|
57
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2009 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: Application UI class required by AVKON application architecture.*
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
// Version : %version: 12 %
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
// INCLUDE FILES
|
|
|
23 |
#include <MediaSettings.rsg>
|
|
|
24 |
#include <avkon.hrh>
|
|
|
25 |
#include <barsread.h>
|
|
|
26 |
#include <akntabgrp.h>
|
|
|
27 |
#include <featmgr.h>
|
|
|
28 |
#include <hlplch.h>
|
|
|
29 |
#include <StringLoader.h>
|
|
|
30 |
#include <AknsUtils.h>
|
|
|
31 |
#include <mediasettings.mbg>
|
|
|
32 |
|
|
|
33 |
#include "mediasettings.hrh"
|
|
|
34 |
#include "MPSettingsAppUi.h"
|
|
|
35 |
#include "MPSettingsMainView.h"
|
|
|
36 |
#include "MPSettingsVideoView.h"
|
|
|
37 |
#include "MPSettingsStreamingView.h"
|
|
|
38 |
#include "MPSettingsConstants.h"
|
|
|
39 |
#include "MPSettingsPluginView.h"
|
|
|
40 |
#include "MPSettingsAdvancedBwView.h"
|
|
|
41 |
#include "MPSettingsDocument.h"
|
|
|
42 |
#include "mpsettingsmodel.h"
|
|
|
43 |
#include "MPSettingsModelForROP.h"
|
|
|
44 |
#include "mpxlog.h"
|
|
|
45 |
|
|
|
46 |
#include <centralrepository.h>
|
|
|
47 |
#include "MediaPlayerPrivateCRKeys.h"
|
|
|
48 |
#include "MediaPlayerVariant.hrh"
|
|
|
49 |
|
|
|
50 |
// CONSTANTS
|
|
|
51 |
const TInt KMPSettViewIdArrayGranularity = 2;
|
|
|
52 |
|
|
|
53 |
// ================= MEMBER FUNCTIONS =======================
|
|
|
54 |
//
|
|
|
55 |
|
|
|
56 |
// -----------------------------------------------------------------------------
|
|
|
57 |
// CMPSettingsAppUi::CMPSettingsAppUi
|
|
|
58 |
// C++ default constructor can NOT contain any code, that
|
|
|
59 |
// might leave.
|
|
|
60 |
// -----------------------------------------------------------------------------
|
|
|
61 |
//
|
|
|
62 |
CMPSettingsAppUi::CMPSettingsAppUi()
|
|
|
63 |
{
|
|
|
64 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::CMPSettingsAppUi()"));
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
// ----------------------------------------------------------
|
|
|
68 |
// CMPSettingsAppUi::ConstructL()
|
|
|
69 |
// Symbian OS default constructor.
|
|
|
70 |
// ----------------------------------------------------------
|
|
|
71 |
//
|
|
|
72 |
void CMPSettingsAppUi::ConstructL()
|
|
|
73 |
{
|
|
|
74 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::ConstructL()"));
|
|
|
75 |
// Enable skin support in base construction
|
|
|
76 |
BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
|
|
|
77 |
|
|
|
78 |
// Sets up TLS, must be done before FeatureManager is used.
|
|
|
79 |
FeatureManager::InitializeLibL();
|
|
|
80 |
|
|
|
81 |
iVideoViewAvailable = VideoContrastIsSupportedL();
|
|
|
82 |
|
|
|
83 |
CMPSettingsDocument* doc = static_cast<CMPSettingsDocument*>( Document() );
|
|
|
84 |
iModel = doc->SettingsModel();
|
|
|
85 |
iRopModel = static_cast<CMPSettingsModelForROP*>(iModel);
|
|
|
86 |
|
|
|
87 |
// Fetch pointer to the default navi pane control
|
|
|
88 |
CEikStatusPane* sp = StatusPane();
|
|
|
89 |
iNaviPane = static_cast<CAknNavigationControlContainer*>
|
|
|
90 |
(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
|
|
|
91 |
|
|
|
92 |
// Construct navipane tabs
|
|
|
93 |
iDecoratedTabGroup = iNaviPane->CreateTabGroupL(this);
|
|
|
94 |
|
|
|
95 |
// Construct tabs if we have multiple views
|
|
|
96 |
if ( iVideoViewAvailable )
|
|
|
97 |
{
|
|
|
98 |
AddTabSettingsGroupL();
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
// Create vector which contains view id's for all setting folders.
|
|
|
102 |
iViewIds = new(ELeave) CArrayFixFlat<TUid>(KMPSettViewIdArrayGranularity);
|
|
|
103 |
if ( iVideoViewAvailable )
|
|
|
104 |
{
|
|
|
105 |
iViewIds->AppendL( KMPSettVideoViewId );
|
|
|
106 |
}
|
|
|
107 |
iViewIds->AppendL( KMPSettStreamingViewId );
|
|
|
108 |
|
|
|
109 |
// Create application views
|
|
|
110 |
CAknView* view;
|
|
|
111 |
view = CMPSettingsMainView::NewLC( iViewIds, iRopModel, EFalse );
|
|
|
112 |
AddViewL(view); // transfer ownership to CAknViewAppUi
|
|
|
113 |
CleanupStack::Pop(); // view
|
|
|
114 |
|
|
|
115 |
// iMainView is not owned, i.e. it is not deleted in the destructor ->
|
|
|
116 |
// main view cannot be directly creted to iMainView, as it's against the coding
|
|
|
117 |
// conventions to place class' pointers to cleanup stack => static_cast.
|
|
|
118 |
iMainView = static_cast<CMPSettingsMainView*>(view);
|
|
|
119 |
|
|
|
120 |
if ( iVideoViewAvailable )
|
|
|
121 |
{
|
|
|
122 |
view = CMPSettingsVideoView::NewLC(iRopModel);
|
|
|
123 |
AddViewL(view); // transfer ownership to CAknViewAppUi
|
|
|
124 |
CleanupStack::Pop(); // view
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
CMPSettingsStreamingView* streamingView = CMPSettingsStreamingView::NewLC(iRopModel);
|
|
|
128 |
view = streamingView;
|
|
|
129 |
AddViewL(view); // transfer ownership to CAknViewAppUi
|
|
|
130 |
CleanupStack::Pop(); // view
|
|
|
131 |
|
|
|
132 |
view = CMPSettingsAdvancedBwView::NewLC( iRopModel, EFalse );
|
|
|
133 |
AddViewL(view); // transfer ownership to CAknViewAppUi
|
|
|
134 |
CleanupStack::Pop(); // view
|
|
|
135 |
|
|
|
136 |
// Construct plug-in views (if any exists)
|
|
|
137 |
CMPSettingsPluginView::ListImplementationsL(iImplInfoArray);
|
|
|
138 |
TInt count = iImplInfoArray.Count();
|
|
|
139 |
|
|
|
140 |
if (count > 0)
|
|
|
141 |
{
|
|
|
142 |
CMPSettingsPluginView* pluginView = NULL;
|
|
|
143 |
|
|
|
144 |
for (TInt ii(0); ii < count; ++ii)
|
|
|
145 |
{
|
|
|
146 |
TUid uid = iImplInfoArray[ii]->ImplementationUid();
|
|
|
147 |
pluginView = CMPSettingsPluginView::NewL(uid);
|
|
|
148 |
CleanupStack::PushL(pluginView);
|
|
|
149 |
AddViewL(pluginView);
|
|
|
150 |
CleanupStack::Pop(); // pluginView
|
|
|
151 |
|
|
|
152 |
if (pluginView->OpenedFromMainView())
|
|
|
153 |
{
|
|
|
154 |
iViewIds->AppendL(pluginView->Id());
|
|
|
155 |
}
|
|
|
156 |
}
|
|
|
157 |
|
|
|
158 |
// Sort UID array to rising order
|
|
|
159 |
TKeyArrayFix sortKey(0, ECmpTUint);
|
|
|
160 |
User::LeaveIfError(iViewIds->Sort(sortKey));
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
if ( iVideoViewAvailable && iMainView )
|
|
|
164 |
{
|
|
|
165 |
SetDefaultViewL(*iMainView);
|
|
|
166 |
}
|
|
|
167 |
else if ( streamingView )
|
|
|
168 |
{
|
|
|
169 |
SetDefaultViewL(*streamingView);
|
|
|
170 |
}
|
|
|
171 |
}
|
|
|
172 |
|
|
|
173 |
// ----------------------------------------------------
|
|
|
174 |
// CMPSettingsAppUi::~CMPSettingsAppUi
|
|
|
175 |
// Destructor
|
|
|
176 |
// Frees reserved resources
|
|
|
177 |
// ----------------------------------------------------
|
|
|
178 |
//
|
|
|
179 |
CMPSettingsAppUi::~CMPSettingsAppUi()
|
|
|
180 |
{
|
|
|
181 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::~CMPSettingsAppUi()"));
|
|
|
182 |
|
|
|
183 |
delete iDecoratedTabGroup;
|
|
|
184 |
|
|
|
185 |
if (iDoorObserver)
|
|
|
186 |
{
|
|
|
187 |
iDoorObserver->NotifyExit(MApaEmbeddedDocObserver::EEmpty);
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
delete iViewIds;
|
|
|
191 |
|
|
|
192 |
iImplInfoArray.ResetAndDestroy();
|
|
|
193 |
FeatureManager::UnInitializeLib();
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
// ----------------------------------------------------
|
|
|
197 |
// CMPSettingsAppUi::HandleCommandL
|
|
|
198 |
// ----------------------------------------------------
|
|
|
199 |
//
|
|
|
200 |
void CMPSettingsAppUi::HandleCommandL(TInt aCommand)
|
|
|
201 |
{
|
|
|
202 |
MPX_DEBUG2(_L("#MS# CMPSettingsAppUi::HandleCommandL(%d)"),aCommand);
|
|
|
203 |
switch (aCommand)
|
|
|
204 |
{
|
|
|
205 |
case EEikCmdExit:
|
|
|
206 |
Exit();
|
|
|
207 |
break;
|
|
|
208 |
case EMPSettCmdHelp:
|
|
|
209 |
case EAknCmdHelp:
|
|
|
210 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
|
|
|
211 |
AppHelpContextL() );
|
|
|
212 |
break;
|
|
|
213 |
default:
|
|
|
214 |
CAknViewAppUi::HandleCommandL(aCommand);
|
|
|
215 |
break;
|
|
|
216 |
}
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
// ----------------------------------------------------
|
|
|
220 |
// CMPSettingsAppUi::HandleResourceChangeL
|
|
|
221 |
// ----------------------------------------------------
|
|
|
222 |
//
|
|
|
223 |
void CMPSettingsAppUi::HandleResourceChangeL( TInt aType )
|
|
|
224 |
{
|
|
|
225 |
MPX_DEBUG2(_L("#MS# CMPSettingsAppUi::HandleResourceChangeL(0x%X)"),aType);
|
|
|
226 |
CAknViewAppUi::HandleResourceChangeL( aType );
|
|
|
227 |
|
|
|
228 |
if( aType == KAknsMessageSkinChange )
|
|
|
229 |
{
|
|
|
230 |
AddTabSettingsGroupL();
|
|
|
231 |
}
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
// ----------------------------------------------------
|
|
|
235 |
// CMPSettingsAppUi::TabChangedL
|
|
|
236 |
// MAknTabObserver callback for handling tab changed event.
|
|
|
237 |
// ----------------------------------------------------
|
|
|
238 |
//
|
|
|
239 |
void CMPSettingsAppUi::TabChangedL(TInt aIndex)
|
|
|
240 |
{
|
|
|
241 |
MPX_DEBUG2(_L("#MS# CMPSettingsAppUi::TabChangedL(%d)"),aIndex);
|
|
|
242 |
iMainView->SetActiveFolder(aIndex);
|
|
|
243 |
ActivateLocalViewL(iViewIds->At(aIndex));
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
// ----------------------------------------------------
|
|
|
247 |
// CMPSettingsAppUi::NaviContainer
|
|
|
248 |
// ----------------------------------------------------
|
|
|
249 |
//
|
|
|
250 |
CAknNavigationControlContainer* CMPSettingsAppUi::NaviContainer() const
|
|
|
251 |
{
|
|
|
252 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::NaviContainer()"));
|
|
|
253 |
return iNaviPane;
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
// ----------------------------------------------------
|
|
|
257 |
// CMPSettingsAppUi::MPTabGroup
|
|
|
258 |
// ----------------------------------------------------
|
|
|
259 |
//
|
|
|
260 |
CAknNavigationDecorator* CMPSettingsAppUi::MPTabGroup() const
|
|
|
261 |
{
|
|
|
262 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::MPTabGroup()"));
|
|
|
263 |
return iDecoratedTabGroup;
|
|
|
264 |
}
|
|
|
265 |
|
|
|
266 |
// ----------------------------------------------------
|
|
|
267 |
// CMPSettingsAppUi::UpdateTabIndex
|
|
|
268 |
// Updates tabgroup.
|
|
|
269 |
// ----------------------------------------------------
|
|
|
270 |
//
|
|
|
271 |
void CMPSettingsAppUi::UpdateTabIndex()
|
|
|
272 |
{
|
|
|
273 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::UpdateTabIndex()"));
|
|
|
274 |
if ( iTabGroup )
|
|
|
275 |
{
|
|
|
276 |
iTabGroup->SetActiveTabByIndex( iMainView->ActiveFolder() );
|
|
|
277 |
}
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
// ------------------------------------------------------------------------------
|
|
|
281 |
// CMPSettingsAppUi::DynInitMenuPaneL
|
|
|
282 |
// This function is called by the AVKON framework just before it displays
|
|
|
283 |
// a menu pane. Its default implementation is empty, and by overriding it,
|
|
|
284 |
// the application can set the state of menu items dynamically according
|
|
|
285 |
// to the state of application data.
|
|
|
286 |
// ------------------------------------------------------------------------------
|
|
|
287 |
//
|
|
|
288 |
void CMPSettingsAppUi::DynInitMenuPaneL(
|
|
|
289 |
TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
|
|
|
290 |
{
|
|
|
291 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::DynInitMenuPaneL()"));
|
|
|
292 |
}
|
|
|
293 |
|
|
|
294 |
// ----------------------------------------------------
|
|
|
295 |
// CMPSettingsAppUi::HandleKeyEventL
|
|
|
296 |
// Forwards key events to tabgroup when appropriate.
|
|
|
297 |
// ----------------------------------------------------
|
|
|
298 |
//
|
|
|
299 |
TKeyResponse CMPSettingsAppUi::HandleKeyEventL(
|
|
|
300 |
const TKeyEvent& aKeyEvent, TEventCode aType)
|
|
|
301 |
{
|
|
|
302 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::HandleKeyEventL()"));
|
|
|
303 |
// Check if the event should be handled by iTabGroup
|
|
|
304 |
if ( !iTabGroup || aType != EEventKey || iNaviPane->Top() != iDecoratedTabGroup)
|
|
|
305 |
{
|
|
|
306 |
return EKeyWasNotConsumed;
|
|
|
307 |
}
|
|
|
308 |
|
|
|
309 |
return iTabGroup->OfferKeyEventL(aKeyEvent, aType);
|
|
|
310 |
}
|
|
|
311 |
|
|
|
312 |
// ----------------------------------------------------
|
|
|
313 |
// CMPSettingsAppUi::AddTabSettingsGroupL()
|
|
|
314 |
// (Re)create tab group with skin support
|
|
|
315 |
// ----------------------------------------------------
|
|
|
316 |
//
|
|
|
317 |
void CMPSettingsAppUi::AddTabSettingsGroupL()
|
|
|
318 |
{
|
|
|
319 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::AddTabSettingsGroupL()"));
|
|
|
320 |
TBool iPushed = EFalse;
|
|
|
321 |
TFileName fileName;
|
|
|
322 |
|
|
|
323 |
// switch view if in tab
|
|
|
324 |
if(iNaviPane->Top() == iDecoratedTabGroup)
|
|
|
325 |
{
|
|
|
326 |
iNaviPane->PushDefaultL();
|
|
|
327 |
iPushed = ETrue;
|
|
|
328 |
}
|
|
|
329 |
|
|
|
330 |
iTabGroup = static_cast<CAknTabGroup*>
|
|
|
331 |
(iDecoratedTabGroup->DecoratedControl());
|
|
|
332 |
|
|
|
333 |
iTabGroup->SetTabFixedWidthL(KTabWidthWithTwoTabs);
|
|
|
334 |
|
|
|
335 |
HBufC* mbmpath = StringLoader::LoadLC(R_MPSETT_ICON_MBM_FILE);
|
|
|
336 |
|
|
|
337 |
// This is done to ensure upgraded file is used first.
|
|
|
338 |
// If no upgraded file is found, default file in Z: drive will be used.
|
|
|
339 |
TFindFile find( CCoeEnv::Static()->FsSession() );
|
|
|
340 |
TInt err = find.FindByDir( *mbmpath, KNullDesC );
|
|
|
341 |
|
|
|
342 |
if ( err )
|
|
|
343 |
{
|
|
|
344 |
fileName.Append( *mbmpath );
|
|
|
345 |
}
|
|
|
346 |
else
|
|
|
347 |
{
|
|
|
348 |
fileName.Append( find.File() );
|
|
|
349 |
}
|
|
|
350 |
|
|
|
351 |
// Create skinnable tabs
|
|
|
352 |
AddTabSettingsL(KAknsIIDQgnPropSetMpVideoTab3,
|
|
|
353 |
fileName,
|
|
|
354 |
EMbmMediasettingsQgn_prop_set_mp_video_tab2,
|
|
|
355 |
EMbmMediasettingsQgn_prop_set_mp_video_tab2_mask,
|
|
|
356 |
EMPViewVideoTab);
|
|
|
357 |
|
|
|
358 |
AddTabSettingsL(KAknsIIDQgnPropSetMpStreamTab3,
|
|
|
359 |
fileName,
|
|
|
360 |
EMbmMediasettingsQgn_prop_set_mp_stream_tab2,
|
|
|
361 |
EMbmMediasettingsQgn_prop_set_mp_stream_tab2_mask,
|
|
|
362 |
EMPViewStreamTab);
|
|
|
363 |
|
|
|
364 |
CleanupStack::PopAndDestroy(); // mbmpath
|
|
|
365 |
|
|
|
366 |
// return to previous view & update correct tab index
|
|
|
367 |
if (iPushed)
|
|
|
368 |
{
|
|
|
369 |
iNaviPane->PushL(*iDecoratedTabGroup);
|
|
|
370 |
UpdateTabIndex();
|
|
|
371 |
}
|
|
|
372 |
}
|
|
|
373 |
|
|
|
374 |
// ----------------------------------------------------
|
|
|
375 |
// CMPSettingsAppUi::AddTabSettingsL
|
|
|
376 |
// Adds individual tabs.
|
|
|
377 |
// ----------------------------------------------------
|
|
|
378 |
//
|
|
|
379 |
void CMPSettingsAppUi::AddTabSettingsL(
|
|
|
380 |
const TAknsItemID& aID,
|
|
|
381 |
const TDesC& aMbmFile,
|
|
|
382 |
TInt aBitmapId,
|
|
|
383 |
TInt aMaskId,
|
|
|
384 |
TInt aTabId)
|
|
|
385 |
{
|
|
|
386 |
|
|
|
387 |
MPX_DEBUG1(_L("#MS# CMPSettingsAppUi::AddTabSettingsL()"));
|
|
|
388 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
|
389 |
|
|
|
390 |
CFbsBitmap* bitmap = NULL;
|
|
|
391 |
CFbsBitmap* mask = NULL;
|
|
|
392 |
|
|
|
393 |
AknsUtils::CreateIconLC(skin, aID,
|
|
|
394 |
bitmap, mask, aMbmFile, aBitmapId, aMaskId);
|
|
|
395 |
|
|
|
396 |
// delete if exists
|
|
|
397 |
if(iTabGroup->TabIndexFromId(aTabId) >= 0)
|
|
|
398 |
{
|
|
|
399 |
iTabGroup->DeleteTabL(aTabId);
|
|
|
400 |
}
|
|
|
401 |
|
|
|
402 |
iTabGroup->AddTabL(aTabId, bitmap, mask);
|
|
|
403 |
|
|
|
404 |
CleanupStack::Pop(2); // bitmap, mask
|
|
|
405 |
}
|
|
|
406 |
|
|
|
407 |
// ----------------------------------------------------
|
|
|
408 |
// CMPSettingsAppUi::ActivateLocalViewL
|
|
|
409 |
// ----------------------------------------------------
|
|
|
410 |
//
|
|
|
411 |
void CMPSettingsAppUi::ActivateLocalViewL( TUid aViewId )
|
|
|
412 |
{
|
|
|
413 |
if ( !iVideoViewAvailable &&
|
|
|
414 |
aViewId == KMPSettMainViewId )
|
|
|
415 |
{
|
|
|
416 |
HandleCommandL( EEikCmdExit );
|
|
|
417 |
}
|
|
|
418 |
else
|
|
|
419 |
{
|
|
|
420 |
CAknViewAppUi::ActivateLocalViewL( aViewId );
|
|
|
421 |
}
|
|
|
422 |
}
|
|
|
423 |
|
|
|
424 |
// ----------------------------------------------------
|
|
|
425 |
// CMPSettingsAppUi::VideoContrastIsSupportedL
|
|
|
426 |
// ----------------------------------------------------
|
|
|
427 |
//
|
|
|
428 |
TBool CMPSettingsAppUi::VideoContrastIsSupportedL()
|
|
|
429 |
{
|
|
|
430 |
TInt flags = 0;
|
|
|
431 |
|
|
|
432 |
CRepository* repository = CRepository::NewL( KCRUidMediaPlayerFeatures );
|
|
|
433 |
repository->Get( KMPLocalVariation, flags );
|
|
|
434 |
delete repository;
|
|
|
435 |
|
|
|
436 |
return ( flags & KMediaPlayerVideoContrast );
|
|
|
437 |
}
|
|
|
438 |
|
|
|
439 |
// End of File
|