# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276252703 -10800 # Node ID 6481344a6d676a0418689da45a490d63589403d6 # Parent 1ee2af37811f82dc9eea9f66667162be30bc238d Revision: 201021 Kit: 2010123 diff -r 1ee2af37811f -r 6481344a6d67 commonutilities/common/group/bld.inf --- a/commonutilities/common/group/bld.inf Thu May 27 12:51:42 2010 +0300 +++ b/commonutilities/common/group/bld.inf Fri Jun 11 13:38:23 2010 +0300 @@ -46,9 +46,8 @@ // for emulator ../cenrep/200009EE_orientation_portrait_landscape.txt /epoc32/release/winscw/udeb/z/private/10202be9/200009EE.txt //slideshow settings cenrep initialisation file - ../cenrep/20007194.txt /epoc32/data/z/private/10202be9/20007194.txt - ../cenrep/20007194.txt /epoc32/release/winscw/udeb/z/private/10202be9/20007194.txt - ../cenrep/20007194.txt /epoc32/release/winscw/urel/z/private/10202be9/20007194.txt + ../cenrep/20007194.txt z:/private/10202be9/20007194.txt + #endif @@ -58,6 +57,8 @@ ../../../conf/slideshowsettings.confml CONFML_EXPORT_PATH(slideshowsettings.confml,customsw) ../../../conf/slideshowsettings_20007194.crml CRML_EXPORT_PATH(slideshowsettings_20007194.crml,customsw) +../../../data/photos.docml z:/resource/hb/splashml/photos.docml +../../../data/photos.splashml z:/resource/hb/splashml/photos.splashml PRJ_MMPFILES glxcommon.mmp diff -r 1ee2af37811f -r 6481344a6d67 commonutilities/common/inc/glxtnmonitor.h --- a/commonutilities/common/inc/glxtnmonitor.h Thu May 27 12:51:42 2010 +0300 +++ b/commonutilities/common/inc/glxtnmonitor.h Fri Jun 11 13:38:23 2010 +0300 @@ -1,21 +1,20 @@ /* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* +* ============================================================================ +* Name : glxscreensavermonitor.h +* Part of : GLX / Collection Data Source Framework +* Description : +* Version :%version: 1 % +* Copyright © 2006-2007 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ============================================================================ */ - #ifndef PLUGINSCREENSAVERMONITORAO_H_ #define PLUGINSCREENSAVERMONITORAO_H_ diff -r 1ee2af37811f -r 6481344a6d67 commonutilities/common/src/glxtnmonitor.cpp --- a/commonutilities/common/src/glxtnmonitor.cpp Thu May 27 12:51:42 2010 +0300 +++ b/commonutilities/common/src/glxtnmonitor.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -1,21 +1,21 @@ /* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* ============================================================================ +* Name : glxscreensavermonitor.cpp +* Part of : GLX / Collection Data Source Framework +* Description : +* Version : %version: 1 % * -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* +* Copyright © 2006-2007 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ============================================================================ */ - #include "glxtnmonitor.h" #include diff -r 1ee2af37811f -r 6481344a6d67 data/photos.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/photos.docml Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + diff -r 1ee2af37811f -r 6481344a6d67 data/photos.splashml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/photos.splashml Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,8 @@ + + photos.docml + mainView + 0x20000A14 + photos + portrait + landscape + diff -r 1ee2af37811f -r 6481344a6d67 data/transitionrotate0.fxml --- a/data/transitionrotate0.fxml Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - 0.5 - 0 - 90 - - - 0.5 - 0.5 - 1 - - - diff -r 1ee2af37811f -r 6481344a6d67 data/transitionrotate180.fxml --- a/data/transitionrotate180.fxml Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - 0.5 - 180 - 270 - - - 0.5 - 0.5 - 1 - - - diff -r 1ee2af37811f -r 6481344a6d67 data/transitionrotate270.fxml --- a/data/transitionrotate270.fxml Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - 0.5 - -90 - 0 - - - 0.5 - 0.5 - 1 - - - diff -r 1ee2af37811f -r 6481344a6d67 data/transitionrotate90.fxml --- a/data/transitionrotate90.fxml Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - 0.5 - 90 - 180 - - - 0.5 - 0.5 - 1 - - - diff -r 1ee2af37811f -r 6481344a6d67 data/zoomin.fxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/zoomin.fxml Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,27 @@ + + + Created using carbide.fx 1.5.0; FxML revision 0.84; Platform 10.1 + + + + 0.6 + 1.0 + 0.1 + + 0.5 + 0.5 + + + 0.6 + 1.0 + 0.1 + + + + 0.6 + 1.0 + 0.0 + + + \ No newline at end of file diff -r 1ee2af37811f -r 6481344a6d67 data/zoomout.fxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/zoomout.fxml Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,27 @@ + + + Created using carbide.fx 1.5.0; FxML revision 0.84; Platform 10.1 + + + + 0.6 + 0.1 + 1.0 + + 0.5 + 0.5 + + + 0.6 + 0.1 + 1.0 + + + + 0.6 + 0.0 + 1.0 + + + \ No newline at end of file diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp --- a/engine/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -102,26 +102,40 @@ // ---------------------------------------------------------------------------- // EXPORT_C void CGlxCollectionPluginBase::OpenL(const CMPXCollectionPath& aPath, - const TArray& /*aAttrs*/, + const TArray& aAttrs, CMPXFilter* aFilter) { TRACER("void CGlxCollectionPluginBase::OpenL()"); iPath = CMPXCollectionPath::NewL(aPath); - if(aFilter) + // When a collection is opened for browsing, + // there are two queries executed with similar filter. + // First query to open the collection from list / cloud view. + // Second one from grid view construction. To improve the grid opening + // performance, the first query will be completed with empty Id list. + TBool openRequest = EFalse; + for (TInt index = 0; index < aAttrs.Count(); index++) { - if(aFilter->IsSupported(KGlxFilterGeneralNavigationalStateOnly)) + const TMPXAttribute attr = aAttrs[index]; + + if (attr == KGlxFilterGeneralNavigationalStateOnly) { - RArray mpxIds; - CleanupClosePushL(mpxIds); - iPath->AppendL(mpxIds.Array()); - iObs->HandleOpen(iPath, KErrNone); - CleanupStack::PopAndDestroy(&mpxIds); - delete iPath; - iPath = NULL; - return; + openRequest = ETrue; } } + if ((aFilter && aFilter->IsSupported( + KGlxFilterGeneralNavigationalStateOnly)) || openRequest) + { + RArray mpxIds; + CleanupClosePushL(mpxIds); + iPath->AppendL(mpxIds.Array()); + iObs->HandleOpen(iPath, KErrNone); + CleanupStack::PopAndDestroy(&mpxIds); + delete iPath; + iPath = NULL; + return; + } + TGlxMediaId targetId(aPath.Id()); if (aPath.Levels() == KGlxCollectionRootLevel) { @@ -218,7 +232,7 @@ if(aSpecs->IsSupported(KMPXMediaGeneralSize)) { - tnFileInfo->iFileSize = aSpecs->ValueTObjectL(KMPXMediaGeneralSize); + tnFileInfo->iFileSize = aSpecs->ValueTObjectL(KMPXMediaGeneralSize); countInfo++; } if(aSpecs->IsSupported(KGlxMediaGeneralLastModifiedDate)) diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/manager/src/glxdatasource.cpp --- a/engine/collectionframework/datasource/manager/src/glxdatasource.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/manager/src/glxdatasource.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Implementation of the Data Source Class. * */ diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/manager/src/glxdatasourcetask.cpp --- a/engine/collectionframework/datasource/manager/src/glxdatasourcetask.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/manager/src/glxdatasourcetask.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Data Source Task Class. * */ diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp Fri Jun 11 13:38:23 2010 +0300 @@ -94,4 +94,6 @@ LIBRARY platformenv.lib LIBRARY flogger.lib LIBRARY imageconversion.lib +LIBRARY harvesterclient.lib + // End of File diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h Fri Jun 11 13:38:23 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: The data source mds class * */ @@ -29,10 +29,18 @@ #define _C_GLXDATASOURCEMDS_H_ // INCLUDES +#include +#include +#include + #include #include #include + +#include +#include + #include #include @@ -44,16 +52,104 @@ #include "mthumbnailfetchrequestobserver.h" #endif - #include "glxdatasource.h" // FORWARD DECLARATIONS class CGlxRequest; - #ifndef USE_S60_TNM class CGlxtnThumbnailCreator; class CGlxtnThumbnailDatabase; #endif +class CGlxDataSourceMde ; + +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); + +/** + * PSCW Listener Observer interface for signaling that MDS has Shutdown/restarted + */ +class MGlxMDSShutdownObserver + { +public: + + virtual void ShutdownNotification(TInt aShutdownState) = 0; + }; + +/** + * Active object for observing P&S keys + * + * @since S60 v5.0 + */ +class CGlxMDSShutdownObserver: public CActive + { +public: + + /** + * Two-phased constructor. + * + * @since S60 v5.0 + * @return Instance of CGlxMDSShutdownObserver. + */ + static CGlxMDSShutdownObserver* NewL( MGlxMDSShutdownObserver& aObserver, const TUid& aKeyCategory, + const TInt aPropertyKey, TBool aDefineKey); + + /** + * Destructor + * + * @since S60 v5.0 + */ + virtual ~CGlxMDSShutdownObserver(); + +protected: + + /** + * Handles an active object's request completion event. + * + * @since S60 v5.0 + */ + void RunL(); + + /** + * Implements cancellation of an outstanding request. + * + * @since S60 v5.0 + */ + void DoCancel(); + +private: + + /** + * C++ default constructor + * + * @since S60 v5.0 + * @return Instance of CGlxMDSShutdownObserver. + */ + CGlxMDSShutdownObserver( MGlxMDSShutdownObserver& aObserver, const TUid& aKeyCategory, + const TInt iPropertyKey, TBool aDefineKey); + + /** + * Symbian 2nd phase constructor can leave. + * + * @since S60 v5.0 + */ + void ConstructL(); + +private: + + // not own + MGlxMDSShutdownObserver& iObserver; + + const TUid& iKeyCategory; + RProperty iProperty; + TInt iPropertyKey; + + TBool iDefineKey; +}; + + // CONSTANTS @@ -68,10 +164,12 @@ */ class CGlxDataSourceMde : public CGlxDataSource, public MMdESessionObserver, + public MGlxMDSShutdownObserver, public MMdEObjectObserver, public MMdEObjectPresentObserver, public MMdERelationObserver, - public MMdERelationPresentObserver + public MMdERelationPresentObserver, + public MHarvesterEventObserver #ifdef USE_S60_TNM , public MThumbnailManagerObserver #else @@ -90,11 +188,19 @@ public: // from CGlxDataSource - CGlxDataSourceTask* CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver); + CGlxDataSourceTask* CreateTaskL(CGlxRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver); +public: + // from MHarvesterEventObserver + void HarvestingUpdated( + HarvesterEventObserverType aHEObserverType, + HarvesterEventState aHarvesterEventState, + TInt aItemsLeft ); #ifdef USE_S60_TNM public: - void FetchThumbnailL(CGlxRequest* aRequest, MThumbnailFetchRequestObserver& aObserver); + void FetchThumbnailL(CGlxRequest* aRequest, + MThumbnailFetchRequestObserver& aObserver); TInt CancelFetchThumbnail(); #else private: @@ -161,13 +267,15 @@ #endif private: - void BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError); + void BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, + TInt aError); void DoSessionInitL(); void AddMdEObserversL(); - void ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, TBool aIsObject); + void ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, + TBool aIsObject); void ProcessItemUpdateL(); @@ -180,8 +288,19 @@ void TaskCompletedL(); void TaskStartedL(); + +#ifdef USE_S60_TNM + /* + * This function doesnt add up any value, added to reduce compiler warnings + */ + void ThumbnailReadyL( TInt aError, MThumbnailData& aThumbnail, + TThumbnailRequestId aId, TBool aQuality ); +#endif + +public: -public: + void CreateSession(); + inline CMdESession& Session() const; #ifndef USE_S60_TNM @@ -236,6 +355,9 @@ TBool SameMonth(const TTime& aOldDate, const TTime& aNewDate); TBool ContainerIsLeft(CMdEObjectDef& aObjectDef); + + // from MGlxMDSShutdownObserver + void ShutdownNotification(TInt aShutdownState); private: #ifdef USE_S60_TNM @@ -247,10 +369,7 @@ TBool iTnRequestInProgress; TInt iTnHandle; TGlxMediaId iMediaId; -#ifdef _DEBUG - TTime iStartTime; - TTime iStopTime; -#endif + #else CGlxtnThumbnailCreator* iThumbnailCreator; CGlxtnThumbnailDatabase* iThumbnailDatabase; @@ -279,6 +398,8 @@ RArray iMonthArray; RArray iMonthList; + RArray iAddedItems; + TTime iFirstMonth; TTime iLastMonth; @@ -296,6 +417,16 @@ RArray iUpdateData; TBool iPauseUpdate; TInt iDeletedCount; + + RHarvesterClient iHC; + TBool iHarvestingOngoing; + + CGlxMDSShutdownObserver* iMDSShutdownObserver; + +#ifdef _DEBUG + TTime iStartTime; + TTime iStopTime; +#endif }; #include "glxdatasourcemds.inl" diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl Fri Jun 11 13:38:23 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Inline methods for the data source MDS class * */ diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h Fri Jun 11 13:38:23 2010 +0300 @@ -67,7 +67,8 @@ * CGlxDataSourceTaskMde class * Base class for mde tasks: provides task generic functionality. */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMde) : public CGlxDataSourceTask, public MMdEQueryObserver +NONSHARABLE_CLASS(CGlxDataSourceTaskMde) : public CGlxDataSourceTask, + public MMdEQueryObserver { public: /** @@ -76,8 +77,8 @@ * @param aObserver observer to be informed when task has completed. * @param aDataSource data source to be used by this object. */ - CGlxDataSourceTaskMde(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, - CGlxDataSource* aDataSource); + CGlxDataSourceTaskMde(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& + aObserver, CGlxDataSource* aDataSource); /** * Destructor. @@ -142,7 +143,8 @@ */ CGlxDataSourceMde* DataSource(); - void AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties); + void AddMonthFilterL(const TGlxMediaId& aContainerId, + TGlxFilterProperties& aFilterProperties); void AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties); @@ -154,11 +156,14 @@ * EFalse if the container is on the right side of the relation * */ - void SetQueryConditionsL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties, const TGlxMediaId aContainerId, CMdEObjectDef& aObjectDef); + void SetQueryConditionsL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties, + const TGlxMediaId aContainerId, CMdEObjectDef& aObjectDef); - void SetQueryFilterConditionsL(CMdELogicCondition& aLogicCondition, CMdEObjectDef& aObjectDef, const TGlxFilterProperties& aFilterProperties); + void SetQueryFilterConditionsL(CMdELogicCondition& aLogicCondition, CMdEObjectDef& aObjectDef, + const TGlxFilterProperties& aFilterProperties); - void SetSortOrderL(CMdEQuery& aQuery, CMdEObjectDef& aObjectDef, const TGlxFilterProperties& aFilterProperties); + void SetSortOrderL(CMdEQuery& aQuery, CMdEObjectDef& aObjectDef, + const TGlxFilterProperties& aFilterProperties); /** * Returns the maximum number of items that a query should find. @@ -171,7 +176,8 @@ */ void RemoveQuery(); - void DoQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, const TGlxMediaId& aContainerId); + void DoQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, + TQueryResultMode aResultMode, const TGlxMediaId& aContainerId); /** * Adds queries for images and or videos to the query queue. The queries will return objects @@ -181,7 +187,8 @@ * image or video queries are required if iItemType is not set to EGlxFilterImage or * EGlxFitlerVideo a query for images will be queued first followed by a query for videos. */ - void QueueImageVideoObjectQueriesL(const RArray& aObjectIds, const TGlxFilterProperties& aFilterProperties); + void QueueImageVideoObjectQueriesL(const RArray& aObjectIds, + const TGlxFilterProperties& aFilterProperties); /** * Adds a query for tag objects that have ids specified by aObjectIds diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsattribute.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsattribute.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsattribute.h Fri Jun 11 13:38:23 2010 +0300 @@ -64,7 +64,8 @@ * @param aObserver observer to be informed when task has completed. * @param aDataSource data source to be used by this object. */ - CGlxDataSourceTaskMdeAttributeMde(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); + CGlxDataSourceTaskMdeAttributeMde(CGlxGetRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); /** * Destructor. @@ -94,9 +95,11 @@ void AddCollectionAttributesL(CMPXMedia* aEntry); - void AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType); + void AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, + CGlxDataSource::TContainerType aType); - void AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType); + void AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, + CGlxDataSource::TItemType aType); /** * Add location information to a media object from MDS. @@ -127,8 +130,10 @@ * of the object being queried is provided by the aObjectDef parameter * */ - void QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, - const TGlxMediaId& aContainerId, TMPXAttribute aAttribute, CMPXMedia* aEntry, + void QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, + TGlxQueryType aQueryType, TQueryResultMode aResultMode, + const TGlxMediaId& aContainerId, + TMPXAttribute aAttribute, CMPXMedia* aEntry, const TGlxFilterProperties& aFilterProperties); @@ -156,10 +161,11 @@ * Attributes associated with outstanding queries */ RArray< TGlxQueryAttribute > iQueryAttributes; + #ifdef _DEBUG - TTime iStartTime; - TTime iStopTime; -#endif + TTime iStartTime; + TTime iStopTime; +#endif }; diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h Fri Jun 11 13:38:23 2010 +0300 @@ -64,7 +64,8 @@ * @param aObserver observer to be informed when task has completed. * @param aDataSource data source to be used by this object. */ - CGlxDataSourceTaskMdeCommand(CGlxCommandRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, + CGlxDataSourceTaskMdeCommand(CGlxCommandRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); /** @@ -88,12 +89,14 @@ /** * See @ref MGlxCommandParserCallback::AddToContainerL */ - void AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers); + void AddToContainerL(const RArray& aSourceIds, + const RArray& aTargetContainers); /** * See @ref MGlxCommandParserCallback::AddToContainerL */ - void AddToContainerL(const TDesC& aSourceUri, const RArray& aTargetContainers); + void AddToContainerL(const TDesC& aSourceUri, + const RArray& aTargetContainers); /** * See @ref MGlxCommandParserCallback::CopyL @@ -108,7 +111,8 @@ /** * See @ref MGlxCommandParserCallback::RemoveFromContainerL */ - void RemoveFromContainerL(const RArray& aItemIds, const TGlxMediaId& aContainerId); + void RemoveFromContainerL(const RArray& aItemIds, + const TGlxMediaId& aContainerId); /** * See @ref MGlxCommandParserCallback::DeleteL @@ -123,12 +127,14 @@ /** * See @ref MGlxCommandParserCallback::SetDescriptionL */ - void SetDescriptionL(const RArray& aItemIds, const TDesC& aDescription); + void SetDescriptionL(const RArray& aItemIds, + const TDesC& aDescription); /** * See @ref MGlxCommandParserCallback::SetCaptureLocationL */ - void SetCaptureLocationL(const RArray& aItemIds, const TCoordinate& aCoordinate); + void SetCaptureLocationL(const RArray& aItemIds, + const TCoordinate& aCoordinate); /** * See @ref MGlxCommandParserCallback::ThumbnailCleanupL @@ -165,7 +171,8 @@ * @param aDrive destination drive. * @param aFileOperation file operation to perform (either a copy or a move) */ - void FileOperationL(const TArray& aSourceIds, const TDesC& aDrive, TFileOperation aFileOperation); + void FileOperationL(const TArray& aSourceIds, + const TDesC& aDrive, TFileOperation aFileOperation); /** * Gets the container id for a given media id. @@ -282,6 +289,18 @@ */ TInt SearchStringL(TInt aResourceId); + + /** + * Timer callback to stop scheduler wait + * @param aPtr Pointer to object that started the timer + * @return 0 to signal that further callbacks are unnecessary, 1 otherwise + */ + static TInt SchedulerStopCallback(TAny* aPtr); + + /** + * Starts the scheduler wait timer. When complete, Scheduler is stopped + */ + void SchedulerStopComplete(); private: /** @@ -325,6 +344,16 @@ * */ CGlxStringCache* iStringCache; + + /** + * Timer that checks if scheduler wait needs to be cancelled + */ + CPeriodic* iTimer; + + /** + * Active scheduler wait object. (Owned) + */ + CActiveSchedulerWait* iSchedulerWait; }; #endif //_C_GLXDATASOURCETASKMDSCOMMAND_H_ diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h Fri Jun 11 13:38:23 2010 +0300 @@ -47,7 +47,8 @@ * CGlxDataSourceTaskMdeIdList class * Task to handle id list requests. */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMdeIdList) : public CGlxDataSourceTaskMde, public MGlxtnThumbnailCreatorClient +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeIdList) : public CGlxDataSourceTaskMde, + public MGlxtnThumbnailCreatorClient { public: @@ -57,7 +58,8 @@ * @param aObserver observer to be informed when task has completed. * @param aDataSource data source to be used by this object. */ - CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); + CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); /** * Destructor. @@ -118,11 +120,17 @@ private: void DoHandleListQueryCompletedL(); - void DoMonthListCreationL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties); + void DoMonthListCreationL(CMdEQuery& aQuery, const TGlxFilterProperties& + aFilterProperties); void DoPostFilterComplete(const RArray& aIdArray, TInt aErrorCode); - void PostFilterL(const RArray& aFilteredList, const TGlxFilterProperties& aFilterProperties); + void PostFilterL(const RArray& aFilteredList, + const TGlxFilterProperties& aFilterProperties); +#ifdef _DEBUG + TTime iStartTime; + TTime iStopTime; +#endif }; #endif // GLXDATASOURCETASKMDSIDLIST_H_ diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h Fri Jun 11 13:38:23 2010 +0300 @@ -77,7 +77,7 @@ #ifdef USE_S60_TNM private: //MThumbnailFetchRequestObserver - void ThumbnailFetchComplete(TInt aError); + void ThumbnailFetchComplete(TInt aError, TBool aQuality); void FetchFileInfoL(); #endif diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/mthumbnailfetchrequestobserver.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/mthumbnailfetchrequestobserver.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/mthumbnailfetchrequestobserver.h Fri Jun 11 13:38:23 2010 +0300 @@ -28,7 +28,7 @@ class MThumbnailFetchRequestObserver { public: - virtual void ThumbnailFetchComplete(TInt aError) = 0; + virtual void ThumbnailFetchComplete(TInt aError, TBool aQuality) = 0; virtual void FetchFileInfoL() = 0; }; diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -20,6 +20,7 @@ // INCLUDE FILES #include "glxdatasourcemds.h" +#include #include #include #include @@ -48,14 +49,14 @@ #include "glxdatasourcetaskmdsidlist.h" #include "glxdatasourcetaskmdsthumbnail.h" -#ifndef USE_S60_TNM +#ifdef USE_S60_TNM +const TInt KMaxGridThumbnailWidth = 200; +#else const TInt KGlxThumbnailCleanupAfterDeletions = 200; _LIT(KGlxMdeDataSourceThumbnailDatabase, "glxmdstn"); #endif -const TInt KMaxGridThumbnailWidth = 200; - _LIT(KObjectDefLocation, "Location"); _LIT(KObjectDefNameAlbum, "Album"); _LIT(KObjectDefNameImage, "Image"); @@ -77,6 +78,8 @@ #undef __USING_INTELLIGENT_UPDATE_FILTERING +const TInt KHarvestUpdateChunkSize = 1000; + // --------------------------------------------------------------------------- // MPXChangeEventType // Helper method @@ -101,6 +104,110 @@ return type; } + +// --------------------------------------------------------------------------- +// CGlxMDSShutdownObserver::NewL() +// --------------------------------------------------------------------------- +// +CGlxMDSShutdownObserver* CGlxMDSShutdownObserver::NewL( MGlxMDSShutdownObserver& aObserver, + const TUid& aKeyCategory, + const TInt aPropertyKey, + TBool aDefineKey) + { + TRACER("CGlxMDSShutdownObserver* CGlxMDSShutdownObserver::NewL"); + CGlxMDSShutdownObserver* self = new( ELeave )CGlxMDSShutdownObserver( aObserver, + aKeyCategory, + aPropertyKey, + aDefineKey); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CGlxMDSShutdownObserver::CGlxMDSShutdownObserver() +// --------------------------------------------------------------------------- +// +CGlxMDSShutdownObserver::CGlxMDSShutdownObserver( MGlxMDSShutdownObserver& aObserver, + const TUid& aKeyCategory, + const TInt aPropertyKey, + TBool aDefineKey) + : CActive( CActive::EPriorityStandard ), iObserver( aObserver ), + iKeyCategory( aKeyCategory ), iPropertyKey(aPropertyKey), iDefineKey( aDefineKey ) + { + TRACER("CGlxMDSShutdownObserver::CGlxMDSShutdownObserver()"); + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CGlxMDSShutdownObserver::ConstructL() +// --------------------------------------------------------------------------- +// +void CGlxMDSShutdownObserver::ConstructL() + { + TRACER("void CGlxMDSShutdownObserver::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(); + } + +// --------------------------------------------------------------------------- +// CGlxMDSShutdownObserver::~CGlxMDSShutdownObserver() +// --------------------------------------------------------------------------- +// +CGlxMDSShutdownObserver::~CGlxMDSShutdownObserver() + { + TRACER("CGlxMDSShutdownObserver::~CGlxMDSShutdownObserver()"); + Cancel(); + iProperty.Close(); + } + +// --------------------------------------------------------------------------- +// CGlxMDSShutdownObserver::RunL() +// --------------------------------------------------------------------------- +// +void CGlxMDSShutdownObserver::RunL() + { + TRACER("void CGlxMDSShutdownObserver::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); + GLX_DEBUG2("CGlxMDSShutdownObserver::RunL(): iProperty.Get(value); returns %d", err); + + User::LeaveIfError(err); + + iObserver.ShutdownNotification(value); + } + +// --------------------------------------------------------------------------- +// CGlxMDSShutdownObserver::DoCancel() +// --------------------------------------------------------------------------- +// +void CGlxMDSShutdownObserver::DoCancel() + { + TRACER("void CGlxMDSShutdownObserver::DoCancel()"); + iProperty.Cancel(); + } + + + // ============================ MEMBER FUNCTIONS ============================== // --------------------------------------------------------------------------- @@ -143,14 +250,17 @@ } delete iThumbnailDatabase; #endif - iFs.Close(); + iHC.Close(); RFbsSession::Disconnect(); iMonthArray.Close(); iMonthList.Close(); iUpdateData.Close(); + iAddedItems.Reset(); + iAddedItems.Close(); delete iUpdateCallback; delete iCreateSessionCallback; + delete iMDSShutdownObserver ; } // --------------------------------------------------------------------------- @@ -159,7 +269,7 @@ // CGlxDataSourceMde::CGlxDataSourceMde() { - TRACER("CGlxDataSourceMde::CGlxDataSourceMde()") + TRACER("CGlxDataSourceMde::CGlxDataSourceMde()"); //No Implementation } @@ -169,7 +279,7 @@ // void CGlxDataSourceMde::ConstructL() { - TRACER("CGlxDataSourceMde::ConstructL()") + TRACER("CGlxDataSourceMde::ConstructL()"); iDataSourceReady = EFalse; User::LeaveIfError(iFs.Connect()); @@ -179,20 +289,27 @@ #ifdef USE_S60_TNM iTnEngine = CThumbnailManager::NewL( *this); - iTnEngine->SetFlagsL(CThumbnailManager::EAllowAnySize); - iTnEngine->SetDisplayModeL( EColor64K ); + iTnEngine->SetDisplayModeL( EColor16M ); iTnRequestInProgress = EFalse; #else iThumbnailCreator = CGlxtnThumbnailCreator::InstanceL(); iThumbnailDatabase = CGlxtnThumbnailDatabase::NewL( KGlxMdeDataSourceThumbnailDatabase, this); #endif - + iCreateSessionCallback = new ( ELeave ) CAsyncCallBack( TCallBack( CreateSession, this ), CActive::EPriorityHigh ); + + iMDSShutdownObserver = CGlxMDSShutdownObserver::NewL( *this, KHarvesterPSShutdown, KMdSShutdown, EFalse ); + iUpdateCallback = new ( ELeave ) CAsyncCallBack( TCallBack( ProcessItemUpdate, this ), CActive::EPriorityLow ); iUpdateData.Reserve(100); // ignore if it fails + + User::LeaveIfError(iHC.Connect()); + iHC.AddHarvesterEventObserver(*this, EHEObserverTypePlaceholder, KHarvestUpdateChunkSize); + + iHarvestingOngoing = EFalse; } // ---------------------------------------------------------------------------- @@ -202,20 +319,22 @@ // void CGlxDataSourceMde::HandleSessionOpened( CMdESession& aSession, TInt aError ) { - TRACER("CGlxDataSourceMde::HandleSessionOpened(CMdESession& aSession, TInt aError)") + TRACER("CGlxDataSourceMde::HandleSessionOpened(CMdESession& aSession, TInt aError)"); if( KErrNone != aError ) { HandleSessionError(aSession, aError); } TRAPD(err, DoSessionInitL()); - if( KErrNone != err ) + if (KErrNone == err) + { + iSessionOpen = ETrue; + iDataSourceReady = ETrue; + TryStartTask(ETrue); + } + else { HandleSessionError(aSession, err); } - - iSessionOpen = ETrue; - iDataSourceReady = ETrue; - TryStartTask(ETrue); } // ---------------------------------------------------------------------------- @@ -223,28 +342,37 @@ // CMPXCollectionMdEPlugin::HandleSessionError // ---------------------------------------------------------------------------- // -void CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/ ) +void CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt aError ) { - TRACER("CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/)") - delete iSession; - iSession = NULL; + TRACER("CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt aError)") + GLX_DEBUG2("void CGlxDataSourceMde::HandleSessionError() aError(%d)", aError); + iDataSourceReady = EFalse; iSessionOpen = EFalse; - iCreateSessionCallback->CallBack(); + + // We wait till MDS restarts before starting the session if the current session is locked. + // that is handled separately by the MDS Shutdown PUB SUB Framework. + // for everything else we use the generic method and continue. + if ( (KErrLocked != aError) && ( KErrServerTerminated != aError) ) + { + iCreateSessionCallback->CallBack(); + } } - // --------------------------------------------------------------------------- // CreateTaskL // --------------------------------------------------------------------------- // -CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver) +CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver) { - TRACER("CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver)") + TRACER("CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest,MGlxDataSourceRequestObserver& aObserver)") ; if(dynamic_cast(aRequest)) { CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeCommand* task = new (ELeave) CGlxDataSourceTaskMdeCommand(static_cast(aRequest), aObserver, this); + CGlxDataSourceTaskMdeCommand* task = new (ELeave) + CGlxDataSourceTaskMdeCommand(static_cast(aRequest), + aObserver, this); CleanupStack::Pop(aRequest); // now owned by task CleanupStack::PushL(task); task->ConstructL(); @@ -253,17 +381,10 @@ } else if (dynamic_cast< CGlxGetRequest *>(aRequest)) { - GLX_LOG_INFO("==> CGlxDataSourceMde::CreateTaskL - CGlxDataSourceTaskMdeAttributeMde+"); -#ifdef _DEBUG - _LIT( KFormatTimeStamp, "[%H:%T:%S.%*C5]"); - TTime time; - time.HomeTime(); // Get home time - TBuf<32> timeStampBuf; - time.FormatL(timeStampBuf, KFormatTimeStamp); - RDebug::Print(_L("%S"), &timeStampBuf); -#endif CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeAttributeMde* task = new (ELeave) CGlxDataSourceTaskMdeAttributeMde(static_cast(aRequest), aObserver, this); + CGlxDataSourceTaskMdeAttributeMde* task = new (ELeave) + CGlxDataSourceTaskMdeAttributeMde(static_cast(aRequest), + aObserver, this); CleanupStack::Pop(aRequest); // now owned by task CleanupStack::PushL(task); task->ConstructL(); @@ -273,7 +394,9 @@ else if (dynamic_cast< CGlxIdListRequest *>(aRequest)) { CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeIdList* task = new (ELeave) CGlxDataSourceTaskMdeIdList(static_cast(aRequest), aObserver, this); + CGlxDataSourceTaskMdeIdList* task = new (ELeave) + CGlxDataSourceTaskMdeIdList(static_cast(aRequest), + aObserver, this); CleanupStack::Pop(aRequest); // now owned by task CleanupStack::PushL(task); task->ConstructL(); @@ -282,17 +405,10 @@ } else if (dynamic_cast< CGlxThumbnailRequest *>(aRequest)) { - GLX_LOG_INFO("==> CGlxDataSourceMde::CreateTaskL - CGlxDataSourceTaskMdeThumbnail+"); -#ifdef _DEBUG - _LIT( KFormatTimeStamp, "[%H:%T:%S.%*C5]"); - TTime time; - time.HomeTime(); // Get home time - TBuf<32> timeStampBuf; - time.FormatL(timeStampBuf, KFormatTimeStamp); - RDebug::Print(_L("%S"), &timeStampBuf); -#endif CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeThumbnail* task = new (ELeave) CGlxDataSourceTaskMdeThumbnail(static_cast(aRequest), aObserver, this); + CGlxDataSourceTaskMdeThumbnail* task = new (ELeave) + CGlxDataSourceTaskMdeThumbnail(static_cast(aRequest), + aObserver, this); CleanupStack::Pop(aRequest); // now owned by task CleanupStack::PushL(task); task->ConstructL(); @@ -311,9 +427,10 @@ // ThumbnailAvailable // --------------------------------------------------------------------------- // -void CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& /*aId*/, const TSize& /*aSize*/) +void CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& + /*aId*/, const TSize& /*aSize*/) { - TRACER("CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& /*aId*/, const TSize& /*aSize*/)") + TRACER("CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& /*aId*/, const TSize& /*aSize*/)"); //No implementation } @@ -323,7 +440,7 @@ // void CGlxDataSourceMde::BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError) { - TRACER("CGlxDataSourceMde::BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError)") + TRACER("CGlxDataSourceMde::BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError)"); TSize size(0, 0); TRAP_IGNORE(BackgroundThumbnailMessageL(aId, size, aError)); } @@ -333,9 +450,10 @@ // BackgroundThumbnailMessageL // --------------------------------------------------------------------------- // -void CGlxDataSourceMde::BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError) +void CGlxDataSourceMde::BackgroundThumbnailMessageL(const TGlxMediaId& aId, + const TSize& aSize, TInt aError) { - TRACER("CGlxDataSourceMde::BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError)") + TRACER("CGlxDataSourceMde::BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError)"); CMPXMessage* message = CMPXMessage::NewL(); CleanupStack::PushL(message); message->SetTObjectValueL(KMPXMessageGeneralId, KGlxMessageIdBackgroundThumbnail); @@ -352,7 +470,7 @@ // void CGlxDataSourceMde::DoSessionInitL() { - TRACER("CGlxDataSourceMde::DoSessionInitL()") + TRACER("CGlxDataSourceMde::DoSessionInitL()"); /// @todo check schema version number iNameSpaceDef = &iSession->GetDefaultNamespaceDefL(); @@ -396,12 +514,23 @@ // void CGlxDataSourceMde::AddMdEObserversL() { - TRACER("CGlxDataSourceMde::AddMdEObserversL()") + TRACER("CGlxDataSourceMde::AddMdEObserversL()"); iSession->AddRelationObserverL(*this); iSession->AddRelationPresentObserverL(*this); - iSession->AddObjectObserverL(*this); - iSession->AddObjectPresentObserverL(*this); + //when setting observing conditions, + //add filters for all images, videos, Albums & Tags + CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorOr ); + addCondition->AddObjectConditionL( *iImageDef ); + addCondition->AddObjectConditionL( *iAlbumDef ); + addCondition->AddObjectConditionL( *iTagDef ); + + iSession->AddObjectObserverL(*this, addCondition ); + iSession->AddObjectPresentObserverL(*this ); + + // This addCondition should only be popped. + // As the ownership is transferred, the same will be destroyed by MdS. + CleanupStack::Pop( addCondition ); } // --------------------------------------------------------------------------- @@ -413,13 +542,47 @@ TObserverNotificationType aType, const RArray& aObjectIdArray) { - TRACER("CGlxDataSourceMde::HandleObjectNotification()") + TRACER("CGlxDataSourceMde::HandleObjectNotification()"); + GLX_LOG_INFO3("CGlxDataSourceMde::HandleObjectNotification() aType=%d, aObjectIdArray.Count()=%d, iHarvestingOngoing=%d", + aType, aObjectIdArray.Count(), + iHarvestingOngoing); + if (ENotifyAdd == aType) + { + for ( TInt i = 0; i < aObjectIdArray.Count(); i++ ) + { + iAddedItems.Append(aObjectIdArray[i]); + } + GLX_LOG_INFO1("ENotifyAdd - iAddedItems.Count()=%d", iAddedItems.Count()); + } + + if (ENotifyModify == aType) + { + for ( TInt i = 0; i < aObjectIdArray.Count(); i++ ) + { + if (iAddedItems.Find(aObjectIdArray[i]) != KErrNotFound) + { + if (!iHarvestingOngoing) + { + GLX_LOG_INFO("ENotifyModify - Harvesting Completed - " + "Reset iAddedItems array"); + iAddedItems.Reset(); + break; + } + GLX_LOG_INFO("ENotifyModify - Id found in iAddedItems array, DO NOT PROCESS"); + return; + } + } + } + + GLX_LOG_INFO("ProcessUpdateArray"); ProcessUpdateArray(aObjectIdArray, MPXChangeEventType(aType), ETrue); #ifndef USE_S60_TNM if(MPXChangeEventType(aType) == EMPXItemDeleted ) { TInt count = aObjectIdArray.Count(); iDeletedCount += count; + GLX_LOG_INFO2("EMPXItemDeleted - aObjectIdArray.Count()=%d, iDeletedCount=%d", + count, iDeletedCount); if(iDeletedCount > KGlxThumbnailCleanupAfterDeletions) { TRAPD(err, ThumbnailCreator().CleanupThumbnailsL(iThumbnailDatabase)); @@ -429,10 +592,15 @@ } } } + + if(MPXChangeEventType(aType) == EMPXItemModified ) + { + GLX_LOG_INFO("EMPXItemModified"); + TRAP_IGNORE(ThumbnailCreator().CleanupThumbnailsL(iThumbnailDatabase)); + } #endif } - // --------------------------------------------------------------------------- // CGlxDataSourceMde::HandleObjectPresentNotification // --------------------------------------------------------------------------- @@ -441,7 +609,7 @@ void CGlxDataSourceMde::HandleObjectPresentNotification(CMdESession& /*aSession*/, TBool aPresent, const RArray& aObjectIdArray) { - TRACER("CGlxDataSourceMde::HandleObjectPresentNotification()") + TRACER("CGlxDataSourceMde::HandleObjectPresentNotification()"); if (aPresent) { ProcessUpdateArray(aObjectIdArray, EMPXItemInserted, ETrue); @@ -461,7 +629,7 @@ TObserverNotificationType aType, const RArray& aRelationIdArray) { - TRACER("CGlxDataSourceMde::HandleRelationNotification()") + TRACER("CGlxDataSourceMde::HandleRelationNotification()"); ProcessUpdateArray(aRelationIdArray, MPXChangeEventType(aType), EFalse); } @@ -473,7 +641,7 @@ void CGlxDataSourceMde::HandleRelationPresentNotification(CMdESession& /*aSession*/, TBool aPresent, const RArray& aRelationIdArray) { - TRACER("CGlxDataSourceMde::HandleRelationPresentNotification()") + TRACER("CGlxDataSourceMde::HandleRelationPresentNotification()"); if (aPresent) { ProcessUpdateArray(aRelationIdArray, EMPXItemInserted, EFalse); @@ -488,9 +656,10 @@ // ProcessUpdateArray // --------------------------------------------------------------------------- // -void CGlxDataSourceMde::ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, TBool aIsObject) +void CGlxDataSourceMde::ProcessUpdateArray(const RArray& aArray, + TMPXChangeEventType aType, TBool aIsObject) { - TRACER("CGlxDataSourceMde::ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, TBool aIsObject)") + TRACER("CGlxDataSourceMde::ProcessUpdateArray(const RArray& aArray,TMPXChangeEventType aType, TBool aIsObject)"); // only need one message so process first item TUpdateData update; update.iId = aArray[0]; @@ -510,12 +679,22 @@ } // --------------------------------------------------------------------------- -// MPXChangeEventType +// CreateSession +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::CreateSession() + { + TRACER("CGlxDataSourceMde::CreateSession()") + TRAP_IGNORE(CreateSessionL()); + } + +// --------------------------------------------------------------------------- +// CreateSession // --------------------------------------------------------------------------- // TInt CGlxDataSourceMde::CreateSession(TAny* aPtr) { - TRACER("CGlxDataSourceMde::CreateSession(TAny* aPtr)") + TRACER("CGlxDataSourceMde::CreateSession(TAny* aPtr)"); CGlxDataSourceMde* self = reinterpret_cast( aPtr ); TRAP_IGNORE(self->CreateSessionL()); @@ -528,7 +707,9 @@ // void CGlxDataSourceMde::CreateSessionL() { - TRACER("CGlxDataSourceMde::CreateSessionL()") + TRACER("CGlxDataSourceMde::CreateSessionL()"); + delete iSession; + iSession = NULL; iSession = CMdESession::NewL( *this ); } @@ -539,7 +720,7 @@ // TInt CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr) { - TRACER("CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr)") + TRACER("CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr)"); CGlxDataSourceMde* self = reinterpret_cast( aPtr ); TRAP_IGNORE(self->ProcessItemUpdateL()); @@ -552,8 +733,7 @@ // void CGlxDataSourceMde::ProcessItemUpdateL() { - TRACER("CGlxDataSourceMde::ProcessItemUpdateL()") - //__ASSERT_DEBUG(iUpdateData.Count(), Panic(EGlxPanicIllegalState)); + TRACER("CGlxDataSourceMde::ProcessItemUpdateL()"); if ( !iUpdateData.Count() || iPauseUpdate ) { return; @@ -561,7 +741,8 @@ CMPXMessage* message = CMPXMessage::NewL(); CleanupStack::PushL(message); message->SetTObjectValueL(KMPXMessageGeneralId, KMPXMessageIdItemChanged); - message->SetTObjectValueL(KMPXMessageChangeEventType, iUpdateData[0].iType); + message->SetTObjectValueL(KMPXMessageChangeEventType, + iUpdateData[0].iType); TMPXGeneralCategory category = EMPXNoCategory; TMPXItemId id = iUpdateData[0].iId; @@ -589,7 +770,8 @@ __ASSERT_DEBUG(rightObject, Panic(EGlxPanicIllegalState)); TContainerType rightContainer = ContainerType(rightObject); delete rightObject; - __ASSERT_DEBUG(( EContainerTypeAlbum != rightContainer), Panic(EGlxPanicIllegalState)); + __ASSERT_DEBUG(( EContainerTypeAlbum != rightContainer), + Panic(EGlxPanicIllegalState)); if( EContainerTypeTag == rightContainer ) { id = leftId; @@ -607,8 +789,10 @@ containerId = leftId; containerCategory = EMPXAlbum; } - message->SetTObjectValueL(KGlxCollectionMessageContainerCategory, containerCategory); - message->SetTObjectValueL(KGlxCollectionMessageContainerId, containerId); + message->SetTObjectValueL(KGlxCollectionMessageContainerCategory, + containerCategory); + message->SetTObjectValueL(KGlxCollectionMessageContainerId, + containerId); } else { @@ -647,7 +831,8 @@ } } #endif // __USING_INTELLIGENT_UPDATE_FILTERING - message->SetTObjectValueL(KMPXMessageMediaGeneralCategory, category); + message->SetTObjectValueL(KMPXMessageMediaGeneralCategory, + category); message->SetTObjectValueL(KMPXMessageMediaGeneralId, id); BroadcastMessage(*message); CleanupStack::PopAndDestroy(message); @@ -660,7 +845,7 @@ // CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObject* aObject) { - TRACER("CGlxDataSourceMde::ContainerType(CMdEObject* aObject)") + TRACER("CGlxDataSourceMde::ContainerType(CMdEObject* aObject)"); TContainerType containerType = EContainerTypeNotAContainer; if( 0 == aObject->Def().Compare(*iAlbumDef) ) @@ -684,9 +869,10 @@ // ContainerType // --------------------------------------------------------------------------- // -CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObjectDef* aObjectDef) +CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObjectDef* + aObjectDef) { - TRACER("CGlxDataSourceMde::ContainerType(CMdEObjectDef* aObjectDef)") + TRACER("CGlxDataSourceMde::ContainerType()"); TContainerType containerType = EContainerTypeNotAContainer; if( 0 == aObjectDef->Compare(*iAlbumDef) ) @@ -711,7 +897,7 @@ // CGlxDataSource::TItemType CGlxDataSourceMde::ItemType(CMdEObject* aObject) { - TRACER("CGlxDataSourceMde::ItemType(CMdEObject* aObject)") + TRACER("CGlxDataSourceMde::ItemType(CMdEObject* aObject)"); TItemType itemType = EItemTypeNotAnItem; if( 0 == aObject->Def().Compare(*iImageDef) ) @@ -732,7 +918,7 @@ // void CGlxDataSourceMde::PrepareMonthsL() { - TRACER("CGlxDataSourceMde::PrepareMonthsL()") + TRACER("CGlxDataSourceMde::PrepareMonthsL()"); TTime month(0); iFirstMonth = month; } @@ -743,7 +929,7 @@ // const TGlxMediaId CGlxDataSourceMde::GetMonthIdL(const TTime& aMonth) { - TRACER("CGlxDataSourceMde::GetMonthIdL(const TTime& aMonth)") + TRACER("CGlxDataSourceMde::GetMonthIdL()"); TTime monthStart = iFirstMonth + aMonth.MonthsFrom(iFirstMonth); const TTimeIntervalMonths KGlxOneMonth = 1; const TTimeIntervalMicroSeconds KGlxOneMicrosecond = 1; @@ -775,7 +961,8 @@ month = iSession->NewObjectLC(*iMonthDef, title); // A title property def of type text is required. - CMdEPropertyDef& titlePropertyDef = iObjectDef->GetPropertyDefL(KPropertyDefNameTitle); + CMdEPropertyDef& titlePropertyDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameTitle); if (titlePropertyDef.PropertyType() != EPropertyText) { User::Leave(KErrCorrupt); @@ -784,7 +971,8 @@ month->AddTextPropertyL (titlePropertyDef, title); // A size property is required. - CMdEPropertyDef& sizePropertyDef = iObjectDef->GetPropertyDefL(KPropertyDefNameSize); + CMdEPropertyDef& sizePropertyDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameSize); if (sizePropertyDef.PropertyType() != EPropertyUint32) { User::Leave(KErrCorrupt); @@ -793,7 +981,8 @@ // A creation date property is required. - CMdEPropertyDef& creationDateDef = iObjectDef->GetPropertyDefL(KPropertyDefNameCreationDate); + CMdEPropertyDef& creationDateDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameCreationDate); if (creationDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); @@ -801,7 +990,8 @@ month->AddTimePropertyL(creationDateDef, monthStart); // A last modified date property is required. - CMdEPropertyDef& lmDateDef = iObjectDef->GetPropertyDefL(KPropertyDefNameLastModifiedDate); + CMdEPropertyDef& lmDateDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameLastModifiedDate); if (lmDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); @@ -865,8 +1055,14 @@ } #ifdef USE_S60_TNM -void CGlxDataSourceMde::FetchThumbnailL(CGlxRequest* aRequest, MThumbnailFetchRequestObserver& aObserver) +void CGlxDataSourceMde::FetchThumbnailL(CGlxRequest* aRequest, + MThumbnailFetchRequestObserver& aObserver) { + TRACER("CGlxDataSourceMde::FetchThumbnailL()"); +#ifdef _DEBUG + iStartTime.HomeTime(); // Get home time +#endif + iTnFetchObserver = &aObserver; CGlxThumbnailRequest* request = static_cast(aRequest); @@ -877,64 +1073,114 @@ iTnHandle = tnReq.iBitmapHandle; iMediaId = tnReq.iId; - if (tnReq.iSizeClass.iWidth < KMaxGridThumbnailWidth) - { - iTnEngine->SetFlagsL(CThumbnailManager::ECropToAspectRatio); + if (tnReq.iSizeClass.iWidth < KMaxGridThumbnailWidth) + { + iTnEngine->SetFlagsL(CThumbnailManager::ECropToAspectRatio); iTnEngine->SetThumbnailSizeL(EGridThumbnailSize); - GLX_LOG_INFO("CGlxDataSourceMde::FetchThumbnailL() - Fetch TN attrib - EGridThumbnailSize"); - } + GLX_LOG_INFO("CGlxDataSourceMde::FetchThumbnailL() - Fetch TN attrib -" + " EGridThumbnailSize"); + } else - { - iTnEngine->SetFlagsL(CThumbnailManager::EDefaultFlags); - iTnEngine->SetThumbnailSizeL(EFullScreenThumbnailSize); - GLX_LOG_INFO("CGlxDataSourceMde::FetchThumbnailL() - Fetch TN attrib - EFullScreenThumbnailSize"); - } - CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(request->ThumbnailInfo()->FilePath(), 0); -#ifdef _DEBUG - iStartTime.UniversalTime(); -#endif + { + iTnEngine->SetFlagsL(CThumbnailManager::EDefaultFlags); + iTnEngine->SetThumbnailSizeL(EFullScreenThumbnailSize); + GLX_LOG_INFO("CGlxDataSourceMde::FetchThumbnailL() - Fetch TN attrib - " + "EFullScreenThumbnailSize"); + } + + if (tnReq.iPriorityMode == TGlxThumbnailRequest::EPrioritizeQuality) + { + iTnEngine->SetQualityPreferenceL(CThumbnailManager::EOptimizeForQuality); + GLX_LOG_INFO("CGlxDataSourceMde::FetchThumbnailL() - Fetch TN attrib -" + " EOptimizeForQuality"); + } + else + { + iTnEngine->SetQualityPreferenceL(CThumbnailManager::EOptimizeForQualityWithPreview); + GLX_LOG_INFO("CGlxDataSourceMde::FetchThumbnailL() - Fetch TN attrib -" + " EOptimizeForQualityWithPreview"); + } + + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( + request->ThumbnailInfo()->FilePath(), 0); iTnThumbnailCbId = iTnEngine->GetThumbnailL(*source); + CleanupStack::PopAndDestroy(source); + iTnRequestInProgress = ETrue; - CleanupStack::PopAndDestroy(); } TInt CGlxDataSourceMde::CancelFetchThumbnail() { + TRACER("CGlxDataSourceMde::CancelFetchThumbnail"); TInt ret = KErrNone; if (iTnRequestInProgress) { ret = iTnEngine->CancelRequest(iTnThumbnailCbId); + iTnRequestInProgress = EFalse; + iTnFetchObserver->ThumbnailFetchComplete(KErrCancel,EFalse); } return ret; } -void CGlxDataSourceMde::ThumbnailPreviewReady(MThumbnailData& /*aThumbnail*/, - TThumbnailRequestId /*aId*/) +// Called when preview thumbnail is created +void CGlxDataSourceMde::ThumbnailPreviewReady(MThumbnailData& aThumbnail, + TThumbnailRequestId aId) { + TRACER("CGlxDataSourceMde::ThumbnailPreviewReady()"); + + TInt error = KErrNotSupported; + if ( aThumbnail.Bitmap() ) + { + GLX_DEBUG1("CGlxDataSourceMde::ThumbnailPreviewReady preview aval"); + error = KErrNone; + } + //This function is called number of times as a callback , + //hence not trapping the leaving function which costs time and memory. + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. + ThumbnailReadyL(error, aThumbnail, aId, EFalse); } // Called when real thumbnail is created void CGlxDataSourceMde::ThumbnailReady(TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId) { - if (iTnThumbnailCbId == aId) - { - iTnRequestInProgress = EFalse; + TRACER("CGlxDataSourceMde::ThumbnailReady"); + GLX_DEBUG2("GlxDataSourceMde::ThumbnailReady aError=%d", aError); + //This function is called number of times as a callback , + //hence not trapping the leaving function which costs time and memory. + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. + ThumbnailReadyL(aError,aThumbnail, aId, ETrue); + } + +// --------------------------------------------------------------------------- +// ThumbnailReadyL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::ThumbnailReadyL(TInt aError, + MThumbnailData& aThumbnail, TThumbnailRequestId aId, TBool aQuality) + { + TRACER("CGlxDataSourceMde::ThumbnailReadyL()"); + GLX_DEBUG3("CGlxDataSourceMde::ThumbnailReadyL aError=%d, aQuality=%d", + aError, aQuality); #ifdef _DEBUG - iStopTime.UniversalTime(); - GLX_LOG_INFO1("==> S60 TNMan fetch took <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); + iStopTime.HomeTime(); // Get home time + GLX_DEBUG2("=>CGlxDataSourceMde::ThumbnailReadyL - TN Fetch took <%d> us", + (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); #endif - if (aError == KErrNone && iTnHandle) - { - if (iTnHandle == KGlxMessageIdBackgroundThumbnail) - { - BackgroundThumbnailMessageL(iMediaId, TSize(), aError); - } - else - { + + if (iTnThumbnailCbId == aId) + { + if (aError == KErrNone && iTnHandle) + { + if (iTnHandle == KGlxMessageIdBackgroundThumbnail) + { + BackgroundThumbnailMessageL(iMediaId, TSize(), aError); + } + else + { delete iTnThumbnail; iTnThumbnail = NULL; - iTnThumbnail = aThumbnail.DetachBitmap(); + iTnThumbnail = aThumbnail.DetachBitmap(); delete iThumbnail; iThumbnail = NULL; @@ -948,15 +1194,75 @@ CleanupStack::PushL(context); context->BitBlt( TPoint(), iTnThumbnail); CleanupStack::PopAndDestroy(context); - CleanupStack::PopAndDestroy(device); - } - } + CleanupStack::PopAndDestroy(device); + } + } + } + + if (iTnFetchObserver && iTnRequestInProgress) + { + iTnFetchObserver->ThumbnailFetchComplete(aError, aQuality); + iTnHandle = KErrNone; + iTnRequestInProgress = EFalse; + } + } +#endif - if (iTnFetchObserver) - { - iTnFetchObserver->ThumbnailFetchComplete(aError); - iTnHandle = KErrNone; - } - } - } -#endif +// --------------------------------------------------------------------------- +// CGlxDataSourceMde +// HarvestingUpdated +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::HarvestingUpdated( + HarvesterEventObserverType /*aHEObserverType*/, + HarvesterEventState aHarvesterEventState, + TInt /*aItemsLeft*/) + { + TRACER("void CGlxDataSourceMde::HarvestingUpdated()"); + GLX_LOG_INFO1("CGlxDataSourceMde::HarvestingUpdated() aHarvesterEventState=%d", + aHarvesterEventState); + + switch(aHarvesterEventState) + { + case EHEStateStarted: + GLX_LOG_INFO("CGlxDataSourceMde::HarvestingUpdated() - EHEStateStarted"); + case EHEStateResumed: + case EHEStateHarvesting: + { + iHarvestingOngoing = ETrue; + } + break; + case EHEStatePaused: + case EHEStateFinished: + { + iHarvestingOngoing = EFalse; + GLX_LOG_INFO("CGlxDataSourceMde::HarvestingUpdated() - EHEStateFinished"); + } + break; + default: + break; + } + } + +// --------------------------------------------------------------------------- +// ShutdownNotification +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::ShutdownNotification(TInt aShutdownState) + { + TRACER("void CGlxDataSourceMde::ShutdownNotification(TInt aShutdownState)") + GLX_DEBUG2("CGlxDataSourceMde::ShutdownNotification(aShutdownState=%d)", + aShutdownState); + + if (!iDataSourceReady && 0 == aShutdownState) + { + GLX_DEBUG1("Photos MdS ShutdownNotification - MdS Server restarted!"); + CreateSession(); + } + + if (iDataSourceReady && 1 == aShutdownState) + { + GLX_DEBUG1("Photos MdS ShutdownNotification - MdS Server Shutdown!"); + HandleSessionError(*iSession, KErrServerTerminated); + } + } diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemdsproxy.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemdsproxy.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemdsproxy.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -22,7 +22,7 @@ * @internal reviewed 11/07/2007 by M Byrne */ -#include +#include #include "glxdatasourcemds.h" #include "glxdatasourcemds.hrh" diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -69,8 +69,6 @@ _LIT(KPropertyDefNameCreationDate, "CreationDate"); _LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); _LIT(KPropertyDefNameTitle, "Title"); -//Code commented cout below, so commenting the below line to remove BAD warning -//_LIT(KPropertyDefNameDRM, "DRM"); _LIT(KPropertyDefNameFrameCount, "FrameCount"); _LIT(KPropertyDefNameOrigin, "Origin"); @@ -82,7 +80,7 @@ MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) : CGlxDataSourceTask(aRequest, aObserver, aDataSource) { - TRACER("CGlxDataSourceTaskMde::CGlxDataSourceTaskMde()") + TRACER("CGlxDataSourceTaskMde::CGlxDataSourceTaskMde()"); // No implementation required } @@ -92,7 +90,7 @@ // CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde() { - TRACER("CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde()") + TRACER("CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde()"); DestroyQueries(); } @@ -102,7 +100,7 @@ // void CGlxDataSourceTaskMde::ConstructL() { - TRACER("CGlxDataSourceTaskMde::ConstructL()") + TRACER("CGlxDataSourceTaskMde::ConstructL()"); CreateResponseL(); #ifdef USE_S60_TNM DataSource()->CancelFetchThumbnail(); @@ -117,9 +115,9 @@ // void CGlxDataSourceTaskMde::CancelRequest() { - TRACER("CGlxDataSourceTaskMde::CancelRequest()") - DestroyQueries(); + TRACER("CGlxDataSourceTaskMde::CancelRequest()"); iCancelled = ETrue; + DestroyQueries(); } // ---------------------------------------------------------------------------- @@ -130,7 +128,7 @@ TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/ ) { - TRACER("CGlxDataSourceTaskMde::HandleQueryNewResults()") + TRACER("CGlxDataSourceTaskMde::HandleQueryNewResults()"); // Not used. } @@ -144,7 +142,7 @@ TInt /*aNewRelationItemCount*/, TInt /*aNewEventItemCount*/) { - TRACER("CGlxDataSourceTaskMde::HandleQueryNewResults()") + TRACER("CGlxDataSourceTaskMde::HandleQueryNewResults()"); // Not used. } @@ -155,7 +153,7 @@ // void CGlxDataSourceTaskMde::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) { - TRACER("CGlxDataSourceTaskMde::HandleQueryCompleted()") + TRACER("CGlxDataSourceTaskMde::HandleQueryCompleted()"); __ASSERT_ALWAYS(&aQuery == iQueries[0], Panic(EGlxPanicQueryLogicError)); TInt err = aError; @@ -164,7 +162,7 @@ TRAP(err, HandleQueryCompletedL(aQuery)); } - if (err != KErrNone) + if (err != KErrNone && !iCancelled) { HandleRequestComplete(err); } @@ -176,7 +174,7 @@ // CGlxDataSourceMde* CGlxDataSourceTaskMde::DataSource() { - TRACER("CGlxDataSourceTaskMde::DataSource()") + TRACER("CGlxDataSourceTaskMde::DataSource()"); return static_cast(iDataSource); } @@ -184,9 +182,10 @@ // CGlxDataSourceTaskMde::AddMonthFilterL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties) +void CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, + TGlxFilterProperties& aFilterProperties) { - TRACER("CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties)") + TRACER("CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties)"); CMdEObject* month = DataSource()->Session().GetObjectL(aContainerId.Value()); if( !month ) { @@ -204,16 +203,19 @@ // CGlxDataSourceTaskMde::AddMonthFilterL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMde::AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties) +void CGlxDataSourceTaskMde::AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& + aFilterProperties) { - TRACER("CGlxDataSourceTaskMde::AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties)") - CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); + TRACER("CGlxDataSourceTaskMde::AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties)"); + CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL( + KPropertyDefNameCreationDate); if (creationDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); } - CMdEPropertyDef& lmDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameLastModifiedDate); + CMdEPropertyDef& lmDateDef = DataSource()->ObjectDef().GetPropertyDefL( + KPropertyDefNameLastModifiedDate); if (lmDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); @@ -240,15 +242,21 @@ // CGlxDataSourceTaskMde::SetQueryConditionsL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMde::SetQueryConditionsL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties, const TGlxMediaId aContainerId, CMdEObjectDef& aObjectDef) +void CGlxDataSourceTaskMde::SetQueryConditionsL(CMdEQuery& aQuery, + const TGlxFilterProperties& aFilterProperties, const TGlxMediaId aContainerId, + CMdEObjectDef& aObjectDef) { - TRACER("CGlxDataSourceTaskMde::SetQueryConditionsL()") + TRACER("CGlxDataSourceTaskMde::SetQueryConditionsL()"); CMdELogicCondition& rootCondition = aQuery.Conditions(); CMdEObjectDef* objectDef = &aObjectDef; SetQueryFilterConditionsL(rootCondition, *objectDef, aFilterProperties); - SetSortOrderL(aQuery, aObjectDef, aFilterProperties); + + if (aQuery.ResultMode() != EQueryResultModeCount) + { + SetSortOrderL(aQuery, aObjectDef, aFilterProperties); + } if( KGlxCollectionRootId != aContainerId.Value() ) { @@ -257,12 +265,14 @@ objectDef = &DataSource()->ObjectDef(); if( DataSource()->ContainerIsLeft(aObjectDef) ) { - relationCondition = &rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); + relationCondition = &rootCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideRight); containerCondition = &relationCondition->LeftL(); } else { - relationCondition = &rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); + relationCondition = &rootCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideLeft); containerCondition = &relationCondition->RightL(); } containerCondition->AddObjectConditionL(aContainerId.Value()); @@ -278,7 +288,7 @@ aLogicCondition, CMdEObjectDef& aObjectDef, const TGlxFilterProperties& aFilterProperties) { - TRACER("CGlxDataSourceTaskMde::SetQueryFilterConditionsL()") + TRACER("CGlxDataSourceTaskMde::SetQueryFilterConditionsL()"); if( aFilterProperties.iUri ) { @@ -298,9 +308,12 @@ } } - if( ( aFilterProperties.iMinCount > 0 ) && ( CGlxDataSource::EContainerTypeNotAContainer != DataSource()->ContainerType(&aObjectDef) ) ) + if( ( aFilterProperties.iMinCount > 0 ) && ( + CGlxDataSource::EContainerTypeNotAContainer != DataSource()->ContainerType( + &aObjectDef) ) ) { - TMdEUintRange range(aFilterProperties.iMinCount,aFilterProperties.iMinCount,EMdERangeTypeGreaterOrEqual); + TMdEUintRange range(aFilterProperties.iMinCount, + aFilterProperties.iMinCount,EMdERangeTypeGreaterOrEqual); aLogicCondition.AddObjectConditionL(range); } @@ -310,12 +323,15 @@ if( DataSource()->ContainerIsLeft(aObjectDef) ) { CMdERelationCondition& relationCondition = - aLogicCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); - relationCondition.RightL().AddObjectConditionL(aFilterProperties.iContainsItem.Value()); + aLogicCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideLeft); + relationCondition.RightL().AddObjectConditionL( + aFilterProperties.iContainsItem.Value()); } else { - CMdERelationCondition& relationCondition = aLogicCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); + CMdERelationCondition& relationCondition = aLogicCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideRight); relationCondition.LeftL().AddObjectConditionL(aFilterProperties.iContainsItem.Value()); } } @@ -326,30 +342,39 @@ if( EGlxFilterOriginDownload == aFilterProperties.iOrigin ) { // The download collection shows all but captured items - aLogicCondition.AddPropertyConditionL(originProperty, TMdEUintNotEqual(MdeConstants::Object::ECamera)); + aLogicCondition.AddPropertyConditionL(originProperty, TMdEUintNotEqual( + MdeConstants::Object::ECamera)); } else if(EGlxFilterOriginCamera == aFilterProperties.iOrigin ) { // The camera collection Shows the captured Items - aLogicCondition.AddPropertyConditionL(originProperty, TMdEUintEqual(MdeConstants::Object::ECamera)); + aLogicCondition.AddPropertyConditionL(originProperty, TMdEUintEqual( + MdeConstants::Object::ECamera)); } + else if(EGlxFilterOriginAll == aFilterProperties.iOrigin ) + { + // The Months Collection Populates All the Items, filter + // it for Images and Videos only + CMdELogicCondition& logicCondition = + aLogicCondition.AddLogicConditionL(ELogicConditionOperatorOr); + logicCondition.AddObjectConditionL( DataSource()->ImageDef() ); + } } if( aFilterProperties.iExcludeAnimation ) { - //__ASSERT_DEBUG((EGlxFilterImage == aFilterProperties.iItemType), Panic(EGlxPanicIllegalArgument)); // Exclude any image with a frame count > 1 const TInt excludeAllImagesAboveOrEqualToThisFrameCount = 2; - CMdEPropertyDef& frameCountProperty = DataSource()->ImageDef().GetPropertyDefL(KPropertyDefNameFrameCount); - aLogicCondition.AddPropertyConditionL(frameCountProperty, TMdEIntLess(excludeAllImagesAboveOrEqualToThisFrameCount)); + CMdEPropertyDef& frameCountProperty = DataSource()->ImageDef().GetPropertyDefL( + KPropertyDefNameFrameCount); + aLogicCondition.AddPropertyConditionL(frameCountProperty, TMdEIntLess( + excludeAllImagesAboveOrEqualToThisFrameCount)); } if( aFilterProperties.iNoDRM ) { - __ASSERT_DEBUG((EGlxFilterImage == aFilterProperties.iItemType), Panic(EGlxPanicIllegalArgument)); - // Exclude any image which is DRM protected - //CMdEPropertyDef& drmProperty = DataSource()->ImageDef().GetPropertyDefL(KPropertyDefNameDRM); - //aLogicCondition.AddPropertyConditionL(drmProperty, EFalse); + __ASSERT_DEBUG((EGlxFilterImage == aFilterProperties.iItemType), Panic( + EGlxPanicIllegalArgument)); } if( aFilterProperties.iPath ) // If this is set. Then we need to filter on the Ids it supplies @@ -373,19 +398,22 @@ if( !aFilterProperties.iIncludeCameraAlbum ) { - CMdEObjectCondition& objectCondition = aLogicCondition.AddObjectConditionL(DataSource()->CameraAlbumId().Value()); + CMdEObjectCondition& objectCondition = aLogicCondition.AddObjectConditionL( + DataSource()->CameraAlbumId().Value()); objectCondition.SetNegate(ETrue); } if( TTime(0) != aFilterProperties.iStartDate ) { - CMdEPropertyDef& creationDateDef = aObjectDef.GetPropertyDefL(KPropertyDefNameCreationDate); + CMdEPropertyDef& creationDateDef = aObjectDef.GetPropertyDefL( + KPropertyDefNameCreationDate); if (creationDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); } - aLogicCondition.AddPropertyConditionL(creationDateDef, TMdETimeBetween(aFilterProperties.iStartDate, aFilterProperties.iEndDate)); + aLogicCondition.AddPropertyConditionL(creationDateDef, TMdETimeBetween( + aFilterProperties.iStartDate, aFilterProperties.iEndDate)); } } @@ -396,13 +424,14 @@ void CGlxDataSourceTaskMde::SetSortOrderL(CMdEQuery& aQuery, CMdEObjectDef& aObjectDef, const TGlxFilterProperties& aFilterProperties) { - TRACER("CGlxDataSourceTaskMde::SetSortOrderL()") + TRACER("CGlxDataSourceTaskMde::SetSortOrderL()"); switch(aFilterProperties.iSortOrder) { case EGlxFilterSortOrderAlphabetical: { CMdEPropertyDef& titleProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameTitle); - TMdEOrderRule orderRule(titleProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + TMdEOrderRule orderRule(titleProperty, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); orderRule.SetType(EOrderRuleTypeProperty); orderRule.SetCaseSensitive(EFalse); aQuery.AppendOrderRuleL(orderRule); @@ -410,27 +439,35 @@ } case EGlxFilterSortOrderItemCount: { - TMdEOrderRule orderRule(EOrderRuleTypeUsageCount, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + //Order rule is needed for tags popularity + TMdEOrderRule orderRule(EOrderRuleTypeUsageCount, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); aQuery.AppendOrderRuleL(orderRule); break; } case EGlxFilterSortOrderCaptureDate: { - CMdEPropertyDef& creationDateProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameCreationDate); - TMdEOrderRule orderRule(creationDateProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + CMdEPropertyDef& creationDateProperty = aObjectDef.GetPropertyDefL( + KPropertyDefNameCreationDate); + TMdEOrderRule orderRule(creationDateProperty, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); orderRule.SetType(EOrderRuleTypeProperty); aQuery.AppendOrderRuleL(orderRule); - TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); aQuery.AppendOrderRuleL(orderRule2); break; } case EGlxFilterSortOrderModifiedDate: { - CMdEPropertyDef& modifiedDateProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameLastModifiedDate); - TMdEOrderRule orderRule(modifiedDateProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + CMdEPropertyDef& modifiedDateProperty = aObjectDef.GetPropertyDefL( + KPropertyDefNameLastModifiedDate); + TMdEOrderRule orderRule(modifiedDateProperty, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); orderRule.SetType(EOrderRuleTypeProperty); aQuery.AppendOrderRuleL(orderRule); - TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); aQuery.AppendOrderRuleL(orderRule2); break; } @@ -445,14 +482,16 @@ // CGlxDataSourceTaskMde::MaxQueryResultsCount // ---------------------------------------------------------------------------- // -TInt CGlxDataSourceTaskMde::MaxQueryResultsCount(const TGlxFilterProperties& aFilterProperties) const +TInt CGlxDataSourceTaskMde::MaxQueryResultsCount(const TGlxFilterProperties& + aFilterProperties) const { - TRACER("CGlxDataSourceTaskMde::MaxQueryResultsCount()") + TRACER("CGlxDataSourceTaskMde::MaxQueryResultsCount()"); TInt ret = KMdEQueryDefaultMaxCount; - if (aFilterProperties.iLastCaptureDate) + if (aFilterProperties.iLastCaptureDate || aFilterProperties.iMaxCount == 1) { ret = 1; } + GLX_DEBUG2("CGlxDataSourceTaskMde::MaxQueryResultsCount ret=%d", ret); return ret; } @@ -462,7 +501,7 @@ // void CGlxDataSourceTaskMde::RemoveQuery() { - TRACER("CGlxDataSourceTaskMde::RemoveQuery()") + TRACER("CGlxDataSourceTaskMde::RemoveQuery()"); CMdEQuery* query = iQueries[0]; iQueryTypes.Remove(0); iQueries.Remove(0); @@ -478,7 +517,7 @@ TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, const TGlxMediaId& aContainerId) { - TRACER("CGlxDataSourceTaskMde::DoQueryL()") + TRACER("CGlxDataSourceTaskMde::DoQueryL()"); CMdEObjectDef* queryBaseObject = &aObjectDef; if( aIsContent ) @@ -503,11 +542,12 @@ } } - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *queryBaseObject, this); + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), + *queryBaseObject, this); CleanupStack::PushL(query); + query->SetResultMode(aResultMode); SetQueryConditionsL(*query, iFilterProperties, aContainerId, aObjectDef); - query->SetResultMode(aResultMode); CleanupStack::Pop(query); @@ -523,7 +563,7 @@ void CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL(const RArray& aObjectIds, const TGlxFilterProperties& aFilterProperties) { - TRACER("CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL()") + TRACER("CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL()"); if (aFilterProperties.iItemType == EGlxFilterImage) { // Only perform the image query @@ -548,7 +588,7 @@ // void CGlxDataSourceTaskMde::QueueTagObjectQueryL(const RArray& aObjectIds) { - TRACER("CGlxDataSourceTaskMde::QueueTagObjectQueryL()") + TRACER("CGlxDataSourceTaskMde::QueueTagObjectQueryL()"); QueueObjectQueryL(DataSource()->TagDef(), aObjectIds, EImageVideoQuery); } @@ -558,14 +598,14 @@ // void CGlxDataSourceTaskMde::QueueAlbumObjectQueryL(const RArray& aObjectIds) { - TRACER("CGlxDataSourceTaskMde::QueueAlbumObjectQueryL()") + TRACER("CGlxDataSourceTaskMde::QueueAlbumObjectQueryL()"); QueueObjectQueryL(DataSource()->AlbumDef(), aObjectIds, EImageVideoQuery); } void CGlxDataSourceTaskMde::QueueMonthObjectQueryL(const RArray& aObjectIds) { - TRACER("CGlxDataSourceTaskMde::QueueMonthObjectQueryL()") + TRACER("CGlxDataSourceTaskMde::QueueMonthObjectQueryL()"); QueueObjectQueryL(DataSource()->MonthDef(), aObjectIds, EImageVideoQuery); } @@ -576,14 +616,15 @@ void CGlxDataSourceTaskMde::QueueObjectQueryL(CMdEObjectDef& aObjectDef, const RArray& aObjectIds, const TGlxQueryType& aQueryType) { - TRACER("CGlxDataSourceTaskMde::QueueObjectQueryL()") - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), aObjectDef, this); + TRACER("CGlxDataSourceTaskMde::QueueObjectQueryL()"); + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), + aObjectDef, this); CleanupStack::PushL(query); CMdELogicCondition& lc = query->Conditions(); NGlxDataSourceMdsUtility::AddObjectConditionL(lc,aObjectIds); - query->SetResultMode(EQueryResultModeObjectWithFreetexts); + query->SetResultMode(EQueryResultModeItem); CleanupStack::Pop(query); AppendQueryL(query, aQueryType); @@ -596,7 +637,7 @@ // void CGlxDataSourceTaskMde::AppendQueryL(CMdEQuery* aQuery, const TGlxQueryType& aQueryType) { - TRACER("CGlxDataSourceTaskMde::AppendQueryL()") + TRACER("CGlxDataSourceTaskMde::AppendQueryL()"); CleanupStack::PushL(aQuery); TInt err = iQueryTypes.Append(aQueryType); @@ -618,7 +659,7 @@ // void CGlxDataSourceTaskMde::ExecuteQueryL() { - TRACER("CGlxDataSourceTaskMde::ExecuteQueryL()") + TRACER("CGlxDataSourceTaskMde::ExecuteQueryL()"); __ASSERT_DEBUG(iQueries.Count(), Panic(EGlxPanicQueryLogicError)); iQueries[0]->FindL(); } @@ -629,9 +670,22 @@ // void CGlxDataSourceTaskMde::HandleQueryCompletedL(CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMde::HandleQueryCompletedL()") + TRACER("CGlxDataSourceTaskMde::HandleQueryCompletedL()"); DoHandleQueryCompletedL(aQuery); - RemoveQuery(); + + // Both the function calls should be executed if any + // request is not cancelled before completion. + // All the pending Queries are already destroyed in CancelRequest. + // Hence we do not have to call RemoveQuery here. That will lead to + // User 130 crash. + // DoNextQuery tries to get iQueries.Count(). Since iQueries is destroyed + // in CancelRequest + if (iCancelled) + { + GLX_LOG_INFO("***Query already Removed. Hence Return***"); + return; + } + RemoveQuery(); DoNextQueryL(); } @@ -641,7 +695,7 @@ // void CGlxDataSourceTaskMde::DestroyQueries() { - TRACER("CGlxDataSourceTaskMde::DestroyQueries()") + TRACER("CGlxDataSourceTaskMde::DestroyQueries()"); for (TInt i = 0; i < iQueries.Count(); i++) { // Ensure that there are not any running queries diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -57,7 +57,7 @@ #include #include #include - +#include #include "glxdatasourcemds.h" #include "glxdatasourcemds.hrh" #include "glxdatasourcemdsutility.h" @@ -83,7 +83,9 @@ // Constructor // ---------------------------------------------------------------------------- // -CGlxDataSourceTaskMdeAttributeMde::CGlxDataSourceTaskMdeAttributeMde(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) +CGlxDataSourceTaskMdeAttributeMde::CGlxDataSourceTaskMdeAttributeMde( + CGlxGetRequest* aRequest,MGlxDataSourceRequestObserver& aObserver, + CGlxDataSource* aDataSource) : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) { TRACER("CGlxDataSourceTaskMdeAttribute::CGlxDataSourceTaskMdeAttribute()") @@ -108,16 +110,14 @@ void CGlxDataSourceTaskMdeAttributeMde::ExecuteRequestL() { TRACER("CGlxDataSourceTaskMdeAttribute::ExecuteRequestL()") - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeAttribute::ExecuteRequestL"); +#ifdef _DEBUG + iStartTime.HomeTime(); +#endif CGlxGetRequest* request = static_cast(iRequest); __ASSERT_DEBUG(request->MediaIds().Count() > 0, User::Invariant()); - - GLX_LOG_INFO("==> CGlxDataSourceTaskMdeAttributeMde::ExecuteRequestL"); -#ifdef _DEBUG - iStartTime.HomeTime(); // Get home time -#endif + if (request->MediaIds().Count() > 1) { iMediaArray = CMPXMediaArray::NewL(); @@ -130,26 +130,8 @@ } else { - - /* __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - - QueueImageVideoObjectQueriesL(request->MediaIds(), iFilterProperties); - QueueAlbumObjectQueryL(request->MediaIds()); - QueueTagObjectQueryL(request->MediaIds()); - QueueMonthObjectQueryL(request->MediaIds()); - - if (LocationAttributeRequested()) - { - QueueLocaitonQueryL(); - } - - */ - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); CGlxGetRequest* request = static_cast(iRequest); -// Not used anywhere, commenting out this line to avoid BAD warning -// const RArray& mediaIds = reinterpret_cast&>(request->MediaIds()); switch(iFilterProperties.iItemType) { @@ -211,6 +193,11 @@ Panic(EGlxPanicLogicError); break; } +#ifdef _DEBUG + iStopTime.HomeTime(); + GLX_DEBUG2("CGlxDataSourceTaskMdeAttributeMde:DoHandleQueryCompletedL() took %d us", + (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); +#endif } // ---------------------------------------------------------------------------- @@ -292,7 +279,8 @@ { if ( request->Attributes()[i] == KMPXMediaGeneralId ) { - aEntry->SetTObjectValueL(KMPXMediaGeneralId, (TMPXItemId)request->CollectionPluginUid().iUid); + aEntry->SetTObjectValueL(KMPXMediaGeneralId, ( + TMPXItemId)request->CollectionPluginUid().iUid); } else if ( request->Attributes()[i] == KMPXMediaGeneralType ) { @@ -323,12 +311,14 @@ { case KGlxCollectionPluginCameraImplementationUid: { -#if 0 /// @todo AB camera album +#if 0 /// AB camera album container = DataSource()->CameraAlbumId(); objectDef = &DataSource()->AlbumDef(); #endif filterProperties.iItemType = EGlxFilterImage; - QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); + QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, + EQueryResultModeCount, container, + request->Attributes()[i], aEntry, filterProperties); break; } default: @@ -350,12 +340,14 @@ { case KGlxCollectionPluginCameraImplementationUid: { -#if 0 /// @todo AB camera album +#if 0 /// AB camera album container = DataSource()->CameraAlbumId(); objectDef = &DataSource()->AlbumDef(); #endif filterProperties.iItemType = EGlxFilterVideo; - QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); + QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, + EQueryResultModeCount, container, + request->Attributes()[i],aEntry, filterProperties); break; } default: @@ -366,7 +358,8 @@ } - else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) + else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || + ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) { TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); @@ -395,39 +388,51 @@ } case KGlxCollectionPluginMonthsImplementationUid: { - filterProperties.iOrigin = EGlxFilterOriginCamera; + filterProperties.iOrigin = EGlxFilterOriginAll; break; } - /* case KGlxCollectionPluginDownloadsImplementationUid: - { - filterProperties.iOrigin = EGlxFilterOriginDownload; - break; - }*/ default: { // default gallery query returns all objects as per filter break; } } - QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); + QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, + EQueryResultModeCount, container, request->Attributes()[i], + aEntry, filterProperties); } else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) { - aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, + KGlxDataSourceMdeImplementationUid); } else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) { + GLX_DEBUG1("CGlxDataSourceTaskMdeAttributeMde::AddCollectionAttributesL - KGlxMediaCollectionInternalStartDate"); TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); TGlxFilterProperties filterProperties = iFilterProperties; filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; - filterProperties.iOrigin = EGlxFilterOriginCamera; + filterProperties.iOrigin = EGlxFilterOriginAll; + filterProperties.iMaxCount = 1 ; - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeObjectWithFreetexts,container, KGlxMediaCollectionInternalStartDate, aEntry, filterProperties); + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeItem, container, + KGlxMediaCollectionInternalStartDate, aEntry, filterProperties); } else if ( request->Attributes()[i] == KGlxMediaCollectionInternalEndDate ) { - // not necessary to be requested, returned when StartDate requested + GLX_DEBUG1("CGlxDataSourceTaskMdeAttributeMde::AddCollectionAttributesL - KGlxMediaCollectionInternalEndDate"); + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + TGlxFilterProperties filterProperties = iFilterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + filterProperties.iOrigin = EGlxFilterOriginAll; + filterProperties.iMaxCount = 1 ; + + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeItem, container, + KGlxMediaCollectionInternalEndDate, aEntry, filterProperties); } else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) { @@ -456,7 +461,8 @@ // CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeAttributeMde::AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType) +void CGlxDataSourceTaskMdeAttributeMde::AddContainerAttributesL(CMPXMedia* aEntry, + CMdEObject* aContainer, CGlxDataSource::TContainerType aType) { TRACER("CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL()") __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); @@ -464,12 +470,13 @@ __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); CGlxGetRequest* request = static_cast(iRequest); - /// @todo check property defs are valid and type is correct + /// check property defs are valid and type is correct for ( TInt i = 0; i < request->Attributes().Count(); i++ ) { if ( request->Attributes()[i] == KMPXMediaGeneralId ) { - aEntry->SetTObjectValueL(KMPXMediaGeneralId, (TMPXItemId)aContainer->Id()); + aEntry->SetTObjectValueL(KMPXMediaGeneralId, + (TMPXItemId)aContainer->Id()); } else if ( request->Attributes()[i] == KMPXMediaGeneralType ) { @@ -501,7 +508,8 @@ else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) { CMdEProperty* title; - CMdEPropertyDef& titleProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameTitle); + CMdEPropertyDef& titleProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameTitle); TInt titleIndex = aContainer->Property(titleProperty, title); if(titleIndex == KErrNotFound) { @@ -510,22 +518,26 @@ } else { - aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast(title)->Value()); + aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast + (title)->Value()); } switch (aType) { case CGlxDataSource::EContainerTypeAlbum: { CMdEProperty* albumType; - CMdEPropertyDef& albumTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameAlbumType); + CMdEPropertyDef& albumTypeProperty = + aContainer->Def().GetPropertyDefL( KPropertyDefNameAlbumType); TInt albumTypeIndex = aContainer->Property(albumTypeProperty, albumType); if( KErrNotFound != albumTypeIndex ) { - TUint16 albumTypeValue = static_cast(albumType)->Value(); + TUint16 albumTypeValue = + static_cast(albumType)->Value(); if ( albumTypeValue != MdeConstants::Album::EAlbumUser ) { request->AppendCpiAttributeL(KMPXMediaGeneralTitle); - aEntry->SetTObjectValueL(KGlxMediaCollectionInternalSystemItemType, albumTypeValue); + aEntry->SetTObjectValueL(KGlxMediaCollectionInternalSystemItemType, + albumTypeValue); } } break; @@ -538,14 +550,16 @@ { request->AppendCpiAttributeL(KMPXMediaGeneralTitle); CMdEProperty* time; - CMdEPropertyDef& timeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameCreationDate); + CMdEPropertyDef& timeProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameCreationDate); TInt timeIndex = aContainer->Property(timeProperty, time); if( KErrNotFound == timeIndex ) { User::Leave(KErrCorrupt); } - aEntry->SetTObjectValueL(KGlxMediaCollectionInternalStartDate, static_cast(time)->Value()); + aEntry->SetTObjectValueL(KGlxMediaCollectionInternalStartDate, + static_cast(time)->Value()); break; } } @@ -553,21 +567,24 @@ else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) { CMdEProperty* time; - CMdEPropertyDef& timeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameCreationDate); + CMdEPropertyDef& timeProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameCreationDate); TInt timeIndex = aContainer->Property(timeProperty, time); if( KErrNotFound == timeIndex ) { User::Leave(KErrCorrupt); } - aEntry->SetTObjectValueL(KMPXMediaGeneralDate, static_cast(time)->Value()); + aEntry->SetTObjectValueL(KMPXMediaGeneralDate, + static_cast(time)->Value()); } else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) { CMdEProperty* size; - CMdEPropertyDef& sizeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameSize); + CMdEPropertyDef& sizeProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameSize); TInt sizeIndex = aContainer->Property(sizeProperty, size); - TInt sizeValue; + TUint sizeValue; if(sizeIndex == KErrNotFound) { sizeValue = 0; @@ -586,7 +603,8 @@ else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) { CMdEProperty* mimeType; - CMdEPropertyDef& mimeTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameItemType); + CMdEPropertyDef& mimeTypeProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameItemType); TInt mimeTypeIndex = aContainer->Property(mimeTypeProperty, mimeType); if( KErrNotFound == mimeTypeIndex) { @@ -594,10 +612,12 @@ } else { - aEntry->SetTextValueL(KMPXMediaGeneralMimeType, static_cast(mimeType)->Value()); + aEntry->SetTextValueL(KMPXMediaGeneralMimeType, + static_cast(mimeType)->Value()); } } - else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) + else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || + ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) { switch (aType) { @@ -610,10 +630,12 @@ } case CGlxDataSource::EContainerTypeMonth: { - iFilterProperties.iOrigin = EGlxFilterOriginCamera; + iFilterProperties.iOrigin = EGlxFilterOriginAll; TGlxFilterProperties filterProperties = iFilterProperties; AddMonthFilterL(aContainer, filterProperties); - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, TGlxMediaId(KGlxCollectionRootId), request->Attributes()[i], aEntry, filterProperties); + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, TGlxMediaId(KGlxCollectionRootId), + request->Attributes()[i], aEntry, filterProperties); break; } } @@ -626,13 +648,16 @@ case CGlxDataSource::EContainerTypeAlbum: { CMdEProperty* albumType; - CMdEPropertyDef& albumTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameAlbumType); - TInt albumTypeIndex = aContainer->Property(albumTypeProperty, albumType); + CMdEPropertyDef& albumTypeProperty = + aContainer->Def().GetPropertyDefL( KPropertyDefNameAlbumType); + TInt albumTypeIndex = aContainer->Property(albumTypeProperty, + albumType); if( KErrNotFound != albumTypeIndex ) { - TInt albumTypeValue = static_cast(albumType)->Value(); - - if( (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera) || (albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite ) ) + TInt albumTypeValue = + static_cast(albumType)->Value(); + if( (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera) || + (albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite ) ) { systemItem = ETrue; } @@ -663,8 +688,10 @@ TGlxFilterProperties filterProperties = iFilterProperties; AddMonthFilterL(aContainer, filterProperties); filterProperties.iItemType = EGlxFilterImage; -#if 0 /// @todo AB camera album - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); +#if 0 /// AB camera album + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, DataSource()->CameraAlbumId(), + request->Attributes()[i], aEntry, filterProperties); #endif break; } @@ -685,8 +712,10 @@ TGlxFilterProperties filterProperties = iFilterProperties; AddMonthFilterL(aContainer, filterProperties); filterProperties.iItemType = EGlxFilterVideo; -#if 0 /// @todo AB camera album - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); +#if 0 /// AB camera album + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, DataSource()->CameraAlbumId(), + request->Attributes()[i], aEntry, filterProperties); #endif break; } @@ -699,7 +728,8 @@ else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) { - aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, + KGlxDataSourceMdeImplementationUid); } else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) { @@ -734,14 +764,18 @@ case CGlxDataSource::EContainerTypeAlbum: case CGlxDataSource::EContainerTypeTag: { - QueueObjectQueryL(aContainer->Def(), ETrue, EAttributeQuery, EQueryResultModeCount, TGlxMediaId(aContainer->Id()), request->Attributes()[i], aEntry, filterProperties); + QueueObjectQueryL(aContainer->Def(), ETrue, EAttributeQuery, + EQueryResultModeCount, TGlxMediaId(aContainer->Id()), + request->Attributes()[i], aEntry, filterProperties); break; } case CGlxDataSource::EContainerTypeMonth: { - filterProperties.iOrigin = EGlxFilterOriginCamera; + filterProperties.iOrigin = EGlxFilterOriginAll; AddMonthFilterL(aContainer, filterProperties); - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, TGlxMediaId(KGlxCollectionRootId), request->Attributes()[i], aEntry, filterProperties); + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, TGlxMediaId(KGlxCollectionRootId), + request->Attributes()[i], aEntry, filterProperties); break; } } @@ -749,13 +783,15 @@ else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) { CMdEProperty* time; - CMdEPropertyDef& timeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameLastModifiedDate); + CMdEPropertyDef& timeProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameLastModifiedDate); TInt timeIndex = aContainer->Property(timeProperty, time); if( KErrNotFound == timeIndex) { User::Leave(KErrCorrupt); } - aEntry->SetTObjectValueL(KGlxMediaGeneralLastModifiedDate, static_cast(time)->Value()); + aEntry->SetTObjectValueL(KGlxMediaGeneralLastModifiedDate, + static_cast(time)->Value()); } else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) { @@ -778,7 +814,8 @@ // CGlxDataSourceTaskMdeAttribute::AddItemAttributesL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeAttributeMde::AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType) +void CGlxDataSourceTaskMdeAttributeMde::AddItemAttributesL(CMPXMedia* aEntry, + CMdEObject* aItem, CGlxDataSource::TItemType aType) { TRACER("CGlxDataSourceTaskMdeAttribute::AddItemAttributesL()") __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); @@ -786,12 +823,13 @@ __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); CGlxGetRequest* request = static_cast(iRequest); - /// @todo check property defs are valid and type is correct + /// check property defs are valid and type is correct for ( TInt i = 0; i < request->Attributes().Count(); i++ ) { if ( request->Attributes()[i] == KMPXMediaGeneralId ) { - aEntry->SetTObjectValueL(KMPXMediaGeneralId, (TMPXItemId)aItem->Id()); + aEntry->SetTObjectValueL(KMPXMediaGeneralId, + (TMPXItemId)aItem->Id()); } else if ( request->Attributes()[i] == KMPXMediaGeneralType ) { @@ -819,7 +857,8 @@ else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) { CMdEProperty* title; - CMdEPropertyDef& titleProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameTitle); + CMdEPropertyDef& titleProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameTitle); TInt titleIndex = aItem->Property(titleProperty, title); if( KErrNotFound == titleIndex ) { @@ -828,35 +867,41 @@ } else { - aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast(title)->Value()); + aEntry->SetTextValueL(KMPXMediaGeneralTitle, + static_cast(title)->Value()); } } else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) { CMdEProperty* time; - CMdEPropertyDef& timeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameCreationDate); + CMdEPropertyDef& timeProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameCreationDate); TInt timeIndex = aItem->Property(timeProperty, time); if( KErrNotFound == timeIndex) { User::Leave(KErrCorrupt); } - aEntry->SetTObjectValueL(KMPXMediaGeneralDate, static_cast(time)->Value()); + aEntry->SetTObjectValueL(KMPXMediaGeneralDate, + static_cast(time)->Value()); } else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) { CMdEProperty* time; - CMdEPropertyDef& timeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameLastModifiedDate); + CMdEPropertyDef& timeProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameLastModifiedDate); TInt timeIndex = aItem->Property(timeProperty, time); if( KErrNotFound == timeIndex) { User::Leave(KErrCorrupt); } - aEntry->SetTObjectValueL(KGlxMediaGeneralLastModifiedDate, static_cast(time)->Value()); + aEntry->SetTObjectValueL(KGlxMediaGeneralLastModifiedDate, + static_cast(time)->Value()); } else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) { CMdEProperty* size; - CMdEPropertyDef& sizeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameSize); + CMdEPropertyDef& sizeProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameSize); TInt sizeIndex = aItem->Property(sizeProperty, size); User::LeaveIfError(sizeIndex); @@ -870,11 +915,34 @@ else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) { CMdEProperty* mimeType; - CMdEPropertyDef& mimeTypeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameItemType); + CMdEPropertyDef& mimeTypeProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameItemType); TInt mimeTypeIndex = aItem->Property(mimeTypeProperty, mimeType); - - User::LeaveIfError(mimeTypeIndex); - aEntry->SetTextValueL(KMPXMediaGeneralMimeType, static_cast(mimeType)->Value()); + if(mimeTypeIndex == KErrNotFound) + { + //MDS retrieves the Mimetype of the file the moment it is notified about + //the new file.But in case of new downloaded video file ,MDS is notified about + //it the moment download starts. As mimetype is available only after the download completes, + //so MDS fails to give the mimetype of the file. But mimetype can also be retrieved + //from CContent class once the download completes. + RBuf mimeTypeData; + CleanupClosePushL(mimeTypeData); + mimeTypeData.CreateL(KMaxFileName); + ContentAccess::CContent* content = ContentAccess::CContent::NewLC(aItem->Uri()); + TInt err = content->GetStringAttribute(ContentAccess::EMimeType, mimeTypeData); + CleanupStack::PopAndDestroy(content); + if(err != KErrNone) + { + mimeTypeData.Copy(KNullDesC); + } + aEntry->SetTextValueL(KMPXMediaGeneralMimeType,mimeTypeData); + CleanupStack::PopAndDestroy(&mimeTypeData); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralMimeType, + static_cast(mimeType)->Value()); + } } else if ( request->Attributes()[i] == KMPXMediaGeneralDuration ) { @@ -885,11 +953,18 @@ else { CMdEProperty* duration; - CMdEPropertyDef& durationProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDuration); + CMdEPropertyDef& durationProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameDuration); TInt durationIndex = aItem->Property(durationProperty, duration); - User::LeaveIfError(durationIndex); - - aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, static_cast(duration)->Value()); + if(durationIndex == KErrNotFound) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralDuration,0); + } + else + { + aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, + static_cast(duration)->Value()); + } } } else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem) @@ -901,11 +976,12 @@ TSize dimensions(0,0); CMdEProperty* xDim; - CMdEPropertyDef& xDimProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameWidth); + CMdEPropertyDef& xDimProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameWidth); TInt xDimIndex = aItem->Property(xDimProperty, xDim); if( KErrNotFound == xDimIndex ) { - //User::Leave(KErrCorrupt); + //Do nothing } else { @@ -913,11 +989,12 @@ } CMdEProperty* yDim; - CMdEPropertyDef& yDimProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameHeight); + CMdEPropertyDef& yDimProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameHeight); TInt yDimIndex = aItem->Property(yDimProperty, yDim); if( KErrNotFound == yDimIndex ) { - //User::Leave(KErrCorrupt); + //Do nothing } else { @@ -930,7 +1007,9 @@ // EXIF header is corrupt, must read size from file. CImageDecoder* decoder = NULL; - TRAPD(err, decoder = CImageDecoder::FileNewL( DataSource()->FileServerSession(), aItem->Uri(), CImageDecoder::EOptionNone )); + TRAPD(err, decoder = CImageDecoder::FileNewL( + DataSource()->FileServerSession(), aItem->Uri(), + CImageDecoder::EOptionNone )); if (err == KErrNone) { dimensions = decoder->FrameInfo().iOverallSizeInPixels; @@ -945,9 +1024,10 @@ { CMdEProperty* framecount; TInt fcount = 1; - //@todo AB test this + // AB test this CMdEPropertyDef* framecountProperty = NULL; - TRAP_IGNORE(framecountProperty = &aItem->Def().GetPropertyDefL(KPropertyDefNameFrameCount)); + TRAP_IGNORE(framecountProperty = &aItem->Def().GetPropertyDefL( + KPropertyDefNameFrameCount)); if( framecountProperty ) { TInt framecountIndex = aItem->Property(*framecountProperty, framecount); @@ -961,7 +1041,8 @@ else if ( request->Attributes()[i] == KMPXMediaGeneralComment ) { CMdEProperty* comment; - CMdEPropertyDef& commentProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameComment); /// @todo using Exif Comment field for comment as spec is not clear + CMdEPropertyDef& commentProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameComment); /// using Exif Comment field for comment as spec is not clear TInt commentIndex = aItem->Property(commentProperty, comment); if( KErrNotFound == commentIndex) { @@ -969,13 +1050,15 @@ } else { - aEntry->SetTextValueL(KMPXMediaGeneralComment, static_cast(comment)->Value()); + aEntry->SetTextValueL(KMPXMediaGeneralComment, + static_cast(comment)->Value()); } } else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) { CMdEProperty* drmProtected; - CMdEPropertyDef& drmProtectedProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDRM); + CMdEPropertyDef& drmProtectedProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameDRM); TInt drmProtectedIndex = aItem->Property(drmProtectedProperty, drmProtected); if( KErrNotFound == drmProtectedIndex) { @@ -983,27 +1066,32 @@ } else { - aEntry->SetTObjectValueL(KMPXMediaDrmProtected, static_cast(drmProtected)->Value()); + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, + static_cast(drmProtected)->Value()); } } else if ( request->Attributes()[i] == KGlxMediaGeneralDRMRightsValid ) { CMdEProperty* drmProtected; - CMdEPropertyDef& drmProtectedProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDRM); + CMdEPropertyDef& drmProtectedProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameDRM); TInt drmProtectedIndex = aItem->Property(drmProtectedProperty, drmProtected); if( KErrNotFound == drmProtectedIndex) { - aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsValidityUnknown); + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, + EGlxDrmRightsValidityUnknown); } else { if( static_cast(drmProtected)->Value() ) { - aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsValidityUnknown); + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, + EGlxDrmRightsValidityUnknown); } else { - aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsValid); + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, + EGlxDrmRightsValid); } } } @@ -1013,7 +1101,8 @@ } else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) { - aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, + KGlxDataSourceMdeImplementationUid); } else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) { @@ -1035,25 +1124,30 @@ // CGlxDataSourceTaskMde::AddLocationAttributeToMediaL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeAttributeMde::AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId) +void CGlxDataSourceTaskMdeAttributeMde::AddLocationAttributeToMediaL( + CMPXMedia& aMedia, const TItemId& aLocationId) { TRACER("CGlxDataSourceTaskMdeAttribute::AddLocationAttributeToMediaL()") - CMdEObject* location = DataSource()->Session().GetObjectL(aLocationId, DataSource()->LocationDef()); + CMdEObject* location = DataSource()->Session().GetObjectL(aLocationId, + DataSource()->LocationDef()); if(!location) { User::Leave(KErrNotFound); } CleanupStack::PushL(location); CMdEProperty* longitude = NULL; - CMdEPropertyDef& longitudePropertyDef = location->Def().GetPropertyDefL(KPropertyDefNameLongitude); + CMdEPropertyDef& longitudePropertyDef = location->Def().GetPropertyDefL( + KPropertyDefNameLongitude); TInt longitudeIndex = location->Property(longitudePropertyDef, longitude); CMdEProperty* latitude = NULL; - CMdEPropertyDef& latitudePropertyDef = location->Def().GetPropertyDefL(KPropertyDefNameLatitude); + CMdEPropertyDef& latitudePropertyDef = location->Def().GetPropertyDefL( + KPropertyDefNameLatitude); TInt latitudeIndex = location->Property(latitudePropertyDef, latitude); if (longitudeIndex > KErrNotFound && latitudeIndex > KErrNotFound) { - TCoordinate coordinate(static_cast< CMdEReal64Property *>(latitude)->Value(),static_cast< CMdEReal64Property *>(longitude)->Value()); + TCoordinate coordinate(static_cast< CMdEReal64Property *>(latitude)->Value(), + static_cast< CMdEReal64Property *>(longitude)->Value()); aMedia.SetTObjectValueL(KGlxMediaGeneralLocation, coordinate); } @@ -1070,41 +1164,63 @@ __ASSERT_DEBUG(iQueryAttributes.Count(), Panic(EGlxPanicIllegalState)); CMdEQuery* query = iQueries[0]; - if( query->ResultMode() == EQueryResultModeObjectWithFreetexts ) + if( query->ResultMode() == EQueryResultModeItem ) { - __ASSERT_DEBUG(( iQueryAttributes[0].iAttribute == KGlxMediaCollectionInternalStartDate ), Panic(EGlxPanicIllegalState)); - CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); + __ASSERT_DEBUG(( iQueryAttributes[0].iAttribute == + KGlxMediaCollectionInternalStartDate || iQueryAttributes[0].iAttribute == + KGlxMediaCollectionInternalEndDate), Panic(EGlxPanicIllegalState)); + CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL( + KPropertyDefNameCreationDate); if (creationDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); } TTime startMonth(0); TTime endMonth(0); + GLX_DEBUG2("CGlxDataSourceTaskMdeAttributeMde::DoHandleAttributeQueryCompletedL iQueries[0]->Count()=%d", iQueries[0]->Count()); + TInt timeIndex(0) ; if(iQueries[0]->Count() ) { - CMdEProperty* startTime; - CMdEObject& startObject = (CMdEObject&)query->ResultItem(0); - TInt timeIndex = startObject.Property(creationDateDef, startTime); - if( KErrNotFound == timeIndex ) - { - User::Leave(KErrCorrupt); - } - startMonth = static_cast(startTime)->Value(); - CMdEProperty* endTime; - CMdEObject& endObject = (CMdEObject&)query->ResultItem(query->Count()-1); - timeIndex = endObject.Property(creationDateDef, endTime); - if( KErrNotFound == timeIndex ) - { - User::Leave(KErrCorrupt); - } - endMonth = static_cast(endTime)->Value(); + GLX_DEBUG2("CGlxDataSourceTaskMdeAttributeMde::DoHandleAttributeQueryCompletedL query->Count()=%d", query->Count()); + if(iQueryAttributes[0].iAttribute == KGlxMediaCollectionInternalStartDate) + { + CMdEProperty* startTime; + CMdEObject& startObject = (CMdEObject&)query->ResultItem(0); + TInt timeIndex = startObject.Property(creationDateDef, startTime); + if( KErrNotFound == timeIndex ) + { + User::Leave(KErrCorrupt); + } + startMonth = static_cast(startTime)->Value(); + iQueryAttributes[0].iMedia->SetTObjectValueL( + KGlxMediaCollectionInternalStartDate, startMonth); + } + else if(iQueryAttributes[0].iAttribute == KGlxMediaCollectionInternalEndDate) + { + CMdEProperty* endTime; + CMdEObject& endObject = (CMdEObject&)query->ResultItem(0); + timeIndex = endObject.Property(creationDateDef, endTime); + if( KErrNotFound == timeIndex ) + { + User::Leave(KErrCorrupt); + } + endMonth = static_cast(endTime)->Value(); + iQueryAttributes[0].iMedia->SetTObjectValueL( + KGlxMediaCollectionInternalEndDate, endMonth); + } } - iQueryAttributes[0].iMedia->SetTObjectValueL(KGlxMediaCollectionInternalStartDate, startMonth); - iQueryAttributes[0].iMedia->SetTObjectValueL(KGlxMediaCollectionInternalEndDate, endMonth); + else + { + iQueryAttributes[0].iMedia->SetTObjectValueL( + KGlxMediaCollectionInternalStartDate, startMonth); + iQueryAttributes[0].iMedia->SetTObjectValueL( + KGlxMediaCollectionInternalEndDate, endMonth); + } } else if( EQueryResultModeCount == query->ResultMode() ) { - iQueryAttributes[0].iMedia->SetTObjectValueL(iQueryAttributes[0].iAttribute, query->Count()); + iQueryAttributes[0].iMedia->SetTObjectValueL( + iQueryAttributes[0].iAttribute, query->Count()); } else { @@ -1124,7 +1240,8 @@ for (TInt queryResultsPos = 0; queryResultsPos < queryResultsCount; queryResultsPos++) { - CMdERelation& relation = static_cast(iQueries[0]->ResultItem(queryResultsPos)); + CMdERelation& relation = static_cast( + iQueries[0]->ResultItem(queryResultsPos)); CMPXMedia* targetMedia = NULL; if (iMediaArray) { @@ -1165,14 +1282,9 @@ CMdEQuery* query = iQueries[0]; TInt queryResultsCount = query->Count(); - GLX_LOG_INFO1("==> CGlxDataSourceTaskMdeAttributeMde::DoHandleImageVideoQueryCompletedL - queryResultsCount=%d", queryResultsCount); -#ifdef _DEBUG - iStopTime.HomeTime(); // Get home time - if (queryResultsCount) - { - GLX_LOG_INFO1("==> CGlxDataSourceTaskMdeAttributeMde::DoHandleImageVideoQueryCompletedL took <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); - } -#endif + GLX_DEBUG2("CGlxDataSourceTaskMdeAttributeMde::DoHandleImageVideoQueryCompletedL()" + " queryResultsCount=%d", queryResultsCount); + if( ( queryResultsCount == 1 ) && ( !iMediaArray ) ) { CMdEObject& object = static_cast(query->ResultItem(0)); @@ -1188,10 +1300,11 @@ for (TInt i = 0; i < queryResultsCount; i++) { CMdEObject& object = static_cast(query->ResultItem(i)); + CMPXMedia* entry = CMPXMedia::NewL(); CleanupStack::PushL(entry); - iMediaArray->AppendL(*entry); - CleanupStack::PopAndDestroy(entry); + iMediaArray->AppendL(entry); + CleanupStack::Pop(entry); AddAttributesL(object, (*iMediaArray)[iMediaArray->Count() - 1]); } } @@ -1207,11 +1320,14 @@ __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); CGlxGetRequest* request = static_cast(iRequest); - CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); + CMdEQuery* query = DataSource()->Session().NewRelationQueryL( + *DataSource()->NamespaceDef(), this); CleanupStack::PushL(query); CMdELogicCondition& rootCondition = query->Conditions(); - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsLocationDef(), ERelationConditionSideRight); + CMdERelationCondition& containerRelationCondition = + rootCondition.AddRelationConditionL(DataSource()->ContainsLocationDef(), + ERelationConditionSideRight); CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); @@ -1290,8 +1406,10 @@ // CGlxDataSourceTask::QueueObjectQueryL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeAttributeMde::QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, - TQueryResultMode aResultMode, const TGlxMediaId& aContainerId, TMPXAttribute aAttribute, CMPXMedia* aEntry, +void CGlxDataSourceTaskMdeAttributeMde::QueueObjectQueryL(CMdEObjectDef& aObjectDef, + TBool aIsContent, TGlxQueryType aQueryType, + TQueryResultMode aResultMode, const TGlxMediaId& aContainerId, + TMPXAttribute aAttribute, CMPXMedia* aEntry, const TGlxFilterProperties& aFilterProperties) { TRACER("CGlxDataSourceTaskMdeAttribute::QueueObjectQueryL()") @@ -1318,10 +1436,11 @@ } } - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *queryBaseObject, this); + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), + *queryBaseObject, this); CleanupStack::PushL(query); + query->SetResultMode(aResultMode); SetQueryConditionsL(*query, aFilterProperties, aContainerId, aObjectDef); - query->SetResultMode(aResultMode); iQueryAttributes.AppendL(TGlxQueryAttribute(aAttribute, aEntry, aFilterProperties)); diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -90,18 +90,28 @@ _LIT(KColonBackslash, ":\\"); _LIT(KFileNameFormatString, "(%+02u)"); +// Items to be deleted from File server at a time before calling scheduler wait +const TInt KDeletedItemCount = 10; +const TInt KDeleteOperationInterval = 1000; + // ---------------------------------------------------------------------------- // Destructor // ---------------------------------------------------------------------------- // CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand() { - TRACER("CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand()") + TRACER("CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand()"); iLeftIds.Close(); iRightIds.Close(); delete iTitle; delete iObjectToRename; delete iStringCache; + if(iTimer && iTimer->IsActive()) + { + iTimer->Cancel(); + } + delete iTimer; + delete iSchedulerWait; } @@ -114,7 +124,7 @@ CGlxDataSource* aDataSource) : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) { - TRACER("CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand()") + TRACER("CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand()"); // No implementation required } @@ -124,13 +134,16 @@ // void CGlxDataSourceTaskMdeCommand::ConstructL() { - TRACER("CGlxDataSourceTaskMdeCommand::ConstructL()") + TRACER("CGlxDataSourceTaskMdeCommand::ConstructL()"); iResponse = CMPXCommand::NewL(static_cast(iRequest)->Command()); #ifdef USE_S60_TNM DataSource()->CancelFetchThumbnail(); #else DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); -#endif +#endif + + iTimer = CPeriodic::NewL(CActive::EPriorityStandard); + iSchedulerWait = new (ELeave) CActiveSchedulerWait(); } /// @todo minor: Rowland Cook 12/06/2007 Add method decription. @@ -140,7 +153,7 @@ // void CGlxDataSourceTaskMdeCommand::ExecuteRequestL() { - TRACER("CGlxDataSourceTaskMdeCommand::ExecuteRequestL()") + TRACER("CGlxDataSourceTaskMdeCommand::ExecuteRequestL()"); __ASSERT_DEBUG(DataSource()->NamespaceDef(), Panic(EGlxPanicIllegalState)); const CMPXCommand& command = static_cast(iRequest)->Command(); @@ -164,7 +177,7 @@ // void CGlxDataSourceTaskMdeCommand::AddContainerL(const TDesC& aContainerName) { - TRACER("CGlxDataSourceTaskMdeCommand::AddContainerL()") + TRACER("CGlxDataSourceTaskMdeCommand::AddContainerL()"); iTitle = aContainerName.AllocL(); AppendContainerTitleCountQueryL(ECommandAddContainer, aContainerName); ExecuteQueryL(); @@ -174,19 +187,24 @@ // Add items to container by id // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeCommand::AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers) +void CGlxDataSourceTaskMdeCommand::AddToContainerL(const RArray& aSourceIds, + const RArray& aTargetContainers) { - TRACER("CGlxDataSourceTaskMdeCommand::AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers)") - __ASSERT_DEBUG(aSourceIds.Count() && aTargetContainers.Count(), Panic(EGlxPanicEmptyArray)); + TRACER("CGlxDataSourceTaskMdeCommand::AddToContainerL(const RArray& aSourceIds,const RArray& aTargetContainers)"); + __ASSERT_DEBUG(aSourceIds.Count() && aTargetContainers.Count(), + Panic(EGlxPanicEmptyArray)); iLeftIds.Reset(); iRightIds.Reset(); - CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); + CMdEQuery* query = DataSource()->Session().NewRelationQueryL( + *DataSource()->NamespaceDef(), this); AppendQueryL(query, ECommandAddToContainer); CMdELogicCondition& rootCondition = query->Conditions(); - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); + CMdERelationCondition& containerRelationCondition = + rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), + ERelationConditionSideLeft); CMdELogicCondition& leftLogicCondition = containerRelationCondition.LeftL(); CMdELogicCondition& rightLogicCondition = containerRelationCondition.RightL(); leftLogicCondition.SetOperator(ELogicConditionOperatorOr); @@ -236,7 +254,7 @@ void CGlxDataSourceTaskMdeCommand::AddToContainerL(const TDesC& aSourceUri, const RArray< TGlxMediaId >& aTargetContainers) { - TRACER("CGlxDataSourceTaskMdeCommand::AddToContainerL()") + TRACER("CGlxDataSourceTaskMdeCommand::AddToContainerL()"); CMdEObject* sourceObject = DataSource()->Session().GetObjectL(aSourceUri); if (!sourceObject) { @@ -254,10 +272,10 @@ // Copy files to another drive. // ---------------------------------------------------------------------------- // -/// @todo minor: Rowland Cook 12/06/2007 Has this method been tested? If so remove comments -void CGlxDataSourceTaskMdeCommand::CopyL(const RArray& aSourceIds, const TDesC& aDrive) +void CGlxDataSourceTaskMdeCommand::CopyL(const RArray& aSourceIds, + const TDesC& aDrive) { - TRACER("CGlxDataSourceTaskMdeCommand::CopyL()") + TRACER("CGlxDataSourceTaskMdeCommand::CopyL()"); FileOperationL(aSourceIds.Array(), aDrive, ECopy); } @@ -265,10 +283,10 @@ // Move files to another drive. // ---------------------------------------------------------------------------- // -/// @todo minor: Rowland Cook 12/06/2007 Has this method been tested? If so remove comments -void CGlxDataSourceTaskMdeCommand::MoveL(const RArray& aSourceIds, const TDesC& aDrive) +void CGlxDataSourceTaskMdeCommand::MoveL(const RArray& aSourceIds, + const TDesC& aDrive) { - TRACER("CGlxDataSourceTaskMdeCommand::MoveL()") + TRACER("CGlxDataSourceTaskMdeCommand::MoveL()"); FileOperationL(aSourceIds.Array(), aDrive, EMove); } @@ -276,9 +294,10 @@ // Remove items from a container. // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeCommand::RemoveFromContainerL(const RArray& aItemIds, const TGlxMediaId& aContainerId) +void CGlxDataSourceTaskMdeCommand::RemoveFromContainerL( + const RArray& aItemIds, const TGlxMediaId& aContainerId) { - TRACER("CGlxDataSourceTaskMdeCommand::RemoveFromContainerL()") + TRACER("CGlxDataSourceTaskMdeCommand::RemoveFromContainerL()"); // Answer to question in @bug above: No CMdEObject* object = NULL; @@ -289,12 +308,15 @@ User::Leave(KErrNotFound); } - CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); + CMdEQuery* query = DataSource()->Session().NewRelationQueryL( + *DataSource()->NamespaceDef(), this); AppendQueryL(query, ECommandRemoveFromContainer); // query is now owned by the query array. CMdELogicCondition& rootCondition = query->Conditions(); - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); + CMdERelationCondition& containerRelationCondition = + rootCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideLeft); CMdELogicCondition* containerLogicCondition = NULL; CMdELogicCondition* itemLogicCondition = NULL; // Containers are on the left for albums, right for tags @@ -326,7 +348,7 @@ // void CGlxDataSourceTaskMdeCommand::DeleteL(const RArray& aItemIds) { - TRACER("CGlxDataSourceTaskMdeCommand::DeleteL()") + TRACER("CGlxDataSourceTaskMdeCommand::DeleteL()"); CMdEObjectDef* containerObjectDef = NULL; TInt err = ContainerObjectDef(containerObjectDef); if (err == KErrNone) @@ -348,10 +370,10 @@ // // ---------------------------------------------------------------------------- // -/// @todo minor: Rowland Cook 12/06/2007 Has this method been tested? If so remove comments -void CGlxDataSourceTaskMdeCommand::RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle) +void CGlxDataSourceTaskMdeCommand::RenameL(const TGlxMediaId& aSourceItemId, + const TDesC& aTitle) { - TRACER("CGlxDataSourceTaskMdeCommand::RenameL()") + TRACER("CGlxDataSourceTaskMdeCommand::RenameL()"); delete iTitle; iTitle = NULL; iTitle = aTitle.AllocL(); @@ -370,10 +392,12 @@ // Set description. // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeCommand::SetDescriptionL(const RArray& aItemIds, const TDesC& aDescription) +void CGlxDataSourceTaskMdeCommand::SetDescriptionL(const RArray& aItemIds, + const TDesC& aDescription) { - TRACER("CGlxDataSourceTaskMdeCommand::SetDescriptionL()") - CMdEPropertyDef& descriptionPropertyDef = DataSource()->MediaDef().GetPropertyDefL(KPropertyDefNameDescription); + TRACER("CGlxDataSourceTaskMdeCommand::SetDescriptionL()"); + CMdEPropertyDef& descriptionPropertyDef = DataSource()->MediaDef().GetPropertyDefL( + KPropertyDefNameDescription); if (descriptionPropertyDef.PropertyType() != EPropertyText) { User::Leave(KErrCorrupt); @@ -430,9 +454,10 @@ // Set capture location. // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeCommand::SetCaptureLocationL(const RArray& aItemIds, const TCoordinate& aCoordinate) +void CGlxDataSourceTaskMdeCommand::SetCaptureLocationL(const RArray& aItemIds, + const TCoordinate& aCoordinate) { - TRACER("CGlxDataSourceTaskMdeCommand::SetCaptureLocationL()") + TRACER("CGlxDataSourceTaskMdeCommand::SetCaptureLocationL()") ; if (!Math::IsNaN(aCoordinate.Latitude()) || !Math::IsNaN(aCoordinate.Longitude())) { User::Leave(KErrArgument); @@ -443,7 +468,8 @@ CMdELogicCondition& rootCondition = query->Conditions(); - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(ERelationConditionSideLeft); + CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL( + ERelationConditionSideLeft); CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); @@ -463,7 +489,7 @@ // void CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL() { - TRACER("CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL()") + TRACER("CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL()"); #ifndef USE_S60_TNM CGlxDataSourceMde* ds = DataSource(); ds->ThumbnailCreator().CleanupThumbnailsL(&ds->ThumbnailDatabase()); @@ -477,7 +503,7 @@ // void CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL(CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL()") + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL()"); TGlxQueryType queryType = iQueryTypes[0]; switch (queryType) @@ -502,7 +528,8 @@ if (queryCount) { - User::LeaveIfError(DataSource()->Session().RemoveRelationsL(relationsToRemove, successfullyRemovedReleations)); + User::LeaveIfError(DataSource()->Session().RemoveRelationsL( + relationsToRemove, successfullyRemovedReleations)); } CleanupStack::PopAndDestroy(&successfullyRemovedReleations); @@ -547,7 +574,7 @@ // void CGlxDataSourceTaskMdeCommand::DoNextQueryL() { - TRACER("CGlxDataSourceTaskMdeCommand::DoNextQueryL()") + TRACER("CGlxDataSourceTaskMdeCommand::DoNextQueryL()"); if (iQueries.Count()) { ExecuteQueryL(); @@ -562,9 +589,10 @@ // CGlxDataSourceTaskMdeCommand::FileOperationL // ---------------------------------------------------------------------------- // -void CGlxDataSourceTaskMdeCommand::FileOperationL(const TArray& aSourceIds, const TDesC& aDrive, TFileOperation aFileOperation) +void CGlxDataSourceTaskMdeCommand::FileOperationL(const TArray& aSourceIds, + const TDesC& aDrive, TFileOperation aFileOperation) { - TRACER("CGlxDataSourceTaskMdeCommand::FileOperationL()") + TRACER("CGlxDataSourceTaskMdeCommand::FileOperationL()"); ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); CleanupStack::PushL(manager); // The following line causes a code scanner warning advising use of EikonEnv RFs instance. @@ -593,7 +621,8 @@ // the drive that it is located on. (For the C:, the root is C:\data, // for the D: the root is D:\) { - fileNameWithoutRoot.Set(sourceFileName.Right(sourceFileName.Length() - sourceRootPath.Length())); + fileNameWithoutRoot.Set(sourceFileName.Right(sourceFileName.Length() - + sourceRootPath.Length())); } else { @@ -606,7 +635,6 @@ // Append the file name destinationFileName.Append(fileNameWithoutRoot); -/// @todo minor: Rowland Cook 12/06/2007 majic number. if (destinationFileName.CompareF(sourceFileName) != 0) { // If source and destination are not identical, perform the copy. @@ -615,7 +643,8 @@ // If the destination file name already exists find an available file name. TParse destinationFileNameParse; destinationFileNameParse.Set(destinationFileName,NULL,NULL); // this is a copy of the data - TInt destinationFileNameWithoutExtensionLength = destinationFileName.Length() - destinationFileNameParse.Ext().Length(); + TInt destinationFileNameWithoutExtensionLength = destinationFileName.Length() + - destinationFileNameParse.Ext().Length(); TInt i = 1; do { @@ -658,16 +687,7 @@ TItemId CGlxDataSourceTaskMdeCommand::ContainerItemId(const TGlxMediaId& aMediaId) { TRACER("TMdEItemId CGlxDataSourceTaskMdeCommand::ContainerItemId()"); - TItemId containerId = aMediaId.Value(); - if (aMediaId == KGlxCollectionRootId) - { - // Check the collection plugin uid - if (iCollectionUid == TUid::Uid(KGlxCollectionPluginCameraImplementationUid)) - { - // containerId = DataSource()->CameraAlbumId().Value(); - } - } - return containerId; + return aMediaId.Value(); } // ---------------------------------------------------------------------------- @@ -676,16 +696,19 @@ // void CGlxDataSourceTaskMdeCommand::RootPath(const TDesC& aDrive, TDes& aRootPath) { - TRACER("CGlxDataSourceTaskMdeCommand::RootPath()") - if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::PhoneMemoryRootPath().Left(KDriveLetterLength)) == 0) + TRACER("CGlxDataSourceTaskMdeCommand::RootPath()"); + if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::PhoneMemoryRootPath().Left( + KDriveLetterLength)) == 0) { aRootPath = PathInfo::PhoneMemoryRootPath(); } - else if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::MemoryCardRootPath().Left(KDriveLetterLength)) == 0) + else if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::MemoryCardRootPath().Left( + KDriveLetterLength)) == 0) { aRootPath = PathInfo::MemoryCardRootPath(); } - else if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::RomRootPath().Left(KDriveLetterLength)) == 0) + else if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::RomRootPath().Left( + KDriveLetterLength)) == 0) { aRootPath = PathInfo::RomRootPath(); } @@ -702,19 +725,23 @@ // void CGlxDataSourceTaskMdeCommand::SendProgressMessageL(TInt aCurrentStep, TInt aStepCount) { - TRACER("CGlxDataSourceTaskMdeCommand::SendProgressMessageL()") - MGlxDataSourceUpdateObserver& observer = static_cast(iRequest)->DataSourceUpdateObserver(); + TRACER("CGlxDataSourceTaskMdeCommand::SendProgressMessageL()"); + MGlxDataSourceUpdateObserver& observer = + static_cast(iRequest)->DataSourceUpdateObserver(); const CMPXCommand& command = static_cast(iRequest)->Command(); - __ASSERT_DEBUG(command.IsSupported(KMPXCommandGeneralSessionId), Panic(EGlxPanicCommandHasNoGeneralSessionId)); + __ASSERT_DEBUG(command.IsSupported(KMPXCommandGeneralSessionId), Panic( + EGlxPanicCommandHasNoGeneralSessionId)); TAny* sessionId = command.ValueTObjectL(KMPXCommandGeneralSessionId); CMPXMessage* progressMessage = CMPXMessage::NewL(); CleanupStack::PushL(progressMessage); progressMessage->SetTObjectValueL(KMPXMessageGeneralId, KMPXMessageContentIdProgress); - progressMessage->SetTObjectValueL(TMPXAttribute(KMPXMessageContentIdProgress, EMPXMessageProgressCurrentCount), aCurrentStep); - progressMessage->SetTObjectValueL(TMPXAttribute(KMPXMessageContentIdProgress, EMPXMessageProgressTotalCount), aStepCount); + progressMessage->SetTObjectValueL(TMPXAttribute(KMPXMessageContentIdProgress, + EMPXMessageProgressCurrentCount), aCurrentStep); + progressMessage->SetTObjectValueL(TMPXAttribute(KMPXMessageContentIdProgress, + EMPXMessageProgressTotalCount), aStepCount); progressMessage->SetTObjectValueL(KMPXCommandGeneralSessionId, sessionId); observer.HandleMessage(*progressMessage); @@ -728,8 +755,7 @@ // TInt CGlxDataSourceTaskMdeCommand::ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef) { - TRACER("CGlxDataSourceTaskMdeCommand::ContainerObjectDef()") - //__ASSERT_DEBUG( (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid) || iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)), Panic(EGlxPanicInvalidCollectionUid)); + TRACER("CGlxDataSourceTaskMdeCommand::ContainerObjectDef()"); TInt err = KErrNone; if (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid)) { @@ -757,7 +783,7 @@ void CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL (CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL()") + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL()"); RPointerArray relations; CleanupClosePushL(relations); @@ -783,7 +809,8 @@ if (!alreadyExists) { - CMdERelation* relation = DataSource()->Session().NewRelationL(DataSource()->ContainsDef(), iLeftIds[leftPos], iRightIds[rightPos]); + CMdERelation* relation = DataSource()->Session().NewRelationL( + DataSource()->ContainsDef(), iLeftIds[leftPos], iRightIds[rightPos]); CleanupStack::PushL(relation); relations.AppendL(relation); CleanupStack::Pop(relation); @@ -811,13 +838,14 @@ (CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL()") + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL()"); //Duplicate albums check for the default albums i.e. Favourites //as title property is left blank in MDS 2.5 if(iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)) { - if(SearchStringL(R_ALBUM_FAVORITES_TITLE) == 0) + if(SearchStringL(R_ALBUM_FAVORITES_TITLE) == 0 || + SearchStringL(R_ALBUM_CAMERA_TITLE) == 0 ) { User::Leave(KErrAlreadyExists); } @@ -837,7 +865,8 @@ object = DataSource()->Session().NewObjectLC(*containerObjectDef, KNullDesC); // A title property def of type text is required. - CMdEPropertyDef& titlePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameTitle); + CMdEPropertyDef& titlePropertyDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameTitle); if (titlePropertyDef.PropertyType() != EPropertyText) { User::Leave(KErrCorrupt); @@ -846,7 +875,8 @@ object->AddTextPropertyL(titlePropertyDef, *iTitle); //ItemType property def of type text is required. - CMdEPropertyDef& itemTypePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefItemType); + CMdEPropertyDef& itemTypePropertyDef = containerObjectDef->GetPropertyDefL( + KPropertyDefItemType); if (itemTypePropertyDef.PropertyType() != EPropertyText) { User::Leave(KErrCorrupt); @@ -865,7 +895,8 @@ // A size property is required. - CMdEPropertyDef& sizePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameSize); + CMdEPropertyDef& sizePropertyDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameSize); if (sizePropertyDef.PropertyType() != EPropertyUint32) { User::Leave(KErrCorrupt); @@ -874,14 +905,16 @@ // A creation date property is required. - CMdEPropertyDef& creationDateDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameCreationDate); + CMdEPropertyDef& creationDateDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameCreationDate); if (creationDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); } // A last modified date property is required. - CMdEPropertyDef& lmDateDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameLastModifiedDate); + CMdEPropertyDef& lmDateDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameLastModifiedDate); if (lmDateDef.PropertyType() != EPropertyTime) { User::Leave(KErrCorrupt); @@ -897,7 +930,8 @@ iResponse->SetTObjectValueL(KMPXMediaGeneralId, id); iResponse->SetTObjectValueL(KMPXMessageMediaGeneralId, id); - iResponse->SetTObjectValueL(KMPXMessageChangeEventType, EMPXItemInserted); + iResponse->SetTObjectValueL(KMPXMessageChangeEventType, + EMPXItemInserted); } // ---------------------------------------------------------------------------- // CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL @@ -906,8 +940,9 @@ void CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL (CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL()") - CMdEPropertyDef& albumTypeProperty = DataSource()->AlbumDef().GetPropertyDefL(KPropertyDefNameAlbumType); + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL()"); + CMdEPropertyDef& albumTypeProperty = DataSource()->AlbumDef().GetPropertyDefL( + KPropertyDefNameAlbumType); TInt queryCount = aQuery.Count(); RArray objectsForRemoval; @@ -928,8 +963,8 @@ if (KErrNotFound != albumTypeIndex) { TInt albumTypeValue = static_cast(albumType)->Value(); - - if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) + if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || + (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) { User::Leave(KErrAccessDenied); } @@ -939,7 +974,8 @@ if (queryCount) { - User::LeaveIfError(DataSource()->Session().RemoveObjectsL(objectsForRemoval, sucessfullyRemovedObjects)); + User::LeaveIfError(DataSource()->Session().RemoveObjectsL(objectsForRemoval, + sucessfullyRemovedObjects)); } CleanupStack::PopAndDestroy(&sucessfullyRemovedObjects); @@ -952,7 +988,8 @@ void CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL (CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL()") + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL()"); + TInt deleteItemCounter = 0; ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); CleanupStack::PushL(manager); TInt queryCount = aQuery.Count(); @@ -971,7 +1008,10 @@ User::LeaveIfError( fs.Connect() ); TInt lastErr = KErrNone; - for(TInt queryPos = queryCount - 1; queryPos >= 0; queryPos--) + + // If Delete operation is cancelled before completion, + // iCancelled because ETrue, break out of for loop. + for(TInt queryPos = queryCount - 1; (queryPos >= 0 && !iCancelled); queryPos--) { CMdEObject& object = static_cast(aQuery.ResultItem(queryPos)); //Removes the Read Only attributes of the file @@ -981,7 +1021,22 @@ { lastErr = err; } - objectsForRemoval.AppendL(object.Id()); + else + { + // On successful deletion, delete the same from database + objectsForRemoval.AppendL(object.Id()); + } + + // After every 50 items are deleted, break from the for loop + // and process other pending requests if any + if(deleteItemCounter == KDeletedItemCount) + { + iTimer->Start( KDeleteOperationInterval, KDeleteOperationInterval, + TCallBack( &SchedulerStopCallback, (TAny *)this ) ); + iSchedulerWait->Start(); + deleteItemCounter = 0; + } + deleteItemCounter++; } // Calling Close() on file server session CleanupStack::PopAndDestroy( &fs ); @@ -1007,7 +1062,7 @@ void CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL (CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL()") + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL()"); __ASSERT_DEBUG(iObjectToRename, Panic(EGlxPanicLogicError)); if (aQuery.Count()) { @@ -1035,8 +1090,8 @@ // the type to be a non-localised user defined album static_cast(albumType)->SetValueL(MdeConstants::Album::EAlbumUser); } - - else if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) + else if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || + (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) { // Cannot rename system albums User::Leave(KErrAccessDenied); @@ -1107,7 +1162,7 @@ void CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL (CMdEQuery& aQuery) { - TRACER("CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL()") + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL()"); __ASSERT_DEBUG(aQuery.Count() == 1, Panic(EGlxPanicUnexpectedQueryResultCount )); delete iObjectToRename; iObjectToRename = static_cast(aQuery.TakeOwnershipOfResult(0)); @@ -1127,20 +1182,23 @@ void CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL (const TGlxQueryType& aQueryType, const TDesC& aTitle) { - TRACER("CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL()") + TRACER("CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL()"); // Test to see if a container alerady exists in the database with aContainerName CMdEObjectDef* containerObjectDef = NULL; TInt err = ContainerObjectDef(containerObjectDef); __ASSERT_ALWAYS(err == KErrNone, Panic(EGlxPanicInvalidCollectionUid)); - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *containerObjectDef, this); + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), + *containerObjectDef, this); CleanupStack::PushL(query); - CMdEPropertyDef& titlePropertyDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameTitle); + CMdEPropertyDef& titlePropertyDef = DataSource()->ObjectDef().GetPropertyDefL( + KPropertyDefNameTitle); query->SetResultMode(EQueryResultModeCount); - query->Conditions().AddPropertyConditionL(titlePropertyDef, ETextPropertyConditionCompareEquals, aTitle); + query->Conditions().AddPropertyConditionL(titlePropertyDef, + ETextPropertyConditionCompareEquals, aTitle); CleanupStack::Pop(query); @@ -1153,7 +1211,7 @@ // TInt CGlxDataSourceTaskMdeCommand::SearchStringL(TInt aResourceId) { - + TRACER("CGlxDataSourceTaskMdeCommand::SearchStringL()"); _LIT(KResourceFile, "z:glxpluginalbums.rsc"); if (!iStringCache) @@ -1170,3 +1228,39 @@ return result; } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::SchedulerStopCallback +// ---------------------------------------------------------------------------- +// +TInt CGlxDataSourceTaskMdeCommand::SchedulerStopCallback(TAny* aPtr) + { + TRACER("CGlxDataSourceTaskMdeCommand::SchedulerStopCallback"); + + CGlxDataSourceTaskMdeCommand* self = (CGlxDataSourceTaskMdeCommand*) aPtr; + if ( self ) + { + self->SchedulerStopComplete(); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// SchedulerStopComplete +// ----------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::SchedulerStopComplete() + { + TRACER("CGlxDataSourceTaskMdeCommand::SchedulerStopComplete"); + + if(iTimer && iTimer->IsActive()) + { + iTimer->Cancel(); + } + + if(iSchedulerWait) + { + iSchedulerWait->AsyncStop(); + } + } diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -74,7 +74,8 @@ // Constructor // ---------------------------------------------------------------------------- // -CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) +CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) { TRACER("CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList()") @@ -109,6 +110,9 @@ void CGlxDataSourceTaskMdeIdList::ExecuteRequestL() { TRACER("CGlxDataSourceTaskMdeIdList::ExecuteRequestL()") +#ifdef _DEBUG + iStartTime.HomeTime(); +#endif CGlxIdListRequest* request = static_cast(iRequest); TGlxMediaId container = request->ContainerId(); TGlxQueryType queryType = EIdListQuery; @@ -140,9 +144,9 @@ } case KGlxCollectionPluginMonthsImplementationUid: { - iFilterProperties.iOrigin = EGlxFilterOriginCamera; + iFilterProperties.iOrigin = EGlxFilterOriginAll; container = TGlxMediaId(KGlxCollectionRootId); - resultMode = EQueryResultModeObjectWithFreetexts; + resultMode = EQueryResultModeItem; break; } case KGlxCollectionPluginImageViewerImplementationUid: @@ -177,7 +181,7 @@ } case KGlxCollectionPluginMonthsImplementationUid: { - iFilterProperties.iOrigin = EGlxFilterOriginCamera; + iFilterProperties.iOrigin = EGlxFilterOriginAll; AddMonthFilterL(container, iFilterProperties); container = TGlxMediaId(KGlxCollectionRootId); break; @@ -202,6 +206,11 @@ TRACER("CGlxDataSourceTaskMdeIdList::DoHandleQueryCompletedL()") __ASSERT_DEBUG(iQueryTypes[0] == EIdListQuery, Panic(EGlxPanicLogicError)); DoHandleListQueryCompletedL(); +#ifdef _DEBUG + iStopTime.HomeTime(); + GLX_DEBUG2("GlxDataSrcTaskMdeIdList:DoHandleQueryCompletedL() took %d us", + (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); +#endif } // ---------------------------------------------------------------------------- @@ -211,7 +220,7 @@ void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL() { TRACER("CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL()") - if(iQueries[0]->ResultMode() == EQueryResultModeObjectWithFreetexts) + if(iQueries[0]->ResultMode() == EQueryResultModeItem) { DoMonthListCreationL(*iQueries[0], iFilterProperties); } @@ -245,6 +254,7 @@ TTime lastMonth; TTime currentMonth; TInt count = aQuery.Count(); + GLX_DEBUG2("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL count=%d", count); for( TInt i = 0 ; i < count ; i++ ) { CMdEObject& object = (CMdEObject&)aQuery.ResultItem(i); @@ -254,13 +264,17 @@ User::Leave(KErrCorrupt); } currentMonth = static_cast(time)->Value(); - if( !DataSource()->SameMonth(lastMonth, currentMonth) ) + + // Also Checking for a Valid Month Entry Based on a Year Greater than 0000. + if( !DataSource()->SameMonth(lastMonth, currentMonth) && (currentMonth.DateTime().Year() > 0) ) { const TGlxMediaId monthId = DataSource()->GetMonthIdL(currentMonth); monthList.AppendL(monthId); + GLX_DEBUG2("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL monthId=%d", monthId.Value()); lastMonth = currentMonth; } } + GLX_DEBUG2("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL monthList.Count=%d", monthList.Count()); PostFilterL(monthList, aFilterProperties); CleanupStack::PopAndDestroy(&monthList); } diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -156,14 +156,17 @@ void CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL() { TRACER("CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL()") +#ifdef _DEBUG + iStartTime.HomeTime(); +#endif CGlxThumbnailRequest* request = static_cast(iRequest); TGlxThumbnailRequest tnReq; request->ThumbnailRequest(tnReq); -#ifdef _DEBUG - RDebug::Print(_L("==> CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL - FetchThumbnailL(Id=%d), W(%d), H(%d)"), request->ItemId().Value(), tnReq.iSizeClass.iWidth, tnReq.iSizeClass.iHeight); - iStartTime.HomeTime(); // Get home time -#endif + GLX_DEBUG4("*** CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL() Id=%d, TN Size w(%d) h(%d) ***", tnReq.iId.Value(), + tnReq.iSizeClass.iWidth, tnReq.iSizeClass.iHeight); + GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL() iPriorityMode=%d", tnReq.iPriorityMode); + #ifdef USE_S60_TNM if(request->ThumbnailInfo()) { @@ -173,7 +176,7 @@ } else { - ThumbnailFetchComplete(KErrNone); + ThumbnailFetchComplete(KErrNone, ETrue); } } else @@ -241,11 +244,13 @@ { TRACER("CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL()") __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxThumbnailRequest* req = static_cast(iRequest); + GLX_DEBUG2("*** CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL() Id=%d ***", req->ItemId().Value()); #ifdef _DEBUG - iStopTime.HomeTime(); // Get home time - RDebug::Print(_L("==> ThumbnailFetchComplete <%d> us"), (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); -#endif - CGlxThumbnailRequest* req = static_cast(iRequest); + iStopTime.HomeTime(); + GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail:HandleThumbnailFetchCompleteL() took %d us", + (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); +#endif delete iResponse; iResponse = NULL; iResponse = CMPXMedia::NewL(); @@ -257,6 +262,7 @@ tnAttribute->iDimensions = size; tnAttribute->iCroppingRect = tnRequest.iCroppingRect; tnAttribute->iThumbnailQuality = aQuality; + GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL() aQuality=%d", aQuality); TUint attributeId = req->AttributeId(); if ( GlxIsFullThumbnailAttribute(attributeId) ) @@ -273,7 +279,8 @@ } #ifdef USE_S60_TNM -void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TInt aError) +void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TInt aError, + TBool aQuality) { TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TNM)") CGlxThumbnailRequest* request = static_cast(iRequest); @@ -282,7 +289,12 @@ TInt err = aError; if(!err) { - TRAP(err, HandleThumbnailFetchCompleteL(tnRequest.iId, EGlxThumbnailQualityHigh)); + TGlxThumbnailQuality tnQuality = EGlxThumbnailQualityHigh; + if (!aQuality) + { + tnQuality = EGlxThumbnailQualityLow; + } + TRAP(err, HandleThumbnailFetchCompleteL(tnRequest.iId, tnQuality)); } HandleRequestComplete(err); } @@ -297,6 +309,7 @@ const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) { TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete()") + GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete() aErrorCode=%d", aErrorCode); iTnRequestInProgress = EFalse; TInt err = aErrorCode; if(!err) @@ -368,18 +381,19 @@ /// @todo: use default filter so we can ensure we always get correct first item if filters change iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; - iFilterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + iFilterProperties.iSortDirection = EGlxFilterSortDirectionOverrideToDescendingIfDate; iFilterProperties.iLastCaptureDate = ETrue; if( CGlxDataSource::EContainerTypeMonth == containerType ) { - iFilterProperties.iOrigin = EGlxFilterOriginCamera; + iFilterProperties.iOrigin = EGlxFilterOriginAll; AddMonthFilterL(item, iFilterProperties); container = TGlxMediaId(KGlxCollectionRootId); objectDef = &DataSource()->ObjectDef(); } - DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, EQueryResultModeObjectWithFreetexts, container); + DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, + EQueryResultModeItem, container); } else { @@ -433,7 +447,8 @@ } CMdEProperty* lastModifiedDateProperty; - CMdEPropertyDef& lastModifiedDatePropertyDef = aItem->Def().GetPropertyDefL(KPropertyDefNameLastModifiedDate); + CMdEPropertyDef& lastModifiedDatePropertyDef = aItem->Def().GetPropertyDefL( + KPropertyDefNameLastModifiedDate); #ifdef _DEBUG TInt index = // This variable is only required for the assert debug below. If it is not wrapped in an @@ -467,7 +482,8 @@ // i.e. background thumbnail generation // so we get status from CAF to avoid forcing second stage harvest TRAP(err, - ContentAccess::CContent* content = ContentAccess::CContent::NewLC(iTnFileInfo->FilePath()); + ContentAccess::CContent* content = ContentAccess::CContent::NewLC( + iTnFileInfo->FilePath()); content->GetAttribute(ContentAccess::EIsProtected, iTnFileInfo->iIsProtected); CleanupStack::PopAndDestroy(content); ); @@ -512,10 +528,11 @@ void CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest(TInt aError) { TRACER("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest(TInt aError)") + GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest aError=%d", aError); #ifdef USE_S60_TNM if (aError != KErrNone) { - ThumbnailFetchComplete(aError); + ThumbnailFetchComplete(aError, EFalse); } else { @@ -526,11 +543,15 @@ if (tnReq.iSizeClass.iWidth > 0 && tnReq.iSizeClass.iHeight > 0 ) { request->SetThumbnailInfo(iTnFileInfo); + //This function is called number of times as a callback , + //hence not trapping the leaving function which costs time and memory. + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. DataSource()->FetchThumbnailL(iRequest, *this); } else { - ThumbnailFetchComplete(KErrArgument); + GLX_LOG_INFO("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest KErrArgument"); + ThumbnailFetchComplete(KErrArgument, EFalse); } } #else @@ -571,18 +592,19 @@ /// @todo: use default filter so we can ensure we always get correct first item if filters change iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; - iFilterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + iFilterProperties.iSortDirection = EGlxFilterSortDirectionOverrideToDescendingIfDate; iFilterProperties.iLastCaptureDate = ETrue; if( CGlxDataSource::EContainerTypeMonth == containerType ) { - iFilterProperties.iOrigin = EGlxFilterOriginCamera; + iFilterProperties.iOrigin = EGlxFilterOriginAll; AddMonthFilterL(item, iFilterProperties); container = TGlxMediaId(KGlxCollectionRootId); objectDef = &DataSource()->ObjectDef(); } - DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, EQueryResultModeObjectWithFreetexts, container); + DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, + EQueryResultModeItem, container); } else { diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/plugins/glxcollectionpluginimageviewer/src/glxcollectionpluginimageviewer.cpp --- a/engine/collectionframework/plugins/glxcollectionpluginimageviewer/src/glxcollectionpluginimageviewer.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/plugins/glxcollectionpluginimageviewer/src/glxcollectionpluginimageviewer.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -92,8 +92,8 @@ } void CGlxCollectionPluginImageViewer::CpiAttributeAdditionalAttributes( - const TMPXAttribute& aCpiAttribute, - RArray& aAttributeArray) + const TMPXAttribute& /*aCpiAttribute*/, + RArray& /*aAttributeArray*/) { // Nothing to be shared apart from the ones that are commonly loaded. } @@ -146,8 +146,8 @@ } void CGlxCollectionPluginImageViewer::HandleCpiAttributeResponseL( - CMPXMedia* aResponse, TArray aCpiAttributes, - TGlxMediaId aMediaId) + CMPXMedia* /*aResponse*/, TArray aCpiAttributes, + TGlxMediaId /*aMediaId*/) { const TInt attribCount = aCpiAttributes.Count(); diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/plugins/glxcollectionpluginmonths/inc/glxcollectionpluginmonths.h --- a/engine/collectionframework/plugins/glxcollectionpluginmonths/inc/glxcollectionpluginmonths.h Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/plugins/glxcollectionpluginmonths/inc/glxcollectionpluginmonths.h Fri Jun 11 13:38:23 2010 +0300 @@ -78,7 +78,8 @@ * @param aCpiAttribute CPI specific attribute to be constructed later * @param aAttributeArray modifiable list of attributes to be retrieved from data source */ - void CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray); + void CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, + RArray& aAttributeArray); /** * Modifies the response to include all requested CPI specific attributes or Leaves. @@ -86,7 +87,8 @@ * @param aResponse Data Source constructed response to which CPI specific attributes should be added (also contains any required data) * @param aCpiAttributes list of CPI specific attributes to be constructed */ - void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray aMediaIds); + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TArray aMediaIds); /** * Modifies the response to include all requested CPI specific attributes or Leaves. @@ -95,7 +97,8 @@ * @param aCpiAttributes list of CPI specific attributes to be constructed * @param aMediaId CPI specific media Id */ - void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TGlxMediaId aMediaId); + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TGlxMediaId aMediaId); TBool IsUpdateMessageIgnored(CMPXMessage& aMessage); diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonths.cpp --- a/engine/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonths.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonths.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -46,6 +46,13 @@ * @internal reviewed 14/06/2007 by Alex Birkett */ // CONSTANTS +const TInt KYearBufferSize = 8; +const TInt KDateBufferPaddingMin = 10; +const TInt KDateBufferPaddingMax = 20; +const TInt KDateFormat1 = 1; + +const TInt KDateFormat2 = 2; +const TInt KDateFormat3 = 3; // ============================ LOCAL FUNCTIONS ============================== @@ -96,7 +103,8 @@ // CpiAttributeAdditionalAttributes // ---------------------------------------------------------------------------- // -void CGlxCollectionPluginMonths::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray) +void CGlxCollectionPluginMonths::CpiAttributeAdditionalAttributes( + const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray) { TRACER("CGlxCollectionPluginMonths::CpiAttributeAdditionalAttributes"); // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files @@ -185,7 +193,8 @@ // HandleCpiAttributeResponseL // ---------------------------------------------------------------------------- // -void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray aMediaIds) +void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TArray aMediaIds) { TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL"); @@ -211,7 +220,8 @@ User::Leave(KErrNotSupported); } - CMPXMediaArray* mediaArray = aResponse->ValueCObjectL(KMPXMediaArrayContents); + CMPXMediaArray* mediaArray = + aResponse->ValueCObjectL(KMPXMediaArrayContents); CleanupStack::PushL(mediaArray); const TInt arrayCount = mediaArray->Count(); @@ -224,7 +234,8 @@ for (TInt index = 0; index < arrayCount; index++) { - HandleCpiAttributeResponseL((*mediaArray)[index], aCpiAttributes, aMediaIds[index]); + HandleCpiAttributeResponseL((*mediaArray)[index], + aCpiAttributes, aMediaIds[index]); } aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray); @@ -239,7 +250,8 @@ // HandleCpiAttributeResponseL // ---------------------------------------------------------------------------- // -void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TGlxMediaId aMediaId) +void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TGlxMediaId aMediaId) { TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL"); @@ -297,7 +309,7 @@ TPtr formatString = tempTitle->Des(); // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number - HBufC* title = HBufC::NewLC(formatString.Length() + 10); + HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); TPtr ptr = title->Des(); StringLoader::Format(ptr, formatString, -1, usageCount); @@ -393,7 +405,7 @@ break; } } - TBuf<8> yearTitle2; + TBuf yearTitle2; end.FormatL(yearTitle2, KGlxTempMonthYearTitleFormat); HBufC* monthTitle2 = NULL; switch(end.DateTime().Month()) @@ -460,20 +472,20 @@ } } - HBufC* title1 = HBufC::NewLC(formatString.Length() + 20); + HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); TPtr ptr1 = title1->Des(); - HBufC* title2 = HBufC::NewLC(formatString.Length() + 20); + HBufC* title2 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); TPtr ptr2 = title2->Des(); - HBufC* title3 = HBufC::NewLC(formatString.Length() + 20); + HBufC* title3 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); TPtr ptr3 = title3->Des(); - HBufC* title4 = HBufC::NewLC(formatString.Length() + 20); + HBufC* title4 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); TPtr ptr4 = title4->Des(); TPtr monthPtr = monthTitle->Des(); TPtr monthPtr2 = monthTitle2->Des(); StringLoader::Format(ptr1, formatString, 0, monthPtr); - StringLoader::Format(ptr2, ptr1, 1, yearTitle); - StringLoader::Format(ptr3, ptr2, 2, monthPtr2); - StringLoader::Format(ptr4, ptr3, 3, yearTitle2); + StringLoader::Format(ptr2, ptr1, KDateFormat1, yearTitle); + StringLoader::Format(ptr3, ptr2, KDateFormat2, monthPtr2); + StringLoader::Format(ptr4, ptr3, KDateFormat3, yearTitle2); aResponse->SetTextValueL(attr, *title4); @@ -502,7 +514,8 @@ { GLX_LOG_INFO("VideoCount:0,ImageCount:0"); - tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO); + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO); aResponse->SetTextValueL(attr, *tempTitle); } else @@ -512,12 +525,13 @@ { GLX_LOG_INFO1("ImageCount:1,VideoCount:%d",videoCount); - tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_ONE_IMAGE_MULTI_VIDEO); + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_ONE_IMAGE_MULTI_VIDEO); TPtr formatString = tempTitle->Des(); // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number - HBufC* title = HBufC::NewLC(formatString.Length() + 10); + HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); TPtr ptr = title->Des(); StringLoader::Format(ptr, formatString, -1, videoCount); @@ -533,12 +547,13 @@ { GLX_LOG_INFO1("ImageCount: %d,VideoCount:1",imageCount); - tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI_IMAGE_ONE_VIDEO); + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_MULTI_IMAGE_ONE_VIDEO); TPtr formatString = tempTitle->Des(); // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number - HBufC* title = HBufC::NewLC(formatString.Length() + 10); + HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); TPtr ptr = title->Des(); StringLoader::Format(ptr, formatString, -1, imageCount); @@ -554,17 +569,19 @@ { GLX_LOG_INFO2("ImageCount %d,VideoCount %d",imageCount,videoCount); - tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI_IMAGE_MULTI_VIDEO); + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_MULTI_IMAGE_MULTI_VIDEO); + TPtr formatString = tempTitle->Des(); - HBufC* title = HBufC::NewLC(formatString.Length() + 10); + HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); TPtr ptr = title->Des(); - HBufC* title1 = HBufC::NewLC(formatString.Length() + 10); + HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); TPtr ptr1 = title1->Des(); StringLoader::Format(ptr, formatString, 0, imageCount); - StringLoader::Format(ptr1, ptr, 1, videoCount); + StringLoader::Format(ptr1, ptr, KDateFormat1, videoCount); // Set the title in the response. aResponse->SetTextValueL(attr, *title1); @@ -584,36 +601,41 @@ } else if ( aResponse->IsSupported(KGlxMediaCollectionInternalUsageCount) ) { - usageCount = aResponse->ValueTObjectL(KGlxMediaCollectionInternalUsageCount); + usageCount = + aResponse->ValueTObjectL(KGlxMediaCollectionInternalUsageCount); } else { User::Leave(KErrNotSupported); } HBufC* tempTitle = NULL; - + if(0 == usageCount) { - tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO); + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO); + // Set the title in the response. aResponse->SetTextValueL(attr, *tempTitle); CleanupStack::PopAndDestroy(tempTitle); - continue; - } - + continue; + } + else if (1 == usageCount) { - tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_SINGLE); + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_SINGLE); } else { - tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI); + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_MULTI); } TPtr formatString = tempTitle->Des(); // Now create a buffer that will contain the result. needs to be length of format string plus a few extra for the number - HBufC* title = HBufC::NewLC(formatString.Length() + 10); + HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); TPtr ptr = title->Des(); StringLoader::Format(ptr, formatString, -1, usageCount); @@ -651,7 +673,8 @@ { GLX_LOG_INFO("Attribute : GeneralTitle:RootId"); - HBufC* title = LoadLocalizedStringLC(KResourceFile, R_MONTHS_GENERAL_TITLE); + HBufC* title = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_GENERAL_TITLE); aResponse->SetTextValueL(attr, *title); CleanupStack::PopAndDestroy(title); } @@ -659,11 +682,13 @@ { if( aResponse->IsSupported(KGlxMediaCollectionInternalStartDate) ) { - HBufC* tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_ITEM_TITLE); + HBufC* tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_ITEM_TITLE); TPtr formatString = tempTitle->Des(); - TTime month = aResponse->ValueTObjectL(KGlxMediaCollectionInternalStartDate); + TTime month = + aResponse->ValueTObjectL(KGlxMediaCollectionInternalStartDate); _LIT(KGlxTempMonthYearTitleFormat, "%F%Y"); - TBuf<8> yearTitle; + TBuf yearTitle; month.FormatL(yearTitle, KGlxTempMonthYearTitleFormat); HBufC* monthTitle = NULL; switch(month.DateTime().Month()) @@ -730,13 +755,13 @@ } } - HBufC* title1 = HBufC::NewLC(formatString.Length() + 20); + HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); TPtr ptr = title1->Des(); - HBufC* title = HBufC::NewLC(formatString.Length() + 20); + HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); TPtr ptr2 = title->Des(); TPtr monthPtr = monthTitle->Des(); StringLoader::Format(ptr, formatString, 0, monthPtr); - StringLoader::Format(ptr2, ptr, 1, yearTitle); + StringLoader::Format(ptr2, ptr, KDateFormat1, yearTitle); aResponse->SetTextValueL(attr, *title); diff -r 1ee2af37811f -r 6481344a6d67 engine/collectionframework/plugins/tagcollectionplugin/src/glxcollectionplugintags.cpp --- a/engine/collectionframework/plugins/tagcollectionplugin/src/glxcollectionplugintags.cpp Thu May 27 12:51:42 2010 +0300 +++ b/engine/collectionframework/plugins/tagcollectionplugin/src/glxcollectionplugintags.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -102,7 +102,7 @@ TInt attrCount = aAttributeArray.Count(); TBool found = EFalse; - //GLX_DEBUG1("CGlxCollectionPluginTags::CpiAttributeAdditionalAttributes-AttributesCount"); + GLX_DEBUG1("CGlxCollectionPluginTags::CpiAttributeAdditionalAttributes-AttributesCount"); for ( TInt index = 0 ; index < attrCount ; index++) { @@ -169,8 +169,6 @@ HandleCpiAttributeResponseL((*mediaArray)[index], aCpiAttributes, aMediaIds[index]); } - - /// @todo - Can we reset a value. Does it overwrite the original or does it leak? Must test aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray); CleanupStack::PopAndDestroy(mediaArray); } @@ -225,6 +223,9 @@ { tempTitle = LoadLocalizedStringLC(KResourceFile, R_TAG_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; } else { @@ -247,6 +248,9 @@ { tempTitle = LoadLocalizedStringLC(KResourceFile, R_TAG_ITEM_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; } else { diff -r 1ee2af37811f -r 6481344a6d67 gallery/sis/photos.pkg --- a/gallery/sis/photos.pkg Thu May 27 12:51:42 2010 +0300 +++ b/gallery/sis/photos.pkg Fri Jun 11 13:38:23 2010 +0300 @@ -20,7 +20,7 @@ &EN ; Package header -#{"photos"},(0x20000A14),1,1,0, TYPE=SA ,RU +#{"photos"},(0x20000A14),2, 1, 0, TYPE=SA ,RU ; Localised Vendor name %{"Nokia, Qt"} @@ -109,6 +109,8 @@ "\epoc32\release\armv5\urel\glxmodelwrapper.dll" -"!:\sys\bin\glxmodelwrapper.dll" "\epoc32\release\armv5\urel\glxloggerqt.dll" -"!:\sys\bin\glxloggerqt.dll" "\epoc32\release\armv5\urel\glxviews.dll" -"!:\sys\bin\glxviews.dll" +"\epoc32\release\armv5\urel\glxviewutilities.dll" -"!:\sys\bin\glxviewutilities.dll" +"\epoc32\release\armv5\urel\glxzoomwidget.dll" -"!:\sys\bin\glxzoomwidget.dll" ;translations "\epoc32\data\z\resource\qt\translations\photos_en.qm" -"!:\resource\qt\translations\photos.qm" @@ -116,4 +118,7 @@ ;cenrep "\epoc32\data\Z\private\10202BE9\20007194.txt" -"!:\private\10202BE9\20007194.txt" +;splash screen +"\epoc32\data\z\resource\hb\splashml\photos.splashml" -"!:\resource\hb\splashml\photos.splashml" +"\epoc32\data\z\resource\hb\splashml\photos.docml" -"!:\resource\hb\splashml\photos.docml" diff -r 1ee2af37811f -r 6481344a6d67 gallery/sis/photos_stub.pkg --- a/gallery/sis/photos_stub.pkg Thu May 27 12:51:42 2010 +0300 +++ b/gallery/sis/photos_stub.pkg Fri Jun 11 13:38:23 2010 +0300 @@ -98,9 +98,14 @@ "" - "z:\sys\bin\glxlistmodel.dll" "" - "z:\sys\bin\glxmodelwrapper.dll" "" - "z:\sys\bin\glxviews.dll" +"" - "z:\sys\bin\glxviewutilities.dll" +"" - "z:\sys\bin\glxzoomwidget.dll" "" - "z:\private\10202BE9\20007194.txt" "" - "z:\resource\qt\translations\photos.qm" +;splashscreen +"" - "z:\resource\hb\splashml\photos.splashml" +"" - "z:\resource\hb\splashml\photos.docml" diff -r 1ee2af37811f -r 6481344a6d67 inc/glxfiltergeneraldefs.h --- a/inc/glxfiltergeneraldefs.h Thu May 27 12:51:42 2010 +0300 +++ b/inc/glxfiltergeneraldefs.h Fri Jun 11 13:38:23 2010 +0300 @@ -86,6 +86,7 @@ const TMPXAttributeData KGlxFilterGeneralOrigin = { KGlxFilterIdGeneral, EGlxFilterOrigin }; /// TGlxFilterOrigin const TMPXAttributeData KGlxFilterGeneralNoDRM = { KGlxFilterIdGeneral, EGlxFilterNoDRM }; /// TBool const TMPXAttributeData KGlxFilterGeneralNavigationalStateOnly = { KGlxFilterIdGeneral, 0x4000 }; /// TBool +const TMPXAttributeData KGlxFilterGeneralMaxCount = { KGlxFilterIdGeneral, 0x8000 }; // TInt enum TGlxFilterSortOrder { @@ -122,7 +123,8 @@ { EGlxFilterOriginNotUsed=0, EGlxFilterOriginCamera, - EGlxFilterOriginDownload + EGlxFilterOriginDownload, + EGlxFilterOriginAll }; #endif // __T_GLXFILTERGENERALDEFS_H__ diff -r 1ee2af37811f -r 6481344a6d67 inc/glxfilterproperties.h --- a/inc/glxfilterproperties.h Thu May 27 12:51:42 2010 +0300 +++ b/inc/glxfilterproperties.h Fri Jun 11 13:38:23 2010 +0300 @@ -43,6 +43,7 @@ iContainsItem(0), iExcludeAnimation(EFalse), iLastCaptureDate(EFalse), + iMaxCount(KMaxTUint), iThumbnailLoadability(0,0), iPath(NULL), iItemType(EGlxFilterVideoAndImages), @@ -62,6 +63,7 @@ TGlxMediaId iContainsItem; TBool iExcludeAnimation; TBool iLastCaptureDate; + TInt iMaxCount; TSize iThumbnailLoadability; CMPXCollectionPath* iPath; TGlxFilterItemType iItemType; diff -r 1ee2af37811f -r 6481344a6d67 inc/glxlocalisationstrings.h --- a/inc/glxlocalisationstrings.h Thu May 27 12:51:42 2010 +0300 +++ b/inc/glxlocalisationstrings.h Fri Jun 11 13:38:23 2010 +0300 @@ -18,6 +18,7 @@ #ifndef GLXLOCALISATIONSTRINGS_H_ #define GLXLOCALISATIONSTRINGS_H_ +#include "hbglobal.h" //OPTIONS MENU //Options list item @@ -108,4 +109,12 @@ #define GLX_BUTTON_HIDE hbTrId("txt_common_button_hide") +#define GLX_LABEL_TRANSITION_EFFECT hbTrId("txt_photos_setlabel_transistion_effect") +#define GLX_VAL_SMOOTH_FADE hbTrId("txt_photos_setlabel_transistion_effect_val_smooth") + +#define GLX_LABEL_TRANSITION_DELAY hbTrId("txt_photos_setlabel_transistion_delay") +#define GLX_VAL_SLOW hbTrId("txt_photos_setlabel_transistion_delay_val_slow") +#define GLX_VAL_MEDIUM hbTrId("txt_photos_setlabel_transistion_delay_val_medium") +#define GLX_VAL_FAST hbTrId("txt_photos_setlabel_transistion_delay_val_fast") + #endif /* GLXLOCALISATIONSTRINGS_H_ */ diff -r 1ee2af37811f -r 6481344a6d67 inc/glxtvconstants.h --- a/inc/glxtvconstants.h Thu May 27 12:51:42 2010 +0300 +++ b/inc/glxtvconstants.h Fri Jun 11 13:38:23 2010 +0300 @@ -30,7 +30,8 @@ { ETvConnectionChanged = 0, ETvDisplayIsVisible, - ETvDisplayNotVisible + ETvDisplayNotVisible, + EDisconnected }; /** TV size constants */ diff -r 1ee2af37811f -r 6481344a6d67 photos.qrc --- a/photos.qrc Thu May 27 12:51:42 2010 +0300 +++ b/photos.qrc Fri Jun 11 13:38:23 2010 +0300 @@ -7,6 +7,8 @@ data/transitiondown.fxml data/opacity_activate.fxml data/opacity_deactivate.fxml + data/zoomin.fxml + data/zoomout.fxml data/view_flip_hide.fxml data/view_flip_show.fxml data/fullscreentogrid.fxml @@ -17,10 +19,6 @@ data/albumlisttogrid.fxml data/albumlisttogridshow.fxml data/photos.css - data/transitionrotate0.fxml - data/transitionrotate90.fxml - data/transitionrotate180.fxml - data/transitionrotate270.fxml data/grid.docml data/listview.docml data/fullscreen.docml diff -r 1ee2af37811f -r 6481344a6d67 rom/photos.iby --- a/rom/photos.iby Thu May 27 12:51:42 2010 +0300 +++ b/rom/photos.iby Fri Jun 11 13:38:23 2010 +0300 @@ -76,6 +76,8 @@ file=ABI_DIR/BUILD_DIR/glxmodelwrapper.dll SHARED_LIB_DIR/glxmodelwrapper.dll file=ABI_DIR/BUILD_DIR/glxlistmodel.dll SHARED_LIB_DIR/glxlistmodel.dll file=ABI_DIR/BUILD_DIR/glxviews.dll SHARED_LIB_DIR/glxviews.dll +file=ABI_DIR/BUILD_DIR/glxviewutilities.dll SHARED_LIB_DIR/glxviewutilities.dll +file=ABI_DIR/BUILD_DIR/glxzoomwidget.dll SHARED_LIB_DIR/glxzoomwidget.dll S60_APP_EXE(photos) @@ -84,4 +86,6 @@ data=/epoc32/data/Z/private/10202BE9/20007194.txt private/10202BE9/20007194.txt data=/epoc32/data/z/system/install/photos_stub.sis /system/install/photos_stub.sis +data=ZRESOURCE/hb/splashml/photos.splashml RESOURCE_FILES_DIR/hb/splashml/photos.splashml +data=ZRESOURCE/hb/splashml/photos.docml RESOURCE_FILES_DIR/hb/splashml/photos.docml #endif //__PHOTOS_IBY__ \ No newline at end of file diff -r 1ee2af37811f -r 6481344a6d67 traces/OstTraceDefinitions.h --- a/traces/OstTraceDefinitions.h Thu May 27 12:51:42 2010 +0300 +++ b/traces/OstTraceDefinitions.h Fri Jun 11 13:38:23 2010 +0300 @@ -1,19 +1,3 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ #ifndef __OSTTRACEDEFINITIONS_H__ #define __OSTTRACEDEFINITIONS_H__ // OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler diff -r 1ee2af37811f -r 6481344a6d67 tvout/bwins/glxtvoutwrapperu.def --- a/tvout/bwins/glxtvoutwrapperu.def Thu May 27 12:51:42 2010 +0300 +++ b/tvout/bwins/glxtvoutwrapperu.def Fri Jun 11 13:38:23 2010 +0300 @@ -2,10 +2,11 @@ ?itemNotSupported@GlxTvOutWrapper@@QAEXXZ @ 1 NONAME ; void GlxTvOutWrapper::itemNotSupported(void) ??1GlxTvOutWrapper@@QAE@XZ @ 2 NONAME ; GlxTvOutWrapper::~GlxTvOutWrapper(void) ?activateZoom@GlxTvOutWrapper@@QAEX_N@Z @ 3 NONAME ; void GlxTvOutWrapper::activateZoom(bool) - ?setModel@GlxTvOutWrapper@@QAEXPAVQAbstractItemModel@@@Z @ 4 NONAME ; void GlxTvOutWrapper::setModel(class QAbstractItemModel *) - ??0GlxTvOutWrapper@@QAE@XZ @ 5 NONAME ; GlxTvOutWrapper::GlxTvOutWrapper(void) - ?deactivateZoom@GlxTvOutWrapper@@QAEXXZ @ 6 NONAME ; void GlxTvOutWrapper::deactivateZoom(void) - ?setImagetoHDMI@GlxTvOutWrapper@@QAEXXZ @ 7 NONAME ; void GlxTvOutWrapper::setImagetoHDMI(void) + ??0GlxTvOutWrapper@@QAE@XZ @ 4 NONAME ; GlxTvOutWrapper::GlxTvOutWrapper(void) + ?deactivateZoom@GlxTvOutWrapper@@QAEXXZ @ 5 NONAME ; void GlxTvOutWrapper::deactivateZoom(void) + ?fadeSurface@GlxTvOutWrapper@@QAEX_N@Z @ 6 NONAME ; void GlxTvOutWrapper::fadeSurface(bool) + ?setModel@GlxTvOutWrapper@@QAEXPAVQAbstractItemModel@@_N@Z @ 7 NONAME ; void GlxTvOutWrapper::setModel(class QAbstractItemModel *, bool) ?setToCloningMode@GlxTvOutWrapper@@QAEXXZ @ 8 NONAME ; void GlxTvOutWrapper::setToCloningMode(void) - ?setToNativeMode@GlxTvOutWrapper@@QAEXXZ @ 9 NONAME ; void GlxTvOutWrapper::setToNativeMode(void) + ?setImagetoHDMI@GlxTvOutWrapper@@QAEXXZ @ 9 NONAME ; void GlxTvOutWrapper::setImagetoHDMI(void) + ?setToNativeMode@GlxTvOutWrapper@@QAEXXZ @ 10 NONAME ; void GlxTvOutWrapper::setToNativeMode(void) diff -r 1ee2af37811f -r 6481344a6d67 tvout/eabi/glxtvoutwrapperu.def --- a/tvout/eabi/glxtvoutwrapperu.def Thu May 27 12:51:42 2010 +0300 +++ b/tvout/eabi/glxtvoutwrapperu.def Fri Jun 11 13:38:23 2010 +0300 @@ -1,13 +1,14 @@ EXPORTS - _ZN15GlxTvOutWrapper12activateZoomEb @ 1 NONAME - _ZN15GlxTvOutWrapper14deactivateZoomEv @ 2 NONAME - _ZN15GlxTvOutWrapper14setImagetoHDMIEv @ 3 NONAME - _ZN15GlxTvOutWrapper15setToNativeModeEv @ 4 NONAME - _ZN15GlxTvOutWrapper16itemNotSupportedEv @ 5 NONAME - _ZN15GlxTvOutWrapper16setToCloningModeEv @ 6 NONAME - _ZN15GlxTvOutWrapper8setModelEP18QAbstractItemModel @ 7 NONAME - _ZN15GlxTvOutWrapperC1Ev @ 8 NONAME - _ZN15GlxTvOutWrapperC2Ev @ 9 NONAME - _ZN15GlxTvOutWrapperD1Ev @ 10 NONAME - _ZN15GlxTvOutWrapperD2Ev @ 11 NONAME + _ZN15GlxTvOutWrapper11fadeSurfaceEb @ 1 NONAME + _ZN15GlxTvOutWrapper12activateZoomEb @ 2 NONAME + _ZN15GlxTvOutWrapper14deactivateZoomEv @ 3 NONAME + _ZN15GlxTvOutWrapper14setImagetoHDMIEv @ 4 NONAME + _ZN15GlxTvOutWrapper15setToNativeModeEv @ 5 NONAME + _ZN15GlxTvOutWrapper16itemNotSupportedEv @ 6 NONAME + _ZN15GlxTvOutWrapper16setToCloningModeEv @ 7 NONAME + _ZN15GlxTvOutWrapper8setModelEP18QAbstractItemModelb @ 8 NONAME + _ZN15GlxTvOutWrapperC1Ev @ 9 NONAME + _ZN15GlxTvOutWrapperC2Ev @ 10 NONAME + _ZN15GlxTvOutWrapperD1Ev @ 11 NONAME + _ZN15GlxTvOutWrapperD2Ev @ 12 NONAME diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/bwins/glxtvoutu.def --- a/tvout/tvoutengine/bwins/glxtvoutu.def Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/bwins/glxtvoutu.def Fri Jun 11 13:38:23 2010 +0300 @@ -1,16 +1,17 @@ EXPORTS ?ActivateZoom@CGlxHdmiController@@QAEXH@Z @ 1 NONAME ; void CGlxHdmiController::ActivateZoom(int) ?ScreenSizeL@CGlxTv@@QBE?AVTSize@@XZ @ 2 NONAME ; class TSize CGlxTv::ScreenSizeL(void) const - ?SetImageL@CGlxHdmiController@@QAEXABVTDesC16@@PAVCFbsBitmap@@H@Z @ 3 NONAME ; void CGlxHdmiController::SetImageL(class TDesC16 const &, class CFbsBitmap *, int) - ??1CGlxTv@@UAE@XZ @ 4 NONAME ; CGlxTv::~CGlxTv(void) - ??1CGlxHdmiController@@UAE@XZ @ 5 NONAME ; CGlxHdmiController::~CGlxHdmiController(void) - ?NewL@CGlxHdmiController@@SAPAV1@XZ @ 6 NONAME ; class CGlxHdmiController * CGlxHdmiController::NewL(void) + ?NewL@CGlxHdmiController@@SAPAV1@H@Z @ 3 NONAME ; class CGlxHdmiController * CGlxHdmiController::NewL(int) + ?SetImageL@CGlxHdmiController@@QAEXABVTDesC16@@PAVCFbsBitmap@@H@Z @ 4 NONAME ; void CGlxHdmiController::SetImageL(class TDesC16 const &, class CFbsBitmap *, int) + ??1CGlxTv@@UAE@XZ @ 5 NONAME ; CGlxTv::~CGlxTv(void) + ??1CGlxHdmiController@@UAE@XZ @ 6 NONAME ; CGlxHdmiController::~CGlxHdmiController(void) ?IsWidescreen@CGlxTv@@QBEHXZ @ 7 NONAME ; int CGlxTv::IsWidescreen(void) const ?ShiftToPostingMode@CGlxHdmiController@@QAEXXZ @ 8 NONAME ; void CGlxHdmiController::ShiftToPostingMode(void) ?ShiftToCloningMode@CGlxHdmiController@@QAEXXZ @ 9 NONAME ; void CGlxHdmiController::ShiftToCloningMode(void) - ?NewL@CGlxTv@@SAPAV1@AAVMGlxTvObserver@@@Z @ 10 NONAME ; class CGlxTv * CGlxTv::NewL(class MGlxTvObserver &) - ?IsConnected@CGlxTv@@QBEHXZ @ 11 NONAME ; int CGlxTv::IsConnected(void) const - ?ItemNotSupported@CGlxHdmiController@@QAEXXZ @ 12 NONAME ; void CGlxHdmiController::ItemNotSupported(void) - ?IsHDMIConnected@CGlxTv@@QBEHXZ @ 13 NONAME ; int CGlxTv::IsHDMIConnected(void) const - ?DeactivateZoom@CGlxHdmiController@@QAEXXZ @ 14 NONAME ; void CGlxHdmiController::DeactivateZoom(void) + ?IsConnected@CGlxTv@@QBEHXZ @ 10 NONAME ; int CGlxTv::IsConnected(void) const + ?ItemNotSupported@CGlxHdmiController@@QAEXXZ @ 11 NONAME ; void CGlxHdmiController::ItemNotSupported(void) + ?NewL@CGlxTv@@SAPAV1@AAVMGlxTvObserver@@@Z @ 12 NONAME ; class CGlxTv * CGlxTv::NewL(class MGlxTvObserver &) + ?FadeSurface@CGlxHdmiController@@QAEXH@Z @ 13 NONAME ; void CGlxHdmiController::FadeSurface(int) + ?IsHDMIConnected@CGlxTv@@QBEHXZ @ 14 NONAME ; int CGlxTv::IsHDMIConnected(void) const + ?DeactivateZoom@CGlxHdmiController@@QAEXXZ @ 15 NONAME ; void CGlxHdmiController::DeactivateZoom(void) diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/eabi/glxtvoutu.def --- a/tvout/tvoutengine/eabi/glxtvoutu.def Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/eabi/glxtvoutu.def Fri Jun 11 13:38:23 2010 +0300 @@ -1,28 +1,29 @@ EXPORTS - _ZN18CGlxHdmiController12ActivateZoomEi @ 1 NONAME - _ZN18CGlxHdmiController14DeactivateZoomEv @ 2 NONAME - _ZN18CGlxHdmiController16ItemNotSupportedEv @ 3 NONAME - _ZN18CGlxHdmiController18ShiftToCloningModeEv @ 4 NONAME - _ZN18CGlxHdmiController18ShiftToPostingModeEv @ 5 NONAME - _ZN18CGlxHdmiController4NewLEv @ 6 NONAME - _ZN18CGlxHdmiController9SetImageLERK7TDesC16P10CFbsBitmapi @ 7 NONAME - _ZN18CGlxHdmiControllerD0Ev @ 8 NONAME - _ZN18CGlxHdmiControllerD1Ev @ 9 NONAME - _ZN18CGlxHdmiControllerD2Ev @ 10 NONAME - _ZN6CGlxTv4NewLER14MGlxTvObserver @ 11 NONAME - _ZN6CGlxTvD0Ev @ 12 NONAME - _ZN6CGlxTvD1Ev @ 13 NONAME - _ZN6CGlxTvD2Ev @ 14 NONAME - _ZNK6CGlxTv11IsConnectedEv @ 15 NONAME - _ZNK6CGlxTv11ScreenSizeLEv @ 16 NONAME - _ZNK6CGlxTv12IsWidescreenEv @ 17 NONAME - _ZNK6CGlxTv15IsHDMIConnectedEv @ 18 NONAME - _ZTI17CGlxHdmiContainer @ 19 NONAME - _ZTI17CGlxHdmiDecoderAO @ 20 NONAME - _ZTI18CGlxHdmiController @ 21 NONAME - _ZTI22CGlxHdmiSurfaceUpdater @ 22 NONAME - _ZTV17CGlxHdmiContainer @ 23 NONAME - _ZTV17CGlxHdmiDecoderAO @ 24 NONAME - _ZTV18CGlxHdmiController @ 25 NONAME - _ZTV22CGlxHdmiSurfaceUpdater @ 26 NONAME + _ZN18CGlxHdmiController11FadeSurfaceEi @ 1 NONAME + _ZN18CGlxHdmiController12ActivateZoomEi @ 2 NONAME + _ZN18CGlxHdmiController14DeactivateZoomEv @ 3 NONAME + _ZN18CGlxHdmiController16ItemNotSupportedEv @ 4 NONAME + _ZN18CGlxHdmiController18ShiftToCloningModeEv @ 5 NONAME + _ZN18CGlxHdmiController18ShiftToPostingModeEv @ 6 NONAME + _ZN18CGlxHdmiController4NewLEi @ 7 NONAME + _ZN18CGlxHdmiController9SetImageLERK7TDesC16P10CFbsBitmapi @ 8 NONAME + _ZN18CGlxHdmiControllerD0Ev @ 9 NONAME + _ZN18CGlxHdmiControllerD1Ev @ 10 NONAME + _ZN18CGlxHdmiControllerD2Ev @ 11 NONAME + _ZN6CGlxTv4NewLER14MGlxTvObserver @ 12 NONAME + _ZN6CGlxTvD0Ev @ 13 NONAME + _ZN6CGlxTvD1Ev @ 14 NONAME + _ZN6CGlxTvD2Ev @ 15 NONAME + _ZNK6CGlxTv11IsConnectedEv @ 16 NONAME + _ZNK6CGlxTv11ScreenSizeLEv @ 17 NONAME + _ZNK6CGlxTv12IsWidescreenEv @ 18 NONAME + _ZNK6CGlxTv15IsHDMIConnectedEv @ 19 NONAME + _ZTI17CGlxHdmiContainer @ 20 NONAME + _ZTI17CGlxHdmiDecoderAO @ 21 NONAME + _ZTI18CGlxHdmiController @ 22 NONAME + _ZTI22CGlxHdmiSurfaceUpdater @ 23 NONAME + _ZTV17CGlxHdmiContainer @ 24 NONAME + _ZTV17CGlxHdmiDecoderAO @ 25 NONAME + _ZTV18CGlxHdmiController @ 26 NONAME + _ZTV22CGlxHdmiSurfaceUpdater @ 27 NONAME diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/group/glxtvout.mmp --- a/tvout/tvoutengine/group/glxtvout.mmp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/group/glxtvout.mmp Fri Jun 11 13:38:23 2010 +0300 @@ -64,6 +64,7 @@ LIBRARY apgrfx.lib // LIBRARY apmime.lib // For ImageViewer mime type extraction LIBRARY glxlogging.lib +LIBRARY alfdecoderserverclient.lib LIBRARY AccPolicy.lib //For RAccessoryConnection status ID's // Other Dependency Libraries #ifdef __MARM diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/inc/glxhdmicontainer.h --- a/tvout/tvoutengine/inc/glxhdmicontainer.h Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/inc/glxhdmicontainer.h Fri Jun 11 13:38:23 2010 +0300 @@ -63,10 +63,10 @@ void CreateHdmiWindowL(); private: - TRect iRect; - RWsSession iSession; + TRect iRect; + RWsSession iSession; RWindow iWsWindow; - CWsScreenDevice* iScreenDevice; + CWsScreenDevice* iScreenDevice; RWindowGroup iWsWindowGroup; CWindowGc* iWindowGc; TInt iWsWindowGroupID; diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/inc/glxhdmicontroller.h --- a/tvout/tvoutengine/inc/glxhdmicontroller.h Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/inc/glxhdmicontroller.h Fri Jun 11 13:38:23 2010 +0300 @@ -33,7 +33,7 @@ * NewLC * @param1 - Image file path default to NULL */ - IMPORT_C static CGlxHdmiController* NewL(); + IMPORT_C static CGlxHdmiController* NewL(TBool aEfectsOn = EFalse); /* * Destructor @@ -71,11 +71,18 @@ */ IMPORT_C void ShiftToPostingMode(); + /* + * Fadeing of the Surface + * @param1 ETrue - FadeIn ( as in gaining brightness ) + * EFalse - FadeOut ( as in loosing brightness ) + */ + IMPORT_C void FadeSurface(TBool aFadeInOut); + private: /* * Constructor */ - CGlxHdmiController(); + CGlxHdmiController(TBool aEfectsOn); /* * ConstructL @@ -116,6 +123,7 @@ CGlxHdmiContainer* iHdmiContainer; CGlxHdmiSurfaceUpdater* iSurfaceUpdater; TBool iIsImageSupported; // Flag to see if Image is supported + TBool iEffectsOn; }; #endif /* GLXHDMICONTROLLER_H_ */ diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/inc/glxhdmisurfaceupdater.h --- a/tvout/tvoutengine/inc/glxhdmisurfaceupdater.h Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/inc/glxhdmisurfaceupdater.h Fri Jun 11 13:38:23 2010 +0300 @@ -30,7 +30,9 @@ class CGlxActiveCallBack; class CGlxHdmiDecoderAO; class CImageDecoder; +class CAlfCompositionSource; class TSurfaceConfiguration; + class MGlxGenCallback { public: @@ -44,7 +46,7 @@ * NewL */ static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, - CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack); + CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack,TBool aEffectsOn); /* * Destructor @@ -70,10 +72,6 @@ * Deactivate Zoom */ void DeactivateZoom(); - /* - * Zoom in our out depending on parameter - */ - void Zoom(TBool aZoom); /* ShiftToCloningMOde @@ -85,11 +83,18 @@ */ void ShiftToPostingMode(); + /* + * Fadeing of the Surface + * @param1 ETrue - FadeIn ( as in gaining brightness ) + * EFalse - FadeOut ( as in loosing brightness ) + */ + void FadeTheSurface(TBool aFadeInOut); + private: /* * Constructor */ - CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack); + CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack,TBool aEffectsOn); /* * ConstructL() @@ -145,10 +150,20 @@ void CreateHdmiL(TBool aCreateSurface = ETrue); /* + * Zoom in our out depending on parameter + */ + void Zoom(TBool aZoom); + + /* * This if for zoom timer timeout */ static TInt TimeOut(TAny* aSelf); - + + /* + * Animation time out timer + */ + static TInt AnimationTimeOut(TAny* aSelf); + /* * ModifySurface positions of the surface to be displayed on screen */ @@ -189,12 +204,22 @@ */ void InitiateHdmiL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile); + /* + * Animate untill loop is complete + */ + void Animate(); + private: - RWindow* iWindow; // window object - CFbsBitmap* iFsBitmap; // FS bitmap - MGlxGenCallback* iCallBack; // callback to the HdmiContainer window - HBufC* iImagePath; // To store the image uri path + RWindow* iWindow; // window object + CFbsBitmap* iFsBitmap; // FS bitmap + MGlxGenCallback* iCallBack; // callback to the HdmiContainer window + HBufC* iImagePath; // To store the image uri path + TBool iEffectsOn; + TBool iShwFsThumbnail; // If the Fs thumbnail is to be shown before decoding HD images + TBool iIsNonJpeg; // If the item is non jpeg + TBool iFadeIn; // If FadeIn or Out for only SLideshow animation + // GCE Surface RSurfaceUpdateSession iSurfUpdateSession; TSurfaceId iSurfId; // TSurfaceId @@ -210,14 +235,18 @@ void* iSurfBuffer; // Surface buffer CGlxActiveCallBack* iSurfBufferAO; // Surface buffer AO + CAlfCompositionSource* ialfCompositionSurface; + //ICL CGlxHdmiDecoderAO* iGlxDecoderAO; // Internal Image decoder AO CImageDecoder* iImageDecoder; // Image Decoder RFs iFsSession; // RFs TPoint iLeftCornerForZoom; // - CPeriodic* iTimer; // Timer for Zoom - + CPeriodic* iTimer; // Timer for Zoom + CPeriodic* iAnimTimer; // Timer for Animation + TInt iAnimCounter; + // Various objects to store sizes and count TSize iTvScreenSize; // to store the Tv screen size TSize iTargetBitmapSize; // To Store the target bitmap size to display(as per Aspect Ratio) @@ -227,10 +256,7 @@ TBool iBitmapReady; // If the bitmap is decoded and ready TBool iAutoZoomOut; // If the UI has asked for auto zoomout TBool iSurfSessionConnected; // If surface session is connected - TBool iShiftToCloning; - TBool iShwFsThumbnail; // If the Fs thumbnail is to be shown before decoding HD images - TBool iIsNonJpeg; // If the item is non jpeg - + TBool iShiftToCloning; #ifdef _DEBUG TTime iStartTime; TTime iStopTime; diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/inc/glxtv.h --- a/tvout/tvoutengine/inc/glxtv.h Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/inc/glxtv.h Fri Jun 11 13:38:23 2010 +0300 @@ -56,9 +56,10 @@ { public: /** - * Handle TV connection state changes + * Handle TV/HDMI/Headset connection state changes + * @param aChangeType The connection change type */ - virtual void HandleTvConnectionStatusChangedL( ) = 0; + virtual void HandleTvConnectionStatusChangedL(TTvChangeType aChangeType) = 0; }; @@ -135,7 +136,7 @@ /** * @ref MGlxTvConnectionObserver::HandleTvConnectionStatusChangedL */ - void HandleTvConnectionStatusChangedL( ); + void HandleTvConnectionStatusChangedL(TTvChangeType aChangeType); private: // new private methods /** diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/inc/glxtvconnectionmonitor.h --- a/tvout/tvoutengine/inc/glxtvconnectionmonitor.h Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/inc/glxtvconnectionmonitor.h Fri Jun 11 13:38:23 2010 +0300 @@ -84,7 +84,6 @@ */ TBool IsHDMIConnected() const; - private: // From CActive /** * @ref CActive::RunL @@ -130,6 +129,9 @@ // TVout The Connection state TBool iIsHDMIConnected; + // Headset The Connection state + TBool iIsHeadSetConnected; + // The (external device) Accessory Server RAccessoryServer iTvAccServer; diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/src/glxhdmicontainer.cpp --- a/tvout/tvoutengine/src/glxhdmicontainer.cpp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/src/glxhdmicontainer.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -75,7 +75,7 @@ RWindow* CGlxHdmiContainer::GetWindow() { TRACER("CGlxHdmiContainer::GetWindow()"); - return &Window(); + return &iWsWindow; } // ----------------------------------------------------------------------------- diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/src/glxhdmicontroller.cpp --- a/tvout/tvoutengine/src/glxhdmicontroller.cpp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/src/glxhdmicontroller.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -28,10 +28,10 @@ // ----------------------------------------------------------------------------- // NewLC // ----------------------------------------------------------------------------- -EXPORT_C CGlxHdmiController* CGlxHdmiController::NewL() +EXPORT_C CGlxHdmiController* CGlxHdmiController::NewL(TBool aEfectsOn) { TRACER("CGlxHdmiController* CGlxHdmiController::NewL()"); - CGlxHdmiController* self = new (ELeave) CGlxHdmiController(); + CGlxHdmiController* self = new (ELeave) CGlxHdmiController(aEfectsOn); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -167,12 +167,26 @@ } } + +// ----------------------------------------------------------------------------- +// FadeSurface +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxHdmiController::FadeSurface(TBool aFadeInOut) + { + TRACER("CGlxHdmiController::FadeSurface()"); + if (iSurfaceUpdater) + { + iSurfaceUpdater->FadeTheSurface(aFadeInOut); + } + } + // ----------------------------------------------------------------------------- // Constructor // ----------------------------------------------------------------------------- -CGlxHdmiController::CGlxHdmiController(): +CGlxHdmiController::CGlxHdmiController(TBool aEffectsOn): iFsBitmap(NULL), - iStoredImagePath(NULL) + iStoredImagePath(NULL), + iEffectsOn(aEffectsOn) { TRACER("CGlxHdmiController::CGlxHdmiController()"); // Implement nothing here @@ -229,9 +243,9 @@ void CGlxHdmiController::CreateSurfaceUpdaterL(const TDesC& aImageFile) { TRACER("CGlxHdmiController::CreateSurfaceUpdater()"); - RWindow* window = iHdmiContainer->GetWindow(); - iSurfaceUpdater = CGlxHdmiSurfaceUpdater::NewL(window, aImageFile, iFsBitmap, - iHdmiContainer); + iSurfaceUpdater = CGlxHdmiSurfaceUpdater::NewL(iHdmiContainer->GetWindow(), + aImageFile, iFsBitmap,iHdmiContainer, + iEffectsOn); iHdmiContainer->DrawNow(); } diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/src/glxhdmisurfaceupdater.cpp --- a/tvout/tvoutengine/src/glxhdmisurfaceupdater.cpp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/src/glxhdmisurfaceupdater.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -18,8 +18,10 @@ #include #include #include +#include #include #include +#include "alf/alfcompositionclient.h" #include #include @@ -33,11 +35,19 @@ const TInt KMulFactorToCreateBitmap = 4; const TInt KZoomDelay = 10000; +const TInt KAnimationTicker = 26000; +const TInt KAnimationTickerFadeIn = 45000; //100 , is decide for 20 steps of zooming , with each step being 5 pixels. const TInt KMaxZoomLimit = 100; //evey time we zoom , there is a increase in the ht amd width by 10 pixels. const TInt KSingleStepForZoom = 10; +// constants for fade effect +const TInt KFadeSteps = 19; +const TReal32 KFadeEachStep = 0.05f; +const TReal32 KFullTransparent = 0.0f; +const TReal32 KFullOpaque = 1.0f; + _LIT(KMimeJpeg,"image/jpeg"); _LIT(KMimeJpg,"image/jpg"); @@ -46,10 +56,11 @@ // ----------------------------------------------------------------------------- CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL(RWindow* aWindow, const TDesC& aImageFile, CFbsBitmap* aFsBitmap, - MGlxGenCallback* aCallBack) + MGlxGenCallback* aCallBack, + TBool aEffectsOn) { TRACER("CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL()"); - CGlxHdmiSurfaceUpdater* self = new (ELeave) CGlxHdmiSurfaceUpdater(aWindow, aCallBack); + CGlxHdmiSurfaceUpdater* self = new (ELeave) CGlxHdmiSurfaceUpdater(aWindow, aCallBack, aEffectsOn); CleanupStack::PushL(self); self->ConstructL(aFsBitmap,aImageFile); CleanupStack::Pop(self); @@ -63,6 +74,13 @@ { TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()"); ReleaseContent(); + if(iAnimTimer && iAnimTimer->IsActive()) // Check for a CPeriodic Instance + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() - cancel iAnimTimer"); + iAnimTimer->Cancel(); + } + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() - deleteing ialfCompositionSurface"); + delete ialfCompositionSurface; if(iWindow) { iWindow->RemoveBackgroundSurface(ETrue); @@ -72,11 +90,7 @@ iTimer->Cancel(); } delete iTimer; - if (iGlxDecoderAO) - { - delete iGlxDecoderAO; - } - iGlxDecoderAO = NULL; + delete iGlxDecoderAO; iFsSession.Close(); if (iSurfManager) { @@ -151,9 +165,11 @@ // CTor // ----------------------------------------------------------------------------- CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater(RWindow* aWindow, - MGlxGenCallback* aCallBack): + MGlxGenCallback* aCallBack,TBool aEffectsOn): iWindow(aWindow), iCallBack(aCallBack), - iShwFsThumbnail(ETrue), iIsNonJpeg(EFalse) + iEffectsOn(aEffectsOn), + iShwFsThumbnail(ETrue), iIsNonJpeg(EFalse), + iAnimCounter(0) { TRACER("CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater()"); // Implement nothing here @@ -167,7 +183,12 @@ TRACER("CGlxHdmiSurfaceUpdater::ConstructL()"); // Initiate the HDMI by assigning the necessary values InitiateHdmiL(aFsBitmap,aImageFile); - + if (iEffectsOn) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ConstructL() Creating iAnimTimer"); + iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard-1 ); + } + TInt error = iFsSession.Connect (); GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() FsSession Connect error = %d", error); User::LeaveIfError(error); @@ -213,7 +234,7 @@ //Cancel the zoom timers if any if(iTimer->IsActive()) { - GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::UpdateNewImageL() - Cancel Timer"); + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::UpdateNewImageL() - Cancel Zoom Timer"); iTimer->Cancel(); } @@ -296,6 +317,15 @@ GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL Open Surface manager error = %d", error); User::LeaveIfError(error); + //Need to set the surface Hint for the surface to indicate + //that photos do not need overscan compensation and the image will + //be displayed in 720p resolution. + //Refer error: HJVA-85DD25 for more info. + RSurfaceManager::THintPair surfHint; + TUid uid(KNullUid); + uid.iUid = surfaceHints::KSurfaceContent; + surfHint.Set(uid, surfaceHints::EStillImage, EFalse); + RSurfaceManager::TSurfaceCreationAttributesBuf attributes; attributes().iPixelFormat = EUidPixelFormatARGB_8888;// EUidPixelFormatYUV_420Planar; attributes().iSize = iTvScreenSize; @@ -305,7 +335,9 @@ attributes().iAlignment = KMulFactorToCreateBitmap; attributes().iContiguous = EFalse; attributes().iMappable = ETrue; - + attributes().iSurfaceHints = &surfHint; + attributes().iHintCount = 1; + error = iSurfManager->CreateSurface(attributes, iSurfId); GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface error : %d",error); if(error == KErrNoMemory) @@ -720,7 +752,24 @@ void CGlxHdmiSurfaceUpdater::ShiftToCloningMode() { TRACER("CGlxHdmiSurfaceUpdater::ShiftToCloningMode()"); - iWindow->RemoveBackgroundSurface(ETrue); + if (iAnimTimer) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToCloningMode() - cancel iAnimTimer"); + iAnimTimer->Cancel(); + delete iAnimTimer; + iAnimTimer = NULL; + } + if (ialfCompositionSurface) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToCloningMode() - deleteing ialfCompositionSurface"); + delete ialfCompositionSurface; + ialfCompositionSurface= NULL; + } + if (iWindow) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToCloningMode() - window present"); + iWindow->RemoveBackgroundSurface(ETrue); + } } // ----------------------------------------------------------------------------- @@ -729,6 +778,11 @@ void CGlxHdmiSurfaceUpdater::ShiftToPostingMode() { TRACER("CGlxHdmiSurfaceUpdater::ShiftToPostingMode()"); + if (iEffectsOn && !iAnimTimer) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToPostingMode() Creating iAnimTimer"); + iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard-1 ); + } if(iSurfManager) { #ifdef _DEBUG @@ -762,6 +816,18 @@ ProcessTvImage(); // set the surface onto background iWindow->SetBackgroundSurface(iConfig, ETrue); + if (iEffectsOn) + { + //Cancel the Animation timer if any + if(!iAnimTimer->IsActive()) + { + iAnimCounter = 0; + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShowFsThumbnailL() - Cancel iAnimTimer Timer"); + iAnimTimer->Cancel(); + } + + FadeTheSurface(ETrue); + } } // ----------------------------------------------------------------------------- @@ -825,5 +891,91 @@ } } +// ----------------------------------------------------------------------------- +// FadeTheSurface +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::FadeTheSurface(TBool aFadeInOut) + { + TRACER("CGlxHdmiSurfaceUpdater::FadeTheSurface()"); + iFadeIn = aFadeInOut; + if (iEffectsOn && !iAnimTimer) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::FadeTheSurface() Creating iAnimTimer"); + iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard-1 ); + } + if (!ialfCompositionSurface) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShowFsThumbnailL() - Creating alfcompositionsurface"); + ialfCompositionSurface = CAlfCompositionSource::NewL(*iWindow); + } + if(!iAnimTimer->IsActive()) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::FadeTheSurface() - Start Timer"); + if (iFadeIn) + iAnimTimer->Start(0,KAnimationTickerFadeIn,TCallBack( AnimationTimeOut,this )); + else + { + for (TInt i=0;i<=KFadeSteps;i++) + { + GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::Animate - Fading Out %d",i); + ialfCompositionSurface->SetOpacity(KFullOpaque -(i*KFadeEachStep)); + User::After(KAnimationTicker); + } + } + } + else + { + iAnimCounter = 0; + // this case can be when fast swipe in Slideshow + ialfCompositionSurface->SetOpacity(KFullOpaque); // set the opacity to maximum when fast swipe + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::FadeTheSurface() - cancel iAnimTimer"); + iAnimTimer->Cancel(); + } + } +// --------------------------------------------------------------------------- +// AnimationTimeOut +// --------------------------------------------------------------------------- +// +TInt CGlxHdmiSurfaceUpdater::AnimationTimeOut(TAny* aSelf) + { + TRACER("CGlxHdmiSurfaceUpdater::AnimationTimeOut"); + if(aSelf) + { + CGlxHdmiSurfaceUpdater* self = static_cast (aSelf); + if (self) + { + self->Animate(); + } + } + return KErrNone; + } +// ----------------------------------------------------------------------------- +// Animate +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::Animate() + { + TRACER("CGlxHdmiSurfaceUpdater::Animate"); + iAnimCounter++; + if (!ialfCompositionSurface) + { + // createing alfcompositiosource + ialfCompositionSurface = CAlfCompositionSource::NewL(*iWindow); + } + if (iAnimCounter <=KFadeSteps && iFadeIn) + { + GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::Animate - iAnimCounter=%d",iAnimCounter); + // gaining brightness + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::Animate - Fading In"); + ialfCompositionSurface->SetOpacity( KFullTransparent +(iAnimCounter*KFadeEachStep)); + } + else + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::Animate() - cancel iAnimTimer"); + iAnimCounter = 0; + // end the timer , as animation of fade in/out is complete + iAnimTimer->Cancel(); + } + } + diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/src/glxtv.cpp --- a/tvout/tvoutengine/src/glxtv.cpp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/src/glxtv.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -356,25 +356,24 @@ // Called when TV connection state changes //----------------------------------------------------------------------------- // -void CGlxTv::HandleTvConnectionStatusChangedL( ) +void CGlxTv::HandleTvConnectionStatusChangedL(TTvChangeType aChangeType) { - TRACER("CGlxTv::HandleTvConnectionStatusChangedL()"); + TRACER("CGlxTv::HandleTvConnectionStatusChangedL()"); - if ( iTvConnectionMonitor->IsConnected() ) - { - // Start monitoring the environment for changes - MonitorEnvironmentL(); - // Calculate the TV Out screen buffer - CalcTvScreenSzL(); - } - else - { - StopMonitoringEnvironment(); - } - iTvObserver.HandleTvStatusChangedL( ETvConnectionChanged ); - } - - + if (iTvConnectionMonitor->IsConnected()) + { + // Start monitoring the environment for changes + MonitorEnvironmentL(); + // Calculate the TV Out screen buffer + CalcTvScreenSzL(); + } + else + { + StopMonitoringEnvironment(); + } + + iTvObserver.HandleTvStatusChangedL(aChangeType); + } //----------------------------------------------------------------------------- // Retrieve the TV display aspect ratio diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutengine/src/glxtvconnectionmonitor.cpp --- a/tvout/tvoutengine/src/glxtvconnectionmonitor.cpp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutengine/src/glxtvconnectionmonitor.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -68,7 +68,8 @@ CGlxTvConnectionMonitor::CGlxTvConnectionMonitor( MGlxTvConnectionObserver& aConnectionObserver) : CActive(EPriorityStandard), iConnectionObserver(aConnectionObserver), - iIsTvOutConnected(EFalse), iIsHDMIConnected(EFalse) + iIsTvOutConnected(EFalse), iIsHDMIConnected(EFalse), + iIsHeadSetConnected(EFalse) { TRACER("CGlxTvConnectionMonitor"); @@ -179,17 +180,31 @@ TRACER("CGlxTvConnectionMonitor::IssueNotificationL"); TBool previousTvState = iIsTvOutConnected; TBool previousHDMIState = iIsHDMIConnected; - + TBool previousHeadSetState = iIsHeadSetConnected; + TTvChangeType changeType = EDisconnected; + // Update the connection status UpdateConnectionStatusL(); // trigger tvstatus change only when there is actually a change the in the connection and not // for spurious events - if (previousTvState != iIsTvOutConnected || previousHDMIState - != iIsHDMIConnected) + if (previousTvState != iIsTvOutConnected) + { + changeType = iIsTvOutConnected == EFalse ? EDisconnected : ETvConnectionChanged; + GLX_LOG_INFO1("CGlxTvConnectionMonitor::IssueNotificationL - TVOut Connection Changed %d", changeType); + iConnectionObserver.HandleTvConnectionStatusChangedL(changeType); + } + else if (previousHDMIState != iIsHDMIConnected) { - GLX_LOG_INFO("CGlxTvConnectionMonitor::IssueNotificationL - Connection Altered"); - iConnectionObserver.HandleTvConnectionStatusChangedL(); + changeType = iIsHDMIConnected == EFalse ? EDisconnected : ETvConnectionChanged; + GLX_LOG_INFO1("CGlxTvConnectionMonitor::IssueNotificationL - HDMI Connection Changed %d", changeType); + iConnectionObserver.HandleTvConnectionStatusChangedL(changeType); + } + else if (previousHeadSetState != iIsHeadSetConnected) + { + changeType = iIsHeadSetConnected == EFalse ? EDisconnected : ETvConnectionChanged; + GLX_LOG_INFO1("CGlxTvConnectionMonitor::IssueNotificationL - Headset Connection Changed %d", changeType); + iConnectionObserver.HandleTvConnectionStatusChangedL(changeType); } } @@ -201,12 +216,13 @@ { TRACER("CGlxTvConnectionMonitor::UpdateConnectionStatusL()"); - GLX_LOG_INFO2("CGlxTvConnectionMonitor::UpdateConnectionStatusL previousTvState = %d , previousHDMIState = %d", - iIsTvOutConnected,iIsHDMIConnected); + GLX_LOG_INFO3("CGlxTvConnectionMonitor::UpdateConnectionStatusL previousTvState = %d , previousHDMIState = %d iIsHeadSetConnected=%d", + iIsTvOutConnected,iIsHDMIConnected,iIsHeadSetConnected); // reset the states iIsHDMIConnected = EFalse; iIsTvOutConnected = EFalse; + iIsHeadSetConnected = EFalse; //gets the TV status in to the iCurrentAccArray and haves the Latest Accesory in 0-index User::LeaveIfError(iTvAccCon.GetAccessoryConnectionStatus(iCurrentAccArray)); @@ -257,9 +273,15 @@ } } } - } + else if (genId.DeviceTypeCaps(KDTHeadset) + && genId.PhysicalConnectionCaps(KPCWired)) + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::UpdateConnectionStatusL HeadSet connect"); + iIsHeadSetConnected = ETrue; + } + } CleanupStack::PopAndDestroy(nameArray); - GLX_LOG_INFO2("CGlxTvConnectionMonitor::UpdateConnectionStatusL CurrentTvState = %d , CurrentHDMIState = %d", - iIsTvOutConnected,iIsHDMIConnected); + GLX_LOG_INFO3("CGlxTvConnectionMonitor::UpdateConnectionStatusL CurrentTvState = %d , CurrentHDMIState = %d, iIsHeadSetConnected=%d", + iIsTvOutConnected,iIsHDMIConnected,iIsHeadSetConnected); } diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutwrapper/inc/glxtvoutwrapper.h --- a/tvout/tvoutwrapper/inc/glxtvoutwrapper.h Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutwrapper/inc/glxtvoutwrapper.h Fri Jun 11 13:38:23 2010 +0300 @@ -47,7 +47,7 @@ * This also creates the private instance of the wrapper * to pass the model */ - void setModel(QAbstractItemModel* aModel); + void setModel(QAbstractItemModel* aModel,bool aEfectsOn = false); /* * Set the image on to HDMI @@ -84,6 +84,14 @@ * Note : This function is not required if bounce back effect finishes automatically */ void deactivateZoom(); + + /* + * Fadeing of the Surface + * @param1 ETrue - FadeIn ( as in gaining brightness ) + * EFalse - FadeOut ( as in loosing brightness ) + */ + void fadeSurface(bool aFadeInOut); + private: GlxTvOutWrapperPrivate* mTvOutWrapperPrivate; }; diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutwrapper/inc/glxtvoutwrapper_p.h --- a/tvout/tvoutwrapper/inc/glxtvoutwrapper_p.h Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutwrapper/inc/glxtvoutwrapper_p.h Fri Jun 11 13:38:23 2010 +0300 @@ -27,16 +27,17 @@ class CGlxHdmiController; // Converting the QVariant to CFbsBitmap* -Q_DECLARE_METATYPE(CFbsBitmap*); +Q_DECLARE_METATYPE(CFbsBitmap*) class GlxTvOutWrapperPrivate { public: /* * Static method to create an instance + * @param3 - to On the Effects of Slideshow - currently only fade in fade out */ static GlxTvOutWrapperPrivate* Instance(GlxTvOutWrapper* aTvOutWrapper, - QAbstractItemModel* aModel); + QAbstractItemModel* aModel,bool aEfectsOn); /* * destructor @@ -81,6 +82,14 @@ * Deactivate zoom in posting mode. */ void DeactivateZoom(); + + /* + * Fadeing of the Surface + * @param1 ETrue - FadeIn ( as in gaining brightness ) + * EFalse - FadeOut ( as in loosing brightness ) + */ + void FadeSurface(bool aFadeInOut); + private: /* * constructor @@ -90,8 +99,9 @@ /* * constructL() + * @param1 - to On the Effects of Slideshow - currently only fade in fade out */ - void ConstructL(); + void ConstructL(bool aEfectsOn); /* * SetNewImage diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutwrapper/src/glxtvoutwrapper.cpp --- a/tvout/tvoutwrapper/src/glxtvoutwrapper.cpp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutwrapper/src/glxtvoutwrapper.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -43,11 +43,11 @@ // setModel // and Create the private instance to pass the model // ----------------------------------------------------------------------------- -void GlxTvOutWrapper::setModel(QAbstractItemModel* aModel) +void GlxTvOutWrapper::setModel(QAbstractItemModel* aModel,bool aEfectsOn) { if (!mTvOutWrapperPrivate) { - mTvOutWrapperPrivate = GlxTvOutWrapperPrivate::Instance(this,aModel); + mTvOutWrapperPrivate = GlxTvOutWrapperPrivate::Instance(this,aModel,aEfectsOn); } else { @@ -115,4 +115,14 @@ } } +// ----------------------------------------------------------------------------- +// deactivateZoom +// ----------------------------------------------------------------------------- +void GlxTvOutWrapper::fadeSurface(bool aFadeInOut) + { + if(mTvOutWrapperPrivate){ + mTvOutWrapperPrivate->FadeSurface(aFadeInOut); + } + } + // End of file diff -r 1ee2af37811f -r 6481344a6d67 tvout/tvoutwrapper/src/glxtvoutwrapper_p.cpp --- a/tvout/tvoutwrapper/src/glxtvoutwrapper_p.cpp Thu May 27 12:51:42 2010 +0300 +++ b/tvout/tvoutwrapper/src/glxtvoutwrapper_p.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -29,12 +29,12 @@ // Static method to create the private wrapper instance // ----------------------------------------------------------------------------- GlxTvOutWrapperPrivate* GlxTvOutWrapperPrivate::Instance(GlxTvOutWrapper* aTvOutWrapper, - QAbstractItemModel* aModel) + QAbstractItemModel* aModel,bool aEfectsOn) { TRACER("GlxTvOutWrapperPrivate::Instance()"); GlxTvOutWrapperPrivate* self = new GlxTvOutWrapperPrivate(aTvOutWrapper,aModel); if (self){ - TRAPD(err,self->ConstructL()); + TRAPD(err,self->ConstructL(aEfectsOn)); if(err != KErrNone){ delete self; self = NULL; @@ -47,12 +47,12 @@ // ConstructL // This creates the Connection observer and the Hdmi Controller // ----------------------------------------------------------------------------- -void GlxTvOutWrapperPrivate::ConstructL() +void GlxTvOutWrapperPrivate::ConstructL(bool aEfectsOn) { TRACER("GlxTvOutWrapperPrivate::ConstructL()"); iConnectionObserver = CGlxConnectionObserver::NewL(this); if (!iHdmiController) { - iHdmiController = CGlxHdmiController::NewL(); + iHdmiController = CGlxHdmiController::NewL(aEfectsOn); iHdmiConnected = iConnectionObserver->IsHdmiConnected(); } } @@ -181,7 +181,14 @@ { TRACER("GlxTvOutWrapperPrivate::SetToNativeMode()"); iIsPhotosInForeground = true; - if(iHdmiController && iHdmiConnected){ + + if(iHdmiController && iHdmiConnected) { + if (!isImageSetToHdmi){ + } + SetNewImage(); // this case can occur when FS image is opened and set to background + // HDMI cable connected and then FS is brought to foreground + } + else{ iHdmiController->ShiftToPostingMode(); } } @@ -218,6 +225,16 @@ } // ----------------------------------------------------------------------------- +// FadeSurface +// ----------------------------------------------------------------------------- +void GlxTvOutWrapperPrivate::FadeSurface(bool aFadeInOut) + { + if(iHdmiController && iHdmiConnected){ + iHdmiController->FadeSurface(aFadeInOut); + } + } + +// ----------------------------------------------------------------------------- // getSubState // ----------------------------------------------------------------------------- int GlxTvOutWrapperPrivate::getSubState() diff -r 1ee2af37811f -r 6481344a6d67 ui/bwins/glxviewsu.def --- a/ui/bwins/glxviewsu.def Thu May 27 12:51:42 2010 +0300 +++ b/ui/bwins/glxviewsu.def Fri Jun 11 13:38:23 2010 +0300 @@ -1,37 +1,3 @@ EXPORTS - ?qt_metacast@GlxSlideShowEffectEngine@@UAEPAXPBD@Z @ 1 NONAME ; void * GlxSlideShowEffectEngine::qt_metacast(char const *) - ?deRegisterEffect@GlxSlideShowEffectEngine@@QAEXABVQString@@@Z @ 2 NONAME ; void GlxSlideShowEffectEngine::deRegisterEffect(class QString const &) - ?transitionEffectFinished@GlxSlideShowEffectEngine@@QAEXABUEffectStatus@HbEffect@@@Z @ 3 NONAME ; void GlxSlideShowEffectEngine::transitionEffectFinished(struct HbEffect::EffectStatus const &) - ?cancelEffect@GlxSlideShowEffectEngine@@QAEXAAV?$QList@PAVQGraphicsItem@@@@W4GlxEffect@@@Z @ 4 NONAME ; void GlxSlideShowEffectEngine::cancelEffect(class QList &, enum GlxEffect) - ?initTransitionEffect@GlxSlideShowEffectEngine@@AAEXXZ @ 5 NONAME ; void GlxSlideShowEffectEngine::initTransitionEffect(void) - ?slideShowEffectFinished@GlxSlideShowEffectEngine@@QAEXABUEffectStatus@HbEffect@@@Z @ 6 NONAME ; void GlxSlideShowEffectEngine::slideShowEffectFinished(struct HbEffect::EffectStatus const &) - ?tr@GlxSlideShowEffectEngine@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString GlxSlideShowEffectEngine::tr(char const *, char const *, int) - ?slideDelayTime@GlxSlideShowEffectEngine@@QAEHXZ @ 8 NONAME ; int GlxSlideShowEffectEngine::slideDelayTime(void) - ?registerTransitionEffect@GlxSlideShowEffectEngine@@QAEXXZ @ 9 NONAME ; void GlxSlideShowEffectEngine::registerTransitionEffect(void) - ?staticMetaObject@GlxSlideShowEffectEngine@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const GlxSlideShowEffectEngine::staticMetaObject - ??_EGlxSlideShowEffectEngine@@UAE@I@Z @ 11 NONAME ; GlxSlideShowEffectEngine::~GlxSlideShowEffectEngine(unsigned int) - ?trUtf8@GlxSlideShowEffectEngine@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString GlxSlideShowEffectEngine::trUtf8(char const *, char const *, int) - ?createView@GlxViewsFactory@@SAPAVGlxView@@HPAVHbMainWindow@@@Z @ 13 NONAME ; class GlxView * GlxViewsFactory::createView(int, class HbMainWindow *) - ?trUtf8@GlxSlideShowEffectEngine@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString GlxSlideShowEffectEngine::trUtf8(char const *, char const *) - ??1GlxSlideShowEffectEngine@@UAE@XZ @ 15 NONAME ; GlxSlideShowEffectEngine::~GlxSlideShowEffectEngine(void) - ?cleanTransitionEfffect@GlxSlideShowEffectEngine@@AAEXXZ @ 16 NONAME ; void GlxSlideShowEffectEngine::cleanTransitionEfffect(void) - ?runEffect@GlxSlideShowEffectEngine@@QAEXPAVQGraphicsItem@@ABVQString@@@Z @ 17 NONAME ; void GlxSlideShowEffectEngine::runEffect(class QGraphicsItem *, class QString const &) - ?tr@GlxSlideShowEffectEngine@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString GlxSlideShowEffectEngine::tr(char const *, char const *) - ?getStaticMetaObject@GlxSlideShowEffectEngine@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & GlxSlideShowEffectEngine::getStaticMetaObject(void) - ?qt_metacall@GlxSlideShowEffectEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 20 NONAME ; int GlxSlideShowEffectEngine::qt_metacall(enum QMetaObject::Call, int, void * *) - ?isEffectRuning@GlxSlideShowEffectEngine@@QAE_NPAVQGraphicsItem@@@Z @ 21 NONAME ; bool GlxSlideShowEffectEngine::isEffectRuning(class QGraphicsItem *) - ??0GlxSlideShowEffectEngine@@QAE@XZ @ 22 NONAME ; GlxSlideShowEffectEngine::GlxSlideShowEffectEngine(void) - ?runEffect@GlxSlideShowEffectEngine@@QAEXAAV?$QList@PAVQGraphicsItem@@@@ABVQString@@@Z @ 23 NONAME ; void GlxSlideShowEffectEngine::runEffect(class QList &, class QString const &) - ?readSetting@GlxSlideShowEffectEngine@@QAEXXZ @ 24 NONAME ; void GlxSlideShowEffectEngine::readSetting(void) - ?effectPluginResolver@GlxSlideShowEffectEngine@@AAEXXZ @ 25 NONAME ; void GlxSlideShowEffectEngine::effectPluginResolver(void) - ?slideShowMoveDir@GlxSlideShowEffectEngine@@QAE?AW4GlxSlideShowMoveDir@@XZ @ 26 NONAME ; enum GlxSlideShowMoveDir GlxSlideShowEffectEngine::slideShowMoveDir(void) - ?metaObject@GlxSlideShowEffectEngine@@UBEPBUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const * GlxSlideShowEffectEngine::metaObject(void) const - ?runEffect@GlxSlideShowEffectEngine@@QAEXAAV?$QList@PAVQGraphicsItem@@@@W4GlxEffect@@@Z @ 28 NONAME ; void GlxSlideShowEffectEngine::runEffect(class QList &, enum GlxEffect) - ?cancelEffect@GlxSlideShowEffectEngine@@QAEXPAVQGraphicsItem@@@Z @ 29 NONAME ; void GlxSlideShowEffectEngine::cancelEffect(class QGraphicsItem *) - ?setEffect@GlxSlideShowEffectEngine@@QAEXW4GlxEffect@@@Z @ 30 NONAME ; void GlxSlideShowEffectEngine::setEffect(enum GlxEffect) - ?effectFinished@GlxSlideShowEffectEngine@@IAEXXZ @ 31 NONAME ; void GlxSlideShowEffectEngine::effectFinished(void) - ?isEffectRuning@GlxSlideShowEffectEngine@@QAE_NABV?$QList@PAVQGraphicsItem@@@@@Z @ 32 NONAME ; bool GlxSlideShowEffectEngine::isEffectRuning(class QList const &) - ?registerEffect@GlxSlideShowEffectEngine@@QAEXABVQString@@@Z @ 33 NONAME ; void GlxSlideShowEffectEngine::registerEffect(class QString const &) - ?cancelEffect@GlxSlideShowEffectEngine@@QAEXABV?$QList@PAVQGraphicsItem@@@@@Z @ 34 NONAME ; void GlxSlideShowEffectEngine::cancelEffect(class QList const &) - ?deregistertransitionEffect@GlxSlideShowEffectEngine@@QAEXXZ @ 35 NONAME ; void GlxSlideShowEffectEngine::deregistertransitionEffect(void) + ?createView@GlxViewsFactory@@SAPAVGlxView@@HPAVHbMainWindow@@@Z @ 1 NONAME ; class GlxView * GlxViewsFactory::createView(int, class HbMainWindow *) diff -r 1ee2af37811f -r 6481344a6d67 ui/bwins/glxviewutilitiesu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/bwins/glxviewutilitiesu.def Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,36 @@ +EXPORTS + ??0GlxSettingInterface@@IAE@XZ @ 1 NONAME ; GlxSettingInterface::GlxSettingInterface(void) + ?initTransitionEffect@GlxEffectEngine@@AAEXXZ @ 2 NONAME ; void GlxEffectEngine::initTransitionEffect(void) + ?transitionEffectFinished@GlxEffectEngine@@QAEXABUEffectStatus@HbEffect@@@Z @ 3 NONAME ; void GlxEffectEngine::transitionEffectFinished(struct HbEffect::EffectStatus const &) + ?metaObject@GlxEffectEngine@@UBEPBUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const * GlxEffectEngine::metaObject(void) const + ??1GlxEffectEngine@@UAE@XZ @ 5 NONAME ; GlxEffectEngine::~GlxEffectEngine(void) + ??_EGlxEffectEngine@@UAE@I@Z @ 6 NONAME ; GlxEffectEngine::~GlxEffectEngine(unsigned int) + ?qt_metacast@GlxEffectEngine@@UAEPAXPBD@Z @ 7 NONAME ; void * GlxEffectEngine::qt_metacast(char const *) + ?isEffectRuning@GlxEffectEngine@@QAE_NABV?$QList@PAVQGraphicsItem@@@@@Z @ 8 NONAME ; bool GlxEffectEngine::isEffectRuning(class QList const &) + ?getStaticMetaObject@GlxEffectEngine@@SAABUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const & GlxEffectEngine::getStaticMetaObject(void) + ?staticMetaObject@GlxEffectEngine@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const GlxEffectEngine::staticMetaObject + ?registerTransitionEffect@GlxEffectEngine@@QAEXXZ @ 11 NONAME ; void GlxEffectEngine::registerTransitionEffect(void) + ?cleanTransitionEfffect@GlxEffectEngine@@AAEXXZ @ 12 NONAME ; void GlxEffectEngine::cleanTransitionEfffect(void) + ?deregistertransitionEffect@GlxEffectEngine@@QAEXXZ @ 13 NONAME ; void GlxEffectEngine::deregistertransitionEffect(void) + ?instance@GlxSettingInterface@@SAPAV1@XZ @ 14 NONAME ; class GlxSettingInterface * GlxSettingInterface::instance(void) + ?trUtf8@GlxEffectEngine@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString GlxEffectEngine::trUtf8(char const *, char const *, int) + ?effectFinished@GlxEffectEngine@@IAEXXZ @ 16 NONAME ; void GlxEffectEngine::effectFinished(void) + ??0GlxEffectEngine@@QAE@XZ @ 17 NONAME ; GlxEffectEngine::GlxEffectEngine(void) + ?runEffect@GlxEffectEngine@@QAEXAAV?$QList@PAVQGraphicsItem@@@@W4GlxEffect@@@Z @ 18 NONAME ; void GlxEffectEngine::runEffect(class QList &, enum GlxEffect) + ??_EGlxSettingInterface@@UAE@I@Z @ 19 NONAME ; GlxSettingInterface::~GlxSettingInterface(unsigned int) + ?deRegisterEffect@GlxEffectEngine@@QAEXABVQString@@@Z @ 20 NONAME ; void GlxEffectEngine::deRegisterEffect(class QString const &) + ?runEffect@GlxEffectEngine@@QAEXAAV?$QList@PAVQGraphicsItem@@@@ABVQString@@@Z @ 21 NONAME ; void GlxEffectEngine::runEffect(class QList &, class QString const &) + ?trUtf8@GlxEffectEngine@@SA?AVQString@@PBD0@Z @ 22 NONAME ; class QString GlxEffectEngine::trUtf8(char const *, char const *) + ??0GlxSettingInterface@@IAE@AAV0@@Z @ 23 NONAME ; GlxSettingInterface::GlxSettingInterface(class GlxSettingInterface &) + ?cancelEffect@GlxEffectEngine@@QAEXAAV?$QList@PAVQGraphicsItem@@@@W4GlxEffect@@@Z @ 24 NONAME ; void GlxEffectEngine::cancelEffect(class QList &, enum GlxEffect) + ?tr@GlxEffectEngine@@SA?AVQString@@PBD0@Z @ 25 NONAME ; class QString GlxEffectEngine::tr(char const *, char const *) + ?isEffectRuning@GlxEffectEngine@@QAE_NPAVQGraphicsItem@@@Z @ 26 NONAME ; bool GlxEffectEngine::isEffectRuning(class QGraphicsItem *) + ?qt_metacall@GlxEffectEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 27 NONAME ; int GlxEffectEngine::qt_metacall(enum QMetaObject::Call, int, void * *) + ?runEffect@GlxEffectEngine@@QAEXPAVQGraphicsItem@@ABVQString@@@Z @ 28 NONAME ; void GlxEffectEngine::runEffect(class QGraphicsItem *, class QString const &) + ?slideShowEffectFinished@GlxEffectEngine@@QAEXABUEffectStatus@HbEffect@@@Z @ 29 NONAME ; void GlxEffectEngine::slideShowEffectFinished(struct HbEffect::EffectStatus const &) + ?registerEffect@GlxEffectEngine@@QAEXABVQString@@@Z @ 30 NONAME ; void GlxEffectEngine::registerEffect(class QString const &) + ?cancelEffect@GlxEffectEngine@@QAEXABV?$QList@PAVQGraphicsItem@@@@@Z @ 31 NONAME ; void GlxEffectEngine::cancelEffect(class QList const &) + ?tr@GlxEffectEngine@@SA?AVQString@@PBD0H@Z @ 32 NONAME ; class QString GlxEffectEngine::tr(char const *, char const *, int) + ??1GlxSettingInterface@@MAE@XZ @ 33 NONAME ; GlxSettingInterface::~GlxSettingInterface(void) + ?cancelEffect@GlxEffectEngine@@QAEXPAVQGraphicsItem@@@Z @ 34 NONAME ; void GlxEffectEngine::cancelEffect(class QGraphicsItem *) + diff -r 1ee2af37811f -r 6481344a6d67 ui/commandhandlers/commandhandlerbase/src/glxmodelcommandhandler.cpp --- a/ui/commandhandlers/commandhandlerbase/src/glxmodelcommandhandler.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/commandhandlers/commandhandlerbase/src/glxmodelcommandhandler.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -1,20 +1,3 @@ -/* -* 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: -* -*/ - #include #include #include diff -r 1ee2af37811f -r 6481344a6d67 ui/commandhandlers/commoncommandhandlers/src/glxcommandhandlersend.cpp --- a/ui/commandhandlers/commoncommandhandlers/src/glxcommandhandlersend.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/commandhandlers/commoncommandhandlers/src/glxcommandhandlersend.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -36,23 +36,23 @@ void GlxCommandHandlerSend::doHandleUserAction(GlxMediaModel* model,QList indexList) const { - QList fileList; - QString imagePath ; + QStringList fileList; + QString imagePath ; //The Index list is NULL, when the item is selected to be sent from contect menu // and fullscreen view,so that inturn is sending the focused item if(indexList.count() == 0) { imagePath = (model->data(model->index(model->data(model->index(0,0),GlxFocusIndexRole).value(),0),GlxUriRole)).value(); - fileList.append(QVariant(imagePath)); + fileList.append(imagePath); } else { for ( int i = 0; i < indexList.count(); i++) { imagePath = (model->data(indexList[i],GlxUriRole)).value(); - fileList.append(QVariant(imagePath)); + fileList.append(imagePath); } } - mSendUiDialog->init(fileList,true); + mSendUiDialog->send(fileList,true); } diff -r 1ee2af37811f -r 6481344a6d67 ui/eabi/glxviewsu.def --- a/ui/eabi/glxviewsu.def Thu May 27 12:51:42 2010 +0300 +++ b/ui/eabi/glxviewsu.def Fri Jun 11 13:38:23 2010 +0300 @@ -1,33 +1,3 @@ EXPORTS _ZN15GlxViewsFactory10createViewEiP12HbMainWindow @ 1 NONAME - _ZN24GlxSlideShowEffectEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME - _ZN24GlxSlideShowEffectEngine11qt_metacastEPKc @ 3 NONAME - _ZN24GlxSlideShowEffectEngine12cancelEffectEP13QGraphicsItem @ 4 NONAME - _ZN24GlxSlideShowEffectEngine12cancelEffectER5QListIP13QGraphicsItemE9GlxEffect @ 5 NONAME - _ZN24GlxSlideShowEffectEngine12cancelEffectERK5QListIP13QGraphicsItemE @ 6 NONAME - _ZN24GlxSlideShowEffectEngine14effectFinishedEv @ 7 NONAME - _ZN24GlxSlideShowEffectEngine14isEffectRuningEP13QGraphicsItem @ 8 NONAME - _ZN24GlxSlideShowEffectEngine14isEffectRuningERK5QListIP13QGraphicsItemE @ 9 NONAME - _ZN24GlxSlideShowEffectEngine14registerEffectERK7QString @ 10 NONAME - _ZN24GlxSlideShowEffectEngine16deRegisterEffectERK7QString @ 11 NONAME - _ZN24GlxSlideShowEffectEngine16staticMetaObjectE @ 12 NONAME DATA 16 - _ZN24GlxSlideShowEffectEngine19getStaticMetaObjectEv @ 13 NONAME - _ZN24GlxSlideShowEffectEngine20effectPluginResolverEv @ 14 NONAME - _ZN24GlxSlideShowEffectEngine20initTransitionEffectEv @ 15 NONAME - _ZN24GlxSlideShowEffectEngine22cleanTransitionEfffectEv @ 16 NONAME - _ZN24GlxSlideShowEffectEngine23slideShowEffectFinishedERKN8HbEffect12EffectStatusE @ 17 NONAME - _ZN24GlxSlideShowEffectEngine24registerTransitionEffectEv @ 18 NONAME - _ZN24GlxSlideShowEffectEngine24transitionEffectFinishedERKN8HbEffect12EffectStatusE @ 19 NONAME - _ZN24GlxSlideShowEffectEngine26deregistertransitionEffectEv @ 20 NONAME - _ZN24GlxSlideShowEffectEngine9runEffectEP13QGraphicsItemRK7QString @ 21 NONAME - _ZN24GlxSlideShowEffectEngine9runEffectER5QListIP13QGraphicsItemE9GlxEffect @ 22 NONAME - _ZN24GlxSlideShowEffectEngine9runEffectER5QListIP13QGraphicsItemERK7QString @ 23 NONAME - _ZN24GlxSlideShowEffectEngineC1Ev @ 24 NONAME - _ZN24GlxSlideShowEffectEngineC2Ev @ 25 NONAME - _ZN24GlxSlideShowEffectEngineD0Ev @ 26 NONAME - _ZN24GlxSlideShowEffectEngineD1Ev @ 27 NONAME - _ZN24GlxSlideShowEffectEngineD2Ev @ 28 NONAME - _ZNK24GlxSlideShowEffectEngine10metaObjectEv @ 29 NONAME - _ZTI24GlxSlideShowEffectEngine @ 30 NONAME - _ZTV24GlxSlideShowEffectEngine @ 31 NONAME diff -r 1ee2af37811f -r 6481344a6d67 ui/eabi/glxviewutilitiesu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/eabi/glxviewutilitiesu.def Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,39 @@ +EXPORTS + _ZN15GlxEffectEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN15GlxEffectEngine11qt_metacastEPKc @ 2 NONAME + _ZN15GlxEffectEngine12cancelEffectEP13QGraphicsItem @ 3 NONAME + _ZN15GlxEffectEngine12cancelEffectER5QListIP13QGraphicsItemE9GlxEffect @ 4 NONAME + _ZN15GlxEffectEngine12cancelEffectERK5QListIP13QGraphicsItemE @ 5 NONAME + _ZN15GlxEffectEngine14effectFinishedEv @ 6 NONAME + _ZN15GlxEffectEngine14isEffectRuningEP13QGraphicsItem @ 7 NONAME + _ZN15GlxEffectEngine14isEffectRuningERK5QListIP13QGraphicsItemE @ 8 NONAME + _ZN15GlxEffectEngine14registerEffectERK7QString @ 9 NONAME + _ZN15GlxEffectEngine16deRegisterEffectERK7QString @ 10 NONAME + _ZN15GlxEffectEngine16staticMetaObjectE @ 11 NONAME DATA 16 + _ZN15GlxEffectEngine19getStaticMetaObjectEv @ 12 NONAME + _ZN15GlxEffectEngine20initTransitionEffectEv @ 13 NONAME + _ZN15GlxEffectEngine22cleanTransitionEfffectEv @ 14 NONAME + _ZN15GlxEffectEngine23slideShowEffectFinishedERKN8HbEffect12EffectStatusE @ 15 NONAME + _ZN15GlxEffectEngine24registerTransitionEffectEv @ 16 NONAME + _ZN15GlxEffectEngine24transitionEffectFinishedERKN8HbEffect12EffectStatusE @ 17 NONAME + _ZN15GlxEffectEngine26deregistertransitionEffectEv @ 18 NONAME + _ZN15GlxEffectEngine9runEffectEP13QGraphicsItemRK7QString @ 19 NONAME + _ZN15GlxEffectEngine9runEffectER5QListIP13QGraphicsItemE9GlxEffect @ 20 NONAME + _ZN15GlxEffectEngine9runEffectER5QListIP13QGraphicsItemERK7QString @ 21 NONAME + _ZN15GlxEffectEngineC1Ev @ 22 NONAME + _ZN15GlxEffectEngineC2Ev @ 23 NONAME + _ZN15GlxEffectEngineD0Ev @ 24 NONAME + _ZN15GlxEffectEngineD1Ev @ 25 NONAME + _ZN15GlxEffectEngineD2Ev @ 26 NONAME + _ZN19GlxSettingInterface8instanceEv @ 27 NONAME + _ZN19GlxSettingInterfaceC2ERS_ @ 28 NONAME + _ZN19GlxSettingInterfaceC2Ev @ 29 NONAME + _ZN19GlxSettingInterfaceD0Ev @ 30 NONAME + _ZN19GlxSettingInterfaceD1Ev @ 31 NONAME + _ZN19GlxSettingInterfaceD2Ev @ 32 NONAME + _ZNK15GlxEffectEngine10metaObjectEv @ 33 NONAME + _ZTI15GlxEffectEngine @ 34 NONAME + _ZTI19GlxSettingInterface @ 35 NONAME + _ZTV15GlxEffectEngine @ 36 NONAME + _ZTV19GlxSettingInterface @ 37 NONAME + diff -r 1ee2af37811f -r 6481344a6d67 ui/inc/glxcommandhandlers.hrh --- a/ui/inc/glxcommandhandlers.hrh Thu May 27 12:51:42 2010 +0300 +++ b/ui/inc/glxcommandhandlers.hrh Fri Jun 11 13:38:23 2010 +0300 @@ -115,6 +115,8 @@ EGlxCmdContextSend, EGlxCmdContextRename, EGlxCmdSetupItem, + EGlxCmdAppBackground, //when application goes into background + EGlxCmdAppForeground, //when application comes into foreground EGlxCmdAiwBase = 0x6000 }; diff -r 1ee2af37811f -r 6481344a6d67 ui/inc/glxuistd.h --- a/ui/inc/glxuistd.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/inc/glxuistd.h Fri Jun 11 13:38:23 2010 +0300 @@ -56,7 +56,7 @@ typedef enum { NO_EFFECT, - WAVE_EFFECT, + FLIP_EFFECT, SMOOTH_FADE, ZOOM_TO_FACE, TRANSITION_EFFECT, diff -r 1ee2af37811f -r 6481344a6d67 ui/ui.pro --- a/ui/ui.pro Thu May 27 12:51:42 2010 +0300 +++ b/ui/ui.pro Fri Jun 11 13:38:23 2010 +0300 @@ -18,6 +18,8 @@ CONFIG += ordered SUBDIRS = uiengine \ commandhandlers \ + viewutilities \ + widgets \ views \ viewmanagement \ # viewplugins diff -r 1ee2af37811f -r 6481344a6d67 ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h --- a/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h Fri Jun 11 13:38:23 2010 +0300 @@ -26,7 +26,7 @@ #include #include "glxmedialistiterator.h" #include "glxmlwrapper.h" -#include +#include #include "mglxtitlefetcherobserver.h" //Forward Declarations diff -r 1ee2af37811f -r 6481344a6d67 ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp --- a/ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -891,9 +891,22 @@ { GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveBitmap %d",aItemIndex); const TGlxMedia& item = iMediaList->Item( aItemIndex ); + TInt height =KFullScreenTNPTWidth; // default as portrait + TInt width =KFullScreenTNPTHeight; + if (iPtFsContextActivated ) + { + GLX_LOG_INFO("GlxMLWrapperPrivate::RetrieveBitmap - CGlxHdmi :PT"); + width = KFullScreenTNPTWidth; + height = KFullScreenTNPTHeight; + } + else if (iLsFsContextActivated) + { + GLX_LOG_INFO("GlxMLWrapperPrivate::RetrieveBitmap - CGlxHdmi :LS"); + width = KFullScreenTNLSWidth; + height = KFullScreenTNLSHeight; + } TMPXAttribute fsTnAttrib= TMPXAttribute(KGlxMediaIdThumbnail, - GlxFullThumbnailAttributeId(ETrue, KFullScreenTNPTWidth, - KFullScreenTNPTHeight)); + GlxFullThumbnailAttributeId(ETrue, width, height)); const CGlxThumbnailAttribute* fsTnValue = item.ThumbnailAttribute( fsTnAttrib); if (fsTnValue) diff -r 1ee2af37811f -r 6481344a6d67 ui/uiengine/model/mediamodel/src/glxmediamodel.cpp --- a/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -83,7 +83,7 @@ clearExternalItems(); err1 = HAL::Get( HALData::EMemoryRAMFree, freeMemory ); qDebug("####mediaModel : Memory available after cache cleanup = %d and error is = %d ", freeMemory , err1 ); - int err = disconnect(mMLWrapper, SIGNAL(updateIcon(int, HbIcon*)), this, SLOT(itemUpdated1(int, HbIcon*))); + int err = disconnect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType))); err = disconnect(mMLWrapper, SIGNAL(itemCorrupted(int)), this, SLOT(itemCorrupted(int))); err = disconnect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int))); err = disconnect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int))); diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/statehandler/inc/glxstatemanager.h --- a/ui/viewmanagement/statehandler/inc/glxstatemanager.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/statehandler/inc/glxstatemanager.h Fri Jun 11 13:38:23 2010 +0300 @@ -135,6 +135,7 @@ GlxActionHandler *mActionHandler; GlxTNObserver *mTNObserver; int mCollectionId; + bool isProgressbarRunning; }; diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/statehandler/inc/glxtnobserver.h --- a/ui/viewmanagement/statehandler/inc/glxtnobserver.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/statehandler/inc/glxtnobserver.h Fri Jun 11 13:38:23 2010 +0300 @@ -31,14 +31,17 @@ Q_OBJECT public: + /* * constructor */ GlxTNObserver(); + /* * Call back to get the number of TN is left to create. */ - void updateTNCount(int &count); + void updateTNCount(int &count); + /* * It will return the number of TN is left to create. */ @@ -50,6 +53,16 @@ void startTNObserving(); /* + * To start the thumbnail generation in back ground + */ + void startTNMDaemon() ; + + /* + * To stop the thumbnail generation in back ground + */ + void stopTNMDaemon() ; + + /* * Destructor */ ~GlxTNObserver(); diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/statehandler/src/glxstatemanager.cpp --- a/ui/viewmanagement/statehandler/src/glxstatemanager.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/statehandler/src/glxstatemanager.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -53,7 +53,8 @@ mCurrentModel( NULL ), mCurrentState( NULL ), mActionHandler( NULL ), - mTNObserver ( NULL ) + mTNObserver ( NULL ), + isProgressbarRunning ( false ) { qDebug("GlxStateManager::GlxStateManager"); PERFORMANCE_ADV ( d1, "view manager creation time") { @@ -108,6 +109,7 @@ if ( mTNObserver->getTNLeftCount() > 0 ) { mViewManager->launchApplication( GLX_GRIDVIEW_ID, mCurrentModel); mViewManager->launchProgressDialog( mTNObserver->getTNLeftCount() ); + isProgressbarRunning = true ; } else { createModel( GLX_GRIDVIEW_ID ); @@ -148,19 +150,26 @@ } void GlxStateManager::updateTNProgress( int count) -{ - if ( mCurrentState->id() != GLX_GRIDVIEW_ID && count > 0) { +{ + // this is case when progress bar is not showing + // in the case of rename of an image or capture the single item + // it is also launching the progress bar, to avoid this scenario add the check of count more than 5 + if ( mCurrentModel && count > 5 ) { goBack( GLX_GRIDVIEW_ID, ALL_ITEM_S ) ; - } - if ( mCurrentModel && count > 0) { cleanAllModel(); mViewManager->launchProgressDialog ( count ) ; + isProgressbarRunning = true ; } - if ( count == 0 ) { - createModel( mCurrentState->id() ); - mViewManager->setModel( mCurrentModel ); + + if ( isProgressbarRunning ){ + if ( count == 0 ) { + createModel( mCurrentState->id() ); + mViewManager->setModel( mCurrentModel ); + isProgressbarRunning = false; + } + + mViewManager->updateProgressDialog( count ); } - mViewManager->updateProgressDialog( count ); } void GlxStateManager::nextState(qint32 state, int internalState) @@ -218,6 +227,12 @@ void GlxStateManager::goBack(qint32 stateId, int internalState) { qDebug("GlxStateManager::goBack()"); + + //if current state and it internal state is same then no need to do any thing + if ( mCurrentState->id() == stateId && mCurrentState->state() == internalState ) { + return ; + } + GlxState *state = mCurrentState; while ( mCurrentState ) { @@ -551,6 +566,18 @@ emit setupItemsSignal(); break; + case EGlxCmdAppBackground : + if ( isProgressbarRunning ){ + mTNObserver->stopTNMDaemon(); + } + break; + + case EGlxCmdAppForeground : + if ( isProgressbarRunning ){ + mTNObserver->startTNMDaemon(); + } + break; + default : mActionHandler->handleAction(id,mCollectionId); break; diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/statehandler/src/glxtnobserver.cpp --- a/ui/viewmanagement/statehandler/src/glxtnobserver.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/statehandler/src/glxtnobserver.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -18,22 +18,27 @@ #include #include +#include "glxtracer.h" + const TUid KTAGDPSNotification = { 0x2001FD51 }; const TInt KForceBackgroundGeneration = 0x00000010; const TInt KItemsleft = 0x00000008; GlxTNObserver::GlxTNObserver() : mTNMonitor( NULL ) { + TRACER("GlxTNObserver::GlxTNObserver() "); RProperty::Set( KTAGDPSNotification, KForceBackgroundGeneration, ETrue ); } void GlxTNObserver::updateTNCount(int &count) { + TRACER("GlxTNObserver::updateTNCount() "); emit leftTNCount( count ); } int GlxTNObserver::getTNLeftCount() { + TRACER("GlxTNObserver::getTNLeftCount() "); TInt leftVariable = 0; RProperty::Get( KTAGDPSNotification, KItemsleft, leftVariable ); //To:Do error handling @@ -42,10 +47,24 @@ void GlxTNObserver::startTNObserving() { + TRACER("GlxTNObserver::startTNObserving() "); mTNMonitor = CGlxTNMonitor::NewL( this ); } +void GlxTNObserver::startTNMDaemon() +{ + TRACER("GlxTNObserver::startTNMDaemon() "); + RProperty::Set( KTAGDPSNotification, KForceBackgroundGeneration, ETrue ); +} + +void GlxTNObserver::stopTNMDaemon() +{ + TRACER("GlxTNObserver::stopTNMDaemon() "); + RProperty::Set( KTAGDPSNotification, KForceBackgroundGeneration, EFalse ); +} + GlxTNObserver::~GlxTNObserver() { + TRACER("GlxTNObserver::~GlxTNObserver() "); delete mTNMonitor; } diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/viewmanager/inc/glxmainwindoweventfilter.h --- a/ui/viewmanagement/viewmanager/inc/glxmainwindoweventfilter.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/viewmanager/inc/glxmainwindoweventfilter.h Fri Jun 11 13:38:23 2010 +0300 @@ -1,20 +1,3 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - #ifndef GLXMAINWINDOWEVENTFILTER_H #define GLXMAINWINDOWEVENTFILTER_H #include diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/viewmanager/inc/glxviewmanager.h --- a/ui/viewmanagement/viewmanager/inc/glxviewmanager.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/viewmanager/inc/glxviewmanager.h Fri Jun 11 13:38:23 2010 +0300 @@ -34,7 +34,7 @@ class HbAction; class QItemSelectionModel; class HbMenu; -class GlxSlideShowEffectEngine; +class GlxEffectEngine; class HbProgressDialog; class GlxMainWindowEventFilter; @@ -200,7 +200,7 @@ HbMainWindow *mMainWindow; //main window pointer, It have ownership only if HbAction *mBackAction; // For back soft key GlxMenuManager *mMenuManager; //Pointer of menu manger to add the menu in the view - GlxSlideShowEffectEngine *mEffectEngine; //To run the animation in between view transition + GlxEffectEngine *mEffectEngine; //To run the animation in between view transition QList mActionList; //Tool bar action list QList mMarkingActionList; //marking mode tool bar action list HbToolBar *mViewToolBar; //view tool bar diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/viewmanager/src/glxviewmanager.cpp --- a/ui/viewmanagement/viewmanager/src/glxviewmanager.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/viewmanager/src/glxviewmanager.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -71,9 +71,9 @@ { mMenuManager = new GlxMenuManager(mMainWindow); addBackSoftKeyAction(); - createToolBar(); + addConnection(); - mView->addToolBar(mViewToolBar); + mMenuManager->addMenu( mView->viewId(), mView->menu() ); mMenuManager->setModel( mModel ); } @@ -84,6 +84,18 @@ PERFORMANCE_ADV ( viewMgrD1, "View Creation time" ) { mView = resolveView(id); } + createToolBar(); + mView->addToolBar(mViewToolBar); + + /* We are showing the toolBar before activating the + * view. This is done to avoid the animation effect seen otherwise + * when the tool bar comes up. + * + * If animation Effect is not removed, it leads to flickering effect + * since we are creating a new tool bar..although a fake tool bar was + * already created on the splashscreen + * + */ mView->activate(); PERFORMANCE_ADV ( viewMgrD3, "Set Model time") @@ -145,7 +157,7 @@ //create and registered the effect if ( mEffectEngine == NULL ) { - mEffectEngine = new GlxSlideShowEffectEngine(); + mEffectEngine = new GlxEffectEngine(); mEffectEngine->registerTransitionEffect(); connect( mEffectEngine, SIGNAL( effectFinished() ), this, SLOT( effectFinished() ) ); } diff -r 1ee2af37811f -r 6481344a6d67 ui/viewmanagement/viewmanager/viewmanager.pro --- a/ui/viewmanagement/viewmanager/viewmanager.pro Thu May 27 12:51:42 2010 +0300 +++ b/ui/viewmanagement/viewmanager/viewmanager.pro Fri Jun 11 13:38:23 2010 +0300 @@ -23,13 +23,15 @@ ../../views/viewbase/inc \ ../../views/effectengine/inc \ ../../../loggers/loggerqt/inc \ - ../../../commonutilities/externalutility/inc + ../../../commonutilities/externalutility/inc \ + ../../viewutilities/effectengine/inc \ CONFIG += hb LIBS += -lglxexternalutility.dll \ -lglxviews.dll \ - -lglxloggerqt.dll + -lglxloggerqt.dll \ + -lglxviewutilities.dll DEFINES += BUILD_VIEWMANAGER diff -r 1ee2af37811f -r 6481344a6d67 ui/views/detailsview/src/glxdetailsview.cpp --- a/ui/views/detailsview/src/glxdetailsview.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/detailsview/src/glxdetailsview.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -33,7 +33,6 @@ #include "glxviewids.h" #include "glxicondefs.h" //Contains the icon names/Ids #include "glxmodelparm.h" -#include "glxmediamodel.h" #include "glxdetailsview.h" #include "glxfavmediamodel.h" #include diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/effectplugin/inc/glxbackwardtransitionplugin.h --- a/ui/views/effectengine/effectplugin/inc/glxbackwardtransitionplugin.h Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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: ?Description -* -*/ - -#ifndef GLXBACKWARDTRANSITIONPLUGIN_H -#define GLXBACKWARDTRANSITIONPLUGIN_H - -#include "glxeffectpluginbase.h" - -class GlxBackwardTransitionPlugin : public GlxEffectPluginBase -{ -public : - GlxBackwardTransitionPlugin(); - ~GlxBackwardTransitionPlugin(); - QList getEffectFileList() { return mEffectFileList ; } - -private : - QList mEffectFileList; -}; - -#endif /*GLXBACKWARDTRANSITIONPLUGIN_H*/ - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/effectplugin/inc/glxeffectpluginbase.h --- a/ui/views/effectengine/effectplugin/inc/glxeffectpluginbase.h Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: ?Description -* -*/ - -#ifndef GLXEFFECTPLUGINBASE_H -#define GLXEFFECTPLUGINBASE_H - -#include -#include -#include - -class GlxEffectPluginBase -{ - -public : - GlxEffectPluginBase() { } - virtual ~GlxEffectPluginBase() {} - virtual QList getEffectFileList() = 0; - virtual void setUpItems( QList< QGraphicsItem * > & items ) { Q_UNUSED( items ) } -/* - * second animation will run same time(false) or later (true) - */ - virtual bool isAnimationLater(int index) - { - Q_UNUSED( index ) - return false ; - } - virtual QString ItemType() { return QString("HbIconItem") ; } - virtual QGraphicsItem * animationItem() { return NULL; } -}; - -#endif /*GLXEFFECTPLUGINBASE_H*/ \ No newline at end of file diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/effectplugin/inc/glxfadeplugin.h --- a/ui/views/effectengine/effectplugin/inc/glxfadeplugin.h Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: ?Description -* -*/ - -#ifndef GLXFADEPLUGIN_H -#define GLXFADEPLUGIN_H - -#include "glxeffectpluginbase.h" - -class GlxFadePlugin : public GlxEffectPluginBase -{ -public : - GlxFadePlugin(); - ~GlxFadePlugin(); - QList getEffectFileList() { return mEffectFileList ; } - /* - * setup the item postion and set the mItem value - */ - void setUpItems( QList< QGraphicsItem * > & items ); -/* - * second animation will be run later - */ - bool isAnimationLater(int index) ; - QGraphicsItem * animationItem() - { - mItem->show(); - return mItem ; - } - -private : - QList mEffectFileList; - QGraphicsItem *mItem; -}; - -#endif /*GLXFADEPLUGIN_H*/ \ No newline at end of file diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/effectplugin/inc/glxforwardtransitionplugin.h --- a/ui/views/effectengine/effectplugin/inc/glxforwardtransitionplugin.h Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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: ?Description -* -*/ - - -#ifndef GLXFORWARDTRANSITIONPLUGIN_H -#define GLXFORWARDTRANSITIONPLUGIN_H - -#include "glxeffectpluginbase.h" - -class GlxForwardTransitionPlugin : public GlxEffectPluginBase -{ -public : - GlxForwardTransitionPlugin(); - ~GlxForwardTransitionPlugin(); - QList getEffectFileList() { return mEffectFileList; } - - /* - * setup the item postion and set the mItem value - */ - void setUpItems( QList< QGraphicsItem * > & items ); - /* - * second animation will be run later - */ - bool isAnimationLater(int index) ; - - QGraphicsItem * animationItem() - { - mItem->show(); - return mItem ; - } - -private : - QList mEffectFileList; - QGraphicsItem *mItem; -}; - -#endif /*GLXFORWARDTRANSITIONPLUGIN_H*/ - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/effectplugin/src/glxbackwardtransitionplugin.cpp --- a/ui/views/effectengine/effectplugin/src/glxbackwardtransitionplugin.cpp Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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: ?Description -* -*/ - -#include "glxbackwardtransitionplugin.h" - - -GlxBackwardTransitionPlugin::GlxBackwardTransitionPlugin() -{ - mEffectFileList.append(QString(":/data/transtionbackward.fxml")); - mEffectFileList.append(QString(":/data/transtion.fxml")); -} - -GlxBackwardTransitionPlugin::~GlxBackwardTransitionPlugin() -{ - mEffectFileList.clear(); -} - - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/effectplugin/src/glxfadeplugin.cpp --- a/ui/views/effectengine/effectplugin/src/glxfadeplugin.cpp Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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: ?Description -* -*/ - - -#include "glxfadeplugin.h" - -GlxFadePlugin::GlxFadePlugin() : mItem(NULL) -{ - mEffectFileList.append(QString(":/data/opacity_deactivate.fxml")); - mEffectFileList.append(QString(":/data/opacity_activate.fxml")); -} - -void GlxFadePlugin::setUpItems( QList< QGraphicsItem * > & items ) -{ - if ( items.count() < 2 ) - return; - - mItem = items.at(1); - //mItem->hide(); - mItem->setPos(0,0); - items.at(0)->setPos(0,0); -} - -bool GlxFadePlugin::isAnimationLater(int index) -{ - /*if ( index == 1) { - return true; - }*/ - return false; -} - -GlxFadePlugin::~GlxFadePlugin() -{ - mEffectFileList.clear(); -} - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/effectplugin/src/glxforwardtransitionplugin.cpp --- a/ui/views/effectengine/effectplugin/src/glxforwardtransitionplugin.cpp Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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: ?Description -* -*/ - - -#include "glxforwardtransitionplugin.h" - -GlxForwardTransitionPlugin::GlxForwardTransitionPlugin() -{ - mEffectFileList.append(QString(":/data/view_flip_hide.fxml")); - mEffectFileList.append(QString(":/data/view_flip_show.fxml")); -} - -void GlxForwardTransitionPlugin::setUpItems( QList< QGraphicsItem * > & items ) -{ - if ( items.count() < 2 ) - return; - - mItem = items.at(1); - mItem->hide(); - mItem->setPos(0,0); - items.at(0)->setPos(0,0); -} - -bool GlxForwardTransitionPlugin::isAnimationLater(int index) -{ - if ( index == 1) { - return true; - } - return false; -} - -GlxForwardTransitionPlugin::~GlxForwardTransitionPlugin() -{ - mEffectFileList.clear(); -} - - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/inc/glxeffectengine.h --- a/ui/views/effectengine/inc/glxeffectengine.h Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +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: ?Description -* -*/ - - -#ifndef GLXEFFECTENGINE_H -#define GLXEFFECTENGINE_H - -#ifdef BUILD_GLXVIEWS -#define GLX_VIEW_EXPORT Q_DECL_EXPORT -#else -#define GLX_VIEW_EXPORT Q_DECL_IMPORT -#endif - -#include -#include -#include -#include -#include -#include "glxuistd.h" - -class XQSettingsKey; -class XQSettingsManager; -class QStringList; -typedef enum -{ - NO_MOVE, - MOVE_FORWARD, - MOVE_BACKWARD, -} GlxSlideShowMoveDir; - -/* - * This class is used for read the setting either from File System or from some xml file. - * This Setting is used by both server and client, but It is coupled with the server and client retreive the data through the server - */ -class GlxSlideShowSetting -{ -public : - GlxSlideShowSetting(int slideDelayTime = 0, GlxEffect effect = NO_EFFECT, GlxSlideShowMoveDir moveDir = NO_MOVE); - ~GlxSlideShowSetting(); - int slideDelayTime ( ) { return mSlideDelayTime; } - GlxEffect effect() { return mEffect ; } - void setEffect(GlxEffect effect) { mEffect = effect ;} - GlxSlideShowMoveDir slideShowMoveDir() { return mMoveDir; } - /* Returns the index to the selected transition effect - This value is fetched from Central repository */ - int slideShowEffectIndex() ; - /*SlideShowSettingsView will call this API to set the index of the transition effect chosen. - This data will be written to the Central Repository*/ - void setslideShowEffectIndex( int index ); - - /* Returns the index to the selected transition delay / - This value is fetched from Central repository */ - int slideShowDelayIndex(); - - /*SlideShowSettingsView will call this API to set the index of the transition delay chosen. - This data will be written to the Central Repository*/ - void setSlideShowDelayIndex( int index ); - - /*This will return the list of effects as available in the central repository */ - QStringList slideShowEffectList(); - -/* - * This funtion read the user setting store in a file system. - * - */ - void readSlideShowSetting(); - -private : - int mSlideDelayTime; //user set time interval in between showing slide - GlxEffect mEffect; //user defined effect, To:Do It is either some integer value or some enum - GlxSlideShowDelay mDelay; - GlxSlideShowMoveDir mMoveDir; //user defined slide move direction - QStringList mEffectList; - XQSettingsManager *mSettingsManager; - XQSettingsKey *mTransitionEffectCenrepKey; - XQSettingsKey *mTransitionDelayCenrepKey; - XQSettingsKey *mWaveEffectCenRepKey; - XQSettingsKey *mFadeEffectCenRepKey; - XQSettingsKey *mZoomEffectCenRepKey; - XQSettingsKey *mSlowCenRepKey; - XQSettingsKey *mMediumCenRepKey; - XQSettingsKey *mFastCenRepKey; -}; - -/* - * This class have the views transition effect information - */ -class GlxTransitionEffectSetting -{ -public : - GlxTransitionEffectSetting(GlxEffect effect); - ~GlxTransitionEffectSetting(); - - QList effectFileList() { return mEffectFileList ; } - QList itemType() { return mItemType ; } - QList eventType() { return mEventType ; } - bool isTransitionLater() { return mTransitionLater ; } - QGraphicsItem * animationItem() { return mItem ; } - - void setEffectFileList( QList & effectFileList) { mEffectFileList = effectFileList ; } - void setItemTypes( QList & itemType) { mItemType = itemType; } - void setEventTypes( QList & eventType) { mEventType = eventType ; } - void setTransitionLater(bool transitionLater) { mTransitionLater = transitionLater ; } - void setAnimationItem(QGraphicsItem *item) { mItem = item ;} - int count() { return mEffectFileList.count() ; } - -private : - void init(); - -private : - GlxEffect mEffect; //transition effect type - bool mTransitionLater; //second animation will run same time(false) or later (true) - QGraphicsItem *mItem; //it will used in the case of animation run later - QList mEffectFileList; //list of fxml file used for animation - QList mItemType; //list of item type - QList mEventType; //list of event type -}; - - -/* - * It is customise class for Photo Application to run the effect. - * In the case of effect setting required to read through File System: - * first read the setting, register the effect and then run the effect. - * In the case of run the client effect: first Set the effect, register the effect and then run the effect. - */ - -class GlxEffectPluginBase; - -class GLX_VIEW_EXPORT GlxSlideShowEffectEngine : public QObject -{ - Q_OBJECT - -public: - GlxSlideShowEffectEngine( ); - ~GlxSlideShowEffectEngine(); - int slideDelayTime ( ) { return mSlideShowSetting.slideDelayTime(); } - GlxSlideShowMoveDir slideShowMoveDir() { return mSlideShowSetting.slideShowMoveDir(); } - void readSetting() { mSlideShowSetting.readSlideShowSetting(); } - void setEffect(GlxEffect effect) { mSlideShowSetting.setEffect( effect ); } - - void registerEffect(const QString &itemType); - void deRegisterEffect(const QString &itemType); - -/* To register a set of transition effect - * e.g "grid to full screeen", "fullscreen to grid" - * - */ - void registerTransitionEffect(); - void deregistertransitionEffect(); - - void runEffect(QGraphicsItem * item, const QString & itemType ); - void runEffect(QList< QGraphicsItem * > & items, const QString & itemType ); - void runEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect); - - void cancelEffect(QGraphicsItem * item); - void cancelEffect( const QList< QGraphicsItem * > & items ); - void cancelEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect); - - bool isEffectRuning(QGraphicsItem * item); - bool isEffectRuning(const QList< QGraphicsItem * > & items); - -signals: - void effectFinished(); - -public slots: - void slideShowEffectFinished( const HbEffect::EffectStatus &status ); - void transitionEffectFinished( const HbEffect::EffectStatus &status ); - -private: - void effectPluginResolver(); - void initTransitionEffect(); - void cleanTransitionEfffect(); - -private: - GlxSlideShowSetting mSlideShowSetting; - int mNbrEffectRunning; //containe the number of effect running - GlxEffectPluginBase *mEffectPlugin; - QHash mTransitionEffectList; - GlxEffect mTransitionEffect; -}; - -#endif /*GLXEFFECTENGINE_H*/ diff -r 1ee2af37811f -r 6481344a6d67 ui/views/effectengine/src/glxeffectengine.cpp --- a/ui/views/effectengine/src/glxeffectengine.cpp Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,468 +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: ?Description -* -*/ - - -#include -#include "glxeffectpluginbase.h" -#include "glxforwardtransitionplugin.h" -#include "glxbackwardtransitionplugin.h" -#include "glxfadeplugin.h" -#include - -#include -#include -#include -const TUint32 KGlxTransitionEffect = 0x1; -const TUint32 KGlxTransitionDelay = 0x2; -const TUint32 KGlxSlow = 0x3; -const TUint32 KGlxMeduim = 0x4; -const TUint32 KGlxFast = 0x5; -const TUint32 KGlxWaveEffect = 0x6; -const TUint32 KGlxFadeEffect = 0x7; -const TUint32 KGlxZoomToFaceEffect = 0x8; -const TUint32 KCRUidGallery = 0x20007194; -GlxSlideShowSetting::GlxSlideShowSetting( int slideDelayTime, GlxEffect effect, GlxSlideShowMoveDir moveDir ) - : mSlideDelayTime(slideDelayTime), - mEffect ( effect), - mMoveDir ( moveDir) -{ - mSettingsManager = new XQSettingsManager(); - mTransitionEffectCenrepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery , KGlxTransitionEffect); - mTransitionDelayCenrepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery , KGlxTransitionDelay); - mSlowCenRepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxSlow); - mMediumCenRepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxMeduim); - mFastCenRepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxFast); - - mWaveEffectCenRepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxWaveEffect ); - mFadeEffectCenRepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxFadeEffect); - mZoomEffectCenRepKey= new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidGallery , KGlxZoomToFaceEffect ); -} - -GlxSlideShowSetting::~GlxSlideShowSetting( ) -{ - delete mFastCenRepKey; - delete mMediumCenRepKey; - delete mSlowCenRepKey; - delete mZoomEffectCenRepKey; - delete mFadeEffectCenRepKey; - delete mWaveEffectCenRepKey; - delete mTransitionDelayCenrepKey; - delete mTransitionEffectCenrepKey; - delete mSettingsManager; -} -int GlxSlideShowSetting::slideShowDelayIndex() -{ - QVariant effectvalue = mSettingsManager->readItemValue(*mTransitionDelayCenrepKey); - return effectvalue.toInt(); -} -void GlxSlideShowSetting::setSlideShowDelayIndex( int index ) -{ - mSettingsManager->writeItemValue(*mTransitionDelayCenrepKey, index); -} -QStringList GlxSlideShowSetting::slideShowEffectList() -{ - if(mSettingsManager->readItemValue(*mWaveEffectCenRepKey).toInt() == WAVE_EFFECT) - mEffectList<<"Flip"; - if(mSettingsManager->readItemValue(*mFadeEffectCenRepKey).toInt() == SMOOTH_FADE) - mEffectList<<"Fade"; - if(mSettingsManager->readItemValue(*mZoomEffectCenRepKey).toInt() == ZOOM_TO_FACE) - mEffectList<<"Zoom to face"; - return mEffectList; -} -int GlxSlideShowSetting::slideShowEffectIndex() -{ - QVariant effectvalue = mSettingsManager->readItemValue(*mTransitionEffectCenrepKey); - return effectvalue.toInt(); -} -void GlxSlideShowSetting::setslideShowEffectIndex( int index ) -{ - mEffect = ( GlxEffect ) ( index + 1 ) ; - mSettingsManager->writeItemValue(*mTransitionEffectCenrepKey, index); -} -void GlxSlideShowSetting::readSlideShowSetting() -{ -//To:Do read from the file system - QVariant effectvalue = mSettingsManager->readItemValue(*mTransitionDelayCenrepKey); - switch (effectvalue.toInt()) { - case SLOW: - mSlideDelayTime = mSettingsManager->readItemValue(*mSlowCenRepKey).toInt(); - break; - case MEDIUM: - mSlideDelayTime = mSettingsManager->readItemValue(*mMediumCenRepKey).toInt(); - break; - case FAST: - mSlideDelayTime = mSettingsManager->readItemValue(*mFastCenRepKey).toInt(); - break; - default: - mSlideDelayTime = 3000; - break; - } - mEffect = ( GlxEffect ) ( mSettingsManager->readItemValue(*mTransitionEffectCenrepKey).toInt() + 1 ) ; - mMoveDir = MOVE_FORWARD; - qDebug("GlxSlideShowSetting::readSlideShowSetting() slide delay time %d effect %d move direction %d", mSlideDelayTime, mEffect, mMoveDir); -} - - -GlxTransitionEffectSetting::GlxTransitionEffectSetting(GlxEffect effect): mEffect(effect), mTransitionLater(false), mItem(0) -{ - qDebug("GlxTransitionEffectSetting::GlxTransitionEffectSetting() effect id %d ", effect); - mEffectFileList.clear(); - mItemType.clear(); - mEventType.clear(); - init(); -} - -void GlxTransitionEffectSetting::init() -{ - qDebug("GlxTransitionEffectSetting::init() effect id %d ", mEffect); - - switch( mEffect ) { - case GRID_TO_FULLSCREEN : - mEffectFileList.append( QString(":/data/gridtofullscreenhide.fxml")); - mItemType.append( QString("HbGridViewItem") ); - mEventType.append(QString("click1") ); - - mEffectFileList.append( QString(":/data/gridtofullscreenshow.fxml")); - mItemType.append( QString("HbView") ); - mEventType.append(QString("click2") ); - break; - - case FULLSCREEN_TO_GRID : - mEffectFileList.append( QString(":/data/fullscreentogrid.fxml")); - mItemType.append( QString("HbGridView") ); - mEventType.append(QString("click3") ); - break; - - case GRID_TO_ALBUMLIST: - mEffectFileList.append( QString(":/data/gridtoalbumlisthide.fxml")); - mItemType.append( QString("HbView") ); - mEventType.append(QString("click4") ); - - mEffectFileList.append( QString(":/data/gridtoalbumlist.fxml")); - mItemType.append( QString("HbListView") ); - mEventType.append(QString("click5") ); - break; - - case ALBUMLIST_TO_GRID: - mEffectFileList.append( QString(":/data/albumlisttogrid.fxml")); - mItemType.append( QString("HbListView") ); - mEventType.append(QString("click6") ); - - mEffectFileList.append( QString(":/data/albumlisttogridshow.fxml")); - mItemType.append( QString("HbView") ); - mEventType.append(QString("click7") ); - break; - - case FULLSCREEN_TO_DETAIL : - mEffectFileList.append( QString(":/data/view_flip_hide.fxml")); - mItemType.append( QString("HbView") ); - mEventType.append(QString("click8") ); - - mEffectFileList.append( QString(":/data/view_flip_show.fxml")); - mItemType.append( QString("HbView") ); - mEventType.append(QString("click9") ); - mTransitionLater = true; - break; - - case DETAIL_TO_FULLSCREEN : - mEffectFileList.append( QString(":/data/view_flip_hide.fxml")); - mItemType.append( QString("HbView") ); - mEventType.append(QString("click10") ); - - mEffectFileList.append( QString(":/data/view_flip_show.fxml")); - mItemType.append( QString("HbView") ); - mEventType.append(QString("click11") ); - mTransitionLater = true; - break; - - default : - break; - } -} - -GlxTransitionEffectSetting::~GlxTransitionEffectSetting() -{ - qDebug("GlxTransitionEffectSetting::~GlxTransitionEffectSetting() effect id %d ", mEffect); - mEffectFileList.clear(); - mItemType.clear(); - mEventType.clear(); -} - - -GlxSlideShowEffectEngine::GlxSlideShowEffectEngine( ) : mNbrEffectRunning( 0 ), - mEffectPlugin(NULL), - mTransitionEffect(NO_EFFECT) -{ - qDebug("GlxSlideShowEffectEngine::GlxSlideShowEffectEngine()"); - mTransitionEffectList.clear(); -} - -GlxSlideShowEffectEngine::~GlxSlideShowEffectEngine() -{ - qDebug("GlxSlideShowEffectEngine::~GlxSlideShowEffectEngine()"); - delete mEffectPlugin; - mEffectPlugin = NULL; - - cleanTransitionEfffect(); -} - -void GlxSlideShowEffectEngine::registerEffect(const QString &itemType) -{ - effectPluginResolver(); - QList effectPathList = mEffectPlugin->getEffectFileList(); - - qDebug("GlxSlideShowEffectEngine::registerEffect() item type %s file path %s", itemType.utf16(), effectPathList[0].utf16()); - for ( int i = 0; i < effectPathList.count() ; ++i ) { - HbEffect::add(itemType, effectPathList.at(i), QString( "Click%1" ).arg(i)); - } -} - -void GlxSlideShowEffectEngine::deRegisterEffect(const QString &itemType) -{ - qDebug("GlxSlideShowEffectEngine::deRegisterEffect() item type %s", itemType.utf16()); - QList effectPathList = mEffectPlugin->getEffectFileList(); - for ( int i = 0; i < effectPathList.count() ; ++i ) { - HbEffect::remove(itemType, effectPathList.at(i), QString( "Click%1" ).arg(i)); - } - delete mEffectPlugin ; - mEffectPlugin = NULL; -} - -void GlxSlideShowEffectEngine::registerTransitionEffect() -{ - qDebug("GlxSlideShowEffectEngine::registerTransitionEffect()"); - initTransitionEffect(); -} - -void GlxSlideShowEffectEngine::deregistertransitionEffect() -{ - qDebug("GlxSlideShowEffectEngine::deregisterTransitionEffect()"); - cleanTransitionEfffect(); -} - -void GlxSlideShowEffectEngine::runEffect(QGraphicsItem * item, const QString & itemType ) -{ - qDebug("GlxSlideShowEffectEngine::runEffect()1 item type %s", itemType.utf16()); - HbEffect::start(item, itemType, QString( "Click1" ), this, "slideShowEffectFinished"); - ++mNbrEffectRunning; -} - -void GlxSlideShowEffectEngine::runEffect(QList< QGraphicsItem * > & items, const QString & itemType ) -{ - qDebug("GlxSlideShowEffectEngine::runEffect()2 item Type %s", itemType.utf16()); - mEffectPlugin->setUpItems(items); - for ( int i = 0; i < items.count() ; ++i ) { - if ( mEffectPlugin->isAnimationLater(i) == FALSE ) { - HbEffect::start(items.at(i), itemType, QString( "Click%1").arg(i), this, "slideShowEffectFinished"); - } - ++mNbrEffectRunning; - } -} - -void GlxSlideShowEffectEngine::runEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect) -{ - qDebug("GlxSlideShowEffectEngine::runEffect()3 effect type %d ", transitionEffect); - - GlxTransitionEffectSetting *effectSetting = mTransitionEffectList.value( transitionEffect ); - - if ( effectSetting == NULL || items.count() != effectSetting->count() ) { - return; - } - - mTransitionEffect = transitionEffect; - for ( int i = 0; i < effectSetting->count() ; ++i) { - ++mNbrEffectRunning; - if ( ( i == effectSetting->count() -1) && effectSetting->isTransitionLater() ) - { - effectSetting->setAnimationItem( items.at(i) ); - items.at(i)->hide(); - } - else { - HbEffect::start(items.at(i), effectSetting->itemType().at(i), effectSetting->eventType().at(i), this, "transitionEffectFinished"); - } - } -} - -void GlxSlideShowEffectEngine::cancelEffect(QGraphicsItem * item) -{ - if ( HbEffect::effectRunning( item, QString( "Click1" ) ) ) { - HbEffect::cancel( item, QString( "Click1" ) ); - } -} - -void GlxSlideShowEffectEngine::cancelEffect(const QList< QGraphicsItem * > & items) -{ - for ( int i = 0; i < items.count() ; ++i ) { - if ( HbEffect::effectRunning( items.at(i), QString( "Click%1").arg(i) ) ) { - HbEffect::cancel( items.at(i), QString( "Click%1").arg(i) ); - } - } -} - -void GlxSlideShowEffectEngine::cancelEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect) -{ - GlxTransitionEffectSetting *effectSetting = mTransitionEffectList.value( transitionEffect ); - - if ( effectSetting == NULL || items.count() != effectSetting->count() ) { - return; - } - - for ( int i = 0; i < effectSetting->count() ; ++i) { - HbEffect::cancel(items.at(i), effectSetting->eventType().at(i) ); - } -} - -bool GlxSlideShowEffectEngine::isEffectRuning(QGraphicsItem * item) -{ - if ( HbEffect::effectRunning( item, QString( "Click1" ) ) ) { - return true; - } - return false; -} - -bool GlxSlideShowEffectEngine::isEffectRuning(const QList< QGraphicsItem * > & items) -{ - for ( int i = 0; i < items.count() ; ++i ) { - if ( HbEffect::effectRunning( items.at(i), QString( "Click%1").arg(i) ) ) { - return true; - } - } - return false; -} - -void GlxSlideShowEffectEngine::slideShowEffectFinished( const HbEffect::EffectStatus &status ) -{ - Q_UNUSED( status ) - qDebug("GlxSlideShowEffectEngine::slideShowEffectFinished() number of effect %d ", mNbrEffectRunning); - - --mNbrEffectRunning; - - if ( mEffectPlugin->isAnimationLater( mNbrEffectRunning) ) { - HbEffect::start( mEffectPlugin->animationItem(), mEffectPlugin->ItemType(), QString( "Click%1").arg(mNbrEffectRunning), this, "slideShowEffectFinished"); - } - - if (mNbrEffectRunning == 0) { - emit effectFinished(); - } -} - -void GlxSlideShowEffectEngine::transitionEffectFinished( const HbEffect::EffectStatus &status ) -{ - Q_UNUSED( status ) - qDebug("GlxSlideShowEffectEngine::transitionEffectFinished() number of effect %d status %d", mNbrEffectRunning, status.reason); - - --mNbrEffectRunning; - if ( mNbrEffectRunning == 1 ) { - GlxTransitionEffectSetting *effectSetting = mTransitionEffectList.value( mTransitionEffect ); - if ( effectSetting->isTransitionLater() ){ - effectSetting->animationItem()->show(); - HbEffect::start( effectSetting->animationItem(), effectSetting->itemType().at(1), effectSetting->eventType().at(1), this, "transitionEffectFinished"); - mTransitionEffect = NO_EFFECT; - } - } - - if (mNbrEffectRunning == 0) { - emit effectFinished(); - } -} - -void GlxSlideShowEffectEngine::effectPluginResolver() -{ -//TO:DO improved the code by using factory design pattern - - delete mEffectPlugin; - mEffectPlugin = NULL; - - switch ( mSlideShowSetting.effect() ) { - case WAVE_EFFECT : - mEffectPlugin = new GlxForwardTransitionPlugin(); - break ; - - /*case TRANSITION_EFFECT : - if ( slideShowMoveDir() == MOVE_FORWARD ) { - mEffectPlugin = new GlxForwardTransitionPlugin(); - } - else { - mEffectPlugin = new GlxBackwardTransitionPlugin(); - } - break;*/ - - case SMOOTH_FADE : - mEffectPlugin = new GlxFadePlugin(); - break; - - default : - mEffectPlugin = new GlxFadePlugin(); - break; - } -} - -void GlxSlideShowEffectEngine::initTransitionEffect() -{ - GlxTransitionEffectSetting *effectSetting = NULL; - - effectSetting = new GlxTransitionEffectSetting(GRID_TO_FULLSCREEN); - for ( int i = 0; i < effectSetting->count(); ++i ) { - HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; - } - mTransitionEffectList[GRID_TO_FULLSCREEN] = effectSetting; - - effectSetting = new GlxTransitionEffectSetting( FULLSCREEN_TO_GRID ); - for ( int i = 0; i < effectSetting->count(); ++i ) { - HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; - } - mTransitionEffectList[FULLSCREEN_TO_GRID] = effectSetting; - - effectSetting = new GlxTransitionEffectSetting( GRID_TO_ALBUMLIST ); - for ( int i = 0; i < effectSetting->count(); ++i ) { - HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; - } - mTransitionEffectList[GRID_TO_ALBUMLIST] = effectSetting; - - effectSetting = new GlxTransitionEffectSetting( ALBUMLIST_TO_GRID ); - for ( int i = 0; i < effectSetting->count(); ++i ) { - HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; - } - mTransitionEffectList[ALBUMLIST_TO_GRID] = effectSetting; - - effectSetting = new GlxTransitionEffectSetting( FULLSCREEN_TO_DETAIL ); - for ( int i = 0; i < effectSetting->count(); ++i ) { - HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; - } - mTransitionEffectList[FULLSCREEN_TO_DETAIL] = effectSetting; - - effectSetting = new GlxTransitionEffectSetting( DETAIL_TO_FULLSCREEN ); - for ( int i = 0; i < effectSetting->count(); ++i ) { - HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; - } - mTransitionEffectList[DETAIL_TO_FULLSCREEN] = effectSetting; -} - -void GlxSlideShowEffectEngine::cleanTransitionEfffect() -{ - qDebug("GlxSlideShowEffectEngine::cleanTrnastionEfffect()"); - - foreach( GlxTransitionEffectSetting *list, mTransitionEffectList) { - for ( int i = 0; i < list->count(); ++i ) { - HbEffect::remove( list->itemType().at(i), list->effectFileList().at(i), list->eventType().at(i)) ; - } - delete list; - } - mTransitionEffectList.clear(); - -} - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/fullscreenview/inc/glxcoverflow.h --- a/ui/views/fullscreenview/inc/glxcoverflow.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/fullscreenview/inc/glxcoverflow.h Fri Jun 11 13:38:23 2010 +0300 @@ -76,8 +76,6 @@ protected slots: void panGesture ( const QPointF & delta ) ; - void leftGesture (int value); - void rightGesture (int value) ; void longPressGesture(const QPointF &point) ; void dataChanged(QModelIndex startIndex, QModelIndex endIndex); void rowsInserted(const QModelIndex &parent, int start, int end); diff -r 1ee2af37811f -r 6481344a6d67 ui/views/fullscreenview/inc/glxzoomwidget.h --- a/ui/views/fullscreenview/inc/glxzoomwidget.h Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +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: glxzoomwidget.h -* definition of the class glxzoomwidget which controls the Zoom behavior of coverflow. -* -*/ -#ifndef GLXZOOMWIDGET_H -#define GLXZOOMWIDGET_H - -#include -#include -#include -#include - -class QGestureEvent; -class QPinchGesture; -class HbIconItem; -class GlxImageDecoderWrapper; - -const int MAXZVALUE = 100; -const int MINZVALUE = 0; - -class GlxZoomWidget : public HbScrollArea -{ - Q_OBJECT - - public: - GlxZoomWidget (QGraphicsItem *parent = NULL); - ~GlxZoomWidget (); - void setModel (QAbstractItemModel *model) ; - void indexChanged(int index); - void setWindowSize(QSize windowSize); - void cleanUp(); - void activate(); - - signals: - void pinchGestureReceived(int index); - void zoomWidgetMovedBackground(int index); - - public slots: - //for Decoder support - void decodedImageAvailable(); - - protected: - bool sceneEvent(QEvent *event); - bool sceneEventFilter(QGraphicsItem *watched,QEvent *event); - protected slots: - void dataChanged(QModelIndex startIndex, QModelIndex endIndex); - void sendDecodeRequest(int index); - - private: - bool executeGestureEvent(QGraphicsItem *source,QGestureEvent *event); - //Responsible for changing the transforms of the widget wrt the ZF and center - //Also adjusts the ZF, center and final size so as to respect the boundaries - void zoomImage(qreal zoomFactor, QPointF center); - //This API will adjust the gesture center to maintain boundaries - //called from GlxZoomWidget::zoomImage - void adjustGestureCenter(QPointF & gestureCenter, qreal& zoomFactor); - //this API will limit the max/min Zoom Size possible - //called from GlxZoomWidget::zoomImage - void limitRequiredSize(QSizeF &requiredSize); - //gets the latest focussed image from the model - void retreiveFocusedImage(); - //finalize the transform and update the sizehint of mZoomWidget - void finalizeWidgetTransform(); - //get the focused image from the model - QPixmap getFocusedImage(); - - //data members - private: - //view widgets - QGraphicsPixmapItem *mZoomItem; //Item containing the pixmap - QGraphicsWidget *mZoomWidget; //container :all scaling and transforms would be done on this widget - HbIconItem* mBlackBackgroundItem; //for setting black background - - //to be in sync with the model - QAbstractItemModel *mModel; - int mFocusIndex; - - //size parameter - QSizeF mItemSize; // the actual pixmap size. Keep it updated with latest pixmap size - QSizeF mStepCurrentSize; //to save the size before gesture started - QSizeF mCurrentSize; //save sizes scaled by gesture - QSize mWindowSize; //the window size - QSizeF mMinScaleSize; //minimum posible size - QSizeF mMinDecScaleSize; //the Minimum scale limit after which the image scaling down should be decelerated - QSizeF mMaxScaleSize; // the maximum scale limit - QSizeF mMaxScaleDecSize; // the Maximum scale limit after which the image scaling should be decelerated - - //for Decoder support - GlxImageDecoderWrapper* mImageDecoder; - - //status flags - //To check if the decode request has already been send or not - bool mImageDecodeRequestSend; - //To check if the pinch gesture is in progress to block any events to HbScrollArea - bool mPinchGestureOngoing; - //to check if decoded image is available - bool mDecodedImageAvailable; - -}; -#endif //GLXZOOMWIDGET_H diff -r 1ee2af37811f -r 6481344a6d67 ui/views/fullscreenview/src/glxcoverflow.cpp --- a/ui/views/fullscreenview/src/glxcoverflow.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/fullscreenview/src/glxcoverflow.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -29,8 +29,9 @@ #include #include "glxviewids.h" -#define GLX_COVERFLOW_SPEED 60 -#define GLX_BOUNCEBACK_SPEED 15 +#define GLX_COVERFLOW_SPEED 32 +#define GLX_BOUNCEBACK_SPEED 16 +#define GLX_BOUNCEBACK_DELTA 8 GlxCoverFlow::GlxCoverFlow(QGraphicsItem *parent ) : HbWidget(parent), @@ -69,7 +70,7 @@ mIconItem[i]->setSize(QSize(0,0)); } mUiOn = FALSE; - mBounceBackDeltaX = 10; + mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA; } void GlxCoverFlow::setItemSize(QSize &size) @@ -105,44 +106,43 @@ void GlxCoverFlow::gestureEvent(QGestureEvent *event) { - if(QTapGesture *gesture = static_cast(event->gesture(Qt::TapGesture))) { + if(QTapGesture *gesture = static_cast(event->gesture(Qt::TapGesture))) { if (gesture->state() == Qt::GestureFinished) { - emit coverFlowEvent( TAP_EVENT ); - event->accept(gesture); + emit coverFlowEvent( TAP_EVENT ); + event->accept(gesture); + } + } + + if (QPanGesture *panningGesture = qobject_cast(event->gesture(Qt::PanGesture))) { + HbPanGesture *hbPanGesture = qobject_cast(panningGesture); + if (hbPanGesture) { + if(hbPanGesture->state() == Qt::GestureUpdated) { + QPointF delta(hbPanGesture->sceneDelta()); + panGesture(delta); + event->accept(panningGesture); + } + + if(hbPanGesture->state() == Qt::GestureFinished) { + switch( mMoveDir ) { + case LEFT_MOVE : + mMoveDir = NO_MOVE; + mBounceBackDeltaX = ( mItemSize.width() >> 2 ) + ( mItemSize.width() >> 3 ); + emit autoLeftMoveSignal(); + break ; + + case RIGHT_MOVE : + mMoveDir = NO_MOVE; + mBounceBackDeltaX = ( mItemSize.width() >> 2 ) + ( mItemSize.width() >> 3 ); + emit autoRightMoveSignal(); + break; + + default: + break; + } + event->accept(panningGesture); } } - - if (QPanGesture *panningGesture = qobject_cast(event->gesture(Qt::PanGesture))) { - HbPanGesture *hbPanGesture = qobject_cast(panningGesture); - if (hbPanGesture) { - if(hbPanGesture->state() == Qt::GestureUpdated) { - QPointF delta(hbPanGesture->sceneDelta()); - panGesture(delta); - event->accept(panningGesture); - - } - if(hbPanGesture->state() == Qt::GestureFinished) { - switch( mMoveDir ) { - - case LEFT_MOVE: - mMoveDir = NO_MOVE; - emit autoLeftMoveSignal(); - break ; - - case RIGHT_MOVE : - mMoveDir = NO_MOVE; - emit autoRightMoveSignal(); - break; - - default: - break; - } - event->accept(panningGesture); - - } - } - } - + } } void GlxCoverFlow::panGesture ( const QPointF & delta ) @@ -165,38 +165,6 @@ } } -void GlxCoverFlow::leftGesture(int value) -{ - Q_UNUSED(value); - qDebug("GlxCoverFlow::leftGesture CurrentPos= %d value %d", mCurrentPos, value); - if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S ) { - return; - } - mMoveDir = NO_MOVE; - mBounceBackDeltaX = ( mItemSize.width() >> 2 ) + ( mItemSize.width() >> 3 ); - emit autoLeftMoveSignal(); - if ( mUiOn == TRUE ) { - mUiOn = FALSE; - emit coverFlowEvent( PANNING_START_EVENT ); - } -} - -void GlxCoverFlow::rightGesture(int value) -{ - Q_UNUSED(value); - qDebug("GlxCoverFlow::rightGesture CurrentPos= %d value %d ", mCurrentPos, value); - if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S ) { - return; - } - mMoveDir = NO_MOVE; - mBounceBackDeltaX = ( mItemSize.width() >> 2 ) + ( mItemSize.width() >> 3 ); - emit autoRightMoveSignal(); - if ( mUiOn == TRUE ) { - mUiOn = FALSE; - emit coverFlowEvent( PANNING_START_EVENT ); - } -} - void GlxCoverFlow::longPressGesture(const QPointF &point) { qDebug("GlxCoverFlow::longPressGesture x = %d y = %d", point.x(), point.y()); @@ -266,7 +234,7 @@ //for bounce back effect for last image ( it will do the back) if ( ( mCurrentPos + width ) > ( mStripLen + mBounceBackDeltaX ) && mMoveDir == NO_MOVE ) { mMoveDir = LEFT_MOVE; - mBounceBackDeltaX = 10; + mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA; autoRightMoveSignal(); return ; } @@ -299,7 +267,7 @@ } } mMoveDir = NO_MOVE; - mBounceBackDeltaX = 10; + mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA; mSpeed = GLX_COVERFLOW_SPEED; } } @@ -318,7 +286,7 @@ qDebug("GlxCoverFlow::autoRightMove diffX x = %d current pos = %d mBounceBackDeltaX x = %d", diffX, mCurrentPos, mBounceBackDeltaX); if ( diffX > mBounceBackDeltaX && diffX < width && mMoveDir == NO_MOVE ){ mMoveDir = RIGHT_MOVE; - mBounceBackDeltaX = 10; + mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA; autoLeftMoveSignal(); return ; } @@ -353,7 +321,7 @@ } } mMoveDir = NO_MOVE; - mBounceBackDeltaX = 10; + mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA; mSpeed = GLX_COVERFLOW_SPEED; } } @@ -554,10 +522,13 @@ } return substate; } + void GlxCoverFlow::zoomStarted(int index) { + Q_UNUSED(index) mZoomOn = true; } + void GlxCoverFlow::zoomFinished(int index) { mZoomOn = false; diff -r 1ee2af37811f -r 6481344a6d67 ui/views/fullscreenview/src/glxfullscreenview.cpp --- a/ui/views/fullscreenview/src/glxfullscreenview.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/fullscreenview/src/glxfullscreenview.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -66,8 +66,8 @@ mFlipAction(NULL), mSendAction(NULL), mDeleteAction(NULL), - mZoomWidget(NULL), - mUseImageAction(NULL) + mUseImageAction(NULL), + mZoomWidget(NULL) { OstTraceFunctionEntry0( GLXFULLSCREENVIEW_GLXFULLSCREENVIEW_ENTRY ); @@ -112,6 +112,7 @@ mCoverFlow = qobject_cast (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW)); mZoomWidget = qobject_cast (mDocLoader->findWidget(GLXFULLSCREENZOOMWIDGET)); + mZoomWidget->connectDecodeRequestToPinchEvent(); mCoverFlow->setMultitouchFilter(mZoomWidget); //initialise the cover flow for basic connections and the rest mCoverFlow->setCoverFlow(); @@ -123,6 +124,7 @@ //@to do : hide the widgets by default in docml mImageStrip->hide(); mImageStrip->setLayoutName( QString( "ImageStrip" ) ); + mImageStrip->setEnabledAnimations(HbAbstractItemView::None); OstTraceFunctionExit0( GLXFULLSCREENVIEW_LOADWIDGETS_EXIT ); } diff -r 1ee2af37811f -r 6481344a6d67 ui/views/fullscreenview/src/glxzoomwidget.cpp --- a/ui/views/fullscreenview/src/glxzoomwidget.cpp Thu May 27 12:51:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,411 +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: glxzoomwidget.cpp -* description of the class GlxGlxZoomWidget which controls the Zoom behavior of coverflow. -* -*/ -#include -#include -#include -#include "glximagedecoderwrapper.h" -#include "glxmodelparm.h" -#include "glxzoomwidget.h" - -GlxZoomWidget::GlxZoomWidget(QGraphicsItem *parent):HbScrollArea(parent), mModel(NULL), mImageDecodeRequestSend(false), mPinchGestureOngoing(false), mDecodedImageAvailable(false) -{ - grabGesture(Qt::PinchGesture); - setAcceptTouchEvents(true) ; - setFrictionEnabled(false); - setZValue(MINZVALUE); - //create the child items and background - mZoomWidget = new QGraphicsWidget(this); - mZoomItem = new QGraphicsPixmapItem(mZoomWidget); - mZoomItem->setTransformationMode(Qt::SmoothTransformation); - //the black background - //replace when a proper substitute for setting backgrounds is known - mBlackBackgroundItem = new HbIconItem(this); - mBlackBackgroundItem->setBrush(QBrush(Qt::black)); - mBlackBackgroundItem->hide(); - //does not work so is commented - //setBackgroundItem(mBlackBackgroundItem); - - //initializing the image decoder - mImageDecoder = new GlxImageDecoderWrapper; - connect(this,SIGNAL( pinchGestureReceived(int) ), this, SLOT( sendDecodeRequest(int) ), Qt::QueuedConnection ); -} - -GlxZoomWidget::~GlxZoomWidget() -{ - //disconnect all existing signals - disconnect(this,SIGNAL( pinchGestureReceived(int) ), this, SLOT( sendDecodeRequest(int) ) ); - //no Null checks required - delete mZoomItem; -// delete mZoomWidget; //as this is a content widegt it will automatically be deleted - delete mBlackBackgroundItem; - //reset the decoder to cancel pending tasks - if(mImageDecoder) { - mImageDecoder->resetDecoder(); - delete mImageDecoder; - } -} - -void GlxZoomWidget::setModel (QAbstractItemModel *model) -{ - if(model) - { - mModel = model; - retreiveFocusedImage(); //Update mZoomItem with focused Image - connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); - } -} - -void GlxZoomWidget::setWindowSize(QSize windowSize) -{ - mWindowSize = windowSize; - mBlackBackgroundItem->setGeometry(QRectF(QPointF(0,0), mWindowSize)); - //try to reset the max and min zoomed size here -} - -void GlxZoomWidget::indexChanged(int index) -{ - Q_UNUSED(index); - if(mFocusIndex != index) { - mImageDecoder->resetDecoder();//reset the decoder first to cancel pending tasks - mImageDecodeRequestSend = false; - mDecodedImageAvailable = false; - retreiveFocusedImage(); //Update mZoomItem with focused Image - } -} - -bool GlxZoomWidget::sceneEvent(QEvent *event) -{ - bool consume(false); - if (event->type() == QEvent::Gesture) { - consume = executeGestureEvent(this, static_cast(event)); - } - if(!consume) - { - consume = HbScrollArea::sceneEvent(event); - } - return consume; -} - -bool GlxZoomWidget::sceneEventFilter(QGraphicsItem *watched,QEvent *event) -{ - qDebug("GlxCoverFlow::eventFilter " ); - bool consume = false; - if (event->type() == QEvent::Gesture) { - consume = executeGestureEvent(watched, static_cast(event)); - } - - if(!consume) { - consume = HbScrollArea::sceneEventFilter(watched,event); - } - return consume; - -} - -bool GlxZoomWidget::executeGestureEvent(QGraphicsItem *source,QGestureEvent *event) -{ - if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { - QPinchGesture* pinchG = static_cast(pinch); - QPinchGesture::ChangeFlags changeFlags = pinchG->changeFlags(); - if (changeFlags & QPinchGesture::ScaleFactorChanged) { - mPinchGestureOngoing = true; - //bring the zoom widget to foreground - setZValue(MAXZVALUE); - //show the black background - mBlackBackgroundItem->setParentItem(parentItem()); - mBlackBackgroundItem->setZValue(MAXZVALUE - 1); - mBlackBackgroundItem->show(); - - //retreive the gesture values - qreal value = pinchG->scaleFactor() / pinchG->lastScaleFactor(); - QPointF center = pinchG->property("centerPoint").toPointF(); - //set the gesture center to the scene coordinates - QPointF sceneGestureCenter = source->sceneTransform().map(center); - zoomImage(value, sceneGestureCenter); - - } - if (pinchG->state() == Qt::GestureStarted) { - emit pinchGestureReceived(mFocusIndex); - } - - if (pinchG->state() == Qt::GestureFinished) { - if(mStepCurrentSize != mCurrentSize) { - //For giving a spring effect when user has zoomed more than normal. - if(mStepCurrentSize.width() > mMaxScaleDecSize.width()) { - //scale the image to limited size - qreal value = mMaxScaleDecSize.width()/mCurrentSize.width(); - QPointF center(mWindowSize.width()/2, mWindowSize.height()/2); - QPointF sceneGestureCenter = source->sceneTransform().map(center); - zoomImage(value, sceneGestureCenter); - } - mPinchGestureOngoing = false; - //finalize the transforms to the geometry else panning will not work - finalizeWidgetTransform(); - } -//push the Zoom widget to background when zoomed image size nears FS image - if(mStepCurrentSize.width() <= mMinDecScaleSize.width()*1.3) { - mBlackBackgroundItem->hide(); - //push the widget back to background - setZValue(MINZVALUE); - emit zoomWidgetMovedBackground(mFocusIndex); - //do not reset the transform here as it will then zoom-in the widget to decoded image size - } - } - //gesture accepted - return true; - } - //gesture rejected - if(!mPinchGestureOngoing) { - return false; - } - return true; - -} - -void GlxZoomWidget::zoomImage(qreal zoomFactor, QPointF center) -{ - adjustGestureCenter(center, zoomFactor); - QSizeF requiredSize(mCurrentSize.width()*zoomFactor, mCurrentSize.height()*zoomFactor); - limitRequiredSize(requiredSize); - if(requiredSize != mCurrentSize) { - QTransform zoomTransform = mZoomWidget->transform(); - QPointF transformedCenter = mZoomWidget->sceneTransform().inverted().map(center); - zoomTransform.translate(transformedCenter.x(),transformedCenter.y()); - zoomTransform.scale(requiredSize.width()/mCurrentSize.width(), requiredSize.height()/mCurrentSize.height()); - zoomTransform.translate(-transformedCenter.x(),-transformedCenter.y()); - mZoomWidget->setTransform(zoomTransform); - mCurrentSize = requiredSize; - } - -} - - -void GlxZoomWidget::limitRequiredSize(QSizeF &requiredSize) -{ - if(requiredSize.width() > mMaxScaleSize.width() ) { - requiredSize = mMaxScaleSize ; - } - else if(requiredSize.width() < mMinDecScaleSize.width() ) { - requiredSize = mMinDecScaleSize ; - } - - -} - -//makes sure that the gesture is on the screen center if the image is smaller than the screen -void GlxZoomWidget::adjustGestureCenter(QPointF & gestureCenter, qreal& zoomFactor) -{ - if(zoomFactor > 1 &&zoomFactor > 1.2 ) { - zoomFactor = 1.2; - } - - if(zoomFactor < 1 &&zoomFactor < 0.8 ) { - zoomFactor = 0.8; - } - QSizeF requiredSize(mCurrentSize.width()*zoomFactor, mCurrentSize.height()*zoomFactor); - //keep smaller image centered - if(mCurrentSize.width() <= mWindowSize.width() ) - { - gestureCenter.setX(mWindowSize.width()/2); - - } - if(mCurrentSize.height() <= mWindowSize.height()) - { - gestureCenter.setY(mWindowSize.height()/2); - - } - //maintains the boundary of the edges for zoom out conditions - if(zoomFactor < 1) - { - QPointF itemOriginPos = mZoomWidget->sceneTransform().map(QPointF(0,0)); - bool hasWidthExceededWindow = mCurrentSize.width() > mWindowSize.width(); - bool hasHeightExceededWindow = mCurrentSize.height() > mWindowSize.height(); - if(itemOriginPos.x() >= 0) { - //image has crossed left boundry leaving blank space - if(hasWidthExceededWindow) { - //stick the gesture to the left corner - gestureCenter.setX(itemOriginPos.x()); - } - } - //Check if the right boundry can be adjusted - if(itemOriginPos.x()+ mCurrentSize.width() <= mWindowSize.width()) { - //Image is before the right boundry leaving blank space - if(hasWidthExceededWindow) { - //stick the gesture to the right corner - gestureCenter.setX(itemOriginPos.x()+ mCurrentSize.width()); - } - } - //check if the upper boundry could be adjusted - if(itemOriginPos.y() >= 0) { - //image has crossed the upper boundry leaving blank space - if(hasHeightExceededWindow) { - //stick the image to the upper boundry - gestureCenter.setY(itemOriginPos.y()); - } - } - //check if the lower boundry could be adjusted - if(itemOriginPos.y()+ mCurrentSize.height() <= mWindowSize.height()) { - //Image is before the right boundry leaving blank space - if(hasHeightExceededWindow) { - //stick the image to the right corner - gestureCenter.setY(itemOriginPos.y()+ mCurrentSize.height()); - } - - } - } - //control the zoom Factor to boundaries - if(mCurrentSize.width() > mWindowSize.width() && requiredSize.width() <= mWindowSize.width()) - { - zoomFactor = mWindowSize.width()/mCurrentSize.width(); - - } - else if(mCurrentSize.height() > mWindowSize.height() && requiredSize.height() <= mWindowSize.height()) - { - zoomFactor = mWindowSize.height()/mCurrentSize.height(); - - } - - //reduce the ZF so as to show a decelerated effect at max/min levels - - if(mCurrentSize.width() > mMaxScaleDecSize.width() && zoomFactor > 1 ) { - zoomFactor = 1.0 + ((zoomFactor-1.0)/6) ; - } - if(mCurrentSize.width() < mMinDecScaleSize.width() && zoomFactor < 1 ) { - zoomFactor = 1.0 - ((1.0-zoomFactor)/6) ; - } - - -} - -//get the latest focused image and set it to mZoomItem -void GlxZoomWidget::retreiveFocusedImage() -{ - - QPixmap targetPixmap(getFocusedImage()); - //initialize all the variables wrt the focussed pixmap - mZoomWidget->resetTransform(); - mItemSize = targetPixmap.size(); - mMaxScaleSize = mItemSize; - mMaxScaleSize.scale(mWindowSize*13, Qt::KeepAspectRatio); - mMaxScaleDecSize = mItemSize; - mMaxScaleDecSize.scale(mWindowSize*7, Qt::KeepAspectRatio); - mMinScaleSize = mItemSize* 0.7; - mMinDecScaleSize = mItemSize; - QPointF originPos = sceneTransform().map(QPointF(0,0)); - mZoomWidget->setGeometry(QRectF(QPointF(mWindowSize.width()/2 - mItemSize.width()/2,mWindowSize.height()/2 - mItemSize.height()/2),mItemSize )); //chk this - mZoomWidget->setPreferredSize(mItemSize); - mZoomItem->setPixmap(targetPixmap); - mCurrentSize = mItemSize; - mStepCurrentSize = mItemSize; - setContentWidget(mZoomWidget); - show(); -} - - -void GlxZoomWidget::dataChanged(QModelIndex startIndex, QModelIndex endIndex) -{ - if(mFocusIndex >= startIndex.row() && mFocusIndex <= endIndex.row()) { - //get the latest image from the model - //will replace a decoded image if callback is received after decoded image is received so a fix is required - //retreiveFocusedImage(); - if(!mDecodedImageAvailable) { - QPixmap targetPixmap(getFocusedImage()); - mZoomItem->setPixmap(targetPixmap); - finalizeWidgetTransform(); - } - } -} - -void GlxZoomWidget::decodedImageAvailable() -{ - //new bitmap with better resolution is available - //so set it to the item - QPixmap decodedPixmap = mImageDecoder->getPixmap(); - disconnect(mImageDecoder, SIGNAL(pixmapDecoded()), this, SLOT(decodedImageAvailable())); - if(decodedPixmap.isNull()){ - return; - } - mDecodedImageAvailable = true; - mZoomItem->setPixmap(decodedPixmap); - mItemSize = decodedPixmap.size(); - //this is important if not done then old transforms will be applied on the new image - finalizeWidgetTransform(); -} - -void GlxZoomWidget::sendDecodeRequest(int index) -{ - if(!mImageDecodeRequestSend) { - QString imagePath = (mModel->data(mModel->index(index,0),GlxUriRole)).value(); - mImageDecoder->decodeImage(imagePath); - connect(mImageDecoder, SIGNAL(pixmapDecoded()), this, SLOT(decodedImageAvailable())); - mImageDecodeRequestSend = true; - } -} - - -void GlxZoomWidget::finalizeWidgetTransform() -{ - QPointF widgetPos = mZoomWidget->sceneTransform().map(QPointF(0,0)); //Map the origin wrt scene - mZoomWidget->resetTransform(); - mZoomWidget->scale(mCurrentSize.width()/mItemSize.width(), mCurrentSize.height()/mItemSize.height()); - mZoomWidget->setGeometry(QRectF(widgetPos , mCurrentSize)); - // this updates HbScrollArea on the sizeHint of ZoomWidget - mZoomWidget->setPreferredSize(mCurrentSize); - mStepCurrentSize = mCurrentSize; -} - -QPixmap GlxZoomWidget::getFocusedImage() -{ - mFocusIndex = mModel->data(mModel->index(0,0),GlxFocusIndexRole).value(); - QVariant iconVariant = mModel->data(mModel->index(mFocusIndex,0),GlxFsImageRole); - QVariant sizeVariant = mModel->data(mModel->index(mFocusIndex,0),GlxDimensionsRole); - QPixmap targetPixmap; - //retreive pixmap from the HbIcon received from model - //should change the model to return and save pixmaps and convert to HbIcons Instead - if ( iconVariant.isValid() && iconVariant.canConvert () ) { - QIcon itemIcon = iconVariant.value().qicon(); - QSize itemSize = itemIcon.actualSize(mWindowSize); - QSize scaleSize; - if(sizeVariant.isValid() && sizeVariant.canConvert ()) { - scaleSize = sizeVariant.toSize(); - if(!(scaleSize.width() < mWindowSize.width() && scaleSize.height() < mWindowSize.height())) { - scaleSize = mWindowSize; - } - } - targetPixmap = itemIcon.pixmap(itemSize).scaled(scaleSize, Qt::KeepAspectRatio); - mItemSize = targetPixmap.size(); - } - return targetPixmap; - -} - - - -void GlxZoomWidget::cleanUp() -{ -// disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); - if(mImageDecoder) { - mImageDecoder->resetDecoder(); - } - mZoomItem->setPixmap(QPixmap()); -} - -void GlxZoomWidget::activate() -{ -} - - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/gridview/inc/glxgridview.h --- a/ui/views/gridview/inc/glxgridview.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/gridview/inc/glxgridview.h Fri Jun 11 13:38:23 2010 +0300 @@ -71,6 +71,11 @@ protected : QVariant itemChange (GraphicsItemChange change, const QVariant &value) ; + + /* + * To emit the signal when application goes into background or come back to foreground + */ + bool eventFilter(QObject *obj, QEvent *ev); private slots: void indicateLongPress(const QModelIndex& index, QPointF coords); diff -r 1ee2af37811f -r 6481344a6d67 ui/views/gridview/src/glxgridview.cpp --- a/ui/views/gridview/src/glxgridview.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/gridview/src/glxgridview.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -30,6 +30,7 @@ #include #include #include +#include //User Includes #include "glxviewids.h" @@ -38,6 +39,9 @@ #include "glxcommandhandlers.hrh" #include "glxicondefs.h" #include "glxlocalisationstrings.h" +#include "glxlog.h" +#include "glxtracer.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE @@ -90,6 +94,7 @@ frame->graphicsItem()->setOpacity(1); mCountItem->setBackgroundItem(frame->graphicsItem(),-1); } + QCoreApplication::instance()->installEventFilter(this); OstTraceFunctionExit0( GLXGRIDVIEW_ACTIVATE_EXIT ); } @@ -97,33 +102,28 @@ { OstTraceFunctionEntry0( GLXGRIDVIEW_DEACTIVATE_ENTRY ); mScrolling = FALSE; - if (mUiOnButton) - { + if (mUiOnButton){ mUiOnButton->hide(); - } - if(mIconItem) - { + } + if(mIconItem) { mIconItem->hide(); mIconItem->resetTransform(); mIconItem->setOpacity(0); mIconItem->setZValue(mIconItem->zValue()-20); - } - if (mCountItem) - { + } + if (mCountItem) { mCountItem->hide(); - } - if (mAlbumName) - { + } + if (mAlbumName) { mAlbumName->hide(); - } - if(mZeroItemLabel) - { + } + if(mZeroItemLabel) { mZeroItemLabel->hide(); - } - if(mCameraButton) - { + } + if(mCameraButton) { mCameraButton->hide(); - } + } + QCoreApplication::instance()->removeEventFilter(this); disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationchanged(Qt::Orientation))); OstTraceFunctionExit0( GLXGRIDVIEW_DEACTIVATE_EXIT ); } @@ -416,6 +416,20 @@ showItemCount(); } +bool GlxGridView::eventFilter(QObject *obj, QEvent *event) +{ + TRACER("GlxGridView::eventFilter() "); + GLX_LOG_INFO1("GlxGridView::eventFilter() %d event type", event->type()); + + if ( event->type() == QEvent::ApplicationActivate ) { + emit actionTriggered( EGlxCmdAppForeground ); + } + if ( event->type() == QEvent::ApplicationDeactivate ) { + emit actionTriggered( EGlxCmdAppBackground ); + } + return HbView::eventFilter(obj,event); +} + void GlxGridView::handleUserAction(qint32 commandId) { OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_HANDLEUSERACTION, "GlxGridView::handleUserAction" ); @@ -518,7 +532,7 @@ } void GlxGridView::hideorshowitems(Qt::Orientation orient) { - if (mWidget->selectionMode() == HgWidget::NoSelection) { + if (mWidget && mWidget->selectionMode() == HgWidget::NoSelection) { if(orient == Qt::Horizontal) { setItemVisible(Hb::AllItems, FALSE) ; @@ -535,7 +549,7 @@ } } - if (mWidget->selectionMode() == HgWidget::MultiSelection) { + if (mWidget && mWidget->selectionMode() == HgWidget::MultiSelection) { setItemVisible(Hb::TitleBarItem, FALSE) ; if (mUiOnButton) { mUiOnButton->hide(); diff -r 1ee2af37811f -r 6481344a6d67 ui/views/slideshowsettingsview/inc/glxslideshowsettingsview.h --- a/ui/views/slideshowsettingsview/inc/glxslideshowsettingsview.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/slideshowsettingsview/inc/glxslideshowsettingsview.h Fri Jun 11 13:38:23 2010 +0300 @@ -30,7 +30,7 @@ class HbMainWindow; class HbComboBox; class QAbstractItemModel; -class GlxSlideShowSetting; +class GlxSettingInterface; class GlxSlideShowSettingsView : public GlxView { @@ -47,16 +47,16 @@ void orientationChanged(Qt::Orientation); private: -void setLayout(); + void setLayout(); private: - HbComboBox *mEffect; //Drop down box to display transition effect + HbComboBox *mEffect; //Drop down box to display transition effect HbComboBox *mDelay; //Drop down box to display transition delay - HbMainWindow *mWindow; //no ownership + HbMainWindow *mWindow; //no ownership HbLabel *mContextlabel; //Display SlideShow label HbLabel *mEffectlabel; //Display "Transition Effect: " - HbLabel *mDelaylabel; //Display "Transition delay: " - GlxSlideShowSetting *mSettings; + HbLabel *mDelaylabel; //Display "Transition delay: " + GlxSettingInterface *mSettings; //no ownership }; #endif /* GLXGRIDVIEW_H_ */ diff -r 1ee2af37811f -r 6481344a6d67 ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp --- a/ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -27,9 +27,8 @@ #include "glxuistd.h" #include "glxviewids.h" #include "glxslideshowsettingsview.h" -#include "glxeffectengine.h" - - +#include "glxsettinginterface.h" +#include "glxlocalisationstrings.h" GlxSlideShowSettingsView::GlxSlideShowSettingsView(HbMainWindow *window) @@ -42,22 +41,22 @@ mDelaylabel (NULL), mSettings( NULL ) { - mSettings = new GlxSlideShowSetting(); + mSettings = GlxSettingInterface::instance() ; setContentFullScreen( true ); } GlxSlideShowSettingsView::~GlxSlideShowSettingsView() { - delete mContextlabel; - delete mEffectlabel; - delete mDelaylabel; - delete mEffect; - delete mDelay; - delete mSettings; + delete mContextlabel; + delete mEffectlabel; + delete mDelaylabel; + delete mEffect; + delete mDelay; } void GlxSlideShowSettingsView::setModel(QAbstractItemModel *model) { + Q_UNUSED( model ) return; } @@ -71,35 +70,33 @@ connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); if ( mContextlabel == NULL ) { - mContextlabel = new HbLabel("Slideshow", this); + mContextlabel = new HbLabel( GLX_MENU_SLIDESHOW, this ); } if ( mEffectlabel == NULL ) { - mEffectlabel = new HbLabel("Transition effect:", this); + mEffectlabel = new HbLabel( GLX_LABEL_TRANSITION_EFFECT, this ); } if ( mEffect == NULL ) { mEffect = new HbComboBox(this); QStringList effectList = mSettings->slideShowEffectList(); - mEffect->addItems( effectList ); - + mEffect->addItems( effectList ); } if ( mDelaylabel == NULL ) { - mDelaylabel = new HbLabel("Transition delay:", this); + mDelaylabel = new HbLabel( GLX_LABEL_TRANSITION_DELAY, this ); } if ( mDelay == NULL ) { mDelay = new HbComboBox(this); QStringList delayList; - delayList<<"slow"<<"medium"<<"fast"; + delayList << GLX_VAL_SLOW << GLX_VAL_MEDIUM << GLX_VAL_FAST ; mDelay->addItems( delayList ); } - // Read the values from the cenrep - - mEffect->setCurrentIndex( mSettings->slideShowEffectIndex()); - mDelay->setCurrentIndex( mSettings->slideShowDelayIndex()); + // Read the values from the cenrep + mEffect->setCurrentIndex( mSettings->slideShowEffectIndex() ); + mDelay->setCurrentIndex( mSettings->slideShowDelayIndex() ); setLayout(); } @@ -117,10 +114,8 @@ void GlxSlideShowSettingsView::deActivate() { //Store the current effect and delay before going back to the previous view - mSettings->setslideShowEffectIndex(mEffect->currentIndex()); - mSettings->setSlideShowDelayIndex(mDelay->currentIndex()); + mSettings->setslideShowEffectIndex( mEffect->currentIndex() ); + mSettings->setSlideShowDelayIndex( mDelay->currentIndex() ); disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); } - - diff -r 1ee2af37811f -r 6481344a6d67 ui/views/slideshowview/inc/glxslideshowwidget.h --- a/ui/views/slideshowview/inc/glxslideshowwidget.h Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/slideshowview/inc/glxslideshowwidget.h Fri Jun 11 13:38:23 2010 +0300 @@ -36,17 +36,24 @@ class HbAbstractDataModel; //User Forward Declarations -class GlxSlideShowEffectEngine; - +class GlxEffectEngine; +class GlxSettingInterface; #define NBR_ITEM 3 typedef enum { UI_ON_EVENT, //send the signal when user tap on screen ( on the UI ) UI_OFF_EVENT, //send the signal when user press continous button ( off the UI) - EMPTY_DATA_EVENT //send the signal when model have no data + EMPTY_DATA_EVENT, //send the signal when model have no data + EFFECT_STARTED // sends the signal when effect is started. } GlxSlideShowEvent; +typedef enum +{ + MOVE_FORWARD, + MOVE_BACKWARD, +} GlxSlideShowMoveDir; + class GlxSlideShowWidget : public HbWidget { Q_OBJECT @@ -101,14 +108,14 @@ //add the connection to the model void initializeNewModel(); void resetSlideShow(); - void setIconItems(int moveDir); - void setItemPos(int moveDir); - void moveImage(int nextIndex, int posX, const QString & move, char * callBack); + void setIconItems( int moveDir ); + void moveImage( int nextIndex, int posX, const QString & move, char * callBack ); void addConnections(); void removeConnections(); private: - GlxSlideShowEffectEngine *mEffectEngine; + GlxEffectEngine *mEffectEngine; + GlxSettingInterface *mSettings; //no ownership HbIconItem *mIconItems[NBR_ITEM]; HbPushButton *mContinueButton; int mItemIndex; diff -r 1ee2af37811f -r 6481344a6d67 ui/views/slideshowview/src/glxslideshowview.cpp --- a/ui/views/slideshowview/src/glxslideshowview.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/slideshowview/src/glxslideshowview.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -91,6 +91,7 @@ disconnect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); disconnect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) ); + //Delete the Items in the slide show widget mSlideShowWidget->cleanUp(); @@ -116,7 +117,7 @@ mSlideShowWidget->setModel(mModel); if (mTvOutWrapper){ - mTvOutWrapper->setModel(mModel); + mTvOutWrapper->setModel(mModel,true); mTvOutWrapper->setImagetoHDMI(); } } @@ -162,6 +163,12 @@ case EMPTY_DATA_EVENT : emit actionTriggered( EGlxCmdEmptyData ); break; + + case EFFECT_STARTED: + if (mTvOutWrapper){ + mTvOutWrapper->fadeSurface(false); + } + break; default : break; diff -r 1ee2af37811f -r 6481344a6d67 ui/views/slideshowview/src/glxslideshowwidget.cpp --- a/ui/views/slideshowview/src/glxslideshowwidget.cpp Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/slideshowview/src/glxslideshowwidget.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -29,20 +29,21 @@ #include #include - //User Includes #include "glxicondefs.h" //Contains the icon names/Ids #include "glxmodelparm.h" #include "glxeffectengine.h" #include "glxdocloaderdefs.h" #include "glxslideshowwidget.h" -#include -#include +#include "glxsettinginterface.h" +#include "glxlog.h" +#include "glxtracer.h" GlxSlideShowWidget::GlxSlideShowWidget( QGraphicsItem *parent ) : HbWidget(parent), mEffectEngine(NULL), + mSettings( NULL ), mContinueButton(NULL), mItemIndex(1), mSelIndex(0), @@ -50,17 +51,18 @@ mModel(NULL) { TRACER("GlxSlideShowWidget::GlxSlideShowWidget()"); + mSettings = GlxSettingInterface::instance() ; //no owner ship grabGesture( Qt::PanGesture ); grabGesture( Qt::TapGesture ); } void GlxSlideShowWidget::setSlideShowWidget(HbDocumentLoader *DocLoader) - { +{ //To:Do error handling TRACER("GlxSlideShowWidget::setSlideShowWidget()"); //create the effect engine - mEffectEngine = new GlxSlideShowEffectEngine(); + mEffectEngine = new GlxEffectEngine(); // Now load the view and the contents. // and then set the play icon to the button @@ -70,8 +72,8 @@ mIsPause = false; for ( int i = 0; i < NBR_ITEM ; i++) { - mIconItems[i] = new HbIconItem(this); - mIconItems[i]->setBrush(QBrush(Qt::black)); + mIconItems[i] = new HbIconItem(this); + mIconItems[i]->setBrush(QBrush(Qt::black)); } mSlideTimer = new QTimer(); @@ -81,75 +83,68 @@ addConnections(); //Create the settings for the effects - mEffectEngine->readSetting(); - mEffectEngine->registerEffect(QString("HbIconItem")); + mEffectEngine->registerEffect( QString("HbIconItem") ); //provide the xml info for the effect to take place HbEffect::add( QString("HbIconItem"), QString(":/data/transition.fxml"), QString( "Move" )); HbEffect::add( QString("HbIconItem"), QString(":/data/transitionleft.fxml"), QString( "LeftMove" )); HbEffect::add( QString("HbIconItem"), QString(":/data/transitionright.fxml"), QString( "RightMove" )); - } +} GlxSlideShowWidget::~GlxSlideShowWidget() - { +{ TRACER("GlxSlideShowWidget::~GlxSlideShowWidget()"); //Delete the resources allocated cleanUp(); - if(mContinueButton) - { + if(mContinueButton) { delete mContinueButton; mContinueButton = NULL; - } } - +} void GlxSlideShowWidget::cleanUp() - { +{ TRACER("GlxSlideShowWidget::cleanUp()"); removeConnections(); - if(mEffectEngine) - { + if(mEffectEngine) { mEffectEngine->deRegisterEffect( QString("HbIconItem") ); delete mEffectEngine; mEffectEngine = NULL; - } - + } - for ( int i = 0; i < NBR_ITEM ; i++) - { + for ( int i = 0; i < NBR_ITEM ; i++) { delete mIconItems[i] ; mIconItems[i] = NULL; - } + } - if(mSlideTimer) - { + if(mSlideTimer) { delete mSlideTimer; mSlideTimer = NULL; - } + } clearCurrentModel(); HbEffect::remove( QString("HbIconItem"), QString(":/data/transition.fxml"), QString( "Move" )); HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionleft.fxml"), QString( "LeftMove" )); HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionright.fxml"), QString( "RightMove" )); - } +} void GlxSlideShowWidget::setModel (QAbstractItemModel *model) - { +{ TRACER("GlxSlideShowWidget::setModel()"); if ( model == mModel ) { - return ; + return ; } clearCurrentModel(); mModel = model; initializeNewModel(); resetSlideShow(); - } +} void GlxSlideShowWidget::setItemGeometry(QRect screenRect) - { +{ TRACER("GlxSlideShowWidget::setItemGeometry()"); int index = mItemIndex; mScreenRect = screenRect; @@ -158,10 +153,10 @@ mIconItems[index]->setGeometry( QRect( mScreenRect.width(), mScreenRect.top(), mScreenRect.width(), mScreenRect.height() ) ); index = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; mIconItems[index]->setGeometry( QRect( -mScreenRect.width(), mScreenRect.top(), mScreenRect.width(), mScreenRect.height() ) ); - } +} void GlxSlideShowWidget::triggeredEffect() - { +{ TRACER("GlxSlideShowWidget::triggeredEffect()"); int index = mItemIndex; mSlideTimer->stop(); @@ -169,54 +164,43 @@ User::ResetInactivityTime(); mItemList.append( mIconItems[index] ); - if ( mEffectEngine->slideShowMoveDir() == MOVE_FORWARD ) { - index = ( mItemIndex + 1) % NBR_ITEM; - } - else { - index = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; - } + index = ( mItemIndex + 1 ) % NBR_ITEM; mItemList.append( mIconItems[index] ); GLX_LOG_INFO3("GlxSlideShowWidget::triggeredEffect() image selected index %d array index %d index %d", mSelIndex, mItemIndex, index); mEffectEngine->runEffect( mItemList, QString("HbIconItem") ); + emit slideShowEvent( EFFECT_STARTED ); } - void GlxSlideShowWidget::effectFinshed() - { +{ TRACER("GlxSlideShowWidget::effectFinshed()"); //To:Do boundery condition or last item check implemented after behaviour of slide show clear int rowCount = mModel->rowCount(); GLX_LOG_INFO2("GlxSlideShowWidget::effectFinshed() before image selected index %d array index %d", mSelIndex, mItemIndex); - if ( mEffectEngine->slideShowMoveDir() == MOVE_FORWARD ) { mSelIndex = ( ++mSelIndex ) % rowCount; mItemIndex = ( ++mItemIndex ) % NBR_ITEM; - } - else { - mSelIndex = mSelIndex ? --mSelIndex : rowCount - 1; - mItemIndex = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; - } - mModel->setData( mModel->index(mSelIndex, 0), mSelIndex, GlxFocusIndexRole ); - setIconItems(mEffectEngine->slideShowMoveDir()); - //setItemPos(mEffectEngine->slideShowMoveDir()); + setIconItems( MOVE_FORWARD ); + GLX_LOG_INFO2("GlxSlideShowWidget::effectFinshed() after image selected index %d array index %d ", mSelIndex, mItemIndex); + if ( mIsPause == false ) { - mSlideTimer->start( mEffectEngine->slideDelayTime() ); + mSlideTimer->start( mSettings->slideShowDelayTime() ); } mItemList.clear(); emit indexchanged(); // on each item change - } +} void GlxSlideShowWidget::cancelEffect() - { +{ TRACER("GlxSlideShowWidget::cancelEffect()"); mEffectEngine->cancelEffect( mItemList ); - } +} void GlxSlideShowWidget::pauseSlideShow() - { +{ TRACER("GlxSlideShowWidget::pauseSlideShow()"); GLX_LOG_INFO1("GlxSlideShowWidget::pauseSlideShow() %d", this->zValue()); mIsPause = true; @@ -225,52 +209,52 @@ mContinueButton->setZValue( this->zValue() + 2); mContinueButton->show() ; emit slideShowEvent(UI_ON_EVENT); - } +} void GlxSlideShowWidget::continueSlideShow(bool checked) - { +{ Q_UNUSED( checked ) TRACER("GlxSlideShowWidget::continueSlideShow()"); mIsPause = false; if ( mModel && mModel->rowCount() > 1 ) { - mSlideTimer->start( mEffectEngine->slideDelayTime() ); + mSlideTimer->start( mSettings->slideShowDelayTime() ); } mContinueButton->hide(); emit slideShowEvent(UI_OFF_EVENT); - } +} void GlxSlideShowWidget::dataChanged(QModelIndex startIndex, QModelIndex endIndex) - { +{ Q_UNUSED( endIndex ) TRACER("GlxSlideShowWidget::dataChanged()"); GLX_LOG_INFO2("GlxSlideShowWidget::dataChanged startIndex = %d mSelIndex = %d ", startIndex.row(), mSelIndex ); int deltaIndex = startIndex.row() - mSelIndex; if ( deltaIndex <= 1 && deltaIndex >= -1 ) { - int index = ( mItemIndex + deltaIndex + NBR_ITEM ) % NBR_ITEM; //calculated the array index in which data sould be updated - GLX_LOG_INFO2("GlxSlideShowWidget::dataChanged index = %d mSelItemIndex = %d ", index, mItemIndex ); - - QVariant variant = mModel->data( startIndex, GlxFsImageRole ); - if ( variant.isValid() && variant.canConvert () ) { - mIconItems[index]->setIcon ( variant.value() ) ; - } - else { - mIconItems[index]->setIcon ( HbIcon() ) ; - } + int index = ( mItemIndex + deltaIndex + NBR_ITEM ) % NBR_ITEM; //calculated the array index in which data sould be updated + GLX_LOG_INFO2("GlxSlideShowWidget::dataChanged index = %d mSelItemIndex = %d ", index, mItemIndex ); + + QVariant variant = mModel->data( startIndex, GlxFsImageRole ); + if ( variant.isValid() && variant.canConvert () ) { + mIconItems[index]->setIcon ( variant.value() ) ; + } + else { + mIconItems[index]->setIcon ( HbIcon() ) ; + } } - } +} void GlxSlideShowWidget::rowsInserted(const QModelIndex &parent, int start, int end) - { +{ TRACER("GlxSlideShowWidget::rowsInserted()"); Q_UNUSED(parent); Q_UNUSED(start); Q_UNUSED(end); resetSlideShow(); - } +} void GlxSlideShowWidget::rowsRemoved(const QModelIndex &parent, int start, int end) - { +{ TRACER("GlxSlideShowWidget::rowsRemoved()"); Q_UNUSED(parent); Q_UNUSED(start); @@ -279,19 +263,19 @@ GLX_LOG_INFO1( "GlxSlideShowWidget::rowsRemoved row count = %d ", mModel->rowCount() ); if ( mModel->rowCount() <= 0 ) { - clearCurrentModel(); - emit slideShowEvent( EMPTY_DATA_EVENT ); + clearCurrentModel(); + emit slideShowEvent( EMPTY_DATA_EVENT ); } else { - resetSlideShow(); + resetSlideShow(); } - } +} void GlxSlideShowWidget::modelDestroyed() - { +{ TRACER("GlxSlideShowWidget::modelDestroyed()"); clearCurrentModel(); - } +} void GlxSlideShowWidget::orientationChanged(QRect screenRect) @@ -322,7 +306,7 @@ } void GlxSlideShowWidget::leftMoveEffectFinished( const HbEffect::EffectStatus &status ) - { +{ Q_UNUSED(status) TRACER("GlxSlideShowWidget::leftMoveEffectFinished()"); GLX_LOG_INFO1("GlxSlideShowWidget::leftMoveEffectFinished() %d status", status.reason); @@ -332,13 +316,13 @@ mItemIndex = ( ++mItemIndex ) % NBR_ITEM; mModel->setData( mModel->index(mSelIndex, 0), mSelIndex, GlxFocusIndexRole ); - setIconItems(MOVE_FORWARD); + setIconItems( MOVE_FORWARD ); startSlideShow(); emit indexchanged(); // on left swipe - } +} void GlxSlideShowWidget::rightMoveEffectFinished( const HbEffect::EffectStatus &status ) - { +{ Q_UNUSED(status) TRACER ( "GlxSlideShowWidget::rightMoveEffectFinished( ) "); GLX_LOG_INFO1("GlxSlideShowWidget::rightMoveEffectFinished() %d status", status.reason); @@ -348,11 +332,10 @@ mItemIndex = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; mModel->setData( mModel->index(mSelIndex, 0), mSelIndex, GlxFocusIndexRole ); - setIconItems(MOVE_BACKWARD); + setIconItems( MOVE_BACKWARD); startSlideShow(); emit indexchanged(); // on right swipe - } - +} void GlxSlideShowWidget::gestureEvent(QGestureEvent *event) { @@ -383,160 +366,146 @@ } void GlxSlideShowWidget::startSlideShow ( ) - { +{ TRACER ( "GlxSlideShowWidget::startSlideShow( ) "); GLX_LOG_INFO1 ( "GlxSlideShowWidget::startSlideShow( ) is pause %d", mIsPause); if ( mIsPause == false && mModel && mModel->rowCount() > 1 ) { - mSlideTimer->start( mEffectEngine->slideDelayTime() ); + mSlideTimer->start( mSettings->slideShowDelayTime() ); } - } +} void GlxSlideShowWidget::stopSlideShow ( ) - { +{ TRACER ( "GlxSlideShowWidget::stopSlideShow( ) "); cancelEffect(); mSlideTimer->stop(); - } +} void GlxSlideShowWidget::clearCurrentModel() - { +{ TRACER ( "GlxSlideShowWidget::clearCurrentModel( ) "); if ( mModel ) { - disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); - disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); - disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); - disconnect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); - mModel = NULL ; + disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); + disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); + disconnect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); + mModel = NULL ; } /* disconnect(mModel, SIGNAL(destroyed()), this, SLOT(_q_modelDestroyed())); disconnect(mModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); */ - } +} void GlxSlideShowWidget::initializeNewModel() - { +{ TRACER("GlxSlideShowWidget::initializeNewModel" ); if ( mModel ) { - connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); - connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); - connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); - connect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); + connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); + connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); + connect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); } - } +} void GlxSlideShowWidget::resetSlideShow() - { +{ TRACER("GlxSlideShowWidget::resetSlideShow()" ); if(! mModel) { return; } QVariant variant = mModel->data( mModel->index( mSelIndex, 0 ), GlxFocusIndexRole ); if ( variant.isValid() && variant.canConvert () ) { - mSelIndex = variant.value() ; - GLX_LOG_INFO1("GlxSlideShowWidget::resetSlideShow() selected index %d", mSelIndex ); + mSelIndex = variant.value() ; + GLX_LOG_INFO1("GlxSlideShowWidget::resetSlideShow() selected index %d", mSelIndex ); } variant = mModel->data( mModel->index( mSelIndex, 0 ), GlxFsImageRole ); if ( variant.isValid() && variant.canConvert () ) { - mIconItems[mItemIndex]->setIcon ( variant.value() ) ; + mIconItems[mItemIndex]->setIcon ( variant.value() ) ; } else { - mIconItems[mItemIndex]->setIcon ( HbIcon() ) ; + mIconItems[mItemIndex]->setIcon ( HbIcon() ) ; } + setIconItems(MOVE_FORWARD); setIconItems(MOVE_BACKWARD); if ( mIsPause == false && mModel && mModel->rowCount() > 1 ) { - mSlideTimer->start( mEffectEngine->slideDelayTime() ); + mSlideTimer->start( mSettings->slideShowDelayTime() ); } - } +} -void GlxSlideShowWidget::setIconItems(int moveDir) - { +void GlxSlideShowWidget::setIconItems( int moveDir ) +{ TRACER("GlxSlideShowWidget::setIconItems()"); int index = 0, itemIndex = 0; int rowCount = mModel->rowCount(); GLX_LOG_INFO1("GlxSlideShowWidget::setIconItems() rowcount %d ", rowCount); if ( rowCount == 0 ) { - return ; + return ; } - - if (moveDir == MOVE_FORWARD) { - index = ( mSelIndex + 1) % rowCount; - itemIndex = ( mItemIndex + 1) % NBR_ITEM; - }else { - index = mSelIndex ? mSelIndex - 1 : rowCount - 1; - itemIndex = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; + + if ( moveDir == MOVE_FORWARD ) { + index = ( mSelIndex + 1 ) % rowCount; + itemIndex = ( mItemIndex + 1) % NBR_ITEM; + } + else { + index = mSelIndex ? mSelIndex - 1 : rowCount - 1; + itemIndex = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; } GLX_LOG_INFO4("GlxSlideShowWidget::setIconItems() image selected index %d array index %d index %d icon index %d", mSelIndex, mItemIndex, index, itemIndex); QVariant variant = mModel->data( mModel->index( index, 0 ), GlxFsImageRole ); if ( variant.isValid() && variant.canConvert () ) { - mIconItems[itemIndex]->setIcon ( variant.value() ) ; + mIconItems[itemIndex]->setIcon ( variant.value() ) ; } else { - mIconItems[itemIndex]->setIcon ( HbIcon() ) ; + mIconItems[itemIndex]->setIcon ( HbIcon() ) ; } - } - -//To:DO it is not used so may be remove later -void GlxSlideShowWidget::setItemPos(int moveDir) - { - Q_UNUSED( moveDir) - TRACER("GlxSlideShowWidget::setItemPos()"); - GLX_LOG_INFO1("GlxSlideShowWidget::setItemPos() array index %d", mItemIndex ); - - if (moveDir == MOVE_FORWARD) { - int index = ( mItemIndex + 1) % NBR_ITEM; - mIconItems[index]->setPos( mScreenRect.width(), mScreenRect.top() ); - } - else { - int index = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; - mIconItems[index]->setPos( -mScreenRect.width(), mScreenRect.top() ); - } - } +} void GlxSlideShowWidget::moveImage(int nextIndex, int posX, const QString & move, char * callBack) - { +{ TRACER("GlxSlideShowWidget::MoveImage()"); if ( mModel->rowCount() <= 1 || mEffectEngine->isEffectRuning( mItemList ) ) { - return ; + return ; } mSlideTimer->stop(); - HbEffect::start(mIconItems[mItemIndex], QString("HbIconItem"), move ); + HbEffect::start( mIconItems[mItemIndex], QString("HbIconItem"), move ); mIconItems[nextIndex]->setPos( posX, mScreenRect.top()); + mIconItems[nextIndex]->setOpacity(1); HbEffect::start(mIconItems[nextIndex], QString("HbIconItem"), QString("Move"), this, callBack ); - } +} void GlxSlideShowWidget::addConnections() - { +{ TRACER("GlxSlideShowWidget::addConnections()"); if ( mEffectEngine ) { - connect( mEffectEngine, SIGNAL( effectFinished() ), this, SLOT( effectFinshed() ) ); + connect( mEffectEngine, SIGNAL( effectFinished() ), this, SLOT( effectFinshed() ) ); } if ( mSlideTimer ) { - connect( mSlideTimer, SIGNAL(timeout()), this, SLOT( triggeredEffect() ) ); + connect( mSlideTimer, SIGNAL(timeout()), this, SLOT( triggeredEffect() ) ); } if ( mContinueButton ) { - connect( mContinueButton, SIGNAL( clicked(bool) ), this, SLOT( continueSlideShow(bool) ) ); + connect( mContinueButton, SIGNAL( clicked(bool) ), this, SLOT( continueSlideShow(bool) ) ); } - } +} void GlxSlideShowWidget::removeConnections() - { +{ TRACER("GlxSlideShowWidget::removeConnections()"); if ( mEffectEngine ) { - disconnect( mEffectEngine, SIGNAL( effectFinished() ), this, SLOT( effectFinshed() ) ); + disconnect( mEffectEngine, SIGNAL( effectFinished() ), this, SLOT( effectFinshed() ) ); } if ( mSlideTimer ) { - disconnect( mSlideTimer, SIGNAL(timeout()), this, SLOT( triggeredEffect() ) ); + disconnect( mSlideTimer, SIGNAL(timeout()), this, SLOT( triggeredEffect() ) ); } if ( mContinueButton ) { - disconnect( mContinueButton, SIGNAL( clicked(bool) ), this, SLOT( continueSlideShow(bool) ) ); + disconnect( mContinueButton, SIGNAL( clicked(bool) ), this, SLOT( continueSlideShow(bool) ) ); } - } +} diff -r 1ee2af37811f -r 6481344a6d67 ui/views/views.pro --- a/ui/views/views.pro Thu May 27 12:51:42 2010 +0300 +++ b/ui/views/views.pro Fri Jun 11 13:38:23 2010 +0300 @@ -20,10 +20,8 @@ DEPENDPATH += . fullscreenview/inc fullscreenview/src gridview/inc gridview/src slideshowsettingsview/inc slideshowsettingsview/src viewbase/inc CONFIG += hb -LIBS += -lglxmediamodel.dll \ - -lglxlistmodel.dll \ - -lglxfavmediamodel.dll \ - -lglximagedecoderwrapper.dll \ +LIBS += -lglxfavmediamodel.dll \ + -lglximagedecoderwrapper.dll \ -lglxloggerqt.dll \ -lshareui.dll \ -lglxtvout.dll \ @@ -32,15 +30,15 @@ -lglxlogging.dll \ -lganeswidgets.dll \ -lglxmodelwrapper.dll \ - -lxqsettingsmanager + -lglxviewutilities.dll \ + -lglxzoomwidget.dll DEFINES += BUILD_GLXVIEWS INCLUDEPATH += . ../inc \ ../../inc \ - ../uiengine/model/mediamodel/inc \ - ../uiengine/model/listmodel/inc \ - ../uiengine/model/favmediamodel/inc \ + ../widgets/glxzoomwidget/inc \ + ../uiengine/model/favmediamodel/inc \ ../uiengine/medialistwrapper/inc \ ../viewbase/inc \ ../../commonutilities/imagedecoderwrapper/inc \ @@ -48,6 +46,8 @@ ../../traces \ ../../tvout/tvoutwrapper/inc \ ../uiengine/model/modelwrapper/inc \ + ../viewutilities/effectengine/inc \ + ../viewutilities/settingutility/inc \ /epoc32/include/mw/hgwidgets symbian: { @@ -61,39 +61,28 @@ HEADERS += viewbase/inc/glxview.h \ fullscreenview/inc/glxcoverflow.h \ fullscreenview/inc/glxfullscreenview.h \ - fullscreenview/inc/glxzoomwidget.h \ detailsview/inc/glxdetailsview.h \ detailsview/inc/glxdetailscustomwidgets.h \ detailsview/inc/glxdetailscustomicon.h \ gridview/inc/glxgridview.h \ - slideshowsettingsview/inc/glxslideshowsettingsview.h \ + slideshowsettingsview/inc/glxslideshowsettingsview.h \ listview/inc/glxlistview.h \ - effectengine/inc/glxeffectengine.h \ slideshowview/inc/glxslideshowview.h \ slideshowview/inc/glxslideshowwidget.h \ - effectengine/effectplugin/inc/glxeffectpluginbase.h \ - effectengine/effectplugin/inc/glxbackwardtransitionplugin.h \ - effectengine/effectplugin/inc/glxforwardtransitionplugin.h \ - effectengine/effectplugin/inc/glxfadeplugin.h \ - docloaders/inc/glxviewdocloader.h \ + docloaders/inc/glxviewdocloader.h \ viewsfactory/inc/glxviewsfactory.h \ SOURCES += viewbase/src/glxview.cpp \ fullscreenview/src/glxcoverflow.cpp \ fullscreenview/src/glxfullscreenview.cpp \ - fullscreenview/src/glxzoomwidget.cpp \ detailsview/src/glxdetailsview.cpp \ detailsview/src/glxdetailscustomwidgets.cpp \ detailsview/src/glxdetailscustomicon.cpp \ gridview/src/glxgridview.cpp \ slideshowsettingsview/src/glxslideshowsettingsview.cpp \ listview/src/glxlistview.cpp \ - effectengine/src/glxeffectengine.cpp \ slideshowview/src/glxslideshowview.cpp \ slideshowview/src/glxslideshowwidget.cpp \ - effectengine/effectplugin/src/glxbackwardtransitionplugin.cpp \ - effectengine/effectplugin/src/glxforwardtransitionplugin.cpp \ - effectengine/effectplugin/src/glxfadeplugin.cpp \ docloaders/src/glxviewdocloader.cpp \ viewsfactory/src/glxviewsfactory.cpp diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectengine/inc/glxeffectengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectengine/inc/glxeffectengine.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,158 @@ +/* +* 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: ?Description +* +*/ + + +#ifndef GLXEFFECTENGINE_H +#define GLXEFFECTENGINE_H + +#ifdef BUILD_GLXVIEWUTILITIES +#define GLX_VIEWUTILITIES_EXPORT Q_DECL_EXPORT +#else +#define GLX_VIEWUTILITIES_EXPORT Q_DECL_IMPORT +#endif + +#include +#include +#include +#include +#include +#include "glxuistd.h" + + +class QStringList ; +class GlxTransitionEffectSetting ; +class GlxEffectPluginBase; +class GlxEffectPluginResolver; + +/* + * It is customise class for Photo Application to run the effect. + */ + +class GLX_VIEWUTILITIES_EXPORT GlxEffectEngine : public QObject +{ + Q_OBJECT + +public: + /* + * Constructor + */ + GlxEffectEngine( ); + /* + * Destructor + */ + ~GlxEffectEngine(); + + /* + * Register the item type with selected effect + * User can change the effect at run time so it is required to register and deregister the effect + * before playing the effect. + */ + void registerEffect(const QString &itemType); + + /* + * Deregister the current register slide show effect + */ + void deRegisterEffect(const QString &itemType); + + /* + * To register a set of transition effect + * e.g "grid to full screeen", "fullscreen to grid" + */ + void registerTransitionEffect(); + + /* + * Deregister the set of register transition effect + */ + void deregistertransitionEffect(); + + /* + * Run the effect on single item + */ + void runEffect(QGraphicsItem * item, const QString & itemType ); + + /* + * Run the effect on multiple item + */ + void runEffect(QList< QGraphicsItem * > & items, const QString & itemType ); + + /* + * Run the transition effect + */ + void runEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect); + + /* + * Cancel the runing effect on the given item + */ + void cancelEffect(QGraphicsItem * item); + + /* + * Cancel the running effect on the given items + */ + void cancelEffect( const QList< QGraphicsItem * > & items ); + + /* + * cancel the runing transition effect + */ + void cancelEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect); + + /* + * Return the running status of the given item + */ + bool isEffectRuning(QGraphicsItem * item); + + /* + * return the running status of given items + */ + bool isEffectRuning(const QList< QGraphicsItem * > & items); + +signals: + /* + * emit the signal of effect finished + */ + void effectFinished(); + +public slots: + /* + * Slot to monitor the slide show effect finished + */ + void slideShowEffectFinished( const HbEffect::EffectStatus &status ); + + /* + * Slot to monitor the transi + */ + void transitionEffectFinished( const HbEffect::EffectStatus &status ); + +private: + /* + * Initialise the all transition effect + */ + void initTransitionEffect(); + + /* + * Clear the all transition effect + */ + void cleanTransitionEfffect(); + +private: + int mNbrEffectRunning; //containe the number of effect running + GlxEffectPluginBase *mEffectPlugin; //No ownership + QHash mTransitionEffectList; + GlxEffect mTransitionEffect; + GlxEffectPluginResolver *mEffectResolver; +}; + +#endif /*GLXEFFECTENGINE_H*/ diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectengine/inc/glxtransitioneffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectengine/inc/glxtransitioneffect.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,62 @@ +/* +* 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: ?Description +* +*/ + +#ifndef GLXTRANSITIONEFFECT_H +#define GLXTRANSITIONEFFECT_H + +#include + +#include "glxuistd.h" + +class QString; +class QGraphicsItem ; + +/* + * This class have the views transition effect information + */ +class GlxTransitionEffectSetting +{ +public : + GlxTransitionEffectSetting(GlxEffect effect); + ~GlxTransitionEffectSetting(); + + QList effectFileList() { return mEffectFileList ; } + QList itemType() { return mItemType ; } + QList eventType() { return mEventType ; } + bool isTransitionLater() { return mTransitionLater ; } + QGraphicsItem * animationItem() { return mItem ; } + + void setEffectFileList( QList & effectFileList) { mEffectFileList = effectFileList ; } + void setItemTypes( QList & itemType) { mItemType = itemType; } + void setEventTypes( QList & eventType) { mEventType = eventType ; } + void setTransitionLater(bool transitionLater) { mTransitionLater = transitionLater ; } + void setAnimationItem(QGraphicsItem *item) { mItem = item ;} + int count() { return mEffectFileList.count() ; } + +private : + void init(); + +private : + GlxEffect mEffect; //transition effect type + bool mTransitionLater; //second animation will run same time(false) or later (true) + QGraphicsItem *mItem; //it will used in the case of animation run later + QList mEffectFileList; //list of fxml file used for animation + QList mItemType; //list of item type + QList mEventType; //list of event type +}; + +#endif //GLXTRANSITIONEFFECT_H diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectengine/src/glxeffectengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectengine/src/glxeffectengine.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,265 @@ +/* +* 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: ?Description +* +*/ + + +#include "glxeffectengine.h" +#include "glxeffectpluginbase.h" +#include "glxtransitioneffect.h" +#include "glxsettinginterface.h" +#include "glxeffectpluginresolver.h" + +#include + +GlxEffectEngine::GlxEffectEngine( ) + : mNbrEffectRunning( 0 ), + mEffectPlugin( NULL ), + mTransitionEffect( NO_EFFECT ), + mEffectResolver( NULL ) +{ + qDebug("GlxSlideShowEffectEngine::GlxSlideShowEffectEngine()"); + mTransitionEffectList.clear(); +} + +GlxEffectEngine::~GlxEffectEngine() +{ + qDebug("GlxSlideShowEffectEngine::~GlxSlideShowEffectEngine()"); + delete mEffectResolver; + mEffectResolver = NULL; + + cleanTransitionEfffect(); +} + +void GlxEffectEngine::registerEffect(const QString &itemType) +{ + GlxSettingInterface *settingObj = GlxSettingInterface::instance(); // NO ownership + if ( mEffectResolver == NULL ) { + mEffectResolver = new GlxEffectPluginResolver(); + } + /* read the selected effect through the centrep and get the effect plugin object through effect plugin resolver*/ + mEffectPlugin = mEffectResolver->effectPlugin( settingObj->slideShowEffectId( settingObj->slideShowEffectIndex ( ) ) ); //No ownership + + QList effectPathList = mEffectPlugin->effectFileList(); + + qDebug("GlxSlideShowEffectEngine::registerEffect() item type %s file path %s", itemType.utf16(), effectPathList[0].utf16()); + for ( int i = 0; i < effectPathList.count() ; ++i ) { + HbEffect::add(itemType, effectPathList.at(i), QString( "Click%1" ).arg(i)); + } +} + +void GlxEffectEngine::deRegisterEffect(const QString &itemType) +{ + qDebug("GlxSlideShowEffectEngine::deRegisterEffect() item type %s", itemType.utf16()); + QList effectPathList = mEffectPlugin->effectFileList(); + for ( int i = 0; i < effectPathList.count() ; ++i ) { + HbEffect::remove(itemType, effectPathList.at(i), QString( "Click%1" ).arg(i)); + } + mEffectPlugin = NULL; +} + +void GlxEffectEngine::registerTransitionEffect() +{ + qDebug("GlxSlideShowEffectEngine::registerTransitionEffect()"); + initTransitionEffect(); +} + +void GlxEffectEngine::deregistertransitionEffect() +{ + qDebug("GlxSlideShowEffectEngine::deregisterTransitionEffect()"); + cleanTransitionEfffect(); +} + +void GlxEffectEngine::runEffect(QGraphicsItem * item, const QString & itemType ) +{ + qDebug("GlxSlideShowEffectEngine::runEffect()1 item type %s", itemType.utf16()); + HbEffect::start(item, itemType, QString( "Click1" ), this, "slideShowEffectFinished"); + ++mNbrEffectRunning; +} + +void GlxEffectEngine::runEffect(QList< QGraphicsItem * > & items, const QString & itemType ) +{ + qDebug("GlxSlideShowEffectEngine::runEffect()2 item Type %s", itemType.utf16()); + mEffectPlugin->setUpItems(items); + for ( int i = 0; i < items.count() ; ++i ) { + if ( mEffectPlugin->isAnimationLater(i) == FALSE ) { + HbEffect::start(items.at(i), itemType, QString( "Click%1").arg(i), this, "slideShowEffectFinished"); + } + ++mNbrEffectRunning; + } +} + +void GlxEffectEngine::runEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect) +{ + qDebug("GlxSlideShowEffectEngine::runEffect()3 effect type %d ", transitionEffect); + + GlxTransitionEffectSetting *effectSetting = mTransitionEffectList.value( transitionEffect ); + + if ( effectSetting == NULL || items.count() != effectSetting->count() ) { + return; + } + + mTransitionEffect = transitionEffect; + for ( int i = 0; i < effectSetting->count() ; ++i) { + ++mNbrEffectRunning; + if ( ( i == effectSetting->count() -1) && effectSetting->isTransitionLater() ) + { + effectSetting->setAnimationItem( items.at(i) ); + items.at(i)->hide(); + } + else { + HbEffect::start(items.at(i), effectSetting->itemType().at(i), effectSetting->eventType().at(i), this, "transitionEffectFinished"); + } + } +} + +void GlxEffectEngine::cancelEffect(QGraphicsItem * item) +{ + if ( HbEffect::effectRunning( item, QString( "Click1" ) ) ) { + HbEffect::cancel( item, QString( "Click1" ) ); + } +} + +void GlxEffectEngine::cancelEffect(const QList< QGraphicsItem * > & items) +{ + for ( int i = 0; i < items.count() ; ++i ) { + if ( HbEffect::effectRunning( items.at(i), QString( "Click%1").arg(i) ) ) { + HbEffect::cancel( items.at(i), QString( "Click%1").arg(i) ); + } + } +} + +void GlxEffectEngine::cancelEffect(QList< QGraphicsItem * > & items, GlxEffect transitionEffect) +{ + GlxTransitionEffectSetting *effectSetting = mTransitionEffectList.value( transitionEffect ); + + if ( effectSetting == NULL || items.count() != effectSetting->count() ) { + return; + } + + for ( int i = 0; i < effectSetting->count() ; ++i) { + HbEffect::cancel(items.at(i), effectSetting->eventType().at(i) ); + } +} + +bool GlxEffectEngine::isEffectRuning(QGraphicsItem * item) +{ + if ( HbEffect::effectRunning( item, QString( "Click1" ) ) ) { + return true; + } + return false; +} + +bool GlxEffectEngine::isEffectRuning(const QList< QGraphicsItem * > & items) +{ + for ( int i = 0; i < items.count() ; ++i ) { + if ( HbEffect::effectRunning( items.at(i), QString( "Click%1").arg(i) ) ) { + return true; + } + } + return false; +} + +void GlxEffectEngine::slideShowEffectFinished( const HbEffect::EffectStatus &status ) +{ + Q_UNUSED( status ) + qDebug("GlxSlideShowEffectEngine::slideShowEffectFinished() number of effect %d ", mNbrEffectRunning); + + --mNbrEffectRunning; + + if ( mEffectPlugin->isAnimationLater( mNbrEffectRunning) ) { + HbEffect::start( mEffectPlugin->animationItem(), mEffectPlugin->ItemType(), QString( "Click%1").arg(mNbrEffectRunning), this, "slideShowEffectFinished"); + } + + if (mNbrEffectRunning == 0) { + emit effectFinished(); + } +} + +void GlxEffectEngine::transitionEffectFinished( const HbEffect::EffectStatus &status ) +{ + Q_UNUSED( status ) + qDebug("GlxSlideShowEffectEngine::transitionEffectFinished() number of effect %d status %d", mNbrEffectRunning, status.reason); + + --mNbrEffectRunning; + if ( mNbrEffectRunning == 1 ) { + GlxTransitionEffectSetting *effectSetting = mTransitionEffectList.value( mTransitionEffect ); + if ( effectSetting->isTransitionLater() ){ + effectSetting->animationItem()->show(); + HbEffect::start( effectSetting->animationItem(), effectSetting->itemType().at(1), effectSetting->eventType().at(1), this, "transitionEffectFinished"); + mTransitionEffect = NO_EFFECT; + } + } + + if (mNbrEffectRunning == 0) { + emit effectFinished(); + } +} + +void GlxEffectEngine::initTransitionEffect() +{ + GlxTransitionEffectSetting *effectSetting = NULL; + + effectSetting = new GlxTransitionEffectSetting(GRID_TO_FULLSCREEN); + for ( int i = 0; i < effectSetting->count(); ++i ) { + HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; + } + mTransitionEffectList[GRID_TO_FULLSCREEN] = effectSetting; + + effectSetting = new GlxTransitionEffectSetting( FULLSCREEN_TO_GRID ); + for ( int i = 0; i < effectSetting->count(); ++i ) { + HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; + } + mTransitionEffectList[FULLSCREEN_TO_GRID] = effectSetting; + + effectSetting = new GlxTransitionEffectSetting( GRID_TO_ALBUMLIST ); + for ( int i = 0; i < effectSetting->count(); ++i ) { + HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; + } + mTransitionEffectList[GRID_TO_ALBUMLIST] = effectSetting; + + effectSetting = new GlxTransitionEffectSetting( ALBUMLIST_TO_GRID ); + for ( int i = 0; i < effectSetting->count(); ++i ) { + HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; + } + mTransitionEffectList[ALBUMLIST_TO_GRID] = effectSetting; + + effectSetting = new GlxTransitionEffectSetting( FULLSCREEN_TO_DETAIL ); + for ( int i = 0; i < effectSetting->count(); ++i ) { + HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; + } + mTransitionEffectList[FULLSCREEN_TO_DETAIL] = effectSetting; + + effectSetting = new GlxTransitionEffectSetting( DETAIL_TO_FULLSCREEN ); + for ( int i = 0; i < effectSetting->count(); ++i ) { + HbEffect::add( effectSetting->itemType().at(i), effectSetting->effectFileList().at(i), effectSetting->eventType().at(i)) ; + } + mTransitionEffectList[DETAIL_TO_FULLSCREEN] = effectSetting; +} + +void GlxEffectEngine::cleanTransitionEfffect() +{ + qDebug("GlxSlideShowEffectEngine::cleanTrnastionEfffect()"); + + foreach( GlxTransitionEffectSetting *list, mTransitionEffectList) { + for ( int i = 0; i < list->count(); ++i ) { + HbEffect::remove( list->itemType().at(i), list->effectFileList().at(i), list->eventType().at(i)) ; + } + delete list; + } + mTransitionEffectList.clear(); + +} + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectengine/src/glxtransitioneffect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectengine/src/glxtransitioneffect.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,106 @@ +/* +* 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: ?Description +* +*/ + +#include + +#include + +GlxTransitionEffectSetting::GlxTransitionEffectSetting(GlxEffect effect): mEffect(effect), mTransitionLater(false), mItem(0) +{ + qDebug("GlxTransitionEffectSetting::GlxTransitionEffectSetting() effect id %d ", effect); + mEffectFileList.clear(); + mItemType.clear(); + mEventType.clear(); + init(); +} + +void GlxTransitionEffectSetting::init() +{ + qDebug("GlxTransitionEffectSetting::init() effect id %d ", mEffect); + + switch( mEffect ) { + case GRID_TO_FULLSCREEN : + mEffectFileList.append( QString(":/data/gridtofullscreenhide.fxml")); + mItemType.append( QString("HbGridViewItem") ); + mEventType.append(QString("click1") ); + + mEffectFileList.append( QString(":/data/gridtofullscreenshow.fxml")); + mItemType.append( QString("HbView") ); + mEventType.append(QString("click2") ); + break; + + case FULLSCREEN_TO_GRID : + mEffectFileList.append( QString(":/data/fullscreentogrid.fxml")); + mItemType.append( QString("HbGridView") ); + mEventType.append(QString("click3") ); + break; + + case GRID_TO_ALBUMLIST: + mEffectFileList.append( QString(":/data/gridtoalbumlisthide.fxml")); + mItemType.append( QString("HbView") ); + mEventType.append(QString("click4") ); + + mEffectFileList.append( QString(":/data/gridtoalbumlist.fxml")); + mItemType.append( QString("HbListView") ); + mEventType.append(QString("click5") ); + break; + + case ALBUMLIST_TO_GRID: + mEffectFileList.append( QString(":/data/albumlisttogrid.fxml")); + mItemType.append( QString("HbListView") ); + mEventType.append(QString("click6") ); + + mEffectFileList.append( QString(":/data/albumlisttogridshow.fxml")); + mItemType.append( QString("HbView") ); + mEventType.append(QString("click7") ); + break; + + case FULLSCREEN_TO_DETAIL : + mEffectFileList.append( QString(":/data/view_flip_hide.fxml")); + mItemType.append( QString("HbView") ); + mEventType.append(QString("click8") ); + + mEffectFileList.append( QString(":/data/view_flip_show.fxml")); + mItemType.append( QString("HbView") ); + mEventType.append(QString("click9") ); + mTransitionLater = true; + break; + + case DETAIL_TO_FULLSCREEN : + mEffectFileList.append( QString(":/data/view_flip_hide.fxml")); + mItemType.append( QString("HbView") ); + mEventType.append(QString("click10") ); + + mEffectFileList.append( QString(":/data/view_flip_show.fxml")); + mItemType.append( QString("HbView") ); + mEventType.append(QString("click11") ); + mTransitionLater = true; + break; + + default : + break; + } +} + +GlxTransitionEffectSetting::~GlxTransitionEffectSetting() +{ + qDebug("GlxTransitionEffectSetting::~GlxTransitionEffectSetting() effect id %d ", mEffect); + mEffectFileList.clear(); + mItemType.clear(); + mEventType.clear(); +} + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/inc/glxeffectpluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/inc/glxeffectpluginbase.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,77 @@ +/* +* 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: ?Description +* +*/ + +#ifndef GLXEFFECTPLUGINBASE_H +#define GLXEFFECTPLUGINBASE_H + +#include +#include +#include + +/* + * It is based class of diffetent animation plugin. + * These Plugin mostly used for playing the animation in slide show + */ + +class GlxEffectPluginBase +{ +public : + /* + * Constructor + */ + GlxEffectPluginBase( int effectId ) { mEffectId = effectId ; } + + /* + * Destructor + */ + virtual ~GlxEffectPluginBase() {} + + /* + * return the list of effect file's + */ + virtual QList effectFileList() = 0; + + /* + * Setup the item's postion and other properties before plaing the animation + */ + virtual void setUpItems( QList< QGraphicsItem * > & items ) { Q_UNUSED( items ) } + + /* + * second animation will run same time(false) or later (true) + */ + virtual bool isAnimationLater(int index) + { + Q_UNUSED( index ) + return false ; + } + + /* + * Return the item type of animated object + */ + virtual QString ItemType() { return QString("HbIconItem") ; } + + /* + * Return the animation object + */ + virtual QGraphicsItem * animationItem() { return NULL; } + +private : + int mEffectId ; + +}; + +#endif /*GLXEFFECTPLUGINBASE_H*/ diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/inc/glxeffectpluginresolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/inc/glxeffectpluginresolver.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,59 @@ +/* +* 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: ?Description +* +*/ + + +#ifndef GLXEFFECTPLUGINRESOLVER_H +#define GLXEFFECTPLUGINRESOLVER_H + +#include +#include + +#include "glxuistd.h" + +class GlxEffectPluginBase ; +class QString ; + +class GlxEffectPluginResolver +{ + +public : + /* + * Constructor + */ + GlxEffectPluginResolver( ); + + /* + * Return the name of the effect + */ + static QString effectName( int effectId ); + + /* + * Return the effect plugin instance to run the effect + */ + GlxEffectPluginBase * effectPlugin( int effectId ); + + /* + * Destructor + */ + ~GlxEffectPluginResolver( ); + +private : + QHash< GlxEffect, GlxEffectPluginBase * > mEffectPluginList ; +}; + + +#endif //GLXEFFECTPLUGINRESOLVER_H diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/inc/glxfadeeffectplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/inc/glxfadeeffectplugin.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,57 @@ +/* +* 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: ?Description +* +*/ + +#ifndef GLXFADEEFFECTPLUGIN_H +#define GLXFADEEFFECTPLUGIN_H + +#include "glxeffectpluginbase.h" + +class QString ; + +class GlxFadeEffectPlugin : public GlxEffectPluginBase +{ +public : + /* + * Constructor + */ + GlxFadeEffectPlugin(); + + /* + * Destructor + */ + ~GlxFadeEffectPlugin(); + + /* + * return the fade in and fade out fxml file list + */ + QList effectFileList() { return mEffectFileList ; } + + /* + * setup the item postion and set the mItem value + */ + void setUpItems( QList< QGraphicsItem * > & items ); + + /* + * get the name of the effect, use to shown in the slide show setting view + */ + static QString effectName(); + +private : + QList mEffectFileList; +}; + +#endif /* GLXFADEEFFECTPLUGIN_H */ diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/inc/glxflipeffectplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/inc/glxflipeffectplugin.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,68 @@ +/* +* 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: ?Description +* +*/ + + +#ifndef GLXFLIPEFFECTPLUGIN_H +#define GLXFLIPEFFECTPLUGIN_H + +#include "glxeffectpluginbase.h" + +class GlxFlipEffectPlugin : public GlxEffectPluginBase +{ +public : + /* + * Constructor + */ + GlxFlipEffectPlugin(); + + /* + * Destructor + */ + ~GlxFlipEffectPlugin(); + + /* + * Get the flip hide and Flip Show file list + */ + QList effectFileList() { return mEffectFileList; } + + /* + * setup the item postion and set the mItem value + */ + void setUpItems( QList< QGraphicsItem * > & items ); + + /* + * second animation will be run later + */ + bool isAnimationLater(int index) ; + + /* + * return the second animation object to play the flip show animation + */ + QGraphicsItem * animationItem() ; + + /* + * get the name of the effect, use to shown in the slide show setting view + */ + static QString effectName() { return QString ("Flip") ; } + +private : + QList mEffectFileList; + QGraphicsItem *mItem; +}; + +#endif /*GLXFLIPEFFECTPLUGIN_H*/ + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/inc/glxzoominoutplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/inc/glxzoominoutplugin.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,57 @@ +/* +* 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: ?Description +* +*/ + + +#ifndef GLXZOOMINOUTEFFECTPLUGIN_H +#define GLXZOOMINOUTEFFECTPLUGIN_H + +#include "glxeffectpluginbase.h" + +class GlxZoomInOutEffectPlugin : public GlxEffectPluginBase +{ +public : + /* + * Constructor + */ + GlxZoomInOutEffectPlugin(); + + /* + * Destructor + */ + ~GlxZoomInOutEffectPlugin(); + + /* + * Get the flip hide and Flip Show file list + */ + QList effectFileList() { return mEffectFileList; } + + /* + * setup the item postion and set the mItem value + */ + void setUpItems( QList< QGraphicsItem * > & items ); + + /* + * get the name of the effect, use to shown in the slide show setting view + */ + static QString effectName() { return QString ("ZoomInOut") ; } + +private : + QList mEffectFileList; + QGraphicsItem *mItem; +}; + +#endif /*GLXZOOMINOUTEFFECTPLUGIN_H*/ diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/src/glxeffectpluginresolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/src/glxeffectpluginresolver.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,86 @@ +/* +* 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: ?Description +* +*/ + +#include + +#include "glxeffectpluginresolver.h" +#include "glxeffectpluginbase.h" +#include "glxfadeeffectplugin.h" +#include "glxflipeffectplugin.h" +#include "glxzoominoutplugin.h" + +GlxEffectPluginResolver::GlxEffectPluginResolver() +{ + mEffectPluginList.clear(); +} + +QString GlxEffectPluginResolver::effectName( int effectId ) +{ + switch ( effectId ) { + case FLIP_EFFECT : + return GlxFlipEffectPlugin::effectName(); + + case SMOOTH_FADE : + return GlxFadeEffectPlugin::effectName() ; + + case ZOOM_TO_FACE : + return GlxZoomInOutEffectPlugin::effectName(); //To:Do temp remove once plugin is ready + + default : + return GlxFadeEffectPlugin::effectName() ; + } +} + +GlxEffectPluginBase *GlxEffectPluginResolver::effectPlugin( int effectId ) +{ + GlxEffectPluginBase * effectPlugin = mEffectPluginList.value( ( GlxEffect )effectId ); + if ( effectPlugin ) { + return effectPlugin ; + } + + switch ( effectId ) { + case FLIP_EFFECT : + effectPlugin = new GlxFlipEffectPlugin(); + mEffectPluginList[ FLIP_EFFECT ] = effectPlugin ; + break ; + + case ZOOM_TO_FACE : + effectPlugin = new GlxZoomInOutEffectPlugin() ; + mEffectPluginList[ ZOOM_TO_FACE ] = effectPlugin ; + break ; + + case SMOOTH_FADE : + default : + effectPlugin = mEffectPluginList.value( SMOOTH_FADE ); + if ( effectPlugin == NULL ) { + effectPlugin = new GlxFadeEffectPlugin(); + mEffectPluginList[ SMOOTH_FADE ] = effectPlugin ; + } + break ; + } + + return effectPlugin ; +} + +GlxEffectPluginResolver::~GlxEffectPluginResolver() +{ + foreach( GlxEffectPluginBase *list, mEffectPluginList) { + delete list; + list = NULL; + } + mEffectPluginList.clear(); +} diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/src/glxfadeeffectplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/src/glxfadeeffectplugin.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,47 @@ +/* +* 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: ?Description +* +*/ + + +#include "glxfadeeffectplugin.h" +#include "glxuistd.h" +#include "glxlocalisationstrings.h" + +GlxFadeEffectPlugin::GlxFadeEffectPlugin() : GlxEffectPluginBase( SMOOTH_FADE ) +{ + mEffectFileList.append(QString(":/data/opacity_deactivate.fxml")); + mEffectFileList.append(QString(":/data/opacity_activate.fxml")); +} + +void GlxFadeEffectPlugin::setUpItems( QList< QGraphicsItem * > & items ) +{ + if ( items.count() < 2 ) + return; + + items.at(0)->setPos(0,0); + items.at(1)->setPos(0,0); +} + +QString GlxFadeEffectPlugin::effectName() +{ + return ( GLX_VAL_SMOOTH_FADE ) ; +} + +GlxFadeEffectPlugin::~GlxFadeEffectPlugin() +{ + mEffectFileList.clear(); +} + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/src/glxflipeffectplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/src/glxflipeffectplugin.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,58 @@ +/* +* 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: ?Description +* +*/ + + +#include "glxflipeffectplugin.h" +#include "glxuistd.h" + +GlxFlipEffectPlugin::GlxFlipEffectPlugin() : GlxEffectPluginBase( FLIP_EFFECT ) +{ + mEffectFileList.append(QString(":/data/view_flip_hide.fxml")); + mEffectFileList.append(QString(":/data/view_flip_show.fxml")); +} + +void GlxFlipEffectPlugin::setUpItems( QList< QGraphicsItem * > & items ) +{ + if ( items.count() < 2 ) + return; + + mItem = items.at(1); + mItem->hide(); + mItem->setPos(0,0); + items.at(0)->setPos(0,0); +} + +bool GlxFlipEffectPlugin::isAnimationLater(int index) +{ + if ( index == 1) { + return true; + } + return false; +} + +QGraphicsItem * GlxFlipEffectPlugin::animationItem() +{ + mItem->show(); + return mItem ; +} + +GlxFlipEffectPlugin::~GlxFlipEffectPlugin() +{ + mEffectFileList.clear(); +} + + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/effectplugin/src/glxzoominoutplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/effectplugin/src/glxzoominoutplugin.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,41 @@ +/* +* 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: ?Description +* +*/ + + +#include "glxzoominoutplugin.h" +#include "glxuistd.h" + +GlxZoomInOutEffectPlugin::GlxZoomInOutEffectPlugin() : GlxEffectPluginBase( ZOOM_TO_FACE ) +{ + mEffectFileList.append(QString(":/data/zoomin.fxml")); + mEffectFileList.append(QString(":/data/zoomout.fxml")); +} + +void GlxZoomInOutEffectPlugin::setUpItems( QList< QGraphicsItem * > & items ) +{ + if ( items.count() < 2 ) + return; + + mItem = items.at(1); + mItem->setPos(0,0); + items.at(0)->setPos(0,0); +} + +GlxZoomInOutEffectPlugin::~GlxZoomInOutEffectPlugin() +{ + mEffectFileList.clear(); +} diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/settingutility/inc/glxsetting.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/settingutility/inc/glxsetting.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,117 @@ +/* +* 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: ?Description +* +*/ + +#ifndef GLXSETTING_H +#define GLXSETTING_H + + +#include + +class XQSettingsKey; +class XQSettingsManager; +class QStringList; + +#define NBR_SLIDESHOW_EFFECT 3 + +/* + * This class is used for read and write the photos application related setting from the centrep. + */ +class GlxSetting : public GlxSettingInterface +{ + +public : + /* + * It will return the singlton object of this class + */ + static GlxSettingInterface * instance(); + + /* + * Returns the index to the selected transition effect + * This value is fetched from Central repository + */ + int slideShowEffectIndex() ; + + /* + * SlideShowSettingsView will call this API to set the index of the transition effect chosen. + * This data will be written to the Central Repository + */ + void setslideShowEffectIndex( int index ); + + /* + * Returns the index to the selected transition delay / + * This value is fetched from Central repository + */ + int slideShowDelayIndex(); + + /* + * SlideShowSettingsView will call this API to set the index of the transition delay chosen. + * This data will be written to the Central Repository + */ + void setSlideShowDelayIndex( int index ); + + /* + * It will return the slide show delay time for playing the slide show. + * This value is fetched for central repository + */ + int slideShowDelayTime() ; + + /* + * This will return the list of effects as available in the central repository + */ + QStringList slideShowEffectList(); + + /* + * This will return the effect ID based on the effect index + * Effect index will be 0,1,2... and effect ID is GLX_EFFECT + * Effect id is store in the centrep with respect to index. + */ + int slideShowEffectId( int index ) ; + +protected : + /* + * Constructor + */ + GlxSetting( ); + + /* + * Copy Constructor + */ + GlxSetting( GlxSetting & ); + + /* + * Destructor + */ + ~GlxSetting(); + +private : + XQSettingsManager *mSettingsManager; + XQSettingsKey *mTransitionEffectCenrepKey; + XQSettingsKey *mTransitionDelayCenrepKey; + + XQSettingsKey *mSlideShowEffectCenRepKey[ NBR_SLIDESHOW_EFFECT ]; + + + XQSettingsKey *mSlowCenRepKey; + XQSettingsKey *mMediumCenRepKey; + XQSettingsKey *mFastCenRepKey; + + static GlxSetting mObj; +}; + + + +#endif //GLXSETTING_H diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/settingutility/inc/glxsettinginterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/settingutility/inc/glxsettinginterface.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,103 @@ +/* +* 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: ?Description +* +*/ + +#ifndef GLXSETTINGINTERFACE_H +#define GLXSETTINGINTERFACE_H + +#include + +#ifdef BUILD_GLXVIEWUTILITIES +#define GLX_VIEWUTILITIES_EXPORT Q_DECL_EXPORT +#else +#define GLX_VIEWUTILITIES_EXPORT Q_DECL_IMPORT +#endif + +class QStringList ; + +/* + * This is an interface for read and write the photos application related setting from the centrep. + */ +class GLX_VIEWUTILITIES_EXPORT GlxSettingInterface +{ + +public : + /* + * return the instance of the GlxSetting + */ + static GlxSettingInterface * instance(); + + /* + * Returns the index to the selected transition effect + * This value is fetched from Central repository + */ + virtual int slideShowEffectIndex() = 0 ; + + /* + * SlideShowSettingsView will call this API to set the index of the transition effect chosen. + * This data will be written to the Central Repository + */ + virtual void setslideShowEffectIndex( int index ) = 0 ; + + /* + * Returns the index to the selected transition delay + * This value is fetched from Central repository + */ + virtual int slideShowDelayIndex() = 0 ; + + /* + * SlideShowSettingsView will call this API to set the index of the transition delay chosen. + * This data will be written to the Central Repository + */ + virtual void setSlideShowDelayIndex( int index ) = 0; + + /* + * It will return the slide show delay time for playing the slide show. + * This value is fetched for central repository + */ + virtual int slideShowDelayTime() = 0; + + /* + * This will return the list of effects as available in the central repository + */ + virtual QStringList slideShowEffectList() = 0; + + /* + * This will return the effect ID based on the effect index + * Effect index will be 0,1,2... and effect ID is GLX_EFFECT + * Effect id is store in the centrep with respect to index. + */ + virtual int slideShowEffectId( int index ) = 0; + +protected : + /* + * Constructor + */ + GlxSettingInterface( ); + + /* + * Copy Constructor + */ + GlxSettingInterface( GlxSettingInterface & ); + + /* + * Destructor + */ + virtual ~GlxSettingInterface() ; +}; + +#endif + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/settingutility/src/glxsetting.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/settingutility/src/glxsetting.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,138 @@ +/* +* 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: ?Description +* +*/ + +#include +#include +#include + +#include "glxsetting.h" +#include "glxeffectpluginresolver.h" +#include "glxuistd.h" + + +const TUint32 KGlxTransitionEffect = 0x1; +const TUint32 KGlxTransitionDelay = 0x2; +const TUint32 KGlxSlow = 0x3; +const TUint32 KGlxMeduim = 0x4; +const TUint32 KGlxFast = 0x5; +const TUint32 KGlxSlideShowEffect[ ] = { 0x6, 0x7, 0x8 }; +const TUint32 KCRUidGallery = 0x20007194; + +GlxSetting GlxSetting::mObj ; + + +GlxSetting::GlxSetting( ) +{ + mSettingsManager = new XQSettingsManager(); + mTransitionEffectCenrepKey = new XQSettingsKey( XQSettingsKey::TargetCentralRepository, KCRUidGallery , KGlxTransitionEffect ); + mTransitionDelayCenrepKey = new XQSettingsKey( XQSettingsKey::TargetCentralRepository, KCRUidGallery , KGlxTransitionDelay ); + mSlowCenRepKey = new XQSettingsKey( XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxSlow ); + mMediumCenRepKey = new XQSettingsKey( XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxMeduim ); + mFastCenRepKey = new XQSettingsKey( XQSettingsKey::TargetCentralRepository, KCRUidGallery ,KGlxFast ); + + for ( int i = 0; i < NBR_SLIDESHOW_EFFECT; i++ ) { + mSlideShowEffectCenRepKey[ i ] = new XQSettingsKey( XQSettingsKey::TargetCentralRepository, KCRUidGallery , KGlxSlideShowEffect[ i ] ); + } +} + +GlxSetting::GlxSetting( GlxSetting & ) +{ + +} + +GlxSetting::~GlxSetting( ) +{ + delete mFastCenRepKey; + delete mMediumCenRepKey; + delete mSlowCenRepKey; + delete mTransitionDelayCenrepKey; + delete mTransitionEffectCenrepKey; + delete mSettingsManager; + + for ( int i = 0 ; i < NBR_SLIDESHOW_EFFECT ; i++ ) { + delete mSlideShowEffectCenRepKey[ i ]; + } +} + +GlxSettingInterface * GlxSetting::instance() +{ + return &mObj ; +} + +int GlxSetting::slideShowEffectIndex() +{ + QVariant effectvalue = mSettingsManager->readItemValue(*mTransitionEffectCenrepKey); + return effectvalue.toInt(); +} + +void GlxSetting::setslideShowEffectIndex( int index ) +{ + mSettingsManager->writeItemValue( *mTransitionEffectCenrepKey, index ) ; +} + +int GlxSetting::slideShowDelayIndex() +{ + QVariant effectvalue = mSettingsManager->readItemValue(*mTransitionDelayCenrepKey); + return effectvalue.toInt(); +} + +void GlxSetting::setSlideShowDelayIndex( int index ) +{ + mSettingsManager->writeItemValue(*mTransitionDelayCenrepKey, index); +} + +int GlxSetting::slideShowDelayTime() +{ + QVariant effectvalue = mSettingsManager->readItemValue(*mTransitionDelayCenrepKey); + switch ( effectvalue.toInt() ) { + case SLOW: + return mSettingsManager->readItemValue(*mSlowCenRepKey).toInt(); + + case MEDIUM: + return mSettingsManager->readItemValue(*mMediumCenRepKey).toInt(); + + case FAST: + return mSettingsManager->readItemValue(*mFastCenRepKey).toInt(); + + default: + return 3000; + } +} + +QStringList GlxSetting::slideShowEffectList() +{ + QStringList effectList; + effectList.clear(); + int effectId = 0; + + for ( int i = 0 ; i < NBR_SLIDESHOW_EFFECT ; i++ ) { + effectId = mSettingsManager->readItemValue( * mSlideShowEffectCenRepKey[ i ] ).toInt() ; + effectList << GlxEffectPluginResolver::effectName ( effectId ); + } + + return effectList; +} + +int GlxSetting::slideShowEffectId( int index ) +{ + if ( index >= NBR_SLIDESHOW_EFFECT || index < 0 ) { + return NO_EFFECT ; + } + + return mSettingsManager->readItemValue( * mSlideShowEffectCenRepKey[ index ] ).toInt() ; +} + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/settingutility/src/glxsettinginterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/settingutility/src/glxsettinginterface.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,37 @@ +/* +* 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: ?Description +* +*/ + +#include +#include + +GlxSettingInterface::GlxSettingInterface() +{ +} + +GlxSettingInterface::~GlxSettingInterface() +{ +} + +GlxSettingInterface::GlxSettingInterface( GlxSettingInterface & ) +{ +} + +GlxSettingInterface * GlxSettingInterface::instance() +{ + return GlxSetting::instance(); +} + diff -r 1ee2af37811f -r 6481344a6d67 ui/viewutilities/viewutilities.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/viewutilities/viewutilities.pro Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,60 @@ +#/* +#* 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: +#* +#*/ +TEMPLATE = lib +TARGET = glxviewutilities + +DEPENDPATH += . settingutiliy/inc settingutility/src +CONFIG += hb + +LIBS += -lxqsettingsmanager + +DEFINES += BUILD_GLXVIEWUTILITIES + +INCLUDEPATH += . ../inc \ + ../../inc \ + ../../loggers/loggerqt/inc \ + ../../traces \ + /epoc32/include/mw/hgwidgets + +symbian: { +TARGET.UID3 = 0x2000718E +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +TARGET.EPOCALLOWDLLDATA = 1 +TARGET.CAPABILITY = ALL -TCB +} + +# Input +HEADERS += settingutility/inc/glxsetting.h \ + settingutility/inc/glxsettinginterface.h \ + effectplugin/inc/glxeffectpluginbase.h \ + effectplugin/inc/glxfadeeffectplugin.h \ + effectplugin/inc/glxflipeffectplugin.h \ + effectplugin/inc/glxzoominoutplugin.h \ + effectplugin/inc/glxeffectpluginresolver.h \ + effectengine/inc/glxtransitioneffect.h \ + effectengine/inc/glxeffectengine.h + +SOURCES += settingutility/src/glxsetting.cpp \ + settingutility/src/glxsettinginterface.cpp \ + effectplugin/src/glxfadeeffectplugin.cpp \ + effectplugin/src/glxflipeffectplugin.cpp \ + effectplugin/src/glxzoominoutplugin.cpp \ + effectplugin/src/glxeffectpluginresolver.cpp \ + effectengine/src/glxtransitioneffect.cpp \ + effectengine/src/glxeffectengine.cpp + +DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT \ No newline at end of file diff -r 1ee2af37811f -r 6481344a6d67 ui/widgets/bwins/glxzoomwidgetu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/widgets/bwins/glxzoomwidgetu.def Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,39 @@ +EXPORTS + ?dataChanged@GlxZoomWidget@@IAEXVQModelIndex@@0@Z @ 1 NONAME ; void GlxZoomWidget::dataChanged(class QModelIndex, class QModelIndex) + ?limitRequiredSize@GlxZoomWidget@@AAEXAAVQSizeF@@@Z @ 2 NONAME ; void GlxZoomWidget::limitRequiredSize(class QSizeF &) + ?cleanUp@GlxZoomWidget@@QAEXXZ @ 3 NONAME ; void GlxZoomWidget::cleanUp(void) + ?setMinMaxZValue@GlxZoomWidget@@QAEXHH@Z @ 4 NONAME ; void GlxZoomWidget::setMinMaxZValue(int, int) + ?sendDecodeRequest@GlxZoomWidget@@QAEXH@Z @ 5 NONAME ; void GlxZoomWidget::sendDecodeRequest(int) + ??0GlxZoomWidget@@QAE@PAVQGraphicsItem@@@Z @ 6 NONAME ; GlxZoomWidget::GlxZoomWidget(class QGraphicsItem *) + ?qt_metacast@GlxZoomWidget@@UAEPAXPBD@Z @ 7 NONAME ; void * GlxZoomWidget::qt_metacast(char const *) + ?staticMetaObject@GlxZoomWidget@@2UQMetaObject@@B @ 8 NONAME ; struct QMetaObject const GlxZoomWidget::staticMetaObject + ?tr@GlxZoomWidget@@SA?AVQString@@PBD0H@Z @ 9 NONAME ; class QString GlxZoomWidget::tr(char const *, char const *, int) + ?sceneEvent@GlxZoomWidget@@MAE_NPAVQEvent@@@Z @ 10 NONAME ; bool GlxZoomWidget::sceneEvent(class QEvent *) + ?trUtf8@GlxZoomWidget@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString GlxZoomWidget::trUtf8(char const *, char const *) + ?getFocusedImage@GlxZoomWidget@@AAE?AVQPixmap@@XZ @ 12 NONAME ; class QPixmap GlxZoomWidget::getFocusedImage(void) + ?setModel@GlxZoomWidget@@QAEXPAVQAbstractItemModel@@@Z @ 13 NONAME ; void GlxZoomWidget::setModel(class QAbstractItemModel *) + ?finalizeWidgetTransform@GlxZoomWidget@@AAEXXZ @ 14 NONAME ; void GlxZoomWidget::finalizeWidgetTransform(void) + ?executeGestureEvent@GlxZoomWidget@@AAE_NPAVQGraphicsItem@@PAVQGestureEvent@@@Z @ 15 NONAME ; bool GlxZoomWidget::executeGestureEvent(class QGraphicsItem *, class QGestureEvent *) + ?zoomImage@GlxZoomWidget@@AAEXMVQPointF@@@Z @ 16 NONAME ; void GlxZoomWidget::zoomImage(float, class QPointF) + ?activate@GlxZoomWidget@@QAEXXZ @ 17 NONAME ; void GlxZoomWidget::activate(void) + ?connectDecodeRequestToPinchEvent@GlxZoomWidget@@QAEXXZ @ 18 NONAME ; void GlxZoomWidget::connectDecodeRequestToPinchEvent(void) + ?indexChanged@GlxZoomWidget@@QAEXH@Z @ 19 NONAME ; void GlxZoomWidget::indexChanged(int) + ?animateZoomIn@GlxZoomWidget@@QAEXVQPointF@@@Z @ 20 NONAME ; void GlxZoomWidget::animateZoomIn(class QPointF) + ?getStaticMetaObject@GlxZoomWidget@@SAABUQMetaObject@@XZ @ 21 NONAME ; struct QMetaObject const & GlxZoomWidget::getStaticMetaObject(void) + ?animationTimeLineFinished@GlxZoomWidget@@QAEXXZ @ 22 NONAME ; void GlxZoomWidget::animationTimeLineFinished(void) + ?qt_metacall@GlxZoomWidget@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 23 NONAME ; int GlxZoomWidget::qt_metacall(enum QMetaObject::Call, int, void * *) + ?zoomWidgetMovedBackground@GlxZoomWidget@@IAEXH@Z @ 24 NONAME ; void GlxZoomWidget::zoomWidgetMovedBackground(int) + ?animateZoomOut@GlxZoomWidget@@QAEXVQPointF@@@Z @ 25 NONAME ; void GlxZoomWidget::animateZoomOut(class QPointF) + ?adjustGestureCenter@GlxZoomWidget@@AAEXAAVQPointF@@AAM@Z @ 26 NONAME ; void GlxZoomWidget::adjustGestureCenter(class QPointF &, float &) + ?metaObject@GlxZoomWidget@@UBEPBUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const * GlxZoomWidget::metaObject(void) const + ?decodedImageAvailable@GlxZoomWidget@@QAEXXZ @ 28 NONAME ; void GlxZoomWidget::decodedImageAvailable(void) + ??_EGlxZoomWidget@@UAE@I@Z @ 29 NONAME ; GlxZoomWidget::~GlxZoomWidget(unsigned int) + ??1GlxZoomWidget@@UAE@XZ @ 30 NONAME ; GlxZoomWidget::~GlxZoomWidget(void) + ?sceneEventFilter@GlxZoomWidget@@MAE_NPAVQGraphicsItem@@PAVQEvent@@@Z @ 31 NONAME ; bool GlxZoomWidget::sceneEventFilter(class QGraphicsItem *, class QEvent *) + ?pinchGestureReceived@GlxZoomWidget@@IAEXH@Z @ 32 NONAME ; void GlxZoomWidget::pinchGestureReceived(int) + ?setWindowSize@GlxZoomWidget@@QAEXVQSize@@@Z @ 33 NONAME ; void GlxZoomWidget::setWindowSize(class QSize) + ?retreiveFocusedImage@GlxZoomWidget@@AAEXXZ @ 34 NONAME ; void GlxZoomWidget::retreiveFocusedImage(void) + ?animationFrameChanged@GlxZoomWidget@@QAEXH@Z @ 35 NONAME ; void GlxZoomWidget::animationFrameChanged(int) + ?tr@GlxZoomWidget@@SA?AVQString@@PBD0@Z @ 36 NONAME ; class QString GlxZoomWidget::tr(char const *, char const *) + ?trUtf8@GlxZoomWidget@@SA?AVQString@@PBD0H@Z @ 37 NONAME ; class QString GlxZoomWidget::trUtf8(char const *, char const *, int) + diff -r 1ee2af37811f -r 6481344a6d67 ui/widgets/eabi/glxzoomwidgetu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/widgets/eabi/glxzoomwidgetu.def Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,45 @@ +EXPORTS + _ZN13GlxZoomWidget10sceneEventEP6QEvent @ 1 NONAME + _ZN13GlxZoomWidget11dataChangedE11QModelIndexS0_ @ 2 NONAME + _ZN13GlxZoomWidget11qt_metacallEN11QMetaObject4CallEiPPv @ 3 NONAME + _ZN13GlxZoomWidget11qt_metacastEPKc @ 4 NONAME + _ZN13GlxZoomWidget12indexChangedEi @ 5 NONAME + _ZN13GlxZoomWidget13animateZoomInE7QPointF @ 6 NONAME + _ZN13GlxZoomWidget13setWindowSizeE5QSize @ 7 NONAME + _ZN13GlxZoomWidget14animateZoomOutE7QPointF @ 8 NONAME + _ZN13GlxZoomWidget15getFocusedImageEv @ 9 NONAME + _ZN13GlxZoomWidget15setMinMaxZValueEii @ 10 NONAME + _ZN13GlxZoomWidget16sceneEventFilterEP13QGraphicsItemP6QEvent @ 11 NONAME + _ZN13GlxZoomWidget16staticMetaObjectE @ 12 NONAME DATA 16 + _ZN13GlxZoomWidget17limitRequiredSizeER6QSizeF @ 13 NONAME + _ZN13GlxZoomWidget17sendDecodeRequestEi @ 14 NONAME + _ZN13GlxZoomWidget19adjustGestureCenterER7QPointFRf @ 15 NONAME + _ZN13GlxZoomWidget19executeGestureEventEP13QGraphicsItemP13QGestureEvent @ 16 NONAME + _ZN13GlxZoomWidget19getStaticMetaObjectEv @ 17 NONAME + _ZN13GlxZoomWidget20pinchGestureReceivedEi @ 18 NONAME + _ZN13GlxZoomWidget20retreiveFocusedImageEv @ 19 NONAME + _ZN13GlxZoomWidget21animationFrameChangedEi @ 20 NONAME + _ZN13GlxZoomWidget21decodedImageAvailableEv @ 21 NONAME + _ZN13GlxZoomWidget23finalizeWidgetTransformEv @ 22 NONAME + _ZN13GlxZoomWidget25animationTimeLineFinishedEv @ 23 NONAME + _ZN13GlxZoomWidget25zoomWidgetMovedBackgroundEi @ 24 NONAME + _ZN13GlxZoomWidget32connectDecodeRequestToPinchEventEv @ 25 NONAME + _ZN13GlxZoomWidget7cleanUpEv @ 26 NONAME + _ZN13GlxZoomWidget8activateEv @ 27 NONAME + _ZN13GlxZoomWidget8setModelEP18QAbstractItemModel @ 28 NONAME + _ZN13GlxZoomWidget9zoomImageEf7QPointF @ 29 NONAME + _ZN13GlxZoomWidgetC1EP13QGraphicsItem @ 30 NONAME + _ZN13GlxZoomWidgetC2EP13QGraphicsItem @ 31 NONAME + _ZN13GlxZoomWidgetD0Ev @ 32 NONAME + _ZN13GlxZoomWidgetD1Ev @ 33 NONAME + _ZN13GlxZoomWidgetD2Ev @ 34 NONAME + _ZNK13GlxZoomWidget10metaObjectEv @ 35 NONAME + _ZTI13GlxZoomWidget @ 36 NONAME + _ZTV13GlxZoomWidget @ 37 NONAME + _ZThn16_N13GlxZoomWidgetD0Ev @ 38 NONAME + _ZThn16_N13GlxZoomWidgetD1Ev @ 39 NONAME + _ZThn8_N13GlxZoomWidget10sceneEventEP6QEvent @ 40 NONAME + _ZThn8_N13GlxZoomWidget16sceneEventFilterEP13QGraphicsItemP6QEvent @ 41 NONAME + _ZThn8_N13GlxZoomWidgetD0Ev @ 42 NONAME + _ZThn8_N13GlxZoomWidgetD1Ev @ 43 NONAME + diff -r 1ee2af37811f -r 6481344a6d67 ui/widgets/glxzoomwidget/glxzoomwidget.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/widgets/glxzoomwidget/glxzoomwidget.pro Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,48 @@ +#/* +#* 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: +#* +#*/ + + +TEMPLATE = lib +TARGET = glxzoomwidget + +CONFIG += hb + +DEFINES += GLXZOOMWIDGET_LIBRARY + +LIBS += -lglxmodelwrapper.dll \ + -lglximagedecoderwrapper.dll \ + +DEPENDPATH += . inc src +INCLUDEPATH += . \ + ../../../commonutilities/imagedecoderwrapper/inc \ + ../uiengine/model/modelwrapper/inc \ + ../../inc \ + ../../../inc + +symbian: { +TARGET.UID3 = 0x200104E4 +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +TARGET.EPOCALLOWDLLDATA = 1 +TARGET.CAPABILITY = ALL -TCB +} + +exportfile = "inc/glxzoomwidget.h APP_LAYER_PLATFORM_EXPORT_PATH(glxzoomwidget.h)" +BLD_INF_RULES.prj_exports += exportfile + +# Input +HEADERS += inc/glxzoomwidget.h inc/glxzoomwidget_global.h +SOURCES += src/glxzoomwidget.cpp diff -r 1ee2af37811f -r 6481344a6d67 ui/widgets/glxzoomwidget/inc/glxzoomwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/widgets/glxzoomwidget/inc/glxzoomwidget.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,135 @@ +/* +* 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: glxzoomwidget.h +* definition of the class glxzoomwidget which controls the Zoom behavior of coverflow. +* +*/ +#ifndef GLXZOOMWIDGET_H +#define GLXZOOMWIDGET_H + +#include +#include +#include +#include + +#include + +class QGestureEvent; +class QPinchGesture; +class HbIconItem; +class GlxImageDecoderWrapper; +class QTimeLine; + +const int MAXZVALUE = 100; +const int MINZVALUE = 0; + +class GLXZOOMWIDGETSHARED_EXPORT GlxZoomWidget : public HbScrollArea +{ + Q_OBJECT + + public: + GlxZoomWidget (QGraphicsItem *parent = NULL); + ~GlxZoomWidget (); + void setModel (QAbstractItemModel *model) ; + void indexChanged(int index); + void setWindowSize(QSize windowSize); + void cleanUp(); + void activate(); + void setMinMaxZValue(int minZvalue, int maxZvalue); + void connectDecodeRequestToPinchEvent(); + + signals: + void pinchGestureReceived(int index); + void zoomWidgetMovedBackground(int index); + + public slots: + //for Decoder support + void decodedImageAvailable(); + void sendDecodeRequest(int index); + + //for animation effects + void animateZoomIn(QPointF animRefPoint); + void animateZoomOut(QPointF animRefPoint); + void animationFrameChanged(int frameNumber); + void animationTimeLineFinished(); + + protected: + bool sceneEvent(QEvent *event); + bool sceneEventFilter(QGraphicsItem *watched,QEvent *event); + protected slots: + void dataChanged(QModelIndex startIndex, QModelIndex endIndex); + + + private: + bool executeGestureEvent(QGraphicsItem *source,QGestureEvent *event); + //Responsible for changing the transforms of the widget wrt the ZF and center + //Also adjusts the ZF, center and final size so as to respect the boundaries + void zoomImage(qreal zoomFactor, QPointF center); + //This API will adjust the gesture center to maintain boundaries + //called from GlxZoomWidget::zoomImage + void adjustGestureCenter(QPointF & gestureCenter, qreal& zoomFactor); + //this API will limit the max/min Zoom Size possible + //called from GlxZoomWidget::zoomImage + void limitRequiredSize(QSizeF &requiredSize); + //gets the latest focussed image from the model + void retreiveFocusedImage(); + //finalize the transform and update the sizehint of mZoomWidget + void finalizeWidgetTransform(); + //get the focused image from the model + QPixmap getFocusedImage(); + + //data members + private: + //view widgets + QGraphicsPixmapItem *mZoomItem; //Item containing the pixmap + QGraphicsWidget *mZoomWidget; //container :all scaling and transforms would be done on this widget + HbIconItem* mBlackBackgroundItem; //for setting black background + + //view Z values + //might push to layouts later + + int mMinZValue ; + int mMaxZValue ; + + + //to be in sync with the model + QAbstractItemModel *mModel; + int mFocusIndex; + + //size parameter + QSizeF mItemSize; // the actual pixmap size. Keep it updated with latest pixmap size + QSizeF mStepCurrentSize; //to save the size before gesture started + QSizeF mCurrentSize; //save sizes scaled by gesture + QSize mWindowSize; //the window size + QSizeF mMinScaleSize; //minimum posible size + QSizeF mMinDecScaleSize; //the Minimum scale limit after which the image scaling down should be decelerated + QSizeF mMaxScaleSize; // the maximum scale limit + QSizeF mMaxScaleDecSize; // the Maximum scale limit after which the image scaling should be decelerated + //for animation effect + qreal m_FinalAnimatedScaleFactor; + QPointF m_AnimRefPoint; + QTimeLine *m_AnimTimeLine; + //for Decoder support + GlxImageDecoderWrapper* mImageDecoder; + + //status flags + //To check if the decode request has already been send or not + bool mImageDecodeRequestSend; + //To check if the pinch gesture is in progress to block any events to HbScrollArea + bool mPinchGestureOngoing; + //to check if decoded image is available + bool mDecodedImageAvailable; + +}; +#endif //GLXZOOMWIDGET_H diff -r 1ee2af37811f -r 6481344a6d67 ui/widgets/glxzoomwidget/inc/glxzoomwidget_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/widgets/glxzoomwidget/inc/glxzoomwidget_global.h Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,12 @@ +#ifndef GLXZOOMWIDGET_GLOBAL_H +#define GLXZOOMWIDGET_GLOBAL_H + +#include + +#if defined(GLXZOOMWIDGET_LIBRARY) +# define GLXZOOMWIDGETSHARED_EXPORT Q_DECL_EXPORT +#else +# define GLXZOOMWIDGETSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // GLXZOOMWIDGET_GLOBAL_H diff -r 1ee2af37811f -r 6481344a6d67 ui/widgets/glxzoomwidget/src/glxzoomwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/widgets/glxzoomwidget/src/glxzoomwidget.cpp Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,482 @@ + /* +* 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: glxzoomwidget.cpp +* description of the class GlxGlxZoomWidget which controls the Zoom behavior of coverflow. +* +*/ +#include +#include +#include +#include +#include "glximagedecoderwrapper.h" +#include "glxmodelparm.h" +#include "glxzoomwidget.h" + +GlxZoomWidget::GlxZoomWidget(QGraphicsItem *parent):HbScrollArea(parent), mModel(NULL), mMinZValue(MINZVALUE), mMaxZValue(MAXZVALUE), mImageDecodeRequestSend(false), mPinchGestureOngoing(false), mDecodedImageAvailable(false) +{ + grabGesture(Qt::PinchGesture); + setAcceptTouchEvents(true) ; + setFrictionEnabled(false); + setZValue(mMinZValue); + //create the child items and background + mZoomWidget = new QGraphicsWidget(this); + mZoomItem = new QGraphicsPixmapItem(mZoomWidget); + mZoomItem->setTransformationMode(Qt::SmoothTransformation); + //the black background + //replace when a proper substitute for setting backgrounds is known + mBlackBackgroundItem = new HbIconItem(this); + mBlackBackgroundItem->setBrush(QBrush(Qt::black)); + mBlackBackgroundItem->hide(); + //does not work so is commented + //setBackgroundItem(mBlackBackgroundItem); + + //initializing the image decoder + mImageDecoder = new GlxImageDecoderWrapper; + + //inititalizing the timer for animation + m_AnimTimeLine = new QTimeLine(1000, this); + m_AnimTimeLine->setFrameRange(0, 100); + connect(m_AnimTimeLine, SIGNAL(frameChanged(int)), this, SLOT(animationFrameChanged(int))); + connect(m_AnimTimeLine, SIGNAL(finished()), this, SLOT(animationTimeLineFinished())); +} + +GlxZoomWidget::~GlxZoomWidget() +{ + //disconnect all existing signals + disconnect(this,SIGNAL( pinchGestureReceived(int) ), this, SLOT( sendDecodeRequest(int) ) ); + //no Null checks required + delete mZoomItem; +// delete mZoomWidget; //as this is a content widegt it will automatically be deleted + delete mBlackBackgroundItem; + //reset the decoder to cancel pending tasks + if(mImageDecoder) { + mImageDecoder->resetDecoder(); + delete mImageDecoder; + } +} + +void GlxZoomWidget::setModel (QAbstractItemModel *model) +{ + if(model) + { + mModel = model; + retreiveFocusedImage(); //Update mZoomItem with focused Image + connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + } +} + +void GlxZoomWidget::setWindowSize(QSize windowSize) +{ + mWindowSize = windowSize; + mBlackBackgroundItem->setGeometry(QRectF(QPointF(0,0), mWindowSize)); + //try to reset the max and min zoomed size here +} + +void GlxZoomWidget::indexChanged(int index) +{ + Q_UNUSED(index); + if(mFocusIndex != index) { + mImageDecoder->resetDecoder();//reset the decoder first to cancel pending tasks + mImageDecodeRequestSend = false; + mDecodedImageAvailable = false; + retreiveFocusedImage(); //Update mZoomItem with focused Image + } +} + +void GlxZoomWidget::cleanUp() +{ +// disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + if(mImageDecoder) { + mImageDecoder->resetDecoder(); + } + mZoomItem->setPixmap(QPixmap()); +} + +void GlxZoomWidget::activate() +{ +} + +void GlxZoomWidget::setMinMaxZValue(int minZvalue, int maxZvalue) +{ + mMinZValue = minZvalue; + mMaxZValue = maxZvalue; +} + +void GlxZoomWidget::connectDecodeRequestToPinchEvent() +{ + connect(this,SIGNAL( pinchGestureReceived(int) ), this, SLOT( sendDecodeRequest(int) ), Qt::QueuedConnection ); +} + +bool GlxZoomWidget::sceneEvent(QEvent *event) +{ + bool consume(false); + if (event->type() == QEvent::Gesture) { + consume = executeGestureEvent(this, static_cast(event)); + } + if(!consume) + { + consume = HbScrollArea::sceneEvent(event); + } + return consume; +} + +bool GlxZoomWidget::sceneEventFilter(QGraphicsItem *watched,QEvent *event) +{ + qDebug("GlxCoverFlow::eventFilter " ); + bool consume = false; + if (event->type() == QEvent::Gesture) { + consume = executeGestureEvent(watched, static_cast(event)); + } + + if(!consume) { + consume = HbScrollArea::sceneEventFilter(watched,event); + } + return consume; + +} + +bool GlxZoomWidget::executeGestureEvent(QGraphicsItem *source,QGestureEvent *event) +{ + if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { + QPinchGesture* pinchG = static_cast(pinch); + QPinchGesture::ChangeFlags changeFlags = pinchG->changeFlags(); + if (changeFlags & QPinchGesture::ScaleFactorChanged) { + mPinchGestureOngoing = true; + //bring the zoom widget to foreground + setZValue(mMaxZValue); + //show the black background + mBlackBackgroundItem->setParentItem(parentItem()); + mBlackBackgroundItem->setZValue(mMaxZValue - 1); + mBlackBackgroundItem->show(); + + //retreive the gesture values + qreal value = pinchG->scaleFactor() / pinchG->lastScaleFactor(); + QPointF center = pinchG->property("centerPoint").toPointF(); + //set the gesture center to the scene coordinates + QPointF sceneGestureCenter = source->sceneTransform().map(center); + zoomImage(value, sceneGestureCenter); + + } + if (pinchG->state() == Qt::GestureStarted) { + emit pinchGestureReceived(mFocusIndex); + } + + if (pinchG->state() == Qt::GestureFinished) { + if(mStepCurrentSize != mCurrentSize) { + //For giving a spring effect when user has zoomed more than normal. + if(mStepCurrentSize.width() > mMaxScaleDecSize.width()) { + //scale the image to limited size + qreal value = mMaxScaleDecSize.width()/mCurrentSize.width(); + QPointF center(mWindowSize.width()/2, mWindowSize.height()/2); + QPointF sceneGestureCenter = source->sceneTransform().map(center); + zoomImage(value, sceneGestureCenter); + } + mPinchGestureOngoing = false; + //finalize the transforms to the geometry else panning will not work + finalizeWidgetTransform(); + } +//push the Zoom widget to background when zoomed image size nears FS image + if(mStepCurrentSize.width() <= mMinDecScaleSize.width()*1.3) { + mBlackBackgroundItem->hide(); + //push the widget back to background + setZValue(mMinZValue); + emit zoomWidgetMovedBackground(mFocusIndex); + //do not reset the transform here as it will then zoom-in the widget to decoded image size + } + } + //gesture accepted + return true; + } + //gesture rejected + if(!mPinchGestureOngoing) { + return false; + } + return true; + +} + +void GlxZoomWidget::zoomImage(qreal zoomFactor, QPointF center) +{ + adjustGestureCenter(center, zoomFactor); + QSizeF requiredSize(mCurrentSize.width()*zoomFactor, mCurrentSize.height()*zoomFactor); + limitRequiredSize(requiredSize); + if(requiredSize != mCurrentSize) { + QTransform zoomTransform = mZoomWidget->transform(); + QPointF transformedCenter = mZoomWidget->sceneTransform().inverted().map(center); + zoomTransform.translate(transformedCenter.x(),transformedCenter.y()); + zoomTransform.scale(requiredSize.width()/mCurrentSize.width(), requiredSize.height()/mCurrentSize.height()); + zoomTransform.translate(-transformedCenter.x(),-transformedCenter.y()); + mZoomWidget->setTransform(zoomTransform); + mCurrentSize = requiredSize; + } + +} + + +void GlxZoomWidget::limitRequiredSize(QSizeF &requiredSize) +{ + if(requiredSize.width() > mMaxScaleSize.width() ) { + requiredSize = mMaxScaleSize ; + } + else if(requiredSize.width() < mMinDecScaleSize.width() ) { + requiredSize = mMinDecScaleSize ; + } + + +} + +//makes sure that the gesture is on the screen center if the image is smaller than the screen +void GlxZoomWidget::adjustGestureCenter(QPointF & gestureCenter, qreal& zoomFactor) +{ + if(zoomFactor > 1 &&zoomFactor > 1.2 ) { + zoomFactor = 1.2; + } + + if(zoomFactor < 1 &&zoomFactor < 0.8 ) { + zoomFactor = 0.8; + } + QSizeF requiredSize(mCurrentSize.width()*zoomFactor, mCurrentSize.height()*zoomFactor); + //keep smaller image centered + if(mCurrentSize.width() <= mWindowSize.width() ) + { + gestureCenter.setX(mWindowSize.width()/2); + + } + if(mCurrentSize.height() <= mWindowSize.height()) + { + gestureCenter.setY(mWindowSize.height()/2); + + } + //maintains the boundary of the edges for zoom out conditions + if(zoomFactor < 1) + { + QPointF itemOriginPos = mZoomWidget->sceneTransform().map(QPointF(0,0)); + bool hasWidthExceededWindow = mCurrentSize.width() > mWindowSize.width(); + bool hasHeightExceededWindow = mCurrentSize.height() > mWindowSize.height(); + if(itemOriginPos.x() >= 0) { + //image has crossed left boundry leaving blank space + if(hasWidthExceededWindow) { + //stick the gesture to the left corner + gestureCenter.setX(itemOriginPos.x()); + } + } + //Check if the right boundry can be adjusted + if(itemOriginPos.x()+ mCurrentSize.width() <= mWindowSize.width()) { + //Image is before the right boundry leaving blank space + if(hasWidthExceededWindow) { + //stick the gesture to the right corner + gestureCenter.setX(itemOriginPos.x()+ mCurrentSize.width()); + } + } + //check if the upper boundry could be adjusted + if(itemOriginPos.y() >= 0) { + //image has crossed the upper boundry leaving blank space + if(hasHeightExceededWindow) { + //stick the image to the upper boundry + gestureCenter.setY(itemOriginPos.y()); + } + } + //check if the lower boundry could be adjusted + if(itemOriginPos.y()+ mCurrentSize.height() <= mWindowSize.height()) { + //Image is before the right boundry leaving blank space + if(hasHeightExceededWindow) { + //stick the image to the right corner + gestureCenter.setY(itemOriginPos.y()+ mCurrentSize.height()); + } + + } + } + //control the zoom Factor to boundaries + if(mCurrentSize.width() > mWindowSize.width() && requiredSize.width() <= mWindowSize.width()) + { + zoomFactor = mWindowSize.width()/mCurrentSize.width(); + + } + else if(mCurrentSize.height() > mWindowSize.height() && requiredSize.height() <= mWindowSize.height()) + { + zoomFactor = mWindowSize.height()/mCurrentSize.height(); + + } + + //reduce the ZF so as to show a decelerated effect at max/min levels + + if(mCurrentSize.width() > mMaxScaleDecSize.width() && zoomFactor > 1 ) { + zoomFactor = 1.0 + ((zoomFactor-1.0)/6) ; + } + if(mCurrentSize.width() < mMinDecScaleSize.width() && zoomFactor < 1 ) { + zoomFactor = 1.0 - ((1.0-zoomFactor)/6) ; + } + + +} + +//get the latest focused image and set it to mZoomItem +void GlxZoomWidget::retreiveFocusedImage() +{ + + QPixmap targetPixmap(getFocusedImage()); + //initialize all the variables wrt the focussed pixmap + mZoomWidget->resetTransform(); + mItemSize = targetPixmap.size(); + mMaxScaleSize = mItemSize; + mMaxScaleSize.scale(mWindowSize*13, Qt::KeepAspectRatio); + mMaxScaleDecSize = mItemSize; + mMaxScaleDecSize.scale(mWindowSize*7, Qt::KeepAspectRatio); + mMinScaleSize = mItemSize* 0.7; + mMinDecScaleSize = mItemSize; + QPointF originPos = sceneTransform().map(QPointF(0,0)); + mZoomWidget->setGeometry(QRectF(QPointF(mWindowSize.width()/2 - mItemSize.width()/2,mWindowSize.height()/2 - mItemSize.height()/2),mItemSize )); //chk this + mZoomWidget->setPreferredSize(mItemSize); + mZoomItem->setPixmap(targetPixmap); + mCurrentSize = mItemSize; + mStepCurrentSize = mItemSize; + setContentWidget(mZoomWidget); + show(); +} + + +void GlxZoomWidget::dataChanged(QModelIndex startIndex, QModelIndex endIndex) +{ + if(mFocusIndex >= startIndex.row() && mFocusIndex <= endIndex.row()) { + //get the latest image from the model + //will replace a decoded image if callback is received after decoded image is received so a fix is required + //retreiveFocusedImage(); + if(!mDecodedImageAvailable) { + QPixmap targetPixmap(getFocusedImage()); + mZoomItem->setPixmap(targetPixmap); + finalizeWidgetTransform(); + } + } +} + +void GlxZoomWidget::decodedImageAvailable() +{ + //new bitmap with better resolution is available + //so set it to the item + QPixmap decodedPixmap = mImageDecoder->getPixmap(); + disconnect(mImageDecoder, SIGNAL(pixmapDecoded()), this, SLOT(decodedImageAvailable())); + if(decodedPixmap.isNull()){ + return; + } + mDecodedImageAvailable = true; + mZoomItem->setPixmap(decodedPixmap); + mItemSize = decodedPixmap.size(); + //this is important if not done then old transforms will be applied on the new image + finalizeWidgetTransform(); +} + +void GlxZoomWidget::sendDecodeRequest(int index) +{ + if(!mImageDecodeRequestSend) { + QString imagePath = (mModel->data(mModel->index(index,0),GlxUriRole)).value(); + mImageDecoder->decodeImage(imagePath); + connect(mImageDecoder, SIGNAL(pixmapDecoded()), this, SLOT(decodedImageAvailable())); + mImageDecodeRequestSend = true; + } +} + + +void GlxZoomWidget::finalizeWidgetTransform() +{ + QPointF widgetPos = mZoomWidget->sceneTransform().map(QPointF(0,0)); //Map the origin wrt scene + mZoomWidget->resetTransform(); + mZoomWidget->scale(mCurrentSize.width()/mItemSize.width(), mCurrentSize.height()/mItemSize.height()); + mZoomWidget->setGeometry(QRectF(widgetPos , mCurrentSize)); + // this updates HbScrollArea on the sizeHint of ZoomWidget + mZoomWidget->setPreferredSize(mCurrentSize); + mStepCurrentSize = mCurrentSize; +} + +QPixmap GlxZoomWidget::getFocusedImage() +{ + mFocusIndex = mModel->data(mModel->index(0,0),GlxFocusIndexRole).value(); + QVariant iconVariant = mModel->data(mModel->index(mFocusIndex,0),GlxFsImageRole); + QVariant sizeVariant = mModel->data(mModel->index(mFocusIndex,0),GlxDimensionsRole); + QPixmap targetPixmap; + //retreive pixmap from the HbIcon received from model + //should change the model to return and save pixmaps and convert to HbIcons Instead + if ( iconVariant.isValid() && iconVariant.canConvert () ) { + QIcon itemIcon = iconVariant.value().qicon(); + QSize itemSize = itemIcon.actualSize(mWindowSize); + QSize scaleSize; + if(sizeVariant.isValid() && sizeVariant.canConvert ()) { + scaleSize = sizeVariant.toSize(); + if(!(scaleSize.width() < mWindowSize.width() && scaleSize.height() < mWindowSize.height())) { + scaleSize = mWindowSize; + } + } + targetPixmap = itemIcon.pixmap(itemSize).scaled(scaleSize, Qt::KeepAspectRatio); + mItemSize = targetPixmap.size(); + } + return targetPixmap; + +} + + + + + +void GlxZoomWidget::animateZoomIn(QPointF animRefPoint) +{ + emit pinchGestureReceived(mFocusIndex); + //bring the zoom widget to foreground + setZValue(mMaxZValue); + //show the black background + mBlackBackgroundItem->setParentItem(parentItem()); + mBlackBackgroundItem->setZValue(mMaxZValue - 1); + mBlackBackgroundItem->show(); + m_AnimRefPoint = animRefPoint; + QSizeF requiredSize = mItemSize; + requiredSize.scale(mWindowSize*3.5, Qt::KeepAspectRatio); + m_FinalAnimatedScaleFactor = requiredSize.width()*3.5/mMinScaleSize.width(); + m_AnimTimeLine->setDirection(QTimeLine::Forward); + m_AnimTimeLine->start(); + // zoomImage(5, m_AnimRefPoint); + +} +void GlxZoomWidget::animateZoomOut(QPointF animRefPoint) +{ + m_AnimRefPoint = animRefPoint; + m_FinalAnimatedScaleFactor = mMinScaleSize.width()/mCurrentSize.width(); + //m_AnimTimeLine->setDirection(QTimeLine::Backward); + m_AnimTimeLine->start(); +} +void GlxZoomWidget::animationFrameChanged(int frameNumber) +{ +qreal scaleFactor = 1; + if(m_FinalAnimatedScaleFactor > 1) { + // qreal scaleFactor = (100+ ((m_FinalAnimatedScaleFactor*100 - 100)/100)*frameNumber)/100; + scaleFactor = 1.0 + (((m_FinalAnimatedScaleFactor - 1)/100)*frameNumber); + } + if(m_FinalAnimatedScaleFactor < 1) { + scaleFactor = (m_FinalAnimatedScaleFactor*100+ ((100 - m_FinalAnimatedScaleFactor*100 )/100)*frameNumber)/100; + // qreal scaleFactor = 1.0 + (((m_FinalAnimatedScaleFactor - 1)/100)*frameNumber) + } + + zoomImage(scaleFactor, m_AnimRefPoint); + +} +void GlxZoomWidget::animationTimeLineFinished() +{ + finalizeWidgetTransform(); +//push the Zoom widget to background when zoomed image size nears FS image + if(mStepCurrentSize.width() <= mMinDecScaleSize.width()*1.3) { + mBlackBackgroundItem->hide(); + //push the widget back to background + setZValue(mMinZValue); + emit zoomWidgetMovedBackground(mFocusIndex); + //do not reset the transform here as it will then zoom-in the widget to decoded image size + } +} + diff -r 1ee2af37811f -r 6481344a6d67 ui/widgets/widgets.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/widgets/widgets.pro Fri Jun 11 13:38:23 2010 +0300 @@ -0,0 +1,19 @@ +#/* +#* 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: +#* +#*/ +TEMPLATE = subdirs +CONFIG += ordered +SUBDIRS = glxzoomwidget