Addition of a playback form - used to play back a log file onto one or both canbuses. However, not yet completed (but it won't crash)
This commit is contained in:
+11
-3
@@ -19,7 +19,8 @@ SOURCES += main.cpp\
|
|||||||
qcustomplot.cpp \
|
qcustomplot.cpp \
|
||||||
graphingwindow.cpp \
|
graphingwindow.cpp \
|
||||||
frameinfowindow.cpp \
|
frameinfowindow.cpp \
|
||||||
newgraphdialog.cpp
|
newgraphdialog.cpp \
|
||||||
|
frameplaybackwindow.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
can_structs.h \
|
can_structs.h \
|
||||||
@@ -28,9 +29,16 @@ HEADERS += mainwindow.h \
|
|||||||
qcustomplot.h \
|
qcustomplot.h \
|
||||||
graphingwindow.h \
|
graphingwindow.h \
|
||||||
frameinfowindow.h \
|
frameinfowindow.h \
|
||||||
newgraphdialog.h
|
newgraphdialog.h \
|
||||||
|
frameplaybackwindow.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
graphingwindow.ui \
|
graphingwindow.ui \
|
||||||
frameinfowindow.ui \
|
frameinfowindow.ui \
|
||||||
newgraphdialog.ui
|
newgraphdialog.ui \
|
||||||
|
frameplaybackwindow.ui
|
||||||
|
|
||||||
|
DISTFILES +=
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
icons.qrc
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 3.4.0, 2015-05-04T22:19:29. -->
|
<!-- Written by QtCreator 3.4.0, 2015-05-05T23:03:39. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#include "frameplaybackwindow.h"
|
||||||
|
#include "ui_frameplaybackwindow.h"
|
||||||
|
|
||||||
|
FramePlaybackWindow::FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::FramePlaybackWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
modelFrames = frames;
|
||||||
|
|
||||||
|
currentPosition = 0;
|
||||||
|
|
||||||
|
refreshIDList();
|
||||||
|
|
||||||
|
ui->comboCANBus->addItem(tr("None"));
|
||||||
|
ui->comboCANBus->addItem(tr("0"));
|
||||||
|
ui->comboCANBus->addItem(tr("1"));
|
||||||
|
ui->comboCANBus->addItem(tr("From File"));
|
||||||
|
|
||||||
|
updateFrameLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
FramePlaybackWindow::~FramePlaybackWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FramePlaybackWindow::refreshIDList()
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
for (int i = 0; i < modelFrames->count(); i++)
|
||||||
|
{
|
||||||
|
id = modelFrames->at(i).ID;
|
||||||
|
if (!foundID.contains(id))
|
||||||
|
{
|
||||||
|
foundID.append(id);
|
||||||
|
QListWidgetItem* item = new QListWidgetItem(QString::number(id, 16).toUpper().rightJustified(4,'0'), ui->listID);
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
|
||||||
|
item->setCheckState(Qt::Checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//default is to sort in ascending order
|
||||||
|
ui->listID->sortItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FramePlaybackWindow::updateFrameLabel()
|
||||||
|
{
|
||||||
|
ui->lblPosition->setText(QString::number(currentPosition) + tr(" of ") + QString::number(modelFrames->count()));
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef FRAMEPLAYBACKWINDOW_H
|
||||||
|
#define FRAMEPLAYBACKWINDOW_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include "can_structs.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class FramePlaybackWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class FramePlaybackWindow : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent = 0);
|
||||||
|
~FramePlaybackWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::FramePlaybackWindow *ui;
|
||||||
|
QList<int> foundID;
|
||||||
|
QList<CANFrame> frameCache;
|
||||||
|
QList<CANFrame> *modelFrames;
|
||||||
|
int currentPosition;
|
||||||
|
|
||||||
|
void refreshIDList();
|
||||||
|
void updateFrameLabel();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FRAMEPLAYBACKWINDOW_H
|
||||||
@@ -0,0 +1,236 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>FramePlaybackWindow</class>
|
||||||
|
<widget class="QDialog" name="FramePlaybackWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>257</width>
|
||||||
|
<height>606</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnStepBack">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/images/NavBack.png</normaloff>:/icons/images/NavBack.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnPause">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/images/PauseHS.png</normaloff>:/icons/images/PauseHS.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnPlayReverse">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/images/ReverseHS.png</normaloff>:/icons/images/ReverseHS.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnStop">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/images/StopHS.png</normaloff>:/icons/images/StopHS.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnPlay">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/images/PlayHS.png</normaloff>:/icons/images/PlayHS.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnStepForward">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icons.qrc">
|
||||||
|
<normaloff>:/icons/images/NavForward.png</normaloff>:/icons/images/NavForward.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Playback speed (ms):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinPlaySpeed">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QCheckBox" name="cbLoop">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loop playback</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Current frame:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="lblPosition">
|
||||||
|
<property name="text">
|
||||||
|
<string>x of y</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Send to CANBus</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboCANBus"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>ID Filtering:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listID"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnSelectAll">
|
||||||
|
<property name="text">
|
||||||
|
<string>Select all IDs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnSelectNone">
|
||||||
|
<property name="text">
|
||||||
|
<string>Deselect all IDs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="icons.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/icons">
|
||||||
|
<file>images/NavBack.png</file>
|
||||||
|
<file>images/NavForward.png</file>
|
||||||
|
<file>images/PauseHS.png</file>
|
||||||
|
<file>images/PlayHS.png</file>
|
||||||
|
<file>images/ReverseHS.png</file>
|
||||||
|
<file>images/StopHS.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 757 B |
Binary file not shown.
|
After Width: | Height: | Size: 740 B |
Binary file not shown.
|
After Width: | Height: | Size: 297 B |
Binary file not shown.
|
After Width: | Height: | Size: 355 B |
Binary file not shown.
|
After Width: | Height: | Size: 328 B |
Binary file not shown.
|
After Width: | Height: | Size: 410 B |
+8
-2
@@ -12,11 +12,9 @@ This first order of business is to attempt to gain feature parity (roughly) with
|
|||||||
can replace it as a cross platform solution.
|
can replace it as a cross platform solution.
|
||||||
|
|
||||||
Here are things yet to do
|
Here are things yet to do
|
||||||
- Support saving frames
|
|
||||||
- Add flow view - ability to see bits change over time
|
- Add flow view - ability to see bits change over time
|
||||||
- Ability to send frames via playback mechanism (people use this so get it working!)
|
- Ability to send frames via playback mechanism (people use this so get it working!)
|
||||||
- Ability to use programmatic frame sending interface (only I use it and it's complicated but helpful)
|
- Ability to use programmatic frame sending interface (only I use it and it's complicated but helpful)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -32,6 +30,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->actionFrame_Data_Analysis, SIGNAL(triggered(bool)), this, SLOT(showFrameDataAnalysis()));
|
connect(ui->actionFrame_Data_Analysis, SIGNAL(triggered(bool)), this, SLOT(showFrameDataAnalysis()));
|
||||||
connect(ui->btnClearFrames, SIGNAL(clicked(bool)), this, SLOT(clearFrames()));
|
connect(ui->btnClearFrames, SIGNAL(clicked(bool)), this, SLOT(clearFrames()));
|
||||||
connect(ui->actionSave_Log_File, SIGNAL(triggered(bool)), this, SLOT(handleSaveFile()));
|
connect(ui->actionSave_Log_File, SIGNAL(triggered(bool)), this, SLOT(handleSaveFile()));
|
||||||
|
connect(ui->action_Playback, SIGNAL(triggered(bool)), this, SLOT(showPlaybackWindow()));
|
||||||
|
|
||||||
model = new CANFrameModel();
|
model = new CANFrameModel();
|
||||||
ui->canFramesView->setModel(model);
|
ui->canFramesView->setModel(model);
|
||||||
@@ -60,6 +59,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
graphingWindow = NULL;
|
graphingWindow = NULL;
|
||||||
frameInfoWindow = NULL;
|
frameInfoWindow = NULL;
|
||||||
|
playbackWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@@ -539,6 +539,12 @@ void MainWindow::showFrameDataAnalysis()
|
|||||||
frameInfoWindow->show();
|
frameInfoWindow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showPlaybackWindow()
|
||||||
|
{
|
||||||
|
if (!playbackWindow) playbackWindow = new FramePlaybackWindow(model->getListReference());
|
||||||
|
playbackWindow->show();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::readSerialData()
|
void MainWindow::readSerialData()
|
||||||
{
|
{
|
||||||
QByteArray data = port->readAll();
|
QByteArray data = port->readAll();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "can_structs.h"
|
#include "can_structs.h"
|
||||||
#include "graphingwindow.h"
|
#include "graphingwindow.h"
|
||||||
#include "frameinfowindow.h"
|
#include "frameinfowindow.h"
|
||||||
|
#include "frameplaybackwindow.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@@ -40,6 +41,7 @@ private slots:
|
|||||||
void showGraphingWindow();
|
void showGraphingWindow();
|
||||||
void showFrameDataAnalysis();
|
void showFrameDataAnalysis();
|
||||||
void clearFrames();
|
void clearFrames();
|
||||||
|
void showPlaybackWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
@@ -51,6 +53,7 @@ private:
|
|||||||
CANFrame buildFrame;
|
CANFrame buildFrame;
|
||||||
GraphingWindow *graphingWindow;
|
GraphingWindow *graphingWindow;
|
||||||
FrameInfoWindow *frameInfoWindow;
|
FrameInfoWindow *frameInfoWindow;
|
||||||
|
FramePlaybackWindow *playbackWindow;
|
||||||
void loadCRTDFile(QString);
|
void loadCRTDFile(QString);
|
||||||
void loadNativeCSVFile(QString);
|
void loadNativeCSVFile(QString);
|
||||||
void loadGenericCSVFile(QString);
|
void loadGenericCSVFile(QString);
|
||||||
|
|||||||
Reference in New Issue
Block a user