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: 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, TBool aOnlyIfVisible )
|
|
374 |
{
|
|
375 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::ActivateVolumeControlL" );
|
|
376 |
MusAppUi()->MusStatusPane()->ActivateVolumeControlL( aValue, aOnlyIfVisible );
|
|
377 |
|
|
378 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::ActivateVolumeControlL" );
|
|
379 |
}
|
|
380 |
|
|
381 |
|
|
382 |
// -----------------------------------------------------------------------------
|
|
383 |
//
|
|
384 |
// -----------------------------------------------------------------------------
|
|
385 |
//
|
|
386 |
void CMusUiGeneralView::HighlightSelectedToolbarItem( TInt aCommand )
|
|
387 |
{
|
|
388 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::HightlightSelectedToolbarItem" );
|
|
389 |
iToolbarItemSelected = !iToolbarItemSelected;
|
|
390 |
CAknButton* button = static_cast<CAknButton*>( Toolbar()->ControlOrNull(
|
|
391 |
aCommand ) );
|
|
392 |
button->SetCurrentState( iToolbarItemSelected ? 1 : 0, ETrue );
|
|
393 |
|
|
394 |
TBool dimAudioRouting( iToolbarItemSelected ||
|
|
395 |
!( EventController() &&
|
|
396 |
EventController()->AudioRoutingCanBeChanged() ) );
|
|
397 |
|
|
398 |
for ( TInt i = EMusuiCmdToolbarVolume; i < EMusUiCmdToolbarLastIndex; i++ )
|
|
399 |
{
|
|
400 |
// Undim audio routing buttons only if changing the routing is allowed
|
|
401 |
if ( i == EMusuiCmdToolbarSpeakerOn )
|
|
402 |
{
|
|
403 |
Toolbar()->SetItemDimmed(
|
|
404 |
EMusuiCmdToolbarSpeakerOn,
|
|
405 |
dimAudioRouting,
|
|
406 |
ETrue );
|
|
407 |
}
|
|
408 |
else if ( i == EMusuiCmdToolbarSpeakerOff )
|
|
409 |
{
|
|
410 |
Toolbar()->SetItemDimmed(
|
|
411 |
EMusuiCmdToolbarSpeakerOff,
|
|
412 |
dimAudioRouting,
|
|
413 |
ETrue );
|
|
414 |
}
|
|
415 |
else if ( i != aCommand )
|
|
416 |
{
|
|
417 |
Toolbar()->SetItemDimmed( i, iToolbarItemSelected, ETrue );
|
|
418 |
}
|
|
419 |
else
|
|
420 |
{
|
|
421 |
// NOP
|
|
422 |
}
|
|
423 |
}
|
|
424 |
|
|
425 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HightlightSelectedToolbarItem" );
|
|
426 |
}
|
|
427 |
|
|
428 |
|
|
429 |
// -----------------------------------------------------------------------------
|
|
430 |
//
|
|
431 |
// -----------------------------------------------------------------------------
|
|
432 |
//
|
|
433 |
void CMusUiGeneralView::ReplaceToolbarCommand( TInt aOldCommand,
|
|
434 |
TInt aNewCommand,
|
|
435 |
TBool aSetNewCommandFocused )
|
|
436 |
{
|
|
437 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::ReplaceToolbarCommand: %d",
|
|
438 |
aNewCommand );
|
|
439 |
|
|
440 |
// Hide the old item:
|
|
441 |
Toolbar()->HideItem( aOldCommand, ETrue, EFalse );
|
|
442 |
// Show new item:
|
|
443 |
Toolbar()->HideItem( aNewCommand, EFalse, ETrue );
|
|
444 |
|
|
445 |
TBool dimAudioRouting( iToolbarItemSelected ||
|
|
446 |
!( EventController() &&
|
|
447 |
EventController()->AudioRoutingCanBeChanged() ) );
|
|
448 |
|
|
449 |
if ( aNewCommand == EMusuiCmdToolbarSpeakerOn ||
|
|
450 |
aNewCommand == EMusuiCmdToolbarSpeakerOff )
|
|
451 |
{
|
|
452 |
// Dim audio routing button if audio routing cannot be changed
|
|
453 |
Toolbar()->SetItemDimmed( aNewCommand,
|
|
454 |
dimAudioRouting,
|
|
455 |
ETrue );
|
|
456 |
}
|
|
457 |
|
|
458 |
if ( aSetNewCommandFocused &&
|
|
459 |
!AknLayoutUtils::PenEnabled() )
|
|
460 |
{
|
|
461 |
TRAP_IGNORE( Toolbar()->SetFocusedItemL( aNewCommand ) );
|
|
462 |
}
|
|
463 |
|
|
464 |
MUS_LOG1( "mus: [MUSUI ] <- CMusUiGeneralView::ReplaceToolbarCommand: %d",
|
|
465 |
aNewCommand );
|
|
466 |
}
|
|
467 |
|
|
468 |
|
|
469 |
// -----------------------------------------------------------------------------
|
|
470 |
//
|
|
471 |
// -----------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
void CMusUiGeneralView::DismissMenuBar()
|
|
474 |
{
|
|
475 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DismissMenuBar" );
|
|
476 |
StopDisplayingMenuBar();
|
|
477 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DismissMenuBar" );
|
|
478 |
}
|
|
479 |
|
|
480 |
|
|
481 |
// -----------------------------------------------------------------------------
|
|
482 |
//
|
|
483 |
// -----------------------------------------------------------------------------
|
|
484 |
//
|
|
485 |
void CMusUiGeneralView::RefreshAudioRoutingToolbarButton()
|
|
486 |
{
|
|
487 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::RefreshAudioRoutingToolbarButton" )
|
|
488 |
TBool loudSpeakerEnabled( EventController() &&
|
|
489 |
EventController()->IsLoudSpeakerEnabled() );
|
|
490 |
if ( MUS_NO_TOOLBAR )
|
|
491 |
{
|
|
492 |
TRAP_IGNORE( EnableMiddleSoftkeyL( loudSpeakerEnabled ?
|
|
493 |
R_MUSUI_VIEW_OPS_MSK_IHF_OFF :
|
|
494 |
R_MUSUI_VIEW_OPS_MSK_IHF_ON ) );
|
|
495 |
}
|
|
496 |
else if ( Toolbar()->IsShown() )
|
|
497 |
{
|
|
498 |
// If toolbar is not shown, it will be refreshed automatically when shown.
|
|
499 |
TInt focusedItem( Toolbar()->FocusedItem() );
|
|
500 |
TBool focusInAudioRouting( focusedItem == EMusuiCmdToolbarSpeakerOff ||
|
|
501 |
focusedItem == EMusuiCmdToolbarSpeakerOn );
|
|
502 |
|
|
503 |
TBool loudSpeakerEnabled( EventController() &&
|
|
504 |
EventController()->IsLoudSpeakerEnabled() );
|
|
505 |
|
|
506 |
// Hide old audio routing buttton
|
|
507 |
Toolbar()->HideItem( loudSpeakerEnabled ?
|
|
508 |
EMusuiCmdToolbarSpeakerOn :
|
|
509 |
EMusuiCmdToolbarSpeakerOff,
|
|
510 |
ETrue,
|
|
511 |
EFalse );
|
|
512 |
|
|
513 |
// Show new audio routing button
|
|
514 |
Toolbar()->HideItem( loudSpeakerEnabled ?
|
|
515 |
EMusuiCmdToolbarSpeakerOff :
|
|
516 |
EMusuiCmdToolbarSpeakerOn,
|
|
517 |
EFalse,
|
|
518 |
ETrue );
|
|
519 |
|
|
520 |
// Dim new audio routing button if audio routing cannot be changed
|
|
521 |
// or when some button is selected
|
|
522 |
TBool dimAudioRouting( iToolbarItemSelected ||
|
|
523 |
!( EventController() &&
|
|
524 |
EventController()->AudioRoutingCanBeChanged() ) );
|
|
525 |
|
|
526 |
Toolbar()->SetItemDimmed( loudSpeakerEnabled ?
|
|
527 |
EMusuiCmdToolbarSpeakerOff :
|
|
528 |
EMusuiCmdToolbarSpeakerOn,
|
|
529 |
dimAudioRouting,
|
|
530 |
ETrue );
|
|
531 |
|
|
532 |
// If audio routing button has been focused, focus also the new button
|
|
533 |
// if it is not dimmed
|
|
534 |
if ( focusInAudioRouting &&
|
|
535 |
!dimAudioRouting &&
|
|
536 |
!AknLayoutUtils::PenEnabled() )
|
|
537 |
{
|
|
538 |
TRAP_IGNORE( Toolbar()->SetFocusedItemL( loudSpeakerEnabled ?
|
|
539 |
EMusuiCmdToolbarSpeakerOff :
|
|
540 |
EMusuiCmdToolbarSpeakerOn ) )
|
|
541 |
}
|
|
542 |
|
|
543 |
|
|
544 |
}
|
|
545 |
|
|
546 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::RefreshAudioRoutingToolbarButton" )
|
|
547 |
}
|
|
548 |
|
|
549 |
|
|
550 |
// -----------------------------------------------------------------------------
|
|
551 |
//
|
|
552 |
// -----------------------------------------------------------------------------
|
|
553 |
//
|
|
554 |
void CMusUiGeneralView::UpdateSessionTime( const TDesC& aSessionTime )
|
|
555 |
{
|
|
556 |
MUS_LOG_TDESC( "mus: [MUSUI ] -> CMusUiGeneralView::UpdateSessionTime: ",
|
|
557 |
aSessionTime );
|
|
558 |
|
|
559 |
TRAPD( err, MusAppUi()->MusStatusPane()->SetLeftLabelL( aSessionTime ) );
|
|
560 |
if ( err != KErrNone )
|
|
561 |
{
|
|
562 |
EventController()->HandleError( err );
|
|
563 |
}
|
|
564 |
|
|
565 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::UpdateSessionTime" );
|
|
566 |
}
|
|
567 |
|
|
568 |
|
|
569 |
// -----------------------------------------------------------------------------
|
|
570 |
// takes care of view command handling
|
|
571 |
// -----------------------------------------------------------------------------
|
|
572 |
//
|
|
573 |
void CMusUiGeneralView::HandleCommandL( TInt aCommand )
|
|
574 |
{
|
|
575 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::HandleCommandL" );
|
|
576 |
|
|
577 |
EventControllerL().HandleCommandL( aCommand );
|
|
578 |
|
|
579 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HandleCommandL" );
|
|
580 |
}
|
|
581 |
|
|
582 |
|
|
583 |
// -----------------------------------------------------------------------------
|
|
584 |
//
|
|
585 |
// -----------------------------------------------------------------------------
|
|
586 |
//
|
|
587 |
CMusUiEventController& CMusUiGeneralView::EventControllerL() const
|
|
588 |
{
|
|
589 |
__ASSERT_ALWAYS( EventController(), User::Leave( KErrNotFound ) );
|
|
590 |
|
|
591 |
return *EventController();
|
|
592 |
}
|
|
593 |
|
|
594 |
|
|
595 |
// -----------------------------------------------------------------------------
|
|
596 |
// Called when focus event occurs. Timer is started once coming to foreground
|
|
597 |
// as often in such case we receive burst of foreground/background events.
|
|
598 |
// Timer is used to filter that burst and to determine the final condition.
|
|
599 |
// -----------------------------------------------------------------------------
|
|
600 |
//
|
|
601 |
void CMusUiGeneralView::HandleForegroundEventL( TBool aForeground, TBool aExit )
|
|
602 |
{
|
|
603 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::HandleForegroundEventL: %d",
|
|
604 |
aForeground );
|
|
605 |
|
|
606 |
SetCurrentFgBgEvent( ( aForeground ? EMusFgEvent : EMusBgEvent ) );
|
|
607 |
iCurrentExitSetting = aExit;
|
|
608 |
|
|
609 |
if ( !iFgBgTimer->IsActive() )
|
|
610 |
{
|
|
611 |
if ( aForeground )
|
|
612 |
{
|
|
613 |
MUS_LOG( "mus: [MUSUI ] delayed to fg" );
|
|
614 |
}
|
|
615 |
else
|
|
616 |
{
|
|
617 |
DoBackgroundEventL( iCurrentExitSetting );
|
|
618 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HandleForegroundEventL,\
|
|
619 |
immediately to bg" );
|
|
620 |
return;
|
|
621 |
}
|
|
622 |
}
|
|
623 |
|
|
624 |
iFgBgTimer->After( KMusFgBgEventFiltering );
|
|
625 |
|
|
626 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::HandleForegroundEventL" );
|
|
627 |
}
|
|
628 |
|
|
629 |
|
|
630 |
// -----------------------------------------------------------------------------
|
|
631 |
// From MMusUiActiveTimerObserver
|
|
632 |
// -----------------------------------------------------------------------------
|
|
633 |
//
|
|
634 |
void CMusUiGeneralView::TimerComplete( CMusUiActiveTimer* aTimer )
|
|
635 |
{
|
|
636 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::TimerComplete" );
|
|
637 |
|
|
638 |
if ( aTimer == iSessionEndTimer )
|
|
639 |
{
|
|
640 |
MUS_LOG( "mus: [MUSUI ] Close application because of going \
|
|
641 |
in background" );
|
|
642 |
|
|
643 |
TRAP_IGNORE( EventControllerL().HandleExitL() )
|
|
644 |
}
|
|
645 |
else
|
|
646 |
{
|
|
647 |
TRAP_IGNORE( CompleteForegroundEventL() )
|
|
648 |
}
|
|
649 |
|
|
650 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::TimerComplete" );
|
|
651 |
}
|
|
652 |
|
|
653 |
|
|
654 |
// -----------------------------------------------------------------------------
|
|
655 |
// From MEikMenuObserver, Called by framework before constructing menupane.
|
|
656 |
// Initializes menu items common to all sharing types.
|
|
657 |
// -----------------------------------------------------------------------------
|
|
658 |
//
|
|
659 |
void CMusUiGeneralView::DynInitMenuPaneL( TInt aResourceId,
|
|
660 |
CEikMenuPane* aMenuPane )
|
|
661 |
{
|
|
662 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::DynInitMenuPaneL [%d]",
|
|
663 |
aResourceId );
|
|
664 |
|
|
665 |
if ( aResourceId == R_MUSUI_VIEW_MENU )
|
|
666 |
{
|
|
667 |
|
|
668 |
// Delete Single session items:
|
|
669 |
aMenuPane->DeleteMenuItem( EMusuiCmdViewShareVideo );
|
|
670 |
aMenuPane->DeleteMenuItem( EMusuiCmdViewShareImage );
|
|
671 |
aMenuPane->DeleteMenuItem( EMusuiCmdViewShareLive );
|
|
672 |
if ( MUS_NO_TOOLBAR )
|
|
673 |
{
|
|
674 |
aMenuPane->DeleteMenuItem( EventControllerL().IsMicMutedL() ?
|
|
675 |
EMusuiCmdViewMicrophoneMute :
|
|
676 |
EMusuiCmdViewMicrophoneUnmute );
|
|
677 |
}
|
|
678 |
else
|
|
679 |
{
|
|
680 |
aMenuPane->DeleteMenuItem( EMusuiCmdViewMicrophoneMute );
|
|
681 |
aMenuPane->DeleteMenuItem( EMusuiCmdViewMicrophoneUnmute );
|
|
682 |
}
|
|
683 |
|
|
684 |
if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
685 |
{
|
|
686 |
aMenuPane->DeleteMenuItem( EAknCmdHelp );
|
|
687 |
}
|
|
688 |
}
|
|
689 |
|
|
690 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DynInitMenuPaneL" );
|
|
691 |
}
|
|
692 |
|
|
693 |
|
|
694 |
// -----------------------------------------------------------------------------
|
|
695 |
// CMusUiGeneralView::DoActivateL
|
|
696 |
// From CAknView, Gets called from framework when activating this view
|
|
697 |
// -----------------------------------------------------------------------------
|
|
698 |
void CMusUiGeneralView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
|
|
699 |
TUid /*aCustomMessageId*/,
|
|
700 |
const TDesC8& /*aCustomMessage*/ )
|
|
701 |
{
|
|
702 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoActivateL()" )
|
|
703 |
|
|
704 |
|
|
705 |
MusAppUi()->MusStatusPane()->ClearNaviPaneL();
|
|
706 |
MusAppUi()->MusStatusPane()->SetTitleFromResourceL(
|
|
707 |
R_MUS_LIVE_SHARING_VIEW_TITLE );
|
|
708 |
|
|
709 |
iIncallBubble->SetIncallBubbleAllowedInUsualL( EFalse );
|
|
710 |
|
|
711 |
/* Draw the skin background in the client rectangle area.*/
|
|
712 |
if ( !iBackgroundContainer )
|
|
713 |
{
|
|
714 |
/* Construct background container with clientrect area and
|
|
715 |
* Ordinal position of 0 ie highest so that it draws the initial
|
|
716 |
* skin background first.
|
|
717 |
*/
|
|
718 |
iBackgroundContainer =
|
|
719 |
CMusUiBackgroundViewContainer::NewL( ClientRect(), 0 );
|
|
720 |
/* Add container to view stack so that it get view events */
|
|
721 |
AppUi()->AddToViewStackL( *this, iBackgroundContainer );
|
|
722 |
}
|
|
723 |
else
|
|
724 |
{
|
|
725 |
/* Set the windows ordinal position to highest ie 0,
|
|
726 |
* so that background gets priority and drawn first.
|
|
727 |
*/
|
|
728 |
iBackgroundContainer->SetOrdinalPosition( 0 );
|
|
729 |
}
|
|
730 |
/* Draw the skin background now */
|
|
731 |
iBackgroundContainer->DrawNow();
|
|
732 |
|
|
733 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoActivateL()" )
|
|
734 |
}
|
|
735 |
|
|
736 |
|
|
737 |
// -----------------------------------------------------------------------------
|
|
738 |
// CMusUiGeneralView::DoDeactivate
|
|
739 |
// From AknView, Gets called from framework when deactivating this view
|
|
740 |
// -----------------------------------------------------------------------------
|
|
741 |
void CMusUiGeneralView::DoDeactivate()
|
|
742 |
{
|
|
743 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoDeactivate()" )
|
|
744 |
if ( iBackgroundContainer )
|
|
745 |
{
|
|
746 |
AppUi()->RemoveFromViewStack( *this, iBackgroundContainer );
|
|
747 |
delete iBackgroundContainer;
|
|
748 |
iBackgroundContainer = NULL;
|
|
749 |
}
|
|
750 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoDeactivate()" )
|
|
751 |
}
|
|
752 |
|
|
753 |
|
|
754 |
// -----------------------------------------------------------------------------
|
|
755 |
// Asynchronous completion of last fg/bg condition.
|
|
756 |
// -----------------------------------------------------------------------------
|
|
757 |
//
|
|
758 |
void CMusUiGeneralView::CompleteForegroundEventL()
|
|
759 |
{
|
|
760 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::CompleteForegroundEventL()" )
|
|
761 |
|
|
762 |
if ( iCurrentFgBgEvent == EMusFgEvent )
|
|
763 |
{
|
|
764 |
DoForegroundEventL();
|
|
765 |
}
|
|
766 |
else if ( iCurrentFgBgEvent == EMusBgEvent && EventControllerL().IsForeground() )
|
|
767 |
{
|
|
768 |
// Bg handling when already at bg would cause problems in state
|
|
769 |
// restoring phase when coming back to fg. Easiest to deal with that
|
|
770 |
// at this level.
|
|
771 |
DoBackgroundEventL( iCurrentExitSetting );
|
|
772 |
}
|
|
773 |
|
|
774 |
SetCurrentFgBgEvent( EMusFgBgEventNone );
|
|
775 |
|
|
776 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::CompleteForegroundEventL()" )
|
|
777 |
}
|
|
778 |
|
|
779 |
|
|
780 |
// -----------------------------------------------------------------------------
|
|
781 |
// Complete foreground event.
|
|
782 |
// -----------------------------------------------------------------------------
|
|
783 |
//
|
|
784 |
void CMusUiGeneralView::DoForegroundEventL()
|
|
785 |
{
|
|
786 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoForegroundEventL()" )
|
|
787 |
|
|
788 |
RefreshView();
|
|
789 |
|
|
790 |
iSessionEndTimer->Cancel();
|
|
791 |
|
|
792 |
EventControllerL().HandleForegroundEventL( ETrue );
|
|
793 |
iIncallBubble->SetIncallBubbleAllowedInUsualL( EFalse );
|
|
794 |
|
|
795 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoForegroundEventL()" )
|
|
796 |
}
|
|
797 |
|
|
798 |
|
|
799 |
// -----------------------------------------------------------------------------
|
|
800 |
// Complete background event.
|
|
801 |
// -----------------------------------------------------------------------------
|
|
802 |
//
|
|
803 |
void CMusUiGeneralView::DoBackgroundEventL( TBool aExit )
|
|
804 |
{
|
|
805 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoBackgroundEventL()" )
|
|
806 |
|
|
807 |
if ( aExit )
|
|
808 |
{
|
|
809 |
MUS_LOG( "mus: [MUSUI ] Go to background, \
|
|
810 |
wait some seconds before closing..." );
|
|
811 |
iSessionEndTimer->After( KBackgroundIntervalForClose );
|
|
812 |
}
|
|
813 |
if ( !MusAppUi()->ExitValue() )
|
|
814 |
{
|
|
815 |
MUS_LOG( "mus: [MUSUI ] Calling EventControllerL()" );
|
|
816 |
EventControllerL().HandleForegroundEventL( EFalse );
|
|
817 |
// If exiting, next will be called by destructor
|
|
818 |
iIncallBubble->SetIncallBubbleAllowedInUsualL( ETrue );
|
|
819 |
}
|
|
820 |
|
|
821 |
SetCurrentFgBgEvent( EMusFgBgEventNone );
|
|
822 |
|
|
823 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DoBackgroundEventL()" )
|
|
824 |
}
|
|
825 |
|
|
826 |
// -----------------------------------------------------------------------------
|
|
827 |
// Set current fg/bg condition.
|
|
828 |
// -----------------------------------------------------------------------------
|
|
829 |
//
|
|
830 |
void CMusUiGeneralView::SetCurrentFgBgEvent( TMusFgBgEventType aEventType )
|
|
831 |
{
|
|
832 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::SetCurrentFgBgEvent() event:%d",
|
|
833 |
aEventType )
|
|
834 |
|
|
835 |
iCurrentFgBgEvent = aEventType;
|
|
836 |
}
|
|
837 |
|
|
838 |
// -----------------------------------------------------------------------------
|
|
839 |
//
|
|
840 |
// -----------------------------------------------------------------------------
|
|
841 |
//
|
|
842 |
TBool CMusUiGeneralView::OperatorSpecificFunctionality() const
|
|
843 |
{
|
|
844 |
return iOperatorSpecificFunctionality;
|
|
845 |
}
|
|
846 |
|
|
847 |
// -----------------------------------------------------------------------------
|
|
848 |
//
|
|
849 |
// -----------------------------------------------------------------------------
|
|
850 |
//
|
|
851 |
TInt CMusUiGeneralView::ToolbarPlaceHolderHeight() const
|
|
852 |
{
|
|
853 |
TInt toolbarPlaceHolderHeight( 0 );
|
|
854 |
CAknAppUiBase::TAppUiOrientation orientation = MusAppUi()->AppOrientation();
|
|
855 |
if ( !Toolbar()->IsShown() &&
|
|
856 |
orientation == CAknAppUiBase::EAppUiOrientationPortrait &&
|
|
857 |
AknLayoutUtils::PenEnabled() )
|
|
858 |
{
|
|
859 |
// In touch UI in portrait mode the toolbar
|
|
860 |
// fills the whole lower part of the screen
|
|
861 |
toolbarPlaceHolderHeight = Toolbar()->Size().iHeight;
|
|
862 |
}
|
|
863 |
return toolbarPlaceHolderHeight;
|
|
864 |
}
|
|
865 |
|
|
866 |
// -----------------------------------------------------------------------------
|
|
867 |
//
|
|
868 |
// -----------------------------------------------------------------------------
|
|
869 |
//
|
|
870 |
TInt CMusUiGeneralView::ToolbarPlaceHolderWidth() const
|
|
871 |
{
|
|
872 |
TInt toolbarPlaceHolderWidth( 0 );
|
|
873 |
CAknAppUiBase::TAppUiOrientation orientation = MusAppUi()->AppOrientation();
|
|
874 |
if ( !Toolbar()->IsShown() &&
|
|
875 |
orientation == CAknAppUiBase::EAppUiOrientationLandscape &&
|
|
876 |
AknLayoutUtils::PenEnabled() )
|
|
877 |
{
|
|
878 |
// In touch UI in EAppUiOrientationLandscape mode the toolbar
|
|
879 |
// fills the whole lower part of the screen
|
|
880 |
toolbarPlaceHolderWidth = Toolbar()->Size().iWidth;
|
|
881 |
}
|
|
882 |
return toolbarPlaceHolderWidth;
|
|
883 |
}
|
|
884 |
|
|
885 |
// -----------------------------------------------------------------------------
|
|
886 |
// Increase/Decrease background container ordinal so that other controls
|
|
887 |
// can preceed background
|
|
888 |
// -----------------------------------------------------------------------------
|
|
889 |
//
|
|
890 |
void CMusUiGeneralView::UpdateBackgroundOrdinalPosition( TBool aUp )
|
|
891 |
{
|
|
892 |
// If there is no background container then do not care
|
|
893 |
if ( iBackgroundContainer )
|
|
894 |
{
|
|
895 |
iBackgroundContainer->UpdateOrdinalPositionValue( aUp );
|
|
896 |
}
|
|
897 |
}
|
|
898 |
|
|
899 |
// -----------------------------------------------------------------------------
|
|
900 |
// Do refresh for background container only if display is disabled.
|
|
901 |
// Refreshing if display is enabled would cause bg container
|
|
902 |
// to draw itself on top of display area, making it invisible.
|
|
903 |
// -----------------------------------------------------------------------------
|
|
904 |
//
|
|
905 |
void CMusUiGeneralView::RefreshBackgroundContainer()
|
|
906 |
{
|
|
907 |
if ( !iBackgroundContainer )
|
|
908 |
{
|
|
909 |
return;
|
|
910 |
}
|
|
911 |
TBool displayEnabled( EFalse );
|
|
912 |
if ( EventController() )
|
|
913 |
{
|
|
914 |
TRAP_IGNORE( displayEnabled = EventController()->IsDisplayEnabledL() )
|
|
915 |
}
|
|
916 |
|
|
917 |
if ( !displayEnabled )
|
|
918 |
{
|
|
919 |
MUS_LOG( "mus: [MUSUI ] <-> CMusUiGeneralView::RefreshBackgroundContainer()" )
|
|
920 |
iBackgroundContainer->SetRect( ClientRect() );
|
|
921 |
}
|
|
922 |
}
|
|
923 |
|
|
924 |
// end of file
|
|
925 |
|
|
926 |
|
|
927 |
|
|
928 |
|
|
929 |
|
|
930 |
|