1 /* |
|
2 * Copyright (c) 2004-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: Implementation of the CVtUiNaviPane class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CVtUiNaviPane.h" |
|
22 #include "CVtUiNaviPaneControl.h" |
|
23 #include "CVtUiMutedControl.h" |
|
24 #include "CVtUiAppUi.h" |
|
25 |
|
26 #include <cvtlogger.h> |
|
27 #include <avkon.rsg> |
|
28 #include <aknnavi.h> |
|
29 #include <aknnavide.h> |
|
30 #include <featmgr.h> |
|
31 #include "tVtuifeaturevariation.h" |
|
32 |
|
33 // CONSTANTS |
|
34 |
|
35 // Timeout after which voice volume bar is switched back to indicators. |
|
36 const TInt KVtUiVoiceVolumeTimeout = 2000000; |
|
37 |
|
38 // LOCAL FUNCTION PROTOTYPES |
|
39 |
|
40 /** |
|
41 * Creates navigation decorator. |
|
42 * @param aNaviPane reference to navi pane. |
|
43 * @param aControl control to be decorated, ownership passed. |
|
44 * @return new navigation decorator instance. |
|
45 */ |
|
46 CAknNavigationDecorator* CreateDecoratorL( |
|
47 CAknNavigationControlContainer& aNaviPane, |
|
48 CCoeControl* aControl ); |
|
49 |
|
50 // ============================= LOCAL FUNCTIONS =============================== |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CreateDecoratorL Creates navigation decorator. |
|
54 // Returns: new navigation decorator instance. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CAknNavigationDecorator* CreateDecoratorL( |
|
58 CAknNavigationControlContainer& aNaviPane, |
|
59 CCoeControl* aControl ) |
|
60 { |
|
61 CAknNavigationDecorator* decoratedFolder = |
|
62 CAknNavigationDecorator::NewL( |
|
63 &aNaviPane, |
|
64 aControl, |
|
65 CAknNavigationDecorator::ENotSpecified ); |
|
66 |
|
67 CleanupStack::PushL( decoratedFolder ); |
|
68 decoratedFolder->SetContainerWindowL( aNaviPane ); |
|
69 aControl->SetContainerWindowL( *decoratedFolder ); |
|
70 CleanupStack::Pop( decoratedFolder ); |
|
71 |
|
72 decoratedFolder->MakeScrollButtonVisible( EFalse ); |
|
73 |
|
74 return decoratedFolder; |
|
75 } |
|
76 |
|
77 // ============================ MEMBER FUNCTIONS =============================== |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CVtUiNaviPane::CVtUiNaviPane |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 CVtUiNaviPane::CVtUiNaviPane( |
|
84 CAknNavigationControlContainer& aNaviPane, |
|
85 CVtUiAppUi& aAppUi ) |
|
86 : CActive( CActive::EPriorityStandard ), |
|
87 iNaviPane( aNaviPane ), |
|
88 iAppUi ( aAppUi ) |
|
89 { |
|
90 CActiveScheduler::Add( this ); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CVtUiNaviPane::ConstructL |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void CVtUiNaviPane::ConstructL( ) |
|
98 { |
|
99 // Create the navi pane indicator (call duration). |
|
100 { |
|
101 CVtUiNaviPaneControl* naviControl = |
|
102 new ( ELeave ) CVtUiNaviPaneControl( *this ); |
|
103 CleanupStack::PushL( naviControl ); |
|
104 naviControl->ConstructL(); |
|
105 CleanupStack::Pop( naviControl ); |
|
106 |
|
107 iMainIndicators = |
|
108 CreateDecoratorL( iNaviPane, naviControl ); |
|
109 |
|
110 iNaviPaneControl = naviControl; |
|
111 } |
|
112 |
|
113 // Create muted indicator. |
|
114 { |
|
115 CVtUiMutedControl* naviControl = |
|
116 new ( ELeave ) CVtUiMutedControl; |
|
117 CleanupStack::PushL( naviControl ); |
|
118 naviControl->ConstructL(); |
|
119 CleanupStack::Pop( naviControl ); |
|
120 |
|
121 iMutedIndicator = |
|
122 CreateDecoratorL( iNaviPane, naviControl ); |
|
123 iMutedControl = naviControl; |
|
124 } |
|
125 |
|
126 User::LeaveIfError( iTimer.CreateLocal() ); |
|
127 |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CVtUiNaviPane::NewL |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 CVtUiNaviPane* CVtUiNaviPane::NewL( |
|
135 CAknNavigationControlContainer& aNaviPane, |
|
136 CVtUiAppUi& aAppUi ) |
|
137 { |
|
138 CVtUiNaviPane* self = |
|
139 new ( ELeave ) CVtUiNaviPane( |
|
140 aNaviPane, aAppUi ); |
|
141 CleanupStack::PushL( self ); |
|
142 self->ConstructL(); |
|
143 CleanupStack::Pop( self ); |
|
144 return self; |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CVtUiNaviPane::~CVtUiNaviPane |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 CVtUiNaviPane::~CVtUiNaviPane() |
|
152 { |
|
153 Cancel(); |
|
154 |
|
155 delete iMainIndicators; |
|
156 delete iMutedIndicator; |
|
157 |
|
158 iTimer.Close(); |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CVtUiNaviPane::SetCurrentSpeaker |
|
163 // Parameter aLoudspeaker defines which speaker is used. |
|
164 // ETrue for loudspeaker, EFalse for handset. |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void CVtUiNaviPane::SetCurrentSpeaker( const TBool aLoudspeaker ) |
|
168 { |
|
169 if( iLoudspeaker != aLoudspeaker ) |
|
170 { |
|
171 Cancel(); |
|
172 if( iCallDurationEnabled || iMicrophoneMuted ) |
|
173 { |
|
174 iSliderType = ENone; |
|
175 } |
|
176 } |
|
177 iLoudspeaker = aLoudspeaker; |
|
178 } |
|
179 |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CVtUiNaviPane::SetMuted |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 void CVtUiNaviPane::SetMuted( |
|
186 const TBool aStatus ) |
|
187 { |
|
188 __VTPRINT2( DEBUG_GEN, "NaviPane.SetMuted.aStatus=%d", aStatus ) |
|
189 if( iMicrophoneMuted != aStatus ) |
|
190 { |
|
191 Cancel(); |
|
192 // if volume indicator is shown when audio is umuted |
|
193 // volume indicator won't be dismissed and call duration |
|
194 // will not be shown |
|
195 if( iCallDurationEnabled || aStatus ) |
|
196 { |
|
197 iSliderType = ENone; |
|
198 } |
|
199 } |
|
200 iMicrophoneMuted = aStatus; |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CVtUiNaviPane::SetCallDuration |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 void CVtUiNaviPane::SetCallDuration( |
|
208 const TTimeIntervalSeconds& aDuration, |
|
209 const TBool aEnabled ) |
|
210 { |
|
211 iCallDurationEnabled = aEnabled; |
|
212 iNaviPaneControl->SetCallDuration( aDuration, aEnabled ); |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CVtUiNaviPane::CommitL |
|
217 // |
|
218 // Priority order of different navi pane elements is the following: |
|
219 // 1. Muted indicator |
|
220 // 2. Main indicators (call duration) |
|
221 // |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 void CVtUiNaviPane::CommitL() |
|
225 { |
|
226 CAknNavigationDecorator* selected = DefaultIndicator(); |
|
227 |
|
228 PushL( selected ); |
|
229 |
|
230 // If current is main indicators, then update now. |
|
231 if ( iCurrent == iMainIndicators ) |
|
232 { |
|
233 iNaviPaneControl->CommitL(); |
|
234 } |
|
235 } |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // CVtUiNaviPane::GetSpeakerVolume |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 void CVtUiNaviPane::GetSpeakerVolume( |
|
242 const TBool , |
|
243 TInt& aValue ) const |
|
244 { |
|
245 aValue = 0; |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // CVtUiNaviPane::HandleResourceChange |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 void CVtUiNaviPane::HandleResourceChange( |
|
253 TInt aType ) |
|
254 { |
|
255 // iCurrent will get event through navi pane. |
|
256 if ( iMainIndicators != iCurrent ) |
|
257 { |
|
258 iMainIndicators->HandleResourceChange( aType ); |
|
259 iNaviPaneControl->HandleResourceChange( aType ); |
|
260 } |
|
261 if ( iMutedIndicator != iCurrent ) |
|
262 { |
|
263 iMutedIndicator->HandleResourceChange( aType ); |
|
264 iMutedControl->HandleResourceChange( aType ); |
|
265 } |
|
266 } |
|
267 |
|
268 // ----------------------------------------------------------------------------- |
|
269 // CVtUiNaviPane::DoCancel |
|
270 // ----------------------------------------------------------------------------- |
|
271 // |
|
272 void CVtUiNaviPane::DoCancel() |
|
273 { |
|
274 iTimer.Cancel(); |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CVtUiNaviPane::RunL |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 void CVtUiNaviPane::RunL() |
|
282 { |
|
283 iSliderType = ENone; |
|
284 CAknNavigationDecorator* selected = DefaultIndicator(); |
|
285 if ( selected ) |
|
286 { |
|
287 PushL( selected ); |
|
288 } |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CVtUiNaviPane::PushAfterTimeout |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 void CVtUiNaviPane::PushAfterTimeout() |
|
296 { |
|
297 Cancel(); |
|
298 iTimer.After( iStatus, KVtUiVoiceVolumeTimeout ); |
|
299 SetActive(); |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // CVtUiNaviPane::PushL |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 void CVtUiNaviPane::PushL( CAknNavigationDecorator* aNew ) |
|
307 { |
|
308 if ( !aNew ) |
|
309 { |
|
310 if ( iCurrent ) |
|
311 { |
|
312 iNaviPane.Pop(); |
|
313 iCurrent = NULL; |
|
314 } |
|
315 else |
|
316 { |
|
317 iNaviPane.PushDefaultL(); |
|
318 } |
|
319 } |
|
320 else if ( iCurrent != aNew ) |
|
321 { |
|
322 // If current not defined, then push to navi pane. This should be called |
|
323 // during construction. |
|
324 if ( !iCurrent ) |
|
325 { |
|
326 iNaviPane.PushL( *aNew ); |
|
327 iCurrent = aNew; |
|
328 } |
|
329 // Otherwise replace the old one. |
|
330 else |
|
331 { |
|
332 iNaviPane.ReplaceL( *iCurrent, *aNew ); |
|
333 iCurrent = aNew; |
|
334 } |
|
335 } |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CVtUiNaviPane::DefaultIndicator |
|
340 // Returns default indicator. Note that this does not include temporary |
|
341 // zoom indicator. |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 CAknNavigationDecorator* CVtUiNaviPane::DefaultIndicator() const |
|
345 { |
|
346 CAknNavigationDecorator* selected = NULL; |
|
347 |
|
348 if ( IsActive() ) |
|
349 { |
|
350 selected = iMainIndicators; |
|
351 } |
|
352 else if ( iMicrophoneMuted && iSliderType != EVolume && iSliderType != EZoom ) |
|
353 { |
|
354 selected = iMutedIndicator; |
|
355 } |
|
356 else if ( iCallDurationEnabled && iSliderType != EVolume && iSliderType != EZoom ) |
|
357 { |
|
358 selected = iMainIndicators; |
|
359 } |
|
360 |
|
361 return selected; |
|
362 } |
|
363 |
|
364 // End of File |
|