- fix: options not correctly set when change compiler set in the project settings

- change: reset compiler settings when change the project compiler set
This commit is contained in:
royqh1979 2021-10-25 21:36:23 +08:00
parent 148e99e483
commit a3c335eed6
13 changed files with 229 additions and 138 deletions

View File

@ -14,6 +14,8 @@ Version 0.7.3
- fix: compiler autolinks options widget don't show autolink infos
- fix: autolink parameters are repeated when compile single files
- enhancement: prompt for filename when create new project unit file
- fix: options not correctly set when change compiler set in the project settings
- change: reset compiler settings when change the project compiler set
Version 0.7.2
- fix: rainbow parenthesis stop functioning when change editor's general options

Binary file not shown.

View File

@ -2807,11 +2807,11 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="mainwindow.ui" line="371"/>
<location filename="mainwindow.cpp" line="3112"/>
<location filename="mainwindow.cpp" line="3115"/>
<location filename="mainwindow.cpp" line="3119"/>
<location filename="mainwindow.cpp" line="3122"/>
<location filename="mainwindow.cpp" line="4518"/>
<location filename="mainwindow.cpp" line="3121"/>
<location filename="mainwindow.cpp" line="3124"/>
<location filename="mainwindow.cpp" line="3128"/>
<location filename="mainwindow.cpp" line="3131"/>
<location filename="mainwindow.cpp" line="4530"/>
<source>Issues</source>
<translation></translation>
</message>
@ -3466,7 +3466,7 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="mainwindow.ui" line="1783"/>
<location filename="mainwindow.cpp" line="3939"/>
<location filename="mainwindow.cpp" line="3948"/>
<source>Clear all breakpoints</source>
<translation></translation>
</message>
@ -3567,7 +3567,7 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="mainwindow.ui" line="1934"/>
<location filename="mainwindow.cpp" line="4475"/>
<location filename="mainwindow.cpp" line="4487"/>
<source>Rename Symbol</source>
<translation></translation>
</message>
@ -3588,13 +3588,13 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="mainwindow.ui" line="1954"/>
<location filename="mainwindow.cpp" line="4597"/>
<location filename="mainwindow.cpp" line="4609"/>
<source>Export As RTF</source>
<translation>RTF</translation>
</message>
<message>
<location filename="mainwindow.ui" line="1959"/>
<location filename="mainwindow.cpp" line="4619"/>
<location filename="mainwindow.cpp" line="4631"/>
<source>Export As HTML</source>
<translation>HTML</translation>
</message>
@ -3640,7 +3640,7 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="mainwindow.ui" line="2018"/>
<location filename="mainwindow.cpp" line="4757"/>
<location filename="mainwindow.cpp" line="4769"/>
<source>Open Folder</source>
<translation></translation>
</message>
@ -3891,15 +3891,15 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="mainwindow.cpp" line="1771"/>
<location filename="mainwindow.cpp" line="4677"/>
<location filename="mainwindow.cpp" line="4717"/>
<location filename="mainwindow.cpp" line="4689"/>
<location filename="mainwindow.cpp" line="4729"/>
<source>Bookmark Description</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1772"/>
<location filename="mainwindow.cpp" line="4678"/>
<location filename="mainwindow.cpp" line="4718"/>
<location filename="mainwindow.cpp" line="4690"/>
<location filename="mainwindow.cpp" line="4730"/>
<source>Description:</source>
<translation></translation>
</message>
@ -4048,128 +4048,143 @@ Are you really want to continue?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3940"/>
<location filename="mainwindow.cpp" line="3055"/>
<source>Change Project Compiler Set</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3056"/>
<source>Change the project&apos;s compiler set will lose all custom compiler set options.</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3058"/>
<source>Do you really want to do that?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3949"/>
<source>Do you really want to clear all breakpoints in this file?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4118"/>
<location filename="mainwindow.cpp" line="4127"/>
<source>New project</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4119"/>
<location filename="mainwindow.cpp" line="4128"/>
<source>Close %1 and start new project?</source>
<translation>&apos;%1&apos;?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4131"/>
<location filename="mainwindow.cpp" line="4140"/>
<source>Folder not exist</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4132"/>
<location filename="mainwindow.cpp" line="4141"/>
<source>Folder &apos;%1&apos; doesn&apos;t exist. Create it now?</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4139"/>
<location filename="mainwindow.cpp" line="4148"/>
<source>Can&apos;t create folder</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4140"/>
<location filename="mainwindow.cpp" line="4149"/>
<source>Failed to create folder &apos;%1&apos;.</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4155"/>
<location filename="mainwindow.cpp" line="4164"/>
<source>Save new project as</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4157"/>
<location filename="mainwindow.cpp" line="4166"/>
<source>Red panda Dev-C++ project file (*.dev)</source>
<translation>Dev-C++ (*.dev)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4168"/>
<location filename="mainwindow.cpp" line="4177"/>
<source>New project fail</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4169"/>
<location filename="mainwindow.cpp" line="4178"/>
<source>Can&apos;t assign project template</source>
<translation>使</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4212"/>
<location filename="mainwindow.cpp" line="4223"/>
<source>untitled</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4221"/>
<location filename="mainwindow.cpp" line="4233"/>
<source>New Project File Name</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4222"/>
<location filename="mainwindow.cpp" line="4234"/>
<source>File Name:</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4228"/>
<location filename="mainwindow.cpp" line="4240"/>
<source>File Already Exists!</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4229"/>
<location filename="mainwindow.cpp" line="4241"/>
<source>File &apos;%1&apos; already exists!</source>
<translation type="unfinished"></translation>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4248"/>
<location filename="mainwindow.cpp" line="4260"/>
<source>Add to project</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4461"/>
<location filename="mainwindow.cpp" line="4473"/>
<source>Rename Error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4462"/>
<location filename="mainwindow.cpp" line="4474"/>
<source>Symbol &apos;%1&apos; is defined in system header.</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4476"/>
<location filename="mainwindow.cpp" line="4488"/>
<source>New Name</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4542"/>
<location filename="mainwindow.cpp" line="4552"/>
<location filename="mainwindow.cpp" line="4554"/>
<location filename="mainwindow.cpp" line="4564"/>
<source>Replace Error</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4543"/>
<location filename="mainwindow.cpp" line="4555"/>
<source>Can&apos;t open file &apos;%1&apos; for replace!</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4553"/>
<location filename="mainwindow.cpp" line="4565"/>
<source>Contents has changed since last search!</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4599"/>
<location filename="mainwindow.cpp" line="4611"/>
<source>Rich Text Format Files (*.rtf)</source>
<translation>RTF格式文件 (*.rtf)</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4621"/>
<location filename="mainwindow.cpp" line="4633"/>
<source>HTML Files (*.html)</source>
<translation>HTML文件 (*.html)</translation>
</message>
@ -4187,8 +4202,8 @@ Are you really want to continue?</source>
<location filename="mainwindow.cpp" line="2880"/>
<location filename="mainwindow.cpp" line="3024"/>
<location filename="mainwindow.cpp" line="3036"/>
<location filename="mainwindow.cpp" line="3367"/>
<location filename="mainwindow.cpp" line="3379"/>
<location filename="mainwindow.cpp" line="3376"/>
<location filename="mainwindow.cpp" line="3388"/>
<source>Error</source>
<translation></translation>
</message>
@ -4223,50 +4238,50 @@ Are you really want to continue?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3199"/>
<location filename="mainwindow.cpp" line="3208"/>
<source>Compile Failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3204"/>
<location filename="mainwindow.cpp" line="3213"/>
<source>Run Failed</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3396"/>
<location filename="mainwindow.cpp" line="3410"/>
<location filename="mainwindow.cpp" line="3405"/>
<location filename="mainwindow.cpp" line="3419"/>
<source>Confirm Convertion</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3397"/>
<location filename="mainwindow.cpp" line="3411"/>
<location filename="mainwindow.cpp" line="3406"/>
<location filename="mainwindow.cpp" line="3420"/>
<source>The editing file will be saved using %1 encoding. &lt;br /&gt;This operation can&apos;t be reverted. &lt;br /&gt;Are you sure to continue?</source>
<translation>使%1&lt;br /&gt;&lt;br /&gt;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3577"/>
<location filename="mainwindow.cpp" line="3586"/>
<source>New Watch Expression</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3578"/>
<location filename="mainwindow.cpp" line="3587"/>
<source>Enter Watch Expression (it is recommended to use &apos;this-&gt;&apos; for class members):</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3634"/>
<location filename="mainwindow.cpp" line="3643"/>
<source>Parsing file %1 of %2: &quot;%3&quot;</source>
<translation>%1/%2&quot;%3&quot;</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3656"/>
<location filename="mainwindow.cpp" line="3662"/>
<location filename="mainwindow.cpp" line="3665"/>
<location filename="mainwindow.cpp" line="3671"/>
<source>Done parsing %1 files in %2 seconds</source>
<translation>%1,%2</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="3659"/>
<location filename="mainwindow.cpp" line="3668"/>
<source>(%1 files per second)</source>
<translation>(%1</translation>
</message>
@ -4348,67 +4363,67 @@ Are you really want to continue?</source>
<translation>&apos;%1&apos;.</translation>
</message>
<message>
<location filename="project.cpp" line="669"/>
<location filename="project.cpp" line="677"/>
<source>Error Load File</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="777"/>
<location filename="project.cpp" line="786"/>
<source>File Exists</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="778"/>
<location filename="project.cpp" line="787"/>
<source>File &apos;%1&apos; is already in the project</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="project.cpp" line="1143"/>
<location filename="project.cpp" line="1152"/>
<source>Project Updated</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1144"/>
<location filename="project.cpp" line="1153"/>
<source>Your project was succesfully updated to a newer file format!</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1146"/>
<location filename="project.cpp" line="1155"/>
<source>If something has gone wrong, we kept a backup-file: &apos;%1&apos;...</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="project.cpp" line="1322"/>
<location filename="project.cpp" line="1331"/>
<source>Settings need update</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1323"/>
<location filename="project.cpp" line="1332"/>
<source>The compiler settings format of Dev-C++ has changed.</source>
<translation>Dev-C++</translation>
</message>
<message>
<location filename="project.cpp" line="1325"/>
<location filename="project.cpp" line="1334"/>
<source>Please update your settings at Project &gt;&gt; Project Options &gt;&gt; Compiler and save your project.</source>
<translation> &gt;&gt; &gt;&gt; </translation>
</message>
<message>
<location filename="project.cpp" line="1361"/>
<location filename="project.cpp" line="1370"/>
<source>Compiler not found</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1362"/>
<location filename="project.cpp" line="1371"/>
<source>The compiler set you have selected for this project, no longer exists.</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1364"/>
<location filename="project.cpp" line="1373"/>
<source>It will be substituted by the global compiler set.</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1389"/>
<location filename="project.cpp" line="1403"/>
<source>Developed using the Red Panda Dev-C++ IDE</source>
<translation>使Dev-C++</translation>
</message>
@ -4422,31 +4437,26 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="20"/>
<source>Add encoding options to compiler</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="27"/>
<source>Statically link libraries</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="34"/>
<source>Additional build options:</source>
<translation>:</translation>
<oldsource>Add encoding options to compiler</oldsource>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="45"/>
<source>Statically link libraries</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="31"/>
<source>C Compiler</source>
<translation>C编译器</translation>
</message>
<message>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="67"/>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="53"/>
<source>C++ Compiler</source>
<translation>C++</translation>
</message>
<message>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="89"/>
<location filename="settingsdialog/projectcompileparamaterswidget.ui" line="75"/>
<source>Linker</source>
<translation></translation>
</message>
@ -4512,17 +4522,17 @@ Are you really want to continue?</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/projectcompilerwidget.ui" line="36"/>
<location filename="settingsdialog/projectcompilerwidget.ui" line="53"/>
<source>Base compiler set:</source>
<translation>:</translation>
</message>
<message>
<location filename="settingsdialog/projectcompilerwidget.ui" line="47"/>
<location filename="settingsdialog/projectcompilerwidget.ui" line="40"/>
<source>Tab 1</source>
<translation>1</translation>
</message>
<message>
<location filename="settingsdialog/projectcompilerwidget.ui" line="52"/>
<location filename="settingsdialog/projectcompilerwidget.ui" line="45"/>
<source>Tab 2</source>
<translation>2</translation>
</message>
@ -4531,6 +4541,16 @@ Are you really want to continue?</source>
<source>Customize (apply to this project only):</source>
<translation>()</translation>
</message>
<message>
<location filename="settingsdialog/projectcompilerwidget.ui" line="67"/>
<source>Statically link libraries</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/projectcompilerwidget.ui" line="74"/>
<source>Add encoding options to compiler</source>
<translation></translation>
</message>
</context>
<context>
<name>ProjectDLLHostWidget</name>
@ -4794,24 +4814,24 @@ Are you really want to continue?</source>
<context>
<name>ProjectModel</name>
<message>
<location filename="project.cpp" line="1876"/>
<location filename="project.cpp" line="1903"/>
<source>File exists</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1877"/>
<location filename="project.cpp" line="1904"/>
<source>File &apos;%1&apos; already exists. Delete it now?</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="project.cpp" line="1895"/>
<location filename="project.cpp" line="1915"/>
<location filename="project.cpp" line="1922"/>
<location filename="project.cpp" line="1942"/>
<source>Remove failed</source>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1896"/>
<location filename="project.cpp" line="1916"/>
<location filename="project.cpp" line="1923"/>
<location filename="project.cpp" line="1943"/>
<source>Failed to remove file &apos;%1&apos;</source>
<translation>&apos;%1&apos;</translation>
</message>
@ -5302,23 +5322,23 @@ Are you really want to continue?</source>
<translation>(-S)</translation>
</message>
<message>
<location filename="settings.cpp" line="2382"/>
<location filename="settings.cpp" line="2407"/>
<location filename="settings.cpp" line="2395"/>
<location filename="settings.cpp" line="2420"/>
<source>Confirm</source>
<translation></translation>
</message>
<message>
<location filename="settings.cpp" line="2383"/>
<location filename="settings.cpp" line="2396"/>
<source>The following problems were found during validation of compiler set &quot;%1&quot;:</source>
<translation>&quot;%1&quot;</translation>
</message>
<message>
<location filename="settings.cpp" line="2408"/>
<location filename="settings.cpp" line="2421"/>
<source>Compiler set not configuared.</source>
<translation></translation>
</message>
<message>
<location filename="settings.cpp" line="2410"/>
<location filename="settings.cpp" line="2423"/>
<source>Would you like Red Panda C++ to search for compilers in the following locations: &lt;BR /&gt;&apos;%1&apos;&lt;BR /&gt;&apos;%2&apos;? </source>
<translation>C++&lt;br /&gt;%1&lt;br /&gt;%2</translation>
</message>
@ -5344,13 +5364,13 @@ Are you really want to continue?</source>
</message>
<message>
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="77"/>
<location filename="settingsdialog/projectcompilerwidget.cpp" line="63"/>
<location filename="settingsdialog/projectcompilerwidget.cpp" line="64"/>
<source>No</source>
<translation></translation>
</message>
<message>
<location filename="settingsdialog/compilersetoptionwidget.cpp" line="78"/>
<location filename="settingsdialog/projectcompilerwidget.cpp" line="64"/>
<location filename="settingsdialog/projectcompilerwidget.cpp" line="65"/>
<source>Yes</source>
<translation></translation>
</message>
@ -6070,7 +6090,7 @@ Are you really want to continue?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4768"/>
<location filename="mainwindow.cpp" line="4780"/>
<location filename="settingsdialog/settingsdialog.cpp" line="130"/>
<location filename="settingsdialog/settingsdialog.cpp" line="174"/>
<location filename="settingsdialog/settingsdialog.cpp" line="178"/>
@ -6146,7 +6166,7 @@ Are you really want to continue?</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="4769"/>
<location filename="mainwindow.cpp" line="4781"/>
<location filename="settingsdialog/settingsdialog.cpp" line="174"/>
<source>Program Runner</source>
<translation></translation>

View File

@ -3050,7 +3050,17 @@ void MainWindow::onCompilerSetChanged(int index)
if (mProject) {
Editor *e = mEditorList->getEditor();
if (!e || e->inProject()) {
mProject->options().compilerSet = index;
if(QMessageBox::warning(
e,
tr("Change Project Compiler Set"),
tr("Change the project's compiler set will lose all custom compiler set options.")
+"<br />"
+ tr("Do you really want to do that?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) != QMessageBox::Yes) {
return;
}
mProject->setCompilerSet(index);
mProject->saveOptions();
return;
}

View File

@ -615,6 +615,14 @@ PFolderNode Project::pointerToNode(FolderNode *p, PFolderNode parent)
return PFolderNode();
}
void Project::setCompilerSet(int compilerSetIndex)
{
if (mOptions.compilerSet != compilerSetIndex) {
mOptions.compilerSet = compilerSetIndex;
updateCompilerSetType();
}
}
bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate)
{
if (!aTemplate) {
@ -716,6 +724,7 @@ void Project::saveOptions()
ini.SetLongValue("Project","IncludeVersionInfo", mOptions.includeVersionInfo);
ini.SetLongValue("Project","SupportXPThemes", mOptions.supportXPThemes);
ini.SetLongValue("Project","CompilerSet", mOptions.compilerSet);
ini.SetLongValue("Project","CompilerSetType", mOptions.compilerSetType);
ini.SetValue("Project","CompilerSettings", mOptions.compilerOptions);
ini.SetLongValue("Project","StaticLink", mOptions.staticLink);
ini.SetLongValue("Project","AddCharset", mOptions.addCharset);
@ -1370,6 +1379,11 @@ void Project::loadOptions(SimpleIni& ini)
mOptions.compilerOptions = ini.GetValue("Project", "CompilerSettings", "");
mOptions.staticLink = ini.GetBoolValue("Project", "StaticLink", true);
mOptions.addCharset = ini.GetBoolValue("Project", "AddCharset", true);
mOptions.compilerSetType = ini.GetLongValue("Project","CompilerSetType",-1);
if (mOptions.compilerSetType<0) {
updateCompilerSetType();
}
bool useUTF8 = ini.GetBoolValue("Project", "UseUTF8", false);
if (useUTF8) {
mOptions.encoding = fromByteArray(ini.GetValue("Project","Encoding", ENCODING_UTF8));
@ -1516,6 +1530,19 @@ void Project::updateFolderNode(PFolderNode node)
}
}
void Project::updateCompilerSetType()
{
Settings::PCompilerSet defaultSet = pSettings->compilerSets().getSet(mOptions.compilerSet);
if (defaultSet) {
mOptions.compilerSetType=defaultSet->compilerSetType();
mOptions.staticLink = defaultSet->staticLink();
mOptions.compilerOptions = defaultSet->iniOptions();
} else {
mOptions.compilerSetType=CST_DEBUG;
mOptions.staticLink = false;
}
}
const QList<PProjectUnit> &Project::units() const
{
return mUnits;

View File

@ -163,6 +163,7 @@ public:
void updateFolders();
void updateNodeIndexes();
PFolderNode pointerToNode(FolderNode * p, PFolderNode parent=PFolderNode());
void setCompilerSet(int compilerSetIndex);
//void showOptions();
bool assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate);
@ -190,6 +191,7 @@ private:
void open();
void removeFolderRecurse(PFolderNode node);
void updateFolderNode(PFolderNode node);
void updateCompilerSetType();
private:
QList<PProjectUnit> mUnits;

View File

@ -60,6 +60,7 @@ struct ProjectOptions{
bool includeVersionInfo;
bool supportXPThemes;
int compilerSet;
int compilerSetType;
QByteArray compilerOptions;
ProjectVersionInfo versionInfo;
QString cmdLineArgs;

View File

@ -2204,6 +2204,16 @@ QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const
return result.trimmed();
}
int Settings::CompilerSet::compilerSetType() const
{
return mCompilerSetType;
}
void Settings::CompilerSet::setCompilerSetType(int newCompilerSetType)
{
mCompilerSetType = newCompilerSetType;
}
void Settings::CompilerSet::setCompilerType(const QString &newCompilerType)
{
mCompilerType = newCompilerType;
@ -2318,14 +2328,17 @@ void Settings::CompilerSets::addSets(const QString &folder)
platformName = "32-bit";
}
baseSet->setName(baseName + " " + platformName + " Release");
baseSet->setCompilerSetType(CompilerSetType::CST_RELEASE);
setReleaseOptions(baseSet);
baseSet = addSet(folder);
baseSet->setName(baseName + " " + platformName + " Debug");
baseSet->setCompilerSetType(CompilerSetType::CST_DEBUG);
setDebugOptions(baseSet);
baseSet = addSet(folder);
baseSet->setName(baseName + " " + platformName + " Profiling");
baseSet->setCompilerSetType(CompilerSetType::CST_PROFILING);
setProfileOptions(baseSet);
mDefaultIndex = mList.size() - 2;
@ -2543,6 +2556,7 @@ void Settings::CompilerSets::saveSet(int index)
mSettings->mSettings.setValue("Name", pSet->name());
mSettings->mSettings.setValue("Target", pSet->target());
mSettings->mSettings.setValue("CompilerType", pSet->compilerType());
mSettings->mSettings.setValue("CompilerSetType", pSet->compilerSetType());
// Paths
savePathList("Bins",pSet->binDirs());
@ -2605,6 +2619,7 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
pSet->setName(mSettings->mSettings.value("Name").toString());
pSet->setTarget(mSettings->mSettings.value("Target").toString());
pSet->setCompilerType(mSettings->mSettings.value("CompilerType").toString());
pSet->setCompilerSetType(mSettings->mSettings.value("CompilerSetType").toInt());
// Paths
loadPathList("Bins",pSet->binDirs());

View File

@ -34,6 +34,12 @@ extern const char ValueToChar[28];
class Settings;
enum CompilerSetType {
CST_RELEASE,
CST_DEBUG,
CST_PROFILING
};
typedef struct {
QString name; // language table index of "Generate debugging info"
QString section; // language table index of "C options"
@ -968,6 +974,9 @@ public:
void setCompilerType(const QString &newCompilerType);
int compilerSetType() const;
void setCompilerSetType(int newCompilerSetType);
private:
// Initialization
void setExecutables();
@ -1003,7 +1012,8 @@ public:
QString mName; // "TDM-GCC 4.7.1 Release"
QStringList mDefines; // list of predefined constants
QString mTarget; // 'X86_64' / 'i686'
QString mCompilerType;
QString mCompilerType; // 'Clang' / 'GCC'
int mCompilerSetType; // RELEASE/ DEBUG/ Profile
// User settings
bool mUseCustomCompileParams;

View File

@ -17,8 +17,6 @@ ProjectCompileParamatersWidget::~ProjectCompileParamatersWidget()
void ProjectCompileParamatersWidget::doLoad()
{
ui->chkAddCharset->setChecked(pMainWindow->project()->options().addCharset);
ui->chkStaticLink->setChecked(pMainWindow->project()->options().staticLink);
ui->txtCCompiler->setPlainText(pMainWindow->project()->options().compilerCmd);
ui->txtCPPCompiler->setPlainText(pMainWindow->project()->options().cppCompilerCmd);
ui->txtLinker->setPlainText(pMainWindow->project()->options().linkerCmd);
@ -26,8 +24,6 @@ void ProjectCompileParamatersWidget::doLoad()
void ProjectCompileParamatersWidget::doSave()
{
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked();
pMainWindow->project()->options().compilerCmd = ui->txtCCompiler->toPlainText();
pMainWindow->project()->options().cppCompilerCmd = ui->txtCPPCompiler->toPlainText();
pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText();

View File

@ -14,20 +14,6 @@
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="chkAddCharset">
<property name="text">
<string>Add encoding options to compiler</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkStaticLink">
<property name="text">
<string>Statically link libraries</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">

View File

@ -18,9 +18,10 @@ ProjectCompilerWidget::~ProjectCompilerWidget()
void ProjectCompilerWidget::refreshOptions()
{
Settings::PCompilerSet pSet = pSettings->compilerSets().defaultSet();
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
if (!pSet)
return;
mOptions = pSet->iniOptions();
QTabWidget* pTab = ui->tabOptions;
while (pTab->count()>0) {
QWidget* p=pTab->widget(0);
@ -79,10 +80,15 @@ void ProjectCompilerWidget::refreshOptions()
QSpacerItem* horizontalSpacer = new QSpacerItem(10, 100, QSizePolicy::Minimum, QSizePolicy::Expanding);
pLayout->addItem(horizontalSpacer,row,0);
}
ui->chkStaticLink->setChecked(pSet->staticLink());
}
void ProjectCompilerWidget::doLoad()
{
ui->chkAddCharset->setChecked(pMainWindow->project()->options().addCharset);
ui->chkStaticLink->setChecked(pMainWindow->project()->options().staticLink);
mOptions = pMainWindow->project()->options().compilerOptions;
ui->cbCompilerSet->setCurrentIndex(pMainWindow->project()->options().compilerSet);
}
@ -113,8 +119,10 @@ void ProjectCompilerWidget::doSave()
}
}
}
pMainWindow->project()->options().compilerSet = ui->cbCompilerSet->currentIndex();
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
pMainWindow->project()->options().compilerOptions = mOptions;
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked();
pMainWindow->project()->saveOptions();
}

View File

@ -14,6 +14,9 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true"/>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
@ -30,17 +33,7 @@
<item row="0" column="1">
<widget class="QComboBox" name="cbCompilerSet"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Base compiler set:</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true"/>
</item>
<item row="2" column="0" colspan="3">
<widget class="QTabWidget" name="tabOptions">
<widget class="QWidget" name="tab">
<attribute name="title">
@ -54,13 +47,34 @@
</widget>
</widget>
</item>
<item row="1" column="0" colspan="3">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Base compiler set:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Customize (apply to this project only):</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="chkStaticLink">
<property name="text">
<string>Statically link libraries</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkAddCharset">
<property name="text">
<string>Add encoding options to compiler</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>