Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / lineardial / lineardialgadgetconfiguration.h
blob41dba0a47d74533f4265a1b5dd425f0d3e2dcc66
1 /**
2 ******************************************************************************
4 * @file lineardialgadgetconfiguration.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup LinearDialPlugin Linear Dial Plugin
9 * @{
10 * @brief Impliments a gadget that displays linear gauges
11 *****************************************************************************/
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.
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.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef LINEARDIALGADGETCONFIGURATION_H
29 #define LINEARDIALGADGETCONFIGURATION_H
31 #include <coreplugin/iuavgadgetconfiguration.h>
33 using namespace Core;
35 /* This is a generic bargraph dial
36 supporting one indicator.
38 class LineardialGadgetConfiguration : public IUAVGadgetConfiguration {
39 Q_OBJECT
40 public:
41 explicit LineardialGadgetConfiguration(QString classId, QSettings &settings, QObject *parent = 0);
42 explicit LineardialGadgetConfiguration(const LineardialGadgetConfiguration &obj);
44 IUAVGadgetConfiguration *clone() const;
45 void saveConfig(QSettings &settings) const;
47 // set dial configuration functions
48 void setDialFile(QString filename)
50 dialFile = filename;
52 void setRange(double min, double max)
54 minValue = min; maxValue = max;
56 void setGreenRange(double min, double max)
58 greenMin = min; greenMax = max;
60 void setYellowRange(double min, double max)
62 yellowMin = min; yellowMax = max;
64 void setRedRange(double min, double max)
66 redMin = min; redMax = max;
68 void setFont(QString text)
70 font = text;
72 void setFactor(double val)
74 factor = val;
76 void setDecimalPlaces(int val)
78 decimalPlaces = val;
80 void setSourceDataObject(QString text)
82 sourceDataObject = text;
84 void setSourceObjField(QString text)
86 sourceObjectField = text;
88 void setUseOpenGL(bool flag)
90 useOpenGLFlag = flag;
93 // get dial configuration functions
94 QString getDialFile()
96 return dialFile;
98 double getMin()
100 return minValue;
102 double getMax()
104 return maxValue;
106 double getGreenMin()
108 return greenMin;
110 double getGreenMax()
112 return greenMax;
114 double getYellowMin()
116 return yellowMin;
118 double getYellowMax()
120 return yellowMax;
122 double getRedMin()
124 return redMin;
126 double getRedMax()
128 return redMax;
130 QString getSourceDataObject()
132 return sourceDataObject;
134 QString getSourceObjectField()
136 return sourceObjectField;
138 QString getFont()
140 return font;
142 int getDecimalPlaces()
144 return decimalPlaces;
146 double getFactor()
148 return factor;
150 bool useOpenGL()
152 return useOpenGLFlag;
155 private:
156 // A linear or "bargraph" dial contains:
157 // * A SVG background file
158 // The source file should have at least the following IDs
159 // defined: "background", "green", "yellow", "red", "needle"
160 QString dialFile;
161 // * The name of the UAVObject field to display
162 QString sourceDataObject;
163 QString sourceObjectField;
164 // The font used for the dial
165 QString font;
166 // * The minimum and maximum values to be displayed
167 double minValue;
168 double maxValue;
169 // * Three start-stop values for green/yellow/red
170 double redMin;
171 double redMax;
172 double yellowMin;
173 double yellowMax;
174 double greenMin;
175 double greenMax;
176 double factor;
177 int decimalPlaces;
178 bool useOpenGLFlag;
181 #endif // LINEARDIALGADGETCONFIGURATION_H