summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Bessent <lost.dragonist@gmail.com>2021-11-22 17:02:07 -0700
committerChris Bessent <lost.dragonist@gmail.com>2021-11-22 17:12:51 -0700
commitb1db3019f4700021479e811029b11f3f824a244f (patch)
tree147320241457e97e0a71503fcc205829acf86ceb /src
parentcf137606fd98eb0bee65a10d6e6e65f525967689 (diff)
Fix selecting a new profile
This fixes clicking the "select" button in the profiles dialog when a newly created profile is selected. This was broken as the profile was being selected before the profile was added to the list of selections. Fixes #1489
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp20
-rw-r--r--src/mainwindow.h2
2 files changed, 9 insertions, 13 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4d1c16ac..98f7319e 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1646,7 +1646,7 @@ void MainWindow::on_profileBox_currentIndexChanged(int index)
}
}
-bool MainWindow::refreshProfiles(bool selectProfile)
+bool MainWindow::refreshProfiles(bool selectProfile, QString newProfile)
{
QComboBox* profileBox = findChild<QComboBox*>("profileBox");
@@ -1675,7 +1675,12 @@ bool MainWindow::refreshProfiles(bool selectProfile)
if (selectProfile) {
if (profileBox->count() > 1) {
- profileBox->setCurrentText(currentProfileName);
+ if (newProfile.isEmpty()) {
+ profileBox->setCurrentText(currentProfileName);
+ }
+ else {
+ profileBox->setCurrentText(newProfile);
+ }
if (profileBox->currentIndex() == 0) {
profileBox->setCurrentIndex(1);
}
@@ -2188,16 +2193,7 @@ void MainWindow::on_actionAdd_Profile_triggered()
profilesDialog.exec();
m_SavesTab->refreshSaveList(); // since the save list may now be outdated we have to refresh it completely
- if (profilesDialog.selectedProfile())
- {
- // Change profile while blocking signals to prevent extra signals being sent
- // Doesn't matter much as refreshProfiles() is being called after this
- ui->profileBox->blockSignals(true);
- ui->profileBox->setCurrentText(profilesDialog.selectedProfile().value());
- ui->profileBox->blockSignals(false);
- }
-
- if (refreshProfiles() && !profilesDialog.failed()) {
+ if (refreshProfiles(true, profilesDialog.selectedProfile().value()) && !profilesDialog.failed()) {
break;
}
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 6626bf51..039f64ac 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -198,7 +198,7 @@ private:
QMenu* createPopupMenu() override;
void activateSelectedProfile();
- bool refreshProfiles(bool selectProfile = true);
+ bool refreshProfiles(bool selectProfile = true, QString newProfile = QString());
void refreshExecutablesList();
bool modifyExecutablesDialog(int selection);