Add progressbar to loading on main form, add ability to graph DBC defined signals, make graphing bias/scale work like DBC bias/scale to be consistent.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#ifndef CONFIG
|
#ifndef CONFIG
|
||||||
#define CONFIG
|
#define CONFIG
|
||||||
|
|
||||||
#define VERSION 129
|
#define VERSION 130
|
||||||
|
|
||||||
//try to keep this in sync.
|
//try to keep this in sync.
|
||||||
//SavvyCAN will complain if you connect a GVRET board with a revision
|
//SavvyCAN will complain if you connect a GVRET board with a revision
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
QFile *inFile = new QFile(filename);
|
QFile *inFile = new QFile(filename);
|
||||||
CANFrame thisFrame;
|
CANFrame thisFrame;
|
||||||
QByteArray line;
|
QByteArray line;
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -79,6 +80,12 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
line = inFile->readLine(); //read out the header first and discard it.
|
line = inFile->readLine(); //read out the header first and discard it.
|
||||||
|
|
||||||
while (!inFile->atEnd()) {
|
while (!inFile->atEnd()) {
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
line = inFile->readLine().simplified();
|
line = inFile->readLine().simplified();
|
||||||
if (line.length() > 2)
|
if (line.length() > 2)
|
||||||
{
|
{
|
||||||
@@ -124,6 +131,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
bool FrameFileIO::saveCRTDFile(QString filename, const QVector<CANFrame>* frames)
|
bool FrameFileIO::saveCRTDFile(QString filename, const QVector<CANFrame>* frames)
|
||||||
{
|
{
|
||||||
QFile *outFile = new QFile(filename);
|
QFile *outFile = new QFile(filename);
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -137,6 +145,13 @@ bool FrameFileIO::saveCRTDFile(QString filename, const QVector<CANFrame>* frames
|
|||||||
|
|
||||||
for (int c = 0; c < frames->count(); c++)
|
for (int c = 0; c < frames->count(); c++)
|
||||||
{
|
{
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
outFile->write(QString::number(frames->at(c).timestamp / 1000000.0, 'f', 6).toUtf8());
|
outFile->write(QString::number(frames->at(c).timestamp / 1000000.0, 'f', 6).toUtf8());
|
||||||
outFile->putChar(' ');
|
outFile->putChar(' ');
|
||||||
if (frames->at(c).extended)
|
if (frames->at(c).extended)
|
||||||
@@ -168,6 +183,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
CANFrame thisFrame;
|
CANFrame thisFrame;
|
||||||
QByteArray line;
|
QByteArray line;
|
||||||
long long timeStamp = Utility::GetTimeMS();
|
long long timeStamp = Utility::GetTimeMS();
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -178,6 +194,13 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
line = inFile->readLine(); //read out the header first and discard it.
|
line = inFile->readLine(); //read out the header first and discard it.
|
||||||
|
|
||||||
while (!inFile->atEnd()) {
|
while (!inFile->atEnd()) {
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
line = inFile->readLine();
|
line = inFile->readLine();
|
||||||
if (line.length() > 2)
|
if (line.length() > 2)
|
||||||
{
|
{
|
||||||
@@ -212,6 +235,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
bool FrameFileIO::saveNativeCSVFile(QString filename, const QVector<CANFrame>* frames)
|
bool FrameFileIO::saveNativeCSVFile(QString filename, const QVector<CANFrame>* frames)
|
||||||
{
|
{
|
||||||
QFile *outFile = new QFile(filename);
|
QFile *outFile = new QFile(filename);
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -224,6 +248,13 @@ bool FrameFileIO::saveNativeCSVFile(QString filename, const QVector<CANFrame>* f
|
|||||||
|
|
||||||
for (int c = 0; c < frames->count(); c++)
|
for (int c = 0; c < frames->count(); c++)
|
||||||
{
|
{
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
outFile->write(QString::number(frames->at(c).timestamp).toUtf8());
|
outFile->write(QString::number(frames->at(c).timestamp).toUtf8());
|
||||||
outFile->putChar(44);
|
outFile->putChar(44);
|
||||||
|
|
||||||
@@ -262,6 +293,7 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector<CANFrame>* frames
|
|||||||
CANFrame thisFrame;
|
CANFrame thisFrame;
|
||||||
QByteArray line;
|
QByteArray line;
|
||||||
long long timeStamp = Utility::GetTimeMS();
|
long long timeStamp = Utility::GetTimeMS();
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -272,6 +304,13 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector<CANFrame>* frames
|
|||||||
line = inFile->readLine(); //read out the header first and discard it.
|
line = inFile->readLine(); //read out the header first and discard it.
|
||||||
|
|
||||||
while (!inFile->atEnd()) {
|
while (!inFile->atEnd()) {
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
line = inFile->readLine();
|
line = inFile->readLine();
|
||||||
if (line.length() > 2)
|
if (line.length() > 2)
|
||||||
{
|
{
|
||||||
@@ -300,6 +339,7 @@ bool FrameFileIO::loadGenericCSVFile(QString filename, QVector<CANFrame>* frames
|
|||||||
bool FrameFileIO::saveGenericCSVFile(QString filename, const QVector<CANFrame>* frames)
|
bool FrameFileIO::saveGenericCSVFile(QString filename, const QVector<CANFrame>* frames)
|
||||||
{
|
{
|
||||||
QFile *outFile = new QFile(filename);
|
QFile *outFile = new QFile(filename);
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -312,6 +352,13 @@ bool FrameFileIO::saveGenericCSVFile(QString filename, const QVector<CANFrame>*
|
|||||||
|
|
||||||
for (int c = 0; c < frames->count(); c++)
|
for (int c = 0; c < frames->count(); c++)
|
||||||
{
|
{
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8());
|
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8());
|
||||||
outFile->putChar(44);
|
outFile->putChar(44);
|
||||||
|
|
||||||
@@ -367,6 +414,7 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
CANFrame thisFrame;
|
CANFrame thisFrame;
|
||||||
QByteArray line;
|
QByteArray line;
|
||||||
uint64_t timeStamp = Utility::GetTimeMS();
|
uint64_t timeStamp = Utility::GetTimeMS();
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -377,6 +425,13 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
line = inFile->readLine(); //read out the header first and discard it.
|
line = inFile->readLine(); //read out the header first and discard it.
|
||||||
|
|
||||||
while (!inFile->atEnd()) {
|
while (!inFile->atEnd()) {
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
line = inFile->readLine();
|
line = inFile->readLine();
|
||||||
if (line.startsWith("***")) continue;
|
if (line.startsWith("***")) continue;
|
||||||
if (line.length() > 1)
|
if (line.length() > 1)
|
||||||
@@ -404,6 +459,7 @@ bool FrameFileIO::saveLogFile(QString filename, const QVector<CANFrame>* frames)
|
|||||||
{
|
{
|
||||||
QFile *outFile = new QFile(filename);
|
QFile *outFile = new QFile(filename);
|
||||||
QDateTime timestamp, tempStamp;
|
QDateTime timestamp, tempStamp;
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
timestamp = QDateTime::currentDateTime();
|
timestamp = QDateTime::currentDateTime();
|
||||||
|
|
||||||
@@ -431,6 +487,13 @@ bool FrameFileIO::saveLogFile(QString filename, const QVector<CANFrame>* frames)
|
|||||||
|
|
||||||
for (int c = 0; c < frames->count(); c++)
|
for (int c = 0; c < frames->count(); c++)
|
||||||
{
|
{
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
tempStamp = timestamp.addMSecs(frames->at(c).timestamp / 1000);
|
tempStamp = timestamp.addMSecs(frames->at(c).timestamp / 1000);
|
||||||
outFile->write(tempStamp.toString("h:m:s:z").toUtf8());
|
outFile->write(tempStamp.toString("h:m:s:z").toUtf8());
|
||||||
outFile->write(" Rx ");
|
outFile->write(" Rx ");
|
||||||
@@ -470,6 +533,7 @@ bool FrameFileIO::loadMicrochipFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
QByteArray line;
|
QByteArray line;
|
||||||
bool inComment = false;
|
bool inComment = false;
|
||||||
long long timeStamp = Utility::GetTimeMS();
|
long long timeStamp = Utility::GetTimeMS();
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
@@ -480,6 +544,13 @@ bool FrameFileIO::loadMicrochipFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
//line = inFile->readLine(); //read out the header first and discard it.
|
//line = inFile->readLine(); //read out the header first and discard it.
|
||||||
|
|
||||||
while (!inFile->atEnd()) {
|
while (!inFile->atEnd()) {
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
line = inFile->readLine();
|
line = inFile->readLine();
|
||||||
if (line.length() > 2)
|
if (line.length() > 2)
|
||||||
{
|
{
|
||||||
@@ -526,6 +597,7 @@ bool FrameFileIO::saveMicrochipFile(QString filename, const QVector<CANFrame>* f
|
|||||||
{
|
{
|
||||||
QFile *outFile = new QFile(filename);
|
QFile *outFile = new QFile(filename);
|
||||||
QDateTime timestamp, tempStamp;
|
QDateTime timestamp, tempStamp;
|
||||||
|
int lineCounter = 0;
|
||||||
|
|
||||||
timestamp = QDateTime::currentDateTime();
|
timestamp = QDateTime::currentDateTime();
|
||||||
|
|
||||||
@@ -546,6 +618,13 @@ bool FrameFileIO::saveMicrochipFile(QString filename, const QVector<CANFrame>* f
|
|||||||
|
|
||||||
for (int c = 0; c < frames->count(); c++)
|
for (int c = 0; c < frames->count(); c++)
|
||||||
{
|
{
|
||||||
|
lineCounter++;
|
||||||
|
if (lineCounter > 100)
|
||||||
|
{
|
||||||
|
qApp->processEvents();
|
||||||
|
lineCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
outFile->write(QString::number((int)(frames->at(c).timestamp / 1000)).toUtf8());
|
outFile->write(QString::number((int)(frames->at(c).timestamp / 1000)).toUtf8());
|
||||||
outFile->write(";RX;");
|
outFile->write(";RX;");
|
||||||
outFile->write("0x" + QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8() + ";");
|
outFile->write("0x" + QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8() + ";");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
|
#include <QApplication>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|||||||
+9
-6
@@ -4,7 +4,7 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent) :
|
GraphingWindow::GraphingWindow(DBCHandler *handler, const QVector<CANFrame> *frames, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::GraphingWindow)
|
ui(new Ui::GraphingWindow)
|
||||||
{
|
{
|
||||||
@@ -13,6 +13,7 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
|||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
modelFrames = frames;
|
modelFrames = frames;
|
||||||
|
dbcHandler = handler;
|
||||||
|
|
||||||
ui->graphingView->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
|
ui->graphingView->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
|
||||||
QCP::iSelectLegend | QCP::iSelectPlottables);
|
QCP::iSelectLegend | QCP::iSelectPlottables);
|
||||||
@@ -479,7 +480,9 @@ void GraphingWindow::loadDefinitions()
|
|||||||
|
|
||||||
void GraphingWindow::showParamsDialog(int idx = -1)
|
void GraphingWindow::showParamsDialog(int idx = -1)
|
||||||
{
|
{
|
||||||
NewGraphDialog *thisDialog = new NewGraphDialog();
|
NewGraphDialog *thisDialog = new NewGraphDialog(dbcHandler);
|
||||||
|
QString oldName;
|
||||||
|
if (idx > -1) oldName = graphParams[idx].graphName;
|
||||||
if (idx > -1) thisDialog->setParams(graphParams[idx]);
|
if (idx > -1) thisDialog->setParams(graphParams[idx]);
|
||||||
if (thisDialog->exec() == QDialog::Accepted)
|
if (thisDialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
@@ -491,6 +494,7 @@ void GraphingWindow::showParamsDialog(int idx = -1)
|
|||||||
//create a new graph with the returned parameters.
|
//create a new graph with the returned parameters.
|
||||||
GraphParams params;
|
GraphParams params;
|
||||||
thisDialog->getParams(params);
|
thisDialog->getParams(params);
|
||||||
|
params.graphName = oldName;
|
||||||
createGraph(params);
|
createGraph(params);
|
||||||
}
|
}
|
||||||
delete thisDialog;
|
delete thisDialog;
|
||||||
@@ -540,12 +544,11 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
{
|
{
|
||||||
x[j] = frameCache[j].timestamp;
|
x[j] = frameCache[j].timestamp;
|
||||||
}
|
}
|
||||||
y[j] = (tempVal + params.bias) * params.scale;
|
y[j] = (tempVal * params.scale) + params.bias;
|
||||||
if (y[j] < yminval) yminval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > ymaxval) ymaxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
if (x[j] < xminval) xminval = x[j];
|
if (x[j] < xminval) xminval = x[j];
|
||||||
if (x[j] > xmaxval) xmaxval = x[j];
|
if (x[j] > xmaxval) xmaxval = x[j];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (params.endByte > params.startByte) //big endian
|
else if (params.endByte > params.startByte) //big endian
|
||||||
@@ -591,7 +594,7 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
x[j] = frameCache[j].timestamp;
|
x[j] = frameCache[j].timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
y[j] = (tempValue + params.bias) * params.scale;
|
y[j] = (tempValue * params.scale) + params.bias;
|
||||||
if (y[j] < yminval) yminval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > ymaxval) ymaxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
if (x[j] < xminval) xminval = x[j];
|
if (x[j] < xminval) xminval = x[j];
|
||||||
@@ -640,7 +643,7 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
x[j] = frameCache[j].timestamp;
|
x[j] = frameCache[j].timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
y[j] = (tempValue + params.bias) * params.scale;
|
y[j] = (tempValue * params.scale) + params.bias;
|
||||||
if (y[j] < yminval) yminval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > ymaxval) ymaxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
if (x[j] < xminval) xminval = x[j];
|
if (x[j] < xminval) xminval = x[j];
|
||||||
|
|||||||
+3
-1
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "qcustomplot.h"
|
#include "qcustomplot.h"
|
||||||
#include "can_structs.h"
|
#include "can_structs.h"
|
||||||
|
#include "dbchandler.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ class GraphingWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GraphingWindow(const QVector<CANFrame> *, QWidget *parent = 0);
|
explicit GraphingWindow(DBCHandler *handler, const QVector<CANFrame> *, QWidget *parent = 0);
|
||||||
~GraphingWindow();
|
~GraphingWindow();
|
||||||
void showEvent(QShowEvent*);
|
void showEvent(QShowEvent*);
|
||||||
|
|
||||||
@@ -55,6 +56,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GraphingWindow *ui;
|
Ui::GraphingWindow *ui;
|
||||||
|
DBCHandler *dbcHandler;
|
||||||
QList<CANFrame> frameCache;
|
QList<CANFrame> frameCache;
|
||||||
const QVector<CANFrame> *modelFrames;
|
const QVector<CANFrame> *modelFrames;
|
||||||
QList<GraphParams> graphParams;
|
QList<GraphParams> graphParams;
|
||||||
|
|||||||
+14
-1
@@ -443,11 +443,24 @@ void MainWindow::handleLoadFile()
|
|||||||
|
|
||||||
QVector<CANFrame> tempFrames;
|
QVector<CANFrame> tempFrames;
|
||||||
|
|
||||||
|
QProgressDialog progress(this);
|
||||||
|
progress.setWindowModality(Qt::WindowModal);
|
||||||
|
progress.setLabelText("Loading file...");
|
||||||
|
progress.setCancelButton(0);
|
||||||
|
progress.setRange(0,0);
|
||||||
|
progress.setMinimumDuration(0);
|
||||||
|
progress.show();
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
|
||||||
if (dialog.selectedNameFilter() == filters[0]) result = FrameFileIO::loadCRTDFile(filename, &tempFrames);
|
if (dialog.selectedNameFilter() == filters[0]) result = FrameFileIO::loadCRTDFile(filename, &tempFrames);
|
||||||
if (dialog.selectedNameFilter() == filters[1]) result = FrameFileIO::loadNativeCSVFile(filename, &tempFrames);
|
if (dialog.selectedNameFilter() == filters[1]) result = FrameFileIO::loadNativeCSVFile(filename, &tempFrames);
|
||||||
if (dialog.selectedNameFilter() == filters[2]) result = FrameFileIO::loadGenericCSVFile(filename, &tempFrames);
|
if (dialog.selectedNameFilter() == filters[2]) result = FrameFileIO::loadGenericCSVFile(filename, &tempFrames);
|
||||||
if (dialog.selectedNameFilter() == filters[3]) result = FrameFileIO::loadLogFile(filename, &tempFrames);
|
if (dialog.selectedNameFilter() == filters[3]) result = FrameFileIO::loadLogFile(filename, &tempFrames);
|
||||||
if (dialog.selectedNameFilter() == filters[4]) result = FrameFileIO::loadMicrochipFile(filename, &tempFrames);
|
if (dialog.selectedNameFilter() == filters[4]) result = FrameFileIO::loadMicrochipFile(filename, &tempFrames);
|
||||||
|
|
||||||
|
progress.cancel();
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
model->insertFrames(tempFrames);
|
model->insertFrames(tempFrames);
|
||||||
@@ -840,7 +853,7 @@ void MainWindow::showSettingsDialog()
|
|||||||
void MainWindow::showGraphingWindow()
|
void MainWindow::showGraphingWindow()
|
||||||
{
|
{
|
||||||
if (!graphingWindow) {
|
if (!graphingWindow) {
|
||||||
graphingWindow = new GraphingWindow(model->getListReference());
|
graphingWindow = new GraphingWindow(dbcHandler, model->getListReference());
|
||||||
}
|
}
|
||||||
graphingWindow->show();
|
graphingWindow->show();
|
||||||
}
|
}
|
||||||
|
|||||||
+70
-1
@@ -3,12 +3,14 @@
|
|||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
NewGraphDialog::NewGraphDialog(QWidget *parent) :
|
NewGraphDialog::NewGraphDialog(DBCHandler *handler, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::NewGraphDialog)
|
ui(new Ui::NewGraphDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
dbcHandler = handler;
|
||||||
|
|
||||||
connect(ui->colorSwatch, SIGNAL(clicked(bool)), this, SLOT(colorSwatchClick()));
|
connect(ui->colorSwatch, SIGNAL(clicked(bool)), this, SLOT(colorSwatchClick()));
|
||||||
connect(ui->btnAddGraph, SIGNAL(clicked(bool)), this, SLOT(addButtonClicked()));
|
connect(ui->btnAddGraph, SIGNAL(clicked(bool)), this, SLOT(addButtonClicked()));
|
||||||
|
|
||||||
@@ -21,6 +23,10 @@ NewGraphDialog::NewGraphDialog(QWidget *parent) :
|
|||||||
p.setColor(QPalette::Button, QColor(qrand() % 160,qrand() % 160,qrand() % 160));
|
p.setColor(QPalette::Button, QColor(qrand() % 160,qrand() % 160,qrand() % 160));
|
||||||
ui->colorSwatch->setPalette(p);
|
ui->colorSwatch->setPalette(p);
|
||||||
|
|
||||||
|
connect(ui->cbMessages, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSignals(int)));
|
||||||
|
connect(ui->cbSignals, SIGNAL(currentIndexChanged(int)), this, SLOT(fillFormFromSignal(int)));
|
||||||
|
|
||||||
|
loadMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
NewGraphDialog::~NewGraphDialog()
|
NewGraphDialog::~NewGraphDialog()
|
||||||
@@ -52,6 +58,8 @@ void NewGraphDialog::setParams(GraphParams ¶ms)
|
|||||||
ui->txtStride->setText(QString::number(params.stride));
|
ui->txtStride->setText(QString::number(params.stride));
|
||||||
ui->cbSigned->setChecked(params.isSigned);
|
ui->cbSigned->setChecked(params.isSigned);
|
||||||
|
|
||||||
|
graphName = params.graphName;
|
||||||
|
|
||||||
if (params.endByte > -1)
|
if (params.endByte > -1)
|
||||||
{
|
{
|
||||||
ui->txtData->setText(QString::number(params.startByte) + "-" + QString::number(params.endByte));
|
ui->txtData->setText(QString::number(params.startByte) + "-" + QString::number(params.endByte));
|
||||||
@@ -92,5 +100,66 @@ void NewGraphDialog::getParams(GraphParams ¶ms)
|
|||||||
if (params.mask == 0) params.mask = 0xFFFFFFFF;
|
if (params.mask == 0) params.mask = 0xFFFFFFFF;
|
||||||
if (fabs(params.scale) < 0.00000001) params.scale = 1.0f;
|
if (fabs(params.scale) < 0.00000001) params.scale = 1.0f;
|
||||||
if (params.stride < 1) params.stride = 1;
|
if (params.stride < 1) params.stride = 1;
|
||||||
|
params.graphName = graphName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGraphDialog::loadMessages()
|
||||||
|
{
|
||||||
|
ui->cbMessages->clear();
|
||||||
|
if (dbcHandler == NULL) return;
|
||||||
|
for (int x = 0; x < dbcHandler->dbc_messages.count(); x++)
|
||||||
|
{
|
||||||
|
ui->cbMessages->addItem(dbcHandler->dbc_messages[x].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGraphDialog::loadSignals(int idx)
|
||||||
|
{
|
||||||
|
//messages were placed into the list in the same order as they exist
|
||||||
|
//in the data structure so it should have been possible to just
|
||||||
|
//look it up based on index but by name is probably safer and this operation
|
||||||
|
//is not time critical at all.
|
||||||
|
DBC_MESSAGE *msg = dbcHandler->findMsgByName(ui->cbMessages->currentText());
|
||||||
|
|
||||||
|
if (msg == NULL) return;
|
||||||
|
ui->cbSignals->clear();
|
||||||
|
for (int x = 0; x < msg->msgSignals.count(); x++)
|
||||||
|
{
|
||||||
|
ui->cbSignals->addItem(msg->msgSignals[x].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGraphDialog::fillFormFromSignal(int idx)
|
||||||
|
{
|
||||||
|
GraphParams params;
|
||||||
|
DBC_MESSAGE *msg = dbcHandler->findMsgByName(ui->cbMessages->currentText());
|
||||||
|
|
||||||
|
if (msg == NULL) return;
|
||||||
|
|
||||||
|
DBC_SIGNAL *sig = dbcHandler->findSignalByName(msg, ui->cbSignals->currentText());
|
||||||
|
|
||||||
|
if (sig == NULL) return;
|
||||||
|
|
||||||
|
params.graphName = sig->name;
|
||||||
|
params.ID = msg->ID;
|
||||||
|
params.bias = sig->bias;
|
||||||
|
params.scale = sig->factor;
|
||||||
|
params.stride = 1;
|
||||||
|
params.mask = (1 << (sig->signalSize)) - 1;
|
||||||
|
params.color = ui->colorSwatch->palette().color(QPalette::Button);
|
||||||
|
if (sig->intelByteOrder)
|
||||||
|
{
|
||||||
|
//for this ordering the byte order is reserved and starting byte
|
||||||
|
//will be the higher value
|
||||||
|
params.endByte = sig->startBit / 8;
|
||||||
|
params.startByte = (sig->startBit + sig->signalSize - 1) / 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//for this ordering it goes in normal numerical order
|
||||||
|
params.startByte = sig->startBit / 8;
|
||||||
|
params.endByte = (sig->startBit + sig->signalSize - 1) / 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
setParams(params);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "graphingwindow.h"
|
#include "graphingwindow.h"
|
||||||
|
#include "dbchandler.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class NewGraphDialog;
|
class NewGraphDialog;
|
||||||
@@ -13,7 +14,7 @@ class NewGraphDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NewGraphDialog(QWidget *parent = 0);
|
explicit NewGraphDialog(DBCHandler *handler, QWidget *parent = 0);
|
||||||
~NewGraphDialog();
|
~NewGraphDialog();
|
||||||
void getParams(GraphParams &);
|
void getParams(GraphParams &);
|
||||||
void setParams(GraphParams &);
|
void setParams(GraphParams &);
|
||||||
@@ -21,9 +22,14 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void addButtonClicked();
|
void addButtonClicked();
|
||||||
void colorSwatchClick();
|
void colorSwatchClick();
|
||||||
|
void loadMessages();
|
||||||
|
void loadSignals(int idx);
|
||||||
|
void fillFormFromSignal(int idx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::NewGraphDialog *ui;
|
Ui::NewGraphDialog *ui;
|
||||||
|
DBCHandler *dbcHandler;
|
||||||
|
QString graphName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NEWGRAPHDIALOG_H
|
#endif // NEWGRAPHDIALOG_H
|
||||||
|
|||||||
+166
-104
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>273</width>
|
<width>492</width>
|
||||||
<height>309</height>
|
<height>309</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -15,110 +15,172 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="text">
|
<item row="0" column="0">
|
||||||
<string>ID:</string>
|
<widget class="QLabel" name="label">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>ID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtID"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Data:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtData"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Signed:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="cbSigned">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Mask:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtMask"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bias:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtBias"/>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Scale</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtScale"/>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Stride</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLineEdit" name="txtStride"/>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QPushButton" name="colorSwatch">
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CHANGE</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="QPushButton" name="btnAddGraph">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add this graph</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Data:</string>
|
<widget class="QLabel" name="label_11">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
</widget>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
</item>
|
<horstretch>0</horstretch>
|
||||||
<item row="2" column="0">
|
<verstretch>0</verstretch>
|
||||||
<widget class="QLabel" name="label_3">
|
</sizepolicy>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Signed:</string>
|
<property name="text">
|
||||||
</property>
|
<string>Graph a DBC Signal:</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="alignment">
|
||||||
<item row="3" column="0">
|
<set>Qt::AlignCenter</set>
|
||||||
<widget class="QLabel" name="label_4">
|
</property>
|
||||||
<property name="frameShape">
|
</widget>
|
||||||
<enum>QFrame::NoFrame</enum>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="text">
|
<widget class="QLabel" name="label_9">
|
||||||
<string>Mask:</string>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
</widget>
|
<horstretch>0</horstretch>
|
||||||
</item>
|
<verstretch>0</verstretch>
|
||||||
<item row="4" column="0">
|
</sizepolicy>
|
||||||
<widget class="QLabel" name="label_5">
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bias:</string>
|
<string>Message:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="alignment">
|
||||||
</item>
|
<set>Qt::AlignCenter</set>
|
||||||
<item row="5" column="0">
|
</property>
|
||||||
<widget class="QLabel" name="label_6">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>Scale</string>
|
<item>
|
||||||
</property>
|
<widget class="QComboBox" name="cbMessages"/>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<item>
|
||||||
<item row="6" column="0">
|
<widget class="QLabel" name="label_10">
|
||||||
<widget class="QLabel" name="label_7">
|
<property name="sizePolicy">
|
||||||
<property name="text">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<string>Stride</string>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
</widget>
|
</sizepolicy>
|
||||||
</item>
|
</property>
|
||||||
<item row="7" column="0">
|
<property name="text">
|
||||||
<widget class="QLabel" name="label_8">
|
<string>Signal:</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Color</string>
|
<property name="alignment">
|
||||||
</property>
|
<set>Qt::AlignCenter</set>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item row="0" column="1">
|
</item>
|
||||||
<widget class="QLineEdit" name="txtID"/>
|
<item>
|
||||||
</item>
|
<widget class="QComboBox" name="cbSignals"/>
|
||||||
<item row="1" column="1">
|
</item>
|
||||||
<widget class="QLineEdit" name="txtData"/>
|
</layout>
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QCheckBox" name="cbSigned">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="txtMask"/>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLineEdit" name="txtBias"/>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLineEdit" name="txtScale"/>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLineEdit" name="txtStride"/>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="QPushButton" name="btnAddGraph">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add this graph</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QPushButton" name="colorSwatch">
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>CHANGE</string>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user