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 } |
|
413 |
|
414 // Last generic base class functionality |
|
415 CMusUiGeneralView::DynInitToolbarL( aResourceId, aToolbar ); |
|
416 |
|
417 MUS_LOG1( "aToolbar Focused Item: %d", aToolbar->FocusedItem() ); |
|
418 MUS_LOG1( "toolbar() Focused Item: %d", Toolbar()->FocusedItem() ); |
|
419 |
|
420 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DynInitToolbarL" ); |
|
421 } |
|
422 |
|
423 |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 // ----------------------------------------------------------------------------- |
|
427 // |
|
428 void CMusUiLiveSharingView::SetZoomValues( TInt aMinZoom, TInt aMaxZoom ) |
|
429 { |
|
430 iContainer->SetZoomValues( aMinZoom, aMaxZoom ); |
|
431 } |
|
432 |
|
433 |
|
434 // ----------------------------------------------------------------------------- |
|
435 // |
|
436 // ----------------------------------------------------------------------------- |
|
437 // |
|
438 void CMusUiLiveSharingView::SetBrightnessValues( TInt aMinBrightness, |
|
439 TInt aMaxBrightness ) |
|
440 { |
|
441 iContainer->SetBrightnessValues( aMinBrightness, aMaxBrightness ); |
|
442 } |
|
443 |
|
444 |
|
445 // ----------------------------------------------------------------------------- |
|
446 // |
|
447 // ----------------------------------------------------------------------------- |
|
448 // |
|
449 void CMusUiLiveSharingView::SetZoomL( TInt aZoomLevel ) |
|
450 { |
|
451 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetZoomL" ); |
|
452 iContainer->SetZoomL( aZoomLevel ); |
|
453 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetZoomL" ); |
|
454 } |
|
455 |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 void CMusUiLiveSharingView::SetBrightnessL( TInt aBrightnessLevel ) |
|
462 { |
|
463 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetBrightnessL" ); |
|
464 iContainer->SetBrightnessL( aBrightnessLevel ); |
|
465 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetBrightnessL" ); |
|
466 } |
|
467 |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 void CMusUiLiveSharingView::SetZoomVisible( TBool aVisible ) |
|
474 { |
|
475 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetZoomVisible" ); |
|
476 |
|
477 iContainer->SetZoomVisible( aVisible ); |
|
478 |
|
479 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetZoomVisible" ); |
|
480 } |
|
481 |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 void CMusUiLiveSharingView::SetBrightnessVisible( TBool aVisible ) |
|
488 { |
|
489 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetBrightnessVisible" ); |
|
490 |
|
491 iContainer->SetBrightnessVisible( aVisible ); |
|
492 |
|
493 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetBrightnessVisible" ); |
|
494 } |
|
495 |
|
496 // ----------------------------------------------------------------------------- |
|
497 // |
|
498 // ----------------------------------------------------------------------------- |
|
499 // |
|
500 void CMusUiLiveSharingView::LevelIndicatorDismissed() |
|
501 { |
|
502 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::LevelIndicatorDismissed" ); |
|
503 iController->LevelIndicatorDismissed(); |
|
504 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::LevelIndicatorDismissed" ); |
|
505 } |
|
506 |
|
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // |
|
510 // ----------------------------------------------------------------------------- |
|
511 // |
|
512 void CMusUiLiveSharingView::RefreshAudioRoutingButton() |
|
513 { |
|
514 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshAudioRoutingButton" ); |
|
515 //We ignore audio routing change event in case there is Zoom/Brightness |
|
516 //adjustment ongoing in operator variant. Middle softkey will be |
|
517 //updated once adjustment is done |
|
518 if ( !MUS_NO_TOOLBAR || |
|
519 ( !iController->ZoomSelected() && |
|
520 !iController->BrightnessSelected() ) ) |
|
521 { |
|
522 CMusUiGeneralView::RefreshAudioRoutingToolbarButton(); |
|
523 } |
|
524 |
|
525 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshAudioRoutingButton" ); |
|
526 } |
|
527 |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 // ----------------------------------------------------------------------------- |
|
531 // |
|
532 void CMusUiLiveSharingView::ReplaceToolbarCommand( TInt aOldCommand, |
|
533 TInt aNewCommand, |
|
534 TBool aSetNewCommandFocused ) |
|
535 { |
|
536 MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingView::ReplaceToolbarCommand: %d", |
|
537 aOldCommand ); |
|
538 switch ( aOldCommand ) |
|
539 { |
|
540 case EMusuiCmdToolbarPauseLive: |
|
541 { |
|
542 iPauseSelected = ETrue; |
|
543 /* Hide pause related toolbar items */ |
|
544 HideToolbarCommandForPause(ETrue); |
|
545 break; |
|
546 } |
|
547 case EMusuiCmdToolbarUnPauseLive: |
|
548 { |
|
549 iPauseSelected = EFalse; |
|
550 /* Unhide pause related toolbar items */ |
|
551 HideToolbarCommandForPause(EFalse); |
|
552 break; |
|
553 } |
|
554 default: |
|
555 { |
|
556 break; |
|
557 } |
|
558 } |
|
559 |
|
560 // Call base class version for generic part |
|
561 |
|
562 CMusUiGeneralView::ReplaceToolbarCommand( aOldCommand, |
|
563 aNewCommand, |
|
564 aSetNewCommandFocused ); |
|
565 |
|
566 MUS_LOG1( "mus: [MUSUI ] <- CMusUiLiveSharingView::ReplaceToolbarCommand: %d", |
|
567 aNewCommand ); |
|
568 } |
|
569 |
|
570 |
|
571 // ----------------------------------------------------------------------------- |
|
572 // |
|
573 // ----------------------------------------------------------------------------- |
|
574 // |
|
575 void CMusUiLiveSharingView::RefreshView() |
|
576 { |
|
577 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshView" ); |
|
578 if ( iContainer ) |
|
579 { |
|
580 TRect containerRect( ClientRect().iBr.iX - KMusUiContainerWidth, |
|
581 ClientRect().iTl.iY, |
|
582 ClientRect().iBr.iX, |
|
583 ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
584 iContainer->SetRect( containerRect ); |
|
585 } |
|
586 |
|
587 if ( iController ) |
|
588 { |
|
589 TRect videoRect( ClientRect().iTl.iX, |
|
590 ClientRect().iTl.iY, |
|
591 ClientRect().iBr.iX, |
|
592 ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
593 // if this function leaves we can nothing to do for camera orientation. |
|
594 // Alteast we can try further to set right rectangle for display |
|
595 TRAPD(err,RefreshCameraOrientationL(videoRect)); |
|
596 if( err ) |
|
597 { |
|
598 MUS_LOG1( "mus: [MUSUI ] -> Orientation can not be changed =%d",err ); |
|
599 } |
|
600 iController->SetRect( videoRect ); |
|
601 } |
|
602 |
|
603 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshView" ); |
|
604 } |
|
605 |
|
606 |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 // ----------------------------------------------------------------------------- |
|
610 // |
|
611 CMusUiSendController* CMusUiLiveSharingView::SendController() const |
|
612 { |
|
613 return iController; |
|
614 } |
|
615 |
|
616 |
|
617 // ----------------------------------------------------------------------------- |
|
618 // |
|
619 // ----------------------------------------------------------------------------- |
|
620 // |
|
621 CMusUiSendViewContainer* CMusUiLiveSharingView::SendContainer() const |
|
622 { |
|
623 return iContainer; |
|
624 } |
|
625 |
|
626 |
|
627 // ----------------------------------------------------------------------------- |
|
628 // From CAknView, Gets called from framework when activating this view |
|
629 // ----------------------------------------------------------------------------- |
|
630 // |
|
631 void CMusUiLiveSharingView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
632 TUid aCustomMessageId, |
|
633 const TDesC8& aCustomMessage ) |
|
634 { |
|
635 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoActivateL" ); |
|
636 |
|
637 // Base class activation first |
|
638 CMusUiSendView::DoActivateL( aPrevViewId, |
|
639 aCustomMessageId, |
|
640 aCustomMessage ); |
|
641 |
|
642 TRect containerRect( ClientRect().iBr.iX - KMusUiContainerWidth, |
|
643 ClientRect().iTl.iY, |
|
644 ClientRect().iBr.iX, |
|
645 ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
646 |
|
647 if ( !iContainer ) |
|
648 { |
|
649 MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingView::DoActivateL: !iContainer" ); |
|
650 iContainer = new ( ELeave ) CMusUiLiveSharingViewContainer(); |
|
651 iContainer->SetMopParent( this ); |
|
652 iContainer->ConstructL( this, |
|
653 containerRect ); |
|
654 AppUi()->AddToViewStackL( *this, iContainer ); |
|
655 } |
|
656 |
|
657 /* Increase the ordinal position of background container |
|
658 * So that other control will be drawn first. |
|
659 */ |
|
660 UpdateBackgroundOrdinalPosition( ETrue ); |
|
661 |
|
662 TRect videoRect( ClientRect().iTl.iX, |
|
663 ClientRect().iTl.iY, |
|
664 ClientRect().iBr.iX, |
|
665 ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
666 |
|
667 if ( !iController ) |
|
668 { |
|
669 MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingView::DoActivateL: !iController" ); |
|
670 iController = CMusUiLiveSharingController::NewL( *MusAppUi(), |
|
671 *this, |
|
672 *this, |
|
673 *this, |
|
674 videoRect ); |
|
675 iController->StartInvitationL(); |
|
676 } |
|
677 |
|
678 iContainer->SetController( iController ); |
|
679 |
|
680 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoActivateL" ); |
|
681 } |
|
682 |
|
683 |
|
684 // ----------------------------------------------------------------------------- |
|
685 // From AknView, Gets called from framework when deactivating this view |
|
686 // ----------------------------------------------------------------------------- |
|
687 // |
|
688 void CMusUiLiveSharingView::DoDeactivate() |
|
689 { |
|
690 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoDeactivate" ); |
|
691 |
|
692 CMusUiSendView::DoDeactivate(); // Base class deactivation first |
|
693 |
|
694 if ( iContainer ) |
|
695 { |
|
696 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
697 delete iContainer; |
|
698 iContainer = NULL; |
|
699 } |
|
700 |
|
701 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoDeactivate" ); |
|
702 } |
|
703 |
|
704 // ----------------------------------------------------------------------------- |
|
705 // When orientation changed , Camera instances has to be recreated inorder |
|
706 // to receive proper orientated frames. |
|
707 // ----------------------------------------------------------------------------- |
|
708 // |
|
709 void CMusUiLiveSharingView::RefreshCameraOrientationL(TRect& aNewRect) |
|
710 { |
|
711 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshCameraOrientation" ); |
|
712 if( iController && iController->IsPlayingL() ) |
|
713 { |
|
714 TRect oldRect = iController->EngineSession()->Rect(); |
|
715 MUS_LOG2( "mus: [MUSUI ] -> Old Rect (width = %d,height=%d)",oldRect.Width(),oldRect.Height() ); |
|
716 MUS_LOG2( "mus: [MUSUI ] -> New Rect (width = %d,height=%d)",aNewRect.Width(),aNewRect.Height() ); |
|
717 if ( !( ( ( oldRect.Width() > oldRect.Height() ) && //check lanscape |
|
718 ( aNewRect.Width() > aNewRect.Height() ) |
|
719 ) |
|
720 || |
|
721 ( |
|
722 ( oldRect.Width() < oldRect.Height() ) && // check portrait |
|
723 ( aNewRect.Width() < aNewRect.Height() ) |
|
724 ) |
|
725 ) |
|
726 ) |
|
727 { |
|
728 MUS_LOG( "mus: [MUSUI ] -> Orientation Changed.Restart Camera" ); |
|
729 iController->PauseL(); |
|
730 iController->PlayL(); |
|
731 } |
|
732 else |
|
733 { |
|
734 MUS_LOG( "mus: [MUSUI ] -> Orientation Not changed. dont restart camera"); |
|
735 } |
|
736 } |
|
737 else |
|
738 { |
|
739 MUS_LOG( "mus: [MUSUI ] -> Not Playing"); |
|
740 } |
|
741 |
|
742 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshCameraOrientation" ); |
|
743 } |
|
744 |
|
745 // ----------------------------------------------------------------------------- |
|
746 // When Live sharing paused , camera source will be unavilable, hence |
|
747 // it is inappropriate to show the zoom and brightness |
|
748 // so hide those item. And unhide it again when unpaused. |
|
749 // ----------------------------------------------------------------------------- |
|
750 // |
|
751 void CMusUiLiveSharingView::HideToolbarCommandForPause( TBool aIsPaused ) |
|
752 { |
|
753 MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingView::HideToolbarCommandForPause() %d",aIsPaused); |
|
754 /* Hide brightness toolbar item if paused else unhide. Draw immediately.*/ |
|
755 Toolbar()->HideItem( EMusuiCmdToolbarBrightness, aIsPaused, ETrue ); |
|
756 /* Hide zoom toolbar item if paused else unhide. Draw immediately.*/ |
|
757 Toolbar()->HideItem( EMusuiCmdToolbarZoom, aIsPaused, ETrue ); |
|
758 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::HideToolbarCommandForPause"); |
|
759 } |
|
760 |
|
761 // ----------------------------------------------------------------------------- |
|
762 // |
|
763 // ----------------------------------------------------------------------------- |
|
764 // |
|
765 void CMusUiLiveSharingView::ResetToolBarSelected() |
|
766 { |
|
767 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::ResetToolBarSelected" ); |
|
768 iController->ResetToolbarSelected(); |
|
769 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::ResetToolBarSelected" ); |
|
770 } |
|
771 // end of file |
|