Added a file manager and hooked it up. It is now possible to load and

edit multiple DBC files.
This commit is contained in:
Collin Kidder
2016-01-17 17:09:47 -05:00
parent cd5f851f35
commit 3ef905b68a
13 changed files with 335 additions and 78 deletions
+6 -3
View File
@@ -42,7 +42,8 @@ SOURCES += main.cpp\
scriptcontainer.cpp \
canfilter.cpp \
rangestatewindow.cpp \
dbc_classes.cpp
dbc_classes.cpp \
dbcloadsavewindow.cpp
HEADERS += mainwindow.h \
can_structs.h \
@@ -72,7 +73,8 @@ HEADERS += mainwindow.h \
scriptingwindow.h \
scriptcontainer.h \
canfilter.h \
rangestatewindow.h
rangestatewindow.h \
dbcloadsavewindow.h
FORMS += mainwindow.ui \
graphingwindow.ui \
@@ -90,7 +92,8 @@ FORMS += mainwindow.ui \
discretestatewindow.ui \
connectionwindow.ui \
scriptingwindow.ui \
rangestatewindow.ui
rangestatewindow.ui \
dbcloadsavewindow.ui
DISTFILES +=
+2 -1
View File
@@ -735,7 +735,7 @@ void DBCHandler::saveDBCFile(int idx)
//Otherwise add a new one. Well, always add a new one.
//If a valid index is passed we'll remove that one and then commence
//adding. Otherwise, just go straight to adding.
void DBCHandler::loadDBCFile(int idx)
DBCFile* DBCHandler::loadDBCFile(int idx)
{
if (idx > -1 && idx < loadedFiles.count()) removeDBCFile(idx);
@@ -757,6 +757,7 @@ void DBCHandler::loadDBCFile(int idx)
newFile.loadFile(filename);
loadedFiles.append(newFile);
}
return &loadedFiles.last();
}
void DBCHandler::removeDBCFile(int idx)
+1 -1
View File
@@ -77,7 +77,7 @@ class DBCHandler: public QObject
{
Q_OBJECT
public:
void loadDBCFile(int);
DBCFile* loadDBCFile(int);
void saveDBCFile(int);
void removeDBCFile(int);
void removeAllFiles();
+118
View File
@@ -0,0 +1,118 @@
#include "dbcloadsavewindow.h"
#include "ui_dbcloadsavewindow.h"
DBCLoadSaveWindow::DBCLoadSaveWindow(DBCHandler *handler, const QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent),
ui(new Ui::DBCLoadSaveWindow)
{
dbcHandler = handler;
referenceFrames = frames;
ui->setupUi(this);
QStringList header;
header << "Filename" << "Associated Bus";
ui->tableFiles->setColumnCount(2);
ui->tableFiles->setHorizontalHeaderLabels(header);
ui->tableFiles->setColumnWidth(0, 355);
ui->tableFiles->setColumnWidth(1, 125);
connect(ui->btnEdit, &QAbstractButton::clicked, this, &DBCLoadSaveWindow::editFile);
connect(ui->btnLoad, &QAbstractButton::clicked, this, &DBCLoadSaveWindow::loadFile);
connect(ui->btnMoveDown, &QAbstractButton::clicked, this, &DBCLoadSaveWindow::moveDown);
connect(ui->btnMoveUp, &QAbstractButton::clicked, this, &DBCLoadSaveWindow::moveUp);
connect(ui->btnRemove, &QAbstractButton::clicked, this, &DBCLoadSaveWindow::removeFile);
connect(ui->btnSave, &QAbstractButton::clicked, this, &DBCLoadSaveWindow::saveFile);
editorWindow = new DBCMainEditor(handler, frames);
}
DBCLoadSaveWindow::~DBCLoadSaveWindow()
{
delete ui;
}
void DBCLoadSaveWindow::loadFile()
{
DBCFile *file = dbcHandler->loadDBCFile(-1);
int idx = ui->tableFiles->rowCount();
ui->tableFiles->insertRow(ui->tableFiles->rowCount());
ui->tableFiles->setItem(idx, 0, new QTableWidgetItem(file->getFullFilename()));
ui->tableFiles->setItem(idx, 1, new QTableWidgetItem("-1"));
}
void DBCLoadSaveWindow::saveFile()
{
int idx = ui->tableFiles->currentRow();
if (idx < 0) return;
dbcHandler->saveDBCFile(idx);
}
void DBCLoadSaveWindow::removeFile()
{
int idx = ui->tableFiles->currentRow();
if (idx < 0) return;
dbcHandler->removeDBCFile(idx);
ui->tableFiles->removeRow(idx);
}
void DBCLoadSaveWindow::moveUp()
{
int idx = ui->tableFiles->currentRow();
if (idx < 1) return;
dbcHandler->swapFiles(idx - 1, idx);
swapTableRows(true);
}
void DBCLoadSaveWindow::moveDown()
{
int idx = ui->tableFiles->currentRow();
if (idx < 0) return;
if (idx > (dbcHandler->getFileCount() - 2)) return;
dbcHandler->swapFiles(idx, idx + 1);
swapTableRows(false);
}
void DBCLoadSaveWindow::editFile()
{
int idx = ui->tableFiles->currentRow();
if (idx < 0) return;
editorWindow->setFileIdx(idx);
editorWindow->show();
}
void DBCLoadSaveWindow::swapTableRows(bool up)
{
int idx = ui->tableFiles->currentRow();
const int destIdx = (up ? idx-1 : idx+1);
Q_ASSERT(destIdx >= 0 && destIdx < ui->tableFiles->rowCount());
// take whole rows
QList<QTableWidgetItem*> sourceItems = takeRow(idx);
QList<QTableWidgetItem*> destItems = takeRow(destIdx);
// set back in reverse order
setRow(idx, destItems);
setRow(destIdx, sourceItems);
}
QList<QTableWidgetItem*> DBCLoadSaveWindow::takeRow(int row)
{
QList<QTableWidgetItem*> rowItems;
for (int col = 0; col < ui->tableFiles->columnCount(); ++col)
{
rowItems << ui->tableFiles->takeItem(row, col);
}
return rowItems;
}
void DBCLoadSaveWindow::setRow(int row, const QList<QTableWidgetItem*>& rowItems)
{
for (int col = 0; col < ui->tableFiles->columnCount(); ++col)
{
ui->tableFiles->setItem(row, col, rowItems.at(col));
}
}
+41
View File
@@ -0,0 +1,41 @@
#ifndef DBCLOADSAVEWINDOW_H
#define DBCLOADSAVEWINDOW_H
#include <QDialog>
#include <QTableWidget>
#include "dbchandler.h"
#include "dbcmaineditor.h"
namespace Ui {
class DBCLoadSaveWindow;
}
class DBCLoadSaveWindow : public QDialog
{
Q_OBJECT
public:
explicit DBCLoadSaveWindow(DBCHandler *handler, const QVector<CANFrame> *frames, QWidget *parent = 0);
~DBCLoadSaveWindow();
private slots:
void loadFile();
void saveFile();
void removeFile();
void moveUp();
void moveDown();
void editFile();
private:
Ui::DBCLoadSaveWindow *ui;
DBCHandler *dbcHandler;
const QVector<CANFrame> *referenceFrames;
DBCMainEditor *editorWindow;
void swapTableRows(bool up);
QList<QTableWidgetItem*> takeRow(int row);
void setRow(int row, const QList<QTableWidgetItem*>& rowItems);
};
#endif // DBCLOADSAVEWINDOW_H
+74
View File
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DBCLoadSaveWindow</class>
<widget class="QDialog" name="DBCLoadSaveWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>665</height>
</rect>
</property>
<property name="windowTitle">
<string>DBC File Manager</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableWidget" name="tableFiles"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnLoad">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnRemove">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMoveUp">
<property name="text">
<string>Move Up</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btnSave">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnEdit">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMoveDown">
<property name="text">
<string>Move Down</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
+34 -26
View File
@@ -54,8 +54,8 @@ void DBCMainEditor::showEvent(QShowEvent* event)
inhibitCellChanged = true;
refreshNodesTable();
if (dbcHandler->getFileByIdx(0)->dbc_nodes.count() > 0)
refreshMessagesTable(&dbcHandler->getFileByIdx(0)->dbc_nodes.at(0));
if (dbcFile->dbc_nodes.count() > 0)
refreshMessagesTable(&dbcFile->dbc_nodes.at(0));
currRow = 0;
inhibitCellChanged = false;
@@ -67,6 +67,13 @@ DBCMainEditor::~DBCMainEditor()
delete sigEditor;
}
void DBCMainEditor::setFileIdx(int idx)
{
if (idx < 0 || idx > dbcHandler->getFileCount() - 1) return;
dbcFile = dbcHandler->getFileByIdx(idx);
fileIdx = idx;
}
void DBCMainEditor::closeEvent(QCloseEvent *event)
{
Q_UNUSED(event);
@@ -123,9 +130,9 @@ void DBCMainEditor::deleteCurrentNode()
if (nodeName.length() > 0 && nodeName.compare("Vector__XXX", Qt::CaseInsensitive) != 0)
{
ui->NodesTable->removeRow(thisRow);
dbcHandler->getFileByIdx(0)->dbc_nodes.removeAt(thisRow);
dbcFile->dbc_nodes.removeAt(thisRow);
inhibitCellChanged = true;
refreshMessagesTable(&dbcHandler->getFileByIdx(0)->dbc_nodes[0]);
refreshMessagesTable(&dbcFile->dbc_nodes[0]);
ui->NodesTable->selectRow(0);
inhibitCellChanged = false;
}
@@ -137,7 +144,7 @@ void DBCMainEditor::deleteCurrentMessage()
if (ui->MessagesTable->item(thisRow, 0)->text().length() > 0)
{
ui->MessagesTable->removeRow(thisRow);
dbcHandler->getFileByIdx(0)->messageHandler->removeMessageByIndex(thisRow);
dbcFile->messageHandler->removeMessageByIndex(thisRow);
}
}
@@ -156,7 +163,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
QString newName = ui->NodesTable->item(row, col)->text().simplified().replace(' ', '_');
qDebug() << "new name: " << newName;
if (newName.length() == 0) return;
if (dbcHandler->getFileByIdx(0)->findNodeByName(newName) != NULL) //duplicates an existing node!
if (dbcFile->findNodeByName(newName) != NULL) //duplicates an existing node!
{
QMessageBox msg;
msg.setParent(0);
@@ -165,8 +172,8 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
return;
}
newNode.name = newName;
dbcHandler->getFileByIdx(0)->dbc_nodes.append(newNode);
qDebug() << "# of nodes now " << dbcHandler->getFileByIdx(0)->dbc_nodes.count();
dbcFile->dbc_nodes.append(newNode);
qDebug() << "# of nodes now " << dbcFile->dbc_nodes.count();
QTableWidgetItem *widgetName = new QTableWidgetItem(newName);
inhibitCellChanged = true;
ui->NodesTable->setItem(row, col, widgetName);
@@ -178,7 +185,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
{
if (col == 0)
{
DBC_NODE *oldNode = dbcHandler->getFileByIdx(0)->findNodeByIdx(row);
DBC_NODE *oldNode = dbcFile->findNodeByIdx(row);
QString nodeName = ui->NodesTable->item(row, col)->text().simplified().replace(' ', '_');
if (oldNode == NULL) return;
if (row != 0) oldNode->name = nodeName;
@@ -192,7 +199,7 @@ void DBCMainEditor::onCellChangedNode(int row,int col)
{
QString nodeName = ui->NodesTable->item(row, 0)->text().simplified().replace(' ', '_');
qDebug() << "searching for node " << nodeName;
DBC_NODE *thisNode = dbcHandler->getFileByIdx(0)->findNodeByName(nodeName);
DBC_NODE *thisNode = dbcFile->findNodeByName(nodeName);
if (thisNode == NULL) return;
thisNode->comment = ui->NodesTable->item(row, col)->text().simplified();
qDebug() << "New comment: " << thisNode->comment;
@@ -213,7 +220,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
int msgLen;
QString msgComment;
DBC_MESSAGE newMsg;
DBC_NODE *node = dbcHandler->getFileByIdx(0)->findNodeByIdx(ui->NodesTable->currentRow());
DBC_NODE *node = dbcFile->findNodeByIdx(ui->NodesTable->currentRow());
DBC_MESSAGE *msg;
if (node == NULL)
{
@@ -224,14 +231,14 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
msgID = Utility::ParseStringToNum(ui->MessagesTable->item(row, 0)->text());
qDebug() << "Msg ID of edited: " << msgID;
msg = dbcHandler->getFileByIdx(0)->messageHandler->findMsgByID(msgID);
msg = dbcFile->messageHandler->findMsgByID(msgID);
switch(col)
{
case 0: //msg id
if (row == ui->MessagesTable->rowCount() - 1) //new record
{
if (dbcHandler->getFileByIdx(0)->messageHandler->findMsgByID(msgID) != NULL)
if (dbcFile->messageHandler->findMsgByID(msgID) != NULL)
{
QMessageBox msg;
msg.setParent(0);
@@ -251,7 +258,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
break;
}
}
dbcHandler->getFileByIdx(0)->messageHandler->addMessage(newMsg);
dbcFile->messageHandler->addMessage(newMsg);
}
else //editing an existing record
{
@@ -270,7 +277,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
if (msgName.length() == 0) return;
if (row == ui->MessagesTable->rowCount() - 1) //new record
{
if (dbcHandler->getFileByIdx(0)->messageHandler->findMsgByName(msgName) != NULL)
if (dbcFile->messageHandler->findMsgByName(msgName) != NULL)
{
QMessageBox msg;
msg.setParent(0);
@@ -281,7 +288,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
newMsg.ID = -1;
newMsg.name = msgName;
newMsg.sender = node;
dbcHandler->getFileByIdx(0)->messageHandler->addMessage(newMsg);
dbcFile->messageHandler->addMessage(newMsg);
}
else
{
@@ -304,7 +311,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
newMsg.name = "";
newMsg.len = msgLen;
newMsg.sender = node;
dbcHandler->getFileByIdx(0)->messageHandler->addMessage(newMsg);
dbcFile->messageHandler->addMessage(newMsg);
}
else //editing an existing record
{
@@ -328,7 +335,7 @@ void DBCMainEditor::onCellChangedMessage(int row,int col)
newMsg.len = 0;
newMsg.comment = msgComment;
newMsg.sender = node;
dbcHandler->getFileByIdx(0)->messageHandler->addMessage(newMsg);
dbcFile->messageHandler->addMessage(newMsg);
}
else //editing an existing record
{
@@ -363,7 +370,7 @@ void DBCMainEditor::onCellClickedNode(int row, int col)
nodeName = item->text();
qDebug() << "Trying to find node with name " << nodeName;
DBC_NODE *node = dbcHandler->getFileByIdx(0)->findNodeByName(nodeName);
DBC_NODE *node = dbcFile->findNodeByName(nodeName);
//qDebug() << "Address of node: " << (int)node;
inhibitCellChanged = true;
refreshMessagesTable(node);
@@ -376,8 +383,9 @@ void DBCMainEditor::onCellClickedMessage(int row, int col)
if (col == 3) //3 is the signals field. If clicked we go to the signals dialog
{
QString idString = ui->MessagesTable->item(row, 0)->text();
DBC_MESSAGE *message = dbcHandler->getFileByIdx(0)->messageHandler->findMsgByID(Utility::ParseStringToNum(idString));
DBC_MESSAGE *message = dbcFile->messageHandler->findMsgByID(Utility::ParseStringToNum(idString));
sigEditor->setMessageRef(message);
sigEditor->setFileIdx(fileIdx);
sigEditor->exec(); //blocks this window from being active until we're done
//now update the displayed # of signals
inhibitCellChanged = true;
@@ -394,17 +402,17 @@ void DBCMainEditor::refreshNodesTable()
int rowIdx;
if (dbcHandler->getFileByIdx(0)->findNodeByName("Vector__XXX") == NULL)
if (dbcFile->findNodeByName("Vector__XXX") == NULL)
{
DBC_NODE newNode;
newNode.name = "Vector__XXX";
newNode.comment = "Default node if no other node is specified";
dbcHandler->getFileByIdx(0)->dbc_nodes.append(newNode);
dbcFile->dbc_nodes.append(newNode);
}
for (int x = 0; x < dbcHandler->getFileByIdx(0)->dbc_nodes.count(); x++)
for (int x = 0; x < dbcFile->dbc_nodes.count(); x++)
{
DBC_NODE node = dbcHandler->getFileByIdx(0)->dbc_nodes.at(x);
DBC_NODE node = dbcFile->dbc_nodes.at(x);
QTableWidgetItem *nodeName = new QTableWidgetItem(node.name);
QTableWidgetItem *nodeComment = new QTableWidgetItem(node.comment);
rowIdx = ui->NodesTable->rowCount();
@@ -428,9 +436,9 @@ void DBCMainEditor::refreshMessagesTable(const DBC_NODE *node)
if (node != NULL)
{
for (int x = 0; x < dbcHandler->getFileByIdx(0)->messageHandler->getCount(); x++)
for (int x = 0; x < dbcFile->messageHandler->getCount(); x++)
{
DBC_MESSAGE *msg = dbcHandler->getFileByIdx(0)->messageHandler->findMsgByIdx(x);
DBC_MESSAGE *msg = dbcFile->messageHandler->findMsgByIdx(x);
if (msg->sender == node)
{
//many of these are simplistic first versions just to test functionality.
+3
View File
@@ -18,6 +18,7 @@ class DBCMainEditor : public QDialog
public:
explicit DBCMainEditor(DBCHandler *handler, const QVector<CANFrame> *frames, QWidget *parent = 0);
~DBCMainEditor();
void setFileIdx(int idx);
private slots:
void onCellChangedNode(int,int);
@@ -35,6 +36,8 @@ private:
const QVector<CANFrame> *referenceFrames;
DBCSignalEditor *sigEditor;
int currRow;
DBCFile *dbcFile;
int fileIdx;
bool inhibitCellChanged;
void refreshNodesTable();
+13 -7
View File
@@ -33,11 +33,6 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
ui->comboType->addItem("DOUBLE PRECISION");
ui->comboType->addItem("STRING");
for (int x = 0; x < dbcHandler->getFileByIdx(0)->dbc_nodes.count(); x++)
{
ui->comboReceiver->addItem(dbcHandler->getFileByIdx(0)->dbc_nodes[x].name);
}
connect(ui->signalsList, SIGNAL(currentRowChanged(int)), this, SLOT(clickSignalList(int)));
connect(ui->bitfield, SIGNAL(gridClicked(int,int)), this, SLOT(bitfieldClicked(int,int)));
connect(ui->signalsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomMenuSignals(QPoint)));
@@ -61,7 +56,7 @@ DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
[=]()
{
if (currentSignal == NULL) return;
currentSignal->receiver = dbcHandler->getFileByIdx(0)->findNodeByName(ui->comboReceiver->currentText());
currentSignal->receiver = dbcFile->findNodeByName(ui->comboReceiver->currentText());
});
connect(ui->comboType, &QComboBox::currentTextChanged,
[=]()
@@ -223,6 +218,17 @@ void DBCSignalEditor::closeEvent(QCloseEvent *event)
writeSettings();
}
void DBCSignalEditor::setFileIdx(int idx)
{
if (idx < 0 || idx > dbcHandler->getFileCount() - 1) return;
dbcFile = dbcHandler->getFileByIdx(idx);
for (int x = 0; x < dbcFile->dbc_nodes.count(); x++)
{
ui->comboReceiver->addItem(dbcFile->dbc_nodes[x].name);
}
}
void DBCSignalEditor::readSettings()
{
QSettings settings;
@@ -326,7 +332,7 @@ void DBCSignalEditor::addNewSignal()
newSig.intelByteOrder = true;
newSig.max = 0.0;
newSig.min = 0.0;
newSig.receiver = dbcHandler->getFileByIdx(0)->findNodeByIdx(0);
newSig.receiver = dbcFile->findNodeByIdx(0);
newSig.signalSize = 1;
newSig.startBit = 0;
newSig.valType = UNSIGNED_INT;
+2
View File
@@ -17,6 +17,7 @@ public:
explicit DBCSignalEditor(DBCHandler *handler, QWidget *parent = 0);
void setMessageRef(DBC_MESSAGE *msg);
void showEvent(QShowEvent*);
void setFileIdx(int idx);
~DBCSignalEditor();
private slots:
@@ -34,6 +35,7 @@ private:
DBCHandler *dbcHandler;
DBC_MESSAGE *dbcMessage;
DBC_SIGNAL *currentSignal;
DBCFile *dbcFile;
bool inhibitCellChanged;
void refreshSignalsList();
+31 -33
View File
@@ -94,6 +94,7 @@ MainWindow::MainWindow(QWidget *parent) :
connectionWindow = NULL;
scriptingWindow = NULL;
rangeWindow = NULL;
dbcFileWindow = NULL;
dbcHandler = new DBCHandler;
bDirty = false;
inhibitFilterUpdate = false;
@@ -113,13 +114,10 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->action_Playback, &QAction::triggered, this, &MainWindow::showPlaybackWindow);
connect(ui->actionFlow_View, &QAction::triggered, this, &MainWindow::showFlowViewWindow);
connect(ui->action_Custom, &QAction::triggered, this, &MainWindow::showFrameSenderWindow);
connect(ui->actionLoad_DBC_File, &QAction::triggered, this, &MainWindow::handleLoadDBC);
connect(ui->actionSave_DBC_File, &QAction::triggered, this, &MainWindow::handleSaveDBC);
connect(ui->canFramesView, &QAbstractItemView::clicked, this, &MainWindow::gridClicked);
connect(ui->canFramesView, &QAbstractItemView::doubleClicked, this, &MainWindow::gridDoubleClicked);
connect(ui->cbInterpret, &QAbstractButton::toggled, this, &MainWindow::interpretToggled);
connect(ui->cbOverwrite, &QAbstractButton::toggled, this, &MainWindow::overwriteToggled);
connect(ui->actionEdit_Messages_Signals, &QAction::triggered, this, &MainWindow::showDBCEditor);
connect(ui->btnCaptureToggle, &QAbstractButton::clicked, this, &MainWindow::toggleCapture);
connect(ui->actionExit_Application, &QAction::triggered, this, &MainWindow::exitApp);
connect(ui->actionFuzzy_Scope, &QAction::triggered, this, &MainWindow::showFuzzyScopeWindow);
@@ -135,6 +133,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->btnFilterAll, &QAbstractButton::clicked, this, &MainWindow::filterSetAll);
connect(ui->btnFilterNone, &QAbstractButton::clicked, this, &MainWindow::filterClearAll);
connect(ui->actionFirmware_Uploader, &QAction::triggered, this, &MainWindow::showFirmwareUploaderWindow);
connect(ui->actionDBC_File_Manager, &QAction::triggered, this, &MainWindow::showDBCFileWindow);
lbStatusConnected.setText(tr("Not connected"));
updateFileStatus();
@@ -240,12 +239,36 @@ MainWindow::~MainWindow()
delete rangeWindow;
}
if (dbcFileWindow)
{
dbcFileWindow->close();
delete dbcFileWindow;
}
delete ui;
delete dbcHandler;
model->clearFrames();
delete model;
}
void MainWindow::exitApp()
{
if (graphingWindow) graphingWindow->close();
if (frameInfoWindow) frameInfoWindow->close();
if (playbackWindow) playbackWindow->close();
if (flowViewWindow) flowViewWindow->close();
if (frameSenderWindow) frameSenderWindow->close();
if (dbcMainEditor) dbcMainEditor->close();
if (comparatorWindow) comparatorWindow->close();
if (connectionWindow) connectionWindow->close();
if (settingsDialog) settingsDialog->close();
if (discreteStateWindow) discreteStateWindow->close();
if (scriptingWindow) scriptingWindow->close();
if (rangeWindow) rangeWindow->close();
if (dbcFileWindow) dbcFileWindow->close();
this->close();
}
void MainWindow::closeEvent(QCloseEvent *event)
{
Q_UNUSED(event);
@@ -753,18 +776,7 @@ void MainWindow::handleLoadFilters()
}
}
void MainWindow::handleLoadDBC()
{
dbcHandler->loadDBCFile(-1);
//lbStatusDatabase.setText(fileList[fileList.length() - 1] + tr(" loaded."));
}
void MainWindow::handleSaveDBC()
{
dbcHandler->saveDBCFile(0);
//lbStatusDatabase.setText(fileList[fileList.length() - 1] + tr(" loaded."));
}
//lbStatusDatabase.setText(fileList[fileList.length() - 1] + tr(" loaded."));
void MainWindow::handleSaveDecoded()
{
@@ -1064,19 +1076,6 @@ void MainWindow::showFuzzyScopeWindow()
//not done yet
}
void MainWindow::exitApp()
{
if (graphingWindow) graphingWindow->close();
if (frameInfoWindow) frameInfoWindow->close();
if (playbackWindow) playbackWindow->close();
if (flowViewWindow) flowViewWindow->close();
if (frameSenderWindow) frameSenderWindow->close();
if (dbcMainEditor) dbcMainEditor->close();
if (comparatorWindow) comparatorWindow->close();
if (connectionWindow) connectionWindow->close();
this->close();
}
void MainWindow::showFlowViewWindow()
{
if (!flowViewWindow)
@@ -1098,14 +1097,13 @@ void MainWindow::showFlowViewWindow()
flowViewWindow->show();
}
//this one always gets the unfiltered list intentionally.
void MainWindow::showDBCEditor()
void MainWindow::showDBCFileWindow()
{
if (!dbcMainEditor)
if (!dbcFileWindow)
{
dbcMainEditor = new DBCMainEditor(dbcHandler, model->getListReference());
dbcFileWindow = new DBCLoadSaveWindow(dbcHandler, model->getListReference());
}
dbcMainEditor->show();
dbcFileWindow->show();
}
void MainWindow::showConnectionSettingsWindow()
+3 -3
View File
@@ -22,6 +22,7 @@
#include "connectionwindow.h"
#include "scriptingwindow.h"
#include "rangestatewindow.h"
#include "dbcloadsavewindow.h"
namespace Ui {
class MainWindow;
@@ -42,8 +43,6 @@ private slots:
void handleLoadFile();
void handleSaveFile();
void handleSaveFilteredFile();
void handleLoadDBC();
void handleSaveDBC();
void handleSaveFilters();
void handleLoadFilters();
void connButtonPress();
@@ -61,6 +60,7 @@ private slots:
void showFirmwareUploaderWindow();
void showConnectionSettingsWindow();
void showScriptingWindow();
void showDBCFileWindow();
void exitApp();
void handleSaveDecoded();
void changeBaudRates();
@@ -71,7 +71,6 @@ private slots:
void gridDoubleClicked(QModelIndex);
void interpretToggled(bool);
void overwriteToggled(bool);
void showDBCEditor();
void toggleCapture();
void normalizeTiming();
void updateFilterList();
@@ -129,6 +128,7 @@ private:
ConnectionWindow *connectionWindow;
ScriptingWindow *scriptingWindow;
RangeStateWindow *rangeWindow;
DBCLoadSaveWindow *dbcFileWindow;
//various private storage
QLabel lbStatusConnected;
+7 -4
View File
@@ -230,9 +230,7 @@
<addaction name="actionLoad_Filter_Definition"/>
<addaction name="actionSave_Filter_Definition"/>
<addaction name="separator"/>
<addaction name="actionLoad_DBC_File"/>
<addaction name="actionEdit_Messages_Signals"/>
<addaction name="actionSave_DBC_File"/>
<addaction name="actionDBC_File_Manager"/>
<addaction name="actionSave_Decoded_Frames"/>
<addaction name="separator"/>
<addaction name="actionPreferences"/>
@@ -355,7 +353,7 @@
<action name="actionConnect">
<property name="text">
<string>Connect</string>
</property>
</property>
</action>
<action name="actionScripting_INterface">
<property name="text">
@@ -372,6 +370,11 @@
<string>Single/Multi State</string>
</property>
</action>
<action name="actionDBC_File_Manager">
<property name="text">
<string>DBC File Manager</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>