|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: CVcxHgMyVideosVideoData class definition* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef VCXHGMYVIDEOSVIDEODATAUPDATER_H |
|
21 #define VCXHGMYVIDEOSVIDEODATAUPDATER_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <coemain.h> |
|
25 |
|
26 #include <thumbnailmanager.h> |
|
27 #include <thumbnailmanagerobserver.h> |
|
28 #include "vcxhgmyvideosvideodata.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CVcxHgMyVideosModel; |
|
32 class CHgScroller; |
|
33 class CMPXMediaArray; |
|
34 class CThumbnailManager; |
|
35 class CVcxHgMyVideosVideoList; |
|
36 class CPeriodic; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * |
|
42 * @lib vcxhgmyvideos.lib |
|
43 */ |
|
44 NONSHARABLE_CLASS( CVcxHgMyVideosVideoDataUpdater ) : |
|
45 public CActive, |
|
46 public MThumbnailManagerObserver |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * |
|
53 * @param aModel Reference to component model. |
|
54 * @param aScroller Reference to Hg list control. |
|
55 * @param aVideoArray Reference to video array. |
|
56 * @return New object. |
|
57 */ |
|
58 static CVcxHgMyVideosVideoDataUpdater* NewL( |
|
59 CVcxHgMyVideosModel& aModel, |
|
60 CHgScroller& aScroller, |
|
61 CVcxHgMyVideosVideoList& aVideoArray ); |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 * |
|
66 * @param aModel Reference to component model. |
|
67 * @param aScroller Reference to Hg list control. |
|
68 * @param aVideoArray Reference to video array. |
|
69 * @return New object. |
|
70 */ |
|
71 static CVcxHgMyVideosVideoDataUpdater* NewLC( |
|
72 CVcxHgMyVideosModel& aModel, |
|
73 CHgScroller& aScroller, |
|
74 CVcxHgMyVideosVideoList& aVideoArray ); |
|
75 |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CVcxHgMyVideosVideoDataUpdater(); |
|
80 |
|
81 /** |
|
82 * Sets data updater to pause or normal mode. |
|
83 * |
|
84 * @param aPaused If ETrue, updater is paused. |
|
85 */ |
|
86 void SetPausedL( TBool aPaused ); |
|
87 |
|
88 /** |
|
89 * Called to inform video data updater that info array has changed. |
|
90 * Causes re-setting of all data as info array is the bases for fetched |
|
91 * additional video data. |
|
92 */ |
|
93 void InfoArrayChanged(); |
|
94 |
|
95 /** |
|
96 * Called by video list implementation when new data is needed. |
|
97 * Appends data item into buffer. |
|
98 * |
|
99 * @param aMPXItemId MPX item id of video data. |
|
100 */ |
|
101 void RequestDataL( TMPXItemId aMPXItemId ); |
|
102 |
|
103 /** |
|
104 * Called by video list implementation when data is not needed anymore. |
|
105 * Removes data item from buffer. |
|
106 * |
|
107 * @param aMPXItemId MPX item id of video data. |
|
108 */ |
|
109 void ReleaseData( TMPXItemId aMPXItemId ); |
|
110 |
|
111 public: // From MThumbnailManagerObserver |
|
112 |
|
113 /** |
|
114 * Preview thumbnail generation or loading is complete. |
|
115 * |
|
116 * @param aThumbnail An object representing the resulting thumbnail. |
|
117 * @param aId Request ID for the operation |
|
118 */ |
|
119 void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
|
120 |
|
121 /** |
|
122 * Final thumbnail bitmap generation or loading is complete. |
|
123 * |
|
124 * @param aError Error code. |
|
125 * @param aThumbnail An object representing the resulting thumbnail. |
|
126 * @param aId Request ID for the operation. |
|
127 */ |
|
128 void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
|
129 |
|
130 public: // From CActive |
|
131 |
|
132 /** |
|
133 * From CActive. |
|
134 */ |
|
135 void RunL(); |
|
136 |
|
137 /** |
|
138 * From CActive. |
|
139 * |
|
140 * @param aError Error code. |
|
141 * @return KErrNone if continuing is ok. |
|
142 */ |
|
143 TInt RunError( TInt aError ); |
|
144 |
|
145 /** |
|
146 * From CActive. |
|
147 */ |
|
148 void DoCancel(); |
|
149 |
|
150 protected: |
|
151 |
|
152 /** |
|
153 * Default constructor |
|
154 * |
|
155 * @param aModel Reference to component model. |
|
156 * @param aScroller Reference to Hg list control. |
|
157 * @param aVideoArray Reference to video array. |
|
158 */ |
|
159 CVcxHgMyVideosVideoDataUpdater( |
|
160 CVcxHgMyVideosModel& aModel, |
|
161 CHgScroller& aScroller, |
|
162 CVcxHgMyVideosVideoList& aVideoArray ); |
|
163 |
|
164 /** |
|
165 * 2nd phase constructor. |
|
166 */ |
|
167 void ConstructL(); |
|
168 |
|
169 /** |
|
170 * Returns index of fetch array based on MPX Item Id. |
|
171 * |
|
172 * @param aMpxItemId MPX Item Id. |
|
173 * @return Index of array or KErrNotFound. |
|
174 */ |
|
175 TInt IndexByMPXItemId( TMPXItemId aMpxItemId ); |
|
176 |
|
177 /** |
|
178 * Selects next index to be fetched. |
|
179 */ |
|
180 void SelectNextIndexL(); |
|
181 |
|
182 /** |
|
183 * Removes item from fetch array. |
|
184 * |
|
185 * @param aIndex Index of fetch array. |
|
186 */ |
|
187 void RemoveItem( TInt aIndex ); |
|
188 |
|
189 /** |
|
190 * Cancels possibly ongoing activities (thumbnail generation, DRM check). |
|
191 * |
|
192 * @param aIndex Index of fetch array. |
|
193 */ |
|
194 void CancelActivities( TInt aIndex ); |
|
195 |
|
196 /** |
|
197 * Adds item into fetch array. |
|
198 * |
|
199 * @param aMPXItemId MPX item id. |
|
200 */ |
|
201 void AddItemToFetchArrayL( TMPXItemId aMPXItemId ); |
|
202 |
|
203 /** |
|
204 * Cancels any on-going video data operations and deletes fetch array. |
|
205 */ |
|
206 void CancelAndDeleteFetchArray(); |
|
207 |
|
208 /** |
|
209 * Makes sure that video data fetching continues. |
|
210 */ |
|
211 void ContinueVideoDataFetchingL(); |
|
212 |
|
213 /** |
|
214 * Updates fetched video data to UI. |
|
215 */ |
|
216 void UpdateVideoDataToUiL( CVcxHgMyVideosVideoData& videoData ); |
|
217 |
|
218 /** |
|
219 * If needed creates, and returns pointer to Thumbnail Manager. |
|
220 * |
|
221 * @return Pointer to Thumbnail Manager. |
|
222 */ |
|
223 CThumbnailManager* ThumbnailManagerL(); |
|
224 |
|
225 /** |
|
226 * Checks if list refreshing is needed. |
|
227 * |
|
228 * @param aIndex The item index on the Ganes list that was modified last. |
|
229 * @return ETrue if refreshing is needed, otherwise EFalse. |
|
230 */ |
|
231 TBool ListRefreshNeeded( TInt aIndex ); |
|
232 |
|
233 /** |
|
234 * Callback method for RefreshTimer. |
|
235 */ |
|
236 static TInt RefreshTimerCallBack( TAny* aAny ); |
|
237 |
|
238 /** |
|
239 * Refreshes the ganes list. |
|
240 */ |
|
241 void RefreshScreen(); |
|
242 |
|
243 protected: |
|
244 |
|
245 /** |
|
246 * Reference to component's model. |
|
247 * Not own. |
|
248 */ |
|
249 CVcxHgMyVideosModel& iModel; |
|
250 |
|
251 /** |
|
252 * Hg list component. |
|
253 * Not own. |
|
254 */ |
|
255 CHgScroller& iScroller; |
|
256 |
|
257 /** |
|
258 * Array of videos that need data fetching. |
|
259 * Own |
|
260 */ |
|
261 RPointerArray<CVcxHgMyVideosVideoData> iFetchArray; |
|
262 |
|
263 /** |
|
264 * Reference to video array. |
|
265 * Not own. |
|
266 */ |
|
267 CVcxHgMyVideosVideoList& iVideoArray; |
|
268 |
|
269 /** |
|
270 * S60 Thumbnail Manager. |
|
271 * Own. |
|
272 */ |
|
273 CThumbnailManager* iTnEngine; |
|
274 |
|
275 /** |
|
276 * Used for indicating that list needs to be refreshed. |
|
277 * Own. |
|
278 */ |
|
279 CPeriodic* iRefreshTimer; |
|
280 |
|
281 /** |
|
282 * Flag for pause state. |
|
283 */ |
|
284 TBool iPaused; |
|
285 |
|
286 /** |
|
287 * Flag indicates that list refresh is delayed. |
|
288 */ |
|
289 TBool iListRefreshIsDelayed; |
|
290 }; |
|
291 |
|
292 #endif // VCXHGMYVIDEOSVIDEODATAUPDATER_H |