From 034d1be0f82b7cec4a27cfa33a7dde656d07eb2e Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 15 Sep 2017 02:15:59 +0200 Subject: [PATCH] MainWindow: simplify the constructs new GUI and input object code --- sdrbase/mainwindow.cpp | 6 ++---- sdrbase/plugin/pluginmanager.cpp | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index e75b221aa..fd978e633 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -858,11 +858,9 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked __attribute__((unus // constructs new GUI and input object QWidget *gui; - PluginManager::SamplingDevice *sampleSourceDevice = (PluginManager::SamplingDevice *) devicePtr; - PluginInstanceUI *pluginUI = sampleSourceDevice->m_plugin->createSampleSourcePluginInstanceGUI(sampleSourceDevice->m_deviceId, &gui, deviceUI->m_deviceSourceAPI); - + PluginInstanceUI *pluginUI = deviceUI->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(deviceUI->m_deviceSourceAPI->getSampleSourceId(), &gui, deviceUI->m_deviceSourceAPI); deviceUI->m_deviceSourceAPI->setSampleSourcePluginInstanceUI(pluginUI); - setDeviceGUI(currentSourceTabIndex, gui, sampleSourceDevice->m_displayName); + setDeviceGUI(currentSourceTabIndex, gui, deviceUI->m_deviceSourceAPI->getSampleSourceDisplayName()); deviceUI->m_deviceSourceAPI->loadSourceSettings(m_settings.getWorkingPreset()); // load new API settings diff --git a/sdrbase/plugin/pluginmanager.cpp b/sdrbase/plugin/pluginmanager.cpp index 0a18c401a..85aa6e3f1 100644 --- a/sdrbase/plugin/pluginmanager.cpp +++ b/sdrbase/plugin/pluginmanager.cpp @@ -557,6 +557,8 @@ void PluginManager::selectSampleSourceByDevice(void *devicePtr, DeviceSourceAPI deviceAPI->setHardwareId(sampleSourceDevice->m_hadrwareId); deviceAPI->setSampleSourceId(sampleSourceDevice->m_deviceId); deviceAPI->setSampleSourceSerial(sampleSourceDevice->m_deviceSerial); + deviceAPI->setSampleSourceDisplayName(sampleSourceDevice->m_displayName); + deviceAPI->setSampleSourcePluginInterface(sampleSourceDevice->m_plugin); } void PluginManager::selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *deviceAPI) @@ -574,6 +576,8 @@ void PluginManager::selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *dev deviceAPI->setHardwareId(sampleSinkDevice->m_hadrwareId); deviceAPI->setSampleSinkId(sampleSinkDevice->m_deviceId); deviceAPI->setSampleSinkSerial(sampleSinkDevice->m_deviceSerial); + deviceAPI->setSampleSinkDisplayName(sampleSinkDevice->m_displayName); + deviceAPI->setSampleSinkPluginInterface(sampleSinkDevice->m_plugin); } void PluginManager::loadPlugins(const QDir& dir)