The mode to turn off hex display now works for the main frame view. It doesn't work elsewhere.
This commit is contained in:
+16
-2
@@ -20,6 +20,16 @@ CANFrameModel::CANFrameModel(QObject *parent)
|
||||
timeOffset = 0;
|
||||
}
|
||||
|
||||
void CANFrameModel::setHexMode(bool mode)
|
||||
{
|
||||
if (useHexMode != mode)
|
||||
{
|
||||
this->beginResetModel();
|
||||
useHexMode = mode;
|
||||
this->endResetModel();
|
||||
}
|
||||
}
|
||||
|
||||
void CANFrameModel::setDBCHandler(DBCHandler *handler)
|
||||
{
|
||||
dbcHandler = handler;
|
||||
@@ -104,7 +114,10 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
|
||||
return QString::number(thisFrame.timestamp);
|
||||
break;
|
||||
case 1: //id
|
||||
return QString::number(thisFrame.ID, 16).toUpper().rightJustified(2,'0');
|
||||
if (useHexMode)
|
||||
return QString::number(thisFrame.ID, 16).toUpper().rightJustified(2,'0');
|
||||
else
|
||||
return QString::number(thisFrame.ID).rightJustified(3,'0');
|
||||
break;
|
||||
case 2: //ext
|
||||
return QString::number(thisFrame.extended);
|
||||
@@ -118,7 +131,8 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
|
||||
case 5: //data
|
||||
for (int i = 0; i < thisFrame.len; i++)
|
||||
{
|
||||
tempString.append(QString::number(thisFrame.data[i], 16).toUpper().rightJustified(2,'0'));
|
||||
if (useHexMode) tempString.append(QString::number(thisFrame.data[i], 16).toUpper().rightJustified(2,'0'));
|
||||
else tempString.append(QString::number(thisFrame.data[i]).rightJustified(3,'0'));
|
||||
tempString.append(" ");
|
||||
}
|
||||
//now, if we're supposed to interpret the data and the DBC handler is loaded then use it
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
void setDBCHandler(DBCHandler *);
|
||||
void setInterpetMode(bool);
|
||||
void setOverwriteMode(bool);
|
||||
void setHexMode(bool);
|
||||
void normalizeTiming();
|
||||
void recalcOverwrite();
|
||||
void insertFrames(const QVector<CANFrame> &newFrames);
|
||||
@@ -42,6 +43,7 @@ private:
|
||||
QMutex mutex;
|
||||
bool interpretFrames; //should we use the dbcHandler?
|
||||
bool overwriteDups; //should we display all frames or only the newest for each ID?
|
||||
bool useHexMode;
|
||||
uint64_t timeOffset;
|
||||
};
|
||||
|
||||
|
||||
+3
-2
@@ -43,8 +43,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QCoreApplication::setOrganizationDomain("evtv.me");
|
||||
QCoreApplication::setApplicationName("SavvyCAN");
|
||||
|
||||
readSettings();
|
||||
|
||||
selfRef = this;
|
||||
|
||||
this->setWindowTitle("Savvy CAN V" + QString::number(VERSION));
|
||||
@@ -52,6 +50,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
model = new CANFrameModel();
|
||||
ui->canFramesView->setModel(model);
|
||||
|
||||
readSettings();
|
||||
|
||||
QStringList headers;
|
||||
headers << "Timestamp" << "ID" << "Ext" << "Bus" << "Len" << "Data";
|
||||
//model->setHorizontalHeaderLabels(headers);
|
||||
@@ -242,6 +242,7 @@ void MainWindow::readSettings()
|
||||
{
|
||||
ui->cbAutoScroll->setChecked(true);
|
||||
}
|
||||
model->setHexMode(settings.value("Main/UseHex", true).toBool());
|
||||
}
|
||||
|
||||
void MainWindow::writeSettings()
|
||||
|
||||
Reference in New Issue
Block a user