From 988afaac7ac8eab0f8370bf5583d6a1a8722f185 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 26 Dec 2022 22:55:00 +0800 Subject: [PATCH] - enhancement: Add "Resources" in project option's dialog's custom compiler parameter page --- NEWS.md | 1 + RedPandaIDE/compiler/projectcompiler.cpp | 7 +- RedPandaIDE/project.cpp | 4 + RedPandaIDE/projectoptions.h | 1 + RedPandaIDE/projecttemplate.cpp | 1 + .../projectcompileparamaterswidget.cpp | 5 + .../projectcompileparamaterswidget.ui | 28 +- RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 8 + RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 346 +++++++++--------- RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 8 + 10 files changed, 236 insertions(+), 173 deletions(-) diff --git a/NEWS.md b/NEWS.md index 046fc0d9..c1879228 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ Red Panda C++ Version 2.8 - fix: Crash when editing makefile + - enhancement: Add "Resources" in project option's dialog's custom compiler parameter page Red Panda C++ Version 2.7 diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index 34279296..382c1627 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -266,6 +266,9 @@ void ProjectCompiler::writeMakeDefines(QFile &file) writeln(file,"PCH_H = " + genMakePath1(extractRelativePath(mProject->makeFileName(), mProject->options().precompiledHeader ))); writeln(file,"PCH = " + genMakePath1(extractRelativePath(mProject->makeFileName(), mProject->options().precompiledHeader+"."+GCH_EXT))); } +#ifdef Q_OS_WIN + writeln(file,"WINDRESFLAGS = " + mProject->options().resourceCmd); +#endif // This needs to be put in before the clean command. @@ -492,11 +495,11 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file) if (mOnlyCheckSyntax) { writeln(file); writeln(file, ObjFileName + ':'); - writeln(file, "\t$(WINDRES) -i " + PrivResName + WindresArgs + " --input-format=rc -o nul -O coff" + ResIncludes); + writeln(file, "\t$(WINDRES) -i " + PrivResName + WindresArgs + " --input-format=rc -o nul -O coff $(WINDRESFLAGS)" + ResIncludes); } else { writeln(file); writeln(file, ObjFileName + ": " + PrivResName + ' ' + ResFiles); - writeln(file, "\t$(WINDRES) -i " + PrivResName + WindresArgs + " --input-format=rc -o " + ObjFileName + " -O coff" + writeln(file, "\t$(WINDRES) -i " + PrivResName + WindresArgs + " --input-format=rc -o " + ObjFileName + " -O coff $(WINDRESFLAGS)" + ResIncludes); } writeln(file); diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index ca6bdfc1..7dc7c72d 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -1007,6 +1007,8 @@ bool Project::saveAsTemplate(const QString &templateFolder, ini->SetValue("Project", "CppCompiler", mOptions.cppCompilerCmd.toUtf8()); if (!mOptions.linkerCmd.isEmpty()) ini->SetValue("Project", "Linker",mOptions.linkerCmd.toUtf8()); + if (!mOptions.resourceCmd.isEmpty()) + ini->SetValue("Project", "ResourceCommand",mOptions.resourceCmd.toUtf8()); ini->SetBoolValue("Project", "IsCpp", mOptions.isCpp); if (mOptions.includeVersionInfo) ini->SetBoolValue("Project", "IncludeVersionInfo", true); @@ -1091,6 +1093,7 @@ void Project::saveOptions() ini.SetValue("Project","Compiler", toByteArray(mOptions.compilerCmd)); ini.SetValue("Project","CppCompiler", toByteArray(mOptions.cppCompilerCmd)); ini.SetValue("Project","Linker", toByteArray(mOptions.linkerCmd)); + ini.SetValue("Project", "ResourceCommand", toByteArray(mOptions.resourceCmd)); ini.SetLongValue("Project","IsCpp", mOptions.isCpp); ini.SetValue("Project","Icon", toByteArray(extractRelativePath(directory(), mOptions.icon))); ini.SetValue("Project","ExeOutput", toByteArray(extractRelativePath(directory(),mOptions.exeOutput))); @@ -1896,6 +1899,7 @@ void Project::loadOptions(SimpleIni& ini) mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "Compiler", "")); mOptions.cppCompilerCmd = fromByteArray(ini.GetValue("Project", "CppCompiler", "")); mOptions.linkerCmd = fromByteArray(ini.GetValue("Project", "Linker", "")); + mOptions.resourceCmd = fromByteArray(ini.GetValue("Project", "ResourceCommand", "")); mOptions.binDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Bins", "")).split(";", #if QT_VERSION >= QT_VERSION_CHECK(5,15,0) Qt::SkipEmptyParts diff --git a/RedPandaIDE/projectoptions.h b/RedPandaIDE/projectoptions.h index c3c46e8d..82189b34 100644 --- a/RedPandaIDE/projectoptions.h +++ b/RedPandaIDE/projectoptions.h @@ -66,6 +66,7 @@ struct ProjectOptions{ QString compilerCmd; QString cppCompilerCmd; QString linkerCmd; + QString resourceCmd; QStringList binDirs; QStringList includeDirs; QStringList libDirs; diff --git a/RedPandaIDE/projecttemplate.cpp b/RedPandaIDE/projecttemplate.cpp index cb8dd738..b179f089 100644 --- a/RedPandaIDE/projecttemplate.cpp +++ b/RedPandaIDE/projecttemplate.cpp @@ -137,6 +137,7 @@ void ProjectTemplate::readTemplateFile(const QString &fileName) mOptions.compilerCmd = fromByteArray(mIni->GetValue("Project", "Compiler", "")); mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", "")); mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker","")); + mOptions.resourceCmd = fromByteArray(mIni->GetValue("Project", "ResourceCommand", "")); mOptions.isCpp = mIni->GetBoolValue("Project", "IsCpp", false); mOptions.includeVersionInfo = mIni->GetBoolValue("Project", "IncludeVersionInfo", false); mOptions.supportXPThemes = mIni->GetBoolValue("Project", "SupportXPThemes", false); diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp index 4dc708ca..61a406b8 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.cpp @@ -35,7 +35,10 @@ ProjectCompileParamatersWidget::ProjectCompileParamatersWidget(const QString &na SYSTEM_INFO info; GetSystemInfo(&info); ui->spinParallelJobs->setMaximum(info.dwNumberOfProcessors); +#else + ui->tabResource->setVisible(false); #endif + ui->tabCommands->setCurrentWidget(ui->tabCCompiler); } ProjectCompileParamatersWidget::~ProjectCompileParamatersWidget() @@ -48,6 +51,7 @@ void ProjectCompileParamatersWidget::doLoad() ui->txtCCompiler->setPlainText(pMainWindow->project()->options().compilerCmd); ui->txtCPPCompiler->setPlainText(pMainWindow->project()->options().cppCompilerCmd); ui->txtLinker->setPlainText(pMainWindow->project()->options().linkerCmd); + ui->txtResource->setPlainText(pMainWindow->project()->options().resourceCmd); ui->grpAllowParallelBuilding->setChecked(pMainWindow->project()->options().allowParallelBuilding); ui->spinParallelJobs->setValue(pMainWindow->project()->options().parellelBuildingJobs); } @@ -57,6 +61,7 @@ void ProjectCompileParamatersWidget::doSave() pMainWindow->project()->options().compilerCmd = ui->txtCCompiler->toPlainText(); pMainWindow->project()->options().cppCompilerCmd = ui->txtCPPCompiler->toPlainText(); pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText(); + pMainWindow->project()->options().resourceCmd = ui->txtResource->toPlainText(); pMainWindow->project()->options().allowParallelBuilding = ui->grpAllowParallelBuilding->isChecked(); pMainWindow->project()->options().parellelBuildingJobs = ui->spinParallelJobs->value(); pMainWindow->project()->saveOptions(); diff --git a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui index 649b9988..5cecd205 100644 --- a/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui +++ b/RedPandaIDE/settingsdialog/projectcompileparamaterswidget.ui @@ -54,7 +54,7 @@ 2 - + C Compiler @@ -76,7 +76,7 @@ - + C++ Compiler @@ -98,7 +98,7 @@ - + Linker @@ -159,6 +159,28 @@ + + + Resource + + + + 5 + + + 5 + + + 5 + + + 5 + + + + + + diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index c19495a5..d546aed4 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -2072,6 +2072,10 @@ Please check the "program" page of compiler settings. + + Checking single file... + + FilePropertiesDialog @@ -5365,6 +5369,10 @@ Parallel Jobs(0 means infinite): + + Resource + + ProjectCompiler diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 2d6befd7..9a5928d4 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -702,12 +702,12 @@ p, li { white-space: pre-wrap; } 程序中的文字内容可能无法被正确处理和显示。 - + Can't find Console Pauser 找不到Console Pauser程序 - + Console Pauser "%1" doesn't exists! 找不到Console Pauser程序"%1"! @@ -2752,55 +2752,60 @@ Are you really want to continue? FileCompiler - + + Checking single file... + 检查单个文件... + + + Compiling single file... 编译单个文件... - + - Filename: %1 - 文件名: %1 - + - Compiler Set Name: %1 - 编译器配置: %1 - - + + Can't delete the old executable file "%1". 无法删除旧的可执行文件"%1". - + Can't find the compiler for file %1 Can't the compiler for file %1 找不到适合文件%1的编译器 - + The Compiler '%1' doesn't exists! 编译器程序"%1"不存在! - + Please check the "program" page of compiler settings. 请检查编译器设置中的“程序”页。 - + Processing %1 source file: 正在处理%1源程序文件: - + %1 Compiler: %2 %1编译器: %2 - + Command: %1 %2 命令: %1 %2 @@ -4106,7 +4111,7 @@ Are you really want to continue? - + Issues 编译器 @@ -4544,7 +4549,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -4566,7 +4571,7 @@ Are you really want to continue? - + Save Problem Set 保存试题集 @@ -4574,7 +4579,7 @@ Are you really want to continue? - + Load Problem Set 载入试题集 @@ -4705,14 +4710,14 @@ Are you really want to continue? - + Import FPS Problem Set 导入FPS试题集 - + Export FPS Problem Set 导出FPS试题集 @@ -4949,7 +4954,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -5196,7 +5201,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -5217,13 +5222,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -5597,22 +5602,22 @@ Are you really want to continue? - - + + Wrong Compiler Settings 错误的编译器设置 - - + + Compiler is set not to generate executable. 编译器被设置为不生成可执行文件。 - + We need the executabe to run problem case. 我们需要可执行文件来运行试题案例。 @@ -5678,7 +5683,7 @@ Are you really want to continue? - + Please correct this before start debugging 请在调试前改正设置。 @@ -5736,22 +5741,22 @@ Are you really want to continue? 全部复制 - + Go to Line 跳转到行 - + Line - + Template Exists 模板已存在 - + Template %1 already exists. Do you want to overwrite? 模板%1已存在。是否覆盖? @@ -5777,7 +5782,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -5851,15 +5856,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -6035,7 +6040,7 @@ Are you really want to continue? - + Delete 删除 @@ -6094,17 +6099,17 @@ Are you really want to continue? 中止 - + FPS Problem Set Files (*.fps;*.xml) FPS试题集文件(*.fps;*.xml) - + FPS Problem Set Files (*.fps) FPS试题集文件(*.fps) - + Export Error 导出时出错 @@ -6148,7 +6153,7 @@ Are you really want to continue? - + Do you want to save it? 需要保存吗? @@ -6172,7 +6177,7 @@ Are you really want to continue? - + Save Error 保存失败 @@ -6211,78 +6216,78 @@ Are you really want to continue? 无标题%1 - + Modify Watch 修改监视表达式 - + Watch Expression 监视表达式 - + 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 - + Folder %1 is not empty. 文件夹%1不是空的。 - + Do you really want to delete it? 你真的要删除它吗? - + Change working folder 改变工作文件夹 - + File '%1' is not in the current working folder. File '%1' is not in the current working folder 文件'%1'不在当前工作文件夹中。 - + Do you want to change working folder to '%1'? 是否将工作文件夹改设为'%1'? @@ -6291,28 +6296,28 @@ Are you really want to continue? 正在删除试题... - + Can't Commit 无法提交 - + Git needs user info to commit. Git需要用信息进行提交。 - + Choose Input Data File 选择输入数据文件 - - + + All files (*.*) 所有文件 (*.*) - + Choose Expected Output Data File Choose Expected Input Data File 选择期望输出文件 @@ -6324,59 +6329,59 @@ Are you really want to continue? - + Choose Working Folder 选择工作文件夹 - - + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! - + Can't commit! 无法提交! - + The following files are in conflicting: 下列文件处于冲突状态,请解决后重新添加和提交: - + Commit Message 提交信息 - + Commit Message: 提交信息: - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -6385,22 +6390,22 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? @@ -6409,27 +6414,27 @@ Are you really want to continue? 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 @@ -6460,76 +6465,76 @@ Are you really want to continue? 本操作会删除此试题的所有案例。 - + Red Panda C++ project file (*.dev) 小熊猫C++项目文件(*.dev) - + 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) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - - + + Load Error 载入失败 - + Problem Case %1 试题案例%1 @@ -6547,9 +6552,9 @@ Are you really want to continue? - - - + + + Error 错误 @@ -6601,54 +6606,54 @@ 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个文件) @@ -6999,31 +7004,31 @@ Are you really want to continue? - + sec - + ms 毫秒 - + KB KB - + MB MB - + GB GB @@ -7057,7 +7062,7 @@ Are you really want to continue? - + Error 错误 @@ -7067,89 +7072,89 @@ Are you really want to continue? 无法创建文件夹%1 - + Warning 警告 - - + + Can't save file %1 无法保存文件%1 - + 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'。 - + Headers 头文件 - + Sources 源文件 - + Others 其他文件 - + Settings need update 设置需要更新 - + The compiler settings format of Red Panda C++ has changed. The compiler settings format of Dev-C++ has changed. 小熊猫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 C++ IDE Developed using the Red Panda Dev-C++ IDE 使用小熊猫C++编辑器开发 @@ -7230,13 +7235,18 @@ Are you really want to continue? - + Add Library Files 添加库文件 - - + + Resource + 资源 + + + + Library Files 库文件 @@ -7264,42 +7274,42 @@ Are you really want to continue? - 资源文件: %1 - + Compiling project changes... 正在编译项目修改... - + - Project Filename: %1 - 项目文件名: %1 - + - Compiler Set Name: %1 - 编译器配置: %1 - + Make program '%1' doesn't exists! Make程序“%1”不存在! - + Please check the "program" page of compiler settings. 请检查编译器配置中的“程序”页。 - + Processing makefile: 正在处理makefile... - + - makefile processer: %1 - makefile处理器: %1 - + - Command: %1 %2 - 命令: %1 %2 @@ -7637,32 +7647,32 @@ 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' - + Rename failed 改名失败 - + Failed to rename file '%1' to '%2' 无法将文件'%1'改名为'%2' @@ -9307,7 +9317,7 @@ Are you really want to continue? - + Compiler Set @@ -9316,7 +9326,7 @@ Are you really want to continue? - + Compiler @@ -9328,7 +9338,7 @@ Are you really want to continue? 自动链接 - + @@ -9405,15 +9415,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index ff83e230..477deb67 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -1941,6 +1941,10 @@ Please check the "program" page of compiler settings. + + Checking single file... + + FilePropertiesDialog @@ -5146,6 +5150,10 @@ Parallel Jobs(0 means infinite): + + Resource + + ProjectCompiler