More cleanup on DeviceSourceAPI and PluginManager

pull/127/head
f4exb 2017-10-31 21:57:29 +01:00
rodzic e30050f018
commit c0afeaefa3
5 zmienionych plików z 3 dodań i 54 usunięć

Wyświetl plik

@ -20,20 +20,14 @@
#include "dsp/devicesamplesource.h"
#include "plugin/pluginapi.h"
#include "plugin/plugininterface.h"
#include "gui/glspectrum.h"
#include "gui/channelwindow.h"
#include "settings/preset.h"
#include "dsp/dspengine.h"
// TODO: extract GUI dependencies in a separate object
DeviceSourceAPI::DeviceSourceAPI(int deviceTabIndex,
DSPDeviceSourceEngine *deviceSourceEngine,
GLSpectrum *glSpectrum,
ChannelWindow *channelWindow) :
DSPDeviceSourceEngine *deviceSourceEngine) :
m_deviceTabIndex(deviceTabIndex),
m_deviceSourceEngine(deviceSourceEngine),
m_spectrum(glSpectrum),
m_channelWindow(channelWindow),
m_sampleSourceSequence(0),
m_pluginInterface(0),
m_sampleSourcePluginInstanceUI(0),
@ -128,16 +122,6 @@ void DeviceSourceAPI::configureCorrections(bool dcOffsetCorrection, bool iqImbal
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)
{
m_hardwareId = id;

Wyświetl plik

@ -25,14 +25,11 @@
#include "util/export.h"
class GLSpectrum;
class ChannelWindow;
class BasebandSampleSink;
class ThreadedBasebandSampleSink;
class DeviceSampleSource;
class MessageQueue;
class ChannelMarker;
class QWidget;
class PluginInstanceGUI;
class PluginAPI;
class PluginInterface;
@ -44,9 +41,7 @@ class SDRANGEL_API DeviceSourceAPI : public QObject {
public:
DeviceSourceAPI(int deviceTabIndex,
DSPDeviceSourceEngine *deviceSourceEngine,
GLSpectrum *glSpectrum,
ChannelWindow *channelWindow);
DSPDeviceSourceEngine *deviceSourceEngine);
~DeviceSourceAPI();
// Device engine stuff
@ -67,10 +62,6 @@ public:
MessageQueue *getSampleSourceGUIMessageQueue();
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 setSampleSourceId(const QString& id);
void resetSampleSourceId();
@ -110,8 +101,6 @@ public:
protected:
int m_deviceTabIndex;
DSPDeviceSourceEngine *m_deviceSourceEngine;
GLSpectrum *m_spectrum;
ChannelWindow *m_channelWindow;
QString m_hardwareId;
QString m_sampleSourceId;

Wyświetl plik

@ -211,7 +211,7 @@ void MainWindow::addSourceDevice()
char tabNameCStr[16];
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_samplingDeviceControl->setDeviceAPI(deviceSourceAPI);
@ -1024,7 +1024,6 @@ void MainWindow::on_channel_addClicked(bool checked __attribute__((unused)))
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);
}
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels

Wyświetl plik

@ -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)
{
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)
{
if (channelPluginIndex < m_txChannelRegistrations.size())

Wyświetl plik

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