2015-10-02 02:04:38 +00:00
|
|
|
#ifndef INCLUDE_SETTINGS_H
|
|
|
|
#define INCLUDE_SETTINGS_H
|
|
|
|
|
2022-03-20 11:23:50 +00:00
|
|
|
#include <QObject>
|
2015-10-02 02:04:38 +00:00
|
|
|
#include <QString>
|
2019-06-12 16:50:53 +00:00
|
|
|
#include "device/deviceuserargs.h"
|
2015-10-02 02:04:38 +00:00
|
|
|
#include "preferences.h"
|
|
|
|
#include "preset.h"
|
2020-09-24 03:38:05 +00:00
|
|
|
#include "featuresetpreset.h"
|
2022-04-05 14:26:57 +00:00
|
|
|
#include "configuration.h"
|
2018-03-20 12:49:21 +00:00
|
|
|
#include "export.h"
|
2020-09-08 14:47:20 +00:00
|
|
|
#include "plugin/pluginmanager.h"
|
2015-10-02 02:04:38 +00:00
|
|
|
|
2018-01-04 10:11:53 +00:00
|
|
|
class Command;
|
2019-07-20 21:25:00 +00:00
|
|
|
class AudioDeviceManager;
|
2018-01-04 10:11:53 +00:00
|
|
|
|
2020-09-08 14:47:20 +00:00
|
|
|
|
2022-03-20 11:23:50 +00:00
|
|
|
class SDRBASE_API MainSettings : public QObject {
|
|
|
|
Q_OBJECT
|
2015-10-02 02:04:38 +00:00
|
|
|
public:
|
|
|
|
MainSettings();
|
|
|
|
~MainSettings();
|
|
|
|
|
2020-09-24 03:38:05 +00:00
|
|
|
void load();
|
|
|
|
void save() const;
|
2015-10-02 02:04:38 +00:00
|
|
|
|
|
|
|
void resetToDefaults();
|
2019-08-06 06:48:14 +00:00
|
|
|
void initialize();
|
2019-01-17 10:22:38 +00:00
|
|
|
QString getFileLocation() const;
|
2019-01-17 10:17:28 +00:00
|
|
|
int getFileFormat() const; //!< see QSettings::Format for the values
|
2015-10-02 02:04:38 +00:00
|
|
|
|
2019-08-01 00:16:56 +00:00
|
|
|
const Preferences& getPreferences() const { return m_preferences; }
|
2019-08-06 06:48:14 +00:00
|
|
|
void setPreferences(const Preferences& preferences) { m_preferences = preferences; }
|
2019-08-01 00:16:56 +00:00
|
|
|
|
2015-10-02 02:04:38 +00:00
|
|
|
Preset* newPreset(const QString& group, const QString& description);
|
2019-08-06 06:48:14 +00:00
|
|
|
void addPreset(Preset *preset);
|
2015-10-02 02:04:38 +00:00
|
|
|
void deletePreset(const Preset* preset);
|
2022-05-08 17:33:10 +00:00
|
|
|
QByteArray serializePreset(const Preset* preset) const;
|
|
|
|
bool deserializePreset(const QByteArray& blob, Preset* preset);
|
2015-10-02 02:04:38 +00:00
|
|
|
int getPresetCount() const { return m_presets.count(); }
|
|
|
|
const Preset* getPreset(int index) const { return m_presets[index]; }
|
2019-05-08 23:12:40 +00:00
|
|
|
const Preset* getPreset(const QString& groupName, quint64 centerFrequency, const QString& description, const QString& type) const;
|
2016-09-11 16:58:40 +00:00
|
|
|
void sortPresets();
|
2018-01-05 10:45:20 +00:00
|
|
|
void renamePresetGroup(const QString& oldGroupName, const QString& newGroupName);
|
2018-01-06 19:02:08 +00:00
|
|
|
void deletePresetGroup(const QString& groupName);
|
2019-08-06 06:48:14 +00:00
|
|
|
void clearPresets();
|
2020-09-24 03:38:05 +00:00
|
|
|
const Preset& getWorkingPresetConst() const { return m_workingPreset; }
|
|
|
|
Preset* getWorkingPreset() { return &m_workingPreset; }
|
2022-04-13 16:43:37 +00:00
|
|
|
QList<Preset*> *getPresets() { return &m_presets; }
|
2015-10-02 02:04:38 +00:00
|
|
|
|
2018-01-04 10:11:53 +00:00
|
|
|
void addCommand(Command *command);
|
|
|
|
void deleteCommand(const Command* command);
|
|
|
|
int getCommandCount() const { return m_commands.count(); }
|
|
|
|
const Command* getCommand(int index) const { return m_commands[index]; }
|
|
|
|
const Command* getCommand(const QString& groupName, const QString& description) const;
|
|
|
|
void sortCommands();
|
2018-01-05 10:45:20 +00:00
|
|
|
void renameCommandGroup(const QString& oldGroupName, const QString& newGroupName);
|
2018-01-06 19:02:08 +00:00
|
|
|
void deleteCommandGroup(const QString& groupName);
|
2019-08-06 06:48:14 +00:00
|
|
|
void clearCommands();
|
2018-01-04 10:11:53 +00:00
|
|
|
|
2020-09-24 03:38:05 +00:00
|
|
|
FeatureSetPreset* newFeatureSetPreset(const QString& group, const QString& description);
|
|
|
|
void addFeatureSetPreset(FeatureSetPreset *preset);
|
|
|
|
void deleteFeatureSetPreset(const FeatureSetPreset* preset);
|
|
|
|
int getFeatureSetPresetCount() const { return m_featureSetPresets.count(); }
|
|
|
|
const FeatureSetPreset* getFeatureSetPreset(int index) const { return m_featureSetPresets[index]; }
|
|
|
|
const FeatureSetPreset* getFeatureSetPreset(const QString& groupName, const QString& description) const;
|
|
|
|
void sortFeatureSetPresets();
|
|
|
|
void renameFeatureSetPresetGroup(const QString& oldGroupName, const QString& newGroupName);
|
|
|
|
void deleteFeatureSetPresetGroup(const QString& groupName);
|
|
|
|
void clearFeatureSetPresets();
|
|
|
|
const FeatureSetPreset& getWorkingFeatureSetPresetConst() const { return m_workingFeatureSetPreset; }
|
|
|
|
FeatureSetPreset* getWorkingFeatureSetPreset() { return &m_workingFeatureSetPreset; }
|
|
|
|
QList<FeatureSetPreset*> *getFeatureSetPresets() { return &m_featureSetPresets; }
|
|
|
|
|
2022-04-05 14:26:57 +00:00
|
|
|
Configuration* newConfiguration(const QString& group, const QString& description);
|
|
|
|
void addConfiguration(Configuration *configuration);
|
|
|
|
void deleteConfiguration(const Configuration *configuration);
|
2022-05-08 17:33:10 +00:00
|
|
|
QByteArray serializeConfiguration(const Configuration *configuration) const;
|
|
|
|
bool deserializeConfiguration(const QByteArray& blob, Configuration *configuration);
|
2022-04-05 14:26:57 +00:00
|
|
|
int getConfigurationCount() const { return m_configurations.size(); }
|
|
|
|
const Configuration* getConfiguration(int index) const { return m_configurations[index]; }
|
|
|
|
const Configuration* getConfiguration(const QString& groupName, const QString& description) const;
|
|
|
|
void sortConfigurations();
|
|
|
|
void renameConfigurationGroup(const QString& oldGroupName, const QString& newGroupName);
|
|
|
|
void deleteConfigurationGroup(const QString& groupName);
|
|
|
|
void clearConfigurations();
|
|
|
|
const Configuration& getWorkingConfigurationConst() const { return m_workingConfiguration; }
|
|
|
|
Configuration* getWorkingConfiguration() { return &m_workingConfiguration; }
|
|
|
|
QList<Configuration*> *getConfigurations() { return &m_configurations; }
|
|
|
|
|
2022-03-20 11:23:50 +00:00
|
|
|
const QString& getSourceDevice() const { return m_preferences.getSourceDevice(); }
|
|
|
|
void setSourceDevice(const QString& value)
|
|
|
|
{
|
|
|
|
m_preferences.setSourceDevice(value);
|
|
|
|
emit preferenceChanged(Preferences::SourceDevice);
|
|
|
|
}
|
|
|
|
|
2015-10-02 02:04:38 +00:00
|
|
|
int getSourceIndex() const { return m_preferences.getSourceIndex(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setSourceIndex(int value)
|
|
|
|
{
|
|
|
|
m_preferences.setSourceIndex(value);
|
|
|
|
emit preferenceChanged(Preferences::SourceIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
int getSourceItemIndex() const { return m_preferences.getSourceItemIndex(); }
|
|
|
|
void setSourceItemIndex(int value)
|
|
|
|
{
|
|
|
|
m_preferences.setSourceItemIndex(value);
|
|
|
|
emit preferenceChanged(Preferences::SourceItemIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString& getAudioType() const { return m_preferences.getAudioType(); }
|
|
|
|
void setAudioType(const QString& value)
|
|
|
|
{
|
|
|
|
m_preferences.setAudioType(value);
|
|
|
|
emit preferenceChanged(Preferences::AudioType);
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString& getAudioDevice() const { return m_preferences.getAudioDevice(); }
|
|
|
|
void setAudioDevice(const QString& value)
|
|
|
|
{
|
|
|
|
m_preferences.setAudioDevice(value);
|
|
|
|
emit preferenceChanged(Preferences::AudioDevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString getStationName() const { return m_preferences.getStationName(); }
|
|
|
|
void setStationName(const QString& name)
|
|
|
|
{
|
|
|
|
m_preferences.setStationName(name);
|
|
|
|
emit preferenceChanged(Preferences::StationName);
|
|
|
|
}
|
|
|
|
|
2016-09-28 11:38:38 +00:00
|
|
|
float getLatitude() const { return m_preferences.getLatitude(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setLatitude(float latitude)
|
|
|
|
{
|
|
|
|
m_preferences.setLatitude(latitude);
|
|
|
|
emit preferenceChanged(Preferences::Latitude);
|
|
|
|
}
|
|
|
|
|
2016-09-28 11:38:38 +00:00
|
|
|
float getLongitude() const { return m_preferences.getLongitude(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setLongitude(float longitude)
|
|
|
|
{
|
|
|
|
m_preferences.setLongitude(longitude);
|
|
|
|
emit preferenceChanged(Preferences::Longitude);
|
|
|
|
}
|
|
|
|
|
2020-10-27 16:22:10 +00:00
|
|
|
float getAltitude() const { return m_preferences.getAltitude(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setAltitude(float altitude)
|
|
|
|
{
|
|
|
|
m_preferences.setAltitude(altitude);
|
|
|
|
emit preferenceChanged(Preferences::Altitude);
|
|
|
|
}
|
2016-09-28 11:38:38 +00:00
|
|
|
|
2017-11-12 01:23:55 +00:00
|
|
|
QtMsgType getConsoleMinLogLevel() const { return m_preferences.getConsoleMinLogLevel(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setConsoleMinLogLevel(const QtMsgType& minLogLevel)
|
|
|
|
{
|
|
|
|
m_preferences.setConsoleMinLogLevel(minLogLevel);
|
|
|
|
emit preferenceChanged(Preferences::ConsoleMinLogLevel);
|
|
|
|
}
|
|
|
|
|
2017-11-12 01:23:55 +00:00
|
|
|
QtMsgType getFileMinLogLevel() const { return m_preferences.getFileMinLogLevel(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setFileMinLogLevel(const QtMsgType& minLogLevel)
|
|
|
|
{
|
|
|
|
m_preferences.setFileMinLogLevel(minLogLevel);
|
|
|
|
emit preferenceChanged(Preferences::FileMinLogLevel);
|
|
|
|
}
|
|
|
|
|
2017-11-11 18:26:23 +00:00
|
|
|
bool getUseLogFile() const { return m_preferences.getUseLogFile(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setUseLogFile(bool useLogFile)
|
|
|
|
{
|
|
|
|
m_preferences.setUseLogFile(useLogFile);
|
|
|
|
emit preferenceChanged(Preferences::UseLogFile);
|
|
|
|
}
|
|
|
|
|
2017-11-11 18:26:23 +00:00
|
|
|
const QString& getLogFileName() const { return m_preferences.getLogFileName(); }
|
2022-03-20 11:23:50 +00:00
|
|
|
void setLogFileName(const QString& value)
|
|
|
|
{
|
|
|
|
m_preferences.setLogFileName(value);
|
|
|
|
emit preferenceChanged(Preferences::LogFileName);
|
|
|
|
}
|
|
|
|
|
2019-06-12 16:50:53 +00:00
|
|
|
DeviceUserArgs& getDeviceUserArgs() { return m_hardwareDeviceUserArgs; }
|
2018-03-23 17:08:38 +00:00
|
|
|
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
|
|
|
|
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
|
2017-01-06 17:56:46 +00:00
|
|
|
|
2022-03-20 11:23:50 +00:00
|
|
|
signals:
|
|
|
|
void preferenceChanged(int);
|
|
|
|
|
2015-10-02 02:04:38 +00:00
|
|
|
protected:
|
|
|
|
Preferences m_preferences;
|
2018-03-23 17:08:38 +00:00
|
|
|
AudioDeviceManager *m_audioDeviceManager;
|
2015-10-02 02:04:38 +00:00
|
|
|
Preset m_workingPreset;
|
|
|
|
typedef QList<Preset*> Presets;
|
|
|
|
Presets m_presets;
|
2018-01-04 10:11:53 +00:00
|
|
|
typedef QList<Command*> Commands;
|
|
|
|
Commands m_commands;
|
2022-04-05 14:26:57 +00:00
|
|
|
FeatureSetPreset m_workingFeatureSetPreset;
|
2020-09-24 03:38:05 +00:00
|
|
|
typedef QList<FeatureSetPreset*> FeatureSetPresets;
|
|
|
|
FeatureSetPresets m_featureSetPresets;
|
2022-04-05 14:26:57 +00:00
|
|
|
Configuration m_workingConfiguration;
|
|
|
|
typedef QList<Configuration*> Configurations;
|
|
|
|
Configurations m_configurations;
|
2019-06-12 16:50:53 +00:00
|
|
|
DeviceUserArgs m_hardwareDeviceUserArgs;
|
2015-10-02 02:04:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_SETTINGS_H
|