Added two modes - millisecond timestamps for frames and a way to
ignore colors set in DBC files
This commit is contained in:
+22
-2
@@ -103,6 +103,16 @@ void CANFrameModel::setSysTimeMode(bool mode)
|
||||
}
|
||||
}
|
||||
|
||||
void CANFrameModel::setMillisMode(bool mode)
|
||||
{
|
||||
if (Utility::millisMode != mode)
|
||||
{
|
||||
this->beginResetModel();
|
||||
Utility::millisMode = mode;
|
||||
this->endResetModel();
|
||||
}
|
||||
}
|
||||
|
||||
void CANFrameModel::setInterpretMode(bool mode)
|
||||
{
|
||||
//if the state of interpretFrames changes then we need to reset the model
|
||||
@@ -127,6 +137,16 @@ void CANFrameModel::setTimeFormat(QString format)
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void CANFrameModel::setIgnoreDBCColors(bool mode)
|
||||
{
|
||||
if(ignoreDBCColors != mode)
|
||||
{
|
||||
beginResetModel(); //reset model to update the view
|
||||
ignoreDBCColors = mode;
|
||||
endResetModel();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan all frames for the smallest timestamp and offset all timestamps so that smallest one is at 0
|
||||
*/
|
||||
@@ -385,7 +405,7 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
if (role == Qt::BackgroundColorRole)
|
||||
{
|
||||
if (dbcHandler != nullptr && interpretFrames)
|
||||
if (dbcHandler != nullptr && interpretFrames && !ignoreDBCColors)
|
||||
{
|
||||
DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame);
|
||||
if (msg != nullptr)
|
||||
@@ -418,7 +438,7 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
if (role == Qt::TextColorRole)
|
||||
{
|
||||
if (dbcHandler != nullptr && interpretFrames)
|
||||
if (dbcHandler != nullptr && interpretFrames && !ignoreDBCColors)
|
||||
{
|
||||
DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame);
|
||||
if (msg != nullptr)
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
void setOverwriteMode(bool);
|
||||
void setHexMode(bool);
|
||||
void setSysTimeMode(bool);
|
||||
void setMillisMode(bool mode);
|
||||
void setIgnoreDBCColors(bool mode);
|
||||
void setFilterState(unsigned int ID, bool state);
|
||||
void setBusFilterState(unsigned int BusID, bool state);
|
||||
void setAllFilters(bool state);
|
||||
@@ -92,6 +94,7 @@ private:
|
||||
bool timeSeconds;
|
||||
bool useSystemTime;
|
||||
bool needFilterRefresh;
|
||||
bool ignoreDBCColors;
|
||||
int64_t timeOffset;
|
||||
int lastUpdateNumFrames;
|
||||
uint32_t preallocSize;
|
||||
|
||||
+17
-1
@@ -17,7 +17,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
QSettings settings;
|
||||
ui->setupUi(this);
|
||||
|
||||
//TODO: This is still hard coded to support only two buses. Sometimes there is none, sometimes 1, sometimes much more than 2. Fix this.
|
||||
//TODO: This is still hard coded to support only two buses. Sometimes there is none, sometimes 1, sometimes much more than 2. Fix this.
|
||||
ui->comboSendingBus->addItem(tr("None"));
|
||||
ui->comboSendingBus->addItem(tr("0"));
|
||||
ui->comboSendingBus->addItem(tr("1"));
|
||||
@@ -51,11 +51,13 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
|
||||
bool secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
||||
bool clockMode = settings.value("Main/TimeClock", false).toBool();
|
||||
bool milliMode = settings.value("Main/TimeMillis", false).toBool();
|
||||
if (clockMode)
|
||||
{
|
||||
ui->rbSeconds->setChecked(false);
|
||||
ui->rbMicros->setChecked(false);
|
||||
ui->rbSysClock->setChecked(true);
|
||||
ui->rbMillis->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -64,12 +66,21 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
ui->rbSeconds->setChecked(true);
|
||||
ui->rbMicros->setChecked(false);
|
||||
ui->rbSysClock->setChecked(false);
|
||||
ui->rbMillis->setChecked(false);
|
||||
}
|
||||
else if (milliMode)
|
||||
{
|
||||
ui->rbSeconds->setChecked(false);
|
||||
ui->rbMicros->setChecked(false);
|
||||
ui->rbSysClock->setChecked(false);
|
||||
ui->rbMillis->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->rbSeconds->setChecked(false);
|
||||
ui->rbMicros->setChecked(true);
|
||||
ui->rbSysClock->setChecked(false);
|
||||
ui->rbMillis->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +88,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
ui->cbUseFiltered->setChecked(settings.value("Main/UseFiltered", false).toBool());
|
||||
ui->cbUseOpenGL->setChecked(settings.value("Main/UseOpenGL", false).toBool());
|
||||
ui->cbFilterLabeling->setChecked(settings.value("Main/FilterLabeling", true).toBool());
|
||||
ui->cbIgnoreDBCColors->setChecked(settings.value("Main/IgnoreDBCColors", false).toBool());
|
||||
|
||||
//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()));
|
||||
@@ -91,6 +103,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
connect(ui->rbSeconds, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->rbMicros, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->rbSysClock, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->rbMillis, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->comboSendingBus, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbUseFiltered, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->lineClockFormat, SIGNAL(editingFinished()), this, SLOT(updateSettings()));
|
||||
@@ -103,6 +116,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
connect(ui->cbFilterLabeling, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbHexGraphFlow, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbHexGraphInfo, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbIgnoreDBCColors, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
|
||||
installEventFilter(this);
|
||||
}
|
||||
@@ -155,6 +169,7 @@ void MainSettingsDialog::updateSettings()
|
||||
settings.setValue("Main/ValidateComm", ui->cbValidate->isChecked());
|
||||
settings.setValue("Playback/DefSpeed", ui->spinPlaybackSpeed->value());
|
||||
settings.setValue("Main/TimeSeconds", ui->rbSeconds->isChecked());
|
||||
settings.setValue("Main/TimeMillis", ui->rbMillis->isChecked());
|
||||
settings.setValue("Main/TimeClock", ui->rbSysClock->isChecked());
|
||||
settings.setValue("Playback/SendingBus", ui->comboSendingBus->currentIndex());
|
||||
settings.setValue("Main/UseFiltered", ui->cbUseFiltered->isChecked());
|
||||
@@ -167,6 +182,7 @@ void MainSettingsDialog::updateSettings()
|
||||
QByteArray encPass = crypto.encryptToByteArray(ui->lineRemotePassword->text());
|
||||
settings.setValue("Remote/Pass", encPass);
|
||||
settings.setValue("Main/FilterLabeling", ui->cbFilterLabeling->isChecked());
|
||||
settings.setValue("Main/IgnoreDBCColors", ui->cbIgnoreDBCColors->isChecked());
|
||||
|
||||
settings.sync();
|
||||
emit updatedSettings();
|
||||
|
||||
@@ -361,6 +361,11 @@ void MainWindow::readSettings()
|
||||
readUpdateableSettings();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* TODO: The way the frame timing mode is specified is DEAD STUPID. There shouldn't be three boolean values
|
||||
* for this. Instead switch it all to an ENUM or something sane.
|
||||
*/
|
||||
void MainWindow::readUpdateableSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -371,8 +376,12 @@ void MainWindow::readUpdateableSettings()
|
||||
model->setSecondsMode(secondsMode);
|
||||
useSystemClock = settings.value("Main/TimeClock", false).toBool();
|
||||
model->setSysTimeMode(useSystemClock);
|
||||
millisMode = settings.value("Main/TimeMillis", false).toBool();
|
||||
model->setMillisMode(millisMode);
|
||||
useFiltered = settings.value("Main/UseFiltered", false).toBool();
|
||||
model->setTimeFormat(settings.value("Main/TimeFormat", "MMM-dd HH:mm:ss.zzz").toString());
|
||||
ignoreDBCColors = settings.value("Main/IgnoreDBCColors", false).toBool();
|
||||
model->setIgnoreDBCColors(ignoreDBCColors);
|
||||
|
||||
if (settings.value("Main/FilterLabeling", false).toBool())
|
||||
ui->listFilters->setMaximumWidth(250);
|
||||
|
||||
@@ -144,7 +144,9 @@ private:
|
||||
bool useHex;
|
||||
bool allowCapture;
|
||||
bool secondsMode;
|
||||
bool millisMode;
|
||||
bool useSystemClock;
|
||||
bool ignoreDBCColors;
|
||||
bool bDirty; //have frames been added or subtracted since the last save/load?
|
||||
bool useFiltered; //should sub-windows use the unfiltered or filtered frames list?
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>965</width>
|
||||
<height>668</height>
|
||||
<height>678</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -73,13 +73,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbFilterLabeling">
|
||||
<property name="text">
|
||||
<string>Label filters using messages from DBC files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbUseOpenGL">
|
||||
<property name="text">
|
||||
@@ -96,7 +89,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Seconds/Microseconds are dongle based</string>
|
||||
<string>Seconds/Milli/Micro are dongle based</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -116,6 +109,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbMillis">
|
||||
<property name="text">
|
||||
<string>Milliseconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -275,6 +275,29 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
<string>DBC Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbFilterLabeling">
|
||||
<property name="text">
|
||||
<string>Label DBC Signals by default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbIgnoreDBCColors">
|
||||
<property name="text">
|
||||
<string>Ignore DBC signal colors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
bool Utility::decimalMode = false;
|
||||
bool Utility::secondsMode = true;
|
||||
bool Utility::sysTimeMode = false;
|
||||
bool Utility::millisMode = false;
|
||||
QString Utility::timeFormat = "MMM-dd HH:mm:ss.zzz";
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
|
||||
static bool decimalMode;
|
||||
static bool secondsMode;
|
||||
static bool millisMode;
|
||||
static bool sysTimeMode;
|
||||
static QString timeFormat;
|
||||
|
||||
@@ -148,8 +149,12 @@ public:
|
||||
static QVariant formatTimestamp(uint64_t timestamp)
|
||||
{
|
||||
if (!sysTimeMode) {
|
||||
if (millisMode) return (double)timestamp / 1000.0;
|
||||
if (!secondsMode) return (unsigned long long)(timestamp);
|
||||
else return (double)timestamp / 1000000.0;
|
||||
else
|
||||
{
|
||||
return (double)timestamp / 1000000.0;
|
||||
}
|
||||
}
|
||||
else return QDateTime::fromMSecsSinceEpoch(timestamp / 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user