|
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: Setting item list class for Video settings list view.* |
|
15 */ |
|
16 |
|
17 |
|
18 // Version : %version: 16 % |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <eikappui.h> |
|
25 #include <MediaSettings.rsg> |
|
26 #include <StringLoader.h> |
|
27 #include <swi/sisregistrysession.h> |
|
28 #include <swi/sisregistryentry.h> |
|
29 #include <AknCommonDialogsDynMem.h> |
|
30 #include <CAknMemorySelectionDialogMultiDrive.h> |
|
31 #include <cmmanagerext.h> |
|
32 #include <cmdestinationext.h> |
|
33 #include <cmapplicationsettingsui.h> |
|
34 |
|
35 #include "MediaPlayerVariant.hrh" |
|
36 #include "MediaPlayerPrivateCRKeys.h" |
|
37 #include "mediasettings.hrh" |
|
38 #include "MPSettingsVideoSettingItemList.h" |
|
39 #include "MPSettingsSliderSettingItem.h" |
|
40 #include "MPSettingsModelForROP.h" |
|
41 #include "MPSettingsAppUi.h" |
|
42 #include "videoplayersettingsengine.h" |
|
43 #include "videoplayercenrepkeys.h" |
|
44 #include "mpxlog.h" |
|
45 |
|
46 |
|
47 const TInt KParentControlAdult( 18 ); |
|
48 const TInt KParentControlMinAge( 4 ); |
|
49 const TInt KParentControlIndexShift( 3 ); |
|
50 const TInt KParentControlMaxIndex( 15 ); |
|
51 const TInt KParentControlSelections( 16 ); |
|
52 const TInt KParentControlOff( 0 ); |
|
53 |
|
54 |
|
55 // ============================ MEMBER FUNCTIONS =============================== |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList |
|
59 // C++ default constructor can NOT contain any code, that |
|
60 // might leave. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList( |
|
64 CMPSettingsModelForROP* aModel, CVcxNsSettingsEngine& aVideoSettingsEngine) : |
|
65 iModel(aModel), iVideoSettingsEngine(aVideoSettingsEngine), iRockerKeysSupported(EFalse) |
|
66 { |
|
67 CMPSettingsAppUi* AppUi = |
|
68 static_cast<CMPSettingsAppUi*> (CCoeEnv::Static()->AppUi()); |
|
69 iLandscapeSupportedByDevice = AppUi->OrientationCanBeChanged(); |
|
70 |
|
71 TBool rockerSupported = EFalse; |
|
72 TRAP_IGNORE( rockerSupported = iModel->IsRockerKeysSupportedL() ); |
|
73 if ( rockerSupported ) |
|
74 { |
|
75 iRockerKeysSupported = ETrue; |
|
76 } |
|
77 MPX_DEBUG3(_L("#MS# CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList() iLandscapeSupportedByDevice(%d) iRockerKeysSupported(%d) "),iLandscapeSupportedByDevice,iRockerKeysSupported ); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList |
|
82 // Destructor |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList() |
|
86 { |
|
87 MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList()")); |
|
88 delete iDriveMonitor; |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CMPSettingsVideoSettingItemList::EditItemL |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CMPSettingsVideoSettingItemList::EditItemL(TInt aIndex, TBool aCalledFromMenu) |
|
96 { |
|
97 MPX_DEBUG3(_L("#MS# CMPSettingsVideoSettingItemList::EditItemL(%d,%d)"),aIndex,aCalledFromMenu); |
|
98 |
|
99 TInt itemIndex = aIndex; |
|
100 TBool storeModifiedSetting( ETrue ); |
|
101 |
|
102 CAknSettingItem* settingItem = SettingItemArray()->At( itemIndex ); |
|
103 TInt identifier = settingItem->Identifier(); |
|
104 |
|
105 // Load current value from shared data |
|
106 switch ( identifier ) |
|
107 { |
|
108 case EMPSettVideoContrastSettingId: |
|
109 { |
|
110 CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu ); |
|
111 break; |
|
112 } |
|
113 |
|
114 case EVcSettingsViewParentControlItem: |
|
115 { |
|
116 EditParentControlItemL( itemIndex, aCalledFromMenu ); |
|
117 break; |
|
118 } |
|
119 |
|
120 case EVcSettingsViewMemoryItem: |
|
121 { |
|
122 EditPreferredMemoryItemL( itemIndex, aCalledFromMenu ); |
|
123 break; |
|
124 } |
|
125 |
|
126 case EVcSettingsViewThumbnails: |
|
127 { |
|
128 EditThumbnailItemL( itemIndex, aCalledFromMenu ); |
|
129 break; |
|
130 } |
|
131 case EVcSettingsviewIadUpdateItem: |
|
132 { |
|
133 // Not editable |
|
134 storeModifiedSetting = EFalse; |
|
135 } |
|
136 break; |
|
137 |
|
138 default: |
|
139 break; |
|
140 } |
|
141 |
|
142 if ( storeModifiedSetting ) |
|
143 { |
|
144 // Store the modified setting |
|
145 switch ( itemIndex ) |
|
146 { |
|
147 case EVcSettingsViewParentControlIndex: |
|
148 case EVcSettingsViewMemoryItemIndex: |
|
149 case EVcSettingsViewThumbnailsIndex: |
|
150 break; |
|
151 |
|
152 default: |
|
153 { |
|
154 // Store setting value to settings model |
|
155 settingItem->StoreL(); |
|
156 StoreSettingL( identifier ); |
|
157 } |
|
158 break; |
|
159 } |
|
160 } |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CMPSettingsVideoSettingItemList::EditThumbnailItemL |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void CMPSettingsVideoSettingItemList::EditThumbnailItemL( TInt itemIndex, TBool aCalledFromMenu ) |
|
168 { |
|
169 if ( aCalledFromMenu ) |
|
170 { |
|
171 CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu); |
|
172 (*SettingItemArray())[itemIndex]->StoreL(); |
|
173 } |
|
174 else |
|
175 { |
|
176 if (iSettingThumbnails) |
|
177 { |
|
178 iSettingThumbnails = 0; |
|
179 } |
|
180 else |
|
181 { |
|
182 iSettingThumbnails = 1; |
|
183 } |
|
184 (*SettingItemArray())[itemIndex]->LoadL(); |
|
185 (*SettingItemArray())[itemIndex]->UpdateListBoxTextL(); |
|
186 } |
|
187 |
|
188 iVideoSettingsEngine.SetVideoOnDemandThumbnails( |
|
189 iSettingThumbnails); |
|
190 DrawDeferred(); |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CMPSettingsVideoSettingItemList::EditParentControlItemL |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void CMPSettingsVideoSettingItemList::EditParentControlItemL( |
|
198 TInt itemIndex, |
|
199 TBool aCalledFromMenu ) |
|
200 { |
|
201 if (!iLockCodeAccepted) |
|
202 { |
|
203 iLockCodeAccepted = iVideoSettingsEngine.CheckLockCodeL(); |
|
204 } |
|
205 if (iLockCodeAccepted) |
|
206 { |
|
207 // can edit setting |
|
208 iParentControlIndex = GetCurrentParentControl(); |
|
209 CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu ); |
|
210 (*SettingItemArray())[itemIndex]->StoreL(); |
|
211 } |
|
212 |
|
213 SetCurrentParentControl( iParentControlIndex ); |
|
214 iParentControlIndex = GetCurrentParentControl(); |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CMPSettingsVideoSettingItemList::EditPreferredMemoryItemL |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 void CMPSettingsVideoSettingItemList::EditPreferredMemoryItemL( |
|
222 TInt itemIndex, |
|
223 TBool |
|
224 #ifndef RD_MULTIPLE_DRIVE_ENABLERS |
|
225 aCalledFromMenu |
|
226 #endif |
|
227 ) |
|
228 { |
|
229 TInt drive; |
|
230 iVideoSettingsEngine.GetUsedMemoryL(drive); |
|
231 iSettingMemory = iDriveMonitor->ArrayPos(drive); |
|
232 if (iSettingMemory == KErrNotFound) |
|
233 { |
|
234 iSettingMemory = 0; |
|
235 } |
|
236 |
|
237 #ifndef RD_MULTIPLE_DRIVE_ENABLERS |
|
238 const TInt KThree( 3 ); |
|
239 if ( iDriveMonitor->iAvailableDrives.Count() < KThree && !aCalledFromMenu ) |
|
240 { |
|
241 if ( iSettingMemory == 1 ) |
|
242 { |
|
243 iSettingMemory = 0; |
|
244 } |
|
245 else |
|
246 { |
|
247 iSettingMemory = 1; |
|
248 } |
|
249 } |
|
250 else |
|
251 { |
|
252 CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); |
|
253 ( *SettingItemArray() )[aIndex]->StoreL(); |
|
254 } |
|
255 #else |
|
256 |
|
257 TBool driveSelected(EFalse); |
|
258 |
|
259 TDriveNumber selectedMem; |
|
260 TInt includedMedias = 0; |
|
261 |
|
262 if (iDriveMonitor->PhoneMemoryDrive() != KErrNotFound) |
|
263 { |
|
264 includedMedias = AknCommonDialogsDynMem::EMemoryTypePhone; |
|
265 } |
|
266 |
|
267 includedMedias |= AknCommonDialogsDynMem::EMemoryTypeMMCExternal |
|
268 | AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage; |
|
269 |
|
270 CAknMemorySelectionDialogMultiDrive* dlg = |
|
271 CAknMemorySelectionDialogMultiDrive::NewL( |
|
272 ECFDDialogTypeSelect, |
|
273 R_MTV_MEMORY_SELECTION_DIALOG, EFalse, |
|
274 includedMedias); |
|
275 CleanupStack::PushL(dlg); |
|
276 driveSelected = dlg->ExecuteL(selectedMem); |
|
277 CleanupStack::PopAndDestroy(dlg); |
|
278 |
|
279 if (driveSelected) |
|
280 { |
|
281 iSettingMemory = iDriveMonitor->ArrayPos(selectedMem); |
|
282 } |
|
283 |
|
284 #endif |
|
285 |
|
286 (*SettingItemArray())[itemIndex]->LoadL(); |
|
287 (*SettingItemArray())[itemIndex]->UpdateListBoxTextL(); |
|
288 |
|
289 iVideoSettingsEngine.SetUsedMemory( |
|
290 iDriveMonitor->iAvailableDrives[iSettingMemory].iDrive ); |
|
291 |
|
292 DrawDeferred(); |
|
293 } |
|
294 |
|
295 // -------------------------------------------------------------------------- |
|
296 // CMPSettingsVideoSettingItemList::HandleListBoxEventL() |
|
297 // -------------------------------------------------------------------------- |
|
298 // |
|
299 void CMPSettingsVideoSettingItemList::HandleListBoxEventL( |
|
300 CEikListBox* aListBox, |
|
301 TListBoxEvent aListBoxEvent ) |
|
302 { |
|
303 if ( aListBoxEvent == EEventEnterKeyPressed || |
|
304 aListBoxEvent == EEventItemSingleClicked || |
|
305 aListBoxEvent == EEventItemDoubleClicked ) |
|
306 { |
|
307 TInt itemIndex = SettingItemArray()->ItemIndexFromVisibleIndex( |
|
308 aListBox->CurrentItemIndex() ); |
|
309 |
|
310 CAknSettingItemList::HandleListBoxEventL( aListBox, aListBoxEvent ); |
|
311 } |
|
312 } |
|
313 |
|
314 // -------------------------------------------------------------------------- |
|
315 // CMPSettingsVideoSettingItemList::EditCurrentItemL() |
|
316 // -------------------------------------------------------------------------- |
|
317 // |
|
318 void CMPSettingsVideoSettingItemList::EditCurrentItemL( TBool aCalledFromMenu ) |
|
319 { |
|
320 TInt itemIndex = SettingItemArray()->ItemIndexFromVisibleIndex( |
|
321 ListBox()->CurrentItemIndex() ); |
|
322 |
|
323 EditItemL( itemIndex, aCalledFromMenu ); |
|
324 } |
|
325 |
|
326 // -------------------------------------------------------------------------- |
|
327 // CMPSettingsVideoSettingItemList::IsCurrentItem() |
|
328 // -------------------------------------------------------------------------- |
|
329 // |
|
330 TBool CMPSettingsVideoSettingItemList::IsCurrentItem( TInt aIndex ) |
|
331 { |
|
332 TBool retValue( EFalse ); |
|
333 TInt currentIndex = SettingItemArray()->ItemIndexFromVisibleIndex( |
|
334 ListBox()->CurrentItemIndex() ); |
|
335 |
|
336 CAknSettingItem* settingItem = SettingItemArray()->At( currentIndex ); |
|
337 TInt identifier = settingItem->Identifier(); |
|
338 if ( aIndex == identifier ) |
|
339 { |
|
340 retValue = ETrue; |
|
341 } |
|
342 |
|
343 return retValue; |
|
344 } |
|
345 |
|
346 // ----------------------------------------------------------------------------- |
|
347 // CMPSettingsVideoSettingItemList::LoadSettingsL |
|
348 // ----------------------------------------------------------------------------- |
|
349 // |
|
350 void CMPSettingsVideoSettingItemList::LoadSettingsL() |
|
351 { |
|
352 MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::LoadSettingsL()")); |
|
353 // Get setting values from settings model |
|
354 LoadAllL(); |
|
355 |
|
356 CAknSettingItemList::LoadSettingsL(); |
|
357 |
|
358 FinishConstructionL(); |
|
359 } |
|
360 |
|
361 // ----------------------------------------------------------------------------- |
|
362 // CMPSettingsVideoSettingItemList::CreateSettingItemL |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 CAknSettingItem* CMPSettingsVideoSettingItemList::CreateSettingItemL(TInt aSettingId) |
|
366 { |
|
367 MPX_DEBUG2(_L("#MS# CMPSettingsVideoSettingItemList::CreateSettingItemL(%d)"),aSettingId); |
|
368 CAknSettingItem* settingItem = NULL; |
|
369 |
|
370 switch (aSettingId) |
|
371 { |
|
372 case EMPSettVideoContrastSettingId: |
|
373 { |
|
374 settingItem = new (ELeave) CMPSettingsSliderSettingItem( |
|
375 aSettingId, iVideoContrast, |
|
376 R_MPSETT_CONTRAST_SLIDER_LIST_VALUE, EFalse); |
|
377 if ( ! VideoContrastIsSupportedL() ) |
|
378 { |
|
379 settingItem->SetHidden( ETrue ); |
|
380 } |
|
381 break; |
|
382 } |
|
383 case EVcSettingsViewParentControlItem: |
|
384 { |
|
385 iParentControlIndex = GetCurrentParentControl(); |
|
386 |
|
387 iSettingParentControlItem |
|
388 = new (ELeave) CAknEnumeratedTextPopupSettingItem( |
|
389 aSettingId, iParentControlIndex); |
|
390 return iSettingParentControlItem; |
|
391 } |
|
392 |
|
393 case EVcSettingsViewMemoryItem: |
|
394 { |
|
395 if (!iDriveMonitor) |
|
396 { |
|
397 iDriveMonitor = CVideoSettingsDriveMonitor::NewL(); |
|
398 iDriveMonitor->RegisterObserverL(this); |
|
399 } |
|
400 |
|
401 TInt drive; |
|
402 iVideoSettingsEngine.GetUsedMemoryL(drive); |
|
403 iSettingMemory = iDriveMonitor->ArrayPos(drive); |
|
404 if (iSettingMemory == KErrNotFound) |
|
405 { |
|
406 iSettingMemory = 0; |
|
407 } |
|
408 |
|
409 iSettingMemoryItem |
|
410 = new (ELeave) CAknEnumeratedTextPopupSettingItem( |
|
411 aSettingId, iSettingMemory); |
|
412 |
|
413 return iSettingMemoryItem; |
|
414 } |
|
415 |
|
416 case EVcSettingsviewIadUpdateItem: |
|
417 { |
|
418 // Set text value to empty. The version number is displayed by |
|
419 // changing the string of empty item in UpdateVersionNumberTextL(). |
|
420 iSettingVersionText = KNullDesC(); |
|
421 iSettingIadUpdateItem = new (ELeave) CAknTextSettingItem( |
|
422 aSettingId, iSettingVersionText); |
|
423 return iSettingIadUpdateItem; |
|
424 } |
|
425 |
|
426 case EVcSettingsViewThumbnails: |
|
427 { |
|
428 iVideoSettingsEngine.GetVideoOnDemandThumbnails(iSettingThumbnails); |
|
429 iSettingThumbnailsItem |
|
430 = new (ELeave) CAknEnumeratedTextPopupSettingItem( |
|
431 aSettingId, iSettingThumbnails); |
|
432 return iSettingThumbnailsItem; |
|
433 } |
|
434 |
|
435 default: |
|
436 break; |
|
437 } |
|
438 |
|
439 return settingItem; |
|
440 } |
|
441 |
|
442 // ----------------------------------------------------------------------------- |
|
443 // CMPSettingsVideoSettingItemList::LoadSettingL |
|
444 // ----------------------------------------------------------------------------- |
|
445 // |
|
446 void CMPSettingsVideoSettingItemList::LoadSettingL(TInt aSettingId) |
|
447 { |
|
448 MPX_DEBUG2(_L("#MS# CMPSettingsVideoSettingItemList::LoadSettingL(%d)"),aSettingId); |
|
449 switch (aSettingId) |
|
450 { |
|
451 case EMPSettVideoContrastSettingId: |
|
452 iModel->GetVideoContrast(iVideoContrast); |
|
453 break; |
|
454 |
|
455 default: |
|
456 break; |
|
457 } |
|
458 } |
|
459 |
|
460 // ----------------------------------------------------------------------------- |
|
461 // CMPSettingsVideoSettingItemList::StoreSettingL |
|
462 // ----------------------------------------------------------------------------- |
|
463 // |
|
464 void CMPSettingsVideoSettingItemList::StoreSettingL(TInt aSettingId) |
|
465 { |
|
466 MPX_DEBUG2(_L("#MS# CMPSettingsVideoSettingItemList::StoreSettingL(%d)"),aSettingId); |
|
467 switch (aSettingId) |
|
468 { |
|
469 case EMPSettVideoContrastSettingId: |
|
470 iModel->SetVideoContrast(iVideoContrast); |
|
471 break; |
|
472 |
|
473 default: |
|
474 break; |
|
475 } |
|
476 |
|
477 iModel->StoreSettingsL(); |
|
478 } |
|
479 |
|
480 // ----------------------------------------------------------------------------- |
|
481 // CMPSettingsVideoSettingItemList::LoadAllL |
|
482 // ----------------------------------------------------------------------------- |
|
483 // |
|
484 void CMPSettingsVideoSettingItemList::LoadAllL() |
|
485 { |
|
486 MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::LoadAllL()")); |
|
487 iModel->LoadSettingsL(EConfigUser); |
|
488 LoadSettingL(EMPSettVideoContrastSettingId); |
|
489 } |
|
490 |
|
491 // -------------------------------------------------------------------------- |
|
492 // CMPSettingsVideoSettingItemList::FinishConstructionL() |
|
493 // -------------------------------------------------------------------------- |
|
494 // |
|
495 void CMPSettingsVideoSettingItemList::FinishConstructionL() |
|
496 { |
|
497 UpdateMemoryItemTextL(); |
|
498 UpdateVersionNumberTextL(); |
|
499 UpdateParentControlTextL(); |
|
500 } |
|
501 |
|
502 // -------------------------------------------------------------------------- |
|
503 // CMPSettingsVideoSettingItemList::UpdateVersionNumberTextL() |
|
504 // -------------------------------------------------------------------------- |
|
505 // |
|
506 void CMPSettingsVideoSettingItemList::UpdateVersionNumberTextL() |
|
507 { |
|
508 Swi::RSisRegistrySession sisRegistrySession; |
|
509 |
|
510 if ( sisRegistrySession.Connect() == KErrNone ) |
|
511 { |
|
512 CleanupClosePushL( sisRegistrySession ); |
|
513 |
|
514 if ( sisRegistrySession.IsInstalledL( KSisUid ) ) |
|
515 { |
|
516 Swi::RSisRegistryEntry sisRegistryEntry; |
|
517 TInt error = sisRegistryEntry.Open( sisRegistrySession, KSisUid ); |
|
518 if ( error == KErrNone ) |
|
519 { |
|
520 CleanupClosePushL( sisRegistryEntry ); |
|
521 TVersion vcVersion( sisRegistryEntry.VersionL() ); |
|
522 CleanupStack::PopAndDestroy( &sisRegistryEntry ); |
|
523 |
|
524 HBufC* versionString = HBufC::NewLC( KMaxVersionNumberLength ); |
|
525 TPtr versionPtr( versionString->Des() ); |
|
526 versionPtr.Format( |
|
527 KVersionNumberFormat, |
|
528 vcVersion.iMajor, |
|
529 vcVersion.iMinor, |
|
530 vcVersion.iBuild ); |
|
531 iSettingIadUpdateItem->SetEmptyItemTextL( *versionString ); |
|
532 CleanupStack::PopAndDestroy( versionString ); |
|
533 iSettingIadUpdateItem->UpdateListBoxTextL(); |
|
534 } |
|
535 } |
|
536 CleanupStack::PopAndDestroy( &sisRegistrySession ); |
|
537 } |
|
538 } |
|
539 |
|
540 // -------------------------------------------------------------------------- |
|
541 // Build dynamic listbox for parental control selection. |
|
542 // -------------------------------------------------------------------------- |
|
543 // |
|
544 void CMPSettingsVideoSettingItemList::UpdateParentControlTextL() |
|
545 { |
|
546 // Set up the dynamic texts for this setting item. Choices are: |
|
547 // |
|
548 // 0: Parent control not in use. |
|
549 // 1-15: Selected minimum age 4-18. |
|
550 |
|
551 CArrayPtrFlat<CAknEnumeratedText>* enumeratedTextArray = |
|
552 new ( ELeave ) CArrayPtrFlat<CAknEnumeratedText>( |
|
553 KParentControlSelections ); |
|
554 CleanupStack::PushL( enumeratedTextArray ); |
|
555 CArrayPtr<HBufC>* poppedUpTextArray = |
|
556 new ( ELeave ) CArrayPtrFlat<HBufC>( KParentControlSelections ); |
|
557 CleanupStack::PushL( poppedUpTextArray ); |
|
558 |
|
559 HBufC* parentControlStrOff1 = NULL; |
|
560 HBufC* parentControlStrOff2 = NULL; |
|
561 |
|
562 parentControlStrOff1 = |
|
563 StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_OFF ); |
|
564 parentControlStrOff2 = |
|
565 StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_OFF ); |
|
566 |
|
567 CAknEnumeratedText* enumeratedTextOff = |
|
568 new ( ELeave ) CAknEnumeratedText( 0, parentControlStrOff1 ); |
|
569 CleanupStack::PushL( enumeratedTextOff ); |
|
570 enumeratedTextArray->AppendL( enumeratedTextOff ); |
|
571 poppedUpTextArray->AppendL( parentControlStrOff2 ); |
|
572 CleanupStack::Pop( enumeratedTextOff ); |
|
573 CleanupStack::Pop( parentControlStrOff2 ); |
|
574 CleanupStack::Pop( parentControlStrOff1 ); |
|
575 |
|
576 for ( TInt age = KParentControlMinAge; age <= KParentControlAdult; age++ ) |
|
577 { |
|
578 HBufC* parentControlStr1 = NULL; |
|
579 HBufC* parentControlStr2 = NULL; |
|
580 |
|
581 parentControlStr1 = |
|
582 StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_N_YEARS, age ); |
|
583 parentControlStr2 = |
|
584 StringLoader::LoadLC( R_IPTV_PARENTAL_CONTROL_N_YEARS, age ); |
|
585 |
|
586 CAknEnumeratedText* enumeratedText = |
|
587 new ( ELeave ) CAknEnumeratedText( |
|
588 age - KParentControlIndexShift, parentControlStr1 ); |
|
589 CleanupStack::PushL( enumeratedText ); |
|
590 enumeratedTextArray->AppendL( enumeratedText ); |
|
591 poppedUpTextArray->AppendL( parentControlStr2 ); |
|
592 CleanupStack::Pop( enumeratedText ); |
|
593 |
|
594 CleanupStack::Pop( parentControlStr2 ); |
|
595 CleanupStack::Pop( parentControlStr1 ); |
|
596 } |
|
597 |
|
598 CleanupStack::Pop( poppedUpTextArray ); |
|
599 CleanupStack::Pop( enumeratedTextArray ); |
|
600 |
|
601 iSettingParentControlItem->SetEnumeratedTextArrays( |
|
602 enumeratedTextArray, |
|
603 poppedUpTextArray ); |
|
604 iSettingParentControlItem->HandleTextArrayUpdateL(); |
|
605 iSettingParentControlItem->UpdateListBoxTextL(); |
|
606 } |
|
607 |
|
608 |
|
609 // -------------------------------------------------------------------------- |
|
610 // Fetch current parent control age and return corresponding index. |
|
611 // -------------------------------------------------------------------------- |
|
612 // |
|
613 TInt CMPSettingsVideoSettingItemList::GetCurrentParentControl() |
|
614 { |
|
615 TInt parentControlAge( 0 ); |
|
616 TInt parentControlIndex( 0 ); |
|
617 |
|
618 if ( !iVideoSettingsEngine.GetParentControl( parentControlAge ) ) |
|
619 { |
|
620 parentControlAge = KIptvCenRepParentControlKeyDefault; |
|
621 } |
|
622 |
|
623 // Fix age as index. |
|
624 if ( KParentControlAdult < parentControlAge ) |
|
625 { |
|
626 parentControlIndex = KParentControlMaxIndex; |
|
627 } |
|
628 else if ( KParentControlMinAge <= parentControlAge ) |
|
629 { |
|
630 parentControlIndex = parentControlAge - KParentControlIndexShift; |
|
631 } |
|
632 else |
|
633 { |
|
634 parentControlIndex = KParentControlOff; |
|
635 } |
|
636 |
|
637 return parentControlIndex; |
|
638 } |
|
639 |
|
640 // ----------------------------------------------------------------------------- |
|
641 // CMPSettingsVideoSettingItemList::HandleDriveMonitorEvent |
|
642 // ----------------------------------------------------------------------------- |
|
643 // |
|
644 void CMPSettingsVideoSettingItemList::HandleDriveMonitorEvent( |
|
645 TIptvDriveMonitorEvent& /*aEvent*/ ) |
|
646 { |
|
647 TRAP_IGNORE( UpdateMemoryItemTextL() ); |
|
648 } |
|
649 |
|
650 // -------------------------------------------------------------------------- |
|
651 // CVcSettingsViewSettingsListbox::UpdateMemoryItemTextL() |
|
652 // -------------------------------------------------------------------------- |
|
653 // |
|
654 void CMPSettingsVideoSettingItemList::UpdateMemoryItemTextL() |
|
655 { |
|
656 MPX_FUNC( |
|
657 "CMPSettingsVideoSettingItemList::UpdateMemoryItemTextL() start"); |
|
658 |
|
659 if ( !iDriveMonitor ) |
|
660 { |
|
661 iDriveMonitor = CVideoSettingsDriveMonitor::NewL(); |
|
662 iDriveMonitor->RegisterObserverL( this ); |
|
663 } |
|
664 |
|
665 CArrayPtrFlat<CAknEnumeratedText>* enumeratedTextArray = |
|
666 new ( ELeave ) CArrayPtrFlat<CAknEnumeratedText>( 2 ); |
|
667 CleanupStack::PushL( enumeratedTextArray ); // 1-> |
|
668 |
|
669 CArrayPtr<HBufC>* poppedUpTextArray = |
|
670 new ( ELeave ) CArrayPtrFlat<HBufC>( 2 ); |
|
671 CleanupStack::PushL( poppedUpTextArray ); // 2-> |
|
672 |
|
673 TInt i; |
|
674 TInt listIndex = 0; |
|
675 for ( i = 0; i < iDriveMonitor->iAvailableDrives.Count(); i++ ) |
|
676 { |
|
677 if ( (iDriveMonitor->iAvailableDrives[i].iFlags & |
|
678 TIptvDriveInfo::ERemovable) ) |
|
679 { |
|
680 /* |
|
681 * MMC |
|
682 */ |
|
683 if ( (iDriveMonitor->iAvailableDrives[i].iFlags & |
|
684 TIptvDriveInfo::EMediaNotPresent) ) |
|
685 { |
|
686 //removable media not present -> Memory card |
|
687 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: media not present, adding memory card to the list")); |
|
688 |
|
689 AddMemoryCardDesToArraysL( listIndex++, |
|
690 *enumeratedTextArray, |
|
691 *poppedUpTextArray ); |
|
692 } |
|
693 else |
|
694 { |
|
695 if ( (iDriveMonitor->iAvailableDrives[i].iFlags & |
|
696 TIptvDriveInfo::ELocked) ) |
|
697 { |
|
698 //removable media present and locked -> Locked memory card |
|
699 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: Adding locked memory card to the list")); |
|
700 |
|
701 AddLockedMemoryCardDesToArraysL( listIndex++, |
|
702 *enumeratedTextArray, |
|
703 *poppedUpTextArray ); |
|
704 } |
|
705 else |
|
706 { |
|
707 //removable media present and not locked |
|
708 if ( iDriveMonitor->iAvailableDrives[i].iVolumeName.Length() > 0 ) |
|
709 { |
|
710 //removable media present, not locked and name text exits-> Volume name |
|
711 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: adding volume name to the list")); |
|
712 HBufC* volumeName = |
|
713 HBufC::NewL( iDriveMonitor->iAvailableDrives[i].iVolumeName.Length() ); |
|
714 CleanupStack::PushL( volumeName ); // 3-> |
|
715 volumeName->Des() = iDriveMonitor->iAvailableDrives[i].iVolumeName; |
|
716 AddDesToArraysL( listIndex++, |
|
717 volumeName, |
|
718 *enumeratedTextArray, |
|
719 *poppedUpTextArray ); |
|
720 CleanupStack::Pop( volumeName ); // <-3 |
|
721 } |
|
722 else |
|
723 { |
|
724 //removable media present, not locked and label text does not exit-> Memory card |
|
725 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: volume name not defined, adding memory card to the list") ); |
|
726 AddMemoryCardDesToArraysL( listIndex++, |
|
727 *enumeratedTextArray, |
|
728 *poppedUpTextArray ); |
|
729 } |
|
730 } |
|
731 } |
|
732 } |
|
733 else |
|
734 { |
|
735 /* |
|
736 * Fixed drive |
|
737 */ |
|
738 if ( iDriveMonitor->iAvailableDrives[i].iDrive == |
|
739 iDriveMonitor->PhoneMemoryDrive() ) |
|
740 { |
|
741 //2 = c-drive -> Phone Memory |
|
742 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: adding Phone memory to the list")); |
|
743 AddPhoneMemoryDesToArraysL( listIndex++, |
|
744 *enumeratedTextArray, |
|
745 *poppedUpTextArray ); |
|
746 } |
|
747 else |
|
748 { |
|
749 //->Hard disk |
|
750 MPX_DEBUG1(_L("CMPSettingsVideoSettingItemList:: adding Hard disk to the list")); |
|
751 AddHardDiskDesToArraysL( listIndex++, |
|
752 *enumeratedTextArray, |
|
753 *poppedUpTextArray ); |
|
754 } |
|
755 } |
|
756 } |
|
757 |
|
758 iSettingMemoryItem->SetEnumeratedTextArrays( |
|
759 enumeratedTextArray, poppedUpTextArray ); |
|
760 iSettingMemoryItem->HandleTextArrayUpdateL(); |
|
761 iSettingMemoryItem->UpdateListBoxTextL(); |
|
762 |
|
763 CleanupStack::Pop( poppedUpTextArray ); // <-2 |
|
764 CleanupStack::Pop( enumeratedTextArray ); // <-1 |
|
765 |
|
766 DrawDeferred(); |
|
767 } |
|
768 |
|
769 // -------------------------------------------------------------------------- |
|
770 // CMPSettingsVideoSettingItemList::AddPhoneMemoryDesToArraysL() |
|
771 // -------------------------------------------------------------------------- |
|
772 // |
|
773 void CMPSettingsVideoSettingItemList::AddPhoneMemoryDesToArraysL( TInt aIndex, |
|
774 CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray, |
|
775 CArrayPtr<HBufC>& aPoppedUpTextArray ) |
|
776 { |
|
777 HBufC* phoneMemoryDes = StringLoader::LoadLC( R_IPTV_SETTING_PHONE_MEMORY ); // 1-> |
|
778 AddDesToArraysL( aIndex, phoneMemoryDes, aEnumeratedTextArray, aPoppedUpTextArray ); |
|
779 CleanupStack::Pop( phoneMemoryDes ); // <-1 |
|
780 } |
|
781 |
|
782 // -------------------------------------------------------------------------- |
|
783 // CMPSettingsVideoSettingItemList::AddMemoryCardDesToArraysL() |
|
784 // -------------------------------------------------------------------------- |
|
785 // |
|
786 void CMPSettingsVideoSettingItemList::AddMemoryCardDesToArraysL( TInt aIndex, |
|
787 CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray, |
|
788 CArrayPtr<HBufC>& aPoppedUpTextArray ) |
|
789 { |
|
790 HBufC* memoryCardDes = StringLoader::LoadLC( R_IPTV_SETTING_MEMORY_CARD ); // 1-> |
|
791 AddDesToArraysL( aIndex, memoryCardDes, aEnumeratedTextArray, aPoppedUpTextArray ); |
|
792 CleanupStack::Pop( memoryCardDes ); // <-1 |
|
793 } |
|
794 |
|
795 // -------------------------------------------------------------------------- |
|
796 // CVcSettingsViewSettingsListbox::AddLockedMemoryCardDesToArraysL() |
|
797 // -------------------------------------------------------------------------- |
|
798 // |
|
799 void CMPSettingsVideoSettingItemList::AddLockedMemoryCardDesToArraysL( TInt aIndex, |
|
800 CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray, |
|
801 CArrayPtr<HBufC>& aPoppedUpTextArray ) |
|
802 { |
|
803 HBufC* lockedMemoryCardDes = StringLoader::LoadLC( R_IPTV_LOCKED_MEMORY_CARD ); // 1-> |
|
804 AddDesToArraysL( aIndex, lockedMemoryCardDes, aEnumeratedTextArray, aPoppedUpTextArray); |
|
805 CleanupStack::Pop( lockedMemoryCardDes ); // <-1 |
|
806 } |
|
807 |
|
808 // -------------------------------------------------------------------------- |
|
809 // CMPSettingsVideoSettingItemList::AddHardDiskDesToArraysL() |
|
810 // -------------------------------------------------------------------------- |
|
811 // |
|
812 void CMPSettingsVideoSettingItemList::AddHardDiskDesToArraysL( TInt aIndex, |
|
813 CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray, |
|
814 CArrayPtr<HBufC>& aPoppedUpTextArray ) |
|
815 { |
|
816 HBufC* hardDiskDes = StringLoader::LoadLC( R_IPTV_SETTING_MASS_MEMORY ); // 1-> |
|
817 AddDesToArraysL( aIndex, hardDiskDes, aEnumeratedTextArray, aPoppedUpTextArray); |
|
818 CleanupStack::Pop( hardDiskDes ); // <-1 |
|
819 } |
|
820 |
|
821 // -------------------------------------------------------------------------- |
|
822 // CMPSettingsVideoSettingItemList::AddDesToArraysL() |
|
823 // NOTE: Codescanner whines about passing non const HBufC, |
|
824 // but that's needed for CAknEnumeratedText construction. |
|
825 // -------------------------------------------------------------------------- |
|
826 // |
|
827 void CMPSettingsVideoSettingItemList::AddDesToArraysL( TInt aIndex, HBufC* aText, |
|
828 CArrayPtrFlat<CAknEnumeratedText>& aEnumeratedTextArray, |
|
829 CArrayPtr<HBufC>& aPoppedUpTextArray ) |
|
830 { |
|
831 CAknEnumeratedText* enumeratedText = |
|
832 new ( ELeave ) CAknEnumeratedText( aIndex, aText ); |
|
833 CleanupStack::PushL( enumeratedText ); //1-> |
|
834 aEnumeratedTextArray.AppendL( enumeratedText ); |
|
835 CleanupStack::Pop( enumeratedText ); // <-1 |
|
836 |
|
837 HBufC* textCopy = HBufC::NewL( aText->Des().Length() ); |
|
838 CleanupStack::PushL( textCopy ); // 1-> |
|
839 textCopy->Des() = aText->Des(); |
|
840 |
|
841 aPoppedUpTextArray.AppendL( textCopy ); |
|
842 CleanupStack::Pop( textCopy ); // <-1 |
|
843 } |
|
844 |
|
845 // -------------------------------------------------------------------------- |
|
846 // Convert and save parent control index as age. |
|
847 // -------------------------------------------------------------------------- |
|
848 // |
|
849 void CMPSettingsVideoSettingItemList::SetCurrentParentControl( |
|
850 TInt aParentControlIndex ) |
|
851 { |
|
852 TInt parentControlAge( 0 ); |
|
853 |
|
854 // Fix index as age. |
|
855 if ( KParentControlMaxIndex < aParentControlIndex ) |
|
856 { |
|
857 parentControlAge = KParentControlAdult; |
|
858 } |
|
859 else if ( 1 <= aParentControlIndex ) |
|
860 { |
|
861 parentControlAge = aParentControlIndex + KParentControlIndexShift; |
|
862 } |
|
863 else |
|
864 { |
|
865 parentControlAge = 0; |
|
866 } |
|
867 |
|
868 iVideoSettingsEngine.SetParentControl( parentControlAge ); |
|
869 } |
|
870 |
|
871 // -------------------------------------------------------------------------- |
|
872 // Check if video contrast is supported. |
|
873 // -------------------------------------------------------------------------- |
|
874 // |
|
875 TBool CMPSettingsVideoSettingItemList::VideoContrastIsSupportedL() |
|
876 { |
|
877 TInt flags; |
|
878 |
|
879 CRepository* repository = CRepository::NewL( KCRUidMediaPlayerFeatures ); |
|
880 repository->Get( KMPLocalVariation, flags ); |
|
881 delete repository; |
|
882 |
|
883 if ( flags & KMediaPlayerVideoContrast ) |
|
884 { |
|
885 return ETrue; |
|
886 } |
|
887 |
|
888 return EFalse; |
|
889 } |
|
890 |
|
891 // End of File |