diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt
index 14f24ccba..016d962a6 100644
--- a/companion/src/CMakeLists.txt
+++ b/companion/src/CMakeLists.txt
@@ -250,6 +250,7 @@ set(companion_SRCS
wizarddialog.cpp
styleeditdialog.cpp
dialogs/filesyncdialog.cpp # TODO move to own lib with other dialogs
+ profilechooser.cpp
)
set(companion_MOC_HDRS
@@ -284,6 +285,7 @@ set(companion_MOC_HDRS
styleeditdialog.h
helpers_html.h
dialogs/filesyncdialog.h
+ profilechooser.h
)
set(companion_UIS
@@ -305,6 +307,7 @@ set(companion_UIS
flasheepromdialog.ui
radionotfound.ui
styleeditdialog.ui
+ profilechooser.ui
)
if(WIN32)
diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp
index e3817a9ba..c235788df 100644
--- a/companion/src/apppreferencesdialog.cpp
+++ b/companion/src/apppreferencesdialog.cpp
@@ -73,6 +73,7 @@ void AppPreferencesDialog::accept()
g.OpenTxBranch(AppData::DownloadBranchType(ui->OpenTxBranch->currentIndex()));
g.autoCheckFw(ui->autoCheckFirmware->isChecked());
g.showSplash(ui->showSplash->isChecked());
+ g.promptProfile(ui->chkPromptProfile->isChecked());
g.simuSW(ui->simuSW->isChecked());
g.removeModelSlots(ui->opt_removeBlankSlots->isChecked());
g.newModelAction(ui->opt_newMdl_useWizard->isChecked() ? AppData::MODEL_ACT_WIZARD : ui->opt_newMdl_useEditor->isChecked() ? AppData::MODEL_ACT_EDITOR : AppData::MODEL_ACT_NONE);
@@ -185,6 +186,7 @@ void AppPreferencesDialog::initSettings()
ui->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
ui->showSplash->setChecked(g.showSplash());
+ ui->chkPromptProfile->setChecked(g.promptProfile());
ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight());
ui->volumeGain->setValue(profile.volumeGain() / 10.0);
diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui
index 9ed6d0e4c..80301223d 100644
--- a/companion/src/apppreferencesdialog.ui
+++ b/companion/src/apppreferencesdialog.ui
@@ -6,7 +6,7 @@
0
0
- 741
+ 864
668
@@ -722,32 +722,21 @@ Mode 4:
6
- -
-
-
-
-
-
- Automatic check for OpenTX firmware updates
-
-
- true
-
-
-
- -
-
-
- Automatic check for Companion updates
-
-
- true
-
-
-
-
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Enable automatic backup before writing firmware
+
+
- -
-
+
-
+
0
@@ -755,7 +744,66 @@ Mode 4:
- Startup Settings
+ Google Earth Executable
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ Releases (stable)
+
+
+ -
+
+ Release candidates (testing)
+
+
+ -
+
+ Nightly builds (unstable)
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ Only show user splash images
+
+
+ -
+
+ Show user and companion splash images
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Horizontal
@@ -795,76 +843,27 @@ Mode 4:
- -
-
-
-
- 0
- 0
-
-
-
- Automatic Backup Folder
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Google Earth Executable
-
-
-
-
- Show splash screen when Companion starts
+ Show splash screen
true
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Remember
-
-
-
- -
-
+
-
+
-
-
-
+
+
true
-
- false
-
-
-
+
0
@@ -872,127 +871,13 @@ Mode 4:
- Select Folder
+ Select Executable
- -
-
-
-
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Select Folder
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Debug Output Logging
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Enable automatic backup before writing firmware
-
-
-
-
-
-
- <html><head/><body><p>This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. </p><p>When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.</p></body></html>
-
-
- Remove empty model slots when deleting models (only applies for radios w/out categories)
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Output Logs Folder
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- Only show user splash images
-
-
- -
-
- Show user and companion splash images
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
@@ -1026,38 +911,17 @@ Mode 4:
- -
-
+
-
+
-
-
-
- true
-
+
false
-
-
-
- Select Folder
-
-
-
-
-
- -
-
-
-
-
-
- true
-
-
-
- -
-
+
0
@@ -1065,13 +929,62 @@ Mode 4:
- Select Executable
+ Select Folder
- -
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Remember
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Output Logs Folder
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Startup Settings
+
+
+
+ -
+
+
+ <html><head/><body><p>This option maintains the behaviour from older OpenTx versions where empty model slots are preserved when a model is deleted or moved. </p><p>When this option is de-selected, the other models may be re-arranged to fill the gap left by the removed model.</p></body></html>
+
+
+ Remove empty model slots when deleting models (only applies for radios w/out categories)
+
+
+
+ -
@@ -1084,47 +997,7 @@ Mode 4:
- -
-
-
- Release channel
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Splash Screen Library
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Action on New Model
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
+
-
-
@@ -1148,29 +1021,163 @@ Mode 4:
- -
-
+
-
+
+
-
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ Select Folder
+
+
+
+
+
+ -
+
-
+
0
0
+
+ Action on New Model
+
+
+
+ -
+
-
-
- Releases (stable)
-
+
+
+ true
+
+
+ false
+
+
-
-
- Release candidates (testing)
-
+
+
+
+ 0
+ 0
+
+
+
+ Select Folder
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Splash Screen Library
+
+
+
+ -
+
+
+ Release channel
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Debug Output Logging
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Automatic Backup Folder
+
+
+
+ -
+
+
-
+
+
+ Automatic check for OpenTX firmware updates
+
+
+ true
+
+
-
-
- Nightly builds (unstable)
-
+
+
+ Automatic check for Companion updates
+
+
+ true
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Prompt for radio profile
+
diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp
index 06760fb41..2c230000b 100644
--- a/companion/src/mainwindow.cpp
+++ b/companion/src/mainwindow.cpp
@@ -49,6 +49,7 @@
#include "translations.h"
#include "dialogs/filesyncdialog.h"
+#include "profilechooser.h"
#include
#include
@@ -130,10 +131,16 @@ MainWindow::MainWindow():
else {
if (!g.previousVersion().isEmpty())
g.warningId(g.warningId() | AppMessages::MSG_UPGRADED);
- if (checkProfileRadioExists(g.sessionId()))
- QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates()));
- else
- g.warningId(g.warningId() | AppMessages::MSG_NO_RADIO_TYPE);
+ 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);
+ }
}
QTimer::singleShot(updateDelay, this, SLOT(displayWarnings()));
@@ -468,7 +475,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
const QString errorString = seekCodeString(qba, "ERROR");
const QString blockedRadios = seekCodeString(qba, "BLOCK");
long version;
-
+
if (errorString == "NO_RC")
return onUpdatesError(tr("No firmware release candidates are currently being served for this version, please switch release channel"));
else if (errorString == "NO_NIGHTLY")
@@ -481,7 +488,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
msgbox.setText(tr("Release candidate builds are now available for this version, would you like to switch to using them?"));
msgbox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgbox.setDefaultButton(QMessageBox::Yes);
-
+
if(msgbox.exec() == QMessageBox::Yes) {
g.OpenTxBranch(AppData::DownloadBranchType(AppData::BRANCH_RC_TESTING));
return onUpdatesError(tr("Channel changed to RC, please restart the download process"));
@@ -493,7 +500,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
msgbox.setText(tr("Official release builds are now available for this version, would you like to switch to using them?"));
msgbox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgbox.setDefaultButton(QMessageBox::Yes);
-
+
if(msgbox.exec() == QMessageBox::Yes) {
g.OpenTxBranch(AppData::DownloadBranchType(AppData::BRANCH_RELEASE_STABLE));
return onUpdatesError(tr("Channel changed to Release, please restart the download process"));
@@ -1807,3 +1814,20 @@ void MainWindow::autoClose()
{
this->close();
}
+
+void MainWindow::chooseProfile()
+{
+ QMap active;
+ active = g.getActiveProfiles();
+ if (active.size() > 1) {
+ ProfileChooserDialog *pcd = new ProfileChooserDialog(this);
+ 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
+ g.warningId(g.warningId() | AppMessages::MSG_NO_RADIO_TYPE);
+ }
+}
diff --git a/companion/src/mainwindow.h b/companion/src/mainwindow.h
index 222c047e0..9369dacac 100644
--- a/companion/src/mainwindow.h
+++ b/companion/src/mainwindow.h
@@ -128,6 +128,7 @@ class MainWindow : public QMainWindow
void exportSettings();
void importSettings();
void autoClose();
+ void chooseProfile();
void openUpdatesWaitDialog();
void closeUpdatesWaitDialog();
diff --git a/companion/src/profilechooser.cpp b/companion/src/profilechooser.cpp
new file mode 100644
index 000000000..17a9570e5
--- /dev/null
+++ b/companion/src/profilechooser.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) OpenTX
+ *
+ * Based on code named
+ * th9x - http://code.google.com/p/th9x
+ * er9x - http://code.google.com/p/er9x
+ * gruvin9x - http://code.google.com/p/gruvin9x
+ *
+ * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "profilechooser.h"
+#include "ui_profilechooser.h"
+#include "appdata.h"
+
+ProfileChooserDialog::ProfileChooserDialog(QWidget * parent):
+ QDialog(parent),
+ ui(new Ui::ProfileChooserDialog)
+{
+ ui->setupUi(this);
+ setWindowIcon(QIcon(":/icon.png"));
+ QComboBox *prof = ui->cboProfiles;
+ prof->clear();
+
+ QMap active;
+ active = g.getActiveProfiles();
+ QMapIterator i(active);
+ while (i.hasNext()) {
+ i.next();
+ prof->addItem(i.value(), i.key());
+ }
+
+ prof->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+ prof->setCurrentIndex(prof->findData(g.id()));
+ connect(prof, SIGNAL(currentIndexChanged(int)), this, SLOT(on_cboProfilesCurrentIndexChanged(int)));
+}
+
+ProfileChooserDialog::~ProfileChooserDialog()
+{
+ delete ui;
+}
+
+void ProfileChooserDialog::on_cboProfilesCurrentIndexChanged(int index)
+{
+ QComboBox *prof = ui->cboProfiles;
+
+ if ((prof->currentIndex() > -1)) {
+ int oldid = g.id();
+ int newid = prof->currentData().toInt();
+ if (oldid != newid)
+ emit profileChanged(newid);
+ }
+}
diff --git a/companion/src/profilechooser.h b/companion/src/profilechooser.h
new file mode 100644
index 000000000..b40e6b359
--- /dev/null
+++ b/companion/src/profilechooser.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) OpenTX
+ *
+ * Based on code named
+ * th9x - http://code.google.com/p/th9x
+ * er9x - http://code.google.com/p/er9x
+ * gruvin9x - http://code.google.com/p/gruvin9x
+ *
+ * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _PROFILECHOOSER_H_
+#define _PROFILECHOOSER_H_
+
+#include
+
+namespace Ui {
+ class ProfileChooserDialog;
+}
+
+class ProfileChooserDialog : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ ProfileChooserDialog(QWidget * parent = 0);
+ ~ProfileChooserDialog();
+signals:
+ void profileChanged(int newid);
+
+ private slots:
+ void on_cboProfilesCurrentIndexChanged(int index);
+
+ private:
+ Ui::ProfileChooserDialog *ui;
+};
+
+#endif // _PROFILECHOOSER_H_
diff --git a/companion/src/profilechooser.ui b/companion/src/profilechooser.ui
new file mode 100644
index 000000000..10a6d6bbe
--- /dev/null
+++ b/companion/src/profilechooser.ui
@@ -0,0 +1,110 @@
+
+
+ ProfileChooserDialog
+
+
+
+ 0
+ 0
+ 352
+ 102
+
+
+
+
+ 0
+ 0
+
+
+
+ Select Profile
+
+
+
+
+ 20
+ 20
+ 311
+ 66
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Profile
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Ok
+
+
+ false
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ ProfileChooserDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ ProfileChooserDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/companion/src/storage/appdata.h b/companion/src/storage/appdata.h
index 3ffa7d688..a17b9c1ce 100644
--- a/companion/src/storage/appdata.h
+++ b/companion/src/storage/appdata.h
@@ -575,6 +575,7 @@ class AppData: public CompStoreObj
PROPERTY4(bool, snapToClpbrd, "snapshot_to_clipboard", false)
PROPERTY4(bool, autoCheckApp, "startup_check_companion", true)
PROPERTY4(bool, autoCheckFw, "startup_check_fw", true)
+ PROPERTY4(bool, promptProfile, "startup_prompt_profile", false)
PROPERTY(bool, enableBackup, false)
PROPERTY(bool, backupOnFlash, true)