mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 16:55:15 +03:00
fix(sim) do not allow launching if no radio profiles found (#3712)
* Test for existence of radio profiles and advise if not found * Fix message box title and move simulator name to constants
This commit is contained in:
parent
15849956ce
commit
b6dd3a0ef8
3 changed files with 14 additions and 1 deletions
|
@ -51,6 +51,7 @@
|
|||
#define CPN_MAX_SPACEMOUSE 6
|
||||
|
||||
#define CPN_STR_APP_NAME QCoreApplication::translate("Companion", "EdgeTX Companion")
|
||||
#define CPN_STR_SIMU_NAME QCoreApplication::translate("Companion", "EdgeTX Simulator")
|
||||
#define CPN_STR_TTL_INFO QCoreApplication::translate("Companion", "Information") // shared Title Case words, eg. for a window title or section heading
|
||||
#define CPN_STR_TTL_WARNING QCoreApplication::translate("Companion", "Warning")
|
||||
#define CPN_STR_TTL_ERROR QCoreApplication::translate("Companion", "Error")
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include <QFileDialog>
|
||||
#include <QStandardItemModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace Simulator;
|
||||
|
||||
|
@ -44,6 +47,7 @@ SimulatorStartupDialog::SimulatorStartupDialog(SimulatorOptions * options, int *
|
|||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowIcon(QIcon(":/icon.png"));
|
||||
this->setWindowTitle(QString("%1 - %2").arg(CPN_STR_SIMU_NAME).arg(tr("Startup Options")));
|
||||
|
||||
QMapIterator<int, QString> pi(g.getActiveProfiles());
|
||||
while (pi.hasNext()) {
|
||||
|
@ -97,6 +101,14 @@ SimulatorStartupDialog::SimulatorStartupDialog(SimulatorOptions * options, int *
|
|||
QObject::connect(ui->btnSelectDataFolder, &QToolButton::clicked, this, &SimulatorStartupDialog::onDataFolderSelect);
|
||||
QObject::connect(ui->btnSelectSdPath, &QToolButton::clicked, this, &SimulatorStartupDialog::onSdPathSelect);
|
||||
|
||||
if (ui->radioProfile->count() < 1) {
|
||||
// give Startup dialog time to display so this error message can overlay it
|
||||
QTimer::singleShot(250, [=] {
|
||||
QMessageBox::critical(this, CPN_STR_SIMU_NAME, tr("No radio profiles have been found. Use %1 to create.").arg(CPN_STR_APP_NAME));
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SimulatorStartupDialog::~SimulatorStartupDialog()
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Simulator Startup Options:</string>
|
||||
<string>Simulator Startup Options</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="layout_options">
|
||||
<property name="sizeConstraint">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue