libdrmconf  0.11.3
A library to program DMR radios.
rxgrouplist.hh
1 #ifndef RXGROUPLIST_HH
2 #define RXGROUPLIST_HH
3 
4 #include <QObject>
5 #include "configreference.hh"
6 
7 class Config;
8 class DMRContact;
9 
10 
14 {
15  Q_OBJECT
16  Q_CLASSINFO("IdPrefix", "grp")
17 
18 
19  Q_PROPERTY(DMRContactRefList* contacts READ contacts)
20 
21 public:
23  explicit RXGroupList(QObject *parent=nullptr);
27  RXGroupList(const QString &name, QObject *parent=nullptr);
28 
30  RXGroupList &operator =(const RXGroupList &other);
31  ConfigItem *clone() const;
32 
34  int count() const;
36  void clear();
37 
39  DMRContact *contact(int idx) const;
41  int addContact(DMRContact *contact, int idx=-1);
45  bool remContact(int idx);
46 
48  const DMRContactRefList *contacts() const;
51 
52 public:
53  YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
54 
55 protected slots:
57  void onModified();
58 
59 protected:
62 };
63 
64 
68 {
69  Q_OBJECT
70 
71 public:
73  explicit RXGroupLists(QObject *parent=nullptr);
74 
76  RXGroupList *list(int idx) const;
77 
78  int add(ConfigObject *obj, int row=-1);
79 
80 public:
81  ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
82 };
83 
84 #endif // RXGROUPLIST_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:341
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:69
List of references to DMR contacts.
Definition: configreference.hh:110
Represents a digital contact, that is a DMR number.
Definition: contact.hh:141
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Generic representation of a RX group list.
Definition: rxgrouplist.hh:14
DMRContactRefList _contacts
The list of contacts.
Definition: rxgrouplist.hh:61
void clear()
Resets & clears this group list.
Definition: rxgrouplist.cc:57
DMRContactRefList * contacts()
Returns the contact list.
int addContact(DMRContact *contact, int idx=-1)
Adds a contact to the list.
Definition: rxgrouplist.cc:70
DMRContactRefList * contacts
The list of contacts.
Definition: rxgrouplist.hh:19
RXGroupList & operator=(const RXGroupList &other)
Copy from other group list.
Definition: rxgrouplist.cc:36
ConfigItem * clone() const
Clones this item.
Definition: rxgrouplist.cc:42
RXGroupList(QObject *parent=nullptr)
Default constructor.
Definition: rxgrouplist.cc:19
int count() const
Returns the number of contacts within the group list.
Definition: rxgrouplist.cc:52
YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition: rxgrouplist.cc:90
void onModified()
Internal used callback to handle list modifications.
Definition: rxgrouplist.cc:97
DMRContact * contact(int idx) const
Returns the contact at the given list index.
Definition: rxgrouplist.cc:63
bool remContact(DMRContact *contact)
Removes the given contact from the list.
Represents the list of RX group lists within the generic configuration.
Definition: rxgrouplist.hh:68
ConfigItem * allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
Allocates a member objects for the given YAML node.
Definition: rxgrouplist.cc:127
RXGroupLists(QObject *parent=nullptr)
Constructor.
Definition: rxgrouplist.cc:105
RXGroupList * list(int idx) const
Returns the group list at the given index.
Definition: rxgrouplist.cc:113
int add(ConfigObject *obj, int row=-1)
Adds an element to the list.
Definition: rxgrouplist.cc:120