Skip to content

Commit 2f075df

Browse files
dr-obliviumf5soh
authored andcommitted
Merged in Oblivium/librepilot/LP-597_Progress_bar_for_GCS_log_replay (pull request #511)
LP-597 Progress bar for GCS log replay Approved-by: Jan NIJS <dr.oblivium@gmail.com> Approved-by: Philippe Renon <philippe_renon@yahoo.fr> Approved-by: Lalanne Laurent <f5soh@free.fr>
2 parents 3bef6b2 + bafc40f commit 2f075df

10 files changed

Lines changed: 813 additions & 92 deletions

File tree

ground/gcs/src/libs/utils/logfile.cpp

Lines changed: 312 additions & 32 deletions
Large diffs are not rendered by default.

ground/gcs/src/libs/utils/logfile.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
******************************************************************************
33
*
44
* @file logfile.h
5-
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
5+
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017-2018.
66
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
77
* @see The GNU Public License (GPL) Version 3
88
*
@@ -32,8 +32,10 @@
3232
#include <QTimer>
3333
#include <QMutexLocker>
3434
#include <QDebug>
35-
#include <QBuffer>
3635
#include <QFile>
36+
#include <QVector>
37+
38+
typedef enum { PLAYING, PAUSED, STOPPED } ReplayState;
3739

3840
class QTCREATOR_UTILS_EXPORT LogFile : public QIODevice {
3941
Q_OBJECT
@@ -75,6 +77,8 @@ class QTCREATOR_UTILS_EXPORT LogFile : public QIODevice {
7577
m_providedTimeStamp = providedTimestamp;
7678
}
7779

80+
ReplayState getReplayState();
81+
7882
public slots:
7983
void setReplaySpeed(double val)
8084
{
@@ -83,36 +87,48 @@ public slots:
8387
};
8488
bool startReplay();
8589
bool stopReplay();
90+
91+
bool resumeReplay(quint32);
8692
bool pauseReplay();
87-
bool resumeReplay();
93+
bool pauseReplayAndResetPosition();
8894

8995
protected slots:
9096
void timerFired();
9197

9298
signals:
93-
void readReady();
9499
void replayStarted();
95-
void replayFinished();
100+
void replayFinished(); // Emitted on error during replay or when logfile disconnected
101+
void replayCompleted(); // Emitted at the end of normal logfile playback
102+
void playbackPositionChanged(quint32);
103+
void timesChanged(quint32, quint32);
96104

97105
protected:
98106
QByteArray m_dataBuffer;
99107
QTimer m_timer;
100108
QTime m_myTime;
101109
QFile m_file;
102-
qint32 m_previousTimeStamp;
103-
qint32 m_nextTimeStamp;
110+
quint32 m_previousTimeStamp;
111+
quint32 m_nextTimeStamp;
104112
double m_lastPlayed;
105113
// QMutex wants to be mutable
106114
// http://stackoverflow.com/questions/25521570/can-mutex-locking-function-be-marked-as-const
107115
mutable QMutex m_mutex;
108116

109117
int m_timeOffset;
110118
double m_playbackSpeed;
111-
bool paused;
119+
ReplayState m_replayState;
112120

113121
private:
114122
bool m_useProvidedTimeStamp;
115123
qint32 m_providedTimeStamp;
124+
quint32 m_beginTimeStamp;
125+
quint32 m_endTimeStamp;
126+
quint32 m_timerTick;
127+
QVector<quint32> m_timeStamps;
128+
QVector<qint64> m_timeStampPositions;
129+
130+
bool buildIndex();
131+
bool resetReplay();
116132
};
117133

118134
#endif // LOGFILE_H
1.31 KB
Loading
1.41 KB
Loading
970 Bytes
Loading

ground/gcs/src/plugins/logging/logging.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ OTHER_FILES += LoggingGadget.pluginspec
2424

2525
FORMS += logging.ui
2626

27+
RESOURCES += \
28+
res.qrc

0 commit comments

Comments
 (0)