From 5d021cb41d97b08c8f19608707e5c57d35ac3fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 18 Aug 2019 21:11:46 +0200 Subject: [PATCH] GUI: Revert my theme changes. The theme selection will only be for the code editor again. --- gui/codeeditorstyle.cpp | 15 --------------- gui/codeeditorstyle.h | 2 -- gui/mainwindow.cpp | 15 +-------------- gui/mainwindow.h | 3 --- gui/resultsview.cpp | 3 --- gui/settings.ui | 6 +++--- 6 files changed, 4 insertions(+), 40 deletions(-) diff --git a/gui/codeeditorstyle.cpp b/gui/codeeditorstyle.cpp index aa841bbb3..9d78b6e70 100644 --- a/gui/codeeditorstyle.cpp +++ b/gui/codeeditorstyle.cpp @@ -219,18 +219,3 @@ void CodeEditorStyle::saveSettings(QSettings *settings, } settings->endGroup(); } - -static QString rgbStyleString(QColor c) -{ - return QString("rgb(%1,%2,%3)").arg(c.red()).arg(c.green()).arg(c.blue()); -} - -QString CodeEditorStyle::generateStyleString() const -{ - if (isSystemTheme()) - return QString(); - return QString("background:%1; color:%2; selection-background-color:%3;") - .arg(rgbStyleString(widgetBGColor)) - .arg(rgbStyleString(widgetFGColor)) - .arg(rgbStyleString(highlightBGColor)); -} diff --git a/gui/codeeditorstyle.h b/gui/codeeditorstyle.h index 2559d0aff..53b2ef5e4 100644 --- a/gui/codeeditorstyle.h +++ b/gui/codeeditorstyle.h @@ -72,8 +72,6 @@ public: static CodeEditorStyle loadSettings(QSettings *settings); static void saveSettings(QSettings *settings, const CodeEditorStyle& theStyle); - QString generateStyleString() const; - public: bool mSystemTheme; QColor widgetFGColor; diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 83045d9a9..b8ad23246 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -33,7 +33,6 @@ #include "applicationlist.h" #include "aboutdialog.h" -#include "codeeditorstyle.h" #include "common.h" #include "threadhandler.h" #include "fileviewdialog.h" @@ -155,8 +154,6 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) : loadSettings(); - updateStyleSetting(); - mThread->initialize(mUI.mResults); if (mProjectFile) formatAndSetTitle(tr("Project:") + ' ' + mProjectFile->getFilename()); @@ -402,16 +399,6 @@ void MainWindow::saveSettings() const mUI.mResults->saveSettings(mSettings); } -void MainWindow::updateStyleSetting() -{ - mUI.mResults->updateStyleSetting(mSettings); - QString styleSheet = CodeEditorStyle::loadSettings(mSettings).generateStyleString(); - mUI.mToolBarMain->setStyleSheet(styleSheet); - mUI.mToolBarView->setStyleSheet(styleSheet); - mUI.mToolBarFilter->setStyleSheet(styleSheet); - this->setStyleSheet(styleSheet); -} - void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLibrary, const bool checkConfiguration) { clearResults(); @@ -1027,7 +1014,7 @@ void MainWindow::programSettings() dialog.showNoErrorsMessage(), dialog.showErrorId(), dialog.showInconclusive()); - this->updateStyleSetting(); + mUI.mResults->updateStyleSetting(mSettings); const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString(); setLanguage(newLang); } diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 041bb5412..6812b17c8 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -227,9 +227,6 @@ protected slots: private: - /** Set widget themes */ - void updateStyleSetting(); - /** Get filename for last results */ QString getLastResults() const; diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index e9e10a981..0bd9b8a57 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -244,9 +244,6 @@ void ResultsView::updateStyleSetting(QSettings *settings) { CodeEditorStyle theStyle(CodeEditorStyle::loadSettings(settings)); mUI.mCode->setStyle(theStyle); - QString styleString(theStyle.generateStyleString()); - mUI.mTree->setStyleSheet(styleString); - mUI.mDetails->setStyleSheet(styleString); } void ResultsView::setCheckDirectory(const QString &dir) diff --git a/gui/settings.ui b/gui/settings.ui index a480276ca..c3b9c25c7 100644 --- a/gui/settings.ui +++ b/gui/settings.ui @@ -420,15 +420,15 @@ - + - Theme + Code Editor - Style + Code Editor Style