work save: editor misc settings dialog

This commit is contained in:
royqh1979 2021-08-30 17:10:46 +08:00
parent dd39b251b4
commit 70203612c5
4 changed files with 158 additions and 0 deletions

View File

@ -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 \

View File

@ -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();
}

View File

@ -0,0 +1,28 @@
#ifndef EDITORMISCWIDGET_H
#define EDITORMISCWIDGET_H
#include <QWidget>
#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

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditorMiscWidget</class>
<widget class="QWidget" name="EditorMiscWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="chkReadonlySystemHeaders">
<property name="text">
<string>Open system header files in read only mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkLoadLastFiles">
<property name="text">
<string>Auto load files being open when Red Panda C++ last exited.</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Default file type</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="rbCppFile">
<property name="text">
<string>C++ files</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rbCFile">
<property name="text">
<string>C files</string>
</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>117</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>