author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:28:06 +0300 | |
branch | RCL_3 |
changeset 41 | 755f0370535b |
parent 38 | ac48f0cc9f9c |
permissions | -rw-r--r-- |
33 | 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 ) ); |
|
41
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
226 |
|
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
227 |
if( !iContainer->IsVisible() ) |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
228 |
{ |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
229 |
iController->ResetSelectedFlags(); |
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
230 |
} |
33 | 231 |
|
232 |
switch ( aCommand ) |
|
233 |
{ |
|
234 |
case EKeyLeftArrow: |
|
235 |
{ |
|
236 |
if( MUS_NO_TOOLBAR ) |
|
237 |
{ |
|
238 |
HandleCommandL( |
|
239 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
240 |
iController->BrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
241 |
iController->ZoomSelected() ? EMusuiCmdViewZoomOut : |
|
242 |
EMusUiCmdToolbarLastIndex ); |
|
243 |
} |
|
244 |
else |
|
245 |
{ |
|
246 |
HandleCommandL( |
|
247 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
248 |
iController->ToolbarBrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
249 |
iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomOut : |
|
250 |
EMusUiCmdToolbarLastIndex ); |
|
251 |
} |
|
252 |
break; |
|
253 |
} |
|
254 |
case EKeyRightArrow: |
|
255 |
{ |
|
256 |
if( MUS_NO_TOOLBAR ) |
|
257 |
{ |
|
258 |
HandleCommandL( |
|
259 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
260 |
iController->BrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
261 |
iController->ZoomSelected() ? EMusuiCmdViewZoomIn : |
|
262 |
EMusUiCmdToolbarLastIndex ); |
|
263 |
} |
|
264 |
else |
|
265 |
{ |
|
266 |
HandleCommandL( |
|
267 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
268 |
iController->ToolbarBrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
269 |
iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomIn : |
|
270 |
EMusUiCmdToolbarLastIndex ); |
|
271 |
} |
|
272 |
break; |
|
273 |
} |
|
274 |
case EKeyUpArrow: |
|
275 |
{ |
|
276 |
if( MUS_NO_TOOLBAR ) |
|
277 |
{ |
|
278 |
HandleCommandL( |
|
279 |
iController->ZoomSelected() ? EMusuiCmdViewZoomIn : |
|
280 |
iController->BrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
281 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
282 |
EMusUiCmdToolbarLastIndex ); |
|
283 |
} |
|
284 |
else |
|
285 |
{ |
|
286 |
HandleCommandL( |
|
287 |
iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomIn : |
|
288 |
iController->ToolbarBrightnessSelected() ? EMusuiCmdViewIncreaseBrightness : |
|
289 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeUp : |
|
290 |
EMusUiCmdToolbarLastIndex ); |
|
291 |
} |
|
292 |
break; |
|
293 |
} |
|
294 |
case EKeyDownArrow: |
|
295 |
{ |
|
296 |
if( MUS_NO_TOOLBAR ) |
|
297 |
{ |
|
298 |
HandleCommandL( |
|
299 |
iController->ZoomSelected() ? EMusuiCmdViewZoomOut : |
|
300 |
iController->BrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
301 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
302 |
EMusUiCmdToolbarLastIndex ); |
|
303 |
} |
|
304 |
else |
|
305 |
{ |
|
306 |
HandleCommandL( |
|
307 |
iController->ToolbarZoomSelected() ? EMusuiCmdViewZoomOut : |
|
308 |
iController->ToolbarBrightnessSelected() ? EMusuiCmdViewDecreaseBrightness : |
|
309 |
iController->ToolbarVolumeSelected() ? EMusuiCmdViewVolumeDown : |
|
310 |
EMusUiCmdToolbarLastIndex ); |
|
311 |
} |
|
312 |
break; |
|
313 |
} |
|
314 |
case EMusuiCmdViewVolumeDown: |
|
315 |
{ |
|
316 |
HandleCommandL( EMusuiCmdViewVolumeDown ); |
|
317 |
break; |
|
318 |
} |
|
319 |
case EMusuiCmdViewVolumeUp: |
|
320 |
{ |
|
321 |
HandleCommandL( EMusuiCmdViewVolumeUp ); |
|
322 |
break; |
|
323 |
} |
|
324 |
default: |
|
325 |
{ |
|
326 |
break; |
|
327 |
} |
|
328 |
} |
|
329 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::HandleToolbarCommandL" ); |
|
330 |
} |
|
331 |
||
332 |
||
333 |
// ----------------------------------------------------------------------------- |
|
334 |
// |
|
335 |
// ----------------------------------------------------------------------------- |
|
336 |
// |
|
337 |
void CMusUiLiveSharingView::SetInitialFocusedItemL() |
|
338 |
{ |
|
339 |
MUS_LOG( "mus: [MUSUI ] -> MusUiLiveSharingView::SetInitialFocusedItemL" ); |
|
340 |
||
341 |
__ASSERT_ALWAYS( iController, User::Leave( KErrNotReady ) ); |
|
342 |
||
343 |
if ( iOperatorSpecificFunctionality && !AknLayoutUtils::PenEnabled() ) |
|
344 |
{ |
|
345 |
MUS_LOG( "Focus changed in OPERATOR mode !!!!!!!!!!!!!" ); |
|
346 |
Toolbar()->SetFocusedItemL( EMusuiCmdToolbarZoom ); |
|
347 |
||
348 |
} |
|
349 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetInitialFocusedItemL" ); |
|
350 |
} |
|
351 |
||
352 |
// ----------------------------------------------------------------------------- |
|
353 |
// |
|
354 |
// ----------------------------------------------------------------------------- |
|
355 |
// |
|
356 |
void CMusUiLiveSharingView::DynInitToolbarL( TInt aResourceId, |
|
357 |
CAknToolbar* aToolbar ) |
|
358 |
{ |
|
359 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DynInitToolbarL" ); |
|
360 |
||
361 |
// Items to be removed in Live Sharing View: |
|
362 |
if (!AknLayoutUtils::PenEnabled())//(aResourceId == R_MUS_TOOLBAR_NONTOUCH)// |
|
363 |
{ |
|
364 |
Toolbar()->RemoveItem( EMusuiCmdToolbarFFRev ); |
|
365 |
||
366 |
// Items to be removed in Live Sharing View: |
|
367 |
if ( iController->DeviceHasDedicatedVolumeKeys() ) |
|
368 |
{ |
|
369 |
Toolbar()->RemoveItem( EMusuiCmdToolbarVolume ); |
|
370 |
} |
|
371 |
else |
|
372 |
{ |
|
373 |
aToolbar->SetFocusedItemL( EMusuiCmdToolbarVolume ); |
|
374 |
} |
|
375 |
||
376 |
||
377 |
if ( !iController->IsBrightnessSupported() ) |
|
378 |
{ |
|
379 |
Toolbar()->HideItem( EMusuiCmdToolbarBrightness, ETrue, ETrue ); |
|
380 |
} |
|
381 |
else |
|
382 |
{ |
|
383 |
if ( aToolbar->FocusedItem() == KErrNotFound ) |
|
384 |
{ |
|
385 |
aToolbar->SetFocusedItemL( EMusuiCmdToolbarBrightness ); |
|
386 |
} |
|
387 |
} |
|
388 |
} |
|
389 |
Toolbar()->RemoveItem( EMusuiCmdToolbarPause ); |
|
390 |
Toolbar()->RemoveItem( EMusuiCmdToolbarUnPause ); |
|
391 |
Toolbar()->RemoveItem( EMusuiCmdToolbarFullScreen ); |
|
392 |
||
393 |
if ( iOperatorSpecificFunctionality ) |
|
394 |
{ |
|
395 |
// Remove pause/unpause functionality in operator variant case |
|
396 |
Toolbar()->RemoveItem( EMusuiCmdToolbarPauseLive ); |
|
397 |
Toolbar()->RemoveItem( EMusuiCmdToolbarUnPauseLive ); |
|
398 |
if ( (aToolbar->FocusedItem() == KErrNotFound ) && |
|
399 |
!AknLayoutUtils::PenEnabled() ) |
|
400 |
{ |
|
401 |
aToolbar->SetFocusedItemL( EMusuiCmdToolbarZoom ); |
|
402 |
} |
|
403 |
} |
|
404 |
else |
|
405 |
{ |
|
406 |
// Toggled items to be hidden: |
|
407 |
Toolbar()->HideItem( iPauseSelected ? |
|
408 |
EMusuiCmdToolbarPauseLive : |
|
409 |
EMusuiCmdToolbarUnPauseLive, |
|
410 |
ETrue, |
|
411 |
ETrue ); |
|
412 |
if ( aToolbar->FocusedItem() == KErrNotFound && |
|
413 |
!AknLayoutUtils::PenEnabled() ) |
|
414 |
{ |
|
415 |
aToolbar->SetFocusedItemL( EMusuiCmdToolbarPauseLive ); |
|
41
755f0370535b
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
416 |
} |
33 | 417 |
} |
418 |
||
419 |
// Last generic base class functionality |
|
420 |
CMusUiGeneralView::DynInitToolbarL( aResourceId, aToolbar ); |
|
421 |
||
422 |
MUS_LOG1( "aToolbar Focused Item: %d", aToolbar->FocusedItem() ); |
|
423 |
MUS_LOG1( "toolbar() Focused Item: %d", Toolbar()->FocusedItem() ); |
|
424 |
||
425 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DynInitToolbarL" ); |
|
426 |
} |
|
427 |
||
428 |
||
429 |
// ----------------------------------------------------------------------------- |
|
430 |
// |
|
431 |
// ----------------------------------------------------------------------------- |
|
432 |
// |
|
433 |
void CMusUiLiveSharingView::SetZoomValues( TInt aMinZoom, TInt aMaxZoom ) |
|
434 |
{ |
|
435 |
iContainer->SetZoomValues( aMinZoom, aMaxZoom ); |
|
436 |
} |
|
437 |
||
438 |
||
439 |
// ----------------------------------------------------------------------------- |
|
440 |
// |
|
441 |
// ----------------------------------------------------------------------------- |
|
442 |
// |
|
443 |
void CMusUiLiveSharingView::SetBrightnessValues( TInt aMinBrightness, |
|
444 |
TInt aMaxBrightness ) |
|
445 |
{ |
|
446 |
iContainer->SetBrightnessValues( aMinBrightness, aMaxBrightness ); |
|
447 |
} |
|
448 |
||
449 |
||
450 |
// ----------------------------------------------------------------------------- |
|
451 |
// |
|
452 |
// ----------------------------------------------------------------------------- |
|
453 |
// |
|
454 |
void CMusUiLiveSharingView::SetZoomL( TInt aZoomLevel ) |
|
455 |
{ |
|
456 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetZoomL" ); |
|
457 |
iContainer->SetZoomL( aZoomLevel ); |
|
458 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetZoomL" ); |
|
459 |
} |
|
460 |
||
461 |
||
462 |
// ----------------------------------------------------------------------------- |
|
463 |
// |
|
464 |
// ----------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
void CMusUiLiveSharingView::SetBrightnessL( TInt aBrightnessLevel ) |
|
467 |
{ |
|
468 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetBrightnessL" ); |
|
469 |
iContainer->SetBrightnessL( aBrightnessLevel ); |
|
470 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetBrightnessL" ); |
|
471 |
} |
|
472 |
||
473 |
||
474 |
// ----------------------------------------------------------------------------- |
|
475 |
// |
|
476 |
// ----------------------------------------------------------------------------- |
|
477 |
// |
|
478 |
void CMusUiLiveSharingView::SetZoomVisible( TBool aVisible ) |
|
479 |
{ |
|
480 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetZoomVisible" ); |
|
481 |
||
482 |
iContainer->SetZoomVisible( aVisible ); |
|
483 |
||
484 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetZoomVisible" ); |
|
485 |
} |
|
486 |
||
487 |
||
488 |
// ----------------------------------------------------------------------------- |
|
489 |
// |
|
490 |
// ----------------------------------------------------------------------------- |
|
491 |
// |
|
492 |
void CMusUiLiveSharingView::SetBrightnessVisible( TBool aVisible ) |
|
493 |
{ |
|
494 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::SetBrightnessVisible" ); |
|
495 |
||
496 |
iContainer->SetBrightnessVisible( aVisible ); |
|
497 |
||
498 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::SetBrightnessVisible" ); |
|
499 |
} |
|
500 |
||
501 |
// ----------------------------------------------------------------------------- |
|
502 |
// |
|
503 |
// ----------------------------------------------------------------------------- |
|
504 |
// |
|
505 |
void CMusUiLiveSharingView::LevelIndicatorDismissed() |
|
506 |
{ |
|
507 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::LevelIndicatorDismissed" ); |
|
508 |
iController->LevelIndicatorDismissed(); |
|
509 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::LevelIndicatorDismissed" ); |
|
510 |
} |
|
511 |
||
512 |
||
513 |
// ----------------------------------------------------------------------------- |
|
514 |
// |
|
515 |
// ----------------------------------------------------------------------------- |
|
516 |
// |
|
517 |
void CMusUiLiveSharingView::RefreshAudioRoutingButton() |
|
518 |
{ |
|
519 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshAudioRoutingButton" ); |
|
520 |
//We ignore audio routing change event in case there is Zoom/Brightness |
|
521 |
//adjustment ongoing in operator variant. Middle softkey will be |
|
522 |
//updated once adjustment is done |
|
523 |
if ( !MUS_NO_TOOLBAR || |
|
524 |
( !iController->ZoomSelected() && |
|
525 |
!iController->BrightnessSelected() ) ) |
|
526 |
{ |
|
527 |
CMusUiGeneralView::RefreshAudioRoutingToolbarButton(); |
|
528 |
} |
|
529 |
||
530 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshAudioRoutingButton" ); |
|
531 |
} |
|
532 |
||
533 |
// ----------------------------------------------------------------------------- |
|
534 |
// |
|
535 |
// ----------------------------------------------------------------------------- |
|
536 |
// |
|
537 |
void CMusUiLiveSharingView::ReplaceToolbarCommand( TInt aOldCommand, |
|
538 |
TInt aNewCommand, |
|
539 |
TBool aSetNewCommandFocused ) |
|
540 |
{ |
|
541 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingView::ReplaceToolbarCommand: %d", |
|
542 |
aOldCommand ); |
|
543 |
switch ( aOldCommand ) |
|
544 |
{ |
|
545 |
case EMusuiCmdToolbarPauseLive: |
|
546 |
{ |
|
547 |
iPauseSelected = ETrue; |
|
548 |
/* Hide pause related toolbar items */ |
|
549 |
HideToolbarCommandForPause(ETrue); |
|
550 |
break; |
|
551 |
} |
|
552 |
case EMusuiCmdToolbarUnPauseLive: |
|
553 |
{ |
|
554 |
iPauseSelected = EFalse; |
|
555 |
/* Unhide pause related toolbar items */ |
|
556 |
HideToolbarCommandForPause(EFalse); |
|
557 |
break; |
|
558 |
} |
|
559 |
default: |
|
560 |
{ |
|
561 |
break; |
|
562 |
} |
|
563 |
} |
|
564 |
||
565 |
// Call base class version for generic part |
|
566 |
||
567 |
CMusUiGeneralView::ReplaceToolbarCommand( aOldCommand, |
|
568 |
aNewCommand, |
|
569 |
aSetNewCommandFocused ); |
|
570 |
||
571 |
MUS_LOG1( "mus: [MUSUI ] <- CMusUiLiveSharingView::ReplaceToolbarCommand: %d", |
|
572 |
aNewCommand ); |
|
573 |
} |
|
574 |
||
575 |
||
576 |
// ----------------------------------------------------------------------------- |
|
577 |
// |
|
578 |
// ----------------------------------------------------------------------------- |
|
579 |
// |
|
580 |
void CMusUiLiveSharingView::RefreshView() |
|
581 |
{ |
|
582 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshView" ); |
|
583 |
if ( iController ) |
|
584 |
{ |
|
585 |
DoRefreshView(); |
|
586 |
} |
|
587 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshView" ); |
|
588 |
} |
|
589 |
||
590 |
||
591 |
// ----------------------------------------------------------------------------- |
|
592 |
// |
|
593 |
// ----------------------------------------------------------------------------- |
|
594 |
// |
|
595 |
void CMusUiLiveSharingView::DoRefreshView() |
|
596 |
{ |
|
597 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoRefreshView" ); |
|
598 |
||
599 |
// Refresh background container before and after as display status |
|
600 |
// may change due async orientation change handling. |
|
601 |
RefreshBackgroundContainer(); |
|
602 |
||
603 |
if ( iContainer ) |
|
604 |
{ |
|
605 |
TRect containerRect( ClientRect().iBr.iX - KMusUiContainerWidth, |
|
606 |
ClientRect().iTl.iY, |
|
607 |
ClientRect().iBr.iX, |
|
608 |
ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
609 |
iContainer->SetRect( containerRect ); |
|
610 |
} |
|
611 |
||
612 |
if ( iController ) |
|
613 |
{ |
|
614 |
TRect videoRect( ClientRect().iTl.iX, |
|
615 |
ClientRect().iTl.iY, |
|
616 |
ClientRect().iBr.iX, |
|
617 |
ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
618 |
// if this function leaves we can nothing to do for camera orientation. |
|
619 |
// Alteast we can try further to set right rectangle for display |
|
620 |
TRAPD(err,RefreshCameraOrientationL(videoRect)); |
|
621 |
if( err ) |
|
622 |
{ |
|
623 |
MUS_LOG1( "mus: [MUSUI ] -> Orientation can not be changed =%d",err ); |
|
624 |
} |
|
625 |
iController->SetRect( videoRect ); |
|
626 |
} |
|
627 |
||
628 |
RefreshBackgroundContainer(); |
|
629 |
||
630 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoRefreshView" ); |
|
631 |
} |
|
632 |
||
633 |
// ----------------------------------------------------------------------------- |
|
634 |
// |
|
635 |
// ----------------------------------------------------------------------------- |
|
636 |
// |
|
637 |
CMusUiSendController* CMusUiLiveSharingView::SendController() const |
|
638 |
{ |
|
639 |
return iController; |
|
640 |
} |
|
641 |
||
642 |
||
643 |
// ----------------------------------------------------------------------------- |
|
644 |
// |
|
645 |
// ----------------------------------------------------------------------------- |
|
646 |
// |
|
647 |
CMusUiSendViewContainer* CMusUiLiveSharingView::SendContainer() const |
|
648 |
{ |
|
649 |
return iContainer; |
|
650 |
} |
|
651 |
||
652 |
||
653 |
// ----------------------------------------------------------------------------- |
|
654 |
// From CAknView, Gets called from framework when activating this view |
|
655 |
// ----------------------------------------------------------------------------- |
|
656 |
// |
|
657 |
void CMusUiLiveSharingView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
658 |
TUid aCustomMessageId, |
|
659 |
const TDesC8& aCustomMessage ) |
|
660 |
{ |
|
661 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoActivateL" ); |
|
662 |
||
663 |
// Base class activation first |
|
664 |
CMusUiSendView::DoActivateL( aPrevViewId, |
|
665 |
aCustomMessageId, |
|
666 |
aCustomMessage ); |
|
667 |
||
668 |
TRect clientRect = ClientRect(); |
|
669 |
clientRect.iBr.iX -= ToolbarPlaceHolderWidth(); |
|
670 |
clientRect.iBr.iY -= ToolbarPlaceHolderHeight(); |
|
671 |
||
672 |
TRect containerRect( clientRect.iBr.iX - KMusUiContainerWidth, |
|
673 |
clientRect.iTl.iY, |
|
674 |
clientRect.iBr.iX, |
|
675 |
clientRect.iBr.iY ); |
|
676 |
||
677 |
if ( !iContainer ) |
|
678 |
{ |
|
679 |
MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingView::DoActivateL: !iContainer" ); |
|
680 |
iContainer = new ( ELeave ) CMusUiLiveSharingViewContainer(); |
|
681 |
iContainer->SetMopParent( this ); |
|
682 |
iContainer->ConstructL( this, |
|
683 |
containerRect ); |
|
684 |
AppUi()->AddToViewStackL( *this, iContainer ); |
|
685 |
} |
|
686 |
||
687 |
/* Increase the ordinal position of background container |
|
688 |
* So that other control will be drawn first. |
|
689 |
*/ |
|
690 |
UpdateBackgroundOrdinalPosition( ETrue ); |
|
691 |
||
692 |
TRect videoRect( ClientRect().iTl.iX, |
|
693 |
ClientRect().iTl.iY, |
|
694 |
ClientRect().iBr.iX, |
|
695 |
ClientRect().iBr.iY - ToolbarPlaceHolderHeight() ); |
|
696 |
||
697 |
if ( !iController ) |
|
698 |
{ |
|
699 |
MUS_LOG( "mus: [MUSUI ] CMusUiLiveSharingView::DoActivateL: !iController" ); |
|
700 |
iController = CMusUiLiveSharingController::NewL( *MusAppUi(), |
|
701 |
*this, |
|
702 |
*this, |
|
703 |
*this, |
|
704 |
videoRect ); |
|
705 |
iController->StartInvitationL(); |
|
706 |
} |
|
707 |
||
708 |
iContainer->SetController( iController ); |
|
709 |
||
710 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoActivateL" ); |
|
711 |
} |
|
712 |
||
713 |
||
714 |
// ----------------------------------------------------------------------------- |
|
715 |
// From AknView, Gets called from framework when deactivating this view |
|
716 |
// ----------------------------------------------------------------------------- |
|
717 |
// |
|
718 |
void CMusUiLiveSharingView::DoDeactivate() |
|
719 |
{ |
|
720 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoDeactivate" ); |
|
721 |
||
722 |
CMusUiSendView::DoDeactivate(); // Base class deactivation first |
|
723 |
||
724 |
if ( iContainer ) |
|
725 |
{ |
|
726 |
AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
727 |
delete iContainer; |
|
728 |
iContainer = NULL; |
|
729 |
} |
|
730 |
||
731 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoDeactivate" ); |
|
732 |
} |
|
733 |
||
734 |
// ----------------------------------------------------------------------------- |
|
735 |
// When orientation changed , Camera instances has to be recreated inorder |
|
736 |
// to receive proper orientated frames. |
|
737 |
// ----------------------------------------------------------------------------- |
|
738 |
// |
|
739 |
void CMusUiLiveSharingView::RefreshCameraOrientationL(TRect& aNewRect) |
|
740 |
{ |
|
741 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshCameraOrientation" ); |
|
742 |
if ( !iController || !iController->EngineSession() ) |
|
743 |
{ |
|
744 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshCameraOrientation, no session" ); |
|
745 |
return; |
|
746 |
} |
|
747 |
TRect oldRect = iController->EngineSession()->Rect(); |
|
748 |
MUS_LOG2( "mus: [MUSUI ] -> Old Rect (width = %d,height=%d)",oldRect.Width(),oldRect.Height() ); |
|
749 |
MUS_LOG2( "mus: [MUSUI ] -> New Rect (width = %d,height=%d)",aNewRect.Width(),aNewRect.Height() ); |
|
750 |
if ( !( ( ( oldRect.Width() > oldRect.Height() ) && //check lanscape |
|
751 |
( aNewRect.Width() > aNewRect.Height() ) |
|
752 |
) |
|
753 |
|| |
|
754 |
( |
|
755 |
( oldRect.Width() < oldRect.Height() ) && // check portrait |
|
756 |
( aNewRect.Width() < aNewRect.Height() ) |
|
757 |
) |
|
758 |
) |
|
759 |
) |
|
760 |
{ |
|
761 |
MUS_LOG( "mus: [MUSUI ] -> Orientation Changed.Restart Camera" ); |
|
762 |
iController->RefreshCameraOrientationL(); |
|
763 |
} |
|
764 |
else |
|
765 |
{ |
|
766 |
MUS_LOG( "mus: [MUSUI ] -> Orientation Not changed. dont restart camera"); |
|
767 |
} |
|
768 |
||
769 |
||
770 |
||
771 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshCameraOrientation" ); |
|
772 |
} |
|
773 |
||
774 |
// ----------------------------------------------------------------------------- |
|
775 |
// When Live sharing paused , camera source will be unavilable, hence |
|
776 |
// it is inappropriate to show the zoom and brightness |
|
777 |
// so hide those item. And unhide it again when unpaused. |
|
778 |
// ----------------------------------------------------------------------------- |
|
779 |
// |
|
780 |
void CMusUiLiveSharingView::HideToolbarCommandForPause( TBool aIsPaused ) |
|
781 |
{ |
|
782 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingView::HideToolbarCommandForPause() %d",aIsPaused); |
|
783 |
/* Hide brightness toolbar item if paused else unhide. Draw immediately.*/ |
|
784 |
Toolbar()->HideItem( EMusuiCmdToolbarBrightness, aIsPaused, ETrue ); |
|
785 |
/* Hide zoom toolbar item if paused else unhide. Draw immediately.*/ |
|
786 |
Toolbar()->HideItem( EMusuiCmdToolbarZoom, aIsPaused, ETrue ); |
|
787 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::HideToolbarCommandForPause"); |
|
788 |
} |
|
789 |
||
790 |
// end of file |