- enhancement: let user choose app theme when first run

This commit is contained in:
royqh1979@gmail.com 2022-02-24 17:33:19 +08:00
parent cbd718dcfe
commit 162121efa2
9 changed files with 309 additions and 58 deletions

View File

@ -8,6 +8,7 @@ Red Panda C++ Version 0.14.4
- enhancement: auto find compiler sets when run for the first time - enhancement: auto find compiler sets when run for the first time
- enhancement: git - remotes - enhancement: git - remotes
- enhancement: rename "open folder" to "choose working folder" - enhancement: rename "open folder" to "choose working folder"
- enhancement: let user choose app theme when first run
Red Panda C++ Version 0.14.3 Red Panda C++ Version 0.14.3
- fix: wrong code completion font size, when screen dpi changed - fix: wrong code completion font size, when screen dpi changed

View File

@ -104,6 +104,7 @@ SOURCES += \
vcs/gitutils.cpp \ vcs/gitutils.cpp \
widgets/aboutdialog.cpp \ widgets/aboutdialog.cpp \
widgets/bookmarkmodel.cpp \ widgets/bookmarkmodel.cpp \
widgets/choosethemedialog.cpp \
widgets/classbrowser.cpp \ widgets/classbrowser.cpp \
widgets/codecompletionlistview.cpp \ widgets/codecompletionlistview.cpp \
widgets/codecompletionpopup.cpp \ widgets/codecompletionpopup.cpp \
@ -245,6 +246,7 @@ HEADERS += \
vcs/gitutils.h \ vcs/gitutils.h \
widgets/aboutdialog.h \ widgets/aboutdialog.h \
widgets/bookmarkmodel.h \ widgets/bookmarkmodel.h \
widgets/choosethemedialog.h \
widgets/classbrowser.h \ widgets/classbrowser.h \
widgets/codecompletionlistview.h \ widgets/codecompletionlistview.h \
widgets/codecompletionpopup.h \ widgets/codecompletionpopup.h \
@ -346,6 +348,7 @@ FORMS += \
vcs/gitremotedialog.ui \ vcs/gitremotedialog.ui \
vcs/gitresetdialog.ui \ vcs/gitresetdialog.ui \
widgets/aboutdialog.ui \ widgets/aboutdialog.ui \
widgets/choosethemedialog.ui \
widgets/cpudialog.ui \ widgets/cpudialog.ui \
mainwindow.ui \ mainwindow.ui \
settingsdialog/compilersetdirectorieswidget.ui \ settingsdialog/compilersetdirectorieswidget.ui \

View File

@ -428,6 +428,30 @@ p, li { white-space: pre-wrap; }
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>ChooseThemeDialog</name>
<message>
<location filename="widgets/choosethemedialog.ui" line="14"/>
<location filename="widgets/choosethemedialog.ui" line="20"/>
<source>Choose Theme</source>
<translation></translation>
</message>
<message>
<location filename="widgets/choosethemedialog.ui" line="26"/>
<source>Dark Theme</source>
<translation></translation>
</message>
<message>
<location filename="widgets/choosethemedialog.ui" line="49"/>
<source>Light Theme</source>
<translation></translation>
</message>
<message>
<location filename="widgets/choosethemedialog.ui" line="116"/>
<source>Ok</source>
<translation></translation>
</message>
</context>
<context> <context>
<name>CodeSnippetsManager</name> <name>CodeSnippetsManager</name>
<message> <message>
@ -3684,7 +3708,7 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="560"/> <location filename="mainwindow.ui" line="560"/>
<location filename="mainwindow.ui" line="2631"/> <location filename="mainwindow.ui" line="2634"/>
<location filename="mainwindow.cpp" line="4282"/> <location filename="mainwindow.cpp" line="4282"/>
<location filename="mainwindow.cpp" line="4285"/> <location filename="mainwindow.cpp" line="4285"/>
<location filename="mainwindow.cpp" line="4289"/> <location filename="mainwindow.cpp" line="4289"/>
@ -3719,27 +3743,27 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="99"/> <location filename="mainwindow.ui" line="178"/>
<location filename="mainwindow.ui" line="1541"/> <location filename="mainwindow.ui" line="1541"/>
<location filename="mainwindow.ui" line="2591"/> <location filename="mainwindow.ui" line="2594"/>
<source>Project</source> <source>Project</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="150"/> <location filename="mainwindow.ui" line="229"/>
<location filename="mainwindow.ui" line="2599"/> <location filename="mainwindow.ui" line="2602"/>
<source>Watch</source> <source>Watch</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="189"/> <location filename="mainwindow.ui" line="268"/>
<location filename="mainwindow.ui" line="2607"/> <location filename="mainwindow.ui" line="2610"/>
<source>Structure</source> <source>Structure</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="228"/> <location filename="mainwindow.ui" line="99"/>
<location filename="mainwindow.ui" line="2615"/> <location filename="mainwindow.ui" line="2618"/>
<source>Files</source> <source>Files</source>
<translation></translation> <translation></translation>
</message> </message>
@ -3752,7 +3776,7 @@ Are you really want to continue?</oldsource>
<location filename="mainwindow.ui" line="1690"/> <location filename="mainwindow.ui" line="1690"/>
<location filename="mainwindow.ui" line="2036"/> <location filename="mainwindow.ui" line="2036"/>
<location filename="mainwindow.ui" line="2039"/> <location filename="mainwindow.ui" line="2039"/>
<location filename="mainwindow.ui" line="2647"/> <location filename="mainwindow.ui" line="2650"/>
<source>Debug</source> <source>Debug</source>
<translation></translation> <translation></translation>
</message> </message>
@ -3785,7 +3809,7 @@ Are you really want to continue?</oldsource>
<message> <message>
<location filename="mainwindow.ui" line="926"/> <location filename="mainwindow.ui" line="926"/>
<location filename="mainwindow.ui" line="1506"/> <location filename="mainwindow.ui" line="1506"/>
<location filename="mainwindow.ui" line="2655"/> <location filename="mainwindow.ui" line="2658"/>
<source>Search</source> <source>Search</source>
<translation></translation> <translation></translation>
</message> </message>
@ -3904,7 +3928,7 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="615"/> <location filename="mainwindow.ui" line="615"/>
<location filename="mainwindow.ui" line="2639"/> <location filename="mainwindow.ui" line="2642"/>
<source>Tools Output</source> <source>Tools Output</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4104,7 +4128,7 @@ Are you really want to continue?</oldsource>
<message> <message>
<location filename="mainwindow.ui" line="307"/> <location filename="mainwindow.ui" line="307"/>
<location filename="mainwindow.ui" line="334"/> <location filename="mainwindow.ui" line="334"/>
<location filename="mainwindow.ui" line="2623"/> <location filename="mainwindow.ui" line="2626"/>
<location filename="mainwindow.cpp" line="658"/> <location filename="mainwindow.cpp" line="658"/>
<source>Problem Set</source> <source>Problem Set</source>
<translation></translation> <translation></translation>
@ -4160,20 +4184,20 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="1094"/> <location filename="mainwindow.ui" line="1094"/>
<location filename="mainwindow.ui" line="2663"/> <location filename="mainwindow.ui" line="2666"/>
<source>TODO</source> <source>TODO</source>
<translation>TODO</translation> <translation>TODO</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="1112"/> <location filename="mainwindow.ui" line="1112"/>
<location filename="mainwindow.ui" line="2671"/> <location filename="mainwindow.ui" line="2674"/>
<source>Bookmark</source> <source>Bookmark</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="1139"/> <location filename="mainwindow.ui" line="1139"/>
<location filename="mainwindow.ui" line="1182"/> <location filename="mainwindow.ui" line="1182"/>
<location filename="mainwindow.ui" line="2679"/> <location filename="mainwindow.ui" line="2682"/>
<location filename="mainwindow.cpp" line="656"/> <location filename="mainwindow.cpp" line="656"/>
<source>Problem</source> <source>Problem</source>
<translation></translation> <translation></translation>
@ -4626,70 +4650,70 @@ Are you really want to continue?</oldsource>
<translation>C++</translation> <translation>C++</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2567"/> <location filename="mainwindow.ui" line="2570"/>
<source>C Reference</source> <source>C Reference</source>
<translation>C参考手册</translation> <translation>C参考手册</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2575"/> <location filename="mainwindow.ui" line="2578"/>
<source>Show Tool Panels</source> <source>Show Tool Panels</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2765"/> <location filename="mainwindow.ui" line="2768"/>
<source>Create Git Repository</source> <source>Create Git Repository</source>
<oldsource>Create Repository</oldsource> <oldsource>Create Repository</oldsource>
<translation>Git仓库</translation> <translation>Git仓库</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2770"/> <location filename="mainwindow.ui" line="2773"/>
<source>Commit</source> <source>Commit</source>
<translation>(Commit)</translation> <translation>(Commit)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2775"/> <location filename="mainwindow.ui" line="2778"/>
<source>Revert</source> <source>Revert</source>
<translation>(Revert)</translation> <translation>(Revert)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2780"/> <location filename="mainwindow.ui" line="2783"/>
<source>Reset</source> <source>Reset</source>
<translation>(Reset)</translation> <translation>(Reset)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2785"/> <location filename="mainwindow.ui" line="2788"/>
<source>Add Files</source> <source>Add Files</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2790"/> <location filename="mainwindow.ui" line="2793"/>
<source>Restore</source> <source>Restore</source>
<translation>(Restore)</translation> <translation>(Restore)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2795"/> <location filename="mainwindow.ui" line="2798"/>
<source>Website</source> <source>Website</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2800"/> <location filename="mainwindow.ui" line="2803"/>
<source>Branch/Switch</source> <source>Branch/Switch</source>
<translation>Switch</translation> <translation>Switch</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2805"/> <location filename="mainwindow.ui" line="2808"/>
<source>Merge</source> <source>Merge</source>
<translation>Merge</translation> <translation>Merge</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2810"/>
<location filename="mainwindow.ui" line="2813"/> <location filename="mainwindow.ui" line="2813"/>
<location filename="mainwindow.ui" line="2816"/>
<source>Show Log</source> <source>Show Log</source>
<oldsource>Log</oldsource> <oldsource>Log</oldsource>
<translation>(Log)</translation> <translation>(Log)</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2818"/> <location filename="mainwindow.ui" line="2821"/>
<source>Remotes...</source> <source>Remotes...</source>
<translation>...</translation> <translation>...</translation>
</message> </message>
@ -4698,50 +4722,50 @@ Are you really want to continue?</oldsource>
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2583"/> <location filename="mainwindow.ui" line="2586"/>
<source>Status Bar</source> <source>Status Bar</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2719"/> <location filename="mainwindow.ui" line="2722"/>
<source>Ctrl+Backspace</source> <source>Ctrl+Backspace</source>
<translation>Ctrl+Backspace</translation> <translation>Ctrl+Backspace</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2728"/> <location filename="mainwindow.ui" line="2731"/>
<source>Interrupt</source> <source>Interrupt</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2733"/>
<location filename="mainwindow.ui" line="2736"/> <location filename="mainwindow.ui" line="2736"/>
<location filename="mainwindow.ui" line="2739"/>
<source>Delete To Word Begin</source> <source>Delete To Word Begin</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2739"/> <location filename="mainwindow.ui" line="2742"/>
<source>Ctrl+Shift+B</source> <source>Ctrl+Shift+B</source>
<translation>Ctrl+Shift+B</translation> <translation>Ctrl+Shift+B</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2744"/> <location filename="mainwindow.ui" line="2747"/>
<source>Delete to Word End</source> <source>Delete to Word End</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2747"/> <location filename="mainwindow.ui" line="2750"/>
<source>Ctrl+Shift+E</source> <source>Ctrl+Shift+E</source>
<translation>Ctrl+Shift+E</translation> <translation>Ctrl+Shift+E</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2752"/> <location filename="mainwindow.ui" line="2755"/>
<source>New Class...</source> <source>New Class...</source>
<oldsource>Add Class...</oldsource> <oldsource>Add Class...</oldsource>
<translation>...</translation> <translation>...</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2757"/>
<location filename="mainwindow.ui" line="2760"/> <location filename="mainwindow.ui" line="2760"/>
<location filename="mainwindow.ui" line="2763"/>
<source>New Header...</source> <source>New Header...</source>
<oldsource>New Header</oldsource> <oldsource>New Header</oldsource>
<translation>...</translation> <translation>...</translation>
@ -4751,47 +4775,47 @@ Are you really want to continue?</oldsource>
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2684"/> <location filename="mainwindow.ui" line="2687"/>
<source>Delete Line</source> <source>Delete Line</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2687"/> <location filename="mainwindow.ui" line="2690"/>
<source>Ctrl+D</source> <source>Ctrl+D</source>
<translation>Ctrl+D</translation> <translation>Ctrl+D</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2692"/> <location filename="mainwindow.ui" line="2695"/>
<source>Duplicate Line</source> <source>Duplicate Line</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2695"/> <location filename="mainwindow.ui" line="2698"/>
<source>Ctrl+E</source> <source>Ctrl+E</source>
<translation>Ctrl+E</translation> <translation>Ctrl+E</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2700"/> <location filename="mainwindow.ui" line="2703"/>
<source>Delete Word</source> <source>Delete Word</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2703"/> <location filename="mainwindow.ui" line="2706"/>
<source>Ctrl+Shift+D</source> <source>Ctrl+Shift+D</source>
<translation>Ctrl+Shift+D</translation> <translation>Ctrl+Shift+D</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2708"/> <location filename="mainwindow.ui" line="2711"/>
<source>Delete to EOL</source> <source>Delete to EOL</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2711"/> <location filename="mainwindow.ui" line="2714"/>
<source>Ctrl+Del</source> <source>Ctrl+Del</source>
<translation>Ctrl+Del</translation> <translation>Ctrl+Del</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2716"/> <location filename="mainwindow.ui" line="2719"/>
<source>Delete to BOL</source> <source>Delete to BOL</source>
<translation></translation> <translation></translation>
</message> </message>
@ -4825,12 +4849,11 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2553"/>
<source>Open Folder</source> <source>Open Folder</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2562"/> <location filename="mainwindow.ui" line="2565"/>
<source>Running Parameters...</source> <source>Running Parameters...</source>
<translation>...</translation> <translation>...</translation>
</message> </message>
@ -5440,6 +5463,8 @@ Are you really want to continue?</oldsource>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="mainwindow.ui" line="2553"/>
<location filename="mainwindow.ui" line="2556"/>
<location filename="mainwindow.cpp" line="6222"/> <location filename="mainwindow.cpp" line="6222"/>
<source>Choose Working Folder</source> <source>Choose Working Folder</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -6704,7 +6729,7 @@ Are you really want to continue?</oldsource>
<context> <context>
<name>QApplication</name> <name>QApplication</name>
<message> <message>
<location filename="main.cpp" line="219"/> <location filename="main.cpp" line="231"/>
<source>Error</source> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
@ -6758,23 +6783,23 @@ Are you really want to continue?</oldsource>
</message> </message>
<message> <message>
<location filename="colorscheme.cpp" line="572"/> <location filename="colorscheme.cpp" line="572"/>
<location filename="main.cpp" line="97"/> <location filename="main.cpp" line="98"/>
<location filename="main.cpp" line="104"/> <location filename="main.cpp" line="105"/>
<source>Error</source> <source>Error</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="main.cpp" line="98"/> <location filename="main.cpp" line="99"/>
<source>Can&apos;t create configuration folder %1</source> <source>Can&apos;t create configuration folder %1</source>
<translation>&quot;%1&quot;</translation> <translation>&quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="main.cpp" line="105"/> <location filename="main.cpp" line="106"/>
<source>Can&apos;t write to configuration file %1</source> <source>Can&apos;t write to configuration file %1</source>
<translation>&quot;%1&quot;</translation> <translation>&quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="main.cpp" line="170"/> <location filename="main.cpp" line="182"/>
<source>Can&apos;t load autolink settings</source> <source>Can&apos;t load autolink settings</source>
<translation></translation> <translation></translation>
</message> </message>
@ -7409,7 +7434,7 @@ Are you really want to continue?</oldsource>
<translation>&quot;%1&quot;:%2</translation> <translation>&quot;%1&quot;:%2</translation>
</message> </message>
<message> <message>
<location filename="vcs/gitmanager.cpp" line="345"/> <location filename="vcs/gitmanager.cpp" line="348"/>
<location filename="vcs/gitmergedialog.cpp" line="18"/> <location filename="vcs/gitmergedialog.cpp" line="18"/>
<source>&lt;Auto Generated by Git&gt;</source> <source>&lt;Auto Generated by Git&gt;</source>
<translation>&lt;Git自动生成&gt;</translation> <translation>&lt;Git自动生成&gt;</translation>

View File

@ -109,4 +109,10 @@
<file>images/associations/template.ico</file> <file>images/associations/template.ico</file>
<file>images/dark-close.svg</file> <file>images/dark-close.svg</file>
</qresource> </qresource>
<qresource prefix="/demos">
<file alias="dark.png">images/demos/dark.png</file>
<file alias="dark-zh_CN.png">images/demos/dark-zh_CN.png</file>
<file alias="light.png">images/demos/light.png</file>
<file alias="light-zh_CN.png">images/demos/light-zh_CN.png</file>
</qresource>
</RCC> </RCC>

View File

@ -35,6 +35,8 @@
#include "platform.h" #include "platform.h"
#include "parser/parserutils.h" #include "parser/parserutils.h"
#include "editorlist.h" #include "editorlist.h"
#include "widgets/choosethemedialog.h"
#include "thememanager.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#endif #endif
@ -109,6 +111,21 @@ QString getSettingFilename(const QString& filepath, bool& firstRun) {
return filename; return filename;
} }
void setTheme(const QString& theme) {
pSettings->environment().setTheme(theme);
ThemeManager themeManager;
PAppTheme appTheme = themeManager.theme(theme);
if (appTheme && !appTheme->defaultColorScheme().isEmpty()) {
pSettings->editor().setColorScheme(appTheme->defaultColorScheme());
pSettings->editor().save();
}
if (appTheme && !appTheme->defaultIconSet().isEmpty()) {
pSettings->environment().setIconSet(appTheme->defaultIconSet());
}
pSettings->environment().save();
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
//QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
@ -157,6 +174,18 @@ int main(int argc, char *argv[])
pSettings->compilerSets().saveSets(); pSettings->compilerSets().saveSets();
} }
pSettings->load(); pSettings->load();
if (firstRun) {
//set theme
ChooseThemeDialog themeDialog;
themeDialog.exec();
switch (themeDialog.theme()) {
case ChooseThemeDialog::Theme::Dark:
setTheme("dark");
break;
default:
setTheme("default");
}
}
auto settings = std::unique_ptr<Settings>(pSettings); auto settings = std::unique_ptr<Settings>(pSettings);
//Color scheme settings must be loaded after translation //Color scheme settings must be loaded after translation

View File

@ -5058,7 +5058,7 @@ void Settings::UI::doLoad()
mBottomPanelIndex = intValue("bottom_panel_index",0); mBottomPanelIndex = intValue("bottom_panel_index",0);
mLeftPanelOpenned = boolValue("left_panel_openned",true); mLeftPanelOpenned = boolValue("left_panel_openned",true);
mLeftPanelWidth = intValue("left_panel_width",250); mLeftPanelWidth = intValue("left_panel_width",250);
mLeftPanelIndex = intValue("left_panel_index",2); mLeftPanelIndex = intValue("left_panel_index",0);
mClassBrowserSortAlpha = boolValue("class_browser_sort_alphabetically",true); mClassBrowserSortAlpha = boolValue("class_browser_sort_alphabetically",true);
mClassBrowserSortType = boolValue("class_browser_sort_by_type",true); mClassBrowserSortType = boolValue("class_browser_sort_by_type",true);
mClassBrowserShowInherited = boolValue("class_browser_show_inherited",true); mClassBrowserShowInherited = boolValue("class_browser_show_inherited",true);

View File

@ -0,0 +1,28 @@
#include "choosethemedialog.h"
#include "ui_choosethemedialog.h"
ChooseThemeDialog::ChooseThemeDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ChooseThemeDialog)
{
ui->setupUi(this);
ui->rbDark->setChecked(true);
}
ChooseThemeDialog::~ChooseThemeDialog()
{
delete ui;
}
ChooseThemeDialog::Theme ChooseThemeDialog::theme()
{
if (ui->rbDark->isChecked())
return Theme::Dark;
return Theme::Light;
}
void ChooseThemeDialog::on_btnOk_clicked()
{
accept();
}

View File

@ -0,0 +1,30 @@
#ifndef CHOOSETHEMEDIALOG_H
#define CHOOSETHEMEDIALOG_H
#include <QDialog>
namespace Ui {
class ChooseThemeDialog;
}
class ChooseThemeDialog : public QDialog
{
Q_OBJECT
public:
enum class Theme {
Dark,
Light
};
explicit ChooseThemeDialog(QWidget *parent = nullptr);
~ChooseThemeDialog();
Theme theme();
private slots:
void on_btnOk_clicked();
private:
Ui::ChooseThemeDialog *ui;
};
#endif // CHOOSETHEMEDIALOG_H

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChooseThemeDialog</class>
<widget class="QDialog" name="ChooseThemeDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1041</width>
<height>593</height>
</rect>
</property>
<property name="windowTitle">
<string>Choose Theme</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="grpTheme">
<property name="title">
<string>Choose Theme</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="rbDark">
<property name="text">
<string>Dark Theme</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/demos/dark.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="rbLight">
<property name="text">
<string>Light Theme</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_2">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/demos/light.png</pixmap>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>77</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1828</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnOk">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>