mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
Multi device support: moved setInputGUI method from plugin API and manager classes to device API class
This commit is contained in:
parent
6747a1cae7
commit
500e809cba
@ -21,6 +21,7 @@
|
||||
#include "airspygui.h"
|
||||
#include "airspyplugin.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
const PluginDescriptor AirspyPlugin::m_pluginDescriptor = {
|
||||
@ -127,7 +128,7 @@ PluginGUI* AirspyPlugin::createSampleSourcePluginGUI(const QString& sourceId, co
|
||||
if(sourceId == m_deviceTypeID)
|
||||
{
|
||||
AirspyGui* gui = new AirspyGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <QAction>
|
||||
#include <libbladeRF.h>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "bladerfgui.h"
|
||||
#include "bladerfplugin.h"
|
||||
@ -85,7 +86,7 @@ PluginGUI* BlderfPlugin::createSampleSourcePluginGUI(const QString& sourceId, co
|
||||
if(sourceId == m_deviceTypeID)
|
||||
{
|
||||
BladerfGui* gui = new BladerfGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <QtPlugin>
|
||||
#include <QAction>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "fcdproplugin.h"
|
||||
#include "fcdprogui.h"
|
||||
@ -79,7 +80,7 @@ PluginGUI* FCDProPlugin::createSampleSourcePluginGUI(const QString& sourceId, co
|
||||
if(sourceId == fcd_traits<Pro>::interfaceIID)
|
||||
{
|
||||
FCDProGui* gui = new FCDProGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <QtPlugin>
|
||||
#include <QAction>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "fcdproplusplugin.h"
|
||||
#include "fcdproplusgui.h"
|
||||
@ -79,7 +80,7 @@ PluginGUI* FCDProPlusPlugin::createSampleSourcePluginGUI(const QString& sourceId
|
||||
if(sourceId == fcd_traits<ProPlus>::interfaceIID)
|
||||
{
|
||||
FCDProPlusGui* gui = new FCDProPlusGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <QtPlugin>
|
||||
#include <QAction>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
#include "filesourcegui.h"
|
||||
@ -72,7 +73,7 @@ PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceId
|
||||
if(sourceId == m_deviceTypeID)
|
||||
{
|
||||
FileSourceGui* gui = new FileSourceGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "hackrfgui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
const PluginDescriptor HackRFPlugin::m_pluginDescriptor = {
|
||||
@ -122,7 +123,7 @@ PluginGUI* HackRFPlugin::createSampleSourcePluginGUI(const QString& sourceId, co
|
||||
if(sourceId == m_deviceTypeID)
|
||||
{
|
||||
HackRFGui* gui = new HackRFGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <QAction>
|
||||
#include <rtl-sdr.h>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "rtlsdrplugin.h"
|
||||
#include "rtlsdrgui.h"
|
||||
@ -63,7 +64,7 @@ PluginGUI* RTLSDRPlugin::createSampleSourcePluginGUI(const QString& sourceId, co
|
||||
{
|
||||
if(sourceId == m_deviceTypeID) {
|
||||
RTLSDRGui* gui = new RTLSDRGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <QtPlugin>
|
||||
#include <QAction>
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
#include "sdrdaemongui.h"
|
||||
@ -72,7 +73,7 @@ PluginGUI* SDRdaemonPlugin::createSampleSourcePluginGUI(const QString& sourceId,
|
||||
if(sourceId == m_deviceTypeID)
|
||||
{
|
||||
SDRdaemonGui* gui = new SDRdaemonGui(m_pluginAPI, deviceAPI);
|
||||
m_pluginAPI->setInputGUI(gui, sourceDisplayName);
|
||||
deviceAPI->setInputGUI(gui, sourceDisplayName);
|
||||
return gui;
|
||||
}
|
||||
else
|
||||
|
@ -17,8 +17,15 @@
|
||||
#include "device/deviceapi.h"
|
||||
#include "gui/glspectrum.h"
|
||||
#include "gui/channelwindow.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
DeviceAPI::DeviceAPI(DSPDeviceEngine *deviceEngine, GLSpectrum *glSpectrum, ChannelWindow *channelWindow) :
|
||||
DeviceAPI::DeviceAPI(MainWindow *mainWindow,
|
||||
int deviceTabIndex,
|
||||
DSPDeviceEngine *deviceEngine,
|
||||
GLSpectrum *glSpectrum,
|
||||
ChannelWindow *channelWindow) :
|
||||
m_mainWindow(mainWindow),
|
||||
m_deviceTabIndex(deviceTabIndex),
|
||||
m_deviceEngine(deviceEngine),
|
||||
m_spectrum(glSpectrum),
|
||||
m_channelWindow(channelWindow)
|
||||
@ -124,3 +131,7 @@ void DeviceAPI::addRollupWidget(QWidget *widget)
|
||||
m_channelWindow->addRollupWidget(widget);
|
||||
}
|
||||
|
||||
void DeviceAPI::setInputGUI(QWidget* inputGUI, const QString& sourceDisplayName)
|
||||
{
|
||||
m_mainWindow->setInputGUI(m_deviceTabIndex, inputGUI, sourceDisplayName);
|
||||
}
|
||||
|
@ -55,18 +55,26 @@ public:
|
||||
MessageQueue *getDeviceInputMessageQueue();
|
||||
MessageQueue *getDeviceOutputMessageQueue();
|
||||
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections
|
||||
|
||||
void setSourceSequence(int sourceSequence);
|
||||
|
||||
// device related stuff
|
||||
GLSpectrum *getSpectrum(); //!< Direct spectrum getter
|
||||
void addChannelMarker(ChannelMarker* channelMarker); //!< Add channel marker to spectrum
|
||||
ChannelWindow *getChannelWindow(); //!< Direct channel window getter
|
||||
void addRollupWidget(QWidget *widget); //!< Add rollup widget to channel window
|
||||
void addRollupWidget(QWidget *widget); //!< Add rollup widget to channel window
|
||||
void setInputGUI(QWidget* inputGUI, const QString& sourceDisplayName);
|
||||
|
||||
protected:
|
||||
DeviceAPI(DSPDeviceEngine *deviceEngine, GLSpectrum *glSpectrum, ChannelWindow *channelWindow);
|
||||
DeviceAPI(MainWindow *mainWindow,
|
||||
int deviceTabIndex,
|
||||
DSPDeviceEngine *deviceEngine,
|
||||
GLSpectrum *glSpectrum,
|
||||
ChannelWindow *channelWindow);
|
||||
~DeviceAPI();
|
||||
|
||||
MainWindow *m_mainWindow;
|
||||
int m_deviceTabIndex;
|
||||
DSPDeviceEngine *m_deviceEngine;
|
||||
GLSpectrum *m_spectrum;
|
||||
ChannelWindow *m_channelWindow;
|
||||
|
@ -198,7 +198,7 @@ void MainWindow::addDevice()
|
||||
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
|
||||
m_deviceUIs.back()->m_deviceEngine = dspDeviceEngine;
|
||||
|
||||
DeviceAPI *deviceAPI = new DeviceAPI(dspDeviceEngine, m_deviceUIs.back()->m_spectrum, m_deviceUIs.back()->m_channelWindow);
|
||||
DeviceAPI *deviceAPI = new DeviceAPI(this, m_deviceUIs.size()-1, dspDeviceEngine, m_deviceUIs.back()->m_spectrum, m_deviceUIs.back()->m_channelWindow);
|
||||
m_deviceUIs.back()->m_deviceAPI = deviceAPI;
|
||||
|
||||
// TODO: do not create one plugin manager per device. Use device API instead
|
||||
|
@ -8,11 +8,6 @@ MessageQueue* PluginAPI::getMainWindowMessageQueue()
|
||||
return m_mainWindow->getInputMessageQueue();
|
||||
}
|
||||
|
||||
void PluginAPI::setInputGUI(QWidget* inputGUI, const QString& sourceDisplayName)
|
||||
{
|
||||
m_pluginManager->setInputGUI(inputGUI, sourceDisplayName);
|
||||
}
|
||||
|
||||
void PluginAPI::registerChannel(const QString& channelName, PluginInterface* plugin)
|
||||
{
|
||||
m_pluginManager->registerChannel(channelName, plugin);
|
||||
|
@ -18,7 +18,6 @@ class SDRANGEL_API PluginAPI : public QObject {
|
||||
public:
|
||||
// MainWindow access
|
||||
MessageQueue* getMainWindowMessageQueue();
|
||||
void setInputGUI(QWidget* inputGUI, const QString& sourceDisplayName);
|
||||
|
||||
// Channel stuff
|
||||
void registerChannel(const QString& channelName, PluginInterface* plugin);
|
||||
|
@ -85,12 +85,6 @@ void PluginManager::registerSampleSource(const QString& sourceName, PluginInterf
|
||||
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
|
||||
}
|
||||
|
||||
void PluginManager::setInputGUI(QWidget* gui, const QString& sourceDisplayName)
|
||||
{
|
||||
//m_mainWindow->setInputGUI(gui);
|
||||
m_mainWindow->setInputGUI(m_deviceTabIndex, gui, sourceDisplayName);
|
||||
}
|
||||
|
||||
void PluginManager::loadSettings(const Preset* preset, DeviceAPI *deviceAPI)
|
||||
{
|
||||
fprintf(stderr, "PluginManager::loadSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
@ -321,7 +315,8 @@ int PluginManager::selectSampleSourceByIndex(int index, DeviceAPI *deviceAPI)
|
||||
<< " ser: " << m_sampleSourceSerial.toStdString().c_str()
|
||||
<< " seq: " << m_sampleSourceSequence;
|
||||
|
||||
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, m_sampleSourceDevices[index].m_displayName, deviceAPI);
|
||||
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, m_sampleSourceDevices[index].m_displayName, deviceAPI);
|
||||
m_sampleSourcePluginGUI = pluginGUI;
|
||||
deviceAPI->setSourceSequence(m_sampleSourceSequence);
|
||||
|
||||
return index;
|
||||
@ -375,7 +370,9 @@ int PluginManager::selectFirstSampleSource(const QString& sourceId, DeviceAPI *d
|
||||
<< " ser: " << m_sampleSourceSerial.toStdString().c_str()
|
||||
<< " seq: " << m_sampleSourceSequence;
|
||||
|
||||
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, m_sampleSourceDevices[index].m_displayName, deviceAPI);
|
||||
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, m_sampleSourceDevices[index].m_displayName, deviceAPI);
|
||||
m_sampleSourcePluginGUI = pluginGUI;
|
||||
deviceAPI->setSourceSequence(m_sampleSourceSequence);
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -442,7 +439,9 @@ int PluginManager::selectSampleSourceBySerialOrSequence(const QString& sourceId,
|
||||
<< " ser: " << qPrintable(m_sampleSourceSerial)
|
||||
<< " seq: " << m_sampleSourceSequence;
|
||||
|
||||
m_sampleSourcePluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, m_sampleSourceDevices[index].m_displayName, deviceAPI);
|
||||
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceId, m_sampleSourceDevices[index].m_displayName, deviceAPI);
|
||||
m_sampleSourcePluginGUI = pluginGUI;
|
||||
deviceAPI->setSourceSequence(m_sampleSourceSequence);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
@ -47,8 +47,6 @@ public:
|
||||
void removeChannelInstance(PluginGUI* pluginGUI);
|
||||
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
|
||||
|
||||
void setInputGUI(QWidget* gui, const QString& sourceDisplayName);
|
||||
|
||||
void loadSettings(const Preset* preset, DeviceAPI *deviceAPI);
|
||||
void loadSourceSettings(const Preset* preset);
|
||||
void saveSettings(Preset* preset);
|
||||
|
Loading…
Reference in New Issue
Block a user