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: The MUS application's UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "musenglivesession.h" |
|
21 #include "musuilivesharingview.h" |
|
22 #include "musuilivesharingviewcontainer.h" |
|
23 #include "musuibackgroundviewcontainer.h" |
|
24 #include "musuilivesharingcontroller.h" |
|
25 #include "musuiactivitymanger.h" |
|
26 #include "musuiappui.h" |
|
27 #include "musuistatuspanehandler.h" |
|
28 #include "musui.hrh" |
|
29 #include "musuidefinitions.h" |
|
30 #include "muslogger.h" // debug logging |
|
31 #include <musui.rsg> |
|
32 #include <musui.mbg> |
|
33 #include "musengmcesession.h" |
|
34 |
|
35 #include <aknViewAppUi.h> |
|
36 #include <avkon.hrh> |
|
37 #include <eikmenup.h> |
|
38 #include <akntoolbar.h> |
|
39 |
|
40 |
|
41 const TInt KMusUiContainerWidth = 30; |
|
42 |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // EPOC two-phased constructor |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CMusUiLiveSharingView::ConstructL() |
|
49 { |
|
50 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::ConstructL" ); |
|
51 |
|
52 CMusUiSendView::ConstructL(); |
|
53 |
|
54 Toolbar()->SetToolbarObserver( this ); |
|
55 Toolbar()->UpdateBackground(); |
|
56 /* |
|
57 if( MUS_NO_TOOLBAR ) |
|
58 { |
|
59 MUS_LOG( "mus: [MUSUI ] Operator variant hides toolbar!" ); |
|
60 Toolbar()->SetToolbarVisibility( EFalse ); |
|
61 Toolbar()->MakeVisible(EFalse); |
|
62 } |
|
63 */ |
|
64 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::ConstructL" ); |
|
65 } |
|
66 |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // Destructor |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CMusUiLiveSharingView::~CMusUiLiveSharingView() |
|
73 { |
|
74 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::~CMusUiLiveSharingView" ); |
|
75 if ( iContainer ) |
|
76 { |
|
77 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
78 } |
|
79 delete iContainer; |
|
80 delete iController; |
|
81 |
|
82 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::~CMusUiLiveSharingView" ); |
|
83 } |
|
84 |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TUid CMusUiLiveSharingView::Id() const |
|
91 { |
|
92 MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingView::Id()" ); |
|
93 return KMusUidLiveSharingView; |
|
94 } |
|
95 |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // Handle EKeyUpArrow key presses |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CMusUiLiveSharingView::HandleKeyUpArrowL() |
|
102 { |
|
103 HandleCommandL( |
|
104 iController->ZoomSelected() ? EMusuiCmdViewZoomIn : |
|
105 iController->BrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
106 EMusUiCmdToolbarLastIndex ); |
|
107 } |
|
108 |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // Handle EKeyDownArrow key presses |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 void CMusUiLiveSharingView::HandleKeyDownArrowL() |
|
115 { |
|
116 HandleCommandL( |
|
117 iController->ZoomSelected() ? EMusuiCmdViewZoomOut : |
|
118 iController->BrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
119 EMusUiCmdToolbarLastIndex ); |
|
120 } |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // From MEikMenuObserver, Called by framework before constructing menupane |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CMusUiLiveSharingView::DynInitMenuPaneL( TInt aResourceId, |
|
130 CEikMenuPane* aMenuPane ) |
|
131 { |
|
132 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DynInitMenuPaneL [%d]" ); |
|
133 SetZoomVisible(EFalse); |
|
134 SetBrightnessVisible(EFalse); |
|
135 // Base class initiated initialization first |
|
136 CMusUiGeneralView::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
137 if( !MUS_NO_TOOLBAR ) |
|
138 { |
|
139 SetInitialFocusedItemL(); |
|
140 } |
|
141 |
|
142 if ( aResourceId == R_MUSUI_VIEW_MENU ) |
|
143 { |
|
144 // Delete items not related to live sharing: |
|
145 aMenuPane->DeleteMenuItem( EMusuiCmdViewReplay ); |
|
146 aMenuPane->DeleteMenuItem( EMusuiCmdViewAudioMute ); |
|
147 aMenuPane->DeleteMenuItem( EMusuiCmdViewAudioNormal ); |
|
148 aMenuPane->DeleteMenuItem( EMusuiCmdViewFullScreen ); |
|
149 |
|
150 if ( iController->ConnectionEstablished() |
|
151 && !iController->IsDiskFull() ) |
|
152 { |
|
153 CMusEngLiveSession *session = dynamic_cast <CMusEngLiveSession*> |
|
154 ( iController->EngineOutSession() ); |
|
155 |
|
156 if ( session->IsPlayingL() ) |
|
157 { |
|
158 aMenuPane->DeleteMenuItem( session->IsRecording() ? |
|
159 EMusuiCmdRecord : |
|
160 EMusuiCmdStopRecording ); |
|
161 } |
|
162 else |
|
163 { |
|
164 // when camera source was paused, hide the command |
|
165 aMenuPane->DeleteMenuItem( EMusuiCmdRecord ); |
|
166 aMenuPane->DeleteMenuItem( EMusuiCmdStopRecording ); |
|
167 } |
|
168 } |
|
169 else |
|
170 { |
|
171 // Hide recording commands if the session is not established |
|
172 // TODO: check autorecord on/off |
|
173 aMenuPane->DeleteMenuItem( EMusuiCmdRecord ); |
|
174 aMenuPane->DeleteMenuItem( EMusuiCmdStopRecording ); |
|
175 } |
|
176 |
|
177 __ASSERT_ALWAYS( iController, User::Leave( KErrNotReady ) ); |
|
178 |
|
179 if( MUS_NO_TOOLBAR ) |
|
180 { |
|
181 aMenuPane->DeleteMenuItem( EMusuiCmdToolbarBrightness ); |
|
182 aMenuPane->DeleteMenuItem( EMusuiCmdToolbarZoom ); |
|
183 if ( !iController->IsBrightnessSupported() || |
|
184 !SendController()->IsPlayingL() ) |
|
185 { |
|
186 aMenuPane->DeleteMenuItem( EMusuiCmdViewBrightness ); |
|
187 } |
|
188 |
|
189 if ( !SendController()->IsPlayingL() ) |
|
190 { |
|
191 aMenuPane->DeleteMenuItem( EMusuiCmdViewZoom ); |
|
192 } |
|
193 } |
|
194 else |
|
195 { |
|
196 aMenuPane->DeleteMenuItem( EMusuiCmdViewBrightness ); |
|
197 aMenuPane->DeleteMenuItem( EMusuiCmdViewZoom ); |
|
198 if ( !iController->IsBrightnessSupported() || |
|
199 !SendController()->IsPlayingL() || |
|
200 !AknLayoutUtils::PenEnabled() ) |
|
201 { |
|
202 aMenuPane->DeleteMenuItem( EMusuiCmdToolbarBrightness ); |
|
203 } |
|
204 |
|
205 if ( !SendController()->IsPlayingL() || |
|
206 !AknLayoutUtils::PenEnabled() ) |
|
207 { |
|
208 aMenuPane->DeleteMenuItem( EMusuiCmdToolbarZoom ); |
|
209 } |
|
210 } |
|
211 } |
|
212 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DynInitMenuPaneL" ); |
|
213 } |
|
214 |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 void CMusUiLiveSharingView::HandleToolbarCommandL( TInt aCommand ) |
|
221 { |
|
222 MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingView::HandleToolbarCommandL: %d", |
|
223 aCommand ); |
|
224 |
|
225 __ASSERT_ALWAYS( iController, User::Leave( KErrNotReady ) ); |
|
226 |
|
227 switch ( aCommand ) |
|
228 { |
|
229 case EKeyLeftArrow: |
|
230 { |
|
231 if( MUS_NO_TOOLBAR ) |
|
232 { |
|
233 HandleCommandL( |
|
234 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
235 iController->BrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
236 iController->ZoomSelected() ? EMusuiCmdViewZoomOut : |
|
237 EMusUiCmdToolbarLastIndex ); |
|
238 } |
|
239 else |
|
240 { |
|
241 HandleCommandL( |
|
242 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
243 iController->ToolbarBrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
244 iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomOut : |
|
245 EMusUiCmdToolbarLastIndex ); |
|
246 } |
|
247 break; |
|
248 } |
|
249 case EKeyRightArrow: |
|
250 { |
|
251 if( MUS_NO_TOOLBAR ) |
|
252 { |
|
253 HandleCommandL( |
|
254 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
255 iController->BrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
256 iController->ZoomSelected() ? EMusuiCmdViewZoomIn : |
|
257 EMusUiCmdToolbarLastIndex ); |
|
258 } |
|
259 else |
|
260 { |
|
261 HandleCommandL( |
|
262 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
263 iController->ToolbarBrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
264 iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomIn : |
|
265 EMusUiCmdToolbarLastIndex ); |
|
266 } |
|
267 break; |
|
268 } |
|
269 case EKeyUpArrow: |
|
270 { |
|
271 if( MUS_NO_TOOLBAR ) |
|
272 { |
|
273 HandleCommandL( |
|
274 iController->ZoomSelected() ? EMusuiCmdViewZoomIn : |
|
275 iController->BrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
276 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
277 EMusUiCmdToolbarLastIndex ); |
|
278 } |
|
279 else |
|
280 { |
|
281 HandleCommandL( |
|
282 iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomIn : |
|
283 iController->ToolbarBrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
284 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
285 EMusUiCmdToolbarLastIndex ); |
|
286 } |
|
287 break; |
|
288 } |
|
289 case EKeyDownArrow: |
|
290 { |
|
291 if( MUS_NO_TOOLBAR ) |
|
292 { |
|
293 HandleCommandL( |
|
294 iController->ZoomSelected() ? EMusuiCmdViewZoomOut : |
|
295 iController->BrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
296 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
297 EMusUiCmdToolbarLastIndex ); |
|
298 } |
|
299 else |
|
300 { |
|
301 HandleCommandL( |
|
302 iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomOut : |
|
303 iController->ToolbarBrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
304 iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
305 EMusUiCmdToolbarLastIndex ); |
|
306 } |
|
307 break; |
|
308 } |
|
309 case EMusuiCmdViewVolumeDown: |
|
310 { |
|
311 HandleCommandL( EMusuiCmdViewVolumeDown ); |
|
312 break; |
|
313 } |
|
314 case EMusuiCmdViewVolumeUp: |
|
315 { |
|
316 HandleCommandL( EMusuiCmdViewVolumeUp ); |
|
317 break; |
|
318 } |
|
319 default: |
|
320 { |
|
321 break; |
|
322 } |
|
323 } |
|
324 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::HandleToolbarCommandL" ); |
|
325 } |
|
326 |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CMusUiLiveSharingView::SetInitialFocusedItemL() |
|
333 { |
|
334 MUS_LOG( "mus: [MUSUI ] -> MusUiLiveSharingView::SetInitialFocusedItemL" ); |
|
335 |
|
336 __ASSERT_ALWAYS( iController, User::Leave( KErrNotReady ) ); |
|
337 |
|
338 if ( iOperatorSpecificFunctionality && !AknLayoutUtils::PenEnabled() ) |
|
339 { |
|
340 MUS_LOG( "Focus changed in OPERATOR mode !!!!!!!!!!!!!" ); |
|
341 Toolbar()->SetFocusedItemL( EMusuiCmdToolbarZoom ); |
|
342 |
|
343 } |
|
344 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetInitialFocusedItemL" ); |
|
345 } |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 void CMusUiLiveSharingView::DynInitToolbarL( TInt aResourceId, |
|
352 CAknToolbar* aToolbar ) |
|
353 { |
|
354 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DynInitToolbarL" ); |
|
355 |
|
356 // Items to be removed in Live Sharing View: |
|
357 if (!AknLayoutUtils::PenEnabled())//(aResourceId == R_MUS_TOOLBAR_NONTOUCH)// |
|
358 { |
|
359 Toolbar()->RemoveItem( EMusuiCmdToolbarFFRev ); |
|
360 |
|
361 // Items to be removed in Live Sharing View: |
|
362 if ( iController->DeviceHasDedicatedVolumeKeys() ) |
|
363 { |
|
364 Toolbar()->RemoveItem( EMusuiCmdToolbarVolume ); |
|
365 } |
|
366 else |
|
367 { |
|
368 aToolbar->SetFocusedItemL( EMusuiCmdToolbarVolume ); |
|
369 } |
|
370 |
|
371 |
|
372 if ( !iController->IsBrightnessSupported() ) |
|
373 { |
|
374 Toolbar()->HideItem( EMusuiCmdToolbarBrightness, ETrue, ETrue ); |
|
375 } |
|
376 else |
|
377 { |
|
378 if ( aToolbar->FocusedItem() == KErrNotFound ) |
|
379 { |
|
380 aToolbar->SetFocusedItemL( EMusuiCmdToolbarBrightness ); |
|
381 } |
|
382 } |
|
383 } |
|
384 Toolbar()->RemoveItem( EMusuiCmdToolbarPause ); |
|
385 Toolbar()->RemoveItem( EMusuiCmdToolbarUnPause ); |
|
386 Toolbar()->RemoveItem( EMusuiCmdToolbarFullScreen ); |
|
387 |
|
388 if ( iOperatorSpecificFunctionality ) |
|
389 { |
|
390 // Remove pause/unpause functionality in operator variant case |
|
391 Toolbar()->RemoveItem( EMusuiCmdToolbarPauseLive ); |
|
392 Toolbar()->RemoveItem( EMusuiCmdToolbarUnPauseLive ); |
|
393 if ( (aToolbar->FocusedItem() == KErrNotFound ) && |
|
394 !AknLayoutUtils::PenEnabled() ) |
|
395 { |
|
396 aToolbar->SetFocusedItemL( EMusuiCmdToolbarZoom ); |
|
397 } |
|
398 } |
|
399 else |
|
400 { |
|
401 // Toggled items to be hidden: |
|
402 Toolbar()->HideItem( iPauseSelected ? |
|
403 EMusuiCmdToolbarPauseLive : |
|
404 EMusuiCmdToolbarUnPauseLive, |
|
405 ETrue, |
|
406 ETrue ); |
|
407 if ( aToolbar->FocusedItem() == KErrNotFound && |
|
408 !AknLayoutUtils::PenEnabled() ) |
|
409 { |
|
410 aToolbar->SetFocusedItemL( EMusuiCmdToolbarPauseLive ); |
|
411 } |
|
412 Toolbar()->RemoveItem( EMusuiCmdToolbarBlank ); |
|
413 } |
|
414 |
|
415 // Last generic base class functionality |
|
416 CMusUiGeneralView::DynInitToolbarL( aResourceId, aToolbar ); |
|
417 |
|
418 MUS_LOG1( "aToolbar Focused Item: %d", aToolbar->FocusedItem() ); |
|
419 MUS_LOG1( "toolbar() Focused Item: %d", Toolbar()->FocusedItem() ); |
|
420 |
|
421 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DynInitToolbarL" ); |
|
422 } |
|
423 |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 void CMusUiLiveSharingView::SetZoomValues( TInt aMinZoom, TInt aMaxZoom ) |
|
430 { |
|
431 iContainer->SetZoomValues( aMinZoom, aMaxZoom ); |
|
432 } |
|
433 |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 void CMusUiLiveSharingView::SetBrightnessValues( TInt aMinBrightness, |
|
440 TInt aMaxBrightness ) |
|
441 { |
|
442 iContainer->SetBrightnessValues( aMinBrightness, aMaxBrightness ); |
|
443 } |
|
444 |
|
445 |
|
446 // ----------------------------------------------------------------------------- |
|
447 // |
|
448 // ----------------------------------------------------------------------------- |
|
449 // |
|
450 void CMusUiLiveSharingView::SetZoomL( TInt aZoomLevel ) |
|
451 { |
|
452 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetZoomL" ); |
|
453 iContainer->SetZoomL( aZoomLevel ); |
|
454 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetZoomL" ); |
|
455 } |
|
456 |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 void CMusUiLiveSharingView::SetBrightnessL( TInt aBrightnessLevel ) |
|
463 { |
|
464 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetBrightnessL" ); |
|
465 iContainer->SetBrightnessL( aBrightnessLevel ); |
|
466 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetBrightnessL" ); |
|
467 } |
|
468 |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 // ----------------------------------------------------------------------------- |
|
473 // |
|
474 void CMusUiLiveSharingView::SetZoomVisible( TBool aVisible ) |
|
475 { |
|
476 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetZoomVisible" ); |
|
477 |
|
478 iContainer->SetZoomVisible( aVisible ); |
|
479 |
|
480 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetZoomVisible" ); |
|
481 } |
|
482 |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 void CMusUiLiveSharingView::SetBrightnessVisible( TBool aVisible ) |
|
489 { |
|
490 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetBrightnessVisible" ); |
|
491 |
|
492 iContainer->SetBrightnessVisible( aVisible ); |
|
493 |
|
494 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetBrightnessVisible" ); |
|
495 } |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 void CMusUiLiveSharingView::LevelIndicatorDismissed() |
|
502 { |
|
503 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::LevelIndicatorDismissed" ); |
|
504 iController->LevelIndicatorDismissed(); |
|
505 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::LevelIndicatorDismissed" ); |
|
506 } |
|
507 |
|
508 |
|
509 // ----------------------------------------------------------------------------- |
|
510 // |
|
511 // ----------------------------------------------------------------------------- |
|
512 // |
|
513 void CMusUiLiveSharingView::RefreshAudioRoutingButton() |
|
514 { |
|
515 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshAudioRoutingButton" ); |
|
516 //We ignore audio routing change event in case there is Zoom/Brightness |
|
517 //adjustment ongoing in operator variant. Middle softkey will be |
|
518 //updated once adjustment is done |
|
519 if ( !MUS_NO_TOOLBAR || |
|
520 ( !iController->ZoomSelected() && |
|
521 !iController->BrightnessSelected() ) ) |
|
522 { |
|
523 CMusUiGeneralView::RefreshAudioRoutingToolbarButton(); |
|
524 } |
|
525 |
|
526 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshAudioRoutingButton" ); |
|
527 } |
|
528 |
|
529 // ----------------------------------------------------------------------------- |
|
530 // |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 void CMusUiLiveSharingView::ReplaceToolbarCommand( TInt aOldCommand, |
|
534 TInt aNewCommand, |
|
535 TBool aSetNewCommandFocused ) |
|
536 { |
|
537 MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingView::ReplaceToolbarCommand: %d", |
|
538 aOldCommand ); |
|
539 switch ( aOldCommand ) |
|
540 { |
|
541 case EMusuiCmdToolbarPauseLive: |
|
542 { |
|
543 iPauseSelected = ETrue; |
|
544 /* Hide pause related toolbar items */ |
|
545 HideToolbarCommandForPause(ETrue); |
|
546 break; |
|
547 } |
|
548 case EMusuiCmdToolbarUnPauseLive: |
|
549 { |
|
550 iPauseSelected = EFalse; |
|
551 /* Unhide pause related toolbar items */ |
|
552 HideToolbarCommandForPause(EFalse); |
|
553 break; |
|
554 } |
|
555 default: |
|
556 { |
|
557 break; |
|
558 } |
|
559 } |
|
560 |
|
561 // Call base class version for generic part |
|
562 |
|
563 CMusUiGeneralView::ReplaceToolbarCommand( aOldCommand, |
|
564 aNewCommand, |
|
565 aSetNewCommandFocused ); |
|
566 |
|
567 MUS_LOG1( "mus: [MUSUI ] <- CMusUiLiveSharingView::ReplaceToolbarCommand: %d", |
|
568 aNewCommand ); |
|
569 } |
|
570 |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 void CMusUiLiveSharingView::RefreshView() |
|
577 { |
|
578 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshView" ); |
|
579 if ( iController ) |
|
580 { |
|
581 DoRefreshView(); |
|
582 } |
|
583 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshView" ); |
|
584 } |
|
585 |
|
586 |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 // ----------------------------------------------------------------------------- |
|
590 // |
|
591 void CMusUiLiveSharingView::DoRefreshView() |
|
592 { |
|
593 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoRefreshView" ); |
|
594 |
|
595 // Refresh background container before and after as display status |
|
596 // may change due async orientation change handling. |
|
597 RefreshBackgroundContainer(); |
|
598 |
|
599 if ( iContainer ) |
|
600 { |
|
601 TRect containerRect( ClientRect().iBr.iX - KMusUiContainerWidth, |
|
602 ClientRect().iTl.iY, |
|
603 ClientRect().iBr.iX, |
|
604 ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
605 iContainer->SetRect( containerRect ); |
|
606 } |
|
607 |
|
608 if ( iController ) |
|
609 { |
|
610 TRect videoRect( ClientRect().iTl.iX, |
|
611 ClientRect().iTl.iY, |
|
612 ClientRect().iBr.iX, |
|
613 ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
614 // if this function leaves we can nothing to do for camera orientation. |
|
615 // Alteast we can try further to set right rectangle for display |
|
616 TRAPD(err,RefreshCameraOrientationL(videoRect)); |
|
617 if( err ) |
|
618 { |
|
619 MUS_LOG1( "mus: [MUSUI ] -> Orientation can not be changed =%d",err ); |
|
620 } |
|
621 iController->SetRect( videoRect ); |
|
622 } |
|
623 |
|
624 RefreshBackgroundContainer(); |
|
625 |
|
626 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoRefreshView" ); |
|
627 } |
|
628 |
|
629 // ----------------------------------------------------------------------------- |
|
630 // |
|
631 // ----------------------------------------------------------------------------- |
|
632 // |
|
633 CMusUiSendController* CMusUiLiveSharingView::SendController() const |
|
634 { |
|
635 return iController; |
|
636 } |
|
637 |
|
638 |
|
639 // ----------------------------------------------------------------------------- |
|
640 // |
|
641 // ----------------------------------------------------------------------------- |
|
642 // |
|
643 CMusUiSendViewContainer* CMusUiLiveSharingView::SendContainer() const |
|
644 { |
|
645 return iContainer; |
|
646 } |
|
647 |
|
648 |
|
649 // ----------------------------------------------------------------------------- |
|
650 // From CAknView, Gets called from framework when activating this view |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 void CMusUiLiveSharingView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
654 TUid aCustomMessageId, |
|
655 const TDesC8& aCustomMessage ) |
|
656 { |
|
657 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoActivateL" ); |
|
658 |
|
659 // Base class activation first |
|
660 CMusUiSendView::DoActivateL( aPrevViewId, |
|
661 aCustomMessageId, |
|
662 aCustomMessage ); |
|
663 |
|
664 TRect clientRect = ClientRect(); |
|
665 clientRect.iBr.iX -= ToolbarPlaceHolderWidth(); |
|
666 clientRect.iBr.iY -= ToolbarPlaceHolderHeight(); |
|
667 |
|
668 TRect containerRect( clientRect.iBr.iX - KMusUiContainerWidth, |
|
669 clientRect.iTl.iY, |
|
670 clientRect.iBr.iX, |
|
671 clientRect.iBr.iY ); |
|
672 |
|
673 if ( !iContainer ) |
|
674 { |
|
675 MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingView::DoActivateL: !iContainer" ); |
|
676 iContainer = new ( ELeave ) CMusUiLiveSharingViewContainer(); |
|
677 iContainer->SetMopParent( this ); |
|
678 iContainer->ConstructL( this, |
|
679 containerRect ); |
|
680 AppUi()->AddToViewStackL( *this, iContainer ); |
|
681 } |
|
682 |
|
683 /* Increase the ordinal position of background container |
|
684 * So that other control will be drawn first. |
|
685 */ |
|
686 UpdateBackgroundOrdinalPosition( ETrue ); |
|
687 |
|
688 TRect videoRect( ClientRect().iTl.iX, |
|
689 ClientRect().iTl.iY, |
|
690 ClientRect().iBr.iX, |
|
691 ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
692 |
|
693 if ( !iController ) |
|
694 { |
|
695 MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingView::DoActivateL: !iController" ); |
|
696 iController = CMusUiLiveSharingController::NewL( *MusAppUi(), |
|
697 *this, |
|
698 *this, |
|
699 *this, |
|
700 videoRect ); |
|
701 iController->StartInvitationL(); |
|
702 } |
|
703 |
|
704 iContainer->SetController( iController ); |
|
705 |
|
706 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoActivateL" ); |
|
707 } |
|
708 |
|
709 |
|
710 // ----------------------------------------------------------------------------- |
|
711 // From AknView, Gets called from framework when deactivating this view |
|
712 // ----------------------------------------------------------------------------- |
|
713 // |
|
714 void CMusUiLiveSharingView::DoDeactivate() |
|
715 { |
|
716 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoDeactivate" ); |
|
717 |
|
718 CMusUiSendView::DoDeactivate(); // Base class deactivation first |
|
719 |
|
720 if ( iContainer ) |
|
721 { |
|
722 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
723 delete iContainer; |
|
724 iContainer = NULL; |
|
725 } |
|
726 |
|
727 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoDeactivate" ); |
|
728 } |
|
729 |
|
730 // ----------------------------------------------------------------------------- |
|
731 // When orientation changed , Camera instances has to be recreated inorder |
|
732 // to receive proper orientated frames. |
|
733 // ----------------------------------------------------------------------------- |
|
734 // |
|
735 void CMusUiLiveSharingView::RefreshCameraOrientationL(TRect& aNewRect) |
|
736 { |
|
737 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshCameraOrientation" ); |
|
738 if ( !iController || !iController->EngineSession() ) |
|
739 { |
|
740 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshCameraOrientation, no session" ); |
|
741 return; |
|
742 } |
|
743 TRect oldRect = iController->EngineSession()->Rect(); |
|
744 MUS_LOG2( "mus: [MUSUI ] -> Old Rect (width = %d,height=%d)",oldRect.Width(),oldRect.Height() ); |
|
745 MUS_LOG2( "mus: [MUSUI ] -> New Rect (width = %d,height=%d)",aNewRect.Width(),aNewRect.Height() ); |
|
746 if ( !( ( ( oldRect.Width() > oldRect.Height() ) && //check lanscape |
|
747 ( aNewRect.Width() > aNewRect.Height() ) |
|
748 ) |
|
749 || |
|
750 ( |
|
751 ( oldRect.Width() < oldRect.Height() ) && // check portrait |
|
752 ( aNewRect.Width() < aNewRect.Height() ) |
|
753 ) |
|
754 ) |
|
755 ) |
|
756 { |
|
757 MUS_LOG( "mus: [MUSUI ] -> Orientation Changed.Restart Camera" ); |
|
758 iController->RefreshCameraOrientationL(); |
|
759 } |
|
760 else |
|
761 { |
|
762 MUS_LOG( "mus: [MUSUI ] -> Orientation Not changed. dont restart camera"); |
|
763 } |
|
764 |
|
765 |
|
766 |
|
767 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshCameraOrientation" ); |
|
768 } |
|
769 |
|
770 // ----------------------------------------------------------------------------- |
|
771 // When Live sharing paused , camera source will be unavilable, hence |
|
772 // it is inappropriate to show the zoom and brightness |
|
773 // so hide those item. And unhide it again when unpaused. |
|
774 // ----------------------------------------------------------------------------- |
|
775 // |
|
776 void CMusUiLiveSharingView::HideToolbarCommandForPause( TBool aIsPaused ) |
|
777 { |
|
778 MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingView::HideToolbarCommandForPause() %d",aIsPaused); |
|
779 /* Hide brightness toolbar item if paused else unhide. Draw immediately.*/ |
|
780 Toolbar()->HideItem( EMusuiCmdToolbarBrightness, aIsPaused, ETrue ); |
|
781 /* Hide zoom toolbar item if paused else unhide. Draw immediately.*/ |
|
782 Toolbar()->HideItem( EMusuiCmdToolbarZoom, aIsPaused, ETrue ); |
|
783 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::HideToolbarCommandForPause"); |
|
784 } |
|
785 |
|
786 // end of file |
|