From 3ced80e198a2d8535d2c6a180ed9cc17dbe366b1 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 30 Sep 2015 08:55:58 +0200 Subject: [PATCH] Fixed source plugins virtual methods --- Readme.md | 1 + include-gpl/plugin/pluginmanager.h | 6 +++--- include/plugin/plugininterface.h | 2 +- plugins/samplesource/fcdpro/fcdproplugin.cpp | 4 ++-- plugins/samplesource/fcdpro/fcdproplugin.h | 4 ++-- plugins/samplesource/filesource/filesourceplugin.cpp | 4 ++-- plugins/samplesource/filesource/filesourceplugin.h | 4 ++-- plugins/samplesource/hackrf/hackrfplugin.cpp | 4 ++-- plugins/samplesource/hackrf/hackrfplugin.h | 4 ++-- sdrbase/gui/pluginsdialog.cpp | 2 +- sdrbase/plugin/pluginmanager.cpp | 12 +++++------- 11 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Readme.md b/Readme.md index 7ac085990..60f53a2c9 100644 --- a/Readme.md +++ b/Readme.md @@ -182,6 +182,7 @@ Assuming Debian Jessie is used: - Many other little things...

To Do

+ - Specialize plugins into channel and sample source plugins since both have almost complete different requirements and only little in common - Enhance presets management (Edit, Move, Import/Export from/to human readable format like JSON). - Allow arbitrary sample rate for channelizers and demodulators (not multiple of 48 kHz). Prerequisite for polyphase channelizer - Implement polyphase channelizer diff --git a/include-gpl/plugin/pluginmanager.h b/include-gpl/plugin/pluginmanager.h index ce693a313..3fd16d173 100644 --- a/include-gpl/plugin/pluginmanager.h +++ b/include-gpl/plugin/pluginmanager.h @@ -23,12 +23,12 @@ public: { QString filename; QPluginLoader* loader; - PluginInterface* plugin; + PluginInterface* pluginInterface; Plugin(const QString& _filename, QPluginLoader* pluginLoader, PluginInterface* _plugin) : filename(_filename), loader(pluginLoader), - plugin(_plugin) + pluginInterface(_plugin) { } }; @@ -137,7 +137,7 @@ private: static inline bool operator<(const PluginManager::Plugin& a, const PluginManager::Plugin& b) { - return a.plugin->getPluginDescriptor().displayedName < b.plugin->getPluginDescriptor().displayedName; + return a.pluginInterface->getPluginDescriptor().displayedName < b.pluginInterface->getPluginDescriptor().displayedName; } #endif // INCLUDE_PLUGINMANAGER_H diff --git a/include/plugin/plugininterface.h b/include/plugin/plugininterface.h index 39aa454b1..4bb3393d6 100644 --- a/include/plugin/plugininterface.h +++ b/include/plugin/plugininterface.h @@ -46,7 +46,7 @@ public: virtual PluginGUI* createChannel(const QString& channelName) { return 0; } virtual SampleSourceDevices enumSampleSources() { return SampleSourceDevices(); } - virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, const QString& sourceSerial, int sourceSequence) { return 0; } + virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId) { return 0; } }; Q_DECLARE_INTERFACE(PluginInterface, "de.maintech.SDRangelove.PluginInterface/0.1"); diff --git a/plugins/samplesource/fcdpro/fcdproplugin.cpp b/plugins/samplesource/fcdpro/fcdproplugin.cpp index 5100060d1..c7f53acf1 100644 --- a/plugins/samplesource/fcdpro/fcdproplugin.cpp +++ b/plugins/samplesource/fcdpro/fcdproplugin.cpp @@ -74,9 +74,9 @@ PluginInterface::SampleSourceDevices FCDProPlugin::enumSampleSources() return result; } -PluginGUI* FCDProPlugin::createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address) +PluginGUI* FCDProPlugin::createSampleSourcePluginGUI(const QString& sourceId) { - if(sourceName == fcd_traits::interfaceIID) + if(sourceId == fcd_traits::interfaceIID) { FCDProGui* gui = new FCDProGui(m_pluginAPI); m_pluginAPI->setInputGUI(gui); diff --git a/plugins/samplesource/fcdpro/fcdproplugin.h b/plugins/samplesource/fcdpro/fcdproplugin.h index 5e999db8c..16864caa4 100644 --- a/plugins/samplesource/fcdpro/fcdproplugin.h +++ b/plugins/samplesource/fcdpro/fcdproplugin.h @@ -17,8 +17,8 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - SampleSourceDevices enumSampleSources(); - PluginGUI* createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address); + virtual SampleSourceDevices enumSampleSources(); + virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId); static const QString m_deviceTypeID; diff --git a/plugins/samplesource/filesource/filesourceplugin.cpp b/plugins/samplesource/filesource/filesourceplugin.cpp index 493bbd1c5..8259dd982 100644 --- a/plugins/samplesource/filesource/filesourceplugin.cpp +++ b/plugins/samplesource/filesource/filesourceplugin.cpp @@ -69,9 +69,9 @@ PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources() return result; } -PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address) +PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceId) { - if(sourceName == "org.osmocom.sdr.samplesource.filesource") { + if(sourceId == "org.osmocom.sdr.samplesource.filesource") { FileSourceGui* gui = new FileSourceGui(m_pluginAPI); m_pluginAPI->setInputGUI(gui); return gui; diff --git a/plugins/samplesource/filesource/filesourceplugin.h b/plugins/samplesource/filesource/filesourceplugin.h index 666ec930c..086c79ce5 100644 --- a/plugins/samplesource/filesource/filesourceplugin.h +++ b/plugins/samplesource/filesource/filesourceplugin.h @@ -31,8 +31,8 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - SampleSourceDevices enumSampleSources(); - PluginGUI* createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address); + virtual SampleSourceDevices enumSampleSources(); + virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/samplesource/hackrf/hackrfplugin.cpp b/plugins/samplesource/hackrf/hackrfplugin.cpp index e4abddeed..5c0d667e3 100644 --- a/plugins/samplesource/hackrf/hackrfplugin.cpp +++ b/plugins/samplesource/hackrf/hackrfplugin.cpp @@ -119,14 +119,14 @@ PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources() return result; } -PluginGUI* HackRFPlugin::createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address) +PluginGUI* HackRFPlugin::createSampleSourcePluginGUI(const QString& sourceId) { if (!m_pluginAPI) { return 0; } - if(sourceName == m_deviceTypeID) + if(sourceId == m_deviceTypeID) { HackRFGui* gui = new HackRFGui(m_pluginAPI); m_pluginAPI->setInputGUI(gui); diff --git a/plugins/samplesource/hackrf/hackrfplugin.h b/plugins/samplesource/hackrf/hackrfplugin.h index 8de848017..3b34ba07e 100644 --- a/plugins/samplesource/hackrf/hackrfplugin.h +++ b/plugins/samplesource/hackrf/hackrfplugin.h @@ -33,8 +33,8 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - SampleSourceDevices enumSampleSources(); - PluginGUI* createSampleSourcePluginGUI(const QString& sourceName, const QByteArray& address); + virtual SampleSourceDevices enumSampleSources(); + virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId); static const QString m_deviceTypeID; diff --git a/sdrbase/gui/pluginsdialog.cpp b/sdrbase/gui/pluginsdialog.cpp index 551456ff2..cb8a26fec 100644 --- a/sdrbase/gui/pluginsdialog.cpp +++ b/sdrbase/gui/pluginsdialog.cpp @@ -11,7 +11,7 @@ PluginsDialog::PluginsDialog(PluginManager* pluginManager, QWidget* parent) : const PluginManager::Plugins& plugins = pluginManager->getPlugins(); for(PluginManager::Plugins::const_iterator it = plugins.constBegin(); it != plugins.constEnd(); ++it) { QStringList sl; - const PluginDescriptor& desc = it->plugin->getPluginDescriptor(); + const PluginDescriptor& desc = it->pluginInterface->getPluginDescriptor(); sl.append(desc.displayedName); sl.append(desc.version); if(desc.licenseIsGPL) diff --git a/sdrbase/plugin/pluginmanager.cpp b/sdrbase/plugin/pluginmanager.cpp index 29ff14ef0..1ab19f3ee 100644 --- a/sdrbase/plugin/pluginmanager.cpp +++ b/sdrbase/plugin/pluginmanager.cpp @@ -17,6 +17,8 @@ PluginManager::PluginManager(MainWindow* mainWindow, DSPEngine* dspEngine, QObje m_mainWindow(mainWindow), m_dspEngine(dspEngine), m_sampleSourceId(), + m_sampleSourceSerial(), + m_sampleSourceSequence(0), m_sampleSourcePluginGUI(NULL) { } @@ -38,7 +40,7 @@ void PluginManager::loadPlugins() for (Plugins::const_iterator it = m_plugins.begin(); it != m_plugins.end(); ++it) { - it->plugin->initPlugin(&m_pluginAPI); + it->pluginInterface->initPlugin(&m_pluginAPI); } updateSampleSourceDevices(); @@ -311,9 +313,7 @@ int PluginManager::selectSampleSource(int index) << " ser: " << m_sampleSourceSerial.toStdString().c_str() << " seq: " << m_sampleSourceSequence; - m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, - m_sampleSourceSerial, - m_sampleSourceSequence); + m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId); return index; } @@ -369,9 +369,7 @@ int PluginManager::selectFirstSampleSource(const QString& sourceId) << " ser: " << m_sampleSourceSerial.toStdString().c_str() << " seq: " << m_sampleSourceSequence; - m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, - m_sampleSourceSerial, - m_sampleSourceSequence); + m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId); return index; }