16 */ |
16 */ |
17 |
17 |
18 #ifndef THUMBNAILMANAGER_QT_H |
18 #ifndef THUMBNAILMANAGER_QT_H |
19 #define THUMBNAILMANAGER_QT_H |
19 #define THUMBNAILMANAGER_QT_H |
20 |
20 |
21 #include <qobject> |
21 #include <QObject> |
22 #include <QPixmap.h> |
22 #include <qpixmap> |
|
23 #include <QImage> |
|
24 #include <QtGlobal> |
23 |
25 |
24 class ThumbnailManagerPrivate; |
26 class ThumbnailManagerPrivate; |
25 class QString; |
27 class QString; |
26 class QSize; |
28 class QSize; |
|
29 |
|
30 #ifdef TNMQT_DLL |
|
31 # define TNM_EXPORT Q_DECL_EXPORT |
|
32 #else |
|
33 # define TNM_EXPORT Q_DECL_IMPORT |
|
34 #endif |
|
35 |
27 |
36 |
28 /** default priority value */ |
37 /** default priority value */ |
29 const int tnmWrapperPriorityIdle = -100; |
38 const int tnmWrapperPriorityIdle = -100; |
30 |
39 |
31 class ThumbnailManager : public QObject |
40 class ThumbnailManager : public QObject |
107 /** |
116 /** |
108 * Constructor |
117 * Constructor |
109 * |
118 * |
110 * @param parentPtr parent |
119 * @param parentPtr parent |
111 */ |
120 */ |
112 IMPORT_C ThumbnailManager( QObject* parentPtr = NULL ); |
121 TNM_EXPORT ThumbnailManager( QObject* parentPtr = NULL ); |
113 |
122 |
114 /** |
123 /** |
115 * Destructor |
124 * Destructor |
116 */ |
125 */ |
117 IMPORT_C ~ThumbnailManager(); |
126 TNM_EXPORT ~ThumbnailManager(); |
118 |
127 |
119 /** |
128 /** |
120 * Get quality versus performance preference. |
129 * Get quality versus performance preference. |
121 * |
130 * |
122 * @return quality versus performance preference |
131 * @return quality versus performance preference |
123 */ |
132 */ |
124 IMPORT_C QualityPreference qualityPreference() const; |
133 TNM_EXPORT QualityPreference qualityPreference() const; |
125 |
134 |
126 /** |
135 /** |
127 * Set quality versus performance preference. |
136 * Set quality versus performance preference. |
128 * |
137 * |
129 * @param qualityPreference New quality versus performance preference |
138 * @param qualityPreference New quality versus performance preference |
130 * value. |
139 * value. |
131 * @return true on success |
140 * @return true on success |
132 */ |
141 */ |
133 IMPORT_C bool setQualityPreference( QualityPreference qualityPreference ); |
142 TNM_EXPORT bool setQualityPreference( QualityPreference qualityPreference ); |
134 |
143 |
135 /** |
144 /** |
136 * Get the current desired size for thumbnail bitmaps. |
145 * Get the current desired size for thumbnail bitmaps. |
137 * |
146 * |
138 * @return Current desired size for thumbnail bitmaps (in pixels). |
147 * @return Current desired size for thumbnail bitmaps (in pixels). |
139 */ |
148 */ |
140 IMPORT_C QSize thumbnailSize() const; |
149 TNM_EXPORT QSize thumbnailSize() const; |
141 |
150 |
142 /** |
151 /** |
143 * Set desired size for thumbnail bitmaps. |
152 * Set desired size for thumbnail bitmaps. |
144 * |
153 * |
145 * @param thumbnailSize New desired thumbnail size. |
154 * @param thumbnailSize New desired thumbnail size. |
146 * @return true on success |
155 * @return true on success |
147 */ |
156 */ |
148 IMPORT_C bool setThumbnailSize( const QSize& thumbnailSize ); |
157 TNM_EXPORT bool setThumbnailSize( const QSize& thumbnailSize ); |
149 |
158 |
150 /** |
159 /** |
151 * Set desired size for thumbnail bitmaps. |
160 * Set desired size for thumbnail bitmaps. |
152 * |
161 * |
153 * @param thumbnailSize New desired thumbnail size. |
162 * @param thumbnailSize New desired thumbnail size. |
154 * @return true on success |
163 * @return true on success |
155 */ |
164 */ |
156 IMPORT_C bool setThumbnailSize( ThumbnailSize thumbnailSize ); |
165 TNM_EXPORT bool setThumbnailSize( ThumbnailSize thumbnailSize ); |
157 |
166 |
158 /** |
167 /** |
159 * Get current mode for thumbnail generation. |
168 * Get current mode for thumbnail generation. |
160 * |
169 * |
161 * @return Current mode. |
170 * @return Current mode. |
162 */ |
171 */ |
163 IMPORT_C ThumbnailMode mode() const; |
172 TNM_EXPORT ThumbnailMode mode() const; |
164 |
173 |
165 /** |
174 /** |
166 * Set mode for thumbnail generation. |
175 * Set mode for thumbnail generation. |
167 * |
176 * |
168 * @param mode New flags. |
177 * @param mode New flags. |
169 * @return true on success |
178 * @return true on success |
170 */ |
179 */ |
171 IMPORT_C bool setMode( ThumbnailMode mode ); |
180 TNM_EXPORT bool setMode( ThumbnailMode mode ); |
172 |
181 |
173 /** |
182 /** |
174 * Get a thumbnail for an object file. If a thumbnail already exists, it |
183 * Get a thumbnail for an object file. If a thumbnail already exists, it |
175 * is loaded and if a thumbnail does not exist, it is created |
184 * is loaded and if a thumbnail does not exist, it is created |
176 * transparently. If thumbnail loadinf fails thumbnailReady signal is emited |
185 * transparently. If thumbnail loadinf fails thumbnailReady signal is emited |
186 * cancel the request or change priority. |
195 * cancel the request or change priority. |
187 * The ID is specific to this tnm |
196 * The ID is specific to this tnm |
188 * instance and may not be shared with other |
197 * instance and may not be shared with other |
189 * instances. |
198 * instances. |
190 */ |
199 */ |
191 IMPORT_C int getThumbnail( const QString& fileName, void * clientData = NULL, |
200 TNM_EXPORT int getThumbnail( const QString& fileName, void * clientData = NULL, |
192 int priority = tnmWrapperPriorityIdle ); |
201 int priority = tnmWrapperPriorityIdle ); |
193 |
202 |
194 /** |
203 /** |
195 * Get a persistent thumbnail for an object file. If a thumbnail already |
204 * Get a persistent thumbnail for an object file. If a thumbnail already |
196 * exists, it is loaded and if a thumbnail does not exist, it is created |
205 * exists, it is loaded and if a thumbnail does not exist, it is created |
207 * cancel the request or change priority. |
216 * cancel the request or change priority. |
208 * The ID is specific to this tnm |
217 * The ID is specific to this tnm |
209 * instance and may not be shared with other |
218 * instance and may not be shared with other |
210 * instances. |
219 * instances. |
211 */ |
220 */ |
212 IMPORT_C int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL, |
221 TNM_EXPORT int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL, |
213 int priority = tnmWrapperPriorityIdle ); |
222 int priority = tnmWrapperPriorityIdle ); |
214 |
223 |
215 /** |
224 /** |
216 * Set a thumbnail for an object file generated from pixmap delivered. |
225 * Set a thumbnail for an object file generated from pixmap delivered. |
217 * thumbnailReady() signal will be emited when the operation is complete. |
226 * thumbnailReady() signal will be emited when the operation is complete. |
225 * @param priority Priority for this operation |
234 * @param priority Priority for this operation |
226 * @return Thumbnail request ID or -1 if request failed. This can be used to |
235 * @return Thumbnail request ID or -1 if request failed. This can be used to |
227 * cancel the request or change priority. |
236 * cancel the request or change priority. |
228 * |
237 * |
229 */ |
238 */ |
230 IMPORT_C int setThumbnail( const QPixmap& source, const QString& fileName, |
239 TNM_EXPORT int setThumbnail( const QPixmap& source, const QString& fileName, |
231 void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); |
240 void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); |
232 |
241 |
233 /** |
242 /** |
234 * Set a thumbnail for an object file generated from pixmap delivered. |
243 * Set a thumbnail for an object file generated from pixmap delivered. |
235 * thumbnailReady() signal will be emited when the operation is complete. |
244 * thumbnailReady() signal will be emited when the operation is complete. |
243 * @param priority Priority for this operation |
252 * @param priority Priority for this operation |
244 * @return Thumbnail request ID or -1 if request failed. This can be used to |
253 * @return Thumbnail request ID or -1 if request failed. This can be used to |
245 * cancel the request or change priority. |
254 * cancel the request or change priority. |
246 * |
255 * |
247 */ |
256 */ |
248 IMPORT_C int setThumbnail( const QImage& source, const QString& fileName, |
257 TNM_EXPORT int setThumbnail( const QImage& source, const QString& fileName, |
249 void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); |
258 void * clientData = NULL, int priority = tnmWrapperPriorityIdle ); |
250 |
259 |
251 /** |
260 /** |
252 * Delete all thumbnails for a given object. This is an asynchronous |
261 * Delete all thumbnails for a given object. This is an asynchronous |
253 * operation, which always returns immediately. |
262 * operation, which always returns immediately. |
254 * |
263 * |
255 * @param fileName Source file |
264 * @param fileName Source file |
256 */ |
265 */ |
257 IMPORT_C void deleteThumbnails( const QString& fileName ); |
266 TNM_EXPORT void deleteThumbnails( const QString& fileName ); |
258 |
267 |
259 /** |
268 /** |
260 * Delete all thumbnails for a given object. This is an asynchronous |
269 * Delete all thumbnails for a given object. This is an asynchronous |
261 * operation, which always returns immediately. |
270 * operation, which always returns immediately. |
262 * |
271 * |
263 * @param thumbnailId thumbnail id |
272 * @param thumbnailId thumbnail id |
264 */ |
273 */ |
265 IMPORT_C void deleteThumbnails( unsigned long int thumbnailId ); |
274 TNM_EXPORT void deleteThumbnails( unsigned long int thumbnailId ); |
266 |
275 |
267 /** |
276 /** |
268 * Cancel a thumbnail operation. |
277 * Cancel a thumbnail operation. |
269 * |
278 * |
270 * @param id Request ID for the operation to be cancelled. |
279 * @param id Request ID for the operation to be cancelled. |
271 * @return true if cancelling was successful. |
280 * @return true if cancelling was successful. |
272 */ |
281 */ |
273 IMPORT_C bool cancelRequest( int id ); |
282 TNM_EXPORT bool cancelRequest( int id ); |
274 |
283 |
275 /** |
284 /** |
276 * Change the priority of a queued thumbnail operation. |
285 * Change the priority of a queued thumbnail operation. |
277 * |
286 * |
278 * @param id Request ID for the request which to assign a new |
287 * @param id Request ID for the request which to assign a new |
279 * priority. |
288 * priority. |
280 * @param newPriority New priority value |
289 * @param newPriority New priority value |
281 * @return true if change was successful. |
290 * @return true if change was successful. |
282 */ |
291 */ |
283 IMPORT_C bool changePriority( int id, int newPriority ); |
292 TNM_EXPORT bool changePriority( int id, int newPriority ); |
284 |
293 |
285 signals: |
294 signals: |
286 /** |
295 /** |
287 * Final thumbnail bitmap generation or loading is complete. |
296 * Final thumbnail bitmap generation or loading is complete. |
288 * |
297 * |
290 * @param clientData Client data |
299 * @param clientData Client data |
291 * @param id Request ID for the operation |
300 * @param id Request ID for the operation |
292 * @param errorCode error code |
301 * @param errorCode error code |
293 */ |
302 */ |
294 void thumbnailReady( QPixmap , void * , int , int ); |
303 void thumbnailReady( QPixmap , void * , int , int ); |
295 |
304 |
|
305 /** |
|
306 * Final thumbnail bitmap generation or loading is complete. |
|
307 * |
|
308 * @param image An object representing the resulting thumbnail. |
|
309 * @param clientData Client data |
|
310 * @param id Request ID for the operation |
|
311 * @param errorCode error code |
|
312 */ |
|
313 void thumbnailReady( QImage , void * , int , int ); |
|
314 |
|
315 protected: |
|
316 |
|
317 void connectNotify(const char *signal); |
|
318 |
|
319 void disconnectNotify(const char *signal); |
|
320 |
296 private: |
321 private: |
297 ThumbnailManagerPrivate* d; |
322 ThumbnailManagerPrivate* d; |
298 }; |
323 }; |
299 |
324 |
300 #endif // THUMBNAILMANAGER_QT |
325 #endif // THUMBNAILMANAGER_QT |