1 /* |
|
2 * Copyright (c) 2007 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: Setting item type for Image/Video quality.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "GSCamQualitySettingItem.h" |
|
21 #include "GSCamQualitySettingPage.h" |
|
22 #include "CamUtility.h" |
|
23 #include "CamStaticSettingsModel.h" |
|
24 |
|
25 #include "camconfiguration.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 // --------------------------------------------------------------------------- |
|
31 // CGSCamQualitySettingItem::CGSCamQualitySettingItem |
|
32 // C++ constructor |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CGSCamQualitySettingItem::CGSCamQualitySettingItem( |
|
36 TCamCameraMode aMode, |
|
37 TInt aIdentifier, |
|
38 TInt& aValue, |
|
39 CCamStaticSettingsModel& aModel ) |
|
40 : CAknEnumeratedTextPopupSettingItem( aIdentifier, aValue ), |
|
41 iMode( aMode ), |
|
42 iModel( aModel ) |
|
43 { |
|
44 } |
|
45 |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CGSCamQualitySettingItem::~CGSCamQualitySettingItem |
|
49 // Destructor. |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CGSCamQualitySettingItem::~CGSCamQualitySettingItem() |
|
53 { |
|
54 PRINT( _L("Camera => ~CGSCamQualitySettingItem") ); |
|
55 iSupportedQualitiesArray.Reset(); |
|
56 PRINT( _L("Camera <= ~CGSCamQualitySettingItem") ); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CGSCamQualitySettingItem::CreateSettingPageL |
|
61 // Framework method for constructing the launching setting page. |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CAknSettingPage* CGSCamQualitySettingItem::CreateSettingPageL() |
|
65 { |
|
66 PRINT( _L("Camera => CGSCamQualitySettingItem::CreateSettingPageL") ); |
|
67 // Create an instance of our customized setting page. |
|
68 TPtrC settingName = SettingName(); |
|
69 CAknSettingPage* page = |
|
70 new( ELeave ) CGSCamQualitySettingPage( iMode, |
|
71 settingName, |
|
72 SettingNumber(), |
|
73 EAknCtPopupSettingList, |
|
74 SettingEditorResourceId(), |
|
75 SettingPageResourceId(), |
|
76 *QueryValue() ); |
|
77 PRINT( _L("Camera <= CGSCamQualitySettingItem::CreateSettingPageL") ); |
|
78 return page; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CGSCamQualitySettingItem::CompleteConstructionL |
|
83 // |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CGSCamQualitySettingItem::CompleteConstructionL() |
|
87 { |
|
88 PRINT( _L("Camera => CGSCamQualitySettingItem::CompleteConstructionL") ); |
|
89 CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); |
|
90 |
|
91 // make sure we only have the supported items in our text array |
|
92 CArrayPtr<CAknEnumeratedText>* array = EnumeratedTextArray(); |
|
93 |
|
94 TBool isVideoMode = (ECamControllerVideo == iMode); |
|
95 |
|
96 TCamPsiKey key = isVideoMode |
|
97 ? ECamPsiSupportedVideoQualities |
|
98 : ECamPsiSupportedStillQualities; |
|
99 |
|
100 iModel.Configuration().GetPsiIntArrayL( key, iSupportedQualitiesArray ); |
|
101 |
|
102 iSupportedQualitiesArray.Sort(); |
|
103 |
|
104 // amend list of supported settings |
|
105 TInt sCount = iSupportedQualitiesArray.Count(); |
|
106 |
|
107 TInt cnt = array->Count(); |
|
108 TInt j = --sCount; |
|
109 TInt i; |
|
110 |
|
111 for ( i = cnt; --i >= 0; ) |
|
112 { |
|
113 if( j < 0 || |
|
114 i != iModel.Configuration().MapSupportedQualityToQualityDescriptor( |
|
115 isVideoMode, |
|
116 iSupportedQualitiesArray[j] ) |
|
117 ) |
|
118 { |
|
119 delete ( array->At( i ) ); |
|
120 array->Delete( i ); |
|
121 } |
|
122 else |
|
123 { |
|
124 j--; |
|
125 } |
|
126 } |
|
127 // Reset the enum values in the resource, so that the updated list has the |
|
128 // new values starting from 0 |
|
129 for( i = 0; i < array->Count(); i++ ) |
|
130 { |
|
131 array->At(i)->SetEnumerationValue( i ); |
|
132 } |
|
133 |
|
134 #ifdef _DEBUG |
|
135 PRINT( _L("Camera <> ===============================================") ); |
|
136 PRINT( _L("Camera <> Quality setting item texts left:") ); |
|
137 for( i = 0; i < array->Count(); i++ ) |
|
138 { |
|
139 PRINT2( _L("Camera <> Quality (%d): %S"), |
|
140 i, |
|
141 array->At(i)->Value() ); |
|
142 } |
|
143 PRINT( _L("Camera <> ===============================================") ); |
|
144 #endif |
|
145 |
|
146 PRINT( _L("Camera <= CGSCamQualitySettingItem::CompleteConstructionL") ); |
|
147 } |
|
148 |
|
149 // End of file |
|