From fbe051f709bfa4d141c39c218b2d063c516316a1 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 26 Mar 2023 12:34:11 +0800 Subject: [PATCH] - fix: "Run all problem cases" with project is not correctly handled. --- NEWS.md | 1 + RedPandaIDE/mainwindow.cpp | 27 ++++++++++--------- RedPandaIDE/mainwindow.h | 2 ++ RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 4 +-- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/NEWS.md b/NEWS.md index 70970dcb..b1b9d8da 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,7 @@ Red Panda C++ Version 2.19 - enhancement: Use key sequences as shortcut to actions in the options dialog's environment->shortcut page. - change: Use ctrl+shift+S as the shortcut for "save as". - change: Use ctrl+K,ctrl+S as the shortcut for "save all". + - fix: "Run all problem cases" with project is not correctly handled. Red Panda C++ Version 2.18 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 459fbe8f..eb4dea3a 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2088,7 +2088,7 @@ void MainWindow::runExecutable(RunType runType) //if project options changed, or units added/removed //mProject->saveAll(); mCompileSuccessionTask=std::make_shared(); - mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal; + mCompileSuccessionTask->type = runTypeToCompileSuccessionTaskType(runType); mCompileSuccessionTask->execName=mProject->executable(); mCompileSuccessionTask->isExecutable=true; mCompileSuccessionTask->binDirs=binDirs; @@ -2099,7 +2099,7 @@ void MainWindow::runExecutable(RunType runType) //if units modified; //mProject->saveAll(); mCompileSuccessionTask=std::make_shared(); - mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal; + mCompileSuccessionTask->type = runTypeToCompileSuccessionTaskType(runType); mCompileSuccessionTask->execName=mProject->executable(); mCompileSuccessionTask->isExecutable=true; mCompileSuccessionTask->binDirs=binDirs; @@ -7902,16 +7902,7 @@ void MainWindow::doCompileRun(RunType runType) } mCompileSuccessionTask = std::make_shared(); mCompileSuccessionTask->binDirs=binDirs; - switch (runType) { - case RunType::CurrentProblemCase: - mCompileSuccessionTask->type = CompileSuccessionTaskType::RunCurrentProblemCase; - break; - case RunType::ProblemCases: - mCompileSuccessionTask->type = CompileSuccessionTaskType::RunProblemCases; - break; - default: - mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal; - } + mCompileSuccessionTask->type = runTypeToCompileSuccessionTaskType(runType); compile(); } @@ -8549,6 +8540,18 @@ void MainWindow::switchCurrentStackTrace(int idx) } +MainWindow::CompileSuccessionTaskType MainWindow::runTypeToCompileSuccessionTaskType(RunType runType) +{ + switch (runType) { + case RunType::CurrentProblemCase: + return CompileSuccessionTaskType::RunCurrentProblemCase; + case RunType::ProblemCases: + return CompileSuccessionTaskType::RunProblemCases; + default: + return CompileSuccessionTaskType::RunNormal; + } +} + void MainWindow::on_actionTool_Window_Bars_triggered() { diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 2f846867..c4fe6f27 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -231,6 +231,8 @@ public: void switchCurrentStackTrace(int idx); + static CompileSuccessionTaskType runTypeToCompileSuccessionTaskType(RunType runType); + public slots: void logToolsOutput(const QString& msg); void onCompileIssue(PCompileIssue issue); diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 043a9083..c392a058 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -4956,7 +4956,7 @@ Are you really want to continue? Ctrl+K, Ctrl+S - + @@ -10765,7 +10765,7 @@ Are you really want to continue? Open compiled in explorer - + 在文件管理器中打开编译结果