libdrmconf  0.12.0
A library to program DMR radios.
Public Member Functions | List of all members
ContactList Class Reference

Represents the list of contacts within the abstract radio configuration. More...

#include <contact.hh>

Inheritance diagram for ContactList:
Inheritance graph
[legend]
Collaboration diagram for ContactList:
Collaboration graph
[legend]

Public Member Functions

 ContactList (QObject *parent=nullptr)
 Constructs an empty contact list.
 
int add (ConfigObject *obj, int row=-1, bool unique=true)
 Adds an element to the list.
 
int digitalCount () const
 Returns the number of digital contacts.
 
int dtmfCount () const
 Returns the number of DTMF contacts.
 
Contactcontact (int idx) const
 Returns the contact at index idx.
 
DMRContactdigitalContact (int idx) const
 Returns the digital contact at index idx among digital contacts.
 
DMRContactfindDigitalContact (unsigned number) const
 Searches for a digital contact with the given number.
 
DTMFContactdtmfContact (int idx) const
 Returns the DTMF contact at index idx among DTMF contacts.
 
ConfigItemallocateChild (const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
 Allocates a member objects for the given YAML node.
 
- Public Member Functions inherited from ConfigObjectList
bool take (ConfigObject *obj)
 Removes an element from the list.
 
bool del (ConfigObject *obj)
 Removes an element from the list (and deletes it if owned).
 
void clear ()
 Clears the list.
 
bool copy (const AbstractConfigObjectList &other)
 Copies all elements from other to this list.
 
virtual int compare (const ConfigObjectList &other) const
 Compares the object lists. More...
 
virtual bool parse (const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
 Parses the list from the YAML node.
 
virtual bool link (const YAML::Node &node, const ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
 Links the list from the given YAML node.
 
bool label (ConfigItem::Context &context, const ErrorStack &err=ErrorStack())
 Recursively labels the config object.
 
YAML::Node serialize (const ConfigItem::Context &context, const ErrorStack &err=ErrorStack())
 Recursively serializes the configuration to YAML nodes. More...
 
- Public Member Functions inherited from AbstractConfigObjectList
virtual int count () const
 Returns the number of elements in the list.
 
virtual int indexOf (ConfigObject *obj) const
 Returns the index of the given object within the list.
 
virtual const Configconfig () const
 Returns the config object, this list belongs to.
 
virtual void findItemsOfTypes (const QStringList &typeNames, QSet< ConfigItem * > &items) const
 Searches the config tree to find all instances of the given type names.
 
virtual QList< ConfigObject * > findItemsByName (const QString name) const
 Searches the list for objects with the given name.
 
virtual bool has (ConfigObject *obj) const
 Returns true, if the list contains the given object.
 
virtual ConfigObjectget (int idx) const
 Returns the list element at the given index or nullptr if out of bounds.
 
virtual int replace (ConfigObject *obj, int row, bool unique=true)
 Replaces an element in the list.
 
virtual bool moveUp (int idx)
 Moves an object at index idx one step up.
 
virtual bool moveUp (int first, int last)
 Moves objects at [first, last] one step up.
 
virtual bool moveDown (int idx)
 Moves an object at index idx one step down.
 
virtual bool moveDown (int first, int last)
 Moves objects [first, last] one step down.
 
virtual bool move (int source, int count, int destination)
 Moves the given source range to the destination index. More...
 
const QList< QMetaObject > & elementTypes () const
 Returns the element type for this list.
 
QStringList classNames () const
 Returns a list of all class names.
 

Additional Inherited Members

- Signals inherited from AbstractConfigObjectList
void elementAdded (int idx)
 Gets emitted if an element was added to the list.
 
void elementModified (int idx)
 Gets emitted if one of the lists elements gets modified.
 
void elementRemoved (int idx)
 Gets emitted if one of the lists elements gets deleted.
 
- Protected Member Functions inherited from ConfigObjectList
 ConfigObjectList (const QMetaObject &elementTypes=ConfigItem::staticMetaObject, QObject *parent=nullptr)
 Hidden constructor.
 
 ConfigObjectList (const std::initializer_list< QMetaObject > &elementTypes, QObject *parent=nullptr)
 Hidden constructor from initializer list.
 
- Protected Member Functions inherited from AbstractConfigObjectList
 AbstractConfigObjectList (const QMetaObject &elementTypes=ConfigObject::staticMetaObject, QObject *parent=nullptr)
 Hidden constructor.
 
 AbstractConfigObjectList (const std::initializer_list< QMetaObject > &elementTypes, QObject *parent=nullptr)
 Hidden constructor from initializer list.
 
- Protected Attributes inherited from AbstractConfigObjectList
QList< QMetaObject > _elementTypes
 Holds the static QMetaObject of the element type.
 
QVector< ConfigObject * > _items
 Holds the list items.
 

Detailed Description

Represents the list of contacts within the abstract radio configuration.

A special feature of this list, is that DTMF and digital contacts can be accessed by their own unique index although they are held within this single list. Most radios manage digital and DTMF contacts in separate lists, hence a means to iterate over and get indices of digital and DTMF contacts only is needed.

This class implements the QAbstractTableModel, such that the list can be shown with the QTableView widget.


The documentation for this class was generated from the following files: