|
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 Upnp Playback view's container. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include <AknDef.h> |
|
23 #include <AknsUtils.h> |
|
24 #include <gulicon.h> |
|
25 #include <mpxconstants.h> |
|
26 #include <aknnotewrappers.h> // error note |
|
27 #include <StringLoader.h> |
|
28 #include <mpxcommonplaybackview.rsg> |
|
29 #include "mpxupnpplaybackview.hlp.hrh" |
|
30 #include "mpxupnpplaybackviewcontainer.h" |
|
31 #include "mpxplaybackviewlayoutinterface.h" |
|
32 #include "mpxcommonplaybackview.hrh" // playback command |
|
33 #include "mpxlog.h" |
|
34 |
|
35 |
|
36 // ======== MEMBER FUNCTIONS ======== |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // C++ default constructor can NOT contain any code, that |
|
40 // might leave. |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CMPXUPnPPlaybackViewContainer::CMPXUPnPPlaybackViewContainer( |
|
44 MEikCommandObserver* aCommandObserver, |
|
45 MMPXLayoutSwitchObserver* aLayoutObserver, |
|
46 MMPXPlaybackViewLayout* aLayout ) |
|
47 { |
|
48 iCommandObserver = aCommandObserver; |
|
49 iLayoutObserver = aLayoutObserver; |
|
50 iMode = EUninitialized; |
|
51 iLayout = aLayout; |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // Symbian 2nd phase constructor can leave. |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 void CMPXUPnPPlaybackViewContainer::ConstructL( const TRect& aRect ) |
|
59 { |
|
60 MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::ConstructL() entering" ); |
|
61 |
|
62 CMPXCommonPlaybackViewContainer::ConstructL( aRect ); |
|
63 |
|
64 // TEMPORARY |
|
65 iRemotePlayerUsed = ETrue; |
|
66 |
|
67 // Disables FMTX label |
|
68 SetFMTXMode(EFalse); |
|
69 |
|
70 MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::ConstructL() exiting" ); |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // Destructor |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CMPXUPnPPlaybackViewContainer::~CMPXUPnPPlaybackViewContainer() |
|
78 { |
|
79 delete iRemotePlayerIcon; |
|
80 } |
|
81 |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Set layout for all elements and set sizes for icons. |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 void CMPXUPnPPlaybackViewContainer::UpdateLayout() |
|
88 { |
|
89 MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::UpdateLayout() entering" ); |
|
90 |
|
91 CMPXCommonPlaybackViewContainer::UpdateLayout(); |
|
92 |
|
93 iRemotePlayerIconRect = iLayout->IndicatorLayout( Rect(), EIconRemotePlayer ); |
|
94 |
|
95 if ( iRemotePlayerIcon ) |
|
96 { |
|
97 AknIconUtils::SetSize( |
|
98 iRemotePlayerIcon->Bitmap(), iRemotePlayerIconRect.Size() ); |
|
99 } |
|
100 |
|
101 MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::UpdateLayout() exiting" ); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // From CCoeControl |
|
106 // Handles key events. |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 TKeyResponse CMPXUPnPPlaybackViewContainer::OfferKeyEventL( |
|
110 const TKeyEvent& aKeyEvent, |
|
111 TEventCode aType ) |
|
112 { |
|
113 MPX_DEBUG4( "CMPXUPnPPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)", |
|
114 aKeyEvent.iCode, aKeyEvent.iScanCode, aType ); |
|
115 |
|
116 if ( ( iLastKeyEvent.iScanCode == aKeyEvent.iScanCode ) && |
|
117 ( iLastKeyType == aType ) && |
|
118 ( iLastKeyType == EEventKeyUp ) ) |
|
119 { |
|
120 return EKeyWasConsumed; |
|
121 } |
|
122 else |
|
123 { |
|
124 iLastKeyEvent = aKeyEvent; |
|
125 iLastKeyType = aType; |
|
126 |
|
127 return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType ); |
|
128 } |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // From CCoeControl |
|
133 // Gets the control's help context. |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void CMPXUPnPPlaybackViewContainer::GetHelpContext( |
|
137 TCoeHelpContext& aContext ) const |
|
138 { |
|
139 aContext.iMajor = KAppUidMusicPlayerX; |
|
140 aContext.iContext = KMUS_HLP_UPNP_PLAYBACK_VIEW; |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // Creates icons. |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 void CMPXUPnPPlaybackViewContainer::CreateIconsL() |
|
148 { |
|
149 CMPXCommonPlaybackViewContainer::CreateIconsL(); |
|
150 |
|
151 delete iRemotePlayerIcon; |
|
152 iRemotePlayerIcon = NULL; |
|
153 |
|
154 // Remote Player |
|
155 iRemotePlayerIcon = iLayout->GetIndicatorIconMaskL( EIconRemotePlayer ); |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // Redraw part of the screen. |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 void CMPXUPnPPlaybackViewContainer::RedrawRect( |
|
163 const TRect& aRect, |
|
164 CBitmapContext& aGc) const |
|
165 { |
|
166 CMPXCommonPlaybackViewContainer::RedrawRect( aRect, aGc ); |
|
167 |
|
168 if ( iRemotePlayerUsed ) |
|
169 { |
|
170 DrawIndicator( aGc, aRect, iRemotePlayerIconRect, iRemotePlayerIcon ); |
|
171 } |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CMPXUPnPPlaybackViewContainer::HandleButtonCommandL |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 void CMPXUPnPPlaybackViewContainer::HandleButtonCommandL( TInt aCommand ) |
|
179 { |
|
180 MPX_DEBUG2("CMPXUPnPPlaybackViewContainer::HandleButtonCommandL(%d) entering", aCommand); |
|
181 |
|
182 switch (aCommand) |
|
183 { |
|
184 case EMPXPbvCmdSeekForward: |
|
185 case EMPXPbvCmdSeekBackward: |
|
186 { |
|
187 HBufC* dialogText = StringLoader::LoadLC(R_MPX_MEDIA_KEYS_NOT_SUPPORTED); |
|
188 CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue); |
|
189 errNote->ExecuteLD( *dialogText ); |
|
190 CleanupStack::PopAndDestroy( dialogText ); |
|
191 |
|
192 // The error note consumed the up key event so it needs |
|
193 //to be sent again |
|
194 if ( iLastKeyType != EEventKeyUp ) |
|
195 { |
|
196 iLastKeyType = EEventKeyUp; |
|
197 CMPXCommonPlaybackViewContainer::OfferKeyEventL( iLastKeyEvent, |
|
198 EEventKeyUp ); |
|
199 } |
|
200 break; |
|
201 } |
|
202 case EMPXPbvCmdEndSeek: |
|
203 { |
|
204 // not used/forwarded |
|
205 break; |
|
206 } |
|
207 default: |
|
208 { |
|
209 CMPXCommonPlaybackViewContainer::HandleButtonCommandL( aCommand ); |
|
210 break; |
|
211 } |
|
212 } |
|
213 MPX_DEBUG1("CMPXUPnPPlaybackViewContainer::HandleButtonCommandL() exiting"); |
|
214 } |
|
215 |
|
216 // End of File |