|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: View class for Streaming list view.* |
|
15 */ |
|
16 |
|
17 |
|
18 // Version : %version: 6 % |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <avkon.hrh> |
|
24 #include <aknViewAppUi.h> |
|
25 #include <eikmenup.h> |
|
26 #include <featmgr.h> |
|
27 #include <akntabgrp.h> |
|
28 #include <barsread.h> |
|
29 #include <MediaSettings.rsg> |
|
30 #include <calslbs.h> |
|
31 #include <gstabhelper.h> |
|
32 #include <hlplch.h> // For HlpLauncher |
|
33 #include "mediasettings.hrh" |
|
34 #include "GSVideoPlugin.h" |
|
35 #include <mediasettings.mbg> |
|
36 #include "GSMediaPlayerStreamingView.h" |
|
37 #include "MPSettingsStreamingContainer.h" |
|
38 #include "MPSettingsConstants.h" |
|
39 #include "MPSettingsBaseView.h" |
|
40 #include "mpxlog.h" |
|
41 |
|
42 class CMPSettingsModelForROP; |
|
43 |
|
44 // CONSTANTS |
|
45 |
|
46 const TInt KMPSettProxyViewListItemId = 0; |
|
47 const TInt KMPSettNetworkViewListItemId = 1; |
|
48 |
|
49 // ================= MEMBER FUNCTIONS ======================= |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CGSMediaPlayerStreamingView::CGSMediaPlayerStreamingView |
|
53 // C++ default constructor can NOT contain any code, that |
|
54 // might leave. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CGSMediaPlayerStreamingView::CGSMediaPlayerStreamingView(CMPSettingsModelForROP* aModel, CArrayPtrFlat<MGSTabbedView>* /* aTabViewArray */ ) |
|
58 : iModel( aModel) |
|
59 { |
|
60 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::CGSMediaPlayerStreamingView()"); |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CGSMediaPlayerStreamingView::ConstructL(const TRect& aRect) |
|
65 // Symbian OS two-phased constructor |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 void CGSMediaPlayerStreamingView::ConstructL(CArrayPtrFlat<MGSTabbedView>* aTabViewArray) |
|
69 { |
|
70 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::ConstructL()"); |
|
71 iTabHelper = CGSTabHelper::NewL(); |
|
72 aTabViewArray->AppendL(this); |
|
73 BaseConstructL(R_GS_MPSETT_STREAMING_VIEW); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CGSMediaPlayerStreamingView::NewLC |
|
78 // Two-phased constructor. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CGSMediaPlayerStreamingView* CGSMediaPlayerStreamingView::NewLC(CMPSettingsModelForROP* aModel, CArrayPtrFlat<MGSTabbedView>* aTabViewArray) |
|
82 { |
|
83 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::NewLC()"); |
|
84 CGSMediaPlayerStreamingView* self = new(ELeave) CGSMediaPlayerStreamingView(aModel,aTabViewArray); |
|
85 |
|
86 CleanupStack::PushL(self); |
|
87 self->ConstructL( aTabViewArray ); |
|
88 |
|
89 return self; |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------- |
|
93 // CGSMediaPlayerStreamingView::~CGSMediaPlayerStreamingView |
|
94 // Destructor |
|
95 // --------------------------------------------------------- |
|
96 // |
|
97 CGSMediaPlayerStreamingView::~CGSMediaPlayerStreamingView() |
|
98 { |
|
99 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::~CGSMediaPlayerStreamingView()"); |
|
100 if ( iContainer ) |
|
101 { |
|
102 AppUi()->RemoveFromStack( iContainer ); |
|
103 delete iContainer; |
|
104 } |
|
105 delete iTabHelper; |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------- |
|
109 // TUid CGSMediaPlayerStreamingView::Id |
|
110 // --------------------------------------------------------- |
|
111 // |
|
112 TUid CGSMediaPlayerStreamingView::Id() const |
|
113 { |
|
114 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::Id()"); |
|
115 return KMPSettStreamingViewId; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------- |
|
119 // CGSMediaPlayerStreamingView::HandleCommandL |
|
120 // --------------------------------------------------------- |
|
121 // |
|
122 void CGSMediaPlayerStreamingView::HandleCommandL(TInt aCommand) |
|
123 { |
|
124 MPX_DEBUG2(_L("#MS# CGSMediaPlayerStreamingView::HandleCommandL(%d)"),aCommand); |
|
125 CGSVideoPlugin* parent = |
|
126 static_cast<CGSVideoPlugin*> ( |
|
127 AppUi()->View( KGSVideoPluginUid ) ); |
|
128 |
|
129 switch (aCommand) |
|
130 { |
|
131 case EMPSettCmdOpen: |
|
132 HandleListBoxSelectionL(); |
|
133 break; |
|
134 case EAknSoftkeyBack: |
|
135 parent->SetCurrentItem(EGSMediaSettingsStreamingIndex); |
|
136 parent->ResetSelectedItemIndex(); |
|
137 AppUi()->ActivateLocalViewL(KGSVideoPluginUid); |
|
138 break; |
|
139 case EMPSettCmdHelp: |
|
140 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
141 { |
|
142 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppUi()->AppHelpContextL() ); |
|
143 } |
|
144 break; |
|
145 default: |
|
146 AppUi()->HandleCommandL(aCommand); |
|
147 break; |
|
148 } |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // CGSMediaPlayerStreamingView::DoActivateL |
|
153 // Activate this view |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 void CGSMediaPlayerStreamingView::DoActivateL( const TVwsViewId& /* aPrevViewId */, |
|
157 TUid /*aCustomMessageId*/, |
|
158 const TDesC8& /*aCustomMessage*/ ) |
|
159 { |
|
160 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::DoActivateL()"); |
|
161 if( iContainer ) |
|
162 { |
|
163 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
164 delete iContainer; |
|
165 iContainer = NULL; |
|
166 } |
|
167 |
|
168 CreateContainerL(); |
|
169 AppUi()->AddToViewStackL( *this, iContainer ); |
|
170 |
|
171 CGSVideoPlugin* parent = |
|
172 static_cast<CGSVideoPlugin*> ( |
|
173 AppUi()->View( KGSVideoPluginUid ) ); |
|
174 |
|
175 if( parent ) |
|
176 { |
|
177 iTabHelper->CreateTabGroupL( Id(), |
|
178 static_cast<CArrayPtrFlat<MGSTabbedView> *> (parent->TabbedViews() ) ); |
|
179 } |
|
180 iContainer->SetRect( ClientRect() ); |
|
181 iContainer->ActivateL(); |
|
182 |
|
183 DynInitContainerL(); |
|
184 |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // CGSMediaPlayerStreamingView::DoDeactivate |
|
189 // Deactivate this view |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 void CGSMediaPlayerStreamingView::DoDeactivate() |
|
193 { |
|
194 |
|
195 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::DoDeactivate()"); |
|
196 if ( iContainer ) |
|
197 { |
|
198 CEikTextListBox* listbox = iContainer->ListBox(); |
|
199 if (listbox) |
|
200 { |
|
201 iCurrentItem = listbox->CurrentItemIndex(); |
|
202 iTopItemIndex = listbox->TopItemIndex(); |
|
203 } |
|
204 |
|
205 AppUi()->RemoveFromStack( iContainer ); |
|
206 delete iContainer; |
|
207 iContainer = NULL; |
|
208 iTabHelper->RemoveTabGroup(); |
|
209 } |
|
210 } |
|
211 |
|
212 // --------------------------------------------------------------------------- |
|
213 // CGSMediaPlayerStreamingView::Container |
|
214 // Returns network container item |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 CMPSettingsBaseContainer* CGSMediaPlayerStreamingView::Container() |
|
218 { |
|
219 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::Container()"); |
|
220 return static_cast <CMPSettingsStreamingContainer*> ( iContainer ); |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------------------------- |
|
224 // CGSMediaPlayerStreamingView::DynInitMenuPaneL |
|
225 // Before showing a options menu |
|
226 // --------------------------------------------------------------------------- |
|
227 // |
|
228 void CGSMediaPlayerStreamingView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
229 { |
|
230 MPX_DEBUG2(_L("#MS# CGSMediaPlayerStreamingView::DynInitMenuPaneL(0x%X)"),aResourceId); |
|
231 if (aResourceId == R_MPSETT_APP_MENU) |
|
232 { |
|
233 // Help should be displayed only if the feature is supported according |
|
234 // to Feature Manager |
|
235 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
236 { |
|
237 aMenuPane->SetItemDimmed(EMPSettCmdHelp, ETrue); |
|
238 } |
|
239 } |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // CGSMediaPlayerStreamingView::NewContainerL() |
|
244 // Creates new iContainer. |
|
245 // --------------------------------------------------------------------------- |
|
246 void CGSMediaPlayerStreamingView::NewContainerL() |
|
247 { |
|
248 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::NewContainerL()"); |
|
249 iContainer = new (ELeave) CMPSettingsStreamingContainer(iModel); |
|
250 } |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CGSMediaPlayerStreamingView::HandleClientRectChange |
|
254 // Handle screen size change. |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 void CGSMediaPlayerStreamingView::HandleClientRectChange() |
|
258 { |
|
259 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::HandleClientRectChange()"); |
|
260 if ( iContainer ) |
|
261 { |
|
262 iContainer->SetRect( ClientRect() ); |
|
263 } |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // CGSMediaPlayerStreamingView::HandleListBoxEventL |
|
268 // --------------------------------------------------------------------------- |
|
269 |
|
270 void CGSMediaPlayerStreamingView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) |
|
271 { |
|
272 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::HandleListBoxEventL()"); |
|
273 switch (aEventType) |
|
274 { |
|
275 case EEventEnterKeyPressed: |
|
276 case EEventItemSingleClicked: |
|
277 case EEventItemDoubleClicked: |
|
278 HandleListBoxSelectionL(); |
|
279 break; |
|
280 default: |
|
281 break; |
|
282 } |
|
283 } |
|
284 |
|
285 // --------------------------------------------------------------------------- |
|
286 // CGSMediaPlayerStreamingView::DynInitContainerL |
|
287 // --------------------------------------------------------------------------- |
|
288 // |
|
289 void CGSMediaPlayerStreamingView::DynInitContainerL() |
|
290 { |
|
291 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::DynInitContainerL()"); |
|
292 CEikTextListBox* listbox = iContainer->ListBox(); |
|
293 |
|
294 listbox->SetListBoxObserver(this); |
|
295 listbox->SetTopItemIndex(iTopItemIndex); |
|
296 |
|
297 if (iCurrentItem >= 0 && iCurrentItem < listbox->Model()->NumberOfItems()) // magic |
|
298 { |
|
299 listbox->SetCurrentItemIndexAndDraw(iCurrentItem); |
|
300 } |
|
301 } |
|
302 |
|
303 // --------------------------------------------------------------------------- |
|
304 // CGSMediaPlayerStreamingView::HandleListBoxSelectionL() |
|
305 // Handles listbox selection. |
|
306 // --------------------------------------------------------------------------- |
|
307 // |
|
308 void CGSMediaPlayerStreamingView::HandleListBoxSelectionL() |
|
309 { |
|
310 iCurrentItem = iContainer->ListBox()->CurrentItemIndex(); |
|
311 iTopItemIndex = iContainer->ListBox()->TopItemIndex(); |
|
312 MPX_DEBUG3(_L("#MS# CGSMediaPlayerStreamingView::HandleListBoxSelectionL() iCurrentItem(%d) iTopItemIndex(%d)"),iCurrentItem,iTopItemIndex); |
|
313 |
|
314 switch (iCurrentItem) |
|
315 { |
|
316 case KMPSettProxyViewListItemId: |
|
317 if (!FeatureManager::FeatureSupported(KFeatureIdProtocolCdma)) |
|
318 { |
|
319 // If KFeatureIdProtocolCdma is not supported then show the |
|
320 // Proxy view. Otherwise, fall through to show Network view because |
|
321 // only Network setting is available. |
|
322 AppUi()->ActivateLocalViewL(KMPSettProxyViewId); |
|
323 break; |
|
324 } |
|
325 case KMPSettNetworkViewListItemId: |
|
326 AppUi()->ActivateLocalViewL(KMPSettNetworkViewId); |
|
327 break; |
|
328 default: |
|
329 break; |
|
330 } |
|
331 } |
|
332 |
|
333 |
|
334 // --------------------------------------------------------------------------- |
|
335 // CGSMediaPlayerStreamingView::CreateContainerL() |
|
336 // Creates new iContainer. |
|
337 // --------------------------------------------------------------------------- |
|
338 // |
|
339 void CGSMediaPlayerStreamingView::CreateContainerL() |
|
340 { |
|
341 |
|
342 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::CreateContainerL()"); |
|
343 NewContainerL(); |
|
344 __ASSERT_DEBUG( |
|
345 iContainer, User::Panic( KGSDoActivateError, EGSViewPanicNullPtr ) ); |
|
346 iContainer->SetMopParent( this ); |
|
347 |
|
348 //TRAPD( error, iContainer->ConstructL() ); |
|
349 TRAPD( error, iContainer->ConstructL( ClientRect() ) ); |
|
350 |
|
351 if ( error ) |
|
352 { |
|
353 delete iContainer; |
|
354 iContainer = NULL; |
|
355 User::Leave( error ); |
|
356 } |
|
357 } |
|
358 |
|
359 // --------------------------------------------------------------------------- |
|
360 // CGSMediaPlayerStreamingView::CreateTabIconL() |
|
361 // Creates tab icon for this view. |
|
362 // --------------------------------------------------------------------------- |
|
363 // |
|
364 CGulIcon* CGSMediaPlayerStreamingView::CreateTabIconL() |
|
365 { |
|
366 |
|
367 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::CreateTabIconL()"); |
|
368 CGulIcon* icon; |
|
369 TFileName fileName; |
|
370 |
|
371 CGSVideoPlugin* parent = |
|
372 static_cast<CGSVideoPlugin*> ( |
|
373 AppUi()->View( KGSVideoPluginUid ) ); |
|
374 |
|
375 if( parent ) |
|
376 { |
|
377 parent->LocateFilePathL( fileName ); |
|
378 } |
|
379 |
|
380 icon = AknsUtils::CreateGulIconL( |
|
381 AknsUtils::SkinInstance(), |
|
382 KAknsIIDDefault, |
|
383 fileName, |
|
384 EMbmMediasettingsQgn_prop_set_mp_stream_tab2, |
|
385 EMbmMediasettingsQgn_prop_set_mp_stream_tab2_mask ); |
|
386 |
|
387 return icon; |
|
388 |
|
389 } |
|
390 |
|
391 // --------------------------------------------------------------------------- |
|
392 // CGSMediaPlayerStreamingView::HandleClientRectChange |
|
393 // --------------------------------------------------------------------------- |
|
394 // |
|
395 void CGSMediaPlayerStreamingView::SetCurrentItem(TInt aIndex) |
|
396 { |
|
397 MPX_DEBUG2(_L("#MS# CGSMediaPlayerStreamingView::SetCurrentItem(%d)"),aIndex); |
|
398 iCurrentItem = aIndex; |
|
399 } |
|
400 // End of File |
|
401 |