- enhancement: choose default language when first run

This commit is contained in:
Roy Qu 2022-07-28 14:03:18 +08:00
parent c7e8ee6072
commit 8bd2802c99
8 changed files with 451 additions and 345 deletions

View File

@ -2,7 +2,9 @@ Red Panda C++ Version 1.1.6
- fix: block indent doesn't work - fix: block indent doesn't work
- fix: selection is not correctly set after input in column mode - fix: selection is not correctly set after input in column mode
- fix: in #if, defined without () not correctly processed
- enhancement: don't show cpp defines when editing c files - enhancement: don't show cpp defines when editing c files
- enhancement: choose default language when first run
Red Panda C++ Version 1.1.5 Red Panda C++ Version 1.1.5

View File

@ -283,6 +283,18 @@
<source>Ok</source> <source>Ok</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Default Language:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>C</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>C++</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CodeSnippetsManager</name> <name>CodeSnippetsManager</name>

File diff suppressed because it is too large Load Diff

View File

@ -283,6 +283,18 @@
<source>Ok</source> <source>Ok</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Default Language:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>C</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>C++</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CodeSnippetsManager</name> <name>CodeSnippetsManager</name>

View File

@ -337,6 +337,10 @@ int main(int argc, char *argv[])
default: default:
setTheme("default"); setTheme("default");
} }
pSettings->editor().setDefaultFileCpp(themeDialog.language()==ChooseThemeDialog::Language::CPlusPlus);
pSettings->editor().save();
//auto detect git in path //auto detect git in path
pSettings->vcs().detectGitInPath(); pSettings->vcs().detectGitInPath();
} }

View File

@ -23,6 +23,7 @@ ChooseThemeDialog::ChooseThemeDialog(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
ui->rbDark->setChecked(true); ui->rbDark->setChecked(true);
ui->rbCpp->setChecked(true);
} }
ChooseThemeDialog::~ChooseThemeDialog() ChooseThemeDialog::~ChooseThemeDialog()
@ -37,6 +38,11 @@ ChooseThemeDialog::Theme ChooseThemeDialog::theme()
return Theme::Light; return Theme::Light;
} }
ChooseThemeDialog::Language ChooseThemeDialog::language()
{
return ui->rbCpp->isChecked()?Language::CPlusPlus:Language::C;
}
void ChooseThemeDialog::on_btnOk_clicked() void ChooseThemeDialog::on_btnOk_clicked()
{ {
accept(); accept();

View File

@ -32,9 +32,15 @@ public:
Dark, Dark,
Light Light
}; };
enum class Language {
C,
CPlusPlus
};
explicit ChooseThemeDialog(QWidget *parent = nullptr); explicit ChooseThemeDialog(QWidget *parent = nullptr);
~ChooseThemeDialog(); ~ChooseThemeDialog();
Theme theme(); Theme theme();
Language language();
private slots: private slots:
void on_btnOk_clicked(); void on_btnOk_clicked();

View File

@ -69,6 +69,52 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Default Language:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbC">
<property name="text">
<string>C</string>
</property>
<attribute name="buttonGroup">
<string notr="true">grpDefaultLanguage</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbCpp">
<property name="text">
<string>C++</string>
</property>
<attribute name="buttonGroup">
<string notr="true">grpDefaultLanguage</string>
</attribute>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@ -126,4 +172,7 @@
<include location="../icons.qrc"/> <include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
<buttongroups>
<buttongroup name="grpDefaultLanguage"/>
</buttongroups>
</ui> </ui>