1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-06 16:05:13 -04:00

git clone git://git.osmocom.org/sdrangelove.git

This commit is contained in:
Hexameron
2014-05-18 16:52:39 +01:00
commit 7d3bfb26fc
203 changed files with 27958 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#ifndef INCLUDE_PREFERENCES_H
#define INCLUDE_PREFERENCES_H
#include <QString>
class Preferences {
public:
Preferences();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
void setSourceType(const QString& value) { m_sourceType = value; }
const QString& getSourceType() const { return m_sourceType; }
void setSourceDevice(const QString& value) { m_sourceDevice= value; }
const QString& getSourceDevice() const { return m_sourceDevice; }
void setAudioType(const QString& value) { m_audioType = value; }
const QString& getAudioType() const { return m_audioType; }
void setAudioDevice(const QString& value) { m_audioDevice= value; }
const QString& getAudioDevice() const { return m_audioDevice; }
protected:
QString m_sourceType;
QString m_sourceDevice;
QString m_audioType;
QString m_audioDevice;
};
#endif // INCLUDE_PREFERENCES_H
+98
View File
@@ -0,0 +1,98 @@
#ifndef INCLUDE_PRESET_H
#define INCLUDE_PRESET_H
#include <QString>
#include <QList>
#include <QMetaType>
class Preset {
public:
struct ChannelConfig {
QString m_channel;
QByteArray m_config;
ChannelConfig(const QString& channel, const QByteArray& config) :
m_channel(channel),
m_config(config)
{ }
};
typedef QList<ChannelConfig> ChannelConfigs;
Preset();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
void setGroup(const QString& group) { m_group = group; }
const QString& getGroup() const { return m_group; }
void setDescription(const QString& description) { m_description = description; }
const QString& getDescription() const { return m_description; }
void setCenterFrequency(const quint64 centerFrequency) { m_centerFrequency = centerFrequency; }
quint64 getCenterFrequency() const { return m_centerFrequency; }
void setSpectrumConfig(const QByteArray& data) { m_spectrumConfig = data; }
const QByteArray& getSpectrumConfig() const { return m_spectrumConfig; }
void setShowScope(bool value) { m_showScope = value; }
bool getShowScope() const { return m_showScope; }
void setLayout(const QByteArray& data) { m_layout = data; }
const QByteArray& getLayout() const { return m_layout; }
void setDCOffsetCorrection(bool value) { m_dcOffsetCorrection = value; }
bool getDCOffsetCorrection() const { return m_dcOffsetCorrection; }
void setIQImbalanceCorrection(bool value) { m_iqImbalanceCorrection = value; }
bool getIQImbalanceCorrection() const { return m_iqImbalanceCorrection; }
void setScopeConfig(const QByteArray& data) { m_scopeConfig = data; }
const QByteArray& getScopeConfig() const { return m_scopeConfig; }
void clearChannels() { m_channelConfigs.clear(); }
void addChannel(const QString& channel, const QByteArray& config) { m_channelConfigs.append(ChannelConfig(channel, config)); }
int getChannelCount() const { return m_channelConfigs.count(); }
const ChannelConfig& getChannelConfig(int index) const { return m_channelConfigs.at(index); }
void setSourceConfig(const QString& source, const QByteArray& generalConfig, const QByteArray& config)
{
m_source = source;
m_sourceGeneralConfig = generalConfig;
m_sourceConfig = config;
}
const QString& getSource() const { return m_source; }
const QByteArray& getSourceGeneralConfig() const { return m_sourceGeneralConfig; }
const QByteArray& getSourceConfig() const { return m_sourceConfig; }
protected:
// group and preset description
QString m_group;
QString m_description;
quint64 m_centerFrequency;
// general configuration
QByteArray m_spectrumConfig;
QByteArray m_scopeConfig;
// dc offset and i/q imbalance correction
bool m_dcOffsetCorrection;
bool m_iqImbalanceCorrection;
// display scope dock
bool m_showScope;
// sample source and sample source configuration
QString m_source;
QByteArray m_sourceGeneralConfig;
QByteArray m_sourceConfig;
// channels and configurations
ChannelConfigs m_channelConfigs;
// screen and dock layout
QByteArray m_layout;
};
Q_DECLARE_METATYPE(const Preset*)
#endif // INCLUDE_PRESET_H
+32
View File
@@ -0,0 +1,32 @@
#ifndef INCLUDE_SETTINGS_H
#define INCLUDE_SETTINGS_H
#include <QString>
#include "preferences.h"
#include "preset.h"
class Settings {
public:
Settings();
~Settings();
void load();
void save() const;
void resetToDefaults();
Preset* newPreset(const QString& group, const QString& description);
void deletePreset(const Preset* preset);
int getPresetCount() const { return m_presets.count(); }
const Preset* getPreset(int index) const { return m_presets[index]; }
Preset* getCurrent() { return &m_current; }
protected:
Preferences m_preferences;
Preset m_current;
typedef QList<Preset*> Presets;
Presets m_presets;
};
#endif // INCLUDE_SETTINGS_H