changeset 578:702272b78bbe 3.0-integration

Merge
author Chris Cannam
date Wed, 04 Jan 2017 19:10:32 +0000
parents 58354f2934ec (diff) c2e27ad7f408 (current diff)
children 1a8a8980f39a
files audio/AudioRecordTarget.cpp audio/AudioRecordTarget.h framework/MainWindowBase.cpp framework/MainWindowBase.h
diffstat 3 files changed, 39 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Jan 04 16:53:06 2017 +0000
+++ b/framework/MainWindowBase.cpp	Wed Jan 04 19:10:32 2017 +0000
@@ -1379,6 +1379,7 @@
 
     if (templateName == "") {
         templateName = getDefaultSessionTemplate();
+        SVDEBUG << "(Default template is: \"" << templateName << "\")" << endl;
     }
 
 //    cerr << "template is: \"" << templateName << "\"" << endl;
@@ -1499,11 +1500,11 @@
         if (templateName != "") {
             FileOpenStatus tplStatus = openSessionTemplate(templateName);
             if (tplStatus == FileOpenCancelled) {
-                cerr << "Template load cancelled" << endl;
+                SVDEBUG << "Template load cancelled" << endl;
                 return FileOpenCancelled;
             }
             if (tplStatus != FileOpenFailed) {
-                cerr << "Template load succeeded" << endl;
+                SVDEBUG << "Template load succeeded" << endl;
                 loadedTemplate = true;
             }
         }
@@ -1558,6 +1559,8 @@
 
     } else if (mode == CreateAdditionalModel) {
 
+        SVCERR << "Mode is CreateAdditionalModel" << endl;
+        
 	CommandHistory::getInstance()->startCompoundOperation
 	    (tr("Import \"%1\"").arg(source.getBasename()), true);
 
@@ -1569,7 +1572,10 @@
 	Pane *pane = command->getPane();
 
         if (m_timeRulerLayer) {
+            SVCERR << "Have time ruler, adding it" << endl;
             m_document->addLayerToView(pane, m_timeRulerLayer);
+        } else {
+            SVCERR << "Do not have time ruler" << endl;
         }
 
 	Layer *newLayer = m_document->createImportedLayer(newModel);
@@ -2013,6 +2019,7 @@
 	if (!source.isRemote()) m_sessionFile = source.getLocalFilename();
 
 	setupMenus();
+        findTimeRulerLayer();
 
 	CommandHistory::getInstance()->clear();
 	CommandHistory::getInstance()->documentSaved();
@@ -2105,6 +2112,7 @@
         emit activity(tr("Open session template \"%1\"").arg(source.getLocation()));
 
 	setupMenus();
+        findTimeRulerLayer();
 
 	CommandHistory::getInstance()->clear();
 	CommandHistory::getInstance()->documentSaved();
@@ -2135,6 +2143,7 @@
     FileOpenStatus status = openLayersFromRDF(source);
 
     setupMenus();
+    findTimeRulerLayer();
     
     setWindowTitle(tr("%1: %2")
                    .arg(QApplication::applicationName())
@@ -2726,6 +2735,26 @@
 }
 
 void
+MainWindowBase::findTimeRulerLayer()
+{
+    for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
+        Pane *pane = m_paneStack->getPane(i);
+        if (!pane) continue;
+        for (int j = 0; j < pane->getLayerCount(); ++j) {
+            Layer *layer = pane->getLayer(j);
+            if (!dynamic_cast<TimeRulerLayer *>(layer)) continue;
+            m_timeRulerLayer = layer;
+            return;
+        }
+    }
+    if (m_timeRulerLayer) {
+        SVCERR << "WARNING: Time ruler layer was not reset to 0 before session template loaded?" << endl;
+        delete m_timeRulerLayer;
+        m_timeRulerLayer = 0;
+    }
+}
+
+void
 MainWindowBase::toggleTimeRulers()
 {
     bool haveRulers = false;
@@ -2967,6 +2996,7 @@
         
         m_document->setMainModel(model);
         setupMenus();
+        findTimeRulerLayer();
 
 	if (loadedTemplate || (m_sessionFile == "")) {
             //!!! shouldn't be dealing directly with title from here -- call a method
--- a/framework/MainWindowBase.h	Wed Jan 04 16:53:06 2017 +0000
+++ b/framework/MainWindowBase.h	Wed Jan 04 19:10:32 2017 +0000
@@ -468,6 +468,8 @@
     virtual QString getDefaultSessionTemplate() const;
     virtual void setDefaultSessionTemplate(QString);
 
+    virtual void findTimeRulerLayer();
+    
     virtual void createAudioIO();
     virtual void deleteAudioIO();
     
--- a/framework/SVFileReader.cpp	Wed Jan 04 16:53:06 2017 +0000
+++ b/framework/SVFileReader.cpp	Wed Jan 04 19:10:32 2017 +0000
@@ -393,14 +393,12 @@
     }
 
 bool
-SVFileReader::readWindow(const QXmlAttributes &attributes)
+SVFileReader::readWindow(const QXmlAttributes &)
 {
-    bool ok = false;
-
-    READ_MANDATORY(int, width, toInt);
-    READ_MANDATORY(int, height, toInt);
-
-    m_paneCallback.setWindowSize(width, height);
+    // The window element contains window dimensions, which we used to
+    // read and size the window accordingly. This was a Bad Idea [tm]
+    // and we now do nothing instead. See #1769 Loading window
+    // dimensions from session file is a really bad idea
     return true;
 }