- fix: Action "Run all problem cases" is triggered twice by one clicked.

This commit is contained in:
Roy Qu 2022-12-31 09:36:50 +08:00
parent 2041f813de
commit 0caaad8436
3 changed files with 8 additions and 9 deletions

View File

@ -6,7 +6,7 @@ Red Panda C++ Version 2.8
- enhancement: "Run" / "Generate Assembly" for project source files - enhancement: "Run" / "Generate Assembly" for project source files
- fix: Can't set project icon to "app.ico" in the project folder, if the project doesn't has icon. - fix: Can't set project icon to "app.ico" in the project folder, if the project doesn't has icon.
- fix: Resource compilation items is missing in the auto generated makefile, if the project's icon is removed and re-added. - fix: Resource compilation items is missing in the auto generated makefile, if the project's icon is removed and re-added.
- fix: Action "Run all problem cases" is triggered twice by one clicked.
Red Panda C++ Version 2.7 Red Panda C++ Version 2.7

View File

@ -664,7 +664,7 @@ void MainWindow::updateCompileActions(const Editor *e)
ui->actionRebuild->setEnabled(false); ui->actionRebuild->setEnabled(false);
ui->actionGenerate_Assembly->setEnabled(false); ui->actionGenerate_Assembly->setEnabled(false);
ui->actionDebug->setEnabled(false); ui->actionDebug->setEnabled(false);
ui->btnRunAllProblemCases->setEnabled(false); mProblem_RunAllCases->setEnabled(false);
} else { } else {
bool forProject=false; bool forProject=false;
bool canRun = false; bool canRun = false;
@ -703,7 +703,7 @@ void MainWindow::updateCompileActions(const Editor *e)
ui->actionRebuild->setEnabled(canCompile); ui->actionRebuild->setEnabled(canCompile);
ui->actionGenerate_Assembly->setEnabled(canGenerateAssembly); ui->actionGenerate_Assembly->setEnabled(canGenerateAssembly);
ui->actionDebug->setEnabled(canRun); ui->actionDebug->setEnabled(canRun);
ui->btnRunAllProblemCases->setEnabled(canRun); mProblem_RunAllCases->setEnabled(canRun && mOJProblemModel.count()>0);
} }
if (!mDebugger->executing()) { if (!mDebugger->executing()) {
disableDebugActions(); disableDebugActions();
@ -2535,7 +2535,7 @@ void MainWindow::createCustomActions()
tr("Run All Cases"), tr("Run All Cases"),
"Problem_RunAllCases"); "Problem_RunAllCases");
connect(mProblem_RunAllCases, &QAction::triggered, this, connect(mProblem_RunAllCases, &QAction::triggered, this,
&MainWindow::on_btnRunAllProblemCases_clicked); &MainWindow::onProblemRunAllCases);
mProblem_RunCurrentCase = createShortcutCustomableAction( mProblem_RunCurrentCase = createShortcutCustomableAction(
tr("Run Current Case"), tr("Run Current Case"),
@ -3892,12 +3892,11 @@ void MainWindow::onProblemCaseIndexChanged(const QModelIndex &current, const QMo
POJProblemCase problemCase = mOJProblemModel.getCase(idx.row()); POJProblemCase problemCase = mOJProblemModel.getCase(idx.row());
if (problemCase) { if (problemCase) {
mProblem_RemoveCases->setEnabled(true); mProblem_RemoveCases->setEnabled(true);
ui->btnRunAllProblemCases->setEnabled(ui->actionRun->isEnabled()); mProblem_RunAllCases->setEnabled(ui->actionRun->isEnabled());
fillProblemCaseInputAndExpected(problemCase); fillProblemCaseInputAndExpected(problemCase);
ui->txtProblemCaseOutput->clear(); ui->txtProblemCaseOutput->clear();
ui->txtProblemCaseOutput->setPlainText(problemCase->output); ui->txtProblemCaseOutput->setPlainText(problemCase->output);
updateProblemCaseOutput(problemCase); updateProblemCaseOutput(problemCase);
return; return;
} }
} }
@ -3912,7 +3911,7 @@ void MainWindow::onProblemCaseIndexChanged(const QModelIndex &current, const QMo
ui->txtProblemCaseExpectedOutputFileName->setToolTip(""); ui->txtProblemCaseExpectedOutputFileName->setToolTip("");
mProblem_RemoveCases->setEnabled(false); mProblem_RemoveCases->setEnabled(false);
ui->btnRunAllProblemCases->setEnabled(false); mProblem_RunAllCases->setEnabled(false);
ui->txtProblemCaseInputFileName->clear(); ui->txtProblemCaseInputFileName->clear();
ui->btnProblemCaseInputFileName->setEnabled(false); ui->btnProblemCaseInputFileName->setEnabled(false);
ui->txtProblemCaseInput->clear(); ui->txtProblemCaseInput->clear();
@ -8096,7 +8095,7 @@ void MainWindow::onAddProblemCase()
ui->tblProblemCases->setCurrentIndex(mOJProblemModel.index(mOJProblemModel.count()-1,0)); ui->tblProblemCases->setCurrentIndex(mOJProblemModel.index(mOJProblemModel.count()-1,0));
} }
void MainWindow::on_btnRunAllProblemCases_clicked() void MainWindow::onProblemRunAllCases()
{ {
if (mOJProblemModel.count()<=0) if (mOJProblemModel.count()<=0)
return; return;

View File

@ -623,7 +623,7 @@ private slots:
void onAddProblemCase(); void onAddProblemCase();
void on_btnRunAllProblemCases_clicked(); void onProblemRunAllCases();
void on_actionC_Reference_triggered(); void on_actionC_Reference_triggered();