2019-03-08 18:03:27 +01:00
|
|
|
#include "headers/apptheme.h"
|
|
|
|
|
|
|
|
AppTheme::AppTheme(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
QVariantMap tmpDarkTheme = {
|
|
|
|
{"backgroundColor", "#2d3037"},
|
|
|
|
|
|
|
|
{"buttonColor", "#202227"},
|
2019-09-22 16:07:41 +02:00
|
|
|
{"buttonPressedColor", "#41454f"},
|
2019-03-08 18:03:27 +01:00
|
|
|
{"buttonBorderColor", "grey"},
|
|
|
|
{"disabledButtonColor", "#555555"},
|
|
|
|
|
|
|
|
{"viewColor", "#202227"},
|
|
|
|
{"menuColor", "#292b32"},
|
|
|
|
|
|
|
|
{"delegate1Color", "#202227"},
|
|
|
|
{"delegate2Color", "#202227"},
|
2019-03-27 22:22:17 +01:00
|
|
|
{"delegateBackgroundColor", "#202227"},
|
|
|
|
{"delegatePressedColor", "#41454f"},
|
2019-03-08 18:03:27 +01:00
|
|
|
|
|
|
|
{"textColor", "#ffffff"},
|
|
|
|
{"textDarkColor", "#232323"},
|
|
|
|
{"disabledTextColor", "#777777"},
|
|
|
|
|
|
|
|
{"sliderColor", "#6ccaf2"},
|
|
|
|
|
2019-09-08 15:08:50 +02:00
|
|
|
{"successColor", "#6bd43b"},
|
|
|
|
{"errorColor", "#e03b2f"},
|
2019-03-08 18:03:27 +01:00
|
|
|
|
|
|
|
{"lineColor", "grey"},
|
|
|
|
|
|
|
|
{"backIcon", "qrc:/graphics/icons/back.png"},
|
2019-03-24 21:31:59 +01:00
|
|
|
{"settIcon", "qrc:/graphics/icons/settings.png"},
|
|
|
|
{"buzzerIcon", "qrc:/graphics/icons/buzzer.png"},
|
|
|
|
{"startpadIcon", "qrc:/graphics/icons/startpad.png"},
|
2019-04-30 23:44:04 +02:00
|
|
|
{"baseStationIcon", "qrc:/graphics/icons/BaseStation.png"},
|
2019-05-31 19:06:04 +02:00
|
|
|
{"profilesIcon", "qrc:/graphics/icons/user.png"},
|
|
|
|
{"confirmIcon", "qrc:/graphics/icons/ok.png"}
|
2019-03-08 18:03:27 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
this->darkTheme = tmpDarkTheme;
|
|
|
|
|
|
|
|
QVariantMap tmpLightTheme = {
|
|
|
|
{"backgroundColor", "white"},
|
|
|
|
|
|
|
|
{"buttonColor", "white"},
|
|
|
|
{"buttonPressedColor", "lightgrey"},
|
|
|
|
{"buttonBorderColor", "grey"},
|
|
|
|
{"disabledButtonColor", "#d5d5d5"},
|
|
|
|
|
|
|
|
{"viewColor", "white"},
|
|
|
|
{"menuColor", "#f8f8f8"},
|
|
|
|
|
|
|
|
{"delegate1Color", "#202227"},
|
|
|
|
{"delegate2Color", "#202227"},
|
2019-03-27 22:22:17 +01:00
|
|
|
{"delegateBackgroundColor", "white"},
|
|
|
|
{"delegatePressedColor", "#dddedf"},
|
2019-03-08 18:03:27 +01:00
|
|
|
|
|
|
|
{"textColor", "black"},
|
|
|
|
{"textDarkColor", "#232323"},
|
|
|
|
{"disabledTextColor", "grey"},
|
|
|
|
|
|
|
|
{"sliderColor", "#6ccaf2"},
|
|
|
|
|
2019-09-08 15:08:50 +02:00
|
|
|
{"successColor", "#60de26"},
|
|
|
|
{"errorColor", "#ff0000"},
|
2019-03-08 18:03:27 +01:00
|
|
|
|
|
|
|
{"lineColor", "grey"},
|
|
|
|
|
|
|
|
{"backIcon", "qrc:/graphics/icons/back_black.png"},
|
2019-03-24 21:31:59 +01:00
|
|
|
{"settIcon", "qrc:/graphics/icons/settings_black.png"},
|
|
|
|
{"buzzerIcon", "qrc:/graphics/icons/buzzer_black.png"},
|
|
|
|
{"startpadIcon", "qrc:/graphics/icons/startpad_black.png"},
|
2019-04-30 23:44:04 +02:00
|
|
|
{"baseStationIcon", "qrc:/graphics/icons/BaseStation_black.png"},
|
2019-05-31 19:06:04 +02:00
|
|
|
{"profilesIcon", "qrc:/graphics/icons/user_black.png"},
|
|
|
|
{"confirmIcon", "qrc:/graphics/icons/ok_black.png"}
|
2019-03-08 18:03:27 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
this->lightTheme = tmpLightTheme;
|
|
|
|
|
|
|
|
QString currentThemeString = pGlobalAppSettings->loadSetting("theme");
|
|
|
|
|
|
|
|
if(currentThemeString == "Light"){
|
|
|
|
this->currentTheme = &this->lightTheme;
|
|
|
|
}
|
|
|
|
else if (currentThemeString == "Dark") {
|
|
|
|
this->currentTheme = &this->darkTheme;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this->currentTheme = &this->lightTheme;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariant AppTheme::getStyle() {
|
|
|
|
return *this->currentTheme;
|
|
|
|
}
|
|
|
|
|
2019-03-24 21:16:16 +01:00
|
|
|
void AppTheme::changeTheme() {
|
2019-03-08 18:03:27 +01:00
|
|
|
QString currentThemeString = pGlobalAppSettings->loadSetting("theme");
|
|
|
|
QString newThemeString = "Light";
|
|
|
|
|
|
|
|
if(currentThemeString == "Light"){
|
|
|
|
this->currentTheme = &this->darkTheme;
|
|
|
|
newThemeString = "Dark";
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (currentThemeString == "Dark") {
|
|
|
|
this->currentTheme = &this->lightTheme;
|
|
|
|
newThemeString = "Light";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
this->currentTheme = &this->lightTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
pGlobalAppSettings->writeSetting("theme", newThemeString);
|
|
|
|
|
|
|
|
emit this->styleChanged();
|
|
|
|
}
|
2019-03-27 22:22:17 +01:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|