libdrmconf 0.13.3
A library to program DMR radios.
Loading...
Searching...
No Matches
Classes | Public Slots | Signals | Public Member Functions | Properties | List of all members
UserDatabase Class Reference

Auto-updating DMR user database. More...

#include <userdatabase.hh>

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

Classes

class  User
 Represents the user information within the UserDatabase. More...
 

Public Slots

void download ()
 Starts the download of the user database.
 

Signals

void loaded ()
 Gets emitted once the call-sign database has been loaded.
 
void error (const QString &msg)
 Gets emitted if the loading of the call-sign database fails.
 
void readyChanged (bool ready)
 Gets emitted, once the database has been loaded or cleard.
 

Public Member Functions

 UserDatabase (bool parallel, unsigned updatePeriodDays=30, QObject *parent=nullptr)
 Constructs the user-database.
 
qint64 count () const
 Returns the number of users.
 
bool exists () const
 Retruns true, if the user database file exists.
 
bool load ()
 Loads all entries from the downloaded user database.
 
bool load (const QString &filename)
 Loads all entries from the downloaded user database at the specified location.
 
bool ready () const
 Returns true, if the database has been loaded.
 
void sortUsers (unsigned id)
 Sorts users with respect to the distance to the given ID.
 
void sortUsers (const QSet< unsigned > &ids)
 Sorts users with respect to the minimum distance to the given IDs.
 
const Useruser (int idx) const
 Returns the user with index idx.
 
unsigned dbAge () const
 Returns the age of the database in days.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Implements the QAbstractTableModel interface, returns the number of rows (number of entries).
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Implements the QAbstractTableModel interface, returns the number of columns.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Implements the QAbstractTableModel interface, return the entry data.
 

Properties

bool ready
 Get notification, once the database has been loaded.
 

Detailed Description

Auto-updating DMR user database.

This class represents the complete DMR user database. The user database gets downloaded from https://www.radioid.net/static/users.json and kept up-to-date by re-downloading it periodically (by default every 30 days). This user database gets used in the GUI application to help assemble private call contacts and to assemble so-called CSV callsign databases, that are programmable to some DMR radios to resolve the DMR ID to callsigns and names.

Constructor & Destructor Documentation

◆ UserDatabase()

UserDatabase::UserDatabase ( bool  parallel,
unsigned  updatePeriodDays = 30,
QObject *  parent = nullptr 
)
explicit

Constructs the user-database.

The constructor will download the current user database if it was not downloaded yet or if the downloaded version is older than updatePeriodDays days.

Member Function Documentation

◆ readyChanged

void UserDatabase::readyChanged ( bool  ready)
signal

Gets emitted, once the database has been loaded or cleard.

Warning
This event might be emitted by another thread.

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