From 7863a3cb69606ef7faac984fa69295ef273c9c16 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 17 May 2016 19:26:23 +0200 Subject: [PATCH] Multi device support: remainder source plugins: removed useless dependencies on plugin API --- plugins/samplesource/airspy/airspygui.cpp | 4 +--- plugins/samplesource/airspy/airspygui.h | 4 +--- plugins/samplesource/airspy/airspyplugin.cpp | 15 ++++----------- plugins/samplesource/airspy/airspyplugin.h | 4 ++-- plugins/samplesource/fcdpro/fcdprogui.cpp | 4 +--- plugins/samplesource/fcdpro/fcdprogui.h | 5 ++--- plugins/samplesource/fcdpro/fcdproplugin.cpp | 6 ++---- plugins/samplesource/fcdpro/fcdproplugin.h | 4 ++-- plugins/samplesource/fcdproplus/fcdproplusgui.cpp | 4 +--- plugins/samplesource/fcdproplus/fcdproplusgui.h | 4 +--- .../samplesource/fcdproplus/fcdproplusplugin.cpp | 6 ++---- .../samplesource/fcdproplus/fcdproplusplugin.h | 4 ++-- plugins/samplesource/filesource/filesourcegui.cpp | 7 +++---- plugins/samplesource/filesource/filesourcegui.h | 4 +--- .../samplesource/filesource/filesourceplugin.cpp | 5 ++--- .../samplesource/filesource/filesourceplugin.h | 4 ++-- plugins/samplesource/hackrf/hackrfgui.cpp | 4 +--- plugins/samplesource/hackrf/hackrfgui.h | 4 +--- plugins/samplesource/hackrf/hackrfplugin.cpp | 13 +++---------- plugins/samplesource/hackrf/hackrfplugin.h | 4 ++-- 20 files changed, 36 insertions(+), 73 deletions(-) diff --git a/plugins/samplesource/airspy/airspygui.cpp b/plugins/samplesource/airspy/airspygui.cpp index 00d3bfb59..80f481df8 100644 --- a/plugins/samplesource/airspy/airspygui.cpp +++ b/plugins/samplesource/airspy/airspygui.cpp @@ -21,7 +21,6 @@ #include "airspygui.h" #include "ui_airspygui.h" -#include "plugin/pluginapi.h" #include "device/deviceapi.h" #include "gui/colormapper.h" #include "gui/glspectrum.h" @@ -29,10 +28,9 @@ #include "dsp/dspcommands.h" #include "dsp/filesink.h" -AirspyGui::AirspyGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : +AirspyGui::AirspyGui(DeviceAPI *deviceAPI, QWidget* parent) : QWidget(parent), ui(new Ui::AirspyGui), - m_pluginAPI(pluginAPI), m_deviceAPI(deviceAPI), m_settings(), m_sampleSource(0), diff --git a/plugins/samplesource/airspy/airspygui.h b/plugins/samplesource/airspy/airspygui.h index 49836f6be..f9bb717f5 100644 --- a/plugins/samplesource/airspy/airspygui.h +++ b/plugins/samplesource/airspy/airspygui.h @@ -24,7 +24,6 @@ #define AIRSPY_MAX_DEVICE (32) -class PluginAPI; class DeviceAPI; class FileSink; @@ -37,7 +36,7 @@ class AirspyGui : public QWidget, public PluginGUI { Q_OBJECT public: - explicit AirspyGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); + explicit AirspyGui(DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~AirspyGui(); void destroy(); @@ -56,7 +55,6 @@ public: private: Ui::AirspyGui* ui; - PluginAPI* m_pluginAPI; DeviceAPI* m_deviceAPI; AirspySettings m_settings; QTimer m_updateTimer; diff --git a/plugins/samplesource/airspy/airspyplugin.cpp b/plugins/samplesource/airspy/airspyplugin.cpp index 797f01e5e..6ee219ed8 100644 --- a/plugins/samplesource/airspy/airspyplugin.cpp +++ b/plugins/samplesource/airspy/airspyplugin.cpp @@ -36,8 +36,7 @@ const PluginDescriptor AirspyPlugin::m_pluginDescriptor = { const QString AirspyPlugin::m_deviceTypeID = AIRSPY_DEVICE_TYPE_ID; AirspyPlugin::AirspyPlugin(QObject* parent) : - QObject(parent), - m_pluginAPI(0) + QObject(parent) { } @@ -48,8 +47,7 @@ const PluginDescriptor& AirspyPlugin::getPluginDescriptor() const void AirspyPlugin::initPlugin(PluginAPI* pluginAPI) { - m_pluginAPI = pluginAPI; - m_pluginAPI->registerSampleSource(m_deviceTypeID, this); + pluginAPI->registerSampleSource(m_deviceTypeID, this); } PluginInterface::SampleSourceDevices AirspyPlugin::enumSampleSources() @@ -120,14 +118,9 @@ PluginInterface::SampleSourceDevices AirspyPlugin::enumSampleSources() PluginGUI* AirspyPlugin::createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceAPI *deviceAPI) { - if (!m_pluginAPI) + if (sourceId == m_deviceTypeID) { - return 0; - } - - if(sourceId == m_deviceTypeID) - { - AirspyGui* gui = new AirspyGui(m_pluginAPI, deviceAPI); + AirspyGui* gui = new AirspyGui(deviceAPI); *widget = gui; return gui; } diff --git a/plugins/samplesource/airspy/airspyplugin.h b/plugins/samplesource/airspy/airspyplugin.h index 59990280c..9892eaf6f 100644 --- a/plugins/samplesource/airspy/airspyplugin.h +++ b/plugins/samplesource/airspy/airspyplugin.h @@ -22,6 +22,8 @@ #define AIRSPY_DEVICE_TYPE_ID "sdrangel.samplesource.airspy" +class PluginAPI; + class AirspyPlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -40,8 +42,6 @@ public: private: static const PluginDescriptor m_pluginDescriptor; - - PluginAPI* m_pluginAPI; }; #endif // INCLUDE_AIRSPYPLUGIN_H diff --git a/plugins/samplesource/fcdpro/fcdprogui.cpp b/plugins/samplesource/fcdpro/fcdprogui.cpp index e39b389d1..7df50dc1a 100644 --- a/plugins/samplesource/fcdpro/fcdprogui.cpp +++ b/plugins/samplesource/fcdpro/fcdprogui.cpp @@ -17,7 +17,6 @@ #include #include "ui_fcdprogui.h" -#include "plugin/pluginapi.h" #include "device/deviceapi.h" #include "gui/colormapper.h" #include "gui/glspectrum.h" @@ -27,10 +26,9 @@ #include "fcdprogui.h" #include "fcdproconst.h" -FCDProGui::FCDProGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : +FCDProGui::FCDProGui(DeviceAPI *deviceAPI, QWidget* parent) : QWidget(parent), ui(new Ui::FCDProGui), - m_pluginAPI(pluginAPI), m_deviceAPI(deviceAPI), m_settings(), m_sampleSource(NULL), diff --git a/plugins/samplesource/fcdpro/fcdprogui.h b/plugins/samplesource/fcdpro/fcdprogui.h index e3d01a442..237ea8908 100644 --- a/plugins/samplesource/fcdpro/fcdprogui.h +++ b/plugins/samplesource/fcdpro/fcdprogui.h @@ -22,9 +22,9 @@ #include "fcdproinput.h" #include "plugin/plugingui.h" -class PluginAPI; class DeviceAPI; class FileSink; +class QWidget; namespace Ui { class FCDProGui; @@ -34,7 +34,7 @@ class FCDProGui : public QWidget, public PluginGUI { Q_OBJECT public: - explicit FCDProGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); + explicit FCDProGui(DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~FCDProGui(); void destroy(); @@ -52,7 +52,6 @@ public: private: Ui::FCDProGui* ui; - PluginAPI* m_pluginAPI; DeviceAPI* m_deviceAPI; FCDProSettings m_settings; QTimer m_updateTimer; diff --git a/plugins/samplesource/fcdpro/fcdproplugin.cpp b/plugins/samplesource/fcdpro/fcdproplugin.cpp index 7dcaca0ff..250717c39 100644 --- a/plugins/samplesource/fcdpro/fcdproplugin.cpp +++ b/plugins/samplesource/fcdpro/fcdproplugin.cpp @@ -46,9 +46,7 @@ const PluginDescriptor& FCDProPlugin::getPluginDescriptor() const void FCDProPlugin::initPlugin(PluginAPI* pluginAPI) { - m_pluginAPI = pluginAPI; - - m_pluginAPI->registerSampleSource(fcd_traits::interfaceIID, this); + pluginAPI->registerSampleSource(fcd_traits::interfaceIID, this); } PluginInterface::SampleSourceDevices FCDProPlugin::enumSampleSources() @@ -79,7 +77,7 @@ PluginGUI* FCDProPlugin::createSampleSourcePluginGUI(const QString& sourceId, QW { if(sourceId == fcd_traits::interfaceIID) { - FCDProGui* gui = new FCDProGui(m_pluginAPI, deviceAPI); + FCDProGui* gui = new FCDProGui(deviceAPI); *widget = gui; return gui; } diff --git a/plugins/samplesource/fcdpro/fcdproplugin.h b/plugins/samplesource/fcdpro/fcdproplugin.h index 9ce0baa18..7244e6fac 100644 --- a/plugins/samplesource/fcdpro/fcdproplugin.h +++ b/plugins/samplesource/fcdpro/fcdproplugin.h @@ -6,6 +6,8 @@ #define FCDPRO_DEVICE_TYPE_ID "sdrangel.samplesource.fcdpro" +class PluginAPI; + class FCDProPlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -24,8 +26,6 @@ public: private: static const PluginDescriptor m_pluginDescriptor; - - PluginAPI* m_pluginAPI; }; #endif // INCLUDE_FCDPLUGIN_H diff --git a/plugins/samplesource/fcdproplus/fcdproplusgui.cpp b/plugins/samplesource/fcdproplus/fcdproplusgui.cpp index 0bab351f6..e9284d7ea 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusgui.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplusgui.cpp @@ -18,7 +18,6 @@ #include #include "ui_fcdproplusgui.h" -#include "plugin/pluginapi.h" #include "device/deviceapi.h" #include "gui/colormapper.h" #include "gui/glspectrum.h" @@ -28,10 +27,9 @@ #include "fcdproplusgui.h" #include "fcdproplusconst.h" -FCDProPlusGui::FCDProPlusGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : +FCDProPlusGui::FCDProPlusGui(DeviceAPI *deviceAPI, QWidget* parent) : QWidget(parent), ui(new Ui::FCDProPlusGui), - m_pluginAPI(pluginAPI), m_deviceAPI(deviceAPI), m_settings(), m_sampleSource(NULL), diff --git a/plugins/samplesource/fcdproplus/fcdproplusgui.h b/plugins/samplesource/fcdproplus/fcdproplusgui.h index c15a6b0ac..52e80d7f1 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusgui.h +++ b/plugins/samplesource/fcdproplus/fcdproplusgui.h @@ -22,7 +22,6 @@ #include "fcdproplusinput.h" #include "plugin/plugingui.h" -class PluginAPI; class DeviceAPI; class FileSink; @@ -34,7 +33,7 @@ class FCDProPlusGui : public QWidget, public PluginGUI { Q_OBJECT public: - explicit FCDProPlusGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); + explicit FCDProPlusGui(DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~FCDProPlusGui(); void destroy(); @@ -52,7 +51,6 @@ public: private: Ui::FCDProPlusGui* ui; - PluginAPI* m_pluginAPI; DeviceAPI* m_deviceAPI; FCDProPlusSettings m_settings; QTimer m_updateTimer; diff --git a/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp b/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp index 2dd3396b2..9d6931504 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp @@ -46,9 +46,7 @@ const PluginDescriptor& FCDProPlusPlugin::getPluginDescriptor() const void FCDProPlusPlugin::initPlugin(PluginAPI* pluginAPI) { - m_pluginAPI = pluginAPI; - - m_pluginAPI->registerSampleSource(fcd_traits::interfaceIID, this); + pluginAPI->registerSampleSource(fcd_traits::interfaceIID, this); } PluginInterface::SampleSourceDevices FCDProPlusPlugin::enumSampleSources() @@ -79,7 +77,7 @@ PluginGUI* FCDProPlusPlugin::createSampleSourcePluginGUI(const QString& sourceId { if(sourceId == fcd_traits::interfaceIID) { - FCDProPlusGui* gui = new FCDProPlusGui(m_pluginAPI, deviceAPI); + FCDProPlusGui* gui = new FCDProPlusGui(deviceAPI); *widget = gui; return gui; } diff --git a/plugins/samplesource/fcdproplus/fcdproplusplugin.h b/plugins/samplesource/fcdproplus/fcdproplusplugin.h index 9ff262b8d..dac14385d 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusplugin.h +++ b/plugins/samplesource/fcdproplus/fcdproplusplugin.h @@ -6,6 +6,8 @@ #define FCDPROPLUS_DEVICE_TYPE_ID "sdrangel.samplesource.fcdproplus" +class PluginAPI; + class FCDProPlusPlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -24,8 +26,6 @@ public: private: static const PluginDescriptor m_pluginDescriptor; - - PluginAPI* m_pluginAPI; }; #endif // INCLUDE_FCDPROPLUSPLUGIN_H diff --git a/plugins/samplesource/filesource/filesourcegui.cpp b/plugins/samplesource/filesource/filesourcegui.cpp index 63e22b934..8825e2bd4 100644 --- a/plugins/samplesource/filesource/filesourcegui.cpp +++ b/plugins/samplesource/filesource/filesourcegui.cpp @@ -34,10 +34,9 @@ #include "filesourcegui.h" -FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : +FileSourceGui::FileSourceGui(DeviceAPI *deviceAPI, QWidget* parent) : QWidget(parent), ui(new Ui::FileSourceGui), - m_pluginAPI(pluginAPI), m_deviceAPI(deviceAPI), m_settings(), m_sampleSource(NULL), @@ -57,7 +56,7 @@ FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget ui->centerFrequency->setValueRange(7, 0, pow(10,7)); ui->fileNameText->setText(m_fileName); - connect(&(m_pluginAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); + connect(&(m_deviceAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); m_statusTimer.start(500); @@ -67,7 +66,7 @@ FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget ui->playLoop->setChecked(true); // FIXME: always play in a loop ui->playLoop->setEnabled(false); - m_sampleSource = new FileSourceInput(m_pluginAPI->getMainWindow()->getMasterTimer()); + m_sampleSource = new FileSourceInput(m_deviceAPI->getMainWindow()->getMasterTimer()); connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); m_deviceAPI->setSource(m_sampleSource); diff --git a/plugins/samplesource/filesource/filesourcegui.h b/plugins/samplesource/filesource/filesourcegui.h index f3fea4057..a647ddfaf 100644 --- a/plugins/samplesource/filesource/filesourcegui.h +++ b/plugins/samplesource/filesource/filesourcegui.h @@ -22,7 +22,6 @@ #include "filesourceinput.h" -class PluginAPI; class DeviceAPI; namespace Ui { @@ -33,7 +32,7 @@ class FileSourceGui : public QWidget, public PluginGUI { Q_OBJECT public: - explicit FileSourceGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); + explicit FileSourceGui(DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~FileSourceGui(); void destroy(); @@ -50,7 +49,6 @@ public: private: Ui::FileSourceGui* ui; - PluginAPI* m_pluginAPI; DeviceAPI* m_deviceAPI; FileSourceInput::Settings m_settings; QTimer m_statusTimer; diff --git a/plugins/samplesource/filesource/filesourceplugin.cpp b/plugins/samplesource/filesource/filesourceplugin.cpp index f6e06264f..b6d141701 100644 --- a/plugins/samplesource/filesource/filesourceplugin.cpp +++ b/plugins/samplesource/filesource/filesourceplugin.cpp @@ -46,8 +46,7 @@ const PluginDescriptor& FileSourcePlugin::getPluginDescriptor() const void FileSourcePlugin::initPlugin(PluginAPI* pluginAPI) { - m_pluginAPI = pluginAPI; - m_pluginAPI->registerSampleSource(m_deviceTypeID, this); + pluginAPI->registerSampleSource(m_deviceTypeID, this); } PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources() @@ -72,7 +71,7 @@ PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceId { if(sourceId == m_deviceTypeID) { - FileSourceGui* gui = new FileSourceGui(m_pluginAPI, deviceAPI); + FileSourceGui* gui = new FileSourceGui(deviceAPI); *widget = gui; return gui; } diff --git a/plugins/samplesource/filesource/filesourceplugin.h b/plugins/samplesource/filesource/filesourceplugin.h index 6eea0a293..fe1884049 100644 --- a/plugins/samplesource/filesource/filesourceplugin.h +++ b/plugins/samplesource/filesource/filesourceplugin.h @@ -22,6 +22,8 @@ #define FILESOURCE_DEVICE_TYPE_ID "sdrangel.samplesource.filesource" +class PluginAPI; + class FileSourcePlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -40,8 +42,6 @@ public: private: static const PluginDescriptor m_pluginDescriptor; - - PluginAPI* m_pluginAPI; }; #endif // INCLUDE_FILESOURCEPLUGIN_H diff --git a/plugins/samplesource/hackrf/hackrfgui.cpp b/plugins/samplesource/hackrf/hackrfgui.cpp index c8c8c2145..a7c21952d 100644 --- a/plugins/samplesource/hackrf/hackrfgui.cpp +++ b/plugins/samplesource/hackrf/hackrfgui.cpp @@ -19,7 +19,6 @@ #include -#include "plugin/pluginapi.h" #include "device/deviceapi.h" #include "gui/colormapper.h" #include "gui/glspectrum.h" @@ -29,10 +28,9 @@ #include "hackrfgui.h" #include "ui_hackrfgui.h" -HackRFGui::HackRFGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : +HackRFGui::HackRFGui(DeviceAPI *deviceAPI, QWidget* parent) : QWidget(parent), ui(new Ui::HackRFGui), - m_pluginAPI(pluginAPI), m_deviceAPI(deviceAPI), m_settings(), m_sampleSource(NULL), diff --git a/plugins/samplesource/hackrf/hackrfgui.h b/plugins/samplesource/hackrf/hackrfgui.h index 1238195d6..741e3abd3 100644 --- a/plugins/samplesource/hackrf/hackrfgui.h +++ b/plugins/samplesource/hackrf/hackrfgui.h @@ -24,7 +24,6 @@ #define HACKRF_MAX_DEVICE (32) -class PluginAPI; class DeviceAPI; class FileSink; @@ -44,7 +43,7 @@ public: HACKRF_IMGREJ_NB } HackRFImgRejValue; - explicit HackRFGui(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); + explicit HackRFGui(DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~HackRFGui(); void destroy(); @@ -61,7 +60,6 @@ public: private: Ui::HackRFGui* ui; - PluginAPI* m_pluginAPI; DeviceAPI* m_deviceAPI; HackRFSettings m_settings; QTimer m_updateTimer; diff --git a/plugins/samplesource/hackrf/hackrfplugin.cpp b/plugins/samplesource/hackrf/hackrfplugin.cpp index e79302855..dd25dff8a 100644 --- a/plugins/samplesource/hackrf/hackrfplugin.cpp +++ b/plugins/samplesource/hackrf/hackrfplugin.cpp @@ -37,8 +37,7 @@ const PluginDescriptor HackRFPlugin::m_pluginDescriptor = { const QString HackRFPlugin::m_deviceTypeID = HACKRF_DEVICE_TYPE_ID; HackRFPlugin::HackRFPlugin(QObject* parent) : - QObject(parent), - m_pluginAPI(0) + QObject(parent) { } @@ -49,8 +48,7 @@ const PluginDescriptor& HackRFPlugin::getPluginDescriptor() const void HackRFPlugin::initPlugin(PluginAPI* pluginAPI) { - m_pluginAPI = pluginAPI; - m_pluginAPI->registerSampleSource(m_deviceTypeID, this); + pluginAPI->registerSampleSource(m_deviceTypeID, this); } PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources() @@ -115,14 +113,9 @@ PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources() PluginGUI* HackRFPlugin::createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceAPI *deviceAPI) { - if (!m_pluginAPI) - { - return 0; - } - if(sourceId == m_deviceTypeID) { - HackRFGui* gui = new HackRFGui(m_pluginAPI, deviceAPI); + HackRFGui* gui = new HackRFGui(deviceAPI); *widget = gui; return gui; } diff --git a/plugins/samplesource/hackrf/hackrfplugin.h b/plugins/samplesource/hackrf/hackrfplugin.h index 4b698ce70..1adb1d966 100644 --- a/plugins/samplesource/hackrf/hackrfplugin.h +++ b/plugins/samplesource/hackrf/hackrfplugin.h @@ -22,6 +22,8 @@ #define HACKRF_DEVICE_TYPE_ID "sdrangel.samplesource.hackrf" +class PluginAPI; + class HackRFPlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -40,8 +42,6 @@ public: private: static const PluginDescriptor m_pluginDescriptor; - - PluginAPI* m_pluginAPI; }; #endif // INCLUDE_HACKRFPLUGIN_H