DBC settings and bugfixes

- Changes in DBC file manager are immediately propagated to the main window (frames, filter labeling)
- Prevent DBC file manager from saving settings too often and too early (this also fixes a bug where sometimes the settings of all but the first DBC file are lost)
This commit is contained in:
mjuhanne
2019-08-12 18:29:33 +03:00
parent 6272ba3911
commit cd5fe6da02
4 changed files with 22 additions and 1 deletions
+10 -1
View File
@@ -15,7 +15,7 @@ DBCLoadSaveWindow::DBCLoadSaveWindow(const QVector<CANFrame> *frames, QWidget *p
ui->setupUi(this);
inhibitCellProcessing = false;
inhibitCellProcessing = true;
QStringList header;
header << "Filename" << "Associated Bus" << "Matching criteria" << "Label filters";
@@ -69,6 +69,8 @@ DBCLoadSaveWindow::DBCLoadSaveWindow(const QVector<CANFrame> *frames, QWidget *p
editorWindow = new DBCMainEditor(frames, this);
currentlyEditingFile = nullptr;
inhibitCellProcessing = false;
installEventFilter(this);
}
@@ -100,12 +102,16 @@ void DBCLoadSaveWindow::updateSettings()
DBCFile * file = dbcHandler->getFileByIdx(i);
if (file)
{
qDebug() << "Save DBC settings #" << i << " File: " << file->getFullFilename()
<< "Bus: " << file->getAssocBus() << "MC: " << file->messageHandler->getMatchingCriteria()
<< "Filter Labeling: " << (file->messageHandler->filterLabeling() ? "enabled" : "disabled");
settings.setValue("DBC/Filename_" + QString(i), file->getFullFilename());
settings.setValue("DBC/AssocBus_" + QString(i), file->getAssocBus());
settings.setValue("DBC/MatchingCriteria_" + QString(i), file->messageHandler->getMatchingCriteria());
settings.setValue("DBC/FilterLabeling_" + QString(i), file->messageHandler->filterLabeling());
}
}
emit updatedDBCSettings();
}
bool DBCLoadSaveWindow::eventFilter(QObject *obj, QEvent *event)
@@ -146,6 +152,7 @@ void DBCLoadSaveWindow::loadFile()
{
DBCFile *file = dbcHandler->loadDBCFile(-1);
if(file) {
inhibitCellProcessing=true;
int idx = ui->tableFiles->rowCount();
ui->tableFiles->insertRow(ui->tableFiles->rowCount());
ui->tableFiles->setItem(idx, 0, new QTableWidgetItem(file->getFullFilename()));
@@ -169,6 +176,7 @@ void DBCLoadSaveWindow::loadFile()
{
item->setCheckState(Qt::Unchecked);
}
inhibitCellProcessing=false;
updateSettings();
}
@@ -237,6 +245,7 @@ void DBCLoadSaveWindow::editFile()
void DBCLoadSaveWindow::matchingCriteriaChanged(int index)
{
if (inhibitCellProcessing) return;
// We don't know which combobox changed, so we just update all of them
for (int row=0; row<ui->tableFiles->rowCount(); row++)
{
+3
View File
@@ -31,6 +31,9 @@ private slots:
void matchingCriteriaChanged(int index);
void newFile();
signals:
void updatedDBCSettings();
private:
Ui::DBCLoadSaveWindow *ui;
DBCHandler *dbcHandler;
+8
View File
@@ -1029,11 +1029,19 @@ void MainWindow::showFlowViewWindow()
flowViewWindow->show();
}
void MainWindow::DBCSettingsUpdated()
{
updateFilterList();
model->sendRefresh();
}
void MainWindow::showDBCFileWindow()
{
if (!dbcFileWindow)
{
dbcFileWindow = new DBCLoadSaveWindow(model->getListReference());
connect(dbcFileWindow, &DBCLoadSaveWindow::updatedDBCSettings, this, &MainWindow::DBCSettingsUpdated);
}
dbcFileWindow->show();
}
+1
View File
@@ -98,6 +98,7 @@ private slots:
void filterSetAll();
void filterClearAll();
void headerClicked (int logicalIndex);
void DBCSettingsUpdated();
public slots:
void gotFrames(int);