From 7b4aa764d35dfb1d1b940501aa67439039bfa8c8 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 22 Mar 2022 15:44:27 +0800 Subject: [PATCH] - fix: the problem & problem set panel can't be correctly , if problem set is enabled --- RedPandaIDE/mainwindow.cpp | 19 ++++++------------- RedPandaIDE/mainwindow.ui | 4 ++-- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 55caceed..b8f6c524 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -648,10 +648,6 @@ void MainWindow::applySettings() ui->txtProblemCaseExpected->setFont(caseEditorFont); mTcpServer.close(); - int idxProblem = ui->tabMessages->indexOf(ui->tabProblem); - ui->tabMessages->setTabEnabled(idxProblem,pSettings->executor().enableProblemSet()); - int idxProblemSet = ui->tabInfos->indexOf(ui->tabProblemSet); - ui->tabInfos->setTabEnabled(idxProblemSet,pSettings->executor().enableProblemSet()); if (pSettings->executor().enableProblemSet()) { if (pSettings->executor().enableCompetitiveCompanion()) { if (!mTcpServer.listen(QHostAddress::LocalHost,pSettings->executor().competivieCompanionPort())) { @@ -664,16 +660,13 @@ void MainWindow::applySettings() // +tr("Or You can choose a different port number and try again.")); } } - if (idxProblem<0) - ui->tabMessages->addTab(ui->tabProblem,tr("Problem")); - if (idxProblemSet<0) - ui->tabInfos->addTab(ui->tabProblemSet, tr("Problem Set")); - } else { - if (idxProblem>=0) - ui->tabMessages->removeTab(idxProblem); - if (idxProblemSet>=0) - ui->tabInfos->removeTab(idxProblemSet); } + + showHideInfosTab(ui->tabProblemSet,pSettings->ui().showProblemSet() + && pSettings->executor().enableProblemSet()); + showHideMessagesTab(ui->tabProblem, pSettings->ui().showProblem() + && pSettings->executor().enableProblemSet()); + ui->actionInterrupt->setVisible(pSettings->debugger().useGDBServer()); //icon sets for editors updateEditorSettings(); diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index a5d2bec0..93aa83b9 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -542,7 +542,7 @@ QTabWidget::South - 3 + 6 @@ -1422,7 +1422,7 @@ 0 0 1114 - 26 + 25