Fixed issue where making a new message could create that message with

an already existing ID. Fixed issue where creating a new signal from
an existing signal would not show up properly.
This commit is contained in:
Collin Kidder
2023-08-01 21:37:59 -04:00
parent f6157e12cd
commit 83fb042e92
+8 -3
View File
@@ -693,8 +693,14 @@ void DBCMainEditor::newMessage()
DBC_MESSAGE *oldMsg = dbcFile->messageHandler->findMsgByID(msgID);
if (oldMsg)
{
msg.name = oldMsg->name + QString::number(randGen.bounded(1000));
msg.name = "Msg" + QString::number(randGen.bounded(500));
msg.ID = oldMsg->ID + 1;
DBC_MESSAGE *overlappedMsg = dbcFile->messageHandler->findMsgByID(msg.ID);
while (overlappedMsg)
{
msg.ID++;
overlappedMsg = dbcFile->messageHandler->findMsgByID(msg.ID);
}
msg.len = oldMsg->len;
msg.bgColor = oldMsg->bgColor;
msg.fgColor = oldMsg->fgColor;
@@ -783,8 +789,7 @@ void DBCMainEditor::newSignal()
msg->sigHandler->addSignal(sig);
sigPtr = msg->sigHandler->findSignalByIdx(msg->sigHandler->getCount() - 1);
QTreeWidgetItem *newSigItem = new QTreeWidgetItem();
QString sigInfo = sig.name;
if (sig.comment.count() > 0) sigInfo.append(" - ").append(sig.comment);
QString sigInfo = createSignalText(&sig);
newSigItem->setText(0, sigInfo);
if (sig.isMultiplexed) newSigItem->setIcon(0, multiplexedSignalIcon);
else if (sig.isMultiplexor) newSigItem->setIcon(0, multiplexorSignalIcon);