comparison data/model/RegionModel.h @ 1766:85b9b466a59f

Merge from branch by-id
author Chris Cannam
date Wed, 17 Jul 2019 14:24:51 +0100
parents 6d09d68165a4
children 13bd41bd8a17
comparison
equal deleted inserted replaced
1730:649ac57c5a2d 1766:85b9b466a59f
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.
289 case 2: e1 = e0.withValue(float(value.toDouble())); break; 292 case 2: e1 = e0.withValue(float(value.toDouble())); break;
290 case 3: e1 = e0.withDuration(value.toInt()); break; 293 case 3: e1 = e0.withDuration(value.toInt()); break;
291 case 4: e1 = e0.withLabel(value.toString()); break; 294 case 4: e1 = e0.withLabel(value.toString()); break;
292 } 295 }
293 296
294 ChangeEventsCommand *command = 297 auto command = new ChangeEventsCommand(getId().untyped, tr("Edit Data"));
295 new ChangeEventsCommand(this, tr("Edit Data"));
296 command->remove(e0); 298 command->remove(e0);
297 command->add(e1); 299 command->add(e1);
298 return command->finish(); 300 return command->finish();
299 } 301 }
300 302