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