dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
dialgadget.cpp
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 #include "dialgadget.h"
29 #include "dialgadgetwidget.h"
31 
32 DialGadget::DialGadget(QString classId, DialGadgetWidget *widget, QWidget *parent)
33  : IUAVGadget(classId, parent)
34  , m_widget(widget)
35 {
36 }
37 
39 {
40  delete m_widget;
41 }
42 
43 /*
44  This is called when a configuration is loaded, and updates the plugin's settings.
45  Careful: the plugin is already drawn before the loadConfiguration method is called the
46  first time, so you have to be careful not to assume all the plugin values are initialized
47  the first time you use them
48  */
49 void DialGadget::loadConfiguration(IUAVGadgetConfiguration *config)
50 {
51  DialGadgetConfiguration *m = qobject_cast<DialGadgetConfiguration *>(config);
52  m_widget->setDialFile(m->dialFile(), m->dialBackground(), m->dialForeground(), m->dialNeedle1(),
53  m->dialNeedle2(), m->dialNeedle3(), m->getN1Move(), m->getN2Move(),
54  m->getN3Move());
55 
56  m_widget->enableSmoothUpdates(m->getBeSmooth());
57 
58  m_widget->setN1Min(m->getN1Min());
59  m_widget->setN1Max(m->getN1Max());
60  m_widget->setN1Factor(m->getN1Factor());
61  m_widget->setN2Min(m->getN2Min());
62  m_widget->setN2Max(m->getN2Max());
63  m_widget->setN2Factor(m->getN2Factor());
64  m_widget->setN3Min(m->getN3Min());
65  m_widget->setN3Max(m->getN3Max());
66  m_widget->setN3Factor(m->getN3Factor());
67  m_widget->setDialFont(m->getFont());
70 }
void enableSmoothUpdates(bool flag)
void loadConfiguration(IUAVGadgetConfiguration *config)
Definition: dialgadget.cpp:49
void setN3Factor(double value)
void setN1Min(double value)
void setN3Min(double value)
void setDialFont(QString fontProps)
void setN1Max(double value)
DialGadget(QString classId, DialGadgetWidget *widget, QWidget *parent=nullptr)
Definition: dialgadget.cpp:32
void connectNeedles(QString object1, QString field1, QString object2, QString field2, QString object3, QString field3)
Connects the widget to the relevant UAVObjects.
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3, QString n1Move, QString n2Move, QString n3Move)
void setN2Min(double value)
void setN2Max(double value)
void setN3Max(double value)
void setN1Factor(double value)
void setN2Factor(double value)