diff --git a/plugins/channelrx/freqtracker/freqtracker.cpp b/plugins/channelrx/freqtracker/freqtracker.cpp index 1a0b771a4..3ca7fc2cf 100644 --- a/plugins/channelrx/freqtracker/freqtracker.cpp +++ b/plugins/channelrx/freqtracker/freqtracker.cpp @@ -619,19 +619,19 @@ void FreqTracker::webapiUpdateChannelSettings( settings.m_squelchGate = response.getFreqTrackerSettings()->getSquelchGate(); } if (channelSettingsKeys.contains("useReverseAPI")) { - settings.m_useReverseAPI = response.getAmDemodSettings()->getUseReverseApi() != 0; + settings.m_useReverseAPI = response.getFreqTrackerSettings()->getUseReverseApi() != 0; } if (channelSettingsKeys.contains("reverseAPIAddress")) { - settings.m_reverseAPIAddress = *response.getAmDemodSettings()->getReverseApiAddress(); + settings.m_reverseAPIAddress = *response.getFreqTrackerSettings()->getReverseApiAddress(); } if (channelSettingsKeys.contains("reverseAPIPort")) { - settings.m_reverseAPIPort = response.getAmDemodSettings()->getReverseApiPort(); + settings.m_reverseAPIPort = response.getFreqTrackerSettings()->getReverseApiPort(); } if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) { - settings.m_reverseAPIDeviceIndex = response.getAmDemodSettings()->getReverseApiDeviceIndex(); + settings.m_reverseAPIDeviceIndex = response.getFreqTrackerSettings()->getReverseApiDeviceIndex(); } if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { - settings.m_reverseAPIChannelIndex = response.getAmDemodSettings()->getReverseApiChannelIndex(); + settings.m_reverseAPIChannelIndex = response.getFreqTrackerSettings()->getReverseApiChannelIndex(); } } diff --git a/sdrbase/webapi/webapiadapterbase.cpp b/sdrbase/webapi/webapiadapterbase.cpp index f6913eec2..51c80a825 100644 --- a/sdrbase/webapi/webapiadapterbase.cpp +++ b/sdrbase/webapi/webapiadapterbase.cpp @@ -114,10 +114,10 @@ void WebAPIAdapterBase::webapiFormatPreset( swgSpectrumConfig->setFftWindow((int) m_spectrumSettings.m_fftWindow); swgSpectrumConfig->setRefLevel(m_spectrumSettings.m_refLevel); swgSpectrumConfig->setPowerRange(m_spectrumSettings.m_powerRange); - swgSpectrumConfig->setDisplayWaterfall(m_spectrumSettings.m_displayWaterfall ? 0 : 1); - swgSpectrumConfig->setInvertedWaterfall(m_spectrumSettings.m_invertedWaterfall ? 0 : 1); - swgSpectrumConfig->setDisplayMaxHold(m_spectrumSettings.m_displayMaxHold ? 0 : 1); - swgSpectrumConfig->setDisplayHistogram(m_spectrumSettings.m_displayHistogram ? 0 : 1); + swgSpectrumConfig->setDisplayWaterfall(m_spectrumSettings.m_displayWaterfall ? 1 : 0); + swgSpectrumConfig->setInvertedWaterfall(m_spectrumSettings.m_invertedWaterfall ? 1 : 0); + swgSpectrumConfig->setDisplayMaxHold(m_spectrumSettings.m_displayMaxHold ? 1 : 0); + swgSpectrumConfig->setDisplayHistogram(m_spectrumSettings.m_displayHistogram ? 1 : 0); swgSpectrumConfig->setDecay(m_spectrumSettings.m_decay); swgSpectrumConfig->setDisplayGrid(m_spectrumSettings.m_displayGrid ? 1 : 0); swgSpectrumConfig->setInvert(m_spectrumSettings.m_invert ? 1 : 0); diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 068b492c0..ea573a9fa 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -2270,13 +2270,16 @@ bool WebAPIRequestMapper::validateConfig(SWGSDRangel::SWGInstanceConfigResponse& if (jsonObject.contains("presets")) { + QList *presets = new QList(); + config.setPresets(presets); QJsonArray presetsJson = jsonObject["presets"].toArray(); QJsonArray::const_iterator presetsIt = presetsJson.begin(); for (; presetsIt != presetsJson.end(); ++presetsIt) { - SWGSDRangel::SWGPreset *preset = new SWGSDRangel::SWGPreset(); QJsonObject presetJson = presetsIt->toObject(); + SWGSDRangel::SWGPreset *preset = new SWGSDRangel::SWGPreset(); + presets->append(preset); configKeys.m_presetKeys.append(WebAPIAdapterInterface::PresetKeys()); appendPresetKeys(preset, presetJson, configKeys.m_presetKeys.back()); } @@ -2349,11 +2352,17 @@ bool WebAPIRequestMapper::appendPresetKeys( for (; channelsIt != channelsJson.end(); ++channelsIt) { QJsonObject channelJson = channelsIt->toObject(); - channels->append(new SWGSDRangel::SWGChannelConfig()); + SWGSDRangel::SWGChannelConfig *channelConfig = new SWGSDRangel::SWGChannelConfig(); presetKeys.m_channelsKeys.append(WebAPIAdapterInterface::ChannelKeys()); - if (!appendPresetChannelKeys(channels->back(), channelJson, presetKeys.m_channelsKeys.back())) { - return false; + if (appendPresetChannelKeys(channelConfig, channelJson, presetKeys.m_channelsKeys.back())) + { + channels->append(channelConfig); + } + else + { + delete channelConfig; + presetKeys.m_channelsKeys.takeLast(); // remove channel keys } } } @@ -2368,11 +2377,17 @@ bool WebAPIRequestMapper::appendPresetKeys( for (; devicesIt != devicesJson.end(); ++devicesIt) { QJsonObject deviceJson = devicesIt->toObject(); - devices->append(new SWGSDRangel::SWGDeviceConfig()); + SWGSDRangel::SWGDeviceConfig *deviceConfig = new SWGSDRangel::SWGDeviceConfig(); presetKeys.m_devicesKeys.append(WebAPIAdapterInterface::DeviceKeys()); - if (!appendPresetDeviceKeys(devices->back(), deviceJson, presetKeys.m_devicesKeys.back())) { - return false; + if (appendPresetDeviceKeys(deviceConfig, deviceJson, presetKeys.m_devicesKeys.back())) + { + devices->append(deviceConfig); + } + else + { + delete deviceConfig; + presetKeys.m_devicesKeys.takeLast(); // remove device keys } } } diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 71cf221f8..a21bb1bbb 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -121,6 +121,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse SDRangelSplash *splash = new SDRangelSplash(logoPixmap); splash->setMessageRect(QRect(10, 80, 350, 16)); splash->show(); + splash->showStatusMessage("starting...", Qt::white); splash->showStatusMessage("starting...", Qt::white); m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager()); @@ -912,6 +913,29 @@ QTreeWidgetItem* MainWindow::addCommandToTree(const Command* command) void MainWindow::applySettings() { loadPresetSettings(m_settings.getWorkingPreset(), 0); + + m_settings.sortPresets(); + int middleIndex = m_settings.getPresetCount() / 2; + QTreeWidgetItem *treeItem; + ui->presetTree->clear(); + + for (int i = 0; i < m_settings.getPresetCount(); ++i) + { + treeItem = addPresetToTree(m_settings.getPreset(i)); + + if (i == middleIndex) { + ui->presetTree->setCurrentItem(treeItem); + } + } + + m_settings.sortCommands(); + ui->commandTree->clear(); + + for (int i = 0; i < m_settings.getCommandCount(); ++i) { + treeItem = addCommandToTree(m_settings.getCommand(i)); + } + + setLoggingOptions(); } bool MainWindow::handleMessage(const Message& cmd)