From ed2cd7bd8cf3d9e35127bb59360de35758c08cba Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Wed, 8 Nov 2017 21:09:20 -0500 Subject: [PATCH] Reimplemented the ability to chain multiple log files and run them in sequences. --- frameplaybackobject.cpp | 59 +---------------------------------------- frameplaybackwindow.cpp | 49 ++++++++++++++++++++++++++++++++-- frameplaybackwindow.h | 1 + 3 files changed, 49 insertions(+), 60 deletions(-) diff --git a/frameplaybackobject.cpp b/frameplaybackobject.cpp index c58c048..5d41774 100644 --- a/frameplaybackobject.cpp +++ b/frameplaybackobject.cpp @@ -38,26 +38,6 @@ quint64 FramePlaybackObject::updatePosition(bool forward) playbackActive = false; playbackTimer->stop(); emit EndOfFrameCache(); - /* - currentSeqNum++; //go forward in the sequence - if (currentSeqNum == seqItems.count()) //are we at the end of the sequence? - { - //reset the loop figures for each sequence entry - for (int i = 0; i < seqItems.count(); i++) seqItems[i].currentLoopCount = 0; - currentSeqNum = 0; - if (ui->cbLoop->isChecked()) //go back to beginning if we're looping the sequence - { - - } - else //not looping so stop playback entirely - { - playbackActive = false; - playbackTimer->stop(); - } - } - currentSeqItem = &seqItems[currentSeqNum]; - ui->tblSequence->setCurrentCell(currentSeqNum, 0); - */ } } } @@ -74,31 +54,10 @@ quint64 FramePlaybackObject::updatePosition(bool forward) playbackActive = false; playbackTimer->stop(); emit EndOfFrameCache(); - - /* - currentSeqNum--; //go backward in the sequence - if (currentSeqNum == -1) //are we trying to go past the beginning? - { - //reset the loop figures for each sequence entry - for (int i = 0; i < seqItems.count(); i++) seqItems[i].currentLoopCount = 0; - currentSeqNum = seqItems.count() - 1; - if (ui->cbLoop->isChecked()) //go back to the last sequence entry if we're looping - { - - } - else //not looping so stop playback entirely - { - playbackActive = false; - playbackTimer->stop(); - } - } - currentSeqItem = &seqItems[currentSeqNum]; - ui->tblSequence->setCurrentCell(currentSeqNum, 0); - */ } } } - //updateFrameLabel(); + //only send frame out if its ID is checked in the list. Otherwise discard it. CANFrame *thisFrame = ¤tSeqItem->data[currentPosition]; uint32_t originalBus = thisFrame->bus; @@ -303,22 +262,6 @@ void FramePlaybackObject::stopPlayback() playbackTimer->stop(); //pushing this button halts automatic playback playbackActive = false; currentPosition = 0; - /* - if (seqItems.count() > 0) - { - currentSeqNum = 0; - currentSeqItem = &seqItems[currentSeqNum]; - } - else { - currentSeqNum = -1; - currentSeqItem = NULL; - } - if (ui->tblSequence->rowCount() > 0) - { - ui->tblSequence->setCurrentCell(0, 0); - refreshIDList(); - } - updateFrameLabel(); */ } void FramePlaybackObject::pausePlayback() diff --git a/frameplaybackwindow.cpp b/frameplaybackwindow.cpp index 87725ae..d8460cb 100644 --- a/frameplaybackwindow.cpp +++ b/frameplaybackwindow.cpp @@ -43,6 +43,7 @@ FramePlaybackWindow::FramePlaybackWindow(const QVector *frames, QWidge currentSeqNum = -1; currentPosition = 0; forward = true; + isPlaying = false; updateFrameLabel(); @@ -271,11 +272,49 @@ void FramePlaybackWindow::EndOfFrameCache() { if (forward) { + currentSeqNum++; //go forward in the sequence + if (currentSeqNum == seqItems.count()) //are we at the end of the sequence? + { + //reset the loop figures for each sequence entry + for (int i = 0; i < seqItems.count(); i++) seqItems[i].currentLoopCount = 0; + currentSeqNum = 0; + if (ui->cbLoop->isChecked()) //go back to beginning if we're looping the sequence + { + } + else //not looping so stop playback entirely + { + isPlaying = false; + playbackObject.stopPlayback(); + } + } + currentSeqItem = &seqItems[currentSeqNum]; + playbackObject.setSequenceObject(currentSeqItem); + if (isPlaying) playbackObject.startPlaybackForward(); + ui->tblSequence->setCurrentCell(currentSeqNum, 0); } else { + currentSeqNum--; //go backward in the sequence + if (currentSeqNum == -1) //are we trying to go past the beginning? + { + //reset the loop figures for each sequence entry + for (int i = 0; i < seqItems.count(); i++) seqItems[i].currentLoopCount = 0; + currentSeqNum = seqItems.count() - 1; + if (ui->cbLoop->isChecked()) //go back to the last sequence entry if we're looping + { + } + else //not looping so stop playback entirely + { + isPlaying = false; + playbackObject.stopPlayback(); + } + } + currentSeqItem = &seqItems[currentSeqNum]; + playbackObject.setSequenceObject(currentSeqItem); + if (isPlaying) playbackObject.startPlaybackBackward(); + ui->tblSequence->setCurrentCell(currentSeqNum, 0); } } @@ -445,22 +484,26 @@ void FramePlaybackWindow::btnLoadLive() void FramePlaybackWindow::btnBackOneClick() { forward = false; + isPlaying = false; playbackObject.stepPlaybackBackward(); } void FramePlaybackWindow::btnPauseClick() { + isPlaying = false; playbackObject.pausePlayback(); } void FramePlaybackWindow::btnReverseClick() { forward = false; + isPlaying = true; playbackObject.startPlaybackBackward(); } void FramePlaybackWindow::btnStopClick() { + isPlaying = false; playbackObject.stopPlayback(); if (seqItems.count() > 0) { @@ -475,19 +518,21 @@ void FramePlaybackWindow::btnStopClick() { ui->tblSequence->setCurrentCell(0, 0); refreshIDList(); - } - //updateFrameLabel(); + } + updateFrameLabel(); } void FramePlaybackWindow::btnPlayClick() { forward = true; + isPlaying = true; playbackObject.startPlaybackForward(); } void FramePlaybackWindow::btnFwdOneClick() { forward = true; + isPlaying = false; playbackObject.stepPlaybackForward(); } diff --git a/frameplaybackwindow.h b/frameplaybackwindow.h index f9e163d..996ac55 100644 --- a/frameplaybackwindow.h +++ b/frameplaybackwindow.h @@ -55,6 +55,7 @@ private: int currentSeqNum; FramePlaybackObject playbackObject; bool forward; + bool isPlaying; int currentPosition; void refreshIDList();