libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
config.hh
1
38#ifndef CONFIG_HH
39#define CONFIG_HH
40
41#include <QTextStream>
42
43#include "configobject.hh"
44#include "contact.hh"
45#include "rxgrouplist.hh"
46#include "channel.hh"
47#include "zone.hh"
48#include "scanlist.hh"
49#include "gpssystem.hh"
50#include "roamingchannel.hh"
51#include "roamingzone.hh"
52#include "radioid.hh"
53#include "radiosettings.hh"
54
55#include "commercial_extension.hh"
56#include "smsextension.hh"
57#include "tyt_extensions.hh"
58
59// Forward declaration
60class UserDatabase;
61
62
69class Config : public ConfigItem
70{
71 Q_OBJECT
72
74 Q_PROPERTY(RadioSettings* settings READ settings SCRIPTABLE false)
76 Q_PROPERTY(RadioIDList* radioIDs READ radioIDs SCRIPTABLE false)
78 Q_PROPERTY(ContactList* contacts READ contacts SCRIPTABLE false)
80 Q_PROPERTY(RXGroupLists* groupLists READ rxGroupLists SCRIPTABLE false)
82 Q_PROPERTY(ChannelList* channels READ channelList SCRIPTABLE false)
84 Q_PROPERTY(ZoneList* zones READ zones SCRIPTABLE false)
86 Q_PROPERTY(ScanLists* scanLists READ scanlists SCRIPTABLE false)
88 Q_PROPERTY(PositioningSystems* positioning READ posSystems SCRIPTABLE false)
90 Q_PROPERTY(RoamingChannelList* roamingChannels READ roamingChannels SCRIPTABLE false)
92 Q_PROPERTY(RoamingZoneList* roamingZones READ roamingZones SCRIPTABLE false)
93
97 Q_PROPERTY(SMSExtension *sms READ smsExtension)
100
101public:
103 Q_INVOKABLE explicit Config(QObject *parent = nullptr);
104
105 bool copy(const ConfigItem &other);
106 ConfigItem *clone() const;
107
109 bool isModified() const;
111 void setModified(bool modified);
112
114 RadioSettings *settings() const;
116 RadioIDList *radioIDs() const;
118 ContactList *contacts() const;
120 RXGroupLists *rxGroupLists() const;
122 ChannelList *channelList() const;
124 ZoneList *zones() const;
126 ScanLists *scanlists() const;
133
135 bool requiresRoaming() const;
137 bool requiresGPS() const;
138
140 void clear();
141
142 const Config *config() const;
143
147 SMSExtension *smsExtension() const;
148
154
155
156public:
158 bool readCSV(const QString &filename, QString &errorMessage);
160 bool readCSV(QTextStream &stream, QString &errorMessage);
161
163 bool readYAML(const QString &filename, const ErrorStack &err=ErrorStack());
164
165 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
166 bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());
167
168public:
170 bool toYAML(QTextStream &stream, const ErrorStack &err=ErrorStack());
171
172protected:
173 bool populate(YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack());
174
175protected slots:
177 void onConfigModified();
178
179protected:
208};
209
210#endif // CONFIG_HH
Container class holding all channels (analog and digital) for a specific configuration (Config).
Definition channel.hh:548
Implements the generic extension for the codeplug to represent some commercial features of DMR.
Definition commercial_extension.hh:11
Parse context for config objects.
Definition configobject.hh:48
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:40
void modified(ConfigItem *obj)
Gets emitted once the config object is modified.
The config class, representing the codeplug configuration.
Definition config.hh:70
RoamingZoneList * _roamingZones
The list of roaming zones.
Definition config.hh:201
ContactList * _contacts
The list of contacts.
Definition config.hh:187
bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack())
Links the given object to the rest of the codeplug using the given context.
Definition config.cc:423
ScanLists * scanLists
The list of scan lists.
Definition config.hh:86
TyTConfigExtension * tytExtension
Represents the config extension for TyT devices.
Definition config.hh:99
bool copy(const ConfigItem &other)
Copies the given item into this one.
Definition config.cc:64
ScanLists * _scanlists
The list of scan lists.
Definition config.hh:195
RoamingChannelList * roamingChannels
The list of roaming channels.
Definition config.hh:90
RoamingChannelList * _roamingChannels
The list of roaming channels.
Definition config.hh:199
ContactList * contacts
The list of contacts.
Definition config.hh:78
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack())
Parses the given YAML node, updates the given object and updates the given context (IDs).
Definition config.cc:374
void onConfigModified()
Iternal callback.
Definition config.cc:311
bool readYAML(const QString &filename, const ErrorStack &err=ErrorStack())
Imports a configuration from the given YAML file.
Definition config.cc:337
RXGroupLists * rxGroupLists() const
Returns the list of RX group lists.
Definition config.cc:184
RadioSettings * _settings
Radio wide settings.
Definition config.hh:183
RadioIDList * _radioIDs
The list of radio IDs.
Definition config.hh:185
bool requiresGPS() const
Returns true if one of the channels has a GPS or APRS system assigned.
Definition config.cc:235
SMSExtension * _smsExtension
Owns the SMS settings extension.
Definition config.hh:207
ChannelList * channels
The list of channels.
Definition config.hh:82
bool populate(YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition config.cc:120
RXGroupLists * groupLists
The list of group lists.
Definition config.hh:80
void clear()
Clears the complete configuration.
Definition config.cc:252
RoamingZoneList * roamingZones
The list of roaming zones.
Definition config.hh:92
ChannelList * channelList() const
Returns the list of channels.
Definition config.cc:189
CommercialExtension * commercial
Represents the config extension for encryption keys.
Definition config.hh:95
TyTConfigExtension * _tytExtension
Owns the TyT settings extension.
Definition config.hh:203
RadioIDList * radioIDs
The list of radio IDs.
Definition config.hh:76
bool toYAML(QTextStream &stream, const ErrorStack &err=ErrorStack())
Serializes the configuration into the given stream as text.
Definition config.cc:103
PositioningSystems * positioning
The list of positioning systems.
Definition config.hh:88
ConfigItem * clone() const
Clones this item.
Definition config.cc:84
ZoneList * _zones
The list of zones.
Definition config.hh:193
ScanLists * scanlists() const
Returns the list of scanlists.
Definition config.cc:199
CommercialExtension * commercialExtension() const
Returns the commercial extension.
Definition config.cc:284
ChannelList * _channels
The list of channels.
Definition config.hh:191
SMSExtension * smsExtension() const
Returns the SMS settings extension.
Definition config.cc:289
const Config * config() const
Returns the config, the item belongs to or nullptr if not part of a config.
Definition config.cc:278
PositioningSystems * posSystems() const
Returns the list of positioning systems.
Definition config.cc:204
bool requiresRoaming() const
Returns true if one of the digital channels has a roaming zone assigned.
Definition config.cc:219
PositioningSystems * _gpsSystems
The list of GPS Systems.
Definition config.hh:197
ZoneList * zones
The list of zones.
Definition config.hh:84
SMSExtension * sms
Represents the extended SMS settings.
Definition config.hh:97
void setTyTExtension(TyTConfigExtension *ext)
Sets the TyT settings extension.
Definition config.cc:298
bool readCSV(const QString &filename, QString &errorMessage)
Imports a configuration from the given file.
Definition config.cc:317
RadioSettings * settings
The global radio settings.
Definition config.hh:74
void setModified(bool modified)
Sets the modified flag.
Definition config.cc:98
bool _modified
If true, the configuration was modified.
Definition config.hh:181
bool isModified() const
Returns true if the config was modified,.
Definition config.cc:94
CommercialExtension * _commercialExtension
Owns the commercial extension.
Definition config.hh:205
RXGroupLists * _rxGroupLists
The list of RX group lists.
Definition config.hh:189
Represents the list of contacts within the abstract radio configuration.
Definition contact.hh:223
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
The list of positioning systems.
Definition gpssystem.hh:286
Represents the list of RX group lists within the generic configuration.
Definition rxgrouplist.hh:68
Represents the list of configured DMR IDs (radio IDs) within the abstract config.
Definition radioid.hh:125
Represents the common radio-global settings.
Definition radiosettings.hh:15
Represents the list of roaming channels within the abstract device configuration.
Definition roamingchannel.hh:99
Represents the list of roaming zones within the abstract device configuration.
Definition roamingzone.hh:103
Extension collecting all settings associated with SMS messages.
Definition smsextension.hh:55
Represents the list of scan lists.
Definition scanlist.hh:112
Groups several extension for TyT devices.
Definition tyt_extensions.hh:1023
Auto-updating DMR user database.
Definition userdatabase.hh:23
Represents the list of zones within the generic configuration.
Definition zone.hh:75