comparison 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
comparison
equal deleted inserted replaced
1751:77543124651b 1752:6d09d68165a4
56 m_haveExtents(false), 56 m_haveExtents(false),
57 m_valueQuantization(0), 57 m_valueQuantization(0),
58 m_units(""), 58 m_units(""),
59 m_extendTo(0), 59 m_extendTo(0),
60 m_notifier(this, 60 m_notifier(this,
61 getId(),
61 notifyOnAdd ? 62 notifyOnAdd ?
62 DeferredNotifier::NOTIFY_ALWAYS : 63 DeferredNotifier::NOTIFY_ALWAYS :
63 DeferredNotifier::NOTIFY_DEFERRED), 64 DeferredNotifier::NOTIFY_DEFERRED),
64 m_completion(100) { 65 m_completion(100) {
65 if (subtype == FLEXI_NOTE) { 66 if (subtype == FLEXI_NOTE) {
82 m_haveExtents(true), 83 m_haveExtents(true),
83 m_valueQuantization(0), 84 m_valueQuantization(0),
84 m_units(""), 85 m_units(""),
85 m_extendTo(0), 86 m_extendTo(0),
86 m_notifier(this, 87 m_notifier(this,
88 getId(),
87 notifyOnAdd ? 89 notifyOnAdd ?
88 DeferredNotifier::NOTIFY_ALWAYS : 90 DeferredNotifier::NOTIFY_ALWAYS :
89 DeferredNotifier::NOTIFY_DEFERRED), 91 DeferredNotifier::NOTIFY_DEFERRED),
90 m_completion(100) { 92 m_completion(100) {
91 PlayParameterRepository::getInstance()->addPlayable 93 PlayParameterRepository::getInstance()->addPlayable
143 145
144 if (update) { 146 if (update) {
145 m_notifier.makeDeferredNotifications(); 147 m_notifier.makeDeferredNotifications();
146 } 148 }
147 149
148 emit completionChanged(); 150 emit completionChanged(getId());
149 151
150 if (completion == 100) { 152 if (completion == 100) {
151 // henceforth: 153 // henceforth:
152 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS); 154 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS);
153 emit modelChanged(); 155 emit modelChanged(getId());
154 } 156 }
155 } 157 }
156 158
157 /** 159 /**
158 * Query methods. 160 * Query methods.
217 } 219 }
218 220
219 m_notifier.update(e.getFrame(), e.getDuration() + m_resolution); 221 m_notifier.update(e.getFrame(), e.getDuration() + m_resolution);
220 222
221 if (allChange) { 223 if (allChange) {
222 emit modelChanged(); 224 emit modelChanged(getId());
223 } 225 }
224 } 226 }
225 227
226 void remove(Event e) override { 228 void remove(Event e) override {
227 { 229 {
228 QMutexLocker locker(&m_mutex); 230 QMutexLocker locker(&m_mutex);
229 m_events.remove(e); 231 m_events.remove(e);
230 } 232 }
231 emit modelChangedWithin(e.getFrame(), 233 emit modelChangedWithin(getId(),
234 e.getFrame(),
232 e.getFrame() + e.getDuration() + m_resolution); 235 e.getFrame() + e.getDuration() + m_resolution);
233 } 236 }
234 237
235 /** 238 /**
236 * TabularModel methods. 239 * TabularModel methods.