Skip to content

Commit

Permalink
Implementation to handle variable datalog formats from plugins
Browse files Browse the repository at this point in the history
Handling is added so a plugin can change datalog format in the middle of incoming data,
and it will automatically repopulate the Numeric data table view
  • Loading branch information
malcom2073 committed Apr 17, 2014
1 parent 1901cc9 commit 6aac0eb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions core/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ void MainWindow::setPlugin(QString plugin)
connect(emsComms,SIGNAL(interrogationData(QMap<QString,QString>)),this,SLOT(interrogationData(QMap<QString,QString>)),Qt::QueuedConnection);
connect(emsComms,SIGNAL(memoryDirty()),statusView,SLOT(setEmsMemoryDirty()));
connect(emsComms,SIGNAL(memoryClean()),statusView,SLOT(setEmsMemoryClean()));
connect(emsComms,SIGNAL(datalogDescriptor(QString)),this,SLOT(datalogDescriptor(QString)));
emsComms->setBaud(m_comBaud);
emsComms->setPort(m_comPort);
emsComms->setLogsEnabled(m_saveLogs);
Expand Down Expand Up @@ -2116,3 +2117,7 @@ void MainWindow::emsMemoryClean()
{

}
void MainWindow::datalogDescriptor(QString data)
{
Q_UNUSED(data)
}
1 change: 1 addition & 0 deletions core/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ private slots:
void subMdiWindowActivated(QMdiSubWindow* window);
void emsMemoryDirty();
void emsMemoryClean();
void datalogDescriptor(QString data);

};

Expand Down
13 changes: 10 additions & 3 deletions core/src/tableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ void TableView::closeEvent(QCloseEvent *event)
void TableView::passDecoder(DataPacketDecoder *decoder)
{
dataPacketDecoder = decoder;
dataFormatChanged();
connect(dataPacketDecoder,SIGNAL(dataFormatChanged()),this,SLOT(dataFormatChanged()));
}
void TableView::dataFormatChanged()
{
m_nameToIndexMap.clear();
ui.tableWidget->clearContents();
ui.tableWidget->setRowCount(dataPacketDecoder->fieldSize());
for (int i=0;i<dataPacketDecoder->fieldSize();i++)
{
m_nameToIndexMap[dataPacketDecoder->getFieldName(i)] = i;
ui.tableWidget->setItem(i,0,new QTableWidgetItem(dataPacketDecoder->getFieldName(i)));
m_nameToIndexMap[dataPacketDecoder->getFieldName(i)] = i;
ui.tableWidget->setItem(i,0,new QTableWidgetItem(dataPacketDecoder->getFieldName(i)));
ui.tableWidget->setItem(i,1,new QTableWidgetItem("0"));
ui.tableWidget->setItem(i,2,new QTableWidgetItem(dataPacketDecoder->getFieldDescription(i)));
ui.tableWidget->setItem(i,2,new QTableWidgetItem(dataPacketDecoder->getFieldDescription(i)));
}
}

Expand Down
1 change: 1 addition & 0 deletions core/src/tableview.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class TableView : public QWidget
void closeEvent(QCloseEvent *event);
private slots:
void guiUpdateTimerTick();
void dataFormatChanged();
signals:
void windowHiding(QMdiSubWindow *parent);
};
Expand Down

0 comments on commit 6aac0eb

Please sign in to comment.