# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1283448220 -10800 # Node ID 01f0bb65bcf1a050838b70db650bb6e9de2a8b46 # Parent 36d7ded3ca2329673fe49b26681e31570d9f4584 Revision: 201033 Kit: 201035 diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/inc/musmanageripccommon.h --- a/mmsharing/inc/musmanageripccommon.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/inc/musmanageripccommon.h Thu Sep 02 20:23:40 2010 +0300 @@ -27,6 +27,7 @@ _LIT( KMusManagerServerName,"musmanagerserver" ); _LIT( KMusManagerServerFilename, "musmanagerserver" ); _LIT( KMusManagerServerSemaphoreName, "musmanagerserverSemaphore" ); +_LIT( KMusManagerServerClosingSemaphoreName, "musmanagerserverClosingSemaphore" ); const TUid KServerUid3 = { KMusManagerServerUid }; diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/inc/lcview.h --- a/mmsharing/livecommsui/lcui/inc/lcview.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/inc/lcview.h Thu Sep 02 20:23:40 2010 +0300 @@ -86,6 +86,7 @@ void disableControls(); void enableControls(); void watchInactivity(); + void updateVolumeSlider(int aVolumeLevel); protected: // From HbView diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/inc/lcviewmanager_p.h --- a/mmsharing/livecommsui/lcui/inc/lcviewmanager_p.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/inc/lcviewmanager_p.h Thu Sep 02 20:23:40 2010 +0300 @@ -36,9 +36,9 @@ LcMainWindow(); virtual ~LcMainWindow(); -protected: // From HbMainWindow - - bool event(QEvent *event); +protected: // From QObject + + bool eventFilter ( QObject * watched, QEvent * event ); signals: diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/livecommsui.qrc --- a/mmsharing/livecommsui/lcui/livecommsui.qrc Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/livecommsui.qrc Thu Sep 02 20:23:40 2010 +0300 @@ -1,14 +1,15 @@ - + + resources/hbpushbutton_color.css - resources/lcviews/lcidleview.docml - resources/lcviews/lcreceiveview.docml - resources/lcviews/lcreceiveonlyview.docml - resources/lcviews/lcsendview.docml - resources/lcviews/lctwowayview.docml - resources/lcviews/lcvtview.docml + resources/lcviews/lcidleview.docml.bin + resources/lcviews/lcreceiveview.docml.bin + resources/lcviews/lcreceiveonlyview.docml.bin + resources/lcviews/lcsendview.docml.bin + resources/lcviews/lctwowayview.docml.bin + resources/lcviews/lcvtview.docml.bin resources/win_appear.fxml diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/resources/lcviews/lcvtview.docml --- a/mmsharing/livecommsui/lcui/resources/lcviews/lcvtview.docml Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/resources/lcviews/lcvtview.docml Thu Sep 02 20:23:40 2010 +0300 @@ -1,8 +1,8 @@ - + - + @@ -13,18 +13,18 @@ - + - + - + @@ -40,8 +40,8 @@ - - + + @@ -50,7 +50,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -120,22 +120,22 @@ - + - + - + - +
@@ -181,22 +181,22 @@ - + - + - + - +
@@ -214,11 +214,11 @@ - + - + - + @@ -230,16 +230,16 @@ - - - + + + - - + + - + @@ -247,7 +247,7 @@ - +
diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/src/lcuicomponentrepository.cpp --- a/mmsharing/livecommsui/lcui/src/lcuicomponentrepository.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/src/lcuicomponentrepository.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -69,7 +69,7 @@ mSlots->insert( lcActEnableCameraId, SLOT( disableCamera() ) ); mSlots->insert( lcActMuteId, SLOT( mute() ) ); mSlots->insert( lcActGalleryId, SLOT( notSupported() ) ); - mSlots->insert( lcActChangeCameraId, SLOT( notSupported() ) ); + mSlots->insert( lcActChangeCameraId, SLOT( changeCamera() ) ); mSlots->insert( lcActAdjustVideoId, SLOT( notSupported() ) ); mSlots->insert( lcActShareImageId, SLOT( notSupported() ) ); mSlots->insert( lcActSwapViewsId, SLOT( swap() ) ); @@ -79,7 +79,7 @@ mSlots->insert( lcActSpeakerId, SLOT( speaker() ) ); mSlots->insert( lcActMenuDisableCameraId, SLOT( disableCamera() ) ); - mSlots->insert( lcActMenuChangeCameraId, SLOT( notSupported() ) ); + mSlots->insert( lcActMenuChangeCameraId, SLOT( changeCamera() ) ); LC_QDEBUG( "livecomms [UI] <- LcUiComponentRepository::LcUiComponentRepository()" ) } @@ -505,7 +505,7 @@ static_cast( findObject( lcActEnableCameraId ) ); QObject::connect( changeCamera, SIGNAL(triggered()), - &view, SLOT(notSupported()) ); + &view, SLOT(changeCamera()) ); QObject::connect( disableCamera, SIGNAL(triggered()), &view, SLOT(disableCamera()) ); diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/src/lcvideowidget.cpp --- a/mmsharing/livecommsui/lcui/src/lcvideowidget.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/src/lcvideowidget.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -62,15 +62,15 @@ QPainter::CompositionMode origCompositionMode = painter->compositionMode(); painter->setCompositionMode(QPainter::CompositionMode_Source); - #if ( defined __WINSCW__ ) || ( defined __WINS__ ) - if( mLocalPlayer ){ - painter->setBrush(QColor(Qt::darkGreen)); - }else{ - painter->setBrush(QColor(Qt::darkRed)); - } - #else +#if ( defined __WINSCW__ ) || ( defined __WINS__ ) + if( mLocalPlayer ){ + painter->setBrush(QColor(Qt::darkGreen)); + }else{ + painter->setBrush(QColor(Qt::darkRed)); + } +#else painter->setBrush(QColor(0,0,0,0)); - #endif +#endif painter->drawRoundedRect( option->exposedRect, lcVideoWidgetCornerRounding, lcVideoWidgetCornerRounding); diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/src/lcview.cpp --- a/mmsharing/livecommsui/lcui/src/lcview.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/src/lcview.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include @@ -74,9 +74,9 @@ mEffectHandler(0), mItemContextMenu(0), mIsOptionMenuOpen(false), - mDialpad(0), + mDialpad(0), + mDialpadVtKeyHandler(0), timerId(0), - mDialpadVtKeyHandler(0), isViewReady(0) { LC_QDEBUG( "livecomms [UI] -> LcView::LcView()" ) @@ -215,6 +215,10 @@ SLOT( updateVideoRects() ), Qt::QueuedConnection ); } + //Subscribe to the Volume Change Events. + connect( &mEngine, SIGNAL(volumeChanged(int)), + this, SLOT(updateVolumeSlider(int)) ); + LC_QDEBUG( "livecomms [UI] <- LcView::init()" ) } @@ -291,10 +295,9 @@ // void LcView::activated() { - LC_QDEBUG( "livecomms [UI] -> LcView::activated()" ) + LC_QDEBUG( "livecomms [UI] -> LcView::activated()" ) + updateVideoRects(); - - //synchronize with engine if ( mEngine.mainCamera() ) { setCameraActionToSecondary(); @@ -313,7 +316,13 @@ } else { setSpeakerActionToSpeaker(); } - + + if( mEngine.isLocalPlayerPlaying() ){ + setCameraActionToDisable(); + } else { + setCameraActionToEnable(); + } + if ( mChangeCameraAction ) { connect( &mEngine, SIGNAL(cameraChangedToMain()), @@ -375,6 +384,14 @@ mEffectHandler, SLOT(showSendWindow()) ); connect( &mEngine, SIGNAL(localPlayerPaused()), mEffectHandler, SLOT(hideSendWindow()) ); + connect( &mEngine, SIGNAL(localPlayerPlaying()), + this, SLOT(setCameraActionToDisable())); + connect( &mEngine, SIGNAL(localPlayerPaused()), + this, SLOT(setCameraActionToEnable())); + connect( &mEngine, SIGNAL(localPlayerUnavailable()), + this, SLOT(setCameraActionToEnable())); + connect( &mEngine, SIGNAL(localPlayerPlaying()), + this, SLOT(updateVideoRects())); } if ( mReceivedVideoWidget ) { @@ -382,6 +399,8 @@ mEffectHandler, SLOT(showReceiveWindow()) ); connect( &mEngine, SIGNAL(remotePlayerPaused()), mEffectHandler, SLOT(hideReceiveWindow()) ); + connect( &mEngine, SIGNAL(remotePlayerPlaying()), + this, SLOT(updateVideoRects()) ); } mEngine.setCurrentView(this); @@ -1037,4 +1056,19 @@ LC_QDEBUG_2("livecomms [UI] - LcView::isPositioned(),",isViewReady) return isViewReady; } + + +// ----------------------------------------------------------------------------- +// LcView::updateVolumeSlider +// ----------------------------------------------------------------------------- +// +void LcView::updateVolumeSlider( int aVolumeLevel ) +{ + LC_QDEBUG("livecomms [UI] -> LcView::updateVolumeSlider()") + //TBD: Show volume slider, with update volume level + LC_QDEBUG_2("Volume Level Is,",aVolumeLevel) + LC_QDEBUG("livecomms [UI] <- LcView::updateVolumeSlider()") +} + + // End of file diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/src/lcviewmanager_p.cpp --- a/mmsharing/livecommsui/lcui/src/lcviewmanager_p.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/src/lcviewmanager_p.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -46,6 +46,7 @@ { // TODO: remove flag WindowFlagFixedHorizontal if portait layout // is going to be supported. + qApp->installEventFilter(this); } // ----------------------------------------------------------------------------- @@ -57,21 +58,23 @@ } // ----------------------------------------------------------------------------- -// LcMainWindow::event +// LcMainWindow::eventFilter // ----------------------------------------------------------------------------- // -bool LcMainWindow::event(QEvent *event) -{ - if ( event->type() == QEvent::FocusIn ){ - LC_QDEBUG( "livecomms [UI] -> LcMainWindow::event(), focus in" ) +bool LcMainWindow::eventFilter ( QObject * watched, QEvent * event ) +{ + if ( event->type() == QEvent::ApplicationActivate ){ + LC_QDEBUG( "livecomms [UI] -> LcMainWindow::eventFilter(), ApplicationActivate" ) emit appFocusGained(); - } else if ( event->type() == QEvent::FocusOut ){ - LC_QDEBUG( "livecomms [UI] -> LcMainWindow::event(), focus out" ) + } else if (( event->type() == QEvent::ApplicationDeactivate ) && + ( !this->windowSurface()) ){ + LC_QDEBUG( "livecomms [UI] -> LcMainWindow::eventFilter(), ApplicationDeactivate" ) emit appFocusLost(); } - return HbMainWindow::event(event); + return QObject::eventFilter(watched, event); } + // ----------------------------------------------------------------------------- // LcViewManagerPrivate::LcViewManagerPrivate // ----------------------------------------------------------------------------- @@ -102,12 +105,12 @@ { LC_QDEBUG( "livecomms [UI] -> LcViewManagerPrivate::~LcViewManagerPrivate()" ) + delete mEngine; QList views = mMainWindow.views(); foreach( HbView* view, views ){ mMainWindow.removeView(view); } - delete mRepository; - delete mEngine; + delete mRepository; LC_QDEBUG( "livecomms [UI] <- LcViewManagerPrivate::~LcViewManagerPrivate()" ) } diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ipvtengine/group/ipvtengineplugin.mmp --- a/mmsharing/livecommsui/lcui/tsrc/ipvtengine/group/ipvtengineplugin.mmp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ipvtengine/group/ipvtengineplugin.mmp Thu Sep 02 20:23:40 2010 +0300 @@ -54,20 +54,12 @@ LIBRARY euser.lib LIBRARY bafl.lib -LIBRARY inetprotutil.lib -LIBRARY phoneclient.lib LIBRARY centralrepository.lib -LIBRARY sipprofilecli.lib -LIBRARY sipclient.lib -LIBRARY sipcodec.lib -LIBRARY mceclient.lib -LIBRARY drmcommon.lib LIBRARY charconv.lib -LIBRARY telephonyaudiorouting.lib LIBRARY cntmodel.lib ecom.lib -LIBRARY ecam.lib LIBRARY ws32.lib LIBRARY bitgdi.lib LIBRARY fbscli.lib LIBRARY cone.lib +LIBRARY lcvtindicatorcontroller.lib DEBUGLIBRARY flogger.lib diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/lcvtindicatorcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/lcvtindicatorcontroller.h Thu Sep 02 20:23:40 2010 +0300 @@ -0,0 +1,39 @@ +/*! +* Copyright (c) 2010 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: Handles phone indicators. +*/ + +#ifndef LCVTINDICATORCONTROLLER_H_ +#define LCVTINDICATORCONTROLLER_H_ + +// FORWARD DECLARATION + +class LcVtIndicatorControllerImpl; + +class LcVtIndicatorController + { +public: + IMPORT_C explicit LcVtIndicatorController(); + IMPORT_C virtual ~LcVtIndicatorController(); + + IMPORT_C void enableActiveCallIndicator(); + IMPORT_C void disableActiveCallIndicator(); + +private: + LcVtIndicatorControllerImpl* mIndicatorimpl; + + friend class UT_LcVtIndicatorController; + }; + +#endif /* LCVTINDICATORCONTROLLER_H_ */ diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/musengmcesession.h --- a/mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/musengmcesession.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/musengmcesession.h Thu Sep 02 20:23:40 2010 +0300 @@ -28,6 +28,8 @@ #include +#include + // FORWARD DECLARATIONS class CContactTextField; @@ -283,6 +285,9 @@ * iBackground is set to EFalse */ TBool iBackground; + + // indicator control + LcVtIndicatorController* iIndicatorCtr; }; diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/musengsessionmanager.h --- a/mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/musengsessionmanager.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ipvtengine/inc/musengsessionmanager.h Thu Sep 02 20:23:40 2010 +0300 @@ -56,6 +56,12 @@ CMccDataReceiver* iMsgReceiver; CMccDataSender* iMsgSender; + private: // Constants + + static const int VTSETTING_ALWAYS_ASK_FIRST = 0; + static const int VTSETTING_DO_NOT_SHOW = 1; + static const int VTSETTING_SHOW_AUTOMATICALLY = 2; + }; #endif // CMUSENGSESSIONMANAGER_H diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ipvtengine/src/musengmcesession.cpp --- a/mmsharing/livecommsui/lcui/tsrc/ipvtengine/src/musengmcesession.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ipvtengine/src/musengmcesession.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -35,6 +35,7 @@ #include #include + #include "svptimer.h" RDrawableWindow* testWindow = 0; @@ -63,6 +64,9 @@ iTimer = CSVPTimer::NewL( *this, 1 ); iCameraHandler.SetSession( this ); + // indicator control + iIndicatorCtr = new ( ELeave ) LcVtIndicatorController(); + MUS_LOG( "mus: [ENGINE] <- CMusEngMceSession::ConstructL()" ) } @@ -78,6 +82,12 @@ delete iRemoteVideoPlayer; delete iLiveVideoPlayer; delete iScreen; + + if (iIndicatorCtr) + { + iIndicatorCtr->disableActiveCallIndicator(); + delete iIndicatorCtr; + } MUS_LOG( "mus: [ENGINE] <- CMusEngMceSession::~CMusEngMceSession()" ) } @@ -618,6 +628,14 @@ if ( iScreen ){ iScreen->Update(aIsForeground); } + + if ( aIsForeground ) + { + iIndicatorCtr->disableActiveCallIndicator(); + } + else { + iIndicatorCtr->enableActiveCallIndicator(); + } return KErrNone; } diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ipvtengine/src/musengsessionmanager.cpp --- a/mmsharing/livecommsui/lcui/tsrc/ipvtengine/src/musengsessionmanager.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ipvtengine/src/musengsessionmanager.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -23,7 +23,8 @@ #include "mccdatareceiver.h" #include "musenglogger.h" #include "mccdatastructures.h" - +#include +#include // ----------------------------------------------------------------------------- // @@ -94,10 +95,19 @@ // TBool CMusEngSessionManager::IsFeatureSupported( TLcFeature aLcFeature ) { - return ( aLcFeature == ELcSendVideoQuery ); + TBool ret = EFalse; + if ( ELcSendVideoQuery == aLcFeature ) + { + TInt videoSendingSetting; + CRepository* repository = CRepository::NewL( KCRUidTelephonySettings ); + if ( KErrNone == repository->Get(KSettingsVTVideoSending, videoSendingSetting) ) + { + if ( VTSETTING_ALWAYS_ASK_FIRST == videoSendingSetting ) + ret = ETrue; + } + delete repository; + } + return ret; } - - - // End of File diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ut_lcui/hbstubs/hbmainwindow.h --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/hbstubs/hbmainwindow.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/hbstubs/hbmainwindow.h Thu Sep 02 20:23:40 2010 +0300 @@ -23,6 +23,9 @@ #include class QGraphicsWidget; +class QWindowSurface + { + }; class HbAction; class HbView; @@ -44,12 +47,18 @@ void show(){}; QList views() const; QRectF sceneRect() const; + + //Overiding function for stub + QWindowSurface *windowSurface() const; private: // Data added for the unit testing stub - HbView* mCurrentView; // Not owned - int mViewCount; - Qt::Orientation mOrientation; - QList mTestViews; + HbView* mCurrentView; // Not owned + int mViewCount; + Qt::Orientation mOrientation; + QList mTestViews; + +public : + QWindowSurface *mSurface; }; #endif // HBMAINWINDOW_H diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ut_lcui/hbstubs/hbstubs.cpp --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/hbstubs/hbstubs.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/hbstubs/hbstubs.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -41,6 +41,7 @@ #include #include #include +#include #include // Helper Class @@ -276,6 +277,18 @@ return QRectF( 0, 0, 360, 640 ); } +// ----------------------------------------------------------------------------- +// HbMainWindow::windowSurface +// ----------------------------------------------------------------------------- +// +QWindowSurface* HbMainWindow::windowSurface() const +{ + return mSurface; +} + + + + // HbWidget // ----------------------------------------------------------------------------- diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ut_lcui/inc/ut_lcview.h --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/inc/ut_lcview.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/inc/ut_lcview.h Thu Sep 02 20:23:40 2010 +0300 @@ -105,9 +105,7 @@ LcView* mView; LcUiEngine* mEngine; HbLabel* mRecipient; - LcUiComponentRepository* mRepository; - HbAction* mAction; - HbAction* mAction2; + LcUiComponentRepository* mRepository; HbPushButton* mEndCallButton; }; diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ut_lcui/lcuiengine_stub/symbian/stub_lcuiengine_p.cpp --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/lcuiengine_stub/symbian/stub_lcuiengine_p.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/lcuiengine_stub/symbian/stub_lcuiengine_p.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -147,7 +147,7 @@ void LcUiEnginePrivate::setMainCamera(const bool aMainCamera) { - mMainCamera = aMainCamera; + mMainCamera = aMainCamera; } bool LcUiEnginePrivate::mainCamera() const @@ -354,7 +354,7 @@ void lcutStub_LcUiEngine_setMuted( bool val ) { - lcutStub_LcUiEngine_layout = val; + lcutStub_LcUiEngine_muted = val; } void lcutStub_LcUiEngine_setSpeaker( bool val ) @@ -394,6 +394,10 @@ lcutStub_LcUiEngine_localplaying = true; } +void LcUiEnginePrivate::volumeLevelChanged(const XQSettingsKey& /*aKey*/, const QVariant& /*aValue*/) +{ +} + // End of file diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/ut_lcview.cpp --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/ut_lcview.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/ut_lcview.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -72,8 +72,11 @@ mView = new LcView( *mEngine, *mRepository ); mView->mRecipient = mRecipient; mView->mEndCallButton = mEndCallButton; - mAction = new HbAction(); - mAction2 = new HbAction(); + mView->mChangeCameraAction = new HbAction(); + mView->mMuteAction = new HbAction(); + mView->mSpeakerAction = new HbAction(); + mView->mDisableCameraAction = new HbAction(); + mView->mDisableCameraMenuAction = new HbAction(); } void UT_LcView::cleanup() @@ -82,9 +85,7 @@ delete mRecipient; delete mView; delete mEngine; - delete mRepository; - delete mAction; - delete mAction2; + delete mRepository; delete mEndCallButton; } @@ -105,10 +106,6 @@ QVERIFY( lcutStub_LcUiEngine_expectCall( lcutStub_LcUiEngine_setContentAreas, 2 ) ); lcutStub_LcUiEngine_reset(); - mView->mChangeCameraAction = mAction; - mView->mMuteAction = mAction; - mView->mSpeakerAction = mAction; - mView->activated(); QVERIFY( lcutStub_LcUiEngine_expectCall( lcutStub_LcUiEngine_updateSession, 0 ) ); QVERIFY( lcutStub_LcUiEngine_expectCall( lcutStub_LcUiEngine_setOrientation, 1 ) ); @@ -123,6 +120,42 @@ QVERIFY( lcutStub_LcUiEngine_expectCall( lcutStub_LcUiEngine_updateSession, 0 ) ); QVERIFY( lcutStub_LcUiEngine_expectCall( lcutStub_LcUiEngine_setOrientation, 1 ) ); QVERIFY( lcutStub_LcUiEngine_expectCall( lcutStub_LcUiEngine_setContentAreas, 2 ) ); + + // normal scenario + lcutStub_LcUiEngine_reset(); + mView->mChangeCameraAction = new HbAction(); + mView->mMuteAction = new HbAction(); + mView->mSpeakerAction = new HbAction(); + mView->mDisableCameraAction = new HbAction(); + + mView->mEngine.setMainCamera( true ); + lcutStub_LcUiEngine_setMuted( true); + lcutStub_LcUiEngine_setSpeaker( true ); + lcutStub_LcUiEngine_setLocalPlaying( true ); + mView->activated(); + QVERIFY( mView->mChangeCameraAction ); + QVERIFY( mView->mChangeCameraAction->icon() == HbIcon( lcIconNameSecondaryCamera ) ); + QVERIFY( mView->mMuteAction ); + QVERIFY( mView->mMuteAction->icon() == HbIcon( lcIconNameUnmuteMic ) ); + QVERIFY( mView->mSpeakerAction ); + QVERIFY( mView->mSpeakerAction->icon() == HbIcon( lcIconNameHandset ) ); + QVERIFY( mView->mDisableCameraAction ); + QVERIFY( mView->mDisableCameraAction->icon() == HbIcon( lcIconNameDisableCamera ) ); + + // dude trust me , ofcourse not everything normal everytime + mView->mEngine.setMainCamera( false ); + lcutStub_LcUiEngine_setMuted( false ); + lcutStub_LcUiEngine_setSpeaker( false ); + lcutStub_LcUiEngine_setLocalPlaying( false ); + mView->activated(); + QVERIFY( mView->mChangeCameraAction ); + QVERIFY( mView->mChangeCameraAction->icon() == HbIcon( lcIconNameMainCamera ) ); + QVERIFY( mView->mMuteAction ); + QVERIFY( mView->mMuteAction->icon() == HbIcon( lcIconNameMuteMic ) ); + QVERIFY( mView->mSpeakerAction ); + QVERIFY( mView->mSpeakerAction->icon() == HbIcon( lcIconNameLoudspeaker ) ); + QVERIFY( mView->mDisableCameraAction ); + QVERIFY( mView->mDisableCameraAction->icon() == HbIcon( lcIconNameEnableCamera ) ); } void UT_LcView::testInit() @@ -157,11 +190,6 @@ void UT_LcView::testSetCameraActionToMain() { - mView->mChangeCameraAction = mAction; - mView->mMuteAction = mAction; - mView->mSpeakerAction = mAction; - mView->mDisableCameraAction = mAction; - mView->setCameraActionToMain(); QVERIFY( mView->mChangeCameraAction->text().isEmpty() ); QCOMPARE( mView->mChangeCameraAction->icon(), HbIcon(lcIconNameMainCamera) ); @@ -169,11 +197,6 @@ void UT_LcView::testSetCameraActionToSecondary() { - mView->mChangeCameraAction = mAction; - mView->mMuteAction = mAction; - mView->mSpeakerAction = mAction; - mView->mDisableCameraAction = mAction; - mView->setCameraActionToSecondary(); QVERIFY( mView->mChangeCameraAction->text().isEmpty() ); QCOMPARE( mView->mChangeCameraAction->icon(), HbIcon(lcIconNameSecondaryCamera) ); @@ -181,11 +204,6 @@ void UT_LcView::testSetMuteActionToUnmute() { - mView->mChangeCameraAction = mAction; - mView->mMuteAction = mAction; - mView->mSpeakerAction = mAction; - mView->mDisableCameraAction = mAction; - mView->setMuteActionToUnmute(); QVERIFY( mView->mMuteAction->text().isEmpty() ); QCOMPARE (mView->mMuteAction->icon(), HbIcon(lcIconNameUnmuteMic)); @@ -193,11 +211,6 @@ void UT_LcView::testSetMuteActionToMute() { - mView->mChangeCameraAction = mAction; - mView->mMuteAction = mAction; - mView->mSpeakerAction = mAction; - mView->mDisableCameraAction = mAction; - mView->setMuteActionToMute(); QVERIFY( mView->mMuteAction->text().isEmpty() ); QCOMPARE (mView->mMuteAction->icon(), HbIcon(lcIconNameMuteMic)); @@ -205,11 +218,6 @@ void UT_LcView::testSetSpeakerActionToHandset() { - mView->mChangeCameraAction = mAction; - mView->mMuteAction = mAction; - mView->mSpeakerAction = mAction; - mView->mDisableCameraAction = mAction; - mView->setSpeakerActionToHandset(); QVERIFY( mView->mSpeakerAction->text().isEmpty() ); QCOMPARE( mView->mSpeakerAction->icon(), HbIcon(lcIconNameHandset) ); @@ -217,11 +225,6 @@ void UT_LcView::testSetSpeakerActionToSpeaker() { - mView->mChangeCameraAction = mAction; - mView->mMuteAction = mAction; - mView->mSpeakerAction = mAction; - mView->mDisableCameraAction = mAction; - mView->setSpeakerActionToSpeaker(); QVERIFY( mView->mSpeakerAction->text().isEmpty() ); QCOMPARE( mView->mSpeakerAction->icon(), HbIcon(lcIconNameLoudspeaker) ); @@ -230,23 +233,13 @@ void UT_LcView::testSetCameraActionToEnable() { mView->setCameraActionToEnable(); - - mView->mDisableCameraAction = mAction; - mView->mDisableCameraMenuAction = mAction2; - - mView->setCameraActionToEnable(); QVERIFY( mView->mDisableCameraAction->text().isEmpty() ); QCOMPARE( mView->mDisableCameraAction->icon(), HbIcon(lcIconNameEnableCamera) ); QCOMPARE( mView->mDisableCameraMenuAction->text(), hbTrId( "txt_vt_menu_enable_camera" ) ); } void UT_LcView::testSetCameraActionToDisable() -{ - mView->setCameraActionToDisable(); - - mView->mDisableCameraAction = mAction; - mView->mDisableCameraMenuAction = mAction2; - +{ mView->setCameraActionToDisable(); QVERIFY( mView->mDisableCameraAction->text().isEmpty() ); QCOMPARE( mView->mDisableCameraAction->icon(), HbIcon(lcIconNameDisableCamera) ); diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/ut_lcviewmanager.cpp --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/ut_lcviewmanager.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/ut_lcviewmanager.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -166,19 +166,30 @@ QSignalSpy spy( &mViewManager->mMainWindow, SIGNAL(appFocusGained()) ); // Not interesting event QEvent event(QEvent::MaxUser); - mViewManager->mMainWindow.event(&event); + mViewManager->mMainWindow.eventFilter(0, &event); QVERIFY( spy.count() == 0 ); // Focus in event - QEvent event2(QEvent::FocusIn); - mViewManager->mMainWindow.event(&event2); + QEvent event2(QEvent::ApplicationActivate); + mViewManager->mMainWindow.eventFilter(0, &event2); QVERIFY( spy.count() == 1 ); - + + // test: Complete focus lost QSignalSpy spy2( &mViewManager->mMainWindow, SIGNAL(appFocusLost()) ); // Focus in event - QEvent event3(QEvent::FocusOut); - mViewManager->mMainWindow.event(&event3); + QEvent event3(QEvent::ApplicationDeactivate); + mViewManager->mMainWindow.mSurface = 0; + mViewManager->mMainWindow.eventFilter(0, &event3); QVERIFY( spy2.count() == 1 ); + + // test: partial focus lost i.e. in case of golbal popup. + QSignalSpy spy3( &mViewManager->mMainWindow, SIGNAL(appFocusLost()) ); + // Partial focus in event i.e. Global popup + QEvent event4(QEvent::ApplicationDeactivate); + QWindowSurface surf; + mViewManager->mMainWindow.mSurface = &surf; + mViewManager->mMainWindow.eventFilter(0, &event4); + QVERIFY( spy3.count() == 0 ); } // end of file diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcui/tsrc/ut_lcui/ut_lcui.pro --- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/ut_lcui.pro Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/ut_lcui.pro Thu Sep 02 20:23:40 2010 +0300 @@ -31,9 +31,9 @@ DEFINES += QT_NO_DEBUG_OUTPUT DEPENDPATH += . +INCLUDEPATH = hbstubs $$INCLUDEPATH INCLUDEPATH += . INCLUDEPATH += $$LCUI_DIR/inc -INCLUDEPATH += hbstubs INCLUDEPATH += $$MUS_DIR/tsrc/qtestutils/inc INCLUDEPATH += $$MUS_DIR/mmsharinguis_plat/live_comms_plugin_api/inc INCLUDEPATH += /epoc32/include/ecom diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/inc/lcuiengine.h --- a/mmsharing/livecommsui/lcuiengine/inc/lcuiengine.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/inc/lcuiengine.h Thu Sep 02 20:23:40 2010 +0300 @@ -123,6 +123,8 @@ void remotePlayerPaused(); void localPlayerUnavailable(); void remotePlayerUnavailable(); + void volumeChanged(int aVolumeLevel); + public slots: @@ -166,7 +168,6 @@ void shareCamera(); void setCurrentView(HbView* view); bool SendDialTone( const QChar aKey ); - private: diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/inc/lcuiengine_p.h --- a/mmsharing/livecommsui/lcuiengine/inc/lcuiengine_p.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/inc/lcuiengine_p.h Thu Sep 02 20:23:40 2010 +0300 @@ -25,9 +25,13 @@ #include #include #include +#include +#include +#include #include #include + class MLcSession; class MLcAudioControl; class MLcZoomControl; @@ -109,6 +113,7 @@ void startReceiving(); void stopForcefully(); void handleEngineForegroundStatus(); + void volumeLevelChanged(const XQSettingsKey& aKey, const QVariant& aValue); private: // From MLcSessionObserver @@ -151,8 +156,12 @@ void stopSessionDurationTimer(); void fillRemoteInfo(bool informChanges); void startStopGuardTimer(); - bool isAllowedToShareVideo(); - int vtVideoSendingSetting(); + void showSendVideoQueryWhenNecessary(); + + void subscribeVolumeEvents(); + void unSubscribeVolumeEvents(); + void doUpdate( MLcVideoPlayer& aPlayer ); + void doUpdate( MLcSession& aSession ); private: // New functions wrapping the leaving functions in LC plug-in API @@ -193,11 +202,9 @@ TRect mRemoteRect; LcActivityManager* mActivityManager; -private: // Constants - - static const int VTSETTING_ALWAYS_ASK_FIRST = 0; - static const int VTSETTING_DO_NOT_SHOW = 1; - static const int VTSETTING_SHOW_AUTOMATICALLY = 2; + XQSettingsManager* mSettingsMgr; + XQSettingsKey* mEarVolumeKey; + XQSettingsKey* mLoudSpeakerKey; friend class LcUiEngine; }; diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/src/lcuiengine_p.cpp --- a/mmsharing/livecommsui/lcuiengine/src/lcuiengine_p.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/src/lcuiengine_p.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -51,8 +51,7 @@ #include #include #include - - +#include #define LC_VTPLUGIN_NAME "Videotelephony"; @@ -81,7 +80,10 @@ mIsMinimized(false), mFirstForegroundSwitch(true), mCurrentView(0), - mActivityManager(0) + mActivityManager(0), + mSettingsMgr(0), + mEarVolumeKey(0), + mLoudSpeakerKey(0) { LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::LcUiEnginePrivate()" ) @@ -118,6 +120,14 @@ } mActivityManager = new LcActivityManager; + + mSettingsMgr = new XQSettingsManager(this); + mEarVolumeKey = new XQSettingsKey(XQSettingsKey::TargetCentralRepository, + KCRUidInCallVolume.iUid, KTelIncallEarVolume); + mLoudSpeakerKey = new XQSettingsKey(XQSettingsKey::TargetCentralRepository, + KCRUidInCallVolume.iUid,KTelIncallLoudspeakerVolume); + + subscribeVolumeEvents(); LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::LcUiEnginePrivate()" ) } @@ -129,6 +139,11 @@ LcUiEnginePrivate::~LcUiEnginePrivate() { LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::~LcUiEnginePrivate()" ) + + unSubscribeVolumeEvents(); + delete mEarVolumeKey; + delete mLoudSpeakerKey; + delete mLiveCommsEngine; delete mCloseTimer; delete mActivityManager; @@ -171,11 +186,12 @@ startStopGuardTimer(); int err = terminateSession(); - - if ( !err && session().LcSessionState() == MLcSession::EClosing ) { - LC_QDEBUG( "livecomms [UI] not closing UI yet, waiting for session termination..." ) - } else { - LC_QDEBUG( "livecomms [UI] closing UI..." ) + LC_QDEBUG_2( "livecomms [UI] terminateSession error = ", err ) + // if there is an error in terminating session + // or session state is already closed , stop ui + // else wait for session state events. + if( err || session().LcSessionState() == MLcSession::EClosed ){ + LC_QDEBUG( "livecomms [UI] closing ui... ") emit mUiEngine.stopped(); } LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::stop()" ) @@ -609,41 +625,7 @@ void LcUiEnginePrivate::StateChanged( MLcSession& aSession ) { LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( session )" ) - - MLcSession::TLcSessionState newState = MLcSession::EUninitialized; - newState = aSession.LcSessionState(); - - LC_QDEBUG_2( "livecomms [UI] new state=", newState ) - - if ( newState == MLcSession::EOpen ) { - LC_QDEBUG( "livecomms [UI] state is MLcSession::EOpen" ) - cancelCloseTimer(); - hideNotes( false ); - if( isAllowedToShareVideo() ) { - startLocalVideo(); - } - startRemoteVideo(); - fillRemoteInfo( true ); - emitViewLayoutChanged(); - startSessionDurationTimer(); - - } else if ( newState == MLcSession::EReceived ) { - LC_QDEBUG( "livecomms [UI] state is MLcSession::EReceived" ) - mRecipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); - if ( mAcceptQuery && - featureSupported( CLcEngine::ELcShowAcceptQuery ) ) { - mAcceptQuery->show(); - } else { - startReceiving(); - } - } else if ( newState == MLcSession::EClosed ) { - LC_QDEBUG( "livecomms [UI] state is MLcSession::EClosed, closing UI..." ) - emit mUiEngine.stopped(); - - } else if ( newState == MLcSession::EOpening ){ - LC_QDEBUG( "livecomms [UI] state is MLcSession::EOpening" ) - } - + doUpdate( aSession ); LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( session )" ) } @@ -653,50 +635,9 @@ // void LcUiEnginePrivate::StateChanged( MLcVideoPlayer& aPlayer ) { - LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( player )" ) - + LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( player )" ) emitViewLayoutChanged(); - - if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPlaying ) { - if ( &aPlayer == session().RemoteVideoPlayer() ) { - if ( mWaitingNote ) { - mWaitingNote->hide(); - } - emit mUiEngine.remotePlayerPlaying(); - } - if ( &aPlayer == session().LocalVideoPlayer() ) { - emit mUiEngine.localPlayerPlaying(); - } - } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPreparing ) { - if ( &aPlayer == session().RemoteVideoPlayer() ) { - emit mUiEngine.remotePlayerPreparing(); - } - if ( &aPlayer == session().LocalVideoPlayer() ) { - emit mUiEngine.localPlayerPreparing(); - } - } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EBuffering ) { - if ( &aPlayer == session().RemoteVideoPlayer() ) { - emit mUiEngine.remotePlayerBuffering(); - } - if ( &aPlayer == session().LocalVideoPlayer() ) { - emit mUiEngine.localPlayerBuffering(); - } - } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPaused ) { - if ( &aPlayer == session().RemoteVideoPlayer() ) { - emit mUiEngine.remotePlayerPaused(); - } - if ( &aPlayer == session().LocalVideoPlayer() ) { - emit mUiEngine.localPlayerPaused(); - } - } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EUnavailable ) { - if ( &aPlayer == session().RemoteVideoPlayer() ) { - emit mUiEngine.remotePlayerUnavailable(); - } - if ( &aPlayer == session().LocalVideoPlayer() ) { - emit mUiEngine.localPlayerUnavailable(); - } - } - + doUpdate( aPlayer ); LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( player )" ) } @@ -704,10 +645,11 @@ // LcUiEnginePrivate::Updated // ----------------------------------------------------------------------------- // -void LcUiEnginePrivate::Updated( MLcSession& /*aSession*/ ) +void LcUiEnginePrivate::Updated( MLcSession& aSession ) { LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( session )" ) emitViewLayoutChanged(); + doUpdate( aSession ); LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( session )" ) } @@ -715,10 +657,11 @@ // LcUiEnginePrivate::Updated // ----------------------------------------------------------------------------- // -void LcUiEnginePrivate::Updated( MLcVideoPlayer& /*aPlayer*/ ) +void LcUiEnginePrivate::Updated( MLcVideoPlayer& aPlayer ) { LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( player )" ) emitViewLayoutChanged(); + doUpdate( aPlayer ); LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( player )" ) } @@ -1419,40 +1362,14 @@ // LcUiEnginePrivate::isAllowedToShareVideo // ----------------------------------------------------------------------------- // -bool LcUiEnginePrivate::isAllowedToShareVideo() +void LcUiEnginePrivate::showSendVideoQueryWhenNecessary() { - LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::isAllowedToShareVideo()" ) - if (!featureSupported( CLcEngine::ELcSendVideoQuery )) //outgoing videocall - return true; - else { //incoming videocall - int ownVtVideoSendingSetting = vtVideoSendingSetting(); - if (VTSETTING_SHOW_AUTOMATICALLY == ownVtVideoSendingSetting) - return true; - else if (VTSETTING_DO_NOT_SHOW == ownVtVideoSendingSetting) - return false; - else { - if (mShareOwnVideoQuery) - mShareOwnVideoQuery->show(); - return false; - } + LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::showSendVideoQueryWhenNecessary()" ) + if (featureSupported( CLcEngine::ELcSendVideoQuery )) { + if (mShareOwnVideoQuery) + mShareOwnVideoQuery->show(); } - LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::isAllowedToShareVideo()" ) -} - -// ----------------------------------------------------------------------------- -// LcUiEnginePrivate::vtVideoSendingSetting -// ----------------------------------------------------------------------------- -// -int LcUiEnginePrivate::vtVideoSendingSetting() -{ - LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::vtVideoSendingSetting()" ) - XQSettingsManager settings; - XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, - KCRUidTelephonySettings.iUid, - KSettingsVTVideoSending); - QVariant ownVtVideoSendingSetting = settings.readItemValue(settingsKey); - LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::vtVideoSendingSetting()" ) - return ownVtVideoSendingSetting.toInt(); + LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::showSendVideoQueryWhenNecessary()" ) } // ----------------------------------------------------------------------------- @@ -1485,4 +1402,146 @@ } LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startLocalVideo()" ) } + +// ----------------------------------------------------------------------------- +// LcUiEnginePrivate::subscribeVolumeEvents +// ----------------------------------------------------------------------------- +// + +void LcUiEnginePrivate::subscribeVolumeEvents() +{ + LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::subscribeVolumeEvents()" ) + mSettingsMgr->startMonitoring( *mEarVolumeKey, XQSettingsManager::TypeInt ); + mSettingsMgr->startMonitoring( *mLoudSpeakerKey, XQSettingsManager::TypeInt ); + connect(mSettingsMgr, + SIGNAL(valueChanged(const XQSettingsKey&, const QVariant&)), + this, SLOT(volumeLevelChanged(const XQSettingsKey&, const QVariant&))); + LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::subscribeVolumeEvents()" ) +} + + +// ----------------------------------------------------------------------------- +// LcUiEnginePrivate::unSubscribeVolumeEvents +// ----------------------------------------------------------------------------- +// +void LcUiEnginePrivate::unSubscribeVolumeEvents() +{ + LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::unSubscribeVolumeEvents()") + mSettingsMgr->stopMonitoring( *mEarVolumeKey ); + mSettingsMgr->stopMonitoring( *mLoudSpeakerKey ); + disconnect(mSettingsMgr, + SIGNAL( valueChanged(const XQSettingsKey&, const QVariant& ) ), + this, SLOT(volumeLevelChanged(const XQSettingsKey&, const QVariant&))); + LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::unSubscribeVolumeEvents()" ) +} + + +// ----------------------------------------------------------------------------- +// LcUiEnginePrivate::volumeLevelChanged +// ----------------------------------------------------------------------------- +// + +void LcUiEnginePrivate::volumeLevelChanged( const XQSettingsKey& aKey, + const QVariant& aValue ) +{ + LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::volumeLevelChanged()" ) + + // Ensure We only send value for the valid keys. + if ((aKey.key() == mEarVolumeKey->key() && aKey.uid() == mEarVolumeKey->uid()) || + (aKey.key() == mLoudSpeakerKey->key() && aKey.uid() == mLoudSpeakerKey->uid()) ) { + + emit mUiEngine.volumeChanged( aValue.toInt() ); + } + LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::volumeLevelChanged()" ) +} + +// ----------------------------------------------------------------------------- +// LcUiEnginePrivate::doUpdate( MLcVideoPlayer& aPlayer ) +// ----------------------------------------------------------------------------- +// + +void LcUiEnginePrivate::doUpdate( MLcVideoPlayer& aPlayer ) +{ + LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::doUpdate(), videoplayer" ) + if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPlaying ) { + if ( &aPlayer == session().RemoteVideoPlayer() ) { + if ( mWaitingNote ) { + mWaitingNote->hide(); + } + emit mUiEngine.remotePlayerPlaying(); + } + if ( &aPlayer == session().LocalVideoPlayer() ) { + emit mUiEngine.localPlayerPlaying(); + } + } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPreparing ) { + if ( &aPlayer == session().RemoteVideoPlayer() ) { + emit mUiEngine.remotePlayerPreparing(); + } + if ( &aPlayer == session().LocalVideoPlayer() ) { + emit mUiEngine.localPlayerPreparing(); + } + } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EBuffering ) { + if ( &aPlayer == session().RemoteVideoPlayer() ) { + emit mUiEngine.remotePlayerBuffering(); + } + if ( &aPlayer == session().LocalVideoPlayer() ) { + emit mUiEngine.localPlayerBuffering(); + } + } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPaused ) { + if ( &aPlayer == session().RemoteVideoPlayer() ) { + emit mUiEngine.remotePlayerPaused(); + } + if ( &aPlayer == session().LocalVideoPlayer() ) { + emit mUiEngine.localPlayerPaused(); + } + } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EUnavailable ) { + if ( &aPlayer == session().RemoteVideoPlayer() ) { + emit mUiEngine.remotePlayerUnavailable(); + } + if ( &aPlayer == session().LocalVideoPlayer() ) { + emit mUiEngine.localPlayerUnavailable(); + } + } + LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::doUpdate(),videoplayer" ) +} + +// ----------------------------------------------------------------------------- +// LcUiEnginePrivate::doUpdate( MLcSession& aSession ) +// ----------------------------------------------------------------------------- +// + +void LcUiEnginePrivate::doUpdate( MLcSession& aSession ) +{ + LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::doUpdate(),session" ) + MLcSession::TLcSessionState newState = MLcSession::EUninitialized; + newState = aSession.LcSessionState(); + LC_QDEBUG_2( "livecomms [UI] session state = ", newState ) + if ( newState == MLcSession::EOpen ) { + LC_QDEBUG( "livecomms [UI] session state is MLcSession::EOpen" ) + cancelCloseTimer(); + hideNotes( false ); + showSendVideoQueryWhenNecessary(); + startRemoteVideo(); + fillRemoteInfo( true ); + emitViewLayoutChanged(); + startSessionDurationTimer(); + + } else if ( newState == MLcSession::EReceived ) { + LC_QDEBUG( "livecomms [UI] state state is MLcSession::EReceived" ) + mRecipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); + if ( mAcceptQuery && + featureSupported( CLcEngine::ELcShowAcceptQuery ) ) { + mAcceptQuery->show(); + } else { + startReceiving(); + } + } else if ( newState == MLcSession::EClosed ) { + LC_QDEBUG( "livecomms [UI] state state is MLcSession::EClosed, closing UI..." ) + emit mUiEngine.stopped(); + + } else if ( newState == MLcSession::EOpening ){ + LC_QDEBUG( "livecomms [UI] state state is MLcSession::EOpening" ) + } + LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::doUpdate(),session" ) +} // End of File diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/inc/ut_lcuiengine.h --- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/inc/ut_lcuiengine.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/inc/ut_lcuiengine.h Thu Sep 02 20:23:40 2010 +0300 @@ -89,15 +89,11 @@ void testIsMinimized(); void testHandleForegroundStatus(); void testSendDialTone(); - void testVtVideoSendingSetting(); void testShareVideoIsAllowedShownAutomatically(); void testShareVideoIsNotAllowedShown(); - void testShareVideoPermissionAskedAlways(); + void testShareVideoPermissionAskedAlways(); + void testVolumeLevelChanged(); -private: // utility functions - - bool setVtVideoSendingSetting(int key); - private: LcUiEngine* mEngine; diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcenginestub.cpp --- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcenginestub.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcenginestub.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -89,8 +89,6 @@ // TBool CLcEngineStub::IsFeatureSupported( TLcFeature aLcFeature ) { - if (ELcSendVideoQuery == aLcFeature) - return true; return lcutStub_LcEngine_lcFeatureSupported; } diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcsessionstub.cpp --- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcsessionstub.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcsessionstub.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -28,7 +28,7 @@ #include -static QStringList lcutStub_LcSession_calledMethods = 0; +static QStringList lcutStub_LcSession_calledMethods; static MLcUiProvider* lcutStub_LcSession_uiProvider = 0; // ----------------------------------------------------------------------------- diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcvideoplayerstub.cpp --- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcvideoplayerstub.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcvideoplayerstub.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -29,7 +29,7 @@ #include -static QStringList lcutStub_LcPlayer_calledMethods = 0; +static QStringList lcutStub_LcPlayer_calledMethods; static bool lcutStub_LcPlayer_asyncCompletionEnabled = false; // ----------------------------------------------------------------------------- diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/src/ut_lcuiengine.cpp --- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/src/ut_lcuiengine.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/src/ut_lcuiengine.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -40,6 +40,7 @@ #include #include #include +#include const char lcutMultimediaSharingEng[] = "MultimediaSharing"; const char lcutVideotelephonyEng[] = "Videotelephony"; @@ -418,7 +419,7 @@ QVERIFY( mEngine->d->mShareOwnVideoQuery ); QVERIFY( mEngine->d->mShareOwnVideoQuery->isVisible() ); CLcVideoPlayer* localPlayer = LC_SESSION( mEngine )->iLocalPlayer; - //QVERIFY( localPlayer->iState == MLcVideoPlayer::EPaused ); + localPlayer = 0; // MO call and sharing own video allowed by default , popup query not shown lcutStub_LcSession_reset(); @@ -430,8 +431,6 @@ mEngine->d->StateChanged( *LC_SESSION( mEngine ) ); QVERIFY( mEngine->d->mShareOwnVideoQuery ); QVERIFY( !mEngine->d->mShareOwnVideoQuery->isVisible() ); - localPlayer = LC_SESSION( mEngine )->iLocalPlayer; - QVERIFY( localPlayer->iState == MLcVideoPlayer::EPlaying ); } @@ -834,9 +833,9 @@ void UT_LcUiEngine::testStop() { - // Ensure that in MLcSession::EClosing state, "stopped" signal won't be emited + // Ensure that in MLcSession::EOpen state, "stopped" signal won't be emited // Check also that session duration timer is stopped - LC_SESSION( mEngine )->iState = MLcSession::EClosing; + LC_SESSION( mEngine )->iState = MLcSession::EOpen; mEngine->d->startSessionDurationTimer(); QVERIFY( mEngine->d->mSessionDurationTimerId != 0 ); QSignalSpy spy(mEngine, SIGNAL(stopped())); @@ -848,11 +847,10 @@ QCOMPARE( spy.count(), 0 ); QVERIFY( mEngine->d->mSessionDurationTimerId == 0 ); - // Ensure that any other state than MLcSession::EClosing, will cause emition - // of "stopped" signal + // Ensure that MLcSession::EClosed, will cause emition of "stopped" signal lcutStub_LcSession_reset(); lcutStub_LcPlayer_reset(); - LC_SESSION( mEngine )->iState = MLcSession::EInitialized; + LC_SESSION( mEngine )->iState = MLcSession::EClosed; mEngine->d->stop(); QVERIFY( lcutStub_LcSession_expectCall( lcutStub_LcSession_terminateSession ) ); QVERIFY( lcutStub_LcPlayer_expectCall( lcutStub_LcPlayer_NoCall ) ); @@ -1206,57 +1204,73 @@ } -void UT_LcUiEngine::testVtVideoSendingSetting() -{ - int settingsKeyValueDoNotShow = 1; - if (!setVtVideoSendingSetting(settingsKeyValueDoNotShow)) - QFAIL("Writing test key to central repository failed."); - QCOMPARE(mEngine->d->vtVideoSendingSetting(), settingsKeyValueDoNotShow); -} - - void UT_LcUiEngine::testShareVideoIsAllowedShownAutomatically() { + lcutStub_LcEngine_setLcFeatureSupported( false ); mShareOwnVideoQuery->hide(); mEngine->d->setUiComponents(mInvitingNote,mWaitingNote,mAcceptQuery,mRecipientQuery,mShareOwnVideoQuery); - int settingsKeyValueShowAutomatically = 2; - if (!setVtVideoSendingSetting(settingsKeyValueShowAutomatically)) - QFAIL("Writing test key to central repository failed."); - QVERIFY(mEngine->d->isAllowedToShareVideo()); + mEngine->d->showSendVideoQueryWhenNecessary(); QVERIFY(mEngine->d->mShareOwnVideoQuery && !mEngine->d->mShareOwnVideoQuery->isVisible()); } void UT_LcUiEngine::testShareVideoIsNotAllowedShown() { + lcutStub_LcEngine_setLcFeatureSupported( false ); mShareOwnVideoQuery->hide(); mEngine->d->setUiComponents(mInvitingNote,mWaitingNote,mAcceptQuery,mRecipientQuery,mShareOwnVideoQuery); - int settingsKeyValueDoNotShow = 1; - if (!setVtVideoSendingSetting(settingsKeyValueDoNotShow)) - QFAIL("Writing test key to central repository failed."); - QVERIFY(!mEngine->d->isAllowedToShareVideo()); + mEngine->d->showSendVideoQueryWhenNecessary(); QVERIFY(mEngine->d->mShareOwnVideoQuery && !mEngine->d->mShareOwnVideoQuery->isVisible()); } void UT_LcUiEngine::testShareVideoPermissionAskedAlways() { + lcutStub_LcEngine_setLcFeatureSupported( true ); mShareOwnVideoQuery->hide(); mEngine->d->setUiComponents(mInvitingNote,mWaitingNote,mAcceptQuery,mRecipientQuery,mShareOwnVideoQuery); - int settingsKeyValueAlwaysAsk = 0; - if (!setVtVideoSendingSetting(settingsKeyValueAlwaysAsk)) - QFAIL("Writing test key to central repository failed."); - QVERIFY(!mEngine->d->isAllowedToShareVideo()); + mEngine->d->showSendVideoQueryWhenNecessary(); QVERIFY(mEngine->d->mShareOwnVideoQuery && mEngine->d->mShareOwnVideoQuery->isVisible()); } -bool UT_LcUiEngine::setVtVideoSendingSetting(int key) +void UT_LcUiEngine::testVolumeLevelChanged() { - QVariant settingsKeyValue(key); - XQSettingsManager settings; - XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, - KCRUidTelephonySettings.iUid, - KSettingsVTVideoSending); - return settings.writeItemValue(settingsKey, settingsKeyValue); + // Subscribe to the events. + mEngine->d->subscribeVolumeEvents(); + + QSignalSpy spy(mEngine, SIGNAL(volumeChanged(int))); + QCOMPARE( spy.count(), 0 ); + + + //Test1: Known Key Event handled + QVariant value; + value.setValue(5); + + XQSettingsKey validKey1(XQSettingsKey::TargetCentralRepository, + KCRUidInCallVolume.iUid, KTelIncallEarVolume); + mEngine->d->volumeLevelChanged(validKey1, value); + QCOMPARE( spy.count(), 1 ); + spy.clear(); + + + //Test2: Known Key Event-2 handled + XQSettingsKey validKey2(XQSettingsKey::TargetCentralRepository, + KCRUidInCallVolume.iUid,KTelIncallLoudspeakerVolume); + mEngine->d->volumeLevelChanged(validKey2, value); + QCOMPARE( spy.count(), 1 ); + spy.clear(); + + //Test3: Unknow Key Event Ignored. + XQSettingsKey unKnownKey(XQSettingsKey::TargetCentralRepository, + 787,899); + mEngine->d->volumeLevelChanged(unKnownKey, value); + QCOMPARE( spy.count(), 0 ); + + // Un-Subscribe Events. + mEngine->d->unSubscribeVolumeEvents(); } + + + +// End of file diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/livecommsui/livecommsui.pro --- a/mmsharing/livecommsui/livecommsui.pro Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/livecommsui/livecommsui.pro Thu Sep 02 20:23:40 2010 +0300 @@ -22,6 +22,14 @@ LCUI_DIR = lcui LCUIENGINE_DIR = lcuiengine +DOCML_DIR = lcui/resources/lcviews + +DOCML += $$DOCML_DIR/lcidleview.docml +DOCML += $$DOCML_DIR/lcreceiveview.docml +DOCML += $$DOCML_DIR/lcreceiveonlyview.docml +DOCML += $$DOCML_DIR/lcsendview.docml +DOCML += $$DOCML_DIR/lctwowayview.docml +DOCML += $$DOCML_DIR/lcvtview.docml RESOURCES += $$LCUI_DIR/livecommsui.qrc @@ -49,7 +57,6 @@ DEPLOYMENT += libFiles symbian: { - DOCML_DIR = lcui/resources/lcviews INCLUDEPATH += /epoc32/include/ecom INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE @@ -85,12 +92,6 @@ MMP_RULES += defFiles :BLD_INF_RULES.prj_exports += "$$LCUI_DIR/inc/lcviewmanager.h /epoc32/include/lcviewmanager.h" - :BLD_INF_RULES.prj_exports += "$$LCUI_DIR/inc/lcexport.h /epoc32/include/lcexport.h" - :BLD_INF_RULES.prj_exports += "$$DOCML_DIR/lcidleview.docml z:/data/others/lcidleview.docml" - :BLD_INF_RULES.prj_exports += "$$DOCML_DIR/lcreceiveView.docml z:/data/others/lcreceiveview.docml" - :BLD_INF_RULES.prj_exports += "$$DOCML_DIR/lcsendview.docml z:/data/others/lcsendview.docml" - :BLD_INF_RULES.prj_exports += "$$DOCML_DIR/lctwowayview.docml z:/data/others/lctwowayview.docml" - :BLD_INF_RULES.prj_exports += "$$DOCML_DIR/lcvtview.docml z:/data/others/lcvtview.docml" - :BLD_INF_RULES.prj_exports += "$$DOCML_DIR/lcreceiveonlyView.docml z:/data/others/lcreceiveonlyview.docml" + :BLD_INF_RULES.prj_exports += "$$LCUI_DIR/inc/lcexport.h /epoc32/include/lcexport.h" } diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/mmshmanagercli/inc/musmanagerclientsession.h --- a/mmsharing/mmshmanagercli/inc/musmanagerclientsession.h Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/mmshmanagercli/inc/musmanagerclientsession.h Thu Sep 02 20:23:40 2010 +0300 @@ -81,6 +81,8 @@ private: // data TVersion Version() const; + + TRequestStatus iSessionCreationStatus; }; diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/mmshmanagercli/src/musmanagerclientsession.cpp --- a/mmsharing/mmshmanagercli/src/musmanagerclientsession.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/mmshmanagercli/src/musmanagerclientsession.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -31,8 +31,10 @@ */ #define ASYNCHRONOUS_MESSAGE_SLOTS 255 +const TInt KMusServerSessionCreationWaitTimeoutInMicrosecs = 10000000; // 10 secs + // ======== LOCAL FUNCTIONS ======== - + // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- @@ -40,21 +42,49 @@ RMusManagerClientSession::RMusManagerClientSession() : RSessionBase () { - } + // --------------------------------------------------------------------------- -// +// Use timeout mechanism for session creation as otherwise it can block +// so long that WServ terminates the process. There's no way to cancel +// session creation other than destuction of client session. Therefore, in case +// of timeout, leave and let creation finish silently or get canceled when +// user of client session object deletes us. // --------------------------------------------------------------------------- // void RMusManagerClientSession::ConnectL() { - MUS_LOG( "mus: [MUSCLI] -> RMusManagerClientSession::ConnectL()" ); - TRequestStatus s; + MUS_LOG( "mus: [MUSCLI] -> RMusManagerClientSession::ConnectL(), with timeout" ); + + if ( iSessionCreationStatus.Int() == KRequestPending ) + { + // Previous creation still pending + User::Leave( KErrNotReady ); + } + + RTimer timer; + CleanupClosePushL( timer ); + User::LeaveIfError( timer.CreateLocal() ); + User::LeaveIfError( CreateSession( KMusManagerServerName(), Version(), - ASYNCHRONOUS_MESSAGE_SLOTS, &s ) ); - - User::WaitForRequest( s ); + ASYNCHRONOUS_MESSAGE_SLOTS, &iSessionCreationStatus) ); + TRequestStatus timeoutStatus; + timer.After( timeoutStatus, KMusServerSessionCreationWaitTimeoutInMicrosecs ); + User::WaitForRequest( iSessionCreationStatus, timeoutStatus ); + if ( timeoutStatus.Int() != KRequestPending ) + { + MUS_LOG( "mus: [MUSCLI] RMusManagerClientSession::ConnectL, timeout" ); + User::Leave( KErrTimedOut ); + } + else + { + MUS_LOG( "mus: [MUSCLI] RMusManagerClientSession::ConnectL, no timeout" ); + timer.Cancel(); + User::WaitForRequest( timeoutStatus ); + } + CleanupStack::PopAndDestroy( &timer ); + MUS_LOG( "mus: [MUSCLI] <- RMusManagerClientSession::ConnectL()" ); } diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/mmshmanagercli/src/musmanagerserverstarter.cpp --- a/mmsharing/mmshmanagercli/src/musmanagerserverstarter.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/mmshmanagercli/src/musmanagerserverstarter.cpp Thu Sep 02 20:23:40 2010 +0300 @@ -21,6 +21,8 @@ #include "musmanageripccommon.h" #include "muslogger.h" +const TInt KMusServerClosingWaitTimeoutInMicrosecs = 10000000; // 10 secs + // ---------------------------------------------------------------------------- // MusManagerServerStarter::Start // ---------------------------------------------------------------------------- @@ -59,8 +61,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 +82,23 @@ TInt MusManagerServerStarter::CreateServerProcess( RSemaphore& aSemaphore ) { TInt err = KErrNone; + + RSemaphore closingSemaphore; + if ( closingSemaphore.OpenGlobal( KMusManagerServerClosingSemaphoreName ) == KErrNone ) + { + MUS_LOG( "mus: [MUSCLI] CreateServerProcess, wait for server closing" ); + // Don't wait forever if server is somehow horribly jammed + + TInt waitErr = closingSemaphore.Wait( KMusServerClosingWaitTimeoutInMicrosecs ); + MUS_LOG1( "mus: [MUSCLI] CreateServerProcess, waitErr( %d )", + waitErr ); + closingSemaphore.Close(); + if ( waitErr != KErrNone ) + { + return waitErr; + } + } + const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); RProcess server; err = server.Create( KMusManagerServerName, KNullDesC() ,serverUid ); diff -r 36d7ded3ca23 -r 01f0bb65bcf1 mmsharing/mmshmanagersrv/src/musmanagerservermain.cpp --- a/mmsharing/mmshmanagersrv/src/musmanagerservermain.cpp Wed Aug 18 09:46:00 2010 +0300 +++ b/mmsharing/mmshmanagersrv/src/musmanagerservermain.cpp Thu Sep 02 20:23:40 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(); } // -----------------------------------------------------------------------------