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

View File

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

View File

@ -1,8 +1,10 @@
#include "settingswidget.h"
#include <QAbstractItemView>
#include <QCheckBox>
#include <QComboBox>
#include <QLineEdit>
#include <QListView>
#include <QPlainTextEdit>
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<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);
}
connectInputs();
}
void SettingsWidget::load()
@ -42,6 +33,26 @@ void SettingsWidget::save()
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()
{
return mGroup;

View File

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