Add logic dependency to global config

This commit is contained in:
lupoDharkael
2017-05-15 21:38:34 +02:00
parent 19c415cd9b
commit d09923790e
8 changed files with 36 additions and 30 deletions

View File

@@ -119,10 +119,25 @@ QIcon Button::getIcon(const Type t, bool isWhite) {
}
return QIcon(path);
}
QString Button::getStyle() {
QSettings settings;
QColor mainColor = settings.value("uiColor").value<QColor>();
QString baseSheet = "Button { border-radius: 15px;"
"background-color: %1; color: white }"
"Button:hover { background-color: %2; }"
"Button:pressed:!hover { "
"background-color: %1; }";
QColor contrast(mainColor.darker(120));
if (mainColor.name() < QColor(30,30,30).name()) {
contrast = contrast.lighter(120);
}
return baseSheet.arg(mainColor.name()).arg(contrast.name());
}
// get icon returns the icon for the type of button
QIcon Button::getIcon(const Type t) {
// assign the isWhite based on the settings
bool isWhite = true;
QSettings settings;
bool isWhite = settings.value("whiteIconColor").toBool();
return getIcon(t, isWhite);
}