mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-05-07 12:36:20 +02:00
Merge branch 'develop' into feature-position
This commit is contained in:
@@ -28,5 +28,6 @@
|
||||
<file>languages/SysTray-X.pt-BR.ts</file>
|
||||
<file>languages/SysTray-X.zh-CN.qm</file>
|
||||
<file>languages/SysTray-X.zh-TW.qm</file>
|
||||
<file>files/icons/blank-icon-dark.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
app/SysTray-X/files/icons/blank-icon-dark.png
Normal file
BIN
app/SysTray-X/files/icons/blank-icon-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -65,6 +65,8 @@ Preferences::Preferences( QObject *parent ) : QObject( parent )
|
||||
m_version_build = QLatin1String( APP_BUILD );
|
||||
m_version_hash = QLatin1String( APP_GITHASH );
|
||||
m_version_branch = QLatin1String( APP_GITBRANCH );
|
||||
|
||||
m_theme = PREF_THEME_LIGHT;
|
||||
}
|
||||
|
||||
|
||||
@@ -528,6 +530,32 @@ void Preferences::setCloseType( CloseType close_type )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the theme pref.
|
||||
*/
|
||||
Preferences::Theme Preferences::getTheme() const
|
||||
{
|
||||
return m_theme;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the theme pref.
|
||||
*/
|
||||
void Preferences::setTheme( Theme theme )
|
||||
{
|
||||
if( m_theme != theme )
|
||||
{
|
||||
m_theme = theme;
|
||||
|
||||
/*
|
||||
* Tell the world the new preference
|
||||
*/
|
||||
emit signalThemeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the debug state.
|
||||
*/
|
||||
|
||||
@@ -63,6 +63,11 @@ class Preferences : public QObject
|
||||
PREF_COUNT_NEW
|
||||
};
|
||||
|
||||
enum Theme {
|
||||
PREF_THEME_LIGHT = 0,
|
||||
PREF_THEME_DARK
|
||||
};
|
||||
|
||||
/*
|
||||
* Window states
|
||||
*/
|
||||
@@ -365,6 +370,20 @@ class Preferences : public QObject
|
||||
*/
|
||||
void setCloseType( CloseType close_type );
|
||||
|
||||
/**
|
||||
* @brief getTheme. Get the theme state.
|
||||
*
|
||||
* @return The state.
|
||||
*/
|
||||
Theme getTheme() const;
|
||||
|
||||
/**
|
||||
* @brief setTheme. Set the theme state.
|
||||
*
|
||||
* @param The state.
|
||||
*/
|
||||
void setTheme( Theme theme );
|
||||
|
||||
/**
|
||||
* @brief getDebug. Get the debug windows state.
|
||||
*
|
||||
@@ -486,6 +505,11 @@ class Preferences : public QObject
|
||||
*/
|
||||
void signalDebugChange();
|
||||
|
||||
/**
|
||||
* @brief signalThemeChange. Signal a theme state change.
|
||||
*/
|
||||
void signalThemeChange();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
@@ -618,6 +642,10 @@ class Preferences : public QObject
|
||||
*/
|
||||
QString m_version_branch;
|
||||
|
||||
/**
|
||||
* @brief m_theme. The theme.
|
||||
*/
|
||||
Theme m_theme;
|
||||
};
|
||||
|
||||
#endif // PREFERENCES_H
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>541</width>
|
||||
<height>664</height>
|
||||
<height>648</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -19,15 +19,15 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<widget class="QGroupBox" name="defaultIconGroupBox">
|
||||
<property name="title">
|
||||
<string>Default icon</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<widget class="QGroupBox" name="iconGroupBox">
|
||||
<property name="title">
|
||||
<string>Icon</string>
|
||||
</property>
|
||||
@@ -112,19 +112,6 @@
|
||||
<string>Mail notification icon</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@@ -256,6 +243,45 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="themeGroupBox">
|
||||
<property name="title">
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="lightRadioButton">
|
||||
<property name="text">
|
||||
<string>Light</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">themeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="darkRadioButton">
|
||||
<property name="text">
|
||||
<string>Dark</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">themeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -264,7 +290,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>113</height>
|
||||
<height>78</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@@ -566,10 +592,11 @@
|
||||
</resources>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="iconTypeGroup"/>
|
||||
<buttongroup name="countTypeGroup"/>
|
||||
<buttongroup name="defaultIconTypeGroup"/>
|
||||
<buttongroup name="minimizeTypeGroup"/>
|
||||
<buttongroup name="closeTypeGroup"/>
|
||||
<buttongroup name="countTypeGroup"/>
|
||||
<buttongroup name="themeGroup"/>
|
||||
<buttongroup name="defaultIconTypeGroup"/>
|
||||
<buttongroup name="iconTypeGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
@@ -118,6 +118,12 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
|
||||
* Set number size
|
||||
*/
|
||||
setNumberSize( m_pref->getNumberSize() );
|
||||
|
||||
/*
|
||||
* Set theme button Ids
|
||||
*/
|
||||
m_ui->themeGroup->setId( m_ui->lightRadioButton, Preferences::PREF_THEME_LIGHT);
|
||||
m_ui->themeGroup->setId( m_ui->darkRadioButton, Preferences::PREF_THEME_DARK );
|
||||
}
|
||||
|
||||
|
||||
@@ -320,6 +326,15 @@ void PreferencesDialog::setCountType( Preferences::CountType count_type )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the theme
|
||||
*/
|
||||
void PreferencesDialog::setTheme( Preferences::Theme theme )
|
||||
{
|
||||
( m_ui->themeGroup->button( theme ) )->setChecked( true );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the accept signal
|
||||
*/
|
||||
@@ -348,10 +363,26 @@ void PreferencesDialog::slotAccept()
|
||||
m_pref->setCloseType( static_cast< Preferences::CloseType >( m_ui->closeTypeGroup->checkedId() ) );
|
||||
|
||||
m_pref->setShowNumber( m_ui->showNumberCheckBox->isChecked() );
|
||||
m_pref->setNumberColor( m_number_color );
|
||||
m_pref->setNumberSize( m_ui->numberSizeSpinBox->value() );
|
||||
m_pref->setCountType( static_cast< Preferences::CountType >( m_ui->countTypeGroup->checkedId() ) );
|
||||
|
||||
Preferences::Theme theme = static_cast< Preferences::Theme >( m_ui->themeGroup->checkedId() );
|
||||
m_pref->setTheme( theme );
|
||||
|
||||
/*
|
||||
* Force different color?
|
||||
*/
|
||||
if( theme == Preferences::PREF_THEME_LIGHT && m_number_color == "#ffffff" )
|
||||
{
|
||||
setNumberColor( "#000000" );
|
||||
}
|
||||
else
|
||||
if( theme == Preferences::PREF_THEME_DARK && m_number_color == "#000000" )
|
||||
{
|
||||
setNumberColor( "#ffffff" );
|
||||
}
|
||||
m_pref->setNumberColor( m_number_color );
|
||||
|
||||
m_pref->setDebug( m_ui->debugWindowCheckBox->isChecked() );
|
||||
|
||||
/*
|
||||
@@ -398,6 +429,8 @@ void PreferencesDialog::slotReject()
|
||||
setNumberSize( m_pref->getNumberSize());
|
||||
setCountType( m_pref->getCountType() );
|
||||
|
||||
setTheme( m_pref->getTheme() );
|
||||
|
||||
setDebug( m_pref->getDebug());
|
||||
}
|
||||
|
||||
@@ -601,3 +634,12 @@ void PreferencesDialog::slotCountTypeChange()
|
||||
{
|
||||
setCountType( m_pref->getCountType() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the theme change signal
|
||||
*/
|
||||
void PreferencesDialog::slotThemeChange()
|
||||
{
|
||||
setTheme( m_pref->getTheme() );
|
||||
}
|
||||
|
||||
@@ -158,6 +158,13 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
void setCountType( Preferences::CountType count_type );
|
||||
|
||||
/**
|
||||
* @brief setTheme. Set the theme.
|
||||
*
|
||||
* @param theme The theme.
|
||||
*/
|
||||
void setTheme( Preferences::Theme theme );
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
@@ -244,6 +251,11 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
void slotCountTypeChange();
|
||||
|
||||
/**
|
||||
* @brief slotThemeChange. Slot for handling theme change.
|
||||
*/
|
||||
void slotThemeChange();
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,6 +123,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
connect( m_preferences, &Preferences::signalStartMinimizedChange, m_pref_dialog, &PreferencesDialog::slotStartMinimizedChange );
|
||||
connect( m_preferences, &Preferences::signalRestoreWindowPositionsChange, m_pref_dialog, &PreferencesDialog::slotRestoreWindowPositionsChange );
|
||||
connect( m_preferences, &Preferences::signalCloseTypeChange, m_pref_dialog, &PreferencesDialog::slotCloseTypeChange );
|
||||
connect( m_preferences, &Preferences::signalThemeChange, m_pref_dialog, &PreferencesDialog::slotThemeChange );
|
||||
connect( m_preferences, &Preferences::signalDebugChange, m_pref_dialog, &PreferencesDialog::slotDebugChange );
|
||||
|
||||
connect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_link, &SysTrayXLink::slotDefaultIconTypeChange );
|
||||
@@ -138,6 +139,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
connect( m_preferences, &Preferences::signalStartMinimizedChange, m_link, &SysTrayXLink::slotStartMinimizedChange );
|
||||
connect( m_preferences, &Preferences::signalRestoreWindowPositionsChange, m_link, &SysTrayXLink::slotRestoreWindowPositionsChange );
|
||||
connect( m_preferences, &Preferences::signalCloseTypeChange, m_link, &SysTrayXLink::slotCloseTypeChange );
|
||||
connect( m_preferences, &Preferences::signalThemeChange, m_link, &SysTrayXLink::slotThemeChange );
|
||||
connect( m_preferences, &Preferences::signalDebugChange, m_link, &SysTrayXLink::slotDebugChange );
|
||||
connect( m_preferences, &Preferences::signalHideDefaultIconChange, this, &SysTrayX::slotSelectIconObjectPref );
|
||||
|
||||
@@ -288,6 +290,7 @@ void SysTrayX::showTrayIcon()
|
||||
connect( m_preferences, &Preferences::signalShowNumberChange, m_tray_icon, &SysTrayXIcon::slotShowNumberChange );
|
||||
connect( m_preferences, &Preferences::signalNumberColorChange, m_tray_icon, &SysTrayXIcon::slotNumberColorChange );
|
||||
connect( m_preferences, &Preferences::signalNumberSizeChange, m_tray_icon, &SysTrayXIcon::slotNumberSizeChange );
|
||||
connect( m_preferences, &Preferences::signalThemeChange, m_tray_icon, &SysTrayXIcon::slotThemeChange );
|
||||
|
||||
connect( m_link, &SysTrayXLink::signalUnreadMail, m_tray_icon, &SysTrayXIcon::slotSetUnreadMail );
|
||||
|
||||
@@ -322,6 +325,7 @@ void SysTrayX::hideTrayIcon()
|
||||
disconnect( m_preferences, &Preferences::signalShowNumberChange, m_tray_icon, &SysTrayXIcon::slotShowNumberChange );
|
||||
disconnect( m_preferences, &Preferences::signalNumberColorChange, m_tray_icon, &SysTrayXIcon::slotNumberColorChange );
|
||||
disconnect( m_preferences, &Preferences::signalNumberSizeChange, m_tray_icon, &SysTrayXIcon::slotNumberSizeChange );
|
||||
disconnect( m_preferences, &Preferences::signalThemeChange, m_tray_icon, &SysTrayXIcon::slotThemeChange );
|
||||
|
||||
disconnect( m_link, &SysTrayXLink::signalUnreadMail, m_tray_icon, &SysTrayXIcon::slotSetUnreadMail );
|
||||
|
||||
@@ -394,6 +398,7 @@ void SysTrayX::showKdeTrayIcon()
|
||||
connect( m_preferences, &Preferences::signalShowNumberChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotShowNumberChange );
|
||||
connect( m_preferences, &Preferences::signalNumberColorChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberColorChange );
|
||||
connect( m_preferences, &Preferences::signalNumberSizeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberSizeChange );
|
||||
connect( m_preferences, &Preferences::signalThemeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotThemeChange );
|
||||
|
||||
connect( m_link, &SysTrayXLink::signalUnreadMail, m_kde_tray_icon, &SysTrayXStatusNotifier::slotSetUnreadMail );
|
||||
|
||||
@@ -427,6 +432,7 @@ void SysTrayX::hideKdeTrayIcon()
|
||||
disconnect( m_preferences, &Preferences::signalShowNumberChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotShowNumberChange );
|
||||
disconnect( m_preferences, &Preferences::signalNumberColorChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberColorChange );
|
||||
disconnect( m_preferences, &Preferences::signalNumberSizeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberSizeChange );
|
||||
disconnect( m_preferences, &Preferences::signalThemeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotThemeChange );
|
||||
|
||||
disconnect( m_link, &SysTrayXLink::signalUnreadMail, m_kde_tray_icon, &SysTrayXStatusNotifier::slotSetUnreadMail );
|
||||
|
||||
|
||||
@@ -240,7 +240,17 @@ void SysTrayXIcon::renderIcon()
|
||||
{
|
||||
case Preferences::PREF_BLANK_ICON:
|
||||
{
|
||||
pixmap = QPixmap( ":/files/icons/blank-icon.png" );
|
||||
Preferences::Theme theme = m_pref->getTheme();
|
||||
|
||||
if( theme == Preferences::PREF_THEME_LIGHT )
|
||||
{
|
||||
pixmap = QPixmap( ":/files/icons/blank-icon.png" );
|
||||
}
|
||||
else
|
||||
{
|
||||
pixmap = QPixmap( ":/files/icons/blank-icon-dark.png" );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -395,6 +405,15 @@ void SysTrayXIcon::slotNumberSizeChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the theme change signal
|
||||
*/
|
||||
void SysTrayXIcon::slotThemeChange()
|
||||
{
|
||||
renderIcon();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle activation of the tray icon
|
||||
*/
|
||||
|
||||
@@ -161,6 +161,11 @@ class SysTrayXIcon : public QSystemTrayIcon
|
||||
*/
|
||||
void slotNumberSizeChange();
|
||||
|
||||
/**
|
||||
* @brief slotThemeChange. Slot for handling theme change signals.
|
||||
*/
|
||||
void slotThemeChange();
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
|
||||
@@ -712,6 +712,16 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref )
|
||||
m_pref->setCloseType( close_type );
|
||||
}
|
||||
|
||||
if( pref.contains( "theme" ) && pref[ "theme" ].isString() )
|
||||
{
|
||||
Preferences::Theme theme = static_cast< Preferences::Theme >( pref[ "theme" ].toString().toInt() );
|
||||
|
||||
/*
|
||||
* Store the new theme
|
||||
*/
|
||||
m_pref->setTheme( theme );
|
||||
}
|
||||
|
||||
if( pref.contains( "debug" ) && pref[ "debug" ].isString() )
|
||||
{
|
||||
bool debug = pref[ "debug" ].toString() == "true";
|
||||
@@ -749,6 +759,7 @@ void SysTrayXLink::EncodePreferences( const Preferences& pref )
|
||||
prefObject.insert("numberColor", QJsonValue::fromVariant( QString( pref.getNumberColor() ) ) );
|
||||
prefObject.insert("numberSize", QJsonValue::fromVariant( QString::number( pref.getNumberSize() ) ) );
|
||||
prefObject.insert("countType", QJsonValue::fromVariant( QString::number( pref.getCountType() ) ) );
|
||||
prefObject.insert("theme", QJsonValue::fromVariant( QString::number( pref.getTheme() ) ) );
|
||||
|
||||
QJsonObject preferencesObject;
|
||||
preferencesObject.insert("preferences", prefObject );
|
||||
@@ -949,7 +960,22 @@ void SysTrayXLink::slotCountTypeChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle a positions change signal
|
||||
*/
|
||||
void SysTrayXLink::slotPositions( QList< QPoint > positions )
|
||||
{
|
||||
sendPositions( positions );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle a theme change signal
|
||||
*/
|
||||
void SysTrayXLink::slotThemeChange()
|
||||
{
|
||||
if( m_pref->getAppPrefChanged() )
|
||||
{
|
||||
sendPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,6 +309,11 @@ class SysTrayXLink : public QObject
|
||||
*/
|
||||
void slotPositions( QList< QPoint > positions );
|
||||
|
||||
/**
|
||||
* @brief slotThemeChange. Slot for handling theme change signals.
|
||||
*/
|
||||
void slotThemeChange();
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
|
||||
@@ -275,7 +275,16 @@ void SysTrayXStatusNotifier::renderIcon()
|
||||
{
|
||||
case Preferences::PREF_BLANK_ICON:
|
||||
{
|
||||
pixmap = QPixmap( ":/files/icons/blank-icon.png" );
|
||||
Preferences::Theme theme = m_pref->getTheme();
|
||||
|
||||
if( theme == Preferences::PREF_THEME_LIGHT )
|
||||
{
|
||||
pixmap = QPixmap( ":/files/icons/blank-icon.png" );
|
||||
}
|
||||
else
|
||||
{
|
||||
pixmap = QPixmap( ":/files/icons/blank-icon-dark.png" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -460,6 +469,15 @@ void SysTrayXStatusNotifier::slotNumberSizeChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the theme change signal
|
||||
*/
|
||||
void SysTrayXStatusNotifier::slotThemeChange()
|
||||
{
|
||||
renderIcon();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle activate request of the notification icon
|
||||
*/
|
||||
|
||||
@@ -182,6 +182,11 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem
|
||||
*/
|
||||
void slotNumberSizeChange();
|
||||
|
||||
/**
|
||||
* @brief slotThemeChange. Slot for handling theme change signals.
|
||||
*/
|
||||
void slotThemeChange();
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
|
||||
@@ -204,6 +204,21 @@
|
||||
"description": "Count new mails"
|
||||
},
|
||||
|
||||
"icons_theme": {
|
||||
"message": "Thema",
|
||||
"description": "The theme"
|
||||
},
|
||||
|
||||
"icons_theme_light": {
|
||||
"message": "Licht",
|
||||
"description": "The light theme"
|
||||
},
|
||||
|
||||
"icons_theme_dark": {
|
||||
"message": "Dunkel",
|
||||
"description": "The dark theme"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"message": "Konten",
|
||||
"description": "Title for Accounts options"
|
||||
|
||||
@@ -204,6 +204,21 @@
|
||||
"description": "Count new mails"
|
||||
},
|
||||
|
||||
"icons_theme": {
|
||||
"message": "θέμα",
|
||||
"description": "The theme"
|
||||
},
|
||||
|
||||
"icons_theme_light": {
|
||||
"message": "φως",
|
||||
"description": "The light theme"
|
||||
},
|
||||
|
||||
"icons_theme_dark": {
|
||||
"message": "σκοτάδι",
|
||||
"description": "The dark theme"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"message": "Λογαριασμοί",
|
||||
"description": "Title for Accounts options"
|
||||
|
||||
@@ -204,6 +204,21 @@
|
||||
"description": "Count new mails"
|
||||
},
|
||||
|
||||
"icons_theme": {
|
||||
"message": "Theme",
|
||||
"description": "The theme"
|
||||
},
|
||||
|
||||
"icons_theme_light": {
|
||||
"message": "Light",
|
||||
"description": "The light theme"
|
||||
},
|
||||
|
||||
"icons_theme_dark": {
|
||||
"message": "Dark",
|
||||
"description": "The dark theme"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"message": "Accounts",
|
||||
"description": "Title for Accounts options"
|
||||
|
||||
@@ -204,6 +204,21 @@
|
||||
"description": "Count new mails"
|
||||
},
|
||||
|
||||
"icons_theme": {
|
||||
"message": "Tema",
|
||||
"description": "The theme"
|
||||
},
|
||||
|
||||
"icons_theme_light": {
|
||||
"message": "Leggero",
|
||||
"description": "The light theme"
|
||||
},
|
||||
|
||||
"icons_theme_dark": {
|
||||
"message": "Scuro",
|
||||
"description": "The dark theme"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"message": "Account",
|
||||
"description": "Title for Accounts options"
|
||||
|
||||
@@ -203,6 +203,21 @@
|
||||
"message": "Nieuw",
|
||||
"description": "Count new mails"
|
||||
},
|
||||
|
||||
"icons_theme": {
|
||||
"message": "Thema",
|
||||
"description": "The theme"
|
||||
},
|
||||
|
||||
"icons_theme_light": {
|
||||
"message": "Licht",
|
||||
"description": "The light theme"
|
||||
},
|
||||
|
||||
"icons_theme_dark": {
|
||||
"message": "Donker",
|
||||
"description": "The dark theme"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"message": "Accounts",
|
||||
|
||||
@@ -204,6 +204,21 @@
|
||||
"description": "Count new mails"
|
||||
},
|
||||
|
||||
"icons_theme": {
|
||||
"message": "Tema",
|
||||
"description": "The theme"
|
||||
},
|
||||
|
||||
"icons_theme_light": {
|
||||
"message": "Claro",
|
||||
"description": "The light theme"
|
||||
},
|
||||
|
||||
"icons_theme_dark": {
|
||||
"message": "Escuro",
|
||||
"description": "The dark theme"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"message": "Contas",
|
||||
"description": "Title for Accounts options"
|
||||
|
||||
@@ -204,6 +204,21 @@
|
||||
"description": "Count new mails"
|
||||
},
|
||||
|
||||
"icons_theme": {
|
||||
"message": "Tема",
|
||||
"description": "The theme"
|
||||
},
|
||||
|
||||
"icons_theme_light": {
|
||||
"message": "светлая",
|
||||
"description": "The light theme"
|
||||
},
|
||||
|
||||
"icons_theme_dark": {
|
||||
"message": "темная",
|
||||
"description": "The dark theme"
|
||||
},
|
||||
|
||||
"accounts": {
|
||||
"message": "Аккаунты",
|
||||
"description": "Title for Accounts options"
|
||||
|
||||
@@ -303,6 +303,7 @@ SysTrayX.Messaging = {
|
||||
"numberColor",
|
||||
"numberSize",
|
||||
"countType",
|
||||
"theme",
|
||||
]);
|
||||
getter.then(this.sendPreferencesStorage, this.onSendPreferecesStorageError);
|
||||
},
|
||||
@@ -320,9 +321,16 @@ SysTrayX.Messaging = {
|
||||
const iconMime = result.iconMime || "image/png";
|
||||
const icon = result.icon || [];
|
||||
const showNumber = result.showNumber || "true";
|
||||
const numberColor = result.numberColor || "#000000";
|
||||
let numberColor = result.numberColor || "#000000";
|
||||
const numberSize = result.numberSize || "10";
|
||||
const countType = result.countType || "0";
|
||||
const theme = result.theme || "0";
|
||||
|
||||
if (theme == "0" && numberColor == "#ffffff") {
|
||||
numberColor = "#000000";
|
||||
} else if (theme == "1" && numberColor == "#000000") {
|
||||
numberColor = "#ffffff";
|
||||
}
|
||||
|
||||
// Send it to the app
|
||||
SysTrayX.Link.postSysTrayXMessage({
|
||||
@@ -342,6 +350,7 @@ SysTrayX.Messaging = {
|
||||
numberColor: numberColor,
|
||||
numberSize: numberSize,
|
||||
countType: countType,
|
||||
theme: theme,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -512,6 +521,13 @@ SysTrayX.Link = {
|
||||
});
|
||||
}
|
||||
|
||||
const theme = response["preferences"].theme;
|
||||
if (theme) {
|
||||
browser.storage.sync.set({
|
||||
theme: theme,
|
||||
});
|
||||
}
|
||||
|
||||
const debug = response["preferences"].debug;
|
||||
if (debug) {
|
||||
browser.storage.sync.set({
|
||||
|
||||
@@ -114,6 +114,14 @@ body {
|
||||
padding: 10px 10px 10px 10px;
|
||||
}
|
||||
|
||||
#themeselect {
|
||||
width: 25em;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
margin: 10px 10px 10px 10px;
|
||||
padding: 10px 10px 10px 10px;
|
||||
}
|
||||
|
||||
ul,
|
||||
#accountsTree {
|
||||
list-style-type: none;
|
||||
|
||||
BIN
webext/icons/blank-icon-dark.png
Normal file
BIN
webext/icons/blank-icon-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -344,6 +344,28 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table id="themeselect">
|
||||
<caption>
|
||||
__MSG_icons_theme__
|
||||
</caption>
|
||||
<tr id="themeLight">
|
||||
<td>
|
||||
<input type="radio" name="theme" id="themeLight" value="0" />
|
||||
<label for="themeLight" id="themeLightlabel"
|
||||
>__MSG_icons_theme_light__</label
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="themeDark">
|
||||
<td>
|
||||
<input type="radio" name="theme" id="themeDark" value="1" />
|
||||
<label for="themeDark" id="themeDarklabel"
|
||||
>__MSG_icons_theme_dark__</label
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<div
|
||||
|
||||
@@ -160,11 +160,29 @@ SysTrayX.SaveOptions = {
|
||||
showNumber: `${showNumber}`,
|
||||
});
|
||||
|
||||
//
|
||||
// Save theme preferences
|
||||
//
|
||||
const theme = document.querySelector('input[name="theme"]:checked').value;
|
||||
|
||||
// Store minimize preferences
|
||||
browser.storage.sync.set({
|
||||
theme: theme,
|
||||
});
|
||||
|
||||
//
|
||||
// Save number color
|
||||
//
|
||||
const numberColor = document.querySelector('input[name="numberColor"]')
|
||||
let numberColor = document.querySelector('input[name="numberColor"]')
|
||||
.value;
|
||||
|
||||
// Force different color?
|
||||
if (theme == "0" && numberColor == "#ffffff") {
|
||||
numberColor = "#000000";
|
||||
} else if (theme == "1" && numberColor == "#000000") {
|
||||
numberColor = "#ffffff";
|
||||
}
|
||||
|
||||
browser.storage.sync.set({
|
||||
numberColor: `${numberColor}`,
|
||||
});
|
||||
@@ -186,6 +204,7 @@ SysTrayX.SaveOptions = {
|
||||
countType: countType,
|
||||
});
|
||||
|
||||
|
||||
// Mark add-on preferences changed
|
||||
browser.storage.sync.set({
|
||||
addonprefchanged: true,
|
||||
@@ -338,6 +357,15 @@ SysTrayX.RestoreOptions = {
|
||||
SysTrayX.RestoreOptions.setCountType,
|
||||
SysTrayX.RestoreOptions.onCountTypeError
|
||||
);
|
||||
|
||||
//
|
||||
// Restore theme
|
||||
//
|
||||
const getTheme = browser.storage.sync.get("theme");
|
||||
getTheme.then(
|
||||
SysTrayX.RestoreOptions.setTheme,
|
||||
SysTrayX.RestoreOptions.onThemeError
|
||||
);
|
||||
},
|
||||
|
||||
//
|
||||
@@ -648,6 +676,22 @@ SysTrayX.RestoreOptions = {
|
||||
console.log(`countType Error: ${error}`);
|
||||
},
|
||||
|
||||
//
|
||||
// Restore theme callbacks
|
||||
//
|
||||
setTheme: function (result) {
|
||||
const theme = result.theme || "0";
|
||||
|
||||
const radioButton = document.querySelector(
|
||||
`input[name="theme"][value="${theme}"]`
|
||||
);
|
||||
radioButton.checked = true;
|
||||
},
|
||||
|
||||
onThemeError: function (error) {
|
||||
console.log(`Theme Error: ${error}`);
|
||||
},
|
||||
|
||||
//
|
||||
// Restore filters callbacks
|
||||
//
|
||||
@@ -806,6 +850,12 @@ SysTrayX.StorageChanged = {
|
||||
startMinimized: changes[item].newValue,
|
||||
});
|
||||
}
|
||||
if (item === "theme") {
|
||||
SysTrayX.RestoreOptions.setTheme({
|
||||
theme: changes[item].newValue,
|
||||
});
|
||||
}
|
||||
|
||||
if (item === "debug") {
|
||||
SysTrayX.RestoreOptions.setDebug({
|
||||
debug: changes[item].newValue,
|
||||
@@ -834,6 +884,7 @@ SysTrayX.StorageChanged = {
|
||||
document.getElementById("iconselect").className = "active";
|
||||
document.getElementById("minimizeselect").className = "active";
|
||||
document.getElementById("closeselect").className = "active";
|
||||
document.getElementById("themeselect").className = "active";
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user