Added a setting that allows for limiting the number of bytes per line.

This is useful if you have a 1920x1080 monitor or smaller resolution
but you want to capture 64 byte payloads. The default is 8 bytes but
usually 16 bytes is fine.
This commit is contained in:
Collin Kidder
2022-12-08 20:35:33 -05:00
parent 8ff3459c75
commit e1f06be6fd
5 changed files with 42 additions and 3 deletions
+9 -1
View File
@@ -76,6 +76,12 @@ CANFrameModel::CANFrameModel(QObject *parent)
lastUpdateNumFrames = 0;
timeFormat = "MMM-dd HH:mm:ss.zzz";
sortDirAsc = false;
bytesPerLine = 8;
}
void CANFrameModel::setBytesPerLine(int bpl)
{
bytesPerLine = bpl;
}
void CANFrameModel::setHexMode(bool mode)
@@ -514,6 +520,7 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
if (byt < 0x20) byt = 0x2E; //dot character
if (byt > 0x7E) byt = 0x2E;
tempString.append(QString::fromUtf8(&byt, 1));
if (!((i+1) % bytesPerLine) && (i != (dataLen - 1))) tempString.append("\n");
}
}
if (thisFrame.frameType() == QCanBusFrame::ErrorFrame)
@@ -531,7 +538,8 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
{
if (useHexMode) tempString.append( QString::number(data[i], 16).toUpper().rightJustified(2, '0'));
else tempString.append(QString::number(data[i], 10));
tempString.append(" ");
if (!((i+1) % bytesPerLine) && (i != (dataLen - 1))) tempString.append("\n");
else tempString.append(" ");
}
if (thisFrame.frameType() == thisFrame.ErrorFrame)
{