From 6ab5c83390124ac028ddcd602c319087a3253bdd Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 3 May 2019 12:00:42 -0700 Subject: [PATCH 1/2] Full width status bar --- src/ui/MainWindow.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 7a98324..6dc0e56 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -271,7 +271,7 @@ void MainWindow::_buildCommonWidgets(void) // Log player // TODO: Make this optional with a preferences setting or under a "View" menu logPlayer = new QGCMAVLinkLogPlayer(statusBar()); - statusBar()->addPermanentWidget(logPlayer); + statusBar()->addPermanentWidget(logPlayer, 1); // Populate widget menu for (int i = 0, end = ARRAY_SIZE(rgDockWidgetNames); i < end; i++) { From afe394364f0a0169791a322162f9974a6780f138 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 3 May 2019 12:01:01 -0700 Subject: [PATCH 2/2] Allow time adjust while playing --- src/comm/LogReplayLink.cc | 19 +++++++++++++++---- src/comm/LogReplayLink.h | 1 + src/ui/QGCMAVLinkLogPlayer.cc | 2 -- src/ui/QGCMAVLinkLogPlayer.ui | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/comm/LogReplayLink.cc b/src/comm/LogReplayLink.cc index a97a84b..579b453 100644 --- a/src/comm/LogReplayLink.cc +++ b/src/comm/LogReplayLink.cc @@ -14,6 +14,7 @@ #include #include +#include const char* LogReplayLinkConfiguration::_logFilenameKey = "logFilename"; @@ -368,7 +369,7 @@ void LogReplayLink::_readNextLogEntry(void) timeToNextExecutionMSecs = desiredPacedTimeMSecs - currentTimeMSecs; } - emit currentLogTimeSecs((_logCurrentTimeUSecs - _logStartTimeUSecs) / 1000000); + _signalCurrentLogTimeSecs(); // And schedule the next execution of this function. _readTickTimer.start(timeToNextExecutionMSecs); @@ -450,8 +451,12 @@ void LogReplayLink::_resetPlaybackToBeginning(void) void LogReplayLink::movePlayhead(int percentComplete) { if (isPlaying()) { - qWarning() << "Should not move playhead while playing, pause first"; - return; + _pauseOnThread(); + QSignalSpy waitForPause(this, SIGNAL(playbackPaused)); + waitForPause.wait(); + if (_readTickTimer.isActive()) { + return; + } } if (percentComplete < 0 || percentComplete > 100) { @@ -495,7 +500,8 @@ void LogReplayLink::movePlayhead(int percentComplete) // And scan until we reach the start of a MAVLink message. We make sure to record this timestamp for // smooth jumping around the file. _logCurrentTimeUSecs = _seekToNextMavlinkMessage(&dummy); - + _signalCurrentLogTimeSecs(); + // Now update the UI with our actual final position. newRelativeTimeUSecs = (float)(_logCurrentTimeUSecs - _logStartTimeUSecs); percentComplete = (newRelativeTimeUSecs / _logDurationUSecs) * 100; @@ -561,3 +567,8 @@ void LogReplayLink::_playbackError(void) _logFile.close(); emit playbackError(); } + +void LogReplayLink::_signalCurrentLogTimeSecs(void) +{ + emit currentLogTimeSecs((_logCurrentTimeUSecs - _logStartTimeUSecs) / 1000000); +} diff --git a/src/comm/LogReplayLink.h b/src/comm/LogReplayLink.h index 6f369b3..fb5de6e 100644 --- a/src/comm/LogReplayLink.h +++ b/src/comm/LogReplayLink.h @@ -120,6 +120,7 @@ private: void _finishPlayback(void); void _playbackError(void); void _resetPlaybackToBeginning(void); + void _signalCurrentLogTimeSecs(void); // Virtuals from LinkInterface virtual bool _connect(void); diff --git a/src/ui/QGCMAVLinkLogPlayer.cc b/src/ui/QGCMAVLinkLogPlayer.cc index 6a7d83b..e28824f 100644 --- a/src/ui/QGCMAVLinkLogPlayer.cc +++ b/src/ui/QGCMAVLinkLogPlayer.cc @@ -142,7 +142,6 @@ void QGCMAVLinkLogPlayer::_playbackStarted(void) _enablePlaybackControls(true); _ui->playButton->setChecked(true); _ui->playButton->setIcon(QIcon(":/res/Pause")); - _ui->positionSlider->setEnabled(false); } /// Signalled from LogReplayLink when replay is paused @@ -150,7 +149,6 @@ void QGCMAVLinkLogPlayer::_playbackPaused(void) { _ui->playButton->setIcon(QIcon(":/res/Play")); _ui->playButton->setChecked(false); - _ui->positionSlider->setEnabled(true); } void QGCMAVLinkLogPlayer::_playbackPercentCompleteChanged(int percentComplete) diff --git a/src/ui/QGCMAVLinkLogPlayer.ui b/src/ui/QGCMAVLinkLogPlayer.ui index f80f6ac..2253c90 100644 --- a/src/ui/QGCMAVLinkLogPlayer.ui +++ b/src/ui/QGCMAVLinkLogPlayer.ui @@ -75,7 +75,7 @@ 100 - false + true Qt::Horizontal