|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Processor |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef THUMBAGPROCESSOR_H |
|
20 #define THUMBAGPROCESSOR_H |
|
21 |
|
22 #include <thumbnailmanager.h> |
|
23 #include <thumbnailmanagerobserver.h> |
|
24 #include <thumbnaildata.h> |
|
25 #include <mdesession.h> |
|
26 #include <mdccommon.h> |
|
27 #include <mdeobjectquery.h> |
|
28 #include "thumbnaillog.h" |
|
29 #include <harvesterclient.h> |
|
30 #include <e32property.h> |
|
31 #include <mpxcollectionobserver.h> |
|
32 |
|
33 //FORWARD DECLARATIONS |
|
34 class CThumbAGFormatObserver; |
|
35 class MMPXCollectionUtility; |
|
36 |
|
37 /** |
|
38 * Processor object for handling thumb generation |
|
39 * |
|
40 * @since S60 v5.0 |
|
41 */ |
|
42 class CThumbAGProcessor: public CActive, |
|
43 public MThumbnailManagerObserver, |
|
44 public MMdEQueryObserver, |
|
45 public MHarvesterEventObserver, |
|
46 public MMPXCollectionObserver |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * |
|
53 * @since S60 v5.0 |
|
54 * @return Instance of CThumbAGProcessor. |
|
55 */ |
|
56 static CThumbAGProcessor* NewL(); |
|
57 |
|
58 /** |
|
59 * Destructor |
|
60 * |
|
61 * @since S60 v5.0 |
|
62 */ |
|
63 virtual ~CThumbAGProcessor(); |
|
64 |
|
65 public: |
|
66 |
|
67 // From MMdEQueryObserver |
|
68 void HandleQueryNewResults( CMdEQuery& aQuery, |
|
69 TInt aFirstNewItemIndex, |
|
70 TInt aNewItemCount ); |
|
71 void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ); |
|
72 |
|
73 // from MThumbnailManagerObserver |
|
74 void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
|
75 void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
|
76 |
|
77 // from MHarvesterEventObserver |
|
78 void HarvestingUpdated( |
|
79 HarvesterEventObserverType aHEObserverType, |
|
80 HarvesterEventState aHarvesterEventState, |
|
81 TInt aItemsLeft ); |
|
82 |
|
83 private: // From MMPXCollectionObserver |
|
84 /// See @ref MMPXCollectionObserver::HandleCollectionMessageL |
|
85 void HandleCollectionMessage( CMPXMessage* aMessage, TInt aError ); |
|
86 |
|
87 /// See @ref MMPXCollectionObserver::HandleOpenL |
|
88 void HandleOpenL(const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, TInt aError); |
|
89 |
|
90 /// See @ref MMPXCollectionObserver::HandleOpenL |
|
91 void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist, TInt aError); |
|
92 |
|
93 /// See @ref MMPXCollectionObserver::HandleCollectionMediaL |
|
94 void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); |
|
95 |
|
96 public: |
|
97 |
|
98 /** |
|
99 * Sets MdE Session |
|
100 * |
|
101 * @since S60 v5.0 |
|
102 * @param aMdESession MdE Session |
|
103 */ |
|
104 void SetMdESession( CMdESession* aMdESession ); |
|
105 |
|
106 /** |
|
107 * Adds new IDs to queue |
|
108 * |
|
109 * @since S60 v5.0 |
|
110 * @param aType TObserverNotificationType |
|
111 * @param aIDArray IDs for thumbnail creation |
|
112 * @param aForce pass ETrue if processor is forced to run without waiting harvesting complete |
|
113 */ |
|
114 void AddToQueueL( TObserverNotificationType aType, const RArray<TItemId>& aIDArray, TBool aPresent ); |
|
115 |
|
116 /** |
|
117 * Calls Thumbnail Manager to create thumbnails |
|
118 * |
|
119 * @since S60 v5.0 |
|
120 * @param aObject MdEObject |
|
121 */ |
|
122 void CreateThumbnailsL( const CMdEObject* aObject ); |
|
123 |
|
124 /** |
|
125 * Remove IDs from queue |
|
126 * |
|
127 * @since S60 v5.0 |
|
128 * @param aIDArray IDs for thumbnail creation |
|
129 */ |
|
130 void RemoveFromQueues( const RArray<TItemId>& aIDArray, const TBool aRemoveFromDelete = EFalse); |
|
131 |
|
132 void SetForceRun( const TBool aForceRun ); |
|
133 |
|
134 void SetFormat(TBool aStatus); |
|
135 |
|
136 void QueryForPlaceholdersL(); |
|
137 |
|
138 protected: |
|
139 |
|
140 /** |
|
141 * QueryL |
|
142 * |
|
143 * @since S60 v5.0 |
|
144 * @param aIDArray Item IDs to query |
|
145 */ |
|
146 void QueryL( RArray<TItemId>& aIDArray ); |
|
147 |
|
148 protected: |
|
149 |
|
150 /** |
|
151 * Handles an active object's request completion event. |
|
152 * |
|
153 * @since S60 v5.0 |
|
154 */ |
|
155 void RunL(); |
|
156 |
|
157 /** |
|
158 * Implements cancellation of an outstanding request. |
|
159 * |
|
160 * @since S60 v5.0 |
|
161 */ |
|
162 void DoCancel(); |
|
163 |
|
164 /** |
|
165 * Implements RunL error handling. |
|
166 * |
|
167 * @since S60 v5.0 |
|
168 */ |
|
169 TInt RunError(TInt aError); |
|
170 |
|
171 private: |
|
172 |
|
173 /** |
|
174 * C++ default constructor |
|
175 * |
|
176 * @since S60 v5.0 |
|
177 * @return Instance of CThumbAGProcessor. |
|
178 */ |
|
179 CThumbAGProcessor(); |
|
180 |
|
181 /** |
|
182 * Symbian 2nd phase constructor can leave. |
|
183 * |
|
184 * @since S60 v5.0 |
|
185 */ |
|
186 void ConstructL(); |
|
187 |
|
188 /** |
|
189 * Activate AO |
|
190 * |
|
191 * @since S60 v5.0 |
|
192 */ |
|
193 void ActivateAO(); |
|
194 |
|
195 /** |
|
196 * Callback for harvesting complete timer |
|
197 * |
|
198 * @since S60 v5.0 |
|
199 */ |
|
200 static TInt PeriodicTimerCallBack(TAny* aAny); |
|
201 |
|
202 /** |
|
203 * Check auto creation values from cenrep |
|
204 * |
|
205 * @since S60 v5.0 |
|
206 */ |
|
207 void CheckAutoCreateValuesL(); |
|
208 |
|
209 /** |
|
210 * Start timeout timer |
|
211 * |
|
212 * @since S60 v5.0 |
|
213 */ |
|
214 void StartTimeout(); |
|
215 |
|
216 /** |
|
217 * Cancel timeout timer |
|
218 * |
|
219 * @since S60 v5.0 |
|
220 */ |
|
221 void CancelTimeout(); |
|
222 |
|
223 private: |
|
224 |
|
225 // not own |
|
226 CMdESession* iMdESession; |
|
227 CMdENamespaceDef* iDefNamespace; |
|
228 |
|
229 // own |
|
230 CThumbnailManager* iTMSession; |
|
231 CMdEObjectQuery* iQuery; |
|
232 CMdEObjectQuery* iQueryForPlaceholders; |
|
233 |
|
234 RArray<TItemId> iAddQueue; |
|
235 RArray<TItemId> iModifyQueue; |
|
236 RArray<TItemId> iRemoveQueue; |
|
237 RArray<TItemId> iPresentQueue; |
|
238 RArray<TItemId> iQueryQueue; |
|
239 |
|
240 RArray<TItemId> iTempModifyQueue; |
|
241 RArray<TItemId> iTempAddQueue; |
|
242 |
|
243 RArray<TItemId> iPlaceholderIDs; |
|
244 |
|
245 TBool iQueryActive; |
|
246 TBool iQueryReady; |
|
247 |
|
248 TBool iQueryForPlaceholdersActive; |
|
249 |
|
250 TBool iModify; |
|
251 TInt iProcessingCount; |
|
252 |
|
253 //Flag is MDS Harvester harevsting |
|
254 TBool iHarvesting; |
|
255 TBool iHarvestingTemp; |
|
256 |
|
257 CPeriodic* iPeriodicTimer; |
|
258 TBool iTimerActive; |
|
259 |
|
260 //MDS Harvester client |
|
261 RHarvesterClient iHarvesterClient; |
|
262 |
|
263 //Set when running RunL() first time |
|
264 TBool iInit; |
|
265 |
|
266 // auto create |
|
267 TBool iAutoImage; |
|
268 TBool iAutoVideo; |
|
269 TBool iAutoAudio; |
|
270 |
|
271 #ifdef _DEBUG |
|
272 TUint32 iAddCounter; |
|
273 TUint32 iModCounter; |
|
274 TUint32 iDelCounter; |
|
275 #endif |
|
276 |
|
277 TBool iForceRun; |
|
278 //request pending in TNM side |
|
279 TBool iActive; |
|
280 //PS key to get info server's idle status |
|
281 RProperty iProperty; |
|
282 |
|
283 CThumbAGFormatObserver* iFormatObserver; |
|
284 |
|
285 TBool iFormatting; |
|
286 TBool iSessionDied; |
|
287 |
|
288 TInt iActiveCount; |
|
289 |
|
290 MMPXCollectionUtility* iCollectionUtility; // own |
|
291 |
|
292 //Flag is MPX harvesting or MTP synchronisation in progress |
|
293 TBool iMPXHarvesting; |
|
294 }; |
|
295 |
|
296 #endif // THUMBAGPROCESSOR_H |