diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 1c654f0d..4a748c73 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -315,7 +315,7 @@ QStringList &Settings::CompilerSet::CppIncludeDirs() return mCppIncludeDirs; } -QStringList &Settings::CompilerSet::LibDirs() +QStringList &Settings::CompilerSet::libDirs() { return mLibDirs; } @@ -871,6 +871,7 @@ void Settings::CompilerSet::setIniOptions(const QByteArray &value) break; } p->value = charToValue(value[i]); + i++; } } @@ -906,7 +907,7 @@ Settings::PCompilerSet Settings::CompilerSets::addSet(const QString &folder) return p; } -static void setReleaseOptions(Settings::PCompilerSet& pSet) { +static void setReleaseOptions(Settings::PCompilerSet pSet) { PCompilerOption pOption = pSet->findOption("-O"); if (pOption) { pSet->setOption(pOption,'a'); @@ -918,7 +919,7 @@ static void setReleaseOptions(Settings::PCompilerSet& pSet) { } } -static void setDebugOptions(Settings::PCompilerSet& pSet) { +static void setDebugOptions(Settings::PCompilerSet pSet) { PCompilerOption pOption = pSet->findOption("-g3"); if (pOption) { pSet->setOption(pOption,'1'); @@ -933,7 +934,7 @@ static void setDebugOptions(Settings::PCompilerSet& pSet) { } } -static void setProfileOptions(Settings::PCompilerSet& pSet) { +static void setProfileOptions(Settings::PCompilerSet pSet) { PCompilerOption pOption = pSet->findOption("-pg"); if (pOption) { pSet->setOption(pOption,'1'); @@ -978,6 +979,7 @@ void Settings::CompilerSets::clearSets() mSettings->mSettings.endGroup(); } mList.clear(); + mDefaultIndex = -1; } void Settings::CompilerSets::findSets() @@ -1127,7 +1129,7 @@ void Settings::CompilerSets::saveSet(int index) savePathList("Bins",pSet->binDirs()); savePathList("C",pSet->CIncludeDirs()); savePathList("Cpp",pSet->CppIncludeDirs()); - savePathList("Libs",pSet->LibDirs()); + savePathList("Libs",pSet->libDirs()); mSettings->mSettings.endGroup(); } @@ -1189,7 +1191,7 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index) loadPathList("Bins",pSet->binDirs()); loadPathList("C",pSet->CIncludeDirs()); loadPathList("Cpp",pSet->CppIncludeDirs()); - loadPathList("Libs",pSet->LibDirs()); + loadPathList("Libs",pSet->libDirs()); mSettings->mSettings.endGroup(); diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 7e2c6af3..04ab96d1 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -106,7 +106,7 @@ public: QStringList& binDirs(); QStringList& CIncludeDirs(); QStringList& CppIncludeDirs(); - QStringList& LibDirs(); + QStringList& libDirs(); const QString& dumpMachine(); void setDumpMachine(const QString& value); diff --git a/RedPandaIDE/settingsdialog/settingswidget.cpp b/RedPandaIDE/settingsdialog/settingswidget.cpp index 559792a1..f9dfc85b 100644 --- a/RedPandaIDE/settingsdialog/settingswidget.cpp +++ b/RedPandaIDE/settingsdialog/settingswidget.cpp @@ -1,8 +1,10 @@ #include "settingswidget.h" +#include #include #include #include +#include #include SettingsWidget::SettingsWidget(const QString &name, const QString &group, QWidget *parent): @@ -16,18 +18,7 @@ SettingsWidget::SettingsWidget(const QString &name, const QString &group, QWidge void SettingsWidget::init() { load(); - for (QLineEdit* p:findChildren()) { - connect(p, &QLineEdit::textChanged, this, &SettingsWidget::setSettingsChanged); - } - for (QCheckBox* p:findChildren()) { - connect(p, &QCheckBox::stateChanged, this, &SettingsWidget::setSettingsChanged); - } - for (QPlainTextEdit* p:findChildren()) { - connect(p, &QPlainTextEdit::textChanged, this, &SettingsWidget::setSettingsChanged); - } - for (QComboBox* p: findChildren()) { - connect(p, QOverload::of(&QComboBox::currentIndexChanged) ,this, &SettingsWidget::setSettingsChanged); - } + connectInputs(); } void SettingsWidget::load() @@ -42,6 +33,26 @@ void SettingsWidget::save() mSettingsChanged = false; } +void SettingsWidget::connectInputs() +{ + for (QLineEdit* p:findChildren()) { + connect(p, &QLineEdit::textChanged, this, &SettingsWidget::setSettingsChanged); + } + for (QCheckBox* p:findChildren()) { + connect(p, &QCheckBox::stateChanged, this, &SettingsWidget::setSettingsChanged); + } + for (QPlainTextEdit* p:findChildren()) { + connect(p, &QPlainTextEdit::textChanged, this, &SettingsWidget::setSettingsChanged); + } + for (QComboBox* p: findChildren()) { + connect(p, QOverload::of(&QComboBox::currentIndexChanged) ,this, &SettingsWidget::setSettingsChanged); + } + for (QAbstractItemView* p: findChildren()) { + connect(p, &QAbstractItemView::activated,this, &SettingsWidget::setSettingsChanged); + } + +} + const QString &SettingsWidget::group() { return mGroup; diff --git a/RedPandaIDE/settingsdialog/settingswidget.h b/RedPandaIDE/settingsdialog/settingswidget.h index 424da4f1..adf790c6 100644 --- a/RedPandaIDE/settingsdialog/settingswidget.h +++ b/RedPandaIDE/settingsdialog/settingswidget.h @@ -17,6 +17,7 @@ signals: void settingsChanged(bool changed); protected: + void connectInputs(); virtual void doLoad() = 0; virtual void doSave() = 0; public: