changeset 345:700cd3350391

* Improvements to layer summary dialog (LayerTree, LayerTreeDialog), & rename. It's still rather unstable though.
author Chris Cannam
date Wed, 28 Nov 2007 17:45:37 +0000
parents 277006c62fea
children a9ccd644f3bf 7a5a9b6d50c7
files data/fileio/AudioFileReader.h data/fileio/MP3FileReader.h data/fileio/OggVorbisFileReader.h data/fileio/QuickTimeFileReader.h data/fileio/ResamplingWavFileReader.h data/fileio/WavFileReader.h data/model/AggregateWaveModel.h data/model/AlignmentModel.h data/model/DenseThreeDimensionalModel.h data/model/DenseTimeValueModel.h data/model/EditableDenseThreeDimensionalModel.h data/model/FFTModel.h data/model/ImageModel.h data/model/Model.cpp data/model/Model.h data/model/NoteModel.h data/model/RangeSummarisableTimeValueModel.h data/model/SparseModel.h data/model/SparseOneDimensionalModel.h data/model/SparseTimeValueModel.h data/model/SparseValueModel.h data/model/TextModel.h data/model/WaveFileModel.cpp data/model/WaveFileModel.h data/model/WritableWaveFileModel.h plugin/transform/ModelTransformerFactory.cpp plugin/transform/ModelTransformerFactory.h system/Init.cpp
diffstat 28 files changed, 91 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/AudioFileReader.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/fileio/AudioFileReader.h	Wed Nov 28 17:45:37 2007 +0000
@@ -39,6 +39,12 @@
     size_t getChannelCount() const { return m_channelCount; }
     size_t getSampleRate() const { return m_sampleRate; }
     size_t getNativeRate() const { return m_sampleRate; } // if resampled
+
+    /**
+     * Return the location of the audio data in the reader (as passed
+     * in to the FileSource constructor, for example).
+     */
+    virtual QString getLocation() const { return ""; }
     
     /**
      * Return the title of the work in the audio file, if known.  This
--- a/data/fileio/MP3FileReader.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/fileio/MP3FileReader.h	Wed Nov 28 17:45:37 2007 +0000
@@ -43,6 +43,7 @@
 
     virtual QString getError() const { return m_error; }
 
+    virtual QString getLocation() const { return m_source.getLocation(); }
     virtual QString getTitle() const { return m_title; }
     virtual QString getMaker() const { return m_maker; }
     
--- a/data/fileio/OggVorbisFileReader.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/fileio/OggVorbisFileReader.h	Wed Nov 28 17:45:37 2007 +0000
@@ -45,6 +45,7 @@
 
     virtual QString getError() const { return m_error; }
 
+    virtual QString getLocation() const { return m_source.getLocation(); }
     virtual QString getTitle() const { return m_title; }
     virtual QString getMaker() const { return m_maker; }
     
--- a/data/fileio/QuickTimeFileReader.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/fileio/QuickTimeFileReader.h	Wed Nov 28 17:45:37 2007 +0000
@@ -44,6 +44,7 @@
     virtual ~QuickTimeFileReader();
 
     virtual QString getError() const { return m_error; }
+    virtual QString getLocation() const { return m_source.getLocation(); }
     virtual QString getTitle() const { return m_title; }
     
     static void getSupportedExtensions(std::set<QString> &extensions);
--- a/data/fileio/ResamplingWavFileReader.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/fileio/ResamplingWavFileReader.h	Wed Nov 28 17:45:37 2007 +0000
@@ -40,6 +40,7 @@
     virtual ~ResamplingWavFileReader();
 
     virtual QString getError() const { return m_error; }
+    virtual QString getLocation() const { return m_source.getLocation(); }
     static void getSupportedExtensions(std::set<QString> &extensions);
     static bool supportsExtension(QString ext);
     static bool supportsContentType(QString type);
--- a/data/fileio/WavFileReader.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/fileio/WavFileReader.h	Wed Nov 28 17:45:37 2007 +0000
@@ -29,6 +29,7 @@
     WavFileReader(FileSource source, bool fileUpdating = false);
     virtual ~WavFileReader();
 
+    virtual QString getLocation() const { return m_source.getLocation(); }
     virtual QString getError() const { return m_error; }
 
     /** 
--- a/data/model/AggregateWaveModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/AggregateWaveModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -42,6 +42,8 @@
     bool isOK() const;
     bool isReady(int *) const;
 
+    QString getTypeName() const { return tr("Aggregate Wave"); }
+
     size_t getComponentCount() const;
     ModelChannelSpec getComponent(size_t c) const;
 
--- a/data/model/AlignmentModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/AlignmentModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -44,6 +44,8 @@
     virtual bool isReady(int *completion = 0) const;
     virtual const ZoomConstraint *getZoomConstraint() const;
 
+    QString getTypeName() const { return tr("Alignment"); }
+
     const Model *getReferenceModel() const;
     const Model *getAlignedModel() const;
 
--- a/data/model/DenseThreeDimensionalModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/DenseThreeDimensionalModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -98,6 +98,8 @@
         return getValueAt(x, y) > threshold;
     }
 
+    QString getTypeName() const { return tr("Dense 3-D"); }
+
     virtual int getCompletion() const = 0;
 
 protected:
--- a/data/model/DenseTimeValueModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/DenseTimeValueModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -70,6 +70,8 @@
      */
     virtual size_t getData(int channel, size_t start, size_t count,
                            double *buffer) const = 0;
+
+    QString getTypeName() const { return tr("Dense Time-Value"); }
 };
 
 #endif
--- a/data/model/EditableDenseThreeDimensionalModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/EditableDenseThreeDimensionalModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -109,6 +109,8 @@
     virtual void setCompletion(int completion, bool update = true);
     virtual int getCompletion() const { return m_completion; }
 
+    QString getTypeName() const { return tr("Editable Dense 3-D"); }
+
     virtual QString toDelimitedDataString(QString delimiter) const;
 
     virtual void toXml(QTextStream &out,
--- a/data/model/FFTModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/FFTModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -165,6 +165,8 @@
     virtual void suspendWrites() { m_server->suspendWrites(); }
     virtual void resume() { m_server->resume(); }
 
+    QString getTypeName() const { return tr("FFT"); }
+
 private:
     FFTModel(const FFTModel &); // not implemented
     FFTModel &operator=(const FFTModel &); // not implemented
--- a/data/model/ImageModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/ImageModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -89,6 +89,8 @@
 	SparseModel<ImagePoint>(sampleRate, resolution, notifyOnAdd)
     { }
 
+    QString getTypeName() const { return tr("Image"); }
+
     virtual void toXml(QTextStream &out,
                        QString indent = "",
                        QString extraAttributes = "") const
--- a/data/model/Model.cpp	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/Model.cpp	Wed Nov 28 17:45:37 2007 +0000
@@ -148,12 +148,21 @@
 Model::getTitle() const
 {
     if (m_sourceModel) return m_sourceModel->getTitle();
+    else return "";
 }
 
 QString
 Model::getMaker() const
 {
     if (m_sourceModel) return m_sourceModel->getMaker();
+    else return "";
+}
+
+QString
+Model::getLocation() const
+{
+    if (m_sourceModel) return m_sourceModel->getLocation();
+    else return "";
 }
 
 void
--- a/data/model/Model.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/Model.h	Wed Nov 28 17:45:37 2007 +0000
@@ -77,6 +77,18 @@
     virtual QString getMaker() const;
 
     /**
+     * Return the location of the data in this model (e.g. source
+     * URL).  This should not normally be returned for editable models
+     * that have been edited.
+     */
+    virtual QString getLocation() const;
+
+    /**
+     * Return the type of the model.  For display purposes only.
+     */
+    virtual QString getTypeName() const = 0;
+
+    /**
      * Return a copy of this model.
      *
      * If the model is not editable, this may be effectively a shallow
--- a/data/model/NoteModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/NoteModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -127,6 +127,8 @@
      */
     virtual PointList getPoints(long frame) const;
 
+    QString getTypeName() const { return tr("Note"); }
+
     virtual void toXml(QTextStream &out,
                        QString indent = "",
                        QString extraAttributes = "") const
--- a/data/model/RangeSummarisableTimeValueModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/RangeSummarisableTimeValueModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -71,6 +71,8 @@
      * block size equal to the distance between start and end frames.
      */
     virtual Range getSummary(size_t channel, size_t start, size_t count) const = 0;
+
+    QString getTypeName() const { return tr("Range-Summarisable Time-Value"); }
 };
 
 #endif
--- a/data/model/SparseModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/SparseModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -132,6 +132,8 @@
 
     virtual bool hasTextLabels() const { return m_hasTextLabels; }
 
+    QString getTypeName() const { return tr("Sparse"); }
+
     virtual void toXml(QTextStream &out,
                        QString indent = "",
                        QString extraAttributes = "") const;
--- a/data/model/SparseOneDimensionalModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/SparseOneDimensionalModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -86,6 +86,8 @@
 	}
 	return -1;
     }
+
+    QString getTypeName() const { return tr("Sparse 1-D"); }
 };
 
 #endif
--- a/data/model/SparseTimeValueModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/SparseTimeValueModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -95,6 +95,8 @@
     {
 	PlayParameterRepository::getInstance()->addModel(this);
     }
+
+    QString getTypeName() const { return tr("Sparse Time-Value"); }
 };
 
 
--- a/data/model/SparseValueModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/SparseValueModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -51,6 +51,9 @@
     using SparseModel<PointType>::m_points;
     using SparseModel<PointType>::modelChanged;
     using SparseModel<PointType>::getPoints;
+    using SparseModel<PointType>::tr;
+
+    QString getTypeName() const { return tr("Sparse Value"); }
 
     virtual float getValueMinimum() const { return m_valueMinimum; }
     virtual float getValueMaximum() const { return m_valueMaximum; }
--- a/data/model/TextModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/TextModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -95,6 +95,8 @@
 	     QString("%1 subtype=\"text\"")
 	     .arg(extraAttributes));
     }
+
+    QString getTypeName() const { return tr("Text"); }
 };
 
 
--- a/data/model/WaveFileModel.cpp	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/WaveFileModel.cpp	Wed Nov 28 17:45:37 2007 +0000
@@ -173,6 +173,13 @@
     if (m_reader) return m_reader->getMaker();
     return "";
 }
+
+QString
+WaveFileModel::getLocation() const
+{
+    if (m_reader) return m_reader->getLocation();
+    return "";
+}
     
 size_t
 WaveFileModel::getData(int channel, size_t start, size_t count,
--- a/data/model/WaveFileModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/WaveFileModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -50,6 +50,7 @@
 
     QString getTitle() const;
     QString getMaker() const;
+    QString getLocation() const;
 
     virtual Model *clone() const;
 
@@ -73,6 +74,8 @@
 
     virtual Range getSummary(size_t channel, size_t start, size_t count) const;
 
+    QString getTypeName() const { return tr("Wave File"); }
+
     virtual void toXml(QTextStream &out,
                        QString indent = "",
                        QString extraAttributes = "") const;
--- a/data/model/WritableWaveFileModel.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/data/model/WritableWaveFileModel.h	Wed Nov 28 17:45:37 2007 +0000
@@ -73,6 +73,8 @@
 
     virtual Range getSummary(size_t channel, size_t start, size_t count) const;
 
+    QString getTypeName() const { return tr("Writable Wave File"); }
+
     virtual void toXml(QTextStream &out,
                        QString indent = "",
                        QString extraAttributes = "") const;
--- a/plugin/transform/ModelTransformerFactory.cpp	Wed Nov 28 13:20:40 2007 +0000
+++ b/plugin/transform/ModelTransformerFactory.cpp	Wed Nov 28 17:45:37 2007 +0000
@@ -68,20 +68,22 @@
 
 Model *
 ModelTransformerFactory::getConfigurationForTransformer(TransformId identifier,
-                                               const std::vector<Model *> &candidateInputModels,
-                                               PluginTransformer::ExecutionContext &context,
-                                               QString &configurationXml,
-                                               AudioCallbackPlaySource *source,
-                                               size_t startFrame,
-                                               size_t duration)
+                                                        const std::vector<Model *> &candidateInputModels,
+                                                        Model *defaultInputModel,
+                                                        PluginTransformer::ExecutionContext &context,
+                                                        QString &configurationXml,
+                                                        AudioCallbackPlaySource *source,
+                                                        size_t startFrame,
+                                                        size_t duration)
 {
     if (candidateInputModels.empty()) return 0;
 
     //!!! This will need revision -- we'll have to have a callback
     //from the dialog for when the candidate input model is changed,
     //as we'll need to reinitialise the channel settings in the dialog
-    Model *inputModel = candidateInputModels[0]; //!!! for now
+    Model *inputModel = candidateInputModels[0];
     QStringList candidateModelNames;
+    QString defaultModelName;
     std::map<QString, Model *> modelMap;
     for (size_t i = 0; i < candidateInputModels.size(); ++i) {
         QString modelName = candidateInputModels[i]->objectName();
@@ -92,6 +94,9 @@
         }
         modelMap[modelName] = candidateInputModels[i];
         candidateModelNames.push_back(modelName);
+        if (candidateInputModels[i] == defaultInputModel) {
+            defaultModelName = modelName;
+        }
     }
 
     QString id = identifier.section(':', 0, 2);
@@ -205,7 +210,8 @@
         PluginParameterDialog *dialog = new PluginParameterDialog(plugin);
 
         if (candidateModelNames.size() > 1 && !generator) {
-            dialog->setCandidateInputModels(candidateModelNames);
+            dialog->setCandidateInputModels(candidateModelNames,
+                                            defaultModelName);
         }
 
         if (startFrame != 0 || duration != 0) {
--- a/plugin/transform/ModelTransformerFactory.h	Wed Nov 28 13:20:40 2007 +0000
+++ b/plugin/transform/ModelTransformerFactory.h	Wed Nov 28 17:45:37 2007 +0000
@@ -48,6 +48,7 @@
      */
     Model *getConfigurationForTransformer(TransformId identifier,
                                           const std::vector<Model *> &candidateInputModels,
+                                          Model *defaultInputModel,
                                           PluginTransformer::ExecutionContext &context,
                                           QString &configurationXml,
                                           AudioCallbackPlaySource *source = 0,
--- a/system/Init.cpp	Wed Nov 28 13:20:40 2007 +0000
+++ b/system/Init.cpp	Wed Nov 28 17:45:37 2007 +0000
@@ -79,9 +79,9 @@
 
 #ifdef Q_WS_WIN32
     redirectStderr();
-    QFont fn = qApp->font();
-    fn.setFamily("Tahoma");
-    qApp->setFont(fn);
+//    QFont fn = qApp->font();
+//    fn.setFamily("Tahoma");
+//    qApp->setFont(fn);
 #else
 #ifdef Q_WS_X11
 //    QFont fn = qApp->font();