Skip to content

Commit

Permalink
Change so 3d tables can now be selected and displayed by name, rather…
Browse files Browse the repository at this point in the history
… than just locationid
  • Loading branch information
malcom2073 committed Jan 27, 2014
1 parent 51feafb commit 7069339
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 19 deletions.
67 changes: 48 additions & 19 deletions core/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,28 +759,57 @@ void MainWindow::menu_windows_PacketStatusClicked()
}
void MainWindow::showTable(QString table)
{
Table2DData *data = emsComms->get2DTableData(table);
TableView2D *view = new TableView2D();
connect(view,SIGNAL(destroyed(QObject*)),this,SLOT(rawDataViewDestroyed(QObject*)));
QString title;
//Table2DMetaData metadata = m_memoryMetaData->get2DMetaData(locid);
//view->setMetaData(metadata);
DataBlock *block = dynamic_cast<DataBlock*>(data);
if (!view->setData(table,block))
Table2DData *data2d = emsComms->get2DTableData(table);
Table3DData *data3d = emsComms->get3DTableData(table);
if (data2d)
{
return;
TableView2D *view = new TableView2D();
connect(view,SIGNAL(destroyed(QObject*)),this,SLOT(rawDataViewDestroyed(QObject*)));
QString title;
//Table2DMetaData metadata = m_memoryMetaData->get2DMetaData(locid);
//view->setMetaData(metadata);
DataBlock *block = dynamic_cast<DataBlock*>(data2d);
if (!view->setData(table,block))
{
return;
}
//title = metadata.tableTitle;
connect(view,SIGNAL(destroyed(QObject*)),this,SLOT(rawDataViewDestroyed(QObject*)));

QMdiSubWindow *win = ui.mdiArea->addSubWindow(view);
//win->setWindowTitle("Ram Location 0x" + QString::number(locid,16).toUpper() + " " + title);
win->setWindowTitle("Ram Location " + table);
win->setGeometry(0,0,((view->width() < this->width()-160) ? view->width() : this->width()-160),((view->height() < this->height()-100) ? view->height() : this->height()-100));
//m_rawDataView[locid] = view;
win->show();
QApplication::postEvent(win, new QEvent(QEvent::Show));
QApplication::postEvent(win, new QEvent(QEvent::WindowActivate));
}
else if (data3d)
{
TableView3D *view = new TableView3D();
connect(view,SIGNAL(destroyed(QObject*)),this,SLOT(rawDataViewDestroyed(QObject*)));
QString title;
//Table2DMetaData metadata = m_memoryMetaData->get2DMetaData(locid);
//view->setMetaData(metadata);
DataBlock *block = dynamic_cast<DataBlock*>(data3d);
if (!view->setData(table,block))
{
return;
}
//title = metadata.tableTitle;
connect(view,SIGNAL(destroyed(QObject*)),this,SLOT(rawDataViewDestroyed(QObject*)));

QMdiSubWindow *win = ui.mdiArea->addSubWindow(view);
//win->setWindowTitle("Ram Location 0x" + QString::number(locid,16).toUpper() + " " + title);
win->setWindowTitle("Ram Location " + table);
win->setGeometry(0,0,((view->width() < this->width()-160) ? view->width() : this->width()-160),((view->height() < this->height()-100) ? view->height() : this->height()-100));
//m_rawDataView[locid] = view;
win->show();
QApplication::postEvent(win, new QEvent(QEvent::Show));
QApplication::postEvent(win, new QEvent(QEvent::WindowActivate));
}
//title = metadata.tableTitle;
connect(view,SIGNAL(destroyed(QObject*)),this,SLOT(rawDataViewDestroyed(QObject*)));

QMdiSubWindow *win = ui.mdiArea->addSubWindow(view);
//win->setWindowTitle("Ram Location 0x" + QString::number(locid,16).toUpper() + " " + title);
win->setWindowTitle("Ram Location " + table);
win->setGeometry(0,0,((view->width() < this->width()-160) ? view->width() : this->width()-160),((view->height() < this->height()-100) ? view->height() : this->height()-100));
//m_rawDataView[locid] = view;
win->show();
QApplication::postEvent(win, new QEvent(QEvent::Show));
QApplication::postEvent(win, new QEvent(QEvent::WindowActivate));
}

void MainWindow::createView(unsigned short locid,DataType type)
Expand Down
15 changes: 15 additions & 0 deletions core/src/tableview3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,21 @@ void TableView3D::setMetaData(Table3DMetaData metadata)
m_metaData = metadata;
metaDataValid = true;
}
bool TableView3D::setData(QString name,DataBlock *data)
{
Q_UNUSED(name)
if (tableData == 0)
{
tableData = dynamic_cast<Table3DData*>(data);
connect(tableData,SIGNAL(update()),this,SLOT(updateTable()));
//connect(tableData,SIGNAL(saveSingleData(unsigned short,QByteArray,unsigned short,unsigned short)),this,SIGNAL(saveSingleData(unsigned short,QByteArray,unsigned short,unsigned short)));
}
else
{
}
//m_locationId = locationid;
return updateTable();
}

bool TableView3D::setData(unsigned short locationid,DataBlock *data)
{
Expand Down
1 change: 1 addition & 0 deletions core/src/tableview3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class TableView3D : public DataView
~TableView3D();
void setMetaData(Table3DMetaData metadata);
bool setData(unsigned short locationid,DataBlock *data);
bool setData(QString name,DataBlock *data);
void passDatalog(QVariantMap data);
private:
void reColorTable(int rownum,int colnum);
Expand Down

0 comments on commit 7069339

Please sign in to comment.