GUI: Revert my theme changes. The theme selection will only be for the code editor again.

This commit is contained in:
Daniel Marjamäki 2019-08-18 21:11:46 +02:00
parent 474fed453e
commit 5d021cb41d
6 changed files with 4 additions and 40 deletions

View File

@ -219,18 +219,3 @@ void CodeEditorStyle::saveSettings(QSettings *settings,
} }
settings->endGroup(); 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));
}

View File

@ -72,8 +72,6 @@ public:
static CodeEditorStyle loadSettings(QSettings *settings); static CodeEditorStyle loadSettings(QSettings *settings);
static void saveSettings(QSettings *settings, const CodeEditorStyle& theStyle); static void saveSettings(QSettings *settings, const CodeEditorStyle& theStyle);
QString generateStyleString() const;
public: public:
bool mSystemTheme; bool mSystemTheme;
QColor widgetFGColor; QColor widgetFGColor;

View File

@ -33,7 +33,6 @@
#include "applicationlist.h" #include "applicationlist.h"
#include "aboutdialog.h" #include "aboutdialog.h"
#include "codeeditorstyle.h"
#include "common.h" #include "common.h"
#include "threadhandler.h" #include "threadhandler.h"
#include "fileviewdialog.h" #include "fileviewdialog.h"
@ -155,8 +154,6 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
loadSettings(); loadSettings();
updateStyleSetting();
mThread->initialize(mUI.mResults); mThread->initialize(mUI.mResults);
if (mProjectFile) if (mProjectFile)
formatAndSetTitle(tr("Project:") + ' ' + mProjectFile->getFilename()); formatAndSetTitle(tr("Project:") + ' ' + mProjectFile->getFilename());
@ -402,16 +399,6 @@ void MainWindow::saveSettings() const
mUI.mResults->saveSettings(mSettings); 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) void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLibrary, const bool checkConfiguration)
{ {
clearResults(); clearResults();
@ -1027,7 +1014,7 @@ void MainWindow::programSettings()
dialog.showNoErrorsMessage(), dialog.showNoErrorsMessage(),
dialog.showErrorId(), dialog.showErrorId(),
dialog.showInconclusive()); dialog.showInconclusive());
this->updateStyleSetting(); mUI.mResults->updateStyleSetting(mSettings);
const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString(); const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString();
setLanguage(newLang); setLanguage(newLang);
} }

View File

@ -227,9 +227,6 @@ protected slots:
private: private:
/** Set widget themes */
void updateStyleSetting();
/** Get filename for last results */ /** Get filename for last results */
QString getLastResults() const; QString getLastResults() const;

View File

@ -244,9 +244,6 @@ void ResultsView::updateStyleSetting(QSettings *settings)
{ {
CodeEditorStyle theStyle(CodeEditorStyle::loadSettings(settings)); CodeEditorStyle theStyle(CodeEditorStyle::loadSettings(settings));
mUI.mCode->setStyle(theStyle); mUI.mCode->setStyle(theStyle);
QString styleString(theStyle.generateStyleString());
mUI.mTree->setStyleSheet(styleString);
mUI.mDetails->setStyleSheet(styleString);
} }
void ResultsView::setCheckDirectory(const QString &dir) void ResultsView::setCheckDirectory(const QString &dir)

View File

@ -420,15 +420,15 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="mTabTheme"> <widget class="QWidget" name="mTabEditorStyle">
<attribute name="title"> <attribute name="title">
<string>Theme</string> <string>Code Editor</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_11"> <layout class="QVBoxLayout" name="verticalLayout_11">
<item> <item>
<widget class="QGroupBox" name="gboxEditorStyle"> <widget class="QGroupBox" name="gboxEditorStyle">
<property name="title"> <property name="title">
<string>Style</string> <string>Code Editor Style</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_12"> <layout class="QVBoxLayout" name="verticalLayout_12">
<item> <item>