2020-05-19 09:31:27 +02:00
|
|
|
#include "../headers/scstwappthememanager.h"
|
|
|
|
|
|
|
|
ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
|
|
|
|
{
|
|
|
|
QFontDatabase::addApplicationFont(":/fonts/fa5solid.woff");
|
|
|
|
|
|
|
|
QVariantMap icons = {
|
|
|
|
{"backIcon", "\uf053"},
|
|
|
|
{"settIcon", "\uf013"},
|
|
|
|
{"toppadIcon", "\uf10a"},
|
|
|
|
{"startpadIcon", "\uf3fa"},
|
|
|
|
{"profilesIcon", "\uf007"},
|
|
|
|
{"confirmIcon", "\uf00c"}
|
|
|
|
};
|
|
|
|
|
|
|
|
ScStwAppTheme * lightTheme = new ScStwAppTheme (
|
2020-05-19 12:43:02 +02:00
|
|
|
"Light",
|
2020-05-19 09:31:27 +02:00
|
|
|
{
|
2020-05-19 12:43:02 +02:00
|
|
|
{"background", "white"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"button", "white"},
|
|
|
|
{"buttonPressed", "lightgrey"},
|
|
|
|
{"buttonBorder", "grey"},
|
|
|
|
{"disabledButton", "#d5d5d5"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"view", "white"},
|
|
|
|
{"menu", "#f8f8f8"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"delegate1", "#202227"},
|
|
|
|
{"delegate2", "#202227"},
|
|
|
|
{"delegateBackground", "white"},
|
|
|
|
{"delegatePressed", "#dddedf"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"text", "black"},
|
|
|
|
{"textDark", "#232323"},
|
|
|
|
{"disabledText", "grey"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"slider", "#6ccaf2"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"success", "#60de26"},
|
|
|
|
{"error", "#ff0000"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"line", "grey"},
|
2020-05-19 09:31:27 +02:00
|
|
|
},
|
2020-05-19 12:43:02 +02:00
|
|
|
icons
|
|
|
|
,
|
2020-05-19 09:31:27 +02:00
|
|
|
{
|
|
|
|
{"icons", "Font Awesome 5 Free"}
|
|
|
|
},
|
|
|
|
{
|
2020-05-19 12:43:02 +02:00
|
|
|
{"backIcon", "qrc:/graphics/icons/back_black.png"},
|
|
|
|
{"settIcon", "qrc:/graphics/icons/settings_black.png"},
|
|
|
|
{"buzzerIcon", "qrc:/graphics/icons/buzzer_black.png"},
|
|
|
|
{"startpadIcon", "qrc:/graphics/icons/startpad_black.png"},
|
|
|
|
{"baseStationIcon", "qrc:/graphics/icons/BaseStation_black.png"},
|
|
|
|
{"profilesIcon", "qrc:/graphics/icons/user_black.png"},
|
|
|
|
{"confirmIcon", "qrc:/graphics/icons/ok_black.png"}
|
2020-05-19 09:31:27 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
ScStwAppTheme *darkTheme = new ScStwAppTheme(
|
2020-05-19 12:43:02 +02:00
|
|
|
"Dark",
|
2020-05-19 09:31:27 +02:00
|
|
|
{
|
2020-05-19 12:43:02 +02:00
|
|
|
{"background", "#2d3037"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"button", "#202227"},
|
|
|
|
{"buttonPressed", "#41454f"},
|
|
|
|
{"buttonBorder", "grey"},
|
|
|
|
{"disabledButton", "#555555"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"view", "#202227"},
|
|
|
|
{"menu", "#292b32"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"delegate1", "#202227"},
|
|
|
|
{"delegate2", "#202227"},
|
|
|
|
{"delegateBackground", "#202227"},
|
|
|
|
{"delegatePressed", "#41454f"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"text", "#ffffff"},
|
|
|
|
{"textDark", "#232323"},
|
|
|
|
{"disabledText", "#777777"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"slider", "#6ccaf2"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"success", "#6bd43b"},
|
|
|
|
{"error", "#e03b2f"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
2020-05-19 12:43:02 +02:00
|
|
|
{"line", "grey"},
|
2020-05-19 09:31:27 +02:00
|
|
|
|
|
|
|
{"iconFontName", "Font Awesome 5 Free"},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icons
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{"icons", "Font Awesome 5 Free"}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{"backIcon", "qrc:/graphics/icons/back.png"},
|
|
|
|
{"settIcon", "qrc:/graphics/icons/settings.png"},
|
|
|
|
{"buzzerIcon", "qrc:/graphics/icons/buzzer.png"},
|
|
|
|
{"startpadIcon", "qrc:/graphics/icons/startpad.png"},
|
|
|
|
{"baseStationIcon", "qrc:/graphics/icons/BaseStation.png"},
|
|
|
|
{"profilesIcon", "qrc:/graphics/icons/user.png"},
|
|
|
|
{"confirmIcon", "qrc:/graphics/icons/ok.png"}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
this->themes.append(lightTheme);
|
|
|
|
this->themes.append(darkTheme);
|
|
|
|
this->currentTheme = this->themes[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
ScStwAppTheme* ScStwAppThemeManager::getTheme() {
|
|
|
|
return this->currentTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ScStwAppThemeManager::setTheme(QString themeName) {
|
|
|
|
ScStwAppTheme * foundTheme = this->findThemeByName(themeName);
|
|
|
|
|
|
|
|
if(foundTheme == nullptr)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
this->currentTheme = foundTheme;
|
|
|
|
emit this->themeChanged();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2020-05-19 12:43:02 +02:00
|
|
|
|
|
|
|
ScStwAppTheme * ScStwAppThemeManager::findThemeByName(QString themeName) {
|
|
|
|
foreach (ScStwAppTheme *theme, this->themes) {
|
|
|
|
if(theme->getName() == themeName)
|
|
|
|
return theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|