LibDMRConf
0.5.2
A library to program DMR radios.
|
Represents the list of contacts within the abstract radio configuration. More...
#include <contact.hh>
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. | |
Contact * | contact (int idx) const |
Returns the contact at index idx . | |
DigitalContact * | digitalContact (int idx) const |
Returns the digital contact at index idx among digital contacts. | |
DigitalContact * | findDigitalContact (uint number) const |
Searches for a digital contact with the given number. | |
DTMFContact * | dtmfContact (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. | |
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.
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.