comparison data/model/SparseTimeValueModel.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
comparison
equal deleted inserted replaced
1751:77543124651b 1752:6d09d68165a4
46 m_valueMinimum(0.f), 46 m_valueMinimum(0.f),
47 m_valueMaximum(0.f), 47 m_valueMaximum(0.f),
48 m_haveExtents(false), 48 m_haveExtents(false),
49 m_haveTextLabels(false), 49 m_haveTextLabels(false),
50 m_notifier(this, 50 m_notifier(this,
51 getId(),
51 notifyOnAdd ? 52 notifyOnAdd ?
52 DeferredNotifier::NOTIFY_ALWAYS : 53 DeferredNotifier::NOTIFY_ALWAYS :
53 DeferredNotifier::NOTIFY_DEFERRED), 54 DeferredNotifier::NOTIFY_DEFERRED),
54 m_completion(100) { 55 m_completion(100) {
55 // Model is playable, but may not sound (if units not Hz or 56 // Model is playable, but may not sound (if units not Hz or
66 m_valueMinimum(valueMinimum), 67 m_valueMinimum(valueMinimum),
67 m_valueMaximum(valueMaximum), 68 m_valueMaximum(valueMaximum),
68 m_haveExtents(true), 69 m_haveExtents(true),
69 m_haveTextLabels(false), 70 m_haveTextLabels(false),
70 m_notifier(this, 71 m_notifier(this,
72 getId(),
71 notifyOnAdd ? 73 notifyOnAdd ?
72 DeferredNotifier::NOTIFY_ALWAYS : 74 DeferredNotifier::NOTIFY_ALWAYS :
73 DeferredNotifier::NOTIFY_DEFERRED), 75 DeferredNotifier::NOTIFY_DEFERRED),
74 m_completion(100) { 76 m_completion(100) {
75 // Model is playable, but may not sound (if units not Hz or 77 // Model is playable, but may not sound (if units not Hz or
125 127
126 if (update) { 128 if (update) {
127 m_notifier.makeDeferredNotifications(); 129 m_notifier.makeDeferredNotifications();
128 } 130 }
129 131
130 emit completionChanged(); 132 emit completionChanged(getId());
131 133
132 if (completion == 100) { 134 if (completion == 100) {
133 // henceforth: 135 // henceforth:
134 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS); 136 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS);
135 emit modelChanged(); 137 emit modelChanged(getId());
136 } 138 }
137 } 139 }
138 140
139 /** 141 /**
140 * Query methods. 142 * Query methods.
203 } 205 }
204 206
205 m_notifier.update(e.getFrame(), m_resolution); 207 m_notifier.update(e.getFrame(), m_resolution);
206 208
207 if (allChange) { 209 if (allChange) {
208 emit modelChanged(); 210 emit modelChanged(getId());
209 } 211 }
210 } 212 }
211 213
212 void remove(Event e) override { 214 void remove(Event e) override {
213 { 215 {
214 QMutexLocker locker(&m_mutex); 216 QMutexLocker locker(&m_mutex);
215 m_events.remove(e); 217 m_events.remove(e);
216 } 218 }
217 emit modelChangedWithin(e.getFrame(), e.getFrame() + m_resolution); 219 emit modelChangedWithin(getId(),
220 e.getFrame(), e.getFrame() + m_resolution);
218 } 221 }
219 222
220 /** 223 /**
221 * TabularModel methods. 224 * TabularModel methods.
222 */ 225 */