dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
lineardialgadgetconfiguration.h
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 #ifndef LINEARDIALGADGETCONFIGURATION_H
28 #define LINEARDIALGADGETCONFIGURATION_H
29 
31 
32 using namespace Core;
33 
34 /* This is a generic bargraph dial
35  supporting one indicator.
36  */
38 {
39  Q_OBJECT
40 public:
41  explicit LineardialGadgetConfiguration(QString classId, QSettings *qSettings = nullptr,
42  QObject *parent = nullptr);
43 
44  // set dial configuration functions
45  void setDialFile(QString filename) { dialFile = filename; }
46  void setRange(double min, double max)
47  {
48  minValue = min;
49  maxValue = max;
50  }
51  void setGreenRange(double min, double max)
52  {
53  greenMin = min;
54  greenMax = max;
55  }
56  void setYellowRange(double min, double max)
57  {
58  yellowMin = min;
59  yellowMax = max;
60  }
61  void setRedRange(double min, double max)
62  {
63  redMin = min;
64  redMax = max;
65  }
66 
67  void setFont(QString text) { font = text; }
68 
69  void setFactor(double val) { factor = val; }
70  void setDecimalPlaces(int val) { decimalPlaces = val; }
71 
72  void setSourceDataObject(QString text) { sourceDataObject = text; }
73  void setSourceObjField(QString text) { sourceObjectField = text; }
74 
75  // get dial configuration functions
76  QString getDialFile() { return dialFile; }
77  double getMin() { return minValue; }
78  double getMax() { return maxValue; }
79  double getGreenMin() { return greenMin; }
80  double getGreenMax() { return greenMax; }
81  double getYellowMin() { return yellowMin; }
82  double getYellowMax() { return yellowMax; }
83  double getRedMin() { return redMin; }
84  double getRedMax() { return redMax; }
85  QString getSourceDataObject() { return sourceDataObject; }
86  QString getSourceObjectField() { return sourceObjectField; }
87  QString getFont() { return font; }
88  int getDecimalPlaces() { return decimalPlaces; }
89  double getFactor() { return factor; }
90 
91  void saveConfig(QSettings *settings) const;
93 
94 private:
95  // A linear or "bargraph" dial contains:
96  // * A SVG background file
97  // The source file should have at least the following IDs
98  // defined: "background", "green", "yellow", "red", "needle"
99  QString dialFile;
100  // * The name of the UAVObject field to display
101  QString sourceDataObject;
102  QString sourceObjectField;
103  // The font used for the dial
104  QString font;
105  // * The minimum and maximum values to be displayed
106  double minValue;
107  double maxValue;
108  // * Three start-stop values for green/yellow/red
109  double redMin;
110  double redMax;
111  double yellowMin;
112  double yellowMax;
113  double greenMin;
114  double greenMax;
115 
116  double factor;
117 
118  int decimalPlaces;
119 };
120 
121 #endif // LINEARDIALGADGETCONFIGURATION_H
void setRedRange(double min, double max)
void setYellowRange(double min, double max)
void setGreenRange(double min, double max)
void setRange(double min, double max)
UAVDataObject * clone(quint32 instID)