|
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: 10 % |
|
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 // ================= MEMBER FUNCTIONS ======================= |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CGSMediaPlayerStreamingView::CGSMediaPlayerStreamingView |
|
48 // C++ default constructor can NOT contain any code, that |
|
49 // might leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CGSMediaPlayerStreamingView::CGSMediaPlayerStreamingView( |
|
53 CMPSettingsModelForROP* aModel, |
|
54 CArrayPtrFlat<MGSTabbedView>* /* aTabViewArray */ ) |
|
55 : iModel( aModel) |
|
56 { |
|
57 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::CGSMediaPlayerStreamingView()"); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------- |
|
61 // CGSMediaPlayerStreamingView::ConstructL(const TRect& aRect) |
|
62 // Symbian OS two-phased constructor |
|
63 // --------------------------------------------------------- |
|
64 // |
|
65 void CGSMediaPlayerStreamingView::ConstructL(CArrayPtrFlat<MGSTabbedView>* aTabViewArray) |
|
66 { |
|
67 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::ConstructL()"); |
|
68 if ( aTabViewArray ) |
|
69 { |
|
70 iTabHelper = CGSTabHelper::NewL(); |
|
71 aTabViewArray->AppendL(this); |
|
72 } |
|
73 BaseConstructL( R_GS_MPSETT_STREAMING_VIEW ); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CGSMediaPlayerStreamingView::NewLC |
|
78 // Two-phased constructor. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CGSMediaPlayerStreamingView* CGSMediaPlayerStreamingView::NewLC( |
|
82 CMPSettingsModelForROP* aModel, |
|
83 CArrayPtrFlat<MGSTabbedView>* aTabViewArray ) |
|
84 { |
|
85 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::NewLC()"); |
|
86 CGSMediaPlayerStreamingView* self = new(ELeave) CGSMediaPlayerStreamingView(aModel,aTabViewArray); |
|
87 |
|
88 CleanupStack::PushL(self); |
|
89 self->ConstructL( aTabViewArray ); |
|
90 |
|
91 return self; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CGSMediaPlayerStreamingView::~CGSMediaPlayerStreamingView |
|
96 // Destructor |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 CGSMediaPlayerStreamingView::~CGSMediaPlayerStreamingView() |
|
100 { |
|
101 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::~CGSMediaPlayerStreamingView()"); |
|
102 if ( iContainer ) |
|
103 { |
|
104 AppUi()->RemoveFromStack( iContainer ); |
|
105 delete iContainer; |
|
106 } |
|
107 delete iTabHelper; |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------- |
|
111 // TUid CGSMediaPlayerStreamingView::Id |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 TUid CGSMediaPlayerStreamingView::Id() const |
|
115 { |
|
116 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::Id()"); |
|
117 return KMPSettStreamingViewId; |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------- |
|
121 // CGSMediaPlayerStreamingView::HandleCommandL |
|
122 // --------------------------------------------------------- |
|
123 // |
|
124 void CGSMediaPlayerStreamingView::HandleCommandL(TInt aCommand) |
|
125 { |
|
126 MPX_DEBUG2(_L("#MS# CGSMediaPlayerStreamingView::HandleCommandL(%d)"),aCommand); |
|
127 CGSVideoPlugin* parent = |
|
128 static_cast<CGSVideoPlugin*> ( |
|
129 AppUi()->View( KGSVideoPluginUid ) ); |
|
130 |
|
131 switch (aCommand) |
|
132 { |
|
133 case EMPSettCmdOpen: |
|
134 break; |
|
135 case EAknSoftkeyBack: |
|
136 { |
|
137 if ( iTabHelper ) |
|
138 { |
|
139 parent->SetCurrentItem(EGSMediaSettingsStreamingIndex); |
|
140 parent->ResetSelectedItemIndex(); |
|
141 AppUi()->ActivateLocalViewL(KGSVideoPluginUid); |
|
142 } |
|
143 else |
|
144 { |
|
145 // If there's no TabHelper, we have just streaming view and |
|
146 // should exit MediaSettings. |
|
147 AppUi()->ActivateLocalViewL( KGSAppsPluginUid ); |
|
148 } |
|
149 } |
|
150 break; |
|
151 case EMPSettCmdAdvancedSett: |
|
152 AppUi()->ActivateLocalViewL( KMPSettAdvancedBwViewId ); |
|
153 break; |
|
154 case EMPSettCmdHelp: |
|
155 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
156 { |
|
157 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), AppUi()->AppHelpContextL() ); |
|
158 } |
|
159 break; |
|
160 default: |
|
161 AppUi()->HandleCommandL(aCommand); |
|
162 break; |
|
163 } |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CGSMediaPlayerStreamingView::DoActivateL |
|
168 // Activate this view |
|
169 // --------------------------------------------------------------------------- |
|
170 // |
|
171 void CGSMediaPlayerStreamingView::DoActivateL( |
|
172 const TVwsViewId& /* aPrevViewId */, |
|
173 TUid /*aCustomMessageId*/, |
|
174 const TDesC8& /*aCustomMessage*/ ) |
|
175 { |
|
176 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::DoActivateL()"); |
|
177 if( iContainer ) |
|
178 { |
|
179 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
180 delete iContainer; |
|
181 iContainer = NULL; |
|
182 } |
|
183 |
|
184 CreateContainerL(); |
|
185 AppUi()->AddToViewStackL( *this, iContainer ); |
|
186 |
|
187 CGSVideoPlugin* parent = |
|
188 static_cast<CGSVideoPlugin*> ( |
|
189 AppUi()->View( KGSVideoPluginUid ) ); |
|
190 |
|
191 if( parent && iTabHelper ) |
|
192 { |
|
193 iTabHelper->CreateTabGroupL( Id(), |
|
194 static_cast<CArrayPtrFlat<MGSTabbedView> *> (parent->TabbedViews() ) ); |
|
195 } |
|
196 iContainer->SetRect( ClientRect() ); |
|
197 iContainer->ActivateL(); |
|
198 |
|
199 DynInitContainerL(); |
|
200 } |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // CGSMediaPlayerStreamingView::DoDeactivate |
|
204 // Deactivate this view |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 void CGSMediaPlayerStreamingView::DoDeactivate() |
|
208 { |
|
209 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::DoDeactivate()"); |
|
210 if ( iContainer ) |
|
211 { |
|
212 CEikTextListBox* listbox = iContainer->ListBox(); |
|
213 if (listbox) |
|
214 { |
|
215 iCurrentItem = listbox->CurrentItemIndex(); |
|
216 iTopItemIndex = listbox->TopItemIndex(); |
|
217 } |
|
218 |
|
219 AppUi()->RemoveFromStack( iContainer ); |
|
220 delete iContainer; |
|
221 iContainer = NULL; |
|
222 if ( iTabHelper ) |
|
223 { |
|
224 iTabHelper->RemoveTabGroup(); |
|
225 } |
|
226 } |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------------------------- |
|
230 // CGSMediaPlayerStreamingView::Container |
|
231 // Returns network container item |
|
232 // --------------------------------------------------------------------------- |
|
233 // |
|
234 CMPSettingsBaseContainer* CGSMediaPlayerStreamingView::Container() |
|
235 { |
|
236 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::Container()"); |
|
237 return static_cast <CMPSettingsStreamingContainer*> ( iContainer ); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // CGSMediaPlayerStreamingView::DynInitMenuPaneL |
|
242 // Before showing a options menu |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 void CGSMediaPlayerStreamingView::DynInitMenuPaneL( TInt aResourceId, |
|
246 CEikMenuPane* aMenuPane) |
|
247 { |
|
248 MPX_DEBUG2(_L("#MS# CGSMediaPlayerStreamingView::DynInitMenuPaneL(0x%X)"),aResourceId); |
|
249 if ( aResourceId == R_MPSETT_APP_MENU ) |
|
250 { |
|
251 // Help should be displayed only if the feature is supported according |
|
252 // to Feature Manager |
|
253 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
254 { |
|
255 aMenuPane->SetItemDimmed(EMPSettCmdHelp, ETrue); |
|
256 } |
|
257 } |
|
258 } |
|
259 |
|
260 // --------------------------------------------------------------------------- |
|
261 // CGSMediaPlayerStreamingView::NewContainerL() |
|
262 // Creates new iContainer. |
|
263 // --------------------------------------------------------------------------- |
|
264 void CGSMediaPlayerStreamingView::NewContainerL() |
|
265 { |
|
266 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::NewContainerL()"); |
|
267 iContainer = new (ELeave) CMPSettingsStreamingContainer(iModel); |
|
268 } |
|
269 |
|
270 // ----------------------------------------------------------------------------- |
|
271 // CGSMediaPlayerStreamingView::HandleClientRectChange |
|
272 // Handle screen size change. |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 void CGSMediaPlayerStreamingView::HandleClientRectChange() |
|
276 { |
|
277 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::HandleClientRectChange()"); |
|
278 if ( iContainer ) |
|
279 { |
|
280 iContainer->SetRect( ClientRect() ); |
|
281 } |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // CGSMediaPlayerStreamingView::DynInitContainerL |
|
286 // --------------------------------------------------------------------------- |
|
287 // |
|
288 void CGSMediaPlayerStreamingView::DynInitContainerL() |
|
289 { |
|
290 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::DynInitContainerL()"); |
|
291 CEikTextListBox* listbox = iContainer->ListBox(); |
|
292 |
|
293 listbox->SetTopItemIndex(iTopItemIndex); |
|
294 |
|
295 if (iCurrentItem >= 0 && iCurrentItem < listbox->Model()->NumberOfItems()) // magic |
|
296 { |
|
297 listbox->SetCurrentItemIndexAndDraw(iCurrentItem); |
|
298 } |
|
299 } |
|
300 |
|
301 // --------------------------------------------------------------------------- |
|
302 // CGSMediaPlayerStreamingView::CreateContainerL() |
|
303 // Creates new iContainer. |
|
304 // --------------------------------------------------------------------------- |
|
305 // |
|
306 void CGSMediaPlayerStreamingView::CreateContainerL() |
|
307 { |
|
308 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::CreateContainerL()"); |
|
309 NewContainerL(); |
|
310 __ASSERT_DEBUG( |
|
311 iContainer, User::Panic( KGSDoActivateError, EGSViewPanicNullPtr ) ); |
|
312 iContainer->SetMopParent( this ); |
|
313 |
|
314 //TRAPD( error, iContainer->ConstructL() ); |
|
315 TRAPD( error, iContainer->ConstructL( ClientRect() ) ); |
|
316 |
|
317 if ( error ) |
|
318 { |
|
319 delete iContainer; |
|
320 iContainer = NULL; |
|
321 User::Leave( error ); |
|
322 } |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // CGSMediaPlayerStreamingView::CreateTabIconL() |
|
327 // Creates tab icon for this view. |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 CGulIcon* CGSMediaPlayerStreamingView::CreateTabIconL() |
|
331 { |
|
332 MPX_FUNC("#MS# CGSMediaPlayerStreamingView::CreateTabIconL()"); |
|
333 CGulIcon* icon; |
|
334 TFileName fileName; |
|
335 |
|
336 CGSVideoPlugin* parent = |
|
337 static_cast<CGSVideoPlugin*> ( |
|
338 AppUi()->View( KGSVideoPluginUid ) ); |
|
339 |
|
340 if( parent ) |
|
341 { |
|
342 parent->LocateFilePathL( fileName ); |
|
343 } |
|
344 |
|
345 icon = AknsUtils::CreateGulIconL( |
|
346 AknsUtils::SkinInstance(), |
|
347 KAknsIIDDefault, |
|
348 fileName, |
|
349 EMbmMediasettingsQgn_prop_set_mp_stream_tab2, |
|
350 EMbmMediasettingsQgn_prop_set_mp_stream_tab2_mask ); |
|
351 |
|
352 return icon; |
|
353 } |
|
354 |
|
355 // --------------------------------------------------------------------------- |
|
356 // CGSMediaPlayerStreamingView::HandleClientRectChange |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 void CGSMediaPlayerStreamingView::SetCurrentItem(TInt aIndex) |
|
360 { |
|
361 MPX_DEBUG2(_L("#MS# CGSMediaPlayerStreamingView::SetCurrentItem(%d)"),aIndex); |
|
362 iCurrentItem = aIndex; |
|
363 } |
|
364 // End of File |
|
365 |