2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-04-17 23:17:22 +08:00
|
|
|
#include "settingsdialog.h"
|
|
|
|
#include "ui_settingsdialog.h"
|
|
|
|
#include "settingswidget.h"
|
|
|
|
#include "compilersetoptionwidget.h"
|
2021-09-04 16:34:14 +08:00
|
|
|
#include "compilerautolinkwidget.h"
|
2021-06-07 11:02:03 +08:00
|
|
|
#include "editorgeneralwidget.h"
|
2021-06-08 21:41:42 +08:00
|
|
|
#include "editorfontwidget.h"
|
2021-06-12 22:36:23 +08:00
|
|
|
#include "editorclipboardwidget.h"
|
2021-06-17 10:39:46 +08:00
|
|
|
#include "editorcolorschemewidget.h"
|
2021-08-30 16:59:08 +08:00
|
|
|
#include "editorcodecompletionwidget.h"
|
2021-06-25 12:40:11 +08:00
|
|
|
#include "editorsyntaxcheckwidget.h"
|
2021-06-21 16:25:21 +08:00
|
|
|
#include "editorsymbolcompletionwidget.h"
|
2021-09-21 20:36:43 +08:00
|
|
|
#include "editortooltipswidget.h"
|
2021-08-30 22:05:45 +08:00
|
|
|
#include "editorautosavewidget.h"
|
2021-09-30 12:52:22 +08:00
|
|
|
#include "editorsnippetwidget.h"
|
2022-11-22 15:14:05 +08:00
|
|
|
#include "editorcustomctypekeywords.h"
|
2021-08-30 18:36:44 +08:00
|
|
|
#include "editormiscwidget.h"
|
2023-07-25 09:41:20 +08:00
|
|
|
#include "environmentappearancewidget.h"
|
2021-10-06 23:19:18 +08:00
|
|
|
#include "environmentshortcutwidget.h"
|
2021-10-08 20:01:29 +08:00
|
|
|
#include "environmentfolderswidget.h"
|
2021-11-08 21:19:48 +08:00
|
|
|
#include "environmentperformancewidget.h"
|
2021-07-01 19:44:38 +08:00
|
|
|
#include "executorgeneralwidget.h"
|
2021-11-02 13:12:36 +08:00
|
|
|
#include "executorproblemsetwidget.h"
|
2021-08-01 23:24:37 +08:00
|
|
|
#include "debuggeneralwidget.h"
|
2021-09-01 00:05:46 +08:00
|
|
|
#include "formattergeneralwidget.h"
|
2023-02-28 10:49:50 +08:00
|
|
|
#include "languageasmgenerationwidget.h"
|
2023-03-09 21:08:08 +08:00
|
|
|
#include "languagecformatwidget.h"
|
2021-09-14 17:33:47 +08:00
|
|
|
#include "projectgeneralwidget.h"
|
2021-09-14 23:56:08 +08:00
|
|
|
#include "projectfileswidget.h"
|
2021-09-15 11:23:42 +08:00
|
|
|
#include "projectcompilerwidget.h"
|
2021-09-15 16:57:28 +08:00
|
|
|
#include "projectcompileparamaterswidget.h"
|
|
|
|
#include "projectdirectorieswidget.h"
|
|
|
|
#include "projectprecompilewidget.h"
|
2021-09-15 22:19:59 +08:00
|
|
|
#include "projectoutputwidget.h"
|
|
|
|
#include "projectmakefilewidget.h"
|
2021-09-18 22:37:07 +08:00
|
|
|
#include "projectdllhostwidget.h"
|
2021-10-08 00:06:41 +08:00
|
|
|
#include "toolsgeneralwidget.h"
|
2022-02-08 23:38:29 +08:00
|
|
|
#include "toolsgitwidget.h"
|
2021-12-24 23:18:20 +08:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
#include "environmentfileassociationwidget.h"
|
|
|
|
#include "projectversioninfowidget.h"
|
|
|
|
#endif
|
2021-12-25 23:38:53 +08:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
#include "environmentprogramswidget.h"
|
2021-12-27 22:46:54 +08:00
|
|
|
#include "formatterpathwidget.h"
|
2021-12-25 23:38:53 +08:00
|
|
|
#endif
|
2021-04-17 23:17:22 +08:00
|
|
|
#include <QDebug>
|
2021-04-18 00:08:01 +08:00
|
|
|
#include <QMessageBox>
|
2021-06-18 21:48:40 +08:00
|
|
|
#include <QModelIndex>
|
2021-12-17 10:10:04 +08:00
|
|
|
#include <QDesktopWidget>
|
2021-04-17 23:17:22 +08:00
|
|
|
|
|
|
|
SettingsDialog::SettingsDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::SettingsDialog)
|
|
|
|
{
|
2022-02-02 17:34:37 +08:00
|
|
|
setWindowFlag(Qt::WindowContextHelpButtonHint,false);
|
2021-04-17 23:17:22 +08:00
|
|
|
ui->setupUi(this);
|
|
|
|
|
2022-10-10 18:05:18 +08:00
|
|
|
QItemSelectionModel *m=ui->widgetsView->selectionModel();
|
2021-04-17 23:17:22 +08:00
|
|
|
ui->widgetsView->setModel(&model);
|
2022-10-10 18:05:18 +08:00
|
|
|
delete m;
|
2021-04-17 23:17:22 +08:00
|
|
|
|
|
|
|
model.setHorizontalHeaderLabels(QStringList());
|
|
|
|
|
|
|
|
ui->btnApply->setEnabled(false);
|
|
|
|
|
2021-10-08 20:01:29 +08:00
|
|
|
mAppShouldQuit = false;
|
2021-12-23 09:11:58 +08:00
|
|
|
resize(pSettings->ui().settingsDialogWidth(),pSettings->ui().settingsDialogHeight());
|
|
|
|
|
|
|
|
QList<int> sizes = ui->splitter->sizes();
|
|
|
|
int tabWidth = pSettings->ui().settingsDialogSplitterPos();
|
|
|
|
int totalSize = sizes[0] + sizes[1];
|
|
|
|
sizes[0] = tabWidth;
|
|
|
|
sizes[1] = std::max(1,totalSize - sizes[0]);
|
|
|
|
ui->splitter->setSizes(sizes);
|
2021-04-17 23:17:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SettingsDialog::~SettingsDialog()
|
|
|
|
{
|
|
|
|
for (SettingsWidget* p:mSettingWidgets) {
|
|
|
|
p->setParent(nullptr);
|
|
|
|
delete p;
|
|
|
|
}
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsDialog::addWidget(SettingsWidget *pWidget)
|
|
|
|
{
|
2022-01-10 08:35:57 +08:00
|
|
|
pWidget->init();
|
2021-04-17 23:17:22 +08:00
|
|
|
QList<QStandardItem*> items = model.findItems(pWidget->group());
|
|
|
|
QStandardItem* pGroupItem;
|
|
|
|
if (items.count() == 0 ) {
|
|
|
|
pGroupItem = new QStandardItem(pWidget->group());
|
|
|
|
pGroupItem->setData(-1, GetWidgetIndexRole);
|
|
|
|
model.appendRow(pGroupItem);
|
|
|
|
} else {
|
|
|
|
pGroupItem = items[0];
|
|
|
|
}
|
|
|
|
mSettingWidgets.append(pWidget);
|
|
|
|
QStandardItem* pWidgetItem = new QStandardItem(pWidget->name());
|
|
|
|
pWidgetItem->setData(mSettingWidgets.count()-1, GetWidgetIndexRole);
|
|
|
|
pGroupItem->appendRow(pWidgetItem);
|
|
|
|
connect(pWidget, &SettingsWidget::settingsChanged,
|
2021-09-14 12:10:43 +08:00
|
|
|
this , &SettingsDialog::widget_settings_changed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsDialog::selectFirstWidget()
|
|
|
|
{
|
|
|
|
ui->widgetsView->expandAll();
|
|
|
|
//select the first widget of the first group
|
|
|
|
auto groupIndex = ui->widgetsView->model()->index(0,0);
|
|
|
|
auto widgetIndex = ui->widgetsView->model()->index(0,0, groupIndex);
|
|
|
|
ui->widgetsView->selectionModel()->setCurrentIndex(
|
|
|
|
widgetIndex,
|
|
|
|
QItemSelectionModel::Select
|
|
|
|
);
|
|
|
|
on_widgetsView_clicked(widgetIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
PSettingsDialog SettingsDialog::optionDialog()
|
|
|
|
{
|
|
|
|
PSettingsDialog dialog = std::make_shared<SettingsDialog>();
|
|
|
|
|
2021-11-14 18:48:18 +08:00
|
|
|
dialog->setWindowTitle(tr("Options"));
|
|
|
|
|
2022-01-10 08:35:57 +08:00
|
|
|
SettingsWidget* widget;
|
2023-07-25 09:41:20 +08:00
|
|
|
widget = new EnvironmentAppearanceWidget(tr("Appearance"),tr("Environment"));
|
2021-09-14 12:10:43 +08:00
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-12-24 23:18:20 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-10-06 23:19:18 +08:00
|
|
|
widget = new EnvironmentFileAssociationWidget(tr("File Association"),tr("Environment"));
|
|
|
|
dialog->addWidget(widget);
|
2021-12-24 23:18:20 +08:00
|
|
|
#endif
|
2021-10-06 23:19:18 +08:00
|
|
|
|
|
|
|
widget = new EnvironmentShortcutWidget(tr("Shortcuts"),tr("Environment"));
|
2021-10-04 19:23:52 +08:00
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-12-25 23:38:53 +08:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
widget = new EnvironmentProgramsWidget(tr("Terminal"),tr("Environment"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
#endif
|
|
|
|
|
2021-11-08 21:19:48 +08:00
|
|
|
widget = new EnvironmentPerformanceWidget(tr("Performance"),tr("Environment"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2023-02-28 10:49:50 +08:00
|
|
|
widget = new EnvironmentFoldersWidget(tr("Folders / Restore Default Settings"),tr("Environment"));
|
|
|
|
connect((EnvironmentFoldersWidget*)widget,
|
|
|
|
&EnvironmentFoldersWidget::shouldQuitApp,
|
|
|
|
dialog.get(),
|
|
|
|
&SettingsDialog::closeAndQuit);
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-14 12:10:43 +08:00
|
|
|
widget = new CompilerSetOptionWidget(tr("Compiler Set"),tr("Compiler"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new CompilerAutolinkWidget(tr("Auto Link"),tr("Compiler"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new EditorGeneralWidget(tr("General"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new EditorFontWidget(tr("Font"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new EditorClipboardWidget(tr("Copy & Export"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new EditorColorSchemeWidget(tr("Color"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new EditorCodeCompletionWidget(tr("Code Completion"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new EditorSymbolCompletionWidget(tr("Symbol Completion"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-30 12:52:22 +08:00
|
|
|
widget = new EditorSnippetWidget(tr("Snippet"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-14 12:10:43 +08:00
|
|
|
widget = new EditorSyntaxCheckWidget(tr("Auto Syntax Checking"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-21 20:36:43 +08:00
|
|
|
widget = new EditorTooltipsWidget(tr("Tooltips"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-14 12:10:43 +08:00
|
|
|
widget = new EditorAutoSaveWidget(tr("Auto save"),tr("Editor"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2023-02-28 10:49:50 +08:00
|
|
|
widget = new EditorMiscWidget(tr("Misc"),tr("Editor"));
|
2022-11-22 15:14:05 +08:00
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2023-02-28 10:49:50 +08:00
|
|
|
widget = new EditorCustomCTypeKeywordsWidget(tr("Custom C/C++ Keywords"),tr("Languages"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2023-03-09 21:08:08 +08:00
|
|
|
// widget = new LanguageCFormatWidget(tr("C/C++ Format"),tr("Languages"));
|
|
|
|
// dialog->addWidget(widget);
|
2023-02-28 10:49:50 +08:00
|
|
|
widget = new LanguageAsmGenerationWidget(tr("ASM Generation"),tr("Languages"));
|
2021-09-14 12:10:43 +08:00
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new ExecutorGeneralWidget(tr("General"),tr("Program Runner"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-11-02 13:12:36 +08:00
|
|
|
widget = new ExecutorProblemSetWidget(tr("Problem Set"),tr("Program Runner"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-14 12:10:43 +08:00
|
|
|
widget = new DebugGeneralWidget(tr("General"),tr("Debugger"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new FormatterGeneralWidget(tr("General"),tr("Code Formatter"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-12-27 22:46:54 +08:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
widget = new FormatterPathWidget(tr("Program"),tr("Code Formatter"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
#endif
|
|
|
|
|
2021-10-08 00:06:41 +08:00
|
|
|
widget = new ToolsGeneralWidget(tr("General"),tr("Tools"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2022-02-08 23:38:29 +08:00
|
|
|
widget = new ToolsGitWidget(tr("Git"),tr("Tools"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
|
2021-09-14 12:10:43 +08:00
|
|
|
dialog->selectFirstWidget();
|
|
|
|
|
|
|
|
return dialog;
|
2021-04-17 23:17:22 +08:00
|
|
|
}
|
|
|
|
|
2021-09-14 17:33:47 +08:00
|
|
|
PSettingsDialog SettingsDialog::projectOptionDialog()
|
|
|
|
{
|
|
|
|
PSettingsDialog dialog = std::make_shared<SettingsDialog>();
|
|
|
|
|
2021-11-14 18:48:18 +08:00
|
|
|
dialog->setWindowTitle(tr("Project Options"));
|
|
|
|
|
2021-09-14 17:33:47 +08:00
|
|
|
SettingsWidget* widget = new ProjectGeneralWidget(tr("General"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-14 23:56:08 +08:00
|
|
|
widget = new ProjectFilesWidget(tr("Files"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-15 11:23:42 +08:00
|
|
|
widget = new ProjectCompilerWidget(tr("Compiler Set"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-15 16:57:28 +08:00
|
|
|
widget = new ProjectCompileParamatersWidget(tr("Custom Compile options"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new ProjectDirectoriesWidget(tr("Directories"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new ProjectPreCompileWidget(tr("Precompiled Header"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-15 22:19:59 +08:00
|
|
|
widget = new ProjectMakefileWidget(tr("Makefile"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
|
|
|
widget = new ProjectOutputWidget(tr("Output"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-09-18 22:37:07 +08:00
|
|
|
widget = new ProjectDLLHostWidget(tr("DLL host"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
|
|
|
|
2021-12-24 23:18:20 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-09-15 22:19:59 +08:00
|
|
|
widget = new ProjectVersionInfoWidget(tr("Version info"),tr("Project"));
|
|
|
|
dialog->addWidget(widget);
|
2021-12-24 23:18:20 +08:00
|
|
|
#endif
|
2021-09-15 22:19:59 +08:00
|
|
|
|
2021-09-14 17:33:47 +08:00
|
|
|
dialog->selectFirstWidget();
|
|
|
|
|
|
|
|
return dialog;
|
|
|
|
}
|
|
|
|
|
2021-10-24 17:31:20 +08:00
|
|
|
bool SettingsDialog::setCurrentWidget(const QString &widgetName, const QString &groupName)
|
|
|
|
{
|
|
|
|
QList<QStandardItem*> items = model.findItems(groupName);
|
|
|
|
if (items.isEmpty())
|
|
|
|
return false;
|
|
|
|
QStandardItem* pGroupItem = items[0];
|
|
|
|
for (int i=0;i<pGroupItem->rowCount();i++) {
|
|
|
|
QStandardItem* pWidgetItem = pGroupItem->child(i);
|
|
|
|
if (pWidgetItem->text() == widgetName) {
|
2021-10-24 23:13:00 +08:00
|
|
|
ui->widgetsView->setCurrentIndex(pWidgetItem->index());
|
2021-10-24 17:31:20 +08:00
|
|
|
on_widgetsView_clicked(pWidgetItem->index());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-04-17 23:17:22 +08:00
|
|
|
|
|
|
|
void SettingsDialog::on_widgetsView_clicked(const QModelIndex &index)
|
|
|
|
{
|
|
|
|
if (!index.isValid())
|
|
|
|
return;
|
|
|
|
int i = index.data(GetWidgetIndexRole).toInt();
|
|
|
|
if (i>=0) {
|
2021-04-18 00:08:01 +08:00
|
|
|
saveCurrentPageSettings(true);
|
2021-04-17 23:17:22 +08:00
|
|
|
SettingsWidget* pWidget = mSettingWidgets[i];
|
2021-06-07 11:02:03 +08:00
|
|
|
if (ui->scrollArea->widget()!=nullptr) {
|
|
|
|
QWidget* w = ui->scrollArea->takeWidget();
|
|
|
|
w->setParent(nullptr);
|
|
|
|
}
|
2021-04-17 23:17:22 +08:00
|
|
|
ui->scrollArea->setWidget(pWidget);
|
|
|
|
ui->lblWidgetCaption->setText(QString("%1 > %2").arg(pWidget->group()).arg(pWidget->name()));
|
|
|
|
|
|
|
|
ui->btnApply->setEnabled(false);
|
2021-08-30 22:48:59 +08:00
|
|
|
} else if (model.hasChildren(index)) {
|
|
|
|
ui->widgetsView->expand(index);
|
|
|
|
QModelIndex childIndex = this->model.index(0,0,index);
|
|
|
|
emit ui->widgetsView->clicked(childIndex);
|
2021-04-17 23:17:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsDialog::widget_settings_changed(bool value)
|
|
|
|
{
|
|
|
|
ui->btnApply->setEnabled(value);
|
|
|
|
}
|
2021-04-18 00:08:01 +08:00
|
|
|
|
2021-12-08 22:47:28 +08:00
|
|
|
void SettingsDialog::on_btnCancel_pressed()
|
2021-04-18 00:08:01 +08:00
|
|
|
{
|
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsDialog::on_btnApply_pressed()
|
|
|
|
{
|
|
|
|
saveCurrentPageSettings(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsDialog::on_btnOk_pressed()
|
|
|
|
{
|
|
|
|
saveCurrentPageSettings(false);
|
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsDialog::saveCurrentPageSettings(bool confirm)
|
|
|
|
{
|
2021-04-18 11:25:40 +08:00
|
|
|
if (ui->scrollArea->widget()==ui->scrollAreaWidgetContents)
|
2021-04-18 00:08:01 +08:00
|
|
|
return;
|
|
|
|
SettingsWidget* pWidget = (SettingsWidget*) ui->scrollArea->widget();
|
|
|
|
if (!pWidget->isSettingsChanged())
|
|
|
|
return;
|
|
|
|
if (confirm) {
|
2021-06-21 11:21:26 +08:00
|
|
|
if (QMessageBox::warning(this,tr("Save Changes"),
|
2021-04-18 00:08:01 +08:00
|
|
|
tr("There are changes in the settings, do you want to save them before swtich to other page?"),
|
|
|
|
QMessageBox::Yes, QMessageBox::No)!=QMessageBox::Yes) {
|
2021-04-18 11:25:40 +08:00
|
|
|
return;
|
|
|
|
}
|
2021-04-18 00:08:01 +08:00
|
|
|
}
|
|
|
|
pWidget->save();
|
|
|
|
}
|
2021-10-08 20:01:29 +08:00
|
|
|
|
2021-12-23 09:11:58 +08:00
|
|
|
void SettingsDialog::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
|
|
|
pSettings->ui().setSettingsDialogWidth(width());
|
|
|
|
pSettings->ui().setSettingsDialogHeight(height());
|
|
|
|
|
|
|
|
QList<int> sizes = ui->splitter->sizes();
|
|
|
|
pSettings->ui().setSettingsDialogSplitterPos(sizes[0]);
|
|
|
|
|
|
|
|
QDialog::closeEvent(event);
|
|
|
|
}
|
|
|
|
|
2021-10-08 20:01:29 +08:00
|
|
|
bool SettingsDialog::appShouldQuit() const
|
|
|
|
{
|
|
|
|
return mAppShouldQuit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsDialog::closeAndQuit()
|
|
|
|
{
|
|
|
|
mAppShouldQuit = true;
|
|
|
|
close();
|
|
|
|
}
|