1 /* |
|
2 * Copyright (c) 2005 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: Mus Applications Event Observer Interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "musuigeneralview.h" |
|
21 #include "musui.hrh" |
|
22 #include "musuiappui.h" // Application UI class |
|
23 #include "musuistatuspanehandler.h" |
|
24 #include "musuieventcontroller.h" |
|
25 #include "musuiviewcontainer.h" |
|
26 #include "musuidefinitions.h" |
|
27 #include "mussettings.h" |
|
28 #include "mussettingskeys.h" |
|
29 #include "muslogger.h" // debug logging |
|
30 #include "musuiactivetimer.h" |
|
31 #include "musuibackgroundviewcontainer.h" |
|
32 #include <musui.rsg> |
|
33 #include <musui.mbg> |
|
34 |
|
35 #include <eikenv.h> // Eikon enviroment |
|
36 #include <aknViewAppUi.h> |
|
37 #include <avkon.hrh> |
|
38 #include <eikmenup.h> |
|
39 #include <akntoolbar.h> |
|
40 #include <aknbutton.h> |
|
41 #include <AknIncallBubbleNotify.h> |
|
42 #include <featmgr.h> |
|
43 |
|
44 const TInt KBackgroundIntervalForClose = 10 * 1000 * 1000; // 10s |
|
45 const TInt KMusFgBgEventFiltering = 200 * 1000; // 200 ms |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // EPOC two-phased constructor |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 void CMusUiGeneralView::ConstructL() |
|
52 { |
|
53 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::ConstructL" ); |
|
54 |
|
55 BaseConstructL( R_MUSUI_VIEW ); |
|
56 TInt toolbarId = R_MUS_TOOLBAR; |
|
57 if (!AknLayoutUtils::PenEnabled()) |
|
58 { |
|
59 toolbarId = R_MUS_TOOLBAR_NONTOUCH; |
|
60 } |
|
61 CreateAndSetToolbarL(toolbarId); |
|
62 |
|
63 // check if operator specific functionality is needed |
|
64 iOperatorSpecificFunctionality = |
|
65 ( MultimediaSharingSettings::OperatorVariantSettingL() == |
|
66 MusSettingsKeys::EOperatorSpecific ); |
|
67 |
|
68 iIncallBubble = CAknIncallBubble::NewL(); |
|
69 iSessionEndTimer = CMusUiActiveTimer::NewL( this ); |
|
70 |
|
71 iFgBgTimer = CMusUiActiveTimer::NewL( this ); |
|
72 |
|
73 if( MUS_NO_TOOLBAR ) |
|
74 { |
|
75 MUS_LOG( "mus: [MUSUI ] Operator variant hides toolbar!" ); |
|
76 Toolbar()->SetToolbarVisibility( EFalse ); |
|
77 Toolbar()->MakeVisible(EFalse); |
|
78 } |
|
79 |
|
80 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::ConstructL" ); |
|
81 } |
|
82 |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // Destructor |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 CMusUiGeneralView::~CMusUiGeneralView() |
|
89 { |
|
90 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::~CMusUiGeneralView" ); |
|
91 |
|
92 delete iSessionEndTimer; |
|
93 |
|
94 delete iFgBgTimer; |
|
95 |
|
96 if ( iIncallBubble ) |
|
97 { |
|
98 TRAP_IGNORE( iIncallBubble->SetIncallBubbleAllowedInUsualL( ETrue ) ) |
|
99 } |
|
100 delete iIncallBubble; |
|
101 |
|
102 /* Remove and delete background container */ |
|
103 if ( iBackgroundContainer ) |
|
104 { |
|
105 AppUi()->RemoveFromViewStack( *this, iBackgroundContainer ); |
|
106 } |
|
107 delete iBackgroundContainer; |
|
108 |
|
109 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::~CMusUiGeneralView" ); |
|
110 } |
|
111 |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // Fetches a pointer to the application's AppUi class ( CMusUiAppUi ) |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 CMusUiAppUi* CMusUiGeneralView::MusAppUi() const |
|
118 { |
|
119 MUS_LOG( "mus: [MUSUI ] CMusUiGeneralView::MusAppUi()" ); |
|
120 return static_cast<CMusUiAppUi*>( iEikonEnv->AppUi() ); |
|
121 } |
|
122 |
|
123 |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // To be overridden in subclasses |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CMusUiGeneralView::HandleKeyUpEvent( TInt /*aKeyCode*/ ) |
|
130 { |
|
131 // NOP |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 void CMusUiGeneralView::SetToolbarVisibility( TBool aVisible ) |
|
139 { |
|
140 MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::SetToolbarVisibility: %d", |
|
141 aVisible ); |
|
142 |
|
143 if( MUS_NO_TOOLBAR ) |
|
144 { |
|
145 MUS_LOG( "mus: [MUSUI ] Operator variant hides toolbar!" ); |
|
146 Toolbar()->SetToolbarVisibility( EFalse ); |
|
147 Toolbar()->MakeVisible(EFalse); |
|
148 return; |
|
149 } |
|
150 |
|
151 // Show toolbar only after established session and before of exit procedure |
|
152 if ( aVisible && |
|
153 EventController() && |
|
154 !EventController()->ExitOccured() && |
|
155 EventController()->ConnectionEstablished() ) |
|
156 { |
|
157 MUS_LOG( "mus: [MUSUI ] setting toolbar visible" ); |
|
158 |
|
159 if ( SharingContainer().WaitDialogShown() ) |
|
160 { |
|
161 // Cannot show toolbar at the moment as it would go over the dialog. |
|
162 // Instead, request container to set visibility once dialog |
|
163 // is dismissed. |
|
164 SharingContainer().RequestToolbarVisibilityOnceDialogDismissed( this ); |
|
165 } |
|
166 else |
|
167 { |
|
168 Toolbar()->SetToolbarVisibility( ETrue ); |
|
169 Toolbar()->MakeVisible(ETrue); |
|
170 } |
|
171 } |
|
172 else if ( !aVisible && EventController()->ExitOccured() ) |
|
173 { |
|
174 Toolbar()->SetToolbarVisibility( EFalse ); |
|
175 Toolbar()->MakeVisible(EFalse); |
|
176 } |
|
177 else |
|
178 { |
|
179 MUS_LOG( "mus: [MUSUI ] We do not set fixed toolbar invisible" ); |
|
180 if (!AknLayoutUtils::PenEnabled()) |
|
181 { |
|
182 Toolbar()->SetToolbarVisibility( EFalse ); |
|
183 Toolbar()->MakeVisible(EFalse); |
|
184 } |
|
185 |
|
186 SharingContainer().RequestToolbarVisibilityOnceDialogDismissed( NULL ); |
|
187 } |
|
188 |
|
189 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::SetToolbarVisibility" ); |
|
190 } |
|
191 |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void CMusUiGeneralView::AsyncQueryDialogAcceptedL( TBool aAccepted ) |
|
198 { |
|
199 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::AsyncQueryDialogAcceptedL" ); |
|
200 |
|
201 EventControllerL().AsyncQueryDialogAcceptedL( aAccepted ); |
|
202 |
|
203 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::AsyncQueryDialogAcceptedL" ); |
|
204 } |
|
205 |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 // ----------------------------------------------------------------------------- |
|
210 // |
|
211 TInt CMusUiGeneralView::FocusedToolbarItem() const |
|
212 { |
|
213 MUS_LOG( "mus: [MUSUI ] <-> CMusUiGeneralView::FocusedToolbarItem" ); |
|
214 return Toolbar()->FocusedItem(); |
|
215 } |
|
216 |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 void CMusUiGeneralView::DynInitToolbarL( TInt /*aResourceId*/, |
|
223 CAknToolbar* /*aToolbar*/ ) |
|
224 { |
|
225 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DynInitToolbarL" ); |
|
226 |
|
227 Toolbar()->SetWithSliding( EFalse ); |
|
228 |
|
229 // Hide items according to states of speaker and microphone: |
|
230 |
|
231 Toolbar()->HideItem( EventControllerL().IsMicMutedL() ? |
|
232 EMusuiCmdToolbarMute : |
|
233 EMusuiCmdToolbarUnmute, |
|
234 ETrue, |
|
235 ETrue ); |
|
236 |
|
237 TBool loudSpeakerEnabled( EventControllerL().IsLoudSpeakerEnabled() ); |
|
238 |
|
239 Toolbar()->HideItem( loudSpeakerEnabled ? |
|
240 EMusuiCmdToolbarSpeakerOn : |
|
241 EMusuiCmdToolbarSpeakerOff, |
|
242 ETrue, |
|
243 ETrue ); |
|
244 |
|
245 // Dim audio routing button if audio routing cannot be changed |
|
246 // or when some button is selected |
|
247 TBool dimAudioRouting( iToolbarItemSelected || |
|
248 !EventControllerL().AudioRoutingCanBeChanged() ); |
|
249 |
|
250 Toolbar()->SetItemDimmed( loudSpeakerEnabled ? |
|
251 EMusuiCmdToolbarSpeakerOff : |
|
252 EMusuiCmdToolbarSpeakerOn, |
|
253 dimAudioRouting, |
|
254 ETrue ); |
|
255 |
|
256 |
|
257 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DynInitToolbarL" ); |
|
258 } |
|
259 |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 void CMusUiGeneralView::OfferToolbarEventL( TInt aCommand ) |
|
266 { |
|
267 MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::OfferToolbarEventL: %d", |
|
268 aCommand ); |
|
269 EventControllerL().OfferToolbarEventL( aCommand ); |
|
270 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::OfferToolbarEventL" ); |
|
271 } |
|
272 |
|
273 |
|
274 // ----------------------------------------------------------------------------- |
|
275 // |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 TBool CMusUiGeneralView::ShowWaitDialogL( const TDesC& aPrompt, |
|
279 TInt aTimerInSeconds, |
|
280 TInt aExpirationMessageResourceId ) |
|
281 { |
|
282 MUS_LOG_TDESC( "mus: [MUSUI ] -> CMusUiGeneralView::ShowWaitDialogL: ", |
|
283 aPrompt ); |
|
284 |
|
285 TBool retVal = SharingContainer().RunWaitDialogL( |
|
286 aPrompt, |
|
287 aTimerInSeconds, |
|
288 aExpirationMessageResourceId ); |
|
289 |
|
290 MUS_LOG1( "mus: [MUSUI ] <- CMusUiGeneralView::ShowWaitDialogL: retVal = %d", |
|
291 retVal ) |
|
292 |
|
293 return retVal; |
|
294 } |
|
295 |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 void CMusUiGeneralView::DismissWaitDialogL( TBool aReturnValue ) |
|
302 { |
|
303 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DismissWaitDialogL" ); |
|
304 |
|
305 SharingContainer().DismissWaitDialogL( aReturnValue ); |
|
306 |
|
307 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DismissWaitDialogL" ); |
|
308 } |
|
309 |
|
310 |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 // ----------------------------------------------------------------------------- |
|
314 // |
|
315 void CMusUiGeneralView::SetWaitDialogCallbackL( MProgressDialogCallback* aCallback ) |
|
316 { |
|
317 SharingContainer().SetWaitDialogCallbackL( aCallback ); |
|
318 } |
|
319 |
|
320 |
|
321 // ----------------------------------------------------------------------------- |
|
322 // |
|
323 // ----------------------------------------------------------------------------- |
|
324 // |
|
325 void CMusUiGeneralView::ShowStatusPaneTitleL() |
|
326 { |
|
327 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::ShowStatusPaneTitleL" ); |
|
328 |
|
329 MusAppUi()->MusStatusPane()->ActivateNaviPaneMediaL(); |
|
330 |
|
331 // Status Pane Title: |
|
332 if ( EventControllerL().MusContactName().Length() > 0 ) |
|
333 { |
|
334 MusAppUi()->MusStatusPane()->SetTitleL( |
|
335 EventControllerL().MusContactName() ); |
|
336 } |
|
337 else if ( EventControllerL().MusTelNumberValue().Length() > 0 ) |
|
338 { |
|
339 MusAppUi()->MusStatusPane()->SetTitleL( |
|
340 EventControllerL().MusTelNumberValue() ); |
|
341 } |
|
342 else |
|
343 { |
|
344 MusAppUi()->MusStatusPane()->SetTitleFromResourceL( |
|
345 R_MUS_LIVE_SHARING_VIEW_TITLE ); |
|
346 } |
|
347 |
|
348 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::ShowStatusPaneTitleL" ); |
|
349 } |
|
350 |
|
351 |
|
352 // ----------------------------------------------------------------------------- |
|
353 // |
|
354 // ----------------------------------------------------------------------------- |
|
355 // |
|
356 void CMusUiGeneralView::EnableMiddleSoftkeyL( TInt aResourceId ) |
|
357 { |
|
358 // Update Middle softkey |
|
359 CEikButtonGroupContainer* cba = Cba(); |
|
360 if ( cba ) |
|
361 { |
|
362 cba->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
363 aResourceId ); |
|
364 cba->DrawDeferred(); |
|
365 } |
|
366 } |
|
367 |
|
368 |
|
369 // ----------------------------------------------------------------------------- |
|
370 // |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 void CMusUiGeneralView::ActivateVolumeControlL( TInt aValue ) |
|
374 { |
|
375 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::ActivateVolumeControlL" ); |
|
376 |
|
377 MusAppUi()->MusStatusPane()->ActivateVolumeControlL( aValue ); |
|
378 |
|
379 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::ActivateVolumeControlL" ); |
|
380 } |
|
381 |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 void CMusUiGeneralView::HighlightSelectedToolbarItem( TInt aCommand ) |
|
388 { |
|
389 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::HightlightSelectedToolbarItem" ); |
|
390 iToolbarItemSelected = !iToolbarItemSelected; |
|
391 CAknButton* button = static_cast<CAknButton*>( Toolbar()->ControlOrNull( |
|
392 aCommand ) ); |
|
393 button->SetCurrentState( iToolbarItemSelected ? 1 : 0, ETrue ); |
|
394 |
|
395 TBool dimAudioRouting( iToolbarItemSelected || |
|
396 !( EventController() && |
|
397 EventController()->AudioRoutingCanBeChanged() ) ); |
|
398 |
|
399 for ( TInt i = EMusuiCmdToolbarVolume; i < EMusUiCmdToolbarLastIndex; i++ ) |
|
400 { |
|
401 // Undim audio routing buttons only if changing the routing is allowed |
|
402 if ( i == EMusuiCmdToolbarSpeakerOn ) |
|
403 { |
|
404 Toolbar()->SetItemDimmed( |
|
405 EMusuiCmdToolbarSpeakerOn, |
|
406 dimAudioRouting, |
|
407 ETrue ); |
|
408 } |
|
409 else if ( i == EMusuiCmdToolbarSpeakerOff ) |
|
410 { |
|
411 Toolbar()->SetItemDimmed( |
|
412 EMusuiCmdToolbarSpeakerOff, |
|
413 dimAudioRouting, |
|
414 ETrue ); |
|
415 } |
|
416 else if ( i != aCommand ) |
|
417 { |
|
418 Toolbar()->SetItemDimmed( i, iToolbarItemSelected, ETrue ); |
|
419 } |
|
420 else |
|
421 { |
|
422 // NOP |
|
423 } |
|
424 } |
|
425 |
|
426 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HightlightSelectedToolbarItem" ); |
|
427 } |
|
428 |
|
429 |
|
430 // ----------------------------------------------------------------------------- |
|
431 // |
|
432 // ----------------------------------------------------------------------------- |
|
433 // |
|
434 void CMusUiGeneralView::ReplaceToolbarCommand( TInt aOldCommand, |
|
435 TInt aNewCommand, |
|
436 TBool aSetNewCommandFocused ) |
|
437 { |
|
438 MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::ReplaceToolbarCommand: %d", |
|
439 aNewCommand ); |
|
440 |
|
441 // Hide the old item: |
|
442 Toolbar()->HideItem( aOldCommand, ETrue, EFalse ); |
|
443 // Show new item: |
|
444 Toolbar()->HideItem( aNewCommand, EFalse, ETrue ); |
|
445 |
|
446 TBool dimAudioRouting( iToolbarItemSelected || |
|
447 !( EventController() && |
|
448 EventController()->AudioRoutingCanBeChanged() ) ); |
|
449 |
|
450 if ( aNewCommand == EMusuiCmdToolbarSpeakerOn || |
|
451 aNewCommand == EMusuiCmdToolbarSpeakerOff ) |
|
452 { |
|
453 // Dim audio routing button if audio routing cannot be changed |
|
454 Toolbar()->SetItemDimmed( aNewCommand, |
|
455 dimAudioRouting, |
|
456 ETrue ); |
|
457 } |
|
458 |
|
459 if ( aSetNewCommandFocused && |
|
460 !AknLayoutUtils::PenEnabled() ) |
|
461 { |
|
462 TRAP_IGNORE( Toolbar()->SetFocusedItemL( aNewCommand ) ); |
|
463 } |
|
464 |
|
465 MUS_LOG1( "mus: [MUSUI ] <- CMusUiGeneralView::ReplaceToolbarCommand: %d", |
|
466 aNewCommand ); |
|
467 } |
|
468 |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 // ----------------------------------------------------------------------------- |
|
473 // |
|
474 void CMusUiGeneralView::RefreshAudioRoutingToolbarButton() |
|
475 { |
|
476 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::RefreshAudioRoutingToolbarButton" ) |
|
477 TBool loudSpeakerEnabled( EventController() && |
|
478 EventController()->IsLoudSpeakerEnabled() ); |
|
479 if ( MUS_NO_TOOLBAR ) |
|
480 { |
|
481 TRAP_IGNORE( EnableMiddleSoftkeyL( loudSpeakerEnabled ? |
|
482 R_MUSUI_VIEW_OPS_MSK_IHF_OFF : |
|
483 R_MUSUI_VIEW_OPS_MSK_IHF_ON ) ); |
|
484 } |
|
485 else if ( Toolbar()->IsShown() ) |
|
486 { |
|
487 // If toolbar is not shown, it will be refreshed automatically when shown. |
|
488 TInt focusedItem( Toolbar()->FocusedItem() ); |
|
489 TBool focusInAudioRouting( focusedItem == EMusuiCmdToolbarSpeakerOff || |
|
490 focusedItem == EMusuiCmdToolbarSpeakerOn ); |
|
491 |
|
492 TBool loudSpeakerEnabled( EventController() && |
|
493 EventController()->IsLoudSpeakerEnabled() ); |
|
494 |
|
495 // Hide old audio routing buttton |
|
496 Toolbar()->HideItem( loudSpeakerEnabled ? |
|
497 EMusuiCmdToolbarSpeakerOn : |
|
498 EMusuiCmdToolbarSpeakerOff, |
|
499 ETrue, |
|
500 EFalse ); |
|
501 |
|
502 // Show new audio routing button |
|
503 Toolbar()->HideItem( loudSpeakerEnabled ? |
|
504 EMusuiCmdToolbarSpeakerOff : |
|
505 EMusuiCmdToolbarSpeakerOn, |
|
506 EFalse, |
|
507 ETrue ); |
|
508 |
|
509 // Dim new audio routing button if audio routing cannot be changed |
|
510 // or when some button is selected |
|
511 TBool dimAudioRouting( iToolbarItemSelected || |
|
512 !( EventController() && |
|
513 EventController()->AudioRoutingCanBeChanged() ) ); |
|
514 |
|
515 Toolbar()->SetItemDimmed( loudSpeakerEnabled ? |
|
516 EMusuiCmdToolbarSpeakerOff : |
|
517 EMusuiCmdToolbarSpeakerOn, |
|
518 dimAudioRouting, |
|
519 ETrue ); |
|
520 |
|
521 // If audio routing button has been focused, focus also the new button |
|
522 // if it is not dimmed |
|
523 if ( focusInAudioRouting && |
|
524 !dimAudioRouting && |
|
525 !AknLayoutUtils::PenEnabled() ) |
|
526 { |
|
527 TRAP_IGNORE( Toolbar()->SetFocusedItemL( loudSpeakerEnabled ? |
|
528 EMusuiCmdToolbarSpeakerOff : |
|
529 EMusuiCmdToolbarSpeakerOn ) ) |
|
530 } |
|
531 |
|
532 |
|
533 } |
|
534 |
|
535 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::RefreshAudioRoutingToolbarButton" ) |
|
536 } |
|
537 |
|
538 |
|
539 // ----------------------------------------------------------------------------- |
|
540 // |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 void CMusUiGeneralView::UpdateSessionTime( const TDesC& aSessionTime ) |
|
544 { |
|
545 MUS_LOG_TDESC( "mus: [MUSUI ] -> CMusUiGeneralView::UpdateSessionTime: ", |
|
546 aSessionTime ); |
|
547 |
|
548 TRAPD( err, MusAppUi()->MusStatusPane()->SetLeftLabelL( aSessionTime ) ); |
|
549 if ( err != KErrNone ) |
|
550 { |
|
551 EventController()->HandleError( err ); |
|
552 } |
|
553 |
|
554 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::UpdateSessionTime" ); |
|
555 } |
|
556 |
|
557 |
|
558 // ----------------------------------------------------------------------------- |
|
559 // takes care of view command handling |
|
560 // ----------------------------------------------------------------------------- |
|
561 // |
|
562 void CMusUiGeneralView::HandleCommandL( TInt aCommand ) |
|
563 { |
|
564 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::HandleCommandL" ); |
|
565 |
|
566 EventControllerL().HandleCommandL( aCommand ); |
|
567 |
|
568 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HandleCommandL" ); |
|
569 } |
|
570 |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 CMusUiEventController& CMusUiGeneralView::EventControllerL() const |
|
577 { |
|
578 __ASSERT_ALWAYS( EventController(), User::Leave( KErrNotFound ) ); |
|
579 |
|
580 return *EventController(); |
|
581 } |
|
582 |
|
583 |
|
584 // ----------------------------------------------------------------------------- |
|
585 // Called when focus event occurs. Timer is started once coming to foreground |
|
586 // as often in such case we receive burst of foreground/background events. |
|
587 // Timer is used to filter that burst and to determine the final condition. |
|
588 // ----------------------------------------------------------------------------- |
|
589 // |
|
590 void CMusUiGeneralView::HandleForegroundEventL( TBool aForeground, TBool aExit ) |
|
591 { |
|
592 MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::HandleForegroundEventL: %d", |
|
593 aForeground ); |
|
594 |
|
595 SetCurrentFgBgEvent( ( aForeground ? EMusFgEvent : EMusBgEvent ) ); |
|
596 iCurrentExitSetting = aExit; |
|
597 |
|
598 if ( !iFgBgTimer->IsActive() ) |
|
599 { |
|
600 if ( aForeground ) |
|
601 { |
|
602 MUS_LOG( "mus: [MUSUI ] immediately to fg" ); |
|
603 RefreshView(); |
|
604 DoForegroundEventL(); |
|
605 } |
|
606 else |
|
607 { |
|
608 DoBackgroundEventL( iCurrentExitSetting ); |
|
609 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HandleForegroundEventL,\ |
|
610 immediately to bg" ); |
|
611 return; |
|
612 } |
|
613 } |
|
614 |
|
615 iFgBgTimer->After( KMusFgBgEventFiltering ); |
|
616 |
|
617 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HandleForegroundEventL" ); |
|
618 } |
|
619 |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // From MMusUiActiveTimerObserver |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 void CMusUiGeneralView::TimerComplete( CMusUiActiveTimer* aTimer ) |
|
626 { |
|
627 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::TimerComplete" ); |
|
628 |
|
629 if ( aTimer == iSessionEndTimer ) |
|
630 { |
|
631 MUS_LOG( "mus: [MUSUI ] Close application because of going \ |
|
632 in background" ); |
|
633 |
|
634 TRAP_IGNORE( EventControllerL().HandleExitL() ) |
|
635 } |
|
636 else |
|
637 { |
|
638 TRAP_IGNORE( CompleteForegroundEventL() ) |
|
639 } |
|
640 |
|
641 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::TimerComplete" ); |
|
642 } |
|
643 |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // From MEikMenuObserver, Called by framework before constructing menupane. |
|
647 // Initializes menu items common to all sharing types. |
|
648 // ----------------------------------------------------------------------------- |
|
649 // |
|
650 void CMusUiGeneralView::DynInitMenuPaneL( TInt aResourceId, |
|
651 CEikMenuPane* aMenuPane ) |
|
652 { |
|
653 MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::DynInitMenuPaneL [%d]", |
|
654 aResourceId ); |
|
655 |
|
656 if ( aResourceId == R_MUSUI_VIEW_MENU ) |
|
657 { |
|
658 |
|
659 // Delete Single session items: |
|
660 aMenuPane->DeleteMenuItem( EMusuiCmdViewShareVideo ); |
|
661 aMenuPane->DeleteMenuItem( EMusuiCmdViewShareImage ); |
|
662 aMenuPane->DeleteMenuItem( EMusuiCmdViewShareLive ); |
|
663 if ( MUS_NO_TOOLBAR ) |
|
664 { |
|
665 aMenuPane->DeleteMenuItem( EventControllerL().IsMicMutedL() ? |
|
666 EMusuiCmdViewMicrophoneMute : |
|
667 EMusuiCmdViewMicrophoneUnmute ); |
|
668 } |
|
669 else |
|
670 { |
|
671 aMenuPane->DeleteMenuItem( EMusuiCmdViewMicrophoneMute ); |
|
672 aMenuPane->DeleteMenuItem( EMusuiCmdViewMicrophoneUnmute ); |
|
673 } |
|
674 |
|
675 if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
676 { |
|
677 aMenuPane->DeleteMenuItem( EAknCmdHelp ); |
|
678 } |
|
679 } |
|
680 |
|
681 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DynInitMenuPaneL" ); |
|
682 } |
|
683 |
|
684 |
|
685 // ----------------------------------------------------------------------------- |
|
686 // CMusUiGeneralView::DoActivateL |
|
687 // From CAknView, Gets called from framework when activating this view |
|
688 // ----------------------------------------------------------------------------- |
|
689 void CMusUiGeneralView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
690 TUid /*aCustomMessageId*/, |
|
691 const TDesC8& /*aCustomMessage*/ ) |
|
692 { |
|
693 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoActivateL()" ) |
|
694 |
|
695 |
|
696 MusAppUi()->MusStatusPane()->ClearNaviPaneL(); |
|
697 MusAppUi()->MusStatusPane()->SetTitleFromResourceL( |
|
698 R_MUS_LIVE_SHARING_VIEW_TITLE ); |
|
699 |
|
700 iIncallBubble->SetIncallBubbleAllowedInUsualL( EFalse ); |
|
701 |
|
702 /* Draw the skin background in the client rectangle area.*/ |
|
703 if ( !iBackgroundContainer ) |
|
704 { |
|
705 /* Construct background container with clientrect area and |
|
706 * Ordinal position of 0 ie highest so that it draws the initial |
|
707 * skin background first. |
|
708 */ |
|
709 iBackgroundContainer = |
|
710 CMusUiBackgroundViewContainer::NewL( ClientRect(), 0 ); |
|
711 /* Add container to view stack so that it get view events */ |
|
712 AppUi()->AddToViewStackL( *this, iBackgroundContainer ); |
|
713 } |
|
714 else |
|
715 { |
|
716 /* Set the windows ordinal position to highest ie 0, |
|
717 * so that background gets priority and drawn first. |
|
718 */ |
|
719 iBackgroundContainer->SetOrdinalPosition( 0 ); |
|
720 } |
|
721 /* Draw the skin background now */ |
|
722 iBackgroundContainer->DrawNow(); |
|
723 |
|
724 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoActivateL()" ) |
|
725 } |
|
726 |
|
727 |
|
728 // ----------------------------------------------------------------------------- |
|
729 // CMusUiGeneralView::DoDeactivate |
|
730 // From AknView, Gets called from framework when deactivating this view |
|
731 // ----------------------------------------------------------------------------- |
|
732 void CMusUiGeneralView::DoDeactivate() |
|
733 { |
|
734 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoDeactivate()" ) |
|
735 if ( iBackgroundContainer ) |
|
736 { |
|
737 AppUi()->RemoveFromViewStack( *this, iBackgroundContainer ); |
|
738 delete iBackgroundContainer; |
|
739 iBackgroundContainer = NULL; |
|
740 } |
|
741 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoDeactivate()" ) |
|
742 } |
|
743 |
|
744 |
|
745 // ----------------------------------------------------------------------------- |
|
746 // Asynchronous completion of last fg/bg condition. |
|
747 // ----------------------------------------------------------------------------- |
|
748 // |
|
749 void CMusUiGeneralView::CompleteForegroundEventL() |
|
750 { |
|
751 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::CompleteForegroundEventL()" ) |
|
752 |
|
753 switch ( iCurrentFgBgEvent ) |
|
754 { |
|
755 case EMusFgEvent: |
|
756 { |
|
757 DoForegroundEventL(); |
|
758 break; |
|
759 } |
|
760 case EMusBgEvent: |
|
761 { |
|
762 DoBackgroundEventL( iCurrentExitSetting ); |
|
763 break; |
|
764 } |
|
765 default: |
|
766 { |
|
767 break; |
|
768 } |
|
769 } |
|
770 |
|
771 SetCurrentFgBgEvent( EMusFgBgEventNone ); |
|
772 |
|
773 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::CompleteForegroundEventL()" ) |
|
774 } |
|
775 |
|
776 |
|
777 // ----------------------------------------------------------------------------- |
|
778 // Complete foreground event. |
|
779 // ----------------------------------------------------------------------------- |
|
780 // |
|
781 void CMusUiGeneralView::DoForegroundEventL() |
|
782 { |
|
783 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoForegroundEventL()" ) |
|
784 |
|
785 /* if background container exist then draw now. but do not change |
|
786 * the ordinal so that other control preceed in drawing. |
|
787 */ |
|
788 if( iBackgroundContainer ) |
|
789 { |
|
790 iBackgroundContainer->RefreshView(); |
|
791 } |
|
792 iSessionEndTimer->Cancel(); |
|
793 |
|
794 EventControllerL().HandleForegroundEventL( ETrue ); |
|
795 iIncallBubble->SetIncallBubbleAllowedInUsualL( EFalse ); |
|
796 |
|
797 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoForegroundEventL()" ) |
|
798 } |
|
799 |
|
800 |
|
801 // ----------------------------------------------------------------------------- |
|
802 // Complete background event. |
|
803 // ----------------------------------------------------------------------------- |
|
804 // |
|
805 void CMusUiGeneralView::DoBackgroundEventL( TBool aExit ) |
|
806 { |
|
807 MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoBackgroundEventL()" ) |
|
808 |
|
809 if ( aExit ) |
|
810 { |
|
811 MUS_LOG( "mus: [MUSUI ] Go to background, \ |
|
812 wait some seconds before closing..." ); |
|
813 iSessionEndTimer->After( KBackgroundIntervalForClose ); |
|
814 } |
|
815 if ( !MusAppUi()->ExitValue() ) |
|
816 { |
|
817 MUS_LOG( "mus: [MUSUI ] Calling EventControllerL()" ); |
|
818 EventControllerL().HandleForegroundEventL( EFalse ); |
|
819 // If exiting, next will be called by destructor |
|
820 iIncallBubble->SetIncallBubbleAllowedInUsualL( ETrue ); |
|
821 } |
|
822 |
|
823 SetCurrentFgBgEvent( EMusFgBgEventNone ); |
|
824 |
|
825 MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoBackgroundEventL()" ) |
|
826 } |
|
827 |
|
828 // ----------------------------------------------------------------------------- |
|
829 // Set current fg/bg condition. |
|
830 // ----------------------------------------------------------------------------- |
|
831 // |
|
832 void CMusUiGeneralView::SetCurrentFgBgEvent( TMusFgBgEventType aEventType ) |
|
833 { |
|
834 MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::SetCurrentFgBgEvent() event:%d", |
|
835 aEventType ) |
|
836 |
|
837 iCurrentFgBgEvent = aEventType; |
|
838 } |
|
839 |
|
840 // ----------------------------------------------------------------------------- |
|
841 // |
|
842 // ----------------------------------------------------------------------------- |
|
843 // |
|
844 TBool CMusUiGeneralView::OperatorSpecificFunctionality() const |
|
845 { |
|
846 return iOperatorSpecificFunctionality; |
|
847 } |
|
848 |
|
849 // ----------------------------------------------------------------------------- |
|
850 // |
|
851 // ----------------------------------------------------------------------------- |
|
852 // |
|
853 TInt CMusUiGeneralView::ToolbarPlaceHolderHeight() const |
|
854 { |
|
855 TInt toolbarPlaceHolderHeight( 0 ); |
|
856 CAknAppUiBase::TAppUiOrientation orientation = MusAppUi()->AppOrientation(); |
|
857 if ( !Toolbar()->IsShown() && |
|
858 orientation == CAknAppUiBase::EAppUiOrientationPortrait && |
|
859 AknLayoutUtils::PenEnabled() ) |
|
860 { |
|
861 // In touch UI in portrait mode the toolbar |
|
862 // fills the whole lower part of the screen |
|
863 toolbarPlaceHolderHeight = Toolbar()->Size().iHeight; |
|
864 } |
|
865 return toolbarPlaceHolderHeight; |
|
866 } |
|
867 |
|
868 // ----------------------------------------------------------------------------- |
|
869 // Increase/Decrease background container ordinal so that other controls |
|
870 // can preceed background |
|
871 // ----------------------------------------------------------------------------- |
|
872 // |
|
873 void CMusUiGeneralView::UpdateBackgroundOrdinalPosition( TBool aUp ) |
|
874 { |
|
875 // If there is no background container then do not care |
|
876 if ( iBackgroundContainer ) |
|
877 { |
|
878 iBackgroundContainer->UpdateOrdinalPositionValue( aUp ); |
|
879 } |
|
880 } |
|
881 // end of file |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|