Bug fixes to DBC attribute loading and message coloring. Message colors work now!
This commit is contained in:
+2
-1
@@ -216,7 +216,8 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
|
|||||||
return msg->bgColor;
|
return msg->bgColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QApplication::palette().color(QPalette::Window);
|
//return QApplication::palette().color(QPalette::Button);
|
||||||
|
return QColor(Qt::white);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == Qt::TextColorRole)
|
if (role == Qt::TextColorRole)
|
||||||
|
|||||||
+9
-9
@@ -597,13 +597,13 @@ void DBCFile::loadFile(QString fileName)
|
|||||||
|
|
||||||
if (line.startsWith("BA_DEF_DEF_ ")) //definition of default value for an attribute
|
if (line.startsWith("BA_DEF_DEF_ ")) //definition of default value for an attribute
|
||||||
{
|
{
|
||||||
regex.setPattern("^BA\\_DEF\\_DEF\\_ \\\"*(\\w+)\\\"* \\\"*(\\w*)\\\"*");
|
regex.setPattern("^BA\\_DEF\\_DEF\\_ \\\"*(\\w+)\\\"* \\\"*([#\\w]*)\\\"*");
|
||||||
match = regex.match(line);
|
match = regex.match(line);
|
||||||
//captured 1 is the name of the attribute
|
//captured 1 is the name of the attribute
|
||||||
//captured 2 is the default value for that attribute
|
//captured 2 is the default value for that attribute
|
||||||
if (match.hasMatch())
|
if (match.hasMatch())
|
||||||
{
|
{
|
||||||
qDebug() << "Found an attribute default value line, searching for an attribute named " << match.captured(1);
|
qDebug() << "Found an attribute default value line, searching for an attribute named " << match.captured(1) << "with data " << match.captured(2);
|
||||||
DBC_ATTRIBUTE *found = findAttributeByName(match.captured(1));
|
DBC_ATTRIBUTE *found = findAttributeByName(match.captured(1));
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
@@ -638,7 +638,7 @@ void DBCFile::loadFile(QString fileName)
|
|||||||
//BA_ "GenMsgCycleTime" BO_ 101 100;
|
//BA_ "GenMsgCycleTime" BO_ 101 100;
|
||||||
if (line.startsWith("BA_ ")) //set value of attribute
|
if (line.startsWith("BA_ ")) //set value of attribute
|
||||||
{
|
{
|
||||||
regex.setPattern("^BA\\_ \\\"*(\\w+)\\\"* BO\\_ (\\d+) \\\"*(\\w+)\\\"*");
|
regex.setPattern("^BA\\_ \\\"*(\\w+)\\\"* BO\\_ (\\d+) \\\"*([#\\w]+)\\\"*");
|
||||||
match = regex.match(line);
|
match = regex.match(line);
|
||||||
//captured 1 is the attribute name
|
//captured 1 is the attribute name
|
||||||
//captured 2 is the message ID number (frame ID)
|
//captured 2 is the message ID number (frame ID)
|
||||||
@@ -669,7 +669,7 @@ void DBCFile::loadFile(QString fileName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
regex.setPattern("^BA\\_ \\\"*(\\w+)\\\"* SG\\_ (\\d+) \\\"*(\\w+)\\\"* \\\"*(\\w+)\\\"*");
|
regex.setPattern("^BA\\_ \\\"*(\\w+)\\\"* SG\\_ (\\d+) \\\"*(\\w+)\\\"* \\\"*([#\\w]+)\\\"*");
|
||||||
match = regex.match(line);
|
match = regex.match(line);
|
||||||
//captured 1 is the attribute name
|
//captured 1 is the attribute name
|
||||||
//captured 2 is the message ID number (frame ID)
|
//captured 2 is the message ID number (frame ID)
|
||||||
@@ -703,7 +703,7 @@ void DBCFile::loadFile(QString fileName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
regex.setPattern("^BA\\_ \\\"*(\\w+)\\\"* BU\\_ \\\"*(\\w+)\\\"* \\\"*(\\w+)\\\"*");
|
regex.setPattern("^BA\\_ \\\"*(\\w+)\\\"* BU\\_ \\\"*(\\w+)\\\"* \\\"*([#\\w]+)\\\"*");
|
||||||
match = regex.match(line);
|
match = regex.match(line);
|
||||||
//captured 1 is the attribute name
|
//captured 1 is the attribute name
|
||||||
//captured 2 is the name of the node
|
//captured 2 is the name of the node
|
||||||
@@ -740,7 +740,7 @@ void DBCFile::loadFile(QString fileName)
|
|||||||
if (!bgAttr)
|
if (!bgAttr)
|
||||||
{
|
{
|
||||||
attr.attrType = MESSAGE;
|
attr.attrType = MESSAGE;
|
||||||
attr.defaultValue = QApplication::palette().color(QPalette::WindowText).name();
|
attr.defaultValue = QColor(Qt::white).name();
|
||||||
attr.enumVals.clear();
|
attr.enumVals.clear();
|
||||||
attr.lower = 0;
|
attr.lower = 0;
|
||||||
attr.upper = 0;
|
attr.upper = 0;
|
||||||
@@ -754,7 +754,7 @@ void DBCFile::loadFile(QString fileName)
|
|||||||
if (!fgAttr)
|
if (!fgAttr)
|
||||||
{
|
{
|
||||||
attr.attrType = MESSAGE;
|
attr.attrType = MESSAGE;
|
||||||
attr.defaultValue = QApplication::palette().color(QPalette::Window).name();
|
attr.defaultValue = QApplication::palette().color(QPalette::WindowText).name();
|
||||||
attr.enumVals.clear();
|
attr.enumVals.clear();
|
||||||
attr.lower = 0;
|
attr.lower = 0;
|
||||||
attr.upper = 0;
|
attr.upper = 0;
|
||||||
@@ -1220,7 +1220,7 @@ int DBCHandler::createBlankFile()
|
|||||||
|
|
||||||
//add our custom attributes to the new file so that we know they're already there.
|
//add our custom attributes to the new file so that we know they're already there.
|
||||||
attr.attrType = MESSAGE;
|
attr.attrType = MESSAGE;
|
||||||
attr.defaultValue = QApplication::palette().color(QPalette::WindowText).name();
|
attr.defaultValue = QColor(Qt::white).name();
|
||||||
attr.enumVals.clear();
|
attr.enumVals.clear();
|
||||||
attr.lower = 0;
|
attr.lower = 0;
|
||||||
attr.upper = 0;
|
attr.upper = 0;
|
||||||
@@ -1229,7 +1229,7 @@ int DBCHandler::createBlankFile()
|
|||||||
newFile.dbc_attributes.append(attr);
|
newFile.dbc_attributes.append(attr);
|
||||||
|
|
||||||
attr.attrType = MESSAGE;
|
attr.attrType = MESSAGE;
|
||||||
attr.defaultValue = QApplication::palette().color(QPalette::Window).name();
|
attr.defaultValue = QApplication::palette().color(QPalette::WindowText).name();
|
||||||
attr.enumVals.clear();
|
attr.enumVals.clear();
|
||||||
attr.lower = 0;
|
attr.lower = 0;
|
||||||
attr.upper = 0;
|
attr.upper = 0;
|
||||||
|
|||||||
@@ -490,6 +490,10 @@ void DBCMainEditor::refreshMessagesTable(const DBC_NODE *node)
|
|||||||
QTableWidgetItem *msgName = new QTableWidgetItem(msg->name);
|
QTableWidgetItem *msgName = new QTableWidgetItem(msg->name);
|
||||||
QTableWidgetItem *msgLen = new QTableWidgetItem(QString::number(msg->len));
|
QTableWidgetItem *msgLen = new QTableWidgetItem(QString::number(msg->len));
|
||||||
QTableWidgetItem *msgSignals = new QTableWidgetItem(QString::number(msg->sigHandler->getCount()));
|
QTableWidgetItem *msgSignals = new QTableWidgetItem(QString::number(msg->sigHandler->getCount()));
|
||||||
|
QTableWidgetItem *fgColor = new QTableWidgetItem("");
|
||||||
|
fgColor->setBackgroundColor(msg->fgColor);
|
||||||
|
QTableWidgetItem *bgColor = new QTableWidgetItem("");
|
||||||
|
bgColor->setBackgroundColor(msg->bgColor);
|
||||||
QTableWidgetItem *msgComment = new QTableWidgetItem(msg->comment);
|
QTableWidgetItem *msgComment = new QTableWidgetItem(msg->comment);
|
||||||
|
|
||||||
rowIdx = ui->MessagesTable->rowCount();
|
rowIdx = ui->MessagesTable->rowCount();
|
||||||
@@ -498,7 +502,9 @@ void DBCMainEditor::refreshMessagesTable(const DBC_NODE *node)
|
|||||||
ui->MessagesTable->setItem(rowIdx, 1, msgName);
|
ui->MessagesTable->setItem(rowIdx, 1, msgName);
|
||||||
ui->MessagesTable->setItem(rowIdx, 2, msgLen);
|
ui->MessagesTable->setItem(rowIdx, 2, msgLen);
|
||||||
ui->MessagesTable->setItem(rowIdx, 3, msgSignals);
|
ui->MessagesTable->setItem(rowIdx, 3, msgSignals);
|
||||||
ui->MessagesTable->setItem(rowIdx, 4, msgComment);
|
ui->MessagesTable->setItem(rowIdx, 4, fgColor);
|
||||||
|
ui->MessagesTable->setItem(rowIdx, 5, bgColor);
|
||||||
|
ui->MessagesTable->setItem(rowIdx, 6, msgComment);
|
||||||
//note that there is a sending node field in the structure but we're
|
//note that there is a sending node field in the structure but we're
|
||||||
//not displaying it. It has to be the node we selected from the node list
|
//not displaying it. It has to be the node we selected from the node list
|
||||||
//so no need to show that here.
|
//so no need to show that here.
|
||||||
|
|||||||
Reference in New Issue
Block a user