diff --git a/NEWS.md b/NEWS.md index 2ae32135..a5b064f7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index 7256ad45..c14595d9 100644 Binary files a/RedPandaIDE/RedPandaIDE_zh_CN.qm and b/RedPandaIDE/RedPandaIDE_zh_CN.qm differ diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index ff10c43d..d597ce23 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -2807,11 +2807,11 @@ Are you really want to continue? - - - - - + + + + + Issues 编译器 @@ -3466,7 +3466,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -3567,7 +3567,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -3588,13 +3588,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -3640,7 +3640,7 @@ Are you really want to continue? - + Open Folder 打开文件夹 @@ -3891,15 +3891,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -4048,128 +4048,143 @@ Are you really want to continue? 保存失败 - + + Change Project Compiler Set + 改变项目编译器配置集 + + + + Change the project's compiler set will lose all custom compiler set options. + 改变项目的编译器配置集会导致所有的自定义编译器选项被重置。 + + + + Do you really want to do that? + 你真的想要做那些吗? + + + Do you really want to clear all breakpoints in this file? 您真的要清除该文件的所有断点吗? - + New project 新建项目 - + Close %1 and start new project? 关闭'%1'以打开新项目? - + Folder not exist 文件夹不存在 - + Folder '%1' doesn't exist. Create it now? 文件夹'%1'不存在。是否创建? - + Can't create folder 无法创建文件夹 - + Failed to create folder '%1'. 创建文件夹'%1'失败。 - + Save new project as - + Red panda Dev-C++ project file (*.dev) 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + untitled - 无标题 + 无标题 - + New Project File Name - + 新的项目文件名 - + File Name: - 文件名: + 文件名: - + File Already Exists! - + 文件已存在! - + File '%1' already exists! - + 文件'%1'已经存在! - + Add to project 添加到项目 - + Rename Error 重命名出错 - + Symbol '%1' is defined in system header. 符号'%1'在系统头文件中定义,无法修改。 - + New Name 新名称 - - + + Replace Error 替换出错 - + Can't open file '%1' for replace! 无法打开文件'%1'进行替换! - + Contents has changed since last search! 内容和上次查找时不一致。 - + Rich Text Format Files (*.rtf) RTF格式文件 (*.rtf) - + HTML Files (*.html) HTML文件 (*.html) @@ -4187,8 +4202,8 @@ Are you really want to continue? - - + + Error 错误 @@ -4223,50 +4238,50 @@ Are you really want to continue? 打开 - + Compile Failed 编译失败 - + Run Failed 运行失败 - - + + Confirm Convertion 确认转换 - - + + The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue? 当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗? - + New Watch Expression 新监视表达式 - + Enter Watch Expression (it is recommended to use 'this->' for class members): 输入监视表达式 - + Parsing file %1 of %2: "%3" (%1/%2)正在解析文件"%3" - - + + Done parsing %1 files in %2 seconds 完成%1个文件的解析,用时%2秒 - + (%1 files per second) (每秒%1个文件) @@ -4348,67 +4363,67 @@ Are you really want to continue? 无法保存文件'%1'. - + Error Load File - + 载入文件错误 - + File Exists 文件已存在 - + File '%1' is already in the project 文件'%1'已在项目中 - + Project Updated 项目已升级 - + Your project was succesfully updated to a newer file format! 已成功将项目升级到新的格式 - + If something has gone wrong, we kept a backup-file: '%1'... 旧项目文件备份在'%1'。 - + Settings need update 设置需要更新 - + The compiler settings format of Dev-C++ has changed. Dev-C++的编译器设置格式已发生改变。 - + Please update your settings at Project >> Project Options >> Compiler and save your project. 请在项目 >> 项目属性 >> 编译器设置中修改您的设置并保存您的项目 - + Compiler not found 未找到编译器 - + The compiler set you have selected for this project, no longer exists. 您为该项目设置的编译器不存在。 - + It will be substituted by the global compiler set. 它将会被全局编译器设置代替。 - + Developed using the Red Panda Dev-C++ IDE 使用小熊猫Dev-C++编辑器开发 @@ -4422,31 +4437,26 @@ Are you really want to continue? - Add encoding options to compiler - 编译时加入文件编码参数 - - - - Statically link libraries - 静态链接所有库 - - - Additional build options: - 附加构建参数: + Add encoding options to compiler + 更多编译选项: - + Statically link libraries + 静态链接所有库 + + + C Compiler C编译器 - + C++ Compiler C++编译器 - + Linker 链接器 @@ -4512,17 +4522,17 @@ Are you really want to continue? 表单 - + Base compiler set: 基础编译器设置: - + Tab 1 标签1 - + Tab 2 标签2 @@ -4531,6 +4541,16 @@ Are you really want to continue? Customize (apply to this project only): 自定义设置(仅对本项目生效) + + + Statically link libraries + 静态链接所有库 + + + + Add encoding options to compiler + 在编译时加入字符集选项 + ProjectDLLHostWidget @@ -4794,24 +4814,24 @@ Are you really want to continue? ProjectModel - + File exists 文件已存在 - + File '%1' already exists. Delete it now? 文件'%1'已存在。是否删除? - - + + Remove failed 删除失败 - - + + Failed to remove file '%1' 无法删除文件'%1' @@ -5302,23 +5322,23 @@ Are you really want to continue? 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 @@ -5344,13 +5364,13 @@ Are you really want to continue? - + No - + Yes @@ -6070,7 +6090,7 @@ Are you really want to continue? 自动链接 - + @@ -6146,7 +6166,7 @@ Are you really want to continue? 杂项 - + Program Runner 程序运行 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 065e329e..deab36cc 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -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.") + +"
" + + tr("Do you really want to do that?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No) != QMessageBox::Yes) { + return; + } + mProject->setCompilerSet(index); mProject->saveOptions(); return; } diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index c85ed724..0eda57c3 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -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 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 &Project::units() const { return mUnits; diff --git a/RedPandaIDE/project.h b/RedPandaIDE/project.h index 8bde8514..3c37f000 100644 --- a/RedPandaIDE/project.h +++ b/RedPandaIDE/project.h @@ -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 aTemplate); @@ -190,6 +191,7 @@ private: void open(); void removeFolderRecurse(PFolderNode node); void updateFolderNode(PFolderNode node); + void updateCompilerSetType(); private: QList mUnits; diff --git a/RedPandaIDE/projectoptions.h b/RedPandaIDE/projectoptions.h index e1710c71..1b3c9259 100644 --- a/RedPandaIDE/projectoptions.h +++ b/RedPandaIDE/projectoptions.h @@ -60,6 +60,7 @@ struct ProjectOptions{ bool includeVersionInfo; bool supportXPThemes; int compilerSet; + int compilerSetType; QByteArray compilerOptions; ProjectVersionInfo versionInfo; QString cmdLineArgs; diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index c64d53d5..dcaa1a42 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -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()); diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 5ae18c6e..c9f36283 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -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; diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp index f63fd089..dd931011 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp @@ -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(); diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui index 505a1617..a536b31e 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui @@ -14,20 +14,6 @@ Form - - - - Add encoding options to compiler - - - - - - - Statically link libraries - - - diff --git a/RedPandaIDE/settingsdialog/projectcompilerwidget.cpp b/RedPandaIDE/settingsdialog/projectcompilerwidget.cpp index d3448b1c..46329ad5 100644 --- a/RedPandaIDE/settingsdialog/projectcompilerwidget.cpp +++ b/RedPandaIDE/settingsdialog/projectcompilerwidget.cpp @@ -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(); } diff --git a/RedPandaIDE/settingsdialog/projectcompilerwidget.ui b/RedPandaIDE/settingsdialog/projectcompilerwidget.ui index 5e1ae547..6de52b42 100644 --- a/RedPandaIDE/settingsdialog/projectcompilerwidget.ui +++ b/RedPandaIDE/settingsdialog/projectcompilerwidget.ui @@ -14,6 +14,9 @@ Form + + + @@ -30,17 +33,7 @@ - - - - Base compiler set: - - - - - - @@ -54,13 +47,34 @@ - + + + + Base compiler set: + + + + Customize (apply to this project only): + + + + Statically link libraries + + + + + + + Add encoding options to compiler + + +