libdrmconf  0.12.0
A library to program DMR radios.
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
Config Class Reference

The config class, representing the codeplug configuration. More...

#include <config.hh>

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

Public Member Functions

Q_INVOKABLE Config (QObject *parent=nullptr)
 Constructs an empty configuration.
 
bool copy (const ConfigItem &other)
 Copies the given item into this one. More...
 
ConfigItemclone () const
 Clones this item.
 
bool isModified () const
 Returns true if the config was modified,. More...
 
void setModified (bool modified)
 Sets the modified flag.
 
RadioSettingssettings () const
 Returns the radio wide settings.
 
RadioIDListradioIDs () const
 Returns the list of radio IDs.
 
ContactListcontacts () const
 Returns the list of contacts.
 
RXGroupListsrxGroupLists () const
 Returns the list of RX group lists.
 
ChannelListchannelList () const
 Returns the list of channels.
 
ZoneListzones () const
 Returns the list of zones.
 
ScanListsscanlists () const
 Returns the list of scanlists.
 
PositioningSystemsposSystems () const
 Returns the list of positioning systems.
 
RoamingChannelListroamingChannels () const
 Returns the list of roaming channels.
 
RoamingZoneListroamingZones () const
 Returns the list of roaming zones.
 
bool requiresRoaming () const
 Returns true if one of the digital channels has a roaming zone assigned.
 
bool requiresGPS () const
 Returns true if one of the channels has a GPS or APRS system assigned.
 
void clear ()
 Clears the complete configuration.
 
const Configconfig () const
 Returns the config, the item belongs to or nullptr if not part of a config.
 
CommercialExtensioncommercialExtension () const
 Returns the commercial extension.
 
SMSExtensionsmsExtension () const
 Returns the SMS settings extension.
 
TyTConfigExtensiontytExtension () const
 Returns the TyT settings extension. More...
 
void setTyTExtension (TyTConfigExtension *ext)
 Sets the TyT settings extension.
 
bool readCSV (const QString &filename, QString &errorMessage)
 Imports a configuration from the given file.
 
bool readCSV (QTextStream &stream, QString &errorMessage)
 Imports a configuration from the given text stream in text format.
 
bool readYAML (const QString &filename, const ErrorStack &err=ErrorStack())
 Imports a configuration from the given YAML file.
 
bool parse (const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack())
 Parses the given YAML node, updates the given object and updates the given context (IDs). More...
 
bool link (const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack())
 Links the given object to the rest of the codeplug using the given context. More...
 
bool toYAML (QTextStream &stream, const ErrorStack &err=ErrorStack())
 Serializes the configuration into the given stream as text.
 
- Public Member Functions inherited from ConfigItem
virtual int compare (const ConfigItem &other) const
 Compares the items. More...
 
virtual bool label (Context &context, const ErrorStack &err=ErrorStack())
 Recursively labels the config object. More...
 
virtual YAML::Node serialize (const Context &context, const ErrorStack &err=ErrorStack())
 Recursively serializes the configuration to YAML nodes. More...
 
virtual ConfigItemallocateChild (QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack())
 Allocates an instance for the given property on the given YAML node. More...
 
virtual void findItemsOfTypes (const QStringList &typeNames, QSet< ConfigItem * > &items) const
 Searches the config tree to find all instances of the given type names.
 
template<class Object >
bool is () const
 Returns true if this object is of class Object.
 
template<class Object >
const Object * as () const
 Casts this object to the given type.
 
template<class Object >
Object * as ()
 Casts this object to the given type.
 
bool hasDescription () const
 Returns true if there is a class info "description" for this instance.
 
bool hasLongDescription () const
 Returns true if there is a class info "longDescription" for this instance.
 
bool hasDescription (const QMetaProperty &prop) const
 Returns true if there is a class info "[PropertyName]Description" for the given property.
 
bool hasLongDescription (const QMetaProperty &prop) const
 Returns true if there is a class info "[PropertyName]LongDescription" for the given property.
 
QString description () const
 Returns the description of this instance if set by a class info.
 
QString longDescription () const
 Returns the long description of this instance if set by a class info.
 
QString description (const QMetaProperty &prop) const
 Returns the description of property if set by a class info.
 
QString longDescription (const QMetaProperty &prop) const
 Returns the long description of property if set by a class info.
 

Protected Slots

void onConfigModified ()
 Iternal callback.
 

Protected Member Functions

bool populate (YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack())
 Recursively serializes the configuration to YAML nodes. More...
 
- Protected Member Functions inherited from ConfigItem
 ConfigItem (QObject *parent=nullptr)
 Hidden constructor. More...
 

Protected Attributes

bool _modified
 If true, the configuration was modified.
 
RadioSettings_settings
 Radio wide settings.
 
RadioIDList_radioIDs
 The list of radio IDs.
 
ContactList_contacts
 The list of contacts.
 
RXGroupLists_rxGroupLists
 The list of RX group lists.
 
ChannelList_channels
 The list of channels.
 
ZoneList_zones
 The list of zones.
 
ScanLists_scanlists
 The list of scan lists.
 
PositioningSystems_gpsSystems
 The list of GPS Systems.
 
RoamingChannelList_roamingChannels
 The list of roaming channels.
 
RoamingZoneList_roamingZones
 The list of roaming zones.
 
TyTConfigExtension_tytExtension
 Owns the TyT settings extension.
 
CommercialExtension_commercialExtension
 Owns the commercial extension.
 
SMSExtension_smsExtension
 Owns the SMS settings extension.
 

Properties

RadioSettingssettings
 The global radio settings.
 
RadioIDListradioIDs
 The list of radio IDs.
 
ContactListcontacts
 The list of contacts.
 
RXGroupListsgroupLists
 The list of group lists.
 
ChannelListchannels
 The list of channels.
 
ZoneListzones
 The list of zones.
 
ScanListsscanLists
 The list of scan lists.
 
PositioningSystemspositioning
 The list of positioning systems.
 
RoamingChannelListroamingChannels
 The list of roaming channels.
 
RoamingZoneListroamingZones
 The list of roaming zones.
 
CommercialExtensioncommercial
 Represents the config extension for encryption keys.
 
SMSExtensionsms
 Represents the extended SMS settings.
 
TyTConfigExtensiontytExtension
 Represents the config extension for TyT devices.
 

Additional Inherited Members

- Signals inherited from ConfigItem
void modified (ConfigItem *obj)
 Gets emitted once the config object is modified. More...
 
void beginClear ()
 Gets emitted before clearing the item.
 
void endClear ()
 Gets emitted after clearing the item.
 

Detailed Description

The config class, representing the codeplug configuration.

It contains the description of the contacts, channels, zones, etc. of the codeplug configuration.

Member Function Documentation

◆ copy()

bool Config::copy ( const ConfigItem other)
virtual

Copies the given item into this one.

Returns
true if copying was successful and false otherwise. The two items must be of the same type (obviously).

Reimplemented from ConfigItem.

◆ isModified()

bool Config::isModified ( ) const

Returns true if the config was modified,.

See also
modified.

◆ link()

bool Config::link ( const YAML::Node &  node,
const Context ctx,
const ErrorStack err = ErrorStack() 
)
virtual

Links the given object to the rest of the codeplug using the given context.

Todo:
Implemented for backward compatibility with version 0.10.0, remove for 1.0.0.

Reimplemented from ConfigItem.

◆ parse()

bool Config::parse ( const YAML::Node &  node,
Context ctx,
const ErrorStack err = ErrorStack() 
)
virtual

Parses the given YAML node, updates the given object and updates the given context (IDs).

Todo:
Implemented for backward compatibility with version 0.10.0, remove for 1.0.0.
Todo:
With Qt 5.15, we can use the REQUIRED flag to check for mandatory properties. However, Ubuntu 20.04 (Focal) comes with Qt 5.12.

Reimplemented from ConfigItem.

◆ populate()

bool Config::populate ( YAML::Node &  node,
const Context context,
const ErrorStack err = ErrorStack() 
)
protectedvirtual

Recursively serializes the configuration to YAML nodes.

The complete configuration must be labeled first.

Reimplemented from ConfigItem.

◆ tytExtension()

TyTConfigExtension * Config::tytExtension ( ) const

Returns the TyT settings extension.

If this extension is not set, returns nullptr.


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