libdrmconf  0.10.4
A library to program DMR radios.
roaming.hh
1 #ifndef ROAMINGZONE_HH
2 #define ROAMINGZONE_HH
3 
4 #include <QAbstractListModel>
5 #include "configreference.hh"
6 
7 
14 class RoamingZone : public ConfigObject
15 {
16  Q_OBJECT
17 
19  Q_PROPERTY(DMRChannelRefList * channels READ channels)
20 
21 public:
23  explicit RoamingZone(QObject *parent=nullptr);
24 
28  RoamingZone(const QString &name, QObject *parent = nullptr);
29 
31  RoamingZone &operator =(const RoamingZone &other);
32  ConfigItem *clone() const;
33 
35  int count() const;
36 
38  void clear();
39 
42  DMRChannel *channel(int idx) const;
47  int addChannel(DMRChannel *ch, int row=-1);
49  bool remChannel(int row);
51  bool remChannel(DMRChannel *ch);
52 
54  const DMRChannelRefList *channels() const;
57 
58 protected:
61 };
62 
63 
69 {
70  Q_OBJECT
71 
72 protected:
75  explicit DefaultRoamingZone(QObject *parent=nullptr);
76 
77 public:
79  static DefaultRoamingZone *get();
80 
81 protected:
84 };
85 
86 
91 {
92  Q_OBJECT
93 
94 public:
96  explicit RoamingZoneList(QObject *parent=nullptr);
97 
99  QSet<DMRChannel *> uniqueChannels() const;
101  void uniqueChannels(QSet<DMRChannel *> &channels) const;
102 
104  RoamingZone *zone(int idx) const;
105 
106  int add(ConfigObject *obj, int row=-1);
107 
108 public:
109  ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
110 };
111 
112 #endif // ROAMINGZONE_HH
Parse context for config objects.
Definition: configobject.hh:48
Base class for all configuration objects (channels, zones, contacts, etc).
Definition: configobject.hh:40
List class for config objects.
Definition: configobject.hh:325
Base class of all labeled and named objects.
Definition: configobject.hh:188
QString name
The name of the object.
Definition: configobject.hh:192
Represents a list of references to some digital channels.
Definition: configreference.hh:176
Extension to the DigitalChannel class to implement an DMR channel.
Definition: channel.hh:345
Dummy roaming zone class that represents the default roaming zone.
Definition: roaming.hh:69
DefaultRoamingZone(QObject *parent=nullptr)
Hidden constructor.
Definition: roaming.cc:89
static DefaultRoamingZone * _instance
Holds a reference to the singleton instance of this class.
Definition: roaming.hh:83
static DefaultRoamingZone * get()
Returns the singleton instance of this class.
Definition: roaming.cc:96
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Represents the list of roaming zones within the abstract device configuration.
Definition: roaming.hh:91
RoamingZoneList(QObject *parent=nullptr)
Constructor.
Definition: roaming.cc:106
RoamingZone * zone(int idx) const
Returns the roaming zone at the given index.
Definition: roaming.cc:130
QSet< DMRChannel * > uniqueChannels() const
Returns a set of unique channels used in all roaming zones.
Definition: roaming.cc:113
int add(ConfigObject *obj, int row=-1)
Adds an element to the list.
Definition: roaming.cc:137
ConfigItem * allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
Allocates a member objects for the given YAML node.
Definition: roaming.cc:144
Represents a RoamingZone within the abstract device configuration.
Definition: roaming.hh:15
ConfigItem * clone() const
Clones this item.
Definition: roaming.cc:28
DMRChannelRefList * channels()
Returns the list of digital channels in this roaming zone.
void clear()
Clears the zone list.
Definition: roaming.cc:43
DMRChannelRefList * channels
The channels in the roaming zone.
Definition: roaming.hh:19
DMRChannelRefList _channel
Holds the actual channels of the roaming zone.
Definition: roaming.hh:60
RoamingZone(QObject *parent=nullptr)
Default constructor.
Definition: roaming.cc:9
bool remChannel(int row)
Removes the channel from the roaming zone at index row.
Definition: roaming.cc:64
int addChannel(DMRChannel *ch, int row=-1)
Adds a channel to the roaming zone.
Definition: roaming.cc:55
RoamingZone & operator=(const RoamingZone &other)
Copies the given zone.
Definition: roaming.cc:22
int count() const
Returns the number of zones.
Definition: roaming.cc:38
DMRChannel * channel(int idx) const
Returns the digital channel, which is the member at index idx (0-based).
Definition: roaming.cc:48