summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 98a60e8..342da87 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -2,10 +2,13 @@
#include <QMessageBox>
#include <QDebug>
+#include <QRegExp>
+#include <QFile>
#include "ui_dialog.h"
#include "save_restore_session.h"
#include "sessiontreeitem.h"
+#include "globals.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent), ui(new Ui::Dialog) {
@@ -165,3 +168,38 @@ void Dialog::showSettingsPVS() {
readPVSSettings();
ui->PVSOptionsGroupBox->show();
}
+
+void Dialog::setTheme() {
+ QString label_l_style, label_r_style;
+ QString backgroundColor, imageLeft, imageRight;
+ QString themePathBase, themePathIni, themePathImgLeft, themePathImgRight;
+
+ if (theme.isEmpty()) return;
+
+ themePathBase = QString("%1/%2/").arg(VMCHOOSER_THEME_BASE).arg(theme);
+ themePathIni = QString("%1%2.ini").arg(themePathBase).arg(theme);
+
+ if (!QFile::exists(themePathIni)) return;
+
+
+ QSettings themeSettings(themePathIni, QSettings::IniFormat);
+ backgroundColor = themeSettings.value("background-color").toString();
+ imageLeft = themeSettings.value("image-left").toString();
+ imageRight = themeSettings.value("image-right").toString();
+
+ themePathImgLeft = QString("%1%2").arg(themePathBase).arg(imageLeft);
+ themePathImgRight = QString("%1%2").arg(themePathBase).arg(imageRight);
+
+ QRegExp re;
+
+ 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);
+ //qDebug() << label_r_style << label_l_style;
+ ui->label_l->setStyleSheet(label_l_style);
+ ui->label_r->setStyleSheet(label_r_style);
+}