# HG changeset patch # User hgs # Date 1272610331 -10800 # Node ID 4eb2df7f7cbe825c64db00134168f5f9f075a3f5 # Parent 8aed59de29f9f04114ad35d8c7ec36ea7168b710 201017 diff -r 8aed59de29f9 -r 4eb2df7f7cbe inc/videoservices.h --- a/inc/videoservices.h Fri Apr 16 18:13:14 2010 +0300 +++ b/inc/videoservices.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,6 +15,8 @@ * */ +// Version : %version: ou1cpsw#3 % + #ifndef __VIDEOSERVICES_H__ #define __VIDEOSERVICES_H__ @@ -56,6 +58,14 @@ * */ QString contextTitle() const; + + /** + * Returns sort type defined by the service client. + * + * @param None. + * @return int. + */ + int sortRole() const; /* * Enum reflecting the services provided @@ -185,6 +195,14 @@ friend class VideoServiceView; friend class VideoServiceBrowse; + +public: + + /* + * indicate fetch service and attach operation has been selected + */ + bool mFetchSelected; + }; #endif //__VIDEOSERVICES_H__ diff -r 8aed59de29f9 -r 4eb2df7f7cbe mediasettings/mediasettingsengine/conf/mediasettings.confml Binary file mediasettings/mediasettingsengine/conf/mediasettings.confml has changed diff -r 8aed59de29f9 -r 4eb2df7f7cbe mediasettings/mediasettingsengine/conf/mediasettings_101F880B.crml Binary file mediasettings/mediasettingsengine/conf/mediasettings_101F880B.crml has changed diff -r 8aed59de29f9 -r 4eb2df7f7cbe mediasettings/mediasettingsengine/group/bld.inf --- a/mediasettings/mediasettingsengine/group/bld.inf Fri Apr 16 18:13:14 2010 +0300 +++ b/mediasettings/mediasettingsengine/group/bld.inf Fri Apr 30 09:52:11 2010 +0300 @@ -16,7 +16,7 @@ -// Version : %version: 7 % +// Version : %version: 8 % #include @@ -30,6 +30,11 @@ ../rom/mpsettropmodel.iby CORE_APP_LAYER_IBY_EXPORT_PATH(mpsettropmodel.iby) ../rom/mpsettropmodelrsc.iby CORE_APP_LAYER_IBY_EXPORT_PATH(mpsettropmodelrsc.iby) +// Generic configuration interface for component cenrep settings +// mediasettings_101F880B implementation specifics for cenrep data +../conf/mediasettings.confml APP_LAYER_CONFML(mediasettings.confml) +../conf/mediasettings_101F880B.crml APP_LAYER_CRML(mediasettings_101F880B.crml) + PRJ_MMPFILES ../group/MPSettROPModel.mmp diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h --- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Fri Apr 30 09:52:11 2010 +0300 @@ -25,12 +25,19 @@ #include #include #include +#include #include "vcxmyvideosalbum.h" class CVcxMyVideosMdsAlbums; class CMPXMedia; class CVcxMyVideosMdsCmdQueue; +const TUid KHarvesterPSShutdown = { 0x200009F5 } ; +const TInt KMdSShutdown = 0x00000002; // values 1 = shutdown, 0 = restart, normal state + +static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); +static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt); + /** * MPX My Videos collection MDS database observer class. * Part of ECOM Plugin. @@ -171,6 +178,75 @@ }; /** + * PSCW Listener Observer interface for signaling that MDS has Shutdown/restarted + */ +class MVcxMdsShutdownMonitorObserver + { +public: + + virtual void ShutdownNotification( TInt aShutdownState ) = 0; + }; + +/** + * Active object for observing P&S keys + */ +class CVcxMdsShutdownMonitor: public CActive + { +public: + + /** + * Two-phased constructor. + * + * @return Instance of CVcxMdsShutdownMonitor. + */ + static CVcxMdsShutdownMonitor* NewL( MVcxMdsShutdownMonitorObserver& aObserver, + const TUid& aKeyCategory, const TInt aPropertyKey, TBool aDefineKey); + + /** + * Destructor + */ + virtual ~CVcxMdsShutdownMonitor(); + +protected: + + /** + * Handles an active object's request completion event. + */ + void RunL(); + + /** + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + +private: + + /** + * C++ default constructor + * + * @return Instance of CVcxMdsShutdownMonitor. + */ + CVcxMdsShutdownMonitor( MVcxMdsShutdownMonitorObserver& aObserver, + const TUid& aKeyCategory, const TInt iPropertyKey, TBool aDefineKey ); + + /** + * Symbian 2nd phase constructor can leave. + */ + void ConstructL(); + +private: + + // not own + MVcxMdsShutdownMonitorObserver& iObserver; + + const TUid& iKeyCategory; + RProperty iProperty; + TInt iPropertyKey; + + TBool iDefineKey; +}; + +/** * MPX My Videos collection ECOM plugin's MDS database class. */ NONSHARABLE_CLASS(CVcxMyVideosMdsDb) : @@ -178,7 +254,8 @@ public MMdESessionObserver, public MMdEQueryObserver, public MMdEObjectObserver, - public MMdEObjectPresentObserver + public MMdEObjectPresentObserver, + public MVcxMdsShutdownMonitorObserver { public: @@ -279,6 +356,8 @@ */ CMPXMedia* CreateVideoL( TUint32 aId, TBool aFullDetails = ETrue ); +protected: + // from MMdESessionObserver /** @@ -343,6 +422,10 @@ // from MMdEObjectPresentObserver void HandleObjectPresentNotification(CMdESession& aSession, TBool aPresent, const RArray& aObjectIdArray); + +// from MVcxMdsShutdownMonitorObserver + void ShutdownNotification( TInt aShutdownState ); + private: /** @@ -459,6 +542,11 @@ * Opens MDS session. */ void OpenMdsSessionL(); + + /** + * @return MDS session. + */ + CMdESession& MdsSessionL(); public: @@ -486,9 +574,9 @@ CMdESession* iMdsSession; /** - * The error code saved from the callbacks. + * The sessions error state. */ - TInt iMdsError; + TInt iMdsSessionError; /** * Asynchronous video list fetching query is stored here. @@ -673,6 +761,12 @@ * handler or starting new query from the handler. */ CAsyncCallBack* iAsyncHandleQueryCompleteCaller; + + /** + * Monitors Mds server shutdown states. + */ + CVcxMdsShutdownMonitor* iMdsShutdownMonitor; + }; #endif // VCXMYVIDEOSMDSDB_H diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -55,7 +55,7 @@ if ( iObserver ) { //ENotifyAdd and ENotifyModify are not supported - iMdsDb.iMdsSession->AddRelationItemObserverL( *this, NULL, + iMdsDb.MdsSessionL().AddRelationItemObserverL( *this, NULL, ENotifyRemove, iMdsDb.iNamespaceDef ); #if 0 @@ -64,13 +64,13 @@ // the add operation instead. This way we don't receive // add events if someone else adds videos to our albums // but the performance is the best possible. - iMdsDb.iMdsSession->AddRelationObserverL( *this, NULL, + iMdsDb.MdsSessionL().AddRelationObserverL( *this, NULL, ENotifyAdd | ENotifyModify | ENotifyRemove ); #endif } //TODO: do we need this? - //iMdsDb.iMdsSession->AddRelationPresentObserverL(); + //iMdsDb.MdsSessionL().AddRelationPresentObserverL(); } // --------------------------------------------------------------------------- @@ -154,18 +154,7 @@ { MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoCancel() start"); -#if 0 - // Seems like the only way to cancel these is to close session to MDS and reopen it... - // Update: even this does not cancel the operation - MPX_DEBUG1("CVcxMyVideosMdsAlbums:: closing mds session"); - - delete iMdsDb.iMdsSession; - iMdsDb.iMdsSession = NULL; - - MPX_DEBUG1("CVcxMyVideosMdsAlbums:: opening mds session"); - TRAP_IGNORE( iMdsDb.OpenMdsSessionL() ); - MPX_DEBUG2("CVcxMyVideosMdsAlbums:: opened mds session (%d)", iMdsDb.iMdsError); -#endif + // MDS does not offer way to cancel these async requests MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoCancel() exit"); } @@ -228,7 +217,7 @@ delete iAlbumQuery; iAlbumQuery = NULL; - iAlbumQuery = iMdsDb.iMdsSession->NewObjectQueryL( *iNamespaceDef, *iAlbumObjectDef, this ); + iAlbumQuery = iMdsDb.MdsSessionL().NewObjectQueryL( *iNamespaceDef, *iAlbumObjectDef, this ); CMdELogicCondition& rootCondition = iAlbumQuery->Conditions(); rootCondition.SetOperator( ELogicConditionOperatorOr ); @@ -277,7 +266,7 @@ iAlbumId = aAlbumId; iAlbumContent = &aContentArray; - iRelationQuery = iMdsDb.iMdsSession->NewRelationQueryL( *iNamespaceDef, this ); + iRelationQuery = iMdsDb.MdsSessionL().NewRelationQueryL( *iNamespaceDef, this ); CMdELogicCondition& rootCondition = iRelationQuery->Conditions(); @@ -337,12 +326,13 @@ iVideoList = &aVideoList; iAlbumId = aAlbumId; - iVideoQuery = iMdsDb.iMdsSession->NewObjectQueryL( *iNamespaceDef, *iMdsDb.iVideoObjectDef, this ); + iVideoQuery = iMdsDb.MdsSessionL().NewObjectQueryL( *iNamespaceDef, *iMdsDb.iVideoObjectDef, this ); CMdELogicCondition& rootCondition = iVideoQuery->Conditions(); CMdERelationCondition& relationCondition = rootCondition.AddRelationConditionL( *iContainsRelationDef ); CMdELogicCondition& leftCondition = relationCondition.LeftL(); + CMdELogicCondition& rightCondition = relationCondition.RightL(); //...left side is an album... leftCondition.AddObjectConditionL( *iAlbumObjectDef ); @@ -364,7 +354,7 @@ // void CVcxMyVideosMdsAlbums::GetSchemaDefinitionsL() { - iNamespaceDef = &(iMdsDb.iMdsSession->GetDefaultNamespaceDefL()); + iNamespaceDef = &(iMdsDb.MdsSessionL().GetDefaultNamespaceDefL()); _LIT( KVcxAlbumObjectName, "Album" ); iAlbumObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxAlbumObjectName )); @@ -634,7 +624,7 @@ iMdsDb.Object2MediaL( object, *media ); #ifdef _DEBUG - TBuf<200> title; + TBuf<256> title; title = TVcxMyVideosCollectionUtil::Title( *media ); MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object title: %S", &title); #endif @@ -724,7 +714,7 @@ if ( TVcxMyVideosCollectionUtil::Int32ValueL( *videoArray->AtL( i ) ) != KErrAlreadyExists ) { - relation = iMdsDb.iMdsSession->NewRelationL( + relation = iMdsDb.MdsSessionL().NewRelationL( *iContainsRelationDef, albumId, TVcxMyVideosCollectionUtil::IdL( *videoArray->AtL( i ) ) ); CleanupStack::PushL( relation ); @@ -738,7 +728,7 @@ iAsyncOperation = EVcxAddVideosToAlbum; - iMdsDb.iMdsSession->AddItemsAsyncL( iItemArray, iStatus, iResultBuffer ); + iMdsDb.MdsSessionL().AddItemsAsyncL( iItemArray, iStatus, iResultBuffer ); SetActive(); } @@ -779,7 +769,7 @@ iAsyncOperation = EVcxRemoveRelations; - iMdsDb.iMdsSession->RemoveRelationsAsyncL( *iIdArray, iStatus, iResultBuffer, iNamespaceDef ); + iMdsDb.MdsSessionL().RemoveRelationsAsyncL( *iIdArray, iStatus, iResultBuffer, iNamespaceDef ); SetActive(); MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveRelationsL() exit"); @@ -792,14 +782,8 @@ void CVcxMyVideosMdsAlbums::AddAlbumL( CMPXMedia& aAlbum ) { MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddAlbumL() start"); - - if ( !iMdsDb.iMdsSession ) - { - MPX_DEBUG2("CVcxMyVideosMdsAlbums:: no mds session(%d), leaving", iMdsDb.iMdsError); - User::Leave( iMdsDb.iMdsError ); - } - - CMdEObject* object = iMdsDb.iMdsSession->NewObjectLC( + + CMdEObject* object = iMdsDb.MdsSessionL().NewObjectLC( *iAlbumObjectDef, KNullDesC ); // 1-> Media2ObjectL( aAlbum, *object ); @@ -808,16 +792,16 @@ TUint32 mdsId; #ifdef _DEBUG - TRAPD( err, mdsId = iMdsDb.iMdsSession->AddObjectL( *object ) ); + TRAPD( err, mdsId = iMdsDb.MdsSessionL().AddObjectL( *object ) ); if ( err != KErrNone ) { - MPX_DEBUG2( "CVcxMyVideosMdsAlbums:: iMdsDb.iMdsSession->AddObjectL leaved with error: %d", err ); + MPX_DEBUG2( "CVcxMyVideosMdsAlbums:: iMdsDb.MdsSessionL().AddObjectL leaved with error: %d", err ); User::Leave( err ); } #else - mdsId = iMdsDb.iMdsSession->AddObjectL( *object ); + mdsId = iMdsDb.MdsSessionL().AddObjectL( *object ); #endif @@ -844,18 +828,12 @@ { MPX_DEBUG1("CVcxMyVideosMdsDb::SetAlbumL() start"); - if ( !iMdsDb.iMdsSession ) - { - MPX_DEBUG2("CVcxMyVideosMdsAlbums:: no mds session(%d), leaving", iMdsDb.iMdsError); - User::Leave( iMdsDb.iMdsError ); - } - TMPXItemId mpxId = TVcxMyVideosCollectionUtil::IdL( aVideo ); MPX_DEBUG2("CVcxMyVideosMdsAlbums::SetAlbumL updating object %d ", mpxId.iId1); CMdEObject* object = - iMdsDb.iMdsSession->OpenObjectL( mpxId.iId1, *iAlbumObjectDef ); + iMdsDb.MdsSessionL().OpenObjectL( mpxId.iId1, *iAlbumObjectDef ); if ( !object ) { // No object with this ID was found! @@ -872,7 +850,7 @@ Media2ObjectL( aVideo, *object ); - iMdsDb.iMdsSession->CommitObjectL( *object ); + iMdsDb.MdsSessionL().CommitObjectL( *object ); CleanupStack::PopAndDestroy( object ); } @@ -929,7 +907,7 @@ iAsyncOperation = EVcxRemoveAlbums; - iMdsDb.iMdsSession->RemoveObjectsAsyncL( idArray, iStatus, iResultBuffer, iNamespaceDef ); + iMdsDb.MdsSessionL().RemoveObjectsAsyncL( idArray, iStatus, iResultBuffer, iNamespaceDef ); CleanupStack::PopAndDestroy( &idArray ); SetActive(); @@ -982,7 +960,7 @@ { MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL() start"); - iMdsDb.iMdsSession->DeserializeItemsL( iResultBuffer, iItemArray ); + iMdsDb.MdsSessionL().DeserializeItemsL( iResultBuffer, iItemArray ); iClient->HandleAddVideosToAlbumResp( iMpxCmd, iItemArray ); iResultBuffer.Close(); @@ -999,7 +977,7 @@ { MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL() start"); - iMdsDb.iMdsSession->DeserializeIdsL( iResultBuffer, NULL, NULL, iResultArrayUint32 ); + iMdsDb.MdsSessionL().DeserializeIdsL( iResultBuffer, NULL, NULL, iResultArrayUint32 ); #ifdef _DEBUG TItemId result; @@ -1028,7 +1006,7 @@ resultArray.Reset(); CleanupClosePushL( resultArray ); - iMdsDb.iMdsSession->DeserializeIdsL( iResultBuffer, &resultArray, NULL, NULL ); + iMdsDb.MdsSessionL().DeserializeIdsL( iResultBuffer, &resultArray, NULL, NULL ); #ifdef _DEBUG TItemId result; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -65,6 +65,100 @@ // --------------------------------------------------------------------------- +// CVcxMdsShutdownMonitor::NewL() +// --------------------------------------------------------------------------- +// +CVcxMdsShutdownMonitor* CVcxMdsShutdownMonitor::NewL( MVcxMdsShutdownMonitorObserver& aObserver, + const TUid& aKeyCategory, + const TInt aPropertyKey, + TBool aDefineKey) + { + CVcxMdsShutdownMonitor* self = new( ELeave )CVcxMdsShutdownMonitor( aObserver, + aKeyCategory, + aPropertyKey, + aDefineKey); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CVcxMdsShutdownMonitor::CVcxMdsShutdownMonitor() +// --------------------------------------------------------------------------- +// +CVcxMdsShutdownMonitor::CVcxMdsShutdownMonitor( MVcxMdsShutdownMonitorObserver& aObserver, + const TUid& aKeyCategory, + const TInt aPropertyKey, + TBool aDefineKey) + : CActive( CActive::EPriorityStandard ), iObserver( aObserver ), + iKeyCategory( aKeyCategory ), iPropertyKey(aPropertyKey), iDefineKey( aDefineKey ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CVcxMdsShutdownMonitor::ConstructL() +// --------------------------------------------------------------------------- +// +void CVcxMdsShutdownMonitor::ConstructL() + { + // define P&S property types + if ( iDefineKey ) + { + RProperty::Define( iKeyCategory, iPropertyKey, + RProperty::EInt, KAllowAllPolicy, KPowerMgmtPolicy ); + } + + // attach to the property + TInt err = iProperty.Attach( iKeyCategory, iPropertyKey,EOwnerThread ); + User::LeaveIfError( err ); + + // wait for the previously attached property to be updated + iProperty.Subscribe( iStatus ); + SetActive(); + } + +// --------------------------------------------------------------------------- +// CVcxMdsShutdownMonitor::~CVcxMdsShutdownMonitor() +// --------------------------------------------------------------------------- +// +CVcxMdsShutdownMonitor::~CVcxMdsShutdownMonitor() + { + Cancel(); + iProperty.Close(); + } + +// --------------------------------------------------------------------------- +// CVcxMdsShutdownMonitor::RunL() +// --------------------------------------------------------------------------- +// +void CVcxMdsShutdownMonitor::RunL() + { + // resubscribe before processing new value to prevent missing updates + iProperty.Subscribe( iStatus ); + SetActive(); + + // retrieve the value + TInt value = 0; + TInt err = iProperty.Get( value ); + MPX_DEBUG2("CVcxMyVideosMdsDb::RunL(): iProperty.Get(value); returns %d", err); + + User::LeaveIfError( err ); + + iObserver.ShutdownNotification( value ); + } + +// --------------------------------------------------------------------------- +// CVcxMdsShutdownMonitor::DoCancel() +// --------------------------------------------------------------------------- +// +void CVcxMdsShutdownMonitor::DoCancel() + { + iProperty.Cancel(); + } + +// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // CVcxMyVideosMdsDb::CVcxMyVideosMdsDb( MVcxMyVideosMdsDbObserver* aObserver, @@ -86,8 +180,6 @@ OpenMdsSessionL(); - // Get the schema definitions - GetSchemaDefinitionsL(); iAlbums = CVcxMyVideosMdsAlbums::NewL( *this, iAlbumsObserver ); @@ -95,6 +187,9 @@ iAsyncHandleQueryCompleteCaller = new (ELeave) CAsyncCallBack( callBack, CActive::EPriorityStandard ); + iMdsShutdownMonitor = CVcxMdsShutdownMonitor::NewL( + *this, KHarvesterPSShutdown, KMdSShutdown, EFalse ); + MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL exit" ); } @@ -106,35 +201,47 @@ { MPX_DEBUG1( "CVcxMyVideosMdsDb::OpenMdsSessionL() start" ); - iMdsError = KErrNone; + iMdsSessionError = KErrNone; + delete iMdsSession; + iMdsSession = NULL; iMdsSession = CMdESession::NewL( *this ); if ( !iMdsSession ) { - // Failed to create session, leave - User::Leave( iMdsError ); + User::Leave( KErrGeneral ); } - if ( iMdsError != KErrNone ) - { - MPX_DEBUG2("Failed to create session to MDS: %d", iMdsError); - User::LeaveIfError( iMdsError ); - } - // Wait until session opened iActiveSchedulerWait->Start(); - MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL iActiveSchedulerWait->Start done" ); + MPX_DEBUG1( "CVcxMyVideosMdsDb:: iActiveSchedulerWait->Start done" ); - MPX_DEBUG1( "CVcxMyVideosMdsDb::OpenMdsSessionL Adding observers" ); + if ( iMdsSessionError == KErrNone ) + { + MPX_DEBUG1( "CVcxMyVideosMdsDb:: session opened ok, adding observers" ); - // We order all object notifications. If we set video condition, then we wont - // receive remove notifications at all (mds feature). Extra notifications - // do not bother us much since we try to fetch the item from the db - // after the add notification anyways, and then we use video condition. - // Eventually extra events are ignored. - iMdsSession->AddObjectObserverL( *this, NULL ); + // We order all object notifications. If we set video condition, then we wont + // receive remove notifications at all (mds feature). Extra notifications + // do not bother us much since we try to fetch the item from the db + // after the add notification anyways, and then we use video condition. + // Eventually extra events are ignored. + iMdsSession->AddObjectObserverL( *this, NULL ); - iMdsSession->AddObjectPresentObserverL( *this ); + iMdsSession->AddObjectPresentObserverL( *this ); + + GetSchemaDefinitionsL(); + + if ( iAlbums ) + { + iAlbums->GetSchemaDefinitionsL(); + } + } + else + { + MPX_DEBUG2( "CVcxMyVideosMdsDb:: session opening failed: %d", iMdsSessionError ); + iMdsSessionError = KErrGeneral; // this ensures that next time when mds is tried to use, it tries to open session again + delete iMdsSession; + iMdsSession = NULL; + } MPX_DEBUG1( "CVcxMyVideosMdsDb::OpenMdsSessionL() exit" ); } @@ -193,22 +300,18 @@ // CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb() { - MPX_FUNC( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb()" ); + MPX_DEBUG1( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb() start" ); Cancel( EGetVideoList ); delete iAlbums; - delete iCmdQueue; - - if ( iMdsSession ) - { - TRAP_IGNORE( iMdsSession->RemoveObjectObserverL( *this ) ); - } - + delete iCmdQueue; delete iVideoQuery; delete iMdsSession; delete iActiveSchedulerWait; delete iAsyncHandleQueryCompleteCaller; + delete iMdsShutdownMonitor; + MPX_DEBUG1( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb() exit" ); } // --------------------------------------------------------------------------- @@ -246,15 +349,9 @@ CMPXMedia& aVideo, TUint32& aMdsId ) { - MPX_FUNC( "CVcxMyVideosMdsDb::AddVideoL" ); - - if ( !iMdsSession ) - { - MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError); - User::Leave( iMdsError ); - } + MPX_DEBUG1( "CVcxMyVideosMdsDb::AddVideoL() start" ); - CMdEObject* object = iMdsSession->NewObjectLC( + CMdEObject* object = MdsSessionL().NewObjectLC( *iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1-> // Value from aVideo is taken in use in Media2ObjectL if aVideo contains creation date @@ -282,11 +379,11 @@ } Media2ObjectL( aVideo, *object ); - TRAPD( err, aMdsId = iMdsSession->AddObjectL( *object ) ); + TRAPD( err, aMdsId = MdsSessionL().AddObjectL( *object ) ); if ( err != KErrNone ) { - MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->AddObjectL leaved with error: %d", err ); + MPX_DEBUG2( "CVcxMyVideosMdsDb:: MdsSessionL().AddObjectL leaved with error: %d", err ); User::Leave( err ); } @@ -302,6 +399,7 @@ CleanupStack::PopAndDestroy( object ); // <-1 + MPX_DEBUG1( "CVcxMyVideosMdsDb::AddVideoL() exit" ); } // --------------------------------------------------------------------------- @@ -310,20 +408,14 @@ // TInt CVcxMyVideosMdsDb::RemoveVideo( TUint32 aMdsId ) { - MPX_FUNC( "CVcxMyVideosMdsDb::RemoveVideoL" ); - - if ( !iMdsSession ) - { - MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session, returning %d", iMdsError); - return iMdsError; - } + MPX_DEBUG1( "CVcxMyVideosMdsDb::RemoveVideoL() start" ); TInt retValue( KErrNone ); TItemId id( 0 ); //init to avoid warning MPX_DEBUG2( "CVcxMyVideosMdsDb:: removing object %d", aMdsId ); - TRAPD( err, id = iMdsSession->RemoveObjectL( aMdsId ) ); + TRAPD( err, id = MdsSessionL().RemoveObjectL( aMdsId ) ); if ( err == KErrNone ) { @@ -339,10 +431,11 @@ } else { - MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->RemoveObjectL left: %d", err ); + MPX_DEBUG2( "CVcxMyVideosMdsDb:: MdsSessionL().RemoveObjectL left: %d", err ); retValue = err; } + MPX_DEBUG1( "CVcxMyVideosMdsDb::RemoveVideoL() exit" ); return retValue; } @@ -352,20 +445,14 @@ // void CVcxMyVideosMdsDb::UpdateVideoL( CMPXMedia& aVideo ) { - MPX_FUNC( "CVcxMyVideosMdsDb::UpdateVideoL" ); - - if ( !iMdsSession ) - { - MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError); - User::Leave( iMdsError ); - } + MPX_DEBUG1( "CVcxMyVideosMdsDb::UpdateVideoL() start" ); TMPXItemId mpxId = aVideo.ValueTObjectL( KMPXMediaGeneralId ); MPX_DEBUG2("CVcxMyVideosMdsDb::UpdateVideoL updating object %d ", mpxId.iId1); CMdEObject* object = - iMdsSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef ); + MdsSessionL().OpenObjectL( mpxId.iId1, *iVideoObjectDef ); if ( !object ) { // No object with this ID was found! @@ -382,7 +469,7 @@ Media2ObjectL( aVideo, *object ); - iMdsSession->CommitObjectL(*object); + MdsSessionL().CommitObjectL(*object); CleanupStack::PopAndDestroy(object); } @@ -394,6 +481,7 @@ User::Leave( KErrInUse ); } } + MPX_DEBUG1( "CVcxMyVideosMdsDb::UpdateVideoL() exit" ); } // --------------------------------------------------------------------------- @@ -403,7 +491,7 @@ void CVcxMyVideosMdsDb::CreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder, TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList ) { - MPX_FUNC( "CVcxMyVideosMdsDb::CreateVideoListL" ); + MPX_DEBUG1( "CVcxMyVideosMdsDb::CreateVideoListL() start" ); CVcxMyVideosMdsCmdGetVideoList* cmd = new (ELeave) CVcxMyVideosMdsCmdGetVideoList; CleanupStack::PushL( cmd ); // 1-> @@ -425,12 +513,6 @@ TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList ) { MPX_FUNC( "CVcxMyVideosMdsDb::DoCreateVideoListL" ); - - if ( !iMdsSession ) - { - MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError); - User::Leave( iMdsError ); - } if ( iVideoListFetchingIsOngoing ) { @@ -448,7 +530,7 @@ delete iVideoQuery; iVideoQuery = NULL; - iVideoQuery = iMdsSession->NewObjectQueryL( + iVideoQuery = MdsSessionL().NewObjectQueryL( *iNamespaceDef, *iVideoObjectDef, this); @@ -553,7 +635,7 @@ TInt /*aNewItemCount*/ ) #endif { - MPX_FUNC("CVcxMyVideosMdsDb::HandleQueryNewResults()"); + MPX_DEBUG1("CVcxMyVideosMdsDb::HandleQueryNewResults() start"); if ( !iVideoList ) { @@ -585,6 +667,7 @@ iMdsDbObserver->HandleCreateVideoListResp( iVideoList, aFirstNewItemIndex, EFalse /* not complete yet */); + MPX_DEBUG1("CVcxMyVideosMdsDb::HandleQueryNewResults() exit"); } @@ -644,7 +727,7 @@ // CMPXMedia* CVcxMyVideosMdsDb::CreateVideoL( TUint32 aId, TBool aFullDetails ) { - MPX_FUNC( "CVcxMyVideosMdsDb::CreateVideoL" ); + MPX_DEBUG1( "CVcxMyVideosMdsDb::CreateVideoL() start" ); CMdEObject* object = ObjectL( aId ); @@ -663,6 +746,7 @@ CleanupStack::Pop( video ); // <-2 CleanupStack::PopAndDestroy( object ); // <-1 + MPX_DEBUG1( "CVcxMyVideosMdsDb::CreateVideoL() exit" ); return video; } @@ -675,7 +759,7 @@ CMdESession& /*aSession*/, TInt aError) { - MPX_FUNC( "CVcxMyVideosMdsDb::HandleSessionOpened" ); + MPX_DEBUG1("CVcxMyVideosMdsDb::HandleSessionOpened() start" ); iActiveSchedulerWait->AsyncStop(); @@ -683,10 +767,9 @@ { MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionOpened: %d", aError ); - iMdsError = aError; - delete iMdsSession; - iMdsSession = NULL; + iMdsSessionError = aError; } + MPX_DEBUG1("CVcxMyVideosMdsDb::HandleSessionOpened() exit" ); } // --------------------------------------------------------------------------- @@ -697,7 +780,7 @@ CMdESession& /*aSession*/, TInt aError) { - MPX_FUNC( "CVcxMyVideosMdsDb::HandleSessionError" ); + MPX_DEBUG1("CVcxMyVideosMdsDb::HandleSessionError() start" ); if (iActiveSchedulerWait->IsStarted()) { @@ -715,9 +798,9 @@ MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionError: %d", aError ); - iMdsError = aError; - delete iMdsSession; - iMdsSession = NULL; + iMdsSessionError = aError; + + MPX_DEBUG1("CVcxMyVideosMdsDb::HandleSessionError() exit" ); } // --------------------------------------------------------------------------- @@ -729,7 +812,7 @@ TObserverNotificationType aType, const RArray& aObjectIdArray) { - TRAP( iMdsError, DoHandleObjectNotificationL( aType, aObjectIdArray )); + TRAP_IGNORE( DoHandleObjectNotificationL( aType, aObjectIdArray )); } // --------------------------------------------------------------------------- @@ -738,14 +821,9 @@ // CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId aId, TBool aIsVideo ) { - if ( !iMdsSession ) - { - MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError); - User::Leave( iMdsError ); - } - + MPX_DEBUG1("CVcxMyVideosMdsDb::ObjectL start"); // If the id is not valid, just return NULL, because - // iMdsSession->GetObjectL leaves in that case + // MdsSessionL().GetObjectL leaves in that case if ( aId == KNoId ) { return NULL; @@ -754,11 +832,11 @@ CMdEObject* object; if ( aIsVideo ) { - object = iMdsSession->GetObjectL( aId, *iVideoObjectDef ); + object = MdsSessionL().GetObjectL( aId, *iVideoObjectDef ); } else { - object = iMdsSession->GetObjectL( aId, *iAlbums->iAlbumObjectDef ); + object = MdsSessionL().GetObjectL( aId, *iAlbums->iAlbumObjectDef ); } if ( object ) @@ -770,6 +848,7 @@ MPX_DEBUG2( "CVcxMyVideosMdsDb::ObjectL not found, id: %d", aId ); } + MPX_DEBUG1("CVcxMyVideosMdsDb::ObjectL exit"); return object; } @@ -1436,7 +1515,7 @@ MPX_FUNC( "CVcxMyVideosMdsDb::GetSchemaDefinitionsL" ); // Namespace - iNamespaceDef = &(iMdsSession->GetDefaultNamespaceDefL()); + iNamespaceDef = &(MdsSessionL().GetDefaultNamespaceDefL()); // Default object definitions iVideoObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxVideoObjectName )); @@ -1555,3 +1634,52 @@ aObject.AddInt16PropertyL( *iTimeOffsetPropertyDef, timeOffset.Int() / secondsInMinute ); aObject.AddTimePropertyL( *iLastModifiedDatePropertyDef, localTime ); } + +// --------------------------------------------------------------------------- +// CVcxMyVideosMdsDb::MdsSessionL +// --------------------------------------------------------------------------- +// +CMdESession& CVcxMyVideosMdsDb::MdsSessionL() + { + if ( iMdsSessionError == KErrServerTerminated ) + { + // This ensures that the iMdsSessionError KErrServerTerminated + // value does not change, since the user can't access iMdsSession. + // Recovery happens in ShutDownNotification func. + User::Leave( KErrServerTerminated ); + } + + if ( !iMdsSession ) + { + OpenMdsSessionL(); + + if ( !iMdsSession ) + { + User::Leave( KErrGeneral ); + } + } + + return *iMdsSession; + } + +// --------------------------------------------------------------------------- +// CVcxMyVideosMdsDb::ShutdownNotification +// From MVcxMdsShutDownMonitorObserver +// --------------------------------------------------------------------------- +// +void CVcxMyVideosMdsDb::ShutdownNotification( TInt aShutdownState ) + { + if ( aShutdownState == 0 ) + { + // Server has restarted, recreate session. + MPX_DEBUG1("CVcxMyVideosMdsDb:: MDS Server restarted!"); + OpenMdsSessionL(); + return; + } + + if ( aShutdownState == 1 ) + { + MPX_DEBUG1("CVcxMyVideosMdsDb:: MDS Server went down!"); + iMdsSessionError = KErrServerTerminated; + } + } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -189,6 +189,24 @@ { extraInfo = media->ValueTObjectL( KVcxMediaMyVideosInt32Value ); } + + if ( extraInfo == EVcxMyVideosVideoListOrderChanged && + aExtraInfo == 0 ) + { + MPX_DEBUG1("CVcxMyVideosMessageList:: found similar message with EVcxMyVideosVideoListOrderChanged flag set, discarding this msg"); + return ETrue; + } + + if ( aExtraInfo == EVcxMyVideosVideoListOrderChanged && + extraInfo == 0 ) + { + MPX_DEBUG1("CVcxMyVideosMessageList:: Turning the EVcxMyVideosVideoListOrderChanged flag on to the previous message"); + MPX_DEBUG1("CVcxMyVideosMessageList:: and discarding this."); + media->SetTObjectValueL( KVcxMediaMyVideosInt32Value, + EVcxMyVideosVideoListOrderChanged ); + return ETrue; + } + if ( aExtraInfo == extraInfo ) { return ETrue; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp --- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -14,7 +14,7 @@ * Description: Video list cache. Contains cached data from MDS.* */ -// Version : %version: % +// Version : %version: TB101_57 % // INCLUDE FILES @@ -573,11 +573,11 @@ else { MPX_DEBUG2("CVcxMyVideosVideoCache:: video with %d ID not found from MDS -> prob non video object, skipping add to cache", aMdsIds[j] ); - aMdsIds.Remove( j ); if ( aNonVideoIds ) { - aNonVideoIds->AppendL( j ); + aNonVideoIds->AppendL( aMdsIds[j] ); } + aMdsIds.Remove( j ); } } else diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/inc/hbabstractitemview.h --- a/videocollection/tsrc/stubs/inc/hbabstractitemview.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/hbabstractitemview.h Fri Apr 30 09:52:11 2010 +0300 @@ -28,8 +28,21 @@ { Q_OBJECT + Q_PROPERTY(ItemAnimations enabledAnimations READ enabledAnimations WRITE setEnabledAnimations) + public: + enum ItemAnimation + { + None = 0x00000, + Appear = 0x00001, + Disappear = 0x00002, + TouchDown = 0x00004, + All = 0xFFFFF + }; + + Q_DECLARE_FLAGS(ItemAnimations, ItemAnimation) + enum SelectionMode { InvalidSelection, @@ -41,6 +54,16 @@ HbAbstractItemView(QGraphicsWidget *parent = 0) : HbWidget(parent){} + void setEnabledAnimations(ItemAnimations flags) + { + Q_UNUSED(flags); + } + + ItemAnimations enabledAnimations() const + { + return None; + } + signals: void activated(const QModelIndex &index); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/inc/hbnamespace.h --- a/videocollection/tsrc/stubs/inc/hbnamespace.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/hbnamespace.h Fri Apr 30 09:52:11 2010 +0300 @@ -378,6 +378,12 @@ }; Q_DECLARE_FLAGS(InteractionModifiers, InteractionModifier)*/ + + enum ActivationReason { + ActivationReasonActivity = 0, + ActivationReasonService, + ActivationReasonNormal + }; }; /*Q_DECLARE_METATYPE(Hb::GraphicsItemType) diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/inc/videoservices.h --- a/videocollection/tsrc/stubs/inc/videoservices.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/inc/videoservices.h Fri Apr 30 09:52:11 2010 +0300 @@ -62,6 +62,14 @@ */ QString contextTitle() const; + /** + * Returns sort type defined by the service client. + * + * @param None. + * @return int. + */ + int sortRole() const; + /* * Enum reflecting the services provided */ @@ -177,6 +185,11 @@ * Current service */ VideoServices::TVideoService mCurrentService; + + /** + * Sort role. + */ + int mSortRole; friend class VideoServiceUriFetch; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/src/videolistdatamodel.cpp --- a/videocollection/tsrc/stubs/src/videolistdatamodel.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videolistdatamodel.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -141,14 +141,6 @@ return QString(); } -QString VideoListDataModel::prepareShortLengthString(int index) const -{ - Q_UNUSED(index); - - // not stubbed - return QString(); -} - QVariant VideoListDataModel::data(const QModelIndex &index, int role) const { QVariant returnValue = QVariant(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/src/videolistview.cpp --- a/videocollection/tsrc/stubs/src/videolistview.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videolistview.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -231,17 +231,6 @@ // not stubbed } - -void VideoListView::finishCollectionOpenedSlot(const HbEffect::EffectStatus &status) -{ - Q_UNUSED(status); -} - -void VideoListView::finishCollectionClosedSlot(const HbEffect::EffectStatus &status) -{ - Q_UNUSED(status); -} - void VideoListView::doSorting(int value) { Q_UNUSED(value); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/src/videolistwidget.cpp --- a/videocollection/tsrc/stubs/src/videolistwidget.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videolistwidget.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -128,6 +128,7 @@ void VideoListWidget::longPressedSlot(HbAbstractViewItem *item, const QPointF &point) { + Q_UNUSED(item); Q_UNUSED(point); // not stubbed } @@ -143,6 +144,11 @@ // not stubbed } +void VideoListWidget::playItemSlot() +{ + // not stubbed +} + void VideoListWidget::doDelayedsSlot() { // not stubbed diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/src/videoservicebrowse.cpp --- a/videocollection/tsrc/stubs/src/videoservicebrowse.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videoservicebrowse.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 3 % #include @@ -83,8 +83,14 @@ \param category, Category which type of videos are browsed. \return None. */ -void VideoServiceBrowse::browseVideos(const QString &title, int category) +void VideoServiceBrowse::browseVideos(const QString &title, + int category, + int sortRole) { + Q_UNUSED(title); + Q_UNUSED(category); + Q_UNUSED(sortRole); + // not stubbed } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/tsrc/stubs/src/videoservices.cpp --- a/videocollection/tsrc/stubs/src/videoservices.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/tsrc/stubs/src/videoservices.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -67,7 +67,8 @@ VideoServices::VideoServices(QVideoPlayerEngine* engine): mReferenceCount(0), mEngine(engine), - mCurrentService(VideoServices::ENoService) + mCurrentService(VideoServices::ENoService), + mSortRole(0) { mServiceUriFetch = new VideoServiceUriFetch(this); mServiceBrowse = new VideoServiceBrowse(this); @@ -100,12 +101,19 @@ { mCurrentService = service; } + QString VideoServices::contextTitle() const { // not stubbed return QString(); } +int VideoServices::sortRole() const +{ + // not stubbed + return mSortRole; +} + void VideoServices::itemSelected(const QString& item) { Q_UNUSED(item); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/data/hbdialog.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/data/hbdialog.css Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,6 @@ +HbDialog::heading { + min-heigh:6un; + pref-heigh:6un; + max-height:12un; + size-policy-vertical:expanding; +} \ No newline at end of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/data/videocollectionview.qrc --- a/videocollection/videocollectionview/data/videocollectionview.qrc Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/data/videocollectionview.qrc Fri Apr 30 09:52:11 2010 +0300 @@ -5,9 +5,8 @@ images/qtg_mono_video_all.svg + + + hbdialog.css - - effects/slide_in_to_left_and_fade_in.fxml - effects/slide_out_to_left_and_fade_out.fxml - diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/data/videolistselectiondialog.docml --- a/videocollection/videocollectionview/data/videolistselectiondialog.docml Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/data/videolistselectiondialog.docml Fri Apr 30 09:52:11 2010 +0300 @@ -1,42 +1,62 @@ - + - + + + - - + + + + + + + + - - + + + + - + + + - - - + + + + + - - - + + + + + + + + + diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/inc/videocollectionuiloaderdef.h --- a/videocollection/videocollectionview/inc/videocollectionuiloaderdef.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/inc/videocollectionuiloaderdef.h Fri Apr 30 09:52:11 2010 +0300 @@ -55,19 +55,13 @@ static const char* DOCML_NAME_DLG_HEADINGLBL = "mHeadingLabel"; static const char* DOCML_NAME_CHECK_CONTAINER = "mCheckBoxContainer"; static const char* DOCML_NAME_MARKALL = "mCheckMarkAll"; +static const char* DOCML_NAME_LBL_MARKALL = "mCheckBoxText"; static const char* DOCML_NAME_LBL_SELECTION = "mSelectionCount"; static const char* DOCML_NAME_LIST_CONTAINER = "mListContainer"; // async loading timeout static const int ASYNC_FIND_TIMEOUT = 50; // ms -// Effect constants -static const char* EFFECT_SLIDE_IN_TO_LEFT_FILENAME = ":/effects/slide_in_to_left_and_fade_in.fxml"; -static const char* EFFECT_SLIDE_OUT_TO_LEFT_FILENAME = ":/effects/slide_out_to_left_and_fade_out.fxml"; - -static const char* EFFECT_SLIDE_IN_TO_LEFT = "slide_in_to_left_and_fade_in"; -static const char* EFFECT_SLIDE_OUT_TO_LEFT = "slide_out_to_left_and_fade_out"; - /** VideoCollectionUiLoader parameter class */ class VideoCollectionUiLoaderParam { diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/inc/videocollectionviewplugin.h --- a/videocollection/videocollectionview/inc/videocollectionviewplugin.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/inc/videocollectionviewplugin.h Fri Apr 30 09:52:11 2010 +0300 @@ -76,7 +76,7 @@ signals: /** - * Command signal, plugin user shoulf connect this in case it wants + * Command signal, plugin user should connect this in case it wants * to receive commands emitted from the view. * * @param command id @@ -93,7 +93,7 @@ /** * Plugin user can notify orientation changes by connecting into this slot - * ti it's signal. In normal cases, view handles orientation chages itself. + * to it's signal. In normal cases, view handles orientation chages itself. * * @param orientation new orientation */ @@ -104,6 +104,13 @@ * */ void back(); + +private slots: + + /** + * Gets notified when view is ready. + */ + void viewReadySlot(); private: @@ -113,7 +120,7 @@ private: // async loading timeout - static const int DELAYED_LOAD_TIMEOUT = 4000; // ms + static const int DELAYED_LOAD_TIMEOUT = 500; // ms /** timer id */ int mTimerId; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/inc/videolistselectiondialog.h --- a/videocollection/videocollectionview/inc/videolistselectiondialog.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/inc/videolistselectiondialog.h Fri Apr 30 09:52:11 2010 +0300 @@ -89,6 +89,11 @@ */ void exec(); + /** + * Signaled by HbInputDialog when it's closed. + */ + void newAlbumNameDialogFinished(HbAction *action); + private slots: /** @@ -183,13 +188,9 @@ QString getSelectedName(); /** - * opens an input dialog for a user to input new album name - * If everything goes well and user accepts, method returns new album name and - * saves album id into mSelectedAlbumId - * - * @return QString new name or empty string in case of error or cancel + * Finalizes the operation. */ - QString queryNewAlbumSelected(); + void finalize(QString albumName = ""); private: @@ -234,6 +235,11 @@ HbLabel *mItemCount; /** + * checkbox label from docml + */ + HbLabel *mCheckBoxText; + + /** * mark all checkbox */ HbCheckBox *mCheckBox; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/inc/videolistview.h --- a/videocollection/videocollectionview/inc/videolistview.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/inc/videolistview.h Fri Apr 30 09:52:11 2010 +0300 @@ -113,7 +113,19 @@ * */ void doDelayeds(); + + /** + * Signaled when view is ready. + */ + void viewReady(); +public slots: + + /** + * Signaled by HbInputDialog when it's closed. + */ + void createCollectionDialogFinished(HbAction *action); + private slots: /** @@ -257,17 +269,7 @@ void collectionOpenedSlot(bool collectionOpened, const QString& collection, const QModelIndex &index); - - /** - * Slot is called when effect for opening a collection finishes. - */ - void finishCollectionOpenedSlot(const HbEffect::EffectStatus &status); - - /** - * Slot is called when effect for closing a collection finishes. - */ - void finishCollectionClosedSlot(const HbEffect::EffectStatus &status); - + /** * Slot which is called when an object has been loaded. */ @@ -378,11 +380,6 @@ * Boolean for knowing when the model is ready. */ bool mModelReady; - - /** - * Collection being opened or closed. - */ - bool mTransitionOngoing; /** * Hint level for the hint widget. diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/inc/videolistwidget.h --- a/videocollection/videocollectionview/inc/videolistwidget.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/inc/videolistwidget.h Fri Apr 30 09:52:11 2010 +0300 @@ -149,6 +149,23 @@ */ void fileUri(const QString&); +public slots: + + /** + * Signaled by HbInputDialog when it's closed. + */ + void renameDialogFinished(HbAction *action); + + /** + * Signaled by HbMessageBox when it's closed. + */ + void deleteItemDialogFinished(HbAction *action); + + /** + * Signaled by HbMessageBox when it's closed. + */ + void removeCollectionDialogFinished(HbAction *action); + protected slots: /** @@ -208,6 +225,12 @@ * Calls emitActivated for actually axecuting the functionality */ void openItemSlot(); + + /** + * Signaled when item's play functionality is initialized from context menu. + * Calls doActivateItem for actually executing the functionality. + */ + void playItemSlot(); /** * slot is connected to view's doDelayeds -signal @@ -267,7 +290,8 @@ EActionRemoveCollection, EActionRename, EActionPlay, - EActionOpen + EActionOpen, + EActionAttach }; /** @@ -311,6 +335,14 @@ void setNavigationAction(); /** + * Does the actual emitActivated functionality. Called from either emitActivated or + * openItemSlot. + * + * @param index Index of the item. + */ + void doEmitActivated (const QModelIndex &index); + + /** * handles single item activation. Either from * user's single tap or from default action at context menu. * diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/src/videocollectionuiloader.cpp --- a/videocollection/videocollectionview/src/videocollectionuiloader.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/src/videocollectionuiloader.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 20 % +// Version : %version: 21 % // INCLUDE FILES #include @@ -427,14 +427,6 @@ videoServices = VideoServices::instance(); } videoList->initialize(*model, videoServices); - - HbEffect::add(videoList, - EFFECT_SLIDE_IN_TO_LEFT_FILENAME, - EFFECT_SLIDE_IN_TO_LEFT); - - HbEffect::add(videoList, - EFFECT_SLIDE_OUT_TO_LEFT_FILENAME, - EFFECT_SLIDE_OUT_TO_LEFT); } } } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/src/videocollectionviewplugin.cpp --- a/videocollection/videocollectionview/src/videocollectionviewplugin.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/src/videocollectionviewplugin.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 23 % // INCLUDE FILES #include @@ -99,13 +99,13 @@ } if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) || - !connect( this, SIGNAL(doDelayeds()), mView, SLOT(doDelayedsSlot()) )) { + !connect( this, SIGNAL(doDelayeds()), mView, SLOT(doDelayedsSlot()) ) || + !connect( mView, SIGNAL(viewReady()), this, SLOT(viewReadySlot()) ) ) { ERROR(-1, "VideoCollectionViewPlugin::createView() failed to connect signals."); delete mView; mView = 0; return; } - mTimerId = startTimer(DELAYED_LOAD_TIMEOUT); mView->initializeView(); } } @@ -179,7 +179,6 @@ int err = mView->activateView(itemId); if (err != 0) { - // TODO: what to do if error? return; } mActivated = true; @@ -233,6 +232,16 @@ } } +// --------------------------------------------------------------------------- +// Slot: viewReadySlot +// --------------------------------------------------------------------------- +// +void VideoCollectionViewPlugin::viewReadySlot() +{ + FUNC_LOG; + mTimerId = startTimer(DELAYED_LOAD_TIMEOUT); +} + XQ_EXPORT_PLUGIN2( videocollectionview, VideoCollectionViewPlugin ); // end of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/src/videolistselectiondialog.cpp --- a/videocollection/videocollectionview/src/videolistselectiondialog.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistselectiondialog.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 22 % +// Version : %version: 25 % // INCLUDE FILES #include @@ -26,6 +26,7 @@ #include #include #include +#include #include "videocollectionuiloader.h" #include "videolistwidget.h" @@ -58,6 +59,7 @@ , mHeading( 0 ) , mCheckboxContainer( 0 ) , mItemCount( 0 ) + , mCheckBoxText( 0 ) , mCheckBox( 0 ) , mListContainer( 0 ) , mForcedCheck( false ) @@ -67,6 +69,9 @@ , mSecondaryAction( 0 ) { FUNC_LOG; + + HbStyleLoader::registerFilePath( ":/style/hbdialog.css" ); + setDismissPolicy(HbDialog::NoDismiss); setTimeout(HbDialog::NoTimeout); @@ -84,6 +89,8 @@ delete mListWidget; mListWidget = 0; } + // disable list related animations to make dialog faster + mListWidget->setEnabledAnimations(HbAbstractItemView::None); } } @@ -94,7 +101,9 @@ VideoListSelectionDialog::~VideoListSelectionDialog() { FUNC_LOG; + HbStyleLoader::unregisterFilePath( ":/style/hbdialog.css" ); delete mListWidget; + mListWidget = 0; } // --------------------------------------------------------------------------- @@ -198,6 +207,12 @@ { mCheckBox = mUiLoader->findWidget(DOCML_NAME_MARKALL); } + + if(!mCheckBoxText) + { + mCheckBoxText = mUiLoader->findWidget(DOCML_NAME_LBL_MARKALL); + } + // HbDialog connects actions to finished signal by default. if(!mPrimaryAction) { @@ -209,9 +224,10 @@ mSecondaryAction = new HbAction(hbTrId("txt_common_button_cancel")); addAction(mSecondaryAction); } - if(!mListContainer || !mHeading || !mCheckBox) + + if(!mListContainer || !mHeading || !mCheckBox || !mCheckBoxText) { - ERROR(-1, "VideoListSelectionDialog::initDialog() !mListContainer || !mHeading || !mCheckBox"); + ERROR(-1, "VideoListSelectionDialog::initDialog() !mListContainer || !mHeading || !mCheckBox || !mCheckBoxText"); return false; } return true; @@ -331,18 +347,56 @@ QString albumName(""); if( mTypeOfSelection == ESelectCollection ) { + mTypeOfSelection = EAddToCollection; if( mSelectedAlbumId == TMPXItemId::InvalidId()) { - albumName = queryNewAlbumSelected(); - if(mSelectedAlbumId == TMPXItemId::InvalidId()) - { - // user canceled new album creation - return; - } + QString label(hbTrId("txt_videos_title_enter_name")); + HbInputDialog *dialog = new HbInputDialog(); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->getText(label, this, SLOT(newAlbumNameDialogFinished(HbAction *)), + hbTrId("txt_videos_dialog_entry_new_collection")); + } + else + { + finalize(); } - mTypeOfSelection = EAddToCollection; + } + else + { + finalize(); } +} + +// --------------------------------------------------------------------------- +// newAlbumNameDialogFinished +// --------------------------------------------------------------------------- +// +void VideoListSelectionDialog::newAlbumNameDialogFinished(HbAction *action) +{ + FUNC_LOG; + Q_UNUSED(action); + HbInputDialog *dialog = static_cast(sender()); + + QVariant variant = dialog->value(); + + if(dialog->actions().first() == action && variant.isValid()) + { + QString text = mModel->resolveAlbumName(variant.toString()); + if(text.length()) + { + mSelectedAlbumId = mModel->addNewAlbum(text); + finalize(text); + } + } +} + +// --------------------------------------------------------------------------- +// finalize +// --------------------------------------------------------------------------- +// +void VideoListSelectionDialog::finalize(QString albumName) +{ // Must be checked again if type was ESelectCollection if(mTypeOfSelection == EAddToCollection) { @@ -626,24 +680,3 @@ return name; } -// --------------------------------------------------------------------------- -// queryNewAlbumSelected -// --------------------------------------------------------------------------- -// -QString VideoListSelectionDialog::queryNewAlbumSelected() -{ - FUNC_LOG; - mSelectedAlbumId = TMPXItemId::InvalidId(); - bool ok = false; - QString label(hbTrId("txt_videos_title_enter_name")); - QString text(""); - text = HbInputDialog::getText(label, hbTrId("txt_videos_dialog_entry_new_collection"), &ok); - if (ok && text.length()) - { - // check for duplicate album name and add new album - text = mModel->resolveAlbumName(text); - mSelectedAlbumId = mModel->addNewAlbum(text); - } - return text; -} - diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/src/videolistview.cpp --- a/videocollection/videocollectionview/src/videolistview.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistview.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 97 % +// Version : %version: 101 % // INCLUDE FILES #include @@ -58,7 +58,6 @@ , mUiLoader( uiLoader ) , mIsService( false ) , mModelReady( false ) - , mTransitionOngoing( false ) , mHintLevel( VideoHintWidget::AllVideos ) , mVideoServices( 0 ) , mCurrentList( 0 ) @@ -300,6 +299,14 @@ void VideoListView::modelReadySlot() { FUNC_LOG; + + // if mModelReady is false, then it means that this is the first time modelReady + // signal fires. Signaling that view is ready. + if(!mModelReady) + { + emit viewReady(); + } + mModelReady = true; // since the reset signal arrives after @@ -539,24 +546,12 @@ { if (show) { - mToolbarActions[ETBActionRemoveVideos]->setVisible(false); - - if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelDefaultColl) - { - mToolbarActions[ETBActionAddVideos]->setVisible(false); - } + mToolbarActions[ETBActionRemoveVideos]->setVisible(false); } - else - { - if(mToolbarActions[ETBActionRemoveVideos]->isVisible() == false) - { - mToolbarActions[ETBActionRemoveVideos]->setVisible(true); - } - if(mToolbarActions[ETBActionAddVideos]->isVisible() == false) - { - mToolbarActions[ETBActionAddVideos]->setVisible(true); - } - } + else if(mToolbarActions[ETBActionRemoveVideos]->isVisible() == false) + { + mToolbarActions[ETBActionRemoveVideos]->setVisible(true); + } } // prepare sublabel @@ -728,13 +723,6 @@ // no need to deactivate since there cannot be previous widget mCurrentList = collectionContentWidget; - // hide toolbar - HbToolBar *toolBar = this->toolBar(); - if (toolBar) - { - toolBar->hide(); - } - // resolve collection name if (itemId.iId1 == KVcxMvcCategoryIdDownloads) { @@ -753,7 +741,37 @@ model.openItem(itemId); // sort model - model.doSorting(VideoCollectionCommon::KeyDateTime, Qt::AscendingOrder); + int sortRole = VideoCollectionCommon::KeyDateTime; + if (mIsService && + mVideoServices) + { + // TODO: sorting roles needs to be defined somewhere + sortRole = mVideoServices->sortRole(); + switch (sortRole) + { + // sort by name + case 2: + { + sortRole = VideoCollectionCommon::KeyTitle; + break; + } + // sort by size + case 3: + { + sortRole = VideoCollectionCommon::KeySizeValue; + break; + } + // date & time + case 1: + // fall through + default: + { + sortRole = VideoCollectionCommon::KeyDateTime; + break; + } + } + } + model.doSorting(sortRole, Qt::AscendingOrder); // set hint level to collections setHintLevel(VideoHintWidget::Collection); @@ -930,8 +948,12 @@ mUiLoader->findWidget(DOCML_NAME_VC_VIDEOLISTWIDGET)->getModel().doSorting(role, order); } - // save sorting values - mUiUtils.saveSortingValues(role, order, mCurrentList->getLevel()); + // save sorting values only if the application is not started as a service + if (!mIsService) + { + // save sorting values + mUiUtils.saveSortingValues(role, order, mCurrentList->getLevel()); + } } // ------------------------------------------------------------------------------------------------- @@ -995,27 +1017,47 @@ return; } - VideoSortFilterProxyModel &model = mCurrentList->getModel(); - - bool ok = false; // query a name for the collection QString label(hbTrId("txt_videos_title_enter_name")); QString text(hbTrId("txt_videos_dialog_entry_new_collection")); - text = HbInputDialog::getText(label, text, &ok); - if (ok && text.length()) + + HbInputDialog *dialog = new HbInputDialog(); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->getText(label, this, SLOT(createCollectionDialogFinished(HbAction *)), text); +} + +// ------------------------------------------------------------------------------------------------- +// createCollectionDialogFinished +// ------------------------------------------------------------------------------------------------- +// +void VideoListView::createCollectionDialogFinished(HbAction *action) +{ + FUNC_LOG; + Q_UNUSED(action); + + HbInputDialog *dialog = static_cast(sender()); + + QVariant variant = dialog->value(); + + if(dialog->actions().first() == action && variant.isValid()) { + VideoSortFilterProxyModel &model = mCurrentList->getModel(); + // resolve collection true name and add new album - text = model.resolveAlbumName(text); + QString text = model.resolveAlbumName(variant.toString()); - // when collection reports about new collection, we open it right away, - // for that, connect to rowsInserted so that the new album can be opened - if(!connect(&model, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(openNewAlbumSlot(const QModelIndex&, int, int)))) + if(text.length()) { - return; + // when collection reports about new collection, we open it right away, + // for that, connect to rowsInserted so that the new album can be opened + if(!connect(&model, SIGNAL(rowsInserted(const QModelIndex&, int, int)), + this, SLOT(openNewAlbumSlot(const QModelIndex&, int, int)))) + { + return; + } + + model.addNewAlbum(text); } - - model.addNewAlbum(text); } } @@ -1270,152 +1312,99 @@ const QModelIndex &index) { FUNC_LOG; - if(mTransitionOngoing) - { - return; - } - else - { - // clear toolbar actions. - toolBar()->clearActions(); - } + + // clear toolbar actions. + toolBar()->clearActions(); + VideoListWidget *collectionContentWidget = + mUiLoader->findWidget( + DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); + + if(!collectionContentWidget) + { + return; + } + // update collection specific information + mCollectionName = collection; + + // disable collection content animations during widget change + HbAbstractItemView::ItemAnimations animationState = collectionContentWidget->enabledAnimations(); + collectionContentWidget->setEnabledAnimations(HbAbstractItemView::None); + if(collectionOpened) { - if(!index.isValid()) - { + // open album view + if (!index.isValid() || !mCurrentList || mCurrentList == collectionContentWidget) + { + // no currentlist or currentlist is already collection content -list + collectionContentWidget->setEnabledAnimations(animationState); return; } - // open album view - VideoListWidget *collectionContentWidget = - mUiLoader->findWidget( - DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); + // get item id before deactivating + TMPXItemId itemId = mCurrentList->getModel().getMediaIdAtIndex(index); - if (!mCurrentList || mCurrentList == collectionContentWidget) + // get level from the item to be opened only default + // or user defined collections can be activated here + VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelInvalid; + if(itemId.iId2 == KVcxMvcMediaTypeCategory) { - // no currentlist or currentlist is already list - // we're about to transit - return; + level = VideoCollectionCommon::ELevelDefaultColl; } - - // get item id before deactivating - TMPXItemId itemId = TMPXItemId::InvalidId(); - itemId = mCurrentList->getModel().getMediaIdAtIndex(index); - - // only category or album can be activated here - if(itemId == TMPXItemId::InvalidId() || - (itemId.iId2 != KVcxMvcMediaTypeCategory && - itemId.iId2 != KVcxMvcMediaTypeAlbum)) + else if(itemId.iId2 == KVcxMvcMediaTypeAlbum) { + level = VideoCollectionCommon::ELevelAlbum; + } + else + { + collectionContentWidget->setEnabledAnimations(animationState); return; } - // Send level that is opened with the effect. - QVariant nextLevel; - if(itemId.iId2 == KVcxMvcMediaTypeCategory) - { - nextLevel = QVariant(VideoCollectionCommon::ELevelDefaultColl); - } - else if(itemId.iId2 == KVcxMvcMediaTypeAlbum) - { - nextLevel = QVariant(VideoCollectionCommon::ELevelAlbum); - } - - // Start fetching content. + // Start fetching content before changing. collectionContentWidget->getModel().openItem(itemId); - HbEffect::start(collectionContentWidget, - EFFECT_SLIDE_IN_TO_LEFT, - this, - "finishCollectionOpenedSlot", - nextLevel); + // deactivat current widget. + mCurrentList->deactivate(); - mTransitionOngoing = true; + // activate video collection content widget and set it as current list. + mCurrentList = collectionContentWidget; + mCurrentList->activate(level); + + updateSubLabel(); + + // setup correct sorting, collection content contains always a list of videos so we use + // ELevelVideos as target for sorting + VideoCollectionViewUtils::sortModel(&mCurrentList->getModel(), false, VideoCollectionCommon::ELevelVideos); + mCurrentList->getModel().invalidate(); + + // update hint widget for correct content + setHintLevel(VideoHintWidget::Collection); + showHint(); + + // update toolbar for albums, default categories don't have one. + if(level == VideoCollectionCommon::ELevelAlbum && + mToolbarCollectionActionGroup && mToolbarActions.contains(ETBActionCollections)) + { + mToolbarActions[ETBActionCollections]->setChecked(false); + toolBar()->addActions(mToolbarCollectionActionGroup->actions()); + } } else { - // open categories view. - VideoListWidget *collectionContentWidget = - mUiLoader->findWidget( - DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); - - HbEffect::start(collectionContentWidget, - EFFECT_SLIDE_OUT_TO_LEFT, - this, - "finishCollectionClosedSlot"); + // open collection view + openCollectionViewSlot(); - mTransitionOngoing = true; - } - // update collection specific information - mCollectionName = collection; -} - -// ------------------------------------------------------------------------------------------------- -// finishCollectionOpenedSlot -// ------------------------------------------------------------------------------------------------- -// -void VideoListView::finishCollectionOpenedSlot(const HbEffect::EffectStatus &status) -{ - FUNC_LOG; - Q_UNUSED(status); - - mTransitionOngoing = false; - - // deactivat current widget. - mCurrentList->deactivate(); - - // activate video collection content widget. - mCurrentList = mUiLoader->findWidget( - DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); - - if(!mCurrentList || !status.userData.isValid()) - { - return; + // update toolbar + if(mToolbarViewsActionGroup && mToolbarActions.contains(ETBActionCollections)) + { + toolBar()->addActions(mToolbarViewsActionGroup->actions()); + mToolbarActions[ETBActionCollections]->setChecked(true); + } } - - updateSubLabel(); - - VideoCollectionCommon::TCollectionLevels level = - static_cast(status.userData.toInt()); - mCurrentList->activate(level); - - VideoCollectionViewUtils::sortModel(&mCurrentList->getModel(), false, VideoCollectionCommon::ELevelVideos); - mCurrentList->getModel().invalidate(); - - // update hint widget - setHintLevel(VideoHintWidget::Collection); - showHint(); - - // update toolbar for albums, default categories don't have one. - if(level == VideoCollectionCommon::ELevelAlbum && - mToolbarCollectionActionGroup && mToolbarActions.contains(ETBActionCollections)) - { - mToolbarActions[ETBActionCollections]->setChecked(false); - toolBar()->addActions(mToolbarCollectionActionGroup->actions()); - } -} - -// ------------------------------------------------------------------------------------------------- -// finishCollectionClosedSlot -// ------------------------------------------------------------------------------------------------- -// -void VideoListView::finishCollectionClosedSlot(const HbEffect::EffectStatus &status) -{ - FUNC_LOG; - Q_UNUSED(status); - - mTransitionOngoing = false; - - // open collection view - openCollectionViewSlot(); - - // update toolbar - if(mToolbarViewsActionGroup && mToolbarActions.contains(ETBActionCollections)) - { - toolBar()->addActions(mToolbarViewsActionGroup->actions()); - mToolbarActions[ETBActionCollections]->setChecked(true); - } + // restore animations for collection content widget + collectionContentWidget->setEnabledAnimations(animationState); + } // ------------------------------------------------------------------------------------------------- diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/src/videolistwidget.cpp --- a/videocollection/videocollectionview/src/videolistwidget.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/src/videolistwidget.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -381,7 +381,24 @@ { QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg( variant.toString()); - if(HbMessageBox::question(text)) + + HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->open(this, SLOT(deleteItemDialogFinished(HbAction *))); + } +} + +// --------------------------------------------------------------------------- +// deleteItemDialogFinished +// --------------------------------------------------------------------------- +// +void VideoListWidget::deleteItemDialogFinished(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + QModelIndex index = currentIndex(); + if(index.isValid()) { QModelIndexList list; list.append(index); @@ -416,15 +433,17 @@ if (service == VideoServices::EUriFetcher) { + mContextMenuActions[EActionAttach] = + mContextMenu->addAction(hbTrId("txt_videos_menu_attach"), this, SLOT(openItemSlot())); mContextMenuActions[EActionPlay] = - mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(openItemSlot())); + mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(playItemSlot())); mContextMenuActions[EActionDetails] = mContextMenu->addAction(hbTrId("txt_common_menu_details"), this, SLOT(openDetailsSlot())); } else if (service == VideoServices::EBrowse) { mContextMenuActions[EActionPlay] = - mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(openItemSlot())); + mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(playItemSlot())); mContextMenuActions[EActionDelete] = mContextMenu->addAction(hbTrId("txt_common_menu_delete"), this, SLOT(deleteItemSlot())); mContextMenuActions[EActionDetails] = @@ -433,7 +452,7 @@ else { mContextMenuActions[EActionPlay] = - mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(openItemSlot())); + mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(playItemSlot())); mContextMenuActions[EActionOpen] = mContextMenu->addAction(hbTrId("txt_common_menu_open"), this, SLOT(openItemSlot())); mContextMenuActions[EActionAddToCollection] = @@ -503,6 +522,8 @@ { mContextMenuActions[EActionAddToCollection]->setVisible(true); mContextMenuActions[EActionDelete]->setVisible(true); + } else { + mContextMenuActions[EActionAttach]->setVisible(true); } mContextMenuActions[EActionPlay]->setVisible(true); mContextMenuActions[EActionDetails]->setVisible(true); @@ -523,7 +544,9 @@ { mContextMenuActions[EActionRemove]->setVisible(true); mContextMenuActions[EActionDelete]->setVisible(true); - } + } else { + mContextMenuActions[EActionAttach]->setVisible(true); + } mContextMenuActions[EActionPlay]->setVisible(true); mContextMenuActions[EActionDetails]->setVisible(true); } @@ -575,12 +598,21 @@ emit activated(modelIndex); return; } + doEmitActivated(modelIndex); +} + +// --------------------------------------------------------------------------- +// doEmitActivated +// --------------------------------------------------------------------------- +// +void VideoListWidget::doEmitActivated (const QModelIndex &index) +{ if(mIsService && mVideoServices && mVideoServices->currentService() == VideoServices::EUriFetcher && mCurrentLevel != VideoCollectionCommon::ELevelCategory) { - QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath); + QVariant variant = mModel->data(index, VideoCollectionCommon::KeyFilePath); if ( variant.isValid() ) { QString itemPath = variant.value(); @@ -589,7 +621,7 @@ } else { - doActivateItem(modelIndex); + doActivateItem(index); } } @@ -632,7 +664,7 @@ { FUNC_LOG_ADDR(this); HbAbstractItemView::SelectionMode selMode = HbAbstractItemView::NoSelection; - if(mode >= HbAbstractItemView::NoSelection && mode <= HbAbstractItemView::ContiguousSelection) + if(mode >= HbAbstractItemView::NoSelection && mode <= HbAbstractItemView::MultiSelection) { selMode = HbAbstractItemView::SelectionMode(mode); } @@ -706,10 +738,20 @@ } // --------------------------------------------------------------------------- +// openItemSlot +// --------------------------------------------------------------------------- +// +void VideoListWidget::openItemSlot() +{ + FUNC_LOG_ADDR(this); + doEmitActivated(currentIndex()); +} + +// --------------------------------------------------------------------------- // playItemSlot // --------------------------------------------------------------------------- // -void VideoListWidget::openItemSlot() +void VideoListWidget::playItemSlot() { FUNC_LOG_ADDR(this); doActivateItem(currentIndex()); @@ -746,15 +788,37 @@ if(variant.isValid() && itemId.iId2 == KVcxMvcMediaTypeAlbum) { - bool ok = false; QString label(hbTrId("txt_videos_title_enter_name")); QString albumName = variant.toString(); - QString newAlbumName; + + HbInputDialog *dialog = new HbInputDialog(); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->getText(label, this, SLOT(renameDialogFinished(HbAction *)), albumName); + } +} + +// ------------------------------------------------------------------------------------------------- +// renameDialogFinished +// ------------------------------------------------------------------------------------------------- +// +void VideoListWidget::renameDialogFinished(HbAction *action) +{ + Q_UNUSED(action); - // Query a name for the collection - newAlbumName = HbInputDialog::getText(label, albumName, &ok); - // Rename only when name has changed. - if(ok && newAlbumName.length() && newAlbumName.trimmed() != albumName) + HbInputDialog *dialog = static_cast(sender()); + + QModelIndex index = currentIndex(); + TMPXItemId itemId = mModel->getMediaIdAtIndex(index); + QVariant newNameVariant = dialog->value(); + QVariant oldNameVariant = mModel->data(index, VideoCollectionCommon::KeyTitle); + + if(dialog->actions().first() == action && + oldNameVariant.isValid() && newNameVariant.isValid() && itemId.iId2 == KVcxMvcMediaTypeAlbum) + { + QString newAlbumName = newNameVariant.toString(); + QString oldAlbumName = oldNameVariant.toString(); + + if(newAlbumName.length() && newAlbumName.trimmed() != oldAlbumName) { // Resolve collection true name and rename the album newAlbumName = mModel->resolveAlbumName(newAlbumName); @@ -762,7 +826,6 @@ } } } - // --------------------------------------------------------------------------- // addToCollectionSlot // --------------------------------------------------------------------------- @@ -828,11 +891,27 @@ { QString text = hbTrId("txt_videos_info_do_you_want_to_remove_collection").arg( variant.toString()); - if(HbMessageBox::question(text)) + HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->open(this, SLOT(removeCollectionDialogFinished(HbAction *))); + } +} + +// --------------------------------------------------------------------------- +// removeCollectionDialogFinished +// --------------------------------------------------------------------------- +// +void VideoListWidget::removeCollectionDialogFinished(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + QModelIndex index = currentIndex(); + if(index.isValid()) { QModelIndexList list; list.append(index); - mModel->removeAlbums(list); + mModel->removeAlbums(list); } } } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h --- a/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Fri Apr 30 09:52:11 2010 +0300 @@ -198,16 +198,6 @@ */ void testRemoveVideosFromCollectionSlot(); - /** - * Tests finishCollectionOpenedSlot - */ - void testFinishCollectionOpenedSlot(); - - /** - * Tests finishCollectionClosedSlot - */ - void testFinishCollectionClosedSlot(); - signals: // Signals needed in tests. diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp --- a/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 36 % +// Version : %version: 38 % #define private public #include "videoservices.h" @@ -544,6 +544,114 @@ QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelVideos); QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, TMPXItemId::InvalidId()); cleanup(); + + // activate view: + // -browse service + // -captured category + // -sort role 0 (default, date & time) + init(false); + XQServiceUtilXtra *serviceUtilXtra = XQServiceUtilXtra::instance(); + serviceUtilXtra->setCurrentService(true); + VideoServices *videoServices = VideoServices::instance(0); + videoServices->mCurrentService = VideoServices::EBrowse; + videoServices->mSortRole = 0; + VideoListWidgetData::reset(); + VideoSortFilterProxyModelData::reset(); + itemId.iId1 = KVcxMvcCategoryIdCaptured; + itemId.iId2 = KVcxMvcMediaTypeCategory; + QCOMPARE(mTestView->initializeView(), 0); + QCOMPARE(mTestView->activateView(itemId), 0); + QVERIFY(VideoListWidgetData::mActive); + QCOMPARE(VideoListWidgetData::mActivateCount, 1); + QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured")); + QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl); + QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId); + QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime); + QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder); + serviceUtilXtra->decreaseReferenceCount(); + videoServices->decreaseReferenceCount(); + cleanup(); + + // activate view: + // -browse service + // -captured category + // -sort role 1 (date & time) + init(false); + serviceUtilXtra = XQServiceUtilXtra::instance(); + serviceUtilXtra->setCurrentService(true); + videoServices = VideoServices::instance(0); + videoServices->mCurrentService = VideoServices::EBrowse; + videoServices->mSortRole = 1; + VideoListWidgetData::reset(); + VideoSortFilterProxyModelData::reset(); + itemId.iId1 = KVcxMvcCategoryIdCaptured; + itemId.iId2 = KVcxMvcMediaTypeCategory; + QCOMPARE(mTestView->initializeView(), 0); + QCOMPARE(mTestView->activateView(itemId), 0); + QVERIFY(VideoListWidgetData::mActive); + QCOMPARE(VideoListWidgetData::mActivateCount, 1); + QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured")); + QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl); + QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId); + QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime); + QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder); + cleanup(); + serviceUtilXtra->decreaseReferenceCount(); + videoServices->decreaseReferenceCount(); + + // activate view: + // -browse service + // -captured category + // -sort role 2 (title) + init(false); + serviceUtilXtra = XQServiceUtilXtra::instance(); + serviceUtilXtra->setCurrentService(true); + videoServices = VideoServices::instance(0); + videoServices->mCurrentService = VideoServices::EBrowse; + videoServices->mSortRole = 2; + VideoListWidgetData::reset(); + VideoSortFilterProxyModelData::reset(); + itemId.iId1 = KVcxMvcCategoryIdCaptured; + itemId.iId2 = KVcxMvcMediaTypeCategory; + QCOMPARE(mTestView->initializeView(), 0); + QCOMPARE(mTestView->activateView(itemId), 0); + QVERIFY(VideoListWidgetData::mActive); + QCOMPARE(VideoListWidgetData::mActivateCount, 1); + QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured")); + QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl); + QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId); + QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle); + QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder); + cleanup(); + serviceUtilXtra->decreaseReferenceCount(); + videoServices->decreaseReferenceCount(); + + // activate view: + // -browse service + // -captured category + // -sort role 3 (size) + init(false); + serviceUtilXtra = XQServiceUtilXtra::instance(); + serviceUtilXtra->setCurrentService(true); + videoServices = VideoServices::instance(0); + videoServices->mCurrentService = VideoServices::EBrowse; + videoServices->mSortRole = 3; + VideoListWidgetData::reset(); + VideoSortFilterProxyModelData::reset(); + itemId.iId1 = KVcxMvcCategoryIdCaptured; + itemId.iId2 = KVcxMvcMediaTypeCategory; + QCOMPARE(mTestView->initializeView(), 0); + QCOMPARE(mTestView->activateView(itemId), 0); + QVERIFY(VideoListWidgetData::mActive); + QCOMPARE(VideoListWidgetData::mActivateCount, 1); + QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured")); + QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl); + QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId); + QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeySizeValue); + QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder); + cleanup(); + serviceUtilXtra->decreaseReferenceCount(); + videoServices->decreaseReferenceCount(); } // --------------------------------------------------------------------------- @@ -784,7 +892,27 @@ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime); QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder); QVERIFY(VideoSortFilterProxyModelData::mSortAsync); - + cleanup(); + + // start sorting slot: + // -is service + init(false); + connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting())); + sortMenu = mUiLoader->findWidget(DOCML_NAME_SORT_MENU); + sortMenuAction->setMenu(sortMenu); + HbMenuData::mMenuAction = sortMenuAction; + mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->setActiveAction(sortMenuAction); + sortAction = mUiLoader->findObject(DOCML_NAME_SORT_BY_NAME); + QVERIFY(sortAction != 0); + sortMenu->setActiveAction(sortAction); + XQServiceUtilXtra *serviceUtilXtra = XQServiceUtilXtra::instance(); + serviceUtilXtra->setCurrentService(true); + QCOMPARE(mTestView->initializeView(), 0); + QCOMPARE(mTestView->activateView(TMPXItemId::InvalidId()), 0); + int sortRole = VideoCollectionViewUtilsData::mVideoSortRole; + emit testSignal(0); + QCOMPARE(sortRole, VideoCollectionViewUtilsData::mVideoSortRole); + serviceUtilXtra->decreaseReferenceCount(); cleanup(); } @@ -1067,10 +1195,14 @@ // index is invalid init(); + emit testCollectionOpenedSignal(true, testString, QModelIndex()); cleanup(); // current list is null init(); + VideoListWidget *tmpList = mTestView->mCurrentList; + emit testCollectionOpenedSignal(true, testString, index); + mTestView->mCurrentList = tmpList; cleanup(); // current list is collectioncontentwidget @@ -1202,13 +1334,12 @@ //////// // toolbar setup mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->setVisible(true); - mTestView->mToolbarActions[VideoListView::ETBActionAddVideos]->setVisible(true); + // mToolbarViewsActionGroup is null QActionGroup *tmp = mTestView->mToolbarViewsActionGroup; mTestView->mToolbarViewsActionGroup = 0; emit testLayoutChangedSignal(); QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible()); - QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionAddVideos]->isVisible()); mTestView->mToolbarViewsActionGroup = tmp; // mToolbarCollectionActionGroup is null @@ -1216,34 +1347,29 @@ mTestView->mToolbarCollectionActionGroup = 0; emit testLayoutChangedSignal(); QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible()); - QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionAddVideos]->isVisible()); mTestView->mToolbarCollectionActionGroup = tmp; // mIsService is true mTestView->mIsService = true; emit testLayoutChangedSignal(); QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible()); - QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionAddVideos]->isVisible()); mTestView->mIsService = false; // show -flag is true, currentlist level != VideoCollectionCommon::ELevelDefaultColl mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelAlbum); emit testLayoutChangedSignal(); QVERIFY(!mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible()); - QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionAddVideos]->isVisible()); mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->setVisible(true); // show -flag is true, currentlist level == VideoCollectionCommon::ELevelDefaultColl mTestView->mCurrentList->activate(VideoCollectionCommon::ELevelDefaultColl); emit testLayoutChangedSignal(); QVERIFY(!mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible()); - QVERIFY(!mTestView->mToolbarActions[VideoListView::ETBActionAddVideos]->isVisible()); // show -flag is false setRowCount(1); emit testLayoutChangedSignal(); QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos]->isVisible()); - QVERIFY(mTestView->mToolbarActions[VideoListView::ETBActionAddVideos]->isVisible()); /////// // sub label @@ -1582,90 +1708,4 @@ cleanup(); } -// --------------------------------------------------------------------------- -// testFinishCollectionOpenedSlot -// --------------------------------------------------------------------------- -// -void TestListView::testFinishCollectionOpenedSlot() -{ - XQServiceUtilXtra *serviceUtil = XQServiceUtilXtra::instance(); - serviceUtil->setCurrentService(false); - - init(false); - - QVERIFY(connect(this, SIGNAL(testSignal(const HbEffect::EffectStatus &)), mTestView, - SLOT(finishCollectionOpenedSlot(const HbEffect::EffectStatus &)))); - - QVERIFY(mTestView->initializeView() == 0); - mTestView->activateView(TMPXItemId::InvalidId()); - - HbEffect::EffectStatus status; - - // Invalid status.userData - mTestView->mTransitionOngoing = true; - emit testSignal(status); - QVERIFY(!mTestView->mTransitionOngoing); - // TODO: verify - - // Category is not album - QVERIFY(mTestView->toolBar()); - mTestView->toolBar()->clearActions(); - mTestView->mTransitionOngoing = true; - status.userData = QVariant(static_cast(VideoCollectionCommon::ELevelCategory)); - emit testSignal(status); - QVERIFY(!mTestView->mTransitionOngoing); - QVERIFY(mTestView->toolBar()->actions().count() == 0); - - // Category is album - QVERIFY(mTestView->toolBar()); - mTestView->toolBar()->clearActions(); - mTestView->mTransitionOngoing = true; - status.userData = QVariant(static_cast(VideoCollectionCommon::ELevelAlbum)); - emit testSignal(status); - QVERIFY(!mTestView->mTransitionOngoing); - QVERIFY(mTestView->toolBar()->actions().count() > 0); - - disconnect(this, SIGNAL(testSignal(const HbEffect::EffectStatus &)), mTestView, - SLOT(finishCollectionOpenedSlot(const HbEffect::EffectStatus &))); - - cleanup(); - - // final cleanup - serviceUtil->decreaseReferenceCount(); -} - -// --------------------------------------------------------------------------- -// testFinishCollectionOpenedSlot -// --------------------------------------------------------------------------- -// -void TestListView::testFinishCollectionClosedSlot() -{ - init(false); - - QVERIFY(connect(this, SIGNAL(testSignal(const HbEffect::EffectStatus &)), mTestView, - SLOT(finishCollectionClosedSlot(const HbEffect::EffectStatus &)))); - - QVERIFY(mTestView->initializeView() == 0); - mTestView->activateView(TMPXItemId::InvalidId()); - - HbEffect::EffectStatus status; - - mTestView->mTransitionOngoing = true; - emit testSignal(status); - QVERIFY(!mTestView->mTransitionOngoing); - - mTestView->mTransitionOngoing = true; - QActionGroup *tmp = mTestView->mToolbarViewsActionGroup; - mTestView->mToolbarViewsActionGroup = 0; - emit testSignal(status); - QVERIFY(!mTestView->mTransitionOngoing); - mTestView->mToolbarViewsActionGroup = tmp; - - - disconnect(this, SIGNAL(testSignal(const HbEffect::EffectStatus &)), mTestView, - SLOT(finishCollectionClosedSlot(const HbEffect::EffectStatus &))); - - cleanup(); -} - // End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h --- a/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 24 % +// Version : %version: 25 % #ifndef __TESTLISTWIDGET_H__ #define __TESTLISTWIDGET_H__ @@ -136,6 +136,11 @@ void testOpenItemSlot(); /** + * verifies openItemSlot + */ + void testPlayItemSlot(); + + /** * verifies addToCollectionSlot */ void testAddToCollectionSlot(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp --- a/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 46 % +// Version : %version: 47 % #include #include @@ -400,7 +400,7 @@ QSignalSpy spysignalActivated(mTestWidget, SIGNAL(activated(const QModelIndex&))); mTestWidget->initialize(*model); - mTestWidget->activate(); + mTestWidget->activate(); VideoSortFilterProxyModelData::mLastItemId = TMPXItemId::InvalidId(); TMPXItemId savedId = TMPXItemId(1,1); @@ -642,7 +642,8 @@ QVERIFY(mTestWidget->activate(VideoCollectionCommon::ELevelDefaultColl) == 0); mTestWidget->mItem->mModelIndex = model->index(0, 0, QModelIndex()); mTestWidget->callLongPressedSlot(item, point); - QCOMPARE(mTestWidget->mContextMenuActions.count(), 2); + QCOMPARE(mTestWidget->mContextMenuActions.count(), 3); + QVERIFY(mTestWidget->mContextMenuActions[VideoListWidget::EActionAttach]->isVisible()); QVERIFY(mTestWidget->mContextMenuActions[VideoListWidget::EActionPlay]->isVisible()); QVERIFY(mTestWidget->mContextMenuActions[VideoListWidget::EActionDetails]->isVisible()); @@ -820,10 +821,13 @@ mTestWidget->initialize(*model); HbListView::mCurrentIndex = model->index(0, 0, QModelIndex()); mTestWidget->mItem->mModelIndex = HbListView::mCurrentIndex ; + VideoServices *videoServices = VideoServices::instance(); mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelAlbum; VideoSortFilterProxyModelData::mItemIds.append(itemId); mTestWidget->mIsService = true; + mTestWidget->mVideoServices = videoServices; + videoServices->mCurrentService = VideoServices::EUriFetcher; mTestWidget->callLongPressedSlot(item, point); iter = mTestWidget->mContextMenuActions.begin(); QVERIFY(iter != mTestWidget->mContextMenuActions.end()); @@ -836,7 +840,7 @@ } ++iter; } - QVERIFY(visibleCount == 2); + QVERIFY(visibleCount == 3); //invalid level mTestWidget->mCurrentLevel = (VideoCollectionCommon::TCollectionLevels)0; @@ -1059,6 +1063,9 @@ // void TestListWidget::testOpenItemSlot() { + // testEmitActivated has already tested the doEmitActivated functionality. + // Just verify here, that the openItemSlot calls doEmitActivated. + VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance(); VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos); mTestWidget->initialize(*model); @@ -1069,6 +1076,15 @@ VideoSortFilterProxyModelData::mItemIds.append(savedId); HbListView::mCurrentIndex = model->index(0, 0, QModelIndex()); + // Making the context menu visible ensures that the doEmitActivated is called + // instead of just emitActivated, as emitActivated does nothing if context menu + // is already visible. + if (!mTestWidget->mContextMenu) + { + mTestWidget->mContextMenu = new HbMenu; + } + mTestWidget->mContextMenu->show(); + emit testSignal(); QVERIFY(VideoSortFilterProxyModelData::mLastItemId == savedId); @@ -1077,6 +1093,29 @@ } // --------------------------------------------------------------------------- +// testPlayItemSlot +// --------------------------------------------------------------------------- +// +void TestListWidget::testPlayItemSlot() +{ + VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance(); + VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos); + mTestWidget->initialize(*model); + connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playItemSlot())); + setRowCount(1); + TMPXItemId savedId = TMPXItemId(1,1); + VideoSortFilterProxyModelData::mItemIds.clear(); + VideoSortFilterProxyModelData::mItemIds.append(savedId); + HbListView::mCurrentIndex = model->index(0, 0, QModelIndex()); + + emit testSignal(); + + QVERIFY(VideoSortFilterProxyModelData::mLastItemId == savedId); + + disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playItemSlot())); +} + +// --------------------------------------------------------------------------- // testAddToCollectionSlot // --------------------------------------------------------------------------- // diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/inc/videocollectionutils.h --- a/videocollection/videocollectionwrapper/inc/videocollectionutils.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videocollectionutils.h Fri Apr 30 09:52:11 2010 +0300 @@ -125,14 +125,6 @@ QString prepareLengthString(quint32 length); /** - * Prepares length string from given value in short format. - * - * @param length Length value in seconds. - * @return Length as QString (for example "00:25:10"). - */ - const QString prepareShortLengthString(quint32 total); - - /** * Prepares size string from the given value. * * @param size Size value in bytes diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h --- a/videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h Fri Apr 30 09:52:11 2010 +0300 @@ -31,7 +31,6 @@ class VideoListDataModel; class VideoSortFilterProxyModel; -// TODO: MVcxNsMyVideosCategoryModelObserver implementation should probably not be in this class class VideoCollectionWrapperPrivate : public QObject { Q_DISABLE_COPY(VideoCollectionWrapperPrivate) diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/inc/videolistdatamodel.h --- a/videocollection/videocollectionwrapper/inc/videolistdatamodel.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videolistdatamodel.h Fri Apr 30 09:52:11 2010 +0300 @@ -283,7 +283,7 @@ * * @return QString detail string */ - QString doDetailRow(int index, const QString duration) const; + QString doDetailRow(int index) const; /** * Generates a video count string for category or album at given index. @@ -317,18 +317,6 @@ * @data data from operation */ void reportAsyncStatus(int statusCode, QVariant &additional); - - /** - * Generates a short video length string from video item at given index - * - * In case item is not found in the provided index, empty - * string is returned. - * - * @param index, index of the item data is requested - * - * @return Lengths as QString, (for example "00:25:10"). - */ - QString prepareShortLengthString(int index) const; private: diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h --- a/videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h Fri Apr 30 09:52:11 2010 +0300 @@ -19,12 +19,13 @@ #define __VIDEOTHUMBNAILDATAPRIVATE_H__ // INCLUDES -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -201,11 +202,11 @@ * for some item. Thumbnail data is saved to icon cache. * * @param tnData: thumbnail - * @param internal: internal data contains pointer to the media id used in emitted signal + * @param mediaId: pointer to the media id used in emitted signal * @param error: possible error code from thumbnail manager ( 0 == ok ) * */ - void thumbnailReadySlot(QPixmap tnData, void *internal, int error); + void thumbnailReadySlot(QPixmap tnData, const TMPXItemId &mediaId, int error); /** * VideoListDataModel signals this slot when the model has been changed. diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/inc/videothumbnailfetcher.h --- a/videocollection/videocollectionwrapper/inc/videothumbnailfetcher.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/inc/videothumbnailfetcher.h Fri Apr 30 09:52:11 2010 +0300 @@ -23,7 +23,7 @@ #include #include #include - +#include #include // FORWARD DECLARATIONS @@ -55,11 +55,11 @@ * when fetch is complete. * * @param fileName path to the media. - * @param internal data identifying the media. + * @param mediaId mpx id for the media. * @param priority priority for the fetch. * */ - void addFetch(const QString fileName, void *internal, int priority); + void addFetch(const QString fileName, const TMPXItemId &mediaId, int priority); /** * Empties fetch list. This does not cancel the possible ongoing fetch on @@ -86,9 +86,12 @@ * started without create thumbnail flag. If there's not any of those, * starts creating thumbnails for fetches that have no thumbnail yet. * Signal allThumbnailsFetched is emitted if there's nothing to do. - * + * + * @param cancelOngoingFetches if true then all ongoing thumbnail fetches + * will be canceled. + * */ - void continueFetching(); + void continueFetching(bool cancelOngoingFetches); /** * Enables or disables the thumbnail creation for videos that do @@ -104,10 +107,10 @@ class ThumbnailFetchData { public: - ThumbnailFetchData() { mInternal = 0; }; QString mFileName; int mPriority; - void *mInternal; + TMPXItemId mMediaId; + int mRequestId; }; protected: @@ -117,9 +120,12 @@ * disabled. Thumbnail manager signals to thumbnailReadySlot. If thumbnail * fetch fails with -1 the fetch is added to thumbnail creation list, * otherwise signal thumbnailReady signal emitted. + * + * @param cancelOngoingFetches if true then all ongoing thumbnail fetches + * will be canceled. * */ - void startThumbnailFetches(); + void startThumbnailFetches(bool cancelOngoingFetches); /** * Starts fetching thumbnail with highest priority from creation list. @@ -136,11 +142,11 @@ * thumbnail fetch process is complete. * * @param tnData thumbnail - * @param internal internal data to identify the request + * @param mediaId mpx id for the media. * @param error possible error code from thumbnail manager ( 0 == ok ) * */ - void thumbnailReady(QPixmap tnData, void *internal, int error); + void thumbnailReady(QPixmap tnData, const TMPXItemId &mediaId, int error); /** * Signaled when all the fetches have been done. @@ -167,35 +173,38 @@ /** * Thumbnail manager object. */ - ThumbnailManager *mThumbnailManager; + ThumbnailManager *mThumbnailManager; /** * List containing not started thumbnail fetches. + * + * key is mpx id. + * value is thumbnail fetch data. */ - QList mFetchList; + QHash mFetchList; /** * Hash containing ongoing thumbnail fetches. * - * key is thumbnail request id. - * value is thumbnail fetch data. + * key is mpx id. + * value is thumbnail fetch data. */ - QHash mStartedFetchList; + QHash mStartedFetchList; /** * List containing thumbnails that have not been created yet. */ - QList mCreationList; + QList mCreationList; /** * Flag indicating if fetching has been paused. */ - bool mPaused; + bool mPaused; /** * Flag indicating if thumbnail creation is enabled. */ - bool mTbnCreationEnabled; + bool mTbnCreationEnabled; }; #endif // __VIDEOTHUMBNAILDATAFETCHER_H__ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/src/videocollectionutils.cpp --- a/videocollection/videocollectionwrapper/src/videocollectionutils.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videocollectionutils.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 15 % // INCLUDE FILES #include @@ -63,86 +63,31 @@ FUNC_LOG; const int secondsInMinute( 60 ); const int secondsInHour( 3600 ); - QString hour; - QString min; - QString sec; - HbExtendedLocale locale = HbExtendedLocale::system(); - - if ( length > 0 ) + quint32 hours = length / secondsInHour; + quint32 minutes = length / secondsInMinute % secondsInMinute; + quint32 seconds = length % secondsInMinute; + + QString hrs(QString::number(hours)); + if(hours < 10) { - quint32 hours = length / secondsInHour; - quint32 minutes = length / secondsInMinute % secondsInMinute; - quint32 seconds = length % secondsInMinute; - - if ( hours > 0 ) - { - if(hours == 1) - { - hour = QObject::tr("%1 hour ").arg(locale.toString(hours)); //localisation - } - else - { - hour = QObject::tr("%1 hours ").arg(locale.toString(hours)); //localisation - } - } - - if ( minutes > 0 ) - { - if(minutes == 1) - { - min = QObject::tr("%1 minute ").arg(locale.toString(minutes)); //localisation - } - else - { - min = QObject::tr("%1 minutes ").arg(locale.toString(minutes)); //localisation - } - } - if (seconds > 0) - { - if(seconds == 1) - { - sec = QObject::tr("%1 second").arg(locale.toString(seconds)); //localisation - } - else - { - sec = QObject::tr("%1 seconds").arg(locale.toString(seconds)); //localisation - } - } - } - else + hrs.prepend(QString::number(0)); + } + QString mins(QString::number(minutes)); + if(minutes < 10) { - sec = QObject::tr("0 seconds"); //localisation + mins.prepend(QString::number(0)); + } + QString secs(QString::number(seconds)); + if(seconds < 10) + { + secs.prepend(QString::number(0)); } - QString lengthStr(hbTrId( "txt_videos_list_l1_l2_l3" ).arg( hour ).arg( min ).arg( sec )); + QString lengthStr(hbTrId( "txt_videos_list_l1l2l3" ).arg( hrs ).arg( mins ).arg( secs )); return lengthStr.trimmed(); } -// ----------------------------------------------------------------------------- -// VideoCollectionUtils::prepareShortLengthString() -// ----------------------------------------------------------------------------- -// -const QString VideoCollectionUtils::prepareShortLengthString(quint32 total) -{ - const int secondsInMinute( 60 ); - const int secondsInHour( 3600 ); - - int hour = total / secondsInHour; - total = total % secondsInHour; - int minutes = total / secondsInMinute; - total = total % secondsInMinute; - int second = total; - - QTime time( hour ,minutes ,second ); - QString str; - - HbExtendedLocale locale = HbExtendedLocale::system(); - - str = locale.format( time, r_qtn_time_durat_long_with_zero ); - - return str; -} // ----------------------------------------------------------------------------- // prepareSizeString diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/src/videolistdatamodel.cpp --- a/videocollection/videocollectionwrapper/src/videolistdatamodel.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videolistdatamodel.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 51 % +// Version : %version: 52 % // INCLUDE FILES #include @@ -262,9 +262,7 @@ } else //video { - const QString duration = prepareShortLengthString( index ); - - retString = doDetailRow(index, duration); + retString = doDetailRow(index); } return retString; } @@ -305,52 +303,73 @@ } // ----------------------------------------------------------------------------- -// VideoListDataModel::prepareShortLengthString() -// ----------------------------------------------------------------------------- -// -QString VideoListDataModel::prepareShortLengthString(int index) const -{ - quint32 total = d_ptr->getVideodurationFromIndex(index); - return VideoCollectionUtils::instance().prepareShortLengthString(total); -} - -// ----------------------------------------------------------------------------- // VideoListDataModel::doDetailRow() // ----------------------------------------------------------------------------- // -QString VideoListDataModel::doDetailRow(int index, const QString duration) const +QString VideoListDataModel::doDetailRow(int index) const { - QString detailStr(""); + QString detailStr(""); quint32 size = d_ptr->getVideoSizeFromIndex(index); + + quint32 total = d_ptr->getVideodurationFromIndex(index); - const int videoSizeGB( 0x40000000 ); + + const int secondsInMinute( 60 ); + const int secondsInHour( 3600 ); + + const int videoSizeGB( 0x40000000 ); const int videoSizeHalfGB( 0x20000000 ); const int videoSizeMB( 0x100000 ); const int videoSizeHalfMB( 0x80000 ); const int videoSizeKB( 0x400 ); quint32 dispSize = 0; + + int hour = total / secondsInHour; + total = total % secondsInHour; + int minutes = total / secondsInMinute; + total = total % secondsInMinute; + int second = total; - if ( size >= videoSizeGB ) + QString hrs(QString::number(hour)); + if(hour < 10) + { + hrs.prepend(QString::number(0)); + } + QString mins(QString::number(minutes)); + if(minutes < 10) + { + mins.prepend(QString::number(0)); + } + QString secs(QString::number(second)); + if(second < 10) + { + secs.prepend(QString::number(0)); + } + + const char* loc = "txt_videos_dblist_captured_val_l1_l2_gb"; + + if ( size >= videoSizeGB ) { dispSize = size + videoSizeHalfGB; dispSize /= videoSizeGB; - detailStr = hbTrId("txt_videos_dblist_captured_val_l1_l2_gb").arg(duration).arg(QString::number(dispSize)); } else if ( size >= videoSizeMB ) { dispSize = size + videoSizeHalfMB; dispSize /= videoSizeMB; - detailStr = hbTrId("txt_videos_dblist_captured_val_l1_l2_mb").arg(duration).arg(QString::number(dispSize)); + loc = "txt_videos_dblist_captured_val_l1_l2_mb"; } else { dispSize = size + videoSizeKB; dispSize /= videoSizeKB; - detailStr = hbTrId("txt_videos_dblist_captured_val_l1_l2_kb").arg(duration).arg(QString::number(dispSize)); + loc = "txt_videos_dblist_captured_val_l1_l2_kb"; } + detailStr = hbTrId(loc).arg(hrs).arg(mins).arg(secs).arg(QString::number(dispSize)); + return detailStr; } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp --- a/videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 37 % // INCLUDE FILES #include @@ -760,7 +760,6 @@ map[MetaKeyDate] = locale.format( date.date(), r_qtn_date_usual ); } - //TODO: Localisation // MetaKeyDurationString quint32 dur = getVideoDuration(media); QString duration = VideoCollectionUtils::instance().prepareLengthString(dur); @@ -768,7 +767,6 @@ map[MetaKeyDurationString] = duration; } - //TODO: Localisation // MetaKeySizeString quint32 s; VideoCollectionUtils::instance().mediaValue(media, KMPXMediaGeneralSize, s ); @@ -798,7 +796,7 @@ quint64 dateTimeValue; if(VideoCollectionUtils::instance().mediaValue(media, KVcxMediaMyVideosModifiedDate, dateTimeValue)) { TDateTime temp = TTime( dateTimeValue ).DateTime(); - QDateTime date = QDateTime(QDate(temp.Year(), temp.Month()+1, temp.Day()), + QDateTime date = QDateTime(QDate(temp.Year(), temp.Month()+1, temp.Day()+1), QTime(temp.Hour(), temp.Minute(), temp.Second(), temp.MicroSecond())); map[MetaKeyModifiedDate] = locale.format( date.date(), r_qtn_date_usual ); } @@ -848,7 +846,7 @@ bitrate = (double)bitrate / (double)1000 + 0.5; } - map[MetaKeyBitRate] = hbTrId(loc, bitrate); + map[MetaKeyBitRate] = hbTrId(loc).arg(bitrate); } // MetaKeyFormat diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp --- a/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 63 % +// Version : %version: 65 % // INCLUDE FILES #include @@ -791,10 +791,10 @@ if (mType == VideoCollectionCommon::EModelTypeCollectionContent) { INFO_1("VideoSortFilterProxyModel::albumChangedSlot() [0x%x] invalidating.", this); - //otherwise newle created album content won't sort + // sort and invalidate filtering, otherwise newle created album content won't sort + invalidateFilter(); setSortRole(mWantedSortRole); sort(0, mWantedSortOrder); - invalidateFilter(); } } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/src/videothumbnaildata.cpp --- a/videocollection/videocollectionwrapper/src/videothumbnaildata.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videothumbnaildata.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 26 % // INCLUDE FILES #include "videocollectiontrace.h" @@ -66,7 +66,7 @@ // bool VideoThumbnailData::removeThumbnail(TMPXItemId mediaId) { - FUNC_LOG; + INFO_2("VideoThumbnailData::removeThumbnail() mediaId (%d, %d)", mediaId.iId1, mediaId.iId2); return d_ptr->removeThumbnail(mediaId); } @@ -76,7 +76,7 @@ // const QIcon* VideoThumbnailData::getThumbnail(TMPXItemId mediaId) { - FUNC_LOG; + INFO_2("VideoThumbnailData::getThumbnail() mediaId (%d, %d)", mediaId.iId1, mediaId.iId2); return d_ptr->getThumbnail(mediaId); } @@ -86,7 +86,7 @@ // void VideoThumbnailData::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex) { - FUNC_LOG; + INFO_2("VideoThumbnailData::startBackgroundFetching() model: 0x%x, fetchIndex: %d", model, fetchIndex); d_ptr->startBackgroundFetching(model, fetchIndex); } @@ -96,7 +96,7 @@ // void VideoThumbnailData::enableBackgroundFetching(bool enable) { - FUNC_LOG; + INFO_1("VideoThumbnailData::enableBackgroundFetching() enable: %d", enable); d_ptr->enableBackgroundFetching(enable); } @@ -106,7 +106,7 @@ // void VideoThumbnailData::enableThumbnailCreation(bool enable) { - FUNC_LOG; + INFO_1("VideoThumbnailData::enableThumbnailCreation() enable: %d", enable); d_ptr->enableThumbnailCreation(enable); } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp --- a/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 20 % +// Version : %version: 21 % // INCLUDE FILES #include @@ -73,7 +73,7 @@ , mBackgroundFetchingEnabled( true ) { FUNC_LOG; - initialize(); + initialize(); } // ----------------------------------------------------------------------------- @@ -116,7 +116,7 @@ cleanup(); return -1; } - + return 0; } @@ -165,8 +165,8 @@ disconnect(model->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelChangedSlot())); disconnect(model->sourceModel(), SIGNAL(modelChanged()), this, SLOT(modelChangedSlot())); } - disconnect(mThumbnailFetcher, SIGNAL(thumbnailReady( QPixmap , void *, int )), - this, SLOT(thumbnailReadySlot( QPixmap , void *, int ))); + disconnect(mThumbnailFetcher, SIGNAL(thumbnailReady(QPixmap , const TMPXItemId &, int )), + this, SLOT(thumbnailReadySlot(QPixmap , const TMPXItemId &, int ))); disconnect(mThumbnailFetcher, SIGNAL(allThumbnailsFetched()), this, SLOT(allThumbnailsFetchedSlot())); disconnect(mBgFetchTimer, SIGNAL(timeout()), this, SLOT(doBackgroundFetching())); @@ -188,8 +188,8 @@ VideoCollectionWrapper::instance().getModel(VideoCollectionCommon::EModelTypeAllVideos); if(!model) return -1; - if(!connect(mThumbnailFetcher, SIGNAL(thumbnailReady( QPixmap , void *, int )), - this, SLOT(thumbnailReadySlot( QPixmap , void *, int))) || + if(!connect(mThumbnailFetcher, SIGNAL(thumbnailReady( QPixmap , const TMPXItemId &, int )), + this, SLOT(thumbnailReadySlot( QPixmap , const TMPXItemId &, int))) || !connect(mThumbnailFetcher, SIGNAL(allThumbnailsFetched()), this, SLOT(allThumbnailsFetchedSlot())) || !connect(model->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelChangedSlot())) || @@ -253,7 +253,8 @@ int started = mThumbnailFetcher->fetchCount() - fetchCountBefore; - mThumbnailFetcher->continueFetching(); + // Start the fetches and cancel previous ones. + mThumbnailFetcher->continueFetching(true); return started; } @@ -280,11 +281,7 @@ // Thumbnail fetcher signals into thumbnailReadySlot when thumbnail ready if(fileName.length() > 0) { - // object containing media id to be passed throught - // thumbnail generation process. - TMPXItemId *internal = new TMPXItemId(mediaId.iId1, mediaId.iId2); - - mThumbnailFetcher->addFetch(fileName, internal, priority); + mThumbnailFetcher->addFetch(fileName, mediaId, priority); } return 0; @@ -367,19 +364,8 @@ // VideoThumbnailDataPrivate::thumbnailReadySlot() // ----------------------------------------------------------------------------- // -void VideoThumbnailDataPrivate::thumbnailReadySlot(QPixmap tnData, void *internal, int error) +void VideoThumbnailDataPrivate::thumbnailReadySlot(QPixmap tnData, const TMPXItemId &mediaId, int error) { - TMPXItemId mediaId(0, 0); - if(internal) - { - mediaId = *(static_cast(internal)); - delete internal; - } - else - { - return; - } - if(!error && !tnData.isNull()) { mThumbnailData.insert(mediaId, new QIcon(tnData)); @@ -537,7 +523,7 @@ { FUNC_LOG; // Stop timers. - if(mBgFetchTimer) + if(mBgFetchTimer) { mBgFetchTimer->stop(); } @@ -565,14 +551,9 @@ void VideoThumbnailDataPrivate::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex) { FUNC_LOG; - if(!mBackgroundFetchingEnabled || !mThumbnailFetcher) - { - return; - } - - mThumbnailFetcher->cancelFetches(); - - // If model is null, we continue using the current one. + + // If model is null, we continue using the current one. Model and index are kept up to date even + // fetching is not enabled. if(model) { mCurrentModel = model; @@ -580,6 +561,13 @@ mCurrentFetchIndex = fetchIndex; mCurrentBackgroundFetchCount = 0; + + if(!mBackgroundFetchingEnabled || !mThumbnailFetcher) + { + INFO("VideoThumbnailDataPrivate::startBackgroundFetching() fetching is disabled."); + return; + } + doBackgroundFetching(); } @@ -592,6 +580,7 @@ FUNC_LOG; if(!mBackgroundFetchingEnabled) { + INFO("VideoThumbnailDataPrivate::continueBackgroundFetch() fetching is disabled.") return; } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/src/videothumbnailfetcher.cpp --- a/videocollection/videocollectionwrapper/src/videothumbnailfetcher.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/src/videothumbnailfetcher.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 4 % // INCLUDE FILES #include @@ -24,6 +24,15 @@ #include "videothumbnailfetcher.h" #include "videocollectiontrace.h" +/** + * global qHash function required fo creating hash values for TMPXItemId -keys + */ +inline uint qHash(TMPXItemId key) +{ + QPair keyPair(key.iId1, key.iId2); + + return qHash(keyPair); +} // ================= MEMBER FUNCTIONS ======================= // @@ -66,20 +75,21 @@ // VideoThumbnailFetcher::addFetch() // ----------------------------------------------------------------------------- // -void VideoThumbnailFetcher::addFetch(const QString fileName, void *internal, int priority) +void VideoThumbnailFetcher::addFetch(const QString fileName, const TMPXItemId &mediaId, int priority) { ThumbnailFetchData *fetch = new ThumbnailFetchData; fetch->mFileName = fileName; - fetch->mInternal = internal; + fetch->mMediaId = mediaId; fetch->mPriority = priority; - mFetchList.append(fetch); + fetch->mRequestId = -1; + mFetchList.insert(mediaId, fetch); } // ----------------------------------------------------------------------------- // VideoThumbnailFetcher::continueFetching() // ----------------------------------------------------------------------------- // -void VideoThumbnailFetcher::continueFetching() +void VideoThumbnailFetcher::continueFetching(bool cancelOngoingFetches) { FUNC_LOG; mPaused = false; @@ -88,7 +98,7 @@ // start thumbnail creation for one thumbnail at a time. if(!mFetchList.isEmpty()) { - startThumbnailFetches(); + startThumbnailFetches(cancelOngoingFetches); } else if(!mCreationList.isEmpty()) { @@ -106,9 +116,10 @@ // VideoThumbnailFetcher::startThumbnailFetches() // ----------------------------------------------------------------------------- // -void VideoThumbnailFetcher::startThumbnailFetches() +void VideoThumbnailFetcher::startThumbnailFetches(bool cancelOngoingFetches) { FUNC_LOG; + if(!mThumbnailManager) { return; @@ -117,23 +128,57 @@ // Only fetch those thumbnails that are already been created. mThumbnailManager->setMode(ThumbnailManager::DoNotCreate); - // Push all from thumbnail manager. - while(!mFetchList.isEmpty()) + // Cancel ongoing fetches, but only those that are not in the list of new fetches. + if(cancelOngoingFetches) { - ThumbnailFetchData *fetch = mFetchList.takeFirst(); + QHash::iterator iter = mStartedFetchList.begin(); + while(iter != mStartedFetchList.end()) + { + if(!mFetchList.contains(iter.key())) + { + ThumbnailFetchData *fetch = iter.value(); + INFO_3("VideoThumbnailFetcher::startThumbnailFetches() canceling - mpx id: (%d, %d), requestId: %d", fetch->mMediaId.iId1, fetch->mMediaId.iId2, fetch->mRequestId); + mThumbnailManager->cancelRequest(fetch->mRequestId); + iter = mStartedFetchList.erase(iter); + delete fetch; + } + else + { + iter++; + } + } + } + + // Start fetches. + QHash::iterator iter = mFetchList.begin(); + while(iter != mFetchList.end()) + { + ThumbnailFetchData *fetch = iter.value(); + iter = mFetchList.erase(iter); - int requestId = mThumbnailManager->getThumbnail(fetch->mFileName, - fetch->mInternal, fetch->mPriority); - - if(requestId != -1) + if(!mStartedFetchList.contains(fetch->mMediaId)) { - // Request succeed, add to list of started fetches. - mStartedFetchList.insert(requestId, fetch); + TMPXItemId *internal = new TMPXItemId(fetch->mMediaId.iId1, fetch->mMediaId.iId2); + + fetch->mRequestId = mThumbnailManager->getThumbnail(fetch->mFileName, + internal, fetch->mPriority); + INFO_3("VideoThumbnailFetcher::startThumbnailFetches() started - mpx id: (%d, %d), requestId: %d", fetch->mMediaId.iId1, fetch->mMediaId.iId2, fetch->mRequestId); + if(fetch->mRequestId != -1) + { + // Request succeed, add to list of started fetches. + mStartedFetchList.insert(fetch->mMediaId, fetch); + } + else + { + // Request failed, free data. + delete internal; + delete fetch; + } } else { - // Request failed, free internal data. - delete fetch->mInternal; + INFO_3("VideoThumbnailFetcher::startThumbnailFetches() already fetching - mpx id: (%d, %d), requestId: %d", fetch->mMediaId.iId1, fetch->mMediaId.iId2, fetch->mRequestId); + // Already fetching this one, fetch data not needed anymore. delete fetch; } } @@ -173,23 +218,20 @@ } ThumbnailFetchData *fetch = mCreationList.takeAt(indexWithHighestPriority); + TMPXItemId *internal = new TMPXItemId(fetch->mMediaId.iId1, fetch->mMediaId.iId2); // Do request to thumbnail manager. int requestId = mThumbnailManager->getThumbnail(fetch->mFileName, - fetch->mInternal, fetch->mPriority); + internal, fetch->mPriority); + INFO_3("VideoThumbnailFetcher::startThumbnailCreation() started - mpx id: (%d, %d), requestId: %d", fetch->mMediaId.iId1, fetch->mMediaId.iId2, requestId); - // Request failed, free internal data. + // Request failed, free data. if(requestId == -1) { - delete fetch->mInternal; - delete fetch; + delete internal; } - else - { - // Don't keep track of fetches when creating thumbnails, if - // it fails with -1 it would be only tried to create again. - delete fetch; - } + // No need for the fetch data anymore when creating thumbnails. + delete fetch; } // ----------------------------------------------------------------------------- @@ -209,21 +251,27 @@ void VideoThumbnailFetcher::cancelFetches() { FUNC_LOG; - // Clear list of started fetches, thumbnail manager has the internal - // pointer. - QList keys = mStartedFetchList.keys(); - for(int i = 0; i < keys.count(); i++ ) + + QHash::const_iterator iter = mStartedFetchList.constBegin(); + while(iter != mStartedFetchList.constEnd()) { - delete mStartedFetchList.take(keys[i]); + mThumbnailManager->cancelRequest(iter.value()->mRequestId); + delete *iter; + iter++; } + mStartedFetchList.clear(); - // Merge lists and free data. - mFetchList.append(mCreationList); - mCreationList.clear(); - while(!mFetchList.isEmpty()) + iter = mFetchList.constBegin(); + while(iter != mFetchList.constEnd()) { - ThumbnailFetchData *fetch = mFetchList.takeFirst(); - delete fetch->mInternal; + delete *iter; + iter++; + } + mFetchList.clear(); + + while(!mCreationList.isEmpty()) + { + ThumbnailFetchData *fetch = mCreationList.takeFirst(); delete fetch; } } @@ -253,35 +301,40 @@ // void VideoThumbnailFetcher::thumbnailReadySlot(QPixmap tnData, void *internal, int requestId, int error) { - // Thumbnail has not been generated yet, put it into creation list. - if(error == -1 && internal) + INFO_2("VideoThumbnailFetcher::thumbnailReadySlot() requestId: %d, error: %d", requestId, error); + + TMPXItemId mediaId = TMPXItemId::InvalidId(); + if(internal) { - if(mStartedFetchList.contains(requestId)) + mediaId = *(static_cast(internal)); + } + delete internal; + + // Thumbnail has not been generated yet, put it into creation list. + if(error == -1) + { + if(mStartedFetchList.contains(mediaId)) { - ThumbnailFetchData *fetch = mStartedFetchList.take(requestId); + ThumbnailFetchData *fetch = mStartedFetchList.take(mediaId); mCreationList.append(fetch); } - else - { - // Fetch data was not found, meaning cancelFetches was called. - delete internal; - } + // If it's not found from started list then cancelFetches has been called and + // there's nothing to do with the failed fetch. } else { - // Report that thumbnail was fetched. - emit thumbnailReady(tnData, internal, error); - - if(mStartedFetchList.contains(requestId)) + // Report that thumbnail was fetched, internal data pointer ownership moves. + emit thumbnailReady(tnData, mediaId, error); + if(mStartedFetchList.contains(mediaId)) { - delete mStartedFetchList.take(requestId); + delete mStartedFetchList.take(mediaId); } } // Continue the fetching process. if(!mPaused && mStartedFetchList.isEmpty()) { - continueFetching(); + continueFetching(false); // No need to cancel fetches because there's none. } } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideomodel/src/testvideolistdatamodel.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideomodel/src/testvideolistdatamodel.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/src/testvideolistdatamodel.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -698,8 +698,6 @@ // // cannot check the actual strin due localisation // - // cannot call prepareShortLengthString directly, need to call indirectly using - // public data -method. That means: // - we cannot test without videolistdata -object -case because tested throught data -call and // existence is tested there already diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videocollectionutils.h --- a/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videocollectionutils.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videocollectionutils.h Fri Apr 30 09:52:11 2010 +0300 @@ -125,11 +125,6 @@ QString prepareLengthString(quint32 length); /** - * prepares length string - */ - const QString prepareShortLengthString(quint32 total); - - /** * Prepares size string from the given value. * * @param size Size value in bytes diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videocollectionutils.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videocollectionutils.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videocollectionutils.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -62,81 +62,32 @@ { const int secondsInMinute( 60 ); const int secondsInHour( 3600 ); - QString lengthStr(""); - - if ( length > 0 ) - { - quint32 hours = length / secondsInHour; - quint32 minutes = length / secondsInMinute % secondsInMinute; - quint32 seconds = length % secondsInMinute; - - if ( hours > 0 ) - { - if(hours == 1) - { - lengthStr = QObject::tr("%1 hour ").arg(QString::number(hours)); - } - else - { - lengthStr += QObject::tr("%1 hours ").arg(QString::number(hours)); - } - } + + quint32 hours = length / secondsInHour; + quint32 minutes = length / secondsInMinute % secondsInMinute; + quint32 seconds = length % secondsInMinute; - if ( minutes > 0 ) - { - if(minutes == 1) - { - lengthStr += QObject::tr("%1 minute ").arg(QString::number(minutes)); - } - else - { - lengthStr += QObject::tr("%1 minutes ").arg(QString::number(minutes)); - } - } - if (seconds > 0 && hours == 0) - { - if(seconds == 1) - { - lengthStr += QObject::tr("%1 second").arg(QString::number(seconds)); - } - else - { - lengthStr += QObject::tr("%1 seconds").arg(QString::number(seconds)); - } - } - } else { - lengthStr += QObject::tr("0 seconds"); + QString hrs(QString::number(hours)); + if(hours < 10) + { + hrs.prepend(QString::number(0)); + } + QString mins(QString::number(minutes)); + if(minutes < 10) + { + mins.prepend(QString::number(0)); } - - return lengthStr; -} - -// ----------------------------------------------------------------------------- -// VideoCollectionUtils::prepareShortLengthString() -// ----------------------------------------------------------------------------- -// -const QString VideoCollectionUtils::prepareShortLengthString(quint32 total) -{ - const int secondsInMinute( 60 ); - const int secondsInHour( 3600 ); + QString secs(QString::number(seconds)); + if(seconds < 10) + { + secs.prepend(QString::number(0)); + } - int hour = total / secondsInHour; - total = total % secondsInHour; - int minutes = total / secondsInMinute; - total = total % secondsInMinute; - int second = total; + QString lengthStr(hbTrId( "txt_videos_list_l1l2l3" ).arg( hrs ).arg( mins ).arg( secs )); - QTime time( hour ,minutes ,second ); - QString str; - - HbExtendedLocale locale = HbExtendedLocale::system(); - - str = locale.format( time, r_qtn_time_durat_long_with_zero ); - - return str; + return lengthStr.trimmed(); } - // ----------------------------------------------------------------------------- // prepareSizeString // ----------------------------------------------------------------------------- diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videothumbnaildata.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videothumbnaildata.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videothumbnaildata.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -149,8 +149,6 @@ // const QIcon* VideoThumbnailData::defaultThumbnail() { - // TODO - return 0; } @@ -166,7 +164,6 @@ { return -1; } - // TODO: do we need to do something with the tn wrapper as well? return 1; } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/testvideothumbnaildata_p.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/testvideothumbnaildata_p.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/testvideothumbnaildata_p.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -630,29 +630,21 @@ init(); int error = 0; - void *internal = 0; QPixmap nullpmap; QIcon icon(":/icons/default_thumbnail.svg"); QPixmap pmap = icon.pixmap(500, 500); + TMPXItemId mediaId = TMPXItemId(10, 10); - // Internal is null and error. - mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error); - QCOMPARE(mTestObject->mThumbnailData.count(), 0); - QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0); - QVERIFY(!mTestObject->mTbnReportTimer->isActive()); - - // Internal is not null but there's error. - internal = (void *)new TMPXItemId(5, 5); + // There's error. error = -5; - mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error); + mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, mediaId, error); QCOMPARE(mTestObject->mThumbnailData.count(), 0); QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0); QVERIFY(!mTestObject->mTbnReportTimer->isActive()); // Pixmap is null. - internal = (void *)new TMPXItemId(5, 5); error = 0; - mTestObject->mThumbnailFetcher->emitThumbnailReady(nullpmap, internal, error); + mTestObject->mThumbnailFetcher->emitThumbnailReady(nullpmap, mediaId, error); QCOMPARE(mTestObject->mThumbnailData.count(), 0); QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0); QVERIFY(!mTestObject->mTbnReportTimer->isActive()); @@ -660,9 +652,8 @@ // Good case. init(); - internal = (void *)new TMPXItemId(5, 5); error = 0; - mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error); + mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, mediaId, error); QCOMPARE(mTestObject->mThumbnailData.count(), 1); QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 1); QVERIFY(mTestObject->mTbnReportTimer->isActive()); @@ -670,10 +661,9 @@ // Good case, thumbnail report timer already running. init(); - internal = (void *)new TMPXItemId(5, 5); error = 0; mTestObject->mTbnReportTimer->start(1000000); - mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error); + mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, mediaId, error); QCOMPARE(mTestObject->mThumbnailData.count(), 1); QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 1); QVERIFY(mTestObject->mTbnReportTimer->isActive()); @@ -681,11 +671,10 @@ // Thumbnail report timer is null. init(); - internal = (void *)new TMPXItemId(5, 5); error = 0; QTimer *backup = mTestObject->mTbnReportTimer; mTestObject->mTbnReportTimer = 0; - mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error); + mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, mediaId, error); QCOMPARE(mTestObject->mThumbnailData.count(), 1); QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 1); mTestObject->mTbnReportTimer = backup; @@ -836,7 +825,7 @@ mTestObject->mBackgroundFetchingEnabled = false; mTestObject->mCurrentFetchIndex = -5; mTestObject->startBackgroundFetching(0, 10); - QVERIFY(mTestObject->mCurrentFetchIndex == -5); + QVERIFY(mTestObject->mCurrentFetchIndex == 10); // Set new model. mTestObject->mBackgroundFetchingEnabled = true; @@ -865,7 +854,7 @@ mTestObject->mCurrentFetchIndex = -1; mTestObject->enableBackgroundFetching(false); QVERIFY(mTestObject->mBackgroundFetchingEnabled == false); - QCOMPARE(mTestObject->mCurrentFetchIndex, -1); + QCOMPARE(mTestObject->mCurrentFetchIndex, 0); mTestObject->mBgFetchTimer->setSingleShot(false); mTestObject->continueBackgroundFetch(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videothumbnailfetcher.h --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videothumbnailfetcher.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videothumbnailfetcher.h Fri Apr 30 09:52:11 2010 +0300 @@ -25,6 +25,7 @@ #include #include #include +#include // FORWARD DECLARATIONS @@ -35,6 +36,7 @@ QString mFileName; int mPriority; void *mInternal; + TMPXItemId mediaId; }; class VideoThumbnailFetcher : public QObject @@ -64,11 +66,11 @@ * when fetch is complete. * * @param fileName path to the media. - * @param internal data identifying the media. + * @param mediaId mpx id for the media. * @param priority priority for the fetch. * */ - void addFetch(const QString fileName, void *internal, int priority); + void addFetch(const QString fileName, const TMPXItemId &mediaId, int priority); /** * Empties fetch list. This does not cancel the possible ongoing fetch on @@ -97,7 +99,7 @@ * Signal allThumbnailsFetched is emitted if there's nothing to do. * */ - void continueFetching(); + void continueFetching(bool cancelOngoingFetches); /** * Enables or disables the thumbnail creation for videos that do @@ -111,22 +113,22 @@ // Test helper methods public: - void emitThumbnailReady(QPixmap pixmap, void *internal, int error); + void emitThumbnailReady(QPixmap pixmap, const TMPXItemId &mediaId, int error); void emitAllThumbnailsFetched(); signals: - + /** * Signaled after signal from thumbnail manager has been processed and * thumbnail fetch process is complete. * * @param tnData thumbnail - * @param internal internal data to identify the request + * @param mediaId mpx id for the media. * @param error possible error code from thumbnail manager ( 0 == ok ) * */ - void thumbnailReady(QPixmap tnData, void *internal, int error); + void thumbnailReady(QPixmap tnData, const TMPXItemId &mediaId, int error); /** * Signaled when all the fetches have been done. @@ -139,11 +141,11 @@ struct TnRequest { QString name; - void *id; + TMPXItemId id; int priority; bool cancelled; - TnRequest(QString name, void *id, int priority, bool cancelled) { + TnRequest(QString name, const TMPXItemId &id, int priority, bool cancelled) { this->name = name; this->id = id; this->priority = priority; @@ -152,7 +154,6 @@ TnRequest() { name = QString(""); - id = 0; priority = -1; cancelled = false; } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videothumbnailfetcher.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videothumbnailfetcher.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videothumbnailfetcher.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -63,21 +63,21 @@ // VideoThumbnailFetcher::addFetch() // ----------------------------------------------------------------------------- // -void VideoThumbnailFetcher::addFetch(const QString fileName, void *internal, int priority) +void VideoThumbnailFetcher::addFetch(const QString fileName, const TMPXItemId &mediaId, int priority) { mAddFetchCallCount++; if(mAddFetchFails) return; int id = mRequests.count(); - mRequests[id] = TnRequest(fileName, internal, priority, false); + mRequests[id] = TnRequest(fileName, mediaId, priority, false); } // ----------------------------------------------------------------------------- // VideoThumbnailFetcher::continueFetching() // ----------------------------------------------------------------------------- // -void VideoThumbnailFetcher::continueFetching() +void VideoThumbnailFetcher::continueFetching(bool cancelOngoingFetches) { mContinueFetchingCallCount++; } @@ -124,9 +124,9 @@ // VideoThumbnailFetcher::emitThumbnailReady() // ----------------------------------------------------------------------------- // -void VideoThumbnailFetcher::emitThumbnailReady(QPixmap pixmap, void *internal, int error) +void VideoThumbnailFetcher::emitThumbnailReady(QPixmap pixmap, const TMPXItemId &mediaId, int error) { - emit thumbnailReady(pixmap, internal, error); + emit thumbnailReady(pixmap, mediaId, error); } // ----------------------------------------------------------------------------- diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/inc/videothumbnailfetchertester.h --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/inc/videothumbnailfetchertester.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/inc/videothumbnailfetchertester.h Fri Apr 30 09:52:11 2010 +0300 @@ -42,7 +42,7 @@ // Test methods for VideoThumbnailFetcher's methods. // - void startThumbnailFetches(); + void startThumbnailFetches(bool cancelOngoingFetches); void startThumbnailCreation(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/testvideothumbnailfetcher.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/testvideothumbnailfetcher.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/testvideothumbnailfetcher.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -33,6 +33,16 @@ #include "videothumbnailfetcher.h" +/** + * global qHash function required fo creating hash values for TMPXItemId -keys + */ +inline uint qHash(TMPXItemId key) +{ + QPair keyPair(key.iId1, key.iId2); + + return qHash(keyPair); +} + // --------------------------------------------------------------------------- // main // --------------------------------------------------------------------------- @@ -71,6 +81,7 @@ ThumbnailManager::mGetThumbFails = false; ThumbnailManager::mThumbnailReadyError = 0; + ThumbnailManager::mCancelRequestCount = 0; } // --------------------------------------------------------------------------- @@ -105,15 +116,10 @@ { init(); - mTestObject->addFetch(QString(), 0, 0); - QCOMPARE(mTestObject->mFetchList.count(), 1); + TMPXItemId mediaId(0, 0); - mTestObject->addFetch("test", 0, 0); - QCOMPARE(mTestObject->mFetchList.count(), 2); - - int *internal = new int; - mTestObject->addFetch("test", internal, 0); - QCOMPARE(mTestObject->mFetchList.count(), 3); + mTestObject->addFetch(QString(), mediaId, 0); + QCOMPARE(mTestObject->mFetchList.count(), 1); cleanup(); } @@ -126,6 +132,8 @@ { init(); + TMPXItemId mediaId(0, 0); + mTestObject->addFetch(QString(), 0, 0); mTestObject->cancelFetches(); QCOMPARE(mTestObject->mFetchList.count(), 0); @@ -138,8 +146,7 @@ QCOMPARE(mTestObject->mStartedFetchList.count(), 0); QCOMPARE(mTestObject->mCreationList.count(), 0); - int *internal = new int; - mTestObject->addFetch("test", internal, 0); + mTestObject->addFetch("test", mediaId, 0); mTestObject->cancelFetches(); QCOMPARE(mTestObject->mFetchList.count(), 0); QCOMPARE(mTestObject->mStartedFetchList.count(), 0); @@ -175,7 +182,7 @@ { init(); - mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData()); + mTestObject->mFetchList.insert(TMPXItemId(0, 0), new VideoThumbnailFetcher::ThumbnailFetchData()); QCOMPARE(mTestObject->fetchCount(), 1); mTestObject->mStartedFetchList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData()); @@ -209,21 +216,21 @@ void TestVideoThumbnailFetcher::testContinueFetching() { init(); - mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData()); - mTestObject->continueFetching(); + mTestObject->mFetchList.insert(TMPXItemId(0, 0), new VideoThumbnailFetcher::ThumbnailFetchData()); + mTestObject->continueFetching(false); QCOMPARE(mTestObject->fetchCount(), 1); cleanup(); init(); mTestObject->mCreationList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData()); - mTestObject->continueFetching(); + mTestObject->continueFetching(false); QCOMPARE(mTestObject->fetchCount(), 0); cleanup(); // Test when there's nothing to fetch init(); QSignalSpy* spy = new QSignalSpy(mTestObject, SIGNAL(allThumbnailsFetched())); - mTestObject->continueFetching(); + mTestObject->continueFetching(false); QCOMPARE(spy->count(), 1); delete spy; @@ -255,16 +262,16 @@ { // Test when thumbnail manager is null. init(); - mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData()); + mTestObject->mFetchList.insert(TMPXItemId(0, 0), new VideoThumbnailFetcher::ThumbnailFetchData()); delete mTestObject->mThumbnailManager; mTestObject->mThumbnailManager = 0; - mTestObject->startThumbnailFetches(); + mTestObject->startThumbnailFetches(false); QCOMPARE(mTestObject->mFetchList.count(), 1); cleanup(); // Test when nothing to fetch. init(); - mTestObject->startThumbnailFetches(); + mTestObject->startThumbnailFetches(false); QVERIFY(mTestObject->mThumbnailManager->mode() == ThumbnailManager::DoNotCreate); QCOMPARE(mTestObject->fetchCount(), 0); cleanup(); @@ -273,11 +280,11 @@ init(); for(int i = 0; i < 10; i++) { - int *internal = new int(i); - mTestObject->addFetch("test", internal, i); + TMPXItemId mediaId = TMPXItemId(i, i); + mTestObject->addFetch("test", mediaId, i); } QCOMPARE(mTestObject->mFetchList.count(), 10); - mTestObject->startThumbnailFetches(); + mTestObject->startThumbnailFetches(false); QCOMPARE(mTestObject->mFetchList.count(), 0); QCOMPARE(mTestObject->mStartedFetchList.count(), 10); QCOMPARE(mTestObject->mThumbnailManager->mRequests.count(), 10); @@ -286,14 +293,43 @@ // Test when request to thumbnail manager fails. init(); ThumbnailManager::mGetThumbFails = true; - int *internal = new int(0); - mTestObject->addFetch("test", internal, 0); + TMPXItemId mediaId = TMPXItemId(0, 0); + mTestObject->addFetch("test", mediaId, 0); QCOMPARE(mTestObject->mFetchList.count(), 1); - mTestObject->startThumbnailFetches(); + mTestObject->startThumbnailFetches(false); QCOMPARE(mTestObject->mFetchList.count(), 0); QCOMPARE(mTestObject->mStartedFetchList.count(), 0); QCOMPARE(mTestObject->mThumbnailManager->mRequests.count(), 0); - cleanup(); + cleanup(); + + // Test canceling fetches that are not on the new started list. + init(); + for(int i = 0; i < 10; i++) + { + mediaId = TMPXItemId(i, i); + mTestObject->addFetch("test", mediaId, i); + } + + // 5 overlapping, they won't be canceled. + for(int i = 5; i < 15; i++) + { + mediaId = TMPXItemId(i, i); // found from the list. + VideoThumbnailFetcher::ThumbnailFetchData *data = new VideoThumbnailFetcher::ThumbnailFetchData(); + data->mFileName = ""; + data->mPriority = 0; + data->mRequestId = -1; + data->mMediaId = mediaId; + mTestObject->mStartedFetchList.insert(mediaId, data); + } + + QCOMPARE(mTestObject->mFetchList.count(), 10); + mTestObject->startThumbnailFetches(true); + QCOMPARE(mTestObject->mFetchList.count(), 0); + QCOMPARE(mTestObject->mThumbnailManager->mRequests.count(), 5); + QCOMPARE(mTestObject->mStartedFetchList.count(), 10); + QCOMPARE(ThumbnailManager::mCancelRequestCount, 5); + cleanup(); + } // --------------------------------------------------------------------------- @@ -334,7 +370,6 @@ { VideoThumbnailFetcher::ThumbnailFetchData *fetch = new VideoThumbnailFetcher::ThumbnailFetchData(); fetch->mFileName = "test"; - fetch->mInternal = 0; mTestObject->mCreationList.insert(0, fetch); } QCOMPARE(mTestObject->mCreationList.count(), 10); @@ -372,7 +407,7 @@ // Internal parameter is null, started fetches do not contain the fetch. init(); - spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) )); + spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, const TMPXItemId &, int) )); mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error); QCOMPARE(spy->count(), 1); delete spy; spy = 0; @@ -380,7 +415,7 @@ // Internal parameter is null, started fetches contains the fetch. init(); - spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) )); + spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, const TMPXItemId &, int) )); mTestObject->mStartedFetchList.insert(requestId, new VideoThumbnailFetcher::ThumbnailFetchData()); mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error); QCOMPARE(spy->count(), 1); @@ -389,17 +424,17 @@ // Test error handling. init(); - spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) )); + spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, const TMPXItemId &, int) )); error = -5; mTestObject->mStartedFetchList.insert(requestId, new VideoThumbnailFetcher::ThumbnailFetchData()); mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error); QCOMPARE(spy->count(), 1); delete spy; spy = 0; cleanup(); - + /* TODO FIX // Fetch fails because thumbnail was not created yet, fetch list contains the request. init(); - spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) )); + spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, const TMPXItemId &, int) )); error = -1; requestId = 5; internal = new int(5); @@ -412,10 +447,10 @@ delete spy; spy = 0; delete internal; internal = 0; cleanup(); - +*/ // Fetch fails because thumbnail was not created yet, fetch list does not contain the request. init(); - spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) )); + spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, const TMPXItemId &, int) )); error = -1; requestId = 5; internal = new int(5); @@ -433,7 +468,7 @@ requestId = 5; mTestObject->mPaused = false; mTestObject->mStartedFetchList.insert(requestId+10, new VideoThumbnailFetcher::ThumbnailFetchData()); - mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData()); + mTestObject->mFetchList.insert(TMPXItemId(0, 0), new VideoThumbnailFetcher::ThumbnailFetchData()); mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error); QCOMPARE(mTestObject->mStartedFetchList.count(), 1); QCOMPARE(mTestObject->mFetchList.count(), 1); @@ -444,7 +479,7 @@ internal = 0; requestId = 5; mTestObject->mPaused = false; - mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData()); + mTestObject->mFetchList.insert(TMPXItemId(0, 0), new VideoThumbnailFetcher::ThumbnailFetchData()); mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error); QCOMPARE(mTestObject->mStartedFetchList.count(), 1); QCOMPARE(mTestObject->mFetchList.count(), 0); @@ -455,7 +490,7 @@ internal = 0; requestId = 5; mTestObject->mPaused = true; - mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData()); + mTestObject->mFetchList.insert(TMPXItemId(0, 0), new VideoThumbnailFetcher::ThumbnailFetchData()); mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error); QCOMPARE(mTestObject->mStartedFetchList.count(), 0); QCOMPARE(mTestObject->mFetchList.count(), 1); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/videothumbnailfetchertester.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/videothumbnailfetchertester.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/videothumbnailfetchertester.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -44,9 +44,9 @@ // VideoThumbnailFetcherTester::startThumbnailFetches() // ----------------------------------------------------------------------------- // -void VideoThumbnailFetcherTester::startThumbnailFetches() +void VideoThumbnailFetcherTester::startThumbnailFetches(bool cancelOngoingFetches) { - VideoThumbnailFetcher::startThumbnailFetches(); + VideoThumbnailFetcher::startThumbnailFetches(cancelOngoingFetches); } // ----------------------------------------------------------------------------- diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/inc/thumbnailmanager_qt.h --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/inc/thumbnailmanager_qt.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/inc/thumbnailmanager_qt.h Fri Apr 30 09:52:11 2010 +0300 @@ -383,6 +383,7 @@ static bool mGetThumbFails; static int mThumbnailReadyError; + static int mCancelRequestCount; }; #endif // STUB_THUMBNAILMANAGER_QT diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/src/thumbnailmanager_qt.cpp --- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/src/thumbnailmanager_qt.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/src/thumbnailmanager_qt.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -23,6 +23,7 @@ bool ThumbnailManager::mGetThumbFails = false; int ThumbnailManager::mThumbnailReadyError = 0; +int ThumbnailManager::mCancelRequestCount = 0; ThumbnailManager::ThumbnailManager( QObject* parentPtr ) : QObject( parentPtr ) @@ -127,6 +128,7 @@ bool ThumbnailManager::cancelRequest( int id ) { + mCancelRequestCount++; if(mRequests.contains(id)) { mRequests[id].cancelled = true; } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videofiledetailsview/inc/videofiledetailsviewplugin.h --- a/videocollection/videofiledetailsview/inc/videofiledetailsviewplugin.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videofiledetailsview/inc/videofiledetailsviewplugin.h Fri Apr 30 09:52:11 2010 +0300 @@ -106,7 +106,7 @@ /** * Plugin user can notify orientation changes by connecting into this slot - * ti it's signal. In normal cases, view handles orientation chages itself. + * to it's signal. In normal cases, view handles orientation chages itself. * * @param orientation new orientation */ @@ -117,6 +117,11 @@ * */ void back(); + + /** + * Signaled by HbMessageBox when it's closed. + */ + void deleteVideoDialogFinished(HbAction *action); private slots: diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp --- a/videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 69 % +// Version : %version: 73 % // INCLUDE FILES #include @@ -124,7 +124,6 @@ if (!mModel) { ERROR(-1, "VideoFileDetailsViewPlugin::createView() get model failed."); - // TODO need to throw exception instead? return; } @@ -204,6 +203,16 @@ connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)), this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int))); + + HbListWidget* list = findWidget(VIDEO_DETAILS_LISTWIDGET); + if(!list) + { + ERROR(-1, "VideoFileDetailsViewPlugin::activateView() failed to load details list widget."); + return; + } + + list->setEnabledAnimations(HbAbstractItemView::None); + } // --------------------------------------------------------------------------- @@ -534,9 +543,9 @@ void VideoFileDetailsViewPlugin::sendVideoSlot() { FUNC_LOG; - HbMessageBox::information(tr("Not implemented yet")); +// HbMessageBox::information(tr("Not implemented yet")); -/* if(mVideoId != TMPXItemId::InvalidId()) + if(mVideoId != TMPXItemId::InvalidId()) { ShareUi dialog; QModelIndex modelIndex = mModel->indexOfId(mVideoId); @@ -547,7 +556,7 @@ fileList.append(variant.toString()); dialog.send(fileList, true); } - }*/ + } } // --------------------------------------------------------------------------- @@ -567,15 +576,30 @@ QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg( variant.toString()); - if (HbMessageBox::question(text)) - { - deleteItem(modelIndex); - } + HbMessageBox *messageBox = new HbMessageBox(text, HbMessageBox::MessageTypeQuestion); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->open(this, SLOT(deleteVideoDialogFinished(HbAction *))); + } } } // --------------------------------------------------------------------------- +// deleteVideoDialogFinished +// --------------------------------------------------------------------------- +// +void VideoFileDetailsViewPlugin::deleteVideoDialogFinished(HbAction *action) +{ + FUNC_LOG; + HbMessageBox *dlg = static_cast(sender()); + QModelIndex modelIndex = mModel->indexOfId(mVideoId); + if(action == dlg->actions().at(0) && modelIndex.isValid()) + { + deleteItem(modelIndex); + } +} + +// --------------------------------------------------------------------------- // deleteItem // --------------------------------------------------------------------------- // diff -r 8aed59de29f9 -r 4eb2df7f7cbe videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp --- a/videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -47,6 +47,7 @@ #include "videofiledetailsviewplugin.h" #undef private +const char *TEST_VIDEO_DETAILS_GFX_DEFAULT = ":/gfx/pri_large_video.svg"; const char *TEST_VIDEO_DETAILS_VIEW = "videofiledetailsview"; const char *TEST_VIDEO_DETAILS_WIDGET = "mContent"; const char *TEST_VIDEO_DETAILS_TITLE = "mLblTitle"; @@ -226,8 +227,6 @@ QVERIFY( mPlugin->mModel == 0 ); QVERIFY( mPlugin->mIsService == false); QVERIFY( mPlugin->mVideoServices == 0); - // TODO if the plugin is changed to throw exception in case of null model, - // then it needs to be added here. // restoring the proper model. VideoCollectionWrapper::instance().setModel(mDummyModel); @@ -387,8 +386,6 @@ QString title("title"); QString filepath("filepath"); - // TODO need to add the default thumbnail checking. - init(); activateView(); @@ -409,7 +406,15 @@ QCOMPARE( mPlugin->mVideoId, testIndex ); QCOMPARE( mPlugin->mTitleAnim->text(), title ); mPlugin->mThumbnailManager = tmpTnManager; - + + // thumbnail fetching fails + tmpTnManager->mGetThumbFails = true; + emit shortDetailsReady(testIndex); + QCOMPARE( mPlugin->mVideoId, testIndex ); + QCOMPARE( mPlugin->mTitleAnim->text(), title ); + QCOMPARE( mPlugin->mThumbLabel->icon().iconName(), QString(TEST_VIDEO_DETAILS_GFX_DEFAULT) ); + tmpTnManager->mGetThumbFails = false; + // data exists emit shortDetailsReady(testIndex); @@ -543,7 +548,7 @@ // void TestVideoFileDetails::testSendVideoSlot() { - QFAIL("Feature not yet implemented!"); +// QFAIL("Feature not yet implemented!"); mDummyModel->reset(); init(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackbuttonbar.h --- a/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackbuttonbar.h Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackButtonBar -* -*/ - -// Version : %version: da1mmcf#12 % - - - -#ifndef MPXVIDEOPLAYBACKBUTTONBAR_H_ -#define MPXVIDEOPLAYBACKBUTTONBAR_H_ - -#include -#include -#include - - -class HbPushButton; -class QActionGroup; -class QMPXVideoPlaybackViewFileDetails; -class QMPXVideoPlaybackControlsController; - -// DATA TYPES -enum TMPXButton -{ - EMPXButtonRW, - EMPXButtonPlay, - EMPXButtonPause, - EMPXButtonFF, - EMPXButtonNatural, - EMPXButtonStretch, - EMPXButtonZoom, - EMPXButtonDetails, - EMPXButtonAttach, - EMPXButtonCount // Should always be the last value -}; - -enum TMPXSeekingState -{ - EMPXNotSeeking, - EMPXFastForwarding, - EMPXRewinding -}; - -const int KMPXFastForward = 30; -const int KMPXRewind = -10; - -class QMPXVideoPlaybackButtonBar : public HbWidget -{ - Q_OBJECT - - public: - QMPXVideoPlaybackButtonBar( QMPXVideoPlaybackControlsController* controller ); - virtual ~QMPXVideoPlaybackButtonBar(); - void updateState( TMPXPlaybackState state ); - void aspectRatioChanged( int aspectRatio ); - void initialize(); - void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details ); - void positionChanged( int position ); - void durationChanged( int duration ); - - private slots: - void play(); - void pause(); - void changeAspectRatio(); - void handleButtonPressed(); - void ffPressing(); - void rwPressing(); - void ffReleased(); - void rwReleased(); - void openDetailsView(); - - private: - QMPXVideoPlaybackControlsController *mController; - QList mButtons; - TMPXSeekingState mSeekingState; - - bool mInitialized; - int mPosition; - int mDuration; -}; - -#endif /*MPXVIDEOPLAYBACKBUTTONBAR_H_*/ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackcontrolbar.h --- a/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackcontrolbar.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackcontrolbar.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 1 % +// Version : %version: 2 % @@ -28,8 +28,7 @@ #include #include -class HbFrameItem; -class QMPXVideoPlaybackButtonBar; +class QMPXVideoPlaybackToolBar; class QMPXVideoPlaybackProgressBar; class QMPXVideoPlaybackViewFileDetails; class QMPXVideoPlaybackControlsController; @@ -55,9 +54,8 @@ private: QMPXVideoPlaybackControlsController *mController; - QMPXVideoPlaybackButtonBar *mButtonBar; + QMPXVideoPlaybackToolBar *mToolBar; QMPXVideoPlaybackProgressBar *mProgressBar; - HbFrameItem *mFrameItem; }; #endif /*MPXVIDEOPLAYBACKCONTROLBAR_H_*/ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackdetailsplaybackwindow.h --- a/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackdetailsplaybackwindow.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackdetailsplaybackwindow.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 4 % +// Version : %version: 6 % diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackprogressbar.h --- a/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackprogressbar.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackprogressbar.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#10 % +// Version : %version: da1mmcf#11 % @@ -26,6 +26,7 @@ #include class QTimer; +class HbFrameItem; class HbProgressSlider; class QMPXVideoPlaybackViewFileDetails; class QMPXVideoPlaybackControlsController; @@ -58,6 +59,7 @@ private: QMPXVideoPlaybackControlsController *mController; HbProgressSlider *mProgressSlider; + HbFrameItem *mFrameItem; int mDuration; int mDraggingPosition; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybacktoolbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybacktoolbar.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,124 @@ +/* +* 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: Implementation of QMPXVideoPlaybackToolBar +* +*/ + +// Version : %version: 2 % + + + +#ifndef MPXVIDEOPLAYBACKTOOLBAR_H_ +#define MPXVIDEOPLAYBACKTOOLBAR_H_ + +#include + +#include +#include + + +class QTimer; +class HbIcon; +class HbAction; +class HbToolBar; +class HbToolButton; +class QMPXVideoPlaybackViewFileDetails; +class QMPXVideoPlaybackControlsController; + +// DATA TYPES + +enum TMPXButton +{ + EMPX1stButton, + EMPX2ndButton, + EMPX3rdButton, + EMPX4thButton, + EMPX5thButton, + EMPXButtonCount // Should always be the last value +}; + +enum TMPXButtonIcon +{ + EMPXRWIcon, + EMPXPlayIcon, + EMPXPauseIcon, + EMPXFFIcon, + EMPXNaturalIcon, + EMPXStretchIcon, + EMPXZoomIcon, + EMPXDetailsIcon, + EMPXAttachIcon, + EMPXShareIcon, + EMPXIconCount // Should always be the last value +}; + +enum TMPXSeekingState +{ + EMPXNotSeeking, + EMPXFastForwarding, + EMPXRewinding +}; + +const int KMPXFastForward = 30; +const int KMPXRewind = -10; + +class QMPXVideoPlaybackToolBar : public QObject +{ + Q_OBJECT + + public: + QMPXVideoPlaybackToolBar( QMPXVideoPlaybackControlsController* controller ); + virtual ~QMPXVideoPlaybackToolBar(); + void updateState( TMPXPlaybackState state ); + void aspectRatioChanged( int aspectRatio ); + void initialize(); + void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details ); + void positionChanged( int position ); + void durationChanged( int duration ); + void setVisible( bool visible ); + + private slots: + void playPause(); + void changeAspectRatio(); + void handleButtonPressed(); + void handleRWButtonPressed(); + void handleFFButtonPressed(); + void ffPressing(); + void rwPressing(); + void ffReleased(); + void rwReleased(); + void openDetailsView(); + void retrieveButtons(); + + private: + QMPXVideoPlaybackControlsController *mController; + HbToolBar *mToolBar; + QTimer *mSeekStartTimer; + QTimer *mRetrieveButtonTimer; + + QList mButtonIcons; + QList mButtonActions; + QList mButtons; + + TMPXSeekingState mSeekingState; + + bool mInitialized; + bool mNeverVisibled; + int mPosition; + int mDuration; + int mAspectRatio; + TReal32 mDisplayAspectRatio; +}; + +#endif /*MPXVIDEOPLAYBACKTOOLBAR_H_*/ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackbuttonbar.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackbuttonbar.cpp Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,566 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackButtonBar -* -*/ - -// Version : %version: da1mmcf#25 % - - - -#include - -#include "mpxvideo_debug.h" -#include "mpxvideoplaybackbuttonbar.h" -#include "mpxvideoplaybackviewfiledetails.h" -#include "mpxcommonvideoplaybackview.hrh" -#include "mpxvideoplaybackdocumentloader.h" -#include "mpxvideoplaybackcontrolscontroller.h" - - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar( - QMPXVideoPlaybackControlsController* controller ) - : mController( controller ) - , mSeekingState( EMPXNotSeeking ) - , mInitialized( false ) - , mPosition( 0 ) - , mDuration( 0 ) -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar")); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()")); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::initialize() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::initialize() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::initialize()")); - - QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader(); - - // - // Don't need to initialize buttons once it gets initialized - // - if ( loader && ! mInitialized ) - { - mInitialized = true; - - // - // RW button - // - QGraphicsWidget *widget = loader->findWidget( QString( "rwButton" ) ); - HbPushButton *rwButton = qobject_cast( widget ); - connect( rwButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( rwButton, SIGNAL( longPress( QPointF ) ), this, SLOT( rwPressing() ) ); - connect( rwButton, SIGNAL( released() ), this, SLOT( rwReleased() ) ); - - mButtons.append( rwButton ); - - // - // Play button - // - widget = loader->findWidget( QString( "playButton" ) ); - HbPushButton *playButton = qobject_cast( widget ); - connect( playButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( playButton, SIGNAL( released() ), this, SLOT( play() ) ); - - mButtons.append( playButton ); - - // - // Pause button - // - widget = loader->findWidget( QString( "pauseButton" ) ); - HbPushButton *pauseButton = qobject_cast( widget ); - connect( pauseButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( pauseButton, SIGNAL( released() ), this, SLOT( pause() ) ); - - mButtons.append( pauseButton ); - - // - // FW button - // - widget = loader->findWidget( QString( "ffButton" ) ); - HbPushButton *ffButton = qobject_cast( widget ); - connect( ffButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( ffButton, SIGNAL( longPress( QPointF ) ), this, SLOT( ffPressing() ) ); - connect( ffButton, SIGNAL( released() ), this, SLOT( ffReleased() ) ); - mButtons.append( ffButton ); - - // - // Aspect ratio button - // - widget = loader->findWidget( QString( "naturalButton" ) ); - HbPushButton *naturalButton = qobject_cast( widget ); - connect( naturalButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( naturalButton, SIGNAL( released() ), this, SLOT( changeAspectRatio() ) ); - mButtons.append( naturalButton ); - - widget = loader->findWidget( QString( "stretchButton" ) ); - HbPushButton *stretchButton = qobject_cast( widget ); - connect( stretchButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( stretchButton, SIGNAL( released() ), this, SLOT( changeAspectRatio() ) ); - mButtons.append( stretchButton ); - - widget = loader->findWidget( QString( "zoomButton" ) ); - HbPushButton *zoomButton = qobject_cast( widget ); - connect( zoomButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( zoomButton, SIGNAL( released() ), this, SLOT( changeAspectRatio() ) ); - mButtons.append( zoomButton ); - - // - // Details button - // - widget = loader->findWidget( QString( "detailsButton" ) ); - HbPushButton *detailsButton = qobject_cast( widget ); - connect( detailsButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( detailsButton, SIGNAL( released() ), this, SLOT( openDetailsView() ) ); - mButtons.append( detailsButton ); - - // - // Attach button - // - widget = loader->findWidget( QString( "attachButton" ) ); - HbPushButton *attachButton = qobject_cast( widget ); - connect( attachButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); - connect( attachButton, SIGNAL( released() ), mController, SLOT( attachVideo() ) ); - mButtons.append( attachButton ); - - for ( int i = 0 ; i < EMPXButtonCount ; i++ ) - { - mButtons[i]->setFlag( QGraphicsItem::ItemIsFocusable, false ); - } - - mDuration = (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier; - - // - // obtain layout for aspect ratio which contains all 3 aspect ratio buttons: - // natural, stretch, zoom - // - widget = loader->findWidget( QString( "aspectRatioButtons" ) ); - - if ( mController->isAttachOperation() ) - { - // - // disable 3 aspect ratio buttons - // - widget->setVisible( false ); - - // - // enable "attach" button - // - mButtons[EMPXButtonAttach]->setVisible( true ); - } - else - { - // - // enable 3 aspect ratio buttons - // - widget->setVisible( true ); - - // - // disable "attach" button - // - mButtons[EMPXButtonAttach]->setVisible( false ); - } - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::play() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::play() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::play()")); - - mController->resetDisappearingTimers( EMPXTimerReset ); - mController->handleCommand( EMPXPbvCmdPlay ); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::ffPressing() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::ffPressing() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::ffPressing()"), - _L("mSeekingState = %d"), mSeekingState ); - - if ( mSeekingState == EMPXNotSeeking ) - { - mSeekingState = EMPXFastForwarding; - mButtons[EMPXButtonFF]->setSelected( true ); - - mController->handleCommand( EMPXPbvCmdSeekForward ); - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::rwPressing() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::rwPressing() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::rwPressing()"), - _L("mSeekingState = %d"), mSeekingState ); - - - if ( mSeekingState == EMPXNotSeeking ) - { - mSeekingState = EMPXRewinding; - mButtons[EMPXButtonRW]->setSelected( true ); - - mController->handleCommand( EMPXPbvCmdSeekBackward ); - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::ffReleased() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::ffReleased() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::ffReleased()"), - _L("mSeekingState = %d"), mSeekingState ); - - if ( mSeekingState == EMPXFastForwarding ) - { - mSeekingState = EMPXNotSeeking; - mController->handleCommand( EMPXPbvCmdEndSeek ); - mButtons[EMPXButtonFF]->setSelected( false ); - } - else - { - int temp = mPosition + KMPXFastForward; - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::ffReleased() temp position = %d"), temp); - - // - // If it has the playing time which is less than KMPXFastForward, ignore - // - if ( temp < mDuration ) - { - mController->handleCommand( EMPXPbvCmdSetPosition, temp ); - } - } - - mController->resetDisappearingTimers( EMPXTimerReset ); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::rwReleased() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::rwReleased() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::rwReleased()"), - _L("mSeekingState = %d"), mSeekingState ); - - if ( mSeekingState == EMPXRewinding ) - { - mSeekingState = EMPXNotSeeking; - mController->handleCommand( EMPXPbvCmdEndSeek ); - mButtons[EMPXButtonRW]->setSelected( false ); - } - else - { - int temp = mPosition + KMPXRewind; - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::rwReleased() temp position = %d"), temp); - - // - // If it played less than KMPXRewind, jump to 0 - // - if ( temp < 0 ) - { - temp = 0; - } - - mController->handleCommand( EMPXPbvCmdSetPosition, temp ); - } - - mController->resetDisappearingTimers( EMPXTimerReset ); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::pause() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::pause() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::pause()")); - - mController->resetDisappearingTimers( EMPXTimerReset ); - mController->handleCommand( EMPXPbvCmdPause ); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::changeAspectRatio() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::changeAspectRatio() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::changeAspectRatio()")); - - if ( ! mController->isAttachOperation() ) - { - mController->resetDisappearingTimers( EMPXTimerReset ); - - TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdNaturalAspectRatio; - - if ( mButtons[EMPXButtonStretch]->isVisible() ) - { - cmd = EMPXPbvCmdStretchAspectRatio; - } - else if ( mButtons[EMPXButtonZoom]->isVisible() ) - { - cmd = EMPXPbvCmdZoomAspectRatio; - } - - mController->handleCommand( cmd ); - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::updateState() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::updateState( TMPXPlaybackState state ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateState() state = %d"), state ); - - switch ( state ) - { - case EPbStatePlaying: - { - if ( ! isEnabled() ) - { - setEnabled( true ); - } - - mButtons[EMPXButtonPlay]->setVisible( false ); - mButtons[EMPXButtonPause]->setVisible( true ); - break; - } - case EPbStatePaused: - { - if ( ! isEnabled() ) - { - setEnabled( true ); - } - - mButtons[EMPXButtonPause]->setVisible( false ); - mButtons[EMPXButtonPlay]->setVisible( true ); - break; - } - case EPbStateNotInitialised: - case EPbStateInitialising: - case EPbStateBuffering: - { - if ( isEnabled() ) - { - setEnabled( false ); - } - - break; - } - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::aspectRatioChanged() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::aspectRatioChanged( int aspectRatio ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio ); - - if ( ! mController->isAttachOperation() ) - { - switch( aspectRatio ) - { - case EMMFNatural: - { - mButtons[EMPXButtonNatural]->setVisible( false ); - mButtons[EMPXButtonStretch]->setVisible( true ); - mButtons[EMPXButtonZoom]->setVisible( false ); - break; - } - case EMMFStretch: - { - mButtons[EMPXButtonNatural]->setVisible( false ); - mButtons[EMPXButtonStretch]->setVisible( false ); - mButtons[EMPXButtonZoom]->setVisible( true ); - break; - } - default: - { - mButtons[EMPXButtonNatural]->setVisible( true ); - mButtons[EMPXButtonStretch]->setVisible( false ); - mButtons[EMPXButtonZoom]->setVisible( false ); - break; - } - } - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::handleButtonPressed() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::handleButtonPressed() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::handleButtonPressed()")); - - mController->resetDisappearingTimers( EMPXTimerCancel ); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::updateWithFileDetails() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::updateWithFileDetails( - QMPXVideoPlaybackViewFileDetails* details ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateWithFileDetails()")); - - if ( ! mController->isAttachOperation() ) - { - if ( ! details->mVideoEnabled || - details->mVideoHeight <= 0 || - details->mVideoWidth <= 0 || - details->mTvOutConnected ) - { - mButtons[EMPXButtonNatural]->setEnabled( false ); - mButtons[EMPXButtonStretch]->setEnabled( false ); - mButtons[EMPXButtonZoom]->setEnabled( false ); - } - else - { - mButtons[EMPXButtonNatural]->setEnabled( true ); - mButtons[EMPXButtonStretch]->setEnabled( true ); - mButtons[EMPXButtonZoom]->setEnabled( true ); - } - } - - // - // for audio-only clips and tv-out, default view is audionOnlyView - // therefore, dim details button - // - if ( ! details->mVideoEnabled || details->mTvOutConnected ) - { - mButtons[EMPXButtonDetails]->setEnabled( false ); - } - else - { - mButtons[EMPXButtonDetails]->setEnabled( true ); - } - - if ( ! details->mSeekable || ( details->mTvOutConnected && ! details->mTvOutPlayAllowed ) ) - { - mButtons[EMPXButtonRW]->setEnabled( false ); - mButtons[EMPXButtonFF]->setEnabled( false ); - } - else - { - mButtons[EMPXButtonRW]->setEnabled( true ); - mButtons[EMPXButtonFF]->setEnabled( true ); - } - - if ( ! details->mPausableStream || ( details->mTvOutConnected && ! details->mTvOutPlayAllowed ) ) - { - mButtons[EMPXButtonPause]->setEnabled( false ); - } - else - { - mButtons[EMPXButtonPause]->setEnabled( true ); - } - - if ( details->mTvOutConnected && ! details->mTvOutPlayAllowed ) - { - mButtons[EMPXButtonPlay]->setEnabled( false ); - } - else - { - mButtons[EMPXButtonPlay]->setEnabled( true ); - } - - // - // If it is audio only view, show the background of button - // - bool backgrondVisible = false; - - if ( mController->viewMode() == EAudioOnlyView ) - { - backgrondVisible = true; - } - - for ( int i = 0 ; i < EMPXButtonCount ; i++ ) - { - QGraphicsItem* widget = mButtons[i]->primitive( HbStyle::P_PushButton_background ); - widget->setVisible( backgrondVisible ); - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::openDetailsView() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::openDetailsView() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::openDetailsView()")); - - TPlaybackViewMode viewMode = mController->viewMode(); - - if ( viewMode == EFullScreenView ) - { - mController->changeViewMode( EDetailsView ); - } -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackProgressBar::positionChanged -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::positionChanged( int position ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::positionChanged position = %d"), position ); - - mPosition = position; -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::durationChanged -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::durationChanged( int duration ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::durationChanged duration = %d"), duration ); - - mDuration = duration; -} - -//End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolbar.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolbar.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolbar.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,15 +15,12 @@ * */ -// Version : %version: 5 % +// Version : %version: 6 % -#include -#include - #include "mpxvideo_debug.h" -#include "mpxvideoplaybackbuttonbar.h" +#include "mpxvideoplaybacktoolbar.h" #include "mpxvideoplaybackcontrolbar.h" #include "mpxvideoplaybackprogressbar.h" #include "mpxcommonvideoplaybackview.hrh" @@ -38,14 +35,14 @@ QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar( QMPXVideoPlaybackControlsController* controller ) : mController( controller ) - , mButtonBar( NULL ) , mProgressBar( NULL ) - , mFrameItem( NULL ) { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar")); - HbEffect::add( this, ":/hbvideoplaybackview/effects/controlbar_appear.fxml", "appear" ); - HbEffect::add( this, ":/hbvideoplaybackview/effects/controlbar_disappear.fxml", "disappear" ); + // + // button bar + // + mToolBar = new QMPXVideoPlaybackToolBar( mController ); } // ------------------------------------------------------------------------------------------------- @@ -56,8 +53,11 @@ { MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()")); - HbEffect::remove( this, ":/hbvideoplaybackview/effects/controlbar_appear.fxml", "appear" ); - HbEffect::remove( this, ":/hbvideoplaybackview/effects/controlbar_disappear.fxml", "disappear" ); + if ( mToolBar ) + { + delete mToolBar; + mToolBar = NULL; + } } // ------------------------------------------------------------------------------------------------- @@ -73,39 +73,18 @@ // // Don't need to initialize buttons once it gets initialized // - if ( mButtonBar == NULL && mProgressBar == NULL ) + if ( mProgressBar == NULL ) { // - // button bar - // - QGraphicsWidget *widget = loader->findWidget( QString( "buttonBarLayout" ) ); - mButtonBar = qobject_cast( widget ); - - if ( mButtonBar ) - { - mButtonBar->initialize(); - } - - // // progress bar // - widget = loader->findWidget( QString( "progressBarLayout" ) ); + QGraphicsWidget *widget = loader->findWidget( QString( "progressBarLayout" ) ); mProgressBar = qobject_cast( widget ); if ( mProgressBar ) { mProgressBar->initialize(); } - - // - // Set framedrawer for semi transparent background - // - mFrameItem = new HbFrameItem ( this ); - mFrameItem->setGeometry( boundingRect() ); - mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" ); - mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces ); - mFrameItem->frameDrawer().setFillWholeRect( true ); - mFrameItem->setVisible( false ); } } @@ -117,9 +96,9 @@ { MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::updateState() state = %d"), state ); - if ( mButtonBar ) + if ( mToolBar ) { - mButtonBar->updateState( state ); + mToolBar->updateState( state ); } if ( mProgressBar ) @@ -136,9 +115,9 @@ { MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio ); - if ( mButtonBar ) + if ( mToolBar ) { - mButtonBar->aspectRatioChanged( aspectRatio ); + mToolBar->aspectRatioChanged( aspectRatio ); } } @@ -151,17 +130,15 @@ { MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::updateWithFileDetails()")); - if ( mButtonBar ) + if ( mToolBar ) { - mButtonBar->updateWithFileDetails( details ); + mToolBar->updateWithFileDetails( details ); } if ( mProgressBar ) { mProgressBar->updateWithFileDetails( details ); } - - mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse ); } // ------------------------------------------------------------------------------------------------- @@ -173,49 +150,10 @@ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::setVisibleToControlBar()"), _L("visible = %d, current visibility = %d"), visible, isVisible() ); - // - // Change the visibility if the following condition meet: - // - visible is true - // - appear effect is not going on - // - disappear effect is going on (assume current visiblity is false) - // - if ( visible && - ! HbEffect::effectRunning( this, "appear" ) && - ( ! isVisible() || HbEffect::effectRunning( this, "disappear" ) ) ) + if ( visible != isVisible() ) { - // - // If disappear effect is running on this, cancel - // - if ( HbEffect::effectRunning( this, "disappear" ) ) - { - HbEffect::cancel( this ); - } - - if ( ! isEnabled() ) - { - setEnabled( true ); - } - - setVisible( true ); - - HbEffect::start( this, "appear", this, "appeared" ); - } - else if ( ! visible && isVisible()&& ! HbEffect::effectRunning( this, "disappear" ) ) - { - // - // If appear effect is running on this, cancel - // - if( HbEffect::effectRunning( this, "appear" ) ) - { - HbEffect::cancel( this ); - } - - if ( isEnabled() ) - { - setEnabled( false ); - } - - HbEffect::start( this, "disappear", this, "disappeared" ); + setVisible( visible ); + mToolBar->setVisible( visible ); } } @@ -270,9 +208,9 @@ mProgressBar->durationChanged( duration ); } - if ( mButtonBar ) + if ( mToolBar ) { - mButtonBar->durationChanged( duration ); + mToolBar->durationChanged( duration ); } } @@ -289,9 +227,9 @@ mProgressBar->positionChanged( position ); } - if ( mButtonBar ) + if ( mToolBar ) { - mButtonBar->positionChanged( position ); + mToolBar->positionChanged( position ); } } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolpolicy.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolpolicy.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolpolicy.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#12 % +// Version : %version: da1mmcf#13 % @@ -91,7 +91,7 @@ case EMPXControlBar: { // - // We don't delete ButtonBar and Progress Bar from the controlsList + // We don't delete Tool Bar and Progress Bar from the controlsList // to update information all the time though it's not visible or activated // So just hide these if it is details view // diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#34 % +// Version : %version: da1mmcf#37 % @@ -37,6 +37,7 @@ #include #include #include +#include #include "mpxvideoviewwrapper.h" #include "hbvideobaseplaybackview.h" @@ -268,7 +269,7 @@ if ( details->mTvOutConnected ) { - handleEvent( EMPXControlCmdTvOutConnected, details->mTvOutPlayAllowed ); + handleEvent( EMPXControlCmdTvOutConnected ); } // @@ -371,14 +372,14 @@ { MPX_DEBUG(_L(" [EMPXControlCmdTvOutConnected]")); - handleTvOutEvent( true, event, value ); + handleTvOutEvent( true, event ); break; } case EMPXControlCmdTvOutDisconnected: { MPX_DEBUG(_L(" [EMPXControlCmdTvOutDisConnected]")); - handleTvOutEvent( false, event, value ); + handleTvOutEvent( false, event ); break; } case EMPXControlCmdHandleErrors: @@ -1072,7 +1073,7 @@ // ------------------------------------------------------------------------------------------------- // void QMPXVideoPlaybackControlsController::handleTvOutEvent( - bool connected, TMPXVideoPlaybackControlCommandIds event, int value ) + bool connected, TMPXVideoPlaybackControlCommandIds event ) { Q_UNUSED( event ); @@ -1085,11 +1086,6 @@ if ( mFileDetails->mTvOutConnected ) { generateThumbNail(); - mFileDetails->mTvOutPlayAllowed = value; - } - else - { - mFileDetails->mTvOutPlayAllowed = ETrue; } // @@ -1366,18 +1362,42 @@ // void QMPXVideoPlaybackControlsController::attachVideo() { - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()")); + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()"), + _L("file = %s"), mFileDetails->mClipName.data() ); - // - // close and release resources - // - handleCommand( EMPXPbvCmdClose ); + // + // close playback view + // + mView->closePlaybackView(); - // - // emit signal to launch videoservices itemSelected() slot - // + // + // emit signal to launch videoservices itemSelected() slot + // emit( attachVideoPath( mFileDetails->mClipName ) ); } +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::sendVideo() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackControlsController::sendVideo() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::sendVideo()"), + _L("file = %s"), mFileDetails->mClipName.data() ); + + // + // pause playback + // + handleCommand( EMPXPbvCmdPause ); + + // + // send video to shareUI + // + ShareUi dlg; + QStringList fileList; + fileList.append( mFileDetails->mClipName ); + dlg.send( fileList, true ); +} + // End of File diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -11,19 +11,16 @@ * * Contributors: * -* Description: Implementation of QMPXVideoPlaybackProgressBar +* Description: Implementation of QMPXVideoPlaybackDetailsPlaybackWindow * */ -// Version : %version: 13 % +// Version : %version: 16 % -#include #include - -#include #include #include #include @@ -82,18 +79,21 @@ connect( mPlayButton, SIGNAL( released() ), this, SLOT( playPause() ) ); - QGraphicsItem *widget1 = mPlayButton->primitive( HbStyle::P_PushButton_background ); - widget1->setVisible( false ); - // // Set framedrawer for semi transparent background // - HbFrameItem *frameItem = new HbFrameItem ( mPlayButton ); - frameItem->setGeometry( mPlayButton->boundingRect() ); - frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" ); - frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces ); - frameItem->frameDrawer().setFillWholeRect( true ); - + HbFrameDrawer *drawer = mPlayButton->frameBackground(); + + if( drawer == NULL ) + { + drawer = new HbFrameDrawer(); + } + + drawer->setFillWholeRect( true ); + drawer->setFrameType( HbFrameDrawer::NinePieces ); + drawer->setFrameGraphicsName( "qtg_fr_multimedia_trans" ); + mPlayButton->setFrameBackground( drawer ); + // // create 'attach' button and connect corresponding signal/slot // @@ -102,11 +102,11 @@ connect( attachButton, SIGNAL( released() ), mController, SLOT( attachVideo() ) ); // - // create 'share' button - // signal and slot to be created when requirement for 'share' operation is confirmed - // + // create 'share' button and connect corresponding signal/slot + // QGraphicsWidget *detailsShareWidget = loader->findWidget( QString( "detailsShareButton" ) ); HbPushButton *shareButton = qobject_cast( detailsShareWidget ); + connect( shareButton, SIGNAL( released() ), mController, SLOT( sendVideo() ) ); // // by default in xml layout, attachButton is not visible while shareButton is visible. @@ -117,7 +117,17 @@ attachButton->setVisible( true ); shareButton->setVisible( false ); } - + else + { + // + // dim "share" button for streaming + // + if ( mController->fileDetails()->mPlaybackMode == EMPXVideoStreaming || + mController->fileDetails()->mPlaybackMode == EMPXVideoLiveStreaming ) + { + shareButton->setEnabled( false ); + } + } } updateState( mController->state() ); @@ -176,9 +186,9 @@ { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::mouseReleaseEvent")); - Q_UNUSED( event ); + playPause(); - playPause(); + event->accept(); } //End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdocumentloader.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdocumentloader.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdocumentloader.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,12 +15,11 @@ * */ -// Version : %version: 9 % +// Version : %version: 13 % #include "mpxvideo_debug.h" -#include "mpxvideoplaybackbuttonbar.h" #include "mpxvideoplaybackcontrolbar.h" #include "mpxvideoplaybackprogressbar.h" #include "mpxvideoplaybackdocumentloader.h" @@ -47,7 +46,7 @@ // QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader() { - MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") ); + MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader") ); } // ------------------------------------------------------------------------------------------------- @@ -56,6 +55,10 @@ // QObject *QMPXVideoPlaybackDocumentLoader::createObject( const QString& type, const QString &name ) { + MPX_ENTER_EXIT( + _L("QMPXVideoPlaybackDocumentLoader::createObject()"), + _L("type = %s, name = %s"), type.data(), name.data() ); + QObject *object = NULL; if ( name == "controlBarLayout" ) @@ -63,11 +66,6 @@ object = new QMPXVideoPlaybackControlBar( mController ); object->setObjectName( name ); } - else if ( name == "buttonBarLayout" ) - { - object = new QMPXVideoPlaybackButtonBar( mController ); - object->setObjectName( name ); - } else if ( name == "progressBarLayout" ) { object = new QMPXVideoPlaybackProgressBar( mController ); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackfiledetailswidget.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackfiledetailswidget.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackfiledetailswidget.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 22 % +// Version : %version: 23 % #include @@ -217,14 +217,7 @@ } else if ( mController->viewMode() == EAudioOnlyView ) { - if ( details->mPlaybackMode == EMPXVideoLocal ) - { - sectionName = "audioOnlyViewWithLocalPlayback"; - } - else - { - sectionName = "audioOnlyViewWithNonLocalPlayback"; - } + sectionName = "audioOnlyView"; } bool ok = false; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackprogressbar.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackprogressbar.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackprogressbar.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#18 % +// Version : %version: da1mmcf#21 % @@ -25,6 +25,8 @@ #include #include +#include +#include #include #include @@ -42,6 +44,7 @@ QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar( QMPXVideoPlaybackControlsController* controller ) : mController( controller ) + , mFrameItem( NULL ) , mDuration( -1 ) , mDraggingPosition( 0 ) , mSetPosition( -1 ) @@ -50,6 +53,7 @@ , mSliderDragging( false ) , mLongTimeFormat( false ) , mLiveStreaming( false ) + , mSeekingTimer( NULL ) { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar()")); } @@ -62,10 +66,10 @@ { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()")); - disconnect( mSeekingTimer, SIGNAL( timeout() ), this, SLOT( handleSeekingTimeout() ) ); - if ( mSeekingTimer ) { + disconnect( mSeekingTimer, SIGNAL( timeout() ), this, SLOT( handleSeekingTimeout() ) ); + if ( mSeekingTimer->isActive() ) { mSeekingTimer->stop(); @@ -124,6 +128,17 @@ // Set the position to 0 until we get position information // positionChanged( 0 ); + + + // + // Set framedrawer for semi transparent background + // + mFrameItem = new HbFrameItem ( parentItem() ); + mFrameItem->setGeometry( boundingRect() ); + mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" ); + mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces ); + mFrameItem->frameDrawer().setFillWholeRect( true ); + mFrameItem->setVisible( false ); } } @@ -355,14 +370,12 @@ { mProgressSlider->setEnabled( false ); } - else if ( details->mTvOutConnected && ! details->mTvOutPlayAllowed ) - { - mProgressSlider->setEnabled( false ); - } else if ( ! mProgressSlider->isEnabled() ) { mProgressSlider->setEnabled( true ); } + + mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse ); } // ------------------------------------------------------------------------------------------------- diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp --- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 14 % +// Version : %version: 15 % #include @@ -70,7 +70,7 @@ // QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl() { - MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl")); + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl")); disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) ); disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) ); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybacktoolbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybacktoolbar.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,753 @@ +/* +* 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: Implementation of QMPXVideoPlaybackToolBar +* +*/ + +// Version : %version: 3 % + + + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "mpxvideo_debug.h" +#include "hbvideobaseplaybackview.h" +#include "mpxvideoplaybacktoolbar.h" +#include "mpxcommonvideoplaybackview.hrh" +#include "mpxvideoplaybackdocumentloader.h" +#include "mpxvideoplaybackviewfiledetails.h" +#include "mpxvideoplaybackcontrolscontroller.h" + +const int KSeekStartTimeOut = 700; +const int KRetrieveButtonTimeOut = 1000; + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar() +// ------------------------------------------------------------------------------------------------- +// +QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar( + QMPXVideoPlaybackControlsController* controller ) + : mController( controller ) + , mSeekStartTimer( NULL ) + , mRetrieveButtonTimer( NULL ) + , mSeekingState( EMPXNotSeeking ) + , mInitialized( false ) + , mNeverVisibled( true ) + , mPosition( 0 ) + , mDuration( 0 ) + , mAspectRatio( EMPXPbvCmdNaturalAspectRatio ) +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar")); + + mToolBar = mController->view()->toolBar(); + mToolBar->setOrientation( Qt::Horizontal ); + HbEffect::disable( mToolBar ); + + mController->view()->hideItems( Hb::ToolBarItem ); + + initialize(); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar() +// ------------------------------------------------------------------------------------------------- +// +QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar()")); + + HbEffect::enable( mToolBar ); + mToolBar->clearActions(); + + for ( int i = 0 ; i < mButtonIcons.count() ; i++ ) + { + if ( mButtonIcons[i] ) + { + delete mButtonIcons[i]; + } + } + mButtonIcons.clear(); + + if ( mSeekStartTimer ) + { + if ( mSeekStartTimer->isActive() ) + { + mSeekStartTimer->stop(); + } + + delete mSeekStartTimer; + mSeekStartTimer = NULL; + } + + if ( mRetrieveButtonTimer ) + { + if ( mRetrieveButtonTimer->isActive() ) + { + mRetrieveButtonTimer->stop(); + } + + delete mRetrieveButtonTimer; + mRetrieveButtonTimer = NULL; + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::initialize() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::initialize() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::initialize()")); + + // + // Don't need to initialize buttons once it gets initialized + // + if ( ! mInitialized ) + { + mInitialized = true; + + QActionGroup *actionsGroup = new QActionGroup( mToolBar ); + + for ( int i = 0 ; i < EMPXButtonCount ; i++ ) + { + mButtonActions.append( new HbAction( actionsGroup ) ); + } + + for ( int i = 0 ; i < EMPXIconCount ; i++ ) + { + mButtonIcons.append( new HbIcon() ); + } + + // + // RW button + // + mButtonIcons[EMPXRWIcon]->setIconName( "qtg_mono_previous" ); + mButtonActions[EMPX2ndButton]->setIcon( *mButtonIcons[EMPXRWIcon] ); + + // + // Play/Pause button + // + mButtonIcons[EMPXPlayIcon]->setIconName( "qtg_mono_play" ); + mButtonIcons[EMPXPauseIcon]->setIconName( "qtg_mono_pause" ); + mButtonActions[EMPX3rdButton]->setIcon( *mButtonIcons[EMPXPlayIcon] ); + + // + // FF button + // + mButtonIcons[EMPXFFIcon]->setIconName( "qtg_mono_next" ); + mButtonActions[EMPX4thButton]->setIcon( *mButtonIcons[EMPXFFIcon] ); + + // + // Details button + // + mButtonIcons[EMPXDetailsIcon]->setIconName( "qtg_mono_info" ); + mButtonActions[EMPX5thButton]->setIcon( *mButtonIcons[EMPXDetailsIcon] ); + + // + // Aspect ratio buttons + // + mButtonIcons[EMPXNaturalIcon]->setIconName( "qtg_mono_aspect_ratio_natural" ); + mButtonIcons[EMPXStretchIcon]->setIconName( "qtg_mono_aspect_ratio_stretched" ); + mButtonIcons[EMPXZoomIcon]->setIconName( "qtg_mono_aspect_ratio_zoom" ); + mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXNaturalIcon] ); + + // + // Attach/Share button + // + mButtonIcons[EMPXAttachIcon]->setIconName( "qtg_mono_attach" ); + mButtonIcons[EMPXShareIcon]->setIconName( "qtg_mono_share" ); + + for ( int i = 0 ; i < EMPXButtonCount ; i++ ) + { + mButtonActions[i]->setCheckable( false ); + mToolBar->addAction( mButtonActions[i] ); + } + + mDuration = (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier; + + // + // Create a timer for seeking. + // We will issue SetPosition every KSeekingTimeOut msec to show the current frame to user + // + mSeekStartTimer = new QTimer(); + mSeekStartTimer->setSingleShot( true ); + mSeekStartTimer->setInterval( KSeekStartTimeOut ); + + // + // get window size + // + RWindow *window = mController->view()->getWindow(); + TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) ); + + // + // get window aspect ratio + // if device is in portrait mode, width > height + // if device is in landscape mode, width < height + // + TReal32 width = (TReal32) displayRect.Width(); + TReal32 height = (TReal32) displayRect.Height(); + mDisplayAspectRatio = (width > height)? (width / height) : (height / width); + + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::playPause() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::playPause() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::playPause()")); + + mController->resetDisappearingTimers( EMPXTimerReset ); + mController->handleCommand( EMPXPbvCmdPlayPause ); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::ffPressing() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::ffPressing() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::ffPressing()"), + _L("mSeekingState = %d"), mSeekingState ); + + if ( mSeekingState == EMPXNotSeeking ) + { + mSeekingState = EMPXFastForwarding; + + mController->handleCommand( EMPXPbvCmdSeekForward ); + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::rwPressing() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::rwPressing() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::rwPressing()"), + _L("mSeekingState = %d"), mSeekingState ); + + if ( mSeekingState == EMPXNotSeeking ) + { + mSeekingState = EMPXRewinding; + + mController->handleCommand( EMPXPbvCmdSeekBackward ); + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::ffReleased() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::ffReleased() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::ffReleased()"), + _L("mSeekingState = %d"), mSeekingState ); + + disconnect( mSeekStartTimer, SIGNAL( timeout() ), this, SLOT( ffPressing() ) ); + + if ( mSeekStartTimer->isActive() ) + { + mSeekStartTimer->stop(); + } + + if ( mSeekingState == EMPXFastForwarding ) + { + mController->handleCommand( EMPXPbvCmdEndSeek ); + } + else + { + int temp = mPosition + KMPXFastForward; + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::ffReleased() temp position = %d"), temp); + + // + // If it has the playing time which is less than KMPXFastForward, ignore + // + if ( temp < mDuration ) + { + mController->handleCommand( EMPXPbvCmdSetPosition, temp ); + } + } + + mSeekingState = EMPXNotSeeking; + mController->resetDisappearingTimers( EMPXTimerReset ); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::rwReleased() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::rwReleased() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::rwReleased()"), + _L("mSeekingState = %d"), mSeekingState ); + + disconnect( mSeekStartTimer, SIGNAL( timeout() ), this, SLOT( rwPressing() ) ); + + if ( mSeekStartTimer->isActive() ) + { + mSeekStartTimer->stop(); + } + + if ( mSeekingState == EMPXRewinding ) + { + mController->handleCommand( EMPXPbvCmdEndSeek ); + } + else + { + int temp = mPosition + KMPXRewind; + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::rwReleased() temp position = %d"), temp); + + // + // If it played less than KMPXRewind, jump to 0 + // + if ( temp < 0 ) + { + temp = 0; + } + + mController->handleCommand( EMPXPbvCmdSetPosition, temp ); + } + + mSeekingState = EMPXNotSeeking; + mController->resetDisappearingTimers( EMPXTimerReset ); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::changeAspectRatio() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::changeAspectRatio() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::changeAspectRatio()")); + + mController->resetDisappearingTimers( EMPXTimerReset ); + + TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdStretchAspectRatio; + + switch( mAspectRatio ) + { + case EMMFZoom: + { + cmd = EMPXPbvCmdNaturalAspectRatio; + break; + } + case EMMFStretch: + { + cmd = EMPXPbvCmdZoomAspectRatio; + break; + } + } + + mController->handleCommand( cmd ); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::updateState() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::updateState( TMPXPlaybackState state ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::updateState() state = %d"), state ); + + switch ( state ) + { + case EPbStatePlaying: + { + mToolBar->setEnabled( true ); + + mButtonActions[EMPX3rdButton]->setIcon( *mButtonIcons[EMPXPauseIcon] ); + + break; + } + case EPbStatePaused: + { + mToolBar->setEnabled( true ); + + mButtonActions[EMPX3rdButton]->setIcon( *mButtonIcons[EMPXPlayIcon] ); + + break; + } + default: + { + mToolBar->setEnabled( false ); + + break; + } + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::aspectRatioChanged() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::aspectRatioChanged( int aspectRatio ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio ); + + mAspectRatio = aspectRatio; + + if ( ! mController->isAttachOperation() ) + { + switch( mAspectRatio ) + { + case EMMFNatural: + { + mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXStretchIcon] ); + break; + } + case EMMFStretch: + { + mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXZoomIcon] ); + break; + } + default: + { + mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXNaturalIcon] ); + break; + } + } + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::handleButtonPressed() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::handleButtonPressed() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::handleButtonPressed()")); + + mController->resetDisappearingTimers( EMPXTimerCancel ); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::handleRWButtonPressed() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::handleRWButtonPressed() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::handleRWButtonPressed()")); + + mController->resetDisappearingTimers( EMPXTimerCancel ); + + connect( mSeekStartTimer, SIGNAL( timeout() ), this, SLOT( rwPressing() ) ); + + if ( mSeekStartTimer->isActive() ) + { + mSeekStartTimer->stop(); + } + + mSeekStartTimer->start(); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::handleFFButtonPressed() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::handleFFButtonPressed() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::handleButtonPressed()")); + + mController->resetDisappearingTimers( EMPXTimerCancel ); + + connect( mSeekStartTimer, SIGNAL( timeout() ), this, SLOT( ffPressing() ) ); + + if ( mSeekStartTimer->isActive() ) + { + mSeekStartTimer->stop(); + } + + mSeekStartTimer->start(); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::updateWithFileDetails() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::updateWithFileDetails( + QMPXVideoPlaybackViewFileDetails* details ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::updateWithFileDetails()")); + + if ( mController->isAttachOperation() ) + { + // + // Show attach button + // + mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXAttachIcon] ); + + if ( mButtons.count() ) + { + disconnect( mButtons[EMPX1stButton], SIGNAL( released() ) ); + connect( mButtons[EMPX1stButton], SIGNAL( released() ), + mController, SLOT( attachVideo() ) ); + } + } + else + { + if ( mController->viewMode() == EFullScreenView ) + { + // + // Show aspect ratio button + // + aspectRatioChanged( mAspectRatio ); + + if ( ! details->mVideoEnabled || + details->mVideoHeight <= 0 || + details->mVideoWidth <= 0 || + details->mTvOutConnected ) + { + // + // dim 'aspect ratio' buttons + // + mButtonActions[EMPX1stButton]->setEnabled( false ); + } + else + { + // + // check if video clip has same aspect ratio as display window + // + TReal32 videoAspectRatio = (TReal32) details->mVideoWidth / (TReal32) details->mVideoHeight; + bool enabled = ( mDisplayAspectRatio == videoAspectRatio )? false : true; + + // + // enable or dim 'aspect ratio' buttons accordingly + // + mButtonActions[EMPX1stButton]->setEnabled( enabled ); + + if ( mButtons.count() ) + { + disconnect( mButtons[EMPX1stButton], SIGNAL( released() ) ); + connect( mButtons[EMPX1stButton], SIGNAL( released() ), + this, SLOT( changeAspectRatio() ) ); + } + } + } + else if ( mController->viewMode() == EAudioOnlyView ) + { + // + // Show share button + // + mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXShareIcon] ); + + if ( mController->fileDetails()->mPlaybackMode == EMPXVideoStreaming || + mController->fileDetails()->mPlaybackMode == EMPXVideoLiveStreaming ) + { + // + // dim 'share' button for streaming + // + mButtonActions[EMPX1stButton]->setEnabled( false ); + } + else + { + // + // enable 'share' button + // + mButtonActions[EMPX1stButton]->setEnabled( true ); + + if ( mButtons.count() ) + { + disconnect( mButtons[EMPX1stButton], SIGNAL( released() ) ); + connect( mButtons[EMPX1stButton], SIGNAL( released() ), + mController, SLOT( sendVideo() ) ); + } + } + } + } + + // + // for audio-only clips and tv-out, default view is audionOnlyView + // therefore, dim details button + // + if ( ! details->mVideoEnabled || details->mTvOutConnected ) + { + mButtonActions[EMPX5thButton]->setEnabled( false ); + } + else + { + mButtonActions[EMPX5thButton]->setEnabled( true ); + } + + if ( ! details->mSeekable ) + { + mButtonActions[EMPX2ndButton]->setEnabled( false ); + mButtonActions[EMPX4thButton]->setEnabled( false ); + } + else + { + mButtonActions[EMPX2ndButton]->setEnabled( true ); + mButtonActions[EMPX4thButton]->setEnabled( true ); + } + + if ( ! details->mPausableStream ) + { + mButtonActions[EMPX3rdButton]->setEnabled( false ); + } + else + { + mButtonActions[EMPX3rdButton]->setEnabled( true ); + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::openDetailsView() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::openDetailsView() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::openDetailsView()")); + + TPlaybackViewMode viewMode = mController->viewMode(); + + if ( viewMode == EFullScreenView ) + { + mController->changeViewMode( EDetailsView ); + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::positionChanged +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::positionChanged( int position ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::positionChanged position = %d"), position ); + + mPosition = position; + retrieveButtons(); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::durationChanged +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::durationChanged( int duration ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::durationChanged duration = %d"), duration ); + + mDuration = duration; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::setVisible +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::setVisible( bool visible ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::setVisible visible = %d"), visible ); + + if ( visible ) + { + mController->view()->showItems( Hb::ToolBarItem ); + + if ( mNeverVisibled ) + { + mNeverVisibled = false; + + + // + // toolbar creates button once it gets visible, so we don't know exact timing when toolbar + // creates button, so start timer to get layout information once the toolbar gets visible. + // This is needed since we don't use toolbar in proper way. + // + mRetrieveButtonTimer = new QTimer(); + mRetrieveButtonTimer->setSingleShot( false ); + mRetrieveButtonTimer->setInterval( KRetrieveButtonTimeOut ); + connect( mRetrieveButtonTimer, SIGNAL( timeout() ), this, SLOT( retrieveButtons() ) ); + + mRetrieveButtonTimer->start(); + } + } + else + { + mController->view()->hideItems( Hb::ToolBarItem ); + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::retrieveButtons() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::retrieveButtons() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::retrieveButtons()")); + + if ( mButtons.count() == 0 ) + { + QGraphicsLayout *layout = mToolBar->layout(); + + if ( layout ) + { + disconnect( mRetrieveButtonTimer, SIGNAL( timeout() ), this, SLOT( retrieveButtons() ) ); + if ( mRetrieveButtonTimer->isActive() ) + { + mRetrieveButtonTimer->stop(); + } + + for ( int i = 0 ; i < layout->count() ; i++ ) + { + mButtons.append( dynamic_cast( layout->itemAt( i ) ) ); + } + + // + // Connect signal and slots + // + connect( mButtons[EMPX1stButton], SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); + + connect( mButtons[EMPX2ndButton], SIGNAL( pressed() ), this, SLOT( handleRWButtonPressed() ) ); + connect( mButtons[EMPX2ndButton], SIGNAL( released() ), this, SLOT( rwReleased() ) ); + + connect( mButtons[EMPX3rdButton], SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); + connect( mButtons[EMPX3rdButton], SIGNAL( released() ), this, SLOT( playPause() ) ); + + connect( mButtons[EMPX4thButton], SIGNAL( pressed() ), this, SLOT( handleFFButtonPressed() ) ); + connect( mButtons[EMPX4thButton], SIGNAL( released() ), this, SLOT( ffReleased() ) ); + + connect( mButtons[EMPX5thButton], SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) ); + connect( mButtons[EMPX5thButton], SIGNAL( released() ), this, SLOT( openDetailsView() ) ); + + if ( mController->isAttachOperation() ) + { + connect( mButtons[EMPX1stButton], SIGNAL( released() ), + mController, SLOT( attachVideo() ) ); + } + else + { + if ( mController->viewMode() == EFullScreenView ) + { + connect( mButtons[EMPX1stButton], SIGNAL( released() ), + this, SLOT( changeAspectRatio() ) ); + } + else if ( mController->viewMode() == EAudioOnlyView ) + { + connect( mButtons[EMPX1stButton], SIGNAL( released() ), + mController, SLOT( sendVideo() ) ); + } + } + } + } +} + +//End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/hbvideoplaybackview.pro --- a/videoplayback/hbvideoplaybackview/hbvideoplaybackview.pro Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/hbvideoplaybackview.pro Fri Apr 30 09:52:11 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building Videoplayer components # # -# Version : %version: da1mmcf#20 % +# Version : %version: da1mmcf#23 % TEMPLATE = lib @@ -54,7 +54,8 @@ -lefsrv.dll \ -lws32.dll \ -lhal.dll \ - -lgdi.dll + -lgdi.dll \ + -lshareui.dll DEPENDPATH += ../inc inc viewinc controlinc VPATH += viewsrc controlsrc @@ -68,7 +69,7 @@ mpxvideoplaybackfullscreencontrol.h \ mpxvideoplaybackstatuspanecontrol.h \ mpxvideoplaybackprogressbar.h \ - mpxvideoplaybackbuttonbar.h \ + mpxvideoplaybacktoolbar.h \ mpxvideoplaybackcontrolbar.h \ mpxvideoplaybackcontrolpolicy.h \ mpxvideoplaybackcontrolconfiguration.h \ @@ -87,7 +88,7 @@ mpxvideoplaybackfullscreencontrol.cpp \ mpxvideoplaybackstatuspanecontrol.cpp \ mpxvideoplaybackprogressbar.cpp \ - mpxvideoplaybackbuttonbar.cpp \ + mpxvideoplaybacktoolbar.cpp \ mpxvideoplaybackcontrolbar.cpp \ mpxvideoplaybackcontrolscontroller.cpp \ mpxvideoplaybackcontrolpolicy.cpp \ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackcontrolscontroller.h --- a/videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackcontrolscontroller.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackcontrolscontroller.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#15 % +// Version : %version: da1mmcf#17 % @@ -116,11 +116,6 @@ */ inline bool isTvOutConnected(); - /* - * Return ETrue if TV-out cable is connected and content can be played - */ - inline bool isTvOutPlaybackAllowed(); - /** * Reset or cancel timers for the controls */ @@ -243,8 +238,7 @@ * Handle tvout connected/disconnected event */ void handleTvOutEvent( bool connected, - TMPXVideoPlaybackControlCommandIds event, - int value ); + TMPXVideoPlaybackControlCommandIds event ); void updateVideoRect( bool transitionEffect = true ); @@ -271,6 +265,7 @@ void handleThumbnailReady( QPixmap tnData, void *internal , int id, int error ); void controlsListUpdated(); void attachVideo(); + void sendVideo(); private: HbVideoBasePlaybackView *mView; @@ -334,21 +329,6 @@ } // ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed -// ------------------------------------------------------------------------------------------------- -// -inline -bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() -{ - bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed ); - - MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"), - playable); - - return playable; -} - -// ------------------------------------------------------------------------------------------------- // QMPXVideoPlaybackControlsController::layoutLoader // ------------------------------------------------------------------------------------------------- // diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackviewfiledetails.h --- a/videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackviewfiledetails.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackviewfiledetails.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 4 % +// Version : %version: 5 % @@ -70,7 +70,6 @@ bool mPartialPlayback; bool mRNFormat; bool mTvOutConnected; - bool mTvOutPlayAllowed; bool mDrmProtected; bool mMultiItemPlaylist; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml --- a/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml Fri Apr 30 09:52:11 2010 +0300 @@ -130,117 +130,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -253,13 +148,15 @@ + - + + @@ -268,12 +165,10 @@ - + - - - +
@@ -289,26 +184,13 @@
-
+
- - - - - - -
-
- - - - - - + diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/inc/testdetailsplaybackwindow.h --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/inc/testdetailsplaybackwindow.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/inc/testdetailsplaybackwindow.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 3 % +// Version : %version: 4 % #ifndef __TESTDETAILSPLAYBACKWINDOW_H__ @@ -57,6 +57,7 @@ void testMousePressEvent(); void testMouseReleaseEvent(); void testAttach(); + void testSend(); signals: void commandSignal(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/src/testdetailsplaybackwindow.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/src/testdetailsplaybackwindow.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/src/testdetailsplaybackwindow.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 3 % +// Version : %version: 6 % #include @@ -203,7 +203,6 @@ // // verify the controller attachVideo() slot has been called // - QVERIFY( mController->mCommand == EMPXPbvCmdClose ); QVERIFY( mController->mAttachVideoDone == true ); // @@ -218,5 +217,46 @@ } +// --------------------------------------------------------------------------- +// testSend +// --------------------------------------------------------------------------- +// +void TestDetailsPlaybackWindow::testSend() +{ + MPX_ENTER_EXIT( + _L("TestDetailsPlaybackWindow::testSend()")); + + // + // test when 'share' operation is enabled + // + init( false ); + + // + // connect signal/slot + // + connect( this, SIGNAL( commandSignal() ), mController, SLOT( sendVideo() ) ); + + // + // emit signal + // + emit commandSignal(); + + // + // verify the controller sendVideo() slot has been called + // + QVERIFY( mController->mCommand == EMPXPbvCmdPause ); + QVERIFY( mController->mSendVideoDone == true ); + + // + // disconnect signal/slot + // + disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( sendVideo() ) ); + + // + // clean up + // + cleanup(); + +} // End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/inc/hbpushbutton.h --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/inc/hbpushbutton.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/inc/hbpushbutton.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 1 % +// Version : %version: 2 % @@ -26,6 +26,7 @@ #include class QGraphicsItem; +class HbFrameDrawer; class HbPushButton : public HbWidget { @@ -45,6 +46,8 @@ QGraphicsItem* primitive( HbStyle::Primitive primitive ) const; void press(); void release(); + HbFrameDrawer* frameBackground(); + void setFrameBackground( HbFrameDrawer *drawer ); signals: void pressed(); @@ -56,6 +59,7 @@ bool mSelected; QGraphicsItem *mBackground; + HbFrameDrawer *mFrameDrawer; }; #endif /*HBPUSHBUTTON_H*/ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/inc/mpxvideoplaybackcontrolscontroller.h --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/inc/mpxvideoplaybackcontrolscontroller.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/inc/mpxvideoplaybackcontrolscontroller.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 2 % +// Version : %version: 3 % @@ -100,6 +100,7 @@ private slots: void attachVideo(); + void sendVideo(); public: QMPXVideoPlaybackViewFileDetails *mFileDetails; @@ -112,6 +113,7 @@ int mCommandValue; bool mIsAttachOperation; bool mAttachVideoDone; + bool mSendVideoDone; }; // INLINE METHODS diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/hbpushbutton.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/hbpushbutton.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/hbpushbutton.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,10 +15,14 @@ * */ -// Version : %version: 3 % +// Version : %version: 2 % + + #include +#include + #include "mpxvideo_debug.h" #include "hbpushbutton.h" @@ -30,6 +34,7 @@ : mVisible( false ) , mEnabled( false ) , mSelected( false ) + , mFrameDrawer( NULL ) { MPX_ENTER_EXIT(_L("HbPushButton::HbPushButton()")); @@ -151,4 +156,26 @@ emit released(); } +// ------------------------------------------------------------------------------------------------- +// HbPushButton::frameBackground +// ------------------------------------------------------------------------------------------------- +// +HbFrameDrawer* HbPushButton::frameBackground() +{ + MPX_DEBUG(_L("HbPushButton::frameBackground") ); + + return mFrameDrawer; +} + +// ------------------------------------------------------------------------------------------------- +// HbPushButton::setFrameBackground +// ------------------------------------------------------------------------------------------------- +// +void HbPushButton::setFrameBackground( HbFrameDrawer *drawer ) +{ + MPX_DEBUG(_L("HbPushButton::setFrameBackground") ); + + mFrameDrawer = drawer; +} + // End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/mpxvideoplaybackcontrolscontroller.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/mpxvideoplaybackcontrolscontroller.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/mpxvideoplaybackcontrolscontroller.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 2 % +// Version : %version: 5 % @@ -35,6 +35,7 @@ : mViewMode( EFullScreenView ) , mIsAttachOperation( attachOperation ) , mAttachVideoDone( false ) + , mSendVideoDone( false ) { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()")); @@ -108,8 +109,19 @@ { MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()")); - handleCommand( EMPXPbvCmdClose ); mAttachVideoDone = true; } +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::sendVideo() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackControlsController::sendVideo() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::sendVideo()")); + + handleCommand( EMPXPbvCmdPause ); + mSendVideoDone = true; +} + // End of File diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/mpxvideoplaybackdocumentloader.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/mpxvideoplaybackdocumentloader.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/mpxvideoplaybackdocumentloader.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 2 % +// Version : %version: 4 % @@ -82,7 +82,8 @@ QGraphicsWidget *object = NULL; - if ( name == "detailsViewPlayButton" || name == "detailsAttachButton" || + if ( name == "detailsViewPlayButton" || + name == "detailsAttachButton" || name == "detailsShareButton" ) { object = new HbPushButton(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/testdetailsplaybackwindow.pro --- a/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/testdetailsplaybackwindow.pro Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/testdetailsplaybackwindow.pro Fri Apr 30 09:52:11 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building testdetailsplaybackwindow # # -# Version : %version: 1 % +# Version : %version: 3 % TEMPLATE = app TARGET = testdetailsplaybackwindow diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/src/testmpxvideoplaybackcontrolbar.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/src/testmpxvideoplaybackcontrolbar.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/src/testmpxvideoplaybackcontrolbar.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,14 +15,14 @@ * */ -// Version : %version: 1 % +// Version : %version: 2 % #include #include #include -#include "mpxvideoplaybackbuttonbar.h" +#include "mpxvideoplaybacktoolbar.h" #include "mpxvideoplaybackprogressbar.h" #include "testmpxvideoplaybackcontrolbar.h" #include "mpxvideoplaybackviewfiledetails.h" @@ -103,11 +103,11 @@ TMPXPlaybackState state = EPbStatePlaying; mControlBar->updateState( state ); - QVERIFY( mControlBar->mButtonBar->mState == EPbStatePlaying ); + QVERIFY( mControlBar->mToolBar->mState == EPbStatePlaying ); state = EPbStatePaused; mControlBar->updateState( state ); - QVERIFY( mControlBar->mButtonBar->mState == EPbStatePaused ); + QVERIFY( mControlBar->mToolBar->mState == EPbStatePaused ); cleanup(); } @@ -124,7 +124,7 @@ int aspectRatio = 1; mControlBar->aspectRatioChanged( aspectRatio ); - QVERIFY( mControlBar->mButtonBar->mAspectRatio == aspectRatio ); + QVERIFY( mControlBar->mToolBar->mAspectRatio == aspectRatio ); cleanup(); } @@ -145,7 +145,7 @@ mControlBar->updateWithFileDetails( details ); - QVERIFY( mControlBar->mButtonBar->mFileDetails->mSeekable == details->mSeekable ); + QVERIFY( mControlBar->mToolBar->mFileDetails->mSeekable == details->mSeekable ); QVERIFY( mControlBar->mProgressBar->mFileDetails->mVideoEnabled == details->mVideoEnabled ); cleanup(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/inc/mpxvideoplaybackbuttonbar.h --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/inc/mpxvideoplaybackbuttonbar.h Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackButtonBar -* -*/ - -// Version : %version: 2 % - - - -#ifndef MPXVIDEOPLAYBACKBUTTONBAR_H_ -#define MPXVIDEOPLAYBACKBUTTONBAR_H_ - -#include -#include - - - -class QMPXVideoPlaybackViewFileDetails; -class QMPXVideoPlaybackControlsController; - - -class QMPXVideoPlaybackButtonBar : public HbWidget -{ - Q_OBJECT - - public: - QMPXVideoPlaybackButtonBar( QMPXVideoPlaybackControlsController* controller ); - virtual ~QMPXVideoPlaybackButtonBar(); - void updateState( TMPXPlaybackState state ); - void aspectRatioChanged( int aspectRatio ); - void initialize(); - void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details ); - void durationChanged( int duration ); - void positionChanged( int position ); - - public: - QMPXVideoPlaybackControlsController *mController; - QMPXVideoPlaybackViewFileDetails *mFileDetails; - int mAspectRatio; - int mPosition; - int mDuration; - TMPXPlaybackState mState; -}; - -#endif /*MPXVIDEOPLAYBACKBUTTONBAR_H_*/ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/inc/mpxvideoplaybacktoolbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/inc/mpxvideoplaybacktoolbar.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,59 @@ +/* +* 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: Implementation of QMPXVideoPlaybackToolBar +* +*/ + +// Version : %version: 1 % + + + +#ifndef MPXVIDEOPLAYBACKTOOLBAR_H_ +#define MPXVIDEOPLAYBACKTOOLBAR_H_ + +#include +#include + + + +class QMPXVideoPlaybackViewFileDetails; +class QMPXVideoPlaybackControlsController; + + +class QMPXVideoPlaybackToolBar : public QWidget +{ + Q_OBJECT + + public: + QMPXVideoPlaybackToolBar( QMPXVideoPlaybackControlsController* controller ); + virtual ~QMPXVideoPlaybackToolBar(); + void updateState( TMPXPlaybackState state ); + void aspectRatioChanged( int aspectRatio ); + void initialize(); + void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details ); + void durationChanged( int duration ); + void positionChanged( int position ); + void setVisible( bool visible ); + + public: + QMPXVideoPlaybackControlsController *mController; + QMPXVideoPlaybackViewFileDetails *mFileDetails; + int mAspectRatio; + int mPosition; + int mDuration; + bool mVisible; + TMPXPlaybackState mState; +}; + +#endif /*MPXVIDEOPLAYBACKTOOLBAR_H_*/ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/src/mpxvideoplaybackbuttonbar.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/src/mpxvideoplaybackbuttonbar.cpp Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackButtonBar -* -*/ - -// Version : %version: 2 % - - - -#include - -#include "mpxvideo_debug.h" -#include "mpxvideoplaybackbuttonbar.h" -#include "mpxvideoplaybackviewfiledetails.h" -#include "mpxcommonvideoplaybackview.hrh" - - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar( - QMPXVideoPlaybackControlsController* controller ) - : mController( controller ) -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar")); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()")); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::initialize() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::initialize() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::initialize()")); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::updateState() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::updateState( TMPXPlaybackState state ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateState() state = %d"), state ); - - mState = state; -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::aspectRatioChanged() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::aspectRatioChanged( int aspectRatio ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio ); - - mAspectRatio = aspectRatio; -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::updateWithFileDetails() -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::updateWithFileDetails( - QMPXVideoPlaybackViewFileDetails* details ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateWithFileDetails()")); - - mFileDetails = details; -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::durationChanged -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::durationChanged( int duration ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::durationChanged duration = %d"), duration ); - - mDuration = duration; -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::positionChanged -// ------------------------------------------------------------------------------------------------- -// -void QMPXVideoPlaybackButtonBar::positionChanged( int position ) -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::positionChanged position = %d"), position ); - - mPosition = position; -} - -//End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/src/mpxvideoplaybackdocumentloader.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/src/mpxvideoplaybackdocumentloader.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/src/mpxvideoplaybackdocumentloader.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,13 +15,12 @@ * */ -// Version : %version: 1 % +// Version : %version: 2 % #include "mpxvideo_debug.h" -#include "mpxvideoplaybackbuttonbar.h" #include "mpxvideoplaybackprogressbar.h" #include "mpxvideoplaybackdocumentloader.h" #include "mpxvideoplaybackcontrolscontroller.h" @@ -86,13 +85,7 @@ QGraphicsWidget *object = NULL; - if ( name == "buttonBarLayout" ) - { - object = new QMPXVideoPlaybackButtonBar( mController ); - object->setObjectName( name ); - mWidgets.append( object ); - } - else if ( name == "progressBarLayout" ) + if ( name == "progressBarLayout" ) { object = new QMPXVideoPlaybackProgressBar( mController ); object->setObjectName( name ); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/src/mpxvideoplaybacktoolbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/stub/src/mpxvideoplaybacktoolbar.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,126 @@ +/* +* 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: Implementation of QMPXVideoPlaybackToolBar +* +*/ + +// Version : %version: 1 % + + + +#include + +#include "mpxvideo_debug.h" +#include "mpxvideoplaybacktoolbar.h" +#include "mpxvideoplaybackviewfiledetails.h" +#include "mpxcommonvideoplaybackview.hrh" + + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar() +// ------------------------------------------------------------------------------------------------- +// +QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar( + QMPXVideoPlaybackControlsController* controller ) + : mController( controller ) +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar")); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar() +// ------------------------------------------------------------------------------------------------- +// +QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar()")); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::initialize() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::initialize() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::initialize()")); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::updateState() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::updateState( TMPXPlaybackState state ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::updateState() state = %d"), state ); + + mState = state; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::aspectRatioChanged() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::aspectRatioChanged( int aspectRatio ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio ); + + mAspectRatio = aspectRatio; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::updateWithFileDetails() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::updateWithFileDetails( + QMPXVideoPlaybackViewFileDetails* details ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::updateWithFileDetails()")); + + mFileDetails = details; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::durationChanged +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::durationChanged( int duration ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::durationChanged duration = %d"), duration ); + + mDuration = duration; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::positionChanged +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::positionChanged( int position ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::positionChanged position = %d"), position ); + + mPosition = position; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackToolBar::setVisible +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackToolBar::setVisible( bool visible ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::setVisible position = %d"), visible ); + + mVisible = visible; +} + +//End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/testmpxvideoplaybackcontrolbar.pro --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/testmpxvideoplaybackcontrolbar.pro Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolbar/testmpxvideoplaybackcontrolbar.pro Fri Apr 30 09:52:11 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building testmpxvideoplaybackcontrolbar # # -# Version : %version: 2 % +# Version : %version: 3 % TEMPLATE = app TARGET = testmpxvideoplaybackcontrolbar @@ -33,7 +33,7 @@ mpxvideoplaybackdocumentloader.h \ mpxvideoplaybackviewfiledetails.h \ mpxvideoplaybackprogressbar.h \ - mpxvideoplaybackbuttonbar.h \ + mpxvideoplaybacktoolbar.h \ hbeffect.h \ ../../controlinc/mpxvideoplaybackcontrolbar.h @@ -42,6 +42,6 @@ mpxvideoplaybackdocumentloader.cpp \ mpxvideoplaybackviewfiledetails.cpp \ mpxvideoplaybackprogressbar.cpp \ - mpxvideoplaybackbuttonbar.cpp \ + mpxvideoplaybacktoolbar.cpp \ hbeffect.cpp \ ../../controlsrc/mpxvideoplaybackcontrolbar.cpp diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/src/testmpxvideoplaybackdocumentloader.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/src/testmpxvideoplaybackdocumentloader.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/src/testmpxvideoplaybackdocumentloader.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 3 % +// Version : %version: 5 % #include @@ -102,9 +102,6 @@ QObject *object = mLoader->createObject( "", "controlBarLayout" ); QVERIFY( object->objectName() == "controlBarLayout" ); - object = mLoader->createObject( "", "buttonBarLayout" ); - QVERIFY( object->objectName() == "buttonBarLayout" ); - object = mLoader->createObject( "", "progressBarLayout" ); QVERIFY( object->objectName() == "progressBarLayout" ); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybackbuttonbar.h --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybackbuttonbar.h Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackButtonBar -* -*/ - -// Version : %version: 1 % - - - -#ifndef MPXVIDEOPLAYBACKBUTTONBAR_H_ -#define MPXVIDEOPLAYBACKBUTTONBAR_H_ - - -#include - -class QMPXVideoPlaybackControlsController; - - -class QMPXVideoPlaybackButtonBar : public QObject -{ - Q_OBJECT - - public: - QMPXVideoPlaybackButtonBar( QMPXVideoPlaybackControlsController* controller ); - virtual ~QMPXVideoPlaybackButtonBar(); - - public: - QMPXVideoPlaybackControlsController *mController; -}; - -#endif /*MPXVIDEOPLAYBACKBUTTONBAR_H_*/ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybacknontouchvolumebar.h --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybacknontouchvolumebar.h Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar -* -*/ - -// Version : %version: 1 % - - - -#ifndef MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_ -#define MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_ - -#include - -class QMPXVideoPlaybackNonTouchVolumeBar : public QObject -{ - Q_OBJECT - - public: - QMPXVideoPlaybackNonTouchVolumeBar(); - - virtual ~QMPXVideoPlaybackNonTouchVolumeBar(); -}; - -#endif /*MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_*/ - diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybackbuttonbar.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybackbuttonbar.cpp Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackButtonBar -* -*/ - -// Version : %version: 1 % - - -#include "mpxvideo_debug.h" -#include "mpxvideoplaybackbuttonbar.h" -#include "mpxvideoplaybackcontrolscontroller.h" - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar( - QMPXVideoPlaybackControlsController* controller ) - : mController( controller ) -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar")); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()")); -} - -//End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybacknontouchvolumebar.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybacknontouchvolumebar.cpp Fri Apr 16 18:13:14 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar -* -*/ - -// Version : %version: 1 % - - - -#include "mpxvideo_debug.h" -#include "mpxvideoplaybackcontrolscontroller.h" -#include "mpxvideoplaybacknontouchvolumebar.h" - - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar() -{ - MPX_ENTER_EXIT(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()")); -} - -// ------------------------------------------------------------------------------------------------- -// QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar() -// ------------------------------------------------------------------------------------------------- -// -QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar() -{ - MPX_DEBUG(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar")); -} - -// End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/testmpxvideoplaybackdocumentloader.pro --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/testmpxvideoplaybackdocumentloader.pro Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/testmpxvideoplaybackdocumentloader.pro Fri Apr 30 09:52:11 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building testmpxvideoplaybackdocumentloader # # -# Version : %version: 3 % +# Version : %version: 5 % TEMPLATE = app TARGET = testmpxvideoplaybackdocumentloader @@ -33,7 +33,6 @@ mpxvideoplaybackfiledetailswidget.h \ mpxvideoplaybackdetailsplaybackwindow.h \ mpxvideoplaybackprogressbar.h \ - mpxvideoplaybackbuttonbar.h \ mpxvideoplaybackcontrolbar.h \ ../../controlinc/mpxvideoplaybackdocumentloader.h @@ -42,6 +41,5 @@ mpxvideoplaybackfiledetailswidget.cpp \ mpxvideoplaybackdetailsplaybackwindow.cpp \ mpxvideoplaybackprogressbar.cpp \ - mpxvideoplaybackbuttonbar.cpp \ mpxvideoplaybackcontrolbar.cpp \ ../../controlsrc/mpxvideoplaybackdocumentloader.cpp diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/inc/testmpxvideoplaybacktoolbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/inc/testmpxvideoplaybacktoolbar.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,82 @@ +/** +* 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: tester for methods in TestMPXVideoPlaybackToolBar +* +*/ + +// Version : %version: 1 % + +#ifndef __TESTMPXVIDEOPLAYBACKTOOLBAR_H__ +#define __TESTMPXVIDEOPLAYBACKTOOLBAR_H__ + + +// INCLUDES +#include + +class QMPXVideoPlaybackToolBar; +class QMPXVideoPlaybackControlsController; + +class TestMPXVideoPlaybackToolBar : public QObject +{ + Q_OBJECT + +public: + + /** + * will be called before each testfunction is executed. + * + */ + void init( bool attachOperation = false ); + + /** + * will be called after every testfunction. + * + */ + void cleanup(); + + // test functions for the test framework +private slots: + + // the order in which these testXX methods are declared is important + // changing this order will affect the test results + void testPlay(); + void testLongTapOnFF(); + void testLongTapOnRW(); + void testShortTapOnFF(); + void testShortTapOnRW(); + void testPause(); + void testChangeAspectRatio(); + void testUpdateState(); + void testAspectRatioChanged(); + void testHandleButtonPressed(); + void testUpdateWithFileDetails(); + void testOpenDetailsView(); + void testAttach(); + void testSend(); + +signals: + void commandSignal(); + +private: + QMPXVideoPlaybackToolBar* mVideoToolBar; + QMPXVideoPlaybackControlsController* mController; +}; + + +#endif // __TESTMPXVIDEOPLAYBACKTOOLBAR_H__ + +// End of file + + + diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/src/testmpxvideoplaybacktoolbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/src/testmpxvideoplaybacktoolbar.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,646 @@ +/** +* 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: tester for methods in TestMPXVideoPlaybackToolBar +* +*/ + +// Version : %version: 2 % + + +#include +#include +#include + +#include "hbtoolbar.h" +#include "hbtoolbutton.h" +#include "testmpxvideoplaybacktoolbar.h" +#include "mpxvideoplaybackviewfiledetails.h" +#include "mpxvideoplaybackcontrolscontroller.h" +#include "mpxvideoplaybackdocumentloader.h" + +#define private public +#include "mpxvideoplaybacktoolbar.h" +#undef private + +// --------------------------------------------------------------------------- +// main +// --------------------------------------------------------------------------- +// +int main(int argc, char *argv[]) +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::Main()")); + + HbApplication app(argc, argv); + HbMainWindow window; + + TestMPXVideoPlaybackToolBar tv; + + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\TestMPXVideoPlaybackToolBar.txt"; + + int res = QTest::qExec(&tv, 3, pass); + + return res; +} + + +// --------------------------------------------------------------------------- +// init +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::init( bool attachOperation ) +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::init()")); + + mController = new QMPXVideoPlaybackControlsController( attachOperation ); + mVideoToolBar = new QMPXVideoPlaybackToolBar( mController ); + + mVideoToolBar->setVisible( true ); + connect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( retrieveButtons() ) ); + emit commandSignal(); + disconnect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( retrieveButtons() ) ); +} + +// --------------------------------------------------------------------------- +// cleanup +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::cleanup() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::cleanup()")); + + if ( mController ) + { + delete mController; + mController = NULL; + } + + if ( mVideoToolBar ) + { + delete mVideoToolBar; + mVideoToolBar = NULL; + } +} + +// --------------------------------------------------------------------------- +// testPlay +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testPlay() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testPlay()")); + + init(); + + mVideoToolBar->mButtons[EMPX3rdButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdPlayPause ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testLongTapOnFF +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testLongTapOnFF() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testLongTapOnFF()")); + + init(); + + // + // Start seeking + // + mVideoToolBar->mButtons[EMPX4thButton]->press(); + QVERIFY( mController->mTimerAction == EMPXTimerCancel ); + + connect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( ffPressing() ) ); + emit commandSignal(); + disconnect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( ffPressing() ) ); + + QVERIFY( mVideoToolBar->mSeekingState == EMPXFastForwarding ); + QVERIFY( mController->mCommand == EMPXPbvCmdSeekForward ); + + // + // End seeking + // + mVideoToolBar->mButtons[EMPX4thButton]->release(); + + QVERIFY( mVideoToolBar->mSeekingState == EMPXNotSeeking ); + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdEndSeek ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testLongTapOnRW +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testLongTapOnRW() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testLongTapOnRW()")); + + init(); + + // + // Start seeking + // + mVideoToolBar->mButtons[EMPX2ndButton]->press(); + QVERIFY( mController->mTimerAction == EMPXTimerCancel ); + + connect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( rwPressing() ) ); + emit commandSignal(); + disconnect( this, SIGNAL( commandSignal() ), mVideoToolBar, SLOT( rwPressing() ) ); + + QVERIFY( mVideoToolBar->mSeekingState == EMPXRewinding ); + QVERIFY( mController->mCommand == EMPXPbvCmdSeekBackward ); + + // + // End seeking + // + mVideoToolBar->mButtons[EMPX2ndButton]->release(); + + QVERIFY( mVideoToolBar->mSeekingState == EMPXNotSeeking ); + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdEndSeek ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testShortTapOnFF +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testShortTapOnFF() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testShortTapOnFF()")); + + init(); + + // + // If mPostion + KMPXFastForward < mDuration + // + mVideoToolBar->mPosition = 30; + mVideoToolBar->mDuration = 70; + mVideoToolBar->mButtons[EMPX4thButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdSetPosition ); + QVERIFY( mController->mCommandValue == mVideoToolBar->mPosition + KMPXFastForward ); + + // + // If mPostion + KMPXFastForward < mDuration + // + mVideoToolBar->mDuration = 50; + mController->mCommand = EMPXPbvCmdPlay; + + mVideoToolBar->mButtons[EMPX4thButton]->release(); + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdPlay ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testShortTapOnRW +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testShortTapOnRW() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testShortTapOnRW()")); + + init(); + + // + // If mPostion + KMPXRewind > 0 + // + mVideoToolBar->mPosition = 30; + mVideoToolBar->mButtons[EMPX2ndButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdSetPosition ); + QVERIFY( mController->mCommandValue == mVideoToolBar->mPosition + KMPXRewind ); + + // + // If mPostion + KMPXRewind < 0 + // + mVideoToolBar->mPosition = 4; + mVideoToolBar->mButtons[EMPX2ndButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdSetPosition ); + QVERIFY( mController->mCommandValue == 0 ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testPause +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testPause() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testPause()")); + + init(); + + mVideoToolBar->mButtons[EMPX3rdButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdPlayPause ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testChangeAspectRatio +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testChangeAspectRatio() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testChangeAspectRatio()")); + + init(); + + // + // Test natural + // + mVideoToolBar->mAspectRatio = EMMFZoom; + mVideoToolBar->mButtons[EMPX1stButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdNaturalAspectRatio ); + + // + // Test stretch + // + mVideoToolBar->mAspectRatio = EMMFStretch; + mVideoToolBar->mButtons[EMPX1stButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdZoomAspectRatio ); + + // + // Test stretch + // + mVideoToolBar->mAspectRatio = EMMFNatural; + mVideoToolBar->mButtons[EMPX1stButton]->release(); + + QVERIFY( mController->mTimerAction == EMPXTimerReset ); + QVERIFY( mController->mCommand == EMPXPbvCmdStretchAspectRatio ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testUpdateState +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testUpdateState() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testUpdateState()")); + + init(); + + // + // Playing + // + TMPXPlaybackState state = EPbStatePlaying; + mVideoToolBar->updateState( state ); + + QVERIFY( mVideoToolBar->mToolBar->mEnabled == true ); + + // + // Paused + // + state = EPbStatePaused; + mVideoToolBar->updateState( state ); + + QVERIFY( mVideoToolBar->mToolBar->mEnabled == true ); + + // + // Not initialized + // + state = EPbStateNotInitialised; + mVideoToolBar->updateState( state ); + + QVERIFY( mVideoToolBar->mToolBar->mEnabled == false ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testAspectRatioChanged +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testAspectRatioChanged() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testAspectRatioChanged()")); + + init(); + + // + // Natural + // + int aspectRatio = EMMFNatural; + mVideoToolBar->aspectRatioChanged( aspectRatio ); + QVERIFY( mVideoToolBar->mAspectRatio == EMMFNatural ); + + // + // Stretch + // + aspectRatio = EMMFStretch; + mVideoToolBar->aspectRatioChanged( aspectRatio ); + QVERIFY( mVideoToolBar->mAspectRatio == EMMFStretch ); + + // + // Zoom + // + aspectRatio = EMMFZoom; + mVideoToolBar->aspectRatioChanged( aspectRatio ); + QVERIFY( mVideoToolBar->mAspectRatio == EMMFZoom ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testHandleButtonPressed +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testHandleButtonPressed() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testHandleButtonPressed()")); + + init(); + + mVideoToolBar->mButtons[EMPX1stButton]->press(); + + QVERIFY( mController->mTimerAction == EMPXTimerCancel ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testUpdateWithFileDetails +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testUpdateWithFileDetails() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testUpdateWithFileDetails()")); + + // + // 'non-attach' mode + // + init(); + + QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails(); + + // + // video clip, view mode is full-screen + // + details->mVideoEnabled = true; + details->mVideoHeight = 1; + details->mVideoWidth = 1; + details->mTvOutConnected = false; + details->mTvOutPlayAllowed = true; + details->mSeekable = true; + details->mPausableStream = true; + mController->mViewMode = EFullScreenView; + + mVideoToolBar->updateWithFileDetails( details ); + + QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true ); + + // + // video clip has same aspect ratio as display window + // + details->mVideoEnabled = true; + details->mVideoHeight = 360; + details->mVideoWidth = 640; + details->mTvOutConnected = false; + mController->mViewMode = EFullScreenView; + + mVideoToolBar->updateWithFileDetails( details ); + + QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true ); + + // + // audio-only clip, view mode is full-screen + // + details->mVideoEnabled = false; + details->mVideoHeight = 0; + details->mVideoWidth = 1; + details->mTvOutConnected = true; + details->mTvOutPlayAllowed = true; + details->mSeekable = false; + details->mPausableStream = false; + + mVideoToolBar->updateWithFileDetails( details ); + + QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false ); + + // + // local audio-only clip, view mode is audio-only + // + details->mVideoEnabled = false; + details->mVideoHeight = 0; + details->mVideoWidth = 1; + details->mTvOutConnected = true; + details->mTvOutPlayAllowed = true; + details->mSeekable = false; + details->mPausableStream = false; + mController->mViewMode = EAudioOnlyView; + + mVideoToolBar->updateWithFileDetails( details ); + + QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false ); + + // + // streaming audio-only clip, view mode is audio-only + // + details->mVideoEnabled = false; + details->mPlaybackMode = EMPXVideoStreaming; + mController->mViewMode = EAudioOnlyView; + + mVideoToolBar->updateWithFileDetails( details ); + + QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == false ); + QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == false ); + + cleanup(); + + // + // 'attach' mode + // + init( true ); + + // + // video clip, view mode is full-screen + // + details->mVideoEnabled = true; + details->mVideoHeight = 1; + details->mVideoWidth = 1; + details->mTvOutConnected = false; + details->mTvOutPlayAllowed = true; + details->mSeekable = true; + details->mPausableStream = true; + + mVideoToolBar->updateWithFileDetails( details ); + + QVERIFY( mVideoToolBar->mButtons[EMPX1stButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX2ndButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX3rdButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX4thButton]->isEnabled() == true ); + QVERIFY( mVideoToolBar->mButtons[EMPX5thButton]->isEnabled() == true ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testOpenDetailsView +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testOpenDetailsView() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testOpenDetailsView()")); + + init(); + + QSignalSpy spy( mVideoToolBar, SIGNAL( openDetailsView() ) ); + + mController->mViewMode = EFullScreenView; + mVideoToolBar->mButtons[EMPX5thButton]->release(); + QVERIFY( mController->mViewMode == EDetailsView ); + + mController->mViewMode = EDetailsView; + mVideoToolBar->mButtons[EMPX5thButton]->release(); + QVERIFY( mController->mViewMode == EDetailsView ); + + mController->mViewMode = EAudioOnlyView; + mVideoToolBar->mButtons[EMPX5thButton]->release(); + QVERIFY( mController->mViewMode == EAudioOnlyView ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// testAttach +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testAttach() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testAttach()")); + + // + // test when 'attach' operation is enabled + // + init( true ); + + QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails(); + details->mVideoEnabled = false; + mVideoToolBar->updateWithFileDetails( details ); + + // + // release 'attach' button + // + mVideoToolBar->mButtons[EMPX1stButton]->release(); + + // + // verify the controller attachVideo() slot has been called + // + QVERIFY( mController->mCommand == EMPXPbvCmdClose ); + QVERIFY( mController->mAttachVideoDone == true ); + + // + // clean up + // + cleanup(); + + // + // test when 'attach' operation is disabled + // + init(); + + // + // verify the controller attachVideo() slot is not called + // + QVERIFY( mController->mAttachVideoDone == false ); + + // + // clean up + // + cleanup(); + +} + +// --------------------------------------------------------------------------- +// testSend +// --------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackToolBar::testSend() +{ + MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackToolBar::testSend()")); + + // + // test when 'share' operation is enabled + // + init( false ); + + QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails(); + details->mVideoEnabled = false; + mController->mViewMode = EAudioOnlyView; + mVideoToolBar->updateWithFileDetails( details ); + + // + // release 'share' button + // + mVideoToolBar->mButtons[EMPX1stButton]->release(); + + // + // verify the controller sendVideo() slot has been called + // + QVERIFY( mController->mCommand == EMPXPbvCmdPause ); + QVERIFY( mController->mSendVideoDone == true ); + + // + // clean up + // + cleanup(); +} + +// End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/hbtoolbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/hbtoolbar.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,54 @@ +/* +* 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: Implementation of HbToolBar +* +*/ + +// Version : %version: 1 % + + + +#ifndef HBTOOLBAR_H_ +#define HBTOOLBAR_H_ + +#include + +class HbAction; +class QGraphicsLayout; +class QGraphicsLinearLayout; + +class HbToolBar : public HbWidget +{ + Q_OBJECT + + public: + HbToolBar(); + virtual ~HbToolBar(); + + public: + void setVisible( bool visible ); + void setEnabled( bool enabled ); + void setOrientation( int orientation ); + void clearActions(); + void addAction( HbAction *action ); + QGraphicsLayout* layout(); + + public: + bool mVisible; + bool mEnabled; + QGraphicsLinearLayout *mLayout; +}; + +#endif /*HBTOOLBAR_H_*/ + diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/hbtoolbutton.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/hbtoolbutton.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,52 @@ +/* +* 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: Implementation of HbToolButton +* +*/ + +// Version : %version: 1 % + + + +#ifndef HbTOOLBUTTON_H_ +#define HbTOOLBUTTON_H_ + +#include + +class HbAction; + +class HbToolButton : public HbWidget +{ + Q_OBJECT + + public: + HbToolButton( HbAction *action ); + virtual ~HbToolButton(); + + public: + void press(); + void release(); + bool isEnabled(); + + signals: + void pressed(); + void released(); + + private: + bool mEnabled; + HbAction *mAction; +}; + +#endif /*HbTOOLBUTTON_H_*/ + diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/hbvideobaseplaybackview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/hbvideobaseplaybackview.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,58 @@ +/* +* 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: HB Video playback view +* +*/ + +// Version : %version: 2 % + + + +// This file defines the API for .dll + +#ifndef __HBVIDEOBASEPLAYBACKVIEW_H__ +#define __HBVIDEOBASEPLAYBACKVIEW_H__ + +// Include Files +#include + + +// Constants + +// Forward Declarations + +// Class Definitions +class HbToolBar; +class RWindow; + +class HbVideoBasePlaybackView : public QWidget +{ + Q_OBJECT + + public: + HbVideoBasePlaybackView(); + virtual ~HbVideoBasePlaybackView(); + + void hideItems( int item ); + void showItems( int item ); + HbToolBar *toolBar(); + RWindow *getWindow(); + + public: + HbToolBar *mToolBar; +}; + +#endif // __HBVIDEOBASEPLAYBACKVIEW_H__ + +// EOF diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/mpxvideoplaybackcontrolscontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/mpxvideoplaybackcontrolscontroller.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,162 @@ +/* +* 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: Implementation of MPXVideoPlaybackControlsController +* +*/ + +// Version : %version: 1 % + + + +#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ +#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ + +// INCLUDES +#include +#include + +#include "mpxvideo_debug.h" +#include "mpxcommonvideoplaybackview.hrh" +#include "mpxvideoplaybackviewfiledetails.h" + +// FORWARD DECLARATIONS + + +// DATA TYPES + +enum TMPXTimerAction +{ + EMPXTimerCancel, + EMPXTimerReset +}; + +enum TPlaybackViewMode +{ + EFullScreenView, + EDetailsView, + EAudioOnlyView +}; + +// CLASS DECLARATION +class HbVideoBasePlaybackView; + +class QMPXVideoPlaybackControlsController : public QObject +{ + Q_OBJECT + + public: + + /** + * constructor. + */ + QMPXVideoPlaybackControlsController( bool attachOperation ); + + /** + * Destructor. + */ + virtual ~QMPXVideoPlaybackControlsController(); + + public: + + /** + * Command handling function. + * Call HandleCommandL() of container + */ + void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 ); + + /** + * Reset or cancel timers for the controls + */ + void resetDisappearingTimers( TMPXTimerAction timerAction ); + + /** + * Return state + */ + inline TMPXPlaybackState state(); + + inline HbVideoBasePlaybackView* view(); + + /** + * Return file details + */ + inline QMPXVideoPlaybackViewFileDetails* fileDetails(); + + TPlaybackViewMode viewMode(); + + void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true ); + + bool isAttachOperation(); + + private slots: + void attachVideo(); + void sendVideo(); + + public: + QMPXVideoPlaybackViewFileDetails *mFileDetails; + HbVideoBasePlaybackView *mView; + + TMPXPlaybackState mState; + TPlaybackViewMode mViewMode; + TMPXTimerAction mTimerAction; + TMPXVideoPlaybackViewCommandIds mCommand; + int mCommandValue; + bool mIsAttachOperation; + bool mAttachVideoDone; + bool mSendVideoDone; +}; + +// INLINE METHODS +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::state +// ------------------------------------------------------------------------------------------------- +// +inline +TMPXPlaybackState QMPXVideoPlaybackControlsController::state() +{ + return mState; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::fileDetails +// ------------------------------------------------------------------------------------------------- +// +inline +QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails() +{ + return mFileDetails; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::viewMode +// ------------------------------------------------------------------------------------------------- +// +inline +TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode() +{ + return mViewMode; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::view +// ------------------------------------------------------------------------------------------------- +// +inline +HbVideoBasePlaybackView* QMPXVideoPlaybackControlsController::view() +{ + return mView; +} + +#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/ + +// End of File diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/mpxvideoplaybackviewfiledetails.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/inc/mpxvideoplaybackviewfiledetails.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,85 @@ +/* +* 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: MPX Video File Details (QT) +* +*/ + +// Version : %version: 1 % + + + + +#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__ +#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__ + +#include +#include "mpxhelixplaybackplugindefs.h" + + +// +// CLASS DECLARATION +// +class QMPXVideoPlaybackViewFileDetails : public QObject +{ + public: + // + // Constructor + // + QMPXVideoPlaybackViewFileDetails(); + + // + // Destructor. + // + virtual ~QMPXVideoPlaybackViewFileDetails(); + + // + // Clear all file details + // + void clearFileDetails(); + + public: + // + // Data + // + QString mClipName; + QString mTitle; + QString mArtist; + QString mMimeType; + QString mDescription; + QString mLocation; + QString mCopyright; + QString mLanguage; + QString mKeywords; + + TMPXVideoMode mPlaybackMode; + bool mSeekable; + bool mPausableStream; + bool mAudioEnabled; + bool mVideoEnabled; + bool mPartialPlayback; + bool mRNFormat; + bool mTvOutConnected; + bool mTvOutPlayAllowed; + bool mDrmProtected; + bool mMultiItemPlaylist; + + int mVideoHeight; + int mVideoWidth; + int mBitRate; + int mDuration; +}; + +#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__ + +// EOF diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/hbtoolbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/hbtoolbar.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,115 @@ +/* +* 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: Implementation of HbToolBar +* +*/ + +// Version : %version: 1 % + + +#include + +#include "mpxvideo_debug.h" +#include "hbtoolbar.h" +#include "hbtoolbutton.h" + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::HbToolBar +// ------------------------------------------------------------------------------------------------- +// +HbToolBar::HbToolBar() + : mVisible( false ) + , mEnabled( false ) +{ + MPX_ENTER_EXIT(_L("HbToolBar::HbToolBar()")); + + mLayout = new QGraphicsLinearLayout(); + setLayout( mLayout ); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::~HbToolBar +// ------------------------------------------------------------------------------------------------- +// +HbToolBar::~HbToolBar() +{ + MPX_DEBUG(_L("HbToolBar::HbToolBar") ); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::setEnabled +// ------------------------------------------------------------------------------------------------- +// +void HbToolBar::setEnabled( bool enabled ) +{ + MPX_DEBUG(_L("HbToolBar::setEnabled %d"), enabled ); + + mEnabled = enabled; +} + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::setVisible +// ------------------------------------------------------------------------------------------------- +// +void HbToolBar::setVisible( bool visible ) +{ + MPX_DEBUG(_L("HbToolBar::setVisible %d"), visible ); + + mVisible = visible; +} + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::setOrientation +// ------------------------------------------------------------------------------------------------- +// +void HbToolBar::setOrientation( int orientation ) +{ + MPX_DEBUG(_L("HbToolBar::setOrientation") ); + Q_UNUSED( orientation ); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::clearActions +// ------------------------------------------------------------------------------------------------- +// +void HbToolBar::clearActions() +{ + MPX_DEBUG(_L("HbToolBar::clearActions") ); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::addAction +// ------------------------------------------------------------------------------------------------- +// +void HbToolBar::addAction( HbAction *action ) +{ + MPX_DEBUG(_L("HbToolBar::addAction") ); + Q_UNUSED( action ); + + HbToolButton *button = new HbToolButton( action ); + mLayout->addItem( button ); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolBar::addAction +// ------------------------------------------------------------------------------------------------- +// +QGraphicsLayout* HbToolBar::layout() +{ + MPX_DEBUG(_L("HbToolBar::layout") ); + + return mLayout; +} + +// End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/hbtoolbutton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/hbtoolbutton.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,83 @@ +/* +* 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: Implementation of HbToolButton +* +*/ + +// Version : %version: 1 % + + + +#include + +#include +#include + +#include "mpxvideo_debug.h" +#include "hbtoolbutton.h" + +// ------------------------------------------------------------------------------------------------- +// HbToolButton::HbToolButton +// ------------------------------------------------------------------------------------------------- +// +HbToolButton::HbToolButton( HbAction *action ) +{ + MPX_ENTER_EXIT(_L("HbToolButton::HbToolButton()")); + + mAction = action; +} + +// ------------------------------------------------------------------------------------------------- +// HbToolButton::~HbToolButton +// ------------------------------------------------------------------------------------------------- +// +HbToolButton::~HbToolButton() +{ + MPX_DEBUG(_L("HbToolButton::HbToolButton") ); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolButton::isEnabled +// ------------------------------------------------------------------------------------------------- +// +bool HbToolButton::isEnabled() +{ + MPX_DEBUG(_L("HbToolButton::isEnabled") ); + + return mAction->isEnabled(); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolButton::press +// ------------------------------------------------------------------------------------------------- +// +void HbToolButton::press() +{ + MPX_DEBUG(_L("HbToolButton::press") ); + + emit pressed(); +} + +// ------------------------------------------------------------------------------------------------- +// HbToolButton::release +// ------------------------------------------------------------------------------------------------- +// +void HbToolButton::release() +{ + MPX_DEBUG(_L("HbToolButton::release") ); + + emit released(); +} + +// End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/hbvideobaseplaybackview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/hbvideobaseplaybackview.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,92 @@ +/* +* 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: Implementation of Video playback view +* +*/ + +// Version : %version: 2 % + + + +// Include Files + +#include +#include + +#include "hbtoolbar.h" +#include "hbvideobaseplaybackview.h" + +// Member Functions + +// ------------------------------------------------------------------------------------------------- +// HbVideoPlaybackView::HbVideoPlaybackView() +// ------------------------------------------------------------------------------------------------- +// +HbVideoBasePlaybackView::HbVideoBasePlaybackView() +{ + mToolBar = new HbToolBar(); +} + +// ------------------------------------------------------------------------------------------------- +// HbVideoPlaybackView::~HbVideoPlaybackView() +// ------------------------------------------------------------------------------------------------- +// +HbVideoBasePlaybackView::~HbVideoBasePlaybackView() +{ + if ( mToolBar ) + { + delete mToolBar; + mToolBar = NULL; + } +} + +// ------------------------------------------------------------------------------------------------- +// HbVideoBasePlaybackView::toolBar() +// ------------------------------------------------------------------------------------------------- +// +HbToolBar* HbVideoBasePlaybackView::toolBar() +{ + return mToolBar; +} + +// ------------------------------------------------------------------------------------------------- +// HbVideoBasePlaybackView::hideItems() +// ------------------------------------------------------------------------------------------------- +// +void HbVideoBasePlaybackView::hideItems( int item ) +{ + Q_UNUSED( item ); + mToolBar->setVisible( false ); +} + +// ------------------------------------------------------------------------------------------------- +// HbVideoBasePlaybackView::hideItems() +// ------------------------------------------------------------------------------------------------- +// +void HbVideoBasePlaybackView::showItems( int item ) +{ + Q_UNUSED( item ); + mToolBar->setVisible( true ); +} + +// ------------------------------------------------------------------------------------------------- +// HbVideoBasePlaybackView::getWindow() +// ------------------------------------------------------------------------------------------------- +// +RWindow *HbVideoBasePlaybackView::getWindow() +{ + return static_cast( hbInstance->allMainWindows()[0]->effectiveWinId()->DrawableWindow() ); +} + +// EOF diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/mpxvideoplaybackcontrolscontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/mpxvideoplaybackcontrolscontroller.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,139 @@ +/* +* 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: Implementation of MPXVideoPlaybackControlsController +* +*/ + +// Version : %version: 1 % + + + +// INCLUDE FILES + +#include "hbvideobaseplaybackview.h" +#include "mpxvideoplaybackcontrolscontroller.h" + +// ================= MEMBER FUNCTIONS ============================================================== + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController() +// ------------------------------------------------------------------------------------------------- +// +QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController( bool attachOperation ) + : mViewMode( EFullScreenView ) + , mIsAttachOperation( attachOperation ) + , mAttachVideoDone( false ) + , mSendVideoDone( false ) +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()")); + + mFileDetails = new QMPXVideoPlaybackViewFileDetails(); + mView = new HbVideoBasePlaybackView(); +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController +// ------------------------------------------------------------------------------------------------- +// +QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController")); + + if ( mFileDetails ) + { + delete mFileDetails; + mFileDetails = NULL; + } + + if ( mView ) + { + delete mView; + mView = NULL; + } +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::handleCommand() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackControlsController::handleCommand( + TMPXVideoPlaybackViewCommandIds command, int value ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command); + + mCommand = command; + mCommandValue = value; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::changeViewMode +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackControlsController::changeViewMode( + TPlaybackViewMode viewMode, bool transitionEffect ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()")); + + Q_UNUSED( transitionEffect ); + mViewMode = viewMode; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::resetDisappearingTimers() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction ) +{ + MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::resetDisappearingTimers()")); + + mTimerAction = timerAction; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::isAttachOperation() +// ------------------------------------------------------------------------------------------------- +// +bool QMPXVideoPlaybackControlsController::isAttachOperation() +{ + MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isAttachOperation() ret %d"), + mIsAttachOperation); + + return mIsAttachOperation; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::attachVideo() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackControlsController::attachVideo() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()")); + + handleCommand( EMPXPbvCmdClose ); + mAttachVideoDone = true; +} + +// ------------------------------------------------------------------------------------------------- +// QMPXVideoPlaybackControlsController::sendVideo() +// ------------------------------------------------------------------------------------------------- +// +void QMPXVideoPlaybackControlsController::sendVideo() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::sendVideo()")); + + handleCommand( EMPXPbvCmdPause ); + mSendVideoDone = true; +} + +// End of File diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/mpxvideoplaybackviewfiledetails.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/stub/src/mpxvideoplaybackviewfiledetails.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,78 @@ +/* +* 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: class for MPX Video File Details (Qt) +* +*/ + +// Version : %version: 1 % + + + +// +// INCLUDE FILES +// +#include "mpxvideo_debug.h" +#include "mpxvideoplaybackviewfiledetails.h" + + +// ============================ MEMBER FUNCTIONS =================================================== + +QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()")); + + clearFileDetails(); +} + +QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()")); + + clearFileDetails(); +} + +void +QMPXVideoPlaybackViewFileDetails::clearFileDetails() +{ + MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()")); + + mMimeType = tr(""); + mTitle = tr(""); + mArtist = tr(""); + mClipName = tr(""); + mDescription = tr(""); + mLocation = tr(""); + mCopyright = tr(""); + mLanguage = tr(""); + mKeywords = tr(""); + + mPlaybackMode = EMPXVideoLocal; + mSeekable = false; + mPausableStream = false; + mAudioEnabled = false; + mVideoEnabled = false; + mPartialPlayback = false; + mRNFormat = false; + + mDuration = 0; + mTvOutConnected = false; + mTvOutPlayAllowed = true; + mDrmProtected = false; + + mVideoHeight = 0; + mVideoWidth = 0; + mBitRate = 0; +} + +// EOF diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/testmpxvideoplaybacktoolbar.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybacktoolbar/testmpxvideoplaybacktoolbar.pro Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,45 @@ +# +# 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: Project file for building testmpxvideoplaybacktoolbar +# +# +# Version : %version: 1 % + +TEMPLATE = app +TARGET = testmpxvideoplaybacktoolbar +CONFIG += qtestlib qt hb + +INCLUDEPATH += stub/inc \ + ../../../../inc \ + ../../../inc + + +DEPENDPATH += inc src stub/inc stub/src + +# Input +HEADERS += testmpxvideoplaybacktoolbar.h \ + mpxvideoplaybackcontrolscontroller.h \ + mpxvideoplaybackviewfiledetails.h \ + hbvideobaseplaybackview.h \ + hbtoolbar.h \ + hbtoolbutton.h \ + ../../controlinc/mpxvideoplaybacktoolbar.h + +SOURCES += testmpxvideoplaybacktoolbar.cpp \ + mpxvideoplaybackcontrolscontroller.cpp \ + mpxvideoplaybackviewfiledetails.cpp \ + hbvideobaseplaybackview.cpp \ + hbtoolbar.cpp \ + hbtoolbutton.cpp \ + ../../controlsrc/mpxvideoplaybacktoolbar.cpp diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxvideoplaybackdisplayhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxvideoplaybackdisplayhandler.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,173 @@ +/* +* 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: Implementation of video playback display handler +* +*/ + +// Version : %version: 4 % + + +#ifndef __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ +#define __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ + +// INCLUDES + +#include +#include +#include +#ifdef SYMBIAN_BUILD_GCE +#include +#else +#include +#endif + + +// +// CLASS DECLARATION +// +class MMPXPlaybackUtility; +class CMPXVideoViewWrapper; +class QMPXVideoPlaybackViewFileDetails; + +/* + * CMPXVideoPlaybackDisplayHandler + * + */ +class CMPXVideoPlaybackDisplayHandler : public CBase +#ifndef SYMBIAN_BUILD_GCE + , public MDirectScreenAccess +#endif +{ + // + // To save user's preference for scaling type in video ratio + screen ratio + // + typedef struct + { + TReal32 videoRatio; + TReal32 screenRatio; + TMMFScalingType scalingType; + } TMPXAspectRatio ; + + public: + + ~CMPXVideoPlaybackDisplayHandler(); + + static CMPXVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ); + + void CreateDisplayWindowL( RWsSession& aWs, + CWsScreenDevice& aScreenDevice, + RWindow& aWin, + TRect aDisplayRect ); + + void RemoveDisplayWindow(); + + void HandleVideoDisplayMessageL( CMPXMessage* aMessage ); + + TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ); + + TInt SetDefaultAspectRatioL( QMPXVideoPlaybackViewFileDetails* aFileDetails, + TReal32 aDisplayAspectRatio ); + + void UpdateVideoRectL( TRect aRect, TBool transitionEffect ); + + private: + + CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil, + CMPXVideoViewWrapper* aViewWrapper ); + + void ConstructL(); + + void LoadAspectRatioL(); + + void SaveAspectRatioL(); + + void SetVideoRectL( TRect aClipRect ); + + void CalculateVideoRectL(); + + static TInt UpdateVideoRectTimeOutL( TAny* aPtr ); + +#ifdef SYMBIAN_BUILD_GCE + + private: + void AddDisplayWindowL( CWsScreenDevice& aScreenDevice, + RWindowBase& aWindowBase, + RWindow* aWin ); + + void SurfaceCreatedL( CMPXMessage* aMessage ); + void SurfaceChangedL( CMPXMessage* aMessage ); + void SurfaceRemoved(); + TInt SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd ); + +#else + + private: + // + // MDirectScreenAccess Implementation + // + void AbortNow( RDirectScreenAccess::TTerminationReasons aReason ); + void Restart( RDirectScreenAccess::TTerminationReasons aReason ); + + TInt CreateAspectRatioCommandL( TMPXVideoPlaybackCommand aCmd ); + + void SetDisplayWindowL( RWsSession& aWs, + CWsScreenDevice& aScreenDevice, + RWindowBase& aWin, + TRect aClipRect ); + void RestartDsaL(); + void CreateAbortDsaCmdL(); + +#endif + + public: + MMPXPlaybackUtility* iPlaybackUtility; + + RArray iAspectRatioArray; + TInt iCurrentIndexForAspectRatio; + TReal iDisplayAspectRatio; + + TRect iWindowRect; + + TReal32 iTlXDiff; + TReal32 iTlYDiff; + TReal32 iBrXDiff; + TReal32 iBrYDiff; + + TInt iTransitionEffectCnt; + + CPeriodic* iResizingTimer; + CMPXVideoViewWrapper* iViewWrapper; + +#ifdef SYMBIAN_BUILD_GCE + CMediaClientVideoDisplay* iVideoDisplay; + + RWindowBase* iWindowBase; + TBool iSurfaceCached; + TSurfaceId iSurfaceId; + TRect iCropRect; + TVideoAspectRatio iAspectRatio; + TReal32 iScaleWidth; + TReal32 iScaleHeight; + TInt iHorizontalPosition; + TInt iVerticalPosition; + TVideoRotation iRotation; + TAutoScaleType iAutoScale; +#else + CDirectScreenAccess* iDirectScreenAccess; +#endif + +}; + +#endif // __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 4 % +// Version : %version: 5 % #include #include @@ -161,7 +161,7 @@ // TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( QMPXVideoPlaybackViewFileDetails* aFileDetails, - TReal aDisplayAspectRatio ) + TReal32 aDisplayAspectRatio ) { Q_UNUSED( aFileDetails ); Q_UNUSED( aDisplayAspectRatio ); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/inc/testmpxvideoplaybackcontrolscontroller.h --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/inc/testmpxvideoplaybackcontrolscontroller.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/inc/testmpxvideoplaybackcontrolscontroller.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 2 % +// Version : %version: 3 % #ifndef __TESTMPXVIDEOPLAYBACKCONTROLSCONTROLLER_H__ #define __TESTMPXVIDEOPLAYBACKCONTROLSCONTROLLER_H__ @@ -113,6 +113,11 @@ // test private slot attachVideo() // void testslot_attachVideo(); + + // + // test private slot attachVideo() + // + void testslot_sendVideo(); signals: diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/src/testmpxvideoplaybackcontrolscontroller.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/src/testmpxvideoplaybackcontrolscontroller.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/src/testmpxvideoplaybackcontrolscontroller.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 4 % +// Version : %version: 6 % #include #include @@ -969,6 +969,11 @@ init(); // + // verify view closePlaybackView() slot is not yet called + // + QVERIFY( mController->mView->mViewClosed == false ); + + // // connect signal with controller attachVideo() slot // bool res = connect( this, SIGNAL( commandSignal() ), mController, SLOT( attachVideo() ) ); @@ -979,10 +984,10 @@ emit commandSignal(); // - // verify command EMPXPbvCmdClose has been issued + // verify view closePlaybackView() slot is called // - QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdClose ); - + QVERIFY( mController->mView->mViewClosed == true ); + // // verify videoservices itemSelected() slot is called // @@ -1005,6 +1010,45 @@ } +// ------------------------------------------------------------------------------------------------- +// TestMPXVideoPlaybackControlsController::testslot_sendVideo +// ------------------------------------------------------------------------------------------------- +// +void TestMPXVideoPlaybackControlsController::testslot_sendVideo() +{ + MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_sendVideo()") ); + + // + // initialize controlscontroller + // + init(); + + // + // connect signal with controller sendVideoo() slot + // + bool res = connect( this, SIGNAL( commandSignal() ), mController, SLOT( sendVideo() ) ); + + // + // emit signal, this will in turns invoke mController sendVideo() slot + // + emit commandSignal(); + + // + // verify command EMPXPbvCmdClose has been issued + // + QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPause ); + + // + // disconnect signal + // + disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( sendVideo() ) ); + + // + // clean up + // + cleanup(); +} + // End of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/hbvideobaseplaybackview.h --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/hbvideobaseplaybackview.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/hbvideobaseplaybackview.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 1 % +// Version : %version: 2 % @@ -48,6 +48,13 @@ signals: void tappedOnScreen(); + + public slots: + void closePlaybackView(); + + public: + bool mViewClosed; + }; #endif // __HBVIDEOBASEPLAYBACKVIEW_H__ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/shareui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/shareui.h Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,35 @@ +/** +* 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: ShareUI STUB class definition +* +*/ + +// Version : %version: 1 % + +#ifndef SHAREUI_H_ +#define SHAREUI_H_ + +class ShareUi +{ + + public: + + ShareUi(); + ~ShareUi(); + + bool send( QStringList& fileList, bool embedded ); + +}; + +#endif diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/hbvideobaseplaybackview.cpp --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/hbvideobaseplaybackview.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/hbvideobaseplaybackview.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 1 % +// Version : %version: 2 % @@ -36,6 +36,7 @@ // ------------------------------------------------------------------------------------------------- // HbVideoBasePlaybackView::HbVideoBasePlaybackView() + : mViewClosed( false ) { MPX_DEBUG(_L("HbVideoBasePlaybackView::HbVideoBasePlaybackView()")); } @@ -60,4 +61,14 @@ emit tappedOnScreen(); } +// ------------------------------------------------------------------------------------------------- +// HbVideoBasePlaybackView::closePlaybackView() +// ------------------------------------------------------------------------------------------------- +// +void HbVideoBasePlaybackView::closePlaybackView() +{ + MPX_DEBUG(_L("HbVideoBasePlaybackView::closePlaybackView()")); + mViewClosed = true; +} + // EOF diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/shareui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/shareui.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -0,0 +1,56 @@ +/* +* 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: Implementation of ShareUI STUB +* +*/ + +// Version : %version: % + +#include + +#include "shareui.h" +#include "mpxvideo_debug.h" + + +// ---------------------------------------------------------------------------- +// ShareUi() +// ---------------------------------------------------------------------------- +// +ShareUi::ShareUi() +{ + MPX_DEBUG(_L("ShareUi::ShareUi()")); +} + +// ---------------------------------------------------------------------------- +// ~ShareUi() +// ---------------------------------------------------------------------------- +// +ShareUi::~ShareUi() +{ + MPX_DEBUG(_L("ShareUi::~ShareUi()")); +} + +// ---------------------------------------------------------------------------- +// send() +// ---------------------------------------------------------------------------- +// +bool ShareUi::send( QStringList& fileList, bool embedded ) +{ + MPX_DEBUG(_L("ShareUi::send()")); + + Q_UNUSED( fileList ); + Q_UNUSED( embedded ); + + return true; +} diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/testmpxvideoplaybackcontrolscontroller.pro --- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/testmpxvideoplaybackcontrolscontroller.pro Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/testmpxvideoplaybackcontrolscontroller.pro Fri Apr 30 09:52:11 2010 +0300 @@ -14,7 +14,7 @@ # Description: Project file for building testmpxvideoplaybackcontrolscontroller # # -# Version : %version: 5 % +# Version : %version: 6 % TEMPLATE = app @@ -28,7 +28,7 @@ ../inc \ ../../inc \ ../../../inc \ - ../../../../inc \ + ../../../../inc DEPENDPATH += stub/inc stub/src inc src @@ -51,6 +51,7 @@ xqserviceutil.h \ videoservices.h \ videoserviceurifetch.h \ + shareui.h \ ../../inc/mpxvideoplaybackcontrolscontroller.h @@ -72,6 +73,7 @@ xqserviceutil.cpp \ videoservices.cpp \ videoserviceurifetch.cpp \ + shareui.cpp \ ../../controlsrc/mpxvideoplaybackcontrolscontroller.cpp \ No newline at end of file diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/viewinc/mpxvideoplaybackdisplayhandler.h --- a/videoplayback/hbvideoplaybackview/viewinc/mpxvideoplaybackdisplayhandler.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/viewinc/mpxvideoplaybackdisplayhandler.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 8 % +// Version : %version: 9 % #ifndef __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__ @@ -72,7 +72,7 @@ TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ); TInt SetDefaultAspectRatioL( QMPXVideoPlaybackViewFileDetails* aFileDetails, - TReal aDisplayAspectRatio ); + TReal32 aDisplayAspectRatio ); void UpdateVideoRectL( TRect aRect, TBool transitionEffect ); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp --- a/videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#34 % +// Version : %version: da1mmcf#38 % @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -88,10 +87,10 @@ { MPX_DEBUG(_L("HbVideoBasePlaybackView::~HbVideoBasePlaybackView()")); - disconnect( mTimerForClosingView, SIGNAL( timeout() ), this, SIGNAL( activatePreviousView() ) ); - if ( mTimerForClosingView ) - { + { + disconnect( mTimerForClosingView, SIGNAL( timeout() ), this, SIGNAL( activatePreviousView() ) ); + if ( mTimerForClosingView->isActive() ) { mTimerForClosingView->stop(); @@ -101,6 +100,11 @@ mTimerForClosingView = NULL; } + if ( mVideoMpxWrapper ) + { + delete mVideoMpxWrapper; + mVideoMpxWrapper = NULL; + } setParentItem( 0 ); } @@ -122,8 +126,6 @@ menu()->close(); - hideItems( Hb::ToolBarItem ); - // // Landscape orientation // @@ -158,8 +160,6 @@ // go back to device orientation // //hbInstance->allMainWindows()[0]->unsetOrientation(); - - showItems( Hb::ToolBarItem ); } // ------------------------------------------------------------------------------------------------- @@ -209,16 +209,6 @@ showDialog( hbTrId( "txt_videos_info_video_playback_is_not_allowed_duri" ), false ); break; } - case KMPXVideoTvOutPlaybackNotAllowed: - { - showDialog( hbTrId( "txt_videos_info_protected_clip_can_not_be_played" ), false ); - break; - } - case KMPXVideoTvOutPlaybackNotAllowedClose: - { - showDialog( hbTrId( "txt_videos_info_protected_clip_can_not_be_played" ) ); - break; - } default: { TRAP_IGNORE( diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackdisplayhandler.cpp --- a/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackdisplayhandler.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackdisplayhandler.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 19 % +// Version : %version: 20 % #include #include @@ -242,7 +242,7 @@ // TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( QMPXVideoPlaybackViewFileDetails* aFileDetails, - TReal aDisplayAspectRatio ) + TReal32 aDisplayAspectRatio ) { MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL()")); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackviewfiledetails.cpp --- a/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackviewfiledetails.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackviewfiledetails.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#9 % +// Version : %version: da1mmcf#10 % @@ -67,7 +67,6 @@ mDuration = 0; mTvOutConnected = false; - mTvOutPlayAllowed = true; mDrmProtected = false; mVideoHeight = 0; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp --- a/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#27 % +// Version : %version: da1mmcf#30 % @@ -555,13 +555,10 @@ TMPXVideoPlaybackControlCommandIds cmdId = EMPXControlCmdTvOutDisconnected; TBool tvOutConnected( *aMessage->Value( KMPXMediaVideoTvOutConnected ) ); - TBool playbackAllowed = ETrue; if ( tvOutConnected ) { cmdId = EMPXControlCmdTvOutConnected; - - playbackAllowed = *aMessage->Value( KMPXMediaVideoTvOutPlayAllowed ); } if ( iUserInputHandler ) @@ -571,7 +568,7 @@ if ( iControlsController ) { - iControlsController->handleEvent( cmdId, playbackAllowed ); + iControlsController->handleEvent( cmdId ); } break; } @@ -834,15 +831,6 @@ } // - // TV-Out Playback Allowed - // - if ( aMedia.IsSupported( KMPXMediaVideoTvOutPlayAllowed ) ) - { - iFileDetails->mTvOutPlayAllowed = - aMedia.ValueTObjectL( KMPXMediaVideoTvOutPlayAllowed ); - } - - // // BitRate // if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) ) @@ -962,15 +950,23 @@ if ( iFileDetails->mVideoEnabled ) { - RWindow *window = iView->getWindow(); + // + // get window size + // + RWindow *window = iView->getWindow(); + TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) ); + + // + // get window aspect ratio + // if device is in landscape mode, width > height + // if device is in portrait mode, width < height + // + TReal32 width = (TReal32) displayRect.Width(); + TReal32 height = (TReal32) displayRect.Height(); + TReal32 displayAspectRatio = (width > height)? (width / height) : (height / width); - TRect displayRect = TRect( window->Position().iX, - window->Position().iY, - window->Position().iX + window->Size().iWidth, - window->Position().iY + window->Size().iHeight ); - - TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height(); - + // + // get new aspect ratio TInt newAspectRatio = iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio ); @@ -1039,7 +1035,7 @@ TInt aValue, TInt aError ) { - MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL - Error(%d)"), aError ); + MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError ); if ( aError == KErrNone ) { @@ -1304,7 +1300,7 @@ // void CMPXVideoViewWrapper::HandleShortPressBackwardL() { - MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL()")); + MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleShortPressBackwardL()")); if( !iPlaylistView ) { @@ -1318,7 +1314,7 @@ // void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground ) { - MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleForegroundEventL()"), + MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL()"), _L("aForeground = %d"), aForeground ); TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground; @@ -1379,7 +1375,6 @@ iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL( KMPXMediaVideoMode ); iFileDetails->mTvOutConnected = cmd->ValueTObjectL( KMPXMediaVideoTvOutConnected ); - iFileDetails->mTvOutPlayAllowed = cmd->ValueTObjectL( KMPXMediaVideoTvOutPlayAllowed ); TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/inc/hbvideobaseplaybackview.h --- a/videoplayback/inc/hbvideobaseplaybackview.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/inc/hbvideobaseplaybackview.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#13 % +// Version : %version: da1mmcf#14 % @@ -49,8 +49,10 @@ void activatePreviousView(); void tappedOnScreen(); + public slots: + virtual void closePlaybackView(); + protected slots: - virtual void closePlaybackView(); void handleClosePopupDialog(); public: diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/inc/mpxvideoaccessoryobserver.h --- a/videoplayback/videohelix/inc/mpxvideoaccessoryobserver.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/inc/mpxvideoaccessoryobserver.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 6 % +// Version : %version: 7 % @@ -65,14 +65,6 @@ */ TBool IsTvOutConnected(); - /* - * Returns if the playback is allowed when the TV-Out cable is connected - * @return playback is allowed - * ETrue playback is allowed. - * EFalse playback is not allowed. - */ - TBool IsTvOutPlaybackAllowed(); - private: /* @@ -133,7 +125,6 @@ CMPXVideoPlaybackController* iController; TBool iTvOutConnected; - TBool iTvOutPlaybackAllowed; #ifdef __ACCESSORY_FW RAccessoryServer iServer; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/inc/mpxvideodrmhelper.h --- a/videoplayback/videohelix/inc/mpxvideodrmhelper.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/inc/mpxvideodrmhelper.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,9 @@ * */ -// Version : %version: 5 % + +// Version : %version: 6 % + #ifndef __MPXVIDEODRMHELPER_H__ #define __MPXVIDEODRMHELPER_H__ @@ -52,13 +54,10 @@ TInt GetDrmRightsStatus( RFile& aFile ); - TBool IsTvOutAllowedL( RFile& aFile ); - #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API - TBool IsProtected64L( RFile64& aFile ); + TBool IsProtected64L( RFile64& aFile ); TInt GetDrmRightsStatus64( RFile64& aFile ); - TBool IsTvOutAllowed64L( RFile64& aFile ); #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/inc/mpxvideoplaybackcontroller.h --- a/videoplayback/videohelix/inc/mpxvideoplaybackcontroller.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/inc/mpxvideoplaybackcontroller.h Fri Apr 30 09:52:11 2010 +0300 @@ -16,7 +16,7 @@ */ -// Version : %version: 24 % +// Version : %version: 25 % #ifndef _CMPXVIDEOPLAYBACKCONTROLLER_H_ @@ -186,7 +186,7 @@ CHWRMLight* GetLightsL(); void ReleaseLights(); - void SendTvOutEventL( TBool aConnected, TBool aPlaybackAllowed ); + void SendTvOutEventL( TBool aConnected ); protected: diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/inc/mpxvideoplaybackmode.h --- a/videoplayback/videohelix/inc/mpxvideoplaybackmode.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/inc/mpxvideoplaybackmode.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,8 @@ * */ -// Version : %version: 14 % + +// Version : %version: 15 % #ifndef _CMPXVIDEOPLAYBACKMODE_H_ @@ -68,7 +69,6 @@ virtual void HandleBackground(); virtual TBool IsNetworkMode2GL(); virtual TBool CanPlayNow(); - virtual TBool IsTvOutAllowedL(); virtual void OpenFileL( const TDesC& aMediaFile ); virtual void OpenFileL( const RFile& aMediaFile ); @@ -129,7 +129,6 @@ inline virtual TInt GetMode(); virtual TBool CanPlayNow(); virtual void HandleOpenComplete(); - TBool IsTvOutAllowedL(); void OpenFileL( const TDesC& aMediaFile ); virtual void HandlePause(); }; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/inc/mpxvideoplaybackstate.h --- a/videoplayback/videohelix/inc/mpxvideoplaybackstate.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/inc/mpxvideoplaybackstate.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,8 @@ * */ -// Version : %version: 17 % + +// Version : %version: 18 % #ifndef _CMPXVIDEOPLAYBACKSTATE_H_ @@ -48,7 +49,6 @@ */ NONSHARABLE_CLASS( CMPXVideoPlaybackState ) : public CBase { - public: // // Constructors and destructor @@ -104,6 +104,8 @@ virtual void ResolveTimeoutError( TInt aError ); + virtual void UpdateSeekableL( CMPXCommand& aCmd ); + // // Set aspect ratio to mmf controller // @@ -165,9 +167,9 @@ virtual void HandleBackground(); virtual void HandleForeground(); virtual void HandlePlay(); + virtual void UpdateSeekableL( CMPXCommand& aCmd ); inline virtual TMPXVideoPlaybackState GetState(); - }; diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/src/mpxvideoaccessoryobserver.cpp --- a/videoplayback/videohelix/src/mpxvideoaccessoryobserver.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideoaccessoryobserver.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 8 % +// Version : %version: 9 % // // INCLUDE FILES @@ -84,7 +84,6 @@ : CActive( CActive::EPriorityStandard ) , iController( aController ) , iTvOutConnected( EFalse ) - , iTvOutPlaybackAllowed( ETrue ) { CActiveScheduler::Add( this ); } @@ -180,19 +179,6 @@ if ( iTvOutConnected != tvOutConnected ) { iTvOutConnected = tvOutConnected; - - if ( iTvOutConnected ) - { - // - // Check the playablility of the clip - // - iTvOutPlaybackAllowed = iController->iPlaybackMode->IsTvOutAllowedL(); - } - else - { - iTvOutPlaybackAllowed = ETrue; - } - statusChanged = ETrue; } @@ -275,16 +261,4 @@ return iTvOutConnected; } -// ------------------------------------------------------------------------------------------------- -// CMPXVideoAccessoryObserver::IsTvOutPlaybackAllowed -// ------------------------------------------------------------------------------------------------- -// -TBool CMPXVideoAccessoryObserver::IsTvOutPlaybackAllowed() -{ - TBool playAllowed = ( ! iTvOutConnected || iTvOutPlaybackAllowed ); - MPX_DEBUG(_L("CMPXVideoAccessoryObserver::IsTvOutPlaybackAllowed(%d)"), playAllowed); - - return playAllowed; -} - // End of File diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/src/mpxvideodrmhelper.cpp --- a/videoplayback/videohelix/src/mpxvideodrmhelper.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideodrmhelper.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,8 @@ * */ -// Version : %version: 8 % + +// Version : %version: 9 % #include @@ -110,41 +111,6 @@ return drmError; } -TBool CMpxVideoDrmHelper::IsTvOutAllowedL( RFile& aFile ) -{ - TBool tvOutAllowed = ETrue; - - if ( IsProtectedL( aFile ) ) - { - ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile ); - - ContentAccess::CData* data = content->OpenContentL( ContentAccess::EPeek ); - - TInt fileType; - - TInt error = data->GetAttribute( ContentAccess::EFileType, fileType ); - - if ( error == KErrNone ) - { - // - // TV-out is not allowed for DRM content other than OMA1 DRM - // - if ( fileType != ContentAccess::EOma1Dcf ) - { - tvOutAllowed = EFalse; - } - } - - delete data; - - CleanupStack::PopAndDestroy( content ); - } - - MPX_DEBUG(_L("CMpxVideoDrmHelper::IsTvOutAllowedL(%d)"), tvOutAllowed); - - return tvOutAllowed; -} - #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API // ------------------------------------------------------------------------------------------------ @@ -203,45 +169,6 @@ return drmError; } -// ------------------------------------------------------------------------------------------------ -// CMpxVideoDrmHelper::IsTvOutAllowed64L() -// ------------------------------------------------------------------------------------------------ -// -TBool CMpxVideoDrmHelper::IsTvOutAllowed64L( RFile64& aFile ) -{ - TBool tvOutAllowed = ETrue; - - if ( IsProtected64L( aFile ) ) - { - ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile ); - - ContentAccess::CData* data = content->OpenContentL( ContentAccess::EPeek ); - - TInt fileType; - - TInt error = data->GetAttribute( ContentAccess::EFileType, fileType ); - - if ( error == KErrNone ) - { - // - // TV-out is not allowed for DRM content other than OMA1 DRM - // - if ( fileType != ContentAccess::EOma1Dcf ) - { - tvOutAllowed = EFalse; - } - } - - delete data; - - CleanupStack::PopAndDestroy( content ); - } - - MPX_DEBUG(_L("CMpxVideoDrmHelper::IsTvOutAllowed64L(%d)"), tvOutAllowed); - - return tvOutAllowed; -} - #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API // EOF diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp --- a/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -16,7 +16,7 @@ */ -// Version : %version: 56 % +// Version : %version: 58 % // @@ -155,7 +155,6 @@ iAccessPointId = KUseDefaultIap; iVideoSeeker = CMPXVideoSeeker::NewL( this ); - // Initiliaze to True iSeekable = ETrue; InitVolumeWatchersL(); @@ -197,6 +196,12 @@ ChangeState( EMPXVideoInitializing ); + if ( iClipName ) + { + delete iClipName; + iClipName = NULL; + } + iClipName = aMediaFile.AllocL(); iAccessPointId = aAccessPointId; @@ -228,35 +233,28 @@ iAccessoryMonitor = CMPXVideoAccessoryObserver::NewL( this ); } - if ( iAccessoryMonitor->IsTvOutPlaybackAllowed() ) + if ( fileExists ) { - if ( fileExists ) + // + // Ensure there are rights for protected clips + // + TInt drmError = iDrmHelper->GetDrmRightsStatus( iFileHandle ); + + if ( drmError ) { // - // Ensure there are rights for protected clips + // Send error to observer for handling // - TInt drmError = iDrmHelper->GetDrmRightsStatus( iFileHandle ); - - if ( drmError ) - { - // - // Send error to observer for handling - // - HandleError( drmError ); - } - else - { - iState->OpenFileL( iFileHandle ); - } + HandleError( drmError ); } else { - iState->OpenFileL( iClipName->Des() ); + iState->OpenFileL( iFileHandle ); } } else { - HandleError( KMPXVideoTvOutPlaybackNotAllowedClose ); + iState->OpenFileL( iClipName->Des() ); } } @@ -418,7 +416,7 @@ { case EPbCmdInitView: { - if ( iState != iNotIntialisedState) + if ( iState != iNotIntialisedState ) { aCmd.SetTextValueL( KMPXMediaVideoPlaybackFileName, *iClipName ); aCmd.SetTObjectValueL( KMPXMediaVideoMode, iPlaybackMode->GetMode() ); @@ -426,12 +424,10 @@ aCmd.SetTObjectValueL( KMPXMediaVideoTvOutConnected, iAccessoryMonitor->IsTvOutConnected() ); - aCmd.SetTObjectValueL( KMPXMediaVideoTvOutPlayAllowed, - iAccessoryMonitor->IsTvOutPlaybackAllowed() ); - if ( iRecognizedMimeType ) { - aCmd.SetTextValueL( KMPXMediaVideoRecognizedMimeType, *iRecognizedMimeType ); + aCmd.SetTextValueL( KMPXMediaVideoRecognizedMimeType, + *iRecognizedMimeType ); } } @@ -475,7 +471,9 @@ } case EPbCmdHandleBackground: { - iAppInForeground = static_cast(aCmd.ValueTObjectL(KMPXMediaVideoAppForeground)); + iAppInForeground = + static_cast(aCmd.ValueTObjectL(KMPXMediaVideoAppForeground)); + iState->HandleBackground(); break; } @@ -496,13 +494,7 @@ } case EPbCmdUpdateSeekable: { - iSeekable = aCmd.ValueTObjectL(KMPXMediaGeneralExtVideoSeekable); - - if ( iFileDetails ) - { - iFileDetails->iSeekable &= iSeekable; - } - + iState->UpdateSeekableL( aCmd ); break; } case EPbCmdEndofClipReached: @@ -1773,7 +1765,7 @@ // CMPXVideoPlaybackController::SendTvOutEventL // ------------------------------------------------------------------------------------------------- // -void CMPXVideoPlaybackController::SendTvOutEventL( TBool aConnected, TBool aPlaybackAllowed ) +void CMPXVideoPlaybackController::SendTvOutEventL( TBool aConnected ) { MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::SendTvOutEventL()")); @@ -1788,7 +1780,6 @@ message->SetTObjectValueL ( KMPXMediaVideoPlaybackCommand, EPbCmdTvOutEvent ); message->SetTObjectValueL( KMPXMediaVideoTvOutConnected, aConnected ); - message->SetTObjectValueL( KMPXMediaVideoTvOutPlayAllowed, aPlaybackAllowed ); iMPXPluginObs->HandlePlaybackMessage( message, KErrNone ); @@ -1829,9 +1820,7 @@ MPX_ENTER_EXIT( _L("CMPXVideoPlaybackController::HandleTvOutEventL()"), _L("aConnected = %d"), aConnected ); - TBool playbackAllowed = iAccessoryMonitor->IsTvOutPlaybackAllowed(); - - SendTvOutEventL( aConnected, playbackAllowed ); + SendTvOutEventL( aConnected ); // // Check playback status of clip with new Tv-Out status @@ -1841,25 +1830,12 @@ // // TV-Out accessory connected // - if ( ! playbackAllowed ) + // If lights are being controlled enable display timer so that screen backlight will be turned + // of after timeout. + if ( iBackLightTimer->IsActive() ) { - // - // Clip has DRM protection and TV-Out is connected - // Pause playback and display info note - // - DoHandleCommandL( EPbCmdPause ); - - iState->SendErrorToViewL( KMPXVideoTvOutPlaybackNotAllowed ); + RestartDisplayTimer(); } - else - { - // If lights are being controlled enable display timer so that screen backlight will be turned - // of after timeout. - if ( iBackLightTimer->IsActive() ) - { - RestartDisplayTimer(); - } - } } else { @@ -1922,6 +1898,7 @@ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DoHandleBackLightTimeout()")); TBool tvOutConnected( EFalse ); + if ( iAccessoryMonitor ) { tvOutConnected = iAccessoryMonitor->IsTvOutConnected(); @@ -1931,7 +1908,8 @@ // it keeps resetting display timer and keeps lights on whenever there is user activity if ( tvOutConnected ) { - MPX_DEBUG ( _L("CMPXVideoPlaybackController::DoHandleBackLightTimeout() inactivity time = %d"), User::InactivityTime().Int() ); + MPX_DEBUG(_L("CMPXVideoPlaybackController::DoHandleBackLightTimeout() inactivity time = %d"), User::InactivityTime().Int() ); + // Cancel activity timer. Otherwise resetting inactivity time would fire user activity detection CancelUserActivityTimer(); } @@ -2357,7 +2335,7 @@ ChangeState( EMPXVideoNotInitialized ); // - // Move the FW state to Initialized so that it can request for Media + // Move the FW state to Initialized so that it can request for Media // iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPInitialised, 0, KErrNone ); @@ -2390,12 +2368,6 @@ iFileDetails = NULL; } - if ( iClipName ) - { - delete iClipName; - iClipName = NULL; - } - if ( iRecognizedMimeType ) { delete iRecognizedMimeType; @@ -2414,7 +2386,6 @@ } #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API - // reset to True iSeekable = ETrue; // @@ -2497,6 +2468,12 @@ ChangeState( EMPXVideoInitializing ); + if ( iClipName ) + { + delete iClipName; + iClipName = NULL; + } + iClipName = aMediaFile.AllocL(); iAccessPointId = aAccessPointId; @@ -2528,35 +2505,28 @@ iAccessoryMonitor = CMPXVideoAccessoryObserver::NewL( this ); } - if ( iAccessoryMonitor->IsTvOutPlaybackAllowed() ) + if ( fileExists ) { - if ( fileExists ) + // + // Ensure there are rights for protected clips + // + TInt drmError = iDrmHelper->GetDrmRightsStatus64( iFileHandle64 ); + + if ( drmError ) { // - // Ensure there are rights for protected clips + // Send error to observer for handling // - TInt drmError = iDrmHelper->GetDrmRightsStatus64( iFileHandle64 ); - - if ( drmError ) - { - // - // Send error to observer for handling - // - HandleError( drmError ); - } - else - { - iState->OpenFile64L( iFileHandle64 ); - } + HandleError( drmError ); } else { - iState->OpenFileL( iClipName->Des() ); + iState->OpenFile64L( iFileHandle64 ); } } else { - HandleError( KMPXVideoTvOutPlaybackNotAllowedClose ); + iState->OpenFileL( iClipName->Des() ); } } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/src/mpxvideoplaybackmode.cpp --- a/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,8 +15,8 @@ * */ -// Version : %version: 23 % +// Version : %version: 25 % // @@ -177,29 +177,31 @@ { MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleBackground()")); + // + // Pause in all cases to remove the different behavior based on the decoder + // + iVideoPlaybackCtlr->iState->HandlePause(); + if ( iVideoPlaybackCtlr->iAppInForeground ) { if ( iVideoPlaybackCtlr->IsAlarm() ) { iVideoPlaybackCtlr->iForegroundPause = ETrue; - iVideoPlaybackCtlr->iState->HandlePause(); } - else if ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) + else if ( iVideoPlaybackCtlr->IsKeyLocked() && + iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) { iVideoPlaybackCtlr->iForegroundPause = ETrue; - iVideoPlaybackCtlr->iState->HandlePause(); iVideoPlaybackCtlr->SendHideControlsEventL(); } else if ( iVideoPlaybackCtlr->IsPhoneCall() || iVideoPlaybackCtlr->IsVideoCall() ) { iVideoPlaybackCtlr->iForegroundPause = EFalse; - iVideoPlaybackCtlr->iState->HandlePause(); } } else { iVideoPlaybackCtlr->iForegroundPause = EFalse; - iVideoPlaybackCtlr->iState->HandlePause(); } } @@ -224,11 +226,6 @@ { iVideoPlaybackCtlr->iForegroundPause = ETrue; } - else if ( ! iVideoPlaybackCtlr->iAccessoryMonitor->IsTvOutPlaybackAllowed() ) - { - MPX_TRAPD( err, - iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoTvOutPlaybackNotAllowed ) ); - } else { playAllowed = ETrue; @@ -279,22 +276,6 @@ return networkMode2g; } - -// ------------------------------------------------------------------------------------------------ -// CMPXVideoPlaybackMode::IsTvOutAllowedL() -// ------------------------------------------------------------------------------------------------ -TBool CMPXVideoPlaybackMode::IsTvOutAllowedL() -{ - MPX_DEBUG(_L("CMPXVideoPlaybackMode::IsTvOutAllowedL()")); - - TBool allowTvOut = - iVideoPlaybackCtlr->iDrmHelper->IsTvOutAllowedL( iVideoPlaybackCtlr->iFileHandle ); - - MPX_DEBUG(_L("CMPXVideoPlaybackMode::IsTvOutAllowedL(%d)"), allowTvOut); - - return allowTvOut; -} - //************************************************************************************************// // CMPXLocalPlaybackMode //************************************************************************************************// @@ -412,7 +393,7 @@ else { MPX_TRAPD( err, - playAllowed = !( iVideoPlaybackCtlr->IsVoiceCall() && IsNetworkMode2GL() ) ); + playAllowed = !( iVideoPlaybackCtlr->IsVoiceCall() && IsNetworkMode2GL() ) ); if ( !playAllowed ) { @@ -427,15 +408,6 @@ } // ------------------------------------------------------------------------------------------------ -// CMPXStreamingPlaybackMode::IsTvOutAllowedL() -// ------------------------------------------------------------------------------------------------ -TBool CMPXStreamingPlaybackMode::IsTvOutAllowedL() -{ - MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::IsTvOutAllowedL(1)")); - return ETrue; -} - -// ------------------------------------------------------------------------------------------------ // CMPXStreamingPlaybackMode::HandlePause() // ------------------------------------------------------------------------------------------------ void CMPXStreamingPlaybackMode::HandlePause() @@ -517,19 +489,10 @@ { MPX_DEBUG(_L("CMPXLiveStreamingPlaybackMode::HandleBackground()")); - if ( iVideoPlaybackCtlr->iAppInForeground ) - { - if ( iVideoPlaybackCtlr->IsPhoneCall() || - iVideoPlaybackCtlr->IsVideoCall() || - ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )) - { - iVideoPlaybackCtlr->iState->HandlePause(); - } - } - else - { - iVideoPlaybackCtlr->iState->HandlePause(); - } + // + // Pause in all cases to remove the different behavior based on the decoder + // + iVideoPlaybackCtlr->iState->HandlePause(); } //************************************************************************************************// diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/src/mpxvideoplaybackstate.cpp --- a/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -16,7 +16,7 @@ */ -// Version : %version: 39 % +// Version : %version: 41 % // @@ -24,6 +24,7 @@ // #include #include +#include #include "mpxvideoplaybackcontroller.h" #include "mpxvideoplaybackstate.h" @@ -54,7 +55,6 @@ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::ConstructL()")); iVideoPlaybackCtlr = aVideoPlaybackCtlr; - iVideoPlaybackCtlr->iPBPluginError = KErrNone; User::LeaveIfError( iFs.Connect() ); iFs.ShareProtected(); @@ -296,8 +296,15 @@ TUint attrG(0); // General attributes TUint attrV(0); // Video attributes - if (iVideoPlaybackCtlr->iPBPluginError != KErrNone) + if ( iVideoPlaybackCtlr->iPBPluginError != KErrNone ) { + if ( iVideoPlaybackCtlr->iClipName ) + { + aMedia->SetTextValueL( + TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ), + *( iVideoPlaybackCtlr->iClipName ) ); + } + aMedia->SetTObjectValueL( TMPXAttribute( KMPXMediaVideoError ), iVideoPlaybackCtlr->iPBPluginError ); @@ -485,16 +492,6 @@ } // - // TV-Out Playback Allowed - // - if ( attrV & KMPXMediaVideoTvOutPlayAllowed.iAttributeId ) - { - aMedia->SetTObjectValueL( - TMPXAttribute( KMPXMediaVideoTvOutPlayAllowed ), - iVideoPlaybackCtlr->iAccessoryMonitor->IsTvOutPlaybackAllowed() ); - } - - // // BitRate // if ( attrV & KMPXMediaVideoBitRate.iAttributeId ) @@ -578,9 +575,9 @@ TMPXAttribute( KMPXMediaVideoKeywords ), *( iVideoPlaybackCtlr->iFileDetails->iKeywords ) ); } - + // - // Creation date/time + // Creation date/time // if ( attrV & KMPXMediaVideoCreated.iAttributeId ) { @@ -590,7 +587,7 @@ } // - // Last Modified date/time + // Last Modified date/time // if ( attrV & KMPXMediaVideoLastModified.iAttributeId ) { @@ -752,7 +749,7 @@ MMPXPlaybackPluginObserver::TEvent aEvent, TBool aSendEvent ) { - MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::CMPXVideoPlaybackState::IssuePlayCommand()"), + MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::IssuePlayCommand()"), _L("aState = %d, aEvent = %d, aSendEvent = %d"), aState, aEvent, aSendEvent ); MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->PlayL() ); @@ -772,6 +769,21 @@ } } +// ------------------------------------------------------------------------------------------------ +// CMPXVideoPlaybackState::UpdateSeekableL() +// ------------------------------------------------------------------------------------------------ +void CMPXVideoPlaybackState::UpdateSeekableL( CMPXCommand& aCmd ) +{ + MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::UpdateSeekableL()")); + + iVideoPlaybackCtlr->iSeekable = aCmd.ValueTObjectL(KMPXMediaGeneralExtVideoSeekable); + + if ( iVideoPlaybackCtlr->iFileDetails ) + { + iVideoPlaybackCtlr->iFileDetails->iSeekable &= iVideoPlaybackCtlr->iSeekable; + } +} + // ************************************************************************************************* // // STATE SUB-CLASSES @@ -829,6 +841,16 @@ if ( iVideoPlaybackCtlr->iPBPluginError != KErrNone ) { + if ( iVideoPlaybackCtlr->iClipName ) + { + // + // Send the clip name and error code for further processing + // + aMedia->SetTextValueL( + TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ), + *( iVideoPlaybackCtlr->iClipName ) ); + } + aMedia->SetTObjectValueL( TMPXAttribute( KMPXMediaVideoError ), iVideoPlaybackCtlr->iPBPluginError ); @@ -902,6 +924,21 @@ MPX_TRAPD( err, SendErrorToViewL( iVideoPlaybackCtlr->iPBPluginError ) ); } +// ------------------------------------------------------------------------------------------------ +// CMPXNotInitialisedState::UpdateSeekableL() +// ------------------------------------------------------------------------------------------------ +void CMPXNotInitialisedState::UpdateSeekableL( CMPXCommand& /*aCmd*/ ) +{ + MPX_DEBUG(_L("CMPXNotInitialisedState::UpdateSeekableL()")); + + // + // Do not update the seekable state since the plugin is in the not initialized state + // An error probably occurred, plugin went to not initialized. If update was applied, + // it would not be cleared for the next clip since we are already in not initialized + // state. + // +} + // ************************************************************************************************* // // CMPXInitialisingState @@ -1024,25 +1061,7 @@ } else { - // - // Transistion back to EMPXVideoNotInitialized, for pre loaded plugin - // this state will alert the view that pre loading failed - // - iVideoPlaybackCtlr->ChangeState( EMPXVideoNotInitialized ); - - // Store the error, in case of pre loaded pluging this can - // later be sent to the view - iVideoPlaybackCtlr->iPBPluginError = aError; - - // - // move the FW state to Initialized irrespective of the playback state - // This enables the FW to send initailized event to view, which in turn - // queries for the error - // - iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, - 0, - KErrNone ); + iVideoPlaybackCtlr->HandleError( aError ); } } @@ -1090,23 +1109,7 @@ } else { - // - // Transistion back to EMPXVideoNotInitialized, for pre loaded plugin - // this state will alert the view that pre loading failed - // - iVideoPlaybackCtlr->ChangeState( EMPXVideoNotInitialized ); - - // Store the error, in case of pre loaded pluging this can - // later be sent to the view - iVideoPlaybackCtlr->iPBPluginError = aError; - - // - // move the FW state to Initialized irrespective of the playback state - // This enables the FW to send initailized event to view, which in turn - // queries for the error - // - iVideoPlaybackCtlr->iMPXPluginObs-> - HandlePluginEvent( MMPXPlaybackPluginObserver::EPInitialised, 0, KErrNone ); + iVideoPlaybackCtlr->HandleError( aError ); } } @@ -1745,22 +1748,22 @@ MPX_DEBUG(_L("CMPXBufferingState::HandleLoadingStarted()")); TInt loadingPercentage = RetrieveBufferingPercentage(); - + if ( loadingPercentage < 100 ) { MPX_TRAPD( err, { CMPXMessage* message = CMPXMessage::NewL(); CleanupStack::PushL( message ); - - message->SetTObjectValueL( KMPXMessageGeneralId, + + message->SetTObjectValueL( KMPXMessageGeneralId, KMPXMediaIdVideoPlayback ); - - message->SetTObjectValueL( KMPXMediaVideoPlaybackCommand, + + message->SetTObjectValueL( KMPXMediaVideoPlaybackCommand, EPbCmdLoadingStarted ); - + iVideoPlaybackCtlr->iMPXPluginObs->HandlePlaybackMessage( message, KErrNone ); - + CleanupStack::PopAndDestroy( message ); } ); } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/tsrc/ut_videohelixtest/conf/videohelixtest.cfg --- a/videoplayback/videohelix/tsrc/ut_videohelixtest/conf/videohelixtest.cfg Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/conf/videohelixtest.cfg Fri Apr 30 09:52:11 2010 +0300 @@ -1,5 +1,4 @@ [Define] -KMPXVideoTvOutPlaybackNotAllowedClose 4 KErrNone 0 KErrNotFound -1 KErrGeneral -2 @@ -41,7 +40,6 @@ EPbDlStateNotDownloading 0 EPbDlStateDownloading 2 -ETvOutPlaybackNotAllowed 0 ETvOutPlaybackAllowed 1 ENoEvent 0 @@ -646,10 +644,10 @@ [Endtest] [Test] -title 42. Tv-Out before Initialization - Unsupported DRM Playback Not Allowed +title 42. Tv-Out before Initialization - DRM Playback Allowed create videohelixtest test -test SetTvOutConnected ETvOutPlaybackNotAllowed -test Initialize 0 10 dcf.odf KErrNone KErrNone KMPXVideoTvOutPlaybackNotAllowedClose +test SetTvOutConnected ETvOutPlaybackAllowed +test Initialize 0 10 dcf.odf KErrNone KErrNone KErrNone waittestclass test pause 100 test GetMedia @@ -659,13 +657,11 @@ [Endtest] [Test] -title 43. Tv-Out after Initialization - Unsupported DRM Playback Not Allowed +title 43. Tv-Out after Initialization - DRM Playback Allowed create videohelixtest test test Initialize 0 10 dcf.odf KErrNone KErrNone KErrNone waittestclass test -test IssueGeneralCommand EPbCmdPlay KErrNone ECallbackBuffering -waittestclass test -test ConnectTvOut ETvOutPlaybackNotAllowed +test ConnectTvOut ETvOutPlaybackAllowed waittestclass test test DisconnectTvOut waittestclass test diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideodrmhelper_stub.cpp --- a/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideodrmhelper_stub.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideodrmhelper_stub.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 6 % +// Version : %version: 7 % #include "mpxvideodrmhelper.h" @@ -108,13 +108,6 @@ return drmError; } -TBool CMpxVideoDrmHelper::IsTvOutAllowedL( RFile& aFile ) -{ - TBool tvOutAllowed = ETrue; - - return tvOutAllowed; -} - #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API // ------------------------------------------------------------------------------------------------ @@ -180,17 +173,6 @@ return drmError; } -// ------------------------------------------------------------------------------------------------ -// CMpxVideoDrmHelper::IsTvOutAllowed64L() -// ------------------------------------------------------------------------------------------------ -// -TBool CMpxVideoDrmHelper::IsTvOutAllowed64L( RFile64& aFile ) -{ - TBool tvOutAllowed = ETrue; - - return tvOutAllowed; -} - #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API // EOF diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp --- a/videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 19 % +// Version : %version: 21 % // [INCLUDE FILES] - do not remove @@ -1418,7 +1418,7 @@ callback->iEvent = EPbCmdTvOutEvent; callback->iData = *aMsg->Value( KMPXMediaVideoTvOutConnected ); - callback->iError = *aMsg->Value( KMPXMediaVideoTvOutPlayAllowed ); + callback->iError = KErrNone; ProcessEvent( callback ); @@ -1964,19 +1964,6 @@ { iAccObserver->SetTvOutPlaybackAllowed( playable ); - if ( ! playable ) - { - TCallbackEvent* event = new TCallbackEvent; - - event->iEvent = EPPaused; - event->iData = 0; - event->iError = 0; - - AddExpectedEvent( event ); - - iExpectedError = KMPXVideoTvOutPlaybackNotAllowed; - } - // // Add event for callback // @@ -1984,7 +1971,7 @@ event->iEvent = EPbCmdTvOutEvent; event->iData = ETrue; - event->iError = playable; + event->iError = KErrNone; AddExpectedEvent( event ); } @@ -2007,10 +1994,10 @@ event->iEvent = EPbCmdTvOutEvent; event->iData = EFalse; - event->iError = ETrue; + event->iError = KErrNone; AddExpectedEvent( event ); - + iAccObserver->UpdateTvOutStatusL( EFalse ); return KErrNone; @@ -2373,7 +2360,6 @@ RFs fs; TInt error = fs.Connect(); - TInt fileError = KErrNone; // // Open a file handle to the clip @@ -2381,7 +2367,7 @@ if ( fileHandle32 ) { RFile file; - fileError = file.Open( fs, fullPath, EFileRead ); + file.Open( fs, fullPath, EFileRead ); iPlaybackPlugin->InitialiseWithPositionL( file, position ); file.Close(); } @@ -2389,7 +2375,7 @@ else { RFile64 file64; - fileError = file64.Open( fs, fullPath, EFileRead ); + file64.Open( fs, fullPath, EFileRead ); iPlaybackPlugin->Initialise64L( file64, position ); file64.Close(); } diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/bwins/videoplayerengineu.def --- a/videoplayerapp/bwins/videoplayerengineu.def Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/bwins/videoplayerengineu.def Fri Apr 30 09:52:11 2010 +0300 @@ -49,4 +49,5 @@ ?browsingEnded@VideoServices@@QAEXXZ @ 48 NONAME ; void VideoServices::browsingEnded(void) ?createPlayAndDetailsViews@QVideoPlayerEngine@@AAEXXZ @ 49 NONAME ; void QVideoPlayerEngine::createPlayAndDetailsViews(void) ?setCurrentView@QVideoPlayerEngine@@AAEXXZ @ 50 NONAME ; void QVideoPlayerEngine::setCurrentView(void) + ?sortRole@VideoServices@@QBEHXZ @ 51 NONAME ; int VideoServices::sortRole(void) const diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/eabi/videoplayerengineu.def --- a/videoplayerapp/eabi/videoplayerengineu.def Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/eabi/videoplayerengineu.def Fri Apr 30 09:52:11 2010 +0300 @@ -49,4 +49,5 @@ _ZNK13VideoServices17getBrowseCategoryEv @ 48 NONAME _ZN18QVideoPlayerEngine25createPlayAndDetailsViewsEv @ 49 NONAME _ZN18QVideoPlayerEngine14setCurrentViewEv @ 50 NONAME + _ZNK13VideoServices8sortRoleEv @ 51 NONAME diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/videoplayerengine/inc/videoservicebrowse.h --- a/videoplayerapp/videoplayerengine/inc/videoservicebrowse.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/videoplayerengine/inc/videoservicebrowse.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 3 % #ifndef VIDEOSERVICEBROWSE_H #define VIDEOSERVICEBROWSE_H @@ -60,6 +60,14 @@ */ QString contextTitle() const; + /** + * Return sort role. + * + * @param None. + * @return int. + */ + int sortRole() const; + public slots: /** @@ -67,9 +75,10 @@ * * @param title, Title of the embedded Videos application * @param category, Category which type of videos are browsed + * @param sort, Sort type. * @return None */ - void browseVideos( const QString &title, int category ); + void browseVideos(const QString &title, int category, int sortRole); private: /** request index of the service */ @@ -83,6 +92,9 @@ /** title of the service client, if not set "Videos" is used */ QString mTitle; + + /** sorting role */ + int mSortRole; }; #endif//VIDEOSERVICEBROWSE_H diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp --- a/videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 7 % +// Version : %version: ou1cpsw#8 % @@ -97,8 +97,11 @@ void CMpxVideoPlayerAppUiEngine::LateInitL() { CreatePlaybackUtilityL(); - - iRecognizer = CMediaRecognizer::NewL(); + + if ( ! iRecognizer ) + { + iRecognizer = CMediaRecognizer::NewL(); + } } // ------------------------------------------------------------------------------------------------- @@ -209,6 +212,8 @@ TFileName filename; aFile.FullName(filename); + + LateInitL(); CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( filename, aFile ); @@ -241,6 +246,8 @@ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL()"), _L("aFileName = %S"), &aFileName); + LateInitL(); + CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName); if ( mediaType == CMediaRecognizer::ELocalVideoFile ) @@ -299,7 +306,9 @@ CleanupStack::PushL( playList ); playList->SetSingleItemPlaylist(); playList->SetToFirst(); - + + LateInitL(); + iPlaybackUtility->InitL( *playList, ETrue ); CleanupStack::PopAndDestroy( playList ); @@ -479,12 +488,14 @@ //OpenMediaL( aMedia ); // Initialize and initiate playback of a single video + LateInitL(); + TPtrC mediaFile( aMedia.ValueText( KMPXMediaGeneralUri ) ); CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(mediaFile); if ( mediaType == CMediaRecognizer::ELocalRamFile || mediaType == CMediaRecognizer::ELocalAsxFile ) - { + { HandleMultiLinksFileL( mediaFile, mediaType ); } else diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/videoplayerengine/src/videoplayerengine.cpp --- a/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#25 % +// Version : %version: 27 % #include @@ -112,10 +112,10 @@ // // Get VideoServices instance // - if( mIsService && !mVideoServices ) + if ( mIsService && ! mVideoServices ) { - mVideoServices = VideoServices::instance(this); - connect( mVideoServices, SIGNAL(activated(int)), this, SLOT(handleCommand(int))); + mVideoServices = VideoServices::instance(this); + connect( mVideoServices, SIGNAL(activated(int)), this, SLOT(handleCommand(int))); } QList impls; @@ -130,7 +130,7 @@ // if app is opened via serviceFW create remaining views // otherwise activate default view i.e. the collection view. // - if( mIsService ) + if ( mIsService ) { createPlayAndDetailsViews(); } @@ -139,10 +139,6 @@ activateView( MpxHbVideoCommon::CollectionView ); } - // delayed initialization of some uiengine member variables - // to help application startup time & improve playback start time - // - mPlaybackWrapper->lateInit(); } // ------------------------------------------------------------------------------------------------- @@ -175,17 +171,17 @@ case MpxHbVideoCommon::ActivateVideoDetailsView: { if ( mCurrentViewPlugin != mFileDetailsViewPlugin ) - { - activateView( MpxHbVideoCommon::VideoDetailsView ); + { + activateView( MpxHbVideoCommon::VideoDetailsView ); } break; } case MpxHbVideoCommon::DoDelayedLoad: { - if ( !mDelayedLoadDone ) - { - doDelayedLoad(); - } + if ( ! mDelayedLoadDone ) + { + doDelayedLoad(); + } break; } @@ -206,7 +202,7 @@ createPlayAndDetailsViews(); - mDelayedLoadDone = true; + mDelayedLoadDone = true; } // ------------------------------------------------------------------------------------------------- @@ -217,6 +213,12 @@ { MPX_ENTER_EXIT(_L("QVideoPlayerEngine::createPlayAndDetailsViews()")); + // + // delayed initialization of some uiengine member variables + // to help application startup time & improve playback start time + // + mPlaybackWrapper->lateInit(); + if ( ! mPlaybackViewPlugin ) { loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); @@ -225,7 +227,7 @@ if ( ! mFileDetailsViewPlugin ) { loadPluginAndCreateView( MpxHbVideoCommon::VideoDetailsView ); - } + } } @@ -251,10 +253,26 @@ { if ( mIsService && ( mVideoServices->currentService() == VideoServices::EPlayback || - mVideoServices->currentService() == VideoServices::EView ) ) + mVideoServices->currentService() == VideoServices::EView || + mVideoServices->currentService() == VideoServices::EUriFetcher ) ) { - qApp->quit(); - XQServiceUtil::toBackground( false ); + if ( mVideoServices->currentService() == VideoServices::EUriFetcher ) + { + if ( ! mVideoServices->mFetchSelected ) + { + // + // view is in 'fetch' service but 'attach' operation has not been selected, + // therefore, go back to collection view + // + mCurrentViewPlugin = mCollectionViewPlugin; + setCurrentView(); + } + } + else + { + qApp->quit(); + XQServiceUtil::toBackground( false ); + } } else { @@ -264,9 +282,9 @@ } else if ( viewType == MpxHbVideoCommon::PlaybackView ) { - if( ! mPlaybackViewPlugin ) + if ( ! mPlaybackViewPlugin ) { - loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); + loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); } mCurrentViewPlugin = mPlaybackViewPlugin; @@ -274,9 +292,9 @@ } else if ( viewType == MpxHbVideoCommon::VideoDetailsView ) { - if( ! mFileDetailsViewPlugin ) + if ( ! mFileDetailsViewPlugin ) { - loadPluginAndCreateView( MpxHbVideoCommon::VideoDetailsView ); + loadPluginAndCreateView( MpxHbVideoCommon::VideoDetailsView ); } mCurrentViewPlugin = mFileDetailsViewPlugin; @@ -303,7 +321,7 @@ { viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllPlaybackUid; } - else if( viewType == MpxHbVideoCommon::VideoDetailsView ) + else if ( viewType == MpxHbVideoCommon::VideoDetailsView ) { viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllFileDetailsUid; } @@ -311,8 +329,8 @@ if ( viewTypeUid ) { // - // load corresponding plug-in - // + // load corresponding plug-in + // XQPluginLoader pluginLoader( viewTypeUid ); QObject* instance = pluginLoader.instance(); @@ -340,9 +358,9 @@ MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : plugin not FOUND ! ")); } - // - // create corresponding view - // + // + // create corresponding view + // if ( currentViewPlugin ) { QGraphicsWidget *view = currentViewPlugin->getView(); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/videoplayerengine/src/videoservicebrowse.cpp --- a/videoplayerapp/videoplayerengine/src/videoservicebrowse.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/videoplayerengine/src/videoservicebrowse.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 3 % #include @@ -32,6 +32,9 @@ : XQServiceProvider( QLatin1String("com.nokia.Videos.IVideoBrowse"), parent ) , mRequestIndex( 0 ) , mServiceApp( parent ) + , mCategory( 0 ) + , mTitle( "" ) + , mSortRole( 0 ) { MPX_ENTER_EXIT(_L("VideoServiceBrowse::VideoServiceBrowse()")); @@ -95,10 +98,22 @@ } // ------------------------------------------------------------------------------------------------- +// sortRole() +// ------------------------------------------------------------------------------------------------- +// +int VideoServiceBrowse::sortRole() const +{ + MPX_DEBUG(_L("VideoServiceBrowse::getBrowseCategory() ret %d"), mSortRole); + return mSortRole; +} + +// ------------------------------------------------------------------------------------------------- // browseVideos() // ------------------------------------------------------------------------------------------------- // -void VideoServiceBrowse::browseVideos(const QString &title, int category) +void VideoServiceBrowse::browseVideos(const QString &title, + int category, + int sortRole) { MPX_ENTER_EXIT(_L("VideoServiceBrowse::browseVideos()")); @@ -111,6 +126,7 @@ mTitle = appTitle; mCategory = category; + mSortRole = sortRole; // start service mServiceApp->setCurrentService(VideoServices::EBrowse); diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/videoplayerengine/src/videoservices.cpp --- a/videoplayerapp/videoplayerengine/src/videoservices.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/videoplayerengine/src/videoservices.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: 6 % #include "videoplayerengine.h" #include "videoservices.h" @@ -43,6 +43,7 @@ { mInstance->setEngine(engine); } + mInstance->mReferenceCount++; return mInstance; } @@ -95,7 +96,7 @@ { MPX_DEBUG(_L("VideoServices::engine")); - return mEngine; + return mEngine; } // ---------------------------------------------------------------------------- @@ -106,13 +107,14 @@ : mReferenceCount( 0 ) , mEngine( engine ) , mCurrentService( VideoServices::ENoService ) + , mFetchSelected( false ) { MPX_ENTER_EXIT(_L("VideoServices::VideoServices()")); mServiceUriFetch = new VideoServiceUriFetch(this); - mServicePlay = new VideoServicePlay(this, engine); - mServiceView = new VideoServiceView(this, engine); - mServiceBrowse = new VideoServiceBrowse(this); + mServicePlay = new VideoServicePlay(this, engine); + mServiceView = new VideoServiceView(this, engine); + mServiceBrowse = new VideoServiceBrowse(this); } // ---------------------------------------------------------------------------- @@ -123,10 +125,10 @@ { MPX_ENTER_EXIT(_L("VideoServices::~VideoServices()")); - delete mServiceUriFetch; - delete mServicePlay; - delete mServiceView; - delete mServiceBrowse; + delete mServiceUriFetch; + delete mServicePlay; + delete mServiceView; + delete mServiceBrowse; } // ---------------------------------------------------------------------------- @@ -137,7 +139,7 @@ { MPX_DEBUG(_L("VideoServices::currentService() ret %d"), mCurrentService ); - return mCurrentService; + return mCurrentService; } // ---------------------------------------------------------------------------- @@ -166,7 +168,7 @@ { MPX_DEBUG(_L("VideoServices::setCurrentService(%d)"), service ); - mCurrentService = service; + mCurrentService = service; } // ---------------------------------------------------------------------------- @@ -179,11 +181,11 @@ QString title; - if ( mCurrentService == VideoServices::EUriFetcher ) + if (mCurrentService == VideoServices::EUriFetcher && mServiceUriFetch) { title = mServiceUriFetch->contextTitle(); } - else if ( mCurrentService == VideoServices::EBrowse ) + else if (mCurrentService == VideoServices::EBrowse && mServiceBrowse) { title = mServiceBrowse->contextTitle(); } @@ -192,6 +194,24 @@ } // ---------------------------------------------------------------------------- +// sortRole() +// ---------------------------------------------------------------------------- +// +int VideoServices::sortRole() const +{ + MPX_ENTER_EXIT(_L("VideoServices::sortType()")); + + int sortRole = 0; + + if (mCurrentService == EBrowse && mServiceBrowse) + { + sortRole = mServiceBrowse->sortRole(); + } + + return sortRole; +} + +// ---------------------------------------------------------------------------- // itemSelected() // ---------------------------------------------------------------------------- // @@ -203,6 +223,7 @@ QStringList list; list.append( item ); mServiceUriFetch->complete( list ); + mFetchSelected = true; } // ---------------------------------------------------------------------------- diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoservices.h --- a/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoservices.h Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoservices.h Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: da1mmcf#4 % #ifndef __VIDEOSERVICES_H__ #define __VIDEOSERVICES_H__ @@ -118,6 +118,11 @@ */ static int mReferenceCount; + /* + * indicate fetch service and attach operation has been selected + */ + bool mFetchSelected; + }; #endif //__VIDEOSERVICES_H__ diff -r 8aed59de29f9 -r 4eb2df7f7cbe videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoservices.cpp --- a/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoservices.cpp Fri Apr 16 18:13:14 2010 +0300 +++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoservices.cpp Fri Apr 30 09:52:11 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: % +// Version : %version: da1mmcf#4 % #include "videoplayerengine.h" #include "videoservices.h" @@ -69,6 +69,7 @@ // VideoServices::VideoServices(QVideoPlayerEngine* engine) : mCurrentService(VideoServices::ENoService) + , mFetchSelected( false ) { MPX_ENTER_EXIT(_L("VideoServices::VideoServices()"));