Fix for a few issues with DBC file loading and the ability to reorder DBC files.

This commit is contained in:
Collin Kidder
2019-05-28 21:26:33 -04:00
parent 377b42c8e7
commit a0cc88ede2
3 changed files with 14 additions and 3 deletions
+6
View File
@@ -15,6 +15,8 @@ DBCLoadSaveWindow::DBCLoadSaveWindow(const QVector<CANFrame> *frames, QWidget *p
ui->setupUi(this);
inhibitCellProcessing = false;
QStringList header;
header << "Filename" << "Associated Bus" << "J1939";
ui->tableFiles->setColumnCount(3);
@@ -159,6 +161,7 @@ void DBCLoadSaveWindow::editFile()
void DBCLoadSaveWindow::cellChanged(int row, int col)
{
if (inhibitCellProcessing) return;
if (col == 1) //the bus column
{
DBCFile *file = dbcHandler->getFileByIdx(row);
@@ -214,6 +217,7 @@ void DBCLoadSaveWindow::swapTableRows(bool up)
const int destIdx = (up ? idx-1 : idx+1);
Q_ASSERT(destIdx >= 0 && destIdx < ui->tableFiles->rowCount());
inhibitCellProcessing = true;
// take whole rows
QList<QTableWidgetItem*> sourceItems = takeRow(idx);
QList<QTableWidgetItem*> destItems = takeRow(destIdx);
@@ -221,6 +225,8 @@ void DBCLoadSaveWindow::swapTableRows(bool up)
// set back in reverse order
setRow(idx, destItems);
setRow(destIdx, sourceItems);
inhibitCellProcessing = false;
}
QList<QTableWidgetItem*> DBCLoadSaveWindow::takeRow(int row)