From 06d3110d7c4f0886dccf1c1b7c46006ab5633ba8 Mon Sep 17 00:00:00 2001 From: Ben Lye Date: Fri, 31 Jul 2020 15:24:57 +0100 Subject: [PATCH] Make radio profile choice synchronous in Companion startup (#7822) * Update mainwindow.cpp Choose profile synchronously, before update check and file load. * Prevent profile choice dialog from being resized --- companion/src/mainwindow.cpp | 21 +++++++++------------ companion/src/profilechooser.cpp | 1 + 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 50574ecd5..9d490da39 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -130,15 +130,9 @@ MainWindow::MainWindow(): else { if (!g.previousVersion().isEmpty()) g.warningId(g.warningId() | AppMessages::MSG_UPGRADED); + if (g.promptProfile()) { - QTimer::singleShot(updateDelay, this, SLOT(chooseProfile())); // add an extra second to give mainwindow time to load - updateDelay += 5000; // give user time to select profile before warnings - } - else { - if (checkProfileRadioExists(g.sessionId())) - QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates())); - else - g.warningId(g.warningId() | AppMessages::MSG_NO_RADIO_TYPE); + chooseProfile(); } } QTimer::singleShot(updateDelay, this, SLOT(displayWarnings())); @@ -184,6 +178,11 @@ MainWindow::MainWindow(): if (printing) { QTimer::singleShot(0, this, SLOT(autoClose())); } + + if (checkProfileRadioExists(g.sessionId())) + QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates())); + else + g.warningId(g.warningId() | AppMessages::MSG_NO_RADIO_TYPE); } MainWindow::~MainWindow() @@ -1805,10 +1804,8 @@ void MainWindow::chooseProfile() connect(pcd, &ProfileChooserDialog::profileChanged, this, &MainWindow::loadProfileId); pcd->exec(); delete pcd; - // doi here as need to wait until dialog dismissed and current radio type is set - if (checkProfileRadioExists(g.sessionId())) - doAutoUpdates(); - else + + if (!checkProfileRadioExists(g.sessionId())) g.warningId(g.warningId() | AppMessages::MSG_NO_RADIO_TYPE); } } diff --git a/companion/src/profilechooser.cpp b/companion/src/profilechooser.cpp index 17a9570e5..a8942652e 100644 --- a/companion/src/profilechooser.cpp +++ b/companion/src/profilechooser.cpp @@ -28,6 +28,7 @@ ProfileChooserDialog::ProfileChooserDialog(QWidget * parent): { ui->setupUi(this); setWindowIcon(QIcon(":/icon.png")); + setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); QComboBox *prof = ui->cboProfiles; prof->clear();