comparison data/model/SparseOneDimensionalModel.h @ 1660:b234d4d011df single-point

We do need haveTextLabels; restore it
author Chris Cannam
date Thu, 21 Mar 2019 13:33:30 +0000
parents 8bf3a52a1604
children 353a2d15f213
comparison
equal deleted inserted replaced
1659:8bf3a52a1604 1660:b234d4d011df
45 SparseOneDimensionalModel(sv_samplerate_t sampleRate, 45 SparseOneDimensionalModel(sv_samplerate_t sampleRate,
46 int resolution, 46 int resolution,
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_notifier(this, 51 m_notifier(this,
51 notifyOnAdd ? 52 notifyOnAdd ?
52 DeferredNotifier::NOTIFY_ALWAYS : 53 DeferredNotifier::NOTIFY_ALWAYS :
53 DeferredNotifier::NOTIFY_DEFERRED), 54 DeferredNotifier::NOTIFY_DEFERRED),
54 m_completion(100) { 55 m_completion(100) {
77 int getResolution() const { return m_resolution; } 78 int getResolution() const { return m_resolution; }
78 79
79 bool canPlay() const override { return true; } 80 bool canPlay() const override { return true; }
80 QString getDefaultPlayClipId() const override { return "tap"; } 81 QString getDefaultPlayClipId() const override { return "tap"; }
81 82
83 bool hasTextLabels() const { return m_haveTextLabels; }
84
82 int getCompletion() const { return m_completion; } 85 int getCompletion() const { return m_completion; }
83 86
84 void setCompletion(int completion, bool update = true) { 87 void setCompletion(int completion, bool update = true) {
85 88
86 { QMutexLocker locker(&m_mutex); 89 { QMutexLocker locker(&m_mutex);
146 */ 149 */
147 void add(Event e) override { 150 void add(Event e) override {
148 151
149 { QMutexLocker locker(&m_mutex); 152 { QMutexLocker locker(&m_mutex);
150 m_events.add(e.withoutValue().withoutDuration()); 153 m_events.add(e.withoutValue().withoutDuration());
154
155 if (e.getLabel() != "") {
156 m_haveTextLabels = true;
157 }
151 } 158 }
152 159
153 m_notifier.update(e.getFrame(), m_resolution); 160 m_notifier.update(e.getFrame(), m_resolution);
154 } 161 }
155 162
288 295
289 protected: 296 protected:
290 sv_samplerate_t m_sampleRate; 297 sv_samplerate_t m_sampleRate;
291 int m_resolution; 298 int m_resolution;
292 299
300 bool m_haveTextLabels;
293 DeferredNotifier m_notifier; 301 DeferredNotifier m_notifier;
294 int m_completion; 302 int m_completion;
295 303
296 EventSeries m_events; 304 EventSeries m_events;
297 305