summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-02 11:10:57 +0200
committerSimon Rettberg2019-07-02 11:10:57 +0200
commiteb9b1f0f770cad3123a7de29c802b87c81456fc6 (patch)
treeb36b2be1335a1e790f6dbcbc6c99765f627147c0
parentFix loading default config file if --config is missing (diff)
downloadvmchooser2-eb9b1f0f770cad3123a7de29c802b87c81456fc6.tar.gz
vmchooser2-eb9b1f0f770cad3123a7de29c802b87c81456fc6.tar.xz
vmchooser2-eb9b1f0f770cad3123a7de29c802b87c81456fc6.zip
Fix inverted check for whether a theme is configured
-rw-r--r--src/dialog.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 984b7ad..a23e3ce 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -372,16 +372,17 @@ void Dialog::setTheme() {
QString backgroundColor, imageLeft, imageRight;
QString themePathBase, themePathIni, themePathImgLeft, themePathImgRight;
- if (Config::isSet(Config::THEME))
+ if (!Config::isSet(Config::THEME))
return;
QString theme(Config::get(Config::THEME));
themePathBase = QString("%1/%2/").arg(VMCHOOSER_THEME_BASE).arg(theme);
themePathIni = QString("%1%2.ini").arg(themePathBase).arg(theme);
- if (!QFile::exists(themePathIni))
+ if (!QFile::exists(themePathIni)) {
+ qDebug() << "Theme config" << themePathIni << "does not exist";
return;
-
+ }
QSettings themeSettings(themePathIni, QSettings::IniFormat);
backgroundColor = themeSettings.value("background-color").toString();
@@ -391,15 +392,15 @@ void Dialog::setTheme() {
themePathImgLeft = QString("%1%2").arg(themePathBase).arg(imageLeft);
themePathImgRight = QString("%1%2").arg(themePathBase).arg(imageRight);
- QRegExp re;
+ QRegExp re("(.*background-color:)#[^;]*(;.*)");
ui->label_l->setPixmap(QPixmap(themePathImgLeft));
ui->label_r->setPixmap(QPixmap(themePathImgRight));
label_l_style = ui->label_l->styleSheet();
label_r_style = ui->label_r->styleSheet();
backgroundColor.prepend("\\1").append("\\2");
- label_l_style.replace(QRegExp("(.*background-color:)#[^;]*(;.*)"), backgroundColor);
- label_r_style.replace(QRegExp("(.*background-color:)#[^;]*(;.*)"), backgroundColor);
+ label_l_style.replace(re, backgroundColor);
+ label_r_style.replace(re, backgroundColor);
ui->label_l->setStyleSheet(label_l_style);
ui->label_r->setStyleSheet(label_r_style);
}