libdrmconf  0.12.0
A library to program DMR radios.
zone.hh
1 #ifndef ZONE_HH
2 #define ZONE_HH
3 
4 #include <QVector>
5 #include "configobject.hh"
6 #include "configreference.hh"
7 
8 #include "anytone_extension.hh"
9 
10 class Config;
11 
14 class Zone : public ConfigObject
15 {
16  Q_OBJECT
17  Q_CLASSINFO("IdPrefix", "zone")
18 
19 
20  Q_PROPERTY(ChannelRefList* A READ A)
22  Q_PROPERTY(ChannelRefList* B READ B)
23 
24 
26 
27 public:
29  Q_INVOKABLE explicit Zone(QObject *parent=nullptr);
31  Zone(const QString &name, QObject *parent = nullptr);
32 
34  Zone &operator =(const Zone &other);
35 
36  ConfigItem *clone() const;
37 
39  void clear();
40 
42  const ChannelRefList *A() const;
46  const ChannelRefList *B() const;
49 
51  bool contains(Channel *obj) const;
52 
57 
58 signals:
60  void modified();
61 
62 protected:
69 };
70 
71 
74 class ZoneList : public ConfigObjectList
75 {
76  Q_OBJECT
77 
78 public:
80  explicit ZoneList(QObject *parent = nullptr);
81 
83  Zone *zone(int idx) const;
84 
85  int add(ConfigObject *obj, int row=-1, bool unique=true);
86 
87 public:
88  ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
89 };
90 
91 
92 #endif // ZONE_HH
Implements the AnyTone extensions for zones.
Definition: anytone_extension.hh:288
Represents a list of weak references to channels (analog and digital).
Definition: configreference.hh:163
The base class of all channels (analog and digital) of a codeplug configuration.
Definition: channel.hh:34
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:349
Base class of all labeled and named objects.
Definition: configobject.hh:199
QString name
The name of the object.
Definition: configobject.hh:203
The config class, representing the codeplug configuration.
Definition: config.hh:70
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Represents the list of zones within the generic configuration.
Definition: zone.hh:75
ConfigItem * allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
Allocates a member objects for the given YAML node.
Definition: zone.cc:125
int add(ConfigObject *obj, int row=-1, bool unique=true)
Adds an element to the list.
Definition: zone.cc:118
Zone * zone(int idx) const
Returns the zone at the given index.
Definition: zone.cc:111
ZoneList(QObject *parent=nullptr)
Constructs an empty list of zones.
Definition: zone.cc:104
Represents a zone within the generic configuration.
Definition: zone.hh:15
AnytoneZoneExtension * anytone
The AnyTone extensions.
Definition: zone.hh:25
ChannelRefList _A
List of channels for VFO A.
Definition: zone.hh:64
AnytoneZoneExtension * _anytone
Owns the AnyTone extensions.
Definition: zone.hh:68
void setAnytoneExtension(AnytoneZoneExtension *ext)
Sets the AnyTone extension.
Definition: zone.cc:86
Zone & operator=(const Zone &other)
Copies the given zone.
Definition: zone.cc:36
AnytoneZoneExtension * anytoneExtension() const
Returns the AnyTone extension.
Definition: zone.cc:82
ChannelRefList * B()
Returns the list of channels for VFO B in this zone.
ChannelRefList * A()
Returns the list of channels for VFO A in this zone.
void modified()
Gets emitted whenever the zone gets modified.
ChannelRefList _B
List of channels for VFO B.
Definition: zone.hh:66
Q_INVOKABLE Zone(QObject *parent=nullptr)
Default constructor.
Definition: zone.cc:17
ChannelRefList * B
The B channels.
Definition: zone.hh:22
ChannelRefList * A
The A channels.
Definition: zone.hh:20
bool contains(Channel *obj) const
Returns true, if the zone contains the given channel.
Definition: zone.cc:77
void clear()
Clears this zone.
Definition: zone.cc:52
ConfigItem * clone() const
Clones this item.
Definition: zone.cc:42