# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276065472 -10800 # Node ID ce86b6d44a6d7790c7a64bac013589408887840f # Parent 95754dcd27add6aeec1b563a3bf88fcfc8f4de6f Revision: 201021 Kit: 2010123 diff -r 95754dcd27ad -r ce86b6d44a6d inc/musindicatorapi.h --- a/inc/musindicatorapi.h Tue May 25 12:38:39 2010 +0300 +++ b/inc/musindicatorapi.h Wed Jun 09 09:37:52 2010 +0300 @@ -142,8 +142,6 @@ void PlayToneL(); void StartLiveSharingL(); - void ToggleIndicatorL(); - TBool IsSubscriber() const; private: // data diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/Conf/multimediasharing.confml Binary file mmsharing/Conf/multimediasharing.confml has changed diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/inc/musmanageripccommon.h --- a/mmsharing/inc/musmanageripccommon.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/inc/musmanageripccommon.h Wed Jun 09 09:37:52 2010 +0300 @@ -27,6 +27,7 @@ _LIT( KMusManagerServerName,"musmanagerserver" ); _LIT( KMusManagerServerFilename, "musmanagerserver" ); _LIT( KMusManagerServerSemaphoreName, "musmanagerserverSemaphore" ); +_LIT( KMusManagerServerClosingSemaphoreName, "musmanagerserverClosingSemaphore" ); const TUid KServerUid3 = { KMusManagerServerUid }; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshavailability/inc/musavacapabilitytimer.h --- a/mmsharing/mmshavailability/inc/musavacapabilitytimer.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshavailability/inc/musavacapabilitytimer.h Wed Jun 09 09:37:52 2010 +0300 @@ -45,6 +45,10 @@ protected: // From CTimer void RunL(); + +protected: // from CActive + + TInt RunError( TInt aError ); private: diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshavailability/src/musavacapabilitytimer.cpp --- a/mmsharing/mmshavailability/src/musavacapabilitytimer.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshavailability/src/musavacapabilitytimer.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -56,6 +56,18 @@ { iNotify->OnExpiredL( iStatus.Int() ); } + +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusAvaCapabilityTimer::RunError( TInt aError ) + { + // Nothing can be done here. + aError = KErrNone; + + return aError; + } // --------------------------------------------------------------------------- diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/group/musengine.mmp --- a/mmsharing/mmshengine/group/musengine.mmp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/group/musengine.mmp Wed Jun 09 09:37:52 2010 +0300 @@ -46,6 +46,7 @@ SOURCE musengclipsession.cpp SOURCE musenguriparser.cpp SOURCE musengmceutils.cpp +SOURCE musengorientationhandler.cpp // SIP API SOURCE mussipprofilehandler.cpp diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musengclipsession.h --- a/mmsharing/mmshengine/inc/musengclipsession.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/inc/musengclipsession.h Wed Jun 09 09:37:52 2010 +0300 @@ -250,6 +250,7 @@ TFileName iTranscodingDestFileName; TBool iRewindedToBeginning; TBool iTranscodingRequiredDueMissingOptions; + TBool iPause; }; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musenglivesession.h --- a/mmsharing/mmshengine/inc/musenglivesession.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/inc/musenglivesession.h Wed Jun 09 09:37:52 2010 +0300 @@ -28,11 +28,13 @@ // FORWARD DECLARATIONS class MMusEngLiveSessionObserver; +class CMusEngOrientationHandler; class CMusEngLiveSession : public CMusEngMceOutSession { MUS_UNITTEST( UT_CMusEngOutSession ) MUS_UNITTEST( UT_CMusEngLiveSession ) + MUS_UNITTEST( UT_CMusEngOrientationHandler ) public: @@ -239,6 +241,10 @@ * Tells whether session is paused or not */ IMPORT_C TBool IsPlayingL(); + + void EnableDisplayL( TBool aEnable ); + + void RefreshOrientationL(); protected: // inherited from CMusEngMceOutSession @@ -409,6 +415,8 @@ */ TInt iBigZoomStep; + CMusEngOrientationHandler* iOrientationHandler; + }; #endif diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musenglivesessionobserver.h --- a/mmsharing/mmshengine/inc/musenglivesessionobserver.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/inc/musenglivesessionobserver.h Wed Jun 09 09:37:52 2010 +0300 @@ -36,7 +36,12 @@ * Indicates that disk has run out of space during recording. */ virtual void DiskFull() = 0; + + /** + * Orientation refresh ended. + */ + virtual void OrientationRefreshEnded() = 0; }; -#endif \ No newline at end of file +#endif diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musengmcesession.h --- a/mmsharing/mmshengine/inc/musengmcesession.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/inc/musengmcesession.h Wed Jun 09 09:37:52 2010 +0300 @@ -218,6 +218,8 @@ */ IMPORT_C void UnmuteL(); + void RefreshOrientationL(); + protected: // CONSTRUCTORS diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musengorientationhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmsharing/mmshengine/inc/musengorientationhandler.h Wed Jun 09 09:37:52 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef MUSENGORIENTATIONHANDLER_H +#define MUSENGORIENTATIONHANDLER_H + + +// INTERNAL INCLUDE +#include "musunittesting.h" + +// SYSTEM INCLUDE +#include + +class CMusEngLiveSession; +class MMusEngLiveSessionObserver; + +/** +* +* @lib musengine.lib +*/ +NONSHARABLE_CLASS(CMusEngOrientationHandler) : public CTimer + + { + MUS_UNITTEST( UT_CMusEngOrientationHandler ) + + public: + + /** + * Creates new instance of CMusEngOrientationHandler + */ + static CMusEngOrientationHandler* NewL( CMusEngLiveSession& aSession, + MMusEngLiveSessionObserver& aSessionObserver ); + + /** + * Destructor + * + */ + ~CMusEngOrientationHandler(); + + + public: // API + + void RefreshOrientationL(); + void UpdateL(); + + protected: + + void RunL(); + TInt RunError( TInt aError ); + + private: + + CMusEngOrientationHandler( CMusEngLiveSession& aSession, + MMusEngLiveSessionObserver& aSessionObserver ); + void ConstructL(); + + void DoDelayedResumeL(); + + private: // DATA + + CMusEngLiveSession& iSession; + MMusEngLiveSessionObserver& iSessionObserver; + TBool iRefreshBeginStateCamera; + TBool iRefreshBeginStateDisplay; + + }; + +#endif // MUSENGORIENTATIONHANDLER_H diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musengsession.h --- a/mmsharing/mmshengine/inc/musengsession.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/inc/musengsession.h Wed Jun 09 09:37:52 2010 +0300 @@ -161,6 +161,11 @@ * and if needed also sent to network. */ virtual void UnmuteL() = 0; + + /** + * + */ + virtual void RefreshOrientationL() = 0; protected: // INTERNAL @@ -209,4 +214,4 @@ }; -#endif //MUSENGSESSION_H \ No newline at end of file +#endif //MUSENGSESSION_H diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musengsessiondurationtimer.h --- a/mmsharing/mmshengine/inc/musengsessiondurationtimer.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/inc/musengsessiondurationtimer.h Wed Jun 09 09:37:52 2010 +0300 @@ -87,6 +87,12 @@ * @since S60 v3.2 */ void DoCancel(); + + /** + * + * @since S60 v3.2 + */ + TInt RunError( TInt aError ); private: // DATA diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/inc/musengtelephoneutils.h --- a/mmsharing/mmshengine/inc/musengtelephoneutils.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/inc/musengtelephoneutils.h Wed Jun 09 09:37:52 2010 +0300 @@ -124,6 +124,7 @@ * */ void RunL(); + TInt RunError( TInt aError ); /** * Cancels outstanding request to phone client diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/src/musengclipsession.cpp --- a/mmsharing/mmshengine/src/musengclipsession.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/src/musengclipsession.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -362,7 +362,7 @@ iFRWDStartTime.Int64() == 0, User::Leave( KErrNotReady ) ); - + iPause = EFalse; CMceFileSource* file = MusEngMceUtils::GetFileSourceL( *iSession ); if ( !file->IsEnabled() ) @@ -395,6 +395,7 @@ User::Leave( KErrNotReady ) ); + iPause = ETrue; CMceFileSource* file = MusEngMceUtils::GetFileSourceL( *iSession ); if ( file->IsEnabled() ) @@ -1107,7 +1108,8 @@ TRAP( error, isRewindFromEnd = ( position.Int64() != 0 && !filesource->IsEnabled() && - videoOut->State() == CMceMediaStream::EDisabled ) ) + videoOut->State() == CMceMediaStream::EDisabled && + !iPause ) ) if( isRewindFromEnd ) { MUS_LOG( "mus: [ENGINE] Rewind from end of clip" ) diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/src/musenglivesession.cpp --- a/mmsharing/mmshengine/src/musenglivesession.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/src/musenglivesession.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -24,6 +24,7 @@ #include "musengmceutils.h" #include "musenglogger.h" #include "mussettings.h" +#include "musengorientationhandler.h" // SYSTEM #include @@ -113,6 +114,9 @@ CMusEngLiveSession::~CMusEngLiveSession() { MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::~CMusEngLiveSession()" ) + + delete iOrientationHandler; + MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::~CMusEngLiveSession()" ) } @@ -569,6 +573,8 @@ { MUS_LOG( "mus: [ENGINE] Camera already enabled, ignore request" ) } + + iOrientationHandler->UpdateL(); MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::PlayL()" ) } @@ -595,6 +601,8 @@ MUS_LOG( "mus: [ENGINE] Camera already disabled, ignore request" ) } + iOrientationHandler->UpdateL(); + MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::PauseL()" ) } @@ -609,7 +617,29 @@ return ( MusEngMceUtils::GetCameraL( *iSession )->IsEnabled() ); } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngLiveSession::EnableDisplayL( TBool aEnable ) +{ + CMusEngMceSession::EnableDisplayL( aEnable ); + iOrientationHandler->UpdateL(); +} +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngLiveSession::RefreshOrientationL() + { + MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::RefreshOrientationL()" ) + + iOrientationHandler->RefreshOrientationL(); + + MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::RefreshOrientationL()" ) + } // ----------------------------------------------------------------------------- // @@ -888,6 +918,8 @@ CMusEngMceOutSession::ConstructL( aSipProfileId ); + iOrientationHandler = CMusEngOrientationHandler::NewL( *this, iLiveSessionObserver ); + MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ConstructL()" ) } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/src/musengmcesession.cpp --- a/mmsharing/mmshengine/src/musengmcesession.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/src/musengmcesession.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -372,6 +372,14 @@ MUS_LOG( "mus: [ENGINE] <- CMusEngMceSession::Unmute()" ) } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngMceSession::RefreshOrientationL() +{ + MUS_LOG( "mus: [ENGINE] <-> CMusEngMceSession::RefreshOrientationL()" ) +} // ----------------------------------------------------------------------------- // diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/src/musengorientationhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmsharing/mmshengine/src/musengorientationhandler.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// USER +#include "musengorientationhandler.h" +#include "muslogger.h" +#include "musenglivesession.h" +#include "musenglivesessionobserver.h" + +// SYSTEM + +const TInt KMusEngDelayedResume = 300000; // 300 ms + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CMusEngOrientationHandler* CMusEngOrientationHandler::NewL( + CMusEngLiveSession& aSession, MMusEngLiveSessionObserver& aSessionObserver ) + { + CMusEngOrientationHandler* self = + new (ELeave) CMusEngOrientationHandler( aSession, aSessionObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self); + return self; + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CMusEngOrientationHandler::~CMusEngOrientationHandler() + { + MUS_LOG( "mus: [ENGINE] CMusEngOrientationHandler::~CMusEngOrientationHandler()" ) + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngOrientationHandler::RefreshOrientationL() + { + MUS_LOG( "mus: [ENGINE] -> CMusEngOrientationHandler::RefreshOrientationL()" ) + if ( !IsActive() ) + { + TBool refreshBeginStateCamera = iSession.IsPlayingL(); + TBool refreshBeginStateDisplay = iSession.IsDisplayEnabledL(); + + if ( refreshBeginStateCamera ) + { + MUS_LOG( "mus: [MUSENG] -> Playing, pause/stop to restart camera" ); + iSession.PauseL(); + } + + if ( refreshBeginStateDisplay ) + { + MUS_LOG( "mus: [MUSENG] -> display is enabled, disable/enable it"); + iSession.EnableDisplayL(EFalse); + } + iRefreshBeginStateCamera = refreshBeginStateCamera; + iRefreshBeginStateDisplay = refreshBeginStateDisplay; + } + + DoDelayedResumeL(); + + MUS_LOG( "mus: [ENGINE] <- CMusEngOrientationHandler::RefreshOrientationL()" ) + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngOrientationHandler::UpdateL() + { + MUS_LOG( "mus: [ENGINE] -> CMusEngOrientationHandler::UpdateL()" ) + iRefreshBeginStateCamera = iSession.IsPlayingL(); + iRefreshBeginStateDisplay = iSession.IsDisplayEnabledL(); + MUS_LOG2( "mus: [ENGINE] <- CMusEngOrientationHandler::UpdateL(), cam:%d disp:%d", + iRefreshBeginStateCamera, iRefreshBeginStateDisplay ) + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngOrientationHandler::RunL() + { + MUS_LOG( "mus: [ENGINE] -> CMusEngOrientationHandler::RunL()" ) + + TBool refreshBeginStateCamera = iRefreshBeginStateCamera; + TBool refreshBeginStateDisplay = iRefreshBeginStateDisplay; + + iSessionObserver.OrientationRefreshEnded(); + + if ( refreshBeginStateDisplay ) + { + MUS_LOG( "mus: [ENGINE] enable display after delayed orientation" ) + iSession.EnableDisplayL(ETrue); + } + + if ( refreshBeginStateCamera ) + { + MUS_LOG( "mus: [ENGINE] enable camera after delayed orientation" ) + iSession.PlayL(); + } + MUS_LOG( "mus: [ENGINE] <- CMusEngOrientationHandler::RunL()" ) + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TInt CMusEngOrientationHandler::RunError( TInt aError ) + { + MUS_LOG( "mus: [ENGINE] <-> CMusEngOrientationHandler::RunError()" ) + aError = KErrNone; + return aError; + } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngOrientationHandler::DoDelayedResumeL() + { + if ( IsActive() ) + { + Cancel(); + } + After( KMusEngDelayedResume ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +CMusEngOrientationHandler::CMusEngOrientationHandler( + CMusEngLiveSession& aSession, MMusEngLiveSessionObserver& aSessionObserver ) + : CTimer( CActive::EPriorityStandard ), iSession( aSession ), + iSessionObserver( aSessionObserver ) + { + CActiveScheduler::Add(this); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngOrientationHandler::ConstructL() + { + MUS_LOG( "mus: [ENGINE] -> CMusEngOrientationHandler::ConstructL()" ) + + CTimer::ConstructL(); + + MUS_LOG( "mus: [ENGINE] <- CMusEngOrientationHandler::ConstructL()" ) + } + diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/src/musengsessiondurationtimer.cpp --- a/mmsharing/mmshengine/src/musengsessiondurationtimer.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/src/musengsessiondurationtimer.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -99,6 +99,17 @@ } } +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusEngSessionDurationTimer::RunError( TInt aError ) + { + // Nothing can be done here. + aError = KErrNone; + + return aError; + } // ----------------------------------------------------------------------------- // diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/src/musengtelephoneutils.cpp --- a/mmsharing/mmshengine/src/musengtelephoneutils.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/src/musengtelephoneutils.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -100,8 +100,6 @@ TBool retValue = ( iTelephonyAudioRouting->Output() != CTelephonyAudioRouting::EWiredAudioAccessory && iTelephonyAudioRouting->Output() != - CTelephonyAudioRouting::EBTAudioAccessory && - iTelephonyAudioRouting->Output() != CTelephonyAudioRouting::ETTY ); MUS_LOG1( "mus: [ENGINE] <- CMusEngTelephoneUtils::AudioRoutingCanBeChanged: %d", @@ -123,7 +121,9 @@ if ( aEnable ) { if ( iTelephonyAudioRouting->Output() == - CTelephonyAudioRouting::EHandset ) + CTelephonyAudioRouting::EHandset || + iTelephonyAudioRouting->Output() == + CTelephonyAudioRouting::EBTAudioAccessory ) { // Disable note shown by audiorouting api as it causes // application going to background for a while. Instead, display @@ -304,6 +304,22 @@ MUS_LOG( "mus: [ENGINE] <- CMusEngTelephoneUtils::RunL()" ) } +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusEngTelephoneUtils::RunError( TInt aError ) + { + MUS_LOG1( "mus: [ENGINE] -> CMusEngTelephoneUtils::\ + RunError() return #%d", aError ) + + // Nothing can be done here. + aError = KErrNone; + + MUS_LOG( "mus: [ENGINE] <- CMusEngTelephoneUtils::RunError()" ) + return aError; + } + // ----------------------------------------------------------------------------- // diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/group/ut_musengine.mmp --- a/mmsharing/mmshengine/tsrc/ut_engine/group/ut_musengine.mmp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/group/ut_musengine.mmp Wed Jun 09 09:37:52 2010 +0300 @@ -74,6 +74,7 @@ SOURCE ut_musengtelephoneutils.cpp SOURCE ut_musengsessiondurationtimer.cpp SOURCE ut_musenguriparser.cpp +SOURCE ut_musengorientationhandler.cpp // Tested classes SOURCEPATH ../../../src @@ -88,6 +89,7 @@ SOURCE musengsessiondurationtimer.cpp SOURCE musengmceutils.cpp SOURCE musenguriparser.cpp +SOURCE musengorientationhandler.cpp // Includes diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/inc/musengstubs.h --- a/mmsharing/mmshengine/tsrc/ut_engine/inc/musengstubs.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/inc/musengstubs.h Wed Jun 09 09:37:52 2010 +0300 @@ -115,6 +115,7 @@ // From MMusEngLiveSessionObserver void DiskFull(); + void OrientationRefreshEnded(); // From MMusEngClipSessionObserver @@ -212,6 +213,7 @@ TInt iVolume; TBool iDueUnknowCapas; + TBool iOrientationRefreshEndedCalled; }; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/inc/ut_musengorientationhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmsharing/mmshengine/tsrc/ut_engine/inc/ut_musengorientationhandler.h Wed Jun 09 09:37:52 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __UT_MUSENGORIENTATIONHANDLER_H__ +#define __UT_MUSENGORIENTATIONHANDLER_H__ + + +// EXTERNAL INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CMusEngLiveSession; +class CMusEngObserverStub; +class CMusEngOrientationHandler; + + +// CLASS DEFINITION +/** + * Tester class for CMusEngLiveSession. + * Tests only implementations that are not tested in ancestor classes. + * + */ +NONSHARABLE_CLASS( UT_CMusEngOrientationHandler ): public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static UT_CMusEngOrientationHandler* NewL(); + static UT_CMusEngOrientationHandler* NewLC(); + + /** + * Destructor + */ + ~UT_CMusEngOrientationHandler(); + + private: // Constructors and destructors + + UT_CMusEngOrientationHandler(); + void ConstructL(); + + private: // Test case setup and teardown + + void SetupL(); + + void Teardown(); + + private: // Test methdods + + void UT_NewLL(); + void UT_RefreshOrientationL(); + + private: // Data + + CMusEngLiveSession* iLiveSession; + CMusEngObserverStub* iObserver; + CMusEngOrientationHandler* iHandler; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __UT_MUSENGORIENTATIONHANDLER_H__ + +// End of file diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/musengstubs.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/musengstubs.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/musengstubs.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -270,7 +270,14 @@ iDiskFullCalled = ETrue; } - +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusEngObserverStub::OrientationRefreshEnded() + { + iOrientationRefreshEndedCalled = ETrue; + } // ---- FUNCTIONS OF MMusEngClipSessionObserver ---------------------------------- @@ -504,6 +511,7 @@ iAudioRouteChangeAllowed = ETrue; iVolume = 0; iDueUnknowCapas = EFalse; + iOrientationRefreshEndedCalled = EFalse; } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengclipsession.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengclipsession.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengclipsession.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -910,7 +910,7 @@ changedStream->iState = CMceMediaStream::EIdle; static_cast(iClipSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ) + EUNIT_ASSERT( iObserver->iStreamIdleCalled ) // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; @@ -1064,7 +1064,7 @@ changedStream->iState = CMceMediaStream::EIdle; static_cast(iClipSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ) + EUNIT_ASSERT( iObserver->iStreamIdleCalled ) // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; @@ -1134,7 +1134,7 @@ static_cast(iClipSession)->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ) + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; @@ -1588,6 +1588,12 @@ // Disapling stream videoOut->iState = CMceMediaStream::EDisabled; EUNIT_ASSERT( iClipSession->IsRewindFromEnd() ) + + iClipSession->iPause = ETrue; + EUNIT_ASSERT( !iClipSession->IsRewindFromEnd() ) + + iClipSession->iPause = EFalse; + EUNIT_ASSERT( iClipSession->IsRewindFromEnd() ) // and finaly try with "real" end of clip (static_cast (videoOut->Source()))->iPosition = 0; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenginedllmain.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenginedllmain.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenginedllmain.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -27,6 +27,7 @@ #include "ut_musengtelephoneutils.h" #include "ut_musenguriparser.h" #include "ut_musengsipprofilehandler.h" +#include "ut_musengorientationhandler.h" // SYSTEM INCLUDES @@ -74,6 +75,9 @@ rootSuite->AddL( UT_TMusEngUriParser::NewLC() ); CleanupStack::Pop(); + + rootSuite->AddL( UT_CMusEngOrientationHandler::NewLC() ); + CleanupStack::Pop(); CleanupStack::Pop( rootSuite ); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenglivesession.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenglivesession.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenglivesession.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -1036,7 +1036,7 @@ changedStream->iState = CMceMediaStream::EIdle; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; @@ -1115,7 +1115,7 @@ changedStream->iState = CMceMediaStream::EIdle; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; @@ -1239,7 +1239,7 @@ // EIdle, stream is not receiving RTP changedStream->iState = CMceMediaStream::EIdle; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengmcesession.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengmcesession.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengmcesession.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -1164,7 +1164,7 @@ // EIdle, stream is not receiving RTP changedStream->iState = CMceMediaStream::EIdle; iLiveSession->CMusEngMceSession::StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; @@ -1241,7 +1241,7 @@ // EIdle, stream is not receiving RTP changedStream->iState = CMceMediaStream::EIdle; iLiveSession->CMusEngMceSession::StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; @@ -1308,7 +1308,7 @@ // EIdle, stream is not receiving RTP changedStream->iState = CMceMediaStream::EIdle; iLiveSession->CMusEngMceSession::StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengorientationhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengorientationhandler.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INTERNAL INCLUDES +#include "ut_musengorientationhandler.h" +#include "musengorientationhandler.h" +#include "musengstubs.h" +#include "musengtestdefs.h" +#include "musenglivesession.h" +#include "musengmceutils.h" +#include +#include + +// SYSTEM INCLUDES +#include + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +UT_CMusEngOrientationHandler* UT_CMusEngOrientationHandler::NewL() + { + UT_CMusEngOrientationHandler* self = UT_CMusEngOrientationHandler::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +UT_CMusEngOrientationHandler* UT_CMusEngOrientationHandler::NewLC() + { + UT_CMusEngOrientationHandler* self = new( ELeave ) UT_CMusEngOrientationHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +UT_CMusEngOrientationHandler::~UT_CMusEngOrientationHandler() + { + // NOP + } + + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +UT_CMusEngOrientationHandler::UT_CMusEngOrientationHandler() + { + // NOP + } + + +// ----------------------------------------------------------------------------- +// Second phase construct +// ----------------------------------------------------------------------------- +// +void UT_CMusEngOrientationHandler::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void UT_CMusEngOrientationHandler::SetupL() + { + iObserver = new( ELeave ) CMusEngObserverStub; + + iLiveSession = CMusEngLiveSession::NewL( TRect(0, 0, 100, 100), + *iObserver, + *iObserver, + *iObserver ); + + iLiveSession->iOperatorVariant = EFalse; + + iHandler = CMusEngOrientationHandler::NewL( *iLiveSession, *iObserver ); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void UT_CMusEngOrientationHandler::Teardown() + { + delete iHandler; + delete iLiveSession; + delete iObserver; + } + + + +// TEST CASES + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void UT_CMusEngOrientationHandler::UT_NewLL() + { + EUNIT_ASSERT( iHandler ); + } + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void UT_CMusEngOrientationHandler::UT_RefreshOrientationL() + { + ESTABLISH_OUT_SESSION( iLiveSession ) + + // Refresh when both camera and display are enabled + CMceCameraSource* camera = + MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); + camera->iIsEnabled = ETrue; + CMceDisplaySink* display = + MusEngMceUtils::GetDisplayL( *(iLiveSession->iSession) ); + display->iIsEnabled = ETrue; + EUNIT_ASSERT( !iHandler->IsActive() ); + iHandler->RefreshOrientationL(); + EUNIT_ASSERT( iHandler->IsActive() ); + EUNIT_ASSERT( !camera->iIsEnabled ); + EUNIT_ASSERT( !display->iIsEnabled ); + iHandler->Cancel(); + iHandler->RunL(); // Simulate completion + EUNIT_ASSERT( !iHandler->IsActive() ); + EUNIT_ASSERT( camera->iIsEnabled ); + EUNIT_ASSERT( display->iIsEnabled ); + + // Refresh when camera is disabled, display disabled + camera->iIsEnabled = EFalse; + display->iIsEnabled = ETrue; + iHandler->RefreshOrientationL(); + EUNIT_ASSERT( iHandler->IsActive() ); + EUNIT_ASSERT( !camera->iIsEnabled ); + EUNIT_ASSERT( !display->iIsEnabled ); + iHandler->Cancel(); + iHandler->RunL(); // Simulate completion + EUNIT_ASSERT( !iHandler->IsActive() ); + EUNIT_ASSERT( !camera->iIsEnabled ); + EUNIT_ASSERT( display->iIsEnabled ); + + // Display and camera gets resumed while delayed orientation handling is ongoing, pausing + // display after handling completes should not happen + camera->iIsEnabled = ETrue; + display->iIsEnabled = EFalse; + iHandler->RefreshOrientationL(); + EUNIT_ASSERT( iHandler->IsActive() ); + EUNIT_ASSERT( !camera->iIsEnabled ); + EUNIT_ASSERT( !display->iIsEnabled ); + display->iIsEnabled = ETrue; + camera->iIsEnabled = ETrue; + iHandler->UpdateL(); + iHandler->Cancel(); + iHandler->RunL(); // Simulate completion + EUNIT_ASSERT( !iHandler->IsActive() ); + EUNIT_ASSERT( camera->iIsEnabled ); + EUNIT_ASSERT( display->iIsEnabled ); + } + + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + UT_CMusEngOrientationHandler, + "UT_CMusEngLiveSesssion", + "UNIT" ) + +EUNIT_TEST( + "NewL - test ", + "CMusEngOrienationHandler", + "NewL", + "FUNCTIONALITY", + SetupL, UT_NewLL, Teardown) + +EUNIT_TEST( + "UT_RefreshOrientationL - test ", + "CMusEngOrienationHandler", + "NewL", + "FUNCTIONALITY", + SetupL, UT_RefreshOrientationL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE + + diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengreceivesession.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengreceivesession.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengreceivesession.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -803,7 +803,7 @@ // Try default behaviors videoStream->iState = CMceMediaStream::EIdle; iReceiveSession->StreamStateChanged( *videoStream ); - EUNIT_ASSERT( iObserver->IsReseted() ) + EUNIT_ASSERT( iObserver->iStreamIdleCalled ); } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengtelephoneutils.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengtelephoneutils.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengtelephoneutils.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -155,7 +155,7 @@ iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = CTelephonyAudioRouting::EBTAudioAccessory; - EUNIT_ASSERT( !iTelephoneUtils->AudioRoutingCanBeChanged() ); + EUNIT_ASSERT( iTelephoneUtils->AudioRoutingCanBeChanged() ); iTelephoneUtils->iTelephonyAudioRouting->iCurrentOutput = CTelephonyAudioRouting::ETTY; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/eabi/musindicatoru.def --- a/mmsharing/mmshindicator/eabi/musindicatoru.def Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshindicator/eabi/musindicatoru.def Wed Jun 09 09:37:52 2010 +0300 @@ -5,8 +5,6 @@ _ZN16CMusIndicatorApi5NewLCER21MMusIndicatorObserver @ 4 NONAME _ZTI15CMusSoundPlayer @ 5 NONAME _ZTI16CMusIndicatorApi @ 6 NONAME - _ZTI16CMusIndicatorDsa @ 7 NONAME - _ZTV15CMusSoundPlayer @ 8 NONAME - _ZTV16CMusIndicatorApi @ 9 NONAME - _ZTV16CMusIndicatorDsa @ 10 NONAME + _ZTV15CMusSoundPlayer @ 7 NONAME + _ZTV16CMusIndicatorApi @ 8 NONAME diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/group/musindicator.mmp --- a/mmsharing/mmshindicator/group/musindicator.mmp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshindicator/group/musindicator.mmp Wed Jun 09 09:37:52 2010 +0300 @@ -38,7 +38,6 @@ SOURCEPATH ../src SOURCE musindicatorapi.cpp SOURCE mussoundplayer.cpp -SOURCE musindicatordsa.cpp SOURCE musresourceutil.cpp USERINCLUDE ../inc diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/inc/musindicatordsa.h --- a/mmsharing/mmshindicator/inc/musindicatordsa.h Tue May 25 12:38:39 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,186 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Draws availability indication to screen using direct screen -* access. -* -*/ - - - -#ifndef C_MUSINDICATORDSA_H -#define C_MUSINDICATORDSA_H - - -#include "musunittesting.h" -#include -#include -#include - -const TInt KMusIndicatorDelay = 400000; -const TInt KMusRedrawDelay = 25000; - -/** - * CMusIndicatorDsa provides multimedia sharing ready indicator "box" - * indcating videosharing availability to user. - * - * @code - * // Activates indication - * CMusIndicatorDsa* dsa = CMusIndicatorDsa::NewL(); - * - * // Deactivates indication - * delete dsa; - * - * @endcode - * - * @lib musindicator.lib - */ -class CMusIndicatorDsa : public CCoeControl - { -public: - - MUS_UNITTEST( UT_CMusIndicatorDsa ) - - static CMusIndicatorDsa* NewL(); - - /** - * Destructor. - */ - ~CMusIndicatorDsa(); - - -public: //from CCoeControl - - - /** - * Draws video sharing ready box and text - */ - void Draw( const TRect& aRect ) const; - - /** - * Hanldes resource change i.e layout change - * - */ - void HandleResourceChange( TInt aType); - -private: - - /** - * Initializes - */ - void Initialize(); - - /** - * Loads image. - */ - void LoadImageL(); - - /** - * Loads resource string. - */ - void LoadResourceStringL(); - - -private: - - CMusIndicatorDsa(); - - void ConstructL(); - - const CFont& Font() const; - - void TryActivateL(); - - - /** - * Callback function to periodic timer. - * - * @param instanse of this. - * @return TInt value indicating if function completed succesfully - */ - static TInt TryActivate( TAny* aThis ); - - /** - * Callback function to periodic timer. - * - * @param instanse of this. - * @return TInt value indicating if function completed succesfully - */ - static TInt DoHandleResourceChange( TAny* aThis ); - - void StartPeriodicTimer( const TCallBack& aCallBack) const; - - /** - * Stops peridoic timer. - */ - void StopPeriodicTimer(); - - -private: // data - - - /** - * Periodic timer. - * Own. - */ - CPeriodic* iPeriodic; - - /** - * Used screen rectangle. - */ - TRect iScreenRect; - - /** - * Used client area size - */ - TSize iScreenSize; - - /** - * Calculated position of left-top point of text. - */ - TPoint iTextpos; - - /** - * Color of DSA boxes border. - */ - TRgb iBorderColor; - - /** - * DSA boxes background color. - */ - TRgb iBorderBgColor; - - /** - * Color of used font. - */ - TRgb iFontColor; - - /** - * Displayed text. - * Own. - */ - HBufC* iText; - - CFbsBitmap* iIcon; - CFbsBitmap* iIconMask; - - TSize iImageSize; - TPoint iImagepos; - - TCallBack iActivateCallBack; - TCallBack iRedrawCallBack; - - - }; - -#endif // C_MUSINDICATORDSA_H diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/src/musindicatorapi.cpp --- a/mmsharing/mmshindicator/src/musindicatorapi.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshindicator/src/musindicatorapi.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -21,7 +21,6 @@ #include "musindicatorapi.h" #include "musresourcefinderutil.h" #include "muslogger.h" -#include "musindicatordsa.h" #include "mussettings.h" #include "mussettingskeys.h" #include "mussoundplayer.h" @@ -82,10 +81,9 @@ Cancel(); delete iIndicatorWindow; delete iSoundPlayer; - if ( !IsSubscriber() ) - { - Indicator( EFalse ); - } + + Indicator( EFalse ); + iProperty.Close(); @@ -94,16 +92,6 @@ // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TBool CMusIndicatorApi::IsSubscriber() const - { - return !iObserver; - } - - -// ----------------------------------------------------------------------------- // Indicates VS availability to user. // In operator specific variant this can include DSA note and an audio tone // played with CMdaAudioPlayerUtility. @@ -112,8 +100,6 @@ EXPORT_C void CMusIndicatorApi::IndicateAvailabilityL() { MUS_LOG( "mus: [MUSIND] -> CMusIndicatorApi::IndicateAvailabilityL" ) - __ASSERT_ALWAYS( !IsSubscriber(), User::Leave( KErrArgument ) ); - Indicator( ETrue ); if( MultimediaSharingSettings::AuditoryNotificationSettingL() == @@ -136,16 +122,10 @@ { MUS_LOG( "mus: [MUSIND] <- CMusIndicatorApi::RunL" ) - if ( !IsSubscriber() ) - { - MUS_LOG( "mus: [MUSIND ] : publisher" ) - StartLiveSharingL(); - } - else - { - MUS_LOG( "mus: [MUSIND ] : subscriber" ) - ToggleIndicatorL(); - } + + MUS_LOG( "mus: [MUSIND ] : publisher" ) + StartLiveSharingL(); + MUS_LOG( "mus: [MUSIND] -> CMusIndicatorApi::RunL" ) } @@ -172,45 +152,6 @@ // ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CMusIndicatorApi::ToggleIndicatorL() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorApi::ToggleIndicatorL" ) - TInt val; - - - - User::LeaveIfError( RProperty::Get( KPSUidCoreApplicationUIs, - KCoreAppUIsVideoSharingIndicator, - val ) ); - iProperty.Subscribe( iStatus ); - SetActive(); - - TBool on = ( val == ECoreAppUIsVideoSharingIndicatorOn ); - - if ( on && !iIndicatorWindow - && MultimediaSharingSettings::OperatorVariantSettingL() == - MusSettingsKeys::EOperatorSpecific ) - { - iIndicatorWindow = CMusIndicatorDsa::NewL(); - } - else if ( !on ) - { - delete iIndicatorWindow; - iIndicatorWindow = NULL; - } - else - { - //NOP - } - - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorApi::ToggleIndicatorL" ) - } - - -// ----------------------------------------------------------------------------- // From CActive. // Cancels an outstanding asynchronous request. // ----------------------------------------------------------------------------- @@ -219,10 +160,7 @@ { MUS_LOG( "mus: [MUSIND] <- CMusIndicatorApi::DoCancel" ) - if ( IsSubscriber() ) - { - iProperty.Cancel(); - } + MUS_LOG( "mus: [MUSIND] -> CMusIndicatorApi::DoCancel" ) } @@ -282,21 +220,10 @@ { MUS_LOG( "mus: [MUSIND ] -> MusIndicatorApi::ConstructL" ) - if ( IsSubscriber() ) - { - MUS_LOG( "mus: [MUSIND ] : subscriber (called by aiwprovider)" ) + + MUS_LOG( "mus: [MUSIND ] : publisher (called by manager)" ) + CActiveScheduler::Add( this ); - User::LeaveIfError( iProperty.Attach( KPSUidCoreApplicationUIs, - KCoreAppUIsVideoSharingIndicator ) ); - CActiveScheduler::Add( this ); - iProperty.Subscribe( iStatus ); - SetActive(); - } - else - { - MUS_LOG( "mus: [MUSIND ] : publisher (called by manager)" ) - CActiveScheduler::Add( this ); - } MUS_LOG( "mus: [MUSIND ] <- MusIndicatorApi::ConstructL" ) } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/src/musindicatordsa.cpp --- a/mmsharing/mmshindicator/src/musindicatordsa.cpp Tue May 25 12:38:39 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,491 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MusIndicatorApi provides means to show notes and indicate -* availability of videosharing to user. -* -*/ - - -#include "musindicatordsa.h" -#include "muslogger.h" -#include "musresourceutil.h" -#include "musresourcefinderutil.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// constants -// Size and positions - -const TInt KMusIndicatorWindowHeight = 50; -const TInt KMusIndicatorWindowShrink = 2; -const TInt KMusSpaceBetweenImageAndText = 5; - -// appereance -const TInt KMusIndicatorBorderRoundedCorners = 6; -const TInt KMusIndicatorBorderSize = 1; -//const TInt KMusIndicatorFontPenSize = 1; - - - - -CMusIndicatorDsa* CMusIndicatorDsa::NewL() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::NewL" ) - CMusIndicatorDsa* self = new (ELeave) CMusIndicatorDsa(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::NewL" ) - return self; - } - - -CMusIndicatorDsa::CMusIndicatorDsa() - : iActivateCallBack( CMusIndicatorDsa::TryActivate, this ), - iRedrawCallBack( CMusIndicatorDsa::DoHandleResourceChange, this ) - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::CMusIndicatorDsa" ) - - iBorderColor = KRgbBlack; - iBorderBgColor = KRgbWhite; - iFontColor = KRgbBlack; - - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::CMusIndicatorDsa" ) - } - - -CMusIndicatorDsa::~CMusIndicatorDsa() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::~CMusIndicatorDsa" ) - - StopPeriodicTimer(); - delete iPeriodic; - - delete iIcon; - delete iIconMask; - - delete iText; - - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::~CMusIndicatorDsa" ) - } - - -const CFont& CMusIndicatorDsa::Font() const - { - TCoeFont coeFont = TCoeFont::NormalFont(); - TZoomFactor zoomFactor = AccumulatedZoom(); - return FindFontProvider().Font(coeFont, zoomFactor); - } - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ -// -void CMusIndicatorDsa::ConstructL() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::ConstructL" ) - - iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); - - LoadResourceStringL(); - LoadImageL(); - CreateWindowL(); - - Initialize(); - TryActivateL(); - - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::ConstructL" ) - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CMusIndicatorDsa::TryActivateL() - { - MAknsControlContext* cc = - AknsDrawUtils::ControlContext( ControlEnv()->AppUi()->TopFocusedControl() ); - - if ( cc ) - { - StopPeriodicTimer(); - ActivateL(); - } - else - { - StartPeriodicTimer( iActivateCallBack ); - } - } - - -// ----------------------------------------------------------------------------- -// Called by framework to redraw the screen area. -// ----------------------------------------------------------------------------- -// -void CMusIndicatorDsa::Draw( const TRect& aRect ) const - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::Draw" ) - MUS_LOG2( "mus: [MUSIND] : x=%d,y=%d", aRect.iTl.iX, aRect.iTl.iY ) - MUS_LOG2( "mus: [MUSIND] : x=%d,y=%d", aRect.iBr.iX, aRect.iBr.iY ) - - CWindowGc& gc = SystemGc(); - - TSize screenSizeNow = ControlEnv()->ScreenDevice()->SizeInPixels(); - - if ( screenSizeNow != iScreenSize ) - { - StartPeriodicTimer( iRedrawCallBack ); - } - - MAknsControlContext* cc = - AknsDrawUtils::ControlContext( ControlEnv()->AppUi()->TopFocusedControl() ); - MUS_LOG1( "mus: [MUSIND] : cc = %d", cc ) - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - MUS_LOG1( "mus: [MUSIND] : skin = %d", skin ) - - TRgb fontColor; - AknsUtils::GetCachedColor( skin, fontColor, - KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); - TRgb borderColor = fontColor; - - TBool backgroundWithBitmap = - ( skin && !cc ) ? - EFalse : - AknsDrawUtils::Background( skin, cc,this,gc,aRect,KAknsDrawParamDefault ); - - if( !backgroundWithBitmap ) - { - MUS_LOG( "mus: [MUSIND] : Clearing rect with null brush") - gc.SetBrushStyle( CGraphicsContext::ENullBrush ); - gc.Clear( aRect ); - } - else - { - MUS_LOG( "mus: [MUSIND] : rect was cleared with bitmap") - } - - gc.UseFont( &Font() ); - - // Border initialization - gc.SetBrushStyle( CGraphicsContext::ENullBrush ); - - // Draw border - MUS_LOG( "mus: [MUSIND] : Draw border") - gc.SetPenStyle( CGraphicsContext::ESolidPen ); - gc.SetPenColor( borderColor ); - gc.SetPenSize( - TSize( KMusIndicatorBorderSize, KMusIndicatorBorderSize ) ); - gc.DrawRoundRect( iScreenRect, - TSize( KMusIndicatorBorderRoundedCorners, - KMusIndicatorBorderRoundedCorners ) ); - - /* - // Draw smaller border with other color - MUS_LOG( "mus: [MUSIND] : Draw smaller border with other color") - gc.SetPenColor( iBorderBgColor ); - TRect smallerRect = iScreenRect; - smallerRect.Shrink( KMusIndicatorBorderSize, KMusIndicatorBorderSize ); - gc.DrawRoundRect( smallerRect, - TSize( KMusIndicatorBorderRoundedCorners, - KMusIndicatorBorderRoundedCorners ) ); - - // Font outline initialization - - MUS_LOG( "mus: [MUSIND] : Draw text outlines") - gc.SetPenColor( iBorderBgColor ); - gc.SetPenSize( TSize( KMusIndicatorFontPenSize, KMusIndicatorFontPenSize ) ); - - // Draw text outlines - TPoint outlineTextPos = iTextpos; - outlineTextPos -= TPoint( 1, 1 ); - gc.DrawText( *iText, outlineTextPos ); - */ - - // Font initialization - gc.SetPenColor( fontColor ); - - // Draw text - MUS_LOG( "mus: [MUSIND] : Draw text") - if ( AknLayoutUtils::LayoutMirrored() ) - { - CGraphicsContext::TDrawTextExtendedParam drawParam; - drawParam.iParRightToLeft = ETrue; - gc.DrawTextExtended(*iText, iTextpos,drawParam); - } - else - { - gc.DrawText( *iText, iTextpos ); - } - - gc.BitBltMasked( iImagepos, - iIcon, - TRect( 0, 0, iImageSize.iWidth, iImageSize.iHeight ), - iIconMask, - EFalse ); - - - - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::Draw" ) - } - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ -// -void CMusIndicatorDsa::HandleResourceChange( TInt aType ) - { - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - Initialize(); - DrawDeferred(); - } - - StopPeriodicTimer(); - - } - - - -//------------------------------------------------------------------------------ -// Calculates topleft position of drawn text. -//------------------------------------------------------------------------------ -// -void CMusIndicatorDsa::Initialize() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::Initialize" ) - - TRect clientRect = CEikonEnv::Static()->EikAppUi()->ClientRect(); - MUS_LOG2( "mus: [MUSIND] clientrect : x=%d,y=%d", clientRect.iTl.iX, clientRect.iTl.iY ) - MUS_LOG2( "mus: [MUSIND] clientrect : x=%d,y=%d", clientRect.iBr.iX, clientRect.iBr.iY ) - - iScreenSize = ControlEnv()->ScreenDevice()->SizeInPixels(); - - //test (indicator goes inside options menu area) - //clientRect.iTl.iY = 150; - - SetPosition( clientRect.iTl ); - SetSize( - TSize( iScreenSize.iWidth, KMusIndicatorWindowHeight ) ); - - iScreenRect = TRect( - TPoint( 0, 0 ), - TSize( iScreenSize.iWidth, KMusIndicatorWindowHeight ) ); - iScreenRect.Shrink( KMusIndicatorWindowShrink, KMusIndicatorWindowShrink ); - - - TInt imagePlusTextWidth = Font().TextWidthInPixels( *iText ) + - iImageSize.iWidth + KMusSpaceBetweenImageAndText; - if ( AknLayoutUtils::LayoutMirrored() ) - { - // Text position - iTextpos.iX = ( iScreenRect.Width() - imagePlusTextWidth ) >> 1; - - iTextpos.iY = ( iScreenRect.Height() >> 1 ) + - ( Font().HeightInPixels() >> 1 ) + - iScreenRect.iTl.iY; - - iImagepos.iX = iTextpos.iX + - Font().TextWidthInPixels( *iText ) + - KMusSpaceBetweenImageAndText; - iImagepos.iY = ( iScreenRect.Height() - iImageSize.iHeight ) >> 1; - } - else - { - iImagepos.iX = ( iScreenRect.Width() - imagePlusTextWidth ) >> 1; - iImagepos.iY = ( iScreenRect.Height() - iImageSize.iHeight ) >> 1; - - // Text position - iTextpos.iX = iImagepos.iX + iImageSize.iWidth + KMusSpaceBetweenImageAndText; - - iTextpos.iY = ( iScreenRect.Height() >> 1 ) + - ( Font().HeightInPixels() >> 1 ) + - iScreenRect.iTl.iY; - } - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::Initialize" ) - } - - - -//------------------------------------------------------------------------------ -// Loads displayed image. -//------------------------------------------------------------------------------ -// -void CMusIndicatorDsa::LoadImageL() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::LoadImageL" ) - - if ( iIcon || iIconMask ) - { - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::LoadImageL" ) - return; - } - - _LIT( KMyBitmapRomFile, "Z:\\resource\\apps\\musindicatoricons.mbm" ); - _LIT( KMyBitmapRamFile, "C:\\resource\\apps\\musindicatoricons.mbm" ); - - TFileName imageFileName; - if ( MusResourceFinderUtil::IsExistL( KMyBitmapRomFile ) ) - { - imageFileName = KMyBitmapRomFile; - } - else if ( MusResourceFinderUtil::IsExistL( KMyBitmapRamFile ) ) - { - imageFileName = KMyBitmapRamFile; - } - else - { - MUS_LOG( "mus: [MUSIND] Icon File Not Found!" ); - User::Leave( KErrNotFound ); - } - - iIcon = new ( ELeave ) CFbsBitmap(); - iIconMask = new ( ELeave ) CFbsBitmap(); - - // Enumerations of mbg file are usable only when vector images - // in mif file are used. Those cannot be loaded without UI components. - const TInt KMusIndicatorIconIndex = 0; - const TInt KMusIndicatorIconMaskIndex = 1; - User::LeaveIfError( - iIcon->Load( imageFileName, KMusIndicatorIconIndex ) ); - User::LeaveIfError( - iIconMask->Load( imageFileName, KMusIndicatorIconMaskIndex ) ); - - iImageSize = iIcon->SizeInPixels(); - - // Crop icon if it is too big - if ( iImageSize.iHeight > KMusIndicatorWindowHeight ) - { - TInt newHeight = KMusIndicatorWindowHeight >> 1; - TInt newWidth = - TReal( iImageSize.iHeight / iImageSize.iWidth ) * newHeight; - iIcon->Resize( TSize( newHeight, newWidth ) ); - iIconMask->Resize( TSize( newHeight, newWidth ) ); - } - - - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::LoadImageL" ) - } - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ -// -void CMusIndicatorDsa::LoadResourceStringL() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::LoadResourceStringL" ) - delete iText; - iText = NULL; - iText = MusResourceUtil::ReadResourceString16L( - R_MUSINDICATOR_NOTE_VSREADY_TXT, - KMusIndicatorResource ); - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::LoadResourceStringL" ) - } - -//------------------------------------------------------------------------------ -// Periodic timer completion -//------------------------------------------------------------------------------ -// -TInt CMusIndicatorDsa::TryActivate( TAny* aThis ) - { - if ( !aThis ) - { - return KErrArgument; - } - - CMusIndicatorDsa* handle = static_cast< CMusIndicatorDsa* > ( aThis ); - - TInt error = KErrNone; - TRAP( error, handle->TryActivateL() ); - - return error; - } - - -//------------------------------------------------------------------------------ -// Periodic timer completion -//------------------------------------------------------------------------------ -// -TInt CMusIndicatorDsa::DoHandleResourceChange( TAny* aThis ) - { - - if ( !aThis ) - { - return KErrArgument; - } - - CMusIndicatorDsa* handle = static_cast< CMusIndicatorDsa* > ( aThis ); - - handle->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); - - return KErrNone; - - } - - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ -// -void CMusIndicatorDsa::StartPeriodicTimer( const TCallBack& aCallBack) const - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::StartPeriodicTimer" ) - - if ( iPeriodic->IsActive() ) - { - return; - } - - TTimeIntervalMicroSeconds32 delay = - aCallBack.iFunction == CMusIndicatorDsa::TryActivate ? - KMusIndicatorDelay : KMusRedrawDelay; - - iPeriodic->Start( delay, delay, aCallBack ); - - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::StartPeriodicTimer" ) - } - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ -// -void CMusIndicatorDsa::StopPeriodicTimer() - { - MUS_LOG( "mus: [MUSIND] -> CMusIndicatorDsa::StopPeriodicTimer" ) - if( iPeriodic ) - { - iPeriodic->Cancel(); - } - MUS_LOG( "mus: [MUSIND] <- CMusIndicatorDsa::StopPeriodicTimer" ) - } - - - - - -// End of file - diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/tsrc/ut_indicator/group/ut_musindicator.mmp --- a/mmsharing/mmshindicator/tsrc/ut_indicator/group/ut_musindicator.mmp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshindicator/tsrc/ut_indicator/group/ut_musindicator.mmp Wed Jun 09 09:37:52 2010 +0300 @@ -37,13 +37,11 @@ SOURCE dllmain.cpp SOURCE ut_cmusindicatorapi.cpp SOURCE ut_cmussoundplayer.cpp -SOURCE ut_cmusindicatordsa.cpp // tested classes SOURCEPATH ../../../src SOURCE mussoundplayer.cpp SOURCE musindicatorapi.cpp -SOURCE musindicatordsa.cpp SOURCE musresourceutil.cpp USERINCLUDE ../inc diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/tsrc/ut_indicator/inc/ut_cmusindicatordsa.h --- a/mmsharing/mmshindicator/tsrc/ut_indicator/inc/ut_cmusindicatordsa.h Tue May 25 12:38:39 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Unit tests for CMusIndicatorApi class. -* -*/ - - - -#ifndef UT_CMUSINDICATORDSA_H -#define UT_CMUSINDICATORDSA_H - - -#include -#include - - -#ifndef NONSHARABLE_CLASS - #define NONSHARABLE_CLASS(x) class x -#endif - - -class CMusIndicatorDsa; - - -/** - * Unit test class for CMusIndicatorApi class. - * Implements unit tests for CMusIndicatorApi class. - */ -NONSHARABLE_CLASS( UT_CMusIndicatorDsa ) : public CEUnitTestSuiteClass - { -public: - - static UT_CMusIndicatorDsa* NewL(); - static UT_CMusIndicatorDsa* NewLC(); - - /** - * Destructor. - */ - ~UT_CMusIndicatorDsa(); - -private: - - UT_CMusIndicatorDsa(); - - void ConstructL(); - - /** - * Sets up a new test. - */ - void SetupL(); - - /** - * Tears down a test. - */ - void Teardown(); - - /** - * Actual unit test methods. - */ - void UT_CMusIndicatorDsa_NewLL(); - void UT_CMusIndicatorDsa_DrawL(); - void UT_CMusIndicatorDsa_LoadImageLL(); - void UT_CMusIndicatorDsa_LoadResourceStringLL(); - void UT_CMusIndicatorDsa_InitializeL(); - void UT_CMusIndicatorDsa_TryActivateL(); - void UT_CMusIndicatorDsa_StartPeriodicTimerL(); - void UT_CMusIndicatorDsa_StopPeriodicTimerL(); - void UT_CMusIndicatorDsa_HandleResourceChangeL(); - void UT_CMusIndicatorDsa_DoHandleResourceChangeL(); - - - /** - * Helpers - */ - void FakeVisibilityL(); - -private: // data - - /** - * Tested class. - * Own. - */ - CMusIndicatorDsa* iIndicatorDsa; - - EUNIT_DECLARE_TEST_TABLE; - - }; - -#endif // UT_CMUSINDICATORDSA_H diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/tsrc/ut_indicator/src/dllmain.cpp --- a/mmsharing/mmshindicator/tsrc/ut_indicator/src/dllmain.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshindicator/tsrc/ut_indicator/src/dllmain.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -19,7 +19,6 @@ #include "ut_cmusindicatorapi.h" #include "ut_cmussoundplayer.h" -#include "ut_cmusindicatordsa.h" #include @@ -39,9 +38,6 @@ rootSuite->AddL( UT_CMusSoundPlayer::NewLC() ); CleanupStack::Pop(); - rootSuite->AddL( UT_CMusIndicatorDsa::NewLC() ); - CleanupStack::Pop(); - CleanupStack::Pop( rootSuite ); return rootSuite; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatorapi.cpp --- a/mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatorapi.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatorapi.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -153,17 +153,7 @@ iIndicatorApi->Cancel(); iIndicatorApi->iStatus = KErrNone; iIndicatorApi->RunL(); - EUNIT_ASSERT( iStartLiveSharingLCalled ); - - EUNIT_ASSERT( !iIndicatorApi->IsSubscriber() ); - - iIndicatorApi->iObserver = NULL; - EUNIT_ASSERT( iIndicatorApi->IsSubscriber() ); - iIndicatorApi->Indicator( ETrue ); - - iIndicatorApi->Cancel(); - - iIndicatorApi->RunL(); + EUNIT_ASSERT( iStartLiveSharingLCalled ); } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatordsa.cpp --- a/mmsharing/mmshindicator/tsrc/ut_indicator/src/ut_cmusindicatordsa.cpp Tue May 25 12:38:39 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,501 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implements unit tests for CMusIndicatorApi class. -* -*/ - - - -#include "ut_cmusindicatordsa.h" -#include "musindicatordsa.h" -#include "mustesthelp.h" -#include "e32property.h" - -#include -#include -#include - - -// Next row is to disable warning emerging from EUnit code. -#pragma warn_illtokenpasting off - -const TSize KOriginalSize = TSize( 176, 208 ); -const TSize KDifferentSize = TSize( 208, 176 ); - -static CWindowGc* gc = NULL; -static TAny* cc = NULL; -static TTimeIntervalMicroSeconds32 delay = 0; -static TSize sizeInPixels = KOriginalSize; - - -// ======== stubs ======== - - -void CCoeControl::CreateWindowL() - { - - } - -void CCoeControl::ActivateL() - { - - } - -void CCoeControl::DrawDeferred() const - { - } - -CWindowGc& CCoeControl::SystemGc() const - { - return *gc; - } - -MWsClientClass::MWsClientClass() - { - } - -CWindowGc::CWindowGc(CWsScreenDevice* /*aDevice*/ ) - { - - } - -CWindowGc::~CWindowGc() - { - - } - -void CWindowGc::SetBrushStyle( TBrushStyle /*aBrushStyle*/ ) - { - } - -void CWindowGc::Clear( const TRect& /*aRect*/ ) - { - } - -void CWindowGc::UseFont( const CFont* /*aFont*/ ) - { - } - -void CWindowGc::SetPenStyle( TPenStyle /*aPenStyle*/ ) - { - } - -void CWindowGc::SetPenColor( const TRgb& /*aColor*/ ) - { - } - -void CWindowGc::SetPenSize( const TSize& /*aSize*/ ) - { - } - -void CWindowGc::DrawRoundRect( const TRect& /*aRect*/,const TSize& /*aEllipse*/ ) - { - } - -void CWindowGc::DrawText( const TDesC& /*aBuf*/,const TPoint& /*aPos*/ ) - { - } - -//Cannot stub due it is virtual method. This is not called -TSize CWsScreenDevice::SizeInPixels() const - { - return sizeInPixels; - } - -void CWindowGc::BitBltMasked(const TPoint& /*aPoint*/,const CFbsBitmap* /*aBitmap*/, - const TRect& /*aSourceRect*/,const CFbsBitmap* /*aMaskBitmap*/,TBool /*aInvertMask*/) - { - } - -MAknsControlContext* AknsDrawUtils::ControlContext( const MObjectProvider* /*aMop*/ ) - { - return static_cast( cc ); - } - -TBool AknsDrawUtils::Background( MAknsSkinInstance* /*aInstance*/, - MAknsControlContext* /*aContext*/, const CCoeControl* /*aControl*/, - CWindowGc& /*aGc*/, const TRect& /*aRect*/, const TInt /*aDrawParam*/ ) - { - return ETrue; - } - - -void CPeriodic::Start(TTimeIntervalMicroSeconds32 aDelay,TTimeIntervalMicroSeconds32 /*anInterval*/,TCallBack /*aCallBack*/) - { - delay = aDelay; - After(aDelay); - - } - - - -// ======== MEMBER FUNCTIONS ======== - - -UT_CMusIndicatorDsa* UT_CMusIndicatorDsa::NewL() - { - UT_CMusIndicatorDsa* self = UT_CMusIndicatorDsa::NewLC(); - CleanupStack::Pop( self ); - return self; - } - - -UT_CMusIndicatorDsa* UT_CMusIndicatorDsa::NewLC() - { - UT_CMusIndicatorDsa* self = new( ELeave ) UT_CMusIndicatorDsa(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -UT_CMusIndicatorDsa::~UT_CMusIndicatorDsa() - { - } - - -UT_CMusIndicatorDsa::UT_CMusIndicatorDsa() - { - delete iIndicatorDsa; - iIndicatorDsa = NULL; - } - - -// --------------------------------------------------------------------------- -// The ConstructL from the base class CEUnitTestSuiteClass must be called. -// It generates the test case table. -// --------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::ConstructL() - { - CEUnitTestSuiteClass::ConstructL(); - } - - -// ---------------------------------------------------------------------------- -// Prepares a test for execution. -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::SetupL() - { - /* NOTE: EUnit reports leak for any first test due AVKON resource reservation, - * which is not released by AVKON at end of test. Resource reservation - * happend in contruction of CMusIndicatorDsa - */ - - cc = this; - iIndicatorDsa = CMusIndicatorDsa::NewL(); - if ( !gc ) - { - gc = new (ELeave) CWindowGc( NULL ); - } - delay = 0; - sizeInPixels = KOriginalSize; - - } - - -// ---------------------------------------------------------------------------- -// Finalizes a test by releasing used resources. -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::Teardown() - { - delete iIndicatorDsa; - iIndicatorDsa = NULL; - delete gc; - gc = NULL; - cc = NULL; - delay = 0; - sizeInPixels = KOriginalSize; - PropertyHelper::Close(); - - } - - -// ======== UNIT TEST METHODS ======== - - -// ---------------------------------------------------------------------------- -// Asserts successful instantiation. -// ---------------------------------------------------------------------------- -// - -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_NewLL() - { - EUNIT_ASSERT( iIndicatorDsa ); - } - - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_DrawL() - { - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - TRect rect; - iIndicatorDsa->Draw( rect ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - cc = NULL; - iIndicatorDsa->Draw( rect ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - /*size cannot be changed - sizeInPixels = KDifferentSize; - iIndicatorDsa->Draw( rect ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic->IsActive() ); - */ - - } - -// ---------------------------------------------------------------------------- -// -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_InitializeL() - { - iIndicatorDsa->Initialize(); - - - EUNIT_ASSERT( iIndicatorDsa->iTextpos.iX ); - EUNIT_ASSERT( iIndicatorDsa->iTextpos.iY ); - - } - - -// ---------------------------------------------------------------------------- -// Asserts that load image is not doing anything if icon is already loaded -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_LoadImageLL() - { - CFbsBitmap* icon = iIndicatorDsa->iIcon; - CFbsBitmap* iconMask = iIndicatorDsa->iIconMask; - EUNIT_ASSERT( icon != NULL ); - EUNIT_ASSERT( iconMask != NULL ); - iIndicatorDsa->LoadImageL(); - - EUNIT_ASSERT( icon == iIndicatorDsa->iIcon ); - EUNIT_ASSERT( iconMask == iIndicatorDsa->iIconMask ); - } - - -// ---------------------------------------------------------------------------- -// Asserts successful loading of resource string. -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_LoadResourceStringLL() - { - iIndicatorDsa->LoadResourceStringL(); - EUNIT_ASSERT( iIndicatorDsa->iText ); - EUNIT_ASSERT( iIndicatorDsa->iText->Length() ); - } - - - -// ---------------------------------------------------------------------------- -// Asserts that periodic timer is started after method call. -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_StartPeriodicTimerL() - { - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - EUNIT_ASSERT( delay.Int() == 0 ); - - iIndicatorDsa->StartPeriodicTimer( iIndicatorDsa->iActivateCallBack ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic->IsActive() ); - EUNIT_ASSERT( delay.Int() == KMusIndicatorDelay ); - - delay = 0; - iIndicatorDsa->StartPeriodicTimer( iIndicatorDsa->iActivateCallBack ); - EUNIT_ASSERT( delay.Int() == 0 ); - - iIndicatorDsa->iPeriodic->Cancel(); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - EUNIT_ASSERT( delay.Int() == 0 ); - - iIndicatorDsa->StartPeriodicTimer( iIndicatorDsa->iRedrawCallBack ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic->IsActive() ); - EUNIT_ASSERT( delay.Int() == KMusRedrawDelay ); - - } - - -// ---------------------------------------------------------------------------- -// Asserts that periodic timer is stopped after method call. -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_StopPeriodicTimerL() - { - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - iIndicatorDsa->StopPeriodicTimer(); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - iIndicatorDsa->StartPeriodicTimer( iIndicatorDsa->iActivateCallBack ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic->IsActive() ); - - iIndicatorDsa->StopPeriodicTimer(); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - } - -// ---------------------------------------------------------------------------- -// Asserts that periodic timer -// ---------------------------------------------------------------------------- -// -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_TryActivateL() - { - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - EUNIT_ASSERT_EQUALS( iIndicatorDsa->TryActivate( iIndicatorDsa ), KErrNone ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - cc = NULL; - - // Through async callback - EUNIT_ASSERT_EQUALS( iIndicatorDsa->TryActivate( iIndicatorDsa ), KErrNone ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic->IsActive() ); - - EUNIT_ASSERT_EQUALS( iIndicatorDsa->TryActivate( NULL ), KErrArgument ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic->IsActive() ); - - } - -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_DoHandleResourceChangeL() - { - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - EUNIT_ASSERT_EQUALS( iIndicatorDsa->DoHandleResourceChange( iIndicatorDsa ), KErrNone ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - EUNIT_ASSERT_EQUALS( iIndicatorDsa->DoHandleResourceChange( NULL ), KErrArgument ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - } - -void UT_CMusIndicatorDsa::UT_CMusIndicatorDsa_HandleResourceChangeL() - { - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - iIndicatorDsa->StartPeriodicTimer( iIndicatorDsa->iRedrawCallBack ); - EUNIT_ASSERT( iIndicatorDsa->iPeriodic->IsActive() ); - - iIndicatorDsa->iScreenSize = TSize(); - iIndicatorDsa->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); - EUNIT_ASSERT( !iIndicatorDsa->iPeriodic->IsActive() ); - - EUNIT_ASSERT( iIndicatorDsa->iScreenSize != TSize() ); - - iIndicatorDsa->iScreenSize = TSize(); - iIndicatorDsa->HandleResourceChange( 0 ); - EUNIT_ASSERT( iIndicatorDsa->iScreenSize == TSize() ); - - } - - - -// ======== EUNIT TEST TABLE ======== - - -EUNIT_BEGIN_TEST_TABLE( - UT_CMusIndicatorDsa, - "UT_CMusIndicatorDsa", - "UNIT" ) - -EUNIT_TEST( - "NewL - test", - "CMusIndicatorDsa", - "NewL", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_NewLL, Teardown ) - - -EUNIT_TEST( - "Draw - test", - "CMusIndicatorDsa", - "Draw", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_DrawL, Teardown ) - - -EUNIT_TEST( - "Initialize - test", - "CMusIndicatorDsa", - "Initialize", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_InitializeL, Teardown ) - -EUNIT_TEST( - "LoadImageL - test", - "CMusIndicatorDsa", - "LoadImageL", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_LoadImageLL, Teardown ) - -EUNIT_TEST( - "LoadResourceStringL - test", - "CMusIndicatorDsa", - "LoadResourceStringL", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_LoadResourceStringLL, Teardown ) - - -EUNIT_TEST( - "TryActivate - test", - "CMusIndicatorDsa", - "TryActivate", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_TryActivateL, Teardown ) - -EUNIT_TEST( - "StartPeriodicTimer - test", - "CMusIndicatorDsa", - "StartPeriodicTimer", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_StartPeriodicTimerL, Teardown ) - -EUNIT_TEST( - "StopPeriodicTimer - test", - "CMusIndicatorDsa", - "StopPeriodicTimer", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_StopPeriodicTimerL, Teardown ) - -EUNIT_TEST( - "DoHandleResourceChange - test", - "CMusIndicatorDsa", - "DoHandleResourceChange", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_DoHandleResourceChangeL, Teardown ) - -EUNIT_TEST( - "HandleResourceChange - test", - "CMusIndicatorDsa", - "HandleResourceChange", - "FUNCTIONALITY", - SetupL, UT_CMusIndicatorDsa_HandleResourceChangeL, Teardown ) - - -EUNIT_END_TEST_TABLE diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshmanagercli/src/musmanagerimpl.cpp --- a/mmsharing/mmshmanagercli/src/musmanagerimpl.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshmanagercli/src/musmanagerimpl.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -402,6 +402,9 @@ { MUS_LOG1( "mus: [MUSCLI] CMusManagerImplListener::RunError: %d", \ aError ); + // Nothing can be done here. + aError = KErrNone; + return aError; } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshmanagercli/src/musmanagerserverstarter.cpp --- a/mmsharing/mmshmanagercli/src/musmanagerserverstarter.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshmanagercli/src/musmanagerserverstarter.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -59,8 +59,15 @@ TFullName name; if (findServer.Next(name) == KErrNone) { - MUS_LOG( "mus: [MUSCLI] <- MusManagerServerStarter::Start()" ); - return ETrue; // Server already running + MUS_LOG( "mus: [MUSCLI] <- MusManagerServerStarter::Start()" ); + + // Server may be running but already doing destruction, report + // it as not running in such case. + RSemaphore closingSemaphore; + TBool closingCurrently( + closingSemaphore.OpenGlobal( KMusManagerServerClosingSemaphoreName ) == KErrNone ); + closingSemaphore.Close(); + return !closingCurrently; } MUS_LOG( "mus: [MUSCLI] <- MusManagerServerStarter::Start()" ); return EFalse; @@ -73,6 +80,17 @@ TInt MusManagerServerStarter::CreateServerProcess( RSemaphore& aSemaphore ) { TInt err = KErrNone; + + RSemaphore closingSemaphore; + if ( closingSemaphore.OpenGlobal( KMusManagerServerClosingSemaphoreName ) == KErrNone ) + { + MUS_LOG( "mus: [MUSCLI] Server is currently closing, wait" ); + // Don't wait forever if server is somehow horribly jammed + const TInt KMusServerClosingWaitTimeoutInMicrosecs = 20000000; // 20 secs + closingSemaphore.Wait(KMusServerClosingWaitTimeoutInMicrosecs); + } + closingSemaphore.Close(); + const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); RProcess server; err = server.Create( KMusManagerServerName, KNullDesC() ,serverUid ); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshmanagersrv/inc/musmanagerserverclosetimer.h --- a/mmsharing/mmshmanagersrv/inc/musmanagerserverclosetimer.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshmanagersrv/inc/musmanagerserverclosetimer.h Wed Jun 09 09:37:52 2010 +0300 @@ -39,6 +39,7 @@ void StopActiveSchedulerAfter( TUint aMilliSeconds ); void RunL(); + TInt RunError( TInt aError ); void DoCancel(); private: diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshmanagersrv/src/musmanagerserverclosetimer.cpp --- a/mmsharing/mmshmanagersrv/src/musmanagerserverclosetimer.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshmanagersrv/src/musmanagerserverclosetimer.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -101,6 +101,18 @@ CActiveScheduler::Stop(); } +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusManagerServerCloseTimer::RunError( TInt aError ) + { + // Nothing can be done here. + aError = KErrNone; + + return aError; + } + // ---------------------------------------------------------------------------- // CMusManagerServerCloseTimer::DoCancel // ---------------------------------------------------------------------------- diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshmanagersrv/src/musmanagerservermain.cpp --- a/mmsharing/mmshmanagersrv/src/musmanagerservermain.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshmanagersrv/src/musmanagerservermain.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -70,9 +70,21 @@ // Start handling requests CActiveScheduler::Start(); + + // Open semaphore for destruction phase as it may take several seconds. + // Client can then interpret that it needs to soon start the server again. + // Even if creation of semaphore fails it is better to continue with gracefull shutdown. + RSemaphore closingSemaphore; + TInt err = closingSemaphore.CreateGlobal( KMusManagerServerClosingSemaphoreName, 0 ); // This will be executed after the active scheduler has been stopped: CleanupStack::PopAndDestroy(server); + + if ( err == KErrNone ) + { + closingSemaphore.Signal(); + } + closingSemaphore.Close(); } // ----------------------------------------------------------------------------- diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuiactivetimer.h --- a/mmsharing/mmshui/inc/musuiactivetimer.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuiactivetimer.h Wed Jun 09 09:37:52 2010 +0300 @@ -61,6 +61,8 @@ void DoCancel(); void RunL(); + + TInt RunError( TInt aError ); private: // Data diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuiactivitymanger.h --- a/mmsharing/mmshui/inc/musuiactivitymanger.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuiactivitymanger.h Wed Jun 09 09:37:52 2010 +0300 @@ -54,6 +54,8 @@ void DoCancel(); void RunL(); + + TInt RunError( TInt aError ); protected: diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuiappui.h --- a/mmsharing/mmshui/inc/musuiappui.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuiappui.h Wed Jun 09 09:37:52 2010 +0300 @@ -125,6 +125,8 @@ virtual TBool OrientationCanBeChanged() const; virtual TInt GetUiVolumeValue(); + + virtual CMusUiResourceHandler* ResourceHandler(); private: // from base class CEikAppUi @@ -193,6 +195,8 @@ TInt iAknNfyServerWgId; TBool iForeground; + + CMusUiResourceHandler* iResourceHandler; }; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuibitmapdecoder.h --- a/mmsharing/mmshui/inc/musuibitmapdecoder.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuibitmapdecoder.h Wed Jun 09 09:37:52 2010 +0300 @@ -66,6 +66,8 @@ void DoCancel(); void RunL(); + + TInt RunError( TInt aError ); private: // Data diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuiclipsharingcontroller.h --- a/mmsharing/mmshui/inc/musuiclipsharingcontroller.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuiclipsharingcontroller.h Wed Jun 09 09:37:52 2010 +0300 @@ -172,6 +172,8 @@ private: // new functions: void StreamStreamingL(); + + void StreamIdleL(); void SessionTimeChangedL( const TTimeIntervalSeconds& aSeconds ); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuiclipsharingview.h --- a/mmsharing/mmshui/inc/musuiclipsharingview.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuiclipsharingview.h Wed Jun 09 09:37:52 2010 +0300 @@ -107,7 +107,7 @@ public: // new functions - void RefreshView( TBool aLayoutChange = EFalse ); + void RefreshView(); void CancelTranscodingL(); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuidefinitions.h --- a/mmsharing/mmshui/inc/musuidefinitions.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuidefinitions.h Wed Jun 09 09:37:52 2010 +0300 @@ -86,8 +86,7 @@ EMusUiAsyncStartInvitation, EMusUiAsyncStartMediaGallery, EMusUiAsyncStartTranscoding, - EMusUiAsyncHandleExit, - EMusUiAsyncRefreshView + EMusUiAsyncHandleExit }; enum TMusUiNaviMediaDecorator diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuieventcontroller.h --- a/mmsharing/mmshui/inc/musuieventcontroller.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuieventcontroller.h Wed Jun 09 09:37:52 2010 +0300 @@ -284,6 +284,11 @@ /** * */ + virtual TBool IsForeground() const; + + /** + * + */ virtual void OfferToolbarEventL( TInt aCommand ); /** diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuieventobserver.h --- a/mmsharing/mmshui/inc/musuieventobserver.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuieventobserver.h Wed Jun 09 09:37:52 2010 +0300 @@ -27,6 +27,8 @@ #include #include +class CMusUiResourceHandler; + class MMusUiEventObserver { @@ -66,6 +68,8 @@ virtual TBool OrientationCanBeChanged() const = 0; virtual TInt GetUiVolumeValue() = 0; + + virtual CMusUiResourceHandler* ResourceHandler() = 0; }; #endif // MUSUIEVENTOBSERVER_H diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuigeneralview.h --- a/mmsharing/mmshui/inc/musuigeneralview.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuigeneralview.h Wed Jun 09 09:37:52 2010 +0300 @@ -78,7 +78,7 @@ * to landscape or vice versa. This is a virtual function that must be * implemented by all concrete MUS UI views. */ - virtual void RefreshView( TBool aLayoutChange = EFalse ) = 0; + virtual void RefreshView() = 0; virtual void HandleToolbarCommandL( TInt aCommand ) = 0; @@ -166,7 +166,9 @@ */ virtual void RefreshAudioRoutingToolbarButton(); - virtual void UpdateSessionTime( const TDesC& aSessionTime ); + virtual void UpdateSessionTime( const TDesC& aSessionTime ); + + virtual void DismissMenuBar(); public: // from base class CAknView @@ -252,6 +254,8 @@ TBool iToolbarItemSelected; + CMusUiBackgroundViewContainer* iBackgroundContainer; // skin background drawer + private: // data CAknIncallBubble* iIncallBubble; @@ -264,8 +268,6 @@ TBool iCurrentExitSetting; - CMusUiBackgroundViewContainer* iBackgroundContainer; // skin background drawer - }; // macro for NO_TOOLBAR case diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuilivesharingcontroller.h --- a/mmsharing/mmshui/inc/musuilivesharingcontroller.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuilivesharingcontroller.h Wed Jun 09 09:37:52 2010 +0300 @@ -28,6 +28,7 @@ class MMusUiLiveSharingObserver; class CMusEngLiveSession; +class CMusUiActiveTimer; /** * @@ -84,8 +85,6 @@ virtual void InviteL( const TDesC& aRecipient ); virtual void HandleSliderValueChangeL( TInt aNewLevel ); - - virtual void HandleAsyncEventL( TMusUiAsyncEvent aEventId ); public: // new functions @@ -141,7 +140,8 @@ public: // From MMusEngLiveSessionObserver void DiskFull(); - + + void OrientationRefreshEnded(); public: // from MMusEngSessionObserver @@ -160,8 +160,10 @@ void SessionTimeChanged( const TTimeIntervalSeconds& aSeconds ); void InactivityTimeout(); - - void AsyncRefreshView(); + + void HandlePauseResumeInToolbar(); + + void UserInitiatedCameraStateChangeL(TBool aEnable); private: @@ -180,6 +182,8 @@ TBool iDiskFull; TBool iSessionEstablished; + + CMusUiActiveTimer* iPauseResumeGuardTimer; }; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuilivesharingview.h --- a/mmsharing/mmshui/inc/musuilivesharingview.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuilivesharingview.h Wed Jun 09 09:37:52 2010 +0300 @@ -96,13 +96,11 @@ void ReplaceToolbarCommand( TInt aOldCommand, TInt aNewCommand, TBool aSetNewCommandFocused ); - - + void DoRefreshView(); + public: // new functions - void RefreshView( TBool aLayoutChange ); - - void DoRefreshView(); + void RefreshView(); void LevelIndicatorDismissed(); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuimmcmonitor.h --- a/mmsharing/mmshui/inc/musuimmcmonitor.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuimmcmonitor.h Wed Jun 09 09:37:52 2010 +0300 @@ -53,6 +53,7 @@ private: // from CActive void RunL(); + TInt RunError( TInt aError ); void DoCancel(); private: // New functions. diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuinavimediadecorator.h --- a/mmsharing/mmshui/inc/musuinavimediadecorator.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuinavimediadecorator.h Wed Jun 09 09:37:52 2010 +0300 @@ -128,7 +128,8 @@ const TAknsItemID& aId, TInt aBitmapId, TInt aMaskId, - TParse parse ); + TParse parse, + TBool aIconHasOwnColor = ETrue); private: // DATA diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuireceivecontainer.h --- a/mmsharing/mmshui/inc/musuireceivecontainer.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuireceivecontainer.h Wed Jun 09 09:37:52 2010 +0300 @@ -95,6 +95,8 @@ void SetFullScreen( TBool aFullScreen, TRect aRect ); + + void UpdatePointerCapture(); private: // from base class CCoeControl diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuireceiveview.h --- a/mmsharing/mmshui/inc/musuireceiveview.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuireceiveview.h Wed Jun 09 09:37:52 2010 +0300 @@ -93,7 +93,7 @@ public: // new functions - void RefreshView( TBool aLayoutChange ); + void RefreshView(); protected: // from MusUiGeneralView diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuiresourcehandler.h --- a/mmsharing/mmshui/inc/musuiresourcehandler.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuiresourcehandler.h Wed Jun 09 09:37:52 2010 +0300 @@ -20,6 +20,7 @@ #include "musuipropertyobserver.h" #include "musresourceproperties.h" #include "mussettingskeys.h" +#include "musmanagercommon.h" #include @@ -49,6 +50,8 @@ TBool RequestVideoPlayerL( TBool aMandatory = EFalse ); + void CheckInitialOrientationL( MultimediaSharing::TMusUseCase aUsecase ); + public: // From MMusUiPropertyObserver diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/inc/musuisharingobserver.h --- a/mmsharing/mmshui/inc/musuisharingobserver.h Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/inc/musuisharingobserver.h Wed Jun 09 09:37:52 2010 +0300 @@ -78,6 +78,8 @@ virtual void RefreshAudioRoutingToolbarButton() = 0; virtual void UpdateSessionTime( const TDesC& aSessionTime ) = 0; + + virtual void DismissMenuBar() = 0; }; diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuiactivequerydialog.cpp --- a/mmsharing/mmshui/src/musuiactivequerydialog.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuiactivequerydialog.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -143,8 +143,10 @@ { MUS_LOG1( "mus: [MUSUI ] -> CMusUiActiveQueryDialog::RunError [%d]", aError ); + + iObserver.HandleQueryError( aError ); - return iObserver.HandleQueryError( aError ); + return KErrNone; } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuiactivetimer.cpp --- a/mmsharing/mmshui/src/musuiactivetimer.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuiactivetimer.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -116,16 +116,30 @@ void CMusUiActiveTimer::RunL() { MUS_LOG( "mus: [MUSUI ] -> CMusUiActiveTimer::RunL" ); - if (iStatus == KErrNone) + if (iObserver && iStatus == KErrNone) { iObserver->TimerComplete( this ); } else { - User::Leave(iStatus.Int()); + User::LeaveIfError(iStatus.Int()); } MUS_LOG( "mus: [MUSUI ] <- CMusUiActiveTimer::RunL" ); } +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusUiActiveTimer::RunError( TInt aError ) + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiActiveTimer::RunError" ); + // Nothing can be done here. + aError = KErrNone; + + MUS_LOG( "mus: [MUSUI ] <- CMusUiActiveTimer::RunError" ); + return aError; + } + // end of file diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuiactivitymanger.cpp --- a/mmsharing/mmshui/src/musuiactivitymanger.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuiactivitymanger.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -163,5 +163,19 @@ MUS_LOG( "mus: [MUSUI ] <- CMusUiActivityManager::RunL" ); } +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusUiActivityManager::RunError( TInt aError ) + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiActivityManager::RunError" ); + // Nothing can be done here. + aError = KErrNone; + + MUS_LOG( "mus: [MUSUI ] <- CMusUiActivityManager::RunError" ); + return aError; + } + // end of file diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuiappui.cpp --- a/mmsharing/mmshui/src/musuiappui.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuiappui.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -28,6 +28,7 @@ #include "mussettings.h" #include "mussettingskeys.h" #include "musmanagercommon.h" +#include "musuiresourcehandler.h" #include "musui.hrh" #include "musuid.hrh" #include "muslogger.h" // debug logging @@ -52,7 +53,11 @@ { MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::ConstructL" ); BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | EAknEnableMSK ); - + + iResourceHandler = CMusUiResourceHandler::NewL( *this ); + MultimediaSharing::TMusUseCase usecase = MusUiStartController::ReadUseCaseL(); + iResourceHandler->CheckInitialOrientationL(usecase); + iForeground = ETrue; // View for Live Sharing: @@ -92,7 +97,7 @@ AknsUtils::SetAvkonSkinEnabledL( ETrue ); // Check use case and set default view - switch ( MusUiStartController::ReadUseCaseL() ) + switch ( usecase ) { case MultimediaSharing::EMusLiveVideo: ActivateLocalViewL( liveSharingView->Id() ); @@ -116,7 +121,7 @@ iOperatorSpecificFunctionality = ( MultimediaSharingSettings::OperatorVariantSettingL() == EOperatorSpecific ); - + MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::ConstructL" ); } @@ -128,6 +133,7 @@ CMusUiAppUi::~CMusUiAppUi() { MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::~CMusUiAppUi" ); + delete iResourceHandler; delete iConfirmationQuery; delete iStatusPaneHandler; delete iInterfaceSelector; @@ -528,7 +534,7 @@ MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HandleResourceChangeL" ); CAknAppUi::HandleResourceChangeL( aResourceChangeType ); - if ( aResourceChangeType == KEikDynamicLayoutVariantSwitch ) + if ( aResourceChangeType == KEikDynamicLayoutVariantSwitch && iView ) { MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::HandleResourceChangeL:\ aResourceChangeType == KEikDynamicLayoutVariantSwitch" ); @@ -545,7 +551,7 @@ if ( activatedView ) { - activatedView->RefreshView( ETrue ); + activatedView->RefreshView(); } } @@ -588,8 +594,10 @@ case EAknSoftkeyExit: case EEikCmdExit: { - SetToolbarVisibility( EFalse ); - HandleExit(); + CMusUiGeneralView* activatedView = + static_cast( iView ); + activatedView->HandleCommandL( EAknSoftkeyExit ); + break; } default: @@ -607,6 +615,14 @@ return iStatusPaneHandler->GetVolumeControlValue(); } +// ----------------------------------------------------------------------------- +// CMusUiAppUi::ResourceHandler() +// ----------------------------------------------------------------------------- +// +CMusUiResourceHandler* CMusUiAppUi::ResourceHandler() + { + return iResourceHandler; + } // ----------------------------------------------------------------------------- // CMusUiAppUi::AppHelpContextL() diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuibitmapdecoder.cpp --- a/mmsharing/mmshui/src/musuibitmapdecoder.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuibitmapdecoder.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -148,5 +148,19 @@ MUS_LOG( "mus: [MUSUI ] <- CMusUiBitmapDecoder::RunL" ); } +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusUiBitmapDecoder::RunError( TInt aError ) + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiBitmapDecoder::RunError" ); + // Nothing can be done here. + aError = KErrNone; + + MUS_LOG( "mus: [MUSUI ] <- CMusUiBitmapDecoder::RunError" ); + return aError; + } + // end of file diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuicallbackservice.cpp --- a/mmsharing/mmshui/src/musuicallbackservice.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuicallbackservice.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -142,8 +142,9 @@ { MUS_LOG1( "mus: [MUSUI ] CMusUiCallbackService::RunError [%d]", aError ); + iCallbackObserver.HandleAsyncError( aError ); - return iCallbackObserver.HandleAsyncError( aError ); + return KErrNone; } diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuiclipsharingcontroller.cpp --- a/mmsharing/mmshui/src/musuiclipsharingcontroller.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuiclipsharingcontroller.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -1025,6 +1025,11 @@ { MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StreamIdle" ); iClipObserver.InvalidVideoFrame( ETrue ); + TRAPD( error, StreamIdleL() ); + if ( error != KErrNone ) + { + iEventObserver.HandleError( error ); + } MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StreamIdle" ); } @@ -1107,6 +1112,21 @@ MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StreamStreamingL" ); } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusUiClipSharingController::StreamIdleL() + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StreamIdleL" ); + + if ( ConnectionEstablished() ) + { + iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); + } + + MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StreamIdleL" ); + } // ----------------------------------------------------------------------------- // diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuiclipsharingview.cpp --- a/mmsharing/mmshui/src/musuiclipsharingview.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuiclipsharingview.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -467,11 +467,15 @@ // // ----------------------------------------------------------------------------- // -void CMusUiClipSharingView::RefreshView( TBool /*aLayoutChange*/ ) +void CMusUiClipSharingView::RefreshView() { MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingView::RefreshView" ); - + if ( iBackgroundContainer ) + { + iBackgroundContainer->SetRect( ClientRect() ); + } + if ( iContainer ) { TInt height = MusAppUi()->ApplicationRect().Height(); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuieventcontroller.cpp --- a/mmsharing/mmshui/src/musuieventcontroller.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuieventcontroller.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -65,7 +65,6 @@ CMusUiEventController::~CMusUiEventController() { MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::~CMusUiEventController" ); - delete iResourceHandler; delete iStatusPropertyWatch; delete iContactName; delete iTelNumber; @@ -140,7 +139,8 @@ iMmcMonitor = CMusUiMmcMonitor::NewL( *this ); - iResourceHandler = CMusUiResourceHandler::NewL( iEventObserver ); + iResourceHandler = iEventObserver.ResourceHandler(); + __ASSERT_ALWAYS( iResourceHandler, User::Leave( KErrNotFound ) ); //Mic mute status property iMicMuteStatusPropertyWatch = CMusUiPropertyWatch::NewL( @@ -603,6 +603,8 @@ { MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::ExitProcedureL" ); + iSharingObserver.DismissMenuBar(); + switch ( iShutdownState ) { case EMusUiShutdownStarted: @@ -692,6 +694,11 @@ aConnectionInitialized ); iConnectionInitialized = aConnectionInitialized; + + if ( !iForeground && !ExitOccured() ) + { + TRAP_IGNORE( EnableDisplayL(EFalse) ) + } } // ----------------------------------------------------------------------------- @@ -847,6 +854,14 @@ MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleForegroundEventL" ); } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +TBool CMusUiEventController::IsForeground() const + { + return iForeground; + } // ----------------------------------------------------------------------------- // diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuigeneralview.cpp --- a/mmsharing/mmshui/src/musuigeneralview.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuigeneralview.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -470,6 +470,18 @@ // // ----------------------------------------------------------------------------- // +void CMusUiGeneralView::DismissMenuBar() + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DismissMenuBar" ); + StopDisplayingMenuBar(); + MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::DismissMenuBar" ); + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// void CMusUiGeneralView::RefreshAudioRoutingToolbarButton() { MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::RefreshAudioRoutingToolbarButton" ) @@ -590,7 +602,7 @@ { MUS_LOG1( "mus: [MUSUI ] -> CMusUiGeneralView::HandleForegroundEventL: %d", aForeground ); - + SetCurrentFgBgEvent( ( aForeground ? EMusFgEvent : EMusBgEvent ) ); iCurrentExitSetting = aExit; @@ -598,9 +610,7 @@ { if ( aForeground ) { - MUS_LOG( "mus: [MUSUI ] immediately to fg" ); - RefreshView(); - DoForegroundEventL(); + MUS_LOG( "mus: [MUSUI ] delayed to fg" ); } else { @@ -749,24 +759,18 @@ { MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::CompleteForegroundEventL()" ) - switch ( iCurrentFgBgEvent ) + if ( iCurrentFgBgEvent == EMusFgEvent ) + { + DoForegroundEventL(); + } + else if ( iCurrentFgBgEvent == EMusBgEvent && EventControllerL().IsForeground() ) { - case EMusFgEvent: - { - DoForegroundEventL(); - break; - } - case EMusBgEvent: - { - DoBackgroundEventL( iCurrentExitSetting ); - break; - } - default: - { - break; - } + // Bg handling when already at bg would cause problems in state + // restoring phase when coming back to fg. Easiest to deal with that + // at this level. + DoBackgroundEventL( iCurrentExitSetting ); } - + SetCurrentFgBgEvent( EMusFgBgEventNone ); MUS_LOG( "mus: [MUSUI ] <- CMusUiGeneralView::CompleteForegroundEventL()" ) @@ -781,13 +785,8 @@ { MUS_LOG( "mus: [MUSUI ] -> CMusUiGeneralView::DoForegroundEventL()" ) - /* if background container exist then draw now. but do not change - * the ordinal so that other control preceed in drawing. - */ - if( iBackgroundContainer ) - { - iBackgroundContainer->RefreshView(); - } + RefreshView(); + iSessionEndTimer->Cancel(); EventControllerL().HandleForegroundEventL( ETrue ); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuilivesharingcontroller.cpp --- a/mmsharing/mmshui/src/musuilivesharingcontroller.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuilivesharingcontroller.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -31,6 +31,7 @@ #include "mussettingskeys.h" #include "muslogger.h" // debug logging #include "musuigeneralview.h" +#include "musuiactivetimer.h" #include #include @@ -41,8 +42,8 @@ using namespace NMusResourceApi; using namespace MusSettingsKeys; +const TInt KMusUiPauseResumeGuardPeriod = 500000; -const TInt KMusUiIntervalToPlay = 5000000; // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -74,6 +75,7 @@ { MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::~CMusUiLiveSharingController" ); delete iSession; + delete iPauseResumeGuardTimer; MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::~CMusUiLiveSharingController" ); } @@ -122,6 +124,8 @@ { iSession->SetSupportedVideoCodecListL( *iVideoCodec ); } + + iPauseResumeGuardTimer = CMusUiActiveTimer::NewL( NULL ); MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::ConstructL" ); } @@ -151,34 +155,15 @@ void CMusUiLiveSharingController::RefreshCameraOrientationL() { MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::RefreshCameraOrientationL" ); - if ( IsPlayingL() ) - { - MUS_LOG( "mus: [MUSUI ] -> Playing, pause/stop to restart camera" ); - TTimeIntervalMicroSeconds32 interval( KMusUiIntervalToPlay ); - PauseL(); - EnableDisplayL(false); - EnableDisplayL(true); - PlayL(); - } - else - { - MUS_LOG( "mus: [MUSUI ] -> Not Playing, try display to restart camera"); - if ( IsDisplayEnabledL() ) - { - //Disabling of display will cause disabling of viewfinder and in its - //turn releasing of camera, enabling of display will recreate a camera - //with new orientation - MUS_LOG( "mus: [MUSUI ] -> display is enabled, disable/enable it"); - EnableDisplayL(false); - EnableDisplayL(true); - } - else - { - MUS_LOG( "mus: [MUSUI ] -> Not refreshing "); - } - } + + if ( EngineSession() ){ + EngineSession()->RefreshOrientationL(); + } + MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::RefreshCameraOrientationL" ); } + +// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // @@ -318,18 +303,14 @@ case EMusuiCmdToolbarPauseLive: { HandleCommandL( EMusuiCmdViewPause ); - iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPauseLive, - EMusuiCmdToolbarUnPauseLive, - ETrue ); + HandlePauseResumeInToolbar(); break; } case EMusuiCmdToolbarUnPauseLive: { HandleCommandL( EMusuiCmdViewContinue ); - iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPauseLive, - EMusuiCmdToolbarPauseLive, - ETrue ); + HandlePauseResumeInToolbar(); break; } case EMusuiCmdToolbarZoom: @@ -393,13 +374,12 @@ { case EMusuiCmdViewPause: { - PauseL(); - iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause ); + UserInitiatedCameraStateChangeL(EFalse); break; } case EMusuiCmdViewContinue: { - PlayL(); + UserInitiatedCameraStateChangeL(ETrue); break; } @@ -770,7 +750,17 @@ TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( R_MUS_VIEW_NOTE_MEMORY_LOW ) ) ); iDiskFull = ETrue; } - + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusUiLiveSharingController::OrientationRefreshEnded() + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::OrientationRefreshEnded" ); + iLiveObserver.DoRefreshView(); + MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::OrientationRefreshEnded" ); + } // ----------------------------------------------------------------------------- // @@ -932,40 +922,6 @@ MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::InactivityTimeout" ); } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CMusUiLiveSharingController::AsyncRefreshView() - { - TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncRefreshView ) ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void CMusUiLiveSharingController::HandleAsyncEventL( TMusUiAsyncEvent aEventId ) - { - MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::HandleAsyncEventL" ); - switch ( aEventId ) - { - case EMusUiAsyncRefreshView: - { - iLiveObserver.DoRefreshView(); - break; - } - default: - { - // Not live sharing specific, let the base class handle - CMusUiSendController::HandleAsyncEventL( aEventId ); - } - } - MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::HandleAsyncEventL" ); - - } - // ----------------------------------------------------------------------------- // Determines whether Session established or not // ----------------------------------------------------------------------------- @@ -975,5 +931,58 @@ return iSessionEstablished; } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusUiLiveSharingController::HandlePauseResumeInToolbar() + { + TBool isPlaying( EFalse ); + TRAP_IGNORE( isPlaying = IsPlayingL() ) + if ( isPlaying ) + { + iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPauseLive, + EMusuiCmdToolbarPauseLive, + ETrue ); + } + else + { + iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPauseLive, + EMusuiCmdToolbarUnPauseLive, + ETrue ); + } + } + +// ----------------------------------------------------------------------------- +// Workaround for problem at lower level (encoder side) which causes crash +// if several sequential pause/resumes are done too rapidly. Discard state change +// attempt if it occurs too quickly after previous state change. +// ----------------------------------------------------------------------------- +// +void CMusUiLiveSharingController::UserInitiatedCameraStateChangeL( TBool aEnable ) + { + MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingController::UserInitiatedCameraStateChangeL, enable:", + aEnable ); + + if ( iPauseResumeGuardTimer->IsActive() ){ + MUS_LOG( "mus: [MUSUI ] <- State change ignored as guard timer is running!" ); + return; + } + + if ( aEnable ) + { + PlayL(); + } + else + { + PauseL(); + } + + iPauseResumeGuardTimer->After( KMusUiPauseResumeGuardPeriod ); + + MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::UserInitiatedCameraStateChangeL" ); + } + + // End of file diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuilivesharingview.cpp --- a/mmsharing/mmshui/src/musuilivesharingview.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuilivesharingview.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -572,20 +572,12 @@ // // ----------------------------------------------------------------------------- // -void CMusUiLiveSharingView::RefreshView( TBool aLayoutChange ) +void CMusUiLiveSharingView::RefreshView() { MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::RefreshView" ); if ( iController ) { - if ( aLayoutChange && iController->IsSessionEstablished() ) - { - iController->AsyncRefreshView(); - } - else - { - DoRefreshView(); - } - + DoRefreshView(); } MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::RefreshView" ); } @@ -598,6 +590,12 @@ void CMusUiLiveSharingView::DoRefreshView() { MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingView::DoRefreshView" ); + + if ( iBackgroundContainer ) + { + iBackgroundContainer->SetRect(ClientRect()); + } + if ( iContainer ) { TRect containerRect( ClientRect().iBr.iX - KMusUiContainerWidth, @@ -626,7 +624,6 @@ MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingView::DoRefreshView" ); } - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuimmcmonitor.cpp --- a/mmsharing/mmshui/src/musuimmcmonitor.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuimmcmonitor.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -111,6 +111,20 @@ MUS_LOG( "mus: [MUSUI ] <- CMusUiMmcMonitor::RunL" ); } +// ------------------------------------------------------------------------- +// If RunL() leaves,It should be handled here. +// ------------------------------------------------------------------------- +// +TInt CMusUiMmcMonitor::RunError( TInt aError ) + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiMmcMonitor::RunError" ); + // Nothing can be done here. + aError = KErrNone; + + MUS_LOG( "mus: [MUSUI ] <- CMusUiMmcMonitor::RunError" ); + return aError; + } + // ----------------------------------------------------------------------------- // diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuinavimediadecorator.cpp --- a/mmsharing/mmshui/src/musuinavimediadecorator.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuinavimediadecorator.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -434,43 +434,50 @@ item, EMbmMusuiiconsQgn_indi_video_forw, EMbmMusuiiconsQgn_indi_video_forw_mask, - parse ); + parse, + EFalse ); ConstructImageL( skin, item, EMbmMusuiiconsQgn_indi_video_pause, EMbmMusuiiconsQgn_indi_video_pause_mask, - parse ); + parse, + EFalse ); ConstructImageL( skin, item, EMbmMusuiiconsQgn_indi_video_play, EMbmMusuiiconsQgn_indi_video_play_mask, - parse ); + parse, + ETrue ); ConstructImageL( skin, item, EMbmMusuiiconsQgn_indi_video_record, EMbmMusuiiconsQgn_indi_video_record_mask, - parse ); + parse, + ETrue ); ConstructImageL( skin, item, EMbmMusuiiconsQgn_indi_video_record_not, EMbmMusuiiconsQgn_indi_video_record_not_mask, - parse ); + parse, + ETrue ); ConstructImageL( skin, item, EMbmMusuiiconsQgn_indi_video_rew, EMbmMusuiiconsQgn_indi_video_rew_mask, - parse ); + parse, + EFalse ); ConstructImageL( skin, item, EMbmMusuiiconsQgn_indi_video_stop, EMbmMusuiiconsQgn_indi_video_stop_mask, - parse ); + parse, + EFalse ); } @@ -482,7 +489,8 @@ const TAknsItemID& aId, TInt aBitmapId, TInt aMaskId, - TParse parse ) + TParse parse, + TBool aIconHasOwnColor ) { MUS_LOG( "mus: [MUSUI ] -> CMusUiNaviMediaDecorator::ConstructImageL()" ); @@ -490,16 +498,30 @@ CFbsBitmap* bitmap = NULL; CFbsBitmap* mask = NULL; - AknsUtils::CreateColorIconL(aSkin, + if (aIconHasOwnColor) + { + AknsUtils::CreateIconL(aSkin, + aId, + bitmap, + mask, + parse.FullName(), + aBitmapId, + aMaskId); + + } + else + { + AknsUtils::CreateColorIconL(aSkin, aId, KAknsIIDQsnIconColors, - EAknsCIQsnIconColorsCG13, + EAknsCIQsnIconColorsCG7, bitmap, - mask, - parse.FullName(), - aBitmapId, - aMaskId, - KRgbBlack); + mask, + parse.FullName(), + aBitmapId, + aMaskId, + KRgbBlack); + } AknIconUtils::SetSize( bitmap, iImageSize ); AknIconUtils::SetSize( mask, iImageSize ); diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuireceivecontainer.cpp --- a/mmsharing/mmshui/src/musuireceivecontainer.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuireceivecontainer.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -315,6 +315,27 @@ (MusUiView()))->HandleCommandL( EMusuiCmdToolbarFullScreen ); } } - - + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusUiReceiveContainer::UpdatePointerCapture() + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveContainer::UpdatePointerCapture" ); + + if ( iFullScreen ) + { + // In order to capture pointer events this container must be visible. + // Thus we make it as small as possible. + SetRect( TRect( 0, 0, 0, 0 ) ); + MakeVisible( ETrue ); + SetGloballyCapturing( ETrue ); + SetPointerCapture( ETrue ); + } + + MUS_LOG( "mus: [MUSUI ] <- CMusUiReceiveContainer::UpdatePointerCapture" ); + } + // end of file diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuireceiveview.cpp --- a/mmsharing/mmshui/src/musuireceiveview.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuireceiveview.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -386,13 +386,19 @@ // // ----------------------------------------------------------------------------- // -void CMusUiReceiveView::RefreshView( TBool /*aLayoutChange*/ ) +void CMusUiReceiveView::RefreshView() { MUS_LOG( "mus: [MUSUI ] -> CMusUiReceiveView::RefreshView" ); + if ( iBackgroundContainer ) + { + iBackgroundContainer->SetRect( ClientRect() ); + } + if ( iContainer ) { iContainer->SetRect( ClientRect() ); + iContainer->UpdatePointerCapture(); } TRect videoRect( ClientRect().iTl.iX, diff -r 95754dcd27ad -r ce86b6d44a6d mmsharing/mmshui/src/musuiresourcehandler.cpp --- a/mmsharing/mmshui/src/musuiresourcehandler.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmsharing/mmshui/src/musuiresourcehandler.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -388,7 +388,7 @@ MultimediaSharingSettings::ResourceUsability( iCameraUsability , iKeypadUsability, iVideoplayerUsability); - + // Read the value from cenrep and check whether camera and keypad // available dynamically. MusSettingsKeys::TAvailability camera,keypad; @@ -509,6 +509,32 @@ ); } +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void CMusUiResourceHandler::CheckInitialOrientationL(MultimediaSharing::TMusUseCase aUsecase ) + { + MUS_LOG( "mus: [MUSUI ] -> CMusUiResourceHandler::CheckInitialOrientationL()" ) + if ( aUsecase != MultimediaSharing::EMusLiveVideo && + aUsecase != MultimediaSharing::EMusClipVideo && + aUsecase != MultimediaSharing::EMusReceive ) + { + return; + } + + MusSettingsKeys::TUsability usability = ( aUsecase == MultimediaSharing::EMusLiveVideo ) ? + iCameraUsability : iVideoplayerUsability; + if ( usability == MusSettingsKeys::EUsabilityPortrait ) + { + iObserver.SwitchOrientationL( CAknAppUiBase::EAppUiOrientationPortrait ); + } + else if ( usability == MusSettingsKeys::EUsabilityLandscape ) + { + iObserver.SwitchOrientationL( CAknAppUiBase::EAppUiOrientationLandscape ); + } + MUS_LOG( "mus: [MUSUI ] <- CMusUiResourceHandler::CheckInitialOrientationL()" ) + } diff -r 95754dcd27ad -r ce86b6d44a6d mmshplugins/mmshaiwplugin/group/musaiwprovider.mmp --- a/mmshplugins/mmshaiwplugin/group/musaiwprovider.mmp Tue May 25 12:38:39 2010 +0300 +++ b/mmshplugins/mmshaiwplugin/group/musaiwprovider.mmp Wed Jun 09 09:37:52 2010 +0300 @@ -52,7 +52,6 @@ // MultimediaSharing libraries LIBRARY musmanagerclient.lib -LIBRARY musindicator.lib // SymbianOS/Series60 libraries LIBRARY aknnotify.lib diff -r 95754dcd27ad -r ce86b6d44a6d mmshplugins/mmshaiwplugin/inc/musaiwprovider.h --- a/mmshplugins/mmshaiwplugin/inc/musaiwprovider.h Tue May 25 12:38:39 2010 +0300 +++ b/mmshplugins/mmshaiwplugin/inc/musaiwprovider.h Wed Jun 09 09:37:52 2010 +0300 @@ -166,8 +166,6 @@ /** To Differentiate Error and Warning Notes */ TBool iIsWarning ; - - CMusIndicatorApi* iIndicator; }; diff -r 95754dcd27ad -r ce86b6d44a6d mmshplugins/mmshaiwplugin/src/musaiwprovider.cpp --- a/mmshplugins/mmshaiwplugin/src/musaiwprovider.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmshplugins/mmshaiwplugin/src/musaiwprovider.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -27,7 +27,6 @@ #include "musresourcefinderutil.h" #include "mussettings.h" #include "mussesseioninformationapi.h" -#include "musindicatorapi.h" #include @@ -78,9 +77,8 @@ { MUS_LOG( "mus: [AIWPRO] -> CMusAiwProvider::~CMusAiwProvider" ) delete iResourceFileName ; - iResourceFileName = NULL ; - delete iIndicator; - iIndicator = NULL ; + iResourceFileName = NULL ; + MUS_LOG( "mus: [AIWPRO] <- CMusAiwProvider::~CMusAiwProvider" ) } @@ -211,12 +209,7 @@ void CMusAiwProvider::DoInitialiseL() { MUS_LOG( "mus: [AIWPRO] -> CMusAiwProvider::DoInitialiseL") - - if ( !iIndicator ) - { - MUS_LOG( "mus: [AIWPRO] : creating indicator") - iIndicator = CMusIndicatorApi::NewL(); - } + MUS_LOG( "mus: [AIWPRO] <- CMusAiwProvider::DoInitialiseL") } diff -r 95754dcd27ad -r ce86b6d44a6d mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp --- a/mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp Tue May 25 12:38:39 2010 +0300 +++ b/mmshplugins/mmshsettingsuiplugin/src/mussettingsplugin.cpp Wed Jun 09 09:37:52 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: MUSSettingsPlugin implementation. -* Version : %version: 36 % << Don't touch! Updated by Synergy at check-out. +* Version : %version: be1sipx1#38 % << Don't touch! Updated by Synergy at check-out. * */ @@ -614,9 +614,16 @@ TRAPD( error, iHandler->DisableProfileL() ); MUS_LOG1( "[MUSSET] VS is off (err=%d)", error ) //activation disabled = true - //to remove warning :) - enabled = error != KErrNone ? ETrue : ETrue; iModel->SetActivationItem( enabled ); + + if ( error == KErrNone ) + { + MUS_LOG( "[MUSSET] Activation setting set off" ) + //MusSettingsKeys::ENever = 2 can not be used anymore + //EActiveInHomeNetworks = 1 is used instead -> off + MultimediaSharingSettings::SetActivationSettingL( + MusSettingsKeys::EActiveInHomeNetworks ); + } } else//currently disabled => enable { @@ -626,7 +633,14 @@ enabled = error != KErrNone; //activation disabled = false/true(if failed) iModel->SetActivationItem( enabled ); - } + + if ( error == KErrNone ) + { + MUS_LOG( "[MUSSET] Activation setting set on" ) + MultimediaSharingSettings::SetActivationSettingL( + MusSettingsKeys::EAlwaysActive ); + } + } } } }