diff --git a/ScStwStyling/headers/scstwapptheme.h b/ScStwStyling/headers/scstwapptheme.h index 678cbfd..d0f7ba7 100644 --- a/ScStwStyling/headers/scstwapptheme.h +++ b/ScStwStyling/headers/scstwapptheme.h @@ -8,28 +8,36 @@ class ScStwAppTheme : public QObject { Q_OBJECT - Q_PROPERTY(QVariant colors READ getColors) - Q_PROPERTY(QVariant icons READ getIcons) - Q_PROPERTY(QVariant fonts READ getFonts) - Q_PROPERTY(QVariant images READ getImages) + Q_PROPERTY(QVariant colors READ getColors NOTIFY colorsChanged) + Q_PROPERTY(QVariant icons READ getIcons NOTIFY iconsChanged) + Q_PROPERTY(QVariant fonts READ getFonts NOTIFY fontsChanged) + Q_PROPERTY(QVariant images READ getImages NOTIFY imagesChanged) public: - explicit ScStwAppTheme(QVariantMap colors, QVariantMap icons, QVariantMap fonts, QVariantMap images, QObject *parent = nullptr); + explicit ScStwAppTheme(QString name, QVariantMap colors = {}, QVariantMap icons = {}, QVariantMap fonts = {}, QVariantMap images = {}, QObject *parent = nullptr); private: + QString name; QVariantMap colors; QVariantMap icons; QVariantMap fonts; QVariantMap images; signals: + void colorsChanged(); + void iconsChanged(); + void fontsChanged(); + void imagesChanged(); + public slots: + QString getName(); QVariant getColors(); QVariant getIcons(); QVariant getFonts(); QVariant getImages(); }; + #endif // APPTHEME_H diff --git a/ScStwStyling/sources/scstwapptheme.cpp b/ScStwStyling/sources/scstwapptheme.cpp index ad6017a..cb9a770 100644 --- a/ScStwStyling/sources/scstwapptheme.cpp +++ b/ScStwStyling/sources/scstwapptheme.cpp @@ -1,13 +1,17 @@ #include "headers/scstwapptheme.h" -ScStwAppTheme::ScStwAppTheme(QVariantMap colors, QVariantMap icons, QVariantMap fonts, QVariantMap images, QObject *parent) : QObject(parent) +ScStwAppTheme::ScStwAppTheme(QString name, QVariantMap colors, QVariantMap icons, QVariantMap fonts, QVariantMap images, QObject *parent) : QObject(parent) { + this->name = name; this->colors = colors; this->icons = icons; this->fonts = fonts; this->images = images; } +QString ScStwAppTheme::getName() { + return this->name; +} QVariant ScStwAppTheme::getColors() { return this->colors; diff --git a/ScStwStyling/sources/scstwappthememanager.cpp b/ScStwStyling/sources/scstwappthememanager.cpp index cccdb48..df09c1b 100644 --- a/ScStwStyling/sources/scstwappthememanager.cpp +++ b/ScStwStyling/sources/scstwappthememanager.cpp @@ -14,70 +14,77 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent) }; ScStwAppTheme * lightTheme = new ScStwAppTheme ( + "Light", { - {"backgroundColor", "white"}, + {"background", "white"}, - {"buttonColor", "white"}, - {"buttonPressedColor", "lightgrey"}, - {"buttonBorderColor", "grey"}, - {"disabledButtonColor", "#d5d5d5"}, + {"button", "white"}, + {"buttonPressed", "lightgrey"}, + {"buttonBorder", "grey"}, + {"disabledButton", "#d5d5d5"}, - {"viewColor", "white"}, - {"menuColor", "#f8f8f8"}, + {"view", "white"}, + {"menu", "#f8f8f8"}, - {"delegate1Color", "#202227"}, - {"delegate2Color", "#202227"}, - {"delegateBackgroundColor", "white"}, - {"delegatePressedColor", "#dddedf"}, + {"delegate1", "#202227"}, + {"delegate2", "#202227"}, + {"delegateBackground", "white"}, + {"delegatePressed", "#dddedf"}, - {"textColor", "black"}, - {"textDarkColor", "#232323"}, - {"disabledTextColor", "grey"}, + {"text", "black"}, + {"textDark", "#232323"}, + {"disabledText", "grey"}, - {"sliderColor", "#6ccaf2"}, + {"slider", "#6ccaf2"}, - {"successColor", "#60de26"}, - {"errorColor", "#ff0000"}, + {"success", "#60de26"}, + {"error", "#ff0000"}, - {"lineColor", "grey"}, - }, - { - icons + {"line", "grey"}, }, + icons + , { {"icons", "Font Awesome 5 Free"} }, { - {"baseStationIcon", "qrc:/graphics/icons/BaseStation.png"} + {"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"} }); ScStwAppTheme *darkTheme = new ScStwAppTheme( + "Dark", { - {"backgroundColor", "#2d3037"}, + {"background", "#2d3037"}, - {"buttonColor", "#202227"}, - {"buttonPressedColor", "#41454f"}, - {"buttonBorderColor", "grey"}, - {"disabledButtonColor", "#555555"}, + {"button", "#202227"}, + {"buttonPressed", "#41454f"}, + {"buttonBorder", "grey"}, + {"disabledButton", "#555555"}, - {"viewColor", "#202227"}, - {"menuColor", "#292b32"}, + {"view", "#202227"}, + {"menu", "#292b32"}, - {"delegate1Color", "#202227"}, - {"delegate2Color", "#202227"}, - {"delegateBackgroundColor", "#202227"}, - {"delegatePressedColor", "#41454f"}, + {"delegate1", "#202227"}, + {"delegate2", "#202227"}, + {"delegateBackground", "#202227"}, + {"delegatePressed", "#41454f"}, - {"textColor", "#ffffff"}, - {"textDarkColor", "#232323"}, - {"disabledTextColor", "#777777"}, + {"text", "#ffffff"}, + {"textDark", "#232323"}, + {"disabledText", "#777777"}, - {"sliderColor", "#6ccaf2"}, + {"slider", "#6ccaf2"}, - {"successColor", "#6bd43b"}, - {"errorColor", "#e03b2f"}, + {"success", "#6bd43b"}, + {"error", "#e03b2f"}, - {"lineColor", "grey"}, + {"line", "grey"}, {"iconFontName", "Font Awesome 5 Free"}, }, @@ -118,3 +125,12 @@ bool ScStwAppThemeManager::setTheme(QString themeName) { return true; } + +ScStwAppTheme * ScStwAppThemeManager::findThemeByName(QString themeName) { + foreach (ScStwAppTheme *theme, this->themes) { + if(theme->getName() == themeName) + return theme; + } + + return nullptr; +}