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
This commit is contained in:
Ben Lye
2020-07-31 16:24:57 +02:00
committed by GitHub
parent 6264e8524e
commit 06d3110d7c
2 changed files with 10 additions and 12 deletions
+9 -12
View File
@@ -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);
}
}
+1
View File
@@ -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();