libdrmconf 0.12.1
A library to program DMR radios.
Loading...
Searching...
No Matches
scanlist.hh
1#ifndef SCANLIST_HH
2#define SCANLIST_HH
3
4#include "configobject.hh"
5#include "configreference.hh"
6
7#include "tyt_extensions.hh"
8
9class Channel;
10
11
14class ScanList : public ConfigObject
15{
16 Q_OBJECT
17 Q_CLASSINFO("IdPrefix", "scan")
18
19
24 Q_PROPERTY(ChannelReference* revert READ revert)
26 Q_PROPERTY(ChannelRefList * channels READ channels)
27
30
31public:
33 Q_INVOKABLE explicit ScanList(QObject *parent=nullptr);
35 ScanList(const QString &name, QObject *parent=nullptr);
36
38 ScanList &operator= (const ScanList &other);
39 ConfigItem *clone() const;
40
42 int count() const;
44 void clear();
45
47 bool contains(Channel *channel) const;
49 Channel *channel(int idx) const;
51 int addChannel(Channel *channel, int idx=-1);
53 bool remChannel(int idx);
56
58 const ChannelRefList *channels() const;
61
63 const ChannelReference *primary() const;
67 Channel *primaryChannel() const;
70
72 const ChannelReference *secondary() const;
79
81 const ChannelReference *revert() const;
85 Channel *revertChannel() const;
88
93
94protected:
105
106};
107
108
112{
113 Q_OBJECT
114
115public:
117 explicit ScanLists(QObject *parent = nullptr);
118
120 ScanList *scanlist(int idx) const;
121
122 int add(ConfigObject *obj, int row=-1, bool unique=true);
123
124public:
125 ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
126};
127
128
129#endif // SCANLIST_HH
Represents a list of weak references to channels (analog and digital).
Definition configreference.hh:163
Represents a reference to a channel.
Definition configreference.hh:123
The base class of all channels (analog and digital) of a codeplug configuration.
Definition channel.hh:34
Parse context for config objects.
Definition configobject.hh:48
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:40
virtual ConfigItem * allocateChild(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.
Definition configobject.cc:490
List class for config objects.
Definition configobject.hh:349
Base class of all labeled and named objects.
Definition configobject.hh:199
QString name
The name of the object.
Definition configobject.hh:203
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
Generic representation of a scan list.
Definition scanlist.hh:15
ChannelReference * secondary
The secondary channel.
Definition scanlist.hh:22
ConfigItem * clone() const
Clones this item.
Definition scanlist.cc:44
void clear()
Clears the scan list.
Definition scanlist.cc:54
Channel * channel(int idx) const
Returns the channel at the given index.
Definition scanlist.cc:84
ChannelRefList * channels
The list of channels.
Definition scanlist.hh:26
ChannelReference _secondary
The secondary priority channel.
Definition scanlist.hh:100
ChannelReference _primary
The priority channel.
Definition scanlist.hh:98
void setSecondaryChannel(Channel *channel)
Sets the secondary priority channel.
Definition scanlist.cc:147
TyTScanListExtension * tytScanListExtension() const
Returns the TyT scan-list extension instance (if set).
Definition scanlist.cc:175
bool remChannel(int idx)
Removes the channel at the given index.
Definition scanlist.cc:97
Channel * primaryChannel() const
Returns the priority channel.
Definition scanlist.cc:120
Channel * revertChannel() const
Returns the TX channel.
Definition scanlist.cc:164
int count() const
Returns the number of channels within the scanlist.
Definition scanlist.cc:74
ChannelRefList _channels
The channel list.
Definition scanlist.hh:96
ChannelReference * revert
The revert channel.
Definition scanlist.hh:24
Channel * secondaryChannel() const
Returns the secondary priority channel.
Definition scanlist.cc:142
ChannelReference * primary
The primary channel.
Definition scanlist.hh:20
void setPrimaryChannel(Channel *channel)
Sets the priority channel.
Definition scanlist.cc:125
ChannelReference _revert
The transmit channel.
Definition scanlist.hh:102
bool contains(Channel *channel) const
Returns true if the given channel is part of this scanlist.
Definition scanlist.cc:79
int addChannel(Channel *channel, int idx=-1)
Adds a channel to the scan list.
Definition scanlist.cc:89
void setRevertChannel(Channel *channel)
Sets the TX channel.
Definition scanlist.cc:169
TyTScanListExtension * _tyt
TyT scan-list settings extension.
Definition scanlist.hh:104
void setTyTScanListExtension(TyTScanListExtension *tyt)
Sets the TyT scan-list extension.
Definition scanlist.cc:179
TyTScanListExtension * tyt
The TyT scan-list extension.
Definition scanlist.hh:29
Represents the list of scan lists.
Definition scanlist.hh:112
Represents device specific scan-list settings for TyT devices.
Definition tyt_extensions.hh:214