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