Updated French translation (#4946)
[opentx.git] / companion / src / logsdialog.h
blobf5f43730ca156c9e73ab4d5dcb75c51788520aa1
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_sessions_CB_currentIndexChanged(int index);
82 void on_mapsButton_clicked();
83 void yAxisChangeRanges(QCPRange range);
85 private:
86 QList<QStringList> csvlog;
87 Ui::LogsDialog *ui;
88 QCPAxisRect *axisRect;
89 QCPLegend *rightLegend;
90 bool plotLock;
91 QString logFilename;
93 QVarLengthArray<Qt::GlobalColor> colors;
94 QPen pen;
96 double yAxesRatios[AXES_LIMIT];
97 minMax yAxesRanges[AXES_LIMIT];
99 QCPItemTracer * tracerMaxAlt;
100 QCPItemTracer * cursorA;
101 QCPItemTracer * cursorB;
102 QCPItemStraightLine * cursorLine;
104 bool cvsFileParse();
105 QList<QStringList> filterGePoints(const QList<QStringList> & input);
106 void exportToGoogleEarth();
107 QDateTime getRecordTimeStamp(int index);
108 QString generateDuration(const QDateTime & start, const QDateTime & end);
109 void setFlightSessions();
111 void addMaxAltitudeMarker(const coords & c, QCPGraph * graph);
112 void countNumberOfThrows(const coords & c, QCPGraph * graph);
113 void addCursor(QCPItemTracer ** cursor, QCPGraph * graph, const QColor & color);
114 void addCursorLine(QCPItemStraightLine ** line, QCPGraph * graph, const QColor & color);
115 void placeCursor(double x, bool second);
116 QString formatTimeDelta(double timeDelta);
117 void updateCursorsLabel();
122 #endif // _LOGSDIALOG_H_