Mercurial > hg > svcore
comparison base/PlayParameterRepository.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 | c01cbe41aeb5 |
children | 77543124651b |
comparison
equal
deleted
inserted
replaced
1741:9d82b164f264 | 1742:52705a328b34 |
---|---|
33 public: | 33 public: |
34 static PlayParameterRepository *getInstance(); | 34 static PlayParameterRepository *getInstance(); |
35 | 35 |
36 virtual ~PlayParameterRepository(); | 36 virtual ~PlayParameterRepository(); |
37 | 37 |
38 void addPlayable(const Playable *playable); | 38 /** |
39 void removePlayable(const Playable *playable); | 39 * Register a playable. |
40 void copyParameters(const Playable *from, const Playable *to); | 40 * |
41 * The id must be of an object that is registered with the ById | |
42 * store and that can be dynamic_cast to Playable. | |
43 */ | |
44 void addPlayable(int playableId); | |
41 | 45 |
42 PlayParameters *getPlayParameters(const Playable *playable); | 46 /** |
47 * Unregister a playable. | |
48 * | |
49 * The id must be of an object that is registered with the ById | |
50 * store and that can be dynamic_cast to Playable. | |
51 */ | |
52 void removePlayable(int playableId); | |
53 | |
54 /** | |
55 * Copy the play parameters from one playable to another. | |
56 * | |
57 * The ids must be of objects that are registered with the ById | |
58 * store and that can be dynamic_cast to Playable. | |
59 */ | |
60 void copyParameters(int fromId, int toId); | |
61 | |
62 /** | |
63 * Retrieve the play parameters for a playable. | |
64 * | |
65 * The id must be of an object that is registered with the ById | |
66 * store and that can be dynamic_cast to Playable. | |
67 */ | |
68 PlayParameters *getPlayParameters(int playableId); | |
43 | 69 |
44 void clear(); | 70 void clear(); |
45 | 71 |
46 class EditCommand : public Command | 72 class EditCommand : public Command |
47 { | 73 { |
62 PlayParameters m_to; | 88 PlayParameters m_to; |
63 }; | 89 }; |
64 | 90 |
65 signals: | 91 signals: |
66 void playParametersChanged(PlayParameters *); | 92 void playParametersChanged(PlayParameters *); |
67 void playClipIdChanged(const Playable *, QString); | 93 void playClipIdChanged(int playableId, QString); |
68 | 94 |
69 protected slots: | 95 protected slots: |
70 void playParametersChanged(); | 96 void playParametersChanged(); |
71 void playClipIdChanged(QString); | 97 void playClipIdChanged(QString); |
72 | 98 |
73 protected: | 99 protected: |
74 typedef std::map<const Playable *, PlayParameters *> PlayableParameterMap; | 100 typedef std::map<int, PlayParameters *> PlayableParameterMap; |
75 PlayableParameterMap m_playParameters; | 101 PlayableParameterMap m_playParameters; |
76 | 102 |
77 static PlayParameterRepository *m_instance; | 103 static PlayParameterRepository *m_instance; |
78 }; | 104 }; |
79 | 105 |