|
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: Implementation of MPXVideoPlaybackControlsController |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: da1mmcf#13 % |
|
19 |
|
20 |
|
21 |
|
22 #ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
|
23 #define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
|
24 |
|
25 // INCLUDES |
|
26 #include <QObject> |
|
27 #include <QPixmap> |
|
28 |
|
29 #include <mpxplaybackframeworkdefs.h> |
|
30 |
|
31 #include "mpxvideo_debug.h" |
|
32 #include "mpxvideoplaybackcontrol.hrh" |
|
33 #include "mpxcommonvideoplaybackview.hrh" |
|
34 #include "mpxvideoplaybackviewfiledetails.h" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class QTimer; |
|
38 class QString; |
|
39 class HbAction; |
|
40 class ThumbnailManager; |
|
41 class QActionGroup; |
|
42 class CMPXVideoViewWrapper; |
|
43 class HbVideoBasePlaybackView; |
|
44 class QMPXVideoPlaybackControlPolicy; |
|
45 class QMPXVideoPlaybackDocumentLoader; |
|
46 class QMPXVideoPlaybackFullScreenControl; |
|
47 class QMPXVideoPlaybackNonTouchVolumeBar; |
|
48 class QMPXVideoPlaybackControlsController; |
|
49 class QMPXVideoPlaybackControlConfiguration; |
|
50 |
|
51 |
|
52 // DATA TYPES |
|
53 |
|
54 enum TMPXTimerAction |
|
55 { |
|
56 EMPXTimerCancel, |
|
57 EMPXTimerReset |
|
58 }; |
|
59 |
|
60 enum TThumbNailState |
|
61 { |
|
62 EThumbNailEmpty, |
|
63 EThumbNailNotAvailable, |
|
64 EThumbNailRequsted, |
|
65 EThumbNailSet |
|
66 }; |
|
67 |
|
68 enum TPlaybackViewMode |
|
69 { |
|
70 EFullScreenView, |
|
71 EDetailsView, |
|
72 EAudioOnlyView |
|
73 }; |
|
74 |
|
75 const int KMPXControlsTimeOut = 4000; |
|
76 |
|
77 const QString KMPXPLAYBACKVIEW_XML = ":/hbvideoplaybackview/hbvideoplaybackview.docml"; |
|
78 |
|
79 |
|
80 // CLASS DECLARATION |
|
81 |
|
82 class QMPXVideoPlaybackControlsController : public QObject |
|
83 { |
|
84 Q_OBJECT |
|
85 |
|
86 public: |
|
87 |
|
88 /** |
|
89 * constructor. |
|
90 */ |
|
91 QMPXVideoPlaybackControlsController( |
|
92 HbVideoBasePlaybackView *view, |
|
93 CMPXVideoViewWrapper *viewWrapper, |
|
94 QMPXVideoPlaybackViewFileDetails *details ); |
|
95 |
|
96 /** |
|
97 * Destructor. |
|
98 */ |
|
99 virtual ~QMPXVideoPlaybackControlsController(); |
|
100 |
|
101 public: |
|
102 |
|
103 /** |
|
104 * Handle event from container |
|
105 */ |
|
106 void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 ); |
|
107 |
|
108 /** |
|
109 * Command handling function. |
|
110 * Call HandleCommandL() of container |
|
111 */ |
|
112 void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 ); |
|
113 |
|
114 /* |
|
115 * Return ETrue if TV-out cable gets connected |
|
116 */ |
|
117 inline bool isTvOutConnected(); |
|
118 |
|
119 /* |
|
120 * Return ETrue if TV-out cable is connected and content can be played |
|
121 */ |
|
122 inline bool isTvOutPlaybackAllowed(); |
|
123 |
|
124 /** |
|
125 * Reset or cancel timers for the controls |
|
126 */ |
|
127 void resetDisappearingTimers( TMPXTimerAction timerAction ); |
|
128 |
|
129 /** |
|
130 * Return state |
|
131 */ |
|
132 inline TMPXPlaybackState state(); |
|
133 |
|
134 /** |
|
135 * Return file details |
|
136 */ |
|
137 inline QMPXVideoPlaybackViewFileDetails* fileDetails(); |
|
138 |
|
139 // |
|
140 // Add the file details to the controls controller when available |
|
141 // |
|
142 void addFileDetails( QMPXVideoPlaybackViewFileDetails* details ); |
|
143 |
|
144 inline QMPXVideoPlaybackDocumentLoader* layoutLoader(); |
|
145 |
|
146 inline HbVideoBasePlaybackView* view(); |
|
147 |
|
148 void updateVideoRectDone(); |
|
149 |
|
150 TPlaybackViewMode viewMode(); |
|
151 |
|
152 void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true ); |
|
153 |
|
154 private: |
|
155 /** |
|
156 * Initialize controller |
|
157 */ |
|
158 void initializeController(); |
|
159 |
|
160 /** |
|
161 * Update controls |
|
162 */ |
|
163 void handleStateChange( TMPXPlaybackState newState ); |
|
164 |
|
165 /** |
|
166 * Show Controls and reset the timers |
|
167 */ |
|
168 void showControls(); |
|
169 |
|
170 /** |
|
171 * Return ETrue if any control is visible |
|
172 */ |
|
173 bool isVisible(); |
|
174 |
|
175 /** |
|
176 * Append a control based on control index |
|
177 */ |
|
178 void appendControl( TMPXVideoPlaybackControls controlIndex ); |
|
179 |
|
180 /** |
|
181 * Set changed volume |
|
182 */ |
|
183 void volumeChanged( int volume ); |
|
184 |
|
185 /** |
|
186 * Set changed duration |
|
187 */ |
|
188 void durationChanged( int duration); |
|
189 |
|
190 /** |
|
191 * Set changed position |
|
192 */ |
|
193 void positionChanged( int position ); |
|
194 |
|
195 /** |
|
196 * Set changed position |
|
197 */ |
|
198 void aspectRatioChanged( int aspectRatio ); |
|
199 |
|
200 /* |
|
201 * Sets the download size on the progress bar |
|
202 */ |
|
203 void setDownloadSize( int size ); |
|
204 |
|
205 /* |
|
206 * Updates the download ratio on the progress bar |
|
207 */ |
|
208 void updateDownloadPosition( int newSize ); |
|
209 |
|
210 /** |
|
211 * Set changed state on the controls |
|
212 */ |
|
213 void updateState(); |
|
214 |
|
215 /** |
|
216 * Check whether this clip is real format or not |
|
217 */ |
|
218 bool realFormat( QString filename ); |
|
219 |
|
220 /** |
|
221 * Check whether this clip is real format or not for streaming/live streaming |
|
222 */ |
|
223 bool realFormatForStreaming( const TDesC& des ); |
|
224 |
|
225 /** |
|
226 * Check whether this clip is real format or not for local/progressive donwload |
|
227 */ |
|
228 bool realFormatForLocal(); |
|
229 |
|
230 /** |
|
231 * Handle errors |
|
232 */ |
|
233 void handleErrors(); |
|
234 |
|
235 /** |
|
236 * Return ETrue if control is visible |
|
237 */ |
|
238 bool isSoftKeyVisible( int value ); |
|
239 |
|
240 /** |
|
241 * Handle tvout connected/disconnected event |
|
242 */ |
|
243 void handleTvOutEvent( bool connected, |
|
244 TMPXVideoPlaybackControlCommandIds event, |
|
245 int value ); |
|
246 |
|
247 HbAction* createAction( QActionGroup *actionsGroup, |
|
248 int index, |
|
249 const char *slot, |
|
250 const QString& toolTip ); |
|
251 |
|
252 void updateVideoRect( bool transitionEffect = true ); |
|
253 |
|
254 void showVolumeControls(); |
|
255 |
|
256 void setDefaultBitmap(); |
|
257 |
|
258 void generateThumbNail(); |
|
259 |
|
260 private slots: |
|
261 void hideAllControls(); |
|
262 void skipToNextVideoItem(); |
|
263 void skipToPreviousVideoItem(); |
|
264 void handleTappedOnScreen(); |
|
265 void handleThumbnailReady( QPixmap tnData, void *internal , int id, int error ); |
|
266 void controlsListUpdated(); |
|
267 |
|
268 private: |
|
269 HbVideoBasePlaybackView *mView; |
|
270 CMPXVideoViewWrapper *mViewWrapper; |
|
271 QMPXVideoPlaybackViewFileDetails *mFileDetails; |
|
272 |
|
273 QList<QMPXVideoPlaybackFullScreenControl*> mControls; |
|
274 |
|
275 QMPXVideoPlaybackControlPolicy *mControlsPolicy; |
|
276 QMPXVideoPlaybackControlConfiguration *mControlsConfig; |
|
277 |
|
278 QTimer *mControlsTimer; |
|
279 |
|
280 QMPXVideoPlaybackDocumentLoader *mLoader; |
|
281 QMPXVideoPlaybackNonTouchVolumeBar *mVolumeControl; |
|
282 |
|
283 ThumbnailManager *mThumbnailManager; |
|
284 |
|
285 bool mViewTransitionIsGoingOn; |
|
286 TThumbNailState mThumbNailState; |
|
287 |
|
288 TMPXPlaybackState mState; |
|
289 TPlaybackViewMode mViewMode; |
|
290 }; |
|
291 |
|
292 // INLINE METHODS |
|
293 // ------------------------------------------------------------------------------------------------- |
|
294 // QMPXVideoPlaybackControlsController::state |
|
295 // ------------------------------------------------------------------------------------------------- |
|
296 // |
|
297 inline |
|
298 TMPXPlaybackState QMPXVideoPlaybackControlsController::state() |
|
299 { |
|
300 return mState; |
|
301 } |
|
302 |
|
303 // ------------------------------------------------------------------------------------------------- |
|
304 // QMPXVideoPlaybackControlsController::fileDetails |
|
305 // ------------------------------------------------------------------------------------------------- |
|
306 // |
|
307 inline |
|
308 QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails() |
|
309 { |
|
310 return mFileDetails; |
|
311 } |
|
312 |
|
313 // ------------------------------------------------------------------------------------------------- |
|
314 // QMPXVideoPlaybackControlsController::isTvOutConnected |
|
315 // ------------------------------------------------------------------------------------------------- |
|
316 // |
|
317 inline |
|
318 bool QMPXVideoPlaybackControlsController::isTvOutConnected() |
|
319 { |
|
320 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"), |
|
321 mFileDetails->mTvOutConnected); |
|
322 |
|
323 return mFileDetails->mTvOutConnected; |
|
324 } |
|
325 |
|
326 // ------------------------------------------------------------------------------------------------- |
|
327 // QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed |
|
328 // ------------------------------------------------------------------------------------------------- |
|
329 // |
|
330 inline |
|
331 bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() |
|
332 { |
|
333 bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed ); |
|
334 |
|
335 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"), |
|
336 playable); |
|
337 |
|
338 return playable; |
|
339 } |
|
340 |
|
341 // ------------------------------------------------------------------------------------------------- |
|
342 // QMPXVideoPlaybackControlsController::layoutLoader |
|
343 // ------------------------------------------------------------------------------------------------- |
|
344 // |
|
345 inline |
|
346 QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader() |
|
347 { |
|
348 return mLoader; |
|
349 } |
|
350 |
|
351 // ------------------------------------------------------------------------------------------------- |
|
352 // QMPXVideoPlaybackControlsController::view |
|
353 // ------------------------------------------------------------------------------------------------- |
|
354 // |
|
355 inline |
|
356 HbVideoBasePlaybackView* QMPXVideoPlaybackControlsController::view() |
|
357 { |
|
358 return mView; |
|
359 } |
|
360 |
|
361 // ------------------------------------------------------------------------------------------------- |
|
362 // QMPXVideoPlaybackControlsController::viewMode |
|
363 // ------------------------------------------------------------------------------------------------- |
|
364 // |
|
365 inline |
|
366 TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode() |
|
367 { |
|
368 return mViewMode; |
|
369 } |
|
370 |
|
371 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/ |
|
372 |
|
373 // End of File |