Mercurial > hg > svcore
diff data/model/AlignmentModel.h @ 1766:85b9b466a59f
Merge from branch by-id
author | Chris Cannam |
---|---|
date | Wed, 17 Jul 2019 14:24:51 +0100 |
parents | ee7fd2c01d87 |
children | f19711ab7074 |
line wrap: on
line diff
--- a/data/model/AlignmentModel.h Thu Jun 20 14:58:20 2019 +0100 +++ b/data/model/AlignmentModel.h Wed Jul 17 14:24:51 2019 +0100 @@ -17,7 +17,7 @@ #define SV_ALIGNMENT_MODEL_H #include "Model.h" -#include "PathModel.h" +#include "Path.h" #include "base/RealTime.h" #include <QString> @@ -30,9 +30,9 @@ Q_OBJECT public: - AlignmentModel(Model *reference, - Model *aligned, - SparseTimeValueModel *path); + AlignmentModel(ModelId reference /* any model */, + ModelId aligned /* any model */, + ModelId path /* a SparseTimeValueModel */); ~AlignmentModel(); bool isOK() const override; @@ -53,18 +53,18 @@ QString getTypeName() const override { return tr("Alignment"); } - const Model *getReferenceModel() const; - const Model *getAlignedModel() const; + ModelId getReferenceModel() const; + ModelId getAlignedModel() const; sv_frame_t toReference(sv_frame_t frame) const; sv_frame_t fromReference(sv_frame_t frame) const; - void setPathFrom(SparseTimeValueModel *rawpath); - void setPath(PathModel *path); + void setPathFrom(ModelId pathSource); // a SparseTimeValueModel + void setPath(const Path &path); void toXml(QTextStream &stream, - QString indent = "", - QString extraAttributes = "") const override; + QString indent = "", + QString extraAttributes = "") const override; QString toDelimitedDataString(QString, DataExportOptions, sv_frame_t, sv_frame_t) const override { @@ -72,22 +72,21 @@ } signals: - void modelChanged(); - void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); - void completionChanged(); + void completionChanged(ModelId); protected slots: - void pathChanged(); - void pathChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); - void pathCompletionChanged(); + void pathSourceChangedWithin(ModelId, sv_frame_t startFrame, sv_frame_t endFrame); + void pathSourceCompletionChanged(ModelId); protected: - Model *m_reference; // I don't own this - Model *m_aligned; // I don't own this + ModelId m_reference; + ModelId m_aligned; - SparseTimeValueModel *m_rawPath; // I own this - mutable PathModel *m_path; // I own this - mutable PathModel *m_reversePath; // I own this + ModelId m_pathSource; // a SparseTimeValueModel, which we need a + // handle on only while it's still being generated + + mutable std::unique_ptr<Path> m_path; + mutable std::unique_ptr<Path> m_reversePath; bool m_pathBegun; bool m_pathComplete; QString m_error; @@ -95,7 +94,7 @@ void constructPath() const; void constructReversePath() const; - sv_frame_t align(PathModel *path, sv_frame_t frame) const; + sv_frame_t performAlignment(const Path &path, sv_frame_t frame) const; }; #endif