allow compiler sets persist in auto-find (#170)
This commit is contained in:
parent
f9028ab70f
commit
69872c6f0b
|
@ -1675,6 +1675,7 @@ Settings::CompilerSet::CompilerSet():
|
|||
mAutoAddCharsetParams{false},
|
||||
mExecCharset{ENCODING_SYSTEM_DEFAULT},
|
||||
mStaticLink{false},
|
||||
mPersistInAutoFind{false},
|
||||
mPreprocessingSuffix{DEFAULT_PREPROCESSING_SUFFIX},
|
||||
mCompilationProperSuffix{DEFAULT_COMPILATION_SUFFIX},
|
||||
mAssemblingSuffix{DEFAULT_ASSEMBLING_SUFFIX},
|
||||
|
@ -1689,6 +1690,7 @@ Settings::CompilerSet::CompilerSet(const QString& compilerFolder, const QString&
|
|||
mAutoAddCharsetParams{true},
|
||||
mExecCharset{ENCODING_SYSTEM_DEFAULT},
|
||||
mStaticLink{true},
|
||||
mPersistInAutoFind{false},
|
||||
mPreprocessingSuffix{DEFAULT_PREPROCESSING_SUFFIX},
|
||||
mCompilationProperSuffix{DEFAULT_COMPILATION_SUFFIX},
|
||||
mAssemblingSuffix{DEFAULT_ASSEMBLING_SUFFIX},
|
||||
|
@ -1754,6 +1756,7 @@ Settings::CompilerSet::CompilerSet(const Settings::CompilerSet &set):
|
|||
mAutoAddCharsetParams{set.mAutoAddCharsetParams},
|
||||
mExecCharset{set.mExecCharset},
|
||||
mStaticLink{set.mStaticLink},
|
||||
mPersistInAutoFind{set.mPersistInAutoFind},
|
||||
|
||||
mPreprocessingSuffix{set.mPreprocessingSuffix},
|
||||
mCompilationProperSuffix{set.mCompilationProperSuffix},
|
||||
|
@ -2779,6 +2782,16 @@ QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const
|
|||
return result.trimmed();
|
||||
}
|
||||
|
||||
bool Settings::CompilerSet::persistInAutoFind() const
|
||||
{
|
||||
return mPersistInAutoFind;
|
||||
}
|
||||
|
||||
void Settings::CompilerSet::setPersistInAutoFind(bool newPersistInAutoFind)
|
||||
{
|
||||
mPersistInAutoFind = newPersistInAutoFind;
|
||||
}
|
||||
|
||||
Settings::CompilerSet::CompilationStage Settings::CompilerSet::compilationStage() const
|
||||
{
|
||||
return mCompilationStage;
|
||||
|
@ -3102,20 +3115,24 @@ bool Settings::CompilerSets::addSets(const QString &folder)
|
|||
return found;
|
||||
}
|
||||
|
||||
void Settings::CompilerSets::clearSets()
|
||||
Settings::CompilerSetList Settings::CompilerSets::clearSets()
|
||||
{
|
||||
CompilerSetList persisted;
|
||||
for (size_t i=0;i<mList.size();i++) {
|
||||
mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(i));
|
||||
mSettings->mSettings.remove("");
|
||||
mSettings->mSettings.endGroup();
|
||||
if (mList[i]->persistInAutoFind())
|
||||
persisted.push_back(std::move(mList[i]));
|
||||
}
|
||||
mList.clear();
|
||||
mDefaultIndex = -1;
|
||||
return persisted;
|
||||
}
|
||||
|
||||
void Settings::CompilerSets::findSets()
|
||||
{
|
||||
clearSets();
|
||||
CompilerSetList persisted = clearSets();
|
||||
QSet<QString> searched;
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
|
@ -3152,6 +3169,8 @@ void Settings::CompilerSets::findSets()
|
|||
}
|
||||
#endif
|
||||
|
||||
for (PCompilerSet &set: persisted)
|
||||
addSet(set);
|
||||
}
|
||||
|
||||
void Settings::CompilerSets::saveSets()
|
||||
|
@ -3241,7 +3260,6 @@ void Settings::CompilerSets::loadSets()
|
|||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
clearSets();
|
||||
findSets();
|
||||
pCurrentSet = defaultSet();
|
||||
if (!pCurrentSet) {
|
||||
|
@ -3370,6 +3388,7 @@ void Settings::CompilerSets::saveSet(int index)
|
|||
mSettings->mSettings.setValue("AddCharset", pSet->autoAddCharsetParams());
|
||||
mSettings->mSettings.setValue("StaticLink", pSet->staticLink());
|
||||
mSettings->mSettings.setValue("ExecCharset", pSet->execCharset());
|
||||
mSettings->mSettings.setValue("PersistInAutoFind", pSet->persistInAutoFind());
|
||||
|
||||
mSettings->mSettings.setValue("preprocessingSuffix", pSet->preprocessingSuffix());
|
||||
mSettings->mSettings.setValue("compilationProperSuffix", pSet->compilationProperSuffix());
|
||||
|
@ -3457,6 +3476,7 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
|
|||
pSet->setCustomLinkParams(mSettings->mSettings.value("customLinkParams").toString());
|
||||
pSet->setAutoAddCharsetParams(mSettings->mSettings.value("AddCharset", true).toBool());
|
||||
pSet->setStaticLink(mSettings->mSettings.value("StaticLink", false).toBool());
|
||||
pSet->setPersistInAutoFind(mSettings->mSettings.value("PersistInAutoFind", false).toBool());
|
||||
|
||||
pSet->setExecCharset(mSettings->mSettings.value("ExecCharset", ENCODING_SYSTEM_DEFAULT).toString());
|
||||
if (pSet->execCharset().isEmpty()) {
|
||||
|
|
|
@ -1468,6 +1468,9 @@ public:
|
|||
bool forceUTF8() const;
|
||||
bool isCompilerInfoUsingUTF8() const;
|
||||
|
||||
bool persistInAutoFind() const;
|
||||
void setPersistInAutoFind(bool newPersistInAutoFind);
|
||||
|
||||
private:
|
||||
void setGCCProperties(const QString& binDir, const QString& c_prog);
|
||||
void setDirectories(const QString& binDir);
|
||||
|
@ -1518,6 +1521,7 @@ public:
|
|||
bool mAutoAddCharsetParams;
|
||||
QString mExecCharset;
|
||||
bool mStaticLink;
|
||||
bool mPersistInAutoFind;
|
||||
|
||||
QString mPreprocessingSuffix;
|
||||
QString mCompilationProperSuffix;
|
||||
|
@ -1538,7 +1542,7 @@ public:
|
|||
explicit CompilerSets(Settings* settings);
|
||||
PCompilerSet addSet();
|
||||
bool addSets(const QString& folder);
|
||||
void clearSets();
|
||||
CompilerSetList clearSets();
|
||||
void findSets();
|
||||
void saveSets();
|
||||
void loadSets();
|
||||
|
|
|
@ -95,6 +95,7 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet
|
|||
ui->txtCustomLinkParams->setEnabled(pSet->useCustomLinkParams());
|
||||
ui->chkAutoAddCharset->setChecked(pSet->autoAddCharsetParams());
|
||||
ui->chkStaticLink->setChecked(pSet->staticLink());
|
||||
ui->chkPersistInAutoFind->setChecked(pSet->persistInAutoFind());
|
||||
//rest tabs in the options widget
|
||||
|
||||
ui->optionTabs->resetUI(pSet,pSet->compileOptions());
|
||||
|
@ -240,6 +241,7 @@ void CompilerSetOptionWidget::saveCurrentCompilerSet()
|
|||
pSet->setCustomLinkParams(ui->txtCustomLinkParams->toPlainText().trimmed());
|
||||
pSet->setAutoAddCharsetParams(ui->chkAutoAddCharset->isChecked());
|
||||
pSet->setStaticLink(ui->chkStaticLink->isChecked());
|
||||
pSet->setPersistInAutoFind(ui->chkPersistInAutoFind->isChecked());
|
||||
|
||||
pSet->setCCompiler(ui->txtCCompiler->text().trimmed());
|
||||
pSet->setCppCompiler(ui->txtCppCompiler->text().trimmed());
|
||||
|
@ -296,13 +298,13 @@ QString CompilerSetOptionWidget::getBinDir()
|
|||
void CompilerSetOptionWidget::on_btnFindCompilers_clicked()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QString msg = tr("Red Panda C++ will clear current compiler list and search"
|
||||
" for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue?")
|
||||
QString msg = tr("Red Panda C++ will clear previously found compiler list and search"
|
||||
" for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Do you really want to continue?")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW32")
|
||||
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW64");
|
||||
#else
|
||||
QString msg = tr("Red Panda C++ will clear current compiler list and search"
|
||||
" for compilers in the the PATH. <br />Are you really want to continue?");
|
||||
QString msg = tr("Red Panda C++ will clear previously found compiler list and search"
|
||||
" for compilers in the the PATH. <br />Do you really want to continue?");
|
||||
#endif
|
||||
if (QMessageBox::warning(this,tr("Confirm"),msg,
|
||||
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok )
|
||||
|
@ -315,14 +317,12 @@ void CompilerSetOptionWidget::on_btnFindCompilers_clicked()
|
|||
pMainWindow);
|
||||
|
||||
progressDlg.setWindowModality(Qt::WindowModal);
|
||||
progressDlg.setMaximum(3);
|
||||
progressDlg.setMaximum(2);
|
||||
progressDlg.setLabelText(tr("Searching..."));
|
||||
pSettings->compilerSets().clearSets();
|
||||
progressDlg.setValue(1);
|
||||
pSettings->compilerSets().findSets();
|
||||
progressDlg.setValue(2);
|
||||
progressDlg.setValue(1);
|
||||
doLoad();
|
||||
progressDlg.setValue(3);
|
||||
progressDlg.setValue(2);
|
||||
setSettingsChanged();
|
||||
if (pSettings->compilerSets().size()==0) {
|
||||
QMessageBox::warning(this,tr("Failed"),tr("Can't find any compiler."));
|
||||
|
@ -332,9 +332,10 @@ void CompilerSetOptionWidget::on_btnFindCompilers_clicked()
|
|||
void CompilerSetOptionWidget::on_btnAddBlankCompilerSet_clicked()
|
||||
{
|
||||
QString name = QInputDialog::getText(this,tr("Compiler Set Name"),tr("Name"));
|
||||
pSettings->compilerSets().addSet();
|
||||
Settings::PCompilerSet set = pSettings->compilerSets().addSet();
|
||||
pSettings->compilerSets().setDefaultIndex(pSettings->compilerSets().size()-1);
|
||||
pSettings->compilerSets().defaultSet()->setName(name);
|
||||
set->setName(name);
|
||||
set->setPersistInAutoFind(true);
|
||||
doLoad();
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,13 @@
|
|||
<item>
|
||||
<widget class="QPlainTextEdit" name="txtCustomLinkParams"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkPersistInAutoFind">
|
||||
<property name="text">
|
||||
<string>Survive auto-finds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabSettings">
|
||||
|
@ -492,6 +499,6 @@
|
|||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -692,12 +692,12 @@
|
|||
<translation>UTF-8</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue?</source>
|
||||
<translation>Red Panda C++ irá limpar a atual lista de compiladores e irá procurar por compiladores em <br /> '%1'<br /> '%2'<br />Quer mesmo continuar?</translation>
|
||||
<source>Red Panda C++ will clear previously found compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Do you really want to continue?</source>
|
||||
<translation>Red Panda C++ irá limpar a atual lista de compiladores encontrada anteriormente e irá procurar por compiladores em <br /> '%1'<br /> '%2'<br />Quer mesmo continuar?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the the PATH. <br />Are you really want to continue?</source>
|
||||
<translation>Red Panda C++ irá limpar a atual lista de compiladores e irá procurar por compiladores no PATH. <br />Quer mesmo continuar</translation>
|
||||
<source>Red Panda C++ will clear previously found compiler list and search for compilers in the the PATH. <br />Do you really want to continue?</source>
|
||||
<translation>Red Panda C++ irá limpar a atual lista de compiladores encontrada anteriormente e irá procurar por compiladores no PATH. <br />Quer mesmo continuar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Confirm</source>
|
||||
|
@ -811,6 +811,10 @@
|
|||
<source>Binary suffix</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Survive auto-finds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CppRefacter</name>
|
||||
|
|
|
@ -1030,12 +1030,8 @@ p, li { white-space: pre-wrap; }
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/compilersetoptionwidget.cpp" line="299"/>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue?</source>
|
||||
<oldsource>Red Panda C++ will clear current compiler list and search for compilers in the following locations:
|
||||
'%1'
|
||||
'%2'
|
||||
Are you really want to continue?</oldsource>
|
||||
<translation>小熊猫C++ 将会清除现有的编译器配置列表,然后在下列文件夹中搜索编译器:<br/> '%1'<br/> '%2'<br />你确定要继续吗?</translation>
|
||||
<source>Red Panda C++ will clear previously found compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Do you really want to continue?</source>
|
||||
<translation>小熊猫C++ 将会清除以前搜索到的编译器配置列表,然后在下列文件夹中搜索编译器:<br/> '%1'<br/> '%2'<br />你确定要继续吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/compilersetoptionwidget.cpp" line="68"/>
|
||||
|
@ -1049,8 +1045,8 @@ Are you really want to continue?</oldsource>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/compilersetoptionwidget.cpp" line="304"/>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the the PATH. <br />Are you really want to continue?</source>
|
||||
<translation>小熊猫C++ 将会清除现有的编译器配置列表,然后在PATH路径中搜索gcc编译器.<br />你确定要继续吗?</translation>
|
||||
<source>Red Panda C++ will clear previously found compiler list and search for compilers in the the PATH. <br />Do you really want to continue?</source>
|
||||
<translation>小熊猫C++ 将会清除以前搜索到的编译器配置列表,然后在PATH路径中搜索gcc编译器.<br />你确定要继续吗?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/compilersetoptionwidget.cpp" line="311"/>
|
||||
|
@ -1148,6 +1144,10 @@ Are you really want to continue?</oldsource>
|
|||
<source>Locate nasm</source>
|
||||
<translation type="vanished">定位nasm程序</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Survive auto-finds</source>
|
||||
<translation>自动搜索时保留此项</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CppRefacter</name>
|
||||
|
|
|
@ -589,11 +589,11 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue?</source>
|
||||
<source>Red Panda C++ will clear previously found compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Do you really want to continue?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Red Panda C++ will clear current compiler list and search for compilers in the the PATH. <br />Are you really want to continue?</source>
|
||||
<source>Red Panda C++ will clear previously found compiler list and search for compilers in the the PATH. <br />Do you really want to continue?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
|
@ -700,6 +700,10 @@
|
|||
<source>Binary suffix</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Survive auto-finds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CppRefacter</name>
|
||||
|
|
Loading…
Reference in New Issue