diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-30 21:20:49 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-30 13:54:12 -0700 |
commit | 0e9bd27bae00641ce7f2df9dd4d080414b33e3fd (patch) | |
tree | 840308dd34e6572e35100bea19c079c0e699a6f8 | |
parent | ce1629ccce2fef50a48f21ee99825b090274da8a (diff) | |
download | subsurface-0e9bd27bae00641ce7f2df9dd4d080414b33e3fd.tar.gz |
cleanup: don't send values in changed-signals of ThemeInterface
According to the Qt-docs you *may* send the new values in the
NOTIFY signal of Q_PROPERTYs. However, since changes will lead
to a reevaluation of a whole expression, this argument will be
unused. All it does is make the code more verbose and brittle:
What happens if you send the wrong value?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | mobile-widgets/themeinterface.cpp | 37 | ||||
-rw-r--r-- | mobile-widgets/themeinterface.h | 36 |
2 files changed, 37 insertions, 36 deletions
diff --git a/mobile-widgets/themeinterface.cpp b/mobile-widgets/themeinterface.cpp index d76e09aaa..68f9564db 100644 --- a/mobile-widgets/themeinterface.cpp +++ b/mobile-widgets/themeinterface.cpp @@ -72,18 +72,19 @@ void ThemeInterface::set_currentTheme(const QString &theme) m_currentTheme = theme; qPrefDisplay::set_theme(m_currentTheme); update_theme(); - emit currentThemeChanged(theme); + emit currentThemeChanged(); } double ThemeInterface::currentScale() { return qPrefDisplay::mobile_scale(); } + void ThemeInterface::set_currentScale(double newScale) { if (newScale != qPrefDisplay::mobile_scale()) { qPrefDisplay::set_mobile_scale(newScale); - emit currentScaleChanged(qPrefDisplay::mobile_scale()); + emit currentScaleChanged(); } // Set current font size @@ -91,16 +92,16 @@ void ThemeInterface::set_currentScale(double newScale) // adjust all used font sizes m_regularPointSize = m_basePointSize * qPrefDisplay::mobile_scale(); - emit regularPointSizeChanged(m_regularPointSize); + emit regularPointSizeChanged(); m_headingPointSize = m_regularPointSize * 1.2; - emit headingPointSizeChanged(m_headingPointSize); + emit headingPointSizeChanged(); m_smallPointSize = m_regularPointSize * 0.8; - emit smallPointSizeChanged(m_smallPointSize); + emit smallPointSizeChanged(); m_titlePointSize = m_regularPointSize * 1.5; - emit titlePointSizeChanged(m_titlePointSize); + emit titlePointSizeChanged(); } void ThemeInterface::update_theme() @@ -145,16 +146,16 @@ void ThemeInterface::update_theme() m_secondaryTextColor = DARK_SECONDARY_TEXT_COLOR; m_textColor = DARK_TEXT_COLOR; } - emit backgroundColorChanged(m_backgroundColor); - emit contrastAccentColorChanged(m_contrastAccentColor); - emit darkerPrimaryColorChanged(m_darkerPrimaryColor); - emit darkerPrimaryTextColorChanged(m_darkerPrimaryTextColor); - emit drawerColorChanged(m_drawerColor); - emit lightDrawerColorChanged(m_lightDrawerColor); - emit lightPrimaryColorChanged(m_lightPrimaryColor); - emit lightPrimaryTextColorChanged(m_lightPrimaryTextColor); - emit primaryColorChanged(m_primaryColor); - emit primaryTextColorChanged(m_primaryTextColor); - emit secondaryTextColorChanged(m_secondaryTextColor); - emit textColorChanged(m_textColor); + emit backgroundColorChanged(); + emit contrastAccentColorChanged(); + emit darkerPrimaryColorChanged(); + emit darkerPrimaryTextColorChanged(); + emit drawerColorChanged(); + emit lightDrawerColorChanged(); + emit lightPrimaryColorChanged(); + emit lightPrimaryTextColorChanged(); + emit primaryColorChanged(); + emit primaryTextColorChanged(); + emit secondaryTextColorChanged(); + emit textColorChanged(); } diff --git a/mobile-widgets/themeinterface.h b/mobile-widgets/themeinterface.h index 1fb0c8186..e364d74b5 100644 --- a/mobile-widgets/themeinterface.h +++ b/mobile-widgets/themeinterface.h @@ -44,26 +44,26 @@ public slots: void set_currentScale(double); signals: - void backgroundColorChanged(QColor); - void contrastAccentColorChanged(QColor); - void darkerPrimaryColorChanged(QColor); - void darkerPrimaryTextColorChanged(QColor); - void drawerColorChanged(QColor); - void lightDrawerColorChanged(QColor); - void lightPrimaryColorChanged(QColor); - void lightPrimaryTextColorChanged(QColor); - void primaryColorChanged(QColor); - void primaryTextColorChanged(QColor); - void secondaryTextColorChanged(QColor); - void textColorChanged(QColor); + void backgroundColorChanged(); + void contrastAccentColorChanged(); + void darkerPrimaryColorChanged(); + void darkerPrimaryTextColorChanged(); + void drawerColorChanged(); + void lightDrawerColorChanged(); + void lightPrimaryColorChanged(); + void lightPrimaryTextColorChanged(); + void primaryColorChanged(); + void primaryTextColorChanged(); + void secondaryTextColorChanged(); + void textColorChanged(); - void headingPointSizeChanged(double); - void regularPointSizeChanged(double); - void smallPointSizeChanged(double); - void titlePointSizeChanged(double); - void currentScaleChanged(double); + void headingPointSizeChanged(); + void regularPointSizeChanged(); + void smallPointSizeChanged(); + void titlePointSizeChanged(); + void currentScaleChanged(); - void currentThemeChanged(const QString &); + void currentThemeChanged(); private: ThemeInterface() {} |