2010-04-19 06:38:03 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file airspeedgadgetwidget.h
|
|
|
|
* @author David "Buzz" Carlson Copyright (C) 2010.
|
|
|
|
* @brief
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
|
|
|
* @defgroup airspeed
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AIRSPEEDGADGETWIDGET_H_
|
|
|
|
#define AIRSPEEDGADGETWIDGET_H_
|
|
|
|
|
2010-05-02 14:07:00 +00:00
|
|
|
#include "airspeedgadgetconfiguration.h"
|
2010-04-19 06:38:03 +00:00
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QtSvg/QSvgRenderer>
|
|
|
|
#include <QtSvg/QGraphicsSvgItem>
|
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
// Used for test purposes
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
class AirspeedGadgetWidget : public QGraphicsView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
AirspeedGadgetWidget(QWidget *parent = 0);
|
|
|
|
~AirspeedGadgetWidget();
|
2010-05-02 14:07:00 +00:00
|
|
|
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2);
|
2010-04-19 06:38:03 +00:00
|
|
|
void paint();
|
2010-05-02 14:07:00 +00:00
|
|
|
// setNeedle1 and setNeedle2 use a timer to simulate
|
|
|
|
// needle inertia
|
|
|
|
void setNeedle1(double value);
|
|
|
|
void setNeedle2(double value);
|
|
|
|
void setN1Min(double value) {n1MinValue = value;}
|
|
|
|
void setN1Max(double value) {n1MaxValue = value;}
|
|
|
|
void setN2Min(double value) {n1MinValue = value;}
|
|
|
|
void setN2Max(double value) {n2MaxValue = value;}
|
2010-04-19 06:38:03 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *event);
|
2010-04-27 14:04:06 +00:00
|
|
|
void resizeEvent(QResizeEvent *event);
|
2010-04-19 06:38:03 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
private slots:
|
2010-05-02 14:07:00 +00:00
|
|
|
// Test function
|
2010-04-19 06:38:03 +00:00
|
|
|
void testRotate();
|
2010-05-02 14:07:00 +00:00
|
|
|
void rotateNeedles();
|
2010-04-19 06:38:03 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QSvgRenderer *m_renderer;
|
|
|
|
QGraphicsSvgItem *m_background;
|
|
|
|
QGraphicsSvgItem *m_foreground;
|
2010-05-02 14:07:00 +00:00
|
|
|
QGraphicsSvgItem *m_needle1;
|
|
|
|
QGraphicsSvgItem *m_needle2;
|
|
|
|
double n1MinValue;
|
|
|
|
double n1MaxValue;
|
|
|
|
double n2MinValue;
|
|
|
|
double n2MaxValue;
|
|
|
|
|
|
|
|
double needle1Target;
|
|
|
|
double needle1Value;
|
|
|
|
double needle2Target;
|
|
|
|
double needle2Value;
|
|
|
|
|
|
|
|
// Rotation timer
|
|
|
|
QTimer dialTimer;
|
2010-04-19 06:38:03 +00:00
|
|
|
|
|
|
|
// Test variables
|
|
|
|
int testSpeed;
|
|
|
|
QTimer m_testTimer;
|
|
|
|
// End test variables
|
|
|
|
};
|
|
|
|
#endif /* AIRSPEEDGADGETWIDGET_H_ */
|