1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-02 13:17:48 -04:00

More cleanup on DeviceSourceAPI and PluginManager

This commit is contained in:
f4exb 2017-10-31 21:57:29 +01:00
parent e30050f018
commit c0afeaefa3
5 changed files with 3 additions and 54 deletions

View File

@ -20,20 +20,14 @@
#include "dsp/devicesamplesource.h" #include "dsp/devicesamplesource.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
#include "gui/glspectrum.h"
#include "gui/channelwindow.h"
#include "settings/preset.h" #include "settings/preset.h"
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
// TODO: extract GUI dependencies in a separate object // TODO: extract GUI dependencies in a separate object
DeviceSourceAPI::DeviceSourceAPI(int deviceTabIndex, DeviceSourceAPI::DeviceSourceAPI(int deviceTabIndex,
DSPDeviceSourceEngine *deviceSourceEngine, DSPDeviceSourceEngine *deviceSourceEngine) :
GLSpectrum *glSpectrum,
ChannelWindow *channelWindow) :
m_deviceTabIndex(deviceTabIndex), m_deviceTabIndex(deviceTabIndex),
m_deviceSourceEngine(deviceSourceEngine), m_deviceSourceEngine(deviceSourceEngine),
m_spectrum(glSpectrum),
m_channelWindow(channelWindow),
m_sampleSourceSequence(0), m_sampleSourceSequence(0),
m_pluginInterface(0), m_pluginInterface(0),
m_sampleSourcePluginInstanceUI(0), m_sampleSourcePluginInstanceUI(0),
@ -128,16 +122,6 @@ void DeviceSourceAPI::configureCorrections(bool dcOffsetCorrection, bool iqImbal
m_deviceSourceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection); m_deviceSourceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);
} }
void DeviceSourceAPI::addChannelMarker(ChannelMarker* channelMarker)
{
m_spectrum->addChannelMarker(channelMarker);
}
void DeviceSourceAPI::addRollupWidget(QWidget *widget)
{
m_channelWindow->addRollupWidget(widget);
}
void DeviceSourceAPI::setHardwareId(const QString& id) void DeviceSourceAPI::setHardwareId(const QString& id)
{ {
m_hardwareId = id; m_hardwareId = id;

View File

@ -25,14 +25,11 @@
#include "util/export.h" #include "util/export.h"
class GLSpectrum;
class ChannelWindow;
class BasebandSampleSink; class BasebandSampleSink;
class ThreadedBasebandSampleSink; class ThreadedBasebandSampleSink;
class DeviceSampleSource; class DeviceSampleSource;
class MessageQueue; class MessageQueue;
class ChannelMarker; class ChannelMarker;
class QWidget;
class PluginInstanceGUI; class PluginInstanceGUI;
class PluginAPI; class PluginAPI;
class PluginInterface; class PluginInterface;
@ -44,9 +41,7 @@ class SDRANGEL_API DeviceSourceAPI : public QObject {
public: public:
DeviceSourceAPI(int deviceTabIndex, DeviceSourceAPI(int deviceTabIndex,
DSPDeviceSourceEngine *deviceSourceEngine, DSPDeviceSourceEngine *deviceSourceEngine);
GLSpectrum *glSpectrum,
ChannelWindow *channelWindow);
~DeviceSourceAPI(); ~DeviceSourceAPI();
// Device engine stuff // Device engine stuff
@ -67,10 +62,6 @@ public:
MessageQueue *getSampleSourceGUIMessageQueue(); MessageQueue *getSampleSourceGUIMessageQueue();
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections
// device related stuff
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
void addRollupWidget(QWidget *widget); //!< Add rollup widget to channel window
void setHardwareId(const QString& id); void setHardwareId(const QString& id);
void setSampleSourceId(const QString& id); void setSampleSourceId(const QString& id);
void resetSampleSourceId(); void resetSampleSourceId();
@ -110,8 +101,6 @@ public:
protected: protected:
int m_deviceTabIndex; int m_deviceTabIndex;
DSPDeviceSourceEngine *m_deviceSourceEngine; DSPDeviceSourceEngine *m_deviceSourceEngine;
GLSpectrum *m_spectrum;
ChannelWindow *m_channelWindow;
QString m_hardwareId; QString m_hardwareId;
QString m_sampleSourceId; QString m_sampleSourceId;

View File

@ -211,7 +211,7 @@ void MainWindow::addSourceDevice()
char tabNameCStr[16]; char tabNameCStr[16];
sprintf(tabNameCStr, "R%d", deviceTabIndex); sprintf(tabNameCStr, "R%d", deviceTabIndex);
DeviceSourceAPI *deviceSourceAPI = new DeviceSourceAPI(deviceTabIndex, dspDeviceSourceEngine, m_deviceUIs.back()->m_spectrum, m_deviceUIs.back()->m_channelWindow); DeviceSourceAPI *deviceSourceAPI = new DeviceSourceAPI(deviceTabIndex, dspDeviceSourceEngine);
m_deviceUIs.back()->m_deviceSourceAPI = deviceSourceAPI; m_deviceUIs.back()->m_deviceSourceAPI = deviceSourceAPI;
m_deviceUIs.back()->m_samplingDeviceControl->setDeviceAPI(deviceSourceAPI); m_deviceUIs.back()->m_samplingDeviceControl->setDeviceAPI(deviceSourceAPI);
@ -1024,7 +1024,6 @@ void MainWindow::on_channel_addClicked(bool checked __attribute__((unused)))
if (deviceUI->m_deviceSourceEngine) // source device => Rx channels if (deviceUI->m_deviceSourceEngine) // source device => Rx channels
{ {
qDebug("MainWindow::on_channel_addClicked: channel name: %s", qPrintable(m_pluginManager->getRxChannelInstanceName(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex())));
m_pluginManager->createRxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI); m_pluginManager->createRxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI);
} }
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels

View File

@ -618,15 +618,6 @@ void PluginManager::populateTxChannelComboBox(QComboBox *channels)
} }
} }
void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI)
{
if (channelPluginIndex < m_rxChannelRegistrations.size())
{
PluginInterface *pluginInterface = m_rxChannelRegistrations[channelPluginIndex].m_plugin;
pluginInterface->createRxChannel(m_rxChannelRegistrations[channelPluginIndex].m_channelName, deviceAPI);
}
}
void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet) void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet)
{ {
if (channelPluginIndex < m_rxChannelRegistrations.size()) if (channelPluginIndex < m_rxChannelRegistrations.size())
@ -636,18 +627,6 @@ void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceUISet
} }
} }
QString PluginManager::getRxChannelInstanceName(int channelPluginIndex)
{
if (channelPluginIndex < m_rxChannelRegistrations.size())
{
return m_rxChannelRegistrations[channelPluginIndex].m_channelName;
}
else
{
return "";
}
}
void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI) void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI)
{ {
if (channelPluginIndex < m_txChannelRegistrations.size()) if (channelPluginIndex < m_txChannelRegistrations.size())

View File

@ -71,9 +71,7 @@ public:
PluginInterface* getPluginInterfaceAt(int index); PluginInterface* getPluginInterfaceAt(int index);
void populateRxChannelComboBox(QComboBox *channels); void populateRxChannelComboBox(QComboBox *channels);
void createRxChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI);
void createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet); void createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet);
QString getRxChannelInstanceName(int channelPluginIndex);
void populateTxChannelComboBox(QComboBox *channels); void populateTxChannelComboBox(QComboBox *channels);
void createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI); void createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI);