From 80e4fcfafc62b27e03522583df6e9ad8d303ceab Mon Sep 17 00:00:00 2001 From: dorian Date: Wed, 27 Mar 2019 22:22:17 +0100 Subject: [PATCH] - added function to refresh the theme - added more colors --- headers/apptheme.h | 1 + sources/apptheme.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/headers/apptheme.h b/headers/apptheme.h index 0fd5d29..e2e683b 100644 --- a/headers/apptheme.h +++ b/headers/apptheme.h @@ -25,6 +25,7 @@ signals: public slots: QVariant getStyle(); Q_INVOKABLE void changeTheme(); + Q_INVOKABLE void refreshTheme(); }; #endif // APPTHEME_H diff --git a/sources/apptheme.cpp b/sources/apptheme.cpp index e955b11..81db4fd 100644 --- a/sources/apptheme.cpp +++ b/sources/apptheme.cpp @@ -16,6 +16,8 @@ AppTheme::AppTheme(QObject *parent) : QObject(parent) {"delegate1Color", "#202227"}, {"delegate2Color", "#202227"}, + {"delegateBackgroundColor", "#202227"}, + {"delegatePressedColor", "#41454f"}, {"textColor", "#ffffff"}, {"textDarkColor", "#232323"}, @@ -50,6 +52,8 @@ AppTheme::AppTheme(QObject *parent) : QObject(parent) {"delegate1Color", "#202227"}, {"delegate2Color", "#202227"}, + {"delegateBackgroundColor", "white"}, + {"delegatePressedColor", "#dddedf"}, {"textColor", "black"}, {"textDarkColor", "#232323"}, @@ -109,3 +113,16 @@ void AppTheme::changeTheme() { 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(); +}