diff src/MainWindow.cpp @ 324:ac662fca8058

Small tidy
author Chris Cannam
date Fri, 13 Jun 2014 14:21:53 +0100
parents 8a884e1e3912
children ef75afbe4c67
line wrap: on
line diff
--- a/src/MainWindow.cpp	Fri Jun 13 14:06:48 2014 +0100
+++ b/src/MainWindow.cpp	Fri Jun 13 14:21:53 2014 +0100
@@ -2999,51 +2999,54 @@
 
     cerr << "(document is " << m_document << ", it says main model is " << m_document->getMainModel() << ")" << endl;
     
-    if (model) {
-        cerr << "pane stack is " << m_paneStack << " with " << m_paneStack->getPaneCount() << " panes" << endl;
-
-        if (m_paneStack) {
-
-            int pc = m_paneStack->getPaneCount();
-            Pane *pane = 0;
-            Pane *selectionStrip = 0;
-
-            if (pc < 2) {
-                pane = m_paneStack->addPane();
-                selectionStrip = m_paneStack->addPane();
-                m_document->addLayerToView
-                    (selectionStrip,
-                     m_document->createMainModelLayer(LayerFactory::TimeRuler));
-            } else {
-                pane = m_paneStack->getPane(0);
-                selectionStrip = m_paneStack->getPane(1);
-            }
-
-            if (selectionStrip) {
-                selectionStrip->setFixedHeight(26);
-                m_paneStack->sizePanesEqually();
-                m_viewManager->clearToolModeOverrides();
-                m_viewManager->setToolModeFor(selectionStrip,
-                                              ViewManager::SelectMode);
-            }
-
-            if (pane) {
-
-                disconnect(pane, SIGNAL(regionOutlined(QRect)),
-                           pane, SLOT(zoomToRegion(QRect)));
-                connect(pane, SIGNAL(regionOutlined(QRect)),
-                        this, SLOT(regionOutlined(QRect)));
-
-                QString error = m_analyser->newFileLoaded
-                    (m_document, getMainModel(), m_paneStack, pane);
-                if (error != "") {
-                    QMessageBox::warning
-                        (this,
-                         tr("Failed to analyse audio"),
-                         tr("<b>Analysis failed</b><p>%1</p>").arg(error),
-                         QMessageBox::Ok);
-                }
-            }
+    if (!model) {
+        cerr << "no main model!" << endl;
+        return;
+    }
+
+    if (!m_paneStack) {
+        cerr << "no pane stack!" << endl;
+        return;
+    }
+
+    int pc = m_paneStack->getPaneCount();
+    Pane *pane = 0;
+    Pane *selectionStrip = 0;
+
+    if (pc < 2) {
+        pane = m_paneStack->addPane();
+        selectionStrip = m_paneStack->addPane();
+        m_document->addLayerToView
+            (selectionStrip,
+             m_document->createMainModelLayer(LayerFactory::TimeRuler));
+    } else {
+        pane = m_paneStack->getPane(0);
+        selectionStrip = m_paneStack->getPane(1);
+    }
+
+    if (selectionStrip) {
+        selectionStrip->setFixedHeight(26);
+        m_paneStack->sizePanesEqually();
+        m_viewManager->clearToolModeOverrides();
+        m_viewManager->setToolModeFor(selectionStrip,
+                                      ViewManager::SelectMode);
+    }
+
+    if (pane) {
+
+        disconnect(pane, SIGNAL(regionOutlined(QRect)),
+                   pane, SLOT(zoomToRegion(QRect)));
+        connect(pane, SIGNAL(regionOutlined(QRect)),
+                this, SLOT(regionOutlined(QRect)));
+
+        QString error = m_analyser->newFileLoaded
+            (m_document, getMainModel(), m_paneStack, pane);
+        if (error != "") {
+            QMessageBox::warning
+                (this,
+                 tr("Failed to analyse audio"),
+                 tr("<b>Analysis failed</b><p>%1</p>").arg(error),
+                 QMessageBox::Ok);
         }
     }
 }