Add reference settings to setup file

This commit is contained in:
Jan Käberich 2022-02-04 12:32:19 +01:00
parent 9e614a23f8
commit 2265b8f6c0

View File

@ -942,6 +942,10 @@ nlohmann::json AppWindow::SaveSetup()
j["VNA"] = vna->toJSON(); j["VNA"] = vna->toJSON();
j["Generator"] = generator->toJSON(); j["Generator"] = generator->toJSON();
j["SpectrumAnalyzer"] = spectrumAnalyzer->toJSON(); j["SpectrumAnalyzer"] = spectrumAnalyzer->toJSON();
nlohmann::json ref;
ref["Mode"] = toolbars.reference.type->currentText().toStdString();
ref["Output"] = toolbars.reference.outFreq->currentText().toStdString();
j["Reference"] = ref;
return j; return j;
} }
@ -970,9 +974,19 @@ void AppWindow::LoadSetup(nlohmann::json j)
{ {
// auto d = new JSONPickerDialog(j); // auto d = new JSONPickerDialog(j);
// d->exec(); // d->exec();
vna->fromJSON(j["VNA"]); if(j.contains("Reference")) {
generator->fromJSON(j["Generator"]); toolbars.reference.type->setCurrentText(QString::fromStdString(j["Reference"].value("Mode", "Int")));
spectrumAnalyzer->fromJSON(j["SpectrumAnalyzer"]); toolbars.reference.outFreq->setCurrentText(QString::fromStdString(j["Reference"].value("Output", "Off")));
}
if(j.contains("VNA")) {
vna->fromJSON(j["VNA"]);
}
if(j.contains("Generator")) {
generator->fromJSON(j["Generator"]);
}
if(j.contains("SpectrumAnalyzer")) {
spectrumAnalyzer->fromJSON(j["SpectrumAnalyzer"]);
}
// activate the correct mode // activate the correct mode
QString modeName = QString::fromStdString(j.value("activeMode", "")); QString modeName = QString::fromStdString(j.value("activeMode", ""));