From 0ab6fdd411f20cb4cc59d923840e8e58659fb888 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Thu, 17 Aug 2017 20:10:43 -0400 Subject: [PATCH] Fixes to allow New Graph Window to pick up DBC changes while the program is running - also allow it to use more than one DBC file --- re/graphingwindow.cpp | 2 ++ re/newgraphdialog.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/re/graphingwindow.cpp b/re/graphingwindow.cpp index f3b24a3..8dbfdcd 100644 --- a/re/graphingwindow.cpp +++ b/re/graphingwindow.cpp @@ -921,6 +921,8 @@ void GraphingWindow::loadDefinitions() void GraphingWindow::showParamsDialog(int idx = -1) { + dbcHandler = DBCHandler::getReference(); + NewGraphDialog *thisDialog = new NewGraphDialog(dbcHandler); if (idx > -1) diff --git a/re/newgraphdialog.cpp b/re/newgraphdialog.cpp index 5647bb8..9af7095 100644 --- a/re/newgraphdialog.cpp +++ b/re/newgraphdialog.cpp @@ -90,7 +90,7 @@ void NewGraphDialog::setParams(GraphParams ¶ms) QPalette p = ui->colorSwatch->palette(); p.setColor(QPalette::Button, params.color); ui->colorSwatch->setPalette(p); - + loadMessages(); drawBitfield(); } @@ -120,10 +120,13 @@ void NewGraphDialog::loadMessages() { ui->cbMessages->clear(); if (dbcHandler == NULL) return; - if (dbcHandler->getFileCount() == 0) dbcHandler->createBlankFile(); - for (int x = 0; x < dbcHandler->getFileByIdx(0)->messageHandler->getCount(); x++) + if (dbcHandler->getFileCount() == 0) return; + for (int y = 0; y < dbcHandler->getFileCount(); y++) { - ui->cbMessages->addItem(dbcHandler->getFileByIdx(0)->messageHandler->findMsgByIdx(x)->name); + for (int x = 0; x < dbcHandler->getFileByIdx(y)->messageHandler->getCount(); x++) + { + ui->cbMessages->addItem(dbcHandler->getFileByIdx(y)->messageHandler->findMsgByIdx(x)->name); + } } }