comparison base/View.h @ 29:8460b3bf8f04

* Implement play mute, level and pan controls and a layer visibility control * Handle swapping the buffers in AudioCallbackPlaySource more gracefully, so that in many cases it can be done inaudibly. Still gets it wrong when playing in a noncontiguous selection. * Fix to SV file save for non-2d sparse models * Fixes to LED button drawing and AudioDial mouse functionality * Add progress bar for Ogg file import * Reshuffle PropertyContainer and its subclasses so it can be a QObject * Add layer dormancy (invisible layer permitted to free its cache space) * Optimisations to SpectrogramLayer, removing locks when reading/writing individual pixels in the cache (should be unnecessary there) -- there's still an issue here as we need a lock when reading from the model in case the model is replaced, and we don't currently have one * Several munlock() calls to make it harder to exhaust real memory if running in an RT mode with mlockall() active
author Chris Cannam
date Fri, 17 Feb 2006 18:04:26 +0000
parents a1a6acb7cd37
children a6ef94ecbe74
comparison
equal deleted inserted replaced
28:4b16526b011b 29:8460b3bf8f04
17 #include "base/PropertyContainer.h" 17 #include "base/PropertyContainer.h"
18 #include "base/ViewManager.h" 18 #include "base/ViewManager.h"
19 #include "base/XmlExportable.h" 19 #include "base/XmlExportable.h"
20 20
21 class Layer; 21 class Layer;
22 class ViewPropertyContainer;
22 23
23 #include <map> 24 #include <map>
24 25
25 /** 26 /**
26 * View is the base class of widgets that display one or more 27 * View is the base class of widgets that display one or more
34 * mechanisms for doing so (as well as any other operations and 35 * mechanisms for doing so (as well as any other operations and
35 * properties available) depend on the subclass. 36 * properties available) depend on the subclass.
36 */ 37 */
37 38
38 class View : public QFrame, 39 class View : public QFrame,
39 public PropertyContainer,
40 public XmlExportable 40 public XmlExportable
41 { 41 {
42 Q_OBJECT 42 Q_OBJECT
43 43
44 public: 44 public:
157 PlaybackIgnore 157 PlaybackIgnore
158 }; 158 };
159 virtual void setPlaybackFollow(PlaybackFollowMode m); 159 virtual void setPlaybackFollow(PlaybackFollowMode m);
160 virtual PlaybackFollowMode getPlaybackFollow() const { return m_followPlay; } 160 virtual PlaybackFollowMode getPlaybackFollow() const { return m_followPlay; }
161 161
162 virtual PropertyList getProperties() const; 162 // We implement the PropertyContainer API, although we don't
163 virtual PropertyType getPropertyType(const PropertyName &) const; 163 // actually subclass PropertyContainer. We have our own
164 virtual int getPropertyRangeAndValue(const PropertyName &, 164 // PropertyContainer that we can return on request that just
165 int *min, int *max) const; 165 // delegates back to us.
166 virtual QString getPropertyValueLabel(const PropertyName &, 166 virtual PropertyContainer::PropertyList getProperties() const;
167 virtual PropertyContainer::PropertyType getPropertyType(const PropertyContainer::PropertyName &) const;
168 virtual int getPropertyRangeAndValue(const PropertyContainer::PropertyName &,
169 int *min, int *max) const;
170 virtual QString getPropertyValueLabel(const PropertyContainer::PropertyName &,
167 int value) const; 171 int value) const;
168 virtual void setProperty(const PropertyName &, int value); 172 virtual void setProperty(const PropertyContainer::PropertyName &, int value);
173 virtual QString getPropertyContainerName() const {
174 return objectName();
175 }
169 176
170 virtual size_t getPropertyContainerCount() const; 177 virtual size_t getPropertyContainerCount() const;
178
171 virtual const PropertyContainer *getPropertyContainer(size_t i) const; 179 virtual const PropertyContainer *getPropertyContainer(size_t i) const;
172 virtual PropertyContainer *getPropertyContainer(size_t i); 180 virtual PropertyContainer *getPropertyContainer(size_t i);
173
174 virtual QString getPropertyContainerName() const {
175 return objectName();
176 }
177 181
178 virtual QString toXmlString(QString indent = "", 182 virtual QString toXmlString(QString indent = "",
179 QString extraAttributes = "") const; 183 QString extraAttributes = "") const;
180 184
181 signals: 185 signals:
260 264
261 typedef std::map<Layer *, LayerProgressBar *> ProgressMap; 265 typedef std::map<Layer *, LayerProgressBar *> ProgressMap;
262 ProgressMap m_progressBars; // I own the ProgressBars 266 ProgressMap m_progressBars; // I own the ProgressBars
263 267
264 ViewManager *m_manager; // I don't own this 268 ViewManager *m_manager; // I don't own this
269 ViewPropertyContainer *m_propertyContainer; // I own this
265 }; 270 };
266 271
272
273 // Use this for delegation, because we can't subclass from
274 // PropertyContainer (which is a QObject) ourselves because of
275 // ambiguity with QFrame parent
276
277 class ViewPropertyContainer : public PropertyContainer
278 {
279 Q_OBJECT
280
281 public:
282 ViewPropertyContainer(View *v);
283 PropertyList getProperties() const { return m_v->getProperties(); }
284 PropertyType getPropertyType(const PropertyName &n) const {
285 return m_v->getPropertyType(n);
286 }
287 int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max) const {
288 return m_v->getPropertyRangeAndValue(n, min, max);
289 }
290 QString getPropertyValueLabel(const PropertyName &n, int value) const {
291 return m_v->getPropertyValueLabel(n, value);
292 }
293 QString getPropertyContainerName() const {
294 return m_v->getPropertyContainerName();
295 }
296 QString getPropertyContainerIconName() const {
297 return "view";
298 }
299
300 public slots:
301 virtual void setProperty(const PropertyName &n, int value) {
302 m_v->setProperty(n, value);
303 }
304
305 protected:
306 View *m_v;
307 };
308
267 #endif 309 #endif
268 310