diff data/model/NoteModel.h @ 1752:6d09d68165a4 by-id

Further review of ById: make IDs only available when adding a model to the ById store, not by querying the item directly. This means any id encountered in the wild must have been added to the store at some point (even if later released), which simplifies reasoning about lifecycles
author Chris Cannam
date Fri, 05 Jul 2019 15:28:07 +0100
parents 77543124651b
children 13bd41bd8a17
line wrap: on
line diff
--- a/data/model/NoteModel.h	Thu Jul 04 18:04:21 2019 +0100
+++ b/data/model/NoteModel.h	Fri Jul 05 15:28:07 2019 +0100
@@ -58,6 +58,7 @@
         m_units(""),
         m_extendTo(0),
         m_notifier(this,
+                   getId(),
                    notifyOnAdd ?
                    DeferredNotifier::NOTIFY_ALWAYS :
                    DeferredNotifier::NOTIFY_DEFERRED),
@@ -84,6 +85,7 @@
         m_units(""),
         m_extendTo(0),
         m_notifier(this,
+                   getId(),
                    notifyOnAdd ?
                    DeferredNotifier::NOTIFY_ALWAYS :
                    DeferredNotifier::NOTIFY_DEFERRED),
@@ -145,12 +147,12 @@
             m_notifier.makeDeferredNotifications();
         }
         
-        emit completionChanged();
+        emit completionChanged(getId());
 
         if (completion == 100) {
             // henceforth:
             m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS);
-            emit modelChanged();
+            emit modelChanged(getId());
         }
     }
 
@@ -219,7 +221,7 @@
         m_notifier.update(e.getFrame(), e.getDuration() + m_resolution);
 
         if (allChange) {
-            emit modelChanged();
+            emit modelChanged(getId());
         }
     }
     
@@ -228,7 +230,8 @@
             QMutexLocker locker(&m_mutex);
             m_events.remove(e);
         }
-        emit modelChangedWithin(e.getFrame(),
+        emit modelChangedWithin(getId(),
+                                e.getFrame(),
                                 e.getFrame() + e.getDuration() + m_resolution);
     }