diff options
-rw-r--r-- | src/dialog.cpp | 13 |
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); } |