dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
dialgadgetconfiguration.h
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
28 #ifndef DIALGADGETCONFIGURATION_H
29 #define DIALGADGETCONFIGURATION_H
30 
32 
33 using namespace Core;
34 
35 /* Despite its name, this is actually a generic analog dial
36  supporting up to two rotating "needle" indicators.
37  */
39 {
40  Q_OBJECT
41 public:
42  explicit DialGadgetConfiguration(QString classId, QSettings *qSettings = nullptr,
43  QObject *parent = nullptr);
44 
45  // set dial configuration functions
46  void setDialFile(QString dialFile) { m_defaultDial = dialFile; }
47  void setDialBackgroundID(QString elementID) { dialBackgroundID = elementID; }
48  void setDialForegroundID(QString elementID) { dialForegroundID = elementID; }
49  void setDialNeedleID1(QString elementID) { dialNeedleID1 = elementID; }
50  void setDialNeedleID2(QString elementID) { dialNeedleID2 = elementID; }
51  void setDialNeedleID3(QString elementID) { dialNeedleID3 = elementID; }
52  void setN1Min(double val) { needle1MinValue = val; }
53  void setN2Min(double val) { needle2MinValue = val; }
54  void setN3Min(double val) { needle3MinValue = val; }
55  void setN1Max(double val) { needle1MaxValue = val; }
56  void setN2Max(double val) { needle2MaxValue = val; }
57  void setN3Max(double val) { needle3MaxValue = val; }
58  void setN1Factor(double val) { needle1Factor = val; }
59  void setN2Factor(double val) { needle2Factor = val; }
60  void setN3Factor(double val) { needle3Factor = val; }
61  void setN1DataObject(QString text) { needle1DataObject = text; }
62  void setN2DataObject(QString text) { needle2DataObject = text; }
63  void setN3DataObject(QString text) { needle3DataObject = text; }
64  void setN1ObjField(QString text) { needle1ObjectField = text; }
65  void setN2ObjField(QString text) { needle2ObjectField = text; }
66  void setN3ObjField(QString text) { needle3ObjectField = text; }
67  void setN1Move(QString move) { needle1Move = move; }
68  void setN2Move(QString move) { needle2Move = move; }
69  void setN3Move(QString move) { needle3Move = move; }
70  void setFont(QString text) { font = text; }
71  void setBeSmooth(bool flag) { beSmooth = flag; }
72 
73  // get dial configuration functions
74  QString dialFile() { return m_defaultDial; }
75  QString dialBackground() { return dialBackgroundID; }
76  QString dialForeground() { return dialForegroundID; }
77  QString dialNeedle1() { return dialNeedleID1; }
78  QString dialNeedle2() { return dialNeedleID2; }
79  QString dialNeedle3() { return dialNeedleID3; }
80  double getN1Min() { return needle1MinValue; }
81  double getN2Min() { return needle2MinValue; }
82  double getN3Min() { return needle3MinValue; }
83  double getN1Max() { return needle1MaxValue; }
84  double getN2Max() { return needle2MaxValue; }
85  double getN3Max() { return needle3MaxValue; }
86  double getN1Factor() { return needle1Factor; }
87  double getN2Factor() { return needle2Factor; }
88  double getN3Factor() { return needle3Factor; }
89  QString getN1DataObject() { return needle1DataObject; }
90  QString getN2DataObject() { return needle2DataObject; }
91  QString getN3DataObject() { return needle3DataObject; }
92  QString getN1ObjField() { return needle1ObjectField; }
93  QString getN2ObjField() { return needle2ObjectField; }
94  QString getN3ObjField() { return needle3ObjectField; }
95  QString getN1Move() { return needle1Move; }
96  QString getN2Move() { return needle2Move; }
97  QString getN3Move() { return needle3Move; }
98  QString getFont() { return font; }
99  bool getBeSmooth() { return beSmooth; }
100 
101  void saveConfig(QSettings *settings) const;
103 
104 private:
105  QString m_defaultDial; // The name of the dial's SVG source file
106  QString dialBackgroundID; // SVG elementID of the background
107  QString dialForegroundID; // ... of the foreground
108  QString dialNeedleID1; // ... and the first needle
109  QString dialNeedleID2; // ... and the second
110  QString dialNeedleID3; // ... and the third
111 
112  // Note: MinValue not used at the moment!
113  double needle1MinValue; // Value corresponding to a 0 degree angle;
114  double needle1MaxValue; // Value corresponding to a 360 degree angle;
115  double needle2MinValue;
116  double needle2MaxValue;
117  double needle3MinValue;
118  double needle3MaxValue;
119  double needle1Factor;
120  double needle2Factor;
121  double needle3Factor;
122 
123  // The font used for the dial
124  QString font;
125 
126  QString needle1DataObject;
127  QString needle1ObjectField;
128  QString needle2DataObject;
129  QString needle2ObjectField;
130  QString needle3DataObject;
131  QString needle3ObjectField;
132 
133  // How the two dials move:
134  QString needle1Move;
135  QString needle2Move;
136  QString needle3Move;
137 
138  bool beSmooth;
139 };
140 
141 #endif // DIALGADGETCONFIGURATION_H
void setDialBackgroundID(QString elementID)
void setDialForegroundID(QString elementID)
void setDialNeedleID3(QString elementID)
void setN2DataObject(QString text)
void setN3DataObject(QString text)
void setDialNeedleID2(QString elementID)
void setN2ObjField(QString text)
void setDialNeedleID1(QString elementID)
void setN3ObjField(QString text)
void setN1ObjField(QString text)
UAVDataObject * clone(quint32 instID)
void setDialFile(QString dialFile)
void setN1DataObject(QString text)