35
|
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: Base class for video telephone popups
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <cvtlogger.h>
|
|
20 |
#include <AknUtils.h>
|
|
21 |
#include <AknVolumePopup.h>
|
|
22 |
#include <fbs.h>
|
|
23 |
|
|
24 |
#include "cvtuipopupbase.h"
|
|
25 |
#include "mvtuicomponentmanager.h"
|
|
26 |
#include "mvtuicomponentstateobserver.h"
|
|
27 |
#include "VtUiPanic.h"
|
|
28 |
#include <layoutmetadata.cdl.h>
|
|
29 |
#include <videotelui.rsg>
|
|
30 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
31 |
|
|
32 |
// default time out time for popup
|
|
33 |
const TInt KDefaultTimeOutTime = 2;
|
|
34 |
|
|
35 |
// max value for slider is 100 (100%)
|
|
36 |
const TInt KMaxSliderValue = 100;
|
|
37 |
|
|
38 |
// Implementation of TVtUiBaseComponentState
|
|
39 |
|
|
40 |
// ---------------------------------------------------------------------------
|
|
41 |
// TVtUiBaseComponentState::TVtUiBaseComponentState
|
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
TVtUiBaseComponentState::TVtUiBaseComponentState(
|
|
45 |
MVtUiComponent& aComponent, TVtUiBlockListBitField aBitField ) :
|
|
46 |
TVtUiComponentState( aComponent, aBitField )
|
|
47 |
{
|
|
48 |
}
|
|
49 |
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
// CVtUiPopupBase::~CVtUiPopupBase
|
|
52 |
// ---------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
CVtUiPopupBase::~CVtUiPopupBase()
|
|
55 |
{
|
|
56 |
__VTPRINTENTER( "CVtUiPopupBase.~CVtUiPopupBase" )
|
|
57 |
if ( iPopup )
|
|
58 |
{
|
|
59 |
iPopup->CloseVolumePopup();
|
|
60 |
}
|
|
61 |
// unregister component change registration
|
|
62 |
iComponentManager.ChangeComponentRegistration(
|
|
63 |
iComponentState, MVtUiComponentManager::EUnregister );
|
|
64 |
delete iPopup;
|
|
65 |
__VTPRINTEXIT( "CVtUiPopupBase.~CVtUiPopupBase" )
|
|
66 |
}
|
|
67 |
|
|
68 |
// ---------------------------------------------------------------------------
|
|
69 |
// CVtUiPopupBase::ComponentId
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
MVtUiComponent::TComponentId CVtUiPopupBase::ComponentId() const
|
|
73 |
{
|
|
74 |
__VTPRINTENTER( "CVtUiPopupBase.ComponentId" )
|
|
75 |
__VTPRINTEXIT( "CVtUiPopupBase.ComponentId" )
|
|
76 |
return iComponentId;
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// CVtUiPopupBase::ComponentAsControl
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
CCoeControl* CVtUiPopupBase::ComponentAsControl()
|
|
84 |
{
|
|
85 |
__VTPRINTENTER( "CVtUiPopupBase.ComponentAsControl" )
|
|
86 |
__VTPRINTEXIT( "CVtUiPopupBase.ComponentAsControl" )
|
|
87 |
return NULL;
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// CVtUiPopupBase::DoActivateL
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
void CVtUiPopupBase::DoActivateL()
|
|
95 |
{
|
|
96 |
__VTPRINTENTER( "CVtUiPopupBase.DoActivateL" )
|
|
97 |
User::LeaveIfError(
|
|
98 |
iComponentManager.ChangeResourceChangeRegistration(
|
|
99 |
*this, MVtUiComponentManager::ERegister ) );
|
|
100 |
|
|
101 |
User::LeaveIfError( iComponentManager.ChangeKeyEventRegistration(
|
|
102 |
*this, MVtUiComponentManager::ERegister ) );
|
|
103 |
|
|
104 |
ShowPopupL();
|
|
105 |
__VTPRINTEXIT( "CVtUiPopupBase.DoActivateL" )
|
|
106 |
}
|
|
107 |
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
// CVtUiPopupBase::DoDeactivateL()
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
void CVtUiPopupBase::DoDeactivateL()
|
|
113 |
{
|
|
114 |
__VTPRINTENTER( "CVtUiPopupBase.DoDeactivateL()" )
|
|
115 |
iPopup->CloseVolumePopup();
|
|
116 |
//notify observer that popup has been closed
|
|
117 |
if ( iCompStateObserver )
|
|
118 |
{
|
|
119 |
iCompStateObserver->ComponenStateChangedL();
|
|
120 |
}
|
|
121 |
// unregister resource change registration
|
|
122 |
iComponentManager.ChangeResourceChangeRegistration(
|
|
123 |
*this, MVtUiComponentManager::EUnregister );
|
|
124 |
|
|
125 |
iComponentManager.ChangeKeyEventRegistration(
|
|
126 |
*this, MVtUiComponentManager::EUnregister );
|
|
127 |
__VTPRINTEXIT( "CVtUiPopupBase.DoDeactivateL()" )
|
|
128 |
}
|
|
129 |
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
// CVtUiPopupBase::HandleResourceChangeL()
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
void CVtUiPopupBase::HandleResourceChangeL( TInt aType )
|
|
135 |
{
|
|
136 |
__VTPRINTENTER( "CVtUiPopupBase.HandleResourceChangeL()" )
|
|
137 |
if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
138 |
{
|
|
139 |
iPopup->SetPosition( PopupPosition() );
|
|
140 |
}
|
|
141 |
__VTPRINTEXIT( "CVtUiPopupBase.HandleResourceChangeL()" )
|
|
142 |
}
|
|
143 |
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
// CVtUiPopupBase::HandleControlEventL
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
void CVtUiPopupBase::HandleControlEventL( CCoeControl* /*aControl*/,
|
|
149 |
TCoeEvent aEventType )
|
|
150 |
{
|
|
151 |
__VTPRINTENTER( "CVtUiPopupBase.HandleControlEventL" )
|
|
152 |
if ( aEventType == EEventStateChanged )
|
|
153 |
{
|
|
154 |
// popup closed
|
|
155 |
if( !IsPopUpVisible() )
|
|
156 |
{
|
|
157 |
ClosePopup();
|
|
158 |
}
|
|
159 |
}
|
|
160 |
__VTPRINTEXIT( "CVtUiPopupBase.HandleControlEventL" )
|
|
161 |
}
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// CVtUiPopupBase::OfferKeyEventL()
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
TKeyResponse CVtUiPopupBase::OfferKeyEventL( const TKeyEvent& aEvent,
|
|
168 |
TEventCode aCode )
|
|
169 |
{
|
|
170 |
__VTPRINTENTER( "CVtUiPopupBase.OfferKeyEventL" )
|
|
171 |
TKeyResponse response( EKeyWasNotConsumed );
|
|
172 |
// Don't handle other types here
|
|
173 |
if ( aCode != EEventKey )
|
|
174 |
{
|
|
175 |
return response;
|
|
176 |
}
|
|
177 |
|
|
178 |
if ( aEvent.iScanCode == EStdKeyUpArrow ||
|
|
179 |
aEvent.iScanCode == EStdKeyDownArrow )
|
|
180 |
{
|
|
181 |
__VTPRINT( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL" )
|
|
182 |
TInt step( 1 );
|
|
183 |
if ( aEvent.iScanCode == EStdKeyDownArrow )
|
|
184 |
{
|
|
185 |
step = -step;
|
|
186 |
}
|
|
187 |
|
|
188 |
const TInt current( Value() );
|
|
189 |
TInt value( current + step );
|
|
190 |
|
|
191 |
TInt maxValue;
|
|
192 |
TInt minValue;
|
|
193 |
iPopup->GetRange( minValue, maxValue );
|
|
194 |
|
|
195 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL iPopup minValue = %d",
|
|
196 |
minValue )
|
|
197 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL iPopup maxValue = %d",
|
|
198 |
maxValue )
|
|
199 |
|
|
200 |
minValue = minValue / iScalingConstant;
|
|
201 |
value = Max( minValue, Min( value, iStepCount ) );
|
|
202 |
if ( value != current )
|
|
203 |
{
|
|
204 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OfferKeyEventL Volume value = %d",
|
|
205 |
value )
|
|
206 |
SetValue( value );
|
|
207 |
response = EKeyWasConsumed;
|
|
208 |
}
|
|
209 |
ShowPopupL();
|
|
210 |
}
|
|
211 |
__VTPRINTEXITR( "CVtUiPopupBase.OfferKeyEventL %d", response )
|
|
212 |
return response;
|
|
213 |
}
|
|
214 |
|
|
215 |
// ---------------------------------------------------------------------------
|
|
216 |
// CVtUiPopupBase::SetObserver()
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CVtUiPopupBase::SetObserver( MVtUiComponentStateObserver& aCompStateObserver )
|
|
220 |
{
|
|
221 |
__VTPRINTENTER( "CVtUiPopupBase.SetObserver()" )
|
|
222 |
iCompStateObserver = &aCompStateObserver;
|
|
223 |
__VTPRINTEXIT( "CVtUiPopupBase.SetObserver()" )
|
|
224 |
}
|
|
225 |
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
// CVtUiPopupBase::SetValueType()
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
void CVtUiPopupBase::SetValueType( TInt aValueType )
|
|
231 |
{
|
|
232 |
__VTPRINTENTER( "CVtUiPopupBase.SetValueType" )
|
|
233 |
iPopup->SetValueType( aValueType );
|
|
234 |
__VTPRINTEXIT( "CVtUiPopupBase.SetValueType" )
|
|
235 |
}
|
|
236 |
|
|
237 |
// ---------------------------------------------------------------------------
|
|
238 |
// CVtUiPopupBase::SetPermanenVisibility()
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
void CVtUiPopupBase::SetPermanenVisibility( TBool aPermanent )
|
|
242 |
{
|
|
243 |
__VTPRINTENTER( "CVtUiPopupBase.SetPermanenVisibility" )
|
|
244 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase = %d", aPermanent );
|
|
245 |
const TInt longPeriod( 86400 ); // 24 h
|
|
246 |
if ( aPermanent )
|
|
247 |
{
|
|
248 |
iPopup->SetTimeOutAsSecond( longPeriod );
|
|
249 |
iPopup->ClosePopupWhenTappedOutside( !aPermanent );
|
|
250 |
}
|
|
251 |
else
|
|
252 |
{
|
|
253 |
iPopup->ClosePopupWhenTappedOutside( !aPermanent );
|
|
254 |
iPopup->SetTimeOutAsSecond( iTimeOutTime );
|
|
255 |
}
|
|
256 |
__VTPRINTEXIT( "CVtUiPopupBase.SetPermanenVisibility" )
|
|
257 |
}
|
|
258 |
|
|
259 |
// ---------------------------------------------------------------------------
|
|
260 |
// CVtUiPopupBase::CVtUiPopupBase
|
|
261 |
// ---------------------------------------------------------------------------
|
|
262 |
//
|
|
263 |
CVtUiPopupBase::CVtUiPopupBase( MVtUiComponentManager& aComponentManager,
|
|
264 |
TVtUiBlockListBitField aBitField, TComponentId aComponentId ) :
|
|
265 |
iComponentManager ( aComponentManager ), iComponentState( *this, aBitField ),
|
|
266 |
iComponentId( aComponentId ), iScalingConstant( 1 )
|
|
267 |
{
|
|
268 |
__VTPRINTENTER( "CVtUiPopupBase.CVtUiPopupBase" )
|
|
269 |
__VTPRINTEXIT( "CVtUiPopupBase.CVtUiPopupBase" )
|
|
270 |
}
|
|
271 |
|
|
272 |
// ---------------------------------------------------------------------------
|
|
273 |
// CVtUiPopupBase::BaseConstructL
|
|
274 |
// ---------------------------------------------------------------------------
|
|
275 |
//
|
|
276 |
void CVtUiPopupBase::BaseConstructL()
|
|
277 |
{
|
|
278 |
__VTPRINTENTER( "CVtUiPopupBase.BaseConstructL" )
|
|
279 |
iPopup = CAknVolumePopup::NewL( NULL, ETrue );
|
|
280 |
iPopup->SetObserver( this );
|
|
281 |
|
|
282 |
// Initialized to 2 seconds
|
|
283 |
iTimeOutTime = KDefaultTimeOutTime;
|
|
284 |
|
|
285 |
// set position
|
|
286 |
iPopup->SetPosition( PopupPosition() );
|
|
287 |
|
|
288 |
User::LeaveIfError(
|
|
289 |
iComponentManager.ChangeComponentRegistration(
|
|
290 |
iComponentState, MVtUiComponentManager::ERegister ) );
|
|
291 |
__VTPRINTEXIT( "CVtUiPopupBase.BaseConstructL" )
|
|
292 |
}
|
|
293 |
|
|
294 |
// ---------------------------------------------------------------------------
|
|
295 |
// CVtUiPopupBase::ShowPopupL
|
|
296 |
// ---------------------------------------------------------------------------
|
|
297 |
//
|
|
298 |
void CVtUiPopupBase::ShowPopupL()
|
|
299 |
{
|
|
300 |
__VTPRINTENTER( "CVtUiPopupBase.ShowPopupL" )
|
|
301 |
iPopup->ShowVolumePopupL();
|
|
302 |
__VTPRINTEXIT( "CVtUiPopupBase.ShowPopupL" )
|
|
303 |
}
|
|
304 |
|
|
305 |
// ---------------------------------------------------------------------------
|
|
306 |
// CVtUiPopupBase::OpenPopupL
|
|
307 |
// ---------------------------------------------------------------------------
|
|
308 |
//
|
|
309 |
void CVtUiPopupBase::OpenPopupL()
|
|
310 |
{
|
|
311 |
__VTPRINTENTER( "CVtUiPopupBase.OpenPopupL" )
|
|
312 |
TRAPD( error,
|
|
313 |
iComponentManager.RequestActivationL( ComponentId() ) );
|
|
314 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.OpenPopupL reqAct=%d", error );
|
|
315 |
User::LeaveIfError( error );
|
|
316 |
__VTPRINTEXIT( "CVtUiPopupBase.OpenPopupL" )
|
|
317 |
}
|
|
318 |
|
|
319 |
// ---------------------------------------------------------------------------
|
|
320 |
// CVtUiPopupBase::ClosePopup
|
|
321 |
// ---------------------------------------------------------------------------
|
|
322 |
//
|
|
323 |
void CVtUiPopupBase::ClosePopup()
|
|
324 |
{
|
|
325 |
__VTPRINTENTER( "CVtUiPopupBase.ClosePopup" )
|
|
326 |
TInt error( KErrNone );
|
|
327 |
TRAP( error, iComponentManager.DeActivateComponentL( ComponentId() ) );
|
|
328 |
__VTPRINTEXITR( "CVtUiPopupBase.ClosePopup %d", error )
|
|
329 |
}
|
|
330 |
|
|
331 |
// ---------------------------------------------------------------------------
|
|
332 |
// CVtUiPopupBase::SetTimeOut
|
|
333 |
// ---------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
void CVtUiPopupBase::SetTimeOut( TInt aTime )
|
|
336 |
{
|
|
337 |
iTimeOutTime = aTime;
|
|
338 |
iPopup->SetTimeOutAsSecond( aTime );
|
|
339 |
}
|
|
340 |
|
|
341 |
// ---------------------------------------------------------------------------
|
|
342 |
// CVtUiPopupBase::IsPopUpVisible
|
|
343 |
// ---------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
TBool CVtUiPopupBase::IsPopUpVisible()
|
|
346 |
{
|
|
347 |
return iPopup->IsVisible();
|
|
348 |
}
|
|
349 |
|
|
350 |
// ---------------------------------------------------------------------------
|
|
351 |
// CVtUiPopupBase::PopupPosition
|
|
352 |
// ---------------------------------------------------------------------------
|
|
353 |
//
|
|
354 |
TPoint CVtUiPopupBase::PopupPosition() const
|
|
355 |
{
|
|
356 |
__VTPRINTENTER( "CVtUiPopupBase.PopupPosition" )
|
|
357 |
TRect mainPaneRect;
|
|
358 |
TAknWindowLineLayout popupLineLayout;
|
|
359 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
|
|
360 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
361 |
{
|
|
362 |
popupLineLayout =
|
|
363 |
AknLayoutScalable_Apps::aid_placing_vt_slider_lsc().LayoutLine();
|
|
364 |
}
|
|
365 |
else
|
|
366 |
{
|
|
367 |
popupLineLayout =
|
|
368 |
AknLayoutScalable_Apps::aid_placing_vt_slider_prt().LayoutLine();
|
|
369 |
}
|
|
370 |
|
|
371 |
TAknLayoutRect layoutRect;
|
|
372 |
layoutRect.LayoutRect( mainPaneRect, popupLineLayout );
|
|
373 |
__VTPRINTEXIT( "CVtUiPopupBase.PopupPosition" )
|
|
374 |
return layoutRect.Rect().iTl;
|
|
375 |
}
|
|
376 |
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
// CVtUiPopupBase::SetPopupValue
|
|
379 |
// ---------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
void CVtUiPopupBase::SetPopupValue( TInt aValue )
|
|
382 |
{
|
|
383 |
iPopup->SetValue( aValue * iScalingConstant );
|
|
384 |
}
|
|
385 |
|
|
386 |
// ---------------------------------------------------------------------------
|
|
387 |
// CVtUiPopupBase::SetAdjustRange
|
|
388 |
// ---------------------------------------------------------------------------
|
|
389 |
//
|
|
390 |
void CVtUiPopupBase::SetAdjustRange( TInt aMinValue, TInt aMaxValue,
|
|
391 |
TInt aStepCount )
|
|
392 |
{
|
|
393 |
__VTPRINTENTER( "CVtUiPopupBase.SetAdjustRange" )
|
|
394 |
__ASSERT_ALWAYS( aMinValue <= aMaxValue &&
|
|
395 |
( aMaxValue - aMinValue ) >= aStepCount &&
|
|
396 |
aStepCount > 0, VtUiPanic::Panic( EVtUiPanicOutOfRange ) );
|
|
397 |
|
|
398 |
// store stepcount
|
|
399 |
iStepCount = aStepCount;
|
|
400 |
|
|
401 |
// Aknvolumepopup does not do any scaling i.e max value
|
|
402 |
// must be 100 or otherwise the per cent value is not shown right.
|
|
403 |
// Scaling constant is used to multiple max value to be 100.
|
|
404 |
iScalingConstant = KMaxSliderValue / aMaxValue;
|
|
405 |
iPopup->SetRange( aMinValue, KMaxSliderValue );
|
|
406 |
TInt stepSize = KMaxSliderValue / aStepCount;
|
|
407 |
iPopup->SetStepSize( stepSize );
|
|
408 |
__VTPRINTEXIT( "CVtUiPopupBase.SetAdjustRange" )
|
|
409 |
}
|
|
410 |
|
|
411 |
// ---------------------------------------------------------------------------
|
|
412 |
// CVtUiPopupBase::SetValue
|
|
413 |
// ---------------------------------------------------------------------------
|
|
414 |
//
|
|
415 |
void CVtUiPopupBase::SetValue( TInt aValue )
|
|
416 |
{
|
|
417 |
__VTPRINTENTER( "CVtUiPopupBase.SetValue" )
|
|
418 |
SetPopupValue( aValue );
|
|
419 |
__VTPRINTEXITR( "CVtUiPopupBase.SetValue %d", Value() )
|
|
420 |
}
|
|
421 |
|
|
422 |
// ---------------------------------------------------------------------------
|
|
423 |
// CVtUiPopupBase::ScaleAndSetValue
|
|
424 |
// ---------------------------------------------------------------------------
|
|
425 |
//
|
|
426 |
void CVtUiPopupBase::ScaleAndSetValue( TInt aValue )
|
|
427 |
{
|
|
428 |
__VTPRINTENTER( "CVtUiPopupBase.ScaleAndSetValue" )
|
|
429 |
SetPopupValue( SliderValueWithScaling( aValue ) );
|
|
430 |
__VTPRINTEXITR( "CVtUiPopupBase.ScaleAndSetValue %d", Value() )
|
|
431 |
}
|
|
432 |
|
|
433 |
// ---------------------------------------------------------------------------
|
|
434 |
// CVtUiPopupBase::ScaledValue
|
|
435 |
// ---------------------------------------------------------------------------
|
|
436 |
//
|
|
437 |
TInt CVtUiPopupBase::ScaledValue() const
|
|
438 |
{
|
|
439 |
__VTPRINTENTER( "CVtUiPopupBase.ScaledValue" )
|
|
440 |
TInt value = Value() * ( iMax-iMin ) / iStepCount + iMin;
|
|
441 |
__VTPRINTEXITR( "CVtUiPopupBase.ScaledValue %d", value )
|
|
442 |
return value;
|
|
443 |
}
|
|
444 |
|
|
445 |
// ---------------------------------------------------------------------------
|
|
446 |
// CVtUiPopupBase::SliderValueWithScaling
|
|
447 |
// ---------------------------------------------------------------------------
|
|
448 |
//
|
|
449 |
TInt CVtUiPopupBase::SliderValueWithScaling( TInt aValue) const
|
|
450 |
{
|
|
451 |
__VTPRINTENTER( "CVtUiPopupBase.SliderValueWithScaling" )
|
|
452 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.aValue=%d", aValue )
|
|
453 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.iStepCount=%d", iStepCount )
|
|
454 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase.iMax=%d", iMax )
|
|
455 |
|
|
456 |
if ( iMax == aValue)
|
|
457 |
{
|
|
458 |
return iStepCount;
|
|
459 |
}
|
|
460 |
else if ( iMin == aValue )
|
|
461 |
{
|
|
462 |
return 0;
|
|
463 |
}
|
|
464 |
TInt modValue = iStepCount * ( aValue - iMin) % ( iMax - iMin );
|
|
465 |
TInt value = iStepCount * ( aValue - iMin) / ( iMax - iMin );
|
|
466 |
|
|
467 |
if ( modValue > ( iMax - iMin ) / 2 )
|
|
468 |
{
|
|
469 |
value++;
|
|
470 |
}
|
|
471 |
|
|
472 |
__VTPRINTEXITR( "CVtUiPopupBase.SliderValueWithScaling %d", value )
|
|
473 |
return value;
|
|
474 |
}
|
|
475 |
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
// CVtUiPopupBase::SetMinAndMaxValues
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
void CVtUiPopupBase::SetMinAndMaxValues( TInt aMin, TInt aMax )
|
|
481 |
{
|
|
482 |
__VTPRINTENTER( "CVtUiPopupBase.SetMaxAndMinValues" )
|
|
483 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase..aMax=%d", aMax )
|
|
484 |
__VTPRINT2( DEBUG_GEN, "CVtUiPopupBase..aMinV=%d", aMin )
|
|
485 |
iMax = aMax;
|
|
486 |
iMin = aMin;
|
|
487 |
__VTPRINTEXIT( "CVtUiPopupBase.SetMaxAndMinValues " )
|
|
488 |
}
|
|
489 |
|
|
490 |
// ---------------------------------------------------------------------------
|
|
491 |
// CVtUiPopupBase::Value
|
|
492 |
// ---------------------------------------------------------------------------
|
|
493 |
//
|
|
494 |
TInt CVtUiPopupBase::Value() const
|
|
495 |
{
|
|
496 |
__VTPRINTENTER( "CVtUiPopupBase.Value" )
|
|
497 |
__VTPRINTEXITR( "CVtUiPopupBase.Value %d", iPopup->Value() )
|
|
498 |
return iPopup->Value() / iScalingConstant;
|
|
499 |
}
|
|
500 |
|
|
501 |
// ---------------------------------------------------------------------------
|
|
502 |
// CVtUiPopupBase::UpdatePopupL
|
|
503 |
// ---------------------------------------------------------------------------
|
|
504 |
//
|
|
505 |
void CVtUiPopupBase::UpdatePopupL()
|
|
506 |
{
|
|
507 |
__VTPRINTENTER( "CVtUiPopupBase.UpdatePopupL" )
|
|
508 |
__VTPRINTEXIT( "CVtUiPopupBase.UpdatePopupL " )
|
|
509 |
}
|