diff --git a/wfmain.cpp b/wfmain.cpp index 2f94485..95496e7 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -685,6 +685,8 @@ void wfmain::setupMainUI() ui->meter2Widget->hide(); ui->meter2selectionCombo->show(); + ui->meter2selectionCombo->setCurrentIndex((int)prefs.meter2Type); + ui->secondaryMeterSelectionLabel->show(); @@ -1236,6 +1238,7 @@ void wfmain::setDefPrefs() defPrefs.wftheme = static_cast(QCPColorGradient::gpJet); defPrefs.confirmExit = true; defPrefs.confirmPowerOff = true; + defPrefs.meter2Type = meterNone; udpDefPrefs.ipAddress = QString(""); udpDefPrefs.controlLANPort = 50001; @@ -1269,7 +1272,7 @@ void wfmain::loadSettings() setWindowState(Qt::WindowActive); // Works around QT bug to returns window+keyboard focus. prefs.confirmExit = settings->value("ConfirmExit", defPrefs.confirmExit).toBool(); prefs.confirmPowerOff = settings->value("ConfirmPowerOff", defPrefs.confirmPowerOff).toBool(); - + prefs.meter2Type = static_cast(settings->value("Meter2Type", defPrefs.meter2Type).toInt()); settings->endGroup(); // Load color schemes: @@ -1570,6 +1573,7 @@ void wfmain::saveSettings() settings->setValue("WFLength", prefs.wflength); settings->setValue("ConfirmExit", prefs.confirmExit); settings->setValue("ConfirmPowerOff", prefs.confirmPowerOff); + settings->setValue("Meter2Type", (int)prefs.meter2Type); settings->endGroup(); // Radio and Comms: C-IV addr, port to use @@ -3003,6 +3007,16 @@ void wfmain::receiveRigID(rigCapabilities rigCaps) // recalculate command timing now that we know the rig better: calculateTimingParameters(); initPeriodicCommands(); + + for (int i = 0; i < ui->meter2selectionCombo->count(); i++) + { + if (static_cast(ui->meter2selectionCombo->itemData(i).toInt()) == prefs.meter2Type) + { + qInfo() << "*******setting meter id" << i; + ui->meter2selectionCombo->setCurrentIndex(i); + on_meter2selectionCombo_activated(i); + } + } } } @@ -3218,9 +3232,9 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e void wfmain::receiveSpectrumMode(spectrumMode spectMode) { - for(int i=0; i < ui->spectrumModeCombo->count(); i++) + for (int i = 0; i < ui->spectrumModeCombo->count(); i++) { - if(static_cast(ui->spectrumModeCombo->itemData(i).toInt()) == spectMode) + if (static_cast(ui->spectrumModeCombo->itemData(i).toInt()) == spectMode) { ui->spectrumModeCombo->blockSignals(true); ui->spectrumModeCombo->setCurrentIndex(i); @@ -5241,7 +5255,7 @@ void wfmain::on_meter2selectionCombo_activated(int index) meterKind oldMeterType; newMeterType = static_cast(ui->meter2selectionCombo->currentData().toInt()); oldMeterType = ui->meter2Widget->getMeterType(); - + qInfo() << "*******setting meter type" << newMeterType; if(newMeterType == oldMeterType) return; @@ -5259,6 +5273,8 @@ void wfmain::on_meter2selectionCombo_activated(int index) ui->meter2Widget->setMeterType(newMeterType); insertPeriodicCommandUnique(newCmd); } + prefs.meter2Type = newMeterType; + (void)index; } diff --git a/wfmain.h b/wfmain.h index 934870d..390b161 100644 --- a/wfmain.h +++ b/wfmain.h @@ -477,6 +477,7 @@ private slots: void on_rigctldPortTxt_editingFinished(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); @@ -703,6 +704,7 @@ private: int wftheme; bool confirmExit; bool confirmPowerOff; + meterKind meter2Type; // plot scheme } prefs;