From e2f15792ad34dd8928ead65b3adb185930d26178 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 15 Sep 2017 08:23:04 +0200 Subject: [PATCH] On sample source confirm clicked delete old UI with the plugin interface --- sdrbase/device/devicesourceapi.cpp | 11 +++++------ sdrbase/device/devicesourceapi.h | 2 ++ sdrbase/mainwindow.cpp | 4 +++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sdrbase/device/devicesourceapi.cpp b/sdrbase/device/devicesourceapi.cpp index f1887d807..2f16fd140 100644 --- a/sdrbase/device/devicesourceapi.cpp +++ b/sdrbase/device/devicesourceapi.cpp @@ -153,6 +153,11 @@ void DeviceSourceAPI::setSampleSourceId(const QString& id) m_sampleSourceId = id; } +void DeviceSourceAPI::resetSampleSourceId() +{ + m_sampleSourceId.clear(); +} + void DeviceSourceAPI::setSampleSourceSerial(const QString& serial) { m_sampleSourceSerial = serial; @@ -176,12 +181,6 @@ void DeviceSourceAPI::setSampleSourcePluginInterface(PluginInterface *interface) void DeviceSourceAPI::setSampleSourcePluginInstanceUI(PluginInstanceUI *gui) { - if (m_sampleSourcePluginInstanceUI != 0) - { - m_sampleSourcePluginInstanceUI->destroy(); - m_sampleSourceId.clear(); - } - m_sampleSourcePluginInstanceUI = gui; } diff --git a/sdrbase/device/devicesourceapi.h b/sdrbase/device/devicesourceapi.h index 6d21578a2..f3d44dcb4 100644 --- a/sdrbase/device/devicesourceapi.h +++ b/sdrbase/device/devicesourceapi.h @@ -69,6 +69,7 @@ public: void setHardwareId(const QString& id); void setSampleSourceId(const QString& id); + void resetSampleSourceId(); void setSampleSourceSerial(const QString& serial); void setSampleSourceDisplayName(const QString& serial); void setSampleSourceSequence(int sequence); @@ -81,6 +82,7 @@ public: const QString& getSampleSourceDisplayName() const { return m_sampleSourceDisplayName; } PluginInterface *getPluginInterface() { return m_pluginInterface; } uint32_t getSampleSourceSequence() const { return m_sampleSourceSequence; } + PluginInstanceUI *getSampleSourcePluginInstanceUI() { return m_sampleSourcePluginInstanceUI; } void registerChannelInstance(const QString& channelName, PluginInstanceUI* pluginGUI); void removeChannelInstance(PluginInstanceUI* pluginGUI); diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index c430cd3b7..2a10a0330 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -817,7 +817,9 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked __attribute__((unus void *devicePtr = deviceUI->m_samplingDeviceControl->getDeviceSelector()->itemData(selectedComboIndex).value(); deviceUI->m_deviceSourceAPI->stopAcquisition(); - deviceUI->m_deviceSourceAPI->setSampleSourcePluginInstanceUI(0); // deletes old UI and input object + // deletes old UI and input object + deviceUI->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(deviceUI->m_deviceSourceAPI->getSampleSourcePluginInstanceUI()); + deviceUI->m_deviceSourceAPI->resetSampleSourceId(); deviceUI->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists m_pluginManager->selectSampleSourceByDevice(devicePtr, deviceUI->m_deviceSourceAPI); // sets the new API