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

Merge from branch by-id
author Chris Cannam
date Wed, 17 Jul 2019 14:24:51 +0100
parents 6d09d68165a4
children baafe1bb7e51
comparison
equal deleted inserted replaced
1730:649ac57c5a2d 1766:85b9b466a59f
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 */
224 case 1: e1 = e0.withFrame(value.toInt()); break; 226 case 1: e1 = e0.withFrame(value.toInt()); break;
225 case 2: e1 = e0.withValue(float(value.toDouble())); break; 227 case 2: e1 = e0.withValue(float(value.toDouble())); break;
226 case 3: e1 = e0.withLabel(value.toString()); break; 228 case 3: e1 = e0.withLabel(value.toString()); break;
227 } 229 }
228 230
229 ChangeEventsCommand *command = 231 auto command = new ChangeEventsCommand(getId().untyped, tr("Edit Data"));
230 new ChangeEventsCommand(this, tr("Edit Data"));
231 command->remove(e0); 232 command->remove(e0);
232 command->add(e1); 233 command->add(e1);
233 return command->finish(); 234 return command->finish();
234 } 235 }
235 236