X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fcompass.h;fp=src%2Fcompass.h;h=f30ea823fbbea6424b0f71e3ea390025ce5b5a35;hb=e142c4137c90c764282de17aa1c39efccd6d0c32;hp=0000000000000000000000000000000000000000;hpb=9c5810009491f943e31128f17aeac7517c1ce0f4;p=gpsdata diff --git a/src/compass.h b/src/compass.h new file mode 100644 index 0000000..f30ea82 --- /dev/null +++ b/src/compass.h @@ -0,0 +1,77 @@ +/* + * GPSData for Maemo. + * Copyright (C) 2011 Roman Moravcik + * + * 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 2 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 COMPASS_H +#define COMPASS_H + +#ifdef QT_NO_OPENGL +#include +#else +#include +#endif +#include + +#ifdef QT_NO_OPENGL +class Compass : public QWidget +#else +class Compass : public QGLWidget +#endif +{ + Q_OBJECT + +public: + enum CompassType + { + Gps = 0, + Sensor = 1 + }; + + Compass(CompassType type); + ~Compass(); + + void updateWidget(const int azimuth, double calibration); + void updateWidget(const int azimuth, bool locked, int speed); + +private slots: + void moveTimerEvent(); + +private: + CompassType m_type; + int m_azimuth; + int m_compassAzimuth; + bool m_locked; + int m_gpsSpeed; + double m_sensorCalibLevel; + + QColor m_azimuthLabelWarnColor; + QColor m_scaleColor; + QColor m_windroseNorthColor; + QColor m_windroseColor; + QColor m_windroseBckColor; + + void paintAzimuth(QPainter &painter, const QRectF &area); + void paintCompass(QPainter &painter, const QRectF &area); + + QTimer *m_rotateTimer; + +protected: + void paintEvent(QPaintEvent *event); +}; + +#endif // GCOMPASS_H