From 524be44dc2ca2d053c5725d3309ff80cc61d8865 Mon Sep 17 00:00:00 2001 From: xarkes Date: Mon, 12 Feb 2018 13:22:53 +0100 Subject: [PATCH] Fixed white logo on startup #319 --- src/dialogs/NewFileDialog.cpp | 4 +--- src/dialogs/OptionsDialog.cpp | 5 +---- src/utils/Configuration.cpp | 11 +++++++++++ src/utils/Configuration.h | 6 ++++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/dialogs/NewFileDialog.cpp b/src/dialogs/NewFileDialog.cpp index 9f94d0b8..76560289 100644 --- a/src/dialogs/NewFileDialog.cpp +++ b/src/dialogs/NewFileDialog.cpp @@ -59,9 +59,7 @@ NewFileDialog::NewFileDialog(QWidget *parent) : setAcceptDrops(true); ui->recentsListWidget->addAction(ui->actionRemove_item); ui->recentsListWidget->addAction(ui->actionClear_all); - - QString logoFile = (palette().window().color().value() < 127) ? ":/img/cutter_white_plain.svg" : ":/img/cutter_plain.svg"; - ui->logoSvgWidget->load(logoFile); + ui->logoSvgWidget->load(Config()->getLogoFile()); fillRecentFilesList(); bool projectsExist = fillProjectsList(); diff --git a/src/dialogs/OptionsDialog.cpp b/src/dialogs/OptionsDialog.cpp index 887ca019..a4e37c7b 100644 --- a/src/dialogs/OptionsDialog.cpp +++ b/src/dialogs/OptionsDialog.cpp @@ -24,10 +24,7 @@ OptionsDialog::OptionsDialog(MainWindow *main): ui->progressBar->setVisible(0); ui->statusLabel->setVisible(0); ui->elapsedLabel->setVisible(0); - - QString logoFile = (palette().window().color().value() < 127) ? ":/img/cutter_white_plain.svg" : ":/img/cutter_plain.svg"; - ui->logoSvgWidget->load(logoFile); - + ui->logoSvgWidget->load(Config()->getLogoFile()); ui->analSlider->setValue(defaultAnalLevel); // Fill the plugins combo diff --git a/src/utils/Configuration.cpp b/src/utils/Configuration.cpp index 3f9df1de..15d1425d 100644 --- a/src/utils/Configuration.cpp +++ b/src/utils/Configuration.cpp @@ -128,6 +128,9 @@ void Configuration::loadDefaultTheme() /* Load Qt Theme */ qApp->setStyleSheet(""); + + /* Images */ + logoFile = QString(":/img/cutter_plain.svg"); } void Configuration::loadDarkTheme() @@ -243,6 +246,9 @@ void Configuration::loadDarkTheme() #endif qApp->setStyleSheet(stylesheet); } + + /* Images */ + logoFile = QString(":/img/cutter_white_plain.svg"); } const QFont Configuration::getFont() const @@ -277,6 +283,11 @@ const QColor Configuration::getColor(const QString &name) const } } +QString Configuration::getLogoFile() +{ + return logoFile; +} + /** * @brief Configuration::setColor sets the local Cutter configuration color * and the radare2 color. diff --git a/src/utils/Configuration.h b/src/utils/Configuration.h index 542cd3c2..9c656289 100644 --- a/src/utils/Configuration.h +++ b/src/utils/Configuration.h @@ -22,6 +22,9 @@ private: void loadDarkTheme(); void setColor(const QString &name, const QColor &color); + // Images + QString logoFile; + public: // Functions Configuration(); @@ -38,6 +41,9 @@ public: void setDarkTheme(bool set); bool getDarkTheme() { return s.value("dark").toBool(); } + // Images + QString getLogoFile(); + // Graph int getGraphBlockMaxChars() const { return s.value("graph.maxcols", 50).toInt(); } void setGraphBlockMaxChars(int ch) { s.setValue("graph.maxcols", ch); }