diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-29 00:08:56 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-29 00:08:56 +0200 |
| commit | 741c71adff886f590081501932ec1520058d7def (patch) | |
| tree | 28009a20d9f15f682b694e794d09eaceb88a5022 /src/mainwindow.cpp | |
| parent | 6edd9e7a12a3827fb6aac62a88be01085e41e176 (diff) | |
| download | kristall-741c71adff886f590081501932ec1520058d7def.tar.gz | |
Changes theme initialization a tad.
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b0305df..79352cb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -71,8 +71,6 @@ MainWindow::MainWindow(QApplication * app, QWidget *parent) : this->ui->favourites_view->setContextMenuPolicy(Qt::CustomContextMenu); this->ui->history_view->setContextMenuPolicy(Qt::CustomContextMenu); - - reloadTheme(); } MainWindow::~MainWindow() @@ -209,8 +207,10 @@ void MainWindow::on_actionSettings_triggered() dialog.setGeminiSslTrust(kristall::trust::gemini); dialog.setHttpsSslTrust(kristall::trust::https); - if(dialog.exec() != QDialog::Accepted) + if(dialog.exec() != QDialog::Accepted) { + kristall::setTheme(kristall::options.theme); return; + } kristall::trust::gemini = dialog.geminiSslTrust(); kristall::trust::https = dialog.httpsSslTrust(); @@ -221,7 +221,7 @@ void MainWindow::on_actionSettings_triggered() kristall::saveSettings(); - this->reloadTheme(); + kristall::setTheme(kristall::options.theme); } void MainWindow::on_actionNew_Tab_triggered() @@ -283,33 +283,6 @@ void MainWindow::on_actionAbout_Qt_triggered() QMessageBox::aboutQt(this, "Kristall"); } -void MainWindow::reloadTheme() -{ - if(kristall::options.theme == Theme::os_default) - { - application->setStyleSheet(""); - QIcon::setThemeName("light"); - } - if(kristall::options.theme == Theme::light) - { - QFile file(":/light.qss"); - file.open(QFile::ReadOnly | QFile::Text); - QTextStream stream(&file); - application->setStyleSheet(stream.readAll()); - - QIcon::setThemeName("light"); - } - else if(kristall::options.theme == Theme::dark) - { - QFile file(":/dark.qss"); - file.open(QFile::ReadOnly | QFile::Text); - QTextStream stream(&file); - application->setStyleSheet(stream.readAll()); - - QIcon::setThemeName("dark"); - } -} - void MainWindow::setFileStatus(const DocumentStats &stats) { if(stats.isValid()) { |
