From 6bf443d3d80ec9c8bab1e840a0d3553add28dcf8 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 26 Oct 2022 08:45:18 +0800 Subject: [PATCH] - fix: Restore project's original compiler set if user choose 'No' in the confirm project compiler set change dialog. --- NEWS.md | 1 + RedPandaIDE/mainwindow.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 12b11397..e8cea4d7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -30,6 +30,7 @@ Red Panda C++ Version 2.0 - enhancement: when new header in the project view, auto select basename in the filename dialog - enhancement: when add file in the project view, auto select basename in the filename dialog - change: Don't generate localized filename when new header/add file in the project view + - fix: Restore project's original compiler set if user choose 'No' in the confirm project compiler set change dialog. Red Panda C++ Version 1.5 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 942b3180..a3d84044 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1493,9 +1493,9 @@ void MainWindow::updateCompilerSet() if ( !e || e->inProject()) { index = mProject->options().compilerSet; } - } - if (index < 0 || index>=mCompilerSet->count()) { - index = pSettings->compilerSets().defaultIndex(); + if (index < 0 || index>=mCompilerSet->count()) { + index = pSettings->compilerSets().defaultIndex(); + } } mCompilerSet->setCurrentIndex(index); mCompilerSet->blockSignals(false); @@ -5030,7 +5030,10 @@ void MainWindow::onCompilerSetChanged(int index) if (index<0) return; Editor *e = mEditorList->getEditor(); - if (mProject && (!e || e->inProject())) { + if ( mProject && (!e || e->inProject()) + ) { + if (index==mProject->options().compilerSet) + return; if(QMessageBox::warning( e, tr("Change Project Compiler Set"), @@ -5039,9 +5042,10 @@ void MainWindow::onCompilerSetChanged(int index) + tr("Do you really want to do that?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) { + mCompilerSet->setCurrentIndex(mProject->options().compilerSet); return; } - mProject->setCompilerSet(index); + mProject->setCompilerSet(mProject->options().compilerSet); mProject->saveOptions(); scanActiveProject(true); return;