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:
@@ -693,8 +693,14 @@ void DBCMainEditor::newMessage()
|
|||||||
DBC_MESSAGE *oldMsg = dbcFile->messageHandler->findMsgByID(msgID);
|
DBC_MESSAGE *oldMsg = dbcFile->messageHandler->findMsgByID(msgID);
|
||||||
if (oldMsg)
|
if (oldMsg)
|
||||||
{
|
{
|
||||||
msg.name = oldMsg->name + QString::number(randGen.bounded(1000));
|
msg.name = "Msg" + QString::number(randGen.bounded(500));
|
||||||
msg.ID = oldMsg->ID + 1;
|
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.len = oldMsg->len;
|
||||||
msg.bgColor = oldMsg->bgColor;
|
msg.bgColor = oldMsg->bgColor;
|
||||||
msg.fgColor = oldMsg->fgColor;
|
msg.fgColor = oldMsg->fgColor;
|
||||||
@@ -783,8 +789,7 @@ void DBCMainEditor::newSignal()
|
|||||||
msg->sigHandler->addSignal(sig);
|
msg->sigHandler->addSignal(sig);
|
||||||
sigPtr = msg->sigHandler->findSignalByIdx(msg->sigHandler->getCount() - 1);
|
sigPtr = msg->sigHandler->findSignalByIdx(msg->sigHandler->getCount() - 1);
|
||||||
QTreeWidgetItem *newSigItem = new QTreeWidgetItem();
|
QTreeWidgetItem *newSigItem = new QTreeWidgetItem();
|
||||||
QString sigInfo = sig.name;
|
QString sigInfo = createSignalText(&sig);
|
||||||
if (sig.comment.count() > 0) sigInfo.append(" - ").append(sig.comment);
|
|
||||||
newSigItem->setText(0, sigInfo);
|
newSigItem->setText(0, sigInfo);
|
||||||
if (sig.isMultiplexed) newSigItem->setIcon(0, multiplexedSignalIcon);
|
if (sig.isMultiplexed) newSigItem->setIcon(0, multiplexedSignalIcon);
|
||||||
else if (sig.isMultiplexor) newSigItem->setIcon(0, multiplexorSignalIcon);
|
else if (sig.isMultiplexor) newSigItem->setIcon(0, multiplexorSignalIcon);
|
||||||
|
|||||||
Reference in New Issue
Block a user