LibDMRConf  0.5.2
A library to program DMR radios.
Signals | Public Member Functions | Protected Slots | Protected Attributes | 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:

Signals

void modified ()
 Gets emitted if the list has changed or any contact in it.
 

Public Member Functions

 ContactList (QObject *parent=nullptr)
 Constructs an empty contact list.
 
int count () const
 Returns the number of contacts.
 
int digitalCount () const
 Returns the number of digital contacts.
 
int dtmfCount () const
 Returns the number of DTMF contacts.
 
void clear ()
 Clears the contact list.
 
Contactcontact (int idx) const
 Returns the contact at index idx.
 
DigitalContactdigitalContact (int idx) const
 Returns the digital contact at index idx among digital contacts.
 
DigitalContactfindDigitalContact (uint 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.
 
int indexOf (Contact *contact) const
 Returns the index of the given contact.
 
int indexOfDigital (DigitalContact *contact) const
 Returns the index of the given digital contact within digital contacts.
 
int indexOfDTMF (DTMFContact *contact) const
 Returns the index of the given DTMF contact within DTMF contacts.
 
int addContact (Contact *contact, int row=-1)
 Adds a contact to the list at the given @ç row. More...
 
bool remContact (int idx)
 Removes the contact at the given index.
 
bool remContact (Contact *contact)
 Removes the given contact from the list.
 
bool moveUp (int row)
 Moves the contact at the given row one up.
 
bool moveDown (int row)
 Moves the contact at the given row one down.
 
int rowCount (const QModelIndex &index) const
 Returns the number of rows, implements the QAbstractTableModel.
 
int columnCount (const QModelIndex &index) const
 Returns the number of columns, implements the QAbstractTableModel.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Returns the cell data at given index, implements the QAbstractTableModel.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Returns the header at given section, implements the QAbstractTableModel.
 

Protected Slots

void onContactDeleted (QObject *contact)
 Internal callback on deleted contacts.
 
void onContactEdited ()
 Internal callback on modified contacts.
 

Protected Attributes

QVector< Contact * > _contacts
 Just the vector of contacts.
 

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 altough 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.

Member Function Documentation

◆ addContact()

int ContactList::addContact ( Contact contact,
int  row = -1 
)

Adds a contact to the list at the given @ç row.

If row < 0, the contact gets appended to the list.


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