Add saving of meter2 state

half-duplex
Phil Taylor 2021-08-27 18:06:09 +01:00
rodzic 5216b43230
commit 3a9f9db4a3
2 zmienionych plików z 22 dodań i 4 usunięć

Wyświetl plik

@ -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<int>(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<meterKind>(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<meterKind>(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<spectrumMode>(ui->spectrumModeCombo->itemData(i).toInt()) == spectMode)
if (static_cast<spectrumMode>(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<meterKind>(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;
}

Wyświetl plik

@ -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;