Fix for proper clearing of frames, addition of a couple of saving formats.
This commit is contained in:
+3
-3
@@ -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-02T23:26:55. -->
|
<!-- Written by QtCreator 3.4.0, 2015-05-04T22:19:29. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
@@ -227,8 +227,8 @@
|
|||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SavvyCAN</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SavvyCAN</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SavvyCAN2</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Collin/Documents/SavvyCAN/SavvyCAN.pro</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Collin/Desktop/SavvyCAN/SavvyCAN.pro</value>
|
||||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">SavvyCAN.pro</value>
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">SavvyCAN.pro</value>
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||||
|
|||||||
+2
-2
@@ -118,9 +118,9 @@ void CANFrameModel::sendRefresh(int pos)
|
|||||||
|
|
||||||
void CANFrameModel::clearFrames()
|
void CANFrameModel::clearFrames()
|
||||||
{
|
{
|
||||||
beginRemoveRows(QModelIndex(), 0, frames.count());
|
this->beginResetModel();
|
||||||
frames.clear();
|
frames.clear();
|
||||||
endRemoveRows();
|
this->endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Is this safe? Maybe not but if we don't change it then that's OK
|
//Is this safe? Maybe not but if we don't change it then that's OK
|
||||||
|
|||||||
+122
-3
@@ -14,8 +14,6 @@ can replace it as a cross platform solution.
|
|||||||
Here are things yet to do
|
Here are things yet to do
|
||||||
- Support saving frames
|
- Support saving frames
|
||||||
- Add flow view - ability to see bits change over time
|
- Add flow view - ability to see bits change over time
|
||||||
- Implement the rest of the file loading formats
|
|
||||||
- Add frame counter to main screen and a way to auto scroll
|
|
||||||
- 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)
|
||||||
|
|
||||||
@@ -33,6 +31,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->actionGraph_Dta, SIGNAL(triggered(bool)), this, SLOT(showGraphingWindow()));
|
connect(ui->actionGraph_Dta, SIGNAL(triggered(bool)), this, SLOT(showGraphingWindow()));
|
||||||
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()));
|
||||||
|
|
||||||
model = new CANFrameModel();
|
model = new CANFrameModel();
|
||||||
ui->canFramesView->setModel(model);
|
ui->canFramesView->setModel(model);
|
||||||
@@ -81,6 +80,7 @@ void MainWindow::addFrameToDisplay(CANFrame &frame, bool autoRefresh = false)
|
|||||||
|
|
||||||
void MainWindow::clearFrames()
|
void MainWindow::clearFrames()
|
||||||
{
|
{
|
||||||
|
ui->canFramesView->scrollToTop();
|
||||||
model->clearFrames();
|
model->clearFrames();
|
||||||
ui->lbNumFrames->setText(QString::number(model->rowCount()));
|
ui->lbNumFrames->setText(QString::number(model->rowCount()));
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,40 @@ void MainWindow::loadCRTDFile(QString filename)
|
|||||||
model->sendRefresh();
|
model->sendRefresh();
|
||||||
ui->lbNumFrames->setText(QString::number(model->rowCount()));
|
ui->lbNumFrames->setText(QString::number(model->rowCount()));
|
||||||
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveCRTDFile(QString filename)
|
||||||
|
{
|
||||||
|
QFile *outFile = new QFile(filename);
|
||||||
|
QList<CANFrame> *frames = model->getListReference();
|
||||||
|
|
||||||
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
|
return;
|
||||||
|
|
||||||
|
outFile->write(QString::number(frames->at(0).timestamp).toUtf8() + tr(" CXX GVRET-PC Reverse Engineering Tool Output").toUtf8());
|
||||||
|
outFile->write("\n");
|
||||||
|
|
||||||
|
for (int c = 0; c < frames->count(); c++)
|
||||||
|
{
|
||||||
|
outFile->write(QString::number(frames->at(c).timestamp).toUtf8());
|
||||||
|
outFile->putChar(' ');
|
||||||
|
if (frames->at(c).extended)
|
||||||
|
{
|
||||||
|
outFile->write("R29 ");
|
||||||
|
}
|
||||||
|
else outFile->write("R11 ");
|
||||||
|
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8());
|
||||||
|
outFile->putChar(' ');
|
||||||
|
|
||||||
|
for (int temp = 0; temp < frames->at(c).len; temp++)
|
||||||
|
{
|
||||||
|
outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||||
|
outFile->putChar(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
outFile->write("\n");
|
||||||
|
}
|
||||||
|
outFile->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
//The "native" file format for this program
|
//The "native" file format for this program
|
||||||
@@ -195,6 +228,48 @@ void MainWindow::loadNativeCSVFile(QString filename)
|
|||||||
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveNativeCSVFile(QString filename)
|
||||||
|
{
|
||||||
|
QFile *outFile = new QFile(filename);
|
||||||
|
QList<CANFrame> *frames = model->getListReference();
|
||||||
|
|
||||||
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
|
return;
|
||||||
|
|
||||||
|
outFile->write("Time Stamp,ID,Extended,Bus,LEN,D1,D2,D3,D4,D5,D6,D7,D8");
|
||||||
|
outFile->write("\n");
|
||||||
|
|
||||||
|
for (int c = 0; c < frames->count(); c++)
|
||||||
|
{
|
||||||
|
outFile->write(QString::number(frames->at(c).timestamp).toUtf8());
|
||||||
|
outFile->putChar(44);
|
||||||
|
|
||||||
|
outFile->write(QString::number(frames->at(c).ID, 16).toUpper().rightJustified(8, '0').toUtf8());
|
||||||
|
outFile->putChar(44);
|
||||||
|
|
||||||
|
if (frames->at(c).extended) outFile->write("true,");
|
||||||
|
else outFile->write("false,");
|
||||||
|
|
||||||
|
outFile->write(QString::number(frames->at(c).bus).toUtf8());
|
||||||
|
outFile->putChar(44);
|
||||||
|
|
||||||
|
outFile->write(QString::number(frames->at(c).len).toUtf8());
|
||||||
|
outFile->putChar(44);
|
||||||
|
|
||||||
|
|
||||||
|
for (int temp = 0; temp < 8; temp++)
|
||||||
|
{
|
||||||
|
outFile->write(QString::number(frames->at(c).data[temp], 16).toUpper().rightJustified(2, '0').toUtf8());
|
||||||
|
outFile->putChar(44);
|
||||||
|
}
|
||||||
|
|
||||||
|
outFile->write("\n");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
outFile->close();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::loadGenericCSVFile(QString filename)
|
void MainWindow::loadGenericCSVFile(QString filename)
|
||||||
{
|
{
|
||||||
QFile *inFile = new QFile(filename);
|
QFile *inFile = new QFile(filename);
|
||||||
@@ -232,6 +307,11 @@ void MainWindow::loadGenericCSVFile(QString filename)
|
|||||||
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveGenericCSVFile(QString filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//busmaster log file
|
//busmaster log file
|
||||||
/*
|
/*
|
||||||
tokens:
|
tokens:
|
||||||
@@ -276,6 +356,11 @@ void MainWindow::loadLogFile(QString filename)
|
|||||||
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveLogFile(QString filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//log file from microchip tool
|
//log file from microchip tool
|
||||||
/*
|
/*
|
||||||
tokens:
|
tokens:
|
||||||
@@ -331,6 +416,11 @@ void MainWindow::loadMicrochipFile(QString filename)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveMicrochipFile(QString filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::handleLoadFile()
|
void MainWindow::handleLoadFile()
|
||||||
{
|
{
|
||||||
QString filename;
|
QString filename;
|
||||||
@@ -359,6 +449,35 @@ void MainWindow::handleLoadFile()
|
|||||||
if (dialog.selectedNameFilter() == filters[4]) loadMicrochipFile(filename);
|
if (dialog.selectedNameFilter() == filters[4]) loadMicrochipFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::handleSaveFile()
|
||||||
|
{
|
||||||
|
QString filename;
|
||||||
|
QFileDialog dialog(this);
|
||||||
|
|
||||||
|
QStringList filters;
|
||||||
|
filters.append(QString(tr("CRTD Logs (*.txt)")));
|
||||||
|
filters.append(QString(tr("GVRET Logs (*.csv)")));
|
||||||
|
filters.append(QString(tr("Generic ID/Data CSV (*.csv)")));
|
||||||
|
filters.append(QString(tr("BusMaster Log (*.log)")));
|
||||||
|
filters.append(QString(tr("Microchip Log (*.log)")));
|
||||||
|
|
||||||
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
dialog.setNameFilters(filters);
|
||||||
|
dialog.setViewMode(QFileDialog::Detail);
|
||||||
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
|
|
||||||
|
if (dialog.exec())
|
||||||
|
{
|
||||||
|
filename = dialog.selectedFiles()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dialog.selectedNameFilter() == filters[0]) saveCRTDFile(filename);
|
||||||
|
if (dialog.selectedNameFilter() == filters[1]) saveNativeCSVFile(filename);
|
||||||
|
if (dialog.selectedNameFilter() == filters[2]) saveGenericCSVFile(filename);
|
||||||
|
if (dialog.selectedNameFilter() == filters[3]) saveLogFile(filename);
|
||||||
|
if (dialog.selectedNameFilter() == filters[4]) saveMicrochipFile(filename);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::connButtonPress()
|
void MainWindow::connButtonPress()
|
||||||
{
|
{
|
||||||
if (port->isOpen())
|
if (port->isOpen())
|
||||||
@@ -396,7 +515,7 @@ void MainWindow::readSerialData()
|
|||||||
{
|
{
|
||||||
QByteArray data = port->readAll();
|
QByteArray data = port->readAll();
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
ui->statusBar->showMessage(tr("Got data from serial. Len = %0").arg(data.length()));
|
qDebug() << (tr("Got data from serial. Len = %0").arg(data.length()));
|
||||||
for (int i = 0; i < data.length(); i++)
|
for (int i = 0; i < data.length(); i++)
|
||||||
{
|
{
|
||||||
c = data.at(i);
|
c = data.at(i);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleLoadFile();
|
void handleLoadFile();
|
||||||
|
void handleSaveFile();
|
||||||
void connButtonPress();
|
void connButtonPress();
|
||||||
void readSerialData();
|
void readSerialData();
|
||||||
void showGraphingWindow();
|
void showGraphingWindow();
|
||||||
@@ -55,6 +56,11 @@ private:
|
|||||||
void loadGenericCSVFile(QString);
|
void loadGenericCSVFile(QString);
|
||||||
void loadLogFile(QString);
|
void loadLogFile(QString);
|
||||||
void loadMicrochipFile(QString);
|
void loadMicrochipFile(QString);
|
||||||
|
void saveCRTDFile(QString);
|
||||||
|
void saveNativeCSVFile(QString);
|
||||||
|
void saveGenericCSVFile(QString);
|
||||||
|
void saveLogFile(QString);
|
||||||
|
void saveMicrochipFile(QString);
|
||||||
void addFrameToDisplay(CANFrame &, bool);
|
void addFrameToDisplay(CANFrame &, bool);
|
||||||
void procRXChar(unsigned char);
|
void procRXChar(unsigned char);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user