Merge branch 'collin80:master' into fix_dbc_creation
This commit is contained in:
@@ -485,6 +485,7 @@ void GVRetSerial::serialError(QSerialPort::SerialPortError err)
|
||||
killConnection = true;
|
||||
piStop();
|
||||
break;
|
||||
#if QT_VERSION <= QT_VERSION_CHECK( 6, 0, 0 )
|
||||
case QSerialPort::ParityError:
|
||||
errMessage = "Parity error on serial port";
|
||||
break;
|
||||
@@ -494,6 +495,7 @@ void GVRetSerial::serialError(QSerialPort::SerialPortError err)
|
||||
case QSerialPort::BreakConditionError:
|
||||
errMessage = "Break error on serial port";
|
||||
break;
|
||||
#endif
|
||||
case QSerialPort::WriteError:
|
||||
errMessage = "Write error on serial port";
|
||||
piStop();
|
||||
|
||||
+81
-56
@@ -32,6 +32,7 @@ SocketCANd::SocketCANd(QString portName) :
|
||||
for (int i = 0; i < mNumBuses; i++)
|
||||
{
|
||||
rx_state.append(IDLE);
|
||||
unprocessedData.append("");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -249,75 +250,89 @@ void SocketCANd::switchToRawMode(int busNum)
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
void SocketCANd::decodeFrames(QString data, int busNum)
|
||||
QString SocketCANd::decodeFrames(QString data, int busNum)
|
||||
{
|
||||
if (data.indexOf("< frame ") == -1)
|
||||
if (data.indexOf("<") == -1)
|
||||
return "";
|
||||
else if(data.length() >= 8 && data.indexOf("< frame ") == -1)
|
||||
return "";
|
||||
|
||||
int firstIndex = data.indexOf("< frame ");
|
||||
if(firstIndex > 0)
|
||||
{
|
||||
qDebug() << "Received datagramm doesn't contain any frame: " << data;
|
||||
return;
|
||||
QString framePartial = data.left(firstIndex);
|
||||
qDebug() << "Received datagramm that starts with fragment (missing '< frame'), this should only occur on startup, removing...: " << framePartial;
|
||||
}
|
||||
else
|
||||
QString framePart = data.mid(firstIndex); //remove starting beginning of payload if not < frame >
|
||||
const QString frameStrConst = framePart.left(framePart.indexOf(">")+1);
|
||||
QString frameStr = frameStrConst;
|
||||
QStringList frameParsed = (frameStr.remove(QRegExp("^<")).remove(QRegExp(">$"))).simplified().split(' ');
|
||||
|
||||
if(frameParsed.length() < 3)
|
||||
{
|
||||
QString framePart = data.mid(data.indexOf("< frame "), data.length()); //remove starting beginning of payload if not < frame >
|
||||
const QString frameStrConst = framePart.left(framePart.indexOf(">")+1);
|
||||
QString frameStr = frameStrConst;
|
||||
QStringList frameParsed = (frameStr.remove(QRegExp("^<")).remove(QRegExp(">$"))).simplified().split(' ');
|
||||
//qDebug() << "Received datagramm is an incomplete frame: " << data;
|
||||
|
||||
if(frameParsed.length() < 2)
|
||||
{
|
||||
qDebug() << "Received datagramm is an incomplete frame: " << data;
|
||||
return;
|
||||
}
|
||||
//ok great, need to leave it in the buffer in case it can be combined with what comes next
|
||||
//but if there was a fragment that did not have a starting token then we don't want it so only return
|
||||
//known good data...again this should only happen on startup, but just in case we need to remove it
|
||||
//so the data buffer doesn't grow uncontrolled.
|
||||
return framePart;
|
||||
}
|
||||
|
||||
buildFrame.setFrameId(frameParsed[1].toUInt(nullptr, 16));
|
||||
buildFrame.bus = busNum;
|
||||
buildFrame.setFrameId(frameParsed[1].toUInt(nullptr, 16));
|
||||
buildFrame.bus = busNum;
|
||||
|
||||
if (buildFrame.frameId() > 0x7FF) buildFrame.setExtendedFrameFormat(true);
|
||||
else buildFrame.setExtendedFrameFormat(false);
|
||||
if (buildFrame.frameId() > 0x7FF) buildFrame.setExtendedFrameFormat(true);
|
||||
else buildFrame.setExtendedFrameFormat(false);
|
||||
|
||||
buildFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, frameParsed[2].toDouble() * 1000000l));
|
||||
//buildFrame.len = frameParsed[3].length() * 0.5;
|
||||
buildFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, frameParsed[2].toDouble() * 1000000l));
|
||||
//buildFrame.len = frameParsed[3].length() * 0.5;
|
||||
|
||||
if(frameParsed.length() < 4)
|
||||
{
|
||||
qDebug() << "Received frame doesn't contain any data: " << data;
|
||||
return;
|
||||
}
|
||||
if(frameParsed.length() < 4)
|
||||
{
|
||||
qDebug() << "Received frame doesn't contain any data: " << data;
|
||||
return data;
|
||||
}
|
||||
|
||||
int framelength = frameParsed[3].length() * 0.5;
|
||||
int framelength = frameParsed[3].length() * 0.5;
|
||||
|
||||
buildData.resize(framelength);
|
||||
buildData.resize(framelength);
|
||||
|
||||
int c;
|
||||
for (c = 0; c < framelength; c++)
|
||||
{
|
||||
bool ok;
|
||||
unsigned char byteVal = frameParsed[3].mid(c*2, 2).toUInt(&ok, 16);
|
||||
buildData[c] = byteVal;
|
||||
}
|
||||
buildFrame.setPayload(buildData);
|
||||
int c;
|
||||
for (c = 0; c < framelength; c++)
|
||||
{
|
||||
bool ok;
|
||||
unsigned char byteVal = frameParsed[3].mid(c*2, 2).toUInt(&ok, 16);
|
||||
buildData[c] = byteVal;
|
||||
}
|
||||
buildFrame.setPayload(buildData);
|
||||
// buildFrame.isReceived = true;
|
||||
|
||||
if (!isCapSuspended())
|
||||
{
|
||||
/* get frame from queue */
|
||||
CANFrame* frame_p = getQueue().get();
|
||||
if(frame_p) {
|
||||
/* copy frame */
|
||||
*frame_p = buildFrame;
|
||||
//frame_p->remote = false;
|
||||
frame_p->setFrameType(QCanBusFrame::DataFrame);
|
||||
checkTargettedFrame(buildFrame);
|
||||
/* enqueue frame */
|
||||
getQueue().queue();
|
||||
}
|
||||
if (!isCapSuspended())
|
||||
{
|
||||
/* get frame from queue */
|
||||
CANFrame* frame_p = getQueue().get();
|
||||
if(frame_p) {
|
||||
/* copy frame */
|
||||
*frame_p = buildFrame;
|
||||
//frame_p->remote = false;
|
||||
frame_p->setFrameType(QCanBusFrame::DataFrame);
|
||||
checkTargettedFrame(buildFrame);
|
||||
/* enqueue frame */
|
||||
getQueue().queue();
|
||||
}
|
||||
else
|
||||
qDebug() << "can't get a frame, capture suspended";
|
||||
|
||||
if (framePart.length() > frameStrConst.length())
|
||||
decodeFrames(framePart.right(framePart.length() - frameStrConst.length()), busNum);
|
||||
}
|
||||
else
|
||||
qDebug() << "can't get a frame, capture suspended";
|
||||
|
||||
//take out the data that we just processed and anything that is in front of it
|
||||
//this should keep broken frames from accumulating at in the data buffer
|
||||
if (framePart.length() > frameStrConst.length())
|
||||
{
|
||||
return decodeFrames(framePart.right(framePart.length() - frameStrConst.length()), busNum);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void SocketCANd::disconnectDevice() {
|
||||
@@ -387,6 +402,7 @@ void SocketCANd::procRXData(QString data, int busNum)
|
||||
{
|
||||
switchToRawMode(busNum);
|
||||
rx_state[busNum] = SWITCHING2RAW;
|
||||
unprocessedData[busNum].clear();
|
||||
}
|
||||
else qInfo() << hostCanIDs[busNum] << ": Could not open bus. Host did not respond with ""< ok >"": " << data;
|
||||
break;
|
||||
@@ -400,17 +416,26 @@ void SocketCANd::procRXData(QString data, int busNum)
|
||||
{
|
||||
qDebug() << "Ok found at start of compound message, switching to RAW and decoding immediately";
|
||||
rx_state[busNum] = RAWMODE;
|
||||
decodeFrames(data, busNum);
|
||||
unprocessedData[busNum] = decodeFrames(data, busNum);
|
||||
}
|
||||
else if(data.indexOf("< ok >", 0, Qt::CaseSensitivity::CaseInsensitive) > 0)
|
||||
{
|
||||
qDebug() << "Ok found at in middle of compound message, switching to RAW and decoding immediately";
|
||||
rx_state[busNum] = RAWMODE;
|
||||
decodeFrames(data, busNum);
|
||||
unprocessedData[busNum] = decodeFrames(data, busNum);
|
||||
}
|
||||
break;
|
||||
case RAWMODE:
|
||||
decodeFrames(data, busNum);
|
||||
unprocessedData[busNum] = decodeFrames(unprocessedData[busNum] + data, busNum);
|
||||
|
||||
if(unprocessedData[busNum].length() > 128)
|
||||
{
|
||||
//the buffer has grown too much we need to clear it out, but what is good logic for that?
|
||||
//the decodeFrames function strips out datat that doesn't have a '< frame' starting token, and in its
|
||||
//recursive calling of itself it strips out data that preceedes valid frames, so this should never happen
|
||||
qDebug() << "busNum: " << busNum << "- " << unprocessedData[busNum].length() << " bytes in unprocessedData, something is wrong, clearing...";
|
||||
unprocessedData[busNum].clear();
|
||||
}
|
||||
break;
|
||||
case ISOTP:
|
||||
break;
|
||||
|
||||
@@ -57,7 +57,7 @@ private slots:
|
||||
void invokeReadTCPData();
|
||||
void deviceConnected(int busNum);
|
||||
void switchToRawMode(int busNum);
|
||||
void decodeFrames(QString, int busNum);
|
||||
QString decodeFrames(QString, int busNum);
|
||||
|
||||
private:
|
||||
void procRXData(QString, int busNum);
|
||||
@@ -76,6 +76,7 @@ protected:
|
||||
QByteArray buildData;
|
||||
QVarLengthArray<MODE> rx_state;
|
||||
CANFrame buildFrame;
|
||||
QVarLengthArray<QString> unprocessedData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+11
-11
@@ -100,8 +100,15 @@ void DBCSignalHandler::sort()
|
||||
DBC_MESSAGE* DBCMessageHandler::findMsgByID(uint32_t id)
|
||||
{
|
||||
if (messages.count() == 0) return nullptr;
|
||||
DBC_MESSAGE *bestMatch = nullptr;
|
||||
|
||||
for (int i = 0; i < messages.count(); i++)
|
||||
{
|
||||
if ( messages[i].ID == id )
|
||||
{
|
||||
return &messages[i];
|
||||
}
|
||||
|
||||
if (matchingCriteria == J1939)
|
||||
{
|
||||
// include data page and extended data page in the pgn
|
||||
@@ -112,7 +119,7 @@ DBC_MESSAGE* DBCMessageHandler::findMsgByID(uint32_t id)
|
||||
pgn &= 0x3FF00;
|
||||
if ((messages[i].ID & 0x3FF0000) == (pgn << 8))
|
||||
{
|
||||
return &messages[i];
|
||||
bestMatch = &messages[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -120,7 +127,7 @@ DBC_MESSAGE* DBCMessageHandler::findMsgByID(uint32_t id)
|
||||
// PDU2 format
|
||||
if ((messages[i].ID & 0x3FFFF00) == (pgn << 8))
|
||||
{
|
||||
return &messages[i];
|
||||
bestMatch = &messages[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,17 +136,10 @@ DBC_MESSAGE* DBCMessageHandler::findMsgByID(uint32_t id)
|
||||
// Match the bits 14-26 (Arbitration Id) of GMLAN 29bit header
|
||||
uint32_t arbId = id &0x3FFE000;
|
||||
if ( (arbId != 0) && (messages[i].ID & 0x3FFE000) == arbId )
|
||||
return &messages[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( messages[i].ID == id )
|
||||
{
|
||||
return &messages[i];
|
||||
}
|
||||
bestMatch = &messages[i];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return bestMatch;
|
||||
}
|
||||
|
||||
DBC_MESSAGE* DBCMessageHandler::findMsgByIdx(int idx)
|
||||
|
||||
@@ -898,7 +898,11 @@ void FrameSenderWindow::processCellChange(int line, int col)
|
||||
case 6: //Data bytes
|
||||
for (int i = 0; i < 8; i++) sendingData[line].payload().data()[i] = 0;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
|
||||
tokens = ui->tableSender->item(line, 6)->text().split(" ", Qt::SkipEmptyParts);
|
||||
#else
|
||||
tokens = ui->tableSender->item(line, 6)->text().split(" ", QString::SkipEmptyParts);
|
||||
#endif
|
||||
arr.clear();
|
||||
arr.reserve(tokens.count());
|
||||
for (int j = 0; j < tokens.count(); j++)
|
||||
|
||||
+2
-1
@@ -931,7 +931,8 @@ void JSEdit::resizeEvent(QResizeEvent *e)
|
||||
void JSEdit::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
if (e->modifiers() == Qt::ControlModifier) {
|
||||
int steps = e->delta() / 20;
|
||||
QPoint numDegrees = e->angleDelta();
|
||||
int steps = numDegrees.y() / 20;
|
||||
steps = qBound(-3, steps, 3);
|
||||
QFont textFont = font();
|
||||
int pointSize = textFont.pointSize() + steps;
|
||||
|
||||
@@ -48,6 +48,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
ui->cbLoadConnections->setChecked(settings.value("Main/SaveRestoreConnections", false).toBool());
|
||||
|
||||
ui->spinFontSize->setValue(settings.value("Main/FontSize", ui->cbDisplayHex->font().pointSize()).toUInt());
|
||||
ui->cbFontFixedWidth->setChecked(settings.value("Main/FontFixedWidth", false).toBool());
|
||||
|
||||
bool secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
||||
bool clockMode = settings.value("Main/TimeClock", false).toBool();
|
||||
@@ -132,6 +133,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
connect(ui->cbHexGraphInfo, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbIgnoreDBCColors, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->spinMaximumFrames, SIGNAL(valueChanged(int)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbFontFixedWidth, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
|
||||
installEventFilter(this);
|
||||
}
|
||||
@@ -199,6 +201,7 @@ void MainSettingsDialog::updateSettings()
|
||||
settings.setValue("Main/FilterLabeling", ui->cbFilterLabeling->isChecked());
|
||||
settings.setValue("Main/IgnoreDBCColors", ui->cbIgnoreDBCColors->isChecked());
|
||||
settings.setValue("Main/MaximumFrames", ui->spinMaximumFrames->value());
|
||||
settings.setValue("Main/FontFixedWidth", ui->cbFontFixedWidth->isChecked());
|
||||
|
||||
settings.sync();
|
||||
emit updatedSettings();
|
||||
|
||||
+7
-1
@@ -57,12 +57,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
verticalHeader->setSectionResizeMode(QHeaderView::Fixed);
|
||||
QSettings settings;
|
||||
int fontSize = settings.value("Main/FontSize", 9).toUInt();
|
||||
QFont sysFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); //get default font
|
||||
QFont sysFont;
|
||||
if(settings.value("Main/FontFixedWidth", false).toBool())
|
||||
sysFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); //get default fixed width font
|
||||
else
|
||||
sysFont = QFont(); //get default font
|
||||
sysFont.setPointSize(fontSize);
|
||||
verticalHeader->setDefaultSectionSize(sysFont.pixelSize());
|
||||
verticalHeader->setFont(QFont());
|
||||
ui->canFramesView->setFont(sysFont);
|
||||
|
||||
QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader();
|
||||
HorzHdr->setFont(QFont());
|
||||
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
|
||||
connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int)));
|
||||
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ class Q_MQTT_EXPORT Client : public QObject
|
||||
Q_PROPERTY(quint8 _willQos READ willQos WRITE setWillQos)
|
||||
Q_PROPERTY(bool _willRetain READ willRetain WRITE setWillRetain)
|
||||
Q_PROPERTY(QByteArray _willMessage READ willMessage WRITE setWillMessage)
|
||||
Q_PROPERTY(QString _connectionState READ connectionState)
|
||||
Q_PROPERTY(ConnectionState _connectionState READ connectionState)
|
||||
#ifndef QT_NO_SSL
|
||||
Q_PROPERTY(QSslConfiguration _sslConfiguration READ sslConfiguration WRITE setSslConfiguration)
|
||||
#endif // QT_NO_SSL
|
||||
|
||||
@@ -41,9 +41,9 @@ QMQTT::Socket::Socket(QObject* parent)
|
||||
connect(_socket.data(), &QTcpSocket::connected, this, &SocketInterface::connected);
|
||||
connect(_socket.data(), &QTcpSocket::disconnected, this, &SocketInterface::disconnected);
|
||||
connect(_socket.data(),
|
||||
static_cast<void (QTcpSocket::*)(QAbstractSocket::SocketError)>(&QTcpSocket::error),
|
||||
SIGNAL(error(QTcpSocket::error)),
|
||||
this,
|
||||
static_cast<void (SocketInterface::*)(QAbstractSocket::SocketError)>(&SocketInterface::error));
|
||||
SLOT(errorHandler(SocketInterface::error)));
|
||||
}
|
||||
|
||||
QMQTT::Socket::~Socket()
|
||||
|
||||
@@ -46,9 +46,9 @@ QMQTT::SslSocket::SslSocket(const QSslConfiguration& config, QObject* parent)
|
||||
connect(_socket.data(), &QSslSocket::encrypted, this, &SocketInterface::connected);
|
||||
connect(_socket.data(), &QSslSocket::disconnected, this, &SocketInterface::disconnected);
|
||||
connect(_socket.data(),
|
||||
static_cast<void (QSslSocket::*)(QAbstractSocket::SocketError)>(&QSslSocket::error),
|
||||
SIGNAL(error(QSslSocket::error)),
|
||||
this,
|
||||
static_cast<void (SocketInterface::*)(QAbstractSocket::SocketError)>(&SocketInterface::error));
|
||||
SLOT(errorHandler(SocketInterface::error)));
|
||||
connect(_socket.data(),
|
||||
static_cast<void (QSslSocket::*)(const QList<QSslError>&)>(&QSslSocket::sslErrors),
|
||||
this,
|
||||
|
||||
@@ -137,7 +137,7 @@ QVariant SnifferModel::data(const QModelIndex &index, int role) const
|
||||
Qt::ItemFlags SnifferModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
return QAbstractItemModel::flags(index);
|
||||
}
|
||||
|
||||
+79
-11
@@ -4,6 +4,9 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QDebug>
|
||||
|
||||
#define MSG_COL 1
|
||||
#define VALUE_COL 2
|
||||
|
||||
SignalViewerWindow::SignalViewerWindow(const QVector<CANFrame> *frames, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SignalViewerWindow)
|
||||
@@ -14,15 +17,31 @@ SignalViewerWindow::SignalViewerWindow(const QVector<CANFrame> *frames, QWidget
|
||||
modelFrames = frames;
|
||||
|
||||
QStringList headers;
|
||||
headers << "Signal" << "Value";
|
||||
headers << "Node" << "Signal" << "Value";
|
||||
ui->tableViewer->setHorizontalHeaderLabels(headers);
|
||||
ui->tableViewer->setColumnWidth(0, 150);
|
||||
ui->tableViewer->setColumnWidth(1, 300);
|
||||
ui->tableViewer->setColumnWidth(0, 100);
|
||||
ui->tableViewer->setColumnWidth(1, 150);
|
||||
|
||||
QSettings settings;
|
||||
QFont sysFont;
|
||||
int fontSize = settings.value("Main/FontSize", 9).toUInt();
|
||||
if(settings.value("Main/FontFixedWidth", false).toBool())
|
||||
sysFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); //get default fixed width font
|
||||
else
|
||||
sysFont = QFont(); //get default font
|
||||
sysFont.setPointSize(fontSize);
|
||||
ui->tableViewer->setFont(sysFont);
|
||||
|
||||
QHeaderView *HorzHdr = ui->tableViewer->horizontalHeader();
|
||||
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
|
||||
HorzHdr->setFont(QFont());
|
||||
|
||||
QHeaderView *verticalHeader = ui->tableViewer->verticalHeader();
|
||||
verticalHeader->setFont(QFont());
|
||||
|
||||
dbcHandler = DBCHandler::getReference();
|
||||
|
||||
connect(ui->cbNodes, SIGNAL(currentIndexChanged(int)), this, SLOT(loadMessages(int)));
|
||||
connect(ui->cbMessages, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSignals(int)));
|
||||
connect(ui->btnAdd, SIGNAL(clicked(bool)), this, SLOT(addSignal()));
|
||||
connect(MainWindow::getReference(), SIGNAL(framesUpdated(int)), this, SLOT(updatedFrames(int)));
|
||||
@@ -32,7 +51,7 @@ SignalViewerWindow::SignalViewerWindow(const QVector<CANFrame> *frames, QWidget
|
||||
connect(ui->btnAppend, SIGNAL(clicked(bool)), this, SLOT(appendSignalsFile()));
|
||||
connect(ui->btnClear, SIGNAL(clicked(bool)), this, SLOT(clearSignalsTable()));
|
||||
|
||||
loadMessages();
|
||||
loadNodes();
|
||||
}
|
||||
|
||||
SignalViewerWindow::~SignalViewerWindow()
|
||||
@@ -79,11 +98,11 @@ void SignalViewerWindow::processFrame(CANFrame &frame)
|
||||
{
|
||||
if (sig->processAsText(frame, sigString, false)) //if true we could interpret the signal so update it in the list
|
||||
{
|
||||
QTableWidgetItem *item = ui->tableViewer->item(i, 1);
|
||||
QTableWidgetItem *item = ui->tableViewer->item(i, VALUE_COL);
|
||||
if (!item)
|
||||
{
|
||||
item = new QTableWidgetItem(sigString);
|
||||
ui->tableViewer->setItem(i, 1, item);
|
||||
ui->tableViewer->setItem(i, VALUE_COL, item);
|
||||
}
|
||||
else item->setText(sigString);
|
||||
}
|
||||
@@ -99,20 +118,67 @@ void SignalViewerWindow::removeSelectedSignal()
|
||||
ui->tableViewer->removeRow(selRow);
|
||||
}
|
||||
|
||||
void SignalViewerWindow::loadMessages()
|
||||
void SetComboBoxItemEnabled(QComboBox * comboBox, int index, bool enabled)
|
||||
{
|
||||
auto * model = qobject_cast<QStandardItemModel*>(comboBox->model());
|
||||
assert(model);
|
||||
if(!model) return;
|
||||
|
||||
auto * item = model->item(index);
|
||||
assert(item);
|
||||
if(!item) return;
|
||||
item->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void SignalViewerWindow::loadNodes()
|
||||
{
|
||||
int numFiles;
|
||||
ui->cbMessages->clear();
|
||||
ui->cbNodes->clear();
|
||||
if (dbcHandler == nullptr) return;
|
||||
if ((numFiles = dbcHandler->getFileCount()) == 0) return;
|
||||
qDebug() << numFiles;
|
||||
for (int f = 0; f < numFiles; f++)
|
||||
{
|
||||
qDebug() << dbcHandler->getFileByIdx(f)->messageHandler->getCount();
|
||||
|
||||
QList<QString> names;
|
||||
|
||||
for (int x = 0; x < dbcHandler->getFileByIdx(f)->dbc_nodes.count(); x++)
|
||||
{
|
||||
QString name = dbcHandler->getFileByIdx(f)->dbc_nodes[x].name;
|
||||
if(name != "Vector__XXX")
|
||||
names.append(name);
|
||||
}
|
||||
|
||||
if(names.count() > 0)
|
||||
{
|
||||
names.sort();
|
||||
ui->cbNodes->addItem("----" + dbcHandler->getFileByIdx(f)->getFilename());
|
||||
SetComboBoxItemEnabled(ui->cbNodes, ui->cbNodes->count() -1, false);
|
||||
for(int i=0; i<names.count(); i++)
|
||||
ui->cbNodes->addItem(names[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SignalViewerWindow::loadMessages(int idx)
|
||||
{
|
||||
int numFiles;
|
||||
ui->cbMessages->clear();
|
||||
if (dbcHandler == nullptr) return;
|
||||
if ((numFiles = dbcHandler->getFileCount()) == 0) return;
|
||||
qDebug() << numFiles;
|
||||
|
||||
QString nodeName = ui->cbNodes->itemText(idx);
|
||||
|
||||
for (int f = 0; f < numFiles; f++)
|
||||
{
|
||||
qDebug() << dbcHandler->getFileByIdx(f)->messageHandler->getCount();
|
||||
|
||||
for (int x = 0; x < dbcHandler->getFileByIdx(f)->messageHandler->getCount(); x++)
|
||||
{
|
||||
ui->cbMessages->addItem(dbcHandler->getFileByIdx(f)->messageHandler->findMsgByIdx(x)->name);
|
||||
if(dbcHandler->getFileByIdx(f)->messageHandler->findMsgByIdx(x)->sender->name == nodeName)
|
||||
ui->cbMessages->addItem(dbcHandler->getFileByIdx(f)->messageHandler->findMsgByIdx(x)->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,8 +216,10 @@ void SignalViewerWindow::addSignal(DBC_SIGNAL *sig)
|
||||
|
||||
int rowIdx = ui->tableViewer->rowCount();
|
||||
ui->tableViewer->insertRow(rowIdx);
|
||||
QTableWidgetItem *item = new QTableWidgetItem(sig->parentMessage->sender->name + " - " + sig->name);
|
||||
ui->tableViewer->setItem(rowIdx, 0, item);
|
||||
QTableWidgetItem *nodeitem = new QTableWidgetItem(sig->parentMessage->sender->name);
|
||||
ui->tableViewer->setItem(rowIdx, 0, nodeitem);
|
||||
QTableWidgetItem *msgitem = new QTableWidgetItem(sig->name);
|
||||
ui->tableViewer->setItem(rowIdx, 1, msgitem);
|
||||
}
|
||||
|
||||
void SignalViewerWindow::saveSignalsFile()
|
||||
|
||||
@@ -17,7 +17,8 @@ public:
|
||||
~SignalViewerWindow();
|
||||
|
||||
private slots:
|
||||
void loadMessages();
|
||||
void loadNodes();
|
||||
void loadMessages(int idx);
|
||||
void loadSignals(int idx);
|
||||
void addSignal();
|
||||
void addSignal(DBC_SIGNAL *sig);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>965</width>
|
||||
<height>678</height>
|
||||
<height>713</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -191,9 +191,23 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Font Size</string>
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbFontFixedWidth">
|
||||
<property name="text">
|
||||
<string>Use fixed-width font in tables</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinFontSize">
|
||||
<property name="minimum">
|
||||
|
||||
@@ -18,8 +18,11 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableViewer">
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>2</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>300</number>
|
||||
@@ -32,6 +35,7 @@
|
||||
</attribute>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -45,6 +49,16 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Node</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbNodes"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
|
||||
Reference in New Issue
Block a user