Moved a lot of the frame playback window functionality to a new class. This allows the functionality to be run

on a separate thread. The performance is a lot better and "use original timing" is now reasonably accurate.
This commit is contained in:
Collin Kidder
2017-11-08 20:38:19 -05:00
parent 10738396c2
commit 3bf19fdbc4
6 changed files with 635 additions and 264 deletions
+8 -23
View File
@@ -2,26 +2,15 @@
#define FRAMEPLAYBACKWINDOW_H
#include <QDialog>
#include <QElapsedTimer>
#include <QListWidget>
#include <QTimer>
#include "can_structs.h"
#include "framefileio.h"
#include "frameplaybackobject.h"
namespace Ui {
class FramePlaybackWindow;
}
//one entry in the sequence of data to use
struct SequenceItem
{
QString filename;
QVector<CANFrame> data;
QHash<int, bool> idFilters;
int maxLoops;
int currentLoopCount;
};
class FramePlaybackWindow : public QDialog
{
Q_OBJECT
@@ -39,12 +28,12 @@ private slots:
void btnFwdOneClick();
void btnDeleteCurrSeq();
void changePlaybackSpeed(int newSpeed);
void changeBurstRate(int burst);
void changeLooping(bool check);
void changeSendingBus(int newIdx);
void changeIDFiltering(QListWidgetItem *item);
void btnSelectAllClick();
void btnSelectNoneClick();
void timerTriggered();
void btnLoadFile();
void btnLoadLive();
void seqTableCellClicked(int row, int col);
@@ -53,33 +42,29 @@ private slots:
void saveFilters();
void loadFilters();
void useOrigTimingClicked();
void getStatusUpdate(int frameNum);
void EndOfFrameCache();
private:
Ui::FramePlaybackWindow *ui;
QList<int> foundID;
QList<CANFrame> frameCache;
QList<CANFrame> sendingBuffer;
const QVector<CANFrame> *modelFrames;
int currentPosition;
QTimer *playbackTimer;
QElapsedTimer playbackElapsed;
quint64 playbackLastTimeStamp;
bool playbackActive;
bool playbackForward;
int whichBusSend;
QList<SequenceItem> seqItems;
SequenceItem *currentSeqItem;
int currentSeqNum;
FramePlaybackObject playbackObject;
bool forward;
int currentPosition;
void refreshIDList();
void updateFrameLabel();
quint64 updatePosition(bool forward);
quint64 peekPosition(bool forward);
void fillIDHash(SequenceItem &item);
void showEvent(QShowEvent *);
void closeEvent(QCloseEvent *event);
void readSettings();
void writeSettings();
void calculateWhichBus();
};
#endif // FRAMEPLAYBACKWINDOW_H