|
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: Implementation of Progressive Download Playback view's container. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include <AknDef.h> |
|
23 #include <gulicon.h> |
|
24 |
|
25 #include "mpxconstants.h" |
|
26 #include "mpxpdplaybackview.hlp.hrh" |
|
27 #include "mpxplaybackviewinfolabel.h" |
|
28 #include "mpxpdplaybackviewcontainer.h" |
|
29 #include "mpxplaybackviewlayoutinterface.h" |
|
30 #include "mpxlog.h" |
|
31 |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // C++ default constructor can NOT contain any code, that |
|
37 // might leave. |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CMPXPdPlaybackViewContainer::CMPXPdPlaybackViewContainer( |
|
41 MEikCommandObserver* aCommandObserver, |
|
42 MMPXLayoutSwitchObserver* aLayoutObserver, |
|
43 MMPXPlaybackViewLayout* aLayout ) |
|
44 { |
|
45 iCommandObserver = aCommandObserver; |
|
46 iLayoutObserver = aLayoutObserver; |
|
47 iMode = EUninitialized; |
|
48 iLayout = aLayout; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // Symbian 2nd phase constructor can leave. |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CMPXPdPlaybackViewContainer::ConstructL( const TRect& aRect ) |
|
56 { |
|
57 MPX_DEBUG1( "CMPXPdPlaybackViewContainer::ConstructL() entering" ); |
|
58 |
|
59 CMPXCommonPlaybackViewContainer::ConstructL( aRect ); |
|
60 |
|
61 MPX_DEBUG1( "CMPXPdPlaybackViewContainer::ConstructL() exiting" ); |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // Destructor |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CMPXPdPlaybackViewContainer::~CMPXPdPlaybackViewContainer() |
|
69 { |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CMPXPdPlaybackViewContainer::HandlePointerEventL |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CMPXPdPlaybackViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
77 { |
|
78 //Handles the touch events, except for sliderpane. |
|
79 if ( (!iSliderPaneRect.Contains(aPointerEvent.iPosition) ) ) |
|
80 { |
|
81 CMPXCommonPlaybackViewContainer::HandlePointerEventL(aPointerEvent); |
|
82 } |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // Handles when the download position has changed |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void CMPXPdPlaybackViewContainer::HandleDownloadPositionChanged( |
|
90 TInt aDownloadedBytes, |
|
91 TInt aTotalBytes ) |
|
92 { |
|
93 MPX_DEBUG3("CMPXPdPlaybackViewContainer::HandleDownloadPositionChanged(%d, %d) entering", |
|
94 aDownloadedBytes, |
|
95 aTotalBytes); |
|
96 |
|
97 if (aTotalBytes) |
|
98 { |
|
99 TReal t = aTotalBytes; |
|
100 iDownloadRatio = aDownloadedBytes / t; |
|
101 |
|
102 RefreshProgressBar(); |
|
103 } |
|
104 |
|
105 MPX_DEBUG1("CMPXPdPlaybackViewContainer::HandleDownloadPositionChanged() exiting"); |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // Redraw part of the screen. |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void CMPXPdPlaybackViewContainer::RedrawRect( |
|
113 const TRect& aRect, |
|
114 CBitmapContext& aGc) const |
|
115 { |
|
116 MPX_DEBUG1("CMPXPdPlaybackViewContainer::RedrawRect() entering"); |
|
117 |
|
118 CMPXCommonPlaybackViewContainer::RedrawRect( aRect, aGc ); |
|
119 |
|
120 // Always show progress bars in progressive download |
|
121 DrawIndicator( aGc, aRect, iSliderBackgroundRect, iSliderBackground ); |
|
122 DrawIndicator( aGc, |
|
123 aRect, |
|
124 TRect(iDownloadSliderRect.iTl, |
|
125 iDownloadSlider->Bitmap()->SizeInPixels()), |
|
126 iDownloadSlider ); |
|
127 DrawIndicator( aGc, |
|
128 aRect, |
|
129 TRect(iPlaybackSliderRect.iTl, |
|
130 iPlaybackSlider->Bitmap()->SizeInPixels()), |
|
131 iPlaybackSlider ); |
|
132 |
|
133 MPX_DEBUG1("CMPXPdPlaybackViewContainer::RedrawRect() exiting"); |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // Sets main pane mode. |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 void CMPXPdPlaybackViewContainer::SetMode( TMPXPbvPlaybackMode aMode ) |
|
141 { |
|
142 MPX_DEBUG2("CMPXPdPlaybackViewContainer::SetMode(%d) entering", aMode); |
|
143 |
|
144 CMPXCommonPlaybackViewContainer::SetMode( aMode ); |
|
145 |
|
146 if ( ENoTracksMode != aMode ) |
|
147 { |
|
148 iLabels[ETextArtist]->MakeVisible( ETrue ); |
|
149 iLabels[ETextTrack]->MakeVisible( ETrue ); |
|
150 |
|
151 // Make sure download label is visible all the time |
|
152 iLabels[ETextDownloadState]->MakeVisible( ETrue ); |
|
153 |
|
154 // Make sure album art is visible all the time |
|
155 iDisplayAlbumArt = ETrue; |
|
156 } |
|
157 |
|
158 MPX_DEBUG1("CMPXPdPlaybackViewContainer::SetMode() exiting"); |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // Set layout for all elements and set sizes for icons. |
|
163 // --------------------------------------------------------------------------- |
|
164 // |
|
165 void CMPXPdPlaybackViewContainer::UpdateLayout() |
|
166 { |
|
167 MPX_DEBUG1( "CMPXPdPlaybackViewContainer::UpdateLayout() entering" ); |
|
168 |
|
169 CMPXCommonPlaybackViewContainer::UpdateLayout(); |
|
170 |
|
171 MPX_DEBUG1( "CMPXPdPlaybackViewContainer::UpdateLayout() exiting" ); |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // From CCoeControl |
|
176 // Handles key events. |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 TKeyResponse CMPXPdPlaybackViewContainer::OfferKeyEventL( |
|
180 const TKeyEvent& aKeyEvent, |
|
181 TEventCode aType ) |
|
182 { |
|
183 MPX_DEBUG4( "CMPXPdPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)", |
|
184 aKeyEvent.iCode, aKeyEvent.iScanCode, aType ); |
|
185 // No action for rocker left and right keys in progress download view |
|
186 if (aKeyEvent.iScanCode == EStdKeyLeftArrow || |
|
187 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
188 { |
|
189 return EKeyWasConsumed; |
|
190 } |
|
191 return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType ); |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // From CCoeControl |
|
196 // Gets the control's help context. |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 void CMPXPdPlaybackViewContainer::GetHelpContext( |
|
200 TCoeHelpContext& aContext ) const |
|
201 { |
|
202 aContext.iMajor = KAppUidMusicPlayerX; |
|
203 aContext.iContext = KMUS_HLP_EMBED_MUSIC_SHOP; |
|
204 } |
|
205 |
|
206 |
|
207 // End of File |