Skip to content

Commit

Permalink
Fixed issue where making a new message could create that message with
Browse files Browse the repository at this point in the history
an already existing ID. Fixed issue where creating a new signal from
an existing signal would not show up properly.
  • Loading branch information
collin80 committed Aug 2, 2023
1 parent 2c886a3 commit b31bd3f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dbc/dbcmaineditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b31bd3f

Please sign in to comment.