|
1 /* |
|
2 * Copyright (c) 2003-2005 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: SmilPlayerDialog declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SMILPLAYERDIALOG_H |
|
21 #define SMILPLAYERDIALOG_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <akndialog.h> |
|
25 #include <remconcoreapitargetobserver.h> |
|
26 #include <coneresloader.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TCoeHelpContext; |
|
30 class CFindItemMenu; |
|
31 class CSmilPlayerPresentationController; |
|
32 class MMediaFactoryFileInfo; |
|
33 class CMDXMLDocument; |
|
34 class CRepository; |
|
35 class CPeriodic; |
|
36 class CRemConInterfaceSelector; |
|
37 class CRemConCoreApiTarget; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * CSmilPlayerDialog dialog class |
|
43 * This is an interface class for applications to use SmilPlayer. |
|
44 * Derived from CAknDialog to enable options menu. |
|
45 * |
|
46 * Usage: |
|
47 * ----------------------- Copy & Paste ------------------------------- |
|
48 * #include <smilplayerdialog.h> //to the .cpp file where the following |
|
49 * //is going to be used |
|
50 * |
|
51 * CSmilPlayerDialog* dialog = CSmilPlayerDialog::NewL( CMDXMLDocument* aDOM, |
|
52 * MMediaFactoryFileInfo* aFileInfo, |
|
53 * const TDesC& aBaseUrl, |
|
54 * TBool aPreview = EFalse, |
|
55 * TBool aAudioOn = EFalse ); |
|
56 * |
|
57 * or |
|
58 * |
|
59 * CSmilPlayerDialog* dialog = CSmilPlayerDialog::NewL( RFile& aFileHandle, |
|
60 * MMediaFactoryFileInfo* aFileInfo, |
|
61 * const TDesC& aBaseUrl, |
|
62 * TBool aPreview = EFalse, |
|
63 * TBool aAudioOn = EFalse ); |
|
64 * |
|
65 * dialog->ExecuteLD(); |
|
66 * -------------------------------------------------------------------- |
|
67 * |
|
68 * Link agains library: smilplayer.lib. |
|
69 * The dialog will be automatically destroyed by ExecuteLD. |
|
70 * |
|
71 * @lib smilplayer.lib |
|
72 * @since 2.0 |
|
73 */ |
|
74 class CSmilPlayerDialog : public CAknDialog, |
|
75 public MCoeForegroundObserver, |
|
76 public MRemConCoreApiTargetObserver |
|
77 { |
|
78 public: // Constructors and destructor |
|
79 |
|
80 /** |
|
81 * Two-phased constructor. |
|
82 * |
|
83 * @param aDOM Pointer to Document Object Handle. Ownership is not |
|
84 * transferred. |
|
85 * @param aFileInfo Handle to the media objects file info. |
|
86 * @param aBaseUrl Base URL that is used for resolving relative URLs. |
|
87 * @param aPreview Boolean if player started to preview mode. |
|
88 * @param aAudioOn Boolean if presentation includes the audio. |
|
89 * |
|
90 * @return Pointer to created CSmilPlayerDialog |
|
91 */ |
|
92 IMPORT_C static CSmilPlayerDialog* NewL( CMDXMLDocument* aDOM, |
|
93 MMediaFactoryFileInfo* aFileInfo, |
|
94 const TDesC& aBaseUrl, |
|
95 TBool aPreview = EFalse, |
|
96 TBool aAudioOn = EFalse ); |
|
97 |
|
98 /** |
|
99 * Two-phased constructor. |
|
100 * |
|
101 * @param aFileHandle Handle to the .smil file. Ownership is not transferred. |
|
102 * @param aFileInfo Handle to the media objects file info. |
|
103 * @param aBaseUrl Base URL that is used for resolving relative URLs. |
|
104 * @param aPreview Boolean if player started to preview mode. |
|
105 * @param aAudioOn Boolean if presentation includes the audio. |
|
106 * |
|
107 * @return Pointer to created CSmilPlayerDialog |
|
108 */ |
|
109 IMPORT_C static CSmilPlayerDialog* NewL( RFile& aFileHandle, |
|
110 MMediaFactoryFileInfo* aFileInfo, |
|
111 const TDesC& aBaseUrl, |
|
112 TBool aPreview = EFalse, |
|
113 TBool aAudioOn = EFalse ); |
|
114 |
|
115 /** |
|
116 * Destructor. |
|
117 */ |
|
118 virtual ~CSmilPlayerDialog(); |
|
119 |
|
120 public: // New functions |
|
121 |
|
122 /** |
|
123 * Initializes the dialog and calls CAknDialog's |
|
124 * ExecuteLD() |
|
125 * This method need to be called to execute the dialog. |
|
126 * After exiting the dialog gets automatically destroyed |
|
127 * |
|
128 * @since 2.0 |
|
129 * |
|
130 * @return TInt ID value of the button that closed the dialog. |
|
131 */ |
|
132 IMPORT_C TInt ExecuteLD(); |
|
133 |
|
134 /** |
|
135 * Is called from the presentationcontroller |
|
136 * when engine indicates about the stop. |
|
137 * |
|
138 * @since 2.0 |
|
139 */ |
|
140 void PresentationStoppedL(); |
|
141 |
|
142 /** |
|
143 * The function is used to start/continue |
|
144 * playing the presentation |
|
145 */ |
|
146 void PlayTappedL(); |
|
147 |
|
148 /** |
|
149 * The function is used to pause the presentation |
|
150 */ |
|
151 void PauseTappedL(); |
|
152 |
|
153 /** |
|
154 * Deactivates scrolling. |
|
155 */ |
|
156 void DeactivateScrollingL(); |
|
157 |
|
158 /** |
|
159 * Performs selection key event handling |
|
160 */ |
|
161 TKeyResponse HandleSelectionKeyL(); |
|
162 |
|
163 public: // Functions from base classes |
|
164 |
|
165 /** |
|
166 * From MCoeForegroundObserver Prosesses foreground event. |
|
167 * |
|
168 * @since 2.0 |
|
169 */ |
|
170 void HandleGainingForeground(); |
|
171 |
|
172 /** |
|
173 * From MCoeForegroundObserver Prosesses foreground event. |
|
174 * |
|
175 * @since 2.0 |
|
176 */ |
|
177 void HandleLosingForeground(); |
|
178 |
|
179 /** |
|
180 * From MEikCommandObserver Prosesses menucommands |
|
181 * |
|
182 * @since 2.0 |
|
183 * |
|
184 * @param aCommandId Commant value defined in resources. |
|
185 */ |
|
186 void ProcessCommandL( TInt aCommandId ); |
|
187 |
|
188 /** |
|
189 * From CCoeControl Handles key events |
|
190 * |
|
191 * @since 2.0 |
|
192 * |
|
193 * @param aKeyEvent TKeyEvent |
|
194 * @param aType TEventCode |
|
195 * |
|
196 * @return TKeyResponse depending on was is consumed or not. |
|
197 */ |
|
198 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
199 |
|
200 /** |
|
201 * From MRemConCoreApiTargetObserver |
|
202 * See remconcoreapitargetobserver.h for more information |
|
203 * |
|
204 * @since 3.0 |
|
205 * |
|
206 */ |
|
207 void MrccatoCommand( TRemConCoreApiOperationId aOperationId, |
|
208 TRemConCoreApiButtonAction aButtonAct ); |
|
209 |
|
210 |
|
211 protected: // Functions from base classes |
|
212 |
|
213 /** |
|
214 * From MEikMenuObserver Initializes items on the menu |
|
215 * |
|
216 * @since 2.0 |
|
217 * |
|
218 * @param aMenuId Current menu's resource Id |
|
219 * @param aMenuPane Pointer to menupane |
|
220 */ |
|
221 void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane); |
|
222 |
|
223 /** |
|
224 * From CEikDialog. Handles button events and checks if the dialog |
|
225 * can be closed |
|
226 * |
|
227 * @since 2.0 |
|
228 * |
|
229 * @param aButtonId Id of the 'pressed' button |
|
230 * |
|
231 * @return EFalse if Options menu was pressed |
|
232 * ETrue otherwise |
|
233 */ |
|
234 TBool OkToExitL( TInt aButtonId ); |
|
235 |
|
236 /** |
|
237 * From CCoeControl |
|
238 * This function is called when Help application is launched. |
|
239 * |
|
240 * @since 2.0 |
|
241 * |
|
242 * @param aContext Help context |
|
243 */ |
|
244 void GetHelpContext( TCoeHelpContext& aContext) const; |
|
245 |
|
246 /** |
|
247 * From CCoeControl |
|
248 * This function is called when control resources are changed. |
|
249 * |
|
250 * @since 2.0 |
|
251 * |
|
252 * @param aType A message UID value. |
|
253 */ |
|
254 void HandleResourceChange( TInt aType ); |
|
255 |
|
256 protected: // New functions |
|
257 |
|
258 /** |
|
259 * DynInitMenuOptionsL Initializes items on the menu |
|
260 * |
|
261 * @since 2.0 |
|
262 * |
|
263 * @param aMenuPane Pointer to menupane |
|
264 */ |
|
265 void DynInitMenuOptionsL(CEikMenuPane* aMenuPane); |
|
266 |
|
267 /** |
|
268 * DynInitMenuOptionsAtNormalEnd Initializes items on the menu |
|
269 * |
|
270 * @since 2.0 |
|
271 * |
|
272 * @param aMenuPane Pointer to menupane |
|
273 */ |
|
274 void DynInitMenuOptionsAtNormalEnd(CEikMenuPane* aMenuPane); |
|
275 |
|
276 private: |
|
277 |
|
278 /** |
|
279 * Default C++ constructor. |
|
280 */ |
|
281 CSmilPlayerDialog(); |
|
282 |
|
283 /** |
|
284 * C++ constructor. |
|
285 * |
|
286 */ |
|
287 CSmilPlayerDialog( TBool aPreview, TBool aAudioOn ); |
|
288 |
|
289 /** |
|
290 * Symbian 2nd phase constructor. |
|
291 */ |
|
292 void ConstructL( const TDesC& aBaseUrl, |
|
293 MMediaFactoryFileInfo* aFileInfo, |
|
294 CMDXMLDocument* aDOM ); |
|
295 |
|
296 /** |
|
297 * Symbian 2nd phase constructor. |
|
298 */ |
|
299 void ConstructL( const TDesC& aBaseUrl, |
|
300 MMediaFactoryFileInfo* aFileInfo, |
|
301 RFile& aFileHandle ); |
|
302 |
|
303 |
|
304 /** |
|
305 * Common 2nd phase constructor shared by two overloaded ConstructL functions. |
|
306 */ |
|
307 void CommonConstructL(); |
|
308 |
|
309 /** |
|
310 * Called just before Draw function |
|
311 */ |
|
312 void ActivateL(); |
|
313 |
|
314 /** |
|
315 * Presentation states of the player |
|
316 */ |
|
317 enum TSmilPlayerPresentationStates |
|
318 { |
|
319 ESmilPlayerStateNotReady = 0, |
|
320 ESmilPlayerStatePlaying, |
|
321 ESmilPlayerStatePause, |
|
322 ESmilPlayerStateStop |
|
323 }; |
|
324 |
|
325 /** |
|
326 * Performs replay functionality. |
|
327 */ |
|
328 void DoReplayL(); |
|
329 |
|
330 /** |
|
331 * Changes the state of the player to given one. |
|
332 * |
|
333 * @param aState New state |
|
334 */ |
|
335 void ChangeStateL( TSmilPlayerPresentationStates aState ); |
|
336 |
|
337 /** |
|
338 * Callback function to stop timer |
|
339 * This timer is used for waiting one |
|
340 * second before getting back to the start. |
|
341 */ |
|
342 static TInt DoStopTiming( TAny* aObject ); |
|
343 |
|
344 /** |
|
345 * Callback function to stop timer |
|
346 * This timer is used for showing the error note |
|
347 * when .smil file is corrupted and player |
|
348 * could be opened. |
|
349 */ |
|
350 static TInt DoClosePlayer( TAny* aObject ); |
|
351 |
|
352 /** |
|
353 * Callback function to do volume repeat. |
|
354 * This timer is used for repeating remote control |
|
355 * server volume up/down command. |
|
356 */ |
|
357 static TInt DoVolumeRepeat( TAny* aObject ); |
|
358 |
|
359 /** |
|
360 * Stops the timers of the time indicator. |
|
361 * Indirectly called by the callback |
|
362 * function DoStopTiming. |
|
363 */ |
|
364 void StopTiming(); // indirectly called |
|
365 |
|
366 /** |
|
367 * Exits the player. |
|
368 * Indirectly called by the callback |
|
369 * function DoCloseTiming. |
|
370 */ |
|
371 void ClosePlayer(); // indirectly called |
|
372 |
|
373 /** |
|
374 * Performs one volume repeat. |
|
375 * Indirectly called by the callback |
|
376 * function DoVolumeRepeat. |
|
377 */ |
|
378 void VolumeRepeat(); // indirectly called |
|
379 |
|
380 /** |
|
381 * Auxiliary function. Shows a information note |
|
382 * using notewrappers. |
|
383 */ |
|
384 void ShowInformationNoteL( TInt aResourceID, TBool aWaiting ); |
|
385 |
|
386 /** |
|
387 * Launches help application |
|
388 */ |
|
389 void LaunchHelpL() const; |
|
390 |
|
391 /** |
|
392 * Implements the find item command. |
|
393 * Activates the find item common component. |
|
394 */ |
|
395 void DoFindItemL( TInt aCommandId ); |
|
396 |
|
397 /** |
|
398 * Sets the correct player layout, when a dialog (e.g. FindUi) |
|
399 * is overlapping the presentation. |
|
400 */ |
|
401 void LayoutOverlappedPresentation(); |
|
402 |
|
403 /** |
|
404 * Sets the correct layout. |
|
405 */ |
|
406 void LayoutPresentationL(); |
|
407 |
|
408 /** |
|
409 * Returns presentation rectangle. |
|
410 */ |
|
411 TRect PresentationRect() const; |
|
412 |
|
413 /** |
|
414 * Activates scrolling. |
|
415 */ |
|
416 void ActivateScrollingL(); |
|
417 |
|
418 /** |
|
419 * Performs key event handling |
|
420 */ |
|
421 TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
422 |
|
423 /** |
|
424 * Performs scroll key event handling |
|
425 */ |
|
426 TKeyResponse HandleScrollKeyL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
427 |
|
428 /** |
|
429 * Performs volume change key event handling |
|
430 */ |
|
431 TKeyResponse HandleVolumeKeyL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
432 |
|
433 /** |
|
434 * Shows given menubar |
|
435 */ |
|
436 void ShowMenubarL( TInt aResourceId ); |
|
437 |
|
438 /** |
|
439 * Returns whether audio is enabled or not. |
|
440 */ |
|
441 TBool AudioEnabled() const; |
|
442 |
|
443 private: //data |
|
444 |
|
445 enum TSmilPlayerFlags |
|
446 { |
|
447 EPreview = 0x0001, |
|
448 EAudioOn = 0x0002, |
|
449 EHelpSupported = 0x0004, |
|
450 EScrollingActivated = 0x0008, |
|
451 EFeatureSideVolumeKeys = 0x0010 |
|
452 }; |
|
453 |
|
454 // Resource loader |
|
455 RConeResourceLoader iResLoader; |
|
456 |
|
457 // Presentation control |
|
458 CSmilPlayerPresentationController* iPresentationController; |
|
459 |
|
460 // State of the presentation |
|
461 TSmilPlayerPresentationStates iPresentationState; |
|
462 |
|
463 // Timer |
|
464 CPeriodic* iTimer; |
|
465 |
|
466 // Remote control server command repeat timer. |
|
467 CPeriodic* iRCSTimer; |
|
468 |
|
469 // Flags |
|
470 TInt iPlayerFlags; |
|
471 |
|
472 // Find item menu. |
|
473 CFindItemMenu* iFindItemMenu; |
|
474 |
|
475 // Remote control server interface selector. |
|
476 CRemConInterfaceSelector* iInterfaceSelector; |
|
477 |
|
478 // Remote control server core API. |
|
479 CRemConCoreApiTarget* iCoreTarget; |
|
480 |
|
481 // Remote control server operation to repeat. |
|
482 TRemConCoreApiOperationId iRepeatId; |
|
483 }; |
|
484 |
|
485 #endif // SMILPLAYERDIALOG_H |
|
486 |
|
487 // End of File |