2 ******************************************************************************
4 * @file lineardialgadget.cpp
5 * @author Edouard Lafargue Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup LinearDialPlugin Linear Dial Plugin
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
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 #include "lineardialgadget.h"
29 #include "lineardialgadgetwidget.h"
30 #include "lineardialgadgetconfiguration.h"
32 LineardialGadget::LineardialGadget(QString classId
, LineardialGadgetWidget
*widget
, QWidget
*parent
) :
33 IUAVGadget(classId
, parent
),
37 LineardialGadget::~LineardialGadget()
43 This is called when a configuration is loaded, and updates the plugin's settings.
44 Careful: the plugin is already drawn before the loadConfiguration method is called the
45 first time, so you have to be careful not to assume all the plugin values are initialized
46 the first time you use them
48 void LineardialGadget::loadConfiguration(IUAVGadgetConfiguration
*config
)
50 LineardialGadgetConfiguration
*m
= qobject_cast
<LineardialGadgetConfiguration
*>(config
);
52 m_widget
->setFactor(m
->getFactor());
53 m_widget
->setDecimalPlaces(m
->getDecimalPlaces());
54 m_widget
->setRange(m
->getMin(), m
->getMax());
55 m_widget
->setGreenRange(m
->getGreenMin(), m
->getGreenMax());
56 m_widget
->setYellowRange(m
->getYellowMin(), m
->getYellowMax());
57 m_widget
->setRedRange(m
->getRedMin(), m
->getRedMax());
58 m_widget
->setDialFile(m
->getDialFile()); // Triggers widget repaint
59 m_widget
->setDialFont(m
->getFont());
60 m_widget
->connectInput(m
->getSourceDataObject(), m
->getSourceObjectField());
61 m_widget
->enableOpenGL(m
->useOpenGL());