Fixes to allow native files and CRTD files to load with frame that have zero data bytes, allow loading of files that have errors.
This commit is contained in:
+2
-2
@@ -325,7 +325,7 @@ bool FrameFileIO::loadCRTDFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
{
|
{
|
||||||
QList<QByteArray> tokens = line.split(' ');
|
QList<QByteArray> tokens = line.split(' ');
|
||||||
int multiplier;
|
int multiplier;
|
||||||
if (tokens.length() > 3)
|
if (tokens.length() > 2)
|
||||||
{
|
{
|
||||||
int idxOfDecimal = tokens[0].indexOf('.');
|
int idxOfDecimal = tokens[0].indexOf('.');
|
||||||
if (idxOfDecimal > -1) {
|
if (idxOfDecimal > -1) {
|
||||||
@@ -699,7 +699,7 @@ bool FrameFileIO::loadNativeCSVFile(QString filename, QVector<CANFrame>* frames)
|
|||||||
if (line.length() > 2)
|
if (line.length() > 2)
|
||||||
{
|
{
|
||||||
QList<QByteArray> tokens = line.split(',');
|
QList<QByteArray> tokens = line.split(',');
|
||||||
if (tokens.length() >= 6)
|
if (tokens.length() >= 5)
|
||||||
{
|
{
|
||||||
if (tokens[0].length() > 3)
|
if (tokens[0].length() > 3)
|
||||||
{
|
{
|
||||||
|
|||||||
+14
-1
@@ -545,7 +545,20 @@ void MainWindow::handleLoadFile()
|
|||||||
QString filename;
|
QString filename;
|
||||||
QVector<CANFrame> tempFrames;
|
QVector<CANFrame> tempFrames;
|
||||||
|
|
||||||
if (FrameFileIO::loadFrameFile(filename, &tempFrames))
|
QMessageBox::StandardButton confirmDialog;
|
||||||
|
|
||||||
|
bool loadResult = FrameFileIO::loadFrameFile(filename, &tempFrames);
|
||||||
|
|
||||||
|
if (!loadResult)
|
||||||
|
{
|
||||||
|
confirmDialog = QMessageBox::question(this, "Error Loading", "Do you want to salvage what could be loaded?",
|
||||||
|
QMessageBox::Yes|QMessageBox::No);
|
||||||
|
if (confirmDialog == QMessageBox::Yes) {
|
||||||
|
loadResult = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loadResult)
|
||||||
{
|
{
|
||||||
ui->canFramesView->scrollToTop();
|
ui->canFramesView->scrollToTop();
|
||||||
model->clearFrames();
|
model->clearFrames();
|
||||||
|
|||||||
Reference in New Issue
Block a user