diff 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
line wrap: on
line diff
--- a/base/View.h	Wed Feb 15 17:58:35 2006 +0000
+++ b/base/View.h	Fri Feb 17 18:04:26 2006 +0000
@@ -19,6 +19,7 @@
 #include "base/XmlExportable.h"
 
 class Layer;
+class ViewPropertyContainer;
 
 #include <map>
 
@@ -36,7 +37,6 @@
  */
 
 class View : public QFrame,
-	     public PropertyContainer,
 	     public XmlExportable
 {
     Q_OBJECT
@@ -159,22 +159,26 @@
     virtual void setPlaybackFollow(PlaybackFollowMode m);
     virtual PlaybackFollowMode getPlaybackFollow() const { return m_followPlay; }
 
-    virtual PropertyList getProperties() const;
-    virtual PropertyType getPropertyType(const PropertyName &) const;
-    virtual int getPropertyRangeAndValue(const PropertyName &,
-					   int *min, int *max) const;
-    virtual QString getPropertyValueLabel(const PropertyName &,
+    // We implement the PropertyContainer API, although we don't
+    // actually subclass PropertyContainer.  We have our own
+    // PropertyContainer that we can return on request that just
+    // delegates back to us.
+    virtual PropertyContainer::PropertyList getProperties() const;
+    virtual PropertyContainer::PropertyType getPropertyType(const PropertyContainer::PropertyName &) const;
+    virtual int getPropertyRangeAndValue(const PropertyContainer::PropertyName &,
+					 int *min, int *max) const;
+    virtual QString getPropertyValueLabel(const PropertyContainer::PropertyName &,
 					  int value) const;
-    virtual void setProperty(const PropertyName &, int value);
-
-    virtual size_t getPropertyContainerCount() const;
-    virtual const PropertyContainer *getPropertyContainer(size_t i) const;
-    virtual PropertyContainer *getPropertyContainer(size_t i);
-
+    virtual void setProperty(const PropertyContainer::PropertyName &, int value);
     virtual QString getPropertyContainerName() const {
 	return objectName();
     }
 
+    virtual size_t getPropertyContainerCount() const;
+
+    virtual const PropertyContainer *getPropertyContainer(size_t i) const;
+    virtual PropertyContainer *getPropertyContainer(size_t i);
+
     virtual QString toXmlString(QString indent = "",
 				QString extraAttributes = "") const;
 
@@ -262,6 +266,44 @@
     ProgressMap m_progressBars; // I own the ProgressBars
 
     ViewManager *m_manager; // I don't own this
+    ViewPropertyContainer *m_propertyContainer; // I own this
+};
+
+
+// Use this for delegation, because we can't subclass from
+// PropertyContainer (which is a QObject) ourselves because of
+// ambiguity with QFrame parent
+
+class ViewPropertyContainer : public PropertyContainer
+{
+    Q_OBJECT
+
+public:
+    ViewPropertyContainer(View *v);
+    PropertyList getProperties() const { return m_v->getProperties(); }
+    PropertyType getPropertyType(const PropertyName &n) const {
+	return m_v->getPropertyType(n);
+    }
+    int getPropertyRangeAndValue(const PropertyName &n, int *min, int *max) const {
+	return m_v->getPropertyRangeAndValue(n, min, max);
+    }
+    QString getPropertyValueLabel(const PropertyName &n, int value) const {
+	return m_v->getPropertyValueLabel(n, value);
+    }
+    QString getPropertyContainerName() const {
+	return m_v->getPropertyContainerName();
+    }
+    QString getPropertyContainerIconName() const {
+	return "view";
+    }
+
+public slots:
+    virtual void setProperty(const PropertyName &n, int value) {
+	m_v->setProperty(n, value);
+    }
+
+protected:
+    View *m_v;
 };
 
 #endif