fix rebased version for QT5 compatibility + dbc handler fixes
This commit is contained in:
+18
-17
@@ -67,17 +67,6 @@ bool DBCSignalHandler::addSignal(DBC_SIGNAL &sig)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool signal_cmp(DBC_SIGNAL *a, DBC_SIGNAL *b) {
|
||||
return a->startBit < b->startBit;
|
||||
}
|
||||
|
||||
QList<DBC_SIGNAL*> DBCSignalHandler::getSignalsAsList()
|
||||
{
|
||||
QList<DBC_SIGNAL*> sig_list = sigs.values();
|
||||
std::sort(sig_list.begin(), sig_list.end(), signal_cmp);
|
||||
return sig_list;
|
||||
}
|
||||
|
||||
bool DBCSignalHandler::removeSignal(DBC_SIGNAL *sig)
|
||||
{
|
||||
qDebug() << "Total # of signals: " << getCount();
|
||||
@@ -126,9 +115,14 @@ int DBCSignalHandler::getCount()
|
||||
return sigs.count();
|
||||
}
|
||||
|
||||
bool signal_cmp(DBC_SIGNAL a, DBC_SIGNAL b)
|
||||
{
|
||||
return a.startBit < b.startBit;
|
||||
}
|
||||
|
||||
void DBCSignalHandler::sort()
|
||||
{
|
||||
std::sort(sigs.begin(), sigs.end());
|
||||
std::sort(sigs.begin(), sigs.end(), signal_cmp);
|
||||
}
|
||||
|
||||
DBC_MESSAGE* DBCMessageHandler::findMsgByID(uint32_t id)
|
||||
@@ -299,9 +293,14 @@ int DBCMessageHandler::getCount()
|
||||
return messages.count();
|
||||
}
|
||||
|
||||
bool msg_cmp(DBC_MESSAGE a, DBC_MESSAGE b)
|
||||
{
|
||||
return a.ID < b.ID;
|
||||
}
|
||||
|
||||
void DBCMessageHandler::sort()
|
||||
{
|
||||
std::sort(messages.begin(), messages.end());
|
||||
std::sort(messages.begin(), messages.end(), msg_cmp);
|
||||
for (int i = 0; i < messages.count(); i++)
|
||||
{
|
||||
messages[i].sigHandler->sort();
|
||||
@@ -1438,6 +1437,8 @@ bool DBCFile::parseAttribute(QString inpString, DBC_ATTRIBUTE &attr)
|
||||
|
||||
bool DBCFile::saveFile(QString fileName)
|
||||
{
|
||||
// sort();
|
||||
messageHandler->sort(); // sort messages, each of which sorts its signals too
|
||||
int nodeNumber = 1;
|
||||
int msgNumber = 1;
|
||||
int sigNumber = 1;
|
||||
@@ -2465,8 +2466,8 @@ DBCHandler::DBCHandler()
|
||||
attr.upper = 0;
|
||||
attr.name = "matchingcriteria";
|
||||
attr.valType = ATTR_INT;
|
||||
file->dbc_attributes.append(attr);
|
||||
file->messageHandler->setMatchingCriteria(matchingCriteria);
|
||||
// file->dbc_attributes.append(attr);
|
||||
// file->messageHandler->setMatchingCriteria(matchingCriteria);
|
||||
|
||||
int filterLabeling = settings.value("DBC/FilterLabeling_" + QString::number(i),0).toInt();
|
||||
attr.attrType = ATTR_TYPE_MESSAGE;
|
||||
@@ -2476,8 +2477,8 @@ DBCHandler::DBCHandler()
|
||||
attr.upper = 0;
|
||||
attr.name = "filterlabeling";
|
||||
attr.valType = ATTR_INT;
|
||||
file->dbc_attributes.append(attr);
|
||||
file->messageHandler->setFilterLabeling(filterLabeling);
|
||||
// file->dbc_attributes.append(attr);
|
||||
// file->messageHandler->setFilterLabeling(filterLabeling);
|
||||
|
||||
qInfo() << "Loaded DBC file" << filename << " (bus:" << bus
|
||||
<< ", Matching Criteria:" << (int)matchingCriteria << "Filter labeling: " << (filterLabeling?"enabled":"disabled") << ")";
|
||||
|
||||
@@ -299,7 +299,8 @@ void FramePlaybackObject::seekPlayback(double timestamp)
|
||||
/* make sure we execute in mThread context */
|
||||
if (mThread_p && (mThread_p != QThread::currentThread()))
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "seekPlayback", Qt::BlockingQueuedConnection, timestamp);
|
||||
// TODO fix for QT5 from customizing branch
|
||||
// QMetaObject::invokeMethod(this, "seekPlayback", Qt::BlockingQueuedConnection, timestamp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+24
-21
@@ -447,33 +447,36 @@ void FramePlaybackWindow::updateFrameLabel()
|
||||
ui->lblCurrPlayback->setText(currentSeqItem->filename);
|
||||
|
||||
// convert current and last timestamp to text according to time format
|
||||
QVariant currentTimestamp = Utility::formatTimestamp(seqItems[row].data[currentPosition].timeStamp().microSeconds());
|
||||
QString currentTimestampText;
|
||||
if (currentTimestamp.typeId() == QMetaType::Double)
|
||||
currentTimestampText = QString::number(currentTimestamp.toDouble(), 'f', 5);
|
||||
else if (currentTimestamp.typeId() == QMetaType::LongLong || currentTimestamp.typeId() == QMetaType::ULongLong)
|
||||
currentTimestampText = QString::number(currentTimestamp.toLongLong());
|
||||
else if (currentTimestamp.typeId() == QMetaType::QDateTime)
|
||||
currentTimestampText = currentTimestamp.toDateTime().toString(Utility::timeFormat);
|
||||
else
|
||||
currentTimestampText = currentTimestamp.toString();
|
||||
// TODO fix for QT5 from customizing branch
|
||||
// QVariant currentTimestamp = Utility::formatTimestamp(seqItems[row].data[currentPosition].timeStamp().microSeconds());
|
||||
// QString currentTimestampText;
|
||||
// if (currentTimestamp.typeId() == QMetaType::Double)
|
||||
// currentTimestampText = QString::number(currentTimestamp.toDouble(), 'f', 5);
|
||||
// else if (currentTimestamp.typeId() == QMetaType::LongLong || currentTimestamp.typeId() == QMetaType::ULongLong)
|
||||
// currentTimestampText = QString::number(currentTimestamp.toLongLong());
|
||||
// else if (currentTimestamp.typeId() == QMetaType::QDateTime)
|
||||
// currentTimestampText = currentTimestamp.toDateTime().toString(Utility::timeFormat);
|
||||
// else
|
||||
// currentTimestampText = currentTimestamp.toString();
|
||||
|
||||
QVariant lastTimestamp = Utility::formatTimestamp(seqItems[row].data.last().timeStamp().microSeconds());
|
||||
QString lastTimestampText;
|
||||
if (lastTimestamp.typeId() == QMetaType::Double)
|
||||
lastTimestampText = QString::number(lastTimestamp.toDouble(), 'f', 5);
|
||||
else if (lastTimestamp.typeId() == QMetaType::LongLong || lastTimestamp.typeId() == QMetaType::ULongLong)
|
||||
lastTimestampText = QString::number(lastTimestamp.toLongLong());
|
||||
else if (lastTimestamp.typeId() == QMetaType::QDateTime)
|
||||
lastTimestampText = lastTimestamp.toDateTime().toString(Utility::timeFormat);
|
||||
else
|
||||
lastTimestampText = lastTimestamp.toString();
|
||||
// QVariant lastTimestamp = Utility::formatTimestamp(seqItems[row].data.last().timeStamp().microSeconds());
|
||||
// QString lastTimestampText;
|
||||
// if (lastTimestamp.typeId() == QMetaType::Double)
|
||||
// lastTimestampText = QString::number(lastTimestamp.toDouble(), 'f', 5);
|
||||
// else if (lastTimestamp.typeId() == QMetaType::LongLong || lastTimestamp.typeId() == QMetaType::ULongLong)
|
||||
// lastTimestampText = QString::number(lastTimestamp.toLongLong());
|
||||
// else if (lastTimestamp.typeId() == QMetaType::QDateTime)
|
||||
// lastTimestampText = lastTimestamp.toDateTime().toString(Utility::timeFormat);
|
||||
// else
|
||||
// lastTimestampText = lastTimestamp.toString();
|
||||
|
||||
if (wantPlaying && !isPlaying)
|
||||
ui->lblPosition->setText(QString::number(currentPosition) + tr(" of ") + QString::number(seqItems[row].data.count()) + " (WAITING)");
|
||||
else
|
||||
ui->lblPosition->setText(QString::number(currentPosition) + tr(" of ") + QString::number(seqItems[row].data.count()));
|
||||
ui->timePosition->setText(currentTimestampText + tr(" of ") + lastTimestampText);
|
||||
|
||||
// TODO fix for QT5 from customizing branch
|
||||
// ui->timePosition->setText(currentTimestampText + tr(" of ") + lastTimestampText);
|
||||
}
|
||||
|
||||
void FramePlaybackWindow::seqTableCellClicked(int row, int col)
|
||||
|
||||
Reference in New Issue
Block a user