13 * |
13 * |
14 * Description: Implementation of MPXVideoPlaybackControlsController |
14 * Description: Implementation of MPXVideoPlaybackControlsController |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // Version : %version: 1 % |
18 // Version : %version: 2 % |
19 |
19 |
20 |
20 |
21 |
21 |
22 #ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
22 #ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
23 #define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
23 #define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
24 |
24 |
25 // INCLUDES |
25 // INCLUDES |
26 #include <qobject> |
26 #include <qobject> |
27 |
27 |
28 #include <mpxplaybackframeworkdefs.h> |
|
29 |
28 |
30 #include "mpxvideo_debug.h" |
29 #include "mpxvideo_debug.h" |
31 #include "mpxvideoplaybackcontrol.hrh" |
|
32 #include "mpxcommonvideoplaybackview.hrh" |
30 #include "mpxcommonvideoplaybackview.hrh" |
33 #include "mpxvideoplaybackviewfiledetails.h" |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class QTimer; |
|
37 class QString; |
|
38 class HbAction; |
|
39 class QActionGroup; |
|
40 class QMPXVideoPlaybackControlPolicy; |
|
41 class QMPXVideoPlaybackFullScreenControl; |
|
42 class QMPXVideoPlaybackNonTouchVolumeBar; |
|
43 class QMPXVideoPlaybackControlsController; |
|
44 class QMPXVideoPlaybackControlConfiguration; |
|
45 |
|
46 |
|
47 // DATA TYPES |
|
48 |
|
49 enum TMPXTimerAction |
|
50 { |
|
51 EMPXTimerCancel, |
|
52 EMPXTimerReset |
|
53 }; |
|
54 |
|
55 enum TPlaybackViewMode |
|
56 { |
|
57 EFullScreenView, |
|
58 EDetailsView, |
|
59 EAudioOnlyView |
|
60 }; |
|
61 |
|
62 const int KMPXControlsTimeOut = 4000; |
|
63 |
|
64 |
31 |
65 // CLASS DECLARATION |
32 // CLASS DECLARATION |
66 |
33 |
67 class QMPXVideoPlaybackControlsController : public QObject |
34 class QMPXVideoPlaybackControlsController : public QObject |
68 { |
35 { |
71 public: |
38 public: |
72 |
39 |
73 /** |
40 /** |
74 * constructor. |
41 * constructor. |
75 */ |
42 */ |
76 QMPXVideoPlaybackControlsController( QMPXVideoPlaybackViewFileDetails *details ); |
43 QMPXVideoPlaybackControlsController(); |
77 |
44 |
78 /** |
45 /** |
79 * Destructor. |
46 * Destructor. |
80 */ |
47 */ |
81 virtual ~QMPXVideoPlaybackControlsController(); |
48 virtual ~QMPXVideoPlaybackControlsController(); |
82 |
49 |
83 public: |
50 public: |
84 |
51 |
85 /** |
52 /** |
86 * Handle event from container |
|
87 */ |
|
88 void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 ); |
|
89 |
|
90 /** |
|
91 * Command handling function. |
53 * Command handling function. |
92 * Call HandleCommandL() of container |
54 * Call HandleCommandL() of container |
93 */ |
55 */ |
94 void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 ); |
56 void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );\ |
95 |
|
96 /* |
|
97 * Return ETrue if TV-out cable gets connected |
|
98 */ |
|
99 inline bool isTvOutConnected(); |
|
100 |
|
101 /* |
|
102 * Return ETrue if TV-out cable is connected and content can be played |
|
103 */ |
|
104 inline bool isTvOutPlaybackAllowed(); |
|
105 |
|
106 /** |
|
107 * Reset or cancel timers for the controls |
|
108 */ |
|
109 void resetDisappearingTimers( TMPXTimerAction timerAction ); |
|
110 |
|
111 /** |
|
112 * Return state |
|
113 */ |
|
114 inline TMPXPlaybackState state(); |
|
115 |
|
116 /** |
|
117 * Return file details |
|
118 */ |
|
119 inline QMPXVideoPlaybackViewFileDetails* fileDetails(); |
|
120 |
|
121 // |
|
122 // Add the file details to the controls controller when available |
|
123 // |
|
124 void addFileDetails( QMPXVideoPlaybackViewFileDetails* details ); |
|
125 |
|
126 inline bool isFlipView(); |
|
127 |
|
128 void updateVideoRectDone(); |
|
129 |
|
130 void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true ); |
|
131 |
|
132 TPlaybackViewMode viewMode(); |
|
133 |
|
134 public: |
|
135 /** |
|
136 * Initialize controller |
|
137 */ |
|
138 void initializeController(); |
|
139 |
|
140 /** |
|
141 * Create controls |
|
142 */ |
|
143 void createControls(); |
|
144 |
|
145 /** |
|
146 * Update controls |
|
147 */ |
|
148 void handleStateChange( TMPXPlaybackState newState ); |
|
149 |
|
150 /** |
|
151 * Update Control's visibility |
|
152 */ |
|
153 void updateControlsVisibility(); |
|
154 |
|
155 /** |
|
156 * Toggle visibility |
|
157 */ |
|
158 void toggleVisibility(); |
|
159 |
|
160 /** |
|
161 * Create/delete controls based on updated control list |
|
162 */ |
|
163 void controlsListUpdated(); |
|
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 button bar |
|
212 */ |
|
213 void updateStateOnButtonBar(); |
|
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 private slots: |
|
257 void hideAllControls(); |
|
258 void skipToNextVideoItem(); |
|
259 void skipToPreviousVideoItem(); |
|
260 void handleTappedOnScreen(); |
|
261 |
|
262 public: |
|
263 QMPXVideoPlaybackViewFileDetails *mFileDetails; |
|
264 |
|
265 QList<QMPXVideoPlaybackFullScreenControl*> mControls; |
|
266 |
|
267 QMPXVideoPlaybackControlPolicy *mControlsPolicy; |
|
268 QMPXVideoPlaybackControlConfiguration *mControlsConfig; |
|
269 |
|
270 QTimer *mControlsTimer; |
|
271 |
|
272 QMPXVideoPlaybackNonTouchVolumeBar *mVolumeControl; |
|
273 |
|
274 bool mFlipViewOpened; |
|
275 bool mViewTransitionIsGoingOn; |
|
276 TMPXPlaybackState mState; |
|
277 TPlaybackViewMode mViewMode; |
|
278 |
|
279 }; |
57 }; |
280 |
|
281 // INLINE METHODS |
|
282 // ------------------------------------------------------------------------------------------------- |
|
283 // QMPXVideoPlaybackControlsController::state |
|
284 // ------------------------------------------------------------------------------------------------- |
|
285 // |
|
286 inline |
|
287 TMPXPlaybackState QMPXVideoPlaybackControlsController::state() |
|
288 { |
|
289 return mState; |
|
290 } |
|
291 |
|
292 // ------------------------------------------------------------------------------------------------- |
|
293 // QMPXVideoPlaybackControlsController::fileDetails |
|
294 // ------------------------------------------------------------------------------------------------- |
|
295 // |
|
296 inline |
|
297 QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails() |
|
298 { |
|
299 return mFileDetails; |
|
300 } |
|
301 |
|
302 // ------------------------------------------------------------------------------------------------- |
|
303 // QMPXVideoPlaybackControlsController::isTvOutConnected |
|
304 // ------------------------------------------------------------------------------------------------- |
|
305 // |
|
306 inline |
|
307 bool QMPXVideoPlaybackControlsController::isTvOutConnected() |
|
308 { |
|
309 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"), |
|
310 mFileDetails->mTvOutConnected); |
|
311 |
|
312 return mFileDetails->mTvOutConnected; |
|
313 } |
|
314 |
|
315 // ------------------------------------------------------------------------------------------------- |
|
316 // QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed |
|
317 // ------------------------------------------------------------------------------------------------- |
|
318 // |
|
319 inline |
|
320 bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() |
|
321 { |
|
322 bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed ); |
|
323 |
|
324 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"), |
|
325 playable); |
|
326 |
|
327 return playable; |
|
328 } |
|
329 |
|
330 // ------------------------------------------------------------------------------------------------- |
|
331 // QMPXVideoPlaybackControlsController::isFlipView |
|
332 // ------------------------------------------------------------------------------------------------- |
|
333 // |
|
334 inline |
|
335 bool QMPXVideoPlaybackControlsController::isFlipView() |
|
336 { |
|
337 return mFlipViewOpened; |
|
338 } |
|
339 |
58 |
340 |
59 |
341 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/ |
60 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/ |
342 |
61 |
343 // End of File |
62 // End of File |