- added function to refresh the theme

- added more colors
This commit is contained in:
Dorian Zedler 2019-03-27 22:22:17 +01:00
parent a6fd19dd73
commit 80e4fcfafc
2 changed files with 18 additions and 0 deletions

View file

@ -25,6 +25,7 @@ signals:
public slots: public slots:
QVariant getStyle(); QVariant getStyle();
Q_INVOKABLE void changeTheme(); Q_INVOKABLE void changeTheme();
Q_INVOKABLE void refreshTheme();
}; };
#endif // APPTHEME_H #endif // APPTHEME_H

View file

@ -16,6 +16,8 @@ AppTheme::AppTheme(QObject *parent) : QObject(parent)
{"delegate1Color", "#202227"}, {"delegate1Color", "#202227"},
{"delegate2Color", "#202227"}, {"delegate2Color", "#202227"},
{"delegateBackgroundColor", "#202227"},
{"delegatePressedColor", "#41454f"},
{"textColor", "#ffffff"}, {"textColor", "#ffffff"},
{"textDarkColor", "#232323"}, {"textDarkColor", "#232323"},
@ -50,6 +52,8 @@ AppTheme::AppTheme(QObject *parent) : QObject(parent)
{"delegate1Color", "#202227"}, {"delegate1Color", "#202227"},
{"delegate2Color", "#202227"}, {"delegate2Color", "#202227"},
{"delegateBackgroundColor", "white"},
{"delegatePressedColor", "#dddedf"},
{"textColor", "black"}, {"textColor", "black"},
{"textDarkColor", "#232323"}, {"textDarkColor", "#232323"},
@ -109,3 +113,16 @@ void AppTheme::changeTheme() {
emit this->styleChanged(); emit this->styleChanged();
} }
void AppTheme::refreshTheme() {
QString currentThemeString = pGlobalAppSettings->loadSetting("theme");
if(currentThemeString == "Light"){
this->currentTheme = &this->lightTheme;
}
else if (currentThemeString == "Dark") {
this->currentTheme = &this->darkTheme;
}
emit this->styleChanged();
}