Mercurial > hg > svcore
comparison data/model/SparseOneDimensionalModel.h @ 1742:52705a328b34 by-id
Rejig ById so as to put everything in a single pool, so that at the core you can go from numeric id (untyped) to anything the object can be dynamic_cast to. Useful for building other abstractions like PlayParameter-type registrations that don't know about e.g. Models. Probably some more tweaking needed. Also add tests
author | Chris Cannam |
---|---|
date | Fri, 28 Jun 2019 17:36:30 +0100 |
parents | 9d82b164f264 |
children | 77543124651b |
comparison
equal
deleted
inserted
replaced
1741:9d82b164f264 | 1742:52705a328b34 |
---|---|
51 m_notifier(this, | 51 m_notifier(this, |
52 notifyOnAdd ? | 52 notifyOnAdd ? |
53 DeferredNotifier::NOTIFY_ALWAYS : | 53 DeferredNotifier::NOTIFY_ALWAYS : |
54 DeferredNotifier::NOTIFY_DEFERRED), | 54 DeferredNotifier::NOTIFY_DEFERRED), |
55 m_completion(100) { | 55 m_completion(100) { |
56 PlayParameterRepository::getInstance()->addPlayable(this); | 56 PlayParameterRepository::getInstance()->addPlayable(getId().untyped); |
57 } | 57 } |
58 | 58 |
59 virtual ~SparseOneDimensionalModel() { | 59 virtual ~SparseOneDimensionalModel() { |
60 PlayParameterRepository::getInstance()->removePlayable(this); | 60 PlayParameterRepository::getInstance()->removePlayable(getId().untyped); |
61 } | 61 } |
62 | 62 |
63 QString getTypeName() const override { return tr("Sparse 1-D"); } | 63 QString getTypeName() const override { return tr("Sparse 1-D"); } |
64 bool isSparse() const override { return true; } | 64 bool isSparse() const override { return true; } |
65 bool isOK() const override { return true; } | 65 bool isOK() const override { return true; } |
237 getSampleRate()))); break; | 237 getSampleRate()))); break; |
238 case 1: e1 = e0.withFrame(value.toInt()); break; | 238 case 1: e1 = e0.withFrame(value.toInt()); break; |
239 case 2: e1 = e0.withLabel(value.toString()); break; | 239 case 2: e1 = e0.withLabel(value.toString()); break; |
240 } | 240 } |
241 | 241 |
242 auto command = new ChangeEventsCommand<Model>(getId(), tr("Edit Data")); | 242 auto command = new ChangeEventsCommand(getId().untyped, tr("Edit Data")); |
243 command->remove(e0); | 243 command->remove(e0); |
244 command->add(e1); | 244 command->add(e1); |
245 return command->finish(); | 245 return command->finish(); |
246 } | 246 } |
247 | 247 |