From 1c8700897016e740241cb26a930b37e2b0773f9a Mon Sep 17 00:00:00 2001 From: Ahmed Sheimy Date: Fri, 5 Aug 2022 18:32:45 +0400 Subject: [PATCH 1/4] Update canconfactory.cpp restore network connection was not working because it was detected as serial by this modification it is working --- connections/canconfactory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connections/canconfactory.cpp b/connections/canconfactory.cpp index 1fc461c..0adb9b8 100644 --- a/connections/canconfactory.cpp +++ b/connections/canconfactory.cpp @@ -13,6 +13,9 @@ CANConnection* CanConFactory::create(type pType, QString pPortName, QString pDri case SERIALBUS: return new SerialBusConnection(pPortName, pDriverName); case GVRET_SERIAL: + if(pPortName.contains(".")) + return new GVRetSerial(pPortName, true); + else return new GVRetSerial(pPortName, false); case REMOTE: return new GVRetSerial(pPortName, true); //it's a special case of GVRET connected over TCP/IP so it uses the same class From b6b73d0e11882e8c558b3344f0c062daa5fc8679 Mon Sep 17 00:00:00 2001 From: Andy Huska Date: Thu, 15 Sep 2022 18:39:56 -0500 Subject: [PATCH 2/4] Fixed crash when deleting a message that isn't at the bottom of the node --- dbc/dbchandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dbc/dbchandler.cpp b/dbc/dbchandler.cpp index 3bbfe01..c5cc4a5 100644 --- a/dbc/dbchandler.cpp +++ b/dbc/dbchandler.cpp @@ -192,6 +192,7 @@ bool DBCMessageHandler::removeMessage(DBC_MESSAGE *msg) { messages.removeAt(i); qDebug() << "Removed message at idx " << i; + break; } } return true; From 7e4ebf2c740c34be5f2993f3c249abc7b6273ca5 Mon Sep 17 00:00:00 2001 From: Andy Huska Date: Thu, 15 Sep 2022 18:59:24 -0500 Subject: [PATCH 3/4] Fixed nonfunctional node delete. Was due to trying to find node by name but passing in the name and comment concatenated together. Made a new function to find by name+comment since extracting only name from the text in the column would require too much guessing. --- dbc/dbchandler.cpp | 17 ++++++++++++++++- dbc/dbchandler.h | 1 + dbc/dbcmaineditor.cpp | 5 +++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dbc/dbchandler.cpp b/dbc/dbchandler.cpp index c5cc4a5..6e29ad7 100644 --- a/dbc/dbchandler.cpp +++ b/dbc/dbchandler.cpp @@ -337,7 +337,22 @@ DBC_NODE* DBCFile::findNodeByName(QString name) if (dbc_nodes.length() == 0) return nullptr; for (int i = 0; i < dbc_nodes.length(); i++) { - if (dbc_nodes[i].name.compare(name, Qt::CaseInsensitive) == 0) + if (name.compare(dbc_nodes[i].name, Qt::CaseInsensitive) == 0) + { + return &dbc_nodes[i]; + } + } + return nullptr; +} + +DBC_NODE* DBCFile::findNodeByNameAndComment(QString fullname) +{ + QString nameAndComment; + if (dbc_nodes.length() == 0) return nullptr; + for (int i = 0; i < dbc_nodes.length(); i++) + { + nameAndComment = dbc_nodes[i].name + " - " + dbc_nodes[i].comment; + if (fullname.compare(nameAndComment, Qt::CaseInsensitive) == 0) { return &dbc_nodes[i]; } diff --git a/dbc/dbchandler.h b/dbc/dbchandler.h index 304a7a8..9e040cb 100644 --- a/dbc/dbchandler.h +++ b/dbc/dbchandler.h @@ -72,6 +72,7 @@ public: DBCFile(const DBCFile& cpy); DBCFile& operator=(const DBCFile& cpy); DBC_NODE *findNodeByName(QString name); + DBC_NODE *findNodeByNameAndComment(QString fullname); DBC_NODE *findNodeByIdx(int idx); DBC_ATTRIBUTE *findAttributeByName(QString name, DBC_ATTRIBUTE_TYPE type = ATTR_TYPE_ANY); DBC_ATTRIBUTE *findAttributeByIdx(int idx); diff --git a/dbc/dbcmaineditor.cpp b/dbc/dbcmaineditor.cpp index 28e831a..54a046b 100644 --- a/dbc/dbcmaineditor.cpp +++ b/dbc/dbcmaineditor.cpp @@ -631,7 +631,7 @@ void DBCMainEditor::deleteCurrentTreeItem() { QTreeWidgetItem *currItem = ui->treeDBC->currentItem(); int typ = currItem->data(0, Qt::UserRole).toInt(); - QString idString; + QString idString, columnText; int msgID; DBC_MESSAGE *msg; DBC_NODE *node; @@ -642,7 +642,8 @@ void DBCMainEditor::deleteCurrentTreeItem() switch (typ) { case 1: //deleting a node cascades deletion down to messages and signals - node = dbcFile->findNodeByName(currItem->text(0)); + columnText = currItem->text(0); + node = dbcFile->findNodeByNameAndComment(columnText); if (!node) return; for (int x = 0; x < dbcFile->messageHandler->getCount(); x++) { From 99640d7239437d6c3f0b8386abebe4258c33a1da Mon Sep 17 00:00:00 2001 From: Andy Huska Date: Sat, 17 Sep 2022 13:16:02 -0500 Subject: [PATCH 4/4] Fixed data string parsing bug where an empty string created by a trailing space would be interpreted as a 0 and then added as a data byte This affected editing of the data in the table as well as loading data from a saved file --- framesenderwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framesenderwindow.cpp b/framesenderwindow.cpp index 8e796ef..7029fa0 100644 --- a/framesenderwindow.cpp +++ b/framesenderwindow.cpp @@ -898,7 +898,7 @@ void FrameSenderWindow::processCellChange(int line, int col) case 6: //Data bytes for (int i = 0; i < 8; i++) sendingData[line].payload().data()[i] = 0; - tokens = ui->tableSender->item(line, 6)->text().split(" "); + tokens = ui->tableSender->item(line, 6)->text().split(" ", QString::SkipEmptyParts); arr.clear(); arr.reserve(tokens.count()); for (int j = 0; j < tokens.count(); j++)