mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-18 23:55:50 -05:00
Multi device support: migrated channel registration objects to plugin API
This commit is contained in:
parent
a9cda881d6
commit
6840a20ab9
@ -199,6 +199,18 @@ void DeviceAPI::saveSourceSettings(Preset* preset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceAPI::saveChannelSettings(Preset *preset)
|
||||||
|
{
|
||||||
|
qDebug("DeviceAPI::saveChannelSettings");
|
||||||
|
|
||||||
|
qSort(m_channelInstanceRegistrations.begin(), m_channelInstanceRegistrations.end()); // sort by increasing delta frequency and type
|
||||||
|
|
||||||
|
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||||
|
{
|
||||||
|
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_gui->serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sort by increasing delta frequency and type (i.e. name)
|
// sort by increasing delta frequency and type (i.e. name)
|
||||||
bool DeviceAPI::ChannelInstanceRegistration::operator<(const ChannelInstanceRegistration& other) const
|
bool DeviceAPI::ChannelInstanceRegistration::operator<(const ChannelInstanceRegistration& other) const
|
||||||
{
|
{
|
||||||
|
@ -73,6 +73,7 @@ public:
|
|||||||
|
|
||||||
void loadSourceSettings(const Preset* preset);
|
void loadSourceSettings(const Preset* preset);
|
||||||
void saveSourceSettings(Preset* preset);
|
void saveSourceSettings(Preset* preset);
|
||||||
|
void saveChannelSettings(Preset* preset);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct ChannelInstanceRegistration
|
struct ChannelInstanceRegistration
|
||||||
|
@ -316,7 +316,7 @@ void MainWindow::loadPresetSettings(const Preset* preset)
|
|||||||
{
|
{
|
||||||
DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex];
|
DeviceUISet *deviceUI = m_deviceUIs[currentSourceTabIndex];
|
||||||
deviceUI->m_spectrumGUI->deserialize(preset->getSpectrumConfig());
|
deviceUI->m_spectrumGUI->deserialize(preset->getSpectrumConfig());
|
||||||
deviceUI->m_pluginManager->loadSettings(preset, deviceUI->m_deviceAPI);
|
deviceUI->m_pluginManager->loadChannelSettings(preset, deviceUI->m_deviceAPI);
|
||||||
deviceUI->m_deviceAPI->loadSourceSettings(preset);
|
deviceUI->m_deviceAPI->loadSourceSettings(preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define INCLUDE_PLUGINAPI_H
|
#define INCLUDE_PLUGINAPI_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
#include "util/export.h"
|
#include "util/export.h"
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
@ -16,6 +18,18 @@ class SDRANGEL_API PluginAPI : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
struct ChannelRegistration
|
||||||
|
{
|
||||||
|
QString m_channelName;
|
||||||
|
PluginInterface* m_plugin;
|
||||||
|
ChannelRegistration(const QString& channelName, PluginInterface* plugin) :
|
||||||
|
m_channelName(channelName),
|
||||||
|
m_plugin(plugin)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef QList<ChannelRegistration> ChannelRegistrations;
|
||||||
|
|
||||||
// MainWindow access
|
// MainWindow access
|
||||||
MessageQueue* getMainWindowMessageQueue();
|
MessageQueue* getMainWindowMessageQueue();
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void PluginManager::loadPlugins()
|
|||||||
|
|
||||||
void PluginManager::registerChannel(const QString& channelName, PluginInterface* plugin)
|
void PluginManager::registerChannel(const QString& channelName, PluginInterface* plugin)
|
||||||
{
|
{
|
||||||
m_channelRegistrations.append(ChannelRegistration(channelName, plugin));
|
m_channelRegistrations.append(PluginAPI::ChannelRegistration(channelName, plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManager::registerChannelInstance(const QString& channelName, PluginGUI* pluginGUI)
|
void PluginManager::registerChannelInstance(const QString& channelName, PluginGUI* pluginGUI)
|
||||||
@ -85,7 +85,7 @@ void PluginManager::registerSampleSource(const QString& sourceName, PluginInterf
|
|||||||
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
|
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManager::loadSettings(const Preset* preset, DeviceAPI *deviceAPI)
|
void PluginManager::loadChannelSettings(const Preset* preset, DeviceAPI *deviceAPI)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "PluginManager::loadSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
fprintf(stderr, "PluginManager::loadSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ void PluginManager::renameChannelInstances()
|
|||||||
|
|
||||||
void PluginManager::populateChannelComboBox(QComboBox *channels)
|
void PluginManager::populateChannelComboBox(QComboBox *channels)
|
||||||
{
|
{
|
||||||
for(ChannelRegistrations::iterator it = m_channelRegistrations.begin(); it != m_channelRegistrations.end(); ++it)
|
for(PluginAPI::ChannelRegistrations::iterator it = m_channelRegistrations.begin(); it != m_channelRegistrations.end(); ++it)
|
||||||
{
|
{
|
||||||
const PluginDescriptor& pluginDescipror = it->m_plugin->getPluginDescriptor();
|
const PluginDescriptor& pluginDescipror = it->m_plugin->getPluginDescriptor();
|
||||||
channels->addItem(pluginDescipror.displayedName);
|
channels->addItem(pluginDescipror.displayedName);
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
void removeChannelInstance(PluginGUI* pluginGUI);
|
void removeChannelInstance(PluginGUI* pluginGUI);
|
||||||
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
|
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
|
||||||
|
|
||||||
void loadSettings(const Preset* preset, DeviceAPI *deviceAPI);
|
void loadChannelSettings(const Preset* preset, DeviceAPI *deviceAPI);
|
||||||
// void loadSourceSettings(const Preset* preset);
|
// void loadSourceSettings(const Preset* preset);
|
||||||
void saveSettings(Preset* preset);
|
void saveSettings(Preset* preset);
|
||||||
// void saveSourceSettings(Preset* preset);
|
// void saveSourceSettings(Preset* preset);
|
||||||
@ -67,16 +67,6 @@ public:
|
|||||||
void createChannelInstance(int channelPluginIndex, DeviceAPI *deviceAPI);
|
void createChannelInstance(int channelPluginIndex, DeviceAPI *deviceAPI);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ChannelRegistration {
|
|
||||||
QString m_channelName;
|
|
||||||
PluginInterface* m_plugin;
|
|
||||||
ChannelRegistration(const QString& channelName, PluginInterface* plugin) :
|
|
||||||
m_channelName(channelName),
|
|
||||||
m_plugin(plugin)
|
|
||||||
{ }
|
|
||||||
};
|
|
||||||
typedef QList<ChannelRegistration> ChannelRegistrations;
|
|
||||||
|
|
||||||
struct ChannelInstanceRegistration {
|
struct ChannelInstanceRegistration {
|
||||||
QString m_channelName;
|
QString m_channelName;
|
||||||
PluginGUI* m_gui;
|
PluginGUI* m_gui;
|
||||||
@ -129,7 +119,7 @@ private:
|
|||||||
DSPDeviceEngine* m_dspDeviceEngine;
|
DSPDeviceEngine* m_dspDeviceEngine;
|
||||||
Plugins m_plugins;
|
Plugins m_plugins;
|
||||||
|
|
||||||
ChannelRegistrations m_channelRegistrations; //!< Channel plugins register here
|
PluginAPI::ChannelRegistrations m_channelRegistrations; //!< Channel plugins register here
|
||||||
ChannelInstanceRegistrations m_channelInstanceRegistrations; // TODO: remove
|
ChannelInstanceRegistrations m_channelInstanceRegistrations; // TODO: remove
|
||||||
SampleSourceRegistrations m_sampleSourceRegistrations; //!< Input source plugins (one per device kind) register here
|
SampleSourceRegistrations m_sampleSourceRegistrations; //!< Input source plugins (one per device kind) register here
|
||||||
SampleSourceDevices m_sampleSourceDevices; //!< Instances of input sources present in the system
|
SampleSourceDevices m_sampleSourceDevices; //!< Instances of input sources present in the system
|
||||||
|
Loading…
Reference in New Issue
Block a user