mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-14 23:43:43 -04:00
Add support for plugin presets.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "channel/channelgui.h"
|
||||
#include "mainspectrum/mainspectrumgui.h"
|
||||
#include "settings/preset.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "deviceuiset.h"
|
||||
@@ -196,6 +197,45 @@ ChannelGUI *DeviceUISet::getChannelGUIAt(int channelIndex)
|
||||
return m_channelInstanceRegistrations[channelIndex].m_gui;
|
||||
}
|
||||
|
||||
// Serialization is only used for Device and Spectrum settings in a Device preset
|
||||
// To include channels, use a Device Set preset via loadDeviceSetSettings/saveDeviceSetSettings
|
||||
|
||||
QByteArray DeviceUISet::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeBlob(1, m_deviceAPI->serialize());
|
||||
s.writeBlob(2, m_deviceGUI->serialize());
|
||||
s.writeBlob(3, m_spectrumGUI->serialize());
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool DeviceUISet::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if (!d.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
QByteArray data;
|
||||
|
||||
d.readBlob(1, &data);
|
||||
m_deviceAPI->deserialize(data);
|
||||
d.readBlob(2, &data);
|
||||
m_deviceGUI->deserialize(data);
|
||||
d.readBlob(3, &data);
|
||||
m_spectrumGUI->deserialize(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceUISet::loadDeviceSetSettings(
|
||||
const Preset* preset,
|
||||
PluginAPI *pluginAPI,
|
||||
|
||||
Reference in New Issue
Block a user