libdrmconf  0.9.0
A library to program DMR radios.
config.hh
1 
11 #ifndef CONFIG_HH
12 #define CONFIG_HH
13 
14 #include <QTextStream>
15 
16 #include "configobject.hh"
17 #include "contact.hh"
18 #include "rxgrouplist.hh"
19 #include "channel.hh"
20 #include "zone.hh"
21 #include "scanlist.hh"
22 #include "gpssystem.hh"
23 #include "roaming.hh"
24 #include "radioid.hh"
25 
26 
27 // Forward declaration
28 class UserDatabase;
29 
36 class Config : public ConfigObject
37 {
38  Q_OBJECT
39 
40 public:
42  explicit Config(QObject *parent = nullptr);
43 
45  bool isModified() const;
47  void setModified(bool modified);
48 
49  bool label(Context &context);
52  bool toYAML(QTextStream &stream);
53 
55  RadioIDList *radioIDs() const;
57  ContactList *contacts() const;
59  RXGroupLists *rxGroupLists() const;
61  ChannelList *channelList() const;
63  ZoneList *zones() const;
65  ScanLists *scanlists() const;
69  RoamingZoneList *roaming() const;
71  bool requiresRoaming() const;
73  bool requiresGPS() const;
74 
76  const QString &introLine1() const;
78  void setIntroLine1(const QString &line);
80  const QString &introLine2() const;
82  void setIntroLine2(const QString &line);
83 
85  uint micLevel() const;
87  void setMicLevel(uint value);
88 
90  bool speech() const;
92  void setSpeech(bool enabled);
93 
95  void reset();
96 
98  bool readCSV(const QString &filename, QString &errorMessage);
100  bool readCSV(QTextStream &stream, QString &errorMessage);
102  bool writeCSV(const QString &filename, QString &errorMessage);
104  bool writeCSV(QTextStream &stream, QString &errorMessage);
105 
106 protected:
107  bool populate(YAML::Node &node, const Context &context);
108 
109 protected slots:
111  void onConfigModified();
112 
113 protected:
115  bool _modified;
132 
134  QString _introLine1;
136  QString _introLine2;
140  bool _speech;
141 };
142 
143 #endif // CONFIG_HH
Config::isModified
bool isModified() const
Returns true if the config was modified,.
Definition: config.cc:35
Config::_rxGroupLists
RXGroupLists * _rxGroupLists
The list of RX group lists.
Definition: config.hh:121
Config::contacts
ContactList * contacts() const
Returns the list of contacts.
Definition: config.cc:143
Config::writeCSV
bool writeCSV(const QString &filename, QString &errorMessage)
Exports the configuration to the given file.
Definition: config.cc:309
Config::onConfigModified
void onConfigModified()
Iternal callback.
Definition: config.cc:284
Config::channelList
ChannelList * channelList() const
Returns the list of channels.
Definition: config.cc:153
Config::readCSV
bool readCSV(const QString &filename, QString &errorMessage)
Imports a configuration from the given file.
Definition: config.cc:290
Config::zones
ZoneList * zones() const
Returns the list of zones.
Definition: config.cc:158
Config::requiresRoaming
bool requiresRoaming() const
Returns true if one of the digital channels has a roaming zone assigned.
Definition: config.cc:178
Config::_gpsSystems
PositioningSystems * _gpsSystems
The list of GPS Systems.
Definition: config.hh:129
ContactList
Represents the list of contacts within the abstract radio configuration.
Definition: contact.hh:156
ChannelList
Container class holding all channels (analog and digital) for a specific configuration (Config).
Definition: channel.hh:443
ConfigObject
Base class for configuration objects (channels, zones, contacts, etc).
Definition: configobject.hh:17
UserDatabase
Auto-updating DMR user database.
Definition: userdatabase.hh:22
Config::_introLine1
QString _introLine1
The fist intro line.
Definition: config.hh:134
Config::_speech
bool _speech
If true, speech synthesis is enabled.
Definition: config.hh:140
ConfigObject::Context
Parse context for config objects.
Definition: configobject.hh:25
Config::_scanlists
ScanLists * _scanlists
The list of scan lists.
Definition: config.hh:127
Config::toYAML
bool toYAML(QTextStream &stream)
Serializes the configuration into the given stream as text.
Definition: config.cc:71
Config::_zones
ZoneList * _zones
The list of zones.
Definition: config.hh:125
Config::_introLine2
QString _introLine2
The second intro line.
Definition: config.hh:136
ConfigObject::serialize
virtual YAML::Node serialize(const Context &context)
Recursively serializes the configuration to YAML nodes.
Definition: configobject.cc:133
Config::micLevel
uint micLevel() const
Returns the MIC amplification level [1,10].
Definition: config.cc:235
ScanLists
Represents the list of scan lists.
Definition: scanlist.hh:102
Config::setModified
void setModified(bool modified)
Sets the modified flag.
Definition: config.cc:39
ConfigObject::modified
void modified(ConfigObject *obj)
Gets emitted once the config object is modified.
PositioningSystems
The list of positioning systems.
Definition: gpssystem.hh:255
ZoneList
Represents the list of zones within the generic configuration.
Definition: zone.hh:65
Config::_mic_level
uint _mic_level
The MIC amplification level [1-10].
Definition: config.hh:138
Config::setIntroLine1
void setIntroLine1(const QString &line)
(Re-)Sets the first intro line.
Definition: config.cc:216
RoamingZoneList
Represents the list of roaming zones within the abstract device configuration.
Definition: roaming.hh:95
Config::label
bool label(Context &context)
Recursively labels the config object.
Definition: config.cc:46
Config::_contacts
ContactList * _contacts
The list of contacts.
Definition: config.hh:119
Config::rxGroupLists
RXGroupLists * rxGroupLists() const
Returns the list of RX group lists.
Definition: config.cc:148
Config::populate
bool populate(YAML::Node &node, const Context &context)
Recursively serializes the configuration to YAML nodes.
Definition: config.cc:85
Config::setSpeech
void setSpeech(bool enabled)
Enables/disables the speech synthesis.
Definition: config.cc:252
Config::setIntroLine2
void setIntroLine2(const QString &line)
(Re-)Sets the second intro line.
Definition: config.cc:227
Config::scanlists
ScanLists * scanlists() const
Retruns the list of scanlists.
Definition: config.cc:163
Config::Config
Config(QObject *parent=nullptr)
Constructs an empty configuration.
Definition: config.cc:17
Config
The config class, representing the codeplug configuration.
Definition: config.hh:36
RXGroupLists
Represents the list of RX group lists within the generic configuration.
Definition: rxgrouplist.hh:72
Config::introLine1
const QString & introLine1() const
Returns the first intro line.
Definition: config.cc:212
Config::reset
void reset()
Clears the complete configuration.
Definition: config.cc:260
Config::introLine2
const QString & introLine2() const
Returns the second intro line.
Definition: config.cc:223
Config::speech
bool speech() const
Returns true if the speech synthesis is enabled.
Definition: config.cc:248
Config::requiresGPS
bool requiresGPS() const
Returns true if one of the channels has a GPS or APRS system assigned.
Definition: config.cc:194
Config::_roaming
RoamingZoneList * _roaming
The list of roaming zones.
Definition: config.hh:131
Config::radioIDs
RadioIDList * radioIDs() const
Returns the list of radio IDs.
Definition: config.cc:138
RadioIDList
Represents the list of configued DMR IDs (radio IDs) within the abstract config.
Definition: radioid.hh:75
Config::_channels
ChannelList * _channels
The list of channels.
Definition: config.hh:123
Config::roaming
RoamingZoneList * roaming() const
Returns the list of roaming zones.
Definition: config.cc:173
Config::_modified
bool _modified
If true, the configuration was modified.
Definition: config.hh:115
Config::posSystems
PositioningSystems * posSystems() const
Returns the list of positioning systems.
Definition: config.cc:168
Config::setMicLevel
void setMicLevel(uint value)
(Re-)Sets the MIC amplification level [1,10].
Definition: config.cc:239
Config::_radioIDs
RadioIDList * _radioIDs
The list of radio IDs.
Definition: config.hh:117