changeset 2303:6df78d2b1b5e by-id

Work on the cancel-button
author Chris Cannam
date Mon, 15 Jul 2019 14:13:40 +0100
parents bac1a8318314
children 1bf8b93dc006
files main/MainWindow.cpp main/MainWindow.h repoint-lock.json
diffstat 3 files changed, 35 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Fri Jul 05 15:35:55 2019 +0100
+++ b/main/MainWindow.cpp	Mon Jul 15 14:13:40 2019 +0100
@@ -3475,6 +3475,10 @@
 MainWindow::paneAdded(Pane *pane)
 {
     if (m_overview) m_overview->registerView(pane);
+    if (pane) {
+        connect(pane, SIGNAL(cancelButtonPressed(Layer *)),
+                this, SLOT(paneCancelButtonPressed(Layer *)));
+    }
 }    
 
 void
@@ -3490,6 +3494,31 @@
 }    
 
 void
+MainWindow::paneCancelButtonPressed(Layer *layer)
+{
+    Pane *pane = qobject_cast<Pane *>(sender());
+    bool found = false;
+    if (pane && layer) {
+        for (int i = 0; i < pane->getLayerCount(); ++i) {
+            if (pane->getLayer(i) == layer) {
+                found = true;
+                break;
+            }
+        }
+    }
+    if (!found) {
+        SVDEBUG << "MainWindow::paneCancelButtonPressed: Unknown layer in pane"
+                << endl;
+        return;
+    }
+
+    SVDEBUG << "MainWindow::paneCancelButtonPressed: Layer " << layer << endl;
+
+    m_document->removeLayerFromView(pane, layer);
+    updateMenuStates();
+}
+
+void
 MainWindow::paneDropAccepted(Pane *pane, QStringList uriList)
 {
     if (pane) m_paneStack->setCurrentPane(pane);
@@ -4146,7 +4175,7 @@
             if (auto aggregateModel = ModelById::get(aggregate)) {
                 aggregateModel->setObjectName(tr("Multiplexed audio"));
             }
-            m_document->addAggregateModel(aggregate);
+            m_document->addNonDerivedModel(aggregate);
         } else {
             ModelById::release(aggregate);
         }
--- a/main/MainWindow.h	Fri Jul 05 15:35:55 2019 +0100
+++ b/main/MainWindow.h	Mon Jul 15 14:13:40 2019 +0100
@@ -118,6 +118,8 @@
     void paneDropAccepted(Pane *, QStringList) override;
     void paneDropAccepted(Pane *, QString) override;
 
+    void paneCancelButtonPressed(Layer *);
+
     virtual void setupRecentFilesMenu();
     virtual void setupRecentTransformsMenu();
     virtual void setupTemplatesMenu();
--- a/repoint-lock.json	Fri Jul 05 15:35:55 2019 +0100
+++ b/repoint-lock.json	Mon Jul 15 14:13:40 2019 +0100
@@ -4,13 +4,13 @@
       "pin": "62987b6d6a3b"
     },
     "svcore": {
-      "pin": "6d09d68165a4"
+      "pin": "110f853c3149"
     },
     "svgui": {
-      "pin": "e540aa5d89cd"
+      "pin": "3943d0720167"
     },
     "svapp": {
-      "pin": "e0b0f3e163ca"
+      "pin": "c8ba09756eff"
     },
     "checker": {
       "pin": "c8c17e51aab0"