diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp
index b0db1934b..60c133305 100644
--- a/companion/src/apppreferencesdialog.cpp
+++ b/companion/src/apppreferencesdialog.cpp
@@ -103,6 +103,7 @@ void AppPreferencesDialog::accept()
g.fwTraceLog(ui->opt_fwTraceLog->isChecked());
g.appLogsDir(ui->appLogsDir->text());
g.runAppInstaller(ui->chkPromptInstall->isChecked());
+ g.useSavedSettings(ui->chkUseSavedSettingsApp->isChecked());
// Simulator tab
g.simuSW(ui->simuSW->isChecked());
@@ -181,6 +182,7 @@ void AppPreferencesDialog::accept()
profile.splashFile(ui->SplashFileName->text());
profile.runSDSync(ui->chkPromptSDSync->isChecked());
profile.radioSimCaseColor(ui->lblRadioColorSample->palette().button().color());
+ profile.useSavedSettings(ui->chkUseSavedSettingsProfile->isChecked());
// The profile name may NEVER be empty
if (ui->profileNameLE->text().isEmpty())
@@ -294,6 +296,7 @@ void AppPreferencesDialog::initSettings()
ui->cboSimuGenericKeysPos->setCurrentIndex(g.simuGenericKeysPos());
ui->chkSimuScrollButtons->setChecked(g.simuScrollButtons());
ui->joystickWarningCB->setChecked(g.disableJoystickWarning());
+ ui->chkUseSavedSettingsApp->setChecked(g.useSavedSettings());
#if defined(USE_SDL)
ui->joystickChkB->setChecked(g.jsSupport());
@@ -373,6 +376,7 @@ void AppPreferencesDialog::initSettings()
hwSettings = tr("AVAILABLE: Radio settings stored %1").arg(str);
}
+ ui->chkUseSavedSettingsProfile->setChecked(profile.useSavedSettings());
ui->lblGeneralSettings->setText(hwSettings);
ui->chkPromptSDSync->setChecked(profile.runSDSync());
ui->lblRadioColorSample->setPalette(QPalette(profile.radioSimCaseColor()));
diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui
index 5f849357a..a9adc4d9f 100644
--- a/companion/src/apppreferencesdialog.ui
+++ b/companion/src/apppreferencesdialog.ui
@@ -35,236 +35,52 @@
- 0
+ 1
Radio Profile
- -
-
-
- Simulator Case Colour
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- The profile specific folder, if set, will override general Backup folder
-
-
- Backup folder
-
-
-
- -
-
-
- Default Int. Module
-
-
-
- -
-
-
- Qt::Orientation::Vertical
-
-
-
- 20
- 5
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Radio Settings
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 5
-
-
- 4
-
-
-
-
- -
-
-
- Select Folder
-
-
-
- -
-
+
-
+
0
0
-
- Prompt to write firmware to radio after update
+
+ Qt::Orientation::Horizontal
- -
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 6
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- true
-
-
-
- Splash Screen
-
-
-
- -
-
-
- true
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Select Image
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 128
- 64
-
-
-
-
- 212
- 64
-
-
-
- QFrame::Shape::StyledPanel
-
-
- QFrame::Shadow::Plain
-
-
- 1
-
-
-
-
-
- true
-
-
-
- -
-
-
- Clear Image
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::Orientation::Horizontal
-
-
-
-
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Orientation::Horizontal
+
- -
+
-
+
+
+
+ true
+
+
+
+ Updates
+
+
+
+ -
@@ -318,62 +134,7 @@ Mode 4:
- -
-
-
- -
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Qt::Orientation::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Language
-
-
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- -
-
-
- External Module
-
-
-
- -
+
-
@@ -386,189 +147,6 @@ Mode 4:
- -
-
-
-
- 0
- 0
-
-
-
- Qt::Orientation::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- true
-
-
-
- Other Settings
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Default Channel Order
-
-
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
-
-
-
- -
-
-
- true
-
-
-
-
-
- false
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Options
-
-
- Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop
-
-
-
- -
-
-
- true
-
-
-
-
-
-
- -
-
-
- The profile specific folder, if set, will override general Backup folder
-
-
- Select Folder
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- true
-
-
-
- Profile Name
-
-
-
- -
-
-
- Select Colour
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
- Radio Settings Label
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- If set it will override the application general setting
-
-
- false
-
-
- true
-
-
-
- -
-
-
- Prompt to run SD Sync after update
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- if set, will override general backup enable
-
-
- Prompt to backup current firmware before writing firmware
-
-
-
-
@@ -585,7 +163,174 @@ Mode 4:
- -
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Default Channel Order
+
+
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+
+
+
+ -
+
+
+ Default Int. Module
+
+
+
+ -
+
+
+ Qt::Orientation::Vertical
+
+
+
+ 20
+ 5
+
+
+
+
+ -
+
+
+ If set it will override the application general setting
+
+
+ false
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Prompt to write firmware to radio after update
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ if set, will override general backup enable
+
+
+ Prompt to backup current firmware before writing firmware
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Options
+
+
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop
+
+
+
+ -
+
+
+ Select Colour
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Language
+
+
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
+
+
+
+ -
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ Radio Settings Label
+
+
+
+ -
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ true
+
+
+
+ Profile Name
+
+
+
+ -
@@ -721,6 +466,20 @@ Mode 4:
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Simulator Case Colour
+
+
+
-
@@ -742,8 +501,38 @@ Mode 4:
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 5
+
+
+ 4
+
+
+
+
+ -
+
0
@@ -755,15 +544,233 @@ Mode 4:
- -
-
+
-
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ true
+
+
+
+ Splash Screen
+
+
+
+ -
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Select Image
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 128
+ 64
+
+
+
+
+ 212
+ 64
+
+
+
+ QFrame::Shape::StyledPanel
+
+
+ QFrame::Shadow::Plain
+
+
+ 1
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Clear Image
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Orientation::Horizontal
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
true
- Updates
+ Other Settings
+
+
+
+ -
+
+
+ true
+
+
+
+
+
+ false
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Radio Settings
+
+
+
+ -
+
+
+ Select Folder
+
+
+
+ -
+
+
+ Prompt to run SD Sync after update
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ The profile specific folder, if set, will override general Backup folder
+
+
+ Backup folder
+
+
+
+ -
+
+
+ External Module
+
+
+
+ -
+
+
+ The profile specific folder, if set, will override general Backup folder
+
+
+ Select Folder
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Use settings backup for new models and settings files
@@ -779,93 +786,10 @@ Mode 4:
6
- -
-
+
-
+
- Prompt to run installer after update
-
-
-
- -
-
-
- Qt::Orientation::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Remember
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- Only show user splash images
-
-
- -
-
- Show user and companion splash images
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Google Earth Executable
-
-
-
- -
-
-
- Show splash screen
-
-
- true
-
-
-
- -
-
-
- Qt::Orientation::Horizontal
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Splash Screen Library
+ Update
@@ -883,83 +807,10 @@ Mode 4:
- -
-
+
-
+
- Move selected Radio Profile to the top of the list
-
-
-
- -
-
-
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Select Executable
-
-
-
-
-
- -
-
-
- <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 labels)
-
-
-
- -
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Action on New Model
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Startup Settings
-
-
-
- -
-
-
- Update
+ Prompt to run installer after update
@@ -993,8 +844,8 @@ Mode 4:
- -
-
+
-
+
0
@@ -1002,30 +853,14 @@ Mode 4:
- Output Logs Folder
+ Remember
- -
-
-
-
- 0
- 0
-
-
-
- Backup Folder
-
-
-
- -
-
-
- -
-
+
-
+
-
-
+
true
@@ -1038,7 +873,7 @@ Mode 4:
-
-
+
Select Folder
@@ -1046,6 +881,13 @@ Mode 4:
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
-
@@ -1082,13 +924,42 @@ Mode 4:
- -
-
+
-
+
Qt::Orientation::Horizontal
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Debug Output Logging
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Backup Folder
+
+
+
+ -
+
+
-
-
@@ -1113,8 +984,15 @@ Mode 4:
- -
-
+
-
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ -
+
0
@@ -1122,7 +1000,21 @@ Mode 4:
- User Splash Screens
+ Google Earth Executable
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ -
+
+
+ Prompt for radio profile
@@ -1139,10 +1031,109 @@ Mode 4:
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Splash Screen Library
+
+
+
+ -
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ User Splash Screens
+
+
+
+ -
+
+
+ Show splash screen
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
-
-
+
+ Only show user splash images
+
+
+ -
+
+ Show user and companion splash images
+
+
+
+
+ -
+
+
-
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Select Executable
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Action on New Model
+
+
+
+ -
+
+
-
+
true
@@ -1155,7 +1146,7 @@ Mode 4:
-
-
+
Select Folder
@@ -1163,15 +1154,8 @@ Mode 4:
- -
-
-
- Qt::Orientation::Horizontal
-
-
-
- -
-
+
-
+
0
@@ -1179,14 +1163,44 @@ Mode 4:
- Debug Output Logging
+ Output Logs Folder
- -
-
+
-
+
+
+
+ 0
+ 0
+
+
- Prompt for radio profile
+ Startup Settings
+
+
+
+ -
+
+
+ Move selected Radio Profile to the top of the list
+
+
+
+ -
+
+
+ <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 labels)
+
+
+
+ -
+
+
+ Use radio settings backup for new models and settings files
diff --git a/companion/src/generaledit/generaledit.cpp b/companion/src/generaledit/generaledit.cpp
index 05c11f917..1342f7f89 100644
--- a/companion/src/generaledit/generaledit.cpp
+++ b/companion/src/generaledit/generaledit.cpp
@@ -41,9 +41,8 @@ GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, Firmware * fir
firmware(firmware)
{
ui->setupUi(this);
- this->setWindowIcon(CompanionIcon("open.png"));
- ui->btnLoadSettings->setDisabled(g.currentProfile().generalSettings().isEmpty());
- ui->btnClearSettings->setDisabled(g.currentProfile().generalSettings().isEmpty());
+ setWindowIcon(CompanionIcon("open.png"));
+ setAttribute(Qt::WA_DeleteOnClose);
editorItemModels = new CompoundItemModelFactory(&generalSettings, nullptr);
// tabs created below expect these item models to be pre-registered
@@ -64,9 +63,16 @@ GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, Firmware * fir
if (firmware->getCapability(KeyShortcuts))
addTab(new GeneralKeysPanel(this, generalSettings, firmware), tr("Key Shortcuts"));
- connect(hwpnl, &HardwarePanel::internalModuleChanged, this, [&] { intModChanged = true; });
+ ui->btnSettingsRestore->setDisabled(g.currentProfile().generalSettings().isEmpty());
+ ui->btnSettingsBackupDelete->setDisabled(g.currentProfile().generalSettings().isEmpty());
- ui->tabWidget->setCurrentIndex( g.generalEditTab() );
+ connect(hwpnl, &HardwarePanel::internalModuleChanged, this, [&] { intModChanged = true; });
+ connect(ui->btnSettingsBackup, &QPushButton::clicked, this, &GeneralEdit::on_btnSettingsBackupClicked);
+ connect(ui->btnSettingsRestore, &QPushButton::clicked, this, &GeneralEdit::on_btnSettingsRestoreClicked);
+ connect(ui->btnSettingsBackupDelete, &QPushButton::clicked, this, &GeneralEdit::on_btnSettingsBackupDeleteClicked);
+ connect(ui->btnSettingsDefaults, &QPushButton::clicked, this, &GeneralEdit::on_btnSettingsDefaultsClicked);
+
+ ui->tabWidget->setCurrentIndex(g.generalEditTab());
}
GeneralEdit::~GeneralEdit()
@@ -103,62 +109,101 @@ void GeneralEdit::on_tabWidget_currentChanged(int index)
panels[index]->update();
}
-void GeneralEdit::on_btnLoadSettings_clicked()
+void GeneralEdit::on_btnSettingsRestoreClicked()
{
- if (QMessageBox::question(this, tr("Profile Radio Settings"),
- tr("WARNING: Loading settings from profile is irreversable.\n\nAre you sure?"),
+ if (QMessageBox::question(this, tr("Radio Settings"),
+ tr("WARNING: Restore settings from profile.\n\nAre you sure?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
return;
+ const unsigned int oldIntMod = generalSettings.internalModule;
QByteArray data = g.currentProfile().generalSettings();
try {
if (!loadRadioSettingsFromYaml(generalSettings, data)) {
- QMessageBox::critical(this, tr("Profile Radio Settings"), tr("Unable to load settings from profile!"));
+ QMessageBox::critical(this, tr("Radio Settings"), tr("Unable to restore settings from profile!"));
return;
}
} catch(const std::runtime_error& e) {
- QMessageBox::critical(this, tr("Profile Radio Settings"),
- tr("Unable to load settings from profile!") + ":\n" + QString(e.what()));
+ QMessageBox::critical(this, tr("Radio Settings"),
+ tr("Unable to restore settings from profile!") + ":\n" + QString(e.what()));
return;
}
- on_tabWidget_currentChanged(ui->tabWidget->currentIndex());
- QMessageBox::information(this, tr("Profile Radio Settings"),
- tr("Settings successfully loaded.") + "\n\n" +
- tr("The Radio Settings window will now be closed for the settings to take effect"));
-
+ postSettingsChangeMsg(oldIntMod);
emit modified();
- accept();
+ closeEvent(new QCloseEvent());
+ done(-1);
}
-void GeneralEdit::on_btnSaveSettings_clicked()
+void GeneralEdit::on_btnSettingsBackupClicked()
{
- if (QMessageBox::question(this, tr("Profile Radio Settings"),
- tr("WARNING: Saving settings to the profile is irreversable.\n\nAre you sure?"),
+ if (QMessageBox::question(this, tr("Radio Settings"),
+ tr("WARNING: Backup settings to profile.\n\nAre you sure?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
return;
QByteArray data;
- writeRadioSettingsToYaml(generalSettings, data);
+
+ try {
+ if (!writeRadioSettingsToYaml(generalSettings, data)) {
+ QMessageBox::critical(this, tr("Radio Settings"), tr("Unable to backup settings to profile!"));
+ return;
+ }
+ } catch(const std::runtime_error& e) {
+ QMessageBox::critical(this, tr("Radio Settings"),
+ tr("Unable to backup settings to profile!") + ":\n" + QString(e.what()));
+ return;
+ }
+
g.currentProfile().generalSettings(data);
QDateTime dateTime = QDateTime::currentDateTime();
g.currentProfile().timeStamp(dateTime.toString("yyyy-MM-dd hh:mm"));
- ui->btnLoadSettings->setEnabled(true);
- ui->btnClearSettings->setEnabled(true);
- QMessageBox::information(this, tr("Save Radio Settings to Profile"), tr("Settings saved to profile."));
+ ui->btnSettingsRestore->setEnabled(true);
+ ui->btnSettingsBackupDelete->setEnabled(true);
+ QMessageBox::information(this, tr("Radio Settings"), tr("Settings saved to profile."));
}
-void GeneralEdit::on_btnClearSettings_clicked()
+void GeneralEdit::on_btnSettingsBackupDeleteClicked()
{
- if (QMessageBox::question(this, tr("Profile Radio Settings"),
- tr("WARNING: Clearing settings from the profile is irreversable.\n\nAre you sure?"),
+ if (QMessageBox::question(this, tr("Radio Settings"),
+ tr("WARNING: Delete settings backup from profile.\n\nAre you sure?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
return;
g.currentProfile().generalSettings(QByteArray());
g.currentProfile().timeStamp(QString());
- ui->btnLoadSettings->setEnabled(false);
- ui->btnClearSettings->setEnabled(false);
- QMessageBox::information(this, tr("Profile Radio Settings"), tr("Settings cleared from profile."));
+ ui->btnSettingsRestore->setEnabled(false);
+ ui->btnSettingsBackupDelete->setEnabled(false);
+ QMessageBox::information(this, tr("Radio Settings"), tr("Settings backup deleted from profile."));
+}
+
+void GeneralEdit::on_btnSettingsDefaultsClicked()
+{
+ if (QMessageBox::question(this, tr("Radio Settings"),
+ tr("WARNING: Reset settings to defaults.\n\nAre you sure?"),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)
+ return;
+
+ const unsigned int oldIntMod = generalSettings.internalModule;
+ generalSettings.clear();
+ postSettingsChangeMsg(oldIntMod);
+ emit modified();
+ closeEvent(new QCloseEvent());
+ done(-1);
+}
+
+void GeneralEdit::postSettingsChangeMsg(const unsigned int oldIntMod)
+{
+ QString intmodmsg;
+
+ if (oldIntMod != generalSettings.internalModule) {
+ intModChanged = true;
+ intmodmsg = tr("The internal module type has been changed and may trigger model updates.") + "\n";
+ }
+
+ QMessageBox::information(this, tr("Radio Settings"),
+ tr("Default settings successfully applied.") + "\n" +
+ intmodmsg +
+ tr("The Radio Settings window will be closed and re-opened for the changes to take effect."));
}
diff --git a/companion/src/generaledit/generaledit.h b/companion/src/generaledit/generaledit.h
index 0942452c5..857451f96 100644
--- a/companion/src/generaledit/generaledit.h
+++ b/companion/src/generaledit/generaledit.h
@@ -69,9 +69,10 @@ class GeneralEdit : public QDialog
private slots:
void onTabModified();
void on_tabWidget_currentChanged(int index);
- void on_btnClearSettings_clicked();
- void on_btnLoadSettings_clicked();
- void on_btnSaveSettings_clicked();
+ void on_btnSettingsBackupClicked();
+ void on_btnSettingsBackupDeleteClicked();
+ void on_btnSettingsRestoreClicked();
+ void on_btnSettingsDefaultsClicked();
private:
Firmware * firmware;
@@ -79,4 +80,6 @@ class GeneralEdit : public QDialog
void addTab(GenericPanel *panel, QString text);
CompoundItemModelFactory *editorItemModels;
bool intModChanged = false;
+
+ void postSettingsChangeMsg(const unsigned int oldIntMod);
};
diff --git a/companion/src/generaledit/generaledit.ui b/companion/src/generaledit/generaledit.ui
index c3db3b640..a0c7bc9f7 100644
--- a/companion/src/generaledit/generaledit.ui
+++ b/companion/src/generaledit/generaledit.ui
@@ -7,7 +7,7 @@
0
0
787
- 577
+ 576
@@ -23,93 +23,6 @@
true
- -
-
-
-
- 0
- 0
-
-
-
- QFrame::Shape::Panel
-
-
- QFrame::Shadow::Raised
-
-
-
- QLayout::SizeConstraint::SetDefaultConstraint
-
-
-
-
-
-
-
-
- Clear settings from profile
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Store settings in profile
-
-
-
- -
-
-
- Qt::Orientation::Horizontal
-
-
- QSizePolicy::Policy::Expanding
-
-
-
- 10
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Load settings from profile
-
-
-
- -
-
-
- Qt::Orientation::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
-
@@ -127,6 +40,133 @@ These will be relevant for all models in the same EEPROM.
+ -
+
+
+
+
+
+ Note: these functions apply to all radio settings
+
+
+ Qt::AlignmentFlag::AlignCenter
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Qt::FocusPolicy::WheelFocus
+
+
+ Qt::ContextMenuPolicy::CustomContextMenu
+
+
+ Take a backup of all settings and save to current radio profile
+
+
+
+
+
+ Backup
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+ QSizePolicy::Policy::Expanding
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ Qt::FocusPolicy::NoFocus
+
+
+ Restore all settings from backup saved in current radio profile
+
+
+ Restore
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::FocusPolicy::NoFocus
+
+
+ Reset all settings to current radio defaults
+
+
+ Set to Defaults
+
+
+
+ -
+
+
+ Qt::Orientation::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Qt::FocusPolicy::NoFocus
+
+
+ Delete settings backup from current radio profile
+
+
+ Delete Backup
+
+
+
+
+
+
diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp
index 9a3c3408f..0cf558576 100644
--- a/companion/src/mainwindow.cpp
+++ b/companion/src/mainwindow.cpp
@@ -335,7 +335,7 @@ void MainWindow::setTabbedWindows(bool on)
void MainWindow::newFile()
{
MdiChild * child = createMdiChild();
- child->newFile();
+ child->newFile(true);
child->show();
}
@@ -544,7 +544,7 @@ void MainWindow::readSettings()
if (readSettingsFromRadio(tempFile)) {
MdiChild * child = createMdiChild();
- child->newFile(false);
+ child->newFile();
child->loadFile(tempFile, false);
child->show();
qunlink(tempFile);
@@ -1325,6 +1325,7 @@ int MainWindow::newProfile(bool loadProfile)
g.profile[i].fwType(newfw->getId());
g.profile[i].defaultInternalModule(Boards::getDefaultInternalModules(newfw->getBoard()));
g.profile[i].externalModuleSize(Boards::getDefaultExternalModuleSize(newfw->getBoard()));
+ g.profile[i].useSavedSettings(g.useSavedSettings());
if (loadProfile) {
if (loadProfileId(i))
@@ -1491,7 +1492,7 @@ void MainWindow::readSettingsSDPath()
if (readSettingsFromSDPath(tempFile)) {
MdiChild * child = createMdiChild();
- child->newFile(false);
+ child->newFile();
child->loadFile(tempFile, false);
child->show();
qunlink(tempFile);
diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp
index 693c58148..160089932 100644
--- a/companion/src/mdichild.cpp
+++ b/companion/src/mdichild.cpp
@@ -33,6 +33,7 @@
#include "radiodataconversionstate.h"
#include "filtereditemmodels.h"
#include "labels.h"
+#include "firmwares/edgetx/edgetxinterface.h"
#include
#include
@@ -1055,7 +1056,8 @@ void MdiChild::generalEdit()
GeneralEdit * t = new GeneralEdit(this, radioData, firmware);
connect(t, &GeneralEdit::modified, this, &MdiChild::setModified);
connect(t, &GeneralEdit::internalModuleChanged, this, &MdiChild::onInternalModuleChanged); // passed up from HardwarePanel >> GeneralEdit
- t->exec();
+ if (t->exec() == -1) // -1 is user defined return value
+ generalEdit();
}
void MdiChild::copyGeneralSettings()
@@ -1267,7 +1269,7 @@ void MdiChild::modelSimulate()
startSimulation(this, radioData, getCurrentModel());
}
-void MdiChild::newFile(bool createDefaults)
+void MdiChild::newFile(bool useProfileSettings)
{
static int sequenceNumber = 1;
isUntitled = true;
@@ -1276,12 +1278,22 @@ void MdiChild::newFile(bool createDefaults)
modelsListModel->setFilename(curFile);
radioData.addLabel(tr("Favorites"));
labelsListModel->buildLabelsList();
+
+ if (useProfileSettings && g.currentProfile().useSavedSettings() &&
+ !g.currentProfile().generalSettings().isEmpty()) {
+ QByteArray data = g.currentProfile().generalSettings();
+
+ if (!loadRadioSettingsFromYaml(radioData.generalSettings, data)) {
+ QMessageBox::critical(this, tr("New File"), tr("Unable to load settings from profile!"));
+ return;
+ }
+ }
}
bool MdiChild::loadFile(const QString & filename, bool resetCurrentFile)
{
if (getStorageType(filename) == STORAGE_TYPE_YML) {
- newFile(false);
+ newFile();
resetCurrentFile = false;
}
diff --git a/companion/src/mdichild.h b/companion/src/mdichild.h
index aeb22a85d..a272bf3a3 100644
--- a/companion/src/mdichild.h
+++ b/companion/src/mdichild.h
@@ -93,7 +93,7 @@ class MdiChild : public QWidget
bool invalidModels();
public slots:
- void newFile(bool createDefaults = true);
+ void newFile(bool useProfileSettings = false);
bool loadFile(const QString & fileName, bool resetCurrentFile=true);
bool save();
bool saveAs(bool isNew=false);
diff --git a/companion/src/storage/appdata.h b/companion/src/storage/appdata.h
index df476f1cb..716a45436 100644
--- a/companion/src/storage/appdata.h
+++ b/companion/src/storage/appdata.h
@@ -508,6 +508,7 @@ class Profile: public CompStoreObj
// General settings
PROPERTYQBA(generalSettings)
PROPERTYSTR2(timeStamp, "TimeStamp")
+ PROPERTY(bool, useSavedSettings, true)
PROPERTYSTRD(jsName, "")
@@ -781,6 +782,7 @@ class AppData: public CompStoreObj
PROPERTY(bool, tabbedMdi, false)
PROPERTY(bool, appDebugLog, false)
PROPERTY(bool, fwTraceLog, false)
+ PROPERTY(bool, useSavedSettings, true)
// Simulator global (non-profile) settings
PROPERTY(QStringList, simuDbgFilters, QStringList())