|
1 /* |
|
2 * Copyright (c) 2006 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: Feature manager for Video Telephone application. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "cvtuifeaturemanager.h" |
|
22 #include "CVtUiAppUi.h" |
|
23 #include "cvtuifixedtoolbar.h" |
|
24 #include "cvtuifloatingtoolbar.h" |
|
25 #include "cvtuimenus.h" |
|
26 #include "cvtuifeaturebase.h" |
|
27 #include "tvtuistates.h" |
|
28 #include <cvtlogger.h> |
|
29 #include "cvtuicommandpolicymanager.h" |
|
30 #include "cvtuisoftkeys.h" |
|
31 #include "cvtuinumberentry.h" |
|
32 #include "cvtuivideoquality.h" |
|
33 #include "cvtuiwhitebalance.h" |
|
34 #include "cvtuicolortone.h" |
|
35 #include "cvtuidialer.h" |
|
36 #include "cvtuibrightness.h" |
|
37 #include "cvtuicontrast.h" |
|
38 #include "cvtuivolume.h" |
|
39 #include "cvtuizoom.h" |
|
40 |
|
41 #include <featmgr.h> |
|
42 |
|
43 // CONSTANTS |
|
44 const TInt KFeatureCount = 9; |
|
45 |
|
46 // ======== LOCAL FUNCTIONS ======== |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // Used in Attach() method to compare two instances of MVtUiFeature. |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 TInt FeatureCmpFunc( const CVtUiFeatureBase& aV1, const CVtUiFeatureBase& aV2 ) |
|
53 { |
|
54 return ( aV1.Id() - aV2.Id() ); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // Used in GetFeature() method to search feature by id. |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 TInt FeatureIdCmpFunc( const TInt* aId, const CVtUiFeatureBase& aFeature ) |
|
62 { |
|
63 return ( *aId - aFeature.Id() ); |
|
64 } |
|
65 |
|
66 |
|
67 // ============================ MEMBER FUNCTIONS =============================== |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CVtUiFeatureManager::NewL |
|
71 // Two-phased constructor. |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CVtUiFeatureManager* CVtUiFeatureManager::NewL( CVtUiAppUi& aAppUi, |
|
75 TVtUiStates& aUiStates, MVtUiCommandManager& aCommandManager, |
|
76 MVtUiComponentManager& aComponentManager ) |
|
77 { |
|
78 CVtUiFeatureManager* self = new( ELeave ) CVtUiFeatureManager( aAppUi, |
|
79 aUiStates, aCommandManager, aComponentManager ); |
|
80 CleanupStack::PushL( self ); |
|
81 self->ConstructL(); |
|
82 CleanupStack::Pop(); |
|
83 return self; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CVtUiFeatureManager::CVtUiFeatureManager |
|
88 // C++ constructor can NOT contain any code, that |
|
89 // might leave. |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 CVtUiFeatureManager::CVtUiFeatureManager( CVtUiAppUi& aAppUi, |
|
93 TVtUiStates& aUiStates, MVtUiCommandManager& aCommandManager, |
|
94 MVtUiComponentManager& aComponentManager ) |
|
95 : iAppUi( aAppUi ), iUiStates( aUiStates ), |
|
96 iCommandManager( aCommandManager ), iComponentManager( aComponentManager ) |
|
97 { |
|
98 __VTPRINTENTER( "CVtUiFeatureManager.CVtUiFeatureManager" ) |
|
99 __VTPRINTEXIT( "CVtUiFeatureManager.CVtUiFeatureManager" ) |
|
100 } |
|
101 |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 //CVtUiFeatureManager::~CVtUiFeatureManager() |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 CVtUiFeatureManager::~CVtUiFeatureManager() |
|
108 { |
|
109 __VTPRINTENTER( "CVtUiFeatureManager.~" ) |
|
110 iFeatures.ResetAndDestroy(); |
|
111 __VTPRINTEXIT( "CVtUiFeatureManager.~" ) |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CVtUiFeatureManager::ConstructL |
|
116 // Symbian 2nd phase constructor can leave. |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void CVtUiFeatureManager::ConstructL() |
|
120 { |
|
121 __VTPRINTENTER( "CVtUiFeatureManager.ConstructL" ) |
|
122 iFeatures.ReserveL( KFeatureCount ); |
|
123 CreateFeaturesL(); |
|
124 __VTPRINTEXIT( "CVtUiFeatureManager.ConstructL" ) |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CVtUiFeatureManager::CreateFeaturesL |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CVtUiFeatureManager::CreateFeaturesL() |
|
132 { |
|
133 __VTPRINTENTER( "CVtUiFeatureManager.CreateFeaturesL" ) |
|
134 CVtUiFeatureBase* feature = NULL; |
|
135 TLinearOrder< CVtUiFeatureBase > |
|
136 linOrder( ::FeatureCmpFunc ); |
|
137 |
|
138 if ( AknLayoutUtils::PenEnabled() ) |
|
139 { |
|
140 feature = CVtUiFixedToolbar::NewL( *this ); |
|
141 } |
|
142 else |
|
143 { |
|
144 feature = CVtUiFloatingToolbar::NewL( *this ); |
|
145 } |
|
146 |
|
147 if ( feature ) |
|
148 { |
|
149 iFeatures.InsertInOrderL( feature, linOrder ); |
|
150 } |
|
151 |
|
152 feature = CVtUiMenus::NewL( *this ); |
|
153 iFeatures.InsertInOrderL( feature, linOrder ); |
|
154 |
|
155 feature = CVtUiSoftkeys::NewL( *this, *iAppUi.GetCba() ); |
|
156 iFeatures.InsertInOrderL( feature, linOrder ); |
|
157 |
|
158 feature = CVtUiNumberEntry::NewL( *this ); |
|
159 iFeatures.InsertInOrderL( feature, linOrder ); |
|
160 |
|
161 if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) ) |
|
162 { |
|
163 feature = CVtUiDialer::NewL( *this ); |
|
164 if ( feature ) |
|
165 { |
|
166 iFeatures.InsertInOrderL( feature, linOrder ); |
|
167 } |
|
168 } |
|
169 |
|
170 feature = CVtUiVideoQuality::NewL( *this ); |
|
171 if ( feature ) |
|
172 { |
|
173 iFeatures.InsertInOrderL( feature, linOrder ); |
|
174 } |
|
175 |
|
176 feature = CVtUiWhiteBalance::NewL( *this ); |
|
177 if ( feature ) |
|
178 { |
|
179 iFeatures.InsertInOrderL( feature, linOrder ); |
|
180 } |
|
181 |
|
182 feature = CVtUiColorTone::NewL( *this ); |
|
183 if ( feature ) |
|
184 { |
|
185 iFeatures.InsertInOrderL( feature, linOrder ); |
|
186 } |
|
187 |
|
188 feature = CVtUiBrightness::NewL( *this ); |
|
189 if ( feature ) |
|
190 { |
|
191 iFeatures.InsertInOrderL( feature, linOrder ); |
|
192 } |
|
193 |
|
194 feature = CVtUiContrast::NewL( *this ); |
|
195 if ( feature ) |
|
196 { |
|
197 iFeatures.InsertInOrderL( feature, linOrder ); |
|
198 } |
|
199 |
|
200 feature = CVtUiVolume::NewL( *this ); |
|
201 if ( feature ) |
|
202 { |
|
203 iFeatures.InsertInOrderL( feature, linOrder ); |
|
204 } |
|
205 |
|
206 feature = CVtUiZoom::NewL( *this ); |
|
207 if ( feature ) |
|
208 { |
|
209 iFeatures.InsertInOrderL( feature, linOrder ); |
|
210 } |
|
211 |
|
212 __VTPRINTEXIT( "CVtUiFeatureManager.CreateFeaturesL" ) |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CVtUiFeatureManager::AppUi |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 CVtUiAppUi& CVtUiFeatureManager::AppUi() |
|
220 { |
|
221 __VTPRINTENTER( "CVtUiFeatureManager.AppUi" ) |
|
222 __VTPRINTEXIT( "CVtUiFeatureManager.AppUi" ) |
|
223 return iAppUi; |
|
224 } |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CVtUiFeatureManager::GetFeatureById |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 MVtUiFeature* CVtUiFeatureManager::GetFeatureById( TInt aId ) |
|
231 { |
|
232 __VTPRINTENTER( "CVtUiFeatureManager.GetFeatureById" ) |
|
233 CVtUiFeatureBase* result = NULL; |
|
234 |
|
235 TInt index( iFeatures.FindInOrder( aId, ::FeatureIdCmpFunc ) ); |
|
236 if ( index != KErrNotFound ) |
|
237 { |
|
238 result = iFeatures[ index ]; |
|
239 } |
|
240 __VTPRINTEXITR( "CVtUiFeatureManager.GetFeatureById %d", (TInt)result ) |
|
241 return result; |
|
242 |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // CVtUiFeatureManager::UiStates |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 |
|
250 TVtUiStates& CVtUiFeatureManager::UiStates() |
|
251 { |
|
252 return iUiStates; |
|
253 } |
|
254 |
|
255 // ----------------------------------------------------------------------------- |
|
256 // CVtUiFeatureManager::CommandManager |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 MVtUiCommandManager& CVtUiFeatureManager::CommandManager() |
|
260 { |
|
261 return iCommandManager; |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // CVtUiFeatureManager::ComponentManager |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 MVtUiComponentManager& CVtUiFeatureManager::ComponentManager() |
|
269 { |
|
270 return iComponentManager; |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CVtUiFeatureManager::Model |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 CVtEngModel& CVtUiFeatureManager::Model() |
|
278 { |
|
279 return iAppUi.Model(); |
|
280 } |