comparison data/model/Model.h @ 923:defbe5bc47b7 tonioni

Add an experimental cancel button to view progress bars
author Chris Cannam
date Fri, 13 Jun 2014 17:39:01 +0100
parents d81c16e47e22
children d03b3d956358
comparison
equal deleted inserted replaced
922:9911b8cb53bc 923:defbe5bc47b7
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
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