dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
systemhealthgadgetwidget.h
Go to the documentation of this file.
1 
12 /*
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.
17  *
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.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 #ifndef SYSTEMHEALTHGADGETWIDGET_H_
28 #define SYSTEMHEALTHGADGETWIDGET_H_
29 
31 #include "uavobjects/uavobject.h"
33 #include <QGraphicsView>
34 #include <QtSvg/QSvgRenderer>
35 #include <QtSvg/QGraphicsSvgItem>
36 #include <QMouseEvent>
37 #include <QMap>
38 #include <QFile>
39 #include <QTimer>
40 
41 class SystemHealthGadgetWidget : public QGraphicsView
42 {
43  Q_OBJECT
44 
45 public:
46  SystemHealthGadgetWidget(QWidget *parent = nullptr);
48  void setSystemFile(QString dfn);
49  void setIndicator(QString indicator);
50  void paint();
51 
52 protected:
53  void paintEvent(QPaintEvent *event);
54  void resizeEvent(QResizeEvent *event);
55  void mousePressEvent(QMouseEvent *event);
56 
57 private slots:
58  void updateAlarms(UAVObject *systemAlarm); // Called by the systemalarms UAVObject
59  void onAutopilotConnect();
60  void onAutopilotDisconnect();
61 
62 private:
63  QSvgRenderer *m_renderer;
64  QGraphicsSvgItem *background;
65  QGraphicsSvgItem *foreground;
66  QGraphicsSvgItem *nolink;
67 
68  // Simple flag to skip rendering if the
69  bool fgenabled; // layer does not exist.
70 
71  void showAlarmDescriptionForItemId(const QString itemId, const QPoint &location);
72  void showAllAlarmDescriptions(const QPoint &location);
73  QString getAlarmDescriptionFileName(const QString itemId);
74 };
75 #endif /* SYSTEMHEALTHGADGETWIDGET_H_ */
void paintEvent(QPaintEvent *event)
void resizeEvent(QResizeEvent *event)
SystemHealthGadgetWidget(QWidget *parent=nullptr)
void setIndicator(QString indicator)
void mousePressEvent(QMouseEvent *event)