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:
+9
-1
@@ -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)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
void setAllFilters(bool state);
|
||||
void setSecondsMode(bool);
|
||||
void setTimeFormat(QString);
|
||||
void setBytesPerLine(int bpl);
|
||||
void loadFilterFile(QString filename);
|
||||
void saveFilterFile(QString filename);
|
||||
void normalizeTiming();
|
||||
@@ -101,6 +102,7 @@ private:
|
||||
int lastUpdateNumFrames;
|
||||
uint32_t preallocSize;
|
||||
bool sortDirAsc;
|
||||
int bytesPerLine;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
ui->comboSendingBus->addItem(tr("None"));
|
||||
ui->comboSendingBus->addItem(tr("0"));
|
||||
ui->comboSendingBus->addItem(tr("1"));
|
||||
ui->comboSendingBus->addItem(tr("Both"));
|
||||
ui->comboSendingBus->addItem(tr("All"));
|
||||
ui->comboSendingBus->addItem(tr("From File"));
|
||||
|
||||
//update the GUI with all the settings we have stored giving things
|
||||
@@ -104,6 +104,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
}
|
||||
|
||||
ui->spinMaximumFrames->setValue(settings.value("Main/MaximumFrames", maxFramesDefault).toInt());
|
||||
ui->spinBytesPerLine->setValue(settings.value("Main/BytesPerLine", 8).toInt());
|
||||
|
||||
//just for simplicity they all call the same function and that function updates all settings at once
|
||||
connect(ui->cbDisplayHex, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
@@ -134,6 +135,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
connect(ui->cbIgnoreDBCColors, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->spinMaximumFrames, SIGNAL(valueChanged(int)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbFontFixedWidth, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->spinBytesPerLine, SIGNAL(valueChanged(int)), this, SLOT(updateSettings()));
|
||||
|
||||
installEventFilter(this);
|
||||
}
|
||||
@@ -201,6 +203,7 @@ void MainSettingsDialog::updateSettings()
|
||||
settings.setValue("Main/FilterLabeling", ui->cbFilterLabeling->isChecked());
|
||||
settings.setValue("Main/IgnoreDBCColors", ui->cbIgnoreDBCColors->isChecked());
|
||||
settings.setValue("Main/MaximumFrames", ui->spinMaximumFrames->value());
|
||||
settings.setValue("Main/BytesPerLine", ui->spinBytesPerLine->value());
|
||||
settings.setValue("Main/FontFixedWidth", ui->cbFontFixedWidth->isChecked());
|
||||
|
||||
settings.sync();
|
||||
|
||||
@@ -392,6 +392,8 @@ void MainWindow::readUpdateableSettings()
|
||||
model->setTimeFormat(settings.value("Main/TimeFormat", "MMM-dd HH:mm:ss.zzz").toString());
|
||||
ignoreDBCColors = settings.value("Main/IgnoreDBCColors", false).toBool();
|
||||
model->setIgnoreDBCColors(ignoreDBCColors);
|
||||
int bpl = settings.value("Main/BytesPerLine", 8).toInt();
|
||||
model->setBytesPerLine(bpl);
|
||||
|
||||
if (settings.value("Main/FilterLabeling", false).toBool())
|
||||
ui->listFilters->setMaximumWidth(250);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>965</width>
|
||||
<height>713</height>
|
||||
<height>815</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -29,6 +29,30 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Maximum data bytes per line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBytesPerLine">
|
||||
<property name="minimum">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>64</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user