comparison data/model/SparseOneDimensionalModel.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
47 bool notifyOnAdd = true) : 47 bool notifyOnAdd = true) :
48 m_sampleRate(sampleRate), 48 m_sampleRate(sampleRate),
49 m_resolution(resolution), 49 m_resolution(resolution),
50 m_haveTextLabels(false), 50 m_haveTextLabels(false),
51 m_notifier(this, 51 m_notifier(this,
52 getId(),
52 notifyOnAdd ? 53 notifyOnAdd ?
53 DeferredNotifier::NOTIFY_ALWAYS : 54 DeferredNotifier::NOTIFY_ALWAYS :
54 DeferredNotifier::NOTIFY_DEFERRED), 55 DeferredNotifier::NOTIFY_DEFERRED),
55 m_completion(100) { 56 m_completion(100) {
56 PlayParameterRepository::getInstance()->addPlayable 57 PlayParameterRepository::getInstance()->addPlayable
95 96
96 if (update) { 97 if (update) {
97 m_notifier.makeDeferredNotifications(); 98 m_notifier.makeDeferredNotifications();
98 } 99 }
99 100
100 emit completionChanged(); 101 emit completionChanged(getId());
101 102
102 if (completion == 100) { 103 if (completion == 100) {
103 // henceforth: 104 // henceforth:
104 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS); 105 m_notifier.switchMode(DeferredNotifier::NOTIFY_ALWAYS);
105 emit modelChanged(); 106 emit modelChanged(getId());
106 } 107 }
107 } 108 }
108 109
109 /** 110 /**
110 * Query methods. 111 * Query methods.
164 165
165 void remove(Event e) override { 166 void remove(Event e) override {
166 { QMutexLocker locker(&m_mutex); 167 { QMutexLocker locker(&m_mutex);
167 m_events.remove(e); 168 m_events.remove(e);
168 } 169 }
169 emit modelChangedWithin(e.getFrame(), e.getFrame() + m_resolution); 170 emit modelChangedWithin(getId(),
171 e.getFrame(), e.getFrame() + m_resolution);
170 } 172 }
171 173
172 /** 174 /**
173 * TabularModel methods. 175 * TabularModel methods.
174 */ 176 */