- X7S option removed (#5388)
[opentx.git] / companion / src / logsdialog.h
blobcdbff50bc7b19ce87a495ff9c60cc0d144fb66d6
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _LOGSDIALOG_H_
22 #define _LOGSDIALOG_H_
24 #include <QtCore>
25 #include <QtGui>
26 #include "qcustomplot.h"
28 #define INVALID_MIN 999999
29 #define INVALID_MAX -999999
31 enum yaxes_t {
32 firstLeft = 0,
33 firstRight,
34 secondLeft,
35 secondRight,
36 AXES_LIMIT // = 4
39 struct coords {
40 QVector<double> x, y;
41 double min_y;
42 double max_y;
43 yaxes_t yaxis;
44 QString name;
47 struct minMax {
48 double min;
49 double max;
52 struct plotsCollection {
53 QVarLengthArray<struct coords> coords;
54 double min_x;
55 double max_x;
56 bool tooManyRanges;
59 namespace Ui {
60 class LogsDialog;
63 class LogsDialog : public QDialog
65 Q_OBJECT
67 public:
68 explicit LogsDialog(QWidget *parent = 0);
69 ~LogsDialog();
71 private slots:
72 void titleDoubleClick(QMouseEvent *evt, QCPPlotTitle *title);
73 void axisLabelDoubleClick(QCPAxis* axis, QCPAxis::SelectablePart part);
74 void legendDoubleClick(QCPLegend* legend, QCPAbstractLegendItem* item);
75 void selectionChanged();
76 void mousePress(QMouseEvent * event);
77 void mouseWheel();
78 void removeAllGraphs();
79 void plotLogs();
80 void on_fileOpen_BT_clicked();
81 void on_saveSession_BT_clicked();
82 void on_sessions_CB_currentIndexChanged(int index);
83 void on_mapsButton_clicked();
84 void yAxisChangeRanges(QCPRange range);
86 private:
87 QList<QStringList> csvlog;
88 Ui::LogsDialog *ui;
89 QCPAxisRect *axisRect;
90 QCPLegend *rightLegend;
91 bool plotLock;
92 QString logFilename;
94 QVarLengthArray<Qt::GlobalColor> colors;
95 QPen pen;
97 double yAxesRatios[AXES_LIMIT];
98 minMax yAxesRanges[AXES_LIMIT];
100 QCPItemTracer * tracerMaxAlt;
101 QCPItemTracer * cursorA;
102 QCPItemTracer * cursorB;
103 QCPItemStraightLine * cursorLine;
105 bool cvsFileParse();
106 QList<QStringList> filterGePoints(const QList<QStringList> & input);
107 void exportToGoogleEarth();
108 QDateTime getRecordTimeStamp(int index);
109 QString generateDuration(const QDateTime & start, const QDateTime & end);
110 void setFlightSessions();
112 void addMaxAltitudeMarker(const coords & c, QCPGraph * graph);
113 void countNumberOfThrows(const coords & c, QCPGraph * graph);
114 void addCursor(QCPItemTracer ** cursor, QCPGraph * graph, const QColor & color);
115 void addCursorLine(QCPItemStraightLine ** line, QCPGraph * graph, const QColor & color);
116 void placeCursor(double x, bool second);
117 QString formatTimeDelta(double timeDelta);
118 void updateCursorsLabel();
123 #endif // _LOGSDIALOG_H_