changeset 693:3c5dc95bea91 by-id

Tidy
author Chris Cannam
date Wed, 17 Jul 2019 13:28:37 +0100
parents ad5917362158
children b5000a78249a
files audio/AudioGenerator.cpp framework/Document.cpp framework/Document.h framework/SVFileReader.cpp
diffstat 4 files changed, 9 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioGenerator.cpp	Wed Jul 17 11:20:24 2019 +0100
+++ b/audio/AudioGenerator.cpp	Wed Jul 17 13:28:37 2019 +0100
@@ -166,15 +166,6 @@
 void
 AudioGenerator::playClipIdChanged(int playableId, QString)
 {
-    /*!!!
-    const Model *model = dynamic_cast<const Model *>(playable);
-    if (!model) {
-        cerr << "WARNING: AudioGenerator::playClipIdChanged: playable "
-                  << playable << " is not a supported model type"
-                  << endl;
-        return;
-    }
-    */
     ModelId modelId;
     modelId.untyped = playableId;
     
--- a/framework/Document.cpp	Wed Jul 17 11:20:24 2019 +0100
+++ b/framework/Document.cpp	Wed Jul 17 13:28:37 2019 +0100
@@ -291,18 +291,6 @@
         delete this;
     }
 
-    void cancel() {
-/*!!! todo: restore
-        foreach (Layer *layer, m_primary) {
-            ModelId model = layer->getModel();
-            //!!! todo: restore this behaviour
-            if (model) {
-                model->abandon();
-            }
-        }
-*/
-    }
-
 private:
     Document *m_doc;
     vector<Layer *> m_primary;
@@ -345,13 +333,6 @@
     return amc;
 }
 
-void
-Document::cancelAsyncLayerCreation(Document::LayerCreationAsyncHandle h)
-{
-    AdditionalModelConverter *conv = static_cast<AdditionalModelConverter *>(h);
-    conv->cancel();
-}
-
 vector<Layer *>
 Document::createLayersForDerivedModels(vector<ModelId> newModels, 
                                        QStringList names)
@@ -1067,7 +1048,6 @@
     return models;
 }
 
-//!!! what is this used for?
 bool
 Document::isKnownModel(const ModelId modelId) const
 {
@@ -1562,10 +1542,6 @@
     // 'type="transform"' in the derivation element.
 
     const Transform &transform = rec.transform;
-
-    //!!! in cases like these, where we think we have the model handle
-    //!!! and nobody else should be releasing it, we probably ought to
-    //!!! throw std::logic_error if !targetModel
     
     auto targetModel = ModelById::get(targetModelId);
     if (!targetModel) return;
--- a/framework/Document.h	Wed Jul 17 11:20:24 2019 +0100
+++ b/framework/Document.h	Wed Jul 17 13:28:37 2019 +0100
@@ -158,21 +158,13 @@
      * transformer process, and the layers are returned through a
      * subsequent call to the provided handler (which must be
      * non-null). The handle returned will be passed through to the
-     * handler callback, and may be also used for cancelling the task.
+     * handler callback.
      */
     LayerCreationAsyncHandle createDerivedLayersAsync(const Transforms &,
                                                       const ModelTransformer::Input &,
                                                       LayerCreationHandler *handler);
 
     /**
-     * Indicate that the async layer creation task associated with the
-     * given handle should be cancelled. There is no guarantee about
-     * what this will mean, and the handler callback may still be
-     * called.
-     */
-    void cancelAsyncLayerCreation(LayerCreationAsyncHandle handle);
-
-    /**
      * Delete the given layer, and also its associated model if no
      * longer used by any other layer.  In general, this should be the
      * only method used to delete layers -- doing so directly is a bit
@@ -196,7 +188,11 @@
     
     std::vector<ModelId> getTransformInputModels();
 
-    //??? investigate & document
+    /**
+     * Return true if the model id is known to be the main model or
+     * one of the other existing models that can be shown in a new
+     * layer.
+     */
     bool isKnownModel(ModelId) const;
 
     /**
--- a/framework/SVFileReader.cpp	Wed Jul 17 11:20:24 2019 +0100
+++ b/framework/SVFileReader.cpp	Wed Jul 17 13:28:37 2019 +0100
@@ -476,19 +476,10 @@
             continue;
         }
 
-        //!!! todo: review this (i.e. who causes the release of what)
+        m_document->addNonDerivedModel(modelId);
         
-        // don't want to add alignment models to the document, because
-        // their lifespans are entirely dictated by the models that
-        // "own" them even though they were read independently from
-        // the .sv file.  (pity we don't have a nicer way to handle
-        // this)
-        if (!ModelById::isa<AlignmentModel>(modelId)) {
-            m_document->addNonDerivedModel(modelId);
-        }
-        
-        // but we add all models including alignment ones to the added
-        // set, so they don't get released by our own destructor
+        // make a note of all models that have been added to the
+        // document, so they don't get released by our own destructor
         m_addedModels.insert(modelId);
     }
 }