css files can be loaded from file
This commit is contained in:
+19
-3
@@ -53,6 +53,7 @@
|
||||
|
||||
MainWindow* mainWindow;
|
||||
|
||||
#define DEFAULT_CSS "QPushButton::checked { background: rgb(25, 25, 25); }"
|
||||
#define OLIVE_FILE_FILTER "Olive Project (*.ove)"
|
||||
|
||||
QTimer autorecovery_timer;
|
||||
@@ -106,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent, const QString &an) :
|
||||
// set up style?
|
||||
|
||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
setStyleSheet("QPushButton::checked { background: rgb(25, 25, 25); }");
|
||||
setStyleSheet(DEFAULT_CSS);
|
||||
|
||||
QPalette darkPalette;
|
||||
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
|
||||
@@ -197,7 +198,11 @@ MainWindow::MainWindow(QWidget *parent, const QString &an) :
|
||||
config_fn = config_path + "/config.xml";
|
||||
if (QFileInfo::exists(config_fn)) {
|
||||
config.load(config_fn);
|
||||
}
|
||||
|
||||
if (!config.css_path.isEmpty()) {
|
||||
load_css_from_file(config.css_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
alloc_panels(this);
|
||||
@@ -330,7 +335,18 @@ void MainWindow::save_shortcuts(const QString& fn) {
|
||||
shortcut_file_io.close();
|
||||
} else {
|
||||
qCritical() << "Failed to save shortcut file";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::load_css_from_file(const QString &fn) {
|
||||
QFile css_file(fn);
|
||||
if (css_file.exists() && css_file.open(QFile::ReadOnly)) {
|
||||
setStyleSheet(css_file.readAll());
|
||||
css_file.close();
|
||||
} else {
|
||||
// set default stylesheet
|
||||
setStyleSheet(DEFAULT_CSS);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::show_about() {
|
||||
|
||||
Reference in New Issue
Block a user