diff framework/MainWindowBase.cpp @ 124:bfa6b0582acb

* reorganise tabular data editor model support
author Chris Cannam
date Wed, 11 Jun 2008 16:13:25 +0000
parents 74dd55646f52
children e4635503a6d2
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Jun 11 12:54:18 2008 +0000
+++ b/framework/MainWindowBase.cpp	Wed Jun 11 16:13:25 2008 +0000
@@ -23,6 +23,7 @@
 #include "data/model/SparseOneDimensionalModel.h"
 #include "data/model/NoteModel.h"
 #include "data/model/Labeller.h"
+#include "data/model/TabularModel.h"
 #include "view/ViewManager.h"
 
 #include "layer/WaveformLayer.h"
@@ -1934,13 +1935,22 @@
     Model *model = layer->getModel();
     if (!model) return;
 
+    TabularModel *tabular = dynamic_cast<TabularModel *>(model);
+    if (!tabular) {
+        //!!! how to prevent this function from being active if not
+        //appropriate model type?  or will we ultimately support
+        //tabular display for all editable models?
+        std::cerr << "NOTE: Not a tabular model" << std::endl;
+        return;
+    }
+
     if (m_layerDataDialogMap.find(layer) != m_layerDataDialogMap.end()) {
         m_layerDataDialogMap[layer]->show();
         m_layerDataDialogMap[layer]->raise();
         return;
     }
 
-    ModelDataTableDialog *dialog = new ModelDataTableDialog(model);
+    ModelDataTableDialog *dialog = new ModelDataTableDialog(tabular);
 //    dialog->setAttribute(Qt::WA_DeleteOnClose); //!!! how to manage this?
 
     connect(m_viewManager,