|
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: Camcorder sub-menu in General Settings. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <aknlists.h> //for CAknSettingStyleListBox |
|
21 #include <gscamerapluginrsc.rsg> |
|
22 #include <camerasettingsplugin.mbg> |
|
23 #include <GSListbox.h> //for listbox clases |
|
24 #include <AknIconArray.h> // CAknIconArray |
|
25 #include <eikclbd.h> // CColumnListBoxData |
|
26 |
|
27 #include "CamAppUid.h" |
|
28 #include "GSCamcorderPluginContainer.h" |
|
29 #include "GSCamcorderPlugin.hrh" |
|
30 #include "Cam.hrh" |
|
31 #include "GSCamcorderPlugin.h" |
|
32 #include <csxhelp/lcam.hlp.hrh> |
|
33 |
|
34 const TInt KIconArrayGranularity = 2; |
|
35 |
|
36 // ========================= MEMBER FUNCTIONS ================================ |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CGSCamcorderPluginContainer::ConstructL |
|
40 // Symbian OS default constructor |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 void CGSCamcorderPluginContainer::ConstructL( const TRect& aRect ) |
|
44 { |
|
45 RDebug::Print( _L( "[CGSCamcorderPluginContainer]: ConstructL - Begin" ) ); |
|
46 |
|
47 // Construct iListBox |
|
48 iListBox = new ( ELeave ) CAknSingleLargeStyleListBox; |
|
49 BaseConstructL( aRect, R_GS_CAMCORDER_VIEW_TITLE, R_CAM_LBX ); |
|
50 LoadIconsL(); |
|
51 RDebug::Print( _L( "[CGSCamcorderPluginContainer]: ConstructL - End" ) ); |
|
52 } |
|
53 |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CGSCamcorderPluginContainer::~CGSTelPluginContainer |
|
57 // Destructor |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 CGSCamcorderPluginContainer::~CGSCamcorderPluginContainer() |
|
61 { |
|
62 delete iListboxItemArray; |
|
63 } |
|
64 |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CGSCamcorderPluginContainer::UpdateListBoxL |
|
68 // Update listbox item |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 void CGSCamcorderPluginContainer::UpdateListBoxL( TInt aFeatureId ) |
|
72 { |
|
73 RDebug::Print( |
|
74 _L( "[CGSCamcorderPluginContainer]: UpdateListBoxL - Begin" ) ); |
|
75 switch ( aFeatureId ) |
|
76 { |
|
77 case EVideoSettingsFolder: |
|
78 MakeVideoSettingsFolderItemL(); |
|
79 break; |
|
80 case EImageSettingsFolder: |
|
81 MakeImageSettingsFolderItemL(); |
|
82 break; |
|
83 |
|
84 default: |
|
85 break; |
|
86 } |
|
87 |
|
88 // Update the listbox |
|
89 iListBox->HandleItemAdditionL(); |
|
90 RDebug::Print( |
|
91 _L( "[CGSCamcorderPluginContainer]: UpdateListBoxL - End" ) ); |
|
92 } |
|
93 |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CGSCamcorderPluginContainer::ConstructListBoxL |
|
97 // Update listbox item |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CGSCamcorderPluginContainer::ConstructListBoxL( TInt aResLbxId ) |
|
101 { |
|
102 RDebug::Print( |
|
103 _L( "[CGSCamcorderPluginContainer]: ConstructListBoxL - Begin" ) ); |
|
104 iListBox->ConstructL( this, EAknListBoxSelectionList ); |
|
105 |
|
106 iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, |
|
107 *iListBox, *iCoeEnv ); |
|
108 iListBox->Model()->SetItemTextArray( iListboxItemArray ); |
|
109 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
110 |
|
111 CreateListBoxItemsL(); |
|
112 RDebug::Print( |
|
113 _L( "[CGSCamcorderPluginContainer]: ConstructListBoxL - End" ) ); |
|
114 } |
|
115 |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CGSCamcorderPluginContainer::CreateListBoxItemsL |
|
119 // Update listbox item |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void CGSCamcorderPluginContainer::CreateListBoxItemsL() |
|
123 { |
|
124 RDebug::Print( |
|
125 _L( "[CGSCamcorderPluginContainer]: CreateListBoxItemsL - Begin" ) ); |
|
126 MakeVideoSettingsFolderItemL(); |
|
127 MakeImageSettingsFolderItemL(); |
|
128 RDebug::Print( |
|
129 _L( "[CGSCamcorderPluginContainer]: CreateListBoxItemsL - End" ) ); |
|
130 } |
|
131 |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CGSCamcorderPluginContainer::CurrentFeatureId |
|
135 // Get the currently selected feature |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 TInt CGSCamcorderPluginContainer::CurrentFeatureId() const |
|
139 { |
|
140 return iListboxItemArray->CurrentFeature(); |
|
141 } |
|
142 |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // CGSCamcorderPluginContainer::MakeVideoSettingsFolderItemL |
|
146 // Create Video Settings folder item |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 void CGSCamcorderPluginContainer::MakeVideoSettingsFolderItemL() |
|
150 { |
|
151 iListboxItemArray->SetItemVisibilityL( EVideoSettingsFolder, |
|
152 CGSListBoxItemTextArray::EVisible ); |
|
153 } |
|
154 |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CGSTelPluginContainer::MakeImageSettingsFolderItemL |
|
158 // Create Image Settings folder item |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 void CGSCamcorderPluginContainer::MakeImageSettingsFolderItemL() |
|
162 { |
|
163 iListboxItemArray->SetItemVisibilityL( EImageSettingsFolder, |
|
164 CGSListBoxItemTextArray::EVisible ); |
|
165 } |
|
166 |
|
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // CGSCamcorderPluginContainer::GetHelpContext |
|
170 // Get help for this view |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 void CGSCamcorderPluginContainer::GetHelpContext( |
|
174 TCoeHelpContext& aContext ) const |
|
175 { |
|
176 #ifdef __SERIES60_HELP |
|
177 aContext.iMajor = TUid::Uid( KCameraappUID ); |
|
178 aContext.iContext = KLCAM_HLP_SETTINGS; |
|
179 #endif |
|
180 } |
|
181 |
|
182 |
|
183 |
|
184 // ---------------------------------------------------------------------------- |
|
185 // CGSCamcorderPluginContainer::LoadIconsL |
|
186 // Load icon bitmaps. |
|
187 // ---------------------------------------------------------------------------- |
|
188 // |
|
189 void CGSCamcorderPluginContainer::LoadIconsL() |
|
190 { |
|
191 RDebug::Print( _L( "[CGSCamcorderPluginContainer]: LoadIconsL - Begin" ) ); |
|
192 CEikColumnListBox* listbox = static_cast<CEikColumnListBox*>( iListBox ); |
|
193 |
|
194 // Delete the old icon array, if any |
|
195 delete listbox->ItemDrawer()->ColumnData()->IconArray(); |
|
196 listbox->ItemDrawer()->ColumnData()->SetIconArray( NULL ); |
|
197 |
|
198 // Construct a new CAknIconArray for iListBox |
|
199 CAknIconArray* icons = |
|
200 new ( ELeave ) CAknIconArray( KIconArrayGranularity ); |
|
201 CleanupStack::PushL( icons ); |
|
202 |
|
203 TParse* fp = new(ELeave) TParse(); |
|
204 CleanupStack::PushL( fp ); |
|
205 TInt err = fp->Set(KDirAndFile, &KDC_APP_BITMAP_DIR, NULL); |
|
206 |
|
207 if (err != KErrNone) |
|
208 { |
|
209 User::Leave(err); |
|
210 } |
|
211 TBuf<KMaxFileName> fileName = fp->FullName(); |
|
212 CleanupStack::PopAndDestroy( fp ); //fp |
|
213 |
|
214 AppendIconToArrayL( |
|
215 icons, |
|
216 KAknsIIDQgnPropSetCamsImageSub, |
|
217 fileName, |
|
218 EMbmCamerasettingspluginQgn_lcam_gen_sett_camera_folder_image, |
|
219 EMbmCamerasettingspluginQgn_lcam_gen_sett_camera_folder_image_mask ); |
|
220 |
|
221 AppendIconToArrayL( |
|
222 icons, |
|
223 KAknsIIDQgnPropSetCamsVideoSub, |
|
224 fileName, |
|
225 EMbmCamerasettingspluginQgn_lcam_gen_sett_camera_folder_video, |
|
226 EMbmCamerasettingspluginQgn_lcam_gen_sett_camera_folder_video_mask ); |
|
227 |
|
228 CleanupStack::Pop( icons ); // icons |
|
229 |
|
230 listbox->ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
231 RDebug::Print( _L( "[CGSCamcorderPluginContainer]: LoadIconsL - End" ) ); |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------------------------- |
|
235 // CGSCamcorderPluginContainer::SizeChanged |
|
236 // Set the size and position of component controls. |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 void CGSCamcorderPluginContainer::SizeChanged() |
|
240 { |
|
241 if ( iListBox ) |
|
242 { |
|
243 iListBox->SetRect( Rect() ); |
|
244 } |
|
245 } |
|
246 |
|
247 |
|
248 // ---------------------------------------------------------------------------- |
|
249 // CGSCamcorderPluginContainer::FocusChanged |
|
250 //Focus changed for listbox item. |
|
251 // ---------------------------------------------------------------------------- |
|
252 // |
|
253 void CGSCamcorderPluginContainer::FocusChanged( TDrawNow aDrawNow ) |
|
254 { |
|
255 CCoeControl::FocusChanged( aDrawNow ); |
|
256 if( iListBox ) |
|
257 { |
|
258 iListBox->SetFocus( IsFocused(), aDrawNow ); |
|
259 } |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // CGSCamcorderPluginContainer::AppendIconToArrayL |
|
264 // Load a possibly skinned icon (with mask) and append it to an |
|
265 // icon array. |
|
266 // --------------------------------------------------------------------------- |
|
267 // |
|
268 void CGSCamcorderPluginContainer::AppendIconToArrayL( CAknIconArray* aArray, |
|
269 const TAknsItemID& aID, |
|
270 const TDesC& aMbmFile, |
|
271 TInt aBitmapId, |
|
272 TInt aMaskId ) |
|
273 { |
|
274 CGulIcon* icon = AknsUtils::CreateGulIconL( |
|
275 AknsUtils::SkinInstance(), aID, aMbmFile, |
|
276 aBitmapId, aMaskId ); |
|
277 |
|
278 CleanupStack::PushL( icon ); |
|
279 aArray->AppendL( icon ); |
|
280 CleanupStack::Pop( icon ); // icon |
|
281 } |
|
282 // End of File |