comparison data/model/TextModel.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 baafe1bb7e51
comparison
equal deleted inserted replaced
1751:77543124651b 1752:6d09d68165a4
44 int resolution, 44 int resolution,
45 bool notifyOnAdd = true) : 45 bool notifyOnAdd = true) :
46 m_sampleRate(sampleRate), 46 m_sampleRate(sampleRate),
47 m_resolution(resolution), 47 m_resolution(resolution),
48 m_notifier(this, 48 m_notifier(this,
49 getId(),
49 notifyOnAdd ? 50 notifyOnAdd ?
50 DeferredNotifier::NOTIFY_ALWAYS : 51 DeferredNotifier::NOTIFY_ALWAYS :
51 DeferredNotifier::NOTIFY_DEFERRED), 52 DeferredNotifier::NOTIFY_DEFERRED),
52 m_completion(100) { 53 m_completion(100) {
53 } 54 }
80 81
81 if (update) { 82 if (update) {
82 m_notifier.makeDeferredNotifications(); 83 m_notifier.makeDeferredNotifications();
83 } 84 }
84 85
85 emit completionChanged(); 86 emit completionChanged(getId());
86 87
87 if (completion == 100) { 88 if (completion == 100) {
88 // henceforth: 89 // henceforth:
89 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS); 90 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS);
90 emit modelChanged(); 91 emit modelChanged(getId());
91 } 92 }
92 } 93 }
93 94
94 /** 95 /**
95 * Query methods. 96 * Query methods.
145 146
146 void remove(Event e) override { 147 void remove(Event e) override {
147 { QMutexLocker locker(&m_mutex); 148 { QMutexLocker locker(&m_mutex);
148 m_events.remove(e); 149 m_events.remove(e);
149 } 150 }
150 emit modelChangedWithin(e.getFrame(), e.getFrame() + m_resolution); 151 emit modelChangedWithin(getId(),
152 e.getFrame(), e.getFrame() + m_resolution);
151 } 153 }
152 154
153 /** 155 /**
154 * TabularModel methods. 156 * TabularModel methods.
155 */ 157 */