comparison data/model/RegionModel.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 52705a328b34
children 13bd41bd8a17
comparison
equal deleted inserted replaced
1751:77543124651b 1752:6d09d68165a4
48 m_valueMaximum(0.f), 48 m_valueMaximum(0.f),
49 m_haveExtents(false), 49 m_haveExtents(false),
50 m_valueQuantization(0), 50 m_valueQuantization(0),
51 m_haveDistinctValues(false), 51 m_haveDistinctValues(false),
52 m_notifier(this, 52 m_notifier(this,
53 getId(),
53 notifyOnAdd ? 54 notifyOnAdd ?
54 DeferredNotifier::NOTIFY_ALWAYS : 55 DeferredNotifier::NOTIFY_ALWAYS :
55 DeferredNotifier::NOTIFY_DEFERRED), 56 DeferredNotifier::NOTIFY_DEFERRED),
56 m_completion(100) { 57 m_completion(100) {
57 } 58 }
65 m_valueMaximum(valueMaximum), 66 m_valueMaximum(valueMaximum),
66 m_haveExtents(true), 67 m_haveExtents(true),
67 m_valueQuantization(0), 68 m_valueQuantization(0),
68 m_haveDistinctValues(false), 69 m_haveDistinctValues(false),
69 m_notifier(this, 70 m_notifier(this,
71 getId(),
70 notifyOnAdd ? 72 notifyOnAdd ?
71 DeferredNotifier::NOTIFY_ALWAYS : 73 DeferredNotifier::NOTIFY_ALWAYS :
72 DeferredNotifier::NOTIFY_DEFERRED), 74 DeferredNotifier::NOTIFY_DEFERRED),
73 m_completion(100) { 75 m_completion(100) {
74 } 76 }
118 120
119 if (update) { 121 if (update) {
120 m_notifier.makeDeferredNotifications(); 122 m_notifier.makeDeferredNotifications();
121 } 123 }
122 124
123 emit completionChanged(); 125 emit completionChanged(getId());
124 126
125 if (completion == 100) { 127 if (completion == 100) {
126 // henceforth: 128 // henceforth:
127 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS); 129 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS);
128 emit modelChanged(); 130 emit modelChanged(getId());
129 } 131 }
130 } 132 }
131 133
132 /** 134 /**
133 * Query methods. 135 * Query methods.
195 } 197 }
196 198
197 m_notifier.update(e.getFrame(), e.getDuration() + m_resolution); 199 m_notifier.update(e.getFrame(), e.getDuration() + m_resolution);
198 200
199 if (allChange) { 201 if (allChange) {
200 emit modelChanged(); 202 emit modelChanged(getId());
201 } 203 }
202 } 204 }
203 205
204 void remove(Event e) override { 206 void remove(Event e) override {
205 { 207 {
206 QMutexLocker locker(&m_mutex); 208 QMutexLocker locker(&m_mutex);
207 m_events.remove(e); 209 m_events.remove(e);
208 } 210 }
209 emit modelChangedWithin(e.getFrame(), 211 emit modelChangedWithin(getId(),
212 e.getFrame(),
210 e.getFrame() + e.getDuration() + m_resolution); 213 e.getFrame() + e.getDuration() + m_resolution);
211 } 214 }
212 215
213 /** 216 /**
214 * TabularModel methods. 217 * TabularModel methods.