dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
telemetrymonitorwidget.h
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 #ifndef TELEMETRYMONITORWIDGET_H
28 #define TELEMETRYMONITORWIDGET_H
29 
30 #include <QWidget>
31 #include <QObject>
32 #include <QGraphicsView>
33 #include <QtSvg/QSvgRenderer>
34 #include <QtSvg/QGraphicsSvgItem>
35 #include <QtCore/QPointer>
36 #include <QTimer>
37 
38 class TelemetryMonitorWidget : public QGraphicsView
39 {
40  Q_OBJECT
41 public:
42  explicit TelemetryMonitorWidget(QWidget *parent = nullptr);
44 
45  void setMin(double min) { minValue = min; }
46  double getMin() { return minValue; }
47  void setMax(double max) { maxValue = max; }
48  double getMax() { return maxValue; }
49 
50  // number of tx/rx nodes in the graph
51  static const int NODE_NUMELEM = 7;
52  QSvgRenderer *getRenderer() { return renderer; }
53  QGraphicsSvgItem *getBackgroundItem() { return graph; }
54 signals:
55 
56 public slots:
57  void connected();
61  void disconnect();
62 
63  void updateTelemetry(double txRate, double rxRate);
64  void showTelemetry();
65 
66 protected:
67  void showEvent(QShowEvent *event);
68  void resizeEvent(QResizeEvent *event);
69 
70 private:
71  QGraphicsSvgItem *graph;
72  QPointer<QGraphicsTextItem> txSpeed;
73  QPointer<QGraphicsTextItem> rxSpeed;
76  bool m_connected;
77  double txIndex;
78  double txValue;
79  double rxIndex;
80  double rxValue;
81  double minValue;
82  double maxValue;
83  QSvgRenderer *renderer;
84 };
85 
86 #endif // TELEMETRYMONITORWIDGET_H
TelemetryMonitorWidget(QWidget *parent=nullptr)
QGraphicsSvgItem * getBackgroundItem()
void resizeEvent(QResizeEvent *event)
void showEvent(QShowEvent *event)
void updateTelemetry(double txRate, double rxRate)
Called by the UAVObject which got updated Updates the numeric value and/or the icon if the dial wants...