changeset 156:b32282fefccd

* Tidy up inheritance hierarchy of model classes -- remove ZoomConstraint as a base class (make it a member instead) and remove virtual inheritances of QObject (no longer necessary).
author Chris Cannam
date Thu, 05 Oct 2006 11:03:06 +0000
parents 8c730f49b9b3
children e68cc314deb7
files layer/Colour3DPlotLayer.h layer/LayerFactory.cpp layer/WaveformLayer.h
diffstat 3 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.h	Wed Oct 04 14:01:28 2006 +0000
+++ b/layer/Colour3DPlotLayer.h	Thu Oct 05 11:03:06 2006 +0000
@@ -45,7 +45,9 @@
     Colour3DPlotLayer();
     ~Colour3DPlotLayer();
 
-    virtual const ZoomConstraint *getZoomConstraint() const { return m_model; }
+    virtual const ZoomConstraint *getZoomConstraint() const {
+        return m_model ? m_model->getZoomConstraint() : 0;
+    }
     virtual const Model *getModel() const { return m_model; }
     virtual void paint(View *v, QPainter &paint, QRect rect) const;
 
--- a/layer/LayerFactory.cpp	Wed Oct 04 14:01:28 2006 +0000
+++ b/layer/LayerFactory.cpp	Thu Oct 05 11:03:06 2006 +0000
@@ -32,6 +32,8 @@
 #include "data/model/NoteModel.h"
 #include "data/model/TextModel.h"
 #include "data/model/DenseThreeDimensionalModel.h"
+#include "data/model/WaveFileModel.h"
+#include "data/model/WritableWaveFileModel.h"
 
 LayerFactory *
 LayerFactory::m_instance = new LayerFactory;
@@ -200,7 +202,13 @@
 void
 LayerFactory::setModel(Layer *layer, Model *model)
 {
-    if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model))
+//    if (trySetModel<WaveformLayer, RangeSummarisableTimeValueModel>(layer, model))
+//	return;
+
+    if (trySetModel<WaveformLayer, WaveFileModel>(layer, model))
+	return;
+
+    if (trySetModel<WaveformLayer, WritableWaveFileModel>(layer, model))
 	return;
 
     if (trySetModel<SpectrogramLayer, DenseTimeValueModel>(layer, model))
--- a/layer/WaveformLayer.h	Wed Oct 04 14:01:28 2006 +0000
+++ b/layer/WaveformLayer.h	Thu Oct 05 11:03:06 2006 +0000
@@ -35,7 +35,9 @@
     WaveformLayer();
     ~WaveformLayer();
 
-    virtual const ZoomConstraint *getZoomConstraint() const { return m_model; }
+    virtual const ZoomConstraint *getZoomConstraint() const {
+        return m_model ? m_model->getZoomConstraint() : 0;
+    }
     virtual const Model *getModel() const { return m_model; }
     virtual void paint(View *v, QPainter &paint, QRect rect) const;