|
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: Music Player UPnP Playback dialog implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <AknUtils.h> |
|
22 #include <eiklabel.h> |
|
23 #include <StringLoader.h> |
|
24 #include <AknsDrawUtils.h> |
|
25 #include <AknsBasicBackgroundControlContext.h> |
|
26 #include <AknsUtils.h> |
|
27 #include <gulicon.h> |
|
28 |
|
29 #include <mpxupnpplaybackdialog.rsg> |
|
30 |
|
31 #include "mpxupnpplaybackdialogcustomcontrol.h" |
|
32 #include "mpxplaybackviewlayoutinterface.h" |
|
33 #include "mpxlog.h" |
|
34 |
|
35 |
|
36 // ============================ MEMBER FUNCTIONS =============================== |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CMPXUPnPPlaybackDialogCustomControl::NewLC |
|
40 // Two-phased constructor. |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CMPXUPnPPlaybackDialogCustomControl* |
|
44 CMPXUPnPPlaybackDialogCustomControl::NewLC( |
|
45 const CCoeControl& aParent, |
|
46 const TRect &aRect, |
|
47 MEikCommandObserver* aCommandObserver, |
|
48 MMPXLayoutSwitchObserver* aLayoutObserver, |
|
49 MMPXPlaybackViewLayout* aLayout, |
|
50 TMPXPlaybackPlayerType aCurrentPlayerType ) |
|
51 { |
|
52 MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::NewLC" ); |
|
53 CMPXUPnPPlaybackDialogCustomControl* self = |
|
54 new ( ELeave ) CMPXUPnPPlaybackDialogCustomControl( aCommandObserver, |
|
55 aLayoutObserver, |
|
56 aLayout); |
|
57 CleanupStack::PushL( self ); |
|
58 self->ConstructL( aParent, aRect, aCurrentPlayerType ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CMPXUPnPPlaybackDialogCustomControl::NewL |
|
64 // Two-phased constructor. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CMPXUPnPPlaybackDialogCustomControl* |
|
68 CMPXUPnPPlaybackDialogCustomControl::NewL( |
|
69 const CCoeControl& aParent, |
|
70 const TRect &aRect, |
|
71 MEikCommandObserver* aCommandObserver, |
|
72 MMPXLayoutSwitchObserver* aLayoutObserver, |
|
73 MMPXPlaybackViewLayout* aLayout, |
|
74 TMPXPlaybackPlayerType aCurrentPlayerType) |
|
75 { |
|
76 MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::NewL" ); |
|
77 CMPXUPnPPlaybackDialogCustomControl* self = NewLC( |
|
78 aParent, aRect, aCommandObserver, aLayoutObserver, aLayout, aCurrentPlayerType ); |
|
79 CleanupStack::Pop( self ); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // Destructor |
|
84 CMPXUPnPPlaybackDialogCustomControl::~CMPXUPnPPlaybackDialogCustomControl() |
|
85 { |
|
86 MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::~CMPXUPnPPlaybackDialogCustomControl" ); |
|
87 delete iBackground; |
|
88 |
|
89 delete iRemotePlayerIcon; |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CMPXUPnPPlaybackDialogCustomControl::CMPXUPnPPlaybackDialogCustomControl |
|
94 // C++ default constructor can NOT contain any code, that |
|
95 // might leave. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CMPXUPnPPlaybackDialogCustomControl::CMPXUPnPPlaybackDialogCustomControl( |
|
99 MEikCommandObserver* aCommandObserver, |
|
100 MMPXLayoutSwitchObserver* aLayoutObserver, |
|
101 MMPXPlaybackViewLayout* aLayout ) |
|
102 { |
|
103 iCommandObserver = aCommandObserver; |
|
104 iLayoutObserver = aLayoutObserver; |
|
105 iMode = EUninitialized; |
|
106 iLayout = aLayout; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CMPXUPnPPlaybackDialogCustomControl::ConstructL |
|
111 // Symbian 2nd phase constructor can leave. |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 void CMPXUPnPPlaybackDialogCustomControl::ConstructL( |
|
115 const CCoeControl& aParent, |
|
116 const TRect &aRect, |
|
117 TMPXPlaybackPlayerType aCurrentPlayerType ) |
|
118 { |
|
119 MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::ConstructL" ); |
|
120 |
|
121 CMPXCommonPlaybackViewContainer::ConstructL( aRect ); |
|
122 |
|
123 if ( aCurrentPlayerType != EPbLocal ) |
|
124 { |
|
125 iRemotePlayerUsed = ETrue; |
|
126 } |
|
127 |
|
128 // Disables FMTX label |
|
129 SetFMTXMode(EFalse); |
|
130 |
|
131 SetMopParent( const_cast < CCoeControl* >( &aParent ) ); |
|
132 |
|
133 |
|
134 SetRect( aRect ); |
|
135 ActivateL(); |
|
136 MakeVisible( ETrue ); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // Set layout for all elements and set sizes for icons. |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CMPXUPnPPlaybackDialogCustomControl::UpdateLayout() |
|
144 { |
|
145 MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::UpdateLayout()" ); |
|
146 |
|
147 CMPXCommonPlaybackViewContainer::UpdateLayout(); |
|
148 |
|
149 iRemotePlayerIconRect = iLayout->IndicatorLayout( Rect(), EIconRemotePlayer ); |
|
150 |
|
151 if ( iRemotePlayerIcon ) |
|
152 { |
|
153 AknIconUtils::SetSize( |
|
154 iRemotePlayerIcon->Bitmap(), iRemotePlayerIconRect.Size() ); |
|
155 } |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // From CCoeControl |
|
160 // Handles key events. |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 TKeyResponse CMPXUPnPPlaybackDialogCustomControl::OfferKeyEventL( |
|
164 const TKeyEvent& aKeyEvent, |
|
165 TEventCode aType ) |
|
166 { |
|
167 MPX_DEBUG4( "CMPXUPnPPlaybackDialogCustomControl::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)", |
|
168 aKeyEvent.iCode, aKeyEvent.iScanCode, aType ); |
|
169 |
|
170 return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType ); |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // Creates icons. |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 void CMPXUPnPPlaybackDialogCustomControl::CreateIconsL() |
|
178 { |
|
179 CMPXCommonPlaybackViewContainer::CreateIconsL(); |
|
180 |
|
181 // Remote Player |
|
182 delete iRemotePlayerIcon; |
|
183 iRemotePlayerIcon = NULL; |
|
184 iRemotePlayerIcon = iLayout->GetIndicatorIconMaskL( EIconRemotePlayer ); |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // Redraw part of the screen. |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 void CMPXUPnPPlaybackDialogCustomControl::RedrawRect( |
|
192 const TRect& aRect, |
|
193 CBitmapContext& aGc) const |
|
194 { |
|
195 CMPXCommonPlaybackViewContainer::RedrawRect( aRect, aGc ); |
|
196 |
|
197 if ( iRemotePlayerUsed ) |
|
198 { |
|
199 DrawIndicator( aGc, aRect, iRemotePlayerIconRect, iRemotePlayerIcon ); |
|
200 } |
|
201 } |
|
202 |
|
203 // End of File |