diff main/MainWindow.cpp @ 177:5bde373ad5ca

* Layer tree view updating when visibility / audibility changed (and layers updating when they are changed in view) -- still some problems when a model is loaded while the tree is visible * FFTW_MEASURE throughout -- it does turn out to make an appreciable difference sometimes
author Chris Cannam
date Thu, 16 Aug 2007 16:47:07 +0000
parents aaf806ce329a
children 98ba77e0d897
line wrap: on
line diff
--- a/main/MainWindow.cpp	Tue Aug 14 19:37:10 2007 +0000
+++ b/main/MainWindow.cpp	Thu Aug 16 16:47:07 2007 +0000
@@ -137,6 +137,7 @@
     m_openingAudioFile(false),
     m_abandoning(false),
     m_preferencesDialog(0),
+    m_layerTreeView(0),
     m_keyReference(new KeyReference())
 {
     setWindowTitle(tr("Sonic Visualiser"));
@@ -347,6 +348,7 @@
     delete m_oscQueue;
     delete m_keyReference;
     delete m_preferencesDialog;
+    delete m_layerTreeView;
     Profiles::getInstance()->dump();
 }
 
@@ -3200,6 +3202,11 @@
         m_preferencesDialog->applicationClosing(false);
     }
 
+    if (m_layerTreeView &&
+        m_layerTreeView->isVisible()) {
+        delete m_layerTreeView;
+    }
+
     e->accept();
     return;
 }
@@ -4456,12 +4463,20 @@
 void
 MainWindow::showLayerTree()
 {
-    QTreeView *view = new QTreeView();
+    if (!m_layerTreeView.isNull()) {
+        m_layerTreeView->show();
+        m_layerTreeView->raise();
+        return;
+    }
+
+    //!!! should use an actual dialog class
+        
+    m_layerTreeView = new QTreeView();
     LayerTreeModel *tree = new LayerTreeModel(m_paneStack);
-    view->setModel(tree);
-    view->expandAll();
-    view->resize(500, 300); //!!!
-    view->show();
+    m_layerTreeView->resize(500, 300); //!!!
+    m_layerTreeView->setModel(tree);
+    m_layerTreeView->expandAll();
+    m_layerTreeView->show();
 }
 
 void