diff --git a/plugins/channel/demodam/amplugin.cpp b/plugins/channel/demodam/amplugin.cpp index 8010fce9d..1af8ebd54 100644 --- a/plugins/channel/demodam/amplugin.cpp +++ b/plugins/channel/demodam/amplugin.cpp @@ -1,6 +1,7 @@ #include "amplugin.h" #include +#include #include "plugin/pluginapi.h" #include "amdemodgui.h" @@ -34,16 +35,18 @@ void AMPlugin::initPlugin(PluginAPI* pluginAPI) PluginGUI* AMPlugin::createChannel(const QString& channelName) { if(channelName == "de.maintech.sdrangelove.channel.am") { - return createInstanceAM(); + AMDemodGUI* gui = AMDemodGUI::create(m_pluginAPI); + m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.am", gui); + m_pluginAPI->addChannelRollup(gui); + return gui; } else { return NULL; } } -PluginGUI* AMPlugin::createInstanceAM() +void AMPlugin::createInstanceAM() { AMDemodGUI* gui = AMDemodGUI::create(m_pluginAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.am", gui); m_pluginAPI->addChannelRollup(gui); - return gui; } diff --git a/plugins/channel/demodam/amplugin.h b/plugins/channel/demodam/amplugin.h index cdf293a2c..3c974f310 100644 --- a/plugins/channel/demodam/amplugin.h +++ b/plugins/channel/demodam/amplugin.h @@ -21,7 +21,9 @@ private: static const PluginDescriptor m_pluginDescriptor; PluginAPI* m_pluginAPI; - PluginGUI* createInstanceAM(); + +private slots: + void createInstanceAM(); }; #endif // INCLUDE_AMPLUGIN_H diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index 27147b47d..acd9e3a0c 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -333,17 +333,13 @@ void MainWindow::savePresetSettings(Preset* preset) qPrintable(preset->getGroup()), qPrintable(preset->getDescription())); - preset->setSpectrumConfig(m_deviceUIs.back()->m_spectrumGUI->serialize()); - preset->clearChannels(); - // Save from currently selected source tab int currentSourceTabIndex = ui->tabInputsView->currentIndex(); + DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex]; - if (currentSourceTabIndex >= 0) - { - DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex]; - deviceUI->m_pluginManager->saveSettings(preset); - } + preset->setSpectrumConfig(deviceUI->m_spectrumGUI->serialize()); + preset->clearChannels(); + deviceUI->m_pluginManager->saveSettings(preset); preset->setLayout(saveState()); } @@ -674,7 +670,7 @@ void MainWindow::on_sampleSource_currentIndexChanged(int index) { DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex]; deviceUI->m_pluginManager->saveSourceSettings(m_settings.getWorkingPreset()); - deviceUI->m_pluginManager->selectSampleSourceByIndex(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->currentIndex()); + deviceUI->m_pluginManager->selectSampleSourceByIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex()); m_settings.setSourceIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex()); deviceUI->m_pluginManager->loadSourceSettings(m_settings.getWorkingPreset());