From 70203612c578392850e840c0f68f851113c8a278 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Mon, 30 Aug 2021 17:10:46 +0800 Subject: [PATCH] work save: editor misc settings dialog --- RedPandaIDE/RedPandaIDE.pro | 3 + .../settingsdialog/editormiscwidget.cpp | 56 +++++++++++++++ RedPandaIDE/settingsdialog/editormiscwidget.h | 28 ++++++++ .../settingsdialog/editormiscwidget.ui | 71 +++++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 RedPandaIDE/settingsdialog/editormiscwidget.cpp create mode 100644 RedPandaIDE/settingsdialog/editormiscwidget.h create mode 100644 RedPandaIDE/settingsdialog/editormiscwidget.ui diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 6b59809f..09fd3eb6 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -30,6 +30,7 @@ SOURCES += \ qsynedit/SearchRegex.cpp \ settingsdialog/debuggeneralwidget.cpp \ settingsdialog/editorcodecompletionwidget.cpp \ + settingsdialog/editormiscwidget.cpp \ widgets/classbrowser.cpp \ widgets/codecompletionlistview.cpp \ widgets/codecompletionpopup.cpp \ @@ -97,6 +98,7 @@ HEADERS += \ qsynedit/SearchRegex.h \ settingsdialog/debuggeneralwidget.h \ settingsdialog/editorcodecompletionwidget.h \ + settingsdialog/editormiscwidget.h \ widgets/classbrowser.h \ widgets/codecompletionlistview.h \ widgets/codecompletionpopup.h \ @@ -150,6 +152,7 @@ HEADERS += \ FORMS += \ settingsdialog/debuggeneralwidget.ui \ settingsdialog/editorcodecompletionwidget.ui \ + settingsdialog/editormiscwidget.ui \ widgets/cpudialog.ui \ mainwindow.ui \ settingsdialog/compilersetdirectorieswidget.ui \ diff --git a/RedPandaIDE/settingsdialog/editormiscwidget.cpp b/RedPandaIDE/settingsdialog/editormiscwidget.cpp new file mode 100644 index 00000000..a4b10ef3 --- /dev/null +++ b/RedPandaIDE/settingsdialog/editormiscwidget.cpp @@ -0,0 +1,56 @@ +#include "editormiscwidget.h" +#include "ui_editormiscwidget.h" + +EditorMiscWidget::EditorMiscWidget(const QString& name, const QString& group, + QWidget *parent) : + SettingsWidget(name,group,parent), + ui(new Ui::EditorMiscWidget) +{ + ui->setupUi(this); +} + +EditorMiscWidget::~EditorMiscWidget() +{ + delete ui; +} + +void EditorMiscWidget::doLoad() +{ + ui->grpEnabled->setChecked(pSettings->codeCompletion().enabled()); + + ui->chkParseLocalFiles->setChecked(pSettings->codeCompletion().parseLocalHeaders()); + ui->chkParseSystemFiles->setChecked(pSettings->codeCompletion().parseGlobalHeaders()); + + ui->spinWidth->setValue(pSettings->codeCompletion().width()); + ui->spinHeight->setValue(pSettings->codeCompletion().height()); + + ui->chkShowSuggestionWhileTyping->setChecked(pSettings->codeCompletion().showCompletionWhileInput()); + ui->chkRecordUsage->setChecked(pSettings->codeCompletion().recordUsage()); + ui->chkSortByScope->setChecked(pSettings->codeCompletion().sortByScope()); + ui->chkShowKeywords->setChecked(pSettings->codeCompletion().showKeywords()); + ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase()); + ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc()); + ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns()); +} + +void EditorMiscWidget::doSave() +{ + //font + pSettings->codeCompletion().setEnabled(ui->grpEnabled->isChecked()); + + pSettings->codeCompletion().setParseLocalHeaders(ui->chkParseLocalFiles->isChecked()); + pSettings->codeCompletion().setParseGlobalHeaders(ui->chkParseSystemFiles->isChecked()); + + pSettings->codeCompletion().setWidth(ui->spinWidth->value()); + pSettings->codeCompletion().setHeight(ui->spinHeight->value()); + + pSettings->codeCompletion().setShowCompletionWhileInput(ui->chkShowSuggestionWhileTyping->isChecked()); + pSettings->codeCompletion().setRecordUsage(ui->chkRecordUsage->isChecked()); + pSettings->codeCompletion().setSortByScope(ui->chkSortByScope->isChecked()); + pSettings->codeCompletion().setShowKeywords(ui->chkShowKeywords->isChecked()); + pSettings->codeCompletion().setIgnoreCase(ui->chkIgnoreCases->isChecked()); + pSettings->codeCompletion().setAppendFunc(ui->chkAppendFunc->isChecked()); + pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked()); + + pSettings->editor().save(); +} diff --git a/RedPandaIDE/settingsdialog/editormiscwidget.h b/RedPandaIDE/settingsdialog/editormiscwidget.h new file mode 100644 index 00000000..7ae00831 --- /dev/null +++ b/RedPandaIDE/settingsdialog/editormiscwidget.h @@ -0,0 +1,28 @@ +#ifndef EDITORMISCWIDGET_H +#define EDITORMISCWIDGET_H + +#include +#include "settingswidget.h" + +namespace Ui { +class EditorMiscWidget; +} + +class EditorMiscWidget : public SettingsWidget +{ + Q_OBJECT + +public: + explicit EditorMiscWidget(const QString& name, const QString& group, QWidget *parent = nullptr); + ~EditorMiscWidget(); + +private: + Ui::EditorMiscWidget *ui; + + // SettingsWidget interface +protected: + void doLoad() override; + void doSave() override; +}; + +#endif // EDITORMISCWIDGET_H diff --git a/RedPandaIDE/settingsdialog/editormiscwidget.ui b/RedPandaIDE/settingsdialog/editormiscwidget.ui new file mode 100644 index 00000000..e8cf6e40 --- /dev/null +++ b/RedPandaIDE/settingsdialog/editormiscwidget.ui @@ -0,0 +1,71 @@ + + + EditorMiscWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Open system header files in read only mode + + + + + + + Auto load files being open when Red Panda C++ last exited. + + + + + + + Default file type + + + + + + C++ files + + + + + + + C files + + + + + + + + + + Qt::Vertical + + + + 20 + 117 + + + + + + + + +