Mercurial > hg > svcore
comparison data/model/Model.h @ 936:0c1d6de8f44b
Merge from branch warnfix_no_size_t
author | Chris Cannam |
---|---|
date | Wed, 18 Jun 2014 13:51:16 +0100 |
parents | d03b3d956358 |
children | cc27f35aa75c |
comparison
equal
deleted
inserted
replaced
917:49618f39ff09 | 936:0c1d6de8f44b |
---|---|
48 virtual bool isOK() const = 0; | 48 virtual bool isOK() const = 0; |
49 | 49 |
50 /** | 50 /** |
51 * Return the first audio frame spanned by the model. | 51 * Return the first audio frame spanned by the model. |
52 */ | 52 */ |
53 virtual size_t getStartFrame() const = 0; | 53 virtual int getStartFrame() const = 0; |
54 | 54 |
55 /** | 55 /** |
56 * Return the last audio frame spanned by the model. | 56 * Return the last audio frame spanned by the model. |
57 */ | 57 */ |
58 virtual size_t getEndFrame() const = 0; | 58 virtual int getEndFrame() const = 0; |
59 | 59 |
60 /** | 60 /** |
61 * Return the frame rate in frames per second. | 61 * Return the frame rate in frames per second. |
62 */ | 62 */ |
63 virtual size_t getSampleRate() const = 0; | 63 virtual int getSampleRate() const = 0; |
64 | 64 |
65 /** | 65 /** |
66 * Return the frame rate of the underlying material, if the model | 66 * Return the frame rate of the underlying material, if the model |
67 * itself has already been resampled. | 67 * itself has already been resampled. |
68 */ | 68 */ |
69 virtual size_t getNativeRate() const { return getSampleRate(); } | 69 virtual int getNativeRate() const { return getSampleRate(); } |
70 | 70 |
71 /** | 71 /** |
72 * Return the "work title" of the model, if known. | 72 * Return the "work title" of the model, if known. |
73 */ | 73 */ |
74 virtual QString getTitle() const; | 74 virtual QString getTitle() const; |
103 * to copy at all. | 103 * to copy at all. |
104 * | 104 * |
105 * Caller owns the returned value. | 105 * Caller owns the returned value. |
106 */ | 106 */ |
107 virtual Model *clone() const = 0; | 107 virtual Model *clone() const = 0; |
108 | 108 |
109 /** | |
110 * Mark the model as abandoning. This means that the application | |
111 * no longer needs it, so it can stop doing any background | |
112 * calculations it may be involved in. Note that as far as the | |
113 * model API is concerned, this does nothing more than tell the | |
114 * model to return true from isAbandoning(). The actual response | |
115 * to this will depend on the model's context -- it's possible | |
116 * nothing at all will change. | |
117 */ | |
118 virtual void abandon() { | |
119 m_abandoning = true; | |
120 } | |
121 | |
122 /** | |
123 * Query whether the model has been marked as abandoning. | |
124 */ | |
125 virtual bool isAbandoning() const { | |
126 return m_abandoning; | |
127 } | |
128 | |
109 /** | 129 /** |
110 * Return true if the model has finished loading or calculating | 130 * Return true if the model has finished loading or calculating |
111 * all its data, for a model that is capable of calculating in a | 131 * all its data, for a model that is capable of calculating in a |
112 * background thread. The default implementation is appropriate | 132 * background thread. The default implementation is appropriate |
113 * for a thread that does not background any work but carries out | 133 * for a thread that does not background any work but carries out |
178 | 198 |
179 /** | 199 /** |
180 * Return the frame number of the reference model that corresponds | 200 * Return the frame number of the reference model that corresponds |
181 * to the given frame number in this model. | 201 * to the given frame number in this model. |
182 */ | 202 */ |
183 virtual size_t alignToReference(size_t frame) const; | 203 virtual int alignToReference(int frame) const; |
184 | 204 |
185 /** | 205 /** |
186 * Return the frame number in this model that corresponds to the | 206 * Return the frame number in this model that corresponds to the |
187 * given frame number of the reference model. | 207 * given frame number of the reference model. |
188 */ | 208 */ |
189 virtual size_t alignFromReference(size_t referenceFrame) const; | 209 virtual int alignFromReference(int referenceFrame) const; |
190 | 210 |
191 /** | 211 /** |
192 * Return the completion percentage for the alignment model: 100 | 212 * Return the completion percentage for the alignment model: 100 |
193 * if there is no alignment model or it has been entirely | 213 * if there is no alignment model or it has been entirely |
194 * calculated, or less than 100 if it is still being calculated. | 214 * calculated, or less than 100 if it is still being calculated. |
212 virtual void toXml(QTextStream &stream, | 232 virtual void toXml(QTextStream &stream, |
213 QString indent = "", | 233 QString indent = "", |
214 QString extraAttributes = "") const; | 234 QString extraAttributes = "") const; |
215 | 235 |
216 virtual QString toDelimitedDataString(QString delimiter) const { | 236 virtual QString toDelimitedDataString(QString delimiter) const { |
217 return toDelimitedDataString(delimiter, getStartFrame(), getEndFrame()); | 237 return toDelimitedDataStringSubset(delimiter, getStartFrame(), getEndFrame()); |
218 } | 238 } |
219 virtual QString toDelimitedDataString(QString, size_t /* f0 */, size_t /* f1 */) const { | 239 virtual QString toDelimitedDataStringSubset(QString, int /* f0 */, int /* f1 */) const { |
220 return ""; | 240 return ""; |
221 } | 241 } |
222 | 242 |
223 public slots: | 243 public slots: |
224 void aboutToDelete(); | 244 void aboutToDelete(); |
233 | 253 |
234 /** | 254 /** |
235 * Emitted when a model has been edited (or more data retrieved | 255 * Emitted when a model has been edited (or more data retrieved |
236 * from cache, in the case of a cached model that generates slowly) | 256 * from cache, in the case of a cached model that generates slowly) |
237 */ | 257 */ |
238 void modelChanged(size_t startFrame, size_t endFrame); | 258 void modelChangedWithin(int startFrame, int endFrame); |
239 | 259 |
240 /** | 260 /** |
241 * Emitted when some internal processing has advanced a stage, but | 261 * Emitted when some internal processing has advanced a stage, but |
242 * the model has not changed externally. Views should respond by | 262 * the model has not changed externally. Views should respond by |
243 * updating any progress meters or other monitoring, but not | 263 * updating any progress meters or other monitoring, but not |
266 * will be emitted before the actual deletion. | 286 * will be emitted before the actual deletion. |
267 */ | 287 */ |
268 void aboutToBeDeleted(); | 288 void aboutToBeDeleted(); |
269 | 289 |
270 protected: | 290 protected: |
271 Model() : m_sourceModel(0), m_alignment(0), m_aboutToDelete(false) { } | 291 Model() : |
292 m_sourceModel(0), | |
293 m_alignment(0), | |
294 m_abandoning(false), | |
295 m_aboutToDelete(false) { } | |
272 | 296 |
273 // Not provided. | 297 // Not provided. |
274 Model(const Model &); | 298 Model(const Model &); |
275 Model &operator=(const Model &); | 299 Model &operator=(const Model &); |
276 | 300 |
277 Model *m_sourceModel; | 301 Model *m_sourceModel; |
278 AlignmentModel *m_alignment; | 302 AlignmentModel *m_alignment; |
279 QString m_typeUri; | 303 QString m_typeUri; |
304 bool m_abandoning; | |
280 bool m_aboutToDelete; | 305 bool m_aboutToDelete; |
281 }; | 306 }; |
282 | 307 |
283 #endif | 308 #endif |