comparison data/model/AlignmentModel.h @ 1735:d91ff235e69d by-id

Some messing with Model and AlignmentModel
author Chris Cannam
date Tue, 25 Jun 2019 15:29:34 +0100
parents 78fe29adfd16
children 5d631f6129fe
comparison
equal deleted inserted replaced
1733:c3b5564cfb78 1735:d91ff235e69d
28 class AlignmentModel : public Model 28 class AlignmentModel : public Model
29 { 29 {
30 Q_OBJECT 30 Q_OBJECT
31 31
32 public: 32 public:
33 AlignmentModel(Model *reference, 33 AlignmentModel(ModelId reference /* any model */,
34 Model *aligned, 34 ModelId aligned /* any model */,
35 SparseTimeValueModel *path); 35 ModelId path /* a SparseTimeValueModel */);
36 ~AlignmentModel(); 36 ~AlignmentModel();
37 37
38 bool isOK() const override; 38 bool isOK() const override;
39 39
40 void setError(QString error) { m_error = error; } 40 void setError(QString error) { m_error = error; }
51 } 51 }
52 const ZoomConstraint *getZoomConstraint() const override; 52 const ZoomConstraint *getZoomConstraint() const override;
53 53
54 QString getTypeName() const override { return tr("Alignment"); } 54 QString getTypeName() const override { return tr("Alignment"); }
55 55
56 const Model *getReferenceModel() const; 56 ModelId getReferenceModel() const;
57 const Model *getAlignedModel() const; 57 ModelId getAlignedModel() const;
58 58
59 sv_frame_t toReference(sv_frame_t frame) const; 59 sv_frame_t toReference(sv_frame_t frame) const;
60 sv_frame_t fromReference(sv_frame_t frame) const; 60 sv_frame_t fromReference(sv_frame_t frame) const;
61 61
62 void setPathFrom(SparseTimeValueModel *rawpath); 62 void setPathFrom(ModelId pathSource); // a SparseTimeValueModel
63 void setPath(PathModel *path); 63 void setPath(const PathModel &path);
64 64
65 void toXml(QTextStream &stream, 65 void toXml(QTextStream &stream,
66 QString indent = "", 66 QString indent = "",
67 QString extraAttributes = "") const override; 67 QString extraAttributes = "") const override;
68 68
75 void modelChanged(); 75 void modelChanged();
76 void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); 76 void modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame);
77 void completionChanged(); 77 void completionChanged();
78 78
79 protected slots: 79 protected slots:
80 void pathChanged(); 80 void pathSourceChanged();
81 void pathChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame); 81 void pathSourceChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame);
82 void pathCompletionChanged(); 82 void pathSourceCompletionChanged();
83 83
84 protected: 84 protected:
85 Model *m_reference; // I don't own this 85 ModelId m_reference;
86 Model *m_aligned; // I don't own this 86 ModelId m_aligned;
87 87
88 SparseTimeValueModel *m_rawPath; // I own this 88 ModelId m_pathSource; // a SparseTimeValueModel
89 mutable PathModel *m_path; // I own this 89
90 mutable PathModel *m_reversePath; // I own this 90 std::unique_ptr<PathModel> m_path;
91 std::unique_ptr<PathModel> m_reversePath;
91 bool m_pathBegun; 92 bool m_pathBegun;
92 bool m_pathComplete; 93 bool m_pathComplete;
93 QString m_error; 94 QString m_error;
94 95
95 void constructPath() const; 96 void constructPath() const;
96 void constructReversePath() const; 97 void constructReversePath() const;
97 98
98 sv_frame_t align(PathModel *path, sv_frame_t frame) const; 99 sv_frame_t align(const PathModel &path, sv_frame_t frame) const;
99 }; 100 };
100 101
101 #endif 102 #endif