some additions to themes

This commit is contained in:
Dorian Zedler 2020-05-19 14:41:23 +02:00
parent c027fa242a
commit cf443a1c70
Signed by: dorian
GPG key ID: 989DE36109AFA354
5 changed files with 30 additions and 8 deletions

View file

@ -2,6 +2,7 @@
#define SCSTWAPPTHEMEMANAGER_H #define SCSTWAPPTHEMEMANAGER_H
#include <QObject> #include <QObject>
#include <QColor>
#include "scstwapptheme.h" #include "scstwapptheme.h"
class ScStwAppThemeManager : public QObject class ScStwAppThemeManager : public QObject
@ -18,6 +19,8 @@ private:
ScStwAppTheme* findThemeByName(QString themeName); ScStwAppTheme* findThemeByName(QString themeName);
QString lighter(QString color, double factor);
signals: signals:
void themeChanged(); void themeChanged();

View file

@ -1,5 +1,7 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>fonts/fa5solid.woff</file> <file>fonts/fa5solid.woff</file>
<file>images/BaseStationBlack.png</file>
<file>images/BaseStationWhite.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

@ -5,23 +5,27 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
QFontDatabase::addApplicationFont(":/fonts/fa5solid.woff"); QFontDatabase::addApplicationFont(":/fonts/fa5solid.woff");
QVariantMap icons = { QVariantMap icons = {
{"backIcon", "\uf053"}, {"back", "\uf053"},
{"settIcon", "\uf013"}, {"settings", "\uf013"},
{"toppadIcon", "\uf10a"}, {"toppad", "\uf10a"},
{"startpadIcon", "\uf3fa"}, {"startpad", "\uf3fa"},
{"profilesIcon", "\uf007"}, {"profiles", "\uf007"},
{"confirmIcon", "\uf00c"} {"confirm", "\uf00c"}
}; };
ScStwAppTheme * lightTheme = new ScStwAppTheme ( ScStwAppTheme * lightTheme = new ScStwAppTheme (
"Light", "Light",
{ {
{"accent", "#0094ff"},
{"background", "white"}, {"background", "white"},
{"button", "white"}, {"button", "white"},
{"buttonPressed", "lightgrey"}, {"buttonPressed", "lightgrey"},
{"buttonBorder", "grey"}, {"buttonBorder", "grey"},
{"disabledButton", "#d5d5d5"}, {"disabledButton", "#d5d5d5"},
{"buttonText", "grey"},
{"buttonPressedText",this->lighter("lightgrey", 0.5)},
{"buttonDisabledText", this->lighter("lightgrey", 0.9)},
{"view", "white"}, {"view", "white"},
{"menu", "#f8f8f8"}, {"menu", "#f8f8f8"},
@ -52,7 +56,7 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
{"settIcon", "qrc:/graphics/icons/settings_black.png"}, {"settIcon", "qrc:/graphics/icons/settings_black.png"},
{"buzzerIcon", "qrc:/graphics/icons/buzzer_black.png"}, {"buzzerIcon", "qrc:/graphics/icons/buzzer_black.png"},
{"startpadIcon", "qrc:/graphics/icons/startpad_black.png"}, {"startpadIcon", "qrc:/graphics/icons/startpad_black.png"},
{"baseStationIcon", "qrc:/graphics/icons/BaseStation_black.png"}, {"baseStationIcon", "qrc:/images/BaseStationBlack.png"},
{"profilesIcon", "qrc:/graphics/icons/user_black.png"}, {"profilesIcon", "qrc:/graphics/icons/user_black.png"},
{"confirmIcon", "qrc:/graphics/icons/ok_black.png"} {"confirmIcon", "qrc:/graphics/icons/ok_black.png"}
}); });
@ -60,12 +64,16 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
ScStwAppTheme *darkTheme = new ScStwAppTheme( ScStwAppTheme *darkTheme = new ScStwAppTheme(
"Dark", "Dark",
{ {
{"accent", "#0094ff"},
{"background", "#2d3037"}, {"background", "#2d3037"},
{"button", "#202227"}, {"button", "#202227"},
{"buttonPressed", "#41454f"}, {"buttonPressed", "#41454f"},
{"buttonBorder", "grey"}, {"buttonBorder", "grey"},
{"disabledButton", "#555555"}, {"disabledButton", "#555555"},
{"buttonText", "white"},
{"buttonPressedText",this->lighter("lightgrey", 0.8)},
{"buttonDisabledText", this->lighter("lightgrey", 0.6)},
{"view", "#202227"}, {"view", "#202227"},
{"menu", "#292b32"}, {"menu", "#292b32"},
@ -99,7 +107,7 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
{"settIcon", "qrc:/graphics/icons/settings.png"}, {"settIcon", "qrc:/graphics/icons/settings.png"},
{"buzzerIcon", "qrc:/graphics/icons/buzzer.png"}, {"buzzerIcon", "qrc:/graphics/icons/buzzer.png"},
{"startpadIcon", "qrc:/graphics/icons/startpad.png"}, {"startpadIcon", "qrc:/graphics/icons/startpad.png"},
{"baseStationIcon", "qrc:/graphics/icons/BaseStation.png"}, {"baseStationIcon", "qrc:/images/BaseStationWhite.png"},
{"profilesIcon", "qrc:/graphics/icons/user.png"}, {"profilesIcon", "qrc:/graphics/icons/user.png"},
{"confirmIcon", "qrc:/graphics/icons/ok.png"} {"confirmIcon", "qrc:/graphics/icons/ok.png"}
} }
@ -134,3 +142,12 @@ ScStwAppTheme * ScStwAppThemeManager::findThemeByName(QString themeName) {
return nullptr; return nullptr;
} }
QString ScStwAppThemeManager::lighter(QString color, double factor) {
QColor qcolor = QColor(color);
qcolor.toHsv();
int h, s, v;
qcolor.getHsv(&h, &s, &v);
qcolor.setHsv(h,s,v * factor);
return qcolor.name();
}