File: zone.hh

package info (click to toggle)
qdmr 0.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,420 kB
  • sloc: cpp: 95,929; xml: 10,749; python: 1,108; makefile: 78; sh: 9
file content (92 lines) | stat: -rw-r--r-- 2,382 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef ZONE_HH
#define ZONE_HH

#include <QVector>
#include "configobject.hh"
#include "configreference.hh"

#include "anytone_extension.hh"

class Config;

/** Represents a zone within the generic configuration.
 * @ingroup conf */
class Zone : public ConfigObject
{
  Q_OBJECT
  Q_CLASSINFO("IdPrefix", "zone")

  /** The A channels. */
  Q_PROPERTY(ChannelRefList* A READ A)
  /** The B channels. */
  Q_PROPERTY(ChannelRefList* B READ B)

  /** The AnyTone extensions. */
  Q_PROPERTY(AnytoneZoneExtension* anytone READ anytoneExtension WRITE setAnytoneExtension)

public:
  /** Default constructor. */
  Q_INVOKABLE explicit Zone(QObject *parent=nullptr);
  /** Constructs an empty Zone with the given name. */
  Zone(const QString &name, QObject *parent = nullptr);

  /** Copies the given zone. */
  Zone &operator =(const Zone &other);

  ConfigItem *clone() const;

  /** Clears this zone. */
  void clear();

  /** Returns the list of channels for VFO A in this zone. */
  const ChannelRefList *A() const;
  /** Returns the list of channels for VFO A in this zone. */
  ChannelRefList* A();
  /** Returns the list of channels for VFO B in this zone. */
  const ChannelRefList *B() const;
  /** Returns the list of channels for VFO B in this zone. */
  ChannelRefList* B();

  /** Returns @c true, if the zone contains the given channel. */
  bool contains(Channel *obj) const;

  /** Returns the AnyTone extension. */
  AnytoneZoneExtension *anytoneExtension() const;
  /** Sets the AnyTone extension. */
  void setAnytoneExtension(AnytoneZoneExtension *ext);

signals:
  /** Gets emitted whenever the zone gets modified. */
	void modified();

protected:
  /** List of channels for VFO A. */
  ChannelRefList _A;
  /** List of channels for VFO B. */
  ChannelRefList _B;
  /** Owns the AnyTone extensions. */
  AnytoneZoneExtension *_anytone;
};


/** Represents the list of zones within the generic configuration.
 * @ingroup conf */
class ZoneList : public ConfigObjectList
{
	Q_OBJECT

public:
  /** Constructs an empty list of zones. */
	explicit ZoneList(QObject *parent = nullptr);

  /** Returns the zone at the given index. */
	Zone *zone(int idx) const;

  int add(ConfigObject *obj, int row=-1, bool unique=true);

public:
  ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
};


#endif // ZONE_HH