This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
shared-libraries/ScStwStyling/sources/scstwappthememanager.cpp

121 lines
3.7 KiB
C++
Raw Normal View History

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 (
{
{"backgroundColor", "white"},
{"buttonColor", "white"},
{"buttonPressedColor", "lightgrey"},
{"buttonBorderColor", "grey"},
{"disabledButtonColor", "#d5d5d5"},
{"viewColor", "white"},
{"menuColor", "#f8f8f8"},
{"delegate1Color", "#202227"},
{"delegate2Color", "#202227"},
{"delegateBackgroundColor", "white"},
{"delegatePressedColor", "#dddedf"},
{"textColor", "black"},
{"textDarkColor", "#232323"},
{"disabledTextColor", "grey"},
{"sliderColor", "#6ccaf2"},
{"successColor", "#60de26"},
{"errorColor", "#ff0000"},
{"lineColor", "grey"},
},
{
icons
},
{
{"icons", "Font Awesome 5 Free"}
},
{
{"baseStationIcon", "qrc:/graphics/icons/BaseStation.png"}
});
ScStwAppTheme *darkTheme = new ScStwAppTheme(
{
{"backgroundColor", "#2d3037"},
{"buttonColor", "#202227"},
{"buttonPressedColor", "#41454f"},
{"buttonBorderColor", "grey"},
{"disabledButtonColor", "#555555"},
{"viewColor", "#202227"},
{"menuColor", "#292b32"},
{"delegate1Color", "#202227"},
{"delegate2Color", "#202227"},
{"delegateBackgroundColor", "#202227"},
{"delegatePressedColor", "#41454f"},
{"textColor", "#ffffff"},
{"textDarkColor", "#232323"},
{"disabledTextColor", "#777777"},
{"sliderColor", "#6ccaf2"},
{"successColor", "#6bd43b"},
{"errorColor", "#e03b2f"},
{"lineColor", "grey"},
{"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;
}