|
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: Implementation of base class for video preference popups |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <cvtlogger.h> |
|
20 #include <mvtengcamerapreferences.h> |
|
21 #include <cvtengmodel.h> |
|
22 |
|
23 #include "cvtuiprefpopupbase.h" |
|
24 #include "mvtuicomponentmanager.h" |
|
25 #include "mvtuicomponentstateobserver.h" |
|
26 #include "cvtuifeaturemanager.h" |
|
27 #include "CVtUiAppUi.h" |
|
28 |
|
29 // Number of steps |
|
30 static const TInt KStepCount = 20; |
|
31 |
|
32 // Slider min value |
|
33 static const TInt KSLiderMinValue = -100; |
|
34 |
|
35 // Slider min value |
|
36 static const TInt KSLiderDefaultValue = 0; |
|
37 |
|
38 // Slider max value |
|
39 static const TInt KSLiderMaxValue = 100; |
|
40 |
|
41 // Min adjust value |
|
42 static const TInt KMinAdjustValue = 0; |
|
43 |
|
44 // Max adjust value |
|
45 static const TInt KMaxAdjustValue = 20; |
|
46 |
|
47 // default time out time for zoom popup |
|
48 const TInt KDefaultPrefTimeOutTime = 5; |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CVtUiPrefPopupBase::~CVtUiPrefPopupBase |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CVtUiPrefPopupBase::~CVtUiPrefPopupBase() |
|
55 { |
|
56 __VTPRINTENTER( "CVtUiPrefPopupBase.~CVtUiPrefPopupBase" ) |
|
57 __VTPRINTEXIT( "CVtUiPrefPopupBase.~CVtUiPrefPopupBase" ) |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CVtUiPrefPopupBase::HandleControlEventL() |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CVtUiPrefPopupBase::HandleControlEventL( |
|
65 CCoeControl* aControl,TCoeEvent aEventType ) |
|
66 { |
|
67 __VTPRINTENTER( "CVtUiPrefPopupBase.HandleControlEventL" ) |
|
68 CVtUiPopupBase::HandleControlEventL( aControl, aEventType ); |
|
69 if ( aEventType == EEventStateChanged ) |
|
70 { |
|
71 const TInt value( Value() ); |
|
72 if ( value != iCurrent ) |
|
73 { |
|
74 __VTPRINT( DEBUG_GEN, "CVtUiPrefPopupBase.OfferKeyEventL value != current " ) |
|
75 iCurrent = value; |
|
76 __VTPRINT2( DEBUG_GEN, "CVtUiPrefPopupBase.HandleControlEventL = %d", ScaledValue() ) |
|
77 AdjustVideoL( ScaledValue() ); |
|
78 } |
|
79 } |
|
80 |
|
81 __VTPRINTEXIT( "CVtUiPrefPopupBase.HandleControlEventL" ) |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CVtUiPrefPopupBase::UpdatePopupL() |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CVtUiPrefPopupBase::UpdatePopupL() |
|
89 { |
|
90 __VTPRINTENTER( "CVtUiPrefPopupBase.UpdatePrefPopupL" ) |
|
91 |
|
92 AdjustVideoL( ScaledValue() ); |
|
93 |
|
94 __VTPRINTEXIT( "CVtUiPrefPopupBase.UpdatePrefPopupL" ) |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CVtUiPrefPopupBase::OfferKeyEventL() |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 TKeyResponse CVtUiPrefPopupBase::OfferKeyEventL( const TKeyEvent& aEvent, |
|
102 TEventCode aCode ) |
|
103 { |
|
104 __VTPRINTENTER( "CVtUiPrefPopupBase.OfferKeyEventL" ) |
|
105 TKeyResponse response = |
|
106 CVtUiPopupBase::OfferKeyEventL( aEvent, aCode ); |
|
107 |
|
108 if ( response == EKeyWasConsumed ) |
|
109 { |
|
110 AdjustVideoL( ScaledValue() ); |
|
111 } |
|
112 |
|
113 __VTPRINTEXIT( "CVtUiPrefPopupBase.OfferKeyEventL" ) |
|
114 return response; |
|
115 } |
|
116 |
|
117 // CVtUiPrefPopupBase::AdjustVideoL() |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 void CVtUiPrefPopupBase::AdjustVideoL( TInt aValue ) |
|
121 { |
|
122 __VTPRINTENTER( "CVtUiPrefPopupBase.AdjustVideoL" ) |
|
123 // cast the parameter |
|
124 TPtrC8 params( reinterpret_cast< TUint8* >( &aValue ), sizeof( TInt ) ); |
|
125 |
|
126 // Adjust Contrast |
|
127 iFeatureManager.AppUi().DoExecuteCmdL( iEngineCommandId, ¶ms ); |
|
128 __VTPRINTEXIT( "CVtUiPrefPopupBase.AdjustVideoL" ) |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CVtUiPrefPopupBase::DoActivateL() |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 void CVtUiPrefPopupBase::DoActivateL() |
|
136 { |
|
137 __VTPRINTENTER( "CVtUiPrefPopupBase.DoActivateL" ) |
|
138 CVtUiPopupBase::DoActivateL(); |
|
139 // Set current value |
|
140 __VTPRINT2( DEBUG_GEN, "CVtUiPrefPopupBase.DoActivateL = %d", CurrentValue() ) |
|
141 ScaleAndSetValue( CurrentValue() ); |
|
142 AdjustVideoL( ScaledValue() ); |
|
143 __VTPRINTEXIT( "CVtUiPrefPopupBase.DoActivateL" ) |
|
144 } |
|
145 |
|
146 // CVtUiPrefPopupBase::CVtUiPrefPopupBase |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 CVtUiPrefPopupBase::CVtUiPrefPopupBase( CVtUiFeatureManager& aFeatureManager, |
|
150 TVtUiBlockListBitField aBitField, TComponentId aComponentId, TInt aCmdId ) : |
|
151 CVtUiPopupBase( aFeatureManager.ComponentManager(), aBitField, |
|
152 aComponentId ), iFeatureManager( aFeatureManager ), |
|
153 iEngineCommandId ( aCmdId ) |
|
154 { |
|
155 __VTPRINTENTER( "CVtUiPrefPopupBase.CVtUiPrefPopupBase" ) |
|
156 __VTPRINTEXIT( "CVtUiPrefPopupBase.CVtUiPrefPopupBase" ) |
|
157 } |
|
158 |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // CVtUiPrefPopupBase::BaseConstructL |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 void CVtUiPrefPopupBase::BaseConstructL() |
|
165 { |
|
166 __VTPRINTENTER( "CVtUiPrefPopupBase.BaseConstructL" ) |
|
167 CVtUiPopupBase::BaseConstructL(); |
|
168 // Get camera preferences extension. |
|
169 iCameraPref = static_cast<MVtEngCameraPreferences*> ( iFeatureManager. |
|
170 AppUi().Model().Extension( KVtEngExtensionCameraPreferences ) ); |
|
171 |
|
172 // Set range and step count for the slider |
|
173 SetAdjustRange( KMinAdjustValue, KMaxAdjustValue, KStepCount ); |
|
174 |
|
175 // Set value range to baseclass |
|
176 // range e.g. 0-20 |
|
177 SetMinAndMaxValues( KSLiderMinValue , KSLiderMaxValue ); |
|
178 |
|
179 // Set slider type to percentage |
|
180 SetValueType( EAknSliderValuePercentage ); |
|
181 |
|
182 // Set default value |
|
183 ScaleAndSetValue( KSLiderDefaultValue ); |
|
184 |
|
185 // Set timeout |
|
186 SetTimeOut( KDefaultPrefTimeOutTime ); |
|
187 |
|
188 __VTPRINTEXIT( "CVtUiPrefPopupBase.BaseConstructL" ) |
|
189 } |