diff --git a/NEWS.md b/NEWS.md index 4a5b9601..3d94dc5c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -24,6 +24,9 @@ Red Panda C++ Version 2.7 - enhancement: "Show whitespaces" in options / editor / font - enhancement: Auto add "lib" to the output of static/dynamic library projects, if project name don't start with "lib". - fix: Makefile error when "Use precompiled header" is enabled in the project option dialog. + - enhancement: "Convert HTML for - Input" / "Convert HTML for - Expected" in "Options" - "Executor" - "Problem Set" + - fix: Unit for memory limit is not correctly loaded when open problem properties dialog. + - enhancement: Auto open the properties dialog, after add a new problem. Red Panda C++ Version 2.6 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 73745c0e..f9da087f 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -4022,8 +4022,18 @@ void MainWindow::onNewProblemConnection() POJProblemCase problemCase = std::make_shared(); problemCase->testState = ProblemCaseTestState::NotTested; problemCase->name = tr("Problem Case %1").arg(problem->cases.count()+1); - problemCase->input = caseObj["input"].toString(); - problemCase->expected = caseObj["output"].toString(); + if (pSettings->executor().convertHTMLToTextForInput()) { + QTextDocument doc; + doc.setHtml(caseObj["input"].toString()); + problemCase->input = doc.toPlainText(); + } else + problemCase->input = caseObj["input"].toString(); + if (pSettings->executor().convertHTMLToTextForExpected()) { + QTextDocument doc; + doc.setHtml(caseObj["output"].toString()); + problemCase->expected = doc.toPlainText(); + } else + problemCase->expected = caseObj["output"].toString(); problem->cases.append(problemCase); } mOJProblemSetModel.addProblem(problem); @@ -7956,6 +7966,7 @@ void MainWindow::onAddProblem() problem->name = name; mOJProblemSetModel.addProblem(problem); ui->lstProblemSet->setCurrentIndex(mOJProblemSetModel.index(mOJProblemSetModel.count()-1)); + mProblem_Properties->trigger(); } diff --git a/RedPandaIDE/problems/ojproblemset.cpp b/RedPandaIDE/problems/ojproblemset.cpp index fa5a6fb8..7ca81892 100644 --- a/RedPandaIDE/problems/ojproblemset.cpp +++ b/RedPandaIDE/problems/ojproblemset.cpp @@ -58,7 +58,7 @@ size_t OJProblem::getMemoryLimit() OJProblem::OJProblem() : timeLimit(0), memoryLimit(0), - timeLimitUnit(ProblemTimeLimitUnit::Milliseconds), + timeLimitUnit(ProblemTimeLimitUnit::Seconds), memoryLimitUnit(ProblemMemoryLimitUnit::MB) { diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 9c911253..4008b938 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -3634,6 +3634,26 @@ void Settings::Executor::setCaseMemoryLimit(size_t newCaseMemoryLimit) mCaseMemoryLimit = newCaseMemoryLimit; } +bool Settings::Executor::convertHTMLToTextForExpected() const +{ + return mConvertHTMLToTextForExpected; +} + +void Settings::Executor::setConvertHTMLToTextForExpected(bool newConvertHTMLToTextForExpected) +{ + mConvertHTMLToTextForExpected = newConvertHTMLToTextForExpected; +} + +bool Settings::Executor::convertHTMLToTextForInput() const +{ + return mConvertHTMLToTextForInput; +} + +void Settings::Executor::setConvertHTMLToTextForInput(bool newConvertHTMLToTextForInput) +{ + mConvertHTMLToTextForInput = newConvertHTMLToTextForInput; +} + bool Settings::Executor::enableCaseLimit() const { return mEnableCaseLimit; @@ -3696,6 +3716,8 @@ void Settings::Executor::doSave() saveValue("enable_proble_set", mEnableProblemSet); saveValue("enable_competivie_companion", mEnableCompetitiveCompanion); saveValue("competitive_companion_port", mCompetivieCompanionPort); + saveValue("input_convert_html", mConvertHTMLToTextForInput); + saveValue("expected_convert_html", mConvertHTMLToTextForExpected); saveValue("ignore_spaces_when_validating_cases", mIgnoreSpacesWhenValidatingCases); saveValue("case_editor_font_name",mCaseEditorFontName); saveValue("case_editor_font_size",mCaseEditorFontSize); @@ -3728,6 +3750,8 @@ void Settings::Executor::doLoad() mEnableProblemSet = boolValue("enable_proble_set",true); mEnableCompetitiveCompanion = boolValue("enable_competivie_companion",true); mCompetivieCompanionPort = intValue("competitive_companion_port",10045); + mConvertHTMLToTextForInput = boolValue("input_convert_html", false); + mConvertHTMLToTextForExpected = boolValue("expected_convert_html", false); mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false); #ifdef Q_OS_WIN mCaseEditorFontName = stringValue("case_editor_font_name","consolas"); diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index adbb7689..22d12986 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -915,6 +915,12 @@ public: size_t caseMemoryLimit() const; void setCaseMemoryLimit(size_t newCaseMemoryLimit); + bool convertHTMLToTextForInput() const; + void setConvertHTMLToTextForInput(bool newConvertHTMLToTextForInput); + + bool convertHTMLToTextForExpected() const; + void setConvertHTMLToTextForExpected(bool newConvertHTMLToTextForExpected); + private: // general bool mPauseConsole; @@ -928,6 +934,8 @@ public: bool mEnableProblemSet; bool mEnableCompetitiveCompanion; int mCompetivieCompanionPort; + bool mConvertHTMLToTextForInput; + bool mConvertHTMLToTextForExpected; bool mIgnoreSpacesWhenValidatingCases; QString mCaseEditorFontName; int mCaseEditorFontSize; diff --git a/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp b/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp index 15173944..cbd4f909 100644 --- a/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp +++ b/RedPandaIDE/settingsdialog/executorproblemsetwidget.cpp @@ -36,6 +36,9 @@ void ExecutorProblemSetWidget::doLoad() ui->grpProblemSet->setChecked(pSettings->executor().enableProblemSet()); ui->grpCompetitiveCompanion->setChecked(pSettings->executor().enableCompetitiveCompanion()); ui->spinPortNumber->setValue(pSettings->executor().competivieCompanionPort()); + ui->chkConvertInputHTML->setChecked(pSettings->executor().convertHTMLToTextForInput()); + ui->chkConvertExpectedHTML->setChecked(pSettings->executor().convertHTMLToTextForExpected()); + ui->chkIgnoreSpacesWhenValidatingCases->setChecked(pSettings->executor().ignoreSpacesWhenValidatingCases()); ui->cbFont->setCurrentFont(QFont(pSettings->executor().caseEditorFontName())); @@ -52,6 +55,8 @@ void ExecutorProblemSetWidget::doSave() pSettings->executor().setEnableProblemSet(ui->grpProblemSet->isChecked()); pSettings->executor().setEnableCompetitiveCompanion(ui->grpCompetitiveCompanion->isChecked()); pSettings->executor().setCompetivieCompanionPort(ui->spinPortNumber->value()); + pSettings->executor().setConvertHTMLToTextForInput(ui->chkConvertInputHTML->isChecked()); + pSettings->executor().setConvertHTMLToTextForExpected(ui->chkConvertExpectedHTML->isChecked()); pSettings->executor().setIgnoreSpacesWhenValidatingCases(ui->chkIgnoreSpacesWhenValidatingCases->isChecked()); pSettings->executor().setCaseEditorFontName(ui->cbFont->currentFont().family()); pSettings->executor().setCaseEditorFontOnlyMonospaced(ui->chkOnlyMonospaced->isChecked()); diff --git a/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui b/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui index 58be4c4e..a3c3a938 100644 --- a/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui +++ b/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui @@ -7,7 +7,7 @@ 0 0 545 - 445 + 503 @@ -42,13 +42,6 @@ - - - - Port Number - - - @@ -62,6 +55,65 @@ + + + + Port Number + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Convert HTML for: + + + + + + + Input + + + + + + + Expected Output + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index bb5953e2..c19495a5 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -2001,6 +2001,18 @@ kb + + Convert HTML for: + + + + Input + Entrada + + + Expected Output + + FileAssociationModel diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index e720611c..2d6befd7 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -2652,32 +2652,47 @@ Are you really want to continue? 监听Competitive Companion连接 - + Port Number 网络端口 - + + Convert HTML for: + 将HTML内容转换为普通文本: + + + + Input + 输入 + + + + Expected Output + 期望输出 + + + Ignore spaces when validating problem cases 在验证测试案例时忽略结果中的空格 - + Case Valdation Limit 测试案例验证的资源限制 - + Time Limit 时间限制 - + Memory Limit 内存限制 - + kb kb @@ -2686,7 +2701,7 @@ Are you really want to continue? 试题案例超时时间 - + ms 毫秒 @@ -2695,22 +2710,22 @@ Are you really want to continue? - + Case Editor Font 试题案例数据编辑字体 - + Font Size: 大小: - + Font: 字体: - + Only Monospaced 仅使用等宽字体 @@ -4087,11 +4102,11 @@ Are you really want to continue? - - - - + + + + Issues 编译器 @@ -4529,7 +4544,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -4551,7 +4566,7 @@ Are you really want to continue? - + Save Problem Set 保存试题集 @@ -4559,7 +4574,7 @@ Are you really want to continue? - + Load Problem Set 载入试题集 @@ -4690,14 +4705,14 @@ Are you really want to continue? - + Import FPS Problem Set 导入FPS试题集 - + Export FPS Problem Set 导出FPS试题集 @@ -4934,7 +4949,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -5181,7 +5196,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -5202,13 +5217,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -5582,22 +5597,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. 我们需要可执行文件来运行试题案例。 @@ -5663,7 +5678,7 @@ Are you really want to continue? - + Please correct this before start debugging 请在调试前改正设置。 @@ -5721,22 +5736,22 @@ Are you really want to continue? 全部复制 - + Go to Line 跳转到行 - + Line - + Template Exists 模板已存在 - + Template %1 already exists. Do you want to overwrite? 模板%1已存在。是否覆盖? @@ -5762,7 +5777,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -5810,12 +5825,12 @@ Are you really want to continue? 试题属性... - + Set Problem Set Name 设置试题集名称 - + Problem Set Name: 试题集名称: @@ -5835,16 +5850,16 @@ Are you really want to continue? 修改描述 - - - + + + Bookmark Description 书签描述 - - - + + + Description: 描述: @@ -5868,12 +5883,12 @@ Are you really want to continue? 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: @@ -5895,18 +5910,18 @@ Are you really want to continue? - + Add Folder 添加文件夹 - - + + New folder 新文件夹 - + Folder name: 文件夹: @@ -6007,7 +6022,7 @@ Are you really want to continue? - + New Folder 新建文件夹 @@ -6018,9 +6033,9 @@ Are you really want to continue? - - - + + + Delete 删除 @@ -6079,17 +6094,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 导出时出错 @@ -6099,7 +6114,7 @@ Are you really want to continue? C/C++源代码文件 (*.c *.cpp *.cc *.cxx) - + New Folder %1 新建文件夹%1 @@ -6112,68 +6127,68 @@ Are you really want to continue? 无标题%1 - + Do you really want to delete %1? 你真的要删除%1吗? - + Do you really want to delete %1 files? 你真的要删除%1个文件吗? - + Save project 保存项目 - + The project '%1' has modifications. 项目'%1'有改动。 - - + + Do you want to save it? 需要保存吗? - - + + File Changed 文件已发生变化 - + New Project File? 新建项目文件? - + Do you want to add the new file to the project? 您是否要将新建的文件加入项目? - - + - + + Save Error 保存失败 - + Change Project Compiler Set 改变项目编译器配置集 - + Change the project's compiler set will lose all custom compiler set options. 改变项目的编译器配置集会导致所有的自定义编译器选项被重置。 - + Do you really want to do that? 你真的想要那么做吗? @@ -6196,78 +6211,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'? @@ -6276,28 +6291,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 选择期望输出文件 @@ -6309,59 +6324,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! 提交信息不能为空! @@ -6370,22 +6385,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? 同时从硬盘上删除文件? @@ -6394,27 +6409,27 @@ Are you really want to continue? 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 @@ -6445,76 +6460,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 @@ -6528,13 +6543,13 @@ Are you really want to continue? - - - - - - - + + + + + + + Error 错误 @@ -6561,79 +6576,79 @@ Are you really want to continue? 版本控制 - + File '%1' was changed. 磁盘文件'%1'已被修改。 - + Reload its content from disk? 是否重新读取它的内容? - + File '%1' was removed. 磁盘文件'%1'已被删除。 - + Keep it open? 是否保持它在小熊猫C++中打开的编辑窗口? - + Open 打开 - + 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个文件) @@ -6746,32 +6761,32 @@ Are you really want to continue? 新建项目 - + Make default language 设为缺省语言 - + C Project C语言项目 - + C++ Project C++语言项目 - + Name: 项目名称: - + Create in 创建在 - + Use as the default project location 设为缺省项目位置 @@ -6780,7 +6795,7 @@ Are you really want to continue? 文件夹: - + ... ... @@ -9292,7 +9307,7 @@ Are you really want to continue? - + Compiler Set @@ -9301,7 +9316,7 @@ Are you really want to continue? - + Compiler @@ -9313,7 +9328,7 @@ Are you really want to continue? 自动链接 - + @@ -9390,15 +9405,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 4e9558c8..ff83e230 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -1870,6 +1870,18 @@ kb + + Convert HTML for: + + + + Input + + + + Expected Output + + FileAssociationModel diff --git a/RedPandaIDE/widgets/ojproblempropertywidget.cpp b/RedPandaIDE/widgets/ojproblempropertywidget.cpp index 2f46371e..dc8425d7 100644 --- a/RedPandaIDE/widgets/ojproblempropertywidget.cpp +++ b/RedPandaIDE/widgets/ojproblempropertywidget.cpp @@ -58,13 +58,13 @@ void OJProblemPropertyWidget::loadFromProblem(POJProblem problem) } switch(problem->memoryLimitUnit) { case ProblemMemoryLimitUnit::KB: - ui->cbTimeLimitUnit->setCurrentText(tr("KB")); + ui->cbMemoryLimitUnit->setCurrentText(tr("KB")); break; case ProblemMemoryLimitUnit::MB: - ui->cbTimeLimitUnit->setCurrentText(tr("MB")); + ui->cbMemoryLimitUnit->setCurrentText(tr("MB")); break; case ProblemMemoryLimitUnit::GB: - ui->cbTimeLimitUnit->setCurrentText(tr("GB")); + ui->cbMemoryLimitUnit->setCurrentText(tr("GB")); break; } }