Fix doc path
[opentx.git] / companion / src / logsdialog.h
blobf3c86eda7b6200c3db1a0bcae689dd6e5876b1da
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 <QDialog>
26 #include "qcustomplot.h"
28 #define INVALID_MIN 999999
29 #define INVALID_MAX -999999
31 namespace Ui {
32 class LogsDialog;
35 class LogsDialog : public QDialog
37 Q_OBJECT
39 enum yaxes_t {
40 firstLeft = 0,
41 firstRight,
42 secondLeft,
43 secondRight,
44 AXES_LIMIT // = 4
47 struct coords_t {
48 QVector<double> x, y;
49 double min_y;
50 double max_y;
51 yaxes_t yaxis;
52 QString name;
55 struct minMax_t {
56 double min;
57 double max;
60 struct plotsCollection {
61 QVarLengthArray<coords_t> coords;
62 double min_x;
63 double max_x;
64 bool tooManyRanges;
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 saveSession();
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_t 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_t & c, QCPGraph * graph);
113 void countNumberOfThrows(const coords_t & 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_