diff --git a/app/SysTray-X/SysTray-X-app/SysTray-X.qrc b/app/SysTray-X/SysTray-X-app/SysTray-X.qrc index 064c2de..13dffbe 100644 --- a/app/SysTray-X/SysTray-X-app/SysTray-X.qrc +++ b/app/SysTray-X/SysTray-X-app/SysTray-X.qrc @@ -20,5 +20,8 @@ languages/SysTray-X.pt-BR.qm files/icons/blank-icon-dark.png files/icons/Thunderbird115.png + files/icons/new-indicator-round.png + files/icons/new-indicator-star-close.png + files/icons/new-indicator-star-open.png diff --git a/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-round.png b/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-round.png new file mode 100644 index 0000000..55bc201 Binary files /dev/null and b/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-round.png differ diff --git a/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-star-close.png b/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-star-close.png new file mode 100644 index 0000000..6b76af3 Binary files /dev/null and b/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-star-close.png differ diff --git a/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-star-open.png b/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-star-open.png new file mode 100644 index 0000000..da0ee7d Binary files /dev/null and b/app/SysTray-X/SysTray-X-app/files/icons/new-indicator-star-open.png differ diff --git a/app/SysTray-X/SysTray-X-app/preferences.cpp b/app/SysTray-X/SysTray-X-app/preferences.cpp index a65948d..17ee1a9 100644 --- a/app/SysTray-X/SysTray-X-app/preferences.cpp +++ b/app/SysTray-X/SysTray-X-app/preferences.cpp @@ -46,6 +46,13 @@ Preferences::Preferences( QObject *parent ) : QObject( parent ) */ m_app_pref_changed = false; + m_minimize_type = PREF_MINIMIZE_METHOD_1; + m_close_type = PREF_MINIMIZE_MAIN_CLOSE_CHILDREN_WINDOWS; + m_minimize_icon_type = PREF_MINIMIZE_TRAY_ICON; + + m_start_minimized = false; + m_restore_window_positions = false; + m_default_icon_type = PREF_DEFAULT_ICON_DEFAULT; m_default_icon_mime = "image/png"; m_default_icon_data = QByteArray(); @@ -55,6 +62,8 @@ Preferences::Preferences( QObject *parent ) : QObject( parent ) m_icon_mime = "image/png"; m_icon_data = QByteArray(); + m_theme = PREF_THEME_LIGHT; + m_show_number = true; m_number_color = "#000000"; m_number_size = 10; @@ -62,12 +71,8 @@ Preferences::Preferences( QObject *parent ) : QObject( parent ) m_startup_delay = 5; m_number_alignment = 4; m_number_margins = QMargins(); - - m_minimize_type = PREF_MINIMIZE_METHOD_1; - m_start_minimized = false; - m_close_type = PREF_MINIMIZE_MAIN_CLOSE_CHILDREN_WINDOWS; - - m_restore_window_positions = false; + m_new_indicator_type = PREF_NEW_INDICATOR_SHADE; + m_new_shade_color = "#80ff8000"; m_debug = false; @@ -79,8 +84,6 @@ Preferences::Preferences( QObject *parent ) : QObject( parent ) m_version_hash = QLatin1String( APP_GITHASH ); m_version_branch = QLatin1String( APP_GITBRANCH ); - m_theme = PREF_THEME_LIGHT; - m_start_app = ""; m_start_app_args = ""; m_close_app = ""; @@ -186,6 +189,172 @@ void Preferences::setBrowserBuildID( const QString buildID ) } +/* + * Get the software version. + */ +QString Preferences::getVersion() const +{ + return m_version_major + "." + m_version_minor + "." + m_version_patch; +} + + +/* + * Get the number of commits. + */ +QString Preferences::getBuild() const +{ + return m_version_build; +} + + +/* + * Get the git hash. + */ +QString Preferences::getHash() const +{ + return m_version_hash; +} + + +/* + * Get the software version. + */ +QString Preferences::getBranch() const +{ + return m_version_branch; +} + + +/* + * Get the minimize type + */ +Preferences::MinimizeType Preferences::getMinimizeType() const +{ + return m_minimize_type; +} + + +/* + * Set the minimize type. + */ +void Preferences::setMinimizeType( MinimizeType minimize_type ) +{ + if( m_minimize_type != minimize_type) + { + m_minimize_type = minimize_type; + + /* + * Tell the world the new preference + */ + emit signalMinimizeTypeChange(); + } +} + + +/* + * Get the close type pref. + */ +Preferences::CloseType Preferences::getCloseType() const +{ + return m_close_type; +} + + +/* + * Set the close type pref. + */ +void Preferences::setCloseType( CloseType close_type ) +{ + if( m_close_type != close_type ) + { + m_close_type = close_type; + + /* + * Tell the world the new preference + */ + emit signalCloseTypeChange(); + } +} + + +/* + * Get the minimize type + */ +Preferences::MinimizeIconType Preferences::getMinimizeIconType() const +{ + return m_minimize_icon_type; +} + + +/* + * Set the minimize type. + */ +void Preferences::setMinimizeIconType( MinimizeIconType minimize_icon_type ) +{ + if( m_minimize_icon_type != minimize_icon_type) + { + m_minimize_icon_type = minimize_icon_type; + + /* + * Tell the world the new preference + */ + emit signalMinimizeIconTypeChange(); + } +} + + +/* + * Get the start minmized pref. + */ +bool Preferences::getStartMinimized() const +{ + return m_start_minimized; +} + + +/* + * Set the start minimized pref. + */ +void Preferences::setStartMinimized( bool state ) +{ + if( m_start_minimized != state ) + { + m_start_minimized = state; + + /* + * Tell the world the new preference + */ + emit signalStartMinimizedChange(); + } +} + + +/* + * Get the start minmized pref. + */ +bool Preferences::getRestoreWindowPositions() const +{ + return m_restore_window_positions; +} + + +/* + * Set the start minimized pref. + */ +void Preferences::setRestoreWindowPositions( bool state ) +{ + if( m_restore_window_positions != state ) + { + m_restore_window_positions = state; + + /* + * Tell the world the new preference + */ + emit signalRestoreWindowPositionsChange(); + } +} + + /* * Get the default icon type. */ @@ -354,6 +523,32 @@ void Preferences::setIconData( const QByteArray& icon_data ) } +/* + * 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 enable number state. */ @@ -380,6 +575,84 @@ void Preferences::setShowNumber( bool state ) } +/* + * Get the show new indicator state. + */ +bool Preferences::getShowNewIndicator() const +{ + return m_show_new_indicator; +} + + +/* + * Set the show new indicator state. + */ +void Preferences::setShowNewIndicator( bool state ) +{ + if( m_show_new_indicator != state ) + { + m_show_new_indicator = state; + + /* + * Tell the world the new preference + */ + emit signalShowNewIndicatorChange(); + } +} + + +/* + * Get the count type. + */ +Preferences::CountType Preferences::getCountType() const +{ + return m_count_type; +} + + +/* + * Set the count type. + */ +void Preferences::setCountType( CountType count_type ) +{ + if( m_count_type != count_type) + { + m_count_type = count_type; + + /* + * Tell the world the new preference + */ + emit signalCountTypeChange(); + } +} + + +/* + * Get the startup delay. + */ +int Preferences::getStartupDelay() const +{ + return m_startup_delay; +} + + +/* + * Set the startup delay. + */ +void Preferences::setStartupDelay( int delay ) +{ + if( m_startup_delay != delay ) + { + m_startup_delay = delay; + + /* + * Tell the world the new preference + */ + emit signalStartupDelayChange(); + } +} + + /* * Get the number color. */ @@ -390,7 +663,7 @@ QString Preferences::getNumberColor() const /* - * Set the enable number state. + * Set the number color. */ void Preferences::setNumberColor( QString color ) { @@ -416,7 +689,7 @@ int Preferences::getNumberSize() const /* - * Set the enable number state. + * Set the number size. */ void Preferences::setNumberSize( int size ) { @@ -485,209 +758,53 @@ void Preferences::setNumberMargins( QMargins margins ) /* - * Get the count type. + * Get the new indicator type. */ -Preferences::CountType Preferences::getCountType() const +Preferences::NewIndicatorType Preferences::getNewIndicatorType() const { - return m_count_type; + return m_new_indicator_type; } /* - * Set the count type. + * Set the new indicator type. */ -void Preferences::setCountType( CountType count_type ) +void Preferences::setNewIndicatorType( NewIndicatorType new_indicator_type ) { - if( m_count_type != count_type) + if( m_new_indicator_type != new_indicator_type) { - m_count_type = count_type; + m_new_indicator_type = new_indicator_type; /* * Tell the world the new preference */ - emit signalCountTypeChange(); + emit signalNewIndicatorTypeChange(); } } /* - * Get the startup delay. + * Get the new shade color. */ -int Preferences::getStartupDelay() const +QString Preferences::getNewShadeColor() const { - return m_startup_delay; + return m_new_shade_color; } /* - * Set the startup delay. + * Set the new shade color. */ -void Preferences::setStartupDelay( int delay ) +void Preferences::setNewShadeColor( QString color ) { - if( m_startup_delay != delay ) + if( m_new_shade_color != color ) { - m_startup_delay = delay; + m_new_shade_color = color; /* * Tell the world the new preference */ - emit signalStartupDelayChange(); - } -} - - -/* - * Get the minimize type - */ -Preferences::MinimizeType Preferences::getMinimizeType() const -{ - return m_minimize_type; -} - - -/* - * Set the minimize type. - */ -void Preferences::setMinimizeType( MinimizeType minimize_type ) -{ - if( m_minimize_type != minimize_type) - { - m_minimize_type = minimize_type; - - /* - * Tell the world the new preference - */ - emit signalMinimizeTypeChange(); - } -} - - -/* - * Get the minimize type - */ -Preferences::MinimizeIconType Preferences::getMinimizeIconType() const -{ - return m_minimize_icon_type; -} - - -/* - * Set the minimize type. - */ -void Preferences::setMinimizeIconType( MinimizeIconType minimize_icon_type ) -{ - if( m_minimize_icon_type != minimize_icon_type) - { - m_minimize_icon_type = minimize_icon_type; - - /* - * Tell the world the new preference - */ - emit signalMinimizeIconTypeChange(); - } -} - - -/* - * Get the start minmized pref. - */ -bool Preferences::getStartMinimized() const -{ - return m_start_minimized; -} - - -/* - * Set the start minimized pref. - */ -void Preferences::setStartMinimized( bool state ) -{ - if( m_start_minimized != state ) - { - m_start_minimized = state; - - /* - * Tell the world the new preference - */ - emit signalStartMinimizedChange(); - } -} - - -/* - * Get the start minmized pref. - */ -bool Preferences::getRestoreWindowPositions() const -{ - return m_restore_window_positions; -} - - -/* - * Set the start minimized pref. - */ -void Preferences::setRestoreWindowPositions( bool state ) -{ - if( m_restore_window_positions != state ) - { - m_restore_window_positions = state; - - /* - * Tell the world the new preference - */ - emit signalRestoreWindowPositionsChange(); - } -} - - -/* - * Get the close type pref. - */ -Preferences::CloseType Preferences::getCloseType() const -{ - return m_close_type; -} - - -/* - * Set the close type pref. - */ -void Preferences::setCloseType( CloseType close_type ) -{ - if( m_close_type != close_type ) - { - m_close_type = close_type; - - /* - * Tell the world the new preference - */ - emit signalCloseTypeChange(); - } -} - - -/* - * 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(); + emit signalNewShadeColorChange(); } } @@ -824,39 +941,3 @@ void Preferences::setDebug( bool state ) emit signalDebugChange(); } } - - -/* - * Get the software version. - */ -QString Preferences::getVersion() const -{ - return m_version_major + "." + m_version_minor + "." + m_version_patch; -} - - -/* - * Get the number of commits. - */ -QString Preferences::getBuild() const -{ - return m_version_build; -} - - -/* - * Get the git hash. - */ -QString Preferences::getHash() const -{ - return m_version_hash; -} - - -/* - * Get the software version. - */ -QString Preferences::getBranch() const -{ - return m_version_branch; -} diff --git a/app/SysTray-X/SysTray-X-app/preferences.h b/app/SysTray-X/SysTray-X-app/preferences.h index abaca82..ca09123 100644 --- a/app/SysTray-X/SysTray-X-app/preferences.h +++ b/app/SysTray-X/SysTray-X-app/preferences.h @@ -68,6 +68,11 @@ class Preferences : public QObject PREF_TB_ICON }; + enum Theme { + PREF_THEME_LIGHT = 0, + PREF_THEME_DARK + }; + /* * Count types */ @@ -76,9 +81,13 @@ class Preferences : public QObject PREF_COUNT_NEW }; - enum Theme { - PREF_THEME_LIGHT = 0, - PREF_THEME_DARK + /* + * Indicator types + */ + enum NewIndicatorType { + PREF_NEW_INDICATOR_ROUND = 0, + PREF_NEW_INDICATOR_STAR, + PREF_NEW_INDICATOR_SHADE }; /* @@ -182,6 +191,76 @@ class Preferences : public QObject */ void setBrowserBuildID( const QString buildID ); + /** + * @brief getStartMinimized. Get the start minimized state. + * + * @return The state. + */ + bool getStartMinimized() const; + + /** + * @brief setStartMinimized. Set the start minimized state. + * + * @param state The state. + */ + void setStartMinimized( bool state ); + + /** + * @brief getRestoreWindowPositions. Get the restore window positions state. + * + * @return The state. + */ + bool getRestoreWindowPositions() const; + + /** + * @brief setRestoreWindowPositions. Set the restore window positions state. + * + * @param state The state. + */ + void setRestoreWindowPositions( bool state ); + + /** + * @brief getMinimizeType. Get the minimize type. + * + * @return The minimize type. + */ + MinimizeType getMinimizeType() const; + + /** + * @brief setMinimizeType. Set the minimize type. + * + * @param minimize_type The minimize type. + */ + void setMinimizeType( MinimizeType minimize_type ); + + /** + * @brief getCloseType. Get the close type. + * + * @return The state. + */ + CloseType getCloseType() const; + + /** + * @brief setCloseType. Set the close type. + * + * @param close_type The close type. + */ + void setCloseType( CloseType close_type ); + + /** + * @brief getMinimizeIconType. Get the minimize icon type. + * + * @return The minimize icon type. + */ + MinimizeIconType getMinimizeIconType() const; + + /** + * @brief setMinimizeType. Set the minimize icon type. + * + * @param minimize_icon_type The minimize icon type. + */ + void setMinimizeIconType( MinimizeIconType minimize_icon_type ); + /** * @brief getDefaultIconType. Get the default icon type. * @@ -280,6 +359,20 @@ class Preferences : public QObject */ void setIconData( const QByteArray& icon_data ); + /** + * @brief getTheme. Get the theme state. + * + * @return The state. + */ + Theme getTheme() const; + + /** + * @brief setTheme. Set the theme state. + * + * @param theme The state. + */ + void setTheme( Theme theme ); + /** * @brief getShowNumber. Get the show number state. * @@ -294,6 +387,48 @@ class Preferences : public QObject */ void setShowNumber( bool state ); + /** + * @brief getShowNewIndicator. Get the show new indicator state. + * + * @return The state. + */ + bool getShowNewIndicator() const; + + /** + * @brief setShowNewIndicator. Set the show new indicator state. + * + * @param state The state. + */ + void setShowNewIndicator( bool state ); + + /** + * @brief getCountType. Get the count type. + * + * @return The count type. + */ + CountType getCountType() const; + + /** + * @brief setCountType. Set the count type. + * + * @param count_type The count type. + */ + void setCountType( CountType count_type ); + + /** + * @brief getStartupDelay. Get the startup delay. + * + * @return The delay. + */ + int getStartupDelay() const; + + /** + * @brief setStartupDelay. Set the startup delay. + * + * @param delay The size. + */ + void setStartupDelay( int delay ); + /** * @brief getNumberColor. Get the number color. * @@ -351,116 +486,32 @@ class Preferences : public QObject void setNumberMargins( QMargins margins ); /** - * @brief getCountType. Get the count type. + * @brief getNewIndicatorType. Get the new indicator type. * - * @return The count type. + * @return The new indicator type. */ - CountType getCountType() const; + NewIndicatorType getNewIndicatorType() const; /** - * @brief setCountType. Set the count type. + * @brief setNewIndicatorType. Set the new indicator type. * - * @param count_type The count type. + * @param type The indicator type. */ - void setCountType( CountType count_type ); + void setNewIndicatorType( NewIndicatorType type ); /** - * @brief getStartupDelay. Get the startup delay. + * @brief getNewShadeColor. Get the new shade color. * - * @return The delay. + * @return The color. */ - int getStartupDelay() const; + QString getNewShadeColor() const; /** - * @brief setStartupDelay. Set the startup delay. + * @brief setNewShadeColor. Set the new shade color. * - * @param delay The size. + * @param color The color. */ - void setStartupDelay( int delay ); - - /** - * @brief getMinimizeType. Get the minimize type. - * - * @return The minimize type. - */ - MinimizeType getMinimizeType() const; - - /** - * @brief setMinimizeType. Set the minimize type. - * - * @param minimize_type The minimize type. - */ - void setMinimizeType( MinimizeType minimize_type ); - - /** - * @brief getMinimizeIconType. Get the minimize icon type. - * - * @return The minimize icon type. - */ - MinimizeIconType getMinimizeIconType() const; - - /** - * @brief setMinimizeType. Set the minimize icon type. - * - * @param minimize_icon_type The minimize icon type. - */ - void setMinimizeIconType( MinimizeIconType minimize_icon_type ); - - /** - * @brief getStartMinimized. Get the start minimized state. - * - * @return The state. - */ - bool getStartMinimized() const; - - /** - * @brief setStartMinimized. Set the start minimized state. - * - * @param state The state. - */ - void setStartMinimized( bool state ); - - /** - * @brief getRestoreWindowPositions. Get the restore window positions state. - * - * @return The state. - */ - bool getRestoreWindowPositions() const; - - /** - * @brief setRestoreWindowPositions. Set the restore window positions state. - * - * @param state The state. - */ - void setRestoreWindowPositions( bool state ); - - /** - * @brief getCloseType. Get the close type. - * - * @return The state. - */ - CloseType getCloseType() const; - - /** - * @brief setCloseType. Set the close type. - * - * @param close_type The close type. - */ - void setCloseType( CloseType close_type ); - - /** - * @brief getTheme. Get the theme state. - * - * @return The state. - */ - Theme getTheme() const; - - /** - * @brief setTheme. Set the theme state. - * - * @param theme The state. - */ - void setTheme( Theme theme ); + void setNewShadeColor( QString color ); /** * @brief getStartApp. Get the start application. @@ -574,6 +625,31 @@ class Preferences : public QObject */ void signalBrowserVersion(); + /** + * @brief signalMinimizeTypeChange. Signal a minimize type change. + */ + void signalMinimizeTypeChange(); + + /** + * @brief signalCloseTypeChange. Signal a close type change. + */ + void signalCloseTypeChange(); + + /** + * @brief signalMinimizeIconTypeChange. Signal a minimize icon type change. + */ + void signalMinimizeIconTypeChange(); + + /** + * @brief signalStartMinimizedChange. Signal a start minimized state change. + */ + void signalStartMinimizedChange(); + + /** + * @brief signalRestoreWindowPositionsChange. Signal a restore window positions state change. + */ + void signalRestoreWindowPositionsChange(); + /** * @brief signalDefaultIconTypeChange. Signal a default icon type change. */ @@ -599,11 +675,31 @@ class Preferences : public QObject */ void signalIconDataChange(); + /** + * @brief signalThemeChange. Signal a theme state change. + */ + void signalThemeChange(); + /** * @brief signalShowNumberChange. Signal a show number state change. */ void signalShowNumberChange(); + /** + * @brief signalShowNewIndicatorChange. Signal a show new indicator state change. + */ + void signalShowNewIndicatorChange(); + + /** + * @brief signalCountTypeChange. Signal a count type change. + */ + void signalCountTypeChange(); + + /** + * @brief signalStartupDelayChange. Signal a startup delay change. + */ + void signalStartupDelayChange(); + /** * @brief signalNumberColorChange. Signal a number color change. */ @@ -625,50 +721,20 @@ class Preferences : public QObject void signalNumberMarginsChange(); /** - * @brief signalCountTypeChange. Signal a count type change. + * @brief signalNewIndicatorTypeChange. Signal a new indicator type change. */ - void signalCountTypeChange(); + void signalNewIndicatorTypeChange(); /** - * @brief signalStartupDelayChange. Signal a startup delay change. + * @brief signalNewShadeColorChange. Signal a new shade color change. */ - void signalStartupDelayChange(); - - /** - * @brief signalMinimizeTypeChange. Signal a minimize type change. - */ - void signalMinimizeTypeChange(); - - /** - * @brief signalMinimizeIconTypeChange. Signal a minimize icon type change. - */ - void signalMinimizeIconTypeChange(); - - /** - * @brief signalStartMinimizedChange. Signal a start minimized state change. - */ - void signalStartMinimizedChange(); - - /** - * @brief signalRestoreWindowPositionsChange. Signal a restore window positions state change. - */ - void signalRestoreWindowPositionsChange(); - - /** - * @brief signalCloseTypeChange. Signal a close type change. - */ - void signalCloseTypeChange(); + void signalNewShadeColorChange(); /** * @brief signalDebugChange. Signal a debug state change. */ void signalDebugChange(); - /** - * @brief signalThemeChange. Signal a theme state change. - */ - void signalThemeChange(); - /** * @brief signalStartAppChange. Signal a start application change. */ @@ -711,6 +777,60 @@ class Preferences : public QObject QString m_browser_version; QString m_browser_buildID; + /** + * @brief m_version_major. Major version number. + */ + QString m_version_major; + + /** + * @brief m_version_minor. Minor version number. + */ + QString m_version_minor; + + /** + * @brief m_version_patch. patch version number. + */ + QString m_version_patch; + + /** + * @brief m_version_build. Git commits count. + */ + QString m_version_build; + + /** + * @brief m_version_build. Git hash. + */ + QString m_version_hash; + + /** + * @brief m_version_build. Git branch. + */ + QString m_version_branch; + /** + * @brief m_minimize_type. Selected minimize type. + */ + MinimizeType m_minimize_type; + + /** + * @brief m_close_type. Closing type for TB. + */ + CloseType m_close_type; + + /** + * @brief m_minimize_icon_type. Selected minimize icon type. + */ + MinimizeIconType m_minimize_icon_type; + + /** + * @brief m_start_minimized. Start TB minimized. + */ + bool m_start_minimized; + + /** + * @brief m_restore_window_positions. Force the same window positions on startup as recorded on the last hide. + */ + bool m_restore_window_positions; + /** * @brief m_default_icon_type. Selected icon type. */ @@ -746,11 +866,31 @@ class Preferences : public QObject */ QByteArray m_icon_data; + /** + * @brief m_theme. The theme. + */ + Theme m_theme; + /** * @brief m_show_number. Show number in systray icon. */ bool m_show_number; + /** + * @brief m_show_number. Show number in systray icon. + */ + bool m_show_new_indicator; + + /** + * @brief m_count_type. Selected count type. + */ + CountType m_count_type; + + /** + * @brief m_startup_delay. The startup delay. + */ + int m_startup_delay; + /** * @brief m_number_color. The color of the number in systray icon. */ @@ -772,79 +912,14 @@ class Preferences : public QObject QMargins m_number_margins; /** - * @brief m_count_type. Selected count type. + * @brief m_new_indicator_type. Selected new indicator type. */ - CountType m_count_type; + NewIndicatorType m_new_indicator_type; /** - * @brief m_startup_delay. The startup delay. + * @brief m_new_shade_color. The color of the new shade in systray icon. */ - int m_startup_delay; - - /** - * @brief m_minimize_type. Selected minimize type. - */ - MinimizeType m_minimize_type; - - /** - * @brief m_minimize_icon_type. Selected minimize icon type. - */ - MinimizeIconType m_minimize_icon_type; - - /** - * @brief m_start_minimized. Start TB minimized. - */ - bool m_start_minimized; - - /** - * @brief m_restore_window_positions. Force the same window positions on startup as recorded on the last hide. - */ - bool m_restore_window_positions; - - /** - * @brief m_close_type. Closing type for TB. - */ - CloseType m_close_type; - - /** - * @brief m_debug. Display debug window. - */ - bool m_debug; - - /** - * @brief m_version_major. Major version number. - */ - QString m_version_major; - - /** - * @brief m_version_minor. Minor version number. - */ - QString m_version_minor; - - /** - * @brief m_version_patch. patch version number. - */ - QString m_version_patch; - - /** - * @brief m_version_build. Git commits count. - */ - QString m_version_build; - - /** - * @brief m_version_build. Git hash. - */ - QString m_version_hash; - - /** - * @brief m_version_build. Git branch. - */ - QString m_version_branch; - - /** - * @brief m_theme. The theme. - */ - Theme m_theme; + QString m_new_shade_color; /** * @brief m_start_app @@ -865,6 +940,11 @@ class Preferences : public QObject * @brief m_close_app_args */ QString m_close_app_args; + + /** + * @brief m_debug. Display debug window. + */ + bool m_debug; }; #endif // PREFERENCES_H diff --git a/app/SysTray-X/SysTray-X-app/preferences.ui b/app/SysTray-X/SysTray-X-app/preferences.ui index ff2cb03..e5d5097 100644 --- a/app/SysTray-X/SysTray-X-app/preferences.ui +++ b/app/SysTray-X/SysTray-X-app/preferences.ui @@ -6,7 +6,7 @@ 0 0 - 555 + 463 531 @@ -23,7 +23,7 @@ :/files/icons/SysTray-X.png:/files/icons/SysTray-X.png - + @@ -348,241 +348,7 @@ - - - - Number properties - - - - - - Display unread message count - - - true - - - - - - - - - - - Number color - - - - - - - Qt::NoFocus - - - - - - - - - - - - - - Number size - - - - - - - 1 - - - 999 - - - 10 - - - - - - - - - - - Alignment - - - - - - - 4 - - - - Top left - - - - - Top centre - - - - - Top right - - - - - Middle left - - - - - Middle centre - - - - - Middle right - - - - - Bottom left - - - - - Bottom centre - - - - - Bottom right - - - - - - - - - - - - - - Margins (left, top, right, bottom): - - - - - - - - - 999 - - - - - - - 999 - - - - - - - 999 - - - - - - - 999 - - - - - - - - - - - - - Startup delay - - - - - - - 0 - - - 99 - - - 5 - - - - - - - - - - - - Count type - - - - - - - - Unread - - - true - - - countTypeGroup - - - - - - - New - - - countTypeGroup - - - - - - - - - + Qt::Vertical @@ -595,7 +361,7 @@ - + Theme @@ -824,6 +590,367 @@ + + + Count + + + + + + + + Show message count + + + true + + + + + + + Show new indicator + + + + + + + + + Startup delay + + + + + + + 0 + + + 99 + + + 5 + + + + + + + + + + + Count type + + + + + + + + Unread + + + true + + + countTypeGroup + + + + + + + New + + + countTypeGroup + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Number properties + + + + + + + + Margins (left, top, right, bottom): + + + + + + + + + 999 + + + + + + + 999 + + + + + + + 999 + + + + + + + 999 + + + + + + + + + + + + + + + Number color + + + + + + + Qt::NoFocus + + + + + + + + + + + + + + Number size + + + + + + + 1 + + + 999 + + + 10 + + + + + + + + + + + Alignment + + + + + + + 4 + + + + Top left + + + + + Top centre + + + + + Top right + + + + + Middle left + + + + + Middle centre + + + + + Middle right + + + + + Bottom left + + + + + Bottom centre + + + + + Bottom right + + + + + + + + + + + + + + + New indicator + + + + + + + + Icon round + + + newIndicatorTypeGroup + + + + + + + Icon star + + + newIndicatorTypeGroup + + + + + + + + + Shade + + + true + + + newIndicatorTypeGroup + + + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 104 + + + + + + + + Qt::Vertical + + + + 20 + 64 + + + + + + Apps @@ -1059,12 +1186,13 @@ - - - - - + + + + + + diff --git a/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp b/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp index 3a356cc..c7bb8c2 100644 --- a/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp +++ b/app/SysTray-X/SysTray-X-app/preferencesdialog.cpp @@ -108,6 +108,19 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi m_tmp_default_icon_data = QByteArray(); m_tmp_default_icon_mime = QString(); + /* + * 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 ); + + /* + * Set new indicator button Ids + */ + m_ui->newIndicatorTypeGroup->setId( m_ui->newIconRoundRadioButton, Preferences::PREF_NEW_INDICATOR_ROUND ); + m_ui->newIndicatorTypeGroup->setId( m_ui->newIconStarRadioButton, Preferences::PREF_NEW_INDICATOR_STAR ); + m_ui->newIndicatorTypeGroup->setId( m_ui->newShadeRadioButton, Preferences::PREF_NEW_INDICATOR_SHADE); + /* * Signals and slots */ @@ -115,6 +128,8 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi connect( m_ui->chooseCustomButton, &QPushButton::clicked, this, &PreferencesDialog::slotFileSelect ); connect( m_ui->numberColorPushButton, &QPushButton::clicked, this, &PreferencesDialog::slotColorSelect ); + connect( m_ui->newShadeColorPushButton, &QPushButton::clicked, this, &PreferencesDialog::slotNewShadeColorSelect ); + connect( m_ui->savePushButton, &QPushButton::clicked, this, &PreferencesDialog::slotAccept); connect( m_ui->cancelPushButton, &QPushButton::clicked, this, &PreferencesDialog::slotReject); @@ -136,12 +151,6 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi */ setStartupDelay( m_pref->getStartupDelay() ); - /* - * 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 ); - /* * Set number alignment */ @@ -152,6 +161,11 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi */ setNumberMargins( m_pref->getNumberMargins() ); + /* + * Set new shade color + */ + setNewShadeColor( m_pref->getNewShadeColor() ); + /* * Set the start and close application parameters */ @@ -365,7 +379,16 @@ void PreferencesDialog::setHideDefaultIcon( bool hide ) /* - * Set the enable number state + * Set the theme + */ +void PreferencesDialog::setTheme( Preferences::Theme theme ) +{ + ( m_ui->themeGroup->button( theme ) )->setChecked( true ); +} + + +/* + * Set the show number state */ void PreferencesDialog::setShowNumber( bool state ) { @@ -373,6 +396,33 @@ void PreferencesDialog::setShowNumber( bool state ) } +/* + * Set the show new indicator state + */ +void PreferencesDialog::setShowNewIndicator( bool state ) +{ + m_ui->showNewCheckBox->setChecked( state ); +} + + +/* + * Set the startup delay + */ +void PreferencesDialog::setStartupDelay( int delay ) +{ + m_ui->startupDelaySpinBox->setValue( delay ); +} + + +/* + * Set the count type + */ +void PreferencesDialog::setCountType( Preferences::CountType count_type ) +{ + ( m_ui->countTypeGroup->button( count_type ) )->setChecked( true ); +} + + /* * Set the number color */ @@ -418,29 +468,25 @@ void PreferencesDialog::setNumberMargins( QMargins margins ) /* - * Set the count type + * Set the new indicator type */ -void PreferencesDialog::setCountType( Preferences::CountType count_type ) +void PreferencesDialog::setNewIndicatorType( Preferences::NewIndicatorType new_indicator_type ) { - ( m_ui->countTypeGroup->button( count_type ) )->setChecked( true ); + ( m_ui->newIndicatorTypeGroup->button( new_indicator_type ) )->setChecked( true ); } /* - * Set the startup delay + * Set the new shade color */ -void PreferencesDialog::setStartupDelay( int delay ) +void PreferencesDialog::setNewShadeColor( QString color ) { - m_ui->startupDelaySpinBox->setValue( delay ); -} + m_new_shade_color = color; + QPixmap pixmap( 256, 256 ); + pixmap.fill( QColor( color ) ); -/* - * Set the theme - */ -void PreferencesDialog::setTheme( Preferences::Theme theme ) -{ - ( m_ui->themeGroup->button( theme ) )->setChecked( true ); + m_ui->newShadeColorPushButton->setIcon( QIcon( pixmap ) ); } @@ -506,18 +552,20 @@ void PreferencesDialog::slotAccept() m_pref->setStartMinimized( m_ui->startMinimizedCheckBox->isChecked() ); m_pref->setRestoreWindowPositions( m_ui->restorePositionscheckBox->isChecked() ); m_pref->setCloseType( static_cast< Preferences::CloseType >( m_ui->closeTypeGroup->checkedId() ) ); + Preferences::Theme theme = static_cast< Preferences::Theme >( m_ui->themeGroup->checkedId() ); + m_pref->setTheme( theme ); m_pref->setShowNumber( m_ui->showNumberCheckBox->isChecked() ); - m_pref->setNumberSize( m_ui->numberSizeSpinBox->value() ); - m_pref->setCountType( static_cast< Preferences::CountType >( m_ui->countTypeGroup->checkedId() ) ); + m_pref->setShowNewIndicator( m_ui->showNewCheckBox->isChecked() ); m_pref->setStartupDelay( m_ui->startupDelaySpinBox->value() ); + m_pref->setCountType( static_cast< Preferences::CountType >( m_ui->countTypeGroup->checkedId() ) ); + m_pref->setNumberSize( m_ui->numberSizeSpinBox->value() ); m_pref->setNumberAlignment( m_ui->numberAlignmentComboBox->currentIndex() ); m_pref->setNumberMargins( QMargins( m_ui->numberMarginLeftSpinBox->value(), m_ui->numberMarginTopSpinBox->value(), m_ui->numberMarginRightSpinBox->value(), m_ui->numberMarginBottomSpinBox->value() ) ); - - Preferences::Theme theme = static_cast< Preferences::Theme >( m_ui->themeGroup->checkedId() ); - m_pref->setTheme( theme ); + m_pref->setNewIndicatorType( static_cast< Preferences::NewIndicatorType >( m_ui->newIndicatorTypeGroup->checkedId() ) ); + m_pref->setNewShadeColor( m_new_shade_color ); QString startApp = m_ui->startAppLineEdit->text(); m_pref->setStartApp( startApp ); @@ -583,15 +631,19 @@ void PreferencesDialog::slotReject() setStartMinimized( m_pref->getStartMinimized() ); setRestoreWindowPositions( m_pref->getRestoreWindowPositions() ); setCloseType( m_pref->getCloseType() ); + setTheme( m_pref->getTheme() ); setShowNumber( m_pref->getShowNumber() ); + setShowNewIndicator( m_pref->getShowNewIndicator() ); + setStartupDelay( m_pref->getStartupDelay()); + setCountType( m_pref->getCountType() ); setNumberColor( m_pref->getNumberColor() ); setNumberSize( m_pref->getNumberSize()); - setCountType( m_pref->getCountType() ); - setStartupDelay( m_pref->getStartupDelay()); setNumberAlignment( m_pref->getNumberAlignment() ); setNumberMargins( m_pref->getNumberMargins() ); - setTheme( m_pref->getTheme() ); + setNewIndicatorType( m_pref->getNewIndicatorType() ); + setNewShadeColor( m_pref->getNewShadeColor() ); + setStartApp( m_pref->getStartApp() ); setStartAppArgs( m_pref->getStartAppArgs() ); setCloseApp( m_pref->getCloseApp() ); @@ -651,7 +703,7 @@ void PreferencesDialog::slotDefaultFileSelect() /* - * Handle the colro select button + * Handle the color select button */ void PreferencesDialog::slotColorSelect() { @@ -665,6 +717,21 @@ void PreferencesDialog::slotColorSelect() } +/* + * Handle the new shade color select button + */ +void PreferencesDialog::slotNewShadeColorSelect() +{ + QColor color( m_new_shade_color ); + QColorDialog color_dialog( color ); + + if( color_dialog.exec() ) + { + setNewShadeColor( color_dialog.selectedColor().name() ); + } +} + + /* * Handle the start application button */ @@ -719,6 +786,24 @@ void PreferencesDialog::slotBrowserVersion() } +/* + * Handle the start minimized change signal + */ +void PreferencesDialog::slotStartMinimizedChange() +{ + setStartMinimized( m_pref->getStartMinimized() ); +} + + +/* + * Handle the restore window positions change signal + */ +void PreferencesDialog::slotRestoreWindowPositionsChange() +{ + setRestoreWindowPositions( m_pref->getRestoreWindowPositions() ); +} + + /* * Handle the minimize type change signal */ @@ -737,23 +822,6 @@ void PreferencesDialog::slotMinimizeIconTypeChange() } -/* - * Handle the start minimized change signal - */ -void PreferencesDialog::slotStartMinimizedChange() -{ - setStartMinimized( m_pref->getStartMinimized() ); -} - - -/* - * Handle the restore window positions change signal - */ -void PreferencesDialog::slotRestoreWindowPositionsChange() -{ - setRestoreWindowPositions( m_pref->getRestoreWindowPositions() ); -} - /* * Handle the minimize on close change signal */ @@ -821,7 +889,16 @@ void PreferencesDialog::slotHideDefaultIconChange() /* - * Handle the enable number state change + * Handle the theme change signal + */ +void PreferencesDialog::slotThemeChange() +{ + setTheme( m_pref->getTheme() ); +} + + +/* + * Handle the show number state change */ void PreferencesDialog::slotShowNumberChange() { @@ -829,6 +906,15 @@ void PreferencesDialog::slotShowNumberChange() } +/* + * Handle the show new indicator state change + */ +void PreferencesDialog::slotShowNewIndicatorChange() +{ + setShowNewIndicator( m_pref->getShowNewIndicator() ); +} + + /* * Handle the number color change */ @@ -884,11 +970,20 @@ void PreferencesDialog::slotNumberMarginsChange() /* - * Handle the theme change signal + * Handle the new indicator type change */ -void PreferencesDialog::slotThemeChange() +void PreferencesDialog::slotNewIndicatorTypeChange() { - setTheme( m_pref->getTheme() ); + setNewIndicatorType( m_pref->getNewIndicatorType() ); +} + + +/* + * Handle the new shade color change + */ +void PreferencesDialog::slotNewShadeColorChange() +{ + setNewShadeColor( m_pref->getNewShadeColor() ); } diff --git a/app/SysTray-X/SysTray-X-app/preferencesdialog.h b/app/SysTray-X/SysTray-X-app/preferencesdialog.h index ae20b0e..2c452ac 100644 --- a/app/SysTray-X/SysTray-X-app/preferencesdialog.h +++ b/app/SysTray-X/SysTray-X-app/preferencesdialog.h @@ -146,6 +146,13 @@ class PreferencesDialog : public QDialog */ void setHideDefaultIcon( bool hide ); + /** + * @brief setTheme. Set the theme. + * + * @param theme The theme. + */ + void setTheme( Preferences::Theme theme ); + /** * @brief setShowNumber. Set the show number state. * @@ -153,6 +160,27 @@ class PreferencesDialog : public QDialog */ void setShowNumber( bool state ); + /** + * @brief setShowNewIndicator. Set the show new indicator state. + * + * @param state The state. + */ + void setShowNewIndicator( bool state ); + + /** + * @brief setCountType. Set the count type. + * + * @param count_type The count type. + */ + void setCountType( Preferences::CountType count_type ); + + /** + * @brief setStartupDelay. Set the startup delay. + * + * @param delay The delay. + */ + void setStartupDelay( int size ); + /** * @brief setNumberColor. Set the number color. * @@ -189,25 +217,18 @@ class PreferencesDialog : public QDialog QMargins getNumberMargins() const; /** - * @brief setCountType. Set the count type. + * @brief setNewIndicatorType. Set the count type. * - * @param count_type The count type. + * @param new_indicator_type The new indicator type. */ - void setCountType( Preferences::CountType count_type ); + void setNewIndicatorType( Preferences::NewIndicatorType new_indicator_type ); /** - * @brief setStartupDelay. Set the startup delay. + * @brief setNewShadeColor. Set the new shade color. * - * @param delay The delay. + * @param color The color. */ - void setStartupDelay( int size ); - - /** - * @brief setTheme. Set the theme. - * - * @param theme The theme. - */ - void setTheme( Preferences::Theme theme ); + void setNewShadeColor( QString color ); /** * @brief setStartApp. Set the start application. @@ -314,11 +335,31 @@ class PreferencesDialog : public QDialog */ void slotDefaultIconDataChange(); + /** + * @brief slotThemeChange. Slot for handling theme change. + */ + void slotThemeChange(); + + /** + * @brief slotCountTypeChange. Slot for handling count type change. + */ + void slotCountTypeChange(); + + /** + * @brief slotStartupDelayChange. Slot for handling startup delay change. + */ + void slotStartupDelayChange(); + /** * @brief slotShowNumberChange. Slot for handling show number state change. */ void slotShowNumberChange(); + /** + * @brief slotShowNewIndicatorChange. Slot for handling show new indicator state change. + */ + void slotShowNewIndicatorChange(); + /** * @brief slotNumberColorChange. Slot for handling number color change. */ @@ -340,19 +381,14 @@ class PreferencesDialog : public QDialog void slotNumberMarginsChange(); /** - * @brief slotCountTypeChange. Slot for handling count type change. + * @brief slotNewIndicatorTypeChange. Slot for handling new indicator type change. */ - void slotCountTypeChange(); + void slotNewIndicatorTypeChange(); /** - * @brief slotStartupDelayChange. Slot for handling startup delay change. + * @brief slotNewShadeColorChange. Slot for handling new shade color change. */ - void slotStartupDelayChange(); - - /** - * @brief slotThemeChange. Slot for handling theme change. - */ - void slotThemeChange(); + void slotNewShadeColorChange(); /** * @brief slotStartAppChange. Slot for handling start application change. @@ -401,6 +437,11 @@ class PreferencesDialog : public QDialog */ void slotColorSelect(); + /** + * @brief slotNewShadeColorSelect. Handle the choose new shade color button click. + */ + void slotNewShadeColorSelect(); + /** * @brief slotStartAppSelect. Handle the start application button click. */ @@ -452,6 +493,11 @@ class PreferencesDialog : public QDialog * @brief m_number_color. Temporary storage for the number color. */ QString m_number_color; + + /** + * @brief m_new_shade_color. Temporary storage for the new shade color. + */ + QString m_new_shade_color; }; #endif // PREFERENCESDIALOG_H diff --git a/app/SysTray-X/SysTray-X-app/systrayx.cpp b/app/SysTray-X/SysTray-X-app/systrayx.cpp index 2062616..2883d47 100644 --- a/app/SysTray-X/SysTray-X-app/systrayx.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayx.cpp @@ -121,19 +121,22 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent ) connect( m_preferences, &Preferences::signalHideDefaultIconChange, m_pref_dialog, &PreferencesDialog::slotHideDefaultIconChange ); connect( m_preferences, &Preferences::signalIconTypeChange, m_pref_dialog, &PreferencesDialog::slotIconTypeChange ); connect( m_preferences, &Preferences::signalIconDataChange, m_pref_dialog, &PreferencesDialog::slotIconDataChange ); - connect( m_preferences, &Preferences::signalShowNumberChange, m_pref_dialog, &PreferencesDialog::slotShowNumberChange ); - connect( m_preferences, &Preferences::signalNumberColorChange, m_pref_dialog, &PreferencesDialog::slotNumberColorChange ); - connect( m_preferences, &Preferences::signalNumberSizeChange, m_pref_dialog, &PreferencesDialog::slotNumberSizeChange ); - connect( m_preferences, &Preferences::signalNumberAlignmentChange, m_pref_dialog, &PreferencesDialog::slotNumberAlignmentChange ); - connect( m_preferences, &Preferences::signalNumberMarginsChange, m_pref_dialog, &PreferencesDialog::slotNumberMarginsChange ); - connect( m_preferences, &Preferences::signalCountTypeChange, m_pref_dialog, &PreferencesDialog::slotCountTypeChange ); - connect( m_preferences, &Preferences::signalStartupDelayChange, m_pref_dialog, &PreferencesDialog::slotStartupDelayChange ); connect( m_preferences, &Preferences::signalMinimizeTypeChange, m_pref_dialog, &PreferencesDialog::slotMinimizeTypeChange ); connect( m_preferences, &Preferences::signalMinimizeIconTypeChange, m_pref_dialog, &PreferencesDialog::slotMinimizeIconTypeChange ); 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::signalShowNumberChange, m_pref_dialog, &PreferencesDialog::slotShowNumberChange ); + connect( m_preferences, &Preferences::signalShowNewIndicatorChange, m_pref_dialog, &PreferencesDialog::slotShowNewIndicatorChange ); + connect( m_preferences, &Preferences::signalStartupDelayChange, m_pref_dialog, &PreferencesDialog::slotStartupDelayChange ); + connect( m_preferences, &Preferences::signalCountTypeChange, m_pref_dialog, &PreferencesDialog::slotCountTypeChange ); + connect( m_preferences, &Preferences::signalNumberColorChange, m_pref_dialog, &PreferencesDialog::slotNumberColorChange ); + connect( m_preferences, &Preferences::signalNumberSizeChange, m_pref_dialog, &PreferencesDialog::slotNumberSizeChange ); + connect( m_preferences, &Preferences::signalNumberAlignmentChange, m_pref_dialog, &PreferencesDialog::slotNumberAlignmentChange ); + connect( m_preferences, &Preferences::signalNumberMarginsChange, m_pref_dialog, &PreferencesDialog::slotNumberMarginsChange ); + connect( m_preferences, &Preferences::signalNewIndicatorTypeChange, m_pref_dialog, &PreferencesDialog::slotNewIndicatorTypeChange ); + connect( m_preferences, &Preferences::signalNewShadeColorChange, m_pref_dialog, &PreferencesDialog::slotNewShadeColorChange ); connect( m_preferences, &Preferences::signalStartAppChange, m_pref_dialog, &PreferencesDialog::slotStartAppChange ); connect( m_preferences, &Preferences::signalStartAppArgsChange, m_pref_dialog, &PreferencesDialog::slotStartAppArgsChange ); connect( m_preferences, &Preferences::signalCloseAppChange, m_pref_dialog, &PreferencesDialog::slotCloseAppChange ); @@ -145,19 +148,22 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent ) connect( m_preferences, &Preferences::signalHideDefaultIconChange, m_link, &SysTrayXLink::slotHideDefaultIconChange ); connect( m_preferences, &Preferences::signalIconTypeChange, m_link, &SysTrayXLink::slotIconTypeChange ); connect( m_preferences, &Preferences::signalIconDataChange, m_link, &SysTrayXLink::slotIconDataChange ); - connect( m_preferences, &Preferences::signalShowNumberChange, m_link, &SysTrayXLink::slotShowNumberChange ); - connect( m_preferences, &Preferences::signalNumberColorChange, m_link, &SysTrayXLink::slotNumberColorChange ); - connect( m_preferences, &Preferences::signalNumberSizeChange, m_link, &SysTrayXLink::slotNumberSizeChange ); - connect( m_preferences, &Preferences::signalNumberAlignmentChange, m_link, &SysTrayXLink::slotNumberAlignmentChange ); - connect( m_preferences, &Preferences::signalNumberMarginsChange, m_link, &SysTrayXLink::slotNumberMarginsChange ); - connect( m_preferences, &Preferences::signalCountTypeChange, m_link, &SysTrayXLink::slotCountTypeChange ); connect( m_preferences, &Preferences::signalMinimizeTypeChange, m_link, &SysTrayXLink::slotMinimizeTypeChange ); connect( m_preferences, &Preferences::signalMinimizeIconTypeChange, m_link, &SysTrayXLink::slotMinimizeIconTypeChange ); - connect( m_preferences, &Preferences::signalStartupDelayChange, m_link, &SysTrayXLink::slotStartupDelayChange ); 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::signalShowNumberChange, m_link, &SysTrayXLink::slotShowNumberChange ); + connect( m_preferences, &Preferences::signalShowNewIndicatorChange, m_link, &SysTrayXLink::slotShowNewIndicatorChange ); + connect( m_preferences, &Preferences::signalStartupDelayChange, m_link, &SysTrayXLink::slotStartupDelayChange ); + connect( m_preferences, &Preferences::signalCountTypeChange, m_link, &SysTrayXLink::slotCountTypeChange ); + connect( m_preferences, &Preferences::signalNumberColorChange, m_link, &SysTrayXLink::slotNumberColorChange ); + connect( m_preferences, &Preferences::signalNumberSizeChange, m_link, &SysTrayXLink::slotNumberSizeChange ); + connect( m_preferences, &Preferences::signalNumberAlignmentChange, m_link, &SysTrayXLink::slotNumberAlignmentChange ); + connect( m_preferences, &Preferences::signalNumberMarginsChange, m_link, &SysTrayXLink::slotNumberMarginsChange ); + connect( m_preferences, &Preferences::signalNewIndicatorTypeChange, m_link, &SysTrayXLink::slotNewIndicatorTypeChange ); + connect( m_preferences, &Preferences::signalNewShadeColorChange, m_link, &SysTrayXLink::slotNewShadeColorChange ); connect( m_preferences, &Preferences::signalStartAppChange, m_link, &SysTrayXLink::slotStartAppChange ); connect( m_preferences, &Preferences::signalStartAppArgsChange, m_link, &SysTrayXLink::slotStartAppArgsChange ); connect( m_preferences, &Preferences::signalCloseAppChange, m_link, &SysTrayXLink::slotCloseAppChange ); @@ -204,18 +210,14 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent ) //slotLoadLanguage( "nl" ); //slotLoadLanguage( "pt-BR" ); //slotLoadLanguage( "ru" ); - slotSelectIconObject( false ); + slotSelectIconObject( true ); -<<<<<<< HEAD slotMailCount( 10, 1 ); -======= - slotSetUnreadMail( 10 ); - - m_preferences->setStartApp( "/home/maxime/test.sh" ); - m_preferences->setStartAppArgs( "/home/maxime/startup.txt StartupString" ); - slotStartApp(); ->>>>>>> develop */ +// m_preferences->setStartApp( "/home/maxime/test.sh" ); +// m_preferences->setStartAppArgs( "/home/maxime/startup.txt StartupString" ); +// slotStartApp(); + } @@ -321,12 +323,15 @@ void SysTrayX::showTrayIcon() connect( m_preferences, &Preferences::signalDefaultIconDataChange, m_tray_icon, &SysTrayXIcon::slotDefaultIconDataChange ); connect( m_preferences, &Preferences::signalIconTypeChange, m_tray_icon, &SysTrayXIcon::slotIconTypeChange ); connect( m_preferences, &Preferences::signalIconDataChange, m_tray_icon, &SysTrayXIcon::slotIconDataChange ); + connect( m_preferences, &Preferences::signalThemeChange, m_tray_icon, &SysTrayXIcon::slotThemeChange ); connect( m_preferences, &Preferences::signalShowNumberChange, m_tray_icon, &SysTrayXIcon::slotShowNumberChange ); + connect( m_preferences, &Preferences::signalShowNewIndicatorChange, m_tray_icon, &SysTrayXIcon::slotShowNewIndicatorChange ); connect( m_preferences, &Preferences::signalNumberColorChange, m_tray_icon, &SysTrayXIcon::slotNumberColorChange ); connect( m_preferences, &Preferences::signalNumberSizeChange, m_tray_icon, &SysTrayXIcon::slotNumberSizeChange ); connect( m_preferences, &Preferences::signalNumberAlignmentChange, m_tray_icon, &SysTrayXIcon::slotNumberAlignmentChange ); connect( m_preferences, &Preferences::signalNumberMarginsChange, m_tray_icon, &SysTrayXIcon::slotNumberMarginsChange ); - connect( m_preferences, &Preferences::signalThemeChange, m_tray_icon, &SysTrayXIcon::slotThemeChange ); + connect( m_preferences, &Preferences::signalNewIndicatorTypeChange, m_tray_icon, &SysTrayXIcon::slotNewIndicatorTypeChange ); + connect( m_preferences, &Preferences::signalNewShadeColorChange, m_tray_icon, &SysTrayXIcon::slotNewShadeColorChange ); connect( m_link, &SysTrayXLink::signalMailCount, m_tray_icon, &SysTrayXIcon::slotMailCount ); @@ -358,12 +363,15 @@ void SysTrayX::hideTrayIcon() disconnect( m_preferences, &Preferences::signalDefaultIconDataChange, m_tray_icon, &SysTrayXIcon::slotDefaultIconDataChange ); disconnect( m_preferences, &Preferences::signalIconTypeChange, m_tray_icon, &SysTrayXIcon::slotIconTypeChange ); disconnect( m_preferences, &Preferences::signalIconDataChange, m_tray_icon, &SysTrayXIcon::slotIconDataChange ); + disconnect( m_preferences, &Preferences::signalThemeChange, m_tray_icon, &SysTrayXIcon::slotThemeChange ); disconnect( m_preferences, &Preferences::signalShowNumberChange, m_tray_icon, &SysTrayXIcon::slotShowNumberChange ); + disconnect( m_preferences, &Preferences::signalShowNewIndicatorChange, m_tray_icon, &SysTrayXIcon::slotShowNewIndicatorChange ); disconnect( m_preferences, &Preferences::signalNumberColorChange, m_tray_icon, &SysTrayXIcon::slotNumberColorChange ); disconnect( m_preferences, &Preferences::signalNumberSizeChange, m_tray_icon, &SysTrayXIcon::slotNumberSizeChange ); disconnect( m_preferences, &Preferences::signalNumberAlignmentChange, m_tray_icon, &SysTrayXIcon::slotNumberAlignmentChange ); disconnect( m_preferences, &Preferences::signalNumberMarginsChange, m_tray_icon, &SysTrayXIcon::slotNumberMarginsChange ); - disconnect( m_preferences, &Preferences::signalThemeChange, m_tray_icon, &SysTrayXIcon::slotThemeChange ); + disconnect( m_preferences, &Preferences::signalNewIndicatorTypeChange, m_tray_icon, &SysTrayXIcon::slotNewIndicatorTypeChange ); + disconnect( m_preferences, &Preferences::signalNewShadeColorChange, m_tray_icon, &SysTrayXIcon::slotNewShadeColorChange ); disconnect( m_link, &SysTrayXLink::signalMailCount, m_tray_icon, &SysTrayXIcon::slotMailCount ); @@ -433,12 +441,15 @@ void SysTrayX::showKdeTrayIcon() connect( m_preferences, &Preferences::signalHideDefaultIconChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotHideDefaultIconChange ); connect( m_preferences, &Preferences::signalIconTypeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotIconTypeChange ); connect( m_preferences, &Preferences::signalIconDataChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotIconDataChange ); + connect( m_preferences, &Preferences::signalThemeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotThemeChange ); connect( m_preferences, &Preferences::signalShowNumberChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotShowNumberChange ); + connect( m_preferences, &Preferences::signalShowNewIndicatorChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotShowNewIndicatorChange ); 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::signalNumberAlignmentChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberAlignmentChange ); connect( m_preferences, &Preferences::signalNumberMarginsChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberMarginsChange ); - connect( m_preferences, &Preferences::signalThemeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotThemeChange ); + connect( m_preferences, &Preferences::signalNewIndicatorTypeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNewIndicatorTypeChange ); + connect( m_preferences, &Preferences::signalNewShadeColorChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNewShadeColorChange ); connect( m_link, &SysTrayXLink::signalMailCount, m_kde_tray_icon, &SysTrayXStatusNotifier::slotMailCount ); @@ -469,12 +480,15 @@ void SysTrayX::hideKdeTrayIcon() disconnect( m_preferences, &Preferences::signalHideDefaultIconChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotHideDefaultIconChange ); disconnect( m_preferences, &Preferences::signalIconTypeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotIconTypeChange ); disconnect( m_preferences, &Preferences::signalIconDataChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotIconDataChange ); + disconnect( m_preferences, &Preferences::signalThemeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotThemeChange ); disconnect( m_preferences, &Preferences::signalShowNumberChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotShowNumberChange ); + disconnect( m_preferences, &Preferences::signalShowNewIndicatorChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotShowNewIndicatorChange ); 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::signalNumberAlignmentChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberAlignmentChange ); disconnect( m_preferences, &Preferences::signalNumberMarginsChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNumberMarginsChange ); - disconnect( m_preferences, &Preferences::signalThemeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotThemeChange ); + disconnect( m_preferences, &Preferences::signalNewIndicatorTypeChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNewIndicatorTypeChange ); + disconnect( m_preferences, &Preferences::signalNewShadeColorChange, m_kde_tray_icon, &SysTrayXStatusNotifier::slotNewShadeColorChange ); disconnect( m_link, &SysTrayXLink::signalMailCount, m_kde_tray_icon, &SysTrayXStatusNotifier::slotMailCount ); diff --git a/app/SysTray-X/SysTray-X-app/systrayxicon.cpp b/app/SysTray-X/SysTray-X-app/systrayxicon.cpp index 22b0a8b..f98ca4b 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxicon.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayxicon.cpp @@ -31,12 +31,18 @@ SysTrayXIcon::SysTrayXIcon( SysTrayXLink* link, Preferences* pref, QObject* pare m_unread_mail = 0; m_new_mail = 0; + m_pixmap_clean = QPixmap(); + m_pixmap_count = QPixmap(); + m_image_indicator = QImage(); + m_show_number = m_pref->getShowNumber(); + m_show_new_indicator = m_pref->getShowNewIndicator(); m_number_color = m_pref->getNumberColor(); m_number_size = m_pref->getNumberSize(); m_number_alignment = Qt::AlignHCenter | Qt::AlignVCenter; setNumberAlignment( m_pref->getNumberAlignment() ); m_number_margins = m_pref->getNumberMargins(); + m_new_shade_color = m_pref->getNewShadeColor(); setToolTip( tr( "SysTray-X: Thunderbird add-on companion app" ) ); @@ -56,6 +62,11 @@ void SysTrayXIcon::setDefaultIconType( Preferences::DefaultIconType icon_type */ m_default_icon_type = icon_type; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -91,6 +102,11 @@ void SysTrayXIcon::setDefaultIconData( const QByteArray& icon_data ) */ m_default_icon_data = icon_data; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -111,6 +127,11 @@ void SysTrayXIcon::setIconType( Preferences::IconType icon_type ) */ m_icon_type = icon_type; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -146,6 +167,11 @@ void SysTrayXIcon::setIconData( const QByteArray& icon_data ) */ m_icon_data = icon_data; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -174,6 +200,26 @@ void SysTrayXIcon::showNumber( bool state ) } +/* + * Enable/disable new indicator + */ +void SysTrayXIcon::showNewIndicator( bool state ) +{ + if( m_show_new_indicator != state ) + { + /* + * Store the new value + */ + m_show_new_indicator = state; + + /* + * Render and set a new icon in the tray + */ + renderIcon(); + } +} + + /* * Set number color */ @@ -276,6 +322,50 @@ void SysTrayXIcon::setNumberMargins( QMargins margins ) } +/* + * Set the new indicator type + */ +void SysTrayXIcon::setNewIndicatorType( Preferences::NewIndicatorType new_indicator_type ) +{ + if( m_new_indicator_type != new_indicator_type ) + { + /* + * Store the new value + */ + m_new_indicator_type = new_indicator_type; + + /* + * Set base params + */ + renderBase(); + + /* + * Render and set a new icon in the tray + */ + renderIcon(); + } +} + +/* + * Set new shade color + */ +void SysTrayXIcon::setNewShadeColor( const QString& color ) +{ + if( m_new_shade_color != color ) + { + /* + * Store the new value + */ + m_new_shade_color = color; + + /* + * Render and set a new icon in the tray + */ + renderIcon(); + } +} + + /* * Set the number of unread/new mails */ @@ -297,6 +387,155 @@ void SysTrayXIcon::setMailCount( int unread_mail, int new_mail ) } +/* + * Set the base for rendering + */ +void SysTrayXIcon::renderBase() +{ + /* + * Set the clean icon + */ + switch( m_default_icon_type ) + { + case Preferences::PREF_DEFAULT_ICON_DEFAULT: + { + QString version = m_pref->getBrowserVersion(); + + if( version.section( '.', 0, 0 ).toInt() < 115 ) + { + m_pixmap_clean = QPixmap( ":/files/icons/Thunderbird.png" ); + } + else + { + m_pixmap_clean = QPixmap( ":/files/icons/Thunderbird115.png" ); + } + break; + } + + case Preferences::PREF_DEFAULT_ICON_HIDE: + { + m_pixmap_clean = QPixmap(); + break; + } + + case Preferences::PREF_DEFAULT_ICON_CUSTOM: + { + m_pixmap_clean.loadFromData( m_default_icon_data ); + break; + } + } + + /* + * Set the count icon + */ + switch( m_icon_type ) + { + case Preferences::PREF_BLANK_ICON: + { + Preferences::Theme theme = m_pref->getTheme(); + + if( theme == Preferences::PREF_THEME_LIGHT ) + { + m_pixmap_count = QPixmap( ":/files/icons/blank-icon.png" ); + } + else + { + m_pixmap_count = QPixmap( ":/files/icons/blank-icon-dark.png" ); + } + + break; + } + + case Preferences::PREF_NEWMAIL_ICON: + { + QIcon new_mail = QIcon::fromTheme("mail-unread", QIcon(":/files/icons/mail-unread.png")); + m_pixmap_count = new_mail.pixmap( 256, 256 ); + break; + } + + case Preferences::PREF_CUSTOM_ICON: + { + m_pixmap_count.loadFromData( m_icon_data ); + break; + } + + case Preferences::PREF_NO_ICON: + { + QPixmap lookthrough( 256, 256 ); + lookthrough.fill( Qt::transparent ); + m_pixmap_count = lookthrough; + break; + } + + case Preferences::PREF_TB_ICON: + { + QString version = m_pref->getBrowserVersion(); + + if( version.section( '.', 0, 0 ).toInt() < 115 ) + { + m_pixmap_count = QPixmap( ":/files/icons/Thunderbird.png" ); + } + else + { + m_pixmap_count = QPixmap( ":/files/icons/Thunderbird115.png" ); + } + break; + } + } + + /* + * Set the new indicator + */ + switch( m_pref->getNewIndicatorType() ) + { + case Preferences::PREF_NEW_INDICATOR_ROUND: + { + m_image_indicator = QImage( ":/files/icons/new-indicator-round.png" ); + break; + } + + case Preferences::PREF_NEW_INDICATOR_STAR: + { + m_image_indicator = QImage( ":/files/icons/new-indicator-star-close.png" ); + break; + } + + default: + { + m_image_indicator = QImage(); + break; + } + } +} + + +/* + * Shade the pixmap + */ +void SysTrayXIcon::shade( QPixmap& pixmap ) +{ + QPainter painter( &pixmap ); + painter.setCompositionMode( painter.CompositionMode_Overlay ); + painter.fillRect( pixmap.rect(), QColor( m_new_shade_color ) ); + painter.end(); +} + + +/* + * Indicator on the pixmap + */ +void SysTrayXIcon::indicator( QPixmap& pixmap ) +{ + int size_x = pixmap.width() / 2; + int size_y = pixmap.width() / 2; + QRect topRight( size_x, 0, size_x, size_y ); + + QPainter painter( &pixmap ); + painter.drawImage( topRight, m_image_indicator ); + painter.end(); +} + + /* * Set and render the icon in the system tray */ @@ -316,91 +555,22 @@ void SysTrayXIcon::renderIcon() if( count > 0 ) { - switch( m_icon_type ) - { - case Preferences::PREF_BLANK_ICON: - { - 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; - } - - case Preferences::PREF_NEWMAIL_ICON: - { - QIcon new_mail = QIcon::fromTheme("mail-unread", QIcon(":/files/icons/mail-unread.png")); - pixmap = new_mail.pixmap( 256, 256 ); - break; - } - - case Preferences::PREF_CUSTOM_ICON: - { - pixmap.loadFromData( m_icon_data ); - break; - } - - case Preferences::PREF_NO_ICON: - { - QPixmap lookthrough( 256, 256 ); - lookthrough.fill( Qt::transparent ); - pixmap = lookthrough; - break; - } - - case Preferences::PREF_TB_ICON: - { - QString version = m_pref->getBrowserVersion(); - - if( version.section( '.', 0, 0 ).toInt() < 115 ) - { - pixmap = QPixmap( ":/files/icons/Thunderbird.png" ); - } - else - { - pixmap = QPixmap( ":/files/icons/Thunderbird115.png" ); - } - break; - } - } + pixmap = m_pixmap_count; } else { - switch( m_default_icon_type ) + pixmap = m_pixmap_clean; + } + + if( m_show_new_indicator && m_new_mail > 0 ) + { + if( m_pref->getNewIndicatorType() == Preferences::PREF_NEW_INDICATOR_SHADE ) { - case Preferences::PREF_DEFAULT_ICON_DEFAULT: - { - QString version = m_pref->getBrowserVersion(); - - if( version.section( '.', 0, 0 ).toInt() < 115 ) - { - pixmap = QPixmap( ":/files/icons/Thunderbird.png" ); - } - else - { - pixmap = QPixmap( ":/files/icons/Thunderbird115.png" ); - } - break; - } - - case Preferences::PREF_DEFAULT_ICON_HIDE: - { - pixmap = QPixmap(); - break; - } - - case Preferences::PREF_DEFAULT_ICON_CUSTOM: - { - pixmap.loadFromData( m_default_icon_data ); - break; - } + shade( pixmap ); + } + else + { + indicator( pixmap ); } } @@ -485,7 +655,16 @@ void SysTrayXIcon::slotIconDataChange() /* - * Handle the enable number state change signal + * Handle the theme change signal + */ +void SysTrayXIcon::slotThemeChange() +{ + renderIcon(); +} + + +/* + * Handle the show number state change signal */ void SysTrayXIcon::slotShowNumberChange() { @@ -493,6 +672,15 @@ void SysTrayXIcon::slotShowNumberChange() } +/* + * Handle the show new indicator state change signal + */ +void SysTrayXIcon::slotShowNewIndicatorChange() +{ + showNewIndicator( m_pref->getShowNewIndicator() ); +} + + /* * Handle the number color change signal */ @@ -530,11 +718,20 @@ void SysTrayXIcon::slotNumberMarginsChange() /* - * Handle the theme change signal + * Handle the new indicator type change signal */ -void SysTrayXIcon::slotThemeChange() +void SysTrayXIcon::slotNewIndicatorTypeChange() { - renderIcon(); + setNewIndicatorType( m_pref->getNewIndicatorType() ); +} + + +/* + * Handle the new shade color change signal + */ +void SysTrayXIcon::slotNewShadeColorChange() +{ + setNewShadeColor( m_pref->getNewShadeColor() ); } diff --git a/app/SysTray-X/SysTray-X-app/systrayxicon.h b/app/SysTray-X/SysTray-X-app/systrayxicon.h index d9924e9..406def6 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxicon.h +++ b/app/SysTray-X/SysTray-X-app/systrayxicon.h @@ -82,6 +82,13 @@ class SysTrayXIcon : public QSystemTrayIcon */ void showNumber( bool state ); + /** + * @brief showNewIndicator. Set the show new indicator state. + * + * @param state Show / hide. + */ + void showNewIndicator( bool state ); + /** * @brief setNumberColor. Set the number color. * @@ -110,6 +117,20 @@ class SysTrayXIcon : public QSystemTrayIcon */ void setNumberMargins( QMargins margins ); + /** + * @brief setNewShadeColor. Set the new shade color. + * + * @param color The color. + */ + void setNewShadeColor( const QString& color ); + + /** + * @brief setNewIndicatorType. Set the new indicator type. + * + * @param new_indicator_type The new indicator type + */ + void setNewIndicatorType( Preferences::NewIndicatorType new_indicator_type ); + /** * @brief setMailCount. Set the number of unread/new mails. * @@ -121,7 +142,26 @@ class SysTrayXIcon : public QSystemTrayIcon private: /** - * @brief setIcon. Set a new rendered icon. + * @brief renderBase. Set the base pixmaps for the icon. + */ + void renderBase(); + + /** + * @brief shade. Shade the icon. + * + * @param pixmap Pixmap to shade. + */ + void shade( QPixmap& pixmap ); + + /** + * @brief indicator. Set the new mail indicator. + * + * @param pixmap Pixmap to put the indicator on. + */ + void indicator( QPixmap& pixmap ); + + /** + * @brief renderIcon. Render the icon. */ void renderIcon(); @@ -162,11 +202,21 @@ class SysTrayXIcon : public QSystemTrayIcon */ void slotIconDataChange(); + /** + * @brief slotThemeChange. Slot for handling theme change signals. + */ + void slotThemeChange(); + /** * @brief slotShowNumberChange. Slot for handling show number change signals. */ void slotShowNumberChange(); + /** + * @brief slotShowNewIndicatorChange. Slot for handling show new indicator change signals. + */ + void slotShowNewIndicatorChange(); + /** * @brief slotNumberColorChange. Slot for handling number color change signals. */ @@ -188,9 +238,14 @@ class SysTrayXIcon : public QSystemTrayIcon void slotNumberMarginsChange(); /** - * @brief slotThemeChange. Slot for handling theme change signals. + * @brief slotNewIndicatorTypeChange. Slot for handling new indicator type change signals. */ - void slotThemeChange(); + void slotNewIndicatorTypeChange(); + + /** + * @brief slotNewShadeColorChange. Slot for handling new shade color change signals. + */ + void slotNewShadeColorChange(); private slots: @@ -213,6 +268,21 @@ class SysTrayXIcon : public QSystemTrayIcon */ Preferences* m_pref; + /** + * @brief m_pixmap_count Pixmap to be used when counting. + */ + QPixmap m_pixmap_count; + + /** + * @brief m_pixmap_clean Pixmap to be used when there is no new mail. + */ + QPixmap m_pixmap_clean; + + /** + * @brief m_image_indicator Image to be used as new mail indicator. + */ + QImage m_image_indicator; + /** * @brief m_default_icon_type. Storage for the default icon type. */ @@ -248,6 +318,11 @@ class SysTrayXIcon : public QSystemTrayIcon */ bool m_show_number; + /** + * @brief m_show_new_indicator. Show the new indicator. + */ + bool m_show_new_indicator; + /** * @brief m_number_color. Color of the unread/new mail number. */ @@ -268,6 +343,17 @@ class SysTrayXIcon : public QSystemTrayIcon */ QMargins m_number_margins; + /** + * @brief m_new_indicator_type. Storage for the new indicator type. + */ + Preferences::NewIndicatorType m_new_indicator_type; + + + /** + * @brief m_new_shade_color. Color of the new shade. + */ + QString m_new_shade_color; + /** * @brief m_unread_mail. Storage for the number of unread mails. */ diff --git a/app/SysTray-X/SysTray-X-app/systrayxlink.cpp b/app/SysTray-X/SysTray-X-app/systrayxlink.cpp index f3af352..7a460c8 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxlink.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayxlink.cpp @@ -691,6 +691,16 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref ) m_pref->setShowNumber( show_number ); } + if( pref.contains( "showNewIndicator" ) && pref[ "showNewIndicator" ].isString() ) + { + bool show_new_indicator = pref[ "showNewIndicator" ].toString() == "true"; + + /* + * Store the new show new indicator state + */ + m_pref->setShowNewIndicator( show_new_indicator ); + } + if( pref.contains( "numberColor" ) && pref[ "numberColor" ].isString() ) { QString number_color = pref[ "numberColor" ].toString(); @@ -915,7 +925,9 @@ void SysTrayXLink::EncodePreferences( const Preferences& pref ) prefObject.insert("iconType", QJsonValue::fromVariant( QString::number( pref.getIconType() ) ) ); prefObject.insert("iconMime", QJsonValue::fromVariant( pref.getIconMime() ) ); prefObject.insert("icon", QJsonValue::fromVariant( QString( pref.getIconData().toBase64() ) ) ); + prefObject.insert("theme", QJsonValue::fromVariant( QString::number( pref.getTheme() ) ) ); prefObject.insert("showNumber", QJsonValue::fromVariant( QString( pref.getShowNumber() ? "true" : "false" ) ) ); + prefObject.insert("showNewIndicator", QJsonValue::fromVariant( QString( pref.getShowNewIndicator() ? "true" : "false" ) ) ); prefObject.insert("numberColor", QJsonValue::fromVariant( QString( pref.getNumberColor() ) ) ); prefObject.insert("numberSize", QJsonValue::fromVariant( QString::number( pref.getNumberSize() ) ) ); prefObject.insert("numberAlignment", QJsonValue::fromVariant( QString::number( pref.getNumberAlignment() ) ) ); @@ -929,7 +941,6 @@ void SysTrayXLink::EncodePreferences( const Preferences& pref ) prefObject.insert("numberMargins", marginsObject ); prefObject.insert("countType", QJsonValue::fromVariant( QString::number( pref.getCountType() ) ) ); prefObject.insert("startupDelay", QJsonValue::fromVariant( QString::number( pref.getStartupDelay() ) ) ); - prefObject.insert("theme", QJsonValue::fromVariant( QString::number( pref.getTheme() ) ) ); prefObject.insert("startApp", QJsonValue::fromVariant( pref.getStartApp() ) ); prefObject.insert("startAppArgs", QJsonValue::fromVariant( pref.getStartAppArgs() ) ); @@ -968,9 +979,18 @@ void SysTrayXLink::slotLinkRead( QByteArray message ) /* - * Handle a debug state change signal + * Handle a positions change signal */ -void SysTrayXLink::slotDebugChange() +void SysTrayXLink::slotPositions( QList< QPoint > positions ) +{ + sendPositions( positions ); +} + + +/* + * Handle a restore window positions state change signal + */ +void SysTrayXLink::slotRestoreWindowPositionsChange() { if( m_pref->getAppPrefChanged() ) { @@ -1015,18 +1035,6 @@ void SysTrayXLink::slotStartMinimizedChange() } -/* - * Handle a restore window positions state change signal - */ -void SysTrayXLink::slotRestoreWindowPositionsChange() -{ - if( m_pref->getAppPrefChanged() ) - { - sendPreferences(); - } -} - - /* * Handle a close type change signal */ @@ -1099,6 +1107,18 @@ void SysTrayXLink::slotIconDataChange() } +/* + * Handle a theme change signal + */ +void SysTrayXLink::slotThemeChange() +{ + if( m_pref->getAppPrefChanged() ) + { + sendPreferences(); + } +} + + /* * Handle a show number state change signal */ @@ -1111,6 +1131,42 @@ void SysTrayXLink::slotShowNumberChange() } +/* + * Handle a show new indicator state change signal + */ +void SysTrayXLink::slotShowNewIndicatorChange() +{ + if( m_pref->getAppPrefChanged() ) + { + sendPreferences(); + } +} + + +/* + * Handle the count type change signal + */ +void SysTrayXLink::slotCountTypeChange() +{ + if( m_pref->getAppPrefChanged() ) + { + sendPreferences(); + } +} + + +/* + * Handle a startup delay change signal + */ +void SysTrayXLink::slotStartupDelayChange() +{ + if( m_pref->getAppPrefChanged() ) + { + sendPreferences(); + } +} + + /* * Handle a number color change signal */ @@ -1160,9 +1216,9 @@ void SysTrayXLink::slotNumberMarginsChange() /* - * Handle the count type change signal + * Handle the new indicator type change signal */ -void SysTrayXLink::slotCountTypeChange() +void SysTrayXLink::slotNewIndicatorTypeChange() { if( m_pref->getAppPrefChanged() ) { @@ -1172,30 +1228,9 @@ void SysTrayXLink::slotCountTypeChange() /* - * Handle a startup delay change signal + * Handle the new shade color change signal */ -void SysTrayXLink::slotStartupDelayChange() -{ - if( m_pref->getAppPrefChanged() ) - { - sendPreferences(); - } -} - - -/* - * Handle a positions change signal - */ -void SysTrayXLink::slotPositions( QList< QPoint > positions ) -{ - sendPositions( positions ); -} - - -/* - * Handle a theme change signal - */ -void SysTrayXLink::slotThemeChange() +void SysTrayXLink::slotNewShadeColorChange() { if( m_pref->getAppPrefChanged() ) { @@ -1250,3 +1285,15 @@ void SysTrayXLink::slotCloseAppArgsChange() sendPreferences(); } } + + +/* + * Handle a debug state change signal + */ +void SysTrayXLink::slotDebugChange() +{ + if( m_pref->getAppPrefChanged() ) + { + sendPreferences(); + } +} diff --git a/app/SysTray-X/SysTray-X-app/systrayxlink.h b/app/SysTray-X/SysTray-X-app/systrayxlink.h index bab500e..394f035 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxlink.h +++ b/app/SysTray-X/SysTray-X-app/systrayxlink.h @@ -259,6 +259,16 @@ class SysTrayXLink : public QObject */ void slotDebugChange(); + /** + * @brief slotPositions. Slot for handling a window positions change. + */ + void slotPositions( QList< QPoint > positions ); + + /** + * @brief slotRestoreWindowPositionsChange. Handle a change in restore window positions state. + */ + void slotRestoreWindowPositionsChange(); + /** * @brief slotMinimizeTypeChange. Slot for handling minimize type change signals. */ @@ -274,11 +284,6 @@ class SysTrayXLink : public QObject */ void slotStartMinimizedChange(); - /** - * @brief slotRestoreWindowPositionsChange. Handle a change in restore window positions state. - */ - void slotRestoreWindowPositionsChange(); - /** * @brief slotCloseTypeChange. Slot for handling close type change signals. */ @@ -309,11 +314,31 @@ class SysTrayXLink : public QObject */ void slotIconDataChange(); + /** + * @brief slotThemeChange. Slot for handling theme change signals. + */ + void slotThemeChange(); + /** * @brief slotShowNumberChange. Handle a change in show number state. */ void slotShowNumberChange(); + /** + * @brief slotShowNewIndicatorChange. Handle a change in show new indicator state. + */ + void slotShowNewIndicatorChange(); + + /** + * @brief slotCountTypeChange. Slot for handling count type change signals. + */ + void slotCountTypeChange(); + + /** + * @brief slotStartupDelayChange. Handle a change in startup delay. + */ + void slotStartupDelayChange(); + /** * @brief slotNumberColorChange. Handle a change in number color. */ @@ -335,24 +360,14 @@ class SysTrayXLink : public QObject void slotNumberMarginsChange(); /** - * @brief slotCountTypeChange. Slot for handling count type change signals. + * @brief slotNewIndicatorTypeChange. Slot for handling new indicator type change signals. */ - void slotCountTypeChange(); + void slotNewIndicatorTypeChange(); /** - * @brief slotStartupDelayChange. Handle a change in startup delay. + * @brief slotNewShadeColorChange. Handle a change in new shade color. */ - void slotStartupDelayChange(); - - /** - * @brief slotPositions. Slot for handling a window positions change. - */ - void slotPositions( QList< QPoint > positions ); - - /** - * @brief slotThemeChange. Slot for handling theme change signals. - */ - void slotThemeChange(); + void slotNewShadeColorChange(); /** * @brief slotStartAppChange. Slot for handling start application change signals. diff --git a/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp b/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp index 10f67eb..221a409 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp +++ b/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.cpp @@ -36,12 +36,18 @@ SysTrayXStatusNotifier::SysTrayXStatusNotifier( SysTrayXLink* link, Preferences* m_unread_mail = 0; m_new_mail = 0; + m_pixmap_clean = QPixmap(); + m_pixmap_count = QPixmap(); + m_image_indicator = QImage(); + m_show_number = m_pref->getShowNumber(); + m_show_new_indicator = m_pref->getShowNewIndicator(); m_number_color = m_pref->getNumberColor(); m_number_size = m_pref->getNumberSize(); m_number_alignment = Qt::AlignHCenter | Qt::AlignVCenter; setNumberAlignment( m_pref->getNumberAlignment() ); m_number_margins = m_pref->getNumberMargins(); + m_new_shade_color = m_pref->getNewShadeColor(); /* * Setup notifier @@ -87,6 +93,11 @@ void SysTrayXStatusNotifier::setDefaultIconType( Preferences::DefaultIconType */ m_default_icon_type = icon_type; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -122,6 +133,11 @@ void SysTrayXStatusNotifier::setDefaultIconData( const QByteArray& icon_data */ m_default_icon_data = icon_data; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -157,6 +173,11 @@ void SysTrayXStatusNotifier::setIconType( Preferences::IconType icon_type ) */ m_icon_type = icon_type; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -192,6 +213,11 @@ void SysTrayXStatusNotifier::setIconData( const QByteArray& icon_data ) */ m_icon_data = icon_data; + /* + * Set base params + */ + renderBase(); + /* * Render and set a new icon in the tray */ @@ -220,6 +246,26 @@ void SysTrayXStatusNotifier::showNumber( bool state ) } +/* + * Enable/disable new indicator + */ +void SysTrayXStatusNotifier::showNewIndicator( bool state ) +{ + if( m_show_new_indicator != state ) + { + /* + * Store the new value + */ + m_show_new_indicator = state; + + /* + * Render and set a new icon in the tray + */ + renderIcon(); + } +} + + /* * Set number color */ @@ -322,6 +368,51 @@ void SysTrayXStatusNotifier::setNumberMargins( QMargins margins ) } +/* + * Set the new indicator type + */ +void SysTrayXStatusNotifier::setNewIndicatorType( Preferences::NewIndicatorType new_indicator_type ) +{ + if( m_new_indicator_type != new_indicator_type ) + { + /* + * Store the new value + */ + m_new_indicator_type = new_indicator_type; + + /* + * Set base params + */ + renderBase(); + + /* + * Render and set a new icon in the tray + */ + renderIcon(); + } +} + + +/* + * Set new shade color + */ +void SysTrayXStatusNotifier::setNewShadeColor( const QString& color ) +{ + if( m_new_shade_color != color ) + { + /* + * Store the new value + */ + m_new_shade_color = color; + + /* + * Render and set a new icon in the tray + */ + renderIcon(); + } +} + + /* * Set the number of unread/new mails */ @@ -343,6 +434,154 @@ void SysTrayXStatusNotifier::setMailCount( int unread_mail, int new_mail ) } +/* + * Set the base for rendering + */ +void SysTrayXStatusNotifier::renderBase() +{ + /* + * Set the clean icon + */ + switch( m_default_icon_type ) + { + case Preferences::PREF_DEFAULT_ICON_DEFAULT: + { + QString version = m_pref->getBrowserVersion(); + + if( version.section( '.', 0, 0 ).toInt() < 115 ) + { + m_pixmap_clean = QPixmap( ":/files/icons/Thunderbird.png" ); + } + else + { + m_pixmap_clean = QPixmap( ":/files/icons/Thunderbird115.png" ); + } + break; + } + + case Preferences::PREF_DEFAULT_ICON_HIDE: + { + m_pixmap_clean = QPixmap(); + break; + } + + case Preferences::PREF_DEFAULT_ICON_CUSTOM: + { + m_pixmap_clean.loadFromData( m_default_icon_data ); + break; + } + } + + /* + * Set the count icon + */ + switch( m_icon_type ) + { + case Preferences::PREF_BLANK_ICON: + { + Preferences::Theme theme = m_pref->getTheme(); + + if( theme == Preferences::PREF_THEME_LIGHT ) + { + m_pixmap_count = QPixmap( ":/files/icons/blank-icon.png" ); + } + else + { + m_pixmap_count = QPixmap( ":/files/icons/blank-icon-dark.png" ); + } + break; + } + + case Preferences::PREF_NEWMAIL_ICON: + { + QIcon new_mail = QIcon::fromTheme("mail-unread", QIcon(":/files/icons/mail-unread.png")); + m_pixmap_count = new_mail.pixmap( 256, 256 ); + break; + } + + case Preferences::PREF_CUSTOM_ICON: + { + m_pixmap_count.loadFromData( m_icon_data ); + break; + } + + case Preferences::PREF_NO_ICON: + { + QPixmap lookthrough( 256, 256 ); + lookthrough.fill( Qt::transparent ); + m_pixmap_count = lookthrough; + break; + } + + case Preferences::PREF_TB_ICON: + { + QString version = m_pref->getBrowserVersion(); + + if( version.section( '.', 0, 0 ).toInt() < 115 ) + { + m_pixmap_count = QPixmap( ":/files/icons/Thunderbird.png" ); + } + else + { + m_pixmap_count = QPixmap( ":/files/icons/Thunderbird115.png" ); + } + break; + } + } + + /* + * Set the new indicator + */ + switch( m_new_indicator_type ) + { + case Preferences::PREF_NEW_INDICATOR_ROUND: + { + m_image_indicator = QImage( ":/files/icons/new-indicator-round.png" ); + break; + } + + case Preferences::PREF_NEW_INDICATOR_STAR: + { + m_image_indicator = QImage( ":/files/icons/new-indicator-star-close.png" ); + break; + } + + default: + { + m_image_indicator = QImage(); + break; + } + } +} + + +/* + * Shade the pixmap + */ +void SysTrayXStatusNotifier::shade( QPixmap& pixmap ) +{ + QPainter painter( &pixmap ); + painter.setCompositionMode( painter.CompositionMode_Overlay ); + painter.fillRect( pixmap.rect(), QColor( m_new_shade_color ) ); + painter.end(); +} + + +/* + * Indicator on the pixmap + */ +void SysTrayXStatusNotifier::indicator( QPixmap& pixmap ) +{ + int size_x = pixmap.width() / 2; + int size_y = pixmap.width() / 2; + QRect topRight( size_x, 0, size_x, size_y ); + + QPainter painter( &pixmap ); + painter.drawImage( topRight, m_image_indicator ); + painter.end(); +} + + /* * Set and render the icon in the system tray */ @@ -362,90 +601,22 @@ void SysTrayXStatusNotifier::renderIcon() if( count > 0 ) { - switch( m_icon_type ) - { - case Preferences::PREF_BLANK_ICON: - { - 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; - } - - case Preferences::PREF_NEWMAIL_ICON: - { - QIcon new_mail = QIcon::fromTheme("mail-unread", QIcon(":/files/icons/mail-unread.png")); - pixmap = new_mail.pixmap( 256, 256 ); - break; - } - - case Preferences::PREF_CUSTOM_ICON: - { - pixmap.loadFromData( m_icon_data ); - break; - } - - case Preferences::PREF_NO_ICON: - { - QPixmap lookthrough( 256, 256 ); - lookthrough.fill( Qt::transparent ); - pixmap = lookthrough; - break; - } - - case Preferences::PREF_TB_ICON: - { - QString version = m_pref->getBrowserVersion(); - - if( version.section( '.', 0, 0 ).toInt() < 115 ) - { - pixmap = QPixmap( ":/files/icons/Thunderbird.png" ); - } - else - { - pixmap = QPixmap( ":/files/icons/Thunderbird115.png" ); - } - break; - } - } + pixmap = m_pixmap_count; } else { - switch( m_default_icon_type ) + pixmap = m_pixmap_clean; + } + + if( m_show_new_indicator && m_new_mail > 0 ) + { + if( m_pref->getNewIndicatorType() == Preferences::PREF_NEW_INDICATOR_SHADE ) { - case Preferences::PREF_DEFAULT_ICON_DEFAULT: - { - QString version = m_pref->getBrowserVersion(); - - if( version.section( '.', 0, 0 ).toInt() < 115 ) - { - pixmap = QPixmap( ":/files/icons/Thunderbird.png" ); - } - else - { - pixmap = QPixmap( ":/files/icons/Thunderbird115.png" ); - } - break; - } - - case Preferences::PREF_DEFAULT_ICON_HIDE: - { - pixmap = QPixmap(); - break; - } - - case Preferences::PREF_DEFAULT_ICON_CUSTOM: - { - pixmap.loadFromData( m_default_icon_data ); - break; - } + shade( pixmap ); + } + else + { + indicator( pixmap ); } } @@ -560,7 +731,16 @@ void SysTrayXStatusNotifier::slotIconDataChange() /* - * Handle the enable number state change signal + * Handle the theme change signal + */ +void SysTrayXStatusNotifier::slotThemeChange() +{ + renderIcon(); +} + + +/* + * Handle the show number state change signal */ void SysTrayXStatusNotifier::slotShowNumberChange() { @@ -568,6 +748,15 @@ void SysTrayXStatusNotifier::slotShowNumberChange() } +/* + * Handle the show new indicator state change signal + */ +void SysTrayXStatusNotifier::slotShowNewIndicatorChange() +{ + showNewIndicator( m_pref->getShowNewIndicator() ); +} + + /* * Handle the number color change signal */ @@ -605,11 +794,20 @@ void SysTrayXStatusNotifier::slotNumberMarginsChange() /* - * Handle the theme change signal + * Handle the new indicator type change signal */ -void SysTrayXStatusNotifier::slotThemeChange() +void SysTrayXStatusNotifier::slotNewIndicatorTypeChange() { - renderIcon(); + setNewIndicatorType( m_pref->getNewIndicatorType() ); +} + + +/* + * Handle the new shade color change signal + */ +void SysTrayXStatusNotifier::slotNewShadeColorChange() +{ + setNewShadeColor( m_pref->getNewShadeColor() ); } diff --git a/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.h b/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.h index df6f465..88829f3 100644 --- a/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.h +++ b/app/SysTray-X/SysTray-X-app/systrayxstatusnotifier.h @@ -14,6 +14,8 @@ * Qt includes */ #include +#include +#include /* * Predefines @@ -93,6 +95,13 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem */ void showNumber( bool state ); + /** + * @brief showNewIndicator. Set the show new indicator state. + * + * @param state Show / hide. + */ + void showNewIndicator( bool state ); + /** * @brief setNumberColor. Set the number color. * @@ -121,6 +130,20 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem */ void setNumberMargins( QMargins margins ); + /** + * @brief setNewIndicatorType. Set the new indicator type. + * + * @param new_indicator_type The new indicator type. + */ + void setNewIndicatorType( Preferences::NewIndicatorType new_indicator_type ); + + /** + * @brief setNewShadeColor. Set the new shade color. + * + * @param color The color. + */ + void setNewShadeColor( const QString& color ); + /** * @brief setMailCount. Set the number of unread/new mails. * @@ -131,6 +154,25 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem private: + /** + * @brief renderBase. Set the base pixmaps for the icon. + */ + void renderBase(); + + /** + * @brief shade. Shade a pixmap + * + * @param pixmap Pixmap to shade. + */ + void shade( QPixmap& pixmap ); + + /** + * @brief indicator. Add a new indicator to the icon. + * + * @param pixmap Pixmap to alter. + */ + void indicator( QPixmap& pixmap ); + /** * @brief setIcon. Set a new rendered icon. */ @@ -183,11 +225,21 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem */ void slotIconDataChange(); + /** + * @brief slotThemeChange. Slot for handling theme change signals. + */ + void slotThemeChange(); + /** * @brief slotShowNumberChange. Slot for handling show number change signals. */ void slotShowNumberChange(); + /** + * @brief slotShowNewIndicatorChange. Slot for handling show new indicator change signals. + */ + void slotShowNewIndicatorChange(); + /** * @brief slotNumberColorChange. Slot for handling number color change signals. */ @@ -209,9 +261,14 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem void slotNumberMarginsChange(); /** - * @brief slotThemeChange. Slot for handling theme change signals. + * @brief slotNewIndicatorTypeChange. Slot for handling new indicator type change signals. */ - void slotThemeChange(); + void slotNewIndicatorTypeChange(); + + /** + * @brief slotNewShadeColorChange. Slot for handling new shade color change signals. + */ + void slotNewShadeColorChange(); private slots: @@ -242,6 +299,21 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem */ Preferences* m_pref; + /** + * @brief m_pixmap_count Pixmap to be used when counting. + */ + QPixmap m_pixmap_count; + + /** + * @brief m_pixmap_clean Pixmap to be used when there is no new mail. + */ + QPixmap m_pixmap_clean; + + /** + * @brief m_image_indicator Image to be used as new mail indicator. + */ + QImage m_image_indicator; + /** * @brief m_default_icon_type. Storage for the default icon type. */ @@ -282,6 +354,11 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem */ bool m_show_number; + /** + * @brief m_show_new_indicator. Show the new indicator. + */ + bool m_show_new_indicator; + /** * @brief m_number_color. Color of the unread/new mail number. */ @@ -302,6 +379,16 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem */ QMargins m_number_margins; + /** + * @brief m_new_indicator_type. The new indicator type. + */ + Preferences::NewIndicatorType m_new_indicator_type; + + /** + * @brief m_new_shade_color. Color of the new shade. + */ + QString m_new_shade_color; + /** * @brief m_unread_mail. Storage for the number of unread mails. */ diff --git a/webext/_locales/en-US/messages.json b/webext/_locales/en-US/messages.json index 48e9fc7..c1d8598 100644 --- a/webext/_locales/en-US/messages.json +++ b/webext/_locales/en-US/messages.json @@ -34,6 +34,11 @@ "description": "Tab for Icon options" }, + "tab_count": { + "message": "Count", + "description": "Tab for Count options" + }, + "tab_apps": { "message": "Apps", "description": "Tab for Apps options" @@ -204,11 +209,6 @@ "description": "Caption for Number options" }, - "icons_number_display": { - "message": "Display unread message count", - "description": "Display the number" - }, - "icons_number_color": { "message": "Number color:", "description": "Color of the number" @@ -274,21 +274,6 @@ "description": "Number margins (left, top, right, bottom)" }, - "icons_number_count_type": { - "message": "Message count type:", - "description": "Count type options" - }, - - "icons_number_count_unread": { - "message": "Unread", - "description": "Count unread mails" - }, - - "icons_number_count_new": { - "message": "New", - "description": "Count new mails" - }, - "icons_startup_delay": { "message": "Startup delay", "description": "Startup delay" @@ -309,6 +294,40 @@ "description": "The dark theme" }, + "count": { + "message": "Count", + "description": "Title for Count options" + }, + + "count_number_display": { + "message": "Show unread message count", + "description": "Show the new message count" + }, + + "count_new_indicator_display": { + "message": "Show new indicator", + "description": "Show the new message indicator" + }, + + + + "count_number_count_type": { + "message": "Message count type:", + "description": "Count type options" + }, + + "count_number_count_unread": { + "message": "Unread", + "description": "Count unread mails" + }, + + "count_number_count_new": { + "message": "New", + "description": "Count new mails" + }, + + + "apps": { "message": "Apps", "description": "Title for Apps options" diff --git a/webext/background.js b/webext/background.js index f3fdbf2..1441523 100644 --- a/webext/background.js +++ b/webext/background.js @@ -561,6 +561,7 @@ SysTrayX.Messaging = { "iconMime", "icon", "showNumber", + "showNewIndicator", "numberColor", "numberSize", "numberAlignment", @@ -594,6 +595,7 @@ SysTrayX.Messaging = { const iconMime = result.iconMime || "image/png"; const icon = result.icon || []; const showNumber = result.showNumber || "true"; + const showNewIndicator = result.showNewIndicator || "true"; let numberColor = result.numberColor || "#000000"; const numberSize = result.numberSize || "10"; const numberAlignment = result.numberAlignment || "4"; @@ -634,6 +636,7 @@ SysTrayX.Messaging = { iconMime, icon, showNumber, + showNewIndicator, numberColor, numberSize, numberAlignment, @@ -773,6 +776,13 @@ SysTrayX.Link = { }); } + const showNewIndicator = response["preferences"].showNewIndicator; + if (showNewIndicator) { + await storage().set({ + showNewIndicator: showNewIndicator, + }); + } + const numberColor = response["preferences"].numberColor; if (numberColor) { await storage().set({ diff --git a/webext/options.html b/webext/options.html index 9139e0f..362e16d 100644 --- a/webext/options.html +++ b/webext/options.html @@ -29,6 +29,7 @@
+ @@ -337,19 +338,6 @@ __MSG_icons_number_options__ - - -
- - -
- - - -   - @@ -443,22 +431,6 @@ /> - - - - - - - - -   @@ -513,6 +485,56 @@
+
+
+

__MSG_count__

+ + + +
+ + +
+ + +
+ + +
+ + + +   + + + + + + + + + + + + + + + + +
+
+

__MSG_apps__

diff --git a/webext/options.js b/webext/options.js index 7f8cedd..7489176 100644 --- a/webext/options.js +++ b/webext/options.js @@ -203,7 +203,7 @@ SysTrayX.SaveOptions = { }); // - // Save enable number state + // Save show number state // const showNumber = document.querySelector( 'input[name="showNumber"]' @@ -212,6 +212,16 @@ SysTrayX.SaveOptions = { showNumber: `${showNumber}`, }); + // + // Save show new indicator state + // + const showNewIndicator = document.querySelector( + 'input[name="showNewIndicator"]' + ).checked; + await storage().set({ + showNewIndicator: `${showNewIndicator}`, + }); + // // Save theme preferences // @@ -454,7 +464,7 @@ SysTrayX.RestoreOptions = { ); // - // Restore enable number state + // Restore show number state // await storage() .get("showNumber") @@ -463,6 +473,16 @@ SysTrayX.RestoreOptions = { SysTrayX.RestoreOptions.onShowNumberError ); + // + // Restore show new indicator state + // + await storage() + .get("showNewIndicator") + .then( + SysTrayX.RestoreOptions.setShowNewIndicator, + SysTrayX.RestoreOptions.onShowNewIndicatorError + ); + // // Restore number color // @@ -830,7 +850,7 @@ SysTrayX.RestoreOptions = { }, // - // Restore enable number state + // Restore show number state // setShowNumber: function (result) { const showNumber = result.showNumber || "true"; @@ -843,6 +863,20 @@ SysTrayX.RestoreOptions = { console.log(`showNumber Error: ${error}`); }, + // + // Restore show new indicator state + // + setShowNewIndicator: function (result) { + const showNewIndicator = result.showNewIndicator || "true"; + + const checkbox = document.querySelector(`input[name="showNewIndicator"]`); + checkbox.checked = showNewIndicator === "true"; + }, + + onShowNewIndicatorError: function (error) { + console.log(`showNewIndicator Error: ${error}`); + }, + // // Restore number color // @@ -1209,6 +1243,11 @@ SysTrayX.StorageChanged = { showNumber: changes[item].newValue, }); } + if (item === "showNewIndicator") { + SysTrayX.RestoreOptions.setShowNewIndicator({ + showNewIndicator: changes[item].newValue, + }); + } if (item === "numberColor") { SysTrayX.RestoreOptions.setNumberColor({ numberColor: changes[item].newValue,