|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef THUMBNAILMANAGER_P_QT_H |
|
19 #define THUMBNAILMANAGER_P_QT_H |
|
20 |
|
21 #include <qobject> |
|
22 #include <thumbnailmanager.h> |
|
23 #include <thumbnailmanager_qt.h> |
|
24 #include <thumbnailmanagerobserver.h> |
|
25 #include <qpixmap.h> |
|
26 |
|
27 class QString; |
|
28 class QPixmap; |
|
29 class QSize; |
|
30 class CThumbnailManager; |
|
31 class MThumbnailData; |
|
32 class CFbsBitmap; |
|
33 class QByteArray; |
|
34 |
|
35 |
|
36 class ThumbnailManagerPrivate : |
|
37 public QObject, |
|
38 public MThumbnailManagerObserver |
|
39 { |
|
40 Q_OBJECT |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Constructor |
|
45 */ |
|
46 |
|
47 ThumbnailManagerPrivate(); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 virtual ~ThumbnailManagerPrivate(); |
|
53 |
|
54 /** |
|
55 * Get quality versus performance preference. |
|
56 */ |
|
57 ThumbnailManager::QualityPreference qualityPreference() const; |
|
58 |
|
59 /** |
|
60 * Set quality versus performance preference. |
|
61 */ |
|
62 bool setQualityPreference( ThumbnailManager::QualityPreference qualityPreference ); |
|
63 |
|
64 /** |
|
65 * Get the current desired size for thumbnail bitmaps. |
|
66 */ |
|
67 QSize thumbnailSize() const; |
|
68 |
|
69 /** |
|
70 * Set desired size for thumbnail bitmaps. |
|
71 */ |
|
72 bool setThumbnailSize( const QSize& aThumbnailSize ); |
|
73 |
|
74 /** |
|
75 * Set desired size for thumbnail bitmaps. |
|
76 */ |
|
77 bool setThumbnailSize( ThumbnailManager::ThumbnailSize thumbnailSize ); |
|
78 |
|
79 /** |
|
80 * Get current mode for thumbnail generation. |
|
81 */ |
|
82 ThumbnailManager::ThumbnailMode mode() const; |
|
83 |
|
84 /** |
|
85 * Set mode for thumbnail generation. |
|
86 */ |
|
87 bool setMode( ThumbnailManager::ThumbnailMode mode ); |
|
88 |
|
89 /** |
|
90 * Get a thumbnail for an object file. If a thumbnail already exists, it |
|
91 * is loaded and if a thumbnail does not exist, it is created |
|
92 * transparently. |
|
93 */ |
|
94 int getThumbnail( const QString& fileName, void * clientData, |
|
95 int priority ); |
|
96 |
|
97 /** |
|
98 * Get a persistent thumbnail for an object file. If a thumbnail already |
|
99 * exists, it is loaded and if a thumbnail does not exist, it is created |
|
100 * transparently. |
|
101 */ |
|
102 int getThumbnail( unsigned long int aThumbnailId, void * clientData, |
|
103 int priority ); |
|
104 |
|
105 /** |
|
106 * Set a thumbnail for an object file generated from pixmap delivered. |
|
107 * thumbnailReady() signal will be emited when the operation is complete. |
|
108 */ |
|
109 int setThumbnail( const QPixmap& source, const QString& fileName, |
|
110 void * clientData, int priority ); |
|
111 |
|
112 /** |
|
113 * Delete all thumbnails for a given object. This is an asynchronous |
|
114 * operation, which always returns immediately. |
|
115 */ |
|
116 void deleteThumbnails( const QString& fileName ); |
|
117 |
|
118 /** |
|
119 * Delete all thumbnails for a given object. This is an asynchronous |
|
120 * operation, which always returns immediately. |
|
121 */ |
|
122 void deleteThumbnails( unsigned long int thumbnailId ); |
|
123 |
|
124 /** |
|
125 * Cancel a thumbnail operation. |
|
126 */ |
|
127 bool cancelRequest( int id ); |
|
128 |
|
129 /** |
|
130 * Change the priority of a queued thumbnail operation. |
|
131 */ |
|
132 bool changePriority( int id, int newPriority ); |
|
133 |
|
134 //FROM MThumbnailManagerObserver |
|
135 /** |
|
136 * Preview thumbnail generation or loading is complete. |
|
137 * |
|
138 * This callback is not called unless EOptimizeForQualityWithPreview flag |
|
139 * was specified. |
|
140 * |
|
141 * This callback is not called if any of the following is true: |
|
142 * - an error occurred while processing the preview thumbnail |
|
143 * - a suitable existing thumbnail was not found |
|
144 * - a high quality thumbnail is already available |
|
145 * |
|
146 * The MThumbnailData instance is only valid for the duration of |
|
147 * this call. It may not be stored for later use. If the client should |
|
148 * want to use the bitmap data later, it can claim ownership of the |
|
149 * CFbsBitmap object by calling DetachBitmap(). |
|
150 * |
|
151 * @since S60 v5.0 |
|
152 * @param aThumbnail An object representing the resulting thumbnail. |
|
153 * @param aId Request ID for the operation |
|
154 */ |
|
155 void ThumbnailPreviewReady( MThumbnailData& aThumbnail, |
|
156 TThumbnailRequestId aId ); |
|
157 |
|
158 /** |
|
159 * Final thumbnail bitmap generation or loading is complete. |
|
160 * |
|
161 * The MThumbnailData instance is only valid for the duration of |
|
162 * this call. It may not be stored for later use. If the client should |
|
163 * want to use the bitmap data later, it can claim ownership of the |
|
164 * CFbsBitmap object by calling DetachBitmap(). |
|
165 * |
|
166 * @since S60 v5.0 |
|
167 * @param aError Error code. |
|
168 * @param aThumbnail An object representing the resulting thumbnail. |
|
169 * @param aId Request ID for the operation. |
|
170 */ |
|
171 void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, |
|
172 TThumbnailRequestId aId ); |
|
173 |
|
174 |
|
175 signals: |
|
176 |
|
177 /** |
|
178 * Final thumbnail bitmap generation or loading is complete. |
|
179 */ |
|
180 void thumbnailReady( QPixmap , void * , int , int ); |
|
181 |
|
182 |
|
183 private: |
|
184 /** |
|
185 * Copy CFbsBitmap into a QPixmap. |
|
186 */ |
|
187 QPixmap copyPixmap( CFbsBitmap* bitmap ); |
|
188 |
|
189 |
|
190 private: |
|
191 |
|
192 CThumbnailManager* iThumbnailManager; |
|
193 |
|
194 QByteArray* byteArray; |
|
195 }; |
|
196 |
|
197 #endif // ThumbnailManager_H |