53
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: MPX Common playback view's container implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef CMPXCOMMONPLAYBACKVIEWCONTAINER_H
|
|
21 |
#define CMPXCOMMONPLAYBACKVIEWCONTAINER_H
|
|
22 |
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <coecntrl.h>
|
|
26 |
#include <hwrmlight.h>
|
|
27 |
|
|
28 |
#include "mpxcommonplaybackviewdefs.h"
|
|
29 |
#include "mpxalbumartutilobserver.h"
|
|
30 |
#include "mpxbutton.h"
|
|
31 |
#include "mpxplaybackframeworkdefs.h"
|
|
32 |
#include "mpxconstants.h"
|
|
33 |
|
|
34 |
|
|
35 |
// FORWARD DECLARATIONS
|
|
36 |
class MEikCommandObserver;
|
|
37 |
class MAknsControlContext;
|
|
38 |
class CAknIconArray;
|
|
39 |
class CMPXPlaybackViewInfoLabel;
|
|
40 |
class MMPXLayoutSwitchObserver;
|
|
41 |
class CMPXCommonUiHelper;
|
|
42 |
class CMPXButtonManager;
|
|
43 |
class MMPXPlaybackViewLayout;
|
|
44 |
|
|
45 |
// CLASS DECLARATION
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Container class for audio view.
|
|
49 |
*
|
|
50 |
* @lib mpxplaybackview.lib
|
|
51 |
* @since S60 v3.0
|
|
52 |
*/
|
|
53 |
class CMPXCommonPlaybackViewContainer : public CCoeControl,
|
|
54 |
public MMPXAlbumArtUtilObserver,
|
|
55 |
public MMPXButtonCmdObserver,
|
|
56 |
public MHWRMLightObserver
|
|
57 |
{
|
|
58 |
public:
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Symbian 2nd phase constructor.
|
|
62 |
*
|
|
63 |
* @param aRect Frame rectangle for container.
|
|
64 |
*/
|
|
65 |
IMPORT_C virtual void ConstructL( const TRect& aRect );
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Destructor.
|
|
69 |
*/
|
|
70 |
IMPORT_C virtual ~CMPXCommonPlaybackViewContainer();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Updates time indicators.
|
|
74 |
*
|
|
75 |
* @since S60 3.0
|
|
76 |
* @param aPlaybackPosInSeconds, New playback postions
|
|
77 |
* @param aTotalLengthInSeconds, Clips duration
|
|
78 |
*/
|
|
79 |
IMPORT_C virtual void UpdateTimeIndicatorsL(
|
|
80 |
TInt aPlaybackPosInSeconds,
|
|
81 |
TInt aTotalLengthInSeconds );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Updates label
|
|
85 |
*
|
|
86 |
* @since S60 3.0
|
|
87 |
* @param aLabel Label which is updated
|
|
88 |
* @param aText New text value
|
|
89 |
*/
|
|
90 |
IMPORT_C virtual void UpdateLabelL(
|
|
91 |
TMPXPbvTextIndicator aLabel,
|
|
92 |
const TDesC& aText );
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Sets main pane mode.
|
|
96 |
*
|
|
97 |
* @since S60 3.0
|
|
98 |
* @param aMode Playback mode.
|
|
99 |
*/
|
|
100 |
IMPORT_C virtual void SetMode( TMPXPbvPlaybackMode aMode );
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Set random mode.
|
|
104 |
*
|
|
105 |
* @since S60 3.0
|
|
106 |
* @param aRandomMode ETrue if random is on.
|
|
107 |
*/
|
|
108 |
IMPORT_C virtual void SetRandomMode( TBool aRandomMode );
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Set repeat mode.
|
|
112 |
*
|
|
113 |
* @since S60 3.0
|
|
114 |
* @param aRepeatAll ETrue if repeat all is on.
|
|
115 |
* @param aRepeatOne ETrue if repeat one is on.
|
|
116 |
*/
|
|
117 |
IMPORT_C virtual void SetRepeatMode(
|
|
118 |
TBool aRepeatAll,
|
|
119 |
TBool aRepeatOne );
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Set Real Audio mode.
|
|
123 |
*
|
|
124 |
* @since S60 3.2
|
|
125 |
* @param aRealAudioMode ETrue if a Real Audio file is being played.
|
|
126 |
*/
|
|
127 |
IMPORT_C virtual void SetRealAudioMode( TBool aRealAudioMode );
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Update buttons according to current state.
|
|
131 |
*
|
|
132 |
* @since 3.0
|
|
133 |
*/
|
|
134 |
IMPORT_C virtual void UpdateButtons( TMPXPlaybackState aState );
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Set layout for all elements and set sizes for icons.
|
|
138 |
*
|
|
139 |
* @since S60 3.0
|
|
140 |
*/
|
|
141 |
IMPORT_C virtual void UpdateLayout();
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Updates duration label.
|
|
145 |
*
|
|
146 |
* @since S60 3.0
|
|
147 |
* @param aTotalLengthInSeconds, Clips duration
|
|
148 |
*/
|
|
149 |
IMPORT_C virtual void UpdateDurationLabelL( TInt aTotalLengthInSeconds );
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Force softkey label colors to what is specified in skin
|
|
153 |
* for Music Player soft keys.
|
|
154 |
*
|
|
155 |
* @since S60 3.0
|
|
156 |
*/
|
|
157 |
IMPORT_C virtual void UpdateSoftkeyColors();
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Handles foreground events
|
|
161 |
*
|
|
162 |
* @since S60 3.0
|
|
163 |
* @param aForeground ETrue if app is going to foreground, EFalse otherwise
|
|
164 |
*/
|
|
165 |
IMPORT_C virtual void HandleForegroundEventL( TBool aForeground );
|
|
166 |
|
|
167 |
// from base class MMPXAlbumArtUtilObserver
|
|
168 |
|
|
169 |
/**
|
|
170 |
* From MMPXAlbumArtUtilObserver.
|
|
171 |
* Notify that extraction of album art started.
|
|
172 |
*/
|
|
173 |
IMPORT_C virtual void ExtractAlbumArtStarted();
|
|
174 |
|
|
175 |
/**
|
|
176 |
* From MMPXAlbumArtUtilObserver.
|
|
177 |
* Album art is extracted from file and ready to use.
|
|
178 |
*
|
|
179 |
* @param aBitmap a converted image. Ownership is transferred.
|
|
180 |
* @param aErr error code
|
|
181 |
*/
|
|
182 |
IMPORT_C virtual void ExtractAlbumArtCompleted(
|
|
183 |
CFbsBitmap* aBitmap,
|
|
184 |
TInt aErr );
|
|
185 |
|
|
186 |
// from base class CoeControl
|
|
187 |
|
|
188 |
/**
|
|
189 |
* From CoeControl.
|
|
190 |
* Handles key events.
|
|
191 |
*
|
|
192 |
* @param aKeyEvent The key event.
|
|
193 |
* @param aType The type of key event.
|
|
194 |
*/
|
|
195 |
IMPORT_C virtual TKeyResponse OfferKeyEventL(
|
|
196 |
const TKeyEvent& aKeyEvent,
|
|
197 |
TEventCode aType );
|
|
198 |
|
|
199 |
/**
|
|
200 |
* From CoeControl.
|
|
201 |
* Handles a change to the control's resources.
|
|
202 |
*
|
|
203 |
* @param aType A message UID value.
|
|
204 |
*/
|
|
205 |
IMPORT_C virtual void HandleResourceChange( TInt aType );
|
|
206 |
|
|
207 |
/**
|
|
208 |
* From CoeControl.
|
|
209 |
* Gets the control's help context.
|
|
210 |
*
|
|
211 |
* @param aContext The control's help context.
|
|
212 |
*/
|
|
213 |
IMPORT_C virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Starts marquee for a playback label
|
|
217 |
*
|
|
218 |
* @param aLabel Label to start marquee
|
|
219 |
*/
|
|
220 |
IMPORT_C virtual void StartMarquee( TMPXPbvTextIndicator aLabel );
|
|
221 |
|
|
222 |
protected:
|
|
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Creates labels.
|
|
231 |
*/
|
|
232 |
IMPORT_C virtual void CreateLabelsL();
|
|
233 |
|
|
234 |
/**
|
|
235 |
* Creates icons.
|
|
236 |
* Any subclass which overrides this must call this base class method
|
|
237 |
* first or else the common icons will not be created.
|
|
238 |
*/
|
|
239 |
IMPORT_C virtual void CreateIconsL();
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Deletes all icon objects.
|
|
243 |
*/
|
|
244 |
IMPORT_C void FreeIcons();
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Draw an icon
|
|
248 |
*
|
|
249 |
* @since 3.0
|
|
250 |
* @param aGc Graphics context to draw to
|
|
251 |
* @param aDirtyRect Part of the screen that needs redrawing
|
|
252 |
* @param aIndicatorRect Position for the icon
|
|
253 |
* @param aIcon Icon and mask
|
|
254 |
* @param aInvertMask Invert mask (see CBitmapContext::BitBltMasked)
|
|
255 |
*/
|
|
256 |
IMPORT_C virtual void DrawIndicator(
|
|
257 |
CWindowGc& aGc ,
|
|
258 |
const TRect& aDirtyRect,
|
|
259 |
const TRect& aIndicatorRect,
|
|
260 |
const CGulIcon* aIcon,
|
|
261 |
TBool aInvertMask = ETrue ) const;
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Redraw part of the screen to the bitmap context.
|
|
265 |
*
|
|
266 |
* @param aRect Area to be redrawn.
|
|
267 |
*
|
|
268 |
*/
|
|
269 |
IMPORT_C virtual void RedrawRect(
|
|
270 |
const TRect& aRect) const;
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Update progress bar graphics based on current playback
|
|
274 |
* and download position.
|
|
275 |
*/
|
|
276 |
IMPORT_C virtual void UpdateProgressBarGraphics();
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Update progress bar graphics and redraw.
|
|
280 |
* Refresh happens only when backlight is ON and
|
|
281 |
* UI is in foreground.
|
|
282 |
* Note: Some display types may not need backlight. In that case
|
|
283 |
* code may need to be adjusted accordingly.
|
|
284 |
*/
|
|
285 |
IMPORT_C virtual void RefreshProgressBar();
|
|
286 |
|
|
287 |
/**
|
|
288 |
* Update label text color according to skin
|
|
289 |
*/
|
|
290 |
IMPORT_C virtual void UpdateLabelColorsL();
|
|
291 |
|
|
292 |
/**
|
|
293 |
* Update skin control context for background
|
|
294 |
*
|
|
295 |
* @param aRect Area to be updated.
|
|
296 |
*/
|
|
297 |
IMPORT_C virtual void UpdateBackgroundSkinControlContext( const TRect& aRect );
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Set FMTX mode.
|
|
301 |
*
|
|
302 |
* @since S60 3.2
|
|
303 |
* @param aFMTXMode ETrue if the view supports FMTX label.
|
|
304 |
*/
|
|
305 |
IMPORT_C virtual void SetFMTXMode( TBool aFMTXMode );
|
|
306 |
|
|
307 |
// from base class CoeControl
|
|
308 |
|
|
309 |
/**
|
|
310 |
* From CCoeControl.
|
|
311 |
* Responds to changes to the size and position of the contents of this
|
|
312 |
* control.
|
|
313 |
*/
|
|
314 |
IMPORT_C virtual void SizeChanged();
|
|
315 |
|
|
316 |
/**
|
|
317 |
* From CCoeControl.
|
|
318 |
* Gets the number of controls contained in a compound control.
|
|
319 |
*
|
|
320 |
* @return The number of component controls contained by this control.
|
|
321 |
*/
|
|
322 |
IMPORT_C virtual TInt CountComponentControls() const;
|
|
323 |
|
|
324 |
/**
|
|
325 |
* From CCoeControl.
|
|
326 |
* Gets an indexed component of a compound control.
|
|
327 |
*
|
|
328 |
* @param aIndex The index of the control.
|
|
329 |
* @return The component control with an index of aIndex.
|
|
330 |
*/
|
|
331 |
IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
332 |
|
|
333 |
/**
|
|
334 |
* From CCoeControl.
|
|
335 |
* Draws the control.
|
|
336 |
*
|
|
337 |
* @param aRect The rectangular region of the control to be drawn.
|
|
338 |
*/
|
|
339 |
IMPORT_C virtual void Draw( const TRect& aRect ) const;
|
|
340 |
|
|
341 |
// from base class MMPXButtonCmdObserver
|
|
342 |
|
|
343 |
/**
|
|
344 |
* From MMPXButtonCmdObserver
|
|
345 |
* Handle a button command.
|
|
346 |
* @param aCommand Command id, as specified in the button constructor.
|
|
347 |
*/
|
|
348 |
IMPORT_C virtual void HandleButtonCommandL( TInt aCommand );
|
|
349 |
|
|
350 |
/**
|
|
351 |
* From CCoeControl.
|
|
352 |
* Handle events from the touch screen
|
|
353 |
* since 5.0
|
|
354 |
*/
|
|
355 |
IMPORT_C virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
356 |
|
|
357 |
public:
|
|
358 |
|
|
359 |
/**
|
|
360 |
* Gets song position (from touch progress bar)
|
|
361 |
* since 5.0
|
|
362 |
*/
|
|
363 |
IMPORT_C virtual TInt GetNewSongPosition();
|
|
364 |
|
|
365 |
/**
|
|
366 |
* Sets song position (from currently playback position)
|
|
367 |
* since 5.0
|
|
368 |
*/
|
|
369 |
void SetNewSongPosition( const TInt64& aPositon );
|
|
370 |
|
|
371 |
/**
|
|
372 |
* From MBacklightControlObserver.
|
|
373 |
* Callback for change in backlight status
|
|
374 |
*
|
|
375 |
* @param aTarget The target of light change event; keypad, screen or both
|
|
376 |
* @param aStatus New status of the target
|
|
377 |
*/
|
|
378 |
IMPORT_C virtual void LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus );
|
|
379 |
|
|
380 |
/**
|
|
381 |
* Restore Buttons' state in some special case
|
|
382 |
*
|
|
383 |
* @since S60 3.0
|
|
384 |
*/
|
|
385 |
void RestoreButtons( TMPXPlaybackState aState );
|
|
386 |
|
|
387 |
TInt CallSetPosition();
|
|
388 |
|
|
389 |
static TInt CallSetPosition( TAny* aAny );
|
|
390 |
|
|
391 |
/**
|
|
392 |
* Sets the ordinal position of a window.
|
|
393 |
*
|
|
394 |
* @param aNewOrdinalPosition The window's new ordinal position
|
|
395 |
*
|
|
396 |
* @since S60 3.0
|
|
397 |
*/
|
|
398 |
void AdjustOrdinalPosition( TInt aNewOrdinalPosition );
|
|
399 |
|
|
400 |
/**
|
|
401 |
* Records the transition animation begin state.
|
|
402 |
*/
|
|
403 |
void BeginTransition();
|
|
404 |
|
|
405 |
/**
|
|
406 |
* Mark the end state. Triggers the transtition.
|
|
407 |
*/
|
|
408 |
void EndTransition();
|
|
409 |
|
|
410 |
/**
|
|
411 |
* Sets the transtition type for animation.
|
|
412 |
*/
|
|
413 |
void SetTransitionType( TTransitionType aTransitionType );
|
|
414 |
|
|
415 |
private:
|
|
416 |
|
|
417 |
/**
|
|
418 |
* Set layout for all elements and set sizes for icons.
|
|
419 |
*/
|
|
420 |
void DoUpdateLayoutL();
|
|
421 |
|
|
422 |
|
|
423 |
|
|
424 |
protected: // data
|
|
425 |
|
|
426 |
MEikCommandObserver* iCommandObserver; // not owned
|
|
427 |
MMPXLayoutSwitchObserver* iLayoutObserver; // not owned
|
|
428 |
RPointerArray<CMPXPlaybackViewInfoLabel> iLabels; // owned
|
|
429 |
|
|
430 |
|
|
431 |
|
|
432 |
|
|
433 |
|
|
434 |
HBufC* iMinSecFormatString; // owned
|
|
435 |
HBufC* iShortFormatString; // owned
|
|
436 |
|
|
437 |
CGulIcon* iPlayIcon; // owned
|
|
438 |
CGulIcon* iPauseIcon; // owned
|
|
439 |
CGulIcon* iRandomIcon; // owned
|
|
440 |
CGulIcon* iRepeatOneIcon; // owned
|
|
441 |
CGulIcon* iRepeatAllIcon; // owned
|
|
442 |
|
|
443 |
CGulIcon* iDownloadSlider; // owned
|
|
444 |
CGulIcon* iPlaybackSlider; // owned
|
|
445 |
CGulIcon* iSliderBackground; // owned
|
|
446 |
|
|
447 |
CGulIcon* iDefaultAlbumArt; // owned
|
|
448 |
CFbsBitmap* iTrackAlbumArt; // owned
|
|
449 |
|
|
450 |
#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
|
|
451 |
CGulIcon* iRealIcon; // owned
|
|
452 |
#endif
|
|
453 |
|
|
454 |
MAknsControlContext* iBackground; // owned
|
|
455 |
|
|
456 |
CMPXCommonUiHelper* iCommonUiHelper; // owned
|
|
457 |
|
|
458 |
TRect iBackgroundLayout;
|
|
459 |
TRect iIconLayout;
|
|
460 |
TRect iRandomIconRect;
|
|
461 |
TRect iRepeatIconRect;
|
|
462 |
TRect iSliderPaneRect;
|
|
463 |
TRect iSliderBackgroundRect;
|
|
464 |
TRect iPlaybackSliderRect;
|
|
465 |
TRect iDownloadSliderRect;
|
|
466 |
TRect iAlbumArtRect;
|
|
467 |
#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
|
|
468 |
TRect iRealIconRect;
|
|
469 |
#endif
|
|
470 |
|
|
471 |
TMPXPbvPlaybackMode iMode;
|
|
472 |
|
|
473 |
TBool iRepeatAllMode;
|
|
474 |
TBool iRepeatOneMode;
|
|
475 |
TBool iRandomMode;
|
|
476 |
#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
|
|
477 |
TBool iRealAudioMode;
|
|
478 |
#endif
|
|
479 |
TBool iFMTXMode;
|
|
480 |
|
|
481 |
TRect iCurrentLayout;
|
|
482 |
|
|
483 |
// Progress bar position - download
|
|
484 |
TReal iDownloadRatio;
|
|
485 |
|
|
486 |
// Progress bar position - playback
|
|
487 |
TReal iPlaybackRatio;
|
|
488 |
|
|
489 |
TBool iEqualizerEnabled;
|
|
490 |
TBool iEnableButtons;
|
|
491 |
TBool iEnableVolumeIndicator;
|
|
492 |
TBool iEnableMarquee;
|
|
493 |
TBool iDisplayAlbumArt;
|
|
494 |
TBool iPrerollCompleted;
|
|
495 |
|
|
496 |
CMPXButtonManager* iButtonManager; // owned
|
|
497 |
CIdle* iIdle;
|
|
498 |
TInt iIdleTaskCompleted;
|
|
499 |
MMPXPlaybackViewLayout* iLayout; // not owned
|
|
500 |
CPeriodic* iSeekTimer;
|
|
501 |
|
|
502 |
TInt iTrackTotalLengthInSeconds;
|
|
503 |
TInt64 iNewSongPosition; // Final position from touch progress bar
|
|
504 |
TBool iTouchDown; // Flag indicating touch progress bar is in use
|
|
505 |
TBool iActiveView;
|
|
506 |
|
|
507 |
TBool iIsForeground;
|
|
508 |
CHWRMLight::TLightStatus iLightStatus;
|
|
509 |
CHWRMLight *iLight;
|
|
510 |
|
|
511 |
TBool iDragProgressBar; //Flag drag progress bar
|
|
512 |
TTransitionType iTransitionType; // Transition direction
|
|
513 |
};
|
|
514 |
|
|
515 |
#endif // CMPXCOMMONPLAYBACKVIEWCONTAINER_H
|
|
516 |
|
|
517 |
// End of File
|