- implement: default settings for code formatter
- implement: remove all custom settings
This commit is contained in:
parent
c4c62ec6c0
commit
8b4fa1f0fc
2
NEWS.md
2
NEWS.md
|
@ -28,6 +28,8 @@ Version 0.6.0
|
||||||
- fix: editor's inproject property not correctly setted (and may cause devcpp to crash when close project)
|
- fix: editor's inproject property not correctly setted (and may cause devcpp to crash when close project)
|
||||||
- implement: print
|
- implement: print
|
||||||
- implement: tools configuration
|
- implement: tools configuration
|
||||||
|
- implement: default settings for code formatter
|
||||||
|
- implement: remove all custom settings
|
||||||
|
|
||||||
Version 0.5.0
|
Version 0.5.0
|
||||||
- enhancement: support C++ using type alias;
|
- enhancement: support C++ using type alias;
|
||||||
|
|
|
@ -49,6 +49,7 @@ SOURCES += \
|
||||||
settingsdialog/editorsnippetwidget.cpp \
|
settingsdialog/editorsnippetwidget.cpp \
|
||||||
settingsdialog/editortooltipswidget.cpp \
|
settingsdialog/editortooltipswidget.cpp \
|
||||||
settingsdialog/environmentfileassociationwidget.cpp \
|
settingsdialog/environmentfileassociationwidget.cpp \
|
||||||
|
settingsdialog/environmentfolderswidget.cpp \
|
||||||
settingsdialog/environmentshortcutwidget.cpp \
|
settingsdialog/environmentshortcutwidget.cpp \
|
||||||
settingsdialog/formattergeneralwidget.cpp \
|
settingsdialog/formattergeneralwidget.cpp \
|
||||||
settingsdialog/projectcompileparamaterswidget.cpp \
|
settingsdialog/projectcompileparamaterswidget.cpp \
|
||||||
|
@ -158,6 +159,7 @@ HEADERS += \
|
||||||
settingsdialog/editorsnippetwidget.h \
|
settingsdialog/editorsnippetwidget.h \
|
||||||
settingsdialog/editortooltipswidget.h \
|
settingsdialog/editortooltipswidget.h \
|
||||||
settingsdialog/environmentfileassociationwidget.h \
|
settingsdialog/environmentfileassociationwidget.h \
|
||||||
|
settingsdialog/environmentfolderswidget.h \
|
||||||
settingsdialog/environmentshortcutwidget.h \
|
settingsdialog/environmentshortcutwidget.h \
|
||||||
settingsdialog/formattergeneralwidget.h \
|
settingsdialog/formattergeneralwidget.h \
|
||||||
settingsdialog/projectcompileparamaterswidget.h \
|
settingsdialog/projectcompileparamaterswidget.h \
|
||||||
|
@ -240,6 +242,7 @@ FORMS += \
|
||||||
settingsdialog/editorsnippetwidget.ui \
|
settingsdialog/editorsnippetwidget.ui \
|
||||||
settingsdialog/editortooltipswidget.ui \
|
settingsdialog/editortooltipswidget.ui \
|
||||||
settingsdialog/environmentfileassociationwidget.ui \
|
settingsdialog/environmentfileassociationwidget.ui \
|
||||||
|
settingsdialog/environmentfolderswidget.ui \
|
||||||
settingsdialog/environmentshortcutwidget.ui \
|
settingsdialog/environmentshortcutwidget.ui \
|
||||||
settingsdialog/formattergeneralwidget.ui \
|
settingsdialog/formattergeneralwidget.ui \
|
||||||
settingsdialog/projectcompileparamaterswidget.ui \
|
settingsdialog/projectcompileparamaterswidget.ui \
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -138,8 +138,14 @@ int main(int argc, char *argv[])
|
||||||
WindowLogoutEventFilter filter;
|
WindowLogoutEventFilter filter;
|
||||||
app.installNativeEventFilter(&filter);
|
app.installNativeEventFilter(&filter);
|
||||||
int retCode = app.exec();
|
int retCode = app.exec();
|
||||||
|
QString configDir = pSettings->dirs().config();
|
||||||
|
delete pSettings;
|
||||||
// save settings
|
// save settings
|
||||||
// settings->compilerSets().saveSets();
|
// settings->compilerSets().saveSets();
|
||||||
|
if (mainWindow.shouldRemoveAllSettings()) {
|
||||||
|
QDir dir(configDir);
|
||||||
|
dir.removeRecursively();
|
||||||
|
}
|
||||||
return retCode;
|
return retCode;
|
||||||
} catch (BaseError e) {
|
} catch (BaseError e) {
|
||||||
QMessageBox::critical(nullptr,QApplication::tr("Error"),e.reason());
|
QMessageBox::critical(nullptr,QApplication::tr("Error"),e.reason());
|
||||||
|
|
|
@ -46,9 +46,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
mSearchDialog(nullptr),
|
mSearchDialog(nullptr),
|
||||||
mQuitting(false),
|
mQuitting(false),
|
||||||
|
mCheckSyntaxInBack(false),
|
||||||
mOpenClosingBottomPanel(false),
|
mOpenClosingBottomPanel(false),
|
||||||
mOpenClosingLeftPanel(false),
|
mOpenClosingLeftPanel(false),
|
||||||
mCheckSyntaxInBack(false),
|
mShouldRemoveAllSettings(false),
|
||||||
mClosing(false),
|
mClosing(false),
|
||||||
mSystemTurnedOff(false)
|
mSystemTurnedOff(false)
|
||||||
{
|
{
|
||||||
|
@ -2534,18 +2535,20 @@ void MainWindow::on_actionOpen_triggered()
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
Settings::UI& settings = pSettings->ui();
|
if (!mShouldRemoveAllSettings) {
|
||||||
settings.setMainWindowState(saveState());
|
Settings::UI& settings = pSettings->ui();
|
||||||
settings.setMainWindowGeometry(saveGeometry());
|
settings.setMainWindowState(saveState());
|
||||||
settings.setBottomPanelHeight(mBottomPanelHeight);
|
settings.setMainWindowGeometry(saveGeometry());
|
||||||
settings.setBottomPanelIndex(ui->tabMessages->currentIndex());
|
settings.setBottomPanelHeight(mBottomPanelHeight);
|
||||||
settings.setBottomPanelOpenned(mBottomPanelOpenned);
|
settings.setBottomPanelIndex(ui->tabMessages->currentIndex());
|
||||||
settings.setLeftPanelWidth(mLeftPanelWidth);
|
settings.setBottomPanelOpenned(mBottomPanelOpenned);
|
||||||
settings.setLeftPanelIndex(ui->tabInfos->currentIndex());
|
settings.setLeftPanelWidth(mLeftPanelWidth);
|
||||||
settings.setLeftPanelOpenned(mLeftPanelOpenned);
|
settings.setLeftPanelIndex(ui->tabInfos->currentIndex());
|
||||||
settings.save();
|
settings.setLeftPanelOpenned(mLeftPanelOpenned);
|
||||||
|
settings.save();
|
||||||
|
}
|
||||||
|
|
||||||
if (pSettings->editor().autoLoadLastFiles()) {
|
if (!mShouldRemoveAllSettings && pSettings->editor().autoLoadLastFiles()) {
|
||||||
saveLastOpens();
|
saveLastOpens();
|
||||||
} else {
|
} else {
|
||||||
//if don't save last open files, close project before editors, to save project openned editors;
|
//if don't save last open files, close project before editors, to save project openned editors;
|
||||||
|
@ -2559,7 +2562,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSettings->editor().autoLoadLastFiles()) {
|
if (!mShouldRemoveAllSettings && pSettings->editor().autoLoadLastFiles()) {
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
closeProject(false);
|
closeProject(false);
|
||||||
}
|
}
|
||||||
|
@ -2568,7 +2571,8 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
|
|
||||||
mCompilerManager->stopCompile();
|
mCompilerManager->stopCompile();
|
||||||
mCompilerManager->stopRun();
|
mCompilerManager->stopRun();
|
||||||
mSymbolUsageManager->save();
|
if (!mShouldRemoveAllSettings)
|
||||||
|
mSymbolUsageManager->save();
|
||||||
event->accept();
|
event->accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2653,6 +2657,11 @@ void MainWindow::on_actionOptions_triggered()
|
||||||
bool oldCodeCompletion = pSettings->codeCompletion().enabled();
|
bool oldCodeCompletion = pSettings->codeCompletion().enabled();
|
||||||
PSettingsDialog settingsDialog = SettingsDialog::optionDialog();
|
PSettingsDialog settingsDialog = SettingsDialog::optionDialog();
|
||||||
settingsDialog->exec();
|
settingsDialog->exec();
|
||||||
|
if (settingsDialog->appShouldQuit()) {
|
||||||
|
mShouldRemoveAllSettings = true;
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool newCodeCompletion = pSettings->codeCompletion().enabled();
|
bool newCodeCompletion = pSettings->codeCompletion().enabled();
|
||||||
if (!oldCodeCompletion && newCodeCompletion) {
|
if (!oldCodeCompletion && newCodeCompletion) {
|
||||||
|
@ -4137,6 +4146,11 @@ void MainWindow::on_actionPrint_triggered()
|
||||||
editor->print();
|
editor->print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::shouldRemoveAllSettings() const
|
||||||
|
{
|
||||||
|
return mShouldRemoveAllSettings;
|
||||||
|
}
|
||||||
|
|
||||||
const PToolsManager &MainWindow::toolsManager() const
|
const PToolsManager &MainWindow::toolsManager() const
|
||||||
{
|
{
|
||||||
return mToolsManager;
|
return mToolsManager;
|
||||||
|
|
|
@ -133,6 +133,8 @@ public:
|
||||||
|
|
||||||
const PToolsManager &toolsManager() const;
|
const PToolsManager &toolsManager() const;
|
||||||
|
|
||||||
|
bool shouldRemoveAllSettings() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onCompileLog(const QString& msg);
|
void onCompileLog(const QString& msg);
|
||||||
void onCompileIssue(PCompileIssue issue);
|
void onCompileIssue(PCompileIssue issue);
|
||||||
|
@ -434,6 +436,7 @@ private:
|
||||||
bool mOpenClosingLeftPanel;
|
bool mOpenClosingLeftPanel;
|
||||||
int mLeftPanelWidth;
|
int mLeftPanelWidth;
|
||||||
bool mLeftPanelOpenned;
|
bool mLeftPanelOpenned;
|
||||||
|
bool mShouldRemoveAllSettings;
|
||||||
PCompileSuccessionTask mCompileSuccessionTask;
|
PCompileSuccessionTask mCompileSuccessionTask;
|
||||||
|
|
||||||
QTimer mAutoSaveTimer;
|
QTimer mAutoSaveTimer;
|
||||||
|
|
|
@ -3888,7 +3888,7 @@ void Settings::CodeFormatter::doSave()
|
||||||
|
|
||||||
void Settings::CodeFormatter::doLoad()
|
void Settings::CodeFormatter::doLoad()
|
||||||
{
|
{
|
||||||
mBraceStyle = intValue("brace_style", FormatterBraceStyle::fbsDefault);
|
mBraceStyle = intValue("brace_style", FormatterBraceStyle::fbsJava);
|
||||||
mIndentStyle = intValue("indent_style",FormatterIndentType::fitTab); // 0 isspaces, 1 is tab
|
mIndentStyle = intValue("indent_style",FormatterIndentType::fitTab); // 0 isspaces, 1 is tab
|
||||||
mTabWidth = intValue("tab_width",4);
|
mTabWidth = intValue("tab_width",4);
|
||||||
mAttachNamespaces = boolValue("attach_namespaces",false);
|
mAttachNamespaces = boolValue("attach_namespaces",false);
|
||||||
|
@ -3896,15 +3896,15 @@ void Settings::CodeFormatter::doLoad()
|
||||||
mAttachInlines = boolValue("attach_inlines",false);
|
mAttachInlines = boolValue("attach_inlines",false);
|
||||||
mAttachExternC = boolValue("attach_extern_c",false);
|
mAttachExternC = boolValue("attach_extern_c",false);
|
||||||
mAttachClosingWhile = boolValue("attach_closing_while",false);
|
mAttachClosingWhile = boolValue("attach_closing_while",false);
|
||||||
mIndentClasses = boolValue("indent_classes",false);
|
mIndentClasses = boolValue("indent_classes",true);
|
||||||
mIndentModifiers = boolValue("indent_modifiers",false);
|
mIndentModifiers = boolValue("indent_modifiers",false);
|
||||||
mIndentSwitches = boolValue("indent_switches",false);
|
mIndentSwitches = boolValue("indent_switches",true);
|
||||||
mIndentCases = boolValue("indent_cases",false);
|
mIndentCases = boolValue("indent_cases",false);
|
||||||
mIndentNamespaces = boolValue("indent_namespaces",false);
|
mIndentNamespaces = boolValue("indent_namespaces",true);
|
||||||
mIndentAfterParens = boolValue("indent_after_parents",false);
|
mIndentAfterParens = boolValue("indent_after_parents",false);
|
||||||
mIndentContinuation = boolValue("indent_continuation",false);
|
mIndentContinuation = boolValue("indent_continuation",false);
|
||||||
mIndentLabels = boolValue("indent_labels",false);
|
mIndentLabels = boolValue("indent_labels",false);
|
||||||
mIndentPreprocBlock = boolValue("indent_preproc_block",false);
|
mIndentPreprocBlock = boolValue("indent_preproc_block",true);
|
||||||
mIndentPreprocCond = boolValue("indent_preproc_cond",false);
|
mIndentPreprocCond = boolValue("indent_preproc_cond",false);
|
||||||
mIndentPreprocDefine = boolValue("indent_preproc_define",false);
|
mIndentPreprocDefine = boolValue("indent_preproc_define",false);
|
||||||
mIndentCol1Comments = boolValue("indent_col1_comments",false);
|
mIndentCol1Comments = boolValue("indent_col1_comments",false);
|
||||||
|
@ -3912,13 +3912,13 @@ void Settings::CodeFormatter::doLoad()
|
||||||
mMaxContinuationIndent = intValue("max_continuation_indent",40);
|
mMaxContinuationIndent = intValue("max_continuation_indent",40);
|
||||||
mBreakBlocks = boolValue("break_blocks",false);
|
mBreakBlocks = boolValue("break_blocks",false);
|
||||||
mBreakBlocksAll = boolValue("break_blocks_all",false);
|
mBreakBlocksAll = boolValue("break_blocks_all",false);
|
||||||
mPadOper = boolValue("pad_oper",false);
|
mPadOper = boolValue("pad_oper",true);
|
||||||
mPadComma = boolValue("pad_comma",false);
|
mPadComma = boolValue("pad_comma",true);
|
||||||
mPadParen = boolValue("pad_paren",false);
|
mPadParen = boolValue("pad_paren",false);
|
||||||
mPadParenOut = boolValue("pad_paren_out",false);
|
mPadParenOut = boolValue("pad_paren_out",false);
|
||||||
mPadFirstParenOut = boolValue("pad_first_paren_out",false);
|
mPadFirstParenOut = boolValue("pad_first_paren_out",false);
|
||||||
mPadParenIn = boolValue("pad_parent_in",false);
|
mPadParenIn = boolValue("pad_parent_in",false);
|
||||||
mPadHeader = boolValue("pad_header",false);
|
mPadHeader = boolValue("pad_header",true);
|
||||||
mUnpadParen = boolValue("unpad_paren",false);
|
mUnpadParen = boolValue("unpad_paren",false);
|
||||||
mDeleteEmptyLines = boolValue("delete_empty_lines",false);
|
mDeleteEmptyLines = boolValue("delete_empty_lines",false);
|
||||||
mDeleteMultipleEmptyLines = boolValue("delete_multiple_empty_lines",false);
|
mDeleteMultipleEmptyLines = boolValue("delete_multiple_empty_lines",false);
|
||||||
|
@ -3941,7 +3941,7 @@ void Settings::CodeFormatter::doLoad()
|
||||||
mCloseTemplates = boolValue("close_templates",false);
|
mCloseTemplates = boolValue("close_templates",false);
|
||||||
mRemoveCommentPrefix = boolValue("remove_comment_prefix",false);
|
mRemoveCommentPrefix = boolValue("remove_comment_prefix",false);
|
||||||
mBreakMaxCodeLength = boolValue("break_max_code_length",false);
|
mBreakMaxCodeLength = boolValue("break_max_code_length",false);
|
||||||
mMaxCodeLength = intValue("max_code_length",200);
|
mMaxCodeLength = intValue("max_code_length",80);
|
||||||
mBreakAfterLogical = boolValue("break_after_logical",false);
|
mBreakAfterLogical = boolValue("break_after_logical",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
#include "environmentfolderswidget.h"
|
||||||
|
#include "ui_environmentfolderswidget.h"
|
||||||
|
#include "../settings.h"
|
||||||
|
#include "../mainwindow.h"
|
||||||
|
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
|
EnvironmentFoldersWidget::EnvironmentFoldersWidget(const QString& name, const QString& group, QWidget *parent) :
|
||||||
|
SettingsWidget(name,group,parent),
|
||||||
|
ui(new Ui::EnvironmentFoldersWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
EnvironmentFoldersWidget::~EnvironmentFoldersWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnvironmentFoldersWidget::doLoad()
|
||||||
|
{
|
||||||
|
ui->txtConfigFolder->setText(pSettings->dirs().config());
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnvironmentFoldersWidget::doSave()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnvironmentFoldersWidget::on_btnOpenConfigFolderInBrowser_clicked()
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl(
|
||||||
|
QUrl("file:///"+
|
||||||
|
includeTrailingPathDelimiter(pSettings->dirs().config()),QUrl::TolerantMode));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EnvironmentFoldersWidget::on_btnResetDefault_clicked()
|
||||||
|
{
|
||||||
|
if (QMessageBox::question(this,tr("Confirm"),
|
||||||
|
tr("Do you really want to delete all custom settings?"),
|
||||||
|
QMessageBox::Yes|QMessageBox::No,
|
||||||
|
QMessageBox::No)!=QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
QDir dir(pSettings->dirs().config());
|
||||||
|
if (!dir.removeRecursively()) {
|
||||||
|
QMessageBox::critical(this,tr("Error"),
|
||||||
|
tr("Failed to delete custom settings."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit shouldQuitApp();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef ENVIRONMENTFOLDERSWIDGET_H
|
||||||
|
#define ENVIRONMENTFOLDERSWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "settingswidget.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class EnvironmentFoldersWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnvironmentFoldersWidget : public SettingsWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EnvironmentFoldersWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
||||||
|
~EnvironmentFoldersWidget();
|
||||||
|
signals:
|
||||||
|
void shouldQuitApp();
|
||||||
|
private:
|
||||||
|
Ui::EnvironmentFoldersWidget *ui;
|
||||||
|
|
||||||
|
// SettingsWidget interface
|
||||||
|
protected:
|
||||||
|
void doLoad() override;
|
||||||
|
void doSave() override;
|
||||||
|
private slots:
|
||||||
|
void on_btnOpenConfigFolderInBrowser_clicked();
|
||||||
|
void on_btnResetDefault_clicked();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ENVIRONMENTFOLDERSWIDGET_H
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>EnvironmentFoldersWidget</class>
|
||||||
|
<widget class="QWidget" name="EnvironmentFoldersWidget">
|
||||||
|
<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="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtConfigFolder">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Configuration folder:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnOpenConfigFolderInBrowser">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open in browser</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnResetDefault">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove all custom settings and exit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../icons.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -17,6 +17,7 @@
|
||||||
#include "environmentappearencewidget.h"
|
#include "environmentappearencewidget.h"
|
||||||
#include "environmentshortcutwidget.h"
|
#include "environmentshortcutwidget.h"
|
||||||
#include "environmentfileassociationwidget.h"
|
#include "environmentfileassociationwidget.h"
|
||||||
|
#include "environmentfolderswidget.h"
|
||||||
#include "executorgeneralwidget.h"
|
#include "executorgeneralwidget.h"
|
||||||
#include "debuggeneralwidget.h"
|
#include "debuggeneralwidget.h"
|
||||||
#include "formattergeneralwidget.h"
|
#include "formattergeneralwidget.h"
|
||||||
|
@ -47,6 +48,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
||||||
|
|
||||||
ui->btnApply->setEnabled(false);
|
ui->btnApply->setEnabled(false);
|
||||||
|
|
||||||
|
mAppShouldQuit = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog()
|
||||||
|
@ -106,6 +109,16 @@ PSettingsDialog SettingsDialog::optionDialog()
|
||||||
widget->init();
|
widget->init();
|
||||||
dialog->addWidget(widget);
|
dialog->addWidget(widget);
|
||||||
|
|
||||||
|
widget = new EnvironmentFoldersWidget(tr("Folders"),tr("Environment"));
|
||||||
|
widget->init();
|
||||||
|
dialog->addWidget(widget);
|
||||||
|
|
||||||
|
connect((EnvironmentFoldersWidget*)widget,
|
||||||
|
&EnvironmentFoldersWidget::shouldQuitApp,
|
||||||
|
dialog.get(),
|
||||||
|
&SettingsDialog::closeAndQuit,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
widget = new CompilerSetOptionWidget(tr("Compiler Set"),tr("Compiler"));
|
widget = new CompilerSetOptionWidget(tr("Compiler Set"),tr("Compiler"));
|
||||||
widget->init();
|
widget->init();
|
||||||
dialog->addWidget(widget);
|
dialog->addWidget(widget);
|
||||||
|
@ -289,3 +302,14 @@ void SettingsDialog::saveCurrentPageSettings(bool confirm)
|
||||||
}
|
}
|
||||||
pWidget->save();
|
pWidget->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SettingsDialog::appShouldQuit() const
|
||||||
|
{
|
||||||
|
return mAppShouldQuit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::closeAndQuit()
|
||||||
|
{
|
||||||
|
mAppShouldQuit = true;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
|
@ -30,7 +30,10 @@ public:
|
||||||
static PSettingsDialog optionDialog();
|
static PSettingsDialog optionDialog();
|
||||||
static PSettingsDialog projectOptionDialog();
|
static PSettingsDialog projectOptionDialog();
|
||||||
|
|
||||||
|
bool appShouldQuit() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void closeAndQuit();
|
||||||
void widget_settings_changed(bool value);
|
void widget_settings_changed(bool value);
|
||||||
void on_widgetsView_clicked(const QModelIndex &index);
|
void on_widgetsView_clicked(const QModelIndex &index);
|
||||||
|
|
||||||
|
@ -45,6 +48,7 @@ private:
|
||||||
Ui::SettingsDialog *ui;
|
Ui::SettingsDialog *ui;
|
||||||
QList<SettingsWidget*> mSettingWidgets;
|
QList<SettingsWidget*> mSettingWidgets;
|
||||||
QStandardItemModel model;
|
QStandardItemModel model;
|
||||||
|
bool mAppShouldQuit;
|
||||||
|
|
||||||
// CompilerSetOptionWidget *pCompilerSetOptionWidget;
|
// CompilerSetOptionWidget *pCompilerSetOptionWidget;
|
||||||
// CompilerAutolinkWidget *pCompilerAutolinkWidget;
|
// CompilerAutolinkWidget *pCompilerAutolinkWidget;
|
||||||
|
|
|
@ -81,8 +81,8 @@ void ToolsManager::save()
|
||||||
doc.setArray(array);
|
doc.setArray(array);
|
||||||
if (file.write(doc.toJson())<0) {
|
if (file.write(doc.toJson())<0) {
|
||||||
QMessageBox::critical(nullptr,
|
QMessageBox::critical(nullptr,
|
||||||
tr("Save tool config failed"),
|
tr("Save tools config failed"),
|
||||||
tr("Write to tool config file '%1' failed.")
|
tr("Write to tools config file '%1' failed.")
|
||||||
.arg(filename));
|
.arg(filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue