* can add new blank compiler set

This commit is contained in:
royqh1979@gmail.com 2021-04-17 22:38:46 +08:00
parent 55326a3659
commit e02c407e9d
4 changed files with 33 additions and 19 deletions

View File

@ -315,7 +315,7 @@ QStringList &Settings::CompilerSet::CppIncludeDirs()
return mCppIncludeDirs; return mCppIncludeDirs;
} }
QStringList &Settings::CompilerSet::LibDirs() QStringList &Settings::CompilerSet::libDirs()
{ {
return mLibDirs; return mLibDirs;
} }
@ -871,6 +871,7 @@ void Settings::CompilerSet::setIniOptions(const QByteArray &value)
break; break;
} }
p->value = charToValue(value[i]); p->value = charToValue(value[i]);
i++;
} }
} }
@ -906,7 +907,7 @@ Settings::PCompilerSet Settings::CompilerSets::addSet(const QString &folder)
return p; return p;
} }
static void setReleaseOptions(Settings::PCompilerSet& pSet) { static void setReleaseOptions(Settings::PCompilerSet pSet) {
PCompilerOption pOption = pSet->findOption("-O"); PCompilerOption pOption = pSet->findOption("-O");
if (pOption) { if (pOption) {
pSet->setOption(pOption,'a'); 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"); PCompilerOption pOption = pSet->findOption("-g3");
if (pOption) { if (pOption) {
pSet->setOption(pOption,'1'); 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"); PCompilerOption pOption = pSet->findOption("-pg");
if (pOption) { if (pOption) {
pSet->setOption(pOption,'1'); pSet->setOption(pOption,'1');
@ -978,6 +979,7 @@ void Settings::CompilerSets::clearSets()
mSettings->mSettings.endGroup(); mSettings->mSettings.endGroup();
} }
mList.clear(); mList.clear();
mDefaultIndex = -1;
} }
void Settings::CompilerSets::findSets() void Settings::CompilerSets::findSets()
@ -1127,7 +1129,7 @@ void Settings::CompilerSets::saveSet(int index)
savePathList("Bins",pSet->binDirs()); savePathList("Bins",pSet->binDirs());
savePathList("C",pSet->CIncludeDirs()); savePathList("C",pSet->CIncludeDirs());
savePathList("Cpp",pSet->CppIncludeDirs()); savePathList("Cpp",pSet->CppIncludeDirs());
savePathList("Libs",pSet->LibDirs()); savePathList("Libs",pSet->libDirs());
mSettings->mSettings.endGroup(); mSettings->mSettings.endGroup();
} }
@ -1189,7 +1191,7 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
loadPathList("Bins",pSet->binDirs()); loadPathList("Bins",pSet->binDirs());
loadPathList("C",pSet->CIncludeDirs()); loadPathList("C",pSet->CIncludeDirs());
loadPathList("Cpp",pSet->CppIncludeDirs()); loadPathList("Cpp",pSet->CppIncludeDirs());
loadPathList("Libs",pSet->LibDirs()); loadPathList("Libs",pSet->libDirs());
mSettings->mSettings.endGroup(); mSettings->mSettings.endGroup();

View File

@ -106,7 +106,7 @@ public:
QStringList& binDirs(); QStringList& binDirs();
QStringList& CIncludeDirs(); QStringList& CIncludeDirs();
QStringList& CppIncludeDirs(); QStringList& CppIncludeDirs();
QStringList& LibDirs(); QStringList& libDirs();
const QString& dumpMachine(); const QString& dumpMachine();
void setDumpMachine(const QString& value); void setDumpMachine(const QString& value);

View File

@ -1,8 +1,10 @@
#include "settingswidget.h" #include "settingswidget.h"
#include <QAbstractItemView>
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox> #include <QComboBox>
#include <QLineEdit> #include <QLineEdit>
#include <QListView>
#include <QPlainTextEdit> #include <QPlainTextEdit>
SettingsWidget::SettingsWidget(const QString &name, const QString &group, QWidget *parent): 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() void SettingsWidget::init()
{ {
load(); load();
for (QLineEdit* p:findChildren<QLineEdit*>()) { connectInputs();
connect(p, &QLineEdit::textChanged, this, &SettingsWidget::setSettingsChanged);
}
for (QCheckBox* p:findChildren<QCheckBox*>()) {
connect(p, &QCheckBox::stateChanged, this, &SettingsWidget::setSettingsChanged);
}
for (QPlainTextEdit* p:findChildren<QPlainTextEdit*>()) {
connect(p, &QPlainTextEdit::textChanged, this, &SettingsWidget::setSettingsChanged);
}
for (QComboBox* p: findChildren<QComboBox*>()) {
connect(p, QOverload<int>::of(&QComboBox::currentIndexChanged) ,this, &SettingsWidget::setSettingsChanged);
}
} }
void SettingsWidget::load() void SettingsWidget::load()
@ -42,6 +33,26 @@ void SettingsWidget::save()
mSettingsChanged = false; mSettingsChanged = false;
} }
void SettingsWidget::connectInputs()
{
for (QLineEdit* p:findChildren<QLineEdit*>()) {
connect(p, &QLineEdit::textChanged, this, &SettingsWidget::setSettingsChanged);
}
for (QCheckBox* p:findChildren<QCheckBox*>()) {
connect(p, &QCheckBox::stateChanged, this, &SettingsWidget::setSettingsChanged);
}
for (QPlainTextEdit* p:findChildren<QPlainTextEdit*>()) {
connect(p, &QPlainTextEdit::textChanged, this, &SettingsWidget::setSettingsChanged);
}
for (QComboBox* p: findChildren<QComboBox*>()) {
connect(p, QOverload<int>::of(&QComboBox::currentIndexChanged) ,this, &SettingsWidget::setSettingsChanged);
}
for (QAbstractItemView* p: findChildren<QAbstractItemView*>()) {
connect(p, &QAbstractItemView::activated,this, &SettingsWidget::setSettingsChanged);
}
}
const QString &SettingsWidget::group() const QString &SettingsWidget::group()
{ {
return mGroup; return mGroup;

View File

@ -17,6 +17,7 @@ signals:
void settingsChanged(bool changed); void settingsChanged(bool changed);
protected: protected:
void connectInputs();
virtual void doLoad() = 0; virtual void doLoad() = 0;
virtual void doSave() = 0; virtual void doSave() = 0;
public: public: