diff data/model/EditableDenseThreeDimensionalModel.cpp @ 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 78fe29adfd16
children d484490cdf69
line wrap: on
line diff
--- a/data/model/EditableDenseThreeDimensionalModel.cpp	Thu Jul 04 18:04:21 2019 +0100
+++ b/data/model/EditableDenseThreeDimensionalModel.cpp	Fri Jul 05 15:28:07 2019 +0100
@@ -359,15 +359,16 @@
 
     if (m_notifyOnAdd) {
         if (allChange) {
-            emit modelChanged();
+            emit modelChanged(getId());
         } else {
-            emit modelChangedWithin(windowStart, windowStart + m_resolution);
+            emit modelChangedWithin(getId(),
+                                    windowStart, windowStart + m_resolution);
         }
     } else {
         if (allChange) {
             m_sinceLastNotifyMin = -1;
             m_sinceLastNotifyMax = -1;
-            emit modelChanged();
+            emit modelChanged(getId());
         } else {
             if (m_sinceLastNotifyMin == -1 ||
                 windowStart < m_sinceLastNotifyMin) {
@@ -393,14 +394,14 @@
 {
     while ((int)m_binNames.size() <= n) m_binNames.push_back("");
     m_binNames[n] = name;
-    emit modelChanged();
+    emit modelChanged(getId());
 }
 
 void
 EditableDenseThreeDimensionalModel::setBinNames(std::vector<QString> names)
 {
     m_binNames = names;
-    emit modelChanged();
+    emit modelChanged(getId());
 }
 
 bool
@@ -474,21 +475,22 @@
         if (completion == 100) {
 
             m_notifyOnAdd = true; // henceforth
-            emit modelChanged();
+            emit modelChanged(getId());
 
         } else if (!m_notifyOnAdd) {
 
             if (update &&
                 m_sinceLastNotifyMin >= 0 &&
                 m_sinceLastNotifyMax >= 0) {
-                emit modelChangedWithin(m_sinceLastNotifyMin,
+                emit modelChangedWithin(getId(),
+                                        m_sinceLastNotifyMin,
                                         m_sinceLastNotifyMax + m_resolution);
                 m_sinceLastNotifyMin = m_sinceLastNotifyMax = -1;
             } else {
-                emit completionChanged();
+                emit completionChanged(getId());
             }
         } else {
-            emit completionChanged();
+            emit completionChanged(getId());
         }            
     }
 }