# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1261032344 -7200 # Node ID 4e91876724a27b04c8009d4a63db8da9151e7f19 Revision: 200949 Kit: 200951 diff -r 000000000000 -r 4e91876724a2 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008-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: Build information for project mgallery. +* +*/ + + + +#include + +#include "../photos_plat/group/bld.inf" + +#include "../photosgallery/group/bld.inf" + +PRJ_EXPORTS diff -r 000000000000 -r 4e91876724a2 group/buildall.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/buildall.cmd Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Batch file to Builds all the photos components +rem + +call bldmake bldfiles + +REM build sources +call abld build winscw udeb +call abld build armv5 urel + +REM build tests +REM call abld test build winscw udeb +REM call abld test build armv5 urel diff -r 000000000000 -r 4e91876724a2 group/buildreleaseclean.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/buildreleaseclean.cmd Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: build release clean command +rem + +REM clean up the environment +call clearbuild.cmd + +REM make build files +call bldmake bldfiles + +REM build release sources for winscw and armv5 +call abld build winscw udeb +call abld build armv5 urel diff -r 000000000000 -r 4e91876724a2 group/clearbuild.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/clearbuild.cmd Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Batch file to clean build photos components +rem + +ECHO "Running ABLD reallyclean" +call abld reallyclean -k +ECHO "Removing Gallery files (glx*.*)" +call del /F /S %EPOCROOT%epoc32\glx*.* +ECHO "Removing Slideshow files (shw*.*)" +call del /F /S %EPOCROOT%epoc32\shw*.* +ECHO "Removing Gallery test files (t_*glx*.*)" +call del /F /S %EPOCROOT%epoc32\t_*glx*.* +ECHO "Removing Slideshow test files (t_*shw*.*)" +call del /F /S %EPOCROOT%epoc32\t_*shw*.* +ECHO "Removing Build directory, and object files in there" +call del /F /S /Q %EPOCROOT%epoc32\BUILD\Photos\*.* +call rmdir /S /Q %EPOCROOT%epoc32\BUILD\Photos \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 group/createsis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/createsis.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,22 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Batch file to create sis file for photos application +rem + +pushd . +cd ..\photosgallery\gallery\sis\ +call makesis glxgallery.pkg +call signsis -s glxgallery.sis glxgallery.sisx RDTest_02.der RDTest_02.key +copy glxgallery.sisx ..\..\..\group\ +popd \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + + +PRJ_EXPORTS +../inc/glxcollectionpluginall.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionpluginall.hrh) +../inc/glxcollectionpluginalbums.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionpluginalbums.hrh) +../inc/glxcollectionplugincamera.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionplugincamera.hrh) +../inc/glxcollectionplugindownloads.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionplugindownloads.hrh) +../inc/glxcollectionpluginmonths.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionpluginmonths.hrh) +../inc/glxcollectionplugintags.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionplugintags.hrh) +../inc/glxcollectionpluginimageviewer.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionpluginimageviewer.hrh) + + +PRJ_MMPFILES + + + +PRJ_TESTMMPFILES + + diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/inc/glxcollectionpluginalbums.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/inc/glxcollectionpluginalbums.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXCOLLECTIONPLUGINALBUMS_HRH +#define GLXCOLLECTIONPLUGINALBUMS_HRH + +// CONSTANTS + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +#define KGlxCollectionPluginAlbumsDllUid 0x20007196 +#define KGlxCollectionPluginAlbumsImplementationUid 0x20007197 + +#endif // GLXCOLLECTIONPLUGINALBUMS_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/inc/glxcollectionpluginall.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/inc/glxcollectionpluginall.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXCOLLECTIONPLUGINALLL_HRH +#define GLXCOLLECTIONPLUGINALLL_HRH + +// CONSTANTS + +#define KGlxCollectionPluginAllDllUid 0x2000A7C0 +#define KGlxCollectionPluginAllImplementationUid 0x2000A7C1 + +#endif // GLXCOLLECTIONPLUGINALLL_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/inc/glxcollectionplugincamera.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/inc/glxcollectionplugincamera.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers +* +*/ + + + + +#ifndef GLXCOLLECTIONPLUGINCAMERA_HRH +#define GLXCOLLECTIONPLUGINCAMERA_HRH + +// CONSTANTS + +#define KGlxCollectionPluginCameraDllUid 0x2000a766 +#define KGlxCollectionPluginCameraImplementationUid 0x2000a767 + +#endif // GLXCOLLECTIONPLUGINCAMERA_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/inc/glxcollectionplugindownloads.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/inc/glxcollectionplugindownloads.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXCOLLECTIONPLUGINDOWNLOADS_HRH +#define GLXCOLLECTIONPLUGINDOWNLOADS_HRH + +// CONSTANTS + +#define KGlxCollectionPluginDownloadsDllUid 0x2000a76a +#define KGlxCollectionPluginDownloadsImplementationUid 0x2000a76b + +#endif // GLXCOLLECTIONPLUGINDOWNLOADS_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/inc/glxcollectionpluginimageviewer.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/inc/glxcollectionpluginimageviewer.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXCOLLECTIONPLUGINIMAGEVIEWER_HRH +#define GLXCOLLECTIONPLUGINIMAGEVIEWER_HRH + +// CONSTANTS + +#define KGlxCollectionPluginImageViewerDllUid 0x200104E5 +#define KGlxCollectionPluginImageViewerImplementationUid 0x200104E6 + +#endif // GLXCOLLECTIONPLUGINIMAGEVIEWER_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/inc/glxcollectionpluginmonths.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/inc/glxcollectionpluginmonths.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +#ifndef GLXCOLLECTIONPLUGINMONTHS_HRH +#define GLXCOLLECTIONPLUGINMONTHS_HRH + +// CONSTANTS + +#define KGlxCollectionPluginMonthsDllUid 0x2000a768 +#define KGlxCollectionPluginMonthsImplementationUid 0x2000a769 + +#endif // GLXCOLLECTIONPLUGINMONTHS_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/collection_plugins_api/inc/glxcollectionplugintags.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/collection_plugins_api/inc/glxcollectionplugintags.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXTAGCOLLECTIONPLUGIN_HRH +#define GLXTAGCOLLECTIONPLUGIN_HRH + +// CONSTANTS + +#define KGlxTagCollectionPluginDllUid 0x200071BC +#define KGlxTagCollectionPluginImplementationUid 0x200071AE + + +#endif // GLXTAGCOLLECTIONPLUGIN_HRH + +// End of File + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + + +PRJ_EXPORTS +../inc/glxcollectionmanager.h APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionmanager.h) +../inc/glxcollectioninfo.h APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectioninfo.h) +../inc/glxcollectionselectionpopup.h APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionselectionpopup.h) + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES + + +#include "../tsrc/group/bld.inf" + + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/inc/glxcollectioninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/inc/glxcollectioninfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2008-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: Collection info class +* +*/ + + + + +#ifndef __C_GLXCOLLECTIONINFO_H__ +#define __C_GLXCOLLECTIONINFO_H__ + +#include +#include + +/** + * Collection info + * This is intended to be an external API only + */ +NONSHARABLE_CLASS( CGlxCollectionInfo ) + : public CBase + { +public: + /** + * Two-phase constructor. + * @param aCollectionId MDS ID of collection (album). + */ + IMPORT_C static CGlxCollectionInfo* NewL(TUint32 aCollectionId); + + /** + * Destructor. + */ + IMPORT_C ~CGlxCollectionInfo(); + + /** + * Get the ID of the collection. + * @return ID of the collection. + */ + IMPORT_C TUint32 Id() const; + + /** + * Determine if the collectino exists. + * @return ETrue if collection exists, EFalse if does not. + */ + IMPORT_C TBool Exists() const; + + /** + * Get the title of the collection. + * @return Title (name) of the album. + */ + IMPORT_C const TDesC& Title() const; + +// Management functions + + /** + * Set if collection exists. + * @param aExists ETrue if collection exists else EFalse. + */ + void SetExists(TBool aExists); + + /** + * Set title. + * @param aTitle Title to set. + */ + void SetTitleL(const TDesC& aTitle); + +private: + /** + * Constructor + * @param aCollectionId MDS ID of collection (album) + */ + CGlxCollectionInfo(TInt aCollectionId); + + /** + * Second-phase constructor + */ + void ConstructL(); + +private: + /** + * Container id in MDS. + */ + TUint32 iItemId; + + /** + * ETrue if the item exists in MDS. Only populated after the data has been retrieved. + */ + TBool iExists; + + /** + * Title (name) of the container. Empty object until the data has been retrieved. (Owned) + */ + HBufC* iTitle; + }; + +#endif // __C_GLXCOLLECTIONINFO_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/inc/glxcollectionmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/inc/glxcollectionmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of collection manager API for external use +* +*/ + + + + +#ifndef __C_GLXCOLLECTIONMANAGER_H__ +#define __C_GLXCOLLECTIONMANAGER_H__ + +#include +#include +#include + +class CGlxCollectionInfo; +class CGlxCollectionManagerImpl; + + +/** + * Collection manager allows accessing and managing collections (only albums + * currently supported). + * + * Only one request may be issued at one time. Functions panic if two requests + * are issued at the same time + * + * The interface is intended to be used by non-MPX applications. + * Not intended to be used by Gallery internally, as there are more efficient + * and architecturally aligned means existing. + * + * @lib glxuiutilities.lib + */ +NONSHARABLE_CLASS( CGlxCollectionManager ) + : public CBase + { +public: + /** + * Special collections, for which id is not know by client + */ + enum TCollection + { + /// Camera album + ECollectionCameraAlbum + }; +public: + /** + * Two-phase constructor + */ + IMPORT_C static CGlxCollectionManager* NewL(); + + /** + * Destructor + */ + IMPORT_C ~CGlxCollectionManager(); + + /** + * Adds a file to collection asynchronously. + * @param aUri URI of file to be added to collection + * @param aCollection Specific collection to which item should be added + * @param aRequestStatus Request status that will be signalled when + * request is complete or fails due to an error. aRequestStatus must + * be an iStatus member variable of an active object. Using + * User::WaitForRequest() will not work. + */ + IMPORT_C void AddToCollectionL(const TDesC& aUri, + TCollection aCollection, TRequestStatus& aRequestStatus); + + /** + * Adds a file to collection asynchronously. + * @param aUri URI of file to be added to collection + * @param aCollectionId MDS ID of collection (album, tag, etc.) + * @param aRequestStatus Request status that will be signalled when + * request is complete or fails due to an error. aRequestStatus must + * be an iStatus member variable of an active object. Using + * User::WaitForRequest() will not work. + */ + IMPORT_C void AddToCollectionL(const TDesC& aUri, + TUint32 aCollectionId, TRequestStatus& aRequestStatus); + + /** + * Retrieves collection info + * @param aInfo Contains the collection information upon return + * Must contain the collection id when called. + * Must not be deleted before aRequestStatus is signalled. + * @param aRequestStatus Request status that will be signalled when + * request is complete or fails due to an error. aRequestStatus must + * be an iStatus member variable of an active object. Using + * User::WaitForRequest() will not work. + */ + IMPORT_C void CollectionInfoL(CGlxCollectionInfo& aInfo, + TRequestStatus& aRequestStatus); + + /** + * Cancel an ongoing request + */ + IMPORT_C void Cancel(); + +private: + /** + * Default constructor. + */ + CGlxCollectionManager(); + + /** + * Second-phase constructor + */ + void ConstructL(); + +private: + /** + * Internal implementation (owned). + */ + CGlxCollectionManagerImpl* iImplementation; + }; + +#endif // __C_GLXCOLLECTIONMANAGER_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/inc/glxcollectionselectionpopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/inc/glxcollectionselectionpopup.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-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: Interface for displaying/using the popup to select collections +* +*/ + + + + +#ifndef __T_GLXCCOLLECTIONSELECTIONPOPUP_H__ +#define __T_GLXCCOLLECTIONSELECTIONPOPUP_H__ + +#include + +/** + * Collection (container) types + * These are defined as TUint32 instead of enum to allow the definition + * of these to be spread across multiple headers (and MPX collection plugin + * id to be used directly as the type id) + */ +// Album +const TUint32 KGlxCollectionTypeIdAlbum = 0x01; +// Tag +const TUint32 KGlxCollectionTypeIdTag = 0x02; + +/** + * @class TGlxCollectionSelectionPopup + * + * Collection selection popup external interface + * + * Shows a popup that contains a selectable list of media collections, + * such as albums or tags + * + * @lib glxcollectionmanager.lib + */ +class TGlxCollectionSelectionPopup +{ +public: + /** + * Displays the list of selectable collections in a popup. Allows creation of a new collection. + * @ param aSelectedIds list of the selected item id + * @ param aType Type of the collection to be shown (albums, tags, locations, etc). + * KGlxCollectionTypeIdAlbum and KGlxCollectionTypeIdTag. + * @param aAllowMultipleSelection If ETrue, popup allows selecting multiple collections + * If EFalse, only a single collection may be selected + * @param aEnableContaierCreation If ETrue, popup allows the creation of a new collection. + * If EFalse, popup does not allow the creation of a new collection. + * @ return Standard error code, e.g., KErrCancel + */ + IMPORT_C static TInt ShowPopupL(RArray& aSelectedIds, + TUint32 aCollectionType, TBool aAllowMultipleSelection, TBool aEnableContainerCreation = ETrue); +}; + +#endif // __T_GLXCCOLLECTIONSELECTIONPOPUP_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -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: build Inf file +* +*/ + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these + + DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' +//../init/TestFramework.ini /epoc32/winscw/c/testframework/TestFramework.ini + + + +//#include "../ut_collectionmanager/group/bld.inf" +//#include "../ui_metaDataDialog/group/bld.inf" +//#include "../ut_collectioninfo/group/bld.inf" + + + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/init/TestFramework.ini Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,191 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testscripter + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\epos_omasuplpostestercfg.cfg +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= testscripter +TestCaseFile = c:\testframework\ut_collectionmanager.cfg +[End_Module] + +# To run metadataDialog tests +[New_Module] +ModuleName= testcombiner +TestCaseFile= c:\testframework\testcombiner.cfg +[End_Module] + + +[New_Module] +ModuleName= testscripter +TestCaseFile = c:\testframework\ut_collectioninfo.cfg +[End_Module] + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/Bmarm/ui_metaDataDialogu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/Bmarm/ui_metaDataDialogu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/Bwins/ui_metaDataDialogu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/Bwins/ui_metaDataDialogu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/conf/testcombiner.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/conf/testcombiner.cfg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,5 @@ +[Test] +title TestViewActivate +run testscripter c:\testframework\ui_metaDataDialog.cfg 1 +run testscripter c:\testframework\ui_metaDataDialog.cfg 2 +[Endtest] diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/conf/ui_metaDataDialog.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/conf/ui_metaDataDialog.cfg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,14 @@ +[Test] +title TestViewActivate +bringtoforeground +create ui_metaDataDialog foobar +foobar TestViewActivate +sendtobackground +delete foobar +[Endtest] + +[Test] +title PressRightSoftkey +pause 5000 // Give some time(5s) for the view to activate, we could use events but this way is simpler +presskey global EKeyDevice1 // press RIGHT softkey +[Endtest] \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/eabi/ui_metaDataDialogu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/eabi/ui_metaDataDialogu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* +*/ + +PRJ_PLATFORMS + + DEFAULT + +PRJ_TESTEXPORTS + +/* ../conf/testcombiner.cfg /epoc32/winscw/c/testframework/testcombiner.cfg +../conf/ui_metaDataDialog.cfg /epoc32/winscw/c/testframework/ui_metaDataDialog.cfg +../init/TestFramework.ini /epoc32/winscw/c/testframework/TestFramework.ini */ // Enable this files export while work on emulator as it is not required for CI build test automation run. + + +PRJ_EXPORTS + +PRJ_TESTMMPFILES + +ui_metaDataDialog.mmp + + +PRJ_MMPFILES +//ui_metaDataDialog_nrm.mmp + + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/*TYPE TESTCLASS*/ +/* +* 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: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET ui_metaDataDialog.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE ui_metaDataDialog.def + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE ui_metaDataDialog.cpp +SOURCE ui_metaDataDialogBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY glxmetadatadialog.lib +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +; +; 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: +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\ui_metaDataDialog.dll"-"!:\Sys\Bin\ui_metaDataDialog.dll" +"..\conf\testcombiner.cfg"-"C:\testframework\testcombiner.cfg" +"..\conf\ui_metaDataDialog.cfg"-"C:\testframework\ui_metaDataDialog.cfg" +"..\init\testframework.ini"-"C:\testframework\testframework.ini" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog_DoxyFile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog_DoxyFile.txt Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,239 @@ +# +# 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 the License "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +# Doxyfile 1.4.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = ui_metaDataDialog +PROJECT_NUMBER = +OUTPUT_DIRECTORY = \ui_metaDataDialog\ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = YES +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = \ui_metaDataDialog\ +FILE_PATTERNS = *.h \ + *.rh \ + *.hrh +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = NO +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = YES +RTF_OUTPUT = Doc +COMPACT_RTF = YES +RTF_HYPERLINKS = YES +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = NONSHARABLE_CLASS +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog_nrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/group/ui_metaDataDialog_nrm.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/*TYPE TESTCLASS*/ +/* +* 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: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET ui_metaDataDialog.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE ui_metaDataDialog.def + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE ui_metaDataDialog.cpp +SOURCE ui_metaDataDialogBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/inc/glxmetadataviewutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/inc/glxmetadataviewutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2008-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: Metadata dialog implementation +* +*/ + + + + + +#ifndef GLXMETADATAVIEWUTILITY_H_ +#define GLXMETADATAVIEWUTILITY_H_ + +// INCLUDES +#include + +/** + * Metadata view utility + * + * Utility for creating/launching metadata view from gallery and other application + * + * @lib glxunifiedmetadataview.lib + */ + + class GlxMetadataViewUtility + { + public: + + /** + * Activate Metadata view for item. + * + * @param aURI filename or URI of item + */ + IMPORT_C static void ActivateViewL( const TDesC& aURI ); + }; + +#endif /*C_GLXMETADATAVIEWUTILITY_H_*/ + +//End of file + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/inc/ui_metaDataDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/inc/ui_metaDataDialog.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,184 @@ +/* +* 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: STIF testclass declaration +* +*/ + +#ifndef UI_METADATADIALOG_H +#define UI_METADATADIALOG_H + +// INCLUDES +#include +#include +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( Kui_metaDataDialogLogPath, "\\logs\\testframework\\ui_metaDataDialog\\" ); +// Log file +_LIT( Kui_metaDataDialogLogFile, "ui_metaDataDialog.txt" ); +_LIT( Kui_metaDataDialogLogFileWithTitle, "ui_metaDataDialog_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cui_metaDataDialog; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cui_metaDataDialog test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cui_metaDataDialog) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cui_metaDataDialog* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cui_metaDataDialog(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + Cui_metaDataDialog( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt TestViewActivaeL( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + // ?one_line_short_description_of_data + //?data_declaration; + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // UI_METADATADIALOG_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/init/TestFramework.ini Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,179 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testscripter + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\epos_omasuplpostestercfg.cfg +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# To run metadataDialog tests +[New_Module] +ModuleName= testcombiner +TestCaseFile= c:\testframework\testcombiner.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/src/ui_metaDataDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/src/ui_metaDataDialog.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,199 @@ +/* +* 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: This file contains testclass implementation. +* +*/ + +// INCLUDE FILES +#include +#include "ui_metaDataDialog.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cui_metaDataDialog::Cui_metaDataDialog +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cui_metaDataDialog::Cui_metaDataDialog( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cui_metaDataDialog::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cui_metaDataDialog::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(Kui_metaDataDialogLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kui_metaDataDialogLogFile); + } + + iLog = CStifLogger::NewL( Kui_metaDataDialogLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cui_metaDataDialog::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cui_metaDataDialog* Cui_metaDataDialog::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cui_metaDataDialog* self = new (ELeave) Cui_metaDataDialog( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cui_metaDataDialog::~Cui_metaDataDialog() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cui_metaDataDialog::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cui_metaDataDialog::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ui_metaDataDialog.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) Cui_metaDataDialog::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/src/ui_metaDataDialogBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ui_metaDataDialog/src/ui_metaDataDialogBlocks.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,150 @@ +/* +* 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: This file contains testclass implementation. +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "glxmetadataviewutility.h" +#include "ui_metaDataDialog.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cui_metaDataDialog::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cui_metaDataDialog::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cui_metaDataDialog::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cui_metaDataDialog::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "TestViewActivate", Cui_metaDataDialog::TestViewActivaeL ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cui_metaDataDialog::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cui_metaDataDialog::TestViewActivaeL( CStifItemParser& /*aItem */) + { + + const TBufC<256> aUri(_L("e:\\images\\sample.jpg")); + GlxMetadataViewUtility::ActivateViewL(aUri); + + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cui_metaDataDialog::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt Cui_metaDataDialog::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/Bmarm/ut_collectioninfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/Bmarm/ut_collectioninfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/Bwins/ut_collectioninfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/Bwins/ut_collectioninfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/conf/ut_collectioninfo.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/conf/ut_collectioninfo.cfg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ + +[Test] +title NewL() +create ut_collectioninfo foobar +foobar TestNewL +delete foobar +[Endtest] + +[Test] +title ExistS() +create ut_collectioninfo foobar +foobar TestExistL +delete foobar +[Endtest] + +[Test] +title Title() +create ut_collectioninfo foobar +foobar TestTitleL +delete foobar +[Endtest] + +[Test] +title Id() +create ut_collectioninfo foobar +foobar TestIdL +delete foobar +[Endtest] + +[Test] +title ~CGlxCollectionInfo() +create ut_collectioninfo foobar +foobar TestDestructorL +delete foobar +[Endtest] diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/eabi/ut_collectioninfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/eabi/ut_collectioninfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,45 @@ +/* +* 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: +* +*/ + +PRJ_PLATFORMS + + + DEFAULT + +PRJ_TESTEXPORTS +/* ../conf/ut_collectioninfo.cfg /epoc32/winscw/c/testframework/ut_collectioninfo.cfg +../init/TestFramework.ini /epoc32/winscw/c/testframework/TestFramework.ini */ // Enable this files export while work on emulator as it is not required for CI build test automation run. + + +PRJ_EXPORTS + + +PRJ_TESTMMPFILES + +ut_collectioninfo.mmp + + + + +PRJ_MMPFILES +//ut_collectioninfo_nrm.mmp + + + + + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,78 @@ +/*TYPE TESTCLASS*/ +/* +* 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: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET ut_collectioninfo.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE ut_collectioninfo.def + +USERINCLUDE ../inc +//SYSTEMINCLUDE ../../../inc + +APP_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../src + +SOURCE ut_collectioninfo.cpp +SOURCE ut_collectioninfoBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY glxcollectionmanager.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -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: +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\ut_collectioninfo.dll"-"!:\Sys\Bin\ut_collectioninfo.dll" +"..\conf\ut_collectioninfo.cfg"-"C:\testframework\ut_collectioninfo.cfg" +"..\init\testframework.ini"-"C:\testframework\testframework.ini" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo_DoxyFile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo_DoxyFile.txt Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,239 @@ +# +# 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 the License "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +# Doxyfile 1.4.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = ut_collectioninfo +PROJECT_NUMBER = +OUTPUT_DIRECTORY = \ut_collectioninfo\ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = YES +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = \ut_collectioninfo\ +FILE_PATTERNS = *.h \ + *.rh \ + *.hrh +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = NO +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = YES +RTF_OUTPUT = Doc +COMPACT_RTF = YES +RTF_HYPERLINKS = YES +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = NONSHARABLE_CLASS +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo_nrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo_nrm.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/*TYPE TESTCLASS*/ +/* +* 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: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET ut_collectioninfo.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE ut_collectioninfo.def + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE ut_collectioninfo.cpp +SOURCE ut_collectioninfoBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/inc/ut_collectioninfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/inc/ut_collectioninfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,191 @@ +/* +* 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: STIF testclass declaration +* +*/ + +#ifndef UT_COLLECTIONINFO_H +#define UT_COLLECTIONINFO_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( Kut_collectioninfoLogPath, "\\logs\\testframework\\ut_collectioninfo\\" ); +// Log file +_LIT( Kut_collectioninfoLogFile, "ut_collectioninfo.txt" ); +_LIT( Kut_collectioninfoLogFileWithTitle, "ut_collectioninfo_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cut_collectioninfo; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cut_collectioninfo test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cut_collectioninfo) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cut_collectioninfo* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cut_collectioninfo(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + Cut_collectioninfo( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt Test_NewL( CStifItemParser& aItem ); + virtual TInt Test_ExistsL (CStifItemParser& aItem ); + virtual TInt Test_TitleL (CStifItemParser& aItem ); + virtual TInt Test_IdL (CStifItemParser& aItem ); + virtual TInt Test_DestructorL (CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + // ?one_line_short_description_of_data + //?data_declaration; + CGlxCollectionInfo* iCollectionInfo; + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // UT_COLLECTIONINFO_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/init/TestFramework.ini Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,180 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testscripter + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\epos_omasuplpostestercfg.cfg +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + +[New_Module] +ModuleName= testscripter +TestCaseFile = c:\testframework\ut_collectioninfo.cfg +[End_Module] + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/src/ut_collectioninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/src/ut_collectioninfo.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,199 @@ +/* +* 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: This file contains testclass implementation. +* +*/ + +// INCLUDE FILES +#include +#include "ut_collectioninfo.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::Cut_collectioninfo +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cut_collectioninfo::Cut_collectioninfo( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cut_collectioninfo::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(Kut_collectioninfoLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kut_collectioninfoLogFile); + } + + iLog = CStifLogger::NewL( Kut_collectioninfoLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cut_collectioninfo* Cut_collectioninfo::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cut_collectioninfo* self = new (ELeave) Cut_collectioninfo( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cut_collectioninfo::~Cut_collectioninfo() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cut_collectioninfo::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cut_collectioninfo::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ut_collectioninfo.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) Cut_collectioninfo::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/src/ut_collectioninfoBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/src/ut_collectioninfoBlocks.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,350 @@ +/* +* 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: This file contains testclass implementation. +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +//#include +#include +#include +#include "ut_collectioninfo.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cut_collectioninfo::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cut_collectioninfo::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + //ADD NEW ENTRY HERE + ENTRY( "TestNewL", Cut_collectioninfo::Test_NewL ), + ENTRY( "TestExistL", Cut_collectioninfo::Test_ExistsL ), + ENTRY( "TestTitleL", Cut_collectioninfo::Test_TitleL ), + ENTRY( "TestIdL", Cut_collectioninfo::Test_IdL ), + ENTRY( "TestDestructorL", Cut_collectioninfo::Test_DestructorL ), + + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt Cut_collectioninfo::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::Test_NewL +// Test for CGlxCollectionInfo::NewL API +// ----------------------------------------------------------------------------- + +TInt Cut_collectioninfo::Test_NewL( CStifItemParser& /*aItem */) + { + // Print to UI + _LIT( KTest_one, "Test_one" ); + _LIT( KTestText, "In Test_NewL" ); + TestModuleIf().Printf( 0, KTest_one, KTestText ); + // Print to log file + iLog->Log( KTestText ); + + TRAPD(err,iCollectionInfo = CGlxCollectionInfo::NewL(KGlxCollectionPluginAlbumsImplementationUid)); + if(iCollectionInfo) + { + // Test case passed if CGlxCollectionInfo instance is created + iLog->Log(_L("CGlxCollectionManager::NewL() Passed")); + delete iCollectionInfo; + iCollectionInfo = NULL; + User::InfoPrint(_L("test CGlxCollectionInfo::NewL passed")); + return KErrNone; + } + else + { + // Test case Failed if CGlxCollectionManager instance is not created + iLog->Log(_L("CGlxCollectionManager::NewL() Failed")); + User::InfoPrint(_L("test newL failed")); + return err; + } + } + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::Test_ExistsL +// Test for CGlxCollectionInfo::Exists() API +// Creates the CGlxCollectionInfo instance and calls the Exists() API +// ----------------------------------------------------------------------------- + +TInt Cut_collectioninfo::Test_ExistsL( CStifItemParser& /*aItem */) + { + // Print to UI + _LIT( KTest_two, "Test_two" ); + _LIT( KTestText, "In Test_ExistsL" ); + TestModuleIf().Printf( 0, KTest_two, KTestText ); + // Print to log file + iLog->Log( KTestText ); + + TInt apiErr = KErrNone; + if(!iCollectionInfo) + { + TRAPD(err,iCollectionInfo = CGlxCollectionInfo::NewL(KGlxCollectionPluginAlbumsImplementationUid)); + if(iCollectionInfo) + { + apiErr = iCollectionInfo->Exists(); + if(!apiErr) //true value // @ToDo: (!apiErr) must chage to (apiErr) and we need to have 2 test cases (1) for case where a collection exists and it is tested for existence. (2) where a collection does not exist and it is tested for non-existence. + { + iLog->Log(_L("CGlxCollectionManager::Exists() Passed")); + User::InfoPrint(_L("Test Exists Passed")); + return KErrNone; + } + else + { + iLog->Log(_L("CGlxCollectionManager::Exists() Failed")); + User::InfoPrint(_L("Test Exists Failed")); + return KErrNotFound; + } + } + else + { + return err; + } + } + } + +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::Test_TitleL +// Test for CGlxCollectionInfo::Title() API +// +// ----------------------------------------------------------------------------- +// +TInt Cut_collectioninfo::Test_TitleL( CStifItemParser& /*aItem */) + { + // Print to UI + _LIT( KTest_three, "Test_three" ); + _LIT( KTestText, "In Test_TitleL" ); + TestModuleIf().Printf( 0, KTest_three, KTestText ); + // Print to log file + iLog->Log( KTestText ); + + TRAPD(err,iCollectionInfo = CGlxCollectionInfo::NewL(KGlxCollectionPluginAlbumsImplementationUid)); + HBufC* textResource = NULL; + if(iCollectionInfo) + { + textResource = iCollectionInfo->Title().AllocLC(); + if(textResource->Length() != 0) //title of collection info is returned + { + //passed + iLog->Log(_L("CGlxCollectionManager::Title() Passed")); + User::InfoPrint(_L("Test Title Passed")); + CleanupStack::PopAndDestroy( textResource ); + return KErrNone; + } + else + { + if(textResource->Des() == KNullDesC) //title is returned as KNullDesC + { + //passed since Title() may return a KNullDesC + iLog->Log(_L("CGlxCollectionManager::Title() Passed")); + User::InfoPrint(_L("Test Title Passed")); + CleanupStack::PopAndDestroy( textResource ); + return KErrNone; + } + else + { + //failed if its a junk value, not sure of how to check for this + //as the API checks and returns null value if the title does + //exist and hence there cannot be a failure scenario + iLog->Log(_L("CGlxCollectionManager::Title() Failed")); + User::InfoPrint(_L("Test Title Failed")); + CleanupStack::PopAndDestroy( textResource ); + //Returning KErrNotFound as Title is not available. Still not 100% sure of this. + return KErrNotFound; + } + } + } + else + { + return err; + } + } +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::Test_IdL +// Test for CGlxCollectionInfo::Id() API +// +// ----------------------------------------------------------------------------- +// +TInt Cut_collectioninfo::Test_IdL( CStifItemParser& /*aItem */) + { + // Print to UI + _LIT( KTest_four, "Test_four" ); + _LIT( KTestText, "In Test_IdL" ); + TestModuleIf().Printf( 0, KTest_four, KTestText ); + // Print to log file + iLog->Log( KTestText ); + TInt err = KErrNone;; + if(!iCollectionInfo) + TRAP(err,iCollectionInfo = CGlxCollectionInfo::NewL(KGlxCollectionPluginAlbumsImplementationUid)); + if(iCollectionInfo) + { + TUint32 collectionId = 0; + collectionId = iCollectionInfo->Id(); + if(collectionId) //if non zero + { + //passed + iLog->Log(_L("CGlxCollectionManager::Id() Passed")); + User::InfoPrint(_L("Test Id Passed")); + return KErrNone; + } + else + { + //failed if zero + iLog->Log(_L("CGlxCollectionManager::Id() Failed")); + User::InfoPrint(_L("Test Id failed")); + //Returning KErrNotFound as Id() is not available. Still not 100% sure of this. + return KErrNotFound; + } + } + else + { + return err; + } +} +// ----------------------------------------------------------------------------- +// Cut_collectioninfo::Test_DestructorL +// Test for CGlxCollectionInfo::~CGlxCollectionInfo() API +// Checks if instance is correctly deleted without any memory leaks +// ----------------------------------------------------------------------------- +// +TInt Cut_collectioninfo::Test_DestructorL( CStifItemParser& /*aItem */) + { + // Print to UI + _LIT( KTest_five, "Test_five" ); + _LIT( KTestText, "In Test_DestructorL" ); + TestModuleIf().Printf( 0, KTest_five, KTestText ); + // Print to log file + iLog->Log( KTestText ); + + TInt err = KErrNone; + if(!iCollectionInfo) + TRAPD(err,iCollectionInfo = CGlxCollectionInfo::NewL(KGlxCollectionPluginAlbumsImplementationUid)); + if(iCollectionInfo) + { + __UHEAP_MARK; + delete iCollectionInfo; + iCollectionInfo = NULL; + __UHEAP_MARKEND; + iLog->Log(_L("~CollectionManager() :: Passed")); + User::InfoPrint(_L("Test Destructor Passed")); + return KErrNone; + } + else + { + return err; + } + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/Bmarm/ut_collectionmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/Bmarm/ut_collectionmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/Bwins/ut_collectionmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/Bwins/ut_collectionmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/conf/ut_collectionmanager.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/conf/ut_collectionmanager.cfg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,36 @@ +[Test] +title NewL +create ut_collectionmanager collectionMgrTest +collectionMgrTest NewL +delete collectionMgrTest +[Endtest] + +[Test] +title Destructor +create ut_collectionmanager collectionMgrTest +collectionMgrTest Destructor +delete collectionMgrTest +[Endtest] + + +[Test] +title AddToCollection +create ut_collectionmanager collectionMgrTest1 +collectionMgrTest1 AddToCollection +delete collectionMgrTest1 +[Endtest] + +[Test] +title TestCollectionInfo +create ut_collectionmanager collectionMgrTest2 +collectionMgrTest2 CollectionInfoL +delete collectionMgrTest2 + +[Endtest] + +[Test] +title TestCancel +create ut_collectionmanager collectionMgrTest3 +collectionMgrTest3 Cancel +delete collectionMgrTest3 +[Endtest] \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/data/sample.jpg Binary file photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/data/sample.jpg has changed diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/eabi/ut_collectionmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/eabi/ut_collectionmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI23CGlxCollectionManagerAO @ 2 NONAME ; ## + _ZTV23CGlxCollectionManagerAO @ 3 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -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: build Inf file +* +*/ + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these + + DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +/* ../conf/ut_collectionmanager.cfg /epoc32/winscw/c/testframework/ut_collectionmanager.cfg +../init/TestFramework.ini /epoc32/winscw/c/testframework/TestFramework.ini +../data/sample.jpg /epoc32/winscw/c/data/images/sample.jpg */ // Enable this files export while work on emulator as it is not required for CI build test automation run. + + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + + +PRJ_TESTMMPFILES + +ut_collectionmanager.mmp + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/ut_collectionmanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/ut_collectionmanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +/*TYPE TESTCLASS*/ +/* +* 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: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include + +TARGET ut_collectionmanager.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE ut_collectionmanager.def + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../inc + +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE ut_collectionmanager.cpp +SOURCE ut_collectionmanagerBlocks.cpp +SOURCE glxcollectionmanagerao.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY glxcollectionmanager.lib + + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/ut_collectionmanager.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/ut_collectionmanager.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -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: Installation file for STIF +; +; + + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\ut_collectionmanager.dll"-"!:\Sys\Bin\ut_collectionmanager.dll" +"..\conf\ut_collectionmanager.cfg"-"C:\testframework\ut_collectionmanager.cfg" +"..\init\testframework.ini"-"C:\testframework\testframework.ini" +"..\data\sample.jpg"-"C:\data\images\sample.jpg" +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/ut_collectionmanager_DoxyFile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/ut_collectionmanager_DoxyFile.txt Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,239 @@ +# +# 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 the License "Symbian Foundation License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +# Doxyfile 1.4.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = ut_collectionmanager +PROJECT_NUMBER = +OUTPUT_DIRECTORY = M:\photos\photos_plat\controllers_collection_api\tsrc\ut_collectionmanager\ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = YES +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = M:\photos\photos_plat\controllers_collection_api\tsrc\ut_collectionmanager\ +FILE_PATTERNS = *.h \ + *.rh \ + *.hrh +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = NO +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = YES +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = YES +RTF_OUTPUT = Doc +COMPACT_RTF = YES +RTF_HYPERLINKS = YES +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = NONSHARABLE_CLASS +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/inc/glxcollectionmanagerao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/inc/glxcollectionmanagerao.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of collection manager API for external use +* +* +*/ + + +#ifndef __GLXCOLLECTIONMANAGERAO_H__ +#define __GLXCOLLECTIONMANAGERAO_H__ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// @todo: Documentation to be done + +// Observer CLASS DECLARATION +class MObserver + { +public : + virtual void RequestComplete(TInt aError) = 0 ; + }; + +class TElement + { +public : + TElement(); +public : + TBuf<256> iData; + }; + + + +class CGlxCollectionManagerAO : public CActive + { +public: + enum TRequestType {EAddToCollectionL,EAddToCollectionL2,ECollectionInfo,ECancel} ; + +public: + + static CGlxCollectionManagerAO* NewL(MObserver& aObserver); + ~CGlxCollectionManagerAO(); + void TestingFunc(CStifItemParser& aItem); + void AddToCollectionTestL(); + void TestCollectionInfoL(); + void TestCancel(); + +public: // from CActive + + void RunL(); + void DoCancel(); + TInt RunError(TInt aError) ; + + +private: + CGlxCollectionManagerAO(MObserver& aObserver); + void ConstructL(); + void ParseUserInput(CArrayFixFlat* aArray); + +private: + + MObserver& iObserver; + CGlxCollectionManager* iCollectionManager; + CArrayFixFlat* fixflat; + CGlxCollectionInfo* iCollectionInfo; + CGlxCollectionManager::TCollection iCollection; + TUint32 iCollectionId; + }; + + +#endif // __GLXCOLLECTIONMANAGERAO_H__ diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/inc/ut_collectionmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/inc/ut_collectionmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,216 @@ +/* +* 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: STIF testclass declaration +* +* +*/ + + +#ifndef UT_COLLECTIONMANAGER_H +#define UT_COLLECTIONMANAGER_H + +// INCLUDES +#include +#include +#include +#include + +#include "glxcollectionmanagerao.h" + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( Kut_collectionmanagerLogPath, "\\logs\\testframework\\ut_collectionmanager\\" ); +// Log file +_LIT( Kut_collectionmanagerLogFile, "ut_collectionmanager.txt" ); +_LIT( Kut_collectionmanagerLogFileWithTitle, "ut_collectionmanager_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cut_collectionmanager; + + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +class CGlxCollectionManagerAO ; + +/** +* Cut_collectionmanager test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cut_collectionmanager) : public CScriptBase,public MObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cut_collectionmanager* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cut_collectionmanager(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + Cut_collectionmanager( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + + /** + * Test case for CollectionManager object creation + * @param aItem Script line containing parameters. + * @return Symbian OS error code + */ + virtual TInt NewLTestL( CStifItemParser& aItem ); + + /** + * Test case for CollectionManager object Destruction + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt DestructionTestL(CStifItemParser& aItem); + + /** + * Test case to check whether the image at the specified URI + * has been added to the specified collection. + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt AddToCollectionTestL(CStifItemParser& aItem); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + void RequestComplete(TInt aError); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + virtual TInt TestCollectionInfoL(); + virtual TInt TestCancelL(); + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + // ?one_line_short_description_of_data + //?data_declaration; + + // CollectionManager Active Object used to create collections of images + + // Reserved pointer for future extension + //TAny* iReserved; + + + public: // Friend classes + //?friend_class_declaration; + + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + CGlxCollectionManagerAO* iAo ; + CActiveSchedulerWait* iWait ; + + }; + +#endif // UT_COLLECTIONMANAGER_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/init/TestFramework.ini Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,179 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testscripter + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\epos_omasuplpostestercfg.cfg +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + +[New_Module] +ModuleName= testscripter +TestCaseFile = c:\testframework\ut_collectionmanager.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/src/glxcollectionmanagerao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/src/glxcollectionmanagerao.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of collection manager API for external use +* +* +*/ + + +//INTERNAL INCLUDES +#include "glxcollectionmanagerao.h" + +//EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ut_collectionmanager.h" + +_LIT( KTagCollection, "KGlxTagCollectionPluginImplementationUid" ); +_LIT( KAlbumCollection, "KGlxCollectionPluginAlbumsImplementationUid" ); +_LIT( KCameraCollection, "ECollectionCameraAlbum" ); + +/* + * Constructor for the TElement class + */ +TElement::TElement() + { + //No need to initialise anything + } + + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerAO::CGlxCollectionManagerAO +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CGlxCollectionManagerAO::CGlxCollectionManagerAO(MObserver& aObserver):CActive(EPriorityStandard),iObserver(aObserver) + { + + } + +// ----------------------------------------------------------------------------- +// CTest_Active::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CGlxCollectionManagerAO* CGlxCollectionManagerAO::NewL(MObserver& aObserver) + { + CGlxCollectionManagerAO* self = new (ELeave) CGlxCollectionManagerAO(aObserver); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxCollectionManagerAO::~CGlxCollectionManagerAO() + { + if(iCollectionManager) + { + delete iCollectionManager; + iCollectionManager = NULL; + } + if ( iCollectionInfo ) + { + delete iCollectionInfo; + iCollectionInfo = NULL; + } + if(fixflat) + { + delete fixflat; + fixflat =NULL; + } + Cancel(); + } + + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerAO::DoCancel() +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerAO::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerAO::RunL() +// ----------------------------------------------------------------------------- +// + +void CGlxCollectionManagerAO::RunL() + { + /* + if (iStatus.Int() != KErrNone) + User::LeaveIfError(iStatus.Int()); + */ + iObserver.RequestComplete(iStatus.Int()); + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerAO::RunError() +// ----------------------------------------------------------------------------- +// + +TInt CGlxCollectionManagerAO::RunError(TInt aError) + { + return aError; + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerAO::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerAO::ConstructL() + { + CActiveScheduler::Add(this); + fixflat = new (ELeave) CArrayFixFlat(3); + } +/* + * CGlxCollectionManagerAO::test_Func + * The test function to test the async APIs + */ +void CGlxCollectionManagerAO::TestingFunc(CStifItemParser& aItem) + { + TPtrC string; + TInt i = 0; + TElement aElement; + while ( aItem.GetNextString ( string ) == KErrNone ) + { + aElement.iData.Copy(string); + fixflat->InsertL(i,aElement); + i++; + } + ParseUserInput(fixflat); + } + + +// ----------------------------------------------------------------------------- +// TestL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerAO::AddToCollectionTestL() + { + +#ifdef __WINSCW__ + _LIT( KPath, "E:\\Images\\sample.jpg"); +#else + _LIT( KPath, "c:\\data\\Images\\sample.jpg"); +#endif + + if (!iCollectionManager) + { + iCollectionManager = CGlxCollectionManager::NewL(); + } + TInt err = KErrNone; + //TRAP(err,iCollectionManager->AddToCollectionL((*fixflat)[0].iData, iCollection, iStatus)); + TRAP(err,iCollectionManager->AddToCollectionL(KPath, 1, iStatus)); + + if( !IsActive() ) + SetActive(); +} + + + +/* + * CTest_Active::TestCollectionInfoL() + * This function checks CollectionInfoL() api. + * + */ +void CGlxCollectionManagerAO::TestCollectionInfoL() + { + if (!iCollectionManager) + { + iCollectionManager = CGlxCollectionManager::NewL(); + } + if ( iCollectionInfo ) + { + delete iCollectionInfo; + iCollectionInfo = NULL; + } + iCollectionInfo = CGlxCollectionInfo::NewL( KGlxCollectionPluginAlbumsImplementationUid ); + iCollectionManager->CollectionInfoL( *iCollectionInfo, iStatus ); + if( !IsActive() ) + SetActive(); + + } +/* + * CTest_Active::TestCancel() + * This function tests the Cancel() api. + * It assumes that a request has been placed and then + * the cancel is been issued. + */ +void CGlxCollectionManagerAO::TestCancel() + { + if (!iCollectionManager) + { + iCollectionManager = CGlxCollectionManager::NewL(); + } + if (!iCollectionManager) + { + iCollectionManager = CGlxCollectionManager::NewL(); + } + if ( iCollectionInfo ) + { + delete iCollectionInfo; + iCollectionInfo = NULL; + } + iCollectionInfo = CGlxCollectionInfo::NewL( KGlxCollectionPluginAlbumsImplementationUid ); + iCollectionManager->CollectionInfoL( *iCollectionInfo, iStatus ); + if( !IsActive() ) + SetActive(); + + if(iCollectionManager) + { + iCollectionManager->Cancel(); + } + } + +/* + * @to do: This function later need to be modified + * For the time, whatever user passes from the .cfg file + * it matches the string && assigns the collectionid or collection + */ +void CGlxCollectionManagerAO::ParseUserInput(CArrayFixFlat* aArray) + { + TInt count1 = aArray->Count(); + if((*fixflat)[1].iData == KAlbumCollection) + { + iCollectionId = KGlxCollectionPluginAlbumsImplementationUid; + } + else if((*fixflat)[1].iData == KTagCollection) + { + iCollectionId = KGlxTagCollectionPluginImplementationUid; + } + else if((*fixflat)[1].iData == KCameraCollection) + { + iCollection = CGlxCollectionManager::ECollectionCameraAlbum; + } + } + diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/src/ut_collectionmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/src/ut_collectionmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,213 @@ +/* +* 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: This file contains testclass implementation. +* +*/ + +// INCLUDE FILES +#include +#include "ut_collectionmanager.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::Cut_collectionmanager +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cut_collectionmanager::Cut_collectionmanager( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cut_collectionmanager::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + iAo = CGlxCollectionManagerAO :: NewL(*this); + iWait = new (ELeave) CActiveSchedulerWait; + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(Kut_collectionmanagerLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kut_collectionmanagerLogFile); + } + + iLog = CStifLogger::NewL( Kut_collectionmanagerLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + } + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cut_collectionmanager* Cut_collectionmanager::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cut_collectionmanager* self = new (ELeave) Cut_collectionmanager( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + + // Destructor + Cut_collectionmanager::~Cut_collectionmanager() + { + if( iWait ) + { + delete iWait; + } + if(iAo) + { + delete iAo; + iAo = NULL; + } + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cut_collectionmanager::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cut_collectionmanager::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ut_collectionmanager.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) Cut_collectionmanager::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/src/ut_collectionmanagerBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/src/ut_collectionmanagerBlocks.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,266 @@ +/* +* 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: This file contains testclass implementation. +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include + +#include "ut_collectionmanager.h" + + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cut_collectionmanager::Delete() + { + } + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cut_collectionmanager::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + ENTRY( "NewL", Cut_collectionmanager::NewLTestL ), + ENTRY( "Destructor", Cut_collectionmanager::DestructionTestL ), + ENTRY( "AddToCollection", Cut_collectionmanager::AddToCollectionTestL), + ENTRY( "CollectionInfoL", Cut_collectionmanager::TestCollectionInfoL ), + ENTRY( "Cancel", Cut_collectionmanager::TestCancelL ), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + + return RunInternalL( KFunctions, count, aItem ); + + } + + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::NewLTestL +// ----------------------------------------------------------------------------- +// +TInt Cut_collectionmanager::NewLTestL( CStifItemParser& /*aItem*/ ) + { + // Create CollectionManager Instance + CGlxCollectionManager* collectionManager = CGlxCollectionManager::NewL(); + + if( collectionManager ) + { + // Print test case passed if CGlxCollectionManager instance is created + iLog->Log(_L("CGlxCollectionManager::NewL() Passed")); + delete collectionManager; + collectionManager = NULL; + User::InfoPrint(_L("test newL passed")); + return KErrNone; + } + else + { + // Print test case passed if CGlxCollectionManager instance is created + iLog->Log(_L("CGlxCollectionManager::NewL() Failed")); + User::InfoPrint(_L("test newL failed")); + return KErrArgument; + } + } + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::DestructionTestL +// ----------------------------------------------------------------------------- +// +TInt Cut_collectionmanager::DestructionTestL(CStifItemParser& /*aItem*/) + { + _LIT( KDestructionTest, "DestructionTest" ); + + // Print to log file + iLog->Log( KDestructionTest ); + + __UHEAP_MARK; + // Create CollectionManager Instance + CGlxCollectionManager* collectionManager = CGlxCollectionManager::NewL(); + delete collectionManager; + collectionManager = NULL; + __UHEAP_MARKEND; + + iLog->Log(_L("~CollectionManager() :: Passed")); + User::InfoPrint(_L("test ~CollectionManager() Passed")); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::AddToCollectionTestL +// ----------------------------------------------------------------------------- +// +TInt Cut_collectionmanager::AddToCollectionTestL(CStifItemParser& aItem) + { + TInt error = KErrNone ; + TRAP(error, + if(iAo) + { + //iAo->TestingFunc(aItem) ;//uncomment it later when pass the args from .cfg file and parse it in parse func + iAo->AddToCollectionTestL(); + iWait->Start(); + } + ); + return error; + } + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::TestCollectionInfoL +// ----------------------------------------------------------------------------- +// +TInt Cut_collectionmanager::TestCollectionInfoL() + { + TInt error = KErrNone ; + TRAP(error, + if(iAo) + { + iAo->TestCollectionInfoL() ; + iWait->Start(); + } + ); + return error; + } + +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::TestCancelL +// ----------------------------------------------------------------------------- +// +TInt Cut_collectionmanager::TestCancelL() + { + TInt error = KErrNone ; + TRAP(error, + if(iAo) + { + iAo->TestCancel() ; + iWait->Start(); + } + ); + return error; + } + + +/**** + * callback from ut_collectionmanager.cpp to report the pass/fail + */ +void Cut_collectionmanager::RequestComplete(TInt aError) + { + iWait->AsyncStop(); + if( aError == KErrNone ) + { + iLog->Log(_L("Test case passed")); + User::InfoPrint(_L("Test case passed")); + } + else if(aError == KErrCancel) + { + iLog->Log(_L("cancel Test case passed")); + User::InfoPrint(_L("cancel Test case passed")); + } + else + { + iLog->Log(_L("Test case Failed")); + User::InfoPrint(_L("test case failed")); + } + } +// ----------------------------------------------------------------------------- +// Cut_collectionmanager::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt Cut_collectionmanager::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + + +PRJ_EXPORTS +../inc/glxgallery.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxgallery.hrh) +../inc/glxcollectionpluginpriority.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionpluginpriority.hrh) +../inc/glxcollectionplugintype.hrh APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectionplugintype.hrh) +../inc/glxcollectiongeneraldefs.h APP_LAYER_PLATFORM_EXPORT_PATH(glxcollectiongeneraldefs.h) +../inc/glxthumbnailinfo.h APP_LAYER_PLATFORM_EXPORT_PATH(glxthumbnailinfo.h) +../inc/glxthumbnailattributeinfo.h APP_LAYER_PLATFORM_EXPORT_PATH(glxthumbnailattributeinfo.h) +../inc/glxthumbnailattributeinfo.inl APP_LAYER_PLATFORM_EXPORT_PATH(glxthumbnailattributeinfo.inl) +../inc/glxmediageneraldefs.h APP_LAYER_PLATFORM_EXPORT_PATH(glxmediageneraldefs.h) + +PRJ_MMPFILES + + + +PRJ_TESTMMPFILES + + diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxcollectiongeneraldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxcollectiongeneraldefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2008-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: Definitions for media attributes +* +*/ + + + + +#ifndef __T_GLXCOLLECTIONGENERALDEFS_H__ +#define __T_GLXCOLLECTIONGENERALDEFS_H__ + +#include +#include + +/** +* Content ID identifying progress messages +*/ +const TInt KGlxMediaIdCollectionPluginSpecific = 0x2000A771; + +/** + * Plugin Subtitle + */ +const TMPXAttributeData KGlxMediaCollectionPluginSpecificSubTitle ={KGlxMediaIdCollectionPluginSpecific, 0x01}; + +/** + * Plugin Popup title + */ +const TMPXAttributeData KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle ={KGlxMediaIdCollectionPluginSpecific, 0x02}; + +/** + * Plugin item title + */ +const TMPXAttributeData KGlxMediaCollectionPluginSpecificNewMediaItemTitle ={KGlxMediaIdCollectionPluginSpecific, 0x04}; + +/** + * Plugin default media title + */ +const TMPXAttributeData KGlxMediaCollectionPluginSpecificDefaultMediaTitle ={KGlxMediaIdCollectionPluginSpecific, 0x08}; + + +/** + * DEPRECATED, please use consts above + * Attributes supported for KGlxMediaIdCollectionPluginSpecific + */ +enum + { + /** + * Plugin Subtitle + */ + EGlxMediaCollectionPluginSpecificSubTitle = 0x01, + + /** + * Plugin Popup title + */ + EGlxMediaCollectionPluginSpecificSelectMediaPopupTitle = 0x02, + + /** + * Plugin item title + */ + EGlxMediaCollectionPluginSpecificNewMediaItemTitle = 0x04, + + /** + * Plugin default media title + */ + EGlxMediaCollectionPluginSpecificDefaultMediaTitle = 0x08 + }; + +#endif // __T_GLXCOLLECTIONGENERALDEFS_H__ diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxcollectionpluginpriority.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxcollectionpluginpriority.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Gallery Collection Priority +* +*/ + + + + +#ifndef __GLXCOLLECTIONPLUGINPRIORITY_HRH +#define __GLXCOLLECTIONPLUGINPRIORITY_HRH + +enum TGlxCollectionPluginPriority + { + // Bug Fix @ ESLM-7VWF28 :: Priority change inorder to display the " ALL " collection folder as the first collection folder in the Photos Matrix Menu + EGlxCollectionPluginAll = 1500, + EGlxCollectionPluginMonths = 1300, + EGlxCollectionPluginAlbums = 1200, + EGlxCollectionPluginTags = 1100, + EGlxCollectionPluginImageViewer = 990, + EGlxCollectionPluginShareOnline = 900 + }; + +#endif // __GLXCOLLECTIONPLUGINPRIORITY_HRH diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxcollectionplugintype.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxcollectionplugintype.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Gallery Collection Plugin UID +* +*/ + + + + +#ifndef __GLXCOLLECTIONPLUGINTYPE_HRH +#define __GLXCOLLECTIONPLUGINTYPE_HRH + +enum TGlxCollectionPluginType + { + EGlxCollectionPluginUnknown=0, // unknown type + EGlxCollectionPluginShowInMainListView=0x200071A5 + }; + +#endif // __GLXCOLLECTIONPLUGINTYPE_HRH diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxgallery.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxgallery.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2008-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: Photos ids +* +*/ + + + + +#ifndef __GLXGALLERY_HRH__ +#define __GLXGALLERY_HRH__ + +/// Gallery application UID +#define KGlxGalleryApplicationUid 0x200009EE + +/** + * Activation commands + * Supply either via TApaTask::SendMessage if Gallery is running, or + * via CApaCommandLine::SetTailEndL, if Gallery not running + */ + +/// Show album list view +#define KGlxActivationCmdShowAlbumList 0x200071AB // message id for album + +/// Show Camera album full screen, focus last modified item +#define KGlxActivationCmdShowLastModified 0x200071A9 // message id for last modified + +/// Run slide show +#define KGlxActivationCmdRunSlideshow 0x200071AA // message id for slideshow + +// show last item (latest captured) in Camera album tile view +#define KGlxActivationCameraAlbum 0x2000A7B8 // message id for cameraalbum @CR 403-2372, 403-2371 Active Space + +// show Gallery and opens Main view +#define KGlxActivationPhotosMenu 0x2000A7B9 // message id for photos menu @CR 403-2372, 403-2371 Active Space +/// Slideshow-specific additional parameters +#define KGlxSlideShowForward 1 +#define KGlxSlideShowBackward 2 + +//Open Captured Grid View from Matrix Menu +#define KGlxActivationCameraView 0x2000a767 // message id for photos Captured View from Matrix Menu + +//Open Months List View from Matrix Menu +#define KGlxActivationMonthsView 0x2000a769 // message id for photos Months View from Matrix Menu + +//Open Albums List View from Matrix Menu +#define KGlxActivationAlbumsView 0x20007197 // message id for photos Albums View from Matrix Menu + +//Open Tags browser View from Matrix Menu +#define KGlxActivationTagsView 0x200071AE // message id for photos Tags View from Matrix Menu + +//Open Downloads Grid View from Matrix Menu +#define KGlxActivationDownloadView 0x2000a76b // message id for photos Download View from Matrix Menu + +//Open All Grid View from Matrix Menu +#define KGlxActivationAllView 0x2000A7C1 // message id for photos All View from Matrix Menu + +#endif // __GLXGALLERY_HRH__ + diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxmediageneraldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxmediageneraldefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008-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: Definitions for media attributes +* +*/ + + + + +#ifndef __T_GLXMEDIAGENERALDEFS_H__ +#define __T_GLXMEDIAGENERALDEFS_H__ + +#include +#include + +/** +* Content ID identifying progress messages +*/ +const TInt KGlxMediaIdGeneral = 0x200071A8; + +/** + * Boolean value of whether item is a system item. + * System albums true (Favourites, Camera album), otherwise false + * (For collection plugins true, but will probably not be asked) + * TBool + */ +const TMPXAttributeData KGlxMediaGeneralSystemItem ={KGlxMediaIdGeneral, 0x01}; + +/** + * Original dimensions of image or video clip + * TSize + */ +const TMPXAttributeData KGlxMediaGeneralDimensions ={KGlxMediaIdGeneral, 0x02}; + +/** + * Frame count (animated GIF) + * TInt + */ +const TMPXAttributeData KGlxMediaGeneralFramecount ={KGlxMediaIdGeneral, 0x04}; + +/** + * Location + * TCoordinate (defined in lbsposition.h) + */ +const TMPXAttributeData KGlxMediaGeneralLocation ={KGlxMediaIdGeneral, 0x08}; + +/** + * Slideshowable Contents (count or -1 for non-containers) + * TInt + */ +const TMPXAttributeData KGlxMediaGeneralSlideshowableContent ={KGlxMediaIdGeneral, 0x20}; + +/** + * Slideshowable Contents (count or -1 for non-containers) + * TInt + */ +const TMPXAttributeData KGlxMediaGeneralLastModifiedDate ={KGlxMediaIdGeneral, 0x40}; + +//MDS 2.5 Migration. Remove the Comments +/** + * Slideshowable Contents (count or -1 for non-containers) + * TInt + */ +const TMPXAttributeData KGlxMediaGeneralDRMRightsValid ={KGlxMediaIdGeneral, 0x80}; + +/** +* DEPRECATED, please use consts above +* Attributes supported for KGlxMediaIdGeneral +*/ +enum + { + /** + * Boolean value of whether item is a system item. + * System albums true (Favourites, Camera album), otherwise false + * (For collection plugins true, but will probably not be asked) + * TBool + */ + EGlxMediaGeneralSystemItem = 0x01, + + /** + * Original dimensions of image or video clip + * TSize + */ + EGlxMediaGeneralDimensions = 0x02, + + /** + * Frame count (animated GIF) + * TInt + */ + EGlxMediaGeneralFramecount = 0x04, + + /** + * Location + * TCoordinate (defined in lbsposition.h) + */ + EGlxMediaGeneralLocation = 0x08, + }; + +//MDS 2.5 Migration. Remove the Comments +enum TGlxMediaGeneralRightsValidity + { + EGlxDrmRightsValidityUnknown, + EGlxDrmRightsValid, + EGlxDrmRightsInvalid + }; +#endif // __T_GLXMEDIAGENERALDEFS_H__ diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxthumbnailattributeinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxthumbnailattributeinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: Thumbnail Info +* +*/ + + + + +#ifndef T_GLXTHUMBNAILATTRIBUTEINFO_H +#define T_GLXTHUMBNAILATTRIBUTEINFO_H + +#include + +class CFbsBitmap; + +/** + * Thumbnail attribute content ID + */ +const TInt KGlxMediaIdThumbnail = 0x2000719E; + +const TInt KGlxAttribSpecThumbnailSize = 0x01; +const TInt KGlxAttribSpecThumbnailCroppingRect = 0x02; +const TInt KGlxAttribSpecThumbnailQualityOverSpeed = 0x04; +const TInt KGlxAttribSpecThumbnailFiltering = 0x08; +const TInt KGlxAttribSpecThumbnailBitmapHandle = 0x10; +const TInt KGlxAttribSpecThumbnailQuicklyAvailable = 0x20; + +/** + * Get the attribute ID for a full thumbnail attribute. + */ +inline TUint GlxFullThumbnailAttributeId(TBool aHighQuality, + TInt aWidth, TInt aHeight); + +/** + * Get the attribute ID for a zoomed thumbnail attribute. + */ +inline TUint GlxZoomedThumbnailAttributeId(TInt aZoomLevel, + TInt aXIndex, TInt aYIndex); + +/** + * Is an attribute ID for a full thumbnail attribute? + */ +inline TBool GlxIsFullThumbnailAttribute(TUint aAttributeId); + +/** + * Get the zoom level from a zoomed thumbnail attribute. + */ +inline TInt GlxZoomedThumbnailZoomLevel(TUint aAttributeId); + +/** + * Structure used for a thumbnail attribute. + */ +class CGlxThumbnailAttribute : public CBase + { +public: + /** + * C++ default constructor. + */ + inline CGlxThumbnailAttribute(); + /** + * Destructor. + */ + inline ~CGlxThumbnailAttribute(); + + inline void ExternalizeL(RWriteStream& aStream) const; + inline void InternalizeL(RReadStream& aStream); + +public: + /** Pointer to bitmap (not filled in by server side!) */ + CFbsBitmap* iBitmap; + /** Cropping rect within original image dimensions */ + TRect iCroppingRect; + /** Size of thumbnail bitmap in pixels */ + TSize iDimensions; + /** Quality of provided thumbnails: 0 = low quality. 255 = high quality. + No values in between supported */ + TInt iThumbnailQuality; + }; + +#include + +#endif // T_GLXTHUMBNAILATTRIBUTEINFO_H diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxthumbnailattributeinfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxthumbnailattributeinfo.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008-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: Thumbnail Info +* +*/ + + + + +#include + +// --------------------------------------------------------------------------- +// GlxFullThumbnailAttributeId +// --------------------------------------------------------------------------- +// +inline TUint GlxFullThumbnailAttributeId(TBool aHighQuality, + TInt aWidth, TInt aHeight) + { + return ((aHighQuality ? 0xA0000000u : 0x80000000u) + | ((aWidth & 0x7FFFu) << 15) | (aHeight & 0x7FFFu)); + } + +// --------------------------------------------------------------------------- +// GlxZoomedThumbnailAttributeId +// --------------------------------------------------------------------------- +// +inline TUint GlxZoomedThumbnailAttributeId(TInt aZoomLevel, + TInt aXIndex, TInt aYIndex) + { + return (((aZoomLevel & 0x7u) << 28) + | ((aXIndex & 0xFFFu) << 12) | (aYIndex & 0xFFFu)); + } + +// --------------------------------------------------------------------------- +// GlxIsFullThumbnailAttribute +// --------------------------------------------------------------------------- +// +inline TBool GlxIsFullThumbnailAttribute(TUint aAttributeId) + { + return (aAttributeId & 0x80000000u); + } + +// --------------------------------------------------------------------------- +// GlxZoomedThumbnailZoomLevel +// --------------------------------------------------------------------------- +// +inline TInt GlxZoomedThumbnailZoomLevel(TUint aAttributeId) + { + return (aAttributeId >> 28) & 0x7u; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code that might leave. +// --------------------------------------------------------------------------- +// +inline CGlxThumbnailAttribute::CGlxThumbnailAttribute() + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +inline CGlxThumbnailAttribute::~CGlxThumbnailAttribute() + { + delete iBitmap; + } + +// --------------------------------------------------------------------------- +// ExternalizeL +// --------------------------------------------------------------------------- +// +inline void CGlxThumbnailAttribute::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L(iThumbnailQuality); + aStream.WriteInt32L(iCroppingRect.iTl.iX); + aStream.WriteInt32L(iCroppingRect.iTl.iY); + aStream.WriteInt32L(iCroppingRect.iBr.iX); + aStream.WriteInt32L(iCroppingRect.iBr.iY); + aStream.WriteInt32L(iDimensions.iWidth); + aStream.WriteInt32L(iDimensions.iHeight); + } + +// --------------------------------------------------------------------------- +// InternalizeL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailAttribute::InternalizeL(RReadStream& aStream) + { + iThumbnailQuality=aStream.ReadInt32L(); + iCroppingRect.iTl.iX=aStream.ReadInt32L(); + iCroppingRect.iTl.iY=aStream.ReadInt32L(); + iCroppingRect.iBr.iX=aStream.ReadInt32L(); + iCroppingRect.iBr.iY=aStream.ReadInt32L(); + iDimensions.iWidth=aStream.ReadInt32L(); + iDimensions.iHeight=aStream.ReadInt32L(); + } diff -r 000000000000 -r 4e91876724a2 photos_plat/gallery_utilities_api/inc/glxthumbnailinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/gallery_utilities_api/inc/glxthumbnailinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008-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: Thumbnail Info +* +*/ + + + + +#ifndef T_GLXTHUMBNAILINFO_H +#define T_GLXTHUMBNAILINFO_H + +#include + +// MPX attribute content IDs +const TInt KGlxMediaIdBitmapHandle = 0x02387563; // Temporary hack to pass bitmap handle to CPI + +// DRM thumbnail size +const TInt KGlxThumbnailDrmWidth = 111; +const TInt KGlxThumbnailDrmHeight = 83; + +/** + * TGlxThumbnailQuality + * + * Quality of a thumbnail + */ +enum TGlxThumbnailQuality + { + EGlxThumbnailQualityLow = 0, // The thumbnail quality is low (probably generated with EPrioritizeSpeed) + EGlxThumbnailQualityHigh = 255 // The thumbnail quality is high (possibly generated with EPrioritizeQuality) + }; + +/** + * Type of filter to apply to the generated thumbnail. + */ +enum TGlxThumbnailFilter + { + EGlxThumbnailFilterNone, + EGlxThumbnailFilterBlur + }; + +#endif // T_GLXTHUMBNAILINFO_H diff -r 000000000000 -r 4e91876724a2 photos_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + +#include "../collection_plugins_api/group/bld.inf" +#include "../controllers_collection_api/group/bld.inf" +#include "../gallery_utilities_api/group/bld.inf" +#include "../slideshow_ui_constants_api/group/bld.inf" +#include "../views_metadatadialog_api/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photos_plat/slideshow_ui_constants_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/slideshow_ui_constants_api/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + + +PRJ_EXPORTS +../inc/shwslideshowsettingsplugin_UID.hrh APP_LAYER_PLATFORM_EXPORT_PATH(shwslideshowsettingsplugin_UID.hrh) +../inc/shwslideshowviewplugin.hrh APP_LAYER_PLATFORM_EXPORT_PATH(shwslideshowviewplugin.hrh) + +PRJ_MMPFILES + + + +PRJ_TESTMMPFILES + + diff -r 000000000000 -r 4e91876724a2 photos_plat/slideshow_ui_constants_api/inc/shwslideshowsettingsplugin_UID.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/slideshow_ui_constants_api/inc/shwslideshowsettingsplugin_UID.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers for project photos +* +*/ + + + + +#ifndef SLIDESHWSETTINGSPLUGIN_UID_HRH +#define SLIDESHWSETTINGSPLUGIN_UID_HRH + +// CONSTANTS +// new +#define KShwSettingsDlgImplementationUid 0x2000A778 +#define KShwSettingsDlgDllUid 0x2000A779 + + + +#endif // SLIDESHWSETTINGSPLUGIN_UID_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/slideshow_ui_constants_api/inc/shwslideshowviewplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/slideshow_ui_constants_api/inc/shwslideshowviewplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007-2008 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: Resource headers +* +*/ + + + + + +#ifndef SHWSLIDESHOWVIEWPLUGIN_HRH +#define SHWSLIDESHOWVIEWPLUGIN_HRH + +// CONSTANTS + +#define KShwSlideshowViewImplementationId 0x20007199 + +#endif // SHWSLIDESHOWVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photos_plat/views_metadatadialog_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/views_metadatadialog_api/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + + +PRJ_EXPORTS +../inc/glxmetadataviewutility.h APP_LAYER_PLATFORM_EXPORT_PATH(glxmetadataviewutility.h) + + + +PRJ_MMPFILES + + + +PRJ_TESTMMPFILES + + diff -r 000000000000 -r 4e91876724a2 photos_plat/views_metadatadialog_api/inc/glxmetadataviewutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photos_plat/views_metadatadialog_api/inc/glxmetadataviewutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2008-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: Metadata dialog implementation +* +*/ + + + + + +#ifndef GLXMETADATAVIEWUTILITY_H_ +#define GLXMETADATAVIEWUTILITY_H_ + +// INCLUDES +#include + +/** + * Metadata view utility + * + * Utility for creating/launching metadata view from gallery and other application + * + * @lib glxunifiedmetadataview.lib + */ + + class GlxMetadataViewUtility + { + public: + + /** + * Activate Metadata view for item. + * + * @param aURI filename or URI of item + */ + IMPORT_C static void ActivateViewL( const TDesC& aURI ); + }; + +#endif /*C_GLXMETADATAVIEWUTILITY_H_*/ + +//End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/cleanup.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/cleanup.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,23 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Cleans all the below mentioned file types explicitly +rem + +del /s *.mcp +del /s *.xml +del /s *UID_.cpp +del /s *.cwlink +del /s *.resources +del /s *.tdt +del /s *.o diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/bwins/glxdatasourcemanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/bwins/glxdatasourcemanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +EXPORTS + ??0CGlxCollectionPluginBase@@QAE@XZ @ 1 NONAME ; CGlxCollectionPluginBase::CGlxCollectionPluginBase(void) + ??0CGlxDataSource@@QAE@XZ @ 2 NONAME ; CGlxDataSource::CGlxDataSource(void) + ??0CGlxDataSourceTask@@QAE@PAVCGlxRequest@@AAVMGlxDataSourceRequestObserver@@PAVCGlxDataSource@@@Z @ 3 NONAME ; CGlxDataSourceTask::CGlxDataSourceTask(class CGlxRequest *, class MGlxDataSourceRequestObserver &, class CGlxDataSource *) + ??1CGlxCollectionPluginBase@@UAE@XZ @ 4 NONAME ; CGlxCollectionPluginBase::~CGlxCollectionPluginBase(void) + ??1CGlxDataSource@@UAE@XZ @ 5 NONAME ; CGlxDataSource::~CGlxDataSource(void) + ??1CGlxDataSourceTask@@UAE@XZ @ 6 NONAME ; CGlxDataSourceTask::~CGlxDataSourceTask(void) + ??1CGlxRequest@@UAE@XZ @ 7 NONAME ; CGlxRequest::~CGlxRequest(void) + ?AddL@CGlxCollectionPluginBase@@EAEXABVCMPXMedia@@@Z @ 8 NONAME ; void CGlxCollectionPluginBase::AddL(class CMPXMedia const &) + ?AttributeId@CGlxThumbnailRequest@@QBEIXZ @ 9 NONAME ; unsigned int CGlxThumbnailRequest::AttributeId(void) const + ?BroadcastMessage@CGlxDataSource@@IAEXAAVCMPXMedia@@@Z @ 10 NONAME ; void CGlxDataSource::BroadcastMessage(class CMPXMedia &) + ?CancelRequest@CGlxCollectionPluginBase@@EAEXXZ @ 11 NONAME ; void CGlxCollectionPluginBase::CancelRequest(void) + ?CancelRequest@CGlxDataSource@@UAEXAAVMGlxDataSourceRequestObserver@@@Z @ 12 NONAME ; void CGlxDataSource::CancelRequest(class MGlxDataSourceRequestObserver &) + ?Close@CGlxDataSource@@UAEXAAVMGlxDataSourceUpdateObserver@@@Z @ 13 NONAME ; void CGlxDataSource::Close(class MGlxDataSourceUpdateObserver &) + ?CollectionPluginUid@CGlxRequest@@QBE?AVTUid@@XZ @ 14 NONAME ; class TUid CGlxRequest::CollectionPluginUid(void) const + ?CommandL@CGlxCollectionPluginBase@@EAEXAAVCMPXMedia@@@Z @ 15 NONAME ; void CGlxCollectionPluginBase::CommandL(class CMPXMedia &) + ?CommandL@CGlxCollectionPluginBase@@EAEXW4TMPXCollectionCommand@@H@Z @ 16 NONAME ; void CGlxCollectionPluginBase::CommandL(enum TMPXCollectionCommand, int) + ?CpiAttributeAdditionalAttributes@CGlxCollectionPluginBase@@MAEXABVTMPXAttribute@@AAV?$RArray@VTMPXAttribute@@@@@Z @ 17 NONAME ; void CGlxCollectionPluginBase::CpiAttributeAdditionalAttributes(class TMPXAttribute const &, class RArray &) + ?CreateResponseL@CGlxDataSourceTask@@QAEXXZ @ 18 NONAME ; void CGlxDataSourceTask::CreateResponseL(void) + ?DataSourceRequestL@CGlxDataSource@@UAEXPAVCGlxRequest@@AAVMGlxDataSourceRequestObserver@@@Z @ 19 NONAME ; void CGlxDataSource::DataSourceRequestL(class CGlxRequest *, class MGlxDataSourceRequestObserver &) + ?DefaultFilter@CGlxCollectionPluginBase@@MAE?AVTGlxFilterProperties@@H@Z @ 20 NONAME ; class TGlxFilterProperties CGlxCollectionPluginBase::DefaultFilter(int) + ?DoCancel@CGlxDataSource@@UAEXXZ @ 21 NONAME ; void CGlxDataSource::DoCancel(void) + ?Filter@CGlxRequest@@QBEPAVCMPXMedia@@XZ @ 22 NONAME ; class CMPXMedia * CGlxRequest::Filter(void) const + ?FindAllL@CGlxCollectionPluginBase@@EAEXABVCMPXMedia@@ABV?$TArray@VTMPXAttribute@@@@@Z @ 23 NONAME ; void CGlxCollectionPluginBase::FindAllL(class CMPXMedia const &, class TArray const &) + ?FindAllSyncL@CGlxCollectionPluginBase@@EAEPAVCMPXMedia@@ABV2@ABV?$TArray@VTMPXAttribute@@@@@Z @ 24 NONAME ; class CMPXMedia * CGlxCollectionPluginBase::FindAllSyncL(class CMPXMedia const &, class TArray const &) + ?GetCapabilities@CGlxCollectionPluginBase@@EAEHXZ @ 25 NONAME ; int CGlxCollectionPluginBase::GetCapabilities(void) + ?HandleCpiAttributeResponseL@CGlxCollectionPluginBase@@MAEXPAVCMPXMedia@@V?$TArray@VTMPXAttribute@@@@V?$TArray@VTGlxMediaId@@@@@Z @ 26 NONAME ; void CGlxCollectionPluginBase::HandleCpiAttributeResponseL(class CMPXMedia *, class TArray, class TArray) + ?HandleMessage@CGlxCollectionPluginBase@@EAEXAAVCMPXMedia@@@Z @ 27 NONAME ; void CGlxCollectionPluginBase::HandleMessage(class CMPXMedia &) + ?HandleRequestComplete@CGlxDataSourceTask@@UAEXH@Z @ 28 NONAME ; void CGlxDataSourceTask::HandleRequestComplete(int) + ?HandleResponse@CGlxCollectionPluginBase@@EAEXPAVCMPXMedia@@PAVCGlxRequest@@ABH@Z @ 29 NONAME ; void CGlxCollectionPluginBase::HandleResponse(class CMPXMedia *, class CGlxRequest *, int const &) + ?HandleTaskComplete@CGlxDataSource@@QAEXPAVCGlxDataSourceTask@@@Z @ 30 NONAME ; void CGlxDataSource::HandleTaskComplete(class CGlxDataSourceTask *) + ?IsUpdateMessageIgnored@CGlxCollectionPluginBase@@MAEHAAVCMPXMedia@@@Z @ 31 NONAME ; int CGlxCollectionPluginBase::IsUpdateMessageIgnored(class CMPXMedia &) + ?ItemId@CGlxThumbnailRequest@@QBEABVTGlxMediaId@@XZ @ 32 NONAME ; class TGlxMediaId const & CGlxThumbnailRequest::ItemId(void) const + ?ListToMediaL@CGlxDataSourceTask@@MAEXABV?$RArray@VTGlxMediaId@@@@@Z @ 33 NONAME ; void CGlxDataSourceTask::ListToMediaL(class RArray const &) + ?LoadLocalizedStringLC@CGlxCollectionPluginBase@@IAEPAVHBufC16@@ABVTDesC16@@H@Z @ 34 NONAME ; class HBufC16 * CGlxCollectionPluginBase::LoadLocalizedStringLC(class TDesC16 const &, int) + ?LoadLocalizedStringLC@CGlxStringCache@@QAEPAVHBufC16@@ABVTDesC16@@H@Z @ 35 NONAME ; class HBufC16 * CGlxStringCache::LoadLocalizedStringLC(class TDesC16 const &, int) + ?MediaL@CGlxCollectionPluginBase@@EAEXABVCMPXCollectionPath@@ABV?$TArray@VTMPXAttribute@@@@ABV?$TArray@W4TCapability@@@@PAVCMPXMedia@@@Z @ 36 NONAME ; void CGlxCollectionPluginBase::MediaL(class CMPXCollectionPath const &, class TArray const &, class TArray const &, class CMPXMedia *) + ?NewL@CGlxGetRequest@@SAPAV1@ABV?$RArray@VTGlxMediaId@@@@ABV?$RArray@VTMPXAttribute@@@@1ABVTUid@@PAVCMPXMedia@@H@Z @ 37 NONAME ; class CGlxGetRequest * CGlxGetRequest::NewL(class RArray const &, class RArray const &, class RArray const &, class TUid const &, class CMPXMedia *, int) + ?NewL@CGlxIdListRequest@@SAPAV1@VTGlxMediaId@@ABVTUid@@PAVCMPXMedia@@AAVCMPXCollectionPath@@@Z @ 38 NONAME ; class CGlxIdListRequest * CGlxIdListRequest::NewL(class TGlxMediaId, class TUid const &, class CMPXMedia *, class CMPXCollectionPath &) + ?NewL@CGlxStringCache@@SAPAV1@XZ @ 39 NONAME ; class CGlxStringCache * CGlxStringCache::NewL(void) + ?NewL@CGlxThumbnailRequest@@SAPAV1@VTGlxThumbnailRequest@@ABVTUid@@HPAVCMPXMedia@@@Z @ 40 NONAME ; class CGlxThumbnailRequest * CGlxThumbnailRequest::NewL(class TGlxThumbnailRequest, class TUid const &, int, class CMPXMedia *) + ?OpenDataSourceL@MGlxDataSource@@SAPAV1@ABVTUid@@AAVMGlxDataSourceUpdateObserver@@@Z @ 41 NONAME ; class MGlxDataSource * MGlxDataSource::OpenDataSourceL(class TUid const &, class MGlxDataSourceUpdateObserver &) + ?OpenL@CGlxCollectionPluginBase@@EAEXABVCMPXCollectionPath@@ABV?$TArray@VTMPXAttribute@@@@PAVCMPXMedia@@@Z @ 42 NONAME ; void CGlxCollectionPluginBase::OpenL(class CMPXCollectionPath const &, class TArray const &, class CMPXMedia *) + ?RemoveL@CGlxCollectionPluginBase@@EAEXABVCMPXCollectionPath@@@Z @ 43 NONAME ; void CGlxCollectionPluginBase::RemoveL(class CMPXCollectionPath const &) + ?RemoveL@CGlxCollectionPluginBase@@EAEXABVCMPXMedia@@@Z @ 44 NONAME ; void CGlxCollectionPluginBase::RemoveL(class CMPXMedia const &) + ?RunError@CGlxDataSource@@UAEHH@Z @ 45 NONAME ; int CGlxDataSource::RunError(int) + ?RunL@CGlxDataSource@@UAEXXZ @ 46 NONAME ; void CGlxDataSource::RunL(void) + ?SetL@CGlxCollectionPluginBase@@EAEXABVCMPXMedia@@@Z @ 47 NONAME ; void CGlxCollectionPluginBase::SetL(class CMPXMedia const &) + ?SetThumbnailInfo@CGlxThumbnailRequest@@QAEXPAVCGlxtnFileInfo@@@Z @ 48 NONAME ; void CGlxThumbnailRequest::SetThumbnailInfo(class CGlxtnFileInfo *) + ?ThumbnailInfo@CGlxThumbnailRequest@@QBEPAVCGlxtnFileInfo@@XZ @ 49 NONAME ; class CGlxtnFileInfo * CGlxThumbnailRequest::ThumbnailInfo(void) const + ?ThumbnailRequest@CGlxThumbnailRequest@@QBEXAAVTGlxThumbnailRequest@@@Z @ 50 NONAME ; void CGlxThumbnailRequest::ThumbnailRequest(class TGlxThumbnailRequest &) const + ?TryStartTask@CGlxDataSource@@IAEXH@Z @ 51 NONAME ; void CGlxDataSource::TryStartTask(int) + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/eabi/glxdatasourcemanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/eabi/glxdatasourcemanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +EXPORTS + _ZN11CGlxRequestD0Ev @ 1 NONAME + _ZN11CGlxRequestD1Ev @ 2 NONAME + _ZN11CGlxRequestD2Ev @ 3 NONAME + _ZN14CGlxDataSource12TryStartTaskEi @ 4 NONAME + _ZN14CGlxDataSource13CancelRequestER29MGlxDataSourceRequestObserver @ 5 NONAME + _ZN14CGlxDataSource16BroadcastMessageER9CMPXMedia @ 6 NONAME + _ZN14CGlxDataSource18DataSourceRequestLEP11CGlxRequestR29MGlxDataSourceRequestObserver @ 7 NONAME + _ZN14CGlxDataSource18HandleTaskCompleteEP18CGlxDataSourceTask @ 8 NONAME + _ZN14CGlxDataSource4RunLEv @ 9 NONAME + _ZN14CGlxDataSource5CloseER28MGlxDataSourceUpdateObserver @ 10 NONAME + _ZN14CGlxDataSource8DoCancelEv @ 11 NONAME + _ZN14CGlxDataSource8RunErrorEi @ 12 NONAME + _ZN14CGlxDataSourceC2Ev @ 13 NONAME + _ZN14CGlxDataSourceD0Ev @ 14 NONAME + _ZN14CGlxDataSourceD1Ev @ 15 NONAME + _ZN14CGlxDataSourceD2Ev @ 16 NONAME + _ZN14CGlxGetRequest4NewLERK6RArrayI11TGlxMediaIdERKS0_I13TMPXAttributeES8_RK4TUidP9CMPXMediai @ 17 NONAME + _ZN14MGlxDataSource15OpenDataSourceLERK4TUidR28MGlxDataSourceUpdateObserver @ 18 NONAME + _ZN15CGlxStringCache21LoadLocalizedStringLCERK7TDesC16i @ 19 NONAME + _ZN15CGlxStringCache4NewLEv @ 20 NONAME + _ZN17CGlxIdListRequest4NewLE11TGlxMediaIdRK4TUidP9CMPXMediaR18CMPXCollectionPath @ 21 NONAME + _ZN18CGlxDataSourceTask12ListToMediaLERK6RArrayI11TGlxMediaIdE @ 22 NONAME + _ZN18CGlxDataSourceTask15CreateResponseLEv @ 23 NONAME + _ZN18CGlxDataSourceTask21HandleRequestCompleteEi @ 24 NONAME + _ZN18CGlxDataSourceTaskC2EP11CGlxRequestR29MGlxDataSourceRequestObserverP14CGlxDataSource @ 25 NONAME + _ZN18CGlxDataSourceTaskD0Ev @ 26 NONAME + _ZN18CGlxDataSourceTaskD1Ev @ 27 NONAME + _ZN18CGlxDataSourceTaskD2Ev @ 28 NONAME + _ZN20CGlxThumbnailRequest16SetThumbnailInfoEP14CGlxtnFileInfo @ 29 NONAME + _ZN20CGlxThumbnailRequest4NewLE20TGlxThumbnailRequestRK4TUidiP9CMPXMedia @ 30 NONAME + _ZN24CGlxCollectionPluginBase12FindAllSyncLERK9CMPXMediaRK6TArrayI13TMPXAttributeE @ 31 NONAME + _ZN24CGlxCollectionPluginBase13CancelRequestEv @ 32 NONAME + _ZN24CGlxCollectionPluginBase13DefaultFilterEi @ 33 NONAME + _ZN24CGlxCollectionPluginBase13HandleMessageER9CMPXMedia @ 34 NONAME + _ZN24CGlxCollectionPluginBase14HandleResponseEP9CMPXMediaP11CGlxRequestRKi @ 35 NONAME + _ZN24CGlxCollectionPluginBase15GetCapabilitiesEv @ 36 NONAME + _ZN24CGlxCollectionPluginBase21LoadLocalizedStringLCERK7TDesC16i @ 37 NONAME + _ZN24CGlxCollectionPluginBase22IsUpdateMessageIgnoredER9CMPXMedia @ 38 NONAME + _ZN24CGlxCollectionPluginBase27HandleCpiAttributeResponseLEP9CMPXMedia6TArrayI13TMPXAttributeES2_I11TGlxMediaIdE @ 39 NONAME + _ZN24CGlxCollectionPluginBase32CpiAttributeAdditionalAttributesERK13TMPXAttributeR6RArrayIS0_E @ 40 NONAME + _ZN24CGlxCollectionPluginBase4AddLERK9CMPXMedia @ 41 NONAME + _ZN24CGlxCollectionPluginBase4SetLERK9CMPXMedia @ 42 NONAME + _ZN24CGlxCollectionPluginBase5OpenLERK18CMPXCollectionPathRK6TArrayI13TMPXAttributeEP9CMPXMedia @ 43 NONAME + _ZN24CGlxCollectionPluginBase6MediaLERK18CMPXCollectionPathRK6TArrayI13TMPXAttributeERKS3_I11TCapabilityEP9CMPXMedia @ 44 NONAME + _ZN24CGlxCollectionPluginBase7RemoveLERK18CMPXCollectionPath @ 45 NONAME + _ZN24CGlxCollectionPluginBase7RemoveLERK9CMPXMedia @ 46 NONAME + _ZN24CGlxCollectionPluginBase8CommandLE21TMPXCollectionCommandi @ 47 NONAME + _ZN24CGlxCollectionPluginBase8CommandLER9CMPXMedia @ 48 NONAME + _ZN24CGlxCollectionPluginBase8FindAllLERK9CMPXMediaRK6TArrayI13TMPXAttributeE @ 49 NONAME + _ZN24CGlxCollectionPluginBaseC1Ev @ 50 NONAME + _ZN24CGlxCollectionPluginBaseC2Ev @ 51 NONAME + _ZN24CGlxCollectionPluginBaseD0Ev @ 52 NONAME + _ZN24CGlxCollectionPluginBaseD1Ev @ 53 NONAME + _ZN24CGlxCollectionPluginBaseD2Ev @ 54 NONAME + _ZNK11CGlxRequest19CollectionPluginUidEv @ 55 NONAME + _ZNK11CGlxRequest6FilterEv @ 56 NONAME + _ZNK20CGlxThumbnailRequest11AttributeIdEv @ 57 NONAME + _ZNK20CGlxThumbnailRequest13ThumbnailInfoEv @ 58 NONAME + _ZNK20CGlxThumbnailRequest16ThumbnailRequestER20TGlxThumbnailRequest @ 59 NONAME + _ZNK20CGlxThumbnailRequest6ItemIdEv @ 60 NONAME + _ZTI11CGlxRequest @ 61 NONAME ; ## + _ZTI14CGlxDataSource @ 62 NONAME ; ## + _ZTI14CGlxGetRequest @ 63 NONAME ; ## + _ZTI17CGlxIdListRequest @ 64 NONAME ; ## + _ZTI18CGlxCommandRequest @ 65 NONAME ; ## + _ZTI18CGlxDataSourceTask @ 66 NONAME ; ## + _ZTI20CGlxThumbnailRequest @ 67 NONAME ; ## + _ZTI24CGlxCollectionPluginBase @ 68 NONAME ; ## + _ZTV11CGlxRequest @ 69 NONAME ; ## + _ZTV14CGlxDataSource @ 70 NONAME ; ## + _ZTV14CGlxGetRequest @ 71 NONAME ; ## + _ZTV17CGlxIdListRequest @ 72 NONAME ; ## + _ZTV18CGlxCommandRequest @ 73 NONAME ; ## + _ZTV18CGlxDataSourceTask @ 74 NONAME ; ## + _ZTV20CGlxThumbnailRequest @ 75 NONAME ; ## + _ZTV24CGlxCollectionPluginBase @ 76 NONAME ; ## + _ZThn24_N24CGlxCollectionPluginBase14HandleResponseEP9CMPXMediaP11CGlxRequestRKi @ 77 NONAME ; ## + _ZThn28_N14CGlxDataSource13CancelRequestER29MGlxDataSourceRequestObserver @ 78 NONAME ; ## + _ZThn28_N14CGlxDataSource18DataSourceRequestLEP11CGlxRequestR29MGlxDataSourceRequestObserver @ 79 NONAME ; ## + _ZThn28_N14CGlxDataSource5CloseER28MGlxDataSourceUpdateObserver @ 80 NONAME ; ## + _ZThn28_N24CGlxCollectionPluginBase13HandleMessageER9CMPXMedia @ 81 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/group/glxdatasourcemanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/group/glxdatasourcemanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2008-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: Project definition file for project glxdatasourcemanager. +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxdatasourcemanager.dll +TARGETTYPE dll +UID 0x1000008d 0x20000A13 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxcollectionpluginbase.cpp +SOURCE glxcommandrequest.cpp +SOURCE glxdatasource.cpp +SOURCE glxdatasourcetask.cpp +SOURCE glxgetrequest.cpp +SOURCE glxidlistrequest.cpp +SOURCE glxrequest.cpp +SOURCE glxthumbnailrequest.cpp +SOURCE glxstringcache.cpp + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../thumbnailcreator/inc + + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY mpxcommon.lib +LIBRARY glxcommon.lib +LIBRARY flogger.lib + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxcollectionpluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxcollectionpluginbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2008-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: This is the base class for Gallery Collection Plugins +* +*/ + + + + + +#ifndef C_GLXCOLLECTIONPLUGINBASE_H +#define C_GLXCOLLECTIONPLUGINBASE_H + +// INCLUDES +#include +#include +#include +#include +#include + +#include "glxrequest.h" +#include "mglxdatasourcerequestobserver.h" +#include "mglxdatasourceupdateobserver.h" + +// FORWARD DECLARATIONS +class MGlxDataSource; +class CGlxStringCache; + +// CONSTANTS +const TInt KGlxCollectionRootLevel = 1; +const TUid KGlxDefaultDataSourceUid = {0x20000A10}; // KGlxDataSourceMdeImplementationUid + +// CLASS DECLARATION + +/** + * CGlxCollectionPluginBase class + * + * Plug-in base. + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxCollectionPluginBase : public CMPXCollectionPlugin, + public MGlxDataSourceRequestObserver, + public MGlxDataSourceUpdateObserver + { +public: // Constructors and destructor + + /** + * Constructor + */ + IMPORT_C CGlxCollectionPluginBase(); + + /** + * Destructor + */ + IMPORT_C virtual ~CGlxCollectionPluginBase(); + +private: // Functions from base classes +// from CMPXCollectionPlugin + /** + * DEPRECATED, Executes a command on the selected collection + * + * @param aCmd a command + * @param aArg optional argument + */ + IMPORT_C void CommandL(TMPXCollectionCommand aCmd, TInt aArg = 0); + + /** + * Executes a command + * + * @param aCmd a command + */ + IMPORT_C void CommandL(CMPXCommand& aCmd); + /** + * Navigates to the given path + * + * @param aPath a path + * @param aAttrs, attributes requested + * @param aFilter, filter to apply or NULL if none + */ + IMPORT_C void OpenL(const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXFilter* aFilter); + /** + * Media properties of the current file (async) + * Note: if selection is set in aPath, HandleMedia will return an array of + * media properties of current selected items. + * if no selection is set in aPath, HandleMedia will return media + * properities of current item. + * + * @param aPath path for the media file + * @param aAttr attributes requested + * @param aCaps platsec capabilities of client requesting media; plug-in should also + * verify its process capabilities + * @aParam aSpecs, specifications for attributes + */ + IMPORT_C void MediaL(const CMPXCollectionPath& aPath, + const TArray& aAttrs, + const TArray& aCaps, + CMPXAttributeSpecs* aSpecs); + /** + * Cancel outstanding request + */ + IMPORT_C void CancelRequest(); + /** + * Adds an item or items to the collection + * + * @param aNewProperties, Properties of the item + */ + IMPORT_C void AddL(const CMPXMedia& aNewMedia); + + /** + * Remove a collection path + * Note that the selection indicies are hidden within the path + * @param aPath, path to remove + * + */ + IMPORT_C void RemoveL(const CMPXCollectionPath& aPath ); + + /** + * Remove an item or items from the collection + * + * @param aProperties, Properties of the item. It may cantain URI only + * or meta data, all of items matched properties + * will be removed. + */ + IMPORT_C void RemoveL(const CMPXMedia& aMedia); + /** + * Sets/updates the media for the item + * specified in the path + * + * @param aMedia, new value + */ + IMPORT_C void SetL(const CMPXMedia& aMedia); + + /** + * Find a list of items matched (async) + * + * @param aCriteria, properties to be searched + * @param aAttrs, attributes to return + */ + IMPORT_C void FindAllL(const CMPXSearchCriteria& aCriteria, + const TArray& aAttrs); + + /** + * Find a list of items matched (sync) + * + * @param aCriteria, properties to be searched + * @param aAttrs, attributes to return + * @return results of the search + */ + IMPORT_C CMPXMedia* FindAllSyncL(const CMPXSearchCriteria& aCriteria, + const TArray& aAttrs); + + /** + * Get the list of supported capabilities + * @return TCollectionCapability, bitmask of supported capabilities + */ + IMPORT_C TCollectionCapability GetCapabilities(); + +private: +// from MGlxDataSourceRequestObserver + /** + * Asynchronous call to retrieve + * + * @param aListId list for this query relates to + * @return error code + */ + IMPORT_C virtual void HandleResponse(CMPXMedia* aResponse, CGlxRequest* aRequest, const TInt& aError); + +private: +// from MGlxDataSourceUpdateObserver + /** + * Notification that new items have been found in the data source (file + * system, etc.) + * + * @param aItems ids of the items that were been found. + */ + IMPORT_C virtual void HandleMessage(CMPXMessage& aMessage); + +protected: + CGlxRequest* GetRequestFactoryL(const CMPXCollectionPath& aPath, const TArray& aAttrs); + + /** + * Checks to see if any additional attributes are required to construct required + * CPI specific attribute + * + * @param aCpiAttribute CPI specific attribute to be constructed later + * @param aAttributeArray modifiable list of attributes to be retrieved from data source + */ + IMPORT_C virtual void CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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 + * @param aMediaIds list of CPI specific media Ids + */ + IMPORT_C virtual void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray aMediaIds); + + IMPORT_C virtual TBool IsUpdateMessageIgnored(CMPXMessage& aMessage); + + /** + * Loads a string from a resurce file + * + * @param aResourceFile - name of the resource file (does not contain the path). + * @param aResourceId - Id of the string to be loaded + * @return HBufC* containing the required string. + */ + IMPORT_C HBufC* LoadLocalizedStringLC(const TDesC& aResourceFile, const TInt aResourceId); + + IMPORT_C virtual TGlxFilterProperties DefaultFilter(TInt aLevel); + +protected: + /** + * Datasouce (owned) + */ + MGlxDataSource* iDataSource; + + /** + * collection plugin path (owned) + */ + CMPXCollectionPath* iPath; + +private: + /** + * String Cache + */ + CGlxStringCache* iStringCache; + }; + +#endif // C_GLXCOLLECTIONPLUGINBASE_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxcommandrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxcommandrequest.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2008-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: Command request +* +*/ + + + + +#ifndef GLXCOMMANDREQUEST_H_ +#define GLXCOMMANDREQUEST_H_ + +// INCLUDES +#include +#include + +#include "glxrequest.h" +#include "mglxdatasourceupdateobserver.h" +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxCommandRequest class + * + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxCommandRequest : public CGlxRequest + { +public: + /** + * Two-phase constructor: + * @param aCommand the MPX command to be requested. + * @param aCollectionPluginUid The UID of the calling collection plugin. + * @param aObserver Oberver to inform of progress notifications + */ + static CGlxCommandRequest* NewL(const CMPXCommand& aCommand, const TUid aCollectionPluginUid, MGlxDataSourceUpdateObserver& aObserver); + + /** + * Destructor + */ + ~CGlxCommandRequest(); + + /** + * Returns a reference to the CMPXCommand object. + * @return a reference to the CMPXCommand object. + */ + inline const CMPXCommand& Command() const; + + /** + * Returns a reference to the MGlxDataSourceUpdateObserver passed in on construction. + * @return a reference to the MGlxDataSourceUpdateObserver passed in on construction. + */ + inline MGlxDataSourceUpdateObserver& DataSourceUpdateObserver(); + +private: + /** + * Constructor. + + * @param aCollectionPluginUid The UID of the calling collection plugin. + * @param aObserver Oberver to inform of progress notifications + */ + CGlxCommandRequest(TUid aCollectionPluginUid, MGlxDataSourceUpdateObserver& aObserver); + + /** + * Second stage constructor. + * @param aCommand the MPX command to be requested. + */ + void ConstructL(const CMPXCommand& aCommand); + +private: + /** + * a CMpxCommand + * (owned) + */ + CMPXCommand* iCommand; + + /** + * Data source update observer. + * Used for progress updates. + */ + MGlxDataSourceUpdateObserver& iDataSourceUpdateObserver; + }; + +#include "glxcommandrequest.inl" + +#endif // GLXCOMMANDREQUEST_H_ + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxcommandrequest.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxcommandrequest.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: Get request +* +*/ + + + + +// ---------------------------------------------------------------------------- +// CGlxCommandRequest::Command +// ---------------------------------------------------------------------------- +// +const CMPXCommand& CGlxCommandRequest::Command() const + { + return *iCommand; + } + +// ---------------------------------------------------------------------------- +// CGlxCommandRequest::DataSourceUpdateObserver +// ---------------------------------------------------------------------------- +// +MGlxDataSourceUpdateObserver& CGlxCommandRequest::DataSourceUpdateObserver() + { + return iDataSourceUpdateObserver; + } \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxdatasource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxdatasource.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2008 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: data source header file +* +*/ + + + + +#ifndef _C_GLXDATASOURCE_H_ +#define _C_GLXDATASOURCE_H_ + +// INCLUDES +#include +#include +#include +#include + +#include +#include "mglxdatasource.h" + +// FORWARD DECLARATIONS +class CGlxRequest; +class CGlxDataSourceTask; +class CGlxDataSource; +// CONSTANTS + +// CLASS DECLARATION + +/** + * CDataSourceArrayOwner + * A singleton that owns a pointer array of datasources + */ +NONSHARABLE_CLASS(CDataSourceArrayOwner) : public CBase + { +public: + /** + * Returns the CDataSourceArrayOwner singleton + * @return the CDataSourceArrayOwner singleton + */ + static CDataSourceArrayOwner* InstanceL(); + + /** + * Closes the singleton + */ + void Close(); + + /** + * Retuns a reference to the array owned by this object + * @return a reference to the array owned by this object + */ + RPointerArray& Array(); + +private: + /** + * Constructor (private so that only + * the singleton store can use it) + */ + static CDataSourceArrayOwner* NewL(); + /** + * Destructor + */ + ~CDataSourceArrayOwner(); + +private: + /** + * Array of datasource + * (owned) + * (array contents not owned) + */ + RPointerArray iDataSources; + }; + +/** + * CGlxDataSource class + * + * Data Source is the Data Source base class. + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxDataSource : public CActive, + public MGlxDataSource + { + +public: + IMPORT_C CGlxDataSource(); + IMPORT_C virtual ~CGlxDataSource(); + +public: // from MGlxDataSource + /** + * Asynchronous call to retrieve + * + * @param aListId list for this query relates to + * @return error code + */ + IMPORT_C void DataSourceRequestL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver); + /** + * Cancel asynchronous request call + * as each requestor can only have one active request the observer is sufficient to cancel the request. + * + */ + IMPORT_C void CancelRequest(MGlxDataSourceRequestObserver& aObserver); + /** + * Decrements the reference count of the data source. Deletes the + * data source if there are no more references. + */ + IMPORT_C void Close(MGlxDataSourceUpdateObserver& aObserver); + + +public: + IMPORT_C void HandleTaskComplete(CGlxDataSourceTask* aRequest); + +public: + inline const TUid& Uid() const + { + return iUid; + }; + inline void SetUid(const TUid& aUid) + { + iUid = aUid; + }; + inline const TInt Count() + { + return iDataSourceObservers.Count(); + }; + inline void SetDtorKey(const TUid& aDtorKey) + { + iDtorKey = aDtorKey; + }; + inline void SetEComSession(REComSession& aEComSession) + { + iEComSession = aEComSession; + }; + + /** + * Set the datasource array owner + * Should be called after object construction + * @param aDataSourceArrayOwner the datasource array owner + */ + inline void SetDataSourceArrayOwner(CDataSourceArrayOwner* aDataSourceArrayOwner) + { + iDataSourceArrayOwner = aDataSourceArrayOwner; + }; + +public: + void AddObserverL(MGlxDataSourceUpdateObserver& aObserver); + +public: // from CActive + IMPORT_C void RunL(); + IMPORT_C void DoCancel(); + IMPORT_C TInt RunError(TInt aError); + +public: + enum TItemType + { + EItemTypeNotAnItem = 0, + EItemTypeImage, + EItemTypeVideo + }; + + enum TContainerType + { + EContainerTypeNotAContainer = 0, + EContainerTypeAlbum, + EContainerTypeTag, + EContainerTypeMonth + }; + +private: + enum TAction + { + EExecuteOnly = 1, + ECleanupAndExecute + }; + +private: + virtual CGlxDataSourceTask* CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver) = 0; + + void CompleteSelf(TAction aAction); + + virtual void TaskStartedL() = 0; + virtual void TaskCompletedL()= 0; + +protected: + IMPORT_C void BroadcastMessage(CMPXMessage& aMessage); + IMPORT_C void TryStartTask(TBool aFirstStart = EFalse); + +protected: + RPointerArray< MGlxDataSourceUpdateObserver > iDataSourceObservers; + RPointerArray< CGlxDataSourceTask > iTasks; + TInt iDataSourceId; // session specific id count from DSM, used to mask the item ids. + TInt iCount; + TUid iUid; + TUid iDtorKey; + REComSession iEComSession; + TBool iDataSourceReady; + + /** + * Singleton, reference counted + * Close() should be called when in order + * when object is no longer required. + */ + CDataSourceArrayOwner* iDataSourceArrayOwner; + }; + + + + +#endif //_C_GLXDATASOURCE_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxdatasourcetask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxdatasourcetask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008 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: Definition of the Data Source Task Class. +* +*/ + + + + +#ifndef _C_GLXDATASOURCETASK_H_ +#define _C_GLXDATASOURCETASK_H_ + +// INCLUDES +#include +#include + +#include "mglxdatasource.h" +// FORWARD DECLARATIONS +class CGlxRequest; +class CMPXMedia; +class CGlxDataSource; +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxDataSourceTask class + * + * Data Source Request is the base class for executing requests. + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxDataSourceTask : public CBase + { +public: + IMPORT_C virtual ~CGlxDataSourceTask(); + IMPORT_C CGlxDataSourceTask(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); + +public: + TBool ObserverMatch(MGlxDataSourceRequestObserver& aObserver); + +public: + virtual void ExecuteRequestL() = 0; + virtual void CancelRequest() = 0; + + /** + * Called when request is completed sucessfully or due to an error. + * This is the default implementation that can be re-defined by + * deriving classes if required. + * @param aError Error that occurred (if any) + */ + IMPORT_C virtual void HandleRequestComplete(TInt aError); + IMPORT_C void CreateResponseL(); + TBool IsDataSourceNeeded() const; +protected: + IMPORT_C virtual void ListToMediaL(const RArray& aList); /// @todo overloaded until don't need name hack + +protected: + CGlxRequest* iRequest; + CMPXMedia* iResponse; + CGlxDataSource* iDataSource; // not owned + MGlxDataSourceRequestObserver* iObserver; + TBool iCancelled; + }; + +#endif //_C_GLXDATASOURCETASK_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxgetrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxgetrequest.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2008-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: Get request +* +*/ + + + + +#ifndef GLXGETREQUEST_H_ +#define GLXGETREQUEST_H_ + +// INCLUDES +#include "glxrequest.h" +#include +#include +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxGetRequest class + * + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxGetRequest : public CGlxRequest + { +public: + virtual ~CGlxGetRequest(); + IMPORT_C static CGlxGetRequest* NewL(const RArray& aMediaIdArray, + const RArray& aAttributeArray, + const RArray& aCpiAttributeArray, + const TUid& aCollectionPluginUid, + CMPXFilter* aFilter=NULL, + const TBool aDoNotNeedDataSource = EFalse); +public: + inline const RArray& MediaIds() const; + inline TArray Attributes() const; + inline TArray CpiAttributes() const; + inline TBool CpiAttributesSet() const; + inline void AppendCpiAttributeL(const TMPXAttribute& aAttribute); + +private: + CGlxGetRequest(const RArray& aMediaIdArray, + const RArray& aAttributeArray, + const RArray& aCpiAttributeArray, + const TUid& aCollectionPluginUid, + const TBool aDoNotNeedDataSource); + +private: + RArray iMediaIdArray; + RArray iAttributeArray; + RArray iCpiAttributeArray; + }; + +#include "glxgetrequest.inl" + +#endif // GLXGETREQUEST_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxgetrequest.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxgetrequest.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Get request +* +*/ + + + + +const RArray& CGlxGetRequest::MediaIds() const + { + return iMediaIdArray; + } + +TArray CGlxGetRequest::Attributes() const + { + return iAttributeArray.Array(); + } + +TArray CGlxGetRequest::CpiAttributes() const + { + return iCpiAttributeArray.Array(); + } + +TBool CGlxGetRequest::CpiAttributesSet() const + { + return (0 != iCpiAttributeArray.Count()); + } + +void CGlxGetRequest::AppendCpiAttributeL(const TMPXAttribute& aAttribute) + { + if (KErrNotFound == iCpiAttributeArray.Find(aAttribute)) + { + iCpiAttributeArray.AppendL(aAttribute); + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxidlistrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxidlistrequest.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2008-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: Id list request +* +*/ + + + + +#ifndef C_CGLXIDLISTREQUEST_H +#define C_CGLXIDLISTREQUEST_H + +// INCLUDES +#include "glxrequest.h" +#include +#include +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxIdListRequest class + * + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxIdListRequest : public CGlxRequest + { +public: + IMPORT_C static CGlxIdListRequest* NewL(TGlxMediaId aContainerId, + const TUid& aCollectionPluginUid, + CMPXFilter* aFilter, CMPXCollectionPath& aPath); + + virtual ~CGlxIdListRequest(); + + inline const TGlxMediaId& ContainerId() const; + + /** + * Return the CollectionPath passed in on construction + * @return Collection path passed in on construction + */ + inline CMPXCollectionPath& CollectionPath(); + +private: + CGlxIdListRequest(const TUid& aCollectionPluginUid, TGlxMediaId aContainerId, CMPXCollectionPath& aPath); + +private: + TGlxMediaId iMediaId; + + /** + * Path to populate + */ + CMPXCollectionPath& iPath; + }; + +#include "glxidlistrequest.inl" + +#endif // C_CGLXIDLISTREQUEST_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxidlistrequest.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxidlistrequest.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: Id list request +* +*/ + + + + +// ---------------------------------------------------------------------------- +// CGlxIdListRequest::CollectionPath +// ---------------------------------------------------------------------------- +// +CMPXCollectionPath& CGlxIdListRequest::CollectionPath() + { + return iPath; + } + +// ---------------------------------------------------------------------------- +// CGlxIdListRequest::ContainerId() +// ---------------------------------------------------------------------------- +// +const TGlxMediaId& CGlxIdListRequest::ContainerId() const + { + return iMediaId; + } \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxmediacollectioninternaldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxmediacollectioninternaldefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2008-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: Definitions for media attributes +* +*/ + + + + +#ifndef __T_GLXMEDIACOLLECTIONINTERNALDEFS_H__ +#define __T_GLXMEDIACOLLECTIONINTERNALDEFS_H__ + +#include +#include +/** +* Content ID identifying progress messages +*/ +const TInt KGlxMediaIdCollectionInternal = 0x2000A7BA; + +/** +* Attributes supported for KGlxMediaIdCollectionInternal +*/ +const TMPXAttributeData KGlxMediaCollectionInternalStartDate = { KGlxMediaIdCollectionInternal, 0x01 }; // TTime +const TMPXAttributeData KGlxMediaCollectionInternalEndDate = { KGlxMediaIdCollectionInternal, 0x02 }; // TTime +const TMPXAttributeData KGlxMediaCollectionInternalUsageCount = { KGlxMediaIdCollectionInternal, 0x04 }; // TInt +const TMPXAttributeData KGlxMediaCollectionInternalSystemItemType = { KGlxMediaIdCollectionInternal, 0x08 }; // TInt + +const TMPXAttributeData KGlxMediaItemTypeImage = { KGlxMediaIdCollectionInternal, 0x16 }; // TInt +const TMPXAttributeData KGlxMediaItemTypeVideo = { KGlxMediaIdCollectionInternal, 0x32 }; // TInt +#endif // __T_GLXMEDIACOLLECTIONINTERNALDEFS_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxrequest.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: Represents a request +* +*/ + + + + +#ifndef C_GLXREQUEST_H +#define C_GLXREQUEST_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxRequest class + * + * Requests encapsulate the requests with filters that can be sent from + * collection plugins to the Data Source Manager. + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxRequest : public CBase + { +public: + IMPORT_C virtual ~CGlxRequest(); + + /** + * Collection plugin UID. + * Gets the UID of the collection plugin that created this request. + * @return the UID of the collection plugin that created this request. + */ + IMPORT_C TUid CollectionPluginUid() const; + IMPORT_C CMPXFilter* Filter() const; + + inline const TBool DoNotNeedDataSource() const + { + return iDoNotNeedDataSource; + } + + + +protected: + CGlxRequest(const TUid& aCollectionPluginUid, const TBool aDoNotNeedDataSource = EFalse); + void ConstructL(const CMPXFilter* aFilter); + +private: + const TUid iCollectionPluginUid; + CMPXFilter* iFilter; +protected: + const TBool iDoNotNeedDataSource; + }; + +#endif // C_GLXREQUEST_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxstringcache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxstringcache.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2008-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: This class caches resource strings +* +*/ + + + + +#ifndef _GLXSTRINGCACHE_H_ +#define _GLXSTRINGCACHE_H_ + +// INCLUDES +#include +#include +#include + +// CLASS DECLARATION + +/** + * CGlxStringCache class + * + * This class caches resource strings. + * It maintains a mapping between the resource id and the string + * @author Rowland Cook + */ +NONSHARABLE_CLASS(CGlxStringCache) : public CBase + { +public: + /** + * Two-phase constructor + */ + static IMPORT_C CGlxStringCache* NewL(); + + /** + * destructor + */ + ~CGlxStringCache(); + + /** + * Loads a string from a resurce file + * + * @param aResourceFile - name of the resource file (does not contain the path). + * @param aResourceId - Id of the string to be loaded + * @return HBufC* containing the required string. + */ + IMPORT_C HBufC* LoadLocalizedStringLC(const TDesC& aResourceFile, const TInt aResourceId); + +private: + /** + * CGlxStringItem class + * + * This class encapsulates a resource id and it's associated string. + */ + NONSHARABLE_CLASS(CGlxStringItem) : public CBase + { + public: + /** + * NewL + * @param the resource id + * @param the string + * use this constructor prior to calling InsertL() (Above). + */ + static CGlxStringItem* NewL(TInt aId, HBufC* aString); + + /** + * Constructor + * @param the resource id + * use this constructor directly to create a dummy class typically used before calling Find() (Above). + */ + CGlxStringItem(TInt aId); + + /** + * destructor + */ + ~CGlxStringItem(); + + /** + * GetId + * @return the Id + */ + TInt GetId() const; + + /** + * GetString + * @return HBufC* to the string + */ + HBufC* GetString(); + + private: + /** + * 2nd Phase constructor + * @param the string. Creates own copy of string + */ + + void ConstructL(HBufC* aString); + + + private: + /// The resource id of the string + TInt iId; + + /// HBufC containing the string (Owned) + HBufC* iString; + }; +private: + /** + * Default Constructor + */ + CGlxStringCache(); + + /** + * Searches for a string given the resource id + * @param - resource id + * @return - an HBufC* to the string. NULL if not found. Ownership of string passed to caller. + */ + HBufC* FindL(TInt aId); + + /** + * Inserts a string and resource id into the cache + * @param - resource id + * @return - an HBufC* to the string. NULL if not found. Ownership of string passed to caller. + */ + void InsertL(TInt aId, HBufC* aString); + /** + * Count + * @return number of elements in array + */ + TInt Count(); + + /** + * This method is a callback passed to RPointerArray.InsertInOrder + * @ref see TLinearOrder. + * @param first item to be compared + * @param second item to be compared + * @return a negative value is Item1 is less than Item2. Zero if Equal, otherwise a positive value + */ + static TInt OrderById(const CGlxStringCache::CGlxStringItem& aItem1, const CGlxStringCache::CGlxStringItem& aItem2); + + /** + * This method is a callback passed to RPointerArray.Find + * @ref see TIdentityRelation. + * @param first item to be compared + * @param second item to be compared + * @return ETrue id Item1 matches Item2, otherwise EFalse + */ + static TBool MatchById(const CGlxStringCache::CGlxStringItem& aItem1, const CGlxStringCache::CGlxStringItem& aItem2); + + /** + * Loads a string from a resurce file + * + * @param aResourceFile - name of the resource file (does not contain the path). + * @param aResourceId - Id of the string to be loaded + * @return HBufC* containing the required string. + */ + HBufC* LoadLocalizedStringFromDriveL(const TDesC& aResourceFile, const TInt aResourceId); + +private: + /// Array of CGlxStringItems + RPointerArray iStringCache; + + // remembers the valid resource file name + TFileName iResourceFileName; + }; + + +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/glxthumbnailrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/glxthumbnailrequest.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2008-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: Thumbnail request +* +*/ + + + + +#ifndef C_GLXTHUMBNAILREQUEST_H +#define C_GLXTHUMBNAILREQUEST_H + +// INCLUDES +#include + +#include "glxrequest.h" +#include "glxmediaid.h" +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxThumbnailRequest class + * + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class CGlxThumbnailRequest : public CGlxRequest + { +public: + IMPORT_C static CGlxThumbnailRequest* NewL(TGlxThumbnailRequest aThumbnailRequest, + const TUid& aCollectionPluginUid, const TInt attributeId, CMPXFilter* aFilter = NULL); + virtual ~CGlxThumbnailRequest(); + + IMPORT_C const TGlxMediaId& ItemId() const; + IMPORT_C void ThumbnailRequest(TGlxThumbnailRequest& aTnRequest) const; + IMPORT_C TUint AttributeId() const; + IMPORT_C void SetThumbnailInfo(CGlxtnFileInfo* aInfo); + IMPORT_C CGlxtnFileInfo* ThumbnailInfo() const; + +private: + CGlxThumbnailRequest(TGlxThumbnailRequest aThumbnailRequest, + const TUid& aCollectionPluginUid, const TInt attributeId); + +private: + TGlxThumbnailRequest iThumbnailRequest; + const TInt iAttributeId; + // owned + CGlxtnFileInfo* iInfo; + }; + + +#endif // C_GLXTHUMBNAILREQUEST_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/mglxdatasource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/mglxdatasource.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: Definition of the Data Source Mixin Class. +* +*/ + + + + +#ifndef _MGLXDATASOURCE_H_ +#define _MGLXDATASOURCE_H_ + +// INCLUDES +#include +#include "mglxdatasourceupdateobserver.h" +#include "mglxdatasourcerequestobserver.h" + +// FORWARD DECLARATIONS +class CGlxRequest; + +// CONSTANTS + +// CLASS DECLARATION + +/** + * MGlxDataSource class + * + * Data Source collates Data Source information. + * @lib GlxDataSource.lib + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class MGlxDataSource + { +public: + /** + * Asynchronous call to retrieve + * + * @param aListId list for this query relates to + * @return error code + */ + virtual void DataSourceRequestL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver) = 0; + /** + * Cancel asynchronous request call + * as each requestor can only have one active request the observer is sufficient to cancel the request. + * + */ + virtual void CancelRequest(MGlxDataSourceRequestObserver& aObserver) = 0; +public: + + /** + * Since there should be only one data source manager for a server, + * clients can use this function to either create the instance or + * return the pointer if the instance already exists. + * + * The pointers are reference counter, and the instance is deleted after + * there are no more clients. It is, therefore, necessary + * to release the instance by calling Close() when no longer needed. + * + * @returns a pointer to a new or existing list manager instance + */ + IMPORT_C static MGlxDataSource* OpenDataSourceL(const TUid& aDataSource, MGlxDataSourceUpdateObserver& aObserver); + + + /** + * Decrements the reference count of the data source manager. Deletes the + * data source manager if there are no more references. + */ + virtual void Close(MGlxDataSourceUpdateObserver& aObserver)=0; + }; + + + +#endif //_MGLXDATASOURCE_H_ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/mglxdatasourcerequestobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/mglxdatasourcerequestobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009-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: Definition of the Data Source Task Request Observer Class. +* +*/ + + + + +#ifndef _MGLXDATASOURCEREQUESTOBSERVER_H_ +#define _MGLXDATASOURCEREQUESTOBSERVER_H_ + +// INCLUDES +#include +#include "glxmediaid.h" +#include "glxrequest.h" + +// FORWARD DECLARATIONS +class TGlxThumbnailRequest; +class CMPXMedia; + +// CONSTANTS + +// CLASS DECLARATION + + +/** + * MGlxDataSourceRequestObserver class + * + * Returns the result of a Request. + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class MGlxDataSourceRequestObserver + { +public: + /** + * Asynchronous call to retrieve + * + * @param aListId list for this query relates to + * @return error code + */ + virtual void HandleResponse(CMPXMedia* aResponse, CGlxRequest* aRequest, const TInt& aError) = 0; + }; + +#endif //_MGLXDATASOURCEREQUESTOBSERVER_H_ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/inc/mglxdatasourceupdateobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/inc/mglxdatasourceupdateobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-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: Definition of the Data Source update observer Class. +* +*/ + + + + +#ifndef _MGLXDATASOURCEUPDATEOBSERVER_H_ +#define _MGLXDATASOURCEUPDATEOBSERVER_H_ + +// INCLUDES +#include +#include "glxmediaid.h" +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * MGlxDataSourceUpdateObserver class + * + * Returns update notifications. + * @ingroup collection_component_design + * @internal reviewed 11/07/2007 by Dave Schofield + */ +class MGlxDataSourceUpdateObserver + { +public: + /** + * Notification that new items have been found in the data source (file + * system, etc.) + * + * @param aItems ids of the items that were been found. + */ + virtual void HandleMessage(CMPXMessage& aMessage) = 0; + + }; + +#endif //_MGLXDATASOURCEUPDATEOBSERVER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxcollectionpluginbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,520 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + +// INCLUDE FILES + +#include "glxcollectionpluginbase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcommandrequest.h" +#include "glxgetrequest.h" +#include "glxidlistrequest.h" +#include "glxrequest.h" +#include "glxstringcache.h" +#include "glxthumbnailrequest.h" +#include "mglxdatasource.h" + + +// CONSTANTS +const TGlxThumbnailRequest::TPriorityMode KGlxDefaultThumbnailPriority = TGlxThumbnailRequest::EPrioritizeQuality; + +// ============================ LOCAL FUNCTIONS ============================== + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxCollectionPluginBase::CGlxCollectionPluginBase() + { + TRACER("CGlxCollectionPluginBase::CGlxCollectionPluginBase()"); + } +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxCollectionPluginBase::~CGlxCollectionPluginBase() + { + TRACER("CGlxCollectionPluginBase::~CGlxCollectionPluginBase()"); + if (iDataSource) + { + iDataSource->Close(*this); + } + delete iPath; + delete iStringCache; + } + + +// ---------------------------------------------------------------------------- +// Executes a command on the selected collection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::CommandL(TMPXCollectionCommand /*aCmd*/, TInt /*aArg*/) + { + TRACER("void CGlxCollectionPluginBase::CommandL(TMPXCollectionCommand /*aCmd*/, TInt /*aArg*/)"); + User::Leave(KErrNotSupported); + } + +// ---------------------------------------------------------------------------- +// Executes a command on the selected collection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::CommandL(CMPXCommand& aCmd) + { + TRACER("void CGlxCollectionPluginBase::CommandL(CMPXCommand& aCmd)"); + CGlxCommandRequest* request = CGlxCommandRequest::NewL(aCmd, Uid(), *this); + iDataSource->DataSourceRequestL(request, *this); + } + +// ---------------------------------------------------------------------------- +// Navigates to the given path +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::OpenL(const CMPXCollectionPath& aPath, + const TArray& /*aAttrs*/, + CMPXFilter* aFilter) + { + TRACER("void CGlxCollectionPluginBase::OpenL()"); + iPath = CMPXCollectionPath::NewL(aPath); + if(aFilter) + { + if(aFilter->IsSupported(KGlxFilterGeneralNavigationalStateOnly)) + { + 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) + { + targetId = TGlxMediaId(KGlxCollectionRootId); + } + TInt level = aPath.Levels() + 1; // filter applies to new level we are retrieving + CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL(DefaultFilter(level), aFilter, EFalse); + CleanupStack::PushL(filter); + CGlxIdListRequest* request = CGlxIdListRequest::NewL(targetId, Uid(), filter, *iPath); + CleanupStack::PopAndDestroy(filter); + iDataSource->DataSourceRequestL(request, *this); + } + +// ---------------------------------------------------------------------------- +// Extended properties of the current file (async) +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::MediaL(const CMPXCollectionPath& aPath, + const TArray< TMPXAttribute >& aAttrs, + const TArray& aCaps, + CMPXAttributeSpecs* aSpecs) + { + TRACER("void CGlxCollectionPluginBase::MediaL()"); + __ASSERT_DEBUG(aPath.Count(), Panic(EGlxPanicMediaRequestedWithEmptyPath)); + + TInt bitmapId = 0; + + TInt count = aAttrs.Count(); + for( TInt i = 0; i < count; ++i ) + { + if( KGlxMediaIdThumbnail == aAttrs[i].ContentId() ) + { + bitmapId = aAttrs[i].AttributeId(); + } + } + + CGlxRequest* request = NULL; + if(aSpecs && bitmapId) + { + TBool clientHasDRM = EFalse; + for ( TInt i = 0; i < aCaps.Count(); ++i) + { + if(aCaps[i] == ECapabilityDRM) + { + clientHasDRM = ETrue; + break; + } + } + TSize size(0,0); + TGlxThumbnailRequest::TPriorityMode priority = KGlxDefaultThumbnailPriority; + TGlxThumbnailFilter filter = EGlxThumbnailFilterNone; + TInt bitmapHandle = 0; + TRect cropRect; + const TMPXAttributeData sizeAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailSize }; + const TMPXAttributeData priorityAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailQualityOverSpeed }; + const TMPXAttributeData bitmapAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailBitmapHandle }; + const TMPXAttributeData cropAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailCroppingRect }; + const TMPXAttributeData filterAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailFiltering }; + + if(aSpecs->IsSupported(sizeAttrib)) + { + size = aSpecs->ValueTObjectL(sizeAttrib); + } + if(aSpecs->IsSupported(priorityAttrib)) + { + priority = aSpecs->ValueTObjectL(priorityAttrib) ? TGlxThumbnailRequest::EPrioritizeQuality : TGlxThumbnailRequest::EPrioritizeSpeed; + } + if(aSpecs->IsSupported(bitmapAttrib)) + { + bitmapHandle = aSpecs->ValueTObjectL(bitmapAttrib); + } + if(aSpecs->IsSupported(cropAttrib)) + { + cropRect = aSpecs->ValueTObjectL(cropAttrib); + } + if(aSpecs->IsSupported(filterAttrib)) + { + filter = aSpecs->ValueTObjectL(filterAttrib); + } + + + TGlxThumbnailRequest tnRequest(TGlxMediaId(aPath.Id()), size, priority, bitmapHandle, clientHasDRM, cropRect, filter); + CMPXFilter* defFilter = TGlxFilterFactory::CreateCombinedFilterL(DefaultFilter(aPath.Levels()), NULL, EFalse); + CleanupStack::PushL(defFilter); + request = CGlxThumbnailRequest::NewL(tnRequest, Uid(), bitmapId, defFilter); + CleanupStack::PopAndDestroy(defFilter); + + CleanupStack::PushL(request); + + CGlxtnFileInfo* tnFileInfo = new (ELeave) CGlxtnFileInfo; + CleanupStack::PushL(tnFileInfo); + + TInt countInfo(0); + + if(aSpecs->IsSupported(KMPXMediaGeneralSize)) + { + tnFileInfo->iFileSize = aSpecs->ValueTObjectL(KMPXMediaGeneralSize); + countInfo++; + } + if(aSpecs->IsSupported(KGlxMediaGeneralLastModifiedDate)) + { + tnFileInfo->iFileTime = aSpecs->ValueTObjectL(KGlxMediaGeneralLastModifiedDate); + countInfo++; + } + if(aSpecs->IsSupported(KMPXMediaDrmProtected)) + { + tnFileInfo->iIsProtected = aSpecs->ValueTObjectL(KMPXMediaDrmProtected); + countInfo++; + } + if(aSpecs->IsSupported(KMPXMediaGeneralUri)) + { + tnFileInfo->SetFilePathL(aSpecs->ValueText(KMPXMediaGeneralUri)); + countInfo++; + } + if(aSpecs->IsSupported(KMPXMediaGeneralCategory)) + { + TMPXGeneralCategory category = aSpecs->ValueTObjectL(KMPXMediaGeneralCategory); + if( EMPXVideo == category ) + { + tnFileInfo->iIsVideo = ETrue; + countInfo++; + } + else if( EMPXImage == category ) + { + tnFileInfo->iIsVideo = EFalse; + countInfo++; + } + } + + const TInt KGlxRequiredCountInfo = 5; + CGlxThumbnailRequest* requestTn = static_cast(request); + if( KGlxRequiredCountInfo == countInfo ) + { + requestTn->SetThumbnailInfo(tnFileInfo); + CleanupStack::Pop(tnFileInfo); + } + else + { + CleanupStack::PopAndDestroy(tnFileInfo); + } + + CleanupStack::Pop(request); + } + else + { + request = GetRequestFactoryL(aPath, aAttrs); + } + iDataSource->DataSourceRequestL(request, *this); + + } + +// ---------------------------------------------------------------------------- +// Cancel outstanding request +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::CancelRequest() + { + TRACER("void CGlxCollectionPluginBase::CancelRequest()"); + iDataSource->CancelRequest(*this); + } + +// ---------------------------------------------------------------------------- +// Adds an item to the collection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::AddL(const CMPXMedia& /*aNewMedia*/) + { + TRACER("void CGlxCollectionPluginBase::AddL()"); + User::Leave(KErrNotSupported); + } + +// ---------------------------------------------------------------------------- +// Remove an item or items under a group from the collection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::RemoveL(const CMPXCollectionPath& /*aPath*/) + { + TRACER("void CGlxCollectionPluginBase::RemoveL()"); + User::Leave(KErrNotSupported); + } + +// ---------------------------------------------------------------------------- +// Remove an item or items under a group from the collection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::RemoveL(const CMPXMedia& /*aMedia*/) + { + TRACER("void CGlxCollectionPluginBase::RemoveL()"); + User::Leave(KErrNotSupported); + } + +// ---------------------------------------------------------------------------- +// Sets/updates the media for the item +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::SetL(const CMPXMedia& /*aMedia*/) + { + TRACER("void CGlxCollectionPluginBase::SetL(const CMPXMedia& /*aMedia*/)"); + User::Leave(KErrNotSupported); + } + +// ---------------------------------------------------------------------------- +// FindAllL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionPluginBase::FindAllL(const CMPXMedia& /*aCriteria*/, const TArray& /*aAttrs*/) + { + TRACER("void CGlxCollectionPluginBase::FindAllL()"); + User::Leave(KErrNotSupported); + } + +// ---------------------------------------------------------------------------- +// FindAllL +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CGlxCollectionPluginBase::FindAllSyncL(const CMPXMedia& /*aCriteria*/, + const TArray& /*aAttrs*/) + { + TRACER("CMPXMedia* CGlxCollectionPluginBase::FindAllSyncL()"); + User::Leave(KErrNotSupported); + return NULL; + } + + +// ---------------------------------------------------------------------------- +// GetCapabilities +// ---------------------------------------------------------------------------- +// +EXPORT_C TCollectionCapability CGlxCollectionPluginBase::GetCapabilities() + { + TRACER("TCollectionCapability CGlxCollectionPluginBase::GetCapabilities()"); + return 0; + } + +EXPORT_C void CGlxCollectionPluginBase::HandleResponse(CMPXMedia* aResponse, CGlxRequest* aRequest, const TInt& aError) + { + TRACER("void CGlxCollectionPluginBase::HandleResponse()"); + + if (dynamic_cast(aRequest)) + // iRequest is a CGlxIdListRequest + { + iObs->HandleOpen(iPath, aError); + delete iPath; + iPath = NULL; + } + else if (dynamic_cast(aRequest)) + // iRequest is a CGlxThumbnailRequest + { + iObs->HandleMedia(aResponse, aError); + } + else if (dynamic_cast(aRequest)) + // iRequest is a CGlxGetRequest + { + TInt error = aError; + CGlxGetRequest* getRequest = static_cast(aRequest); + TBool b = getRequest->CpiAttributesSet(); + if(b && ( KErrNone == error )) + { + TRAP(error, HandleCpiAttributeResponseL(aResponse, getRequest->CpiAttributes(), getRequest->MediaIds().Array())); + } + iObs->HandleMedia(aResponse, error); + } + else if (dynamic_cast(aRequest)) + // iRequest is a CGlxCommandRequest + { + iObs->HandleCommandComplete(aResponse, aError); + } + else + { + // Other request types not handled + Panic(EGlxPanicLogicError); + } + } + +CGlxRequest* CGlxCollectionPluginBase::GetRequestFactoryL(const CMPXCollectionPath& aPath, const TArray& aAttrs) + { + TRACER("CGlxRequest* CGlxCollectionPluginBase::GetRequestFactoryL()"); + TBool doNotNeedDataSource = EFalse; + RArray mediaIdArray; + + CleanupClosePushL(mediaIdArray); + + if( aPath.Levels() == KGlxCollectionRootLevel) + { + __ASSERT_DEBUG(Uid().iUid == (TUint32)aPath.Id(), Panic(EGlxPanicIllegalArgument)); + mediaIdArray.AppendL(TGlxMediaId(KGlxCollectionRootId)); + doNotNeedDataSource = ETrue; + } + else + { + // Add the media Ids to the iMediaIdArray + TArray selection = aPath.Selection(); + TInt selectedCount = selection.Count(); + if (selectedCount) + // Items are selected; We require the attributes for the selected items. + { + for (TInt i = 0; i < selectedCount; i++) + { + const TMPXItemId& itemId = aPath.IdOfIndex(selection[i]); + mediaIdArray.AppendL(TGlxMediaId(itemId)); + } + } + else // No items are selected; We will use the current item + { + mediaIdArray.AppendL(TGlxMediaId(aPath.Id())); + } + + } + + // Add the attributes to the attributeArray + RArray attributeArray; + CleanupClosePushL(attributeArray); + RArray cpiAttributeArray; + CleanupClosePushL(cpiAttributeArray); + + for (TInt i = 0; i < aAttrs.Count(); i++) + { + if( KGlxMediaIdCollectionPluginSpecific == aAttrs[i].ContentId()) + { + cpiAttributeArray.AppendL(aAttrs[i]); + CpiAttributeAdditionalAttributes(aAttrs[i], attributeArray); + doNotNeedDataSource = EFalse; + } + else + { + if ( aAttrs[i] == KMPXMediaGeneralCount ) + { + doNotNeedDataSource = EFalse; + } + attributeArray.AppendL(aAttrs[i]); + } + } + + CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL(DefaultFilter(aPath.Levels()), NULL, EFalse); + CleanupStack::PushL(filter); + CGlxRequest* request = CGlxGetRequest::NewL(mediaIdArray, attributeArray, cpiAttributeArray, Uid(), filter, doNotNeedDataSource); // Array contents ownership transferred + CleanupStack::PopAndDestroy(filter); + CleanupStack::Pop(&cpiAttributeArray); + CleanupStack::Pop(&attributeArray); + CleanupStack::Pop(&mediaIdArray); + return request; + } + + + EXPORT_C void CGlxCollectionPluginBase::HandleMessage(CMPXMessage& aMessage) + { + TRACER("void CGlxCollectionPluginBase::HandleMessage(CMPXMessage& aMessage)"); + aMessage.SetTObjectValueL(KMPXMessageCollectionId, Uid()); + iObs->HandleMessage(&aMessage, KErrNone); + } + +EXPORT_C TBool CGlxCollectionPluginBase::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/) + { + TRACER("TBool CGlxCollectionPluginBase::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/)"); + // Default implementation ignores all update messages + return ETrue; + } + +EXPORT_C void CGlxCollectionPluginBase::CpiAttributeAdditionalAttributes(const TMPXAttribute& /*aCpiAttribute*/, RArray& /*aAttributeArray*/) + { + TRACER("void CGlxCollectionPluginBase::CpiAttributeAdditionalAttributes()"); + // Default implementation does not require additional attributes + } + +EXPORT_C void CGlxCollectionPluginBase::HandleCpiAttributeResponseL(CMPXMedia* /*aResponse*/, TArray /*aCpiAttributes*/, TArray /* aMediaIds */) + { + TRACER("void CGlxCollectionPluginBase::HandleCpiAttributeResponseL()"); + // Base class does not support CPI specific attributes, deriving class must override. + User::Leave(KErrNotSupported); + } + +EXPORT_C HBufC* CGlxCollectionPluginBase::LoadLocalizedStringLC(const TDesC& aResourceFile, const TInt aResourceId) + { + TRACER("void CGlxCollectionPluginBase::LoadLocalizedStringLC()"); + + if (!iStringCache) + { + iStringCache = CGlxStringCache::NewL(); + } + return (iStringCache->LoadLocalizedStringLC(aResourceFile,aResourceId)); + } + + +EXPORT_C TGlxFilterProperties CGlxCollectionPluginBase::DefaultFilter(TInt /*aLevel*/) + { + TRACER("TGlxFilterProperties CGlxCollectionPluginBase::DefaultFilter(TInt /*aLevel*/)"); + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + + return filterProperties; + } + + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxcommandrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxcommandrequest.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008-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: Request filter. +* +*/ + + + + +#include + +#include "glxcommandrequest.h" +#include + +// ---------------------------------------------------------------------------- +// CGlxCommandRequest::NewL +// ---------------------------------------------------------------------------- +// +CGlxCommandRequest* CGlxCommandRequest::NewL(const CMPXCommand& aCommand, + const TUid aCollectionPluginUid, MGlxDataSourceUpdateObserver& aObserver) + { + TRACER("CGlxCommandRequest* CGlxCommandRequest::NewL()"); + CGlxCommandRequest* obj = + new(ELeave) CGlxCommandRequest(aCollectionPluginUid, aObserver); + CleanupStack::PushL(obj); + obj->ConstructL(aCommand); + CleanupStack::Pop(obj); + return obj; + } + +// ---------------------------------------------------------------------------- +// CGlxCommandRequest::~CGlxCommandRequest +// ---------------------------------------------------------------------------- +// +CGlxCommandRequest::~CGlxCommandRequest() + { + TRACER("CGlxCommandRequest::~CGlxCommandRequest()"); + delete iCommand; + } + +// ---------------------------------------------------------------------------- +// CGlxCommandRequest::CGlxCommandRequest +// ---------------------------------------------------------------------------- +// +CGlxCommandRequest::CGlxCommandRequest(TUid aCollectionPluginUid, + MGlxDataSourceUpdateObserver& aObserver) + : CGlxRequest(aCollectionPluginUid), iDataSourceUpdateObserver(aObserver) + { + TRACER("CGlxCommandRequest::CGlxCommandRequest()"); + } + +// ---------------------------------------------------------------------------- +// CGlxCommandRequest::ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxCommandRequest::ConstructL(const CMPXCommand& aCommand) + { + TRACER("void CGlxCommandRequest::ConstructL()"); + iCommand = CMPXCommand::NewL(aCommand); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxdatasource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxdatasource.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,342 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the Data Source Class. +* +*/ + + + + + + +#include "glxdatasource.h" + +#include +#include +#include + +#include "glxdatasourcetask.h" +#include "mglxdatasourceupdateobserver.h" +#include "mglxdatasourcerequestobserver.h" + +// --------------------------------------------------------------------------- +// CDataSourceArrayOwner::InstanceL +// --------------------------------------------------------------------------- +// +CDataSourceArrayOwner* CDataSourceArrayOwner::InstanceL() + { + TRACER("CDataSourceArrayOwner::InstanceL()"); + return CGlxSingletonStore::InstanceL(&NewL); + } + +// --------------------------------------------------------------------------- +// CDataSourceArrayOwner::Close +// --------------------------------------------------------------------------- +// +void CDataSourceArrayOwner::Close() + { + TRACER("void CDataSourceArrayOwner::Close()"); + CGlxSingletonStore::Close(this); + } + +// --------------------------------------------------------------------------- +// CDataSourceArrayOwner::Array +// --------------------------------------------------------------------------- +// +RPointerArray& CDataSourceArrayOwner::Array() + { + TRACER("CDataSourceArrayOwner::Array()"); + return iDataSources; + } + +// --------------------------------------------------------------------------- +// CDataSourceArrayOwner::NewL +// --------------------------------------------------------------------------- +// +CDataSourceArrayOwner* CDataSourceArrayOwner::NewL() + { + TRACER("CDataSourceArrayOwner* CDataSourceArrayOwner::NewL()"); + return new (ELeave) CDataSourceArrayOwner(); + } + +// --------------------------------------------------------------------------- +// CDataSourceArrayOwner::~CDataSourceArrayOwner +// --------------------------------------------------------------------------- +// +CDataSourceArrayOwner::~CDataSourceArrayOwner() + { + TRACER("CDataSourceArrayOwner::~CDataSourceArrayOwner()"); + iDataSources.Close(); + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxDataSource::CGlxDataSource() + : CActive(EPriorityStandard) + { + TRACER("EXPORT_C CGlxDataSource::CGlxDataSource()"); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// MGlxDataSource::OpenDataSourceL +// --------------------------------------------------------------------------- +// +EXPORT_C MGlxDataSource* MGlxDataSource::OpenDataSourceL(const TUid& aDataSource, MGlxDataSourceUpdateObserver& aObserver) + { + TRACER("MGlxDataSource* MGlxDataSource::OpenDataSourceL()"); + CDataSourceArrayOwner* dsArrayOwner = CDataSourceArrayOwner::InstanceL(); + CleanupClosePushL(*dsArrayOwner); + RPointerArray& dataSoruceArray = dsArrayOwner->Array(); + CGlxDataSource* dataSource = NULL; + if (dataSoruceArray.Count()) + { + for (TInt i = 0;i < dataSoruceArray.Count(); i++) + { + if (dataSoruceArray[i]->Uid() == aDataSource) + { + dataSource = dataSoruceArray[i]; + dataSource->AddObserverL(aObserver); + break; + } + } + } + if (!dataSource) + { + REComSession ecomSession = REComSession::OpenL(); + CleanupClosePushL(ecomSession); + TUid dtorKey; + dataSource = reinterpret_cast( + REComSession::CreateImplementationL(aDataSource, dtorKey)); + CleanupStack::PushL(dataSource); + dataSoruceArray.AppendL(dataSource); + dataSource->SetUid(aDataSource); + dataSource->SetDtorKey(dtorKey); + dataSource->AddObserverL(aObserver); + CleanupStack::Pop(dataSource); + dataSource->SetEComSession(ecomSession); + CleanupStack::Pop(&ecomSession); + dataSource->SetDataSourceArrayOwner(dsArrayOwner); + CleanupStack::Pop(dsArrayOwner); + } + else + { + CleanupStack::PopAndDestroy(dsArrayOwner); + } + + return dataSource; + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::Close +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::Close(MGlxDataSourceUpdateObserver& aObserver) + { + TRACER("void CGlxDataSource::Close(MGlxDataSourceUpdateObserver& aObserver)"); + TInt observer = iDataSourceObservers.Find(&aObserver); + __ASSERT_DEBUG(observer !=KErrNotFound, Panic(EGlxPanicLogicError)); // Closing non-existant observer + iDataSourceObservers.Remove(observer); + if (iDataSourceObservers.Count() == 0) + { + RPointerArray& dataSourceArray = iDataSourceArrayOwner->Array(); + TInt dataSource = dataSourceArray.Find(this); + __ASSERT_DEBUG(dataSource !=KErrNotFound, Panic(EGlxPanicLogicError)); // Closing non-existant observer + dataSourceArray.Remove(dataSource); + REComSession ecomSession = iEComSession; + TInt count = dataSourceArray.Count(); + delete this; + if (count == 0) + { + ecomSession.Close(); + } + } + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::~CGlxDataSource +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxDataSource::~CGlxDataSource() + { + TRACER("EXPORT_C CGlxDataSource::~CGlxDataSource()"); + Cancel(); + iDataSourceObservers.Close(); + REComSession::DestroyedImplementation(iDtorKey); + iTasks.ResetAndDestroy(); + iDataSourceArrayOwner->Close(); + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::AddObserverL +// --------------------------------------------------------------------------- +// +void CGlxDataSource::AddObserverL(MGlxDataSourceUpdateObserver& aObserver) + { + TRACER("void CGlxDataSource::AddObserverL(MGlxDataSourceUpdateObserver& aObserver)"); + iDataSourceObservers.AppendL(&aObserver); + } + + +// --------------------------------------------------------------------------- +// CGlxDataSource::RunL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::RunL() + { + TRACER("void CGlxDataSource::RunL()"); + TAction action = static_cast(iStatus.Int()); + + switch (action) + { + case ECleanupAndExecute: + { + delete iTasks[0]; + iTasks.Remove(0); + TaskCompletedL(); + } + // Don't break - fall through + case EExecuteOnly: + { + if ( (iTasks.Count() > 0) && ( iDataSourceReady || !iTasks[0]->IsDataSourceNeeded() ) ) + { + TaskStartedL(); + iTasks[0]->ExecuteRequestL(); // Execute the oldest request + } + } + break; + } + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::DoCancel +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::DoCancel() + { + TRACER("void CGlxDataSource::DoCancel()"); + // CActive::Cancel() will wait for the request to complete. + // It is not necessary to take any action here. + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::RunError +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxDataSource::RunError(TInt aError) + { + TRACER("TInt CGlxDataSource::RunError(TInt aError)"); + __ASSERT_DEBUG(iTasks.Count() > 0, Panic(EGlxPanicLogicError)); + iTasks[0]->HandleRequestComplete(aError); + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::CompleteSelf +// --------------------------------------------------------------------------- +// +void CGlxDataSource::CompleteSelf(TAction aAction) + { + TRACER("void CGlxDataSource::CompleteSelf(TAction aAction)"); + TRequestStatus* status=&iStatus; + User::RequestComplete(status, aAction); + SetActive(); + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::DataSourceRequestL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::DataSourceRequestL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver) + { + TRACER("void CGlxDataSource::DataSourceRequestL()"); + CGlxDataSourceTask* newRequest = CreateTaskL(aRequest, aObserver); + iTasks.AppendL(newRequest); + TryStartTask(); + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::TryStartTask +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::TryStartTask(TBool aFirstStart) + { + TRACER("void CGlxDataSource::TryStartTask(TBool aFirstStart)"); + if ( ( aFirstStart ? iTasks.Count() >= 1 : iTasks.Count() == 1 ) && !IsActive() ) + // There is one request i.e. it was just added by the call to AppendL() above and we are not waiting + // for a an existing request to complete. If we are waiting for a request to complete then the request + // we have just added will run later. + { + CompleteSelf(EExecuteOnly); + } + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::HandleTaskComplete +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::HandleTaskComplete(CGlxDataSourceTask* aRequest) + { + TRACER("void CGlxDataSource::HandleTaskComplete(CGlxDataSourceTask* aRequest)"); + __ASSERT_DEBUG(iTasks.Find(aRequest) == 0, Panic( EGlxPanicLogicError )); // The only request that should be executing is the 0th request in the array. + CompleteSelf(ECleanupAndExecute); + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::CancelRequest +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::CancelRequest(MGlxDataSourceRequestObserver& aObserver) + { + TRACER("void CGlxDataSource::CancelRequest(MGlxDataSourceRequestObserver& aObserver)"); + for (TInt i = 0; i < iTasks.Count(); i++) + { + if (iTasks[i]->ObserverMatch(aObserver)) + { + if (i == 0) // Cancel the active request + { + if (!IsActive()) + { + // We can only cancel the request if it is currently executing. The active object being + // active indicates that the request has not yet started or has already completed. + iTasks[0]->CancelRequest(); + } + Cancel(); + CompleteSelf(ECleanupAndExecute); + } + else // The request is waiting to be executed - just remove it from the queue. + { + delete iTasks[i]; + iTasks.Remove(i); + } + break; + } + } + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::BroadcastMessage +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSource::BroadcastMessage(CMPXMessage& aMessage) + { + TRACER("void CGlxDataSource::BroadcastMessage(CMPXMessage& aMessage)"); + __ASSERT_DEBUG(iDataSourceObservers.Count(), Panic(EGlxPanicLogicError)); + // There should always be at least 1 observer because they are passed in + // when the object is instatiated. + iDataSourceObservers[0]->HandleMessage(aMessage); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxdatasourcetask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxdatasourcetask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: Data Source Task Class. +* +*/ + + + +#include "glxdatasourcetask.h" + +#include +#include +#include +#include +#include + +#include "glxrequest.h" +#include "glxidlistrequest.h" +#include "glxdatasource.h" +#include "glxlog.h" + +EXPORT_C CGlxDataSourceTask::~CGlxDataSourceTask() + { + TRACER("EXPORT_C CGlxDataSourceTask::~CGlxDataSourceTask()"); + delete iRequest; + delete iResponse; + } + +EXPORT_C CGlxDataSourceTask::CGlxDataSourceTask(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : iRequest(aRequest), iDataSource(aDataSource), iObserver(&aObserver) + { + TRACER("EXPORT_C CGlxDataSourceTask::CGlxDataSourceTask()"); + } + +TBool CGlxDataSourceTask::ObserverMatch(MGlxDataSourceRequestObserver& aObserver) + { + TRACER("TBool CGlxDataSourceTask::ObserverMatch(MGlxDataSourceRequestObserver& aObserver)"); + if(&aObserver == iObserver) + { + return ETrue; + } + else + { + return EFalse; + } + } + +EXPORT_C void CGlxDataSourceTask::ListToMediaL(const RArray& aList) + { + TRACER("void CGlxDataSourceTask::ListToMediaL(const RArray& aList)"); + RArray mpxIds; + CleanupClosePushL(mpxIds); + + for (TInt i = 0; i < aList.Count(); i++) + { + mpxIds.AppendL(aList[i].Value()); + } + if (dynamic_cast(iRequest)) + { + CGlxIdListRequest* request = static_cast(iRequest); + request->CollectionPath().AppendL(mpxIds.Array()); + } + + CleanupStack::PopAndDestroy(&mpxIds); + } + +EXPORT_C void CGlxDataSourceTask::HandleRequestComplete(TInt aError) + { + TRACER("void CGlxDataSourceTask::HandleRequestComplete(TInt aError)"); + GLX_DEBUG2("Entering CGlxDataSourceTask::HandleRequestComplete() error %d", aError); + if( !iCancelled && iResponse && iObserver ) + { + iObserver->HandleResponse(iResponse, iRequest, aError); + iDataSource->HandleTaskComplete(this); + } + } + +// ---------------------------------------------------------------------------- +// CreateResponseL() +///@todo Remove this method +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDataSourceTask::CreateResponseL() + { + TRACER("void CGlxDataSourceTask::CreateResponseL()"); + iResponse = CMPXMedia::NewL(); + } + +TBool CGlxDataSourceTask::IsDataSourceNeeded() const + { + TRACER("TBool CGlxDataSourceTask::IsDataSourceNeeded()"); + return !iRequest->DoNotNeedDataSource(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxgetrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxgetrequest.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2008-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: Get request +* +*/ + + + + +#include "glxgetrequest.h" + +#include +#include +#include + + +EXPORT_C CGlxGetRequest* CGlxGetRequest::NewL(const RArray& aMediaIdArray, + const RArray& aAttributeArray, + const RArray& aCpiAttributeArray, + const TUid& aCollectionPluginUid, + CMPXFilter* aFilter, + const TBool aDoNotNeedDataSource) + { + TRACER("CGlxGetRequest* CGlxGetRequest::NewL()"); + CGlxGetRequest* task = new (ELeave) CGlxGetRequest(aMediaIdArray, aAttributeArray, + aCpiAttributeArray, aCollectionPluginUid, aDoNotNeedDataSource); + CleanupStack::PushL(task); + task->ConstructL(aFilter); + CleanupStack::Pop(task); + return task; + } + +CGlxGetRequest::CGlxGetRequest(const RArray& aMediaIdArray, + const RArray& aAttributeArray, + const RArray& aCpiAttributeArray, + const TUid& aCollectionPluginUid, + const TBool aDoNotNeedDataSource) + : CGlxRequest(aCollectionPluginUid, aDoNotNeedDataSource), iMediaIdArray(aMediaIdArray), + iAttributeArray(aAttributeArray), iCpiAttributeArray(aCpiAttributeArray) + { + TRACER("CGlxGetRequest::CGlxGetRequest()"); + } + +CGlxGetRequest::~CGlxGetRequest() + { + TRACER("CGlxGetRequest::~CGlxGetRequest()"); + iMediaIdArray.Close(); + iAttributeArray.Close(); + iCpiAttributeArray.Close(); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxidlistrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxidlistrequest.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2008-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: Id list request +* +*/ + + + + +#include "glxidlistrequest.h" +#include +#include +#include +// ---------------------------------------------------------------------------- +// CGlxIdListRequest::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxIdListRequest* CGlxIdListRequest::NewL(TGlxMediaId aContainerId, + const TUid& aCollectionPluginUid, CMPXFilter* aFilter, + CMPXCollectionPath& aPath) + { + TRACER("CGlxIdListRequest* CGlxIdListRequest::NewL()"); + CGlxIdListRequest* task = new (ELeave) CGlxIdListRequest(aCollectionPluginUid, aContainerId, aPath); + CleanupStack::PushL(task); + task->ConstructL(aFilter); + CleanupStack::Pop(task); + return task; + } + +// ---------------------------------------------------------------------------- +// CGlxIdListRequest::CGlxIdListRequest +// ---------------------------------------------------------------------------- +// +CGlxIdListRequest::CGlxIdListRequest(const TUid& aCollectionPluginUid, + TGlxMediaId aContainerId, CMPXCollectionPath& aPath) + : CGlxRequest(aCollectionPluginUid), + iMediaId(aContainerId), + iPath(aPath) + { + TRACER("CGlxIdListRequest::CGlxIdListRequest()"); + } + +CGlxIdListRequest::~CGlxIdListRequest() + { + TRACER("CGlxIdListRequest::~CGlxIdListRequest()"); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxrequest.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-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: request. +* +*/ + + + + +#include "glxrequest.h" +#include +#include +#include + +EXPORT_C CGlxRequest::~CGlxRequest() + { + TRACER("EXPORT_C CGlxRequest::~CGlxRequest()"); + delete iFilter; + } + +CGlxRequest::CGlxRequest(const TUid& aCollectionPluginUid, const TBool aDoNotNeedDataSource) + : iCollectionPluginUid(aCollectionPluginUid), + iDoNotNeedDataSource(aDoNotNeedDataSource) + { + TRACER("CGlxRequest::CGlxRequest()"); + } + +EXPORT_C TUid CGlxRequest::CollectionPluginUid() const + { + TRACER("TUid CGlxRequest::CollectionPluginUid()"); + return iCollectionPluginUid; + } + +EXPORT_C CMPXFilter* CGlxRequest::Filter() const + { + TRACER("CMPXFilter* CGlxRequest::Filter()"); + return iFilter; + } + +void CGlxRequest::ConstructL(const CMPXFilter* aFilter) + { + TRACER("void CGlxRequest::ConstructL(const CMPXFilter* aFilter)"); + if (aFilter) + { + // Take a copy of the filter as we do not own it. + iFilter = CMPXFilter::NewL(*aFilter); + } + else + { + // No filter supplied, so create a default filter; + iFilter = TGlxFilterFactory::CreateAlphabeticSortFilterL(); + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxstringcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxstringcache.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,340 @@ +/* +* Copyright (c) 2008-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: This class caches resource strings +* +*/ + + + + +#include + +#include +#include +#include +#include + +#include "glxstringcache.h" + + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +CGlxStringCache::CGlxStringItem* CGlxStringCache::CGlxStringItem::NewL(TInt aId, HBufC* aString) + { + CGlxStringItem* self = new (ELeave) CGlxStringItem(aId); + CleanupStack::PushL(self); + self->ConstructL(aString); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxStringCache::CGlxStringItem::ConstructL(HBufC* aString) + { + if (NULL == aString) + { + User::Leave(KErrArgument); + } + + iString = (*aString).AllocL(); + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxStringCache::CGlxStringItem::CGlxStringItem(TInt aId) +: iId(aId) + { + + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxStringCache::CGlxStringItem::~CGlxStringItem() + { + delete iString; + } + +// ---------------------------------------------------------------------------- +// GetId +// ---------------------------------------------------------------------------- +// + +TInt CGlxStringCache::CGlxStringItem::GetId() const + { + return iId; + } + +// ---------------------------------------------------------------------------- +// GetString +// ---------------------------------------------------------------------------- +// + +HBufC* CGlxStringCache::CGlxStringItem::GetString() + { + return iString; + } + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// + +EXPORT_C CGlxStringCache* CGlxStringCache::NewL() + { + CGlxStringCache* self = new(ELeave) CGlxStringCache; + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxStringCache::CGlxStringCache() + { + TRACER("CGlxStringCache::CGlxStringCache()"); + iResourceFileName.Zero(); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxStringCache::~CGlxStringCache() + { + TRACER("CGlxStringCache::~CGlxStringCache()"); + iStringCache.ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// Count +// ---------------------------------------------------------------------------- +// +TInt CGlxStringCache::Count() + { + TRACER("TInt CGlxStringCache::Count()"); + return iStringCache.Count(); + } + +// ---------------------------------------------------------------------------- +// Find +// ---------------------------------------------------------------------------- +// +HBufC* CGlxStringCache::FindL(TInt aId) + { + TRACER("HBufC* CGlxStringCache::FindL(TInt aId)"); + // Create a TIdentityRelation to be used in the Find + TIdentityRelation match(&MatchById); + + // Create a dummy string item with the correct id to use in the find + CGlxStringItem* dummyItem = new (ELeave) CGlxStringItem(aId); + + // Call Find + TInt index = iStringCache.Find(dummyItem, match); + + // delete the dummy item + delete dummyItem; + + + if (KErrNotFound != index) + { + // The string was found so create a copy and pass to caller + CGlxStringItem* item = iStringCache[index]; + return item->GetString()->Des().AllocL(); + } + + // String was not found + return NULL; + } + +// ---------------------------------------------------------------------------- +// InsertL +// ---------------------------------------------------------------------------- +// +void CGlxStringCache::InsertL(TInt aId, HBufC* aString) + { + TRACER("void CGlxStringCache::InsertL(TInt aId, HBufC* aString)"); + // Create a TLinearOrder to be used in the InsertInOrder + TLinearOrder orderer(&OrderById); + + // Create the string item + CGlxStringItem* item = CGlxStringItem::NewL(aId, aString); + + // attempt to insert it + TInt err = iStringCache.InsertInOrder(item, orderer); + + switch (err) + { + case KErrNone: + // Do nothing as item has been inserted into cache + break; + + case KErrAlreadyExists: + // This is not an error, but we must tidy up + delete item; + break; + + default: + // We have an error + delete item; + User::Leave(err); + break; + } + } + +// ---------------------------------------------------------------------------- +// Compares two Id's by subtraction +// ---------------------------------------------------------------------------- +// +TInt CGlxStringCache::OrderById(const CGlxStringCache::CGlxStringItem& aItem1, const CGlxStringCache::CGlxStringItem& aItem2) + { + TRACER("TInt CGlxStringCache::OrderById()"); + return aItem1.GetId() - aItem2.GetId(); + } + +// ---------------------------------------------------------------------------- +// Compares two Id's logical equality +// ---------------------------------------------------------------------------- +// +TBool CGlxStringCache::MatchById(const CGlxStringCache::CGlxStringItem& aItem1, const CGlxStringCache::CGlxStringItem& aItem2) + { + TRACER("TBool CGlxStringCache::MatchById()"); + return aItem1.GetId() == aItem2.GetId(); + } + +// ---------------------------------------------------------------------------- +// Load the String +// ---------------------------------------------------------------------------- +// +EXPORT_C HBufC* CGlxStringCache::LoadLocalizedStringLC(const TDesC& aResourceFile, const TInt aResourceId) + { + TRACER("HBufC* CGlxCollectionPluginBase::LoadLocalizedStringLC()"); + HBufC* string = NULL; + + TFileName resourceFile; + resourceFile.Copy(aResourceFile); + + TRAPD(err, string = LoadLocalizedStringFromDriveL(resourceFile, aResourceId)); + + switch (err) + { + case KErrNone: + break; + + case KErrNotFound: + { + // Could not find resource file on drive z so try on drive c + _LIT(KCDrive,"c"); + resourceFile.Copy(KCDrive); + resourceFile.Append(aResourceFile.Mid(1)); + string = LoadLocalizedStringFromDriveL(resourceFile, aResourceId); + } + break; + + default: + { + GLX_DEBUG2("LEAVING LoadLocalizedStringLC with %d", err); + User::Leave(err); + } + break; + } + + CleanupStack::PushL(string); + + return string; + } + +// ---------------------------------------------------------------------------- +// Loads the String from a drive +// ---------------------------------------------------------------------------- +// +HBufC* CGlxStringCache::LoadLocalizedStringFromDriveL(const TDesC& aResourceFile, const TInt aResourceId) + { + TRACER("HBufC* CGlxCollectionPluginBase::LoadLocalizedStringFromDriveL()"); + + HBufC* string = NULL; + + if (NULL != (string = FindL(aResourceId))) + { + // String has been cached to return it + return string; + } + + + // The string has not been cached to read from resource file + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + // find out if the resource name file has been cached + TBool resoureFileNameCached = (0 != iResourceFileName.Length()); + TFileName resFile; + + if (resoureFileNameCached) + { + // Use cached resource file name + resFile.Copy(iResourceFileName); + } + else + { + // Caluculate the path and language extension + TParse parse; + parse.Set( aResourceFile, &KDC_ECOM_RESOURCE_DIR, NULL ); + resFile.Copy(parse.FullName()); + + TLanguage language = ELangNone; + BaflUtils::NearestLanguageFile( fs, resFile, language); + // Do not cache the file name here as it could be the wrong drive + // causing a leave later + } + + RResourceFile resourceFile; + resourceFile.OpenL(fs, resFile); + CleanupClosePushL(resourceFile); + resourceFile.ConfirmSignatureL(0); // must use BA_RSS_SIGNATURE in resource file (not RSS_SIGNATURE). + + TResourceReader resReader; + + HBufC8* buf = resourceFile.AllocReadLC( aResourceId ); + resReader.SetBuffer( buf ); + string = resReader.ReadHBufCL(); + CleanupStack::PopAndDestroy( buf ); + + // We have succesfully read from the resource so + // check to see if we need to cache the file name + if (!resoureFileNameCached) + { + // Cache the resource file name + iResourceFileName.Copy(resFile); + } + + CleanupStack::PopAndDestroy( &resourceFile ); + CleanupStack::PopAndDestroy( &fs ); + + CleanupStack::PushL(string); + + InsertL(aResourceId, string); // InsertL won't create duplicates + + CleanupStack::Pop(string); + + return string; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/manager/src/glxthumbnailrequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/manager/src/glxthumbnailrequest.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Thumbnail request +* +*/ + + + + +#include "glxthumbnailrequest.h" +#include +#include + +EXPORT_C CGlxThumbnailRequest* CGlxThumbnailRequest::NewL(TGlxThumbnailRequest aThumbnailRequest, + const TUid& aCollectionPluginUid, const TInt attributeId, CMPXFilter* aFilter) + { + TRACER("CGlxThumbnailRequest* CGlxThumbnailRequest::NewL()"); + CGlxThumbnailRequest* tnRequest = new (ELeave) CGlxThumbnailRequest(aThumbnailRequest, aCollectionPluginUid, attributeId); + CleanupStack::PushL(tnRequest); + tnRequest->ConstructL(aFilter); + CleanupStack::Pop(tnRequest); + return tnRequest; + } + +CGlxThumbnailRequest::CGlxThumbnailRequest(TGlxThumbnailRequest aThumbnailRequest, + const TUid& aCollectionPluginUid, const TInt attributeId) +: CGlxRequest(aCollectionPluginUid), iThumbnailRequest(aThumbnailRequest), iAttributeId(attributeId) + { + TRACER("CGlxThumbnailRequest::CGlxThumbnailRequest()"); + } + +CGlxThumbnailRequest::~CGlxThumbnailRequest() + { + TRACER("CGlxThumbnailRequest::~CGlxThumbnailRequest()"); + delete iInfo; + } + +EXPORT_C const TGlxMediaId& CGlxThumbnailRequest::ItemId() const + { + TRACER("TGlxMediaId& CGlxThumbnailRequest::ItemId()"); + return iThumbnailRequest.iId; + } + +EXPORT_C void CGlxThumbnailRequest::ThumbnailRequest(TGlxThumbnailRequest& aThumbnailRequest) const + { + TRACER("void CGlxThumbnailRequest::ThumbnailRequest()"); + aThumbnailRequest = iThumbnailRequest; + } + +// ----------------------------------------------------------------------------- +// AttributeId +// ----------------------------------------------------------------------------- +// +EXPORT_C TUint CGlxThumbnailRequest::AttributeId() const + { + TRACER("TUint CGlxThumbnailRequest::AttributeId()"); + return iAttributeId; + } + +EXPORT_C void CGlxThumbnailRequest::SetThumbnailInfo(CGlxtnFileInfo* aInfo) + { + TRACER("void CGlxThumbnailRequest::SetThumbnailInfo()"); + iInfo = aInfo; + } + +EXPORT_C CGlxtnFileInfo* CGlxThumbnailRequest::ThumbnailInfo() const + { + TRACER("CGlxtnFileInfo* CGlxThumbnailRequest::ThumbnailInfo()"); + return (iInfo); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/data/20000A16.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/data/20000A16.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +// INCLUDES + +#include +#include "glxdatasourcemde.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxDataSourceMdePluginDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x20000A0F; // KGlxDataSourceInterfaceUid + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxDataSourceMdeImplementationUid; + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +PRJ_MMPFILES +glxdatasourcemde.mmp \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/group/glxdatasourcemde.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/group/glxdatasourcemde.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project glxdatasourcemanager. +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + +#include +#include +#include + +#include "../../../../../group/glxbuildcommon.mmh" + + +TARGET glxdatasourcemde.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20000A16 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxdatasourcemde.cpp +SOURCE glxdatasourcemdeproxy.cpp +SOURCE glxdatasourcetaskmde.cpp +SOURCE glxdatasourcetaskmdeattribute.cpp +SOURCE glxdatasourcetaskmdecommand.cpp +SOURCE glxdatasourcetaskmdeidlist.cpp +SOURCE glxdatasourcetaskmdethumbnail.cpp + +// if you comment the lines below out, Photos dB will be used for thumbnail fetching +MACRO USE_S60_TNM +#define USE_S60_TNM +// System includes from the source tree +SYSTEMINCLUDE ../../../../../common/inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../thumbnailcreator/inc +SYSTEMINCLUDE ../../../manager/inc +SYSTEMINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE 20000A16.rss +TARGET glxdatasourcemde.rsc +END + +LIBRARY bafl.lib +LIBRARY caf.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommon.lib +LIBRARY glxdatasourcemanager.lib +#ifdef USE_S60_TNM +LIBRARY thumbnailmanager.lib +LIBRARY bitgdi.lib +#else +LIBRARY glxthumbnailcreator.lib +#endif +LIBRARY inetprotutil.lib +LIBRARY lbs.lib +LIBRARY mdeclient.lib +LIBRARY mpxcommon.lib +LIBRARY platformenv.lib +LIBRARY iclextjpegapi.lib +LIBRARY imageconversion.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data Source MDE Class. +* +*/ + + + + +/** + * @author Simon Brooks, Alex Birkett + */ + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + +#ifndef _C_GLXDATASOURCEMDE_H_ +#define _C_GLXDATASOURCEMDE_H_ + +// INCLUDES +#include +#include + +#include +#include +#include + +#ifdef USE_S60_TNM +#include +#include +#include +#include + +#include "mthumbnailfetchrequestobserver.h" +#endif + +#include "glxdatasource.h" + +// FORWARD DECLARATIONS +class CGlxRequest; + +#ifndef USE_S60_TNM +class CGlxtnThumbnailCreator; +class CGlxtnThumbnailDatabase; +#endif + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxDataSourceMde class + * + * Data Source Mde is a Meta Data Data Source. + * @lib GlxDataSourceMde.lib + * @ingroup collection_component_design + */ +class CGlxDataSourceMde : public CGlxDataSource, + public MMdESessionObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver, + public MMdERelationObserver, + public MMdERelationPresentObserver +#ifdef USE_S60_TNM + , public MThumbnailManagerObserver +#else + , public MGlxtnThumbnailStorageObserver +#endif + { +public: + static CGlxDataSourceMde* NewL(); + +private: + ~CGlxDataSourceMde(); + + CGlxDataSourceMde(); + + void ConstructL(); + +public: // from CGlxDataSource + CGlxDataSourceTask* CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver); + +private: + /** + * from MMdESessionObserver + */ + void HandleSessionOpened(CMdESession& aSession, TInt aError); + + void HandleSessionError(CMdESession& aSession, TInt aError); + +#ifdef USE_S60_TNM +public: + void FetchThumbnailL(CGlxRequest* aRequest, MThumbnailFetchRequestObserver& aObserver); + TInt CancelFetchThumbnail(); +#else +private: // from MGlxtnThumbnailStorageObserver + /** + * Notify that a given thumbnail is available in storage. + * @param aId Media item ID. + * @param aSize Requested thumbnail size. + */ + void ThumbnailAvailable(const TGlxMediaId& aId, const TSize& aSize); + /** + * Notify that a given thumbnail is available in storage. + * @param aId Media item ID. + * @param aSize Thumbnail size. + */ + void BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError); +#endif + +private: // MMdEObjectObserver + /** + * Called to notify the observer that new objects has been added to + * the metadata engine database. + * + * @param aSession session + * @param aObjectIdArray IDs of added object + */ + void HandleObjectAdded(CMdESession& aSession, const RArray& aObjectIdArray); + + /** + * Called to notify the observer that objects has been modified in + * the metadata engine database. + * + * @param aSession session + * @param aObjectIdArray IDs of modified object + */ + void HandleObjectModified(CMdESession& aSession, const RArray& aObjectIdArray); + + /** + * Called to notify the observer that objects has been removed from + * the metadata engine database. + * + * @param aSession session + * @param aObjectIdArray IDs of removed object + */ + void HandleObjectRemoved(CMdESession& aSession, const RArray& aObjectIdArray); + +private: // MMdEObjectPresentObserver + /** + * Called to notify the observer that objects has been set to present state in + * the metadata engine database. + * + * @param aSession session + * @param aObjectIdArray object IDs which are set to present state + */ + void HandleObjectPresent(CMdESession& aSession, const RArray& aObjectIdArray); + + /** + * Called to notify the observer that objects has been set to not present state in + * the metadata engine database. + * + * @param aSession session + * @param aObjectIdArray object IDs which are set to not present state + */ + void HandleObjectNotPresent(CMdESession& aSession, const RArray& aObjectIdArray); + +private: // MMdERelationObserver + /** + * Called to notify the observer that new relations has been added to + * the metadata engine database. + * + * @param aSession session + * @param aRelationIdArray IDs of added relations + */ + void HandleRelationAdded(CMdESession& aSession, const RArray& aRelationIdArray); + + /** + * Called to notify the observer that relations has been removed from + * the metadata engine database. + * + * @param aSession session + * @param aRelationIdArray IDs of removed relations + */ + void HandleRelationRemoved(CMdESession& aSession, const RArray& aRelationIdArray); + + /** + * Called to notify the observer that relations has been modified from + * the metadata engine database. + * + * @param aSession session + * @param aRelationIdArray IDs of modified relations + */ + void HandleRelationModified(CMdESession& aSession, const RArray& aRelationIdArray); + +private: //MMdERelationPresentObserver + /** + * Called to notify the observer that objects has been set to present state in + * the metadata engine database. + * + * @param aSession session + * @param aObjectIdArray object IDs which are set to present state + */ + void HandleRelationPresent(CMdESession& aSession, const RArray& aRelationIdArray); + + /** + * Called to notify the observer that objects has been set to not present state in + * the metadata engine database. + * + * @param aSession session + * @param aObjectIdArray object IDs which are set to not present state + */ + void HandleRelationNotPresent(CMdESession& aSession, const RArray& aRelationIdArray); + +#ifdef USE_S60_TNM + // from MThumbnailManagerObserver + void ThumbnailPreviewReady( MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); + + void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); +#endif + +private: + + void BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError); + + void DoSessionInitL(); + + void AddMdEObserversL(); + + void ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, TBool aIsObject); + + void ProcessItemUpdateL(); + + static TInt ProcessItemUpdate(TAny* aPtr); + + void CreateSessionL(); + + static TInt CreateSession(TAny* aPtr); + + void PrepareMonthsL(); + + 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 ); +#endif + +public: + inline CMdESession& Session() const; + +#ifndef USE_S60_TNM + inline CGlxtnThumbnailCreator& ThumbnailCreator() const; + + inline CGlxtnThumbnailDatabase& ThumbnailDatabase() const; +#endif + + inline RFs& FileServerSession(); + + inline const TGlxMediaId& CameraAlbumId() const; + + inline const TGlxMediaId& FavoritesId() const; + + inline CMdENamespaceDef* NamespaceDef() const; + + inline CMdEObjectDef& ObjectDef() const; + + inline CMdEObjectDef& ImageDef() const; + + inline CMdEObjectDef& VideoDef() const; + + inline CMdEObjectDef& AlbumDef() const; + + inline CMdEObjectDef& MediaDef() const; + inline CMdEObjectDef& TagDef() const; + + /** + * Return object definition used to describe months. + * @return object definition used to describe months. + */ + inline CMdEObjectDef& MonthDef() const; + + inline CMdERelationDef& ContainsDef() const; + + /** + * Get the location definition. + * @return location definition. + */ + inline CMdEObjectDef& LocationDef() const; + + TContainerType ContainerType(CMdEObject* aObject); + + TContainerType ContainerType(CMdEObjectDef* aObjectDef); + + TItemType ItemType(CMdEObject* aObject); + + const TGlxMediaId GetMonthIdL(const TTime& aMonth); + + TBool SameMonth(const TTime& aOldDate, const TTime& aNewDate); + + TBool ContainerIsLeft(CMdEObjectDef& aObjectDef); + +private: +#ifdef USE_S60_TNM + MThumbnailFetchRequestObserver* iTnFetchObserver; + CThumbnailManager* iTnEngine; + CFbsBitmap* iTnThumbnail; + CFbsBitmap* iThumbnail; + TThumbnailRequestId iTnThumbnailCbId; + TBool iTnRequestInProgress; + TInt iTnHandle; + TGlxMediaId iMediaId; + +#else + CGlxtnThumbnailCreator* iThumbnailCreator; + + CGlxtnThumbnailDatabase* iThumbnailDatabase; +#endif + + CMdESession* iSession; + + RFs iFs; + + TBool iSessionOpen; + + TGlxMediaId iCameraAlbumId; + + TGlxMediaId iFavoritesId; + + + CMdENamespaceDef* iNameSpaceDef; + + CMdEObjectDef* iObjectDef; + + CMdEObjectDef* iImageDef; + + CMdEObjectDef* iVideoDef; + + CMdEObjectDef* iAlbumDef; + + CMdEObjectDef* iMediaDef; + CMdEObjectDef* iTagDef; + + CMdEObjectDef* iMonthDef; + + /** + * Location object definition. + */ + CMdEObjectDef* iLocationDef; + CMdERelationDef* iContainsDef; + + + RArray iMonthArray; + + RArray iMonthList; + + TTime iFirstMonth; + + TTime iLastMonth; + + CAsyncCallBack* iUpdateCallback; + + CAsyncCallBack* iCreateSessionCallback; + + struct TUpdateData + { + TItemId iId; + TMPXChangeEventType iType; + TBool iIsObject; + }; + + RArray iUpdateData; + TBool iPauseUpdate; + }; + +#include "glxdatasourcemde.inl" + +#endif //_C_GLXDATASOURCEMDE_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource headers +* +*/ + + + + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + +#ifndef GLXDATASOURCEMDE_HRH +#define GLXDATASOURCEMDE_HRH + +// CONSTANTS + +#define KGlxDataSourceMdePluginDllUid 0x20000A16 +#define KGlxDataSourceMdeImplementationUid 0x20000A10 + +#endif // GLXDATASOURCEMDE_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for Data Source MDE +* +*/ + + + + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + +#include + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::Session +// ---------------------------------------------------------------------------- +// +CMdESession& CGlxDataSourceMde::Session() const + { + __ASSERT_DEBUG(iSessionOpen, Panic(EGlxPanicDatasourceMdeSessionNotOpen)); + return *iSession; + } + +#ifndef USE_S60_TNM +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ThumbnailCreator +// ---------------------------------------------------------------------------- +// +CGlxtnThumbnailCreator& CGlxDataSourceMde::ThumbnailCreator() const + { + return *iThumbnailCreator; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ThumbnailDatabase +// ---------------------------------------------------------------------------- +// +CGlxtnThumbnailDatabase& CGlxDataSourceMde::ThumbnailDatabase() const + { + return *iThumbnailDatabase; + } +#endif + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::FileServerSession +// ---------------------------------------------------------------------------- +// +RFs& CGlxDataSourceMde::FileServerSession() + { + return iFs; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::CameraAlbumId +// ---------------------------------------------------------------------------- +// +const TGlxMediaId& CGlxDataSourceMde::CameraAlbumId() const + { + return iCameraAlbumId; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::FavoritesId +// ---------------------------------------------------------------------------- +// +const TGlxMediaId& CGlxDataSourceMde::FavoritesId() const + { + return iFavoritesId; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::NamespaceDef +// ---------------------------------------------------------------------------- +// +CMdENamespaceDef* CGlxDataSourceMde::NamespaceDef() const + { + return iNameSpaceDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ObjectDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::ObjectDef() const + { + return *iObjectDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ImageDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::ImageDef() const + { + return *iImageDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::VideoDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::VideoDef() const + { + return *iVideoDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::MediaDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::MediaDef() const + { + return *iMediaDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::AlbumDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::AlbumDef() const + { + return *iAlbumDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::TagDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::TagDef() const + { + return *iTagDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::MonthDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::MonthDef() const + { + return *iMonthDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ContainsDef +// ---------------------------------------------------------------------------- +// +CMdERelationDef& CGlxDataSourceMde::ContainsDef() const + { + return *iContainsDef; + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde::LocationDef +// --------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::LocationDef() const + { + return *iLocationDef; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmde.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmde.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data Source Task MDE +* +*/ + + + + +#ifndef _C_GLXDATASOURCETASKMDE_H_ +#define _C_GLXDATASOURCETASKMDE_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CGlxDataSourceMde; +class CGlxRequest; +class CGlxtnThumbnailCreator; +class CMdEObjectDef; +class CMdEObjectQuery; +class CMdESession; + + +/** + * Query types supported by subclasses of CGlxDataSourceTaskMde + */ +enum TGlxQueryType + { + EContainerFirstItemQuery, // CGlxDataSourceTaskMdeThumbnail+ + EIdListQuery, // GlxDataSourceTaskMdeIdList + EAttributeQuery, // CGlxDataSourceTaskMdeAttribute + ELocationAttributeQuery, // CGlxDataSourceTaskMdeAttribute + EImageVideoQuery, // CGlxDataSourceTaskMdeAttribute (but should be general) + ECommandRemoveFromContainer, // CGlxDataSourceTaskMdeCommand + ECommandAddToContainer, // CGlxDataSourceTaskMdeCommand + ECommandRemoveLocation, // CGlxDataSourceTaskMdeCommand + ECommandAddContainer, // CGlxDataSourceTaskMdeCommand adds a container + ECommandDeleteContainers, // CGlxDataSourceTaskMdeCommand deletes containers objects + ECommandDeleteItems, // CGlxDataSourceTaskMdeCommand deletes containers objects + ECommandRenameContainer, + ECommandRename + }; + +/** + * CGlxDataSourceTaskMde class + * Base class for mde tasks: provides task generic functionality. + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMde) : public CGlxDataSourceTask, public MMdEQueryObserver + { +public: + /** + * Constructor. + * @param aRequest request to be executed. + * @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); + + /** + * Destructor. + */ + ~CGlxDataSourceTaskMde(); + + /** + * Second stage constructor + */ + virtual void ConstructL(); + +protected: // to be implemented by deriving classes + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + virtual void ExecuteRequestL() = 0; + + /** + * Must be implemented by deriving classes. To handle query completion + * @param aQuery Query that has been completed. + */ + virtual void DoHandleQueryCompletedL(CMdEQuery& aQuery) = 0; + + /** + * Optionally implemented by deriving classes. Used if the deriving class has + * to run more than one query. Should start the next query or call HandleRequestComplete() + * if no futher queries are required to be run. If the deriving class only has a single query, + * HandleRequestComplete() can be called from DoHandleQueryCompletedL() + */ + virtual void DoNextQueryL() {} + +public: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::CancelRequest + */ + void CancelRequest(); + +private: // from MMdEQueryObserver + /** + * See @ref MMdEQueryObserver::HandleQueryNewResults + */ + void HandleQueryNewResults( CMdEQuery& aQuery, + TInt aFirstNewItemIndex, + TInt aNewItemCount ); + /** + * See @ref MMdEQueryObserver::HandleQueryNewResults + */ + void HandleQueryNewResults( CMdEQuery& aQuery, + TInt aNewObjectItemCount, + TInt aNewRelationItemCount, + TInt aNewEventItemCount); + /** + * See @ref MMdEQueryObserver::HandleQueryCompleted + */ + void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError); + +protected: + + /** + * Returns a pointer to the CGlxDataSourceMde object passed in on instantiation. + * @return a pointer to the CGlxDataSourceMde object passed in on instantiation. + */ + CGlxDataSourceMde* DataSource(); + + void AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties); + + void AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties); + + /** + * Set query contditions by container id and filter properties. + * @param aLogicCondition logic condition to add conditions to + * @param aContainerId Id of the container + * @param aContainerIsLeft. This should be set to to ETrue if the container is on the left side of the releation, or + * 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 SetQueryFilterConditionsL(CMdELogicCondition& aLogicCondition, 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. + * @return Maximum number of results + */ + TInt MaxQueryResultsCount(const TGlxFilterProperties& aFilterProperties) const; + + /** + * Removes and destroys the oldest query in iQueries. + */ + void RemoveQuery(); + + 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 + * of type image or video that have ids specified by aObjectIds. + * @param aObjectIds A list of the ids of the required objects. + * @param aFilterProperties TGlxFilterProperties.iItemType is used to determine if only + * 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); + + /** + * Adds a query for tag objects that have ids specified by aObjectIds + * to the query queue. + * @param aObjectIds A list of the ids of the required objects. + */ + void QueueTagObjectQueryL(const RArray& aObjectIds); + + /** + * Adds a query for album objects that have ids specified by aObjectIds + * to the query queue. + * @param aObjectIds A list of the ids of the required objects. + */ + void QueueAlbumObjectQueryL(const RArray& aObjectIds); + + /** + * Adds a query for "month" objects that have ids specified by aObjectIds + * to the query queue. + * @param aObjectIds A list of the ids of the required objects. + */ + void QueueMonthObjectQueryL(const RArray& aObjectIds); + + /** + * Adds a query for objects of type specified by aObjectDef + * that have ids specified by aObjectIds to the query queue. + * @param aObjectDef type of objects required. + * @param aObjectIds A list of the ids of the required objects. + * @param aQueryType The query type. + */ + void QueueObjectQueryL(CMdEObjectDef& aObjectDef, + const RArray& aObjectIds, const TGlxQueryType& aQueryType); + + /** + * Appends a query to the query queue. (the ownership of the query is transferred) + * @param aQuery query to append to the query queue ownership is transferred to + * the query queue. It is expected that aQuery is not on the cleanupstack before the + * call to AppendQueryL is made + * @param aQueryType the query type. + */ + void AppendQueryL(CMdEQuery* aQuery, const TGlxQueryType& aQueryType); + + /** + * Executes the query at ordinal 0 in the + * query list implementation can be overidden by + * deriving classes. + */ + virtual void ExecuteQueryL(); + +private: + /* + * Helper function TRAPed and called by HandleQueryCompleted() + * @param aQuery the query that has been completed + */ + void HandleQueryCompletedL(CMdEQuery& aQuery); + + /** + * Removes the observer from any existing queries, cancels and destroys them + */ + void DestroyQueries(); + +private: + /** + * Default namespace def (not owned) + */ + CMdENamespaceDef* iDefaultNameSpaceDef; + +protected: + /** + * Outstanding queries array (owned) + */ + RPointerArray iQueries; + + /** + * Query types array (owned) + */ + RArray iQueryTypes; + + /** + * Filter properties + */ + TGlxFilterProperties iFilterProperties; + }; + +#endif //_C_GLXDATASOURCETASKMDE_H_ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeattribute.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeattribute.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data Source Task MDS Attribute Class +* +*/ + + + + +#ifndef _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_ +#define _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +#include +#include "glxdatasourcetaskmde.h" + + +// CLASS DECLARATION + +class CGlxGetRequest; + +NONSHARABLE_CLASS(TGlxQueryAttribute) + { +public: + TGlxQueryAttribute( + TMPXAttribute aAttribute, + CMPXMedia* aMedia, + TGlxFilterProperties aFilterProperties + ) : + iAttribute(aAttribute), + iMedia(aMedia), + iFilterProperties(aFilterProperties) + { + + }; +public: + TMPXAttribute iAttribute; + CMPXMedia* iMedia; + TGlxFilterProperties iFilterProperties; + }; + +/** + * Attribute retrieval task. + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeAttribute) : public CGlxDataSourceTaskMde + { +public: + /** + * Constructor. + * @param aRequest request to be executed. + * @param aObserver observer to be informed when task has completed. + * @param aDataSource data source to be used by this object. + */ + CGlxDataSourceTaskMdeAttribute(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); + + /** + * Destructor. + */ + ~CGlxDataSourceTaskMdeAttribute(); + +private: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + +private: // From CGlxDataSourceTaskMde + /** + * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + + /** + * See @ref CGlxDataSourceTaskMde::DoNextQueryL + */ + void DoNextQueryL(); + +private: + + void AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry); + + void AddCollectionAttributesL(CMPXMedia* aEntry); + + void AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType); + + void AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType); + + /** + * Add location information to a media object from MDS. + * @param aLocationId the id of a location object. + * @param aMedia media object to add a location attribute to. + */ + void AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId); + + + void DoHandleAttributeQueryCompletedL(); + + /** + * Handles the completion of a query of type ELocationQuery. + */ + void DoHandleLocationQueryCompletedL(); + + + void DoHandleImageVideoQueryCompletedL(); + + /** + * Creates a location query and adds it to the queue of queries. + */ + void QueueLocaitonQueryL(); + + /** + * @param aObjectDef object definition which defines objects which will be queried + * @param aIsContent If ETrue, the definition of the objects being queried is set by the item type filter property, if EFalse, the definition + * 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, + const TGlxFilterProperties& aFilterProperties); + + + void DoHandleAttributeResponseCompleteL(); + + + /** + * Determines if the request contains the KGlxMediaGeneralLocation attribtue. + * @return ETrue if the the KGlxMediaGeneralLocation attribute is requrested else EFalse + */ + TBool LocationAttributeRequested(); + + /** + * Executes the next query in the queue of queries. + */ + void ExecuteQueryL(); + +private: + /** + * Results media array (owned) + */ + CMPXMediaArray* iMediaArray; + + /** + * Attributes associated with outstanding queries + */ + RArray< TGlxQueryAttribute > iQueryAttributes; + }; + + +#endif // _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdecommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdecommand.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,316 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data Source Task MDE Command +* +*/ + + + + +#ifndef _C_GLXDATASOURCETASKMDECOMMAND_H_ +#define _C_GLXDATASOURCETASKMDECOMMAND_H_ + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include "glxdatasourcetaskmde.h" + +// FORWARD DECLARATIONS +class CGlxDataSourceMde; +class CGlxRequest; +class CMdENamespaceDef; +class CMdEObjectDef; +class CMdEObjectQuery; +class CMdERelationDef; +class CMdERelationQuery; +class CMdESession; + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxDataSourceTaskMdeCommand class + * + */ +NONSHARABLE_CLASS( CGlxDataSourceTaskMdeCommand ) : public CGlxDataSourceTaskMde, + public MGlxCommandParserCallback + + { +public: // Constructors / Destructors + /** + * Constructor. + * @param aRequest request to be executed. + * @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, + CGlxDataSource* aDataSource); + + /** + * Symbian 2nd stage constructor + * See @ref CGlxDataSourceTaskMde::ConstructL + */ + void ConstructL(); + + /** + * Destructor + */ + ~CGlxDataSourceTaskMdeCommand(); + +private: // From MGlxCommandParserCallback + + /** + * See @ref MGlxCommandParserCallback::AddContainerL + */ + void AddContainerL(const TDesC& aContainerName); + + /** + * See @ref MGlxCommandParserCallback::AddToContainerL + */ + void AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers); + + /** + * See @ref MGlxCommandParserCallback::AddToContainerL + */ + void AddToContainerL(const TDesC& aSourceUri, const RArray& aTargetContainers); + + /** + * See @ref MGlxCommandParserCallback::CopyL + */ + void CopyL(const RArray& aSourceIds, const TDesC& aDrive); + + /** + * See @ref MGlxCommandParserCallback::MoveL + */ + void MoveL(const RArray& aSourceIds, const TDesC& aDrive); + + /** + * See @ref MGlxCommandParserCallback::RemoveFromContainerL + */ + void RemoveFromContainerL(const RArray& aItemIds, const TGlxMediaId& aContainerId); + + /** + * See @ref MGlxCommandParserCallback::DeleteL + */ + void DeleteL(const RArray& aItemIds); + + /** + * See @ref MGlxCommandParserCallback::RenameL + */ + void RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle); + + /** + * See @ref MGlxCommandParserCallback::SetDescriptionL + */ + void SetDescriptionL(const RArray& aItemIds, const TDesC& aDescription); + + /** + * See @ref MGlxCommandParserCallback::SetCaptureLocationL + */ + void SetCaptureLocationL(const RArray& aItemIds, const TCoordinate& aCoordinate); + + /** + * See @ref MGlxCommandParserCallback::ThumbnailCleanupL + */ + void ThumbnailCleanupL(); + +private: // from CGlxDataSourceTaskMde + + /** + * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + + /** + * See @ref CGlxDataSourceTaskMde::DoNextQueryL + */ + void DoNextQueryL(); + +private: + + /** + * Enumeration to describe file operations + * (Copy or Move) + */ + enum TFileOperation + { + ECopy, + EMove + }; + + /** + * Perform a file operation (copy or move). + * @param aSourceIds an array of media ids to copy or move. + * @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); + + /** + * Gets the container id for a given media id. + * If aMedia id is KGlxCollectionRootId (0) then container id + * is determined using the collection id. E.g. if the aMediaId + * is KGlxCollectionRootId and the collection uid is + * KGlxCollectionPluginCameraImplementationUid + * then the camera album id is returned by the method. + * When aMedia id is not equal to KGlxCollectionRootId, (the + * vast majority of cases) the container id returned by the method + * will be the same as the media id passed in. + * + * @param aMediaId should be either a valid container id or KGlxCollectionRootId + * @return a container id. + */ + TMdEItemId ContainerItemId(const TGlxMediaId& aMediaId); + + /** + * Uses the PathInfo class to determine the 'root' path for + * a given drive. The 'root' path is C:\data for the C drive and + * x:\ for all other drives (where x is a drive letter) + * @param aDrive the drive for which the root path is required. + * @param aRootPath on return contains the root path. + */ + void RootPath(const TDesC& aDrive, TDes& aRootPath); + + /** + * Copies items from a TGlxMedia array to a TItemId array. + * @param aDestArray destination array. (It is the callers responsibility to ensure that aDestArray is on + * the cleanup stack should this be required) + * @param aSourceArray source array. + */ + void CopyArrayL(RArray& aDestArray, const RArray& aSourceArray); + + /** + * Sends progress messages to the client + * @param aCurrentStep number of currently completed steps. + * @param aStepCount number of total steps to completion. + */ + void SendProgressMessageL(TInt aCurrentStep, TInt aStepCount); + + /** + * Returns the container object definition (either album or tag) + * the container object definition is calculated based on the + * collection plug-in id associated with the task. + * @param aContainerObjectDef a pointer to the container object + * definition associated with the collection plugin if the + * function completes with out error. The caller does not take + * ownership of the pointer. + * @return KErrNone if the collection plug-in has a container + * object definition associated with it or a system wide + * error code. + */ + TInt ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef); + + /** + * Handle the completion of a 'add to container' query. + * @param aQuery Query that has been completed. + */ + void DoHandleAddToContainerQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'add container' query. + * @param aQuery Query that has been completed. + */ + void DoHandleAddContainerQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'delete containers' query. + * @param aQuery Query that has been completed. + */ + void DoHandleDeleteContainersQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'delete items' query. + * @param aQuery Query that has been completed. + */ + void DoHandleDeleteItemsQueryCompletedL(CMdEQuery& aQuery); + + + /** + * Handle the completion of a 'rename' query. + * @param aQuery Query that has been completed. + */ + void DoHandleRenameQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'rename container' query. + * @param aQuery Query that has been completed. + */ + void DoHandleRenameConainerQueryCompletedL(CMdEQuery& aQuery); + + /** + * Appends a query to the query queue that determines the number + * of container objects that have the title aTitle. This + * method is used to check to see if a container with a + * specific title exists. The container type is determined + * using the ContainerObjectDef() method + * @aQueryType the query type. + * @aTitle title to search for. + */ + void AppendContainerTitleCountQueryL(const TGlxQueryType& aQueryType, const TDesC& aTitle); + +private: // from CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + +private: + /** + * Default name space definition. + */ + CMdENamespaceDef* iDefaultNameSpaceDef; + + /** + * Collection uid. + */ + TUid iCollectionUid; + + /** + * Before new relations are added to the database, a check must be made to see if + * identical relations already exist. This is done asynchronously so they need to + * be stored temporarily as a member variable. + */ + RArray iLeftIds; + + /** + * Before new relations are added to the database, a check must be made to see if + * identical relations already exist. This is done asynchronously so they need to + * be stored temporarily as a member variable. + */ + RArray iRightIds; + + /** + * Used to store object titles while asynchronous operations are in progress. + * (owned) + */ + HBufC* iTitle; + + /** + * Used to store the object to rename while asynchronous operations are in progress. + * (owned) + */ + CMdEObject* iObjectToRename; + }; + +#endif //_C_GLXDATASOURCETASKMDECOMMAND_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeidlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeidlist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data Source Task MDE ID list +* +*/ + + + + +#ifndef GLXDATASOURCETASKMDEIDLIST_H_ +#define GLXDATASOURCETASKMDEIDLIST_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +// INCLUDES +#include +#include + +#include +#include +#include +#include +#include +#include +#include "glxdatasourcetaskmde.h" +// FORWARD DECLARATIONS +class CGlxDataSourceMde; +class CGlxIdListRequest; +class CGlxtnThumbnailCreator; +class CMdEObjectDef; +class CMdEObjectQuery; +class CMdESession; + +/** + * CGlxDataSourceTaskMdeIdList class + * Task to handle id list requests. + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeIdList) : public CGlxDataSourceTaskMde, public MGlxtnThumbnailCreatorClient + + { +public: + /** + * Constructor. + * @param aRequest request to be executed. + * @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); + + /** + * Destructor. + */ + ~CGlxDataSourceTaskMdeIdList(); + +private: // from MGlxtnThumbnailCreatorClient + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete + */ + void ThumbnailFetchComplete(const TGlxMediaId& /*aItemId*/, + TGlxThumbnailQuality /*aQuality*/, TInt /*aErrorCode*/) {}; + + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete + */ + void ThumbnailDeletionComplete(const TGlxMediaId& /*aItemId*/, + TInt /*aErrorCode*/) {}; + + /** + * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete + */ + void FilterAvailableComplete(const RArray& aIdArray, + TInt aErrorCode); + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL + */ + void FetchFileInfoL(CGlxtnFileInfo* /*aInfo*/, + const TGlxMediaId& /*aItemId*/, TRequestStatus* /*aStatus*/) {}; + + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri + */ + void CancelFetchUri(const TGlxMediaId& /*aItemId*/) {}; + + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage + */ + MGlxtnThumbnailStorage* ThumbnailStorage() { return NULL; }; + +public: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + +private: // from CGlxDataSourceTaskMde + /** + * See @ref CGlxDataSourceTask::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + +private: + void DoHandleListQueryCompletedL(); + + void DoMonthListCreationL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties); + + void DoPostFilterComplete(const RArray& aIdArray, TInt aErrorCode); + + void PostFilterL(const RArray& aFilteredList, const TGlxFilterProperties& aFilterProperties); + }; + +#endif // GLXDATASOURCETASKMDEIDLIST_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdethumbnail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdethumbnail.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data Source Task MDE Thumbnail +* +*/ + + + + +#ifndef GLXDATASOURCETASKMDETHUMBNAIL_H_ +#define GLXDATASOURCETASKMDETHUMBNAIL_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +#include "glxdatasourcetaskmdeattribute.h" + +#ifdef USE_S60_TNM +#include "mthumbnailfetchrequestobserver.h" +#endif + +#include +#include + +/** + * CGlxDataSourceTaskMdeThumnail class + * Services thumbnail requests + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeThumbnail) : public CGlxDataSourceTaskMde +#ifdef USE_S60_TNM + , public MThumbnailFetchRequestObserver +#else + , public MGlxtnThumbnailCreatorClient +#endif + { +public: + /** + * Constructor + * @param aRequest thumbnail request to service + * @param aObserver observer + * @param aDataSource data source + */ + CGlxDataSourceTaskMdeThumbnail(CGlxThumbnailRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); + + /** + * Destructor + */ + ~CGlxDataSourceTaskMdeThumbnail(); + +private: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + + /** + * See @ref CGlxDataSourceTask::HandleRequestComplete + */ + void HandleRequestComplete(TInt aError); + +private: // From CGlxDataSourceTaskMde + /** + * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + +#ifdef USE_S60_TNM +private: //MThumbnailFetchRequestObserver + void ThumbnailFetchComplete(TInt aError); + void FetchFileInfoL(); +#endif + +private: // From MGlxtnThumbnailCreatorClient + /** + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete + */ + void ThumbnailFetchComplete(const TGlxMediaId& aItemId, + TGlxThumbnailQuality aQuality, TInt aErrorCode); + + /** + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete + */ + void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); + + /** + * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete + */ + void FilterAvailableComplete(const RArray& aIdArray, TInt aErrorCode); + + /** + * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL + */ + void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, + TRequestStatus* aStatus); + + /** + * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri + */ + void CancelFetchUri(const TGlxMediaId& aItemId); + + /** + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage + */ + MGlxtnThumbnailStorage* ThumbnailStorage(); + +private: + void HandleThumbnailFetchCompleteL(const TGlxMediaId& aId, + TGlxThumbnailQuality aQuality); + + void DoHandleContainerFirstItemQueryCompletedL(); + + void CompleteFetchFileInfoL(CMdEObject* aItem); + +private: + void CompleteThumbnailRequest(TInt aError); + +private: + CGlxtnFileInfo* iTnFileInfo; + + TRequestStatus* iTnRequestStatus; + + TBool iTnRequestInProgress; + }; + +#endif // GLXDATASOURCETASKMDETHUMBNAIL_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/mthumbnailfetchrequestobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/mthumbnailfetchrequestobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2008-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 : class header for thumbnail fetch request observer +* +*/ + + +#ifndef M_THUMBNAILFETCHREQUESTOBSERVER_H +#define M_THUMBNAILFETCHREQUESTOBSERVER_H + + +class CGlxtnFileInfo; + +// CLASS DECLARATION + +class MThumbnailFetchRequestObserver + { +public: + virtual void ThumbnailFetchComplete(TInt aError) = 0; + virtual void FetchFileInfoL() = 0; + }; + +#endif // M_THUMBNAILFETCHREQUESTOBSERVER_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemde.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemde.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,793 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: the Data Source MDE class +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + + +// INCLUDE FILES +#include "glxdatasourcemde.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef USE_S60_TNM +#include +#include +#endif + +#include +#include +#include +#include +#include + +#include "glxdatasourcetaskmde.h" +#include "glxdatasourcetaskmdeattribute.h" +#include "glxdatasourcetaskmdecommand.h" +#include "glxdatasourcetaskmdeidlist.h" +#include "glxdatasourcetaskmdethumbnail.h" + +#ifdef USE_S60_TNM +const TInt KMaxGridThumbnailWidth = 120; +#else +_LIT(KGlxMdeDataSourceThumbnailDatabase, "glxmdstn"); +#endif + +_LIT(KObjectDefLocation, "Location"); +_LIT(KObjectDefNameAlbum, "Album"); +_LIT(KObjectDefNameImage, "Image"); +_LIT(KObjectDefNameMedia, "MediaObject"); +_LIT(KObjectDefNameObject, "Object"); +_LIT(KObjectDefNameTag, "Tag"); +_LIT(KObjectDefNameVideo, "Video"); +_LIT(KPropertyDefNameCreationDate, "CreationDate"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KPropertyDefNameTitle, "Title"); +_LIT(KRelationDefNameContains, "Contains"); + +_LIT(KObjectDefNameMonth, "MediaObject");/// @todo nasty hack remove and use base object + +_LIT(KGlxMdeCameraAlbumUri, "Camera album"); +_LIT(KGlxMdeFavoritesUri, "Favorites"); + +#undef __USING_INTELLIGENT_UPDATE_FILTERING + +// ============================ MEMBER FUNCTIONS ============================== + +CGlxDataSourceMde* CGlxDataSourceMde::NewL() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde* CGlxDataSourceMde::NewL()"); + CGlxDataSourceMde* ds = new (ELeave) CGlxDataSourceMde(); + CleanupStack::PushL(ds); + ds->ConstructL(); + CleanupStack::Pop(ds); + return ds; + } + +CGlxDataSourceMde::~CGlxDataSourceMde() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde::~CGlxDataSourceMde()"); + delete iSession; + +#ifdef USE_S60_TNM + delete iTnThumbnail; + iTnThumbnail = NULL; + + delete iThumbnail; + iThumbnail = NULL; + + delete iTnEngine; + iTnEngine = NULL; +#else + if (iThumbnailCreator) + { + iThumbnailCreator->Close(iThumbnailDatabase); + } + delete iThumbnailDatabase; +#endif + iFs.Close(); + RFbsSession::Disconnect(); + iMonthArray.Close(); + iMonthList.Close(); + iUpdateData.Close(); + delete iUpdateCallback; + delete iCreateSessionCallback; + } + +CGlxDataSourceMde::CGlxDataSourceMde() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde::CGlxDataSourceMde()"); + } + +void CGlxDataSourceMde::ConstructL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ConstructL()"); + iDataSourceReady = EFalse; + User::LeaveIfError(iFs.Connect()); + iSession = CMdESession::NewL( *this ); + + User::LeaveIfError(RFbsSession::Connect()); + +#ifdef USE_S60_TNM + iTnEngine = CThumbnailManager::NewL( *this); + iTnEngine->SetDisplayModeL( EColor64K ); + iTnRequestInProgress = EFalse; +#else + iThumbnailCreator = CGlxtnThumbnailCreator::InstanceL(); + iThumbnailDatabase = CGlxtnThumbnailDatabase::NewL( + KGlxMdeDataSourceThumbnailDatabase, this); +#endif + + iCreateSessionCallback = new ( ELeave ) + CAsyncCallBack( TCallBack( CreateSession, this ), CActive::EPriorityHigh ); + iUpdateCallback = new ( ELeave ) + CAsyncCallBack( TCallBack( ProcessItemUpdate, this ), CActive::EPriorityLow ); + iUpdateData.Reserve(100); // ignore if it fails + } + +// ---------------------------------------------------------------------------- +// from MMdESessionObserver +// CMPXCollectionMdEPlugin::HandleSessionOpened +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceMde::HandleSessionOpened( CMdESession& aSession, TInt aError ) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleSessionOpened(CMdESession& aSession, TInt aError)"); + if( KErrNone != aError ) + { + HandleSessionError(aSession, aError); + } + TRAPD(err, DoSessionInitL()); + if( KErrNone != err ) + { + HandleSessionError(aSession, err); + } + + iSessionOpen = ETrue; + iDataSourceReady = ETrue; + TryStartTask(ETrue); + } + +// ---------------------------------------------------------------------------- +// from MMdESessionObserver +// CMPXCollectionMdEPlugin::HandleSessionError +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/ ) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/)"); + iSession = NULL; + iDataSourceReady = EFalse; + iSessionOpen = EFalse; + iCreateSessionCallback->CallBack(); + } + + +CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver) + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver)"); + if(dynamic_cast(aRequest)) + { + CleanupStack::PushL(aRequest); + CGlxDataSourceTaskMdeCommand* task = new (ELeave) CGlxDataSourceTaskMdeCommand(static_cast(aRequest), aObserver, this); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else if (dynamic_cast< CGlxGetRequest *>(aRequest)) + { + CleanupStack::PushL(aRequest); + CGlxDataSourceTaskMdeAttribute* task = new (ELeave) CGlxDataSourceTaskMdeAttribute(static_cast(aRequest), aObserver, this); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else if (dynamic_cast< CGlxIdListRequest *>(aRequest)) + { + CleanupStack::PushL(aRequest); + CGlxDataSourceTaskMdeIdList* task = new (ELeave) CGlxDataSourceTaskMdeIdList(static_cast(aRequest), aObserver, this); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else if (dynamic_cast< CGlxThumbnailRequest *>(aRequest)) + { + CleanupStack::PushL(aRequest); + CGlxDataSourceTaskMdeThumbnail* task = new (ELeave) CGlxDataSourceTaskMdeThumbnail(static_cast(aRequest), aObserver, this); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else + { + User::Leave(KErrNotSupported); + return NULL; // stops compiler warning + } + } + +#ifndef USE_S60_TNM +void CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& /*aId*/, const TSize& /*aSize*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ThumbnailAvailable()"); + // no implementation + } + +void CGlxDataSourceMde::BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::BackgroundThumbnailError()"); + TSize size(0, 0); + TRAP_IGNORE(BackgroundThumbnailMessageL(aId, size, aError)); + } +#endif + +void CGlxDataSourceMde::BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::BackgroundThumbnailMessageL()"); + CMPXMessage* message = CMPXMessage::NewL(); + CleanupStack::PushL(message); + message->SetTObjectValueL(KMPXMessageGeneralId, KGlxMessageIdBackgroundThumbnail); + message->SetTObjectValueL(KGlxBackgroundThumbnailMediaId, aId.Value()); + message->SetTObjectValueL(KGlxBackgroundThumbnailSize, aSize); + message->SetTObjectValueL(KGlxBackgroundThumbnailError, aError); + BroadcastMessage(*message); + CleanupStack::PopAndDestroy(message); + } + +void CGlxDataSourceMde::DoSessionInitL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::DoSessionInitL()"); + /// @todo check schema version number + iNameSpaceDef = iSession->GetDefaultNamespaceDefL(); + if ( !iNameSpaceDef ) + { + User::Leave(KErrCorrupt); + } + + CMdEObject* cameraAlbum = iSession->GetObjectL(KGlxMdeCameraAlbumUri); + if ( !cameraAlbum ) + { + User::Leave(KErrCorrupt); + } + iCameraAlbumId = (TGlxMediaId)cameraAlbum->Id(); + delete cameraAlbum; + + CMdEObject* favorites = iSession->GetObjectL(KGlxMdeFavoritesUri); + if ( !favorites ) + { + User::Leave(KErrCorrupt); + } + iFavoritesId = (TGlxMediaId)favorites->Id(); + delete favorites; + + iContainsDef = iNameSpaceDef->GetRelationDefL(KRelationDefNameContains); + + iObjectDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameObject); + iImageDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameImage); + iVideoDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameVideo); + iMediaDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameMedia); + iAlbumDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameAlbum); + iTagDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameTag); + iMonthDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameMonth); + iLocationDef = iNameSpaceDef->GetObjectDefL(KObjectDefLocation); + + AddMdEObserversL(); + + PrepareMonthsL(); + } + +void CGlxDataSourceMde::AddMdEObserversL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::AddMdEObserversL()"); + iSession->AddRelationObserverL(*this); + iSession->AddRelationPresentObserverL(*this); + + iSession->AddObjectObserverL(*this); + iSession->AddObjectPresentObserverL(*this); + } + +void CGlxDataSourceMde::HandleObjectAdded(CMdESession& /*aSession*/, const RArray& aObjectIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectAdded()"); + ProcessUpdateArray(aObjectIdArray, EMPXItemInserted, ETrue); + } + +void CGlxDataSourceMde::HandleObjectModified(CMdESession& /*aSession*/, const RArray& aObjectIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectModified()"); + ProcessUpdateArray(aObjectIdArray, EMPXItemModified, ETrue); + } + +void CGlxDataSourceMde::HandleObjectRemoved(CMdESession& /*aSession*/, const RArray& aObjectIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectRemoved()"); + ProcessUpdateArray(aObjectIdArray, EMPXItemDeleted, ETrue); + } + +void CGlxDataSourceMde::HandleObjectPresent(CMdESession& /*aSession*/, const RArray& aObjectIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectPresent()"); + ProcessUpdateArray(aObjectIdArray, EMPXItemInserted, ETrue); + } +void CGlxDataSourceMde::HandleObjectNotPresent(CMdESession& /*aSession*/, const RArray& aObjectIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectNotPresent()"); + ProcessUpdateArray(aObjectIdArray, EMPXItemDeleted, ETrue); + } +void CGlxDataSourceMde::HandleRelationAdded(CMdESession& /*aSession*/, const RArray& aRelationIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationAdded()"); + ProcessUpdateArray(aRelationIdArray, EMPXItemInserted, EFalse); + } +void CGlxDataSourceMde::HandleRelationRemoved(CMdESession& /*aSession*/, const RArray& aRelationIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationRemoved()"); + ProcessUpdateArray(aRelationIdArray, EMPXItemDeleted, EFalse); + } +void CGlxDataSourceMde::HandleRelationModified(CMdESession& /*aSession*/, const RArray& /*aRelationIdArray*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationModified()"); + // not used until ordinals are required + } +void CGlxDataSourceMde::HandleRelationPresent(CMdESession& /*aSession*/, const RArray& aRelationIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationPresent()"); + ProcessUpdateArray(aRelationIdArray, EMPXItemInserted, EFalse); + } +void CGlxDataSourceMde::HandleRelationNotPresent(CMdESession& /*aSession*/, const RArray& aRelationIdArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationNotPresent()"); + ProcessUpdateArray(aRelationIdArray, EMPXItemDeleted, EFalse); + } +void CGlxDataSourceMde::ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, TBool aIsObject) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ProcessUpdateArray()"); + // only need one message so process first item + TUpdateData update; + update.iId = aArray[0]; + update.iType = aType; + update.iIsObject = aIsObject; + if( iUpdateData.Count() ) + { + if( ( iUpdateData[0].iType == aType ) && ( iUpdateData[0].iIsObject ) ) + { + return; + } + } + if( iUpdateData.Append(update) == KErrNone ) // if we can't allocate space for the update, ignore it + { + iUpdateCallback->CallBack(); + } + } +TInt CGlxDataSourceMde::CreateSession(TAny* aPtr) + { + GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceMde::CreateSession(TAny* aPtr)"); + CGlxDataSourceMde* self + = reinterpret_cast( aPtr ); + TRAP_IGNORE(self->CreateSessionL()); + return 0; + } + +void CGlxDataSourceMde::CreateSessionL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::CreateSessionL()"); + iSession = CMdESession::NewL( *this ); + } + + +TInt CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr) + { + GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr)"); + CGlxDataSourceMde* self + = reinterpret_cast( aPtr ); + TRAP_IGNORE(self->ProcessItemUpdateL()); + return 0; + } + +void CGlxDataSourceMde::ProcessItemUpdateL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ProcessItemUpdateL()"); + if ( !iUpdateData.Count() || iPauseUpdate ) + { + return; + } + + CMPXMessage* message = CMPXMessage::NewL(); + CleanupStack::PushL(message); + message->SetTObjectValueL(KMPXMessageGeneralId, KMPXMessageIdItemChanged); + message->SetTObjectValueL(KMPXMessageChangeEventType, iUpdateData[0].iType); + TMPXGeneralCategory category = EMPXNoCategory; + TMPXItemId id = iUpdateData[0].iId; + + GLX_LOG_INFO2("CGlxDataSourceMde::ProcessItemUpdateL() cat%d, item id %d", category, id.iId1); +#ifdef __USING_INTELLIGENT_UPDATE_FILTERING + if ( !iUpdateData[0].iIsObject ) + { + TMPXGeneralCategory containerCategory = EMPXNoCategory; + TMPXItemId containerId; + + CMdERelation* relation = iSession->GetRelationL(id); + if( relation ) + { + TItemId rightId = relation->RightObjectId(); + TItemId leftId = relation->LeftObjectId(); + delete relation; + + CMdEObject* contObject = iSession->GetObjectL(leftId); + __ASSERT_DEBUG(contObject, Panic(EGlxPanicIllegalState)); + TContainerType container = ContainerType(contObject); + delete contObject; + __ASSERT_DEBUG(( EContainerTypeTag != container), Panic(EGlxPanicIllegalState)); + if( EContainerTypeNotAContainer == container ) + { + CMdEObject* rightObject = iSession->GetObjectL(rightId); + __ASSERT_DEBUG(rightObject, Panic(EGlxPanicIllegalState)); + TContainerType rightContainer = ContainerType(rightObject); + delete rightObject; + __ASSERT_DEBUG(( EContainerTypeAlbum != rightContainer), Panic(EGlxPanicIllegalState)); + if( EContainerTypeTag == rightContainer ) + { + id = leftId; + containerId = rightId; + containerCategory = EMPXTag; + } + else if( EContainerTypeNotAContainer == rightContainer ) + { + User::Leave(KErrNotSupported); // Not a gallery relation. + } + } + else if( EContainerTypeAlbum == container) + { + id = rightId; + containerId = leftId; + containerCategory = EMPXAlbum; + } + message->SetTObjectValueL(KGlxCollectionMessageContainerCategory, containerCategory); + message->SetTObjectValueL(KGlxCollectionMessageContainerId, containerId); + } + else + { + // use id 0 to identify to ML that we don't know what was deleted + id = 0; + } + } + + if ( id != 0 ) + { + CMdEObject* object = iSession->GetObjectL(id); + if( object ) + { + TContainerType container = ContainerType(object); + if( EContainerTypeAlbum == container) + { + category = EMPXAlbum; + } + else if( EContainerTypeTag == container) + { + category = EMPXTag; + } + else + { + TItemType item = ItemType(object); + if( EItemTypeImage == item) + { + category = EMPXImage; + } + else if( EItemTypeVideo == item) + { + category = EMPXVideo; + } + } + delete object; + } + } +#endif // __USING_INTELLIGENT_UPDATE_FILTERING + message->SetTObjectValueL(KMPXMessageMediaGeneralCategory, category); + message->SetTObjectValueL(KMPXMessageMediaGeneralId, id); + BroadcastMessage(*message); + CleanupStack::PopAndDestroy(message); + iUpdateData.Remove(0); + } + +CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObject* aObject) + { + GLX_LOG_ENTRY_EXIT("TContainerType CGlxDataSourceMde::ContainerType()"); + TContainerType containerType = EContainerTypeNotAContainer; + + if( 0 == aObject->Def().Compare(*iAlbumDef) ) + { + containerType = EContainerTypeAlbum; + } + else if( 0 == aObject->Def().Compare(*iTagDef) ) + { + containerType = EContainerTypeTag; + } + else if( 0 == aObject->Def().Compare(*iMonthDef) ) + { + containerType = EContainerTypeMonth; + } + + return containerType; + } + +CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObjectDef* aObjectDef) + { + GLX_LOG_ENTRY_EXIT("TContainerType CGlxDataSourceMde::ContainerType()"); + TContainerType containerType = EContainerTypeNotAContainer; + + if( 0 == aObjectDef->Compare(*iAlbumDef) ) + { + containerType = EContainerTypeAlbum; + } + else if( 0 == aObjectDef->Compare(*iTagDef) ) + { + containerType = EContainerTypeTag; + } + else if( 0 == aObjectDef->Compare(*iMonthDef) ) + { + containerType = EContainerTypeMonth; + } + + return containerType; + } +CGlxDataSource::TItemType CGlxDataSourceMde::ItemType(CMdEObject* aObject) + { + GLX_LOG_ENTRY_EXIT("TItemType CGlxDataSourceMde::ItemType()"); + TItemType itemType = EItemTypeNotAnItem; + + if( 0 == aObject->Def().Compare(*iImageDef) ) + { + itemType = EItemTypeImage; + } + else if(0 == aObject->Def().Compare(*iVideoDef) ) + { + itemType = EItemTypeVideo; + } + + return itemType; + } +void CGlxDataSourceMde::PrepareMonthsL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::PrepareMonthsL()"); + TTime month(0); + iFirstMonth = month; + } +const TGlxMediaId CGlxDataSourceMde::GetMonthIdL(const TTime& aMonth) + { + GLX_LOG_ENTRY_EXIT("TGlxMediaId CGlxDataSourceMde::GetMonthIdL()"); + TTime monthStart = iFirstMonth + aMonth.MonthsFrom(iFirstMonth); + const TTimeIntervalMonths KGlxOneMonth = 1; + const TTimeIntervalMicroSeconds KGlxOneMicrosecond = 1; + + TGlxMediaId monthId; + TInt monthIndex = iMonthArray.Find(monthStart); + if( monthIndex != KErrNotFound ) + { + monthId = iMonthList[monthIndex]; + } + else + { + _LIT(KGlxMonthTitleFormat, "%F%Y%M%D:"); + const TInt KGlxMonthTitleLength = 12; + TBuf title; + monthStart.FormatL(title, KGlxMonthTitleFormat); + + CMdEObject* month = iSession->GetObjectL(title); + if( month ) + { + monthId = (TGlxMediaId)month->Id(); + iMonthArray.AppendL(monthStart); + iMonthList.AppendL(monthId); + delete month; + } + else + { + TTime monthEnd = monthStart + KGlxOneMonth - KGlxOneMicrosecond; + month = iSession->NewObjectLC(*iMonthDef, title); + + // A title property def of type text is required. + CMdEPropertyDef* titlePropertyDef = iObjectDef->GetPropertyDefL(KPropertyDefNameTitle); + if (!titlePropertyDef || titlePropertyDef->PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + // Set the object title. + month->AddTextPropertyL (*titlePropertyDef, title); + + // A size property is required. + CMdEPropertyDef* sizePropertyDef = iObjectDef->GetPropertyDefL(KPropertyDefNameSize); + if (!sizePropertyDef || sizePropertyDef->PropertyType() != EPropertyUint32) + { + User::Leave(KErrCorrupt); + } + month->AddUint32PropertyL(*sizePropertyDef,0); + + + // A creation date property is required. + CMdEPropertyDef* creationDateDef = iObjectDef->GetPropertyDefL(KPropertyDefNameCreationDate); + if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + month->AddTimePropertyL(*creationDateDef, monthStart); + + // A last modified date property is required. + CMdEPropertyDef* lmDateDef = iObjectDef->GetPropertyDefL(KPropertyDefNameLastModifiedDate); + if (!lmDateDef || lmDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + month->AddTimePropertyL(*lmDateDef, monthEnd); + + monthId = (TGlxMediaId)iSession->AddObjectL(*month); + CleanupStack::PopAndDestroy(month); + iMonthArray.AppendL(monthStart); + iMonthList.AppendL(monthId); + } + } + return monthId; + } +TBool CGlxDataSourceMde::SameMonth(const TTime& aOldDate, const TTime& aNewDate) + { + GLX_LOG_ENTRY_EXIT("TBool CGlxDataSourceMde::SameMonth(const TTime& aOldDate, const TTime& aNewDate)"); + return ( aOldDate.MonthsFrom(iFirstMonth) == aNewDate.MonthsFrom(iFirstMonth) ); + } + +TBool CGlxDataSourceMde::ContainerIsLeft(CMdEObjectDef& aObjectDef) + { + GLX_LOG_ENTRY_EXIT("TBool CGlxDataSourceMde::ContainerIsLeft(CMdEObjectDef& aObjectDef)"); + TBool containerLeft = EFalse; + if ( 0 == aObjectDef.Compare(AlbumDef()) ) + { + containerLeft = ETrue; + } + return containerLeft; + } + +void CGlxDataSourceMde::TaskCompletedL() + { + iPauseUpdate = EFalse; + iUpdateCallback->CallBack(); + } + +void CGlxDataSourceMde::TaskStartedL() + { + iPauseUpdate = ETrue; + } + +#ifdef USE_S60_TNM +void CGlxDataSourceMde::FetchThumbnailL(CGlxRequest* aRequest, MThumbnailFetchRequestObserver& aObserver) + { + iTnFetchObserver = &aObserver; + + CGlxThumbnailRequest* request = static_cast(aRequest); + + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); + User::LeaveIfNull(request->ThumbnailInfo()); + + iTnHandle = tnReq.iBitmapHandle; + iMediaId = tnReq.iId; + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(request->ThumbnailInfo()->FilePath()); + iTnEngine->SetThumbnailSizeL(tnReq.iSizeClass); + + if (tnReq.iSizeClass.iWidth < KMaxGridThumbnailWidth) + { + iTnEngine->SetFlagsL(CThumbnailManager::ECropToAspectRatio); + } + + iTnThumbnailCbId = iTnEngine->GetThumbnailL(*source); + iTnRequestInProgress = ETrue; + CleanupStack::PopAndDestroy(); + } + +TInt CGlxDataSourceMde::CancelFetchThumbnail() + { + TInt ret = KErrNone; + if (iTnRequestInProgress) + { + ret = iTnEngine->CancelRequest(iTnThumbnailCbId); + } + return ret; + } + +void CGlxDataSourceMde::ThumbnailPreviewReady(MThumbnailData& /*aThumbnail*/, + TThumbnailRequestId /*aId*/) + { + TRACER("CGlxDataSourceMde::ThumbnailPreviewReady"); + } + +// Called when real thumbnail is created +void CGlxDataSourceMde::ThumbnailReady(TInt aError, + MThumbnailData& aThumbnail, TThumbnailRequestId aId) + { + TRACER("CGlxDataSourceMde::ThumbnailReady"); + GLX_LOG_INFO1("GlxDataSourceMde::ThumbnailReady aError=%d", aError); + ThumbnailReadyL(aError, + aThumbnail, aId); + } +// --------------------------------------------------------------------------- +// ThumbnailReadyL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::ThumbnailReadyL(TInt aError, + MThumbnailData& aThumbnail, TThumbnailRequestId aId) + { + TRACER("CGlxDataSourceMde::ThumbnailReadyL") + if (iTnThumbnailCbId == aId) + { + iTnRequestInProgress = EFalse; + + if (aError == KErrNone && iTnHandle) + { + if (iTnHandle == KGlxMessageIdBackgroundThumbnail) + { + BackgroundThumbnailMessageL(iMediaId, TSize(), aError); + } + else + { + delete iTnThumbnail; + iTnThumbnail = NULL; + iTnThumbnail = aThumbnail.DetachBitmap(); + + delete iThumbnail; + iThumbnail = NULL; + iThumbnail = new (ELeave) CFbsBitmap(); + User::LeaveIfError( iThumbnail->Duplicate(iTnHandle)); + User::LeaveIfError(iThumbnail->Resize(iTnThumbnail->SizeInPixels())); + CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iThumbnail); + CleanupStack::PushL(device ); + CFbsBitGc* context = NULL; + User::LeaveIfError(device->CreateContext(context)); + CleanupStack::PushL(context); + context->BitBlt( TPoint(), iTnThumbnail); + CleanupStack::PopAndDestroy(context); + CleanupStack::PopAndDestroy(device); + + iTnHandle = KErrNone; + } + } + } + if (iTnFetchObserver) + { + iTnFetchObserver->ThumbnailFetchComplete(aError); + } + + } +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemdeproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemdeproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Standard proxy of the ECOM plugin +* +*/ + + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + +#include +#include "glxdatasourcemde.h" +#include "glxdatasourcemde.hrh" + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(KGlxDataSourceMdeImplementationUid, + CGlxDataSourceMde::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmde.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmde.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,668 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The glx data source task MDE class. +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + * @internal reviewed 24/07/2007 by K Hoikka, SCO 403-8472 removal of all view + */ + + +#include "glxdatasourcetaskmde.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcemde.h" +#include "glxdatasourcemde.hrh" + +// CONSTANTS +_LIT(KPropertyDefNameCreationDate, "CreationDate"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameTitle, "Title"); +_LIT(KPropertyDefNameDRM, "DRM"); +_LIT(KPropertyDefNameUsageCount, "UsageCount"); +_LIT(KPropertyDefNameFrameCount, "FrameCount"); +_LIT(KPropertyDefNameOrigin, "Origin"); + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMde:: CGlxDataSourceTaskMde(CGlxRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : CGlxDataSourceTask(aRequest, aObserver, aDataSource) + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMde::CGlxDataSourceTaskMde()"); + // No implementation required + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde()"); + DestroyQueries(); + } + +// ---------------------------------------------------------------------------- +// Second stage constructor +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::ConstructL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::ConstructL()"); + CreateResponseL(); +#ifdef USE_S60_TNM + DataSource()->CancelFetchThumbnail(); +#else + DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); +#endif + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::CancelRequest +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::CancelRequest() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::CancelRequest()"); + DestroyQueries(); + iCancelled = ETrue; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryNewResults +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, + TInt /*aNewItemCount*/ ) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryNewResults()"); + // Not used. + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryNewResults +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aNewObjectItemCount*/, + TInt /*aNewRelationItemCount*/, + TInt /*aNewEventItemCount*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryNewResults()"); + // Not used. + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryCompleted +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryCompleted()"); + __ASSERT_ALWAYS(&aQuery == iQueries[0], Panic(EGlxPanicQueryLogicError)); + + TInt err = aError; + if (err == KErrNone) + { + TRAP(err, HandleQueryCompletedL(aQuery)); + } + + if (err != KErrNone) + { + HandleRequestComplete(err); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DataSource +// ---------------------------------------------------------------------------- +// +CGlxDataSourceMde* CGlxDataSourceTaskMde::DataSource() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde* CGlxDataSourceTaskMde::DataSource()"); + return static_cast(iDataSource); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AddMonthFilterL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::AddMonthFilterL()"); + CMdEObject* month = DataSource()->Session().GetObjectL(aContainerId.Value()); + if( !month ) + { + User::Leave(KErrNotFound); + } + CleanupStack::PushL(month); + + AddMonthFilterL(month, aFilterProperties); + + CleanupStack::PopAndDestroy(month); + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AddMonthFilterL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::AddMonthFilterL()"); + CMdEPropertyDef* creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); + if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + CMdEPropertyDef* lmDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameLastModifiedDate); + if (!lmDateDef || lmDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + CMdEProperty* startDate; + TInt startDateIndex = aMonth->Property(*creationDateDef, startDate); + if( KErrNotFound == startDateIndex) + { + User::Leave(KErrCorrupt); + } + aFilterProperties.iStartDate = static_cast(startDate)->Value(); + + CMdEProperty* endDate; + TInt endDateIndex = aMonth->Property(*lmDateDef, endDate); + if( KErrNotFound == endDateIndex) + { + User::Leave(KErrCorrupt); + } + aFilterProperties.iEndDate = static_cast(endDate)->Value(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::SetQueryConditionsL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::SetQueryConditionsL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties, const TGlxMediaId aContainerId, CMdEObjectDef& aObjectDef) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::SetQueryConditionsL()"); + CMdELogicCondition& rootCondition = aQuery.Conditions(); + CMdEObjectDef* objectDef = &aObjectDef; + + SetQueryFilterConditionsL(rootCondition, *objectDef, aFilterProperties); + SetSortOrderL(aQuery, aObjectDef, aFilterProperties); + + if( KGlxCollectionRootId != aContainerId.Value() ) + { + CMdELogicCondition* containerCondition = NULL; + CMdERelationCondition* relationCondition = NULL; + objectDef = &DataSource()->ObjectDef(); + if( DataSource()->ContainerIsLeft(aObjectDef) ) + { + relationCondition = &rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); + containerCondition = &relationCondition->LeftL(); + } + else + { + relationCondition = &rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); + containerCondition = &relationCondition->RightL(); + } + containerCondition->AddObjectConditionL(aContainerId.Value()); + } + + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::SetQueryFilterConditionsL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::SetQueryFilterConditionsL(CMdELogicCondition& + aLogicCondition, CMdEObjectDef& aObjectDef, + const TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::SetQueryFilterConditionsL()"); + + if( aFilterProperties.iUri ) + { + aLogicCondition.AddObjectConditionL(EObjectConditionCompareUri, + *aFilterProperties.iUri); + } + + if( 0 == aObjectDef.Compare(DataSource()->ObjectDef()) ) + { + // Filter on content type + if ( EGlxFilterVideoAndImages == aFilterProperties.iItemType ) + { + CMdELogicCondition& logicCondition = + aLogicCondition.AddLogicConditionL(ELogicConditionOperatorOr); + logicCondition.AddObjectConditionL( DataSource()->ImageDef() ); + logicCondition.AddObjectConditionL( DataSource()->VideoDef() ); + } + } + + if( ( aFilterProperties.iMinCount > 0 ) && ( CGlxDataSource::EContainerTypeNotAContainer != DataSource()->ContainerType(&aObjectDef) ) ) + { + CMdEPropertyDef* itemCountProperty = + aObjectDef.GetPropertyDefL(KPropertyDefNameUsageCount); + aLogicCondition.AddPropertyConditionL(*itemCountProperty, + TMdEIntGreaterEqual(aFilterProperties.iMinCount)); + } + + if( 0 != aFilterProperties.iContainsItem.Value() ) + { + + if( DataSource()->ContainerIsLeft(aObjectDef) ) + { + CMdERelationCondition& relationCondition = + aLogicCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); + relationCondition.RightL().AddObjectConditionL(aFilterProperties.iContainsItem.Value()); + } + else + { + CMdERelationCondition& relationCondition = aLogicCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); + relationCondition.LeftL().AddObjectConditionL(aFilterProperties.iContainsItem.Value()); + } + } + + if( EGlxFilterOriginNotUsed != aFilterProperties.iOrigin ) + { + CMdEPropertyDef* originProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameOrigin); + if(originProperty) + { + if( EGlxFilterOriginDownload == aFilterProperties.iOrigin ) + { +#ifdef GLX_NO_ALL_VIEW + // The download collection shows all but captured items + aLogicCondition.AddPropertyConditionL(*originProperty, TMdEUintNotEqual(MdeConstants::Object::ECamera)); +#else + // The download collection shows only downloaded items + aLogicCondition.AddPropertyConditionL(*originProperty, TMdEUintEqual(MdeConstants::Object::EDownloaded)); +#endif + } + } + } + + 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); + if( frameCountProperty ) + { + 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); + if( drmProperty ) + { + aLogicCondition.AddPropertyConditionL(*drmProperty, EFalse); + } + } + + if( aFilterProperties.iPath ) // If this is set. Then we need to filter on the Ids it supplies + { + TArray selection = aFilterProperties.iPath->Selection(); + TInt selectionCount = selection.Count(); + RArray itemList; + CleanupClosePushL(itemList); + GLX_DEBUG2("Reading Ids from Path, count = %d", selectionCount); + if( selectionCount ) + { + for( TInt i = 0; i < selectionCount; i++ ) + { + const TMPXItemId& itemId = aFilterProperties.iPath->IdOfIndex(selection[i]); + itemList.AppendL(itemId); + } + aLogicCondition.AddObjectConditionL(itemList); + } + CleanupStack::Pop(&itemList); + } + + if( !aFilterProperties.iIncludeCameraAlbum ) + { + CMdEObjectCondition& objectCondition = aLogicCondition.AddObjectConditionL(DataSource()->CameraAlbumId().Value()); + objectCondition.SetNegate(ETrue); + } + + if( TTime(0) != aFilterProperties.iStartDate ) + { + CMdEPropertyDef* creationDateDef = aObjectDef.GetPropertyDefL(KPropertyDefNameCreationDate); + if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + aLogicCondition.AddPropertyConditionL(*creationDateDef, TMdETimeBetween(aFilterProperties.iStartDate, aFilterProperties.iEndDate)); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::SetSortOrderL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::SetSortOrderL(CMdEQuery& aQuery, CMdEObjectDef& aObjectDef, + const TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::SetSortOrderL()"); + switch(aFilterProperties.iSortOrder) + { + case EGlxFilterSortOrderAlphabetical: + { + CMdEPropertyDef* titleProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameTitle); + TMdEOrderRule orderRule(*titleProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + orderRule.SetType(EOrderRuleTypeProperty); + orderRule.SetCaseSensitive(EFalse); + aQuery.AppendOrderRuleL(orderRule); + break; + } + case EGlxFilterSortOrderItemCount: + { + CMdEPropertyDef* itemCountProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameUsageCount); + TMdEOrderRule orderRule(*itemCountProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + orderRule.SetType(EOrderRuleTypeProperty); + aQuery.AppendOrderRuleL(orderRule); + break; + } + case EGlxFilterSortOrderCaptureDate: + { + CMdEPropertyDef* creationDateProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameCreationDate); + TMdEOrderRule orderRule(*creationDateProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + orderRule.SetType(EOrderRuleTypeProperty); + aQuery.AppendOrderRuleL(orderRule); + TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + aQuery.AppendOrderRuleL(orderRule2); + break; + } + case EGlxFilterSortOrderModifiedDate: + { + CMdEPropertyDef* modifiedDateProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameLastModifiedDate); + TMdEOrderRule orderRule(*modifiedDateProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + orderRule.SetType(EOrderRuleTypeProperty); + aQuery.AppendOrderRuleL(orderRule); + TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); + aQuery.AppendOrderRuleL(orderRule2); + break; + } + case EGlxFilterSortOrderNotUsed: + { + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::MaxQueryResultsCount +// ---------------------------------------------------------------------------- +// +TInt CGlxDataSourceTaskMde::MaxQueryResultsCount(const TGlxFilterProperties& aFilterProperties) const + { + GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceTaskMde::MaxQueryResultsCount()"); + TInt ret = KMdEQueryDefaultMaxCount; + if (aFilterProperties.iLastCaptureDate) + { + ret = 1; + } + return ret; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::RemoveQuery +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::RemoveQuery() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::RemoveQuery()"); + CMdEQuery* query = iQueries[0]; + iQueryTypes.Remove(0); + iQueries.Remove(0); + query->RemoveObserver(*this); + delete query; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::DoQueryL(CMdEObjectDef& aObjectDef, + TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, + const TGlxMediaId& aContainerId) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::DoQueryL()"); + + CMdEObjectDef* queryBaseObject = &aObjectDef; + if( aIsContent ) + { + switch(iFilterProperties.iItemType) + { + case EGlxFilterImage: + { + queryBaseObject = &DataSource()->ImageDef(); + break; + } + case EGlxFilterVideo: + { + queryBaseObject = &DataSource()->VideoDef(); + break; + } + default: + { + queryBaseObject = &DataSource()->ObjectDef(); + break; + } + } + } + + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *queryBaseObject, this); + CleanupStack::PushL(query); + + SetQueryConditionsL(*query, iFilterProperties, aContainerId, aObjectDef); + query->SetResultMode(aResultMode); + + CleanupStack::Pop(query); + + AppendQueryL(query, aQueryType); + + query->FindL(MaxQueryResultsCount(iFilterProperties)); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueImageVideoObjectQueriesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL(const RArray& aObjectIds, + const TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL()"); + if (aFilterProperties.iItemType == EGlxFilterImage) + { + // Only perform the image query + QueueObjectQueryL(DataSource()->ImageDef(), aObjectIds, EImageVideoQuery); + } + else if (aFilterProperties.iItemType == EGlxFilterVideo) + { + // Only perform the video query + QueueObjectQueryL(DataSource()->VideoDef(), aObjectIds, EImageVideoQuery); + } + else + { + QueueObjectQueryL(DataSource()->ImageDef(), aObjectIds, EImageVideoQuery); + QueueObjectQueryL(DataSource()->VideoDef(), aObjectIds, EImageVideoQuery); + // Perform both the image and video queries + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueTagObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueTagObjectQueryL(const RArray& aObjectIds) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueTagObjectQueryL()"); + QueueObjectQueryL(DataSource()->TagDef(), aObjectIds, EImageVideoQuery); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueAlbumObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueAlbumObjectQueryL(const RArray& aObjectIds) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueAlbumObjectQueryL()"); + QueueObjectQueryL(DataSource()->AlbumDef(), aObjectIds, EImageVideoQuery); + } + + +void CGlxDataSourceTaskMde::QueueMonthObjectQueryL(const RArray& aObjectIds) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueMonthObjectQueryL()"); + QueueObjectQueryL(DataSource()->MonthDef(), aObjectIds, EImageVideoQuery); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueObjectQueryL(CMdEObjectDef& aObjectDef, + const RArray& aObjectIds, const TGlxQueryType& aQueryType) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueObjectQueryL()"); + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), aObjectDef, this); + CleanupStack::PushL(query); + + CMdELogicCondition& lc = query->Conditions(); + lc.AddObjectConditionL(aObjectIds); + + query->SetResultMode(EQueryResultModeObjectWithoutFreetexts); + + CleanupStack::Pop(query); + AppendQueryL(query, aQueryType); + + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AppendQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::AppendQueryL(CMdEQuery* aQuery, const TGlxQueryType& aQueryType) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::AppendQueryL()"); + CleanupStack::PushL(aQuery); + + TInt err = iQueryTypes.Append(aQueryType); + + if (KErrNone == err) + { + iQueries.AppendL(aQuery); + CleanupStack::Pop(aQuery); + } + else + { + User::Leave(err); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::ExecuteQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::ExecuteQueryL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::ExecuteQueryL()"); + __ASSERT_DEBUG(iQueries.Count(), Panic(EGlxPanicQueryLogicError)); + iQueries[0]->FindL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryCompletedL(CMdEQuery& aQuery) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryCompletedL()"); + DoHandleQueryCompletedL(aQuery); + RemoveQuery(); + DoNextQueryL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DestroyQueries +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::DestroyQueries() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::DestroyQueries()"); + for (TInt i = 0; i < iQueries.Count(); i++) + { + // Ensure that there are not any running queries + iQueries[i]->RemoveObserver(*this); + iQueries[i]->Cancel(); + } + iQueries.ResetAndDestroy(); + iQueryTypes.Close(); + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeattribute.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeattribute.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1278 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: data source task mde attribute souce file +* +*/ + + + + +#include "glxdatasourcetaskmdeattribute.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcemde.h" +#include "glxdatasourcemde.h" +#include "glxdatasourcemde.hrh" + +// CONSTANTS + +_LIT(KPropertyDefNameAlbumType, "Type"); +_LIT(KPropertyDefNameComment, "Comment"); +_LIT(KPropertyDefNameCreationDate, "CreationDate"); +_LIT(KPropertyDefNameDRM, "DRM"); +_LIT(KPropertyDefNameDuration, "Duration"); +_LIT(KPropertyDefNameFrameCount, "FrameCount"); +_LIT(KPropertyDefNameHeight, "Height"); +_LIT(KPropertyDefNameItemType, "ItemType"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameLatitude, "Latitude"); +_LIT(KPropertyDefNameLongitude, "Longitude"); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KPropertyDefNameTitle, "Title"); +_LIT(KPropertyDefNameUsageCount, "UsageCount"); +_LIT(KPropertyDefNameWidth, "Width"); + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeAttribute::CGlxDataSourceTaskMdeAttribute(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeAttribute::CGlxDataSourceTaskMdeAttribute()"); + iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeAttribute::~CGlxDataSourceTaskMdeAttribute() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeAttribute::~CGlxDataSourceTaskMdeAttribute()"); + delete iMediaArray; + iQueryAttributes.Close(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::ExecuteRequestL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::ExecuteRequestL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::ExecuteRequestL()"); + CGlxGetRequest* request = static_cast(iRequest); + + __ASSERT_DEBUG(request->MediaIds().Count() > 0, User::Invariant()); + + if (request->MediaIds().Count() > 1) + { + iMediaArray = CMPXMediaArray::NewL(); + } + + if (request->MediaIds()[0] == KGlxCollectionRootId) + { + __ASSERT_DEBUG(request->MediaIds().Count() == 1, User::Invariant()); + AddCollectionAttributesL(iResponse); + } + else + { + + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + const RArray& mediaIds = reinterpret_cast&>(request->MediaIds()); + + switch(iFilterProperties.iItemType) + { + case EGlxFilterVideoAndImages: + case EGlxFilterImage: + case EGlxFilterVideo: + { + QueueImageVideoObjectQueriesL(mediaIds, iFilterProperties); + if (LocationAttributeRequested()) + { + QueueLocaitonQueryL(); + } + break; + } + case EGlxFilterAlbum: + { + QueueAlbumObjectQueryL(mediaIds); + break; + } + case EGlxFilterTag: + { + QueueTagObjectQueryL(mediaIds); + break; + } + case EGlxFilterMonth: + { + QueueMonthObjectQueryL(mediaIds); + break; + } + } + + } + + DoNextQueryL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoHandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleQueryCompletedL()"); + switch (iQueryTypes[0]) + { + case ELocationAttributeQuery: + DoHandleLocationQueryCompletedL(); + break; + case EAttributeQuery: + DoHandleAttributeQueryCompletedL(); + break; + case EImageVideoQuery: + DoHandleImageVideoQueryCompletedL(); + break; + case EContainerFirstItemQuery: + // Fall through to panic, DoHandleQueryCompletedL can't handle this query type. + default: + Panic(EGlxPanicLogicError); + break; + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoNextQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::DoNextQueryL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoNextQueryL()"); + if (iQueries.Count()) + { + ExecuteQueryL(); + } + else + { + DoHandleAttributeResponseCompleteL(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL()"); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + if(request->MediaIds().Count() > 1) + { + iResponse->SetCObjectValueL(KMPXMediaArrayContents, iMediaArray); + iResponse->SetTObjectValueL(KMPXMediaArrayCount, iMediaArray->Count()); + delete iMediaArray; + iMediaArray = NULL; + } + HandleRequestComplete(KErrNone); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddAttributesLC +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry)"); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + + CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(&aObject); + if( containerType != CGlxDataSource::EContainerTypeNotAContainer ) + { + AddContainerAttributesL(aEntry, &aObject, containerType); + } + else + { + CGlxDataSource::TItemType itemType = DataSource()->ItemType(&aObject); + if ( itemType != CGlxDataSource::EItemTypeNotAnItem ) + { + AddItemAttributesL(aEntry, &aObject, itemType); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL(CMPXMedia* aEntry) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL(CMPXMedia* aEntry)"); + __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + for ( TInt i = 0; i < request->Attributes().Count(); i++ ) + { + if ( request->Attributes()[i] == KMPXMediaGeneralId ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralId, (TMPXItemId)request->CollectionPluginUid().iUid); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXNoType); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXCollection); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) + { + request->AppendCpiAttributeL(KMPXMediaGeneralTitle); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + } + + + #ifdef GLX_SUB_TITLE_REL8 + + //Attributes to get the Count of Images in Container + else if ( request->Attributes()[i] == KGlxMediaItemTypeImage ) + { + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + TGlxFilterProperties filterProperties = iFilterProperties; + + switch(iRequest->CollectionPluginUid().iUid) + { + case KGlxCollectionPluginCameraImplementationUid: + { + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + filterProperties.iItemType = EGlxFilterImage; + QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); + break; + } + default: + { + break; + } + } + } + + + //Attributes to get the Count of Videos in Container + else if ( request->Attributes()[i] == KGlxMediaItemTypeVideo ) + { + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + TGlxFilterProperties filterProperties = iFilterProperties; + + switch(iRequest->CollectionPluginUid().iUid) + { + case KGlxCollectionPluginCameraImplementationUid: + { + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + filterProperties.iItemType = EGlxFilterVideo; + QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); + break; + } + default: + { + break; + } + } + } + +#endif + + + else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) + { + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + TGlxFilterProperties filterProperties = iFilterProperties; + + switch(iRequest->CollectionPluginUid().iUid) + { + + case KGlxCollectionPluginAlbumsImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxCollectionPluginCameraImplementationUid: + { + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxTagCollectionPluginImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->TagDef(); + break; + } + case KGlxCollectionPluginMonthsImplementationUid: + { + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + break; + } + default: + { + // default gallery query returns all objects as per filter + break; + } + } + QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); + } + else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) + { + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); + } + else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) + { + TGlxFilterProperties filterProperties = iFilterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeObjectWithoutFreetexts, DataSource()->CameraAlbumId(), KGlxMediaCollectionInternalStartDate, aEntry, filterProperties); + } + else if ( request->Attributes()[i] == KGlxMediaCollectionInternalEndDate ) + { + // not necessary to be requested, returned when StartDate requested + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSlideshowableContent, 0); + } + else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) + { + // collection itself is not protected + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL()"); + __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(aContainer, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + /// @todo 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXGroup); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) + { + if( CGlxDataSource::EContainerTypeAlbum == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXAlbum); + } + else if( CGlxDataSource::EContainerTypeTag == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXTag); + } + else if( CGlxDataSource::EContainerTypeMonth == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXMonth); + } + else + { + User::Leave(KErrNotSupported); + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralUri ) + { + aEntry->SetTextValueL(KMPXMediaGeneralUri, aContainer->Uri()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) + { + CMdEProperty* title; + CMdEPropertyDef* titleProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameTitle); + TInt titleIndex = aContainer->Property(*titleProperty, title); + if(titleIndex == KErrNotFound) + { + TParsePtrC parser(aContainer->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name()); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast(title)->Value()); + } + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + { + CMdEProperty* albumType; + CMdEPropertyDef* albumTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameAlbumType); + TInt albumTypeIndex = aContainer->Property(*albumTypeProperty, albumType); + if( KErrNotFound != albumTypeIndex ) + { + TUint16 albumTypeValue = static_cast(albumType)->Value(); + if ( albumTypeValue != MdeConstants::Album::EAlbumUser ) + { + request->AppendCpiAttributeL(KMPXMediaGeneralTitle); + aEntry->SetTObjectValueL(KGlxMediaCollectionInternalSystemItemType, albumTypeValue); + } + } + break; + } + case CGlxDataSource::EContainerTypeTag: + { + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + request->AppendCpiAttributeL(KMPXMediaGeneralTitle); + CMdEProperty* time; + 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()); + break; + } + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) + { + CMdEProperty* size; + CMdEPropertyDef* sizeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameSize); + TInt sizeIndex = aContainer->Property(*sizeProperty, size); + TInt sizeValue; + if(sizeIndex == KErrNotFound) + { + sizeValue = 0; + } + else + { + sizeValue = static_cast(size)->Value(); + } + aEntry->SetTObjectValueL(KMPXMediaGeneralSize, sizeValue); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDrive ) + { + TParsePtrC parser(aContainer->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralDrive, parser.Drive()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) + { + CMdEProperty* mimeType; + CMdEPropertyDef* mimeTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameItemType); + TInt mimeTypeIndex = aContainer->Property(*mimeTypeProperty, mimeType); + if( KErrNotFound == mimeTypeIndex) + { + aEntry->SetTextValueL(KMPXMediaGeneralMimeType, KNullDesC); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralMimeType, static_cast(mimeType)->Value()); + } + } + else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) + { + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + case CGlxDataSource::EContainerTypeTag: + { + CMdEProperty* countType; + CMdEPropertyDef* countTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameUsageCount); + TInt countTypeIndex = aContainer->Property(*countTypeProperty, countType); + if( KErrNotFound != countTypeIndex ) + { + TUint count = static_cast(countType)->Value(); + aEntry->SetTObjectValueL(request->Attributes()[i], count); + } + else + { + aEntry->SetTObjectValueL(request->Attributes()[i], 0); + } + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + TGlxFilterProperties filterProperties = iFilterProperties; + AddMonthFilterL(aContainer, filterProperties); + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); + break; + } + } + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem ) + { + TBool systemItem = EFalse; + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + { + CMdEProperty* 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 ) ) + { + systemItem = ETrue; + } + } + break; + } + case CGlxDataSource::EContainerTypeTag: + { + systemItem = EFalse; + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + systemItem = ETrue; + break; + } + } + aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, systemItem); + } + + //Attributes to get the Count of Images in Container + else if ( request->Attributes()[i] == KGlxMediaItemTypeImage ) + { + switch (aType) + { + case CGlxDataSource::EContainerTypeMonth: + { + TGlxFilterProperties filterProperties = iFilterProperties; + AddMonthFilterL(aContainer, filterProperties); + filterProperties.iItemType = EGlxFilterImage; + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); + break; + } + default: + { + break; + } + } + } + + // Attributes to get the Count of Videos in Container + + else if ( request->Attributes()[i] == KGlxMediaItemTypeVideo ) + { + switch (aType) + { + case CGlxDataSource::EContainerTypeMonth: + { + TGlxFilterProperties filterProperties = iFilterProperties; + AddMonthFilterL(aContainer, filterProperties); + filterProperties.iItemType = EGlxFilterVideo; + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); + break; + } + default: + { + break; + } + } + } + + else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) + { + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); + } + else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) + { + // nothing returned for container but is valid for CPI to request + } + else if ( request->Attributes()[i] == KGlxMediaCollectionInternalEndDate ) + { + // nothing returned for container but is valid for CPI to request + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) + { + // return zero size for container (thumbnail only used in preview list) + aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(0,0)); + } + else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) + { + // container itself is not protected + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralFramecount ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) + { + TGlxFilterProperties filterProperties = iFilterProperties; + filterProperties.iItemType = EGlxFilterImage; + filterProperties.iNoDRM = ETrue; + filterProperties.iExcludeAnimation = ETrue; + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + case CGlxDataSource::EContainerTypeTag: + { + QueueObjectQueryL(aContainer->Def(), ETrue, EAttributeQuery, EQueryResultModeCount, TGlxMediaId(aContainer->Id()), request->Attributes()[i], aEntry, filterProperties); + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + AddMonthFilterL(aContainer, filterProperties); + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); + break; + } + } + } + else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) + { + TSize dimensions(0,0); + + aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, dimensions); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddItemAttributesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType)"); + __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(aItem, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + /// @todo 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) + { + if( CGlxDataSource::EItemTypeImage == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + } + else if( CGlxDataSource::EItemTypeVideo == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + } + else + { + User::Leave(KErrNotSupported); + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralUri ) + { + aEntry->SetTextValueL(KMPXMediaGeneralUri, aItem->Uri()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) + { + CMdEProperty* title; + CMdEPropertyDef* titleProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameTitle); + TInt titleIndex = aItem->Property(*titleProperty, title); + if( KErrNotFound == titleIndex ) + { + TParsePtrC parser(aItem->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name()); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast(title)->Value()); + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) + { + CMdEProperty* size; + CMdEPropertyDef* sizeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameSize); + TInt sizeIndex = aItem->Property(*sizeProperty, size); + User::LeaveIfError(sizeIndex); + + aEntry->SetTObjectValueL(KMPXMediaGeneralSize, static_cast(size)->Value()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDrive ) + { + TParsePtrC parser(aItem->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralDrive, parser.Drive()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) + { + CMdEProperty* mimeType; + CMdEPropertyDef* mimeTypeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameItemType); + TInt mimeTypeIndex = aItem->Property(*mimeTypeProperty, mimeType); + + User::LeaveIfError(mimeTypeIndex); + aEntry->SetTextValueL(KMPXMediaGeneralMimeType, static_cast(mimeType)->Value()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDuration ) + { + if( CGlxDataSource::EItemTypeImage == aType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, 0); + } + else + { + CMdEProperty* duration; + CMdEPropertyDef* durationProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDuration); + TInt durationIndex = aItem->Property(*durationProperty, duration); + User::LeaveIfError(durationIndex); + + aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, static_cast(duration)->Value()); + } + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) + { + TSize dimensions(0,0); + + CMdEProperty* xDim; + CMdEPropertyDef* xDimProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameWidth); + TInt xDimIndex = aItem->Property(*xDimProperty, xDim); + if( KErrNotFound == xDimIndex ) + { + //User::Leave(KErrCorrupt); + } + else + { + dimensions.iWidth = static_cast(xDim)->Value(); + } + + CMdEProperty* yDim; + CMdEPropertyDef* yDimProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameHeight); + TInt yDimIndex = aItem->Property(*yDimProperty, yDim); + if( KErrNotFound == yDimIndex ) + { + //User::Leave(KErrCorrupt); + } + else + { + dimensions.iHeight = static_cast(yDim)->Value(); + } + if ( ( dimensions.iWidth == 0 ) || ( dimensions.iHeight == 0 ) ) + { + if( CGlxDataSource::EItemTypeImage == aType) + { + // EXIF header is corrupt, must read size from file. + CImageDecoder* decoder = NULL; + + TRAPD(err, decoder = CImageDecoder::FileNewL( DataSource()->FileServerSession(), aItem->Uri(), CImageDecoder::EOptionNone )); + if (err == KErrNone) + { + dimensions = decoder->FrameInfo().iOverallSizeInPixels; + } + delete decoder; + } + } + + aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, dimensions); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralFramecount ) + { + CMdEProperty* framecount; + TInt fcount = 1; + CMdEPropertyDef* framecountProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameFrameCount); + if( framecountProperty ) + { + TInt framecountIndex = aItem->Property(*framecountProperty, framecount); + if( KErrNotFound != framecountIndex ) + { + fcount = static_cast(framecount)->Value(); + } + } + aEntry->SetTObjectValueL(KGlxMediaGeneralFramecount, fcount); + } + 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 + TInt commentIndex = aItem->Property(*commentProperty, comment); + if( KErrNotFound == commentIndex) + { + aEntry->SetTextValueL(KMPXMediaGeneralComment, KNullDesC); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralComment, static_cast(comment)->Value()); + } + } + else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) + { + CMdEProperty* drmProtected; + CMdEPropertyDef* drmProtectedProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDRM); + TInt drmProtectedIndex = aItem->Property(*drmProtectedProperty, drmProtected); + if( KErrNotFound == drmProtectedIndex) + { + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + } + else + { + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, static_cast(drmProtected)->Value()); + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCount ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCount, 1); + } + else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) + { + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSlideshowableContent, -1); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralLocation) + { + // Set the attribute to a TCoordinate initialised to NaN. + aEntry->SetTObjectValueL(KGlxMediaGeneralLocation, TCoordinate()); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AddLocationAttributeToMediaL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId)"); + 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); + TInt longitudeIndex = location->Property(*longitudePropertyDef, longitude); + CMdEProperty* latitude = NULL; + 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()); + aMedia.SetTObjectValueL(KGlxMediaGeneralLocation, coordinate); + } + + CleanupStack::PopAndDestroy(location); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL()"); + __ASSERT_DEBUG(iQueryAttributes.Count(), Panic(EGlxPanicIllegalState)); + CMdEQuery* query = iQueries[0]; + + if( EQueryResultModeObjectWithoutFreetexts == query->ResultMode() ) + { + __ASSERT_DEBUG(( iQueryAttributes[0].iAttribute == KGlxMediaCollectionInternalStartDate ), Panic(EGlxPanicIllegalState)); + CMdEPropertyDef* creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); + if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + TTime startMonth(0); + TTime endMonth(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(); + } + 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()); + } + else + { + Panic(EGlxPanicIllegalState); + } + iQueryAttributes.Remove(0); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoHandleLocationQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::DoHandleLocationQueryCompletedL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleLocationQueryCompletedL()"); + TInt queryResultsCount = iQueries[0]->Count(); + + for (TInt queryResultsPos = 0; queryResultsPos < queryResultsCount; queryResultsPos++) + { + CMdERelation& relation = static_cast(iQueries[0]->ResultItem(queryResultsPos)); + CMPXMedia* targetMedia = NULL; + if (iMediaArray) + { + TInt mediaArrayCount = iMediaArray->Count(); + for (TInt mediaArrayPos = 0; mediaArrayPos < mediaArrayCount; mediaArrayPos++) + { + CMPXMedia* media = (*iMediaArray)[mediaArrayPos]; + TMPXItemId id = media->ValueTObjectL(KMPXMediaGeneralId); + if (id.iId1 == relation.LeftObjectId()) + { + targetMedia = media; + break; + } + } + } + else + { + targetMedia = iResponse; +#ifdef _DEBUG + TMPXItemId id = targetMedia->ValueTObjectL(KMPXMediaGeneralId); + __ASSERT_DEBUG(id.iId1 == relation.LeftObjectId(), Panic(EGlxPanicLogicError)); +#endif + } + + __ASSERT_DEBUG(targetMedia, Panic(EGlxPanicLogicError)); + AddLocationAttributeToMediaL(*targetMedia, relation.RightObjectId()); + + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL()"); + CMdEQuery* query = iQueries[0]; + + TInt queryResultsCount = query->Count(); + + if( ( queryResultsCount == 1 ) && ( !iMediaArray ) ) + { + CMdEObject& object = static_cast(query->ResultItem(0)); + + delete iResponse; + // setiing iResponse to NULL to remove CodeScanner warning + iResponse = NULL; + iResponse = CMPXMedia::NewL(); + AddAttributesL(object, iResponse); + } + else + { + 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::Pop(entry); + AddAttributesL(object, (*iMediaArray)[iMediaArray->Count() - 1]); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL()"); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); + CleanupStack::PushL(query); + + CMdELogicCondition& rootCondition = query->Conditions(); + CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); + CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); + CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); + locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); + locationLogicCondition.SetOperator(ELogicConditionOperatorOr); + itemLogicCondition.SetOperator(ELogicConditionOperatorOr); + + TInt mediaIdCount = request->MediaIds().Count(); + + RArray mediaIdArray; + CleanupClosePushL(mediaIdArray); + + for (TInt i = 0; i < mediaIdCount; i++) + { + mediaIdArray.AppendL(request->MediaIds()[i].Value()); + } + + itemLogicCondition.AddObjectConditionL(mediaIdArray); + CleanupStack::PopAndDestroy(&mediaIdArray); + + query->SetResultMode(EQueryResultModeItem); + + CleanupStack::Pop(query); + AppendQueryL(query, ELocationAttributeQuery); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::ExecuteQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::ExecuteQueryL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::ExecuteQueryL()"); + switch (iQueryTypes[0]) + { + case EAttributeQuery: + { + iQueries[0]->FindL(MaxQueryResultsCount(iQueryAttributes[0].iFilterProperties)); + } + break; + case EImageVideoQuery: // fall through + case ELocationAttributeQuery: + { + iQueries[0]->FindL(); + } + break; + default: + { + Panic(EGlxPanicUnsupportedQueryType); + } + break; + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested +// ---------------------------------------------------------------------------- +// +TBool CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested() + { + GLX_LOG_ENTRY_EXIT("TBool CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested()"); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + TInt attributeArrayCount = request->Attributes().Count(); + for (TInt i = 0; i < attributeArrayCount; i++) + { + if (request->Attributes()[i] == KGlxMediaGeneralLocation) + { + return ETrue; + } + } + return EFalse; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttribute::QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, + TQueryResultMode aResultMode, const TGlxMediaId& aContainerId, TMPXAttribute aAttribute, CMPXMedia* aEntry, + const TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::QueueObjectQueryL()"); + CMdEObjectDef* queryBaseObject = &aObjectDef; + if( aIsContent ) + { + switch(aFilterProperties.iItemType) + { + case EGlxFilterImage: + { + queryBaseObject = &DataSource()->ImageDef(); + break; + } + case EGlxFilterVideo: + { + queryBaseObject = &DataSource()->VideoDef(); + break; + } + default: + { + queryBaseObject = &DataSource()->ObjectDef(); + break; + } + } + } + + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *queryBaseObject, this); + CleanupStack::PushL(query); + SetQueryConditionsL(*query, aFilterProperties, aContainerId, aObjectDef); + query->SetResultMode(aResultMode); + + iQueryAttributes.AppendL(TGlxQueryAttribute(aAttribute, aEntry, aFilterProperties)); + + CleanupStack::Pop(query); + + TRAPD(err, AppendQueryL(query,aQueryType)); + + if (err != KErrNone) + { + iQueryAttributes.Remove(iQueryAttributes.Count() - 1); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdecommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdecommand.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1157 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The Data Source Task MDE Command Class +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + + +#include "glxdatasourcetaskmdecommand.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "glxdatasourcemde.h" +#include "glxdatasourcemde.hrh" + +// CONSTANTS +_LIT(KPropertyDefNameDescription, "Comment"); +_LIT(KPropertyDefNameTitle, "Title" ); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KPropertyDefNameCreationDate, "CreationDate"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameAlbumType, "Type"); +_LIT(KPropertyDefItemType, "ItemType"); +// Item type for Album +_LIT( KAlbumItemType, "application/vnd.nokia.mde.album" ); +// Item type for Tag +_LIT( KTagItemType, "application/vnd.nokia.mde.tag" ); + +const TInt KDriveLetterLength = 1; +_LIT(KColonBackslash, ":\\"); +_LIT(KFileNameFormatString, "(%+02u)"); + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand()"); + iLeftIds.Close(); + iRightIds.Close(); + delete iTitle; + delete iObjectToRename; + } + + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand( + CGlxCommandRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, + CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand()"); + // No implementation required + } + +// ---------------------------------------------------------------------------- +// Second phase constructor +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::ConstructL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::ConstructL()"); + iResponse = CMPXCommand::NewL(static_cast(iRequest)->Command()); +#ifdef USE_S60_TNM + DataSource()->CancelFetchThumbnail(); +#else + DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); +#endif + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ExecuteRequestL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::ExecuteRequestL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::ExecuteRequestL()"); + __ASSERT_DEBUG(DataSource()->NamespaceDef(), Panic(EGlxPanicIllegalState)); + + const CMPXCommand& command = static_cast(iRequest)->Command(); + + if ( command.IsSupported(KMPXCommandGeneralCollectionId) ) + { + iCollectionUid = command.ValueTObjectL(KMPXCommandGeneralCollectionId); + } + else + { + // if the collection Uid has not been set on the command, use the Ud of the plugin in use. + iCollectionUid = iRequest->CollectionPluginUid(); + } + + TGlxCommandParser::ParseL(*this, command); + } + +// ---------------------------------------------------------------------------- +// Add container +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::AddContainerL(const TDesC& aContainerName) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AddContainerL(const TDesC& aContainerName)"); + iTitle = aContainerName.AllocL(); + AppendContainerTitleCountQueryL(ECommandAddContainer, aContainerName); + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Add items to container by id +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AddToContainerL()"); + __ASSERT_DEBUG(aSourceIds.Count() && aTargetContainers.Count(), Panic(EGlxPanicEmptyArray)); + + iLeftIds.Reset(); + iRightIds.Reset(); + + CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); + AppendQueryL(query, ECommandAddToContainer); + + CMdELogicCondition& rootCondition = query->Conditions(); + CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); + CMdELogicCondition& leftLogicCondition = containerRelationCondition.LeftL(); + CMdELogicCondition& rightLogicCondition = containerRelationCondition.RightL(); + leftLogicCondition.SetOperator(ELogicConditionOperatorOr); + rightLogicCondition.SetOperator(ELogicConditionOperatorOr); + + TMdEItemId containerId = ContainerItemId(aTargetContainers[0]); + // It is currenly a safe assumption that all containers are of the same type (either albums or tags) + // and thus they will either all be on the left or all be on the right of the logic condition. Therefore, + // we only need to test the first container to see if it is on the left or on the right. + CMdEObject* container = DataSource()->Session().GetObjectL(containerId); + if (!container) + { + User::Leave(KErrNotFound); + } + TBool containerIsLeft = DataSource()->ContainerIsLeft(container->Def()); + + delete container; + container = NULL; + + + if (containerIsLeft) + { + // the container is on the left + CopyArrayL(iLeftIds, aTargetContainers); + CopyArrayL(iRightIds, aSourceIds); + } + else + { + // the container is on the right + CopyArrayL(iRightIds, aTargetContainers); + CopyArrayL(iLeftIds, aSourceIds); + } + + leftLogicCondition.AddObjectConditionL(iLeftIds); + rightLogicCondition.AddObjectConditionL(iRightIds); + + query->SetResultMode(EQueryResultModeItem); + + ExecuteQueryL(); + + } + +// ---------------------------------------------------------------------------- +// Add item to containers by URI. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::AddToContainerL(const TDesC& aSourceUri, + const RArray< TGlxMediaId >& aTargetContainers) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AddToContainerL()"); + CMdEObject* sourceObject = DataSource()->Session().GetObjectL(aSourceUri); + if (!sourceObject) + { + User::Leave(KErrNotFound); + } + RArray sourceIds; + CleanupClosePushL(sourceIds); + sourceIds.AppendL(TGlxMediaId(sourceObject->Id())); + + AddToContainerL(sourceIds, aTargetContainers); + CleanupStack::PopAndDestroy(&sourceIds); + } + +// ---------------------------------------------------------------------------- +// 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) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::CopyL()"); + FileOperationL(aSourceIds.Array(), aDrive, ECopy); + } + +// ---------------------------------------------------------------------------- +// 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) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::MoveL()"); + FileOperationL(aSourceIds.Array(), aDrive, EMove); + } + +// ---------------------------------------------------------------------------- +// Remove items from a container. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::RemoveFromContainerL(const RArray& aItemIds, const TGlxMediaId& aContainerId) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::RemoveFromContainerL()"); + // Answer to question in @bug above: No + + CMdEObject* object = NULL; + object = DataSource()->Session().GetObjectL(aContainerId.Value()); + CleanupStack::PushL(object); + if (!object) + { + User::Leave(KErrNotFound); + } + + 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); + CMdELogicCondition* containerLogicCondition = NULL; + CMdELogicCondition* itemLogicCondition = NULL; + // Containers are on the left for albums, right for tags + if ( DataSource()->ContainerIsLeft(object->Def()) ) + { + containerLogicCondition = &containerRelationCondition.LeftL(); + itemLogicCondition = &containerRelationCondition.RightL(); + } + else + { + containerLogicCondition = &containerRelationCondition.RightL(); + itemLogicCondition = &containerRelationCondition.LeftL(); + } + + containerLogicCondition->AddObjectConditionL(aContainerId.Value()); + + itemLogicCondition->SetOperator(ELogicConditionOperatorOr); + itemLogicCondition->AddObjectConditionL(reinterpret_cast&>(aItemIds)); + + query->SetResultMode(EQueryResultModeId); + CleanupStack::PopAndDestroy(object); + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Delete files, Remove container. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DeleteL(const RArray& aItemIds) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DeleteL()"); + CMdEObjectDef* containerObjectDef = NULL; + TInt err = ContainerObjectDef(containerObjectDef); + if (err == KErrNone) + { + QueueObjectQueryL(*containerObjectDef, + reinterpret_cast&>(aItemIds), ECommandDeleteContainers); + } + // Assume that only items are left + QueueObjectQueryL(DataSource()->ObjectDef(), + reinterpret_cast&>(aItemIds), ECommandDeleteItems); + + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Rename files, Rename container. +// +/// @todo test this method. +// +// ---------------------------------------------------------------------------- +// +/// @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) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::RenameL()"); + delete iTitle; + iTitle = NULL; + iTitle = aTitle.AllocL(); + + RArray sourceIdArray; + CleanupClosePushL(sourceIdArray); + sourceIdArray.AppendL(aSourceItemId.Value()); + + QueueObjectQueryL(DataSource()->ObjectDef(), sourceIdArray , ECommandRename); + CleanupStack::PopAndDestroy(&sourceIdArray); + + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Set description. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::SetDescriptionL(const RArray& aItemIds, const TDesC& aDescription) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::SetDescriptionL()"); + CMdEPropertyDef* descriptionPropertyDef = DataSource()->MediaDef().GetPropertyDefL(KPropertyDefNameDescription); + if (!descriptionPropertyDef || descriptionPropertyDef->PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + + TInt count = aItemIds.Count(); + for (TInt i = 0; i < count; i++) + { + TMdEItemId itemId = aItemIds[i].Value(); + CMdEObject* object = DataSource()->Session().OpenFullObjectL(itemId); + if (!object) + { + User::Leave(KErrNotFound); + } + CleanupStack::PushL(object); + CMdEProperty* descriptionProperty = NULL; + TInt index = object->Property(*descriptionPropertyDef, descriptionProperty); + if (index < KErrNotFound) + { + User::Leave(index); + } + if (index != KErrNotFound) + { + // Check whether the description string is empty + if( aDescription.Length() ) + { + static_cast(descriptionProperty)->SetValueL(aDescription); + } + + //if entered description string is blank then remove the old property + else + { + object->RemoveProperty(index); + } + } + else + { + if( aDescription.Length() ) + { + object->AddTextPropertyL(*descriptionPropertyDef, aDescription); + } + } + DataSource()->Session().CommitObjectL(*object); + CleanupStack::PopAndDestroy(object); + } + + HandleRequestComplete(KErrNone); + } + + +// ---------------------------------------------------------------------------- +// Set capture location. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::SetCaptureLocationL(const RArray& aItemIds, const TCoordinate& aCoordinate) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::SetCaptureLocationL()"); + if (!Math::IsNaN(aCoordinate.Latitude()) || !Math::IsNaN(aCoordinate.Longitude())) + { + User::Leave(KErrArgument); + } + + CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); + AppendQueryL(query, ECommandRemoveLocation); // query is now owned by the query array. + + CMdELogicCondition& rootCondition = query->Conditions(); + + CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(ERelationConditionSideLeft); + CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); + CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); + locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); + + itemLogicCondition.SetOperator(ELogicConditionOperatorOr); + + itemLogicCondition.AddObjectConditionL(reinterpret_cast&>(aItemIds)); + + query->SetResultMode(EQueryResultModeId); + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL()"); +#ifndef USE_S60_TNM + CGlxDataSourceMde* ds = DataSource(); + ds->ThumbnailCreator().CleanupThumbnailsL(&ds->ThumbnailDatabase()); +#endif + HandleRequestComplete(KErrNone); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::HandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL(CMdEQuery& aQuery) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL()"); + TGlxQueryType queryType = iQueryTypes[0]; + + switch (queryType) + { + + case ECommandRemoveFromContainer: // don't break + case ECommandRemoveLocation: + { + TInt queryCount = aQuery.Count(); + RArray relationsToRemove; + CleanupClosePushL(relationsToRemove); + User::LeaveIfError(relationsToRemove.Reserve(queryCount)); + + RArray successfullyRemovedReleations; + CleanupClosePushL(successfullyRemovedReleations); + User::LeaveIfError(successfullyRemovedReleations.Reserve(queryCount)); + + for(TInt i = queryCount - 1; i >= 0; i--) + { + relationsToRemove.AppendL(aQuery.ResultId(i)); + } + + if (queryCount) + { + User::LeaveIfError(DataSource()->Session().RemoveRelationsL(relationsToRemove, successfullyRemovedReleations)); + } + + CleanupStack::PopAndDestroy(&successfullyRemovedReleations); + CleanupStack::PopAndDestroy(&relationsToRemove); + } + break; + case ECommandAddToContainer: + { + DoHandleAddToContainerQueryCompletedL(aQuery); + } + break; + case ECommandAddContainer: + { + DoHandleAddContainerQueryCompletedL(aQuery); + } + break; + case ECommandDeleteContainers: + { + DoHandleDeleteContainersQueryCompletedL(aQuery); + } + break; + case ECommandDeleteItems: + { + DoHandleDeleteItemsQueryCompletedL(aQuery); + } + break; + case ECommandRename: + { + DoHandleRenameQueryCompletedL(aQuery); + } + break; + case ECommandRenameContainer: + { + DoHandleRenameConainerQueryCompletedL(aQuery); + } + break; + } + } +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoNextQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoNextQueryL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoNextQueryL()"); + if (iQueries.Count()) + { + ExecuteQueryL(); + } + else + { + HandleRequestComplete(KErrNone); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::FileOperationL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::FileOperationL(const TArray& aSourceIds, const TDesC& aDrive, TFileOperation aFileOperation) + { + GLX_LOG_ENTRY_EXIT("void 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. + // We don't have an EikonEnv as we are running in a server process. + RFs rfs; // used for BaflUtils::FileExists + + CleanupClosePushL(rfs); + User::LeaveIfError(rfs.Connect()); + for (TInt i = 0; i < aSourceIds.Count(); i++) + { + CMdEObject* sourceObject = DataSource()->Session().GetObjectL(aSourceIds[i].Value()); + if (!sourceObject) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(sourceObject); + + const TDesC& sourceFileName = sourceObject->Uri(); + TFileName sourceRootPath; + + RootPath(sourceFileName, sourceRootPath); + TPtrC fileNameWithoutRoot(NULL,0); + if (sourceFileName.Left(sourceRootPath.Length()).CompareF(sourceRootPath) == 0) + // This is the expected case. The file to be copied is under the 'root' of + // 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())); + } + else + { + fileNameWithoutRoot.Set(sourceFileName); + } + + TFileName destinationFileName; + // Set destination file name to destination 'root' path + RootPath(aDrive, destinationFileName); + // 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. + if (BaflUtils::FileExists(rfs, destinationFileName)) + { + // 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 i = 1; + do + { + destinationFileName.SetLength(destinationFileNameWithoutExtensionLength); + destinationFileName.AppendFormat(KFileNameFormatString,i++); + destinationFileName.Append(destinationFileNameParse.Ext()); + } + while (BaflUtils::FileExists(rfs, destinationFileName)); + } + + // Ensure the path that we are copying to exists. + // Fixed error ID: ELLZ-798BP3 Lumiere 07.46.08_MC Photo: + // "System: System error." is displayed when copying/moving image which is saved in a user created folder. + BaflUtils::EnsurePathExistsL(rfs,destinationFileName); + + if (aFileOperation == ECopy) + { + User::LeaveIfError(manager->CopyFile(sourceFileName, destinationFileName)); + } + else + { + User::LeaveIfError(manager->RenameFile(sourceFileName, destinationFileName)); + } + + } + + CleanupStack::PopAndDestroy(sourceObject); + } + + CleanupStack::PopAndDestroy(&rfs); + CleanupStack::PopAndDestroy(manager); + + HandleRequestComplete(KErrNone); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ContainerItemId +// ---------------------------------------------------------------------------- +// +TMdEItemId CGlxDataSourceTaskMdeCommand::ContainerItemId(const TGlxMediaId& aMediaId) + { + GLX_LOG_ENTRY_EXIT("TMdEItemId CGlxDataSourceTaskMdeCommand::ContainerItemId()"); + TMdEItemId containerId = aMediaId.Value(); + if (aMediaId == KGlxCollectionRootId) + { + // Check the collection plugin uid + if (iCollectionUid == TUid::Uid(KGlxCollectionPluginCameraImplementationUid)) + { + containerId = DataSource()->CameraAlbumId().Value(); + } + } + return containerId; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ContainerItemId +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::RootPath(const TDesC& aDrive, TDes& aRootPath) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::RootPath(const TDesC& aDrive, TDes& aRootPath)"); + if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::PhoneMemoryRootPath().Left(KDriveLetterLength)) == 0) + { + aRootPath = PathInfo::PhoneMemoryRootPath(); + } + 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) + { + aRootPath = PathInfo::RomRootPath(); + } + else + { + aRootPath = aDrive.Left(KDriveLetterLength); + aRootPath.Append(KColonBackslash); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::CopyArrayL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::CopyArrayL(RArray& aDestArray, const RArray& aSourceArray) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::CopyArrayL()"); + TInt count = aSourceArray.Count(); + User::LeaveIfError(aDestArray.Reserve(count)); + for (TInt i = 0; i < count; i++) + { + aDestArray.AppendL(ContainerItemId(aSourceArray[i])); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::SendProgressMessageL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::SendProgressMessageL(TInt aCurrentStep, TInt aStepCount) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::SendProgressMessageL(TInt aCurrentStep, TInt aStepCount)"); + MGlxDataSourceUpdateObserver& observer = static_cast(iRequest)->DataSourceUpdateObserver(); + + const CMPXCommand& command = static_cast(iRequest)->Command(); + __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(KMPXCommandGeneralSessionId, sessionId); + + observer.HandleMessage(*progressMessage); + + CleanupStack::PopAndDestroy(progressMessage); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ContainerObjectDef +// ---------------------------------------------------------------------------- +// +TInt CGlxDataSourceTaskMdeCommand::ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef) +{ + GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceTaskMdeCommand::ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef)"); + //__ASSERT_DEBUG( (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid) || iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)), Panic(EGlxPanicInvalidCollectionUid)); + TInt err = KErrNone; + if (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid)) + { + aContainerObjectDef = &DataSource()->TagDef(); + } + else if (iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)) + { + aContainerObjectDef = &DataSource()->AlbumDef(); + } + else + { + err = KErrNotFound; + } + return err; +} + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL + (CMdEQuery& aQuery) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL(CMdEQuery& aQuery)"); + RPointerArray relations; + CleanupClosePushL(relations); + + TInt leftCount = iLeftIds.Count(); + TInt rightCount = iRightIds.Count(); + User::LeaveIfError(relations.Reserve(leftCount*rightCount)); // this is a bigest reservation that could be required. + for (TInt leftPos = 0; leftPos < leftCount; leftPos++) + { + for (TInt rightPos = 0; rightPos < rightCount; rightPos++) + { + // Check to see if id already exists + TBool alreadyExists = EFalse; + for(TInt queryPos = aQuery.Count() - 1; queryPos >= 0; queryPos--) + { + CMdERelation& relation = static_cast(aQuery.ResultItem(queryPos)); + if (relation.LeftObjectId() == iLeftIds[leftPos] + && relation.RightObjectId() == iRightIds[rightPos]) + { + alreadyExists = ETrue; + break; + } + } + + if (!alreadyExists) + { + CMdERelation* relation = DataSource()->Session().NewRelationL(DataSource()->ContainsDef(), iLeftIds[leftPos], iRightIds[rightPos]); + CleanupStack::PushL(relation); + relations.AppendL(relation); + CleanupStack::Pop(relation); + } + } + + } + + if (relations.Count()) + { + User::LeaveIfError(DataSource()->Session().AddItemsL(relations)); + } + + CleanupStack::PopAndDestroy(&relations); + + iLeftIds.Reset(); + iRightIds.Reset(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL + (CMdEQuery& aQuery) + + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL()"); + if (aQuery.Count()) + { + // An object (or more strickly objects) with the given container name already exist + User::Leave(KErrAlreadyExists); + } + + CMdEObject* object = NULL; + CMdEObjectDef* containerObjectDef = NULL; + TInt err = ContainerObjectDef(containerObjectDef ); + __ASSERT_ALWAYS(err == KErrNone, Panic(EGlxPanicInvalidCollectionUid)); + + object = DataSource()->Session().NewObjectLC(*containerObjectDef, KNullDesC); + + // A title property def of type text is required. + CMdEPropertyDef* titlePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameTitle); + if (!titlePropertyDef || titlePropertyDef->PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + // Set the object title. + object->AddTextPropertyL (*titlePropertyDef, *iTitle); + + //ItemType property def of type text is required. + CMdEPropertyDef* itemTypePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefItemType); + if (!itemTypePropertyDef || itemTypePropertyDef->PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + + // Checks the Container type whether it is Tag or Album + if (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid)) + { + object->AddTextPropertyL (*itemTypePropertyDef, KTagItemType); + } + else + { + object->AddTextPropertyL (*itemTypePropertyDef, KAlbumItemType); + } + + + // A size property is required. + + CMdEPropertyDef* sizePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameSize); + if (!sizePropertyDef || sizePropertyDef->PropertyType() != EPropertyUint32) + { + User::Leave(KErrCorrupt); + } + object->AddUint32PropertyL(*sizePropertyDef,0); + + + // A creation date property is required. + CMdEPropertyDef* creationDateDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameCreationDate); + if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + // A last modified date property is required. + CMdEPropertyDef* lmDateDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameLastModifiedDate); + if (!lmDateDef || lmDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + TTime uTime; + uTime.UniversalTime(); + object->AddTimePropertyL(*creationDateDef, uTime); + object->AddTimePropertyL(*lmDateDef, uTime); + + TMdEItemId id = DataSource()->Session().AddObjectL(*object); + CleanupStack::PopAndDestroy(object); + + iResponse->SetTObjectValueL(KMPXMediaGeneralId, id); + iResponse->SetTObjectValueL(KMPXMessageMediaGeneralId, id); + iResponse->SetTObjectValueL(KMPXMessageChangeEventType, EMPXItemInserted); + } +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL + (CMdEQuery& aQuery) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL()"); + CMdEPropertyDef* albumTypeProperty = DataSource()->AlbumDef().GetPropertyDefL(KPropertyDefNameAlbumType); + TInt queryCount = aQuery.Count(); + + RArray objectsForRemoval; + CleanupClosePushL(objectsForRemoval); + User::LeaveIfError(objectsForRemoval.Reserve(queryCount)); + + RArray sucessfullyRemovedObjects; + CleanupClosePushL(sucessfullyRemovedObjects); + User::LeaveIfError(sucessfullyRemovedObjects.Reserve(queryCount)); + + // Ensure that deletion is legal and that deletion + for(TInt queryPos = 0; queryPos < queryCount; queryPos++) + { + CMdEObject& object = static_cast(aQuery.ResultItem(queryPos)); + + CMdEProperty* albumType; + TInt albumTypeIndex = object.Property(*albumTypeProperty, albumType); + if (KErrNotFound != albumTypeIndex) + { + TInt albumTypeValue = static_cast(albumType)->Value(); + if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) + { + User::Leave(KErrAccessDenied); + } + } + objectsForRemoval.AppendL(object.Id()); + } + + if (queryCount) + { + User::LeaveIfError(DataSource()->Session().RemoveObjectsL(objectsForRemoval, sucessfullyRemovedObjects)); + } + + CleanupStack::PopAndDestroy(&sucessfullyRemovedObjects); + CleanupStack::PopAndDestroy(&objectsForRemoval); + } +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsContainersQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL + (CMdEQuery& aQuery) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL()"); + ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); + CleanupStack::PushL(manager); + TInt queryCount = aQuery.Count(); + RArray objectsForRemoval; + CleanupClosePushL(objectsForRemoval); + User::LeaveIfError(objectsForRemoval.Reserve(queryCount)); + + RArray sucessfullyRemovedObjects; + CleanupClosePushL(sucessfullyRemovedObjects); + User::LeaveIfError(sucessfullyRemovedObjects.Reserve(queryCount)); + + TInt lastErr = KErrNone; + for(TInt queryPos = queryCount - 1; queryPos >= 0; queryPos--) + { + CMdEObject& object = static_cast(aQuery.ResultItem(queryPos)); + TInt err = manager->DeleteFile(object.Uri()); + if (err != KErrNone) + { + lastErr = err; + } + objectsForRemoval.AppendL(object.Id()); + } + + User::LeaveIfError(lastErr); + + if (queryCount) + { + // Some objects may have already been removed by the harvester + DataSource()->Session().RemoveObjectsL(objectsForRemoval, sucessfullyRemovedObjects); + } + + CleanupStack::PopAndDestroy(&sucessfullyRemovedObjects); + CleanupStack::PopAndDestroy(&objectsForRemoval); + + CleanupStack::PopAndDestroy(manager); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL + (CMdEQuery& aQuery) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL()"); + __ASSERT_DEBUG(iObjectToRename, Panic(EGlxPanicLogicError)); + if (aQuery.Count()) + { + User::Leave(KErrAlreadyExists); + } + + CMdEObject* object = DataSource()->Session().OpenObjectL(iObjectToRename->Id(), iObjectToRename->Def()); + CleanupStack::PushL(object); + CMdEProperty* albumType; + CMdEPropertyDef* albumTypeProperty = object->Def().GetPropertyDefL(KPropertyDefNameAlbumType); + TInt albumTypeIndex = KErrNotFound; + // Must guard against non-existance of albumTypeProperty (e.g. when renaming a tag) + if (albumTypeProperty) + { + albumTypeIndex = object->Property(*albumTypeProperty, albumType); + } + if( KErrNotFound != albumTypeIndex ) + { + TInt albumTypeValue = static_cast(albumType)->Value(); + if ( albumTypeValue == MdeConstants::Album::EAlbumUserPredefined ) + { + // Want to rename a predefined, localised album name so reclassify + // 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)) + { + // Cannot rename system albums + User::Leave(KErrAccessDenied); + } + } + + + CMdEPropertyDef* titlePropertyDef = object->Def().GetPropertyDefL(KPropertyDefNameTitle); + if (!titlePropertyDef || titlePropertyDef->PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + + CMdEProperty* titleProperty = NULL; + TInt index = object->Property(*titlePropertyDef, titleProperty); + if (index < KErrNotFound) + { + User::Leave(index); + } + if (index != KErrNotFound) + { + // Remove the old property + object->RemoveProperty(index); + } + // Set the object title + object->AddTextPropertyL(*titlePropertyDef, *iTitle); + + // Get time propertydef of current session object + CMdEPropertyDef* timePropertyDef = object->Def().GetPropertyDefL( + KPropertyDefNameLastModifiedDate); + + // Check the validty of the time def + if (!timePropertyDef || timePropertyDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + // Get index and check the validity + CMdEProperty* timeProperty = NULL; + index = object->Property(*timePropertyDef, timeProperty); + + if (index < KErrNotFound) + { + User::Leave(index); + } + + if (index != KErrNotFound) + { + // Remove the old property + object->RemoveProperty(index); + } + + // Take current universal time + TTime currentTime; + currentTime.UniversalTime(); + + // Set the object current time + object->AddTimePropertyL(*timePropertyDef, currentTime); + + DataSource()->Session().CommitObjectL(*object); + CleanupStack::PopAndDestroy(object); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL + (CMdEQuery& aQuery) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL()"); + __ASSERT_DEBUG(aQuery.Count() == 1, Panic(EGlxPanicUnexpectedQueryResultCount )); + delete iObjectToRename; + iObjectToRename = static_cast(aQuery.TakeOwnershipOfResult(0)); + + CMdEObjectDef* containerObjectDef = NULL; + TInt err = ContainerObjectDef(containerObjectDef); + + if (err == KErrNone && 0 == iObjectToRename->Def().Compare(*containerObjectDef)) + { + AppendContainerTitleCountQueryL(ECommandRenameContainer, *iTitle); + } + else + // The object is an image or video; Rename the file using CAF and let the harvester detect the changes. + { + TParsePtrC parsePtr(iObjectToRename->Uri()); + + TFileName destinationFileName; + destinationFileName.Append(parsePtr.DriveAndPath()); + destinationFileName.Append(*iTitle); + destinationFileName.Append(parsePtr.Ext()); + + // If the destination file already exists, leave with KErrAlreadyExists + // It is up to the client to handle this error + // This check is explicitly needed because manager->RenameFile calls + // CFileMan Rename() with default behaviour of overwriting existing files + // See EDKZ-79UDW3 + RFs fs; + CleanupClosePushL( fs ); + + User::LeaveIfError( fs.Connect() ); + + if ( BaflUtils::FileExists( fs, destinationFileName ) ) + { + User::Leave( KErrAlreadyExists ); + } + + CleanupStack::PopAndDestroy( &fs ); + + if(destinationFileName.CompareF(iObjectToRename->Uri())) + { + ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); + CleanupStack::PushL(manager); + + User::LeaveIfError(manager->RenameFile(iObjectToRename->Uri(), destinationFileName)); + + CleanupStack::PopAndDestroy(manager); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL + (const TGlxQueryType& aQueryType, const TDesC& aTitle) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL(const TGlxQueryType& aQueryType, const TDesC& aTitle)"); + // 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); + CleanupStack::PushL(query); + + CMdEPropertyDef* titlePropertyDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameTitle); + + query->SetResultMode(EQueryResultModeCount); + + query->Conditions().AddPropertyConditionL(*titlePropertyDef, ETextPropertyConditionCompareEquals, aTitle); + + CleanupStack::Pop(query); + + AppendQueryL(query, aQueryType); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeidlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeidlist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,309 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The Data Source Task MDE ID List class +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + +#include "glxdatasourcetaskmdeidlist.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcemde.h" +#include "glxdatasourcemde.hrh" + +// CONSTANTS +const TInt KGlxAlbumPromotionPosition = 0; + +_LIT(KPropertyDefNameCreationDate, "CreationDate"); + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList()"); + iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeIdList::~CGlxDataSourceTaskMdeIdList() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeIdList::~CGlxDataSourceTaskMdeIdList()"); + // No implementation required + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::FilterAvailableComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::FilterAvailableComplete( + const RArray& aIdArray, TInt aErrorCode) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::FilterAvailableComplete()"); + DoPostFilterComplete(aIdArray, aErrorCode); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::ExecuteRequestL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::ExecuteRequestL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::ExecuteRequestL()"); + CGlxIdListRequest* request = static_cast(iRequest); + TGlxMediaId container = request->ContainerId(); + TGlxQueryType queryType = EIdListQuery; + TQueryResultMode resultMode = EQueryResultModeId; + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + + if( KGlxCollectionRootId == container.Value() ) // The root. + { + switch(request->CollectionPluginUid().iUid) + { + + case KGlxCollectionPluginAlbumsImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxCollectionPluginCameraImplementationUid: + { + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxTagCollectionPluginImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->TagDef(); + break; + } + case KGlxCollectionPluginMonthsImplementationUid: + { + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + resultMode = EQueryResultModeObjectWithoutFreetexts; + break; + } + default: + { + // default gallery query returns all objects as per filter + break; + } + } + } + else // return the content of a container + { + switch(request->CollectionPluginUid().iUid) + { + case KGlxCollectionPluginAlbumsImplementationUid: + { + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxTagCollectionPluginImplementationUid: + { + objectDef = &DataSource()->TagDef(); + break; + } + case KGlxCollectionPluginMonthsImplementationUid: + { + AddMonthFilterL(container, iFilterProperties); + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + break; + } + default: + { + User::Leave(KErrNotSupported); + break; + } + } + } + + DoQueryL(*objectDef, isContent, queryType, resultMode, container); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoHandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoHandleQueryCompletedL()"); + __ASSERT_DEBUG(iQueryTypes[0] == EIdListQuery, Panic(EGlxPanicLogicError)); + DoHandleListQueryCompletedL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL()"); + if( EQueryResultModeObjectWithoutFreetexts == iQueries[0]->ResultMode() ) + { + DoMonthListCreationL(*iQueries[0], iFilterProperties); + } + else // only id or item supported + { + const RArray& localList = reinterpret_cast&>(iQueries[0]->ResultIds()); + PostFilterL(localList, iFilterProperties); + + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::DoMonthListCreationL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoMonthListCreationL(CMdEQuery& aQuery, + const TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoMonthListCreationL()"); + CMdEProperty* time; + CMdEPropertyDef* creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); + if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + RArray monthList; + CleanupClosePushL(monthList); + TTime lastMonth; + TTime currentMonth; + TInt count = aQuery.Count(); + for( TInt i = 0 ; i < count ; i++ ) + { + CMdEObject& object = (CMdEObject&)aQuery.ResultItem(i); + TInt timeIndex = object.Property(*creationDateDef, time); + if( KErrNotFound == timeIndex ) + { + User::Leave(KErrCorrupt); + } + currentMonth = static_cast(time)->Value(); + if( !DataSource()->SameMonth(lastMonth, currentMonth) ) + { + const TGlxMediaId monthId = DataSource()->GetMonthIdL(currentMonth); + monthList.AppendL(monthId); + lastMonth = currentMonth; + } + } + PostFilterL(monthList, aFilterProperties); + CleanupStack::PopAndDestroy(&monthList); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::DoPostFilterComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoPostFilterComplete( + const RArray& aIdArray, TInt aErrorCode) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoPostFilterComplete()"); + if (aErrorCode == KErrNone) + { + TRAP(aErrorCode, ListToMediaL(aIdArray)); + } + + HandleRequestComplete(aErrorCode); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::PostFilterL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::PostFilterL(const RArray& + aFilteredList, const TGlxFilterProperties& aFilterProperties) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::PostFilterL()"); +/* if( TSize(0,0) != aFilterProperties.iThumbnailLoadability ) + { + DataSource()->ThumbnailCreator().FilterAvailableThumbnailsL + (aFilteredList.Array(), iFilterProperties.iThumbnailLoadability, *this); + } + else + { +*/ if( aFilterProperties.iPromoteSystemItems ) + { + RArray list = aFilteredList; + TInt favoritesIndex = list.Find(DataSource()->FavoritesId()); + if( KErrNotFound != favoritesIndex ) + { + list.Remove(favoritesIndex); + list.Insert(DataSource()->FavoritesId(), KGlxAlbumPromotionPosition); + } + TInt cameraAlbumIndex = list.Find(DataSource()->CameraAlbumId()); + if( KErrNotFound != cameraAlbumIndex ) + { + list.Remove(cameraAlbumIndex); + list.Insert(DataSource()->CameraAlbumId(), KGlxAlbumPromotionPosition); + } + DoPostFilterComplete(list, KErrNone); + } + else + { + DoPostFilterComplete(aFilteredList, KErrNone); + } +// } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdethumbnail.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdethumbnail.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,583 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The Data Source Task MDE THumbnail Class +* +*/ + + + + +#include "glxdatasourcetaskmdethumbnail.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcemde.h" +#include "glxdatasourcemde.hrh" + +// CONSTANTS + +_LIT(KPropertyDefNameDRM, "DRM"); +_LIT(KPropertyDefNameItemType, "ItemType"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KUnsupportedItemType, "video/x-pn-realvideo"); +_LIT(KUnsupportedItemType1, "video/x-pn-multirate-realvideo"); +_LIT(KUnsupportedItemType2, "video/vnd.rn-realvideo"); +_LIT(KUnsupportedItemType3, "video/x-ms-wmv"); + +// ---------------------------------------------------------------------------- +// IsUnsupportedL +// Tests to see if an item type is unsupported +// ---------------------------------------------------------------------------- +// +TBool IsUnsupportedL(CMdESession& aSession, TItemId aItemId) + { + GLX_LOG_ENTRY_EXIT("IsUnsupportedL()"); + TBool isUnsupported = EFalse; + CMdEObject* item = aSession.GetObjectL(aItemId); + + if (!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + CMdEProperty* itemType = NULL; + CMdEPropertyDef* itemTypeProperty = item->Def().GetPropertyDefL(KPropertyDefNameItemType); + + TInt itemTypeIndex = item->Property(*itemTypeProperty, itemType); + if (itemTypeIndex > KErrNotFound) + { + const TDesC& des = static_cast< CMdETextProperty *>(itemType)->Value(); + if (des.Compare(KUnsupportedItemType) == 0 || + des.Compare(KUnsupportedItemType1) == 0 || + des.Compare(KUnsupportedItemType2) == 0 || + des.Compare(KUnsupportedItemType3) == 0) + { + // The item is unsupported + isUnsupported = ETrue; + } + } + CleanupStack::PopAndDestroy(item); + + return isUnsupported; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeThumbnail:: CGlxDataSourceTaskMdeThumbnail(CGlxThumbnailRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeThumbnail::CGlxDataSourceTaskMdeThumbnail()"); + iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail()"); +#ifdef USE_S60_TNM + DataSource()->CancelFetchThumbnail(); + delete iTnFileInfo; + iTnFileInfo = NULL; +#else + if( iTnRequestStatus ) + { + CancelFetchUri(TGlxMediaId()); + } + if( iTnRequestInProgress ) + { + CGlxThumbnailRequest* request = static_cast(iRequest); + + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); + DataSource()->ThumbnailCreator().CancelRequest(tnReq.iId); + } +#endif + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::ExecuteRequest +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL()"); + CGlxThumbnailRequest* request = static_cast(iRequest); + + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); +#ifdef USE_S60_TNM + if(request->ThumbnailInfo()) + { + if (tnReq.iSizeClass.iWidth > 0 && tnReq.iSizeClass.iHeight > 0 ) + { + DataSource()->FetchThumbnailL(iRequest, *this); + } + else + { + ThumbnailFetchComplete(KErrNone); + } + } + else + { + FetchFileInfoL(); + } +#else + iTnRequestInProgress = ETrue; + DataSource()->ThumbnailCreator().FetchThumbnailL(tnReq, *this); +#endif + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete(TInt aError) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete()"); + CGlxThumbnailRequest* request = static_cast(iRequest); + if(request && !(aError == KErrNone || aError == KErrNoMemory)) + { + // An error has occured. + TBool isUnsupported = EFalse; + // If the item type is unsupported the we want to display the default + // icon rather than the corrupt icon. + TRAPD(err, isUnsupported = IsUnsupportedL(DataSource()->Session(), + TItemId(request->ItemId().Value()))); + if (isUnsupported) + { + aError = KErrNotSupported; + } + else if (err != KErrNone) + { + aError = err; + } + } + CGlxDataSourceTask::HandleRequestComplete(aError); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL()"); + if (EContainerFirstItemQuery == iQueryTypes[0]) + { + TRAPD(err, DoHandleContainerFirstItemQueryCompletedL()); + + if (err != KErrNone) + { + CompleteThumbnailRequest(err); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL(const TGlxMediaId& aId, + TGlxThumbnailQuality aQuality) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL()"); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxThumbnailRequest* req = static_cast(iRequest); + delete iResponse; + iResponse = NULL; + iResponse = CMPXMedia::NewL(); + CGlxThumbnailAttribute* tnAttribute = new (ELeave) CGlxThumbnailAttribute; + CleanupStack::PushL(tnAttribute); + TGlxThumbnailRequest tnRequest; + req->ThumbnailRequest(tnRequest); + TSize size(tnRequest.iSizeClass); + tnAttribute->iDimensions = size; + tnAttribute->iCroppingRect = tnRequest.iCroppingRect; + tnAttribute->iThumbnailQuality = aQuality; + + TUint attributeId = req->AttributeId(); + if ( GlxIsFullThumbnailAttribute(attributeId) ) + { + TBool quality = (EGlxThumbnailQualityHigh == aQuality); + attributeId = GlxFullThumbnailAttributeId(quality, + size.iWidth, size.iHeight); + } + + iResponse->SetTObjectValueL(KMPXMediaGeneralId, aId.Value()); + iResponse->SetNoNewLCObjectL( + TMPXAttribute(KGlxMediaIdThumbnail, attributeId), tnAttribute); + CleanupStack::PopAndDestroy(tnAttribute); + } + +#ifdef USE_S60_TNM +void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TInt aError) + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TNM)"); + CGlxThumbnailRequest* request = static_cast(iRequest); + TGlxThumbnailRequest tnRequest; + request->ThumbnailRequest(tnRequest); + TInt err = aError; + if(!err) + { + TRAP(err, HandleThumbnailFetchCompleteL(tnRequest.iId, EGlxThumbnailQualityHigh)); + } + HandleRequestComplete(err); + } +#else +// ----------------------------------------------------------------------------- +// ThumbnailFetchComplete +// Notifies that a thumbnail for a given item is available, or that +// thumbnail generation failed. +// ----------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete( + const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete()"); + iTnRequestInProgress = EFalse; + TInt err = aErrorCode; + if(!err) + { + TRAP(err, HandleThumbnailFetchCompleteL(aItemId, aQuality)); + } + HandleRequestComplete(err); + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete( + const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete()"); + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete( + const RArray& /*aIdArray*/, TInt /*aErrorCode*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete()"); + // No implementation + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL(CGlxtnFileInfo* aInfo, + const TGlxMediaId& aItemId, TRequestStatus* aStatus) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL()"); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxThumbnailRequest* request = static_cast(iRequest); + if(request->ThumbnailInfo()) + { + aInfo->CopyInfoL(*request->ThumbnailInfo()); + *aStatus = KRequestPending; + User::RequestComplete(aStatus, KErrNone); + return; + } + + CMdEObject* item = DataSource()->Session().GetObjectL((TMdEItemId)aItemId.Value()); + if(!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + iTnRequestStatus = aStatus; + iTnFileInfo = aInfo; + *iTnRequestStatus = KRequestPending; + + CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(item); + if( CGlxDataSource::EContainerTypeNotAContainer != containerType ) + { + iTnFileInfo->iTemporary = ETrue; + + TGlxMediaId container = aItemId; + CMdEObjectDef* objectDef = &item->Def(); + + /// @todo: use default filter so we can ensure we always get correct first item if filters change + iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + iFilterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + iFilterProperties.iLastCaptureDate = ETrue; + + if( CGlxDataSource::EContainerTypeMonth == containerType ) + { + AddMonthFilterL(item, iFilterProperties); + container = DataSource()->CameraAlbumId(); + objectDef = &DataSource()->AlbumDef(); + } + + DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, EQueryResultModeObjectWithoutFreetexts, container); + } + else + { + CompleteFetchFileInfoL(item); + } + + CleanupStack::PopAndDestroy(item); + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::CancelFetchUri +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::CancelFetchUri(const TGlxMediaId& /*aItemId*/) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::CancelFetchUri()"); + CompleteThumbnailRequest(KErrCancel); + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage +// ---------------------------------------------------------------------------- +// +MGlxtnThumbnailStorage* CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage() + { + GLX_LOG_ENTRY_EXIT("MGlxtnThumbnailStorage* CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage()"); + return &DataSource()->ThumbnailDatabase(); + } +#endif + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL(CMdEObject* aItem) + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL()"); + TParsePtrC parser(aItem->Uri()); + iTnFileInfo->SetFilePathL(parser.FullName()); + + CMdEProperty* size; + CMdEPropertyDef* sizeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameSize); + TInt sizeIndex = aItem->Property(*sizeProperty, size); + if( KErrNotFound == sizeIndex ) + { + iTnFileInfo->iFileSize = 0; + } + else + { + iTnFileInfo->iFileSize = static_cast< CMdEInt32Property *>(size)->Value(); + } + + CMdEProperty* lastModifiedDateProperty; + 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 + // #ifdef _DEBUG, it will cause a warning in non debug builds. +#endif + aItem->Property(*lastModifiedDatePropertyDef, lastModifiedDateProperty); + __ASSERT_DEBUG(index > KErrNotFound, Panic(EGlxPanicRequiredPropertyNotFound)); + + iTnFileInfo->iFileTime = static_cast(lastModifiedDateProperty)->Value(); + + CGlxDataSource::TItemType itemType = DataSource()->ItemType(aItem); + iTnFileInfo->iIsVideo = ( CGlxDataSource::EItemTypeVideo == itemType ); + + CMdEProperty* drmProtected; + CMdEPropertyDef* drmProtectedProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDRM); + TInt drmProtectedIndex = aItem->Property(*drmProtectedProperty, drmProtected); + TInt err = KErrNone; + if( KErrNotFound == drmProtectedIndex) + { + // should be present for all normally harvested images + // so this should only be where we didn't pre-fetch the attributes + // 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()); + content->GetAttribute(ContentAccess::EIsProtected, iTnFileInfo->iIsProtected); + CleanupStack::PopAndDestroy(content); + ); + } + else + { + iTnFileInfo->iIsProtected = static_cast(drmProtected)->Value(); + } + + CompleteThumbnailRequest(err); + iTnFileInfo = NULL; + iTnRequestStatus = NULL; + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL() + { + GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL()"); + if( !iQueries[0]->Count() ) + { + User::Leave(KErrGlxEmptyContainer); // leave with a specific Error code so UI can display empty folder icon + } + + CMdEObject* item = static_cast(iQueries[0]->TakeOwnershipOfResult(0)); + if(!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + CompleteFetchFileInfoL(item); + CleanupStack::PopAndDestroy(item); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest(TInt aError) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest(TInt aError)") + GLX_LOG_INFO1("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest aError=%d", aError); +#ifdef USE_S60_TNM + if (aError != KErrNone) + { + ThumbnailFetchComplete(aError); + } + else + { + CGlxThumbnailRequest* request = static_cast(iRequest); + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); + + if (tnReq.iSizeClass.iWidth > 0 && tnReq.iSizeClass.iHeight > 0 ) + { + request->SetThumbnailInfo(iTnFileInfo); + DataSource()->FetchThumbnailL(iRequest, *this); + } + else + { + GLX_LOG_INFO("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest KErrArgument"); + ThumbnailFetchComplete(KErrArgument); + } + } +#else + if (iTnRequestStatus) + { + *iTnRequestStatus = KRequestPending; + User::RequestComplete(iTnRequestStatus, aError); + iTnFileInfo = NULL; + iTnRequestStatus = NULL; + } +#endif + } + +#ifdef USE_S60_TNM +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL() + { + GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL()"); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxThumbnailRequest* request = static_cast(iRequest); + CMdEObject* item = DataSource()->Session().GetObjectL(request->ItemId().Value()); + if(!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + iTnFileInfo = new (ELeave) CGlxtnFileInfo; + + CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(item); + if( CGlxDataSource::EContainerTypeNotAContainer != containerType ) + { + iTnFileInfo->iTemporary = ETrue; + + TGlxMediaId container = request->ItemId(); + CMdEObjectDef* objectDef = &item->Def(); + + /// @todo: use default filter so we can ensure we always get correct first item if filters change + iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + iFilterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + iFilterProperties.iLastCaptureDate = ETrue; + + if( CGlxDataSource::EContainerTypeMonth == containerType ) + { + iFilterProperties.iOrigin = EGlxFilterOriginCamera; + AddMonthFilterL(item, iFilterProperties); + container = TGlxMediaId(KGlxCollectionRootId); + objectDef = &DataSource()->ObjectDef(); + } + + DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, EQueryResultModeObjectWithoutFreetexts, container); + } + else + { + CompleteFetchFileInfoL(item); + } + + CleanupStack::PopAndDestroy(item); + } + +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/data/20000A16.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/data/20000A16.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +// INCLUDES + +#include +#include "glxdatasourcemds.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxDataSourceMdePluginDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x20000A0F; // KGlxDataSourceInterfaceUid + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxDataSourceMdeImplementationUid; + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +PRJ_MMPFILES +glxdatasourcemde.mmp \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2008-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: Project definition file for project glxdatasourcemanager. +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + +#include +#include +#include + +#include "../../../../../group/glxbuildcommon.mmh" + + +TARGET glxdatasourcemde.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20000A16 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxdatasourcemds.cpp +SOURCE glxdatasourcemdsproxy.cpp +SOURCE glxdatasourcemdsutility.cpp +SOURCE glxdatasourcetaskmds.cpp +SOURCE glxdatasourcetaskmdsattribute.cpp +SOURCE glxdatasourcetaskmdscommand.cpp +SOURCE glxdatasourcetaskmdsidlist.cpp +SOURCE glxdatasourcetaskmdsthumbnail.cpp + +// if you comment the lines below out, Photos dB will be used for thumbnail fetching +MACRO USE_S60_TNM +#define USE_S60_TNM + +// System includes from the source tree +SYSTEMINCLUDE ../../../../../common/inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../thumbnailcreator/inc +SYSTEMINCLUDE ../../../manager/inc +SYSTEMINCLUDE ../inc + + +APP_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../data +START RESOURCE 20000A16.rss +TARGET glxdatasourcemde.rsc +END + +LIBRARY bafl.lib +LIBRARY caf.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommon.lib +LIBRARY glxdatasourcemanager.lib + +#ifdef USE_S60_TNM +LIBRARY thumbnailmanager.lib +LIBRARY bitgdi.lib +#else +LIBRARY glxthumbnailcreator.lib +#endif + +LIBRARY inetprotutil.lib +LIBRARY lbs.lib +LIBRARY mdeclient.lib +LIBRARY mpxcommon.lib +LIBRARY platformenv.lib +LIBRARY flogger.lib +LIBRARY imageconversion.lib +LIBRARY harvesterclient.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,437 @@ +/* +* Copyright (c) 2008-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: The data source mds class +* +*/ + + + + +/** + * @author Simon Brooks, Alex Birkett + */ + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + +#ifndef _C_GLXDATASOURCEMDS_H_ +#define _C_GLXDATASOURCEMDS_H_ + +// INCLUDES +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include + +#ifdef USE_S60_TNM +#include +#include +#include +#include + +#include "mthumbnailfetchrequestobserver.h" +#endif +#include "glxdatasource.h" + +// FORWARD DECLARATIONS +class CGlxRequest; +#ifndef USE_S60_TNM +class CGlxtnThumbnailCreator; +class CGlxtnThumbnailDatabase; +#endif +class CGlxDataSourceMde ; + +// Use this till MDS bug is fixed. Then KMdSPSShutdown is to be used. +const TUid KHarvesterPSShutdown = { 0x200009F5 } ; +//const TUid KMdSPSShutdown = { 0x20022E94 }; +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 + +// CLASS DECLARATION + +/** + * CGlxDataSourceMde class + * + * Data Source Mde is a Meta Data Data Source. + * @lib GlxDataSourceMde.lib + * @ingroup collection_component_design + */ +class CGlxDataSourceMde : public CGlxDataSource, + public MMdESessionObserver, + public MGlxMDSShutdownObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver, + public MMdERelationObserver, + public MMdERelationPresentObserver, + public MHarvesterEventObserver +#ifdef USE_S60_TNM + , public MThumbnailManagerObserver +#else + , public MGlxtnThumbnailStorageObserver +#endif + { +public: + static CGlxDataSourceMde* NewL(); + +private: + ~CGlxDataSourceMde(); + + CGlxDataSourceMde(); + + void ConstructL(); + +public: + // from CGlxDataSource + 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); + TInt CancelFetchThumbnail(); +#else +private: + // from MGlxtnThumbnailStorageObserver + /** + * Notify that a given thumbnail is available in storage. + * @param aId Media item ID. + * @param aSize Requested thumbnail size. + */ + void ThumbnailAvailable(const TGlxMediaId& aId, const TSize& aSize); + /** + * Notify that a given thumbnail is available in storage. + * @param aId Media item ID. + * @param aSize Thumbnail size. + */ + void BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError); +#endif + +private: + /** + * from MMdESessionObserver + */ + void HandleSessionOpened(CMdESession& aSession, TInt aError); + + void HandleSessionError(CMdESession& aSession, TInt aError); + +private: // MMdEObjectObserver + /** + * See @ref MMdEObjectObserver::HandleObjectNotification + */ + void HandleObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray); + +private: // MMdEObjectPresentObserver + /** + * See @ref MMdEObjectPresentObserver::HandleObjectPresentNotification + */ + void HandleObjectPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + +private: // MMdERelationObserver + /** + * See @ref MMdERelationObserver::HandleRelationNotification + */ + void HandleRelationNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aRelationIdArray); + +private: //MMdERelationPresentObserver + /** + * See @ref MMdERelationPresentObserver::HandleRelationPresentNotification + */ + void HandleRelationPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aRelationIdArray); + +#ifdef USE_S60_TNM + // from MThumbnailManagerObserver + void ThumbnailPreviewReady( MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); + + void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); +#endif + +private: + void BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, + TInt aError); + + void DoSessionInitL(); + + void AddMdEObserversL(); + + void ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, + TBool aIsObject); + + void ProcessItemUpdateL(); + + static TInt ProcessItemUpdate(TAny* aPtr); + void CreateSessionL(); + + static TInt CreateSession(TAny* aPtr); + + void PrepareMonthsL(); + 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: + + void CreateSession(); + + inline CMdESession& Session() const; + +#ifndef USE_S60_TNM + inline CGlxtnThumbnailCreator& ThumbnailCreator() const; + + inline CGlxtnThumbnailDatabase& ThumbnailDatabase() const; +#endif + + inline RFs& FileServerSession(); + + inline const TGlxMediaId& CameraAlbumId() const; + + inline const TGlxMediaId& FavoritesId() const; + + inline CMdENamespaceDef* NamespaceDef() const; + + inline CMdEObjectDef& ObjectDef() const; + + inline CMdEObjectDef& ImageDef() const; + + inline CMdEObjectDef& VideoDef() const; + + inline CMdEObjectDef& AlbumDef() const; + + inline CMdEObjectDef& MediaDef() const; + inline CMdEObjectDef& TagDef() const; + + /** + * Return object definition used to describe months. + * @return object definition used to describe months. + */ + inline CMdEObjectDef& MonthDef() const; + + inline CMdERelationDef& ContainsDef() const; + + inline CMdERelationDef& ContainsLocationDef() const; + + /** + * Get the location definition. + * @return location definition. + */ + inline CMdEObjectDef& LocationDef() const; + + TContainerType ContainerType(CMdEObject* aObject); + + TContainerType ContainerType(CMdEObjectDef* aObjectDef); + + TItemType ItemType(CMdEObject* aObject); + + const TGlxMediaId GetMonthIdL(const TTime& aMonth); + + TBool SameMonth(const TTime& aOldDate, const TTime& aNewDate); + + TBool ContainerIsLeft(CMdEObjectDef& aObjectDef); + + // from MGlxMDSShutdownObserver + void ShutdownNotification(TInt aShutdownState); + +private: +#ifdef USE_S60_TNM + MThumbnailFetchRequestObserver* iTnFetchObserver; + CThumbnailManager* iTnEngine; + CFbsBitmap* iTnThumbnail; + CFbsBitmap* iThumbnail; + TThumbnailRequestId iTnThumbnailCbId; + TBool iTnRequestInProgress; + TInt iTnHandle; + TGlxMediaId iMediaId; + +#else + CGlxtnThumbnailCreator* iThumbnailCreator; + CGlxtnThumbnailDatabase* iThumbnailDatabase; +#endif + + CMdESession* iSession; + RFs iFs; + TBool iSessionOpen; + TGlxMediaId iCameraAlbumId; + TGlxMediaId iFavoritesId; + + CMdENamespaceDef* iNameSpaceDef; + CMdEObjectDef* iObjectDef; + CMdEObjectDef* iImageDef; + CMdEObjectDef* iVideoDef; + CMdEObjectDef* iAlbumDef; + CMdEObjectDef* iMediaDef; + CMdEObjectDef* iTagDef; + CMdEObjectDef* iMonthDef; + /** + * Location object definition. + */ + CMdEObjectDef* iLocationDef; + CMdERelationDef* iContainsDef; + CMdERelationDef* iContainsLocationDef; + + RArray iMonthArray; + RArray iMonthList; + RArray iAddedItems; + + TTime iFirstMonth; + TTime iLastMonth; + + CAsyncCallBack* iUpdateCallback; + + CAsyncCallBack* iCreateSessionCallback; + + struct TUpdateData + { + TItemId iId; + TMPXChangeEventType iType; + TBool iIsObject; + }; + + RArray iUpdateData; + TBool iPauseUpdate; + TInt iDeletedCount; + + RHarvesterClient iHC; + TBool iHarvestingOngoing; + + CGlxMDSShutdownObserver* iMDSShutdownObserver; + +#ifdef _DEBUG + TTime iStartTime; + TTime iStopTime; +#endif + }; + +#include "glxdatasourcemds.inl" + +#endif //_C_GLXDATASOURCEMDE_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + +#ifndef GLXDATASOURCEMDS_HRH +#define GLXDATASOURCEMDS_HRH + +// CONSTANTS + +#define KGlxDataSourceMdePluginDllUid 0x20000A16 +#define KGlxDataSourceMdeImplementationUid 0x20000A10 + +#endif // GLXDATASOURCEMDS_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2008-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: Inline methods for the data source MDS class +* +*/ + + + + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + +#include + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::Session +// ---------------------------------------------------------------------------- +// +CMdESession& CGlxDataSourceMde::Session() const + { + __ASSERT_DEBUG(iSessionOpen, Panic(EGlxPanicDatasourceMdeSessionNotOpen)); + return *iSession; + } + +#ifndef USE_S60_TNM +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ThumbnailCreator +// ---------------------------------------------------------------------------- +// +CGlxtnThumbnailCreator& CGlxDataSourceMde::ThumbnailCreator() const + { + return *iThumbnailCreator; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ThumbnailDatabase +// ---------------------------------------------------------------------------- +// +CGlxtnThumbnailDatabase& CGlxDataSourceMde::ThumbnailDatabase() const + { + return *iThumbnailDatabase; + } +#endif + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::FileServerSession +// ---------------------------------------------------------------------------- +// +//const RFs& CGlxDataSourceMde::FileServerSession() const + RFs& CGlxDataSourceMde::FileServerSession() + { + return iFs; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::CameraAlbumId +// ---------------------------------------------------------------------------- +// +const TGlxMediaId& CGlxDataSourceMde::CameraAlbumId() const + { + return iCameraAlbumId; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::FavoritesId +// ---------------------------------------------------------------------------- +// +const TGlxMediaId& CGlxDataSourceMde::FavoritesId() const + { + return iFavoritesId; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::NamespaceDef +// ---------------------------------------------------------------------------- +// +CMdENamespaceDef* CGlxDataSourceMde::NamespaceDef() const + { + return iNameSpaceDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ObjectDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::ObjectDef() const + { + return *iObjectDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ImageDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::ImageDef() const + { + return *iImageDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::VideoDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::VideoDef() const + { + return *iVideoDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::MediaDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::MediaDef() const + { + return *iMediaDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::AlbumDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::AlbumDef() const + { + return *iAlbumDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::TagDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::TagDef() const + { + return *iTagDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::MonthDef +// ---------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::MonthDef() const + { + return *iMonthDef; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceMde::ContainsDef +// ---------------------------------------------------------------------------- +// +CMdERelationDef& CGlxDataSourceMde::ContainsDef() const + { + return *iContainsDef; + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde::ContainsLocationDef +// --------------------------------------------------------------------------- +// +CMdERelationDef& CGlxDataSourceMde::ContainsLocationDef() const + { + return *iContainsLocationDef; + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde::LocationDef +// --------------------------------------------------------------------------- +// +CMdEObjectDef& CGlxDataSourceMde::LocationDef() const + { + return *iLocationDef; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemdsutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemdsutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + +#ifndef GLXDATASOURCEMDSUTILITY_H_ +#define GLXDATASOURCEMDSUTILITY_H_ + +#include +#include +#include + +namespace NGlxDataSourceMdsUtility + { + /** + * Copies all the elements in an array of TGlxMediaIds to an array of TItemIds + * @param aDestArray destination array. It is the callers responsibility to + * ensure that aDestArray is on the cleanupstack prior to making the call + * to this method. + * @param aSrcArray source array. + */ + void CopyMediaIdArrayL(RArray& aDestArray, + const RArray& aSrcArray); + /** + * Copies all the elements in an array of TItemIds to an array of TGlxMediaIds + * @param aDestArray destination array. It is the callers responsibility to + * ensure that aDestArray is on the cleanupstack prior to making the call + * to this method. + * @param aSrcArray source array. + */ + void CopyItemIdArrayL(RArray& aDestArray, + const RArray& aSrcArray); + + void AddObjectConditionL(CMdELogicCondition& aLogicCondition, + const RArray& aMediaIds); + } + +#endif /*GLXDATASOURCEMDSUTILITY_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,276 @@ +/* +* Copyright (c) 2008-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: Data source Task MDS Class +* +*/ + + + + +#ifndef _C_GLXDATASOURCETASKMDS_H_ +#define _C_GLXDATASOURCETASKMDS_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CGlxDataSourceMde; +class CGlxRequest; +class CGlxtnThumbnailCreator; +class CMdEObjectDef; +class CMdEObjectQuery; +class CMdESession; + + +/** + * Query types supported by subclasses of CGlxDataSourceTaskMde + */ +enum TGlxQueryType + { + EContainerFirstItemQuery, // CGlxDataSourceTaskMdeThumbnail+ + EIdListQuery, // GlxDataSourceTaskMdeIdList + EAttributeQuery, // CGlxDataSourceTaskMdeAttribute + ELocationAttributeQuery, // CGlxDataSourceTaskMdeAttribute + EImageVideoQuery, // CGlxDataSourceTaskMdeAttribute (but should be general) + ECommandRemoveFromContainer, // CGlxDataSourceTaskMdeCommand + ECommandAddToContainer, // CGlxDataSourceTaskMdeCommand + ECommandRemoveLocation, // CGlxDataSourceTaskMdeCommand + ECommandAddContainer, // CGlxDataSourceTaskMdeCommand adds a container + ECommandDeleteContainers, // CGlxDataSourceTaskMdeCommand deletes containers objects + ECommandDeleteItems, // CGlxDataSourceTaskMdeCommand deletes containers objects + ECommandRenameContainer, + ECommandRename + }; + +/** + * CGlxDataSourceTaskMde class + * Base class for mde tasks: provides task generic functionality. + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMde) : public CGlxDataSourceTask, + public MMdEQueryObserver + { +public: + /** + * Constructor. + * @param aRequest request to be executed. + * @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); + + /** + * Destructor. + */ + ~CGlxDataSourceTaskMde(); + + /** + * Second stage constructor + */ + virtual void ConstructL(); + +protected: // to be implemented by deriving classes + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + virtual void ExecuteRequestL() = 0; + + /** + * Must be implemented by deriving classes. To handle query completion + * @param aQuery Query that has been completed. + */ + virtual void DoHandleQueryCompletedL(CMdEQuery& aQuery) = 0; + + /** + * Optionally implemented by deriving classes. Used if the deriving class has + * to run more than one query. Should start the next query or call HandleRequestComplete() + * if no futher queries are required to be run. If the deriving class only has a single query, + * HandleRequestComplete() can be called from DoHandleQueryCompletedL() + */ + virtual void DoNextQueryL() {} + +public: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::CancelRequest + */ + void CancelRequest(); + +private: // from MMdEQueryObserver + /** + * See @ref MMdEQueryObserver::HandleQueryNewResults + */ + void HandleQueryNewResults( CMdEQuery& aQuery, + TInt aFirstNewItemIndex, + TInt aNewItemCount ); + /** + * See @ref MMdEQueryObserver::HandleQueryNewResults + */ + void HandleQueryNewResults( CMdEQuery& aQuery, + TInt aNewObjectItemCount, + TInt aNewRelationItemCount, + TInt aNewEventItemCount); + /** + * See @ref MMdEQueryObserver::HandleQueryCompleted + */ + void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError); + +protected: + + /** + * Returns a pointer to the CGlxDataSourceMde object passed in on instantiation. + * @return a pointer to the CGlxDataSourceMde object passed in on instantiation. + */ + CGlxDataSourceMde* DataSource(); + + void AddMonthFilterL(const TGlxMediaId& aContainerId, + TGlxFilterProperties& aFilterProperties); + + void AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties); + + /** + * Set query contditions by container id and filter properties. + * @param aLogicCondition logic condition to add conditions to + * @param aContainerId Id of the container + * @param aContainerIsLeft. This should be set to to ETrue if the container is on the left side of the releation, or + * 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 SetQueryFilterConditionsL(CMdELogicCondition& aLogicCondition, 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. + * @return Maximum number of results + */ + TInt MaxQueryResultsCount(const TGlxFilterProperties& aFilterProperties) const; + + /** + * Removes and destroys the oldest query in iQueries. + */ + void RemoveQuery(); + + 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 + * of type image or video that have ids specified by aObjectIds. + * @param aObjectIds A list of the ids of the required objects. + * @param aFilterProperties TGlxFilterProperties.iItemType is used to determine if only + * 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); + + /** + * Adds a query for tag objects that have ids specified by aObjectIds + * to the query queue. + * @param aObjectIds A list of the ids of the required objects. + */ + void QueueTagObjectQueryL(const RArray& aObjectIds); + + /** + * Adds a query for album objects that have ids specified by aObjectIds + * to the query queue. + * @param aObjectIds A list of the ids of the required objects. + */ + void QueueAlbumObjectQueryL(const RArray& aObjectIds); + + /** + * Adds a query for "month" objects that have ids specified by aObjectIds + * to the query queue. + * @param aObjectIds A list of the ids of the required objects. + */ + void QueueMonthObjectQueryL(const RArray& aObjectIds); + + /** + * Adds a query for objects of type specified by aObjectDef + * that have ids specified by aObjectIds to the query queue. + * @param aObjectDef type of objects required. + * @param aObjectIds A list of the ids of the required objects. + * @param aQueryType The query type. + */ + void QueueObjectQueryL(CMdEObjectDef& aObjectDef, + const RArray& aObjectIds, const TGlxQueryType& aQueryType); + + /** + * Appends a query to the query queue. (the ownership of the query is transferred) + * @param aQuery query to append to the query queue ownership is transferred to + * the query queue. It is expected that aQuery is not on the cleanupstack before the + * call to AppendQueryL is made + * @param aQueryType the query type. + */ + void AppendQueryL(CMdEQuery* aQuery, const TGlxQueryType& aQueryType); + + /** + * Executes the query at ordinal 0 in the + * query list implementation can be overidden by + * deriving classes. + */ + virtual void ExecuteQueryL(); + +private: + /* + * Helper function TRAPed and called by HandleQueryCompleted() + * @param aQuery the query that has been completed + */ + void HandleQueryCompletedL(CMdEQuery& aQuery); + + /** + * Removes the observer from any existing queries, cancels and destroys them + */ + void DestroyQueries(); + +private: + /** + * Default namespace def (not owned) + */ + CMdENamespaceDef* iDefaultNameSpaceDef; + +protected: + /** + * Outstanding queries array (owned) + */ + RPointerArray iQueries; + + /** + * Query types array (owned) + */ + RArray iQueryTypes; + + /** + * Filter properties + */ + TGlxFilterProperties iFilterProperties; + }; + +#endif //_C_GLXDATASOURCETASKMDS_H_ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsattribute.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsattribute.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2008-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: Data Source Task MDS Attribute Class +* +*/ + + + + +#ifndef _C_GLXDATASOURCETASKMDSATTRIBUTETASK_H_ +#define _C_GLXDATASOURCETASKMDSATTRIBUTETASK_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +#include +#include "glxdatasourcetaskmds.h" + + +// CLASS DECLARATION + +class CGlxGetRequest; + +NONSHARABLE_CLASS(TGlxQueryAttribute) + { +public: + TGlxQueryAttribute( + TMPXAttribute aAttribute, + CMPXMedia* aMedia, + TGlxFilterProperties aFilterProperties + ) : + iAttribute(aAttribute), + iMedia(aMedia), + iFilterProperties(aFilterProperties) + { + + }; +public: + TMPXAttribute iAttribute; + CMPXMedia* iMedia; + TGlxFilterProperties iFilterProperties; + }; + +/** + * Attribute retrieval task. + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeAttributeMde) : public CGlxDataSourceTaskMde + { +public: + /** + * Constructor. + * @param aRequest request to be executed. + * @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); + + /** + * Destructor. + */ + ~CGlxDataSourceTaskMdeAttributeMde(); + +private: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + +private: // From CGlxDataSourceTaskMde + /** + * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + + /** + * See @ref CGlxDataSourceTaskMde::DoNextQueryL + */ + void DoNextQueryL(); + +private: + + void AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry); + + void AddCollectionAttributesL(CMPXMedia* aEntry); + + void AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, + CGlxDataSource::TContainerType aType); + + void AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, + CGlxDataSource::TItemType aType); + + /** + * Add location information to a media object from MDS. + * @param aLocationId the id of a location object. + * @param aMedia media object to add a location attribute to. + */ + void AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId); + + + void DoHandleAttributeQueryCompletedL(); + + /** + * Handles the completion of a query of type ELocationQuery. + */ + void DoHandleLocationQueryCompletedL(); + + + void DoHandleImageVideoQueryCompletedL(); + + /** + * Creates a location query and adds it to the queue of queries. + */ + void QueueLocaitonQueryL(); + + /** + * @param aObjectDef object definition which defines objects which will be queried + * @param aIsContent If ETrue, the definition of the objects being queried is set by the item type filter property, if EFalse, the definition + * 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, + const TGlxFilterProperties& aFilterProperties); + + + void DoHandleAttributeResponseCompleteL(); + + + /** + * Determines if the request contains the KGlxMediaGeneralLocation attribtue. + * @return ETrue if the the KGlxMediaGeneralLocation attribute is requrested else EFalse + */ + TBool LocationAttributeRequested(); + + /** + * Executes the next query in the queue of queries. + */ + void ExecuteQueryL(); + +private: + /** + * Results media array (owned) + */ + CMPXMediaArray* iMediaArray; + + /** + * Attributes associated with outstanding queries + */ + RArray< TGlxQueryAttribute > iQueryAttributes; + }; + + +#endif // _C_GLXDATASOURCETASKMDSATTRIBUTETASK_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,338 @@ +/* +* Copyright (c) 2008-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: Data Source Task MDS Command Class +* +*/ + + + + +#ifndef _C_GLXDATASOURCETASKMDSCOMMAND_H_ +#define _C_GLXDATASOURCETASKMDSCOMMAND_H_ + +/** + * @internal reviewed 10/07/2007 by M Byrne + */ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include "glxdatasourcetaskmds.h" + +// FORWARD DECLARATIONS +class CGlxDataSourceMde; +class CGlxRequest; +class CGlxStringCache; +class CMdENamespaceDef; +class CMdEObjectDef; +class CMdEObjectQuery; +class CMdERelationDef; +class CMdERelationQuery; +class CMdESession; + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxDataSourceTaskMdeCommand class + * + */ +NONSHARABLE_CLASS( CGlxDataSourceTaskMdeCommand ) : public CGlxDataSourceTaskMde, + public MGlxCommandParserCallback + + { +public: // Constructors / Destructors + /** + * Constructor. + * @param aRequest request to be executed. + * @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, + CGlxDataSource* aDataSource); + + /** + * Symbian 2nd stage constructor + * See @ref CGlxDataSourceTaskMde::ConstructL + */ + void ConstructL(); + + /** + * Destructor + */ + ~CGlxDataSourceTaskMdeCommand(); + +private: // From MGlxCommandParserCallback + + /** + * See @ref MGlxCommandParserCallback::AddContainerL + */ + void AddContainerL(const TDesC& aContainerName); + + /** + * See @ref MGlxCommandParserCallback::AddToContainerL + */ + void AddToContainerL(const RArray& aSourceIds, + const RArray& aTargetContainers); + + /** + * See @ref MGlxCommandParserCallback::AddToContainerL + */ + void AddToContainerL(const TDesC& aSourceUri, + const RArray& aTargetContainers); + + /** + * See @ref MGlxCommandParserCallback::CopyL + */ + void CopyL(const RArray& aSourceIds, const TDesC& aDrive); + + /** + * See @ref MGlxCommandParserCallback::MoveL + */ + void MoveL(const RArray& aSourceIds, const TDesC& aDrive); + + /** + * See @ref MGlxCommandParserCallback::RemoveFromContainerL + */ + void RemoveFromContainerL(const RArray& aItemIds, + const TGlxMediaId& aContainerId); + + /** + * See @ref MGlxCommandParserCallback::DeleteL + */ + void DeleteL(const RArray& aItemIds); + + /** + * See @ref MGlxCommandParserCallback::RenameL + */ + void RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle); + + /** + * See @ref MGlxCommandParserCallback::SetDescriptionL + */ + void SetDescriptionL(const RArray& aItemIds, + const TDesC& aDescription); + + /** + * See @ref MGlxCommandParserCallback::SetCaptureLocationL + */ + void SetCaptureLocationL(const RArray& aItemIds, + const TCoordinate& aCoordinate); + + /** + * See @ref MGlxCommandParserCallback::ThumbnailCleanupL + */ + void ThumbnailCleanupL(); + +private: // from CGlxDataSourceTaskMde + + /** + * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + + /** + * See @ref CGlxDataSourceTaskMde::DoNextQueryL + */ + void DoNextQueryL(); + +private: + + /** + * Enumeration to describe file operations + * (Copy or Move) + */ + enum TFileOperation + { + ECopy, + EMove + }; + + /** + * Perform a file operation (copy or move). + * @param aSourceIds an array of media ids to copy or move. + * @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); + + /** + * Gets the container id for a given media id. + * If aMedia id is KGlxCollectionRootId (0) then container id + * is determined using the collection id. E.g. if the aMediaId + * is KGlxCollectionRootId and the collection uid is + * KGlxCollectionPluginCameraImplementationUid + * then the camera album id is returned by the method. + * When aMedia id is not equal to KGlxCollectionRootId, (the + * vast majority of cases) the container id returned by the method + * will be the same as the media id passed in. + * + * @param aMediaId should be either a valid container id or KGlxCollectionRootId + * @return a container id. + */ + TItemId ContainerItemId(const TGlxMediaId& aMediaId); + + /** + * Uses the PathInfo class to determine the 'root' path for + * a given drive. The 'root' path is C:\data for the C drive and + * x:\ for all other drives (where x is a drive letter) + * @param aDrive the drive for which the root path is required. + * @param aRootPath on return contains the root path. + */ + void RootPath(const TDesC& aDrive, TDes& aRootPath); + +#if 0 + /** + * Copies items from a TGlxMedia array to a TItemId array. + * @param aDestArray destination array. (It is the callers responsibility to ensure that aDestArray is on + * the cleanup stack should this be required) + * @param aSourceArray source array. + */ + void CopyArrayL(RArray& aDestArray, const RArray& aSourceArray); +#endif + + /** + * Sends progress messages to the client + * @param aCurrentStep number of currently completed steps. + * @param aStepCount number of total steps to completion. + */ + void SendProgressMessageL(TInt aCurrentStep, TInt aStepCount); + + /** + * Returns the container object definition (either album or tag) + * the container object definition is calculated based on the + * collection plug-in id associated with the task. + * @param aContainerObjectDef a pointer to the container object + * definition associated with the collection plugin if the + * function completes with out error. The caller does not take + * ownership of the pointer. + * @return KErrNone if the collection plug-in has a container + * object definition associated with it or a system wide + * error code. + */ + TInt ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef); + + /** + * Handle the completion of a 'add to container' query. + * @param aQuery Query that has been completed. + */ + void DoHandleAddToContainerQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'add container' query. + * @param aQuery Query that has been completed. + */ + void DoHandleAddContainerQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'delete containers' query. + * @param aQuery Query that has been completed. + */ + void DoHandleDeleteContainersQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'delete items' query. + * @param aQuery Query that has been completed. + */ + void DoHandleDeleteItemsQueryCompletedL(CMdEQuery& aQuery); + + + /** + * Handle the completion of a 'rename' query. + * @param aQuery Query that has been completed. + */ + void DoHandleRenameQueryCompletedL(CMdEQuery& aQuery); + + /** + * Handle the completion of a 'rename container' query. + * @param aQuery Query that has been completed. + */ + void DoHandleRenameConainerQueryCompletedL(CMdEQuery& aQuery); + + /** + * Appends a query to the query queue that determines the number + * of container objects that have the title aTitle. This + * method is used to check to see if a container with a + * specific title exists. The container type is determined + * using the ContainerObjectDef() method + * @aQueryType the query type. + * @aTitle title to search for. + */ + void AppendContainerTitleCountQueryL(const TGlxQueryType& aQueryType, const TDesC& aTitle); + +private: // from CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + + /** + * Matches the given resource ID with the title(user defined new album) + */ + + TInt SearchStringL(TInt aResourceId); + +private: + /** + * Default name space definition. + */ + CMdENamespaceDef* iDefaultNameSpaceDef; + + /** + * Collection uid. + */ + TUid iCollectionUid; + + /** + * Before new relations are added to the database, a check must be made to see if + * identical relations already exist. This is done asynchronously so they need to + * be stored temporarily as a member variable. + */ + RArray iLeftIds; + + /** + * Before new relations are added to the database, a check must be made to see if + * identical relations already exist. This is done asynchronously so they need to + * be stored temporarily as a member variable. + */ + RArray iRightIds; + + /** + * Used to store object titles while asynchronous operations are in progress. + * (owned) + */ + HBufC* iTitle; + + /** + * Used to store the object to rename while asynchronous operations are in progress. + * (owned) + */ + CMdEObject* iObjectToRename; + + /** + * Used to get the localized string from the cache + * + */ + CGlxStringCache* iStringCache; + }; + +#endif //_C_GLXDATASOURCETASKMDSCOMMAND_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008-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: Data Source Task MDS IDlist class +* +*/ + + + + +#ifndef GLXDATASOURCETASKMDSIDLIST_H_ +#define GLXDATASOURCETASKMDSIDLIST_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +// INCLUDES +#include +#include + +#include +#include +#include +#include +#include +#include +#include "glxdatasourcetaskmds.h" +// FORWARD DECLARATIONS +class CGlxDataSourceMde; +class CGlxIdListRequest; +class CGlxtnThumbnailCreator; +class CMdEObjectDef; +class CMdEObjectQuery; +class CMdESession; + +/** + * CGlxDataSourceTaskMdeIdList class + * Task to handle id list requests. + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeIdList) : public CGlxDataSourceTaskMde, + public MGlxtnThumbnailCreatorClient + + { +public: + /** + * Constructor. + * @param aRequest request to be executed. + * @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); + + /** + * Destructor. + */ + ~CGlxDataSourceTaskMdeIdList(); + +private: // from MGlxtnThumbnailCreatorClient + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete + */ + void ThumbnailFetchComplete(const TGlxMediaId& /*aItemId*/, + TGlxThumbnailQuality /*aQuality*/, TInt /*aErrorCode*/) {}; + + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete + */ + void ThumbnailDeletionComplete(const TGlxMediaId& /*aItemId*/, + TInt /*aErrorCode*/) {}; + + /** + * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete + */ + void FilterAvailableComplete(const RArray& aIdArray, + TInt aErrorCode); + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL + */ + void FetchFileInfoL(CGlxtnFileInfo* /*aInfo*/, + const TGlxMediaId& /*aItemId*/, TRequestStatus* /*aStatus*/) {}; + + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri + */ + void CancelFetchUri(const TGlxMediaId& /*aItemId*/) {}; + + /** + * Not used (pure virtual stubbed) + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage + */ + MGlxtnThumbnailStorage* ThumbnailStorage() { return NULL; }; + +public: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + +private: // from CGlxDataSourceTaskMde + /** + * See @ref CGlxDataSourceTask::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + +private: + void DoHandleListQueryCompletedL(); + + void DoMonthListCreationL(CMdEQuery& aQuery, const TGlxFilterProperties& + aFilterProperties); + + void DoPostFilterComplete(const RArray& aIdArray, TInt aErrorCode); + + void PostFilterL(const RArray& aFilteredList, + const TGlxFilterProperties& aFilterProperties); + }; + +#endif // GLXDATASOURCETASKMDSIDLIST_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2008-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: Data Source Task MDS thumbnail Class +* +*/ + + + + +#ifndef GLXDATASOURCETASKMDSTHUMBNAIL_H_ +#define GLXDATASOURCETASKMDSTHUMBNAIL_H_ + +/** + * @author Simon Brooks, Alex Birkett + */ + +#include "glxdatasourcetaskmdsattribute.h" + +#ifdef USE_S60_TNM +#include "mthumbnailfetchrequestobserver.h" +#endif + +#include +#include + +/** + * CGlxDataSourceTaskMdeThumnail class + * Services thumbnail requests + */ +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeThumbnail) : public CGlxDataSourceTaskMde +#ifdef USE_S60_TNM + , public MThumbnailFetchRequestObserver +#else + , public MGlxtnThumbnailCreatorClient +#endif + { +public: + /** + * Constructor + * @param aRequest thumbnail request to service + * @param aObserver observer + * @param aDataSource data source + */ + CGlxDataSourceTaskMdeThumbnail(CGlxThumbnailRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); + + /** + * Destructor + */ + ~CGlxDataSourceTaskMdeThumbnail(); + +private: // From CGlxDataSourceTask + /** + * See @ref CGlxDataSourceTask::ExecuteRequestL + */ + void ExecuteRequestL(); + /** + * See @ref CGlxDataSourceTask::HandleRequestComplete + */ + void HandleRequestComplete(TInt aError); + +private: // From CGlxDataSourceTaskMde + /** + * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL + */ + void DoHandleQueryCompletedL(CMdEQuery& aQuery); + +#ifdef USE_S60_TNM +private: //MThumbnailFetchRequestObserver + void ThumbnailFetchComplete(TInt aError, TBool aQuality); + void FetchFileInfoL(); +#endif + +private: // From MGlxtnThumbnailCreatorClient + /** + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete + */ + void ThumbnailFetchComplete(const TGlxMediaId& aItemId, + TGlxThumbnailQuality aQuality, TInt aErrorCode); + + /** + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete + */ + void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); + + /** + * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete + */ + void FilterAvailableComplete(const RArray& aIdArray, TInt aErrorCode); + + /** + * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL + */ + void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, + TRequestStatus* aStatus); + + /** + * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri + */ + void CancelFetchUri(const TGlxMediaId& aItemId); + + /** + * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage + */ + MGlxtnThumbnailStorage* ThumbnailStorage(); + +private: + void HandleThumbnailFetchCompleteL(const TGlxMediaId& aId, + TGlxThumbnailQuality aQuality); + + void DoHandleContainerFirstItemQueryCompletedL(); + + void CompleteFetchFileInfoL(CMdEObject* aItem); + +private: + void CompleteThumbnailRequest(TInt aError); + +private: + CGlxtnFileInfo* iTnFileInfo; + + TRequestStatus* iTnRequestStatus; + + TBool iTnRequestInProgress; + }; + +#endif // GLXDATASOURCETASKMDSTHUMBNAIL_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/mthumbnailfetchrequestobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/mthumbnailfetchrequestobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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 : class header for thumbnail fetch request observer +* +*/ + + + +#ifndef M_THUMBNAILFETCHREQUESTOBSERVER_H +#define M_THUMBNAILFETCHREQUESTOBSERVER_H + + +class CGlxtnFileInfo; + +// CLASS DECLARATION + +class MThumbnailFetchRequestObserver + { +public: + virtual void ThumbnailFetchComplete(TInt aError, TBool aQuality) = 0; + virtual void FetchFileInfoL() = 0; + }; + +#endif // M_THUMBNAILFETCHREQUESTOBSERVER_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1250 @@ +/* +* Copyright (c) 2008-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: Data Source MDS Class +* +*/ + + + + +// INCLUDE FILES +#include "glxdatasourcemds.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef USE_S60_TNM +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcetaskmds.h" +#include "glxdatasourcetaskmdsattribute.h" +#include "glxdatasourcetaskmdscommand.h" +#include "glxdatasourcetaskmdsidlist.h" +#include "glxdatasourcetaskmdsthumbnail.h" + +#ifdef USE_S60_TNM +const TInt KMaxGridThumbnailWidth = 200; +#else +const TInt KGlxThumbnailCleanupAfterDeletions = 200; + +_LIT(KGlxMdeDataSourceThumbnailDatabase, "glxmdstn"); +#endif + +_LIT(KObjectDefLocation, "Location"); +_LIT(KObjectDefNameAlbum, "Album"); +_LIT(KObjectDefNameImage, "Image"); +_LIT(KObjectDefNameMedia, "MediaObject"); +_LIT(KObjectDefNameObject, "Object"); +_LIT(KObjectDefNameTag, "Tag"); +_LIT(KObjectDefNameVideo, "Video"); +_LIT(KPropertyDefNameCreationDate, "CreationDate"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KPropertyDefNameTitle, "Title"); +_LIT(KRelationDefNameContains, "Contains"); +_LIT(KRelationDefNameContainsLocation, "ContainsLocation"); + +_LIT(KObjectDefNameMonth, "MediaObject");/// @todo nasty hack remove and use base object + +_LIT(KGlxMdeCameraAlbumUri, "defaultalbum_captured"); +_LIT(KGlxMdeFavoritesUri, "defaultalbum_favourites"); + +#undef __USING_INTELLIGENT_UPDATE_FILTERING + +const TInt KHarvestUpdateChunkSize = 1000; + +// --------------------------------------------------------------------------- +// MPXChangeEventType +// Helper method +// --------------------------------------------------------------------------- +// +TMPXChangeEventType MPXChangeEventType(const TObserverNotificationType& aType) + { + TMPXChangeEventType type = EMPXItemInserted; + + switch (aType) + { + case ENotifyAdd: + type = EMPXItemInserted; + break; + case ENotifyModify: + type = EMPXItemModified; + break; + case ENotifyRemove: + type = EMPXItemDeleted; + break; + } + 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 ============================== + +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CGlxDataSourceMde* CGlxDataSourceMde::NewL() + { + TRACER("CGlxDataSourceMde* CGlxDataSourceMde::NewL()"); + CGlxDataSourceMde* ds = new (ELeave) CGlxDataSourceMde(); + CleanupStack::PushL(ds); + ds->ConstructL(); + CleanupStack::Pop(ds); + return ds; + } + +// --------------------------------------------------------------------------- +// ~CGlxDataSourceMde() +// --------------------------------------------------------------------------- +// + +CGlxDataSourceMde::~CGlxDataSourceMde() + { + TRACER("CGlxDataSourceMde::~CGlxDataSourceMde()"); + delete iSession; + +#ifdef USE_S60_TNM + delete iTnThumbnail; + iTnThumbnail = NULL; + + delete iThumbnail; + iThumbnail = NULL; + + delete iTnEngine; + iTnEngine = NULL; +#else + if (iThumbnailCreator) + { + iThumbnailCreator->Close(iThumbnailDatabase); + } + 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 ; + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde() +// --------------------------------------------------------------------------- +// +CGlxDataSourceMde::CGlxDataSourceMde() + { + TRACER("CGlxDataSourceMde::CGlxDataSourceMde()"); + //No Implementation + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::ConstructL() + { + TRACER("CGlxDataSourceMde::ConstructL()"); + + iDataSourceReady = EFalse; + User::LeaveIfError(iFs.Connect()); + iSession = CMdESession::NewL( *this ); + + User::LeaveIfError(RFbsSession::Connect()); + +#ifdef USE_S60_TNM + iTnEngine = CThumbnailManager::NewL( *this); + iTnEngine->SetDisplayModeL( EColor64K ); + + 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; + } + +// ---------------------------------------------------------------------------- +// from MMdESessionObserver +// CMPXCollectionMdEPlugin::HandleSessionOpened +// ---------------------------------------------------------------------------- +// +void 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 ) + { + HandleSessionError(aSession, err); + } + + iSessionOpen = ETrue; + iDataSourceReady = ETrue; + TryStartTask(ETrue); + } + +// ---------------------------------------------------------------------------- +// from MMdESessionObserver +// CMPXCollectionMdEPlugin::HandleSessionError +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt aError ) + { + TRACER("CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt aError)") + iSession = NULL; + + GLX_DEBUG2("void CGlxDataSourceMde::HandleSessionError() Session Error = %d", aError); + + iDataSourceReady = EFalse; + iSessionOpen = EFalse; + + // 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) + { + 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); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else if (dynamic_cast< CGlxGetRequest *>(aRequest)) + { + CleanupStack::PushL(aRequest); + CGlxDataSourceTaskMdeAttributeMde* task = new (ELeave) + CGlxDataSourceTaskMdeAttributeMde(static_cast(aRequest), + aObserver, this); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else if (dynamic_cast< CGlxIdListRequest *>(aRequest)) + { + CleanupStack::PushL(aRequest); + CGlxDataSourceTaskMdeIdList* task = new (ELeave) + CGlxDataSourceTaskMdeIdList(static_cast(aRequest), + aObserver, this); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else if (dynamic_cast< CGlxThumbnailRequest *>(aRequest)) + { + CleanupStack::PushL(aRequest); + CGlxDataSourceTaskMdeThumbnail* task = new (ELeave) + CGlxDataSourceTaskMdeThumbnail(static_cast(aRequest), + aObserver, this); + CleanupStack::Pop(aRequest); // now owned by task + CleanupStack::PushL(task); + task->ConstructL(); + CleanupStack::Pop(task); + return task; + } + else + { + User::Leave(KErrNotSupported); + return NULL; // stops compiler warning + } + } + +#ifndef USE_S60_TNM +// --------------------------------------------------------------------------- +// ThumbnailAvailable +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& + /*aId*/, const TSize& /*aSize*/) + { + TRACER("CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& /*aId*/, const TSize& /*aSize*/)"); + //No implementation + } + +// --------------------------------------------------------------------------- +// BackgroundThumbnailError +// --------------------------------------------------------------------------- +// +void 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)); + } +#endif + +// --------------------------------------------------------------------------- +// BackgroundThumbnailMessageL +// --------------------------------------------------------------------------- +// +void 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); + message->SetTObjectValueL(KGlxBackgroundThumbnailMediaId, aId.Value()); + message->SetTObjectValueL(KGlxBackgroundThumbnailSize, aSize); + message->SetTObjectValueL(KGlxBackgroundThumbnailError, aError); + BroadcastMessage(*message); + CleanupStack::PopAndDestroy(message); + } + +// --------------------------------------------------------------------------- +// DoSessionInitL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::DoSessionInitL() + { + TRACER("CGlxDataSourceMde::DoSessionInitL()"); + /// @todo check schema version number + iNameSpaceDef = &iSession->GetDefaultNamespaceDefL(); + + CMdEObject* cameraAlbum = iSession->GetObjectL(KGlxMdeCameraAlbumUri); + if ( !cameraAlbum ) + { + User::Leave(KErrCorrupt); + } + iCameraAlbumId = (TGlxMediaId)cameraAlbum->Id(); + delete cameraAlbum; + + CMdEObject* favorites = iSession->GetObjectL(KGlxMdeFavoritesUri); + if ( !favorites ) + { + User::Leave(KErrCorrupt); + } + iFavoritesId = (TGlxMediaId)favorites->Id(); + delete favorites; + + + iContainsDef = &iNameSpaceDef->GetRelationDefL(KRelationDefNameContains); + iContainsLocationDef = &iNameSpaceDef->GetRelationDefL(KRelationDefNameContainsLocation); + + iObjectDef = &iNameSpaceDef->GetObjectDefL(KObjectDefNameObject); + iImageDef = &iNameSpaceDef->GetObjectDefL(KObjectDefNameImage); + iVideoDef = &iNameSpaceDef->GetObjectDefL(KObjectDefNameVideo); + iMediaDef = &iNameSpaceDef->GetObjectDefL(KObjectDefNameMedia); + iAlbumDef = &iNameSpaceDef->GetObjectDefL(KObjectDefNameAlbum); + iTagDef = &iNameSpaceDef->GetObjectDefL(KObjectDefNameTag); + iMonthDef = &iNameSpaceDef->GetObjectDefL(KObjectDefNameMonth); + iLocationDef = &iNameSpaceDef->GetObjectDefL(KObjectDefLocation); + + AddMdEObserversL(); + + PrepareMonthsL(); + } + +// --------------------------------------------------------------------------- +// AddMdEObserversL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::AddMdEObserversL() + { + TRACER("CGlxDataSourceMde::AddMdEObserversL()"); + iSession->AddRelationObserverL(*this); + iSession->AddRelationPresentObserverL(*this); + + iSession->AddObjectObserverL(*this); + iSession->AddObjectPresentObserverL(*this); + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde::HandleObjectNotification +// --------------------------------------------------------------------------- +// +///@todo AB test this +void CGlxDataSourceMde::HandleObjectNotification(CMdESession& /*aSession*/, + TObserverNotificationType aType, + const RArray& aObjectIdArray) + { + 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)); + if(!err) + { + iDeletedCount = 0; + } + } + } + + if(MPXChangeEventType(aType) == EMPXItemModified ) + { + GLX_LOG_INFO("EMPXItemModified"); + TRAP_IGNORE(ThumbnailCreator().CleanupThumbnailsL(iThumbnailDatabase)); + } +#endif + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde::HandleObjectPresentNotification +// --------------------------------------------------------------------------- +// +///@todo AB test this +void CGlxDataSourceMde::HandleObjectPresentNotification(CMdESession& /*aSession*/, + TBool aPresent, const RArray& aObjectIdArray) + { + TRACER("CGlxDataSourceMde::HandleObjectPresentNotification()"); + if (aPresent) + { + ProcessUpdateArray(aObjectIdArray, EMPXItemInserted, ETrue); + } + else + { + ProcessUpdateArray(aObjectIdArray, EMPXItemDeleted, ETrue); + } + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde::HandleRelationNotification +// --------------------------------------------------------------------------- +// +///@todo AB test this +void CGlxDataSourceMde::HandleRelationNotification(CMdESession& /*aSession*/, + TObserverNotificationType aType, + const RArray& aRelationIdArray) + { + TRACER("CGlxDataSourceMde::HandleRelationNotification()"); + ProcessUpdateArray(aRelationIdArray, MPXChangeEventType(aType), EFalse); + } + +// --------------------------------------------------------------------------- +// CGlxDataSourceMde::HandleRelationPresentNotification +// --------------------------------------------------------------------------- +// +///@todo AB test this +void CGlxDataSourceMde::HandleRelationPresentNotification(CMdESession& /*aSession*/, + TBool aPresent, const RArray& aRelationIdArray) + { + TRACER("CGlxDataSourceMde::HandleRelationPresentNotification()"); + if (aPresent) + { + ProcessUpdateArray(aRelationIdArray, EMPXItemInserted, EFalse); + } + else + { + ProcessUpdateArray(aRelationIdArray, EMPXItemDeleted, EFalse); + } + } + +// --------------------------------------------------------------------------- +// ProcessUpdateArray +// --------------------------------------------------------------------------- +// +void 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]; + update.iType = aType; + update.iIsObject = aIsObject; + if( iUpdateData.Count() ) + { + if( ( iUpdateData[0].iType == aType ) && ( iUpdateData[0].iIsObject ) ) + { + return; + } + } + if( iUpdateData.Append(update) == KErrNone ) // if we can't allocate space for the update, ignore it + { + iUpdateCallback->CallBack(); + } + } + +// --------------------------------------------------------------------------- +// CreateSession +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::CreateSession() + { + TRACER("CGlxDataSourceMde::CreateSession()") + TRAP_IGNORE(CreateSessionL()); + } + +// --------------------------------------------------------------------------- +// CreateSession +// --------------------------------------------------------------------------- +// +TInt CGlxDataSourceMde::CreateSession(TAny* aPtr) + { + TRACER("CGlxDataSourceMde::CreateSession(TAny* aPtr)"); + CGlxDataSourceMde* self + = reinterpret_cast( aPtr ); + TRAP_IGNORE(self->CreateSessionL()); + return 0; + } + +// --------------------------------------------------------------------------- +// CreateSessionL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::CreateSessionL() + { + TRACER("CGlxDataSourceMde::CreateSessionL()"); + iSession = CMdESession::NewL( *this ); + } + + +// --------------------------------------------------------------------------- +// ProcessItemUpdate +// --------------------------------------------------------------------------- +// +TInt CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr) + { + TRACER("CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr)"); + CGlxDataSourceMde* self + = reinterpret_cast( aPtr ); + TRAP_IGNORE(self->ProcessItemUpdateL()); + return 0; + } + +// --------------------------------------------------------------------------- +// ProcessItemUpdateL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::ProcessItemUpdateL() + { + TRACER("CGlxDataSourceMde::ProcessItemUpdateL()"); + //__ASSERT_DEBUG(iUpdateData.Count(), Panic(EGlxPanicIllegalState)); + if ( !iUpdateData.Count() || iPauseUpdate ) + { + return; + } + CMPXMessage* message = CMPXMessage::NewL(); + CleanupStack::PushL(message); + message->SetTObjectValueL(KMPXMessageGeneralId, KMPXMessageIdItemChanged); + message->SetTObjectValueL(KMPXMessageChangeEventType, + iUpdateData[0].iType); + TMPXGeneralCategory category = EMPXNoCategory; + TMPXItemId id = iUpdateData[0].iId; + +#ifdef __USING_INTELLIGENT_UPDATE_FILTERING + if ( !iUpdateData[0].iIsObject ) + { + TMPXGeneralCategory containerCategory = EMPXNoCategory; + TMPXItemId containerId; + + CMdERelation* relation = iSession->GetRelationL(id); + if( relation ) + { + TItemId rightId = relation->RightObjectId(); + TItemId leftId = relation->LeftObjectId(); + delete relation; + + CMdEObject* contObject = iSession->GetObjectL(leftId); + __ASSERT_DEBUG(contObject, Panic(EGlxPanicIllegalState)); + TContainerType container = ContainerType(contObject); + delete contObject; + __ASSERT_DEBUG(( EContainerTypeTag != container), Panic(EGlxPanicIllegalState)); + if( EContainerTypeNotAContainer == container ) + { + CMdEObject* rightObject = iSession->GetObjectL(rightId); + __ASSERT_DEBUG(rightObject, Panic(EGlxPanicIllegalState)); + TContainerType rightContainer = ContainerType(rightObject); + delete rightObject; + __ASSERT_DEBUG(( EContainerTypeAlbum != rightContainer), + Panic(EGlxPanicIllegalState)); + if( EContainerTypeTag == rightContainer ) + { + id = leftId; + containerId = rightId; + containerCategory = EMPXTag; + } + else if( EContainerTypeNotAContainer == rightContainer ) + { + User::Leave(KErrNotSupported); // Not a gallery relation. + } + } + else if( EContainerTypeAlbum == container) + { + id = rightId; + containerId = leftId; + containerCategory = EMPXAlbum; + } + message->SetTObjectValueL(KGlxCollectionMessageContainerCategory, + containerCategory); + message->SetTObjectValueL(KGlxCollectionMessageContainerId, + containerId); + } + else + { + // use id 0 to identify to ML that we don't know what was deleted + id = 0; + } + } + + if ( id != 0 ) + { + CMdEObject* object = iSession->GetObjectL(id); + if( object ) + { + TContainerType container = ContainerType(object); + if( EContainerTypeAlbum == container) + { + category = EMPXAlbum; + } + else if( EContainerTypeTag == container) + { + category = EMPXTag; + } + else + { + TItemType item = ItemType(object); + if( EItemTypeImage == item) + { + category = EMPXImage; + } + else if( EItemTypeVideo == item) + { + category = EMPXVideo; + } + } + delete object; + } + } +#endif // __USING_INTELLIGENT_UPDATE_FILTERING + message->SetTObjectValueL(KMPXMessageMediaGeneralCategory, + category); + message->SetTObjectValueL(KMPXMessageMediaGeneralId, id); + BroadcastMessage(*message); + CleanupStack::PopAndDestroy(message); + iUpdateData.Remove(0); + } + +// --------------------------------------------------------------------------- +// ContainerType +// --------------------------------------------------------------------------- +// +CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObject* aObject) + { + TRACER("CGlxDataSourceMde::ContainerType(CMdEObject* aObject)"); + TContainerType containerType = EContainerTypeNotAContainer; + + if( 0 == aObject->Def().Compare(*iAlbumDef) ) + { + containerType = EContainerTypeAlbum; + } + else if( 0 == aObject->Def().Compare(*iTagDef) ) + { + containerType = EContainerTypeTag; + } + else if( 0 == aObject->Def().Compare(*iMonthDef) ) + { + containerType = EContainerTypeMonth; + } + + return containerType; + } + + +// --------------------------------------------------------------------------- +// ContainerType +// --------------------------------------------------------------------------- +// +CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObjectDef* + aObjectDef) + { + TRACER("CGlxDataSourceMde::ContainerType()"); + TContainerType containerType = EContainerTypeNotAContainer; + + if( 0 == aObjectDef->Compare(*iAlbumDef) ) + { + containerType = EContainerTypeAlbum; + } + else if( 0 == aObjectDef->Compare(*iTagDef) ) + { + containerType = EContainerTypeTag; + } + else if( 0 == aObjectDef->Compare(*iMonthDef) ) + { + containerType = EContainerTypeMonth; + } + + return containerType; + } + +// --------------------------------------------------------------------------- +// ItemType() +// --------------------------------------------------------------------------- +// +CGlxDataSource::TItemType CGlxDataSourceMde::ItemType(CMdEObject* aObject) + { + TRACER("CGlxDataSourceMde::ItemType(CMdEObject* aObject)"); + TItemType itemType = EItemTypeNotAnItem; + + if( 0 == aObject->Def().Compare(*iImageDef) ) + { + itemType = EItemTypeImage; + } + else if(0 == aObject->Def().Compare(*iVideoDef) ) + { + itemType = EItemTypeVideo; + } + + return itemType; + } + +// --------------------------------------------------------------------------- +// PrepareMonthsL() +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::PrepareMonthsL() + { + TRACER("CGlxDataSourceMde::PrepareMonthsL()"); + TTime month(0); + iFirstMonth = month; + } + +// --------------------------------------------------------------------------- +// GetMonthIdL() +// --------------------------------------------------------------------------- +// +const TGlxMediaId CGlxDataSourceMde::GetMonthIdL(const TTime& aMonth) + { + TRACER("CGlxDataSourceMde::GetMonthIdL()"); + TTime monthStart = iFirstMonth + aMonth.MonthsFrom(iFirstMonth); + const TTimeIntervalMonths KGlxOneMonth = 1; + const TTimeIntervalMicroSeconds KGlxOneMicrosecond = 1; + + TGlxMediaId monthId; + TInt monthIndex = iMonthArray.Find(monthStart); + if( monthIndex != KErrNotFound ) + { + monthId = iMonthList[monthIndex]; + } + else + { + _LIT(KGlxMonthTitleFormat, "%F%Y%M%D:"); + const TInt KGlxMonthTitleLength = 12; + TBuf title; + monthStart.FormatL(title, KGlxMonthTitleFormat); + + CMdEObject* month = iSession->GetObjectL(title); + if( month ) + { + monthId = (TGlxMediaId)month->Id(); + iMonthArray.AppendL(monthStart); + iMonthList.AppendL(monthId); + delete month; + } + else + { + TTime monthEnd = monthStart + KGlxOneMonth - KGlxOneMicrosecond; + month = iSession->NewObjectLC(*iMonthDef, title); + + // A title property def of type text is required. + CMdEPropertyDef& titlePropertyDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameTitle); + if (titlePropertyDef.PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + // Set the object title. + month->AddTextPropertyL (titlePropertyDef, title); + + // A size property is required. + CMdEPropertyDef& sizePropertyDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameSize); + if (sizePropertyDef.PropertyType() != EPropertyUint32) + { + User::Leave(KErrCorrupt); + } + month->AddUint32PropertyL(sizePropertyDef,0); + + + // A creation date property is required. + CMdEPropertyDef& creationDateDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameCreationDate); + if (creationDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + month->AddTimePropertyL(creationDateDef, monthStart); + + // A last modified date property is required. + CMdEPropertyDef& lmDateDef = iObjectDef->GetPropertyDefL( + KPropertyDefNameLastModifiedDate); + if (lmDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + month->AddTimePropertyL(lmDateDef, monthEnd); + + monthId = (TGlxMediaId)iSession->AddObjectL(*month); + CleanupStack::PopAndDestroy(month); + iMonthArray.AppendL(monthStart); + iMonthList.AppendL(monthId); + } + } + return monthId; + } + +// --------------------------------------------------------------------------- +// SameMonth +// --------------------------------------------------------------------------- +// +TBool CGlxDataSourceMde::SameMonth(const TTime& aOldDate, const TTime& aNewDate) + { + TRACER("CGlxDataSourceMde::SameMonth(const TTime& aOldDate, const TTime& aNewDate)") + return ( aOldDate.MonthsFrom(iFirstMonth) == aNewDate.MonthsFrom(iFirstMonth) ); + } + +// --------------------------------------------------------------------------- +// ContainerIsLeft +// --------------------------------------------------------------------------- +// +TBool CGlxDataSourceMde::ContainerIsLeft(CMdEObjectDef& aObjectDef) + { + TRACER("CGlxDataSourceMde::ContainerIsLeft(CMdEObjectDef& aObjectDef)") + TBool containerLeft = EFalse; + if ( 0 == aObjectDef.Compare(AlbumDef()) ) + { + containerLeft = ETrue; + } + return containerLeft; + } + +// --------------------------------------------------------------------------- +// CGlxDataSource +// TaskCompletedL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::TaskCompletedL() + { + iPauseUpdate = EFalse; + iUpdateCallback->CallBack(); + } + +// --------------------------------------------------------------------------- +// CGlxDataSource +// TaskStartedL +// --------------------------------------------------------------------------- +// +void CGlxDataSourceMde::TaskStartedL() + { + iPauseUpdate = ETrue; + } + +#ifdef USE_S60_TNM +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); + + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); + User::LeaveIfNull(request->ThumbnailInfo()); + + iTnHandle = tnReq.iBitmapHandle; + iMediaId = tnReq.iId; + if (tnReq.iSizeClass.iWidth < KMaxGridThumbnailWidth) + { + iTnEngine->SetFlagsL(CThumbnailManager::ECropToAspectRatio); + iTnEngine->SetThumbnailSizeL(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"); + } + + 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(); + + iTnRequestInProgress = ETrue; + } + +TInt CGlxDataSourceMde::CancelFetchThumbnail() + { + TRACER("CGlxDataSourceMde::CancelFetchThumbnail"); + TInt ret = KErrNone; + if (iTnRequestInProgress) + { + ret = iTnEngine->CancelRequest(iTnThumbnailCbId); + iTnRequestInProgress = EFalse; + iTnFetchObserver->ThumbnailFetchComplete(KErrCancel,EFalse); + } + return ret; + } + +// Called when preview thumbnail is created +void CGlxDataSourceMde::ThumbnailPreviewReady(MThumbnailData& aThumbnail, + TThumbnailRequestId aId) + { + TRACER("CGlxDataSourceMde::ThumbnailPreviewReady()"); + + TInt error = KErrNotSupported; + if (aThumbnail.Bitmap() != NULL) + { + 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) + { + 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.HomeTime(); // Get home time + GLX_DEBUG2("=>CGlxDataSourceMde::ThumbnailReadyL - TN Fetch took <%d> us", + (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); +#endif + + if (iTnThumbnailCbId == aId) + { + if (aError == KErrNone && iTnHandle) + { + if (iTnHandle == KGlxMessageIdBackgroundThumbnail) + { + BackgroundThumbnailMessageL(iMediaId, TSize(), aError); + } + else + { + delete iTnThumbnail; + iTnThumbnail = NULL; + iTnThumbnail = aThumbnail.DetachBitmap(); + + delete iThumbnail; + iThumbnail = NULL; + iThumbnail = new (ELeave) CFbsBitmap(); + User::LeaveIfError( iThumbnail->Duplicate(iTnHandle)); + User::LeaveIfError(iThumbnail->Resize(iTnThumbnail->SizeInPixels())); + CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iThumbnail); + CleanupStack::PushL(device ); + CFbsBitGc* context = NULL; + User::LeaveIfError(device->CreateContext(context)); + CleanupStack::PushL(context); + context->BitBlt( TPoint(), iTnThumbnail); + CleanupStack::PopAndDestroy(context); + CleanupStack::PopAndDestroy(device); + } + } + } + + if (iTnFetchObserver && iTnRequestInProgress) + { + iTnFetchObserver->ThumbnailFetchComplete(aError, aQuality); + iTnHandle = KErrNone; + iTnRequestInProgress = EFalse; + } + } +#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; + } + } + +void CGlxDataSourceMde::ShutdownNotification(TInt aShutdownState) + { + TRACER("void CGlxDataSourceMde::ShutdownNotification(TInt aShutdownState)") + GLX_DEBUG2("CGlxDataSourceMde::ShutdownNotification(TInt aShutdownState) aShutdownState = %d", aShutdownState); + + // iDataSourceReady is set to false if we have lost an MDS session. + // a ShutdownNotification with aaShutdownState == 0 means that MDS has restarted. So this is the time to recreate a session with MDS. + if ( (!iDataSourceReady) && (0 == aShutdownState) ) + { + CreateSession(); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemdsproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemdsproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + +#include +#include "glxdatasourcemds.h" +#include "glxdatasourcemds.hrh" + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(KGlxDataSourceMdeImplementationUid, + CGlxDataSourceMde::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemdsutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemdsutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + +#include "glxdatasourcemdsutility.h" + + +namespace NGlxDataSourceMdsUtility + { + +// ---------------------------------------------------------------------------- +// CopyMediaIdArrayL +// ---------------------------------------------------------------------------- +// +void CopyMediaIdArrayL(RArray& aDestArray, + const RArray& aSrcArray) + { + TInt count = aSrcArray.Count(); + for (TInt i = 0; i < count; i++) + { + aDestArray.AppendL(aSrcArray[i].Value()); + } + } + +// ---------------------------------------------------------------------------- +// CopyItemIdArrayL +// ---------------------------------------------------------------------------- +// +void CopyItemIdArrayL(RArray& aDestArray, + const RArray& aSrcArray) + { + TInt count = aSrcArray.Count(); + for (TInt i = 0; i < count; i++) + { + aDestArray.AppendL(TGlxMediaId(aSrcArray[i])); + } + } + +// ---------------------------------------------------------------------------- +// CopyItemIdArrayL +// ---------------------------------------------------------------------------- +// +void AddObjectConditionL(CMdELogicCondition& aLogicCondition, + const RArray& aMediaIds) + { + RArray itemIds; + CleanupClosePushL(itemIds); + CopyMediaIdArrayL(itemIds, aMediaIds); + aLogicCondition.AddObjectConditionL(itemIds); + CleanupStack::PopAndDestroy(&itemIds); + } + + + } // namespace + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,694 @@ +/* +* Copyright (c) 2008-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: Data Source Task MDS class +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + * @internal reviewed 24/07/2007 by K Hoikka, SCO 403-8472 removal of all view + */ + +#include "glxdatasourcetaskmds.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcemds.h" +#include "glxdatasourcemds.hrh" +#include "glxdatasourcemdsutility.h" + +// CONSTANTS +_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"); + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMde:: CGlxDataSourceTaskMde(CGlxRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : CGlxDataSourceTask(aRequest, aObserver, aDataSource) + { + TRACER("CGlxDataSourceTaskMde::CGlxDataSourceTaskMde()"); + // No implementation required + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde() + { + TRACER("CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde()"); + DestroyQueries(); + } + +// ---------------------------------------------------------------------------- +// Second stage constructor +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::ConstructL() + { + TRACER("CGlxDataSourceTaskMde::ConstructL()"); + CreateResponseL(); +#ifdef USE_S60_TNM + DataSource()->CancelFetchThumbnail(); +#else + DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); +#endif + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::CancelRequest +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::CancelRequest() + { + TRACER("CGlxDataSourceTaskMde::CancelRequest()"); + DestroyQueries(); + iCancelled = ETrue; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryNewResults +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, + TInt /*aNewItemCount*/ ) + { + TRACER("CGlxDataSourceTaskMde::HandleQueryNewResults()"); + // Not used. + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryNewResults +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aNewObjectItemCount*/, + TInt /*aNewRelationItemCount*/, + TInt /*aNewEventItemCount*/) + { + TRACER("CGlxDataSourceTaskMde::HandleQueryNewResults()"); + // Not used. + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryCompleted +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) + { + TRACER("CGlxDataSourceTaskMde::HandleQueryCompleted()"); + __ASSERT_ALWAYS(&aQuery == iQueries[0], Panic(EGlxPanicQueryLogicError)); + + TInt err = aError; + if (err == KErrNone) + { + TRAP(err, HandleQueryCompletedL(aQuery)); + } + + if (err != KErrNone) + { + HandleRequestComplete(err); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DataSource +// ---------------------------------------------------------------------------- +// +CGlxDataSourceMde* CGlxDataSourceTaskMde::DataSource() + { + TRACER("CGlxDataSourceTaskMde::DataSource()"); + return static_cast(iDataSource); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AddMonthFilterL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, + TGlxFilterProperties& aFilterProperties) + { + TRACER("CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties)"); + CMdEObject* month = DataSource()->Session().GetObjectL(aContainerId.Value()); + if( !month ) + { + User::Leave(KErrNotFound); + } + CleanupStack::PushL(month); + + AddMonthFilterL(month, aFilterProperties); + + CleanupStack::PopAndDestroy(month); + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AddMonthFilterL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& + aFilterProperties) + { + 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); + if (lmDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + CMdEProperty* startDate; + TInt startDateIndex = aMonth->Property(creationDateDef, startDate); + if( KErrNotFound == startDateIndex) + { + User::Leave(KErrCorrupt); + } + aFilterProperties.iStartDate = static_cast(startDate)->Value(); + + CMdEProperty* endDate; + TInt endDateIndex = aMonth->Property(lmDateDef, endDate); + if( KErrNotFound == endDateIndex) + { + User::Leave(KErrCorrupt); + } + aFilterProperties.iEndDate = static_cast(endDate)->Value(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::SetQueryConditionsL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::SetQueryConditionsL(CMdEQuery& aQuery, + const TGlxFilterProperties& aFilterProperties, const TGlxMediaId aContainerId, + CMdEObjectDef& aObjectDef) + { + TRACER("CGlxDataSourceTaskMde::SetQueryConditionsL()"); + + CMdELogicCondition& rootCondition = aQuery.Conditions(); + CMdEObjectDef* objectDef = &aObjectDef; + + SetQueryFilterConditionsL(rootCondition, *objectDef, aFilterProperties); + SetSortOrderL(aQuery, aObjectDef, aFilterProperties); + + if( KGlxCollectionRootId != aContainerId.Value() ) + { + CMdELogicCondition* containerCondition = NULL; + CMdERelationCondition* relationCondition = NULL; + objectDef = &DataSource()->ObjectDef(); + if( DataSource()->ContainerIsLeft(aObjectDef) ) + { + relationCondition = &rootCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideRight); + containerCondition = &relationCondition->LeftL(); + } + else + { + relationCondition = &rootCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideLeft); + containerCondition = &relationCondition->RightL(); + } + containerCondition->AddObjectConditionL(aContainerId.Value()); + } + + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::SetQueryFilterConditionsL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::SetQueryFilterConditionsL(CMdELogicCondition& + aLogicCondition, CMdEObjectDef& aObjectDef, + const TGlxFilterProperties& aFilterProperties) + { + TRACER("CGlxDataSourceTaskMde::SetQueryFilterConditionsL()"); + + if( aFilterProperties.iUri ) + { + aLogicCondition.AddObjectConditionL(EObjectConditionCompareUri, + *aFilterProperties.iUri); + } + + if( 0 == aObjectDef.Compare(DataSource()->ObjectDef()) ) + { + // Filter on content type + if ( EGlxFilterVideoAndImages == aFilterProperties.iItemType ) + { + CMdELogicCondition& logicCondition = + aLogicCondition.AddLogicConditionL(ELogicConditionOperatorOr); + logicCondition.AddObjectConditionL( DataSource()->ImageDef() ); + logicCondition.AddObjectConditionL( DataSource()->VideoDef() ); + } + } + + if( ( aFilterProperties.iMinCount > 0 ) && ( + CGlxDataSource::EContainerTypeNotAContainer != DataSource()->ContainerType( + &aObjectDef) ) ) + { + TMdEUintRange range(aFilterProperties.iMinCount, + aFilterProperties.iMinCount,EMdERangeTypeGreaterOrEqual); + aLogicCondition.AddObjectConditionL(range); + } + + if( 0 != aFilterProperties.iContainsItem.Value() ) + { + + if( DataSource()->ContainerIsLeft(aObjectDef) ) + { + CMdERelationCondition& relationCondition = + aLogicCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideLeft); + relationCondition.RightL().AddObjectConditionL( + aFilterProperties.iContainsItem.Value()); + } + else + { + CMdERelationCondition& relationCondition = aLogicCondition.AddRelationConditionL( + DataSource()->ContainsDef(), ERelationConditionSideRight); + relationCondition.LeftL().AddObjectConditionL(aFilterProperties.iContainsItem.Value()); + } + } + + if( EGlxFilterOriginNotUsed != aFilterProperties.iOrigin ) + { + CMdEPropertyDef& originProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameOrigin); + if( EGlxFilterOriginDownload == aFilterProperties.iOrigin ) + { + // The download collection shows all but captured items + 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)); + } + else if(EGlxFilterOriginAll == aFilterProperties.iOrigin ) + { + // The Months Collection Populates All the Items + aLogicCondition.AddPropertyConditionL(originProperty, TMdEUintGreaterEqual( + MdeConstants::Object::EOther)); + } + } + + 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)); + } + + 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); + } + + if( aFilterProperties.iPath ) // If this is set. Then we need to filter on the Ids it supplies + { + TArray selection = aFilterProperties.iPath->Selection(); + TInt selectionCount = selection.Count(); + RArray itemList; + CleanupClosePushL(itemList); + GLX_DEBUG2("Reading Ids from Path, count = %d", selectionCount); + if( selectionCount ) + { + for( TInt i = 0; i < selectionCount; i++ ) + { + const TMPXItemId& itemId = aFilterProperties.iPath->IdOfIndex(selection[i]); + itemList.AppendL(itemId); + } + aLogicCondition.AddObjectConditionL(itemList); + } + CleanupStack::Pop(&itemList); + } + + if( !aFilterProperties.iIncludeCameraAlbum ) + { + CMdEObjectCondition& objectCondition = aLogicCondition.AddObjectConditionL( + DataSource()->CameraAlbumId().Value()); + objectCondition.SetNegate(ETrue); + } + + if( TTime(0) != aFilterProperties.iStartDate ) + { + CMdEPropertyDef& creationDateDef = aObjectDef.GetPropertyDefL( + KPropertyDefNameCreationDate); + if (creationDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + aLogicCondition.AddPropertyConditionL(creationDateDef, TMdETimeBetween( + aFilterProperties.iStartDate, aFilterProperties.iEndDate)); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::SetSortOrderL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::SetSortOrderL(CMdEQuery& aQuery, CMdEObjectDef& aObjectDef, + const TGlxFilterProperties& aFilterProperties) + { + TRACER("CGlxDataSourceTaskMde::SetSortOrderL()"); + switch(aFilterProperties.iSortOrder) + { + case EGlxFilterSortOrderAlphabetical: + { + CMdEPropertyDef& titleProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameTitle); + TMdEOrderRule orderRule(titleProperty, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); + orderRule.SetType(EOrderRuleTypeProperty); + orderRule.SetCaseSensitive(EFalse); + aQuery.AppendOrderRuleL(orderRule); + break; + } + case EGlxFilterSortOrderItemCount: + { + //Order rule is not necessary for item count query + break; + } + case EGlxFilterSortOrderCaptureDate: + { + CMdEPropertyDef& creationDateProperty = aObjectDef.GetPropertyDefL( + KPropertyDefNameCreationDate); + TMdEOrderRule orderRule(creationDateProperty, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); + orderRule.SetType(EOrderRuleTypeProperty); + aQuery.AppendOrderRuleL(orderRule); + TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); + aQuery.AppendOrderRuleL(orderRule2); + break; + } + case EGlxFilterSortOrderModifiedDate: + { + CMdEPropertyDef& modifiedDateProperty = aObjectDef.GetPropertyDefL( + KPropertyDefNameLastModifiedDate); + TMdEOrderRule orderRule(modifiedDateProperty, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); + orderRule.SetType(EOrderRuleTypeProperty); + aQuery.AppendOrderRuleL(orderRule); + TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == + EGlxFilterSortDirectionAscending); + aQuery.AppendOrderRuleL(orderRule2); + break; + } + case EGlxFilterSortOrderNotUsed: + { + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::MaxQueryResultsCount +// ---------------------------------------------------------------------------- +// +TInt CGlxDataSourceTaskMde::MaxQueryResultsCount(const TGlxFilterProperties& + aFilterProperties) const + { + TRACER("CGlxDataSourceTaskMde::MaxQueryResultsCount()"); + TInt ret = KMdEQueryDefaultMaxCount; + if (aFilterProperties.iLastCaptureDate) + { + ret = 1; + } + return ret; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::RemoveQuery +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::RemoveQuery() + { + TRACER("CGlxDataSourceTaskMde::RemoveQuery()"); + CMdEQuery* query = iQueries[0]; + iQueryTypes.Remove(0); + iQueries.Remove(0); + query->RemoveObserver(*this); + delete query; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::DoQueryL(CMdEObjectDef& aObjectDef, + TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, + const TGlxMediaId& aContainerId) + { + TRACER("CGlxDataSourceTaskMde::DoQueryL()"); + + CMdEObjectDef* queryBaseObject = &aObjectDef; + if( aIsContent ) + { + switch(iFilterProperties.iItemType) + { + case EGlxFilterImage: + { + queryBaseObject = &DataSource()->ImageDef(); + break; + } + case EGlxFilterVideo: + { + queryBaseObject = &DataSource()->VideoDef(); + break; + } + default: + { + queryBaseObject = &DataSource()->ObjectDef(); + break; + } + } + } + + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), + *queryBaseObject, this); + CleanupStack::PushL(query); + + SetQueryConditionsL(*query, iFilterProperties, aContainerId, aObjectDef); + query->SetResultMode(aResultMode); + + CleanupStack::Pop(query); + + AppendQueryL(query, aQueryType); + + query->FindL(MaxQueryResultsCount(iFilterProperties)); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueImageVideoObjectQueriesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL(const RArray& aObjectIds, + const TGlxFilterProperties& aFilterProperties) + { + TRACER("CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL()"); + if (aFilterProperties.iItemType == EGlxFilterImage) + { + // Only perform the image query + QueueObjectQueryL(DataSource()->ImageDef(), aObjectIds, EImageVideoQuery); + } + else if (aFilterProperties.iItemType == EGlxFilterVideo) + { + // Only perform the video query + QueueObjectQueryL(DataSource()->VideoDef(), aObjectIds, EImageVideoQuery); + } + else + { + QueueObjectQueryL(DataSource()->ImageDef(), aObjectIds, EImageVideoQuery); + QueueObjectQueryL(DataSource()->VideoDef(), aObjectIds, EImageVideoQuery); + // Perform both the image and video queries + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueTagObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueTagObjectQueryL(const RArray& aObjectIds) + { + TRACER("CGlxDataSourceTaskMde::QueueTagObjectQueryL()"); + QueueObjectQueryL(DataSource()->TagDef(), aObjectIds, EImageVideoQuery); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueAlbumObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueAlbumObjectQueryL(const RArray& aObjectIds) + { + TRACER("CGlxDataSourceTaskMde::QueueAlbumObjectQueryL()"); + QueueObjectQueryL(DataSource()->AlbumDef(), aObjectIds, EImageVideoQuery); + } + + +void CGlxDataSourceTaskMde::QueueMonthObjectQueryL(const RArray& aObjectIds) + { + TRACER("CGlxDataSourceTaskMde::QueueMonthObjectQueryL()"); + QueueObjectQueryL(DataSource()->MonthDef(), aObjectIds, EImageVideoQuery); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::QueueObjectQueryL(CMdEObjectDef& aObjectDef, + const RArray& aObjectIds, const TGlxQueryType& aQueryType) + { + 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(EQueryResultModeItem); + + CleanupStack::Pop(query); + AppendQueryL(query, aQueryType); + + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AppendQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::AppendQueryL(CMdEQuery* aQuery, const TGlxQueryType& aQueryType) + { + TRACER("CGlxDataSourceTaskMde::AppendQueryL()"); + CleanupStack::PushL(aQuery); + + TInt err = iQueryTypes.Append(aQueryType); + + if (KErrNone == err) + { + iQueries.AppendL(aQuery); + CleanupStack::Pop(aQuery); + } + else + { + User::Leave(err); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::ExecuteQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::ExecuteQueryL() + { + TRACER("CGlxDataSourceTaskMde::ExecuteQueryL()"); + __ASSERT_DEBUG(iQueries.Count(), Panic(EGlxPanicQueryLogicError)); + iQueries[0]->FindL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::HandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::HandleQueryCompletedL(CMdEQuery& aQuery) + { + TRACER("CGlxDataSourceTaskMde::HandleQueryCompletedL()"); + DoHandleQueryCompletedL(aQuery); + RemoveQuery(); + DoNextQueryL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DestroyQueries +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMde::DestroyQueries() + { + TRACER("CGlxDataSourceTaskMde::DestroyQueries()"); + for (TInt i = 0; i < iQueries.Count(); i++) + { + // Ensure that there are not any running queries + iQueries[i]->RemoveObserver(*this); + iQueries[i]->Cancel(); + } + iQueries.ResetAndDestroy(); + iQueryTypes.Close(); + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1440 @@ +/* +* Copyright (c) 2008-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: Data Source task MDS attribute Class +* +*/ + + + +#include "glxdatasourcetaskmdsattribute.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "glxdatasourcemds.h" +#include "glxdatasourcemds.hrh" +#include "glxdatasourcemdsutility.h" + +// CONSTANTS + +_LIT(KPropertyDefNameAlbumType, "Type"); +_LIT(KPropertyDefNameItemType, "ItemType"); +_LIT(KPropertyDefNameCreationDate, "CreationDate"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KPropertyDefNameTitle, "Title"); +_LIT(KPropertyDefNameDuration, "Duration"); +_LIT(KPropertyDefNameComment, "Comment"); +_LIT(KPropertyDefNameWidth, "Width"); +_LIT(KPropertyDefNameHeight, "Height"); +_LIT(KPropertyDefNameDRM, "DRM"); +_LIT(KPropertyDefNameFrameCount, "FrameCount"); +_LIT(KPropertyDefNameLatitude, "Latitude"); +_LIT(KPropertyDefNameLongitude, "Longitude"); + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeAttributeMde::CGlxDataSourceTaskMdeAttributeMde( + CGlxGetRequest* aRequest,MGlxDataSourceRequestObserver& aObserver, + CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + TRACER("CGlxDataSourceTaskMdeAttribute::CGlxDataSourceTaskMdeAttribute()") + iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeAttributeMde::~CGlxDataSourceTaskMdeAttributeMde() + { + TRACER("CGlxDataSourceTaskMdeAttribute::~CGlxDataSourceTaskMdeAttribute()") + delete iMediaArray; + iQueryAttributes.Close(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::ExecuteRequestL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::ExecuteRequestL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::ExecuteRequestL()") + + CGlxGetRequest* request = static_cast(iRequest); + + __ASSERT_DEBUG(request->MediaIds().Count() > 0, User::Invariant()); + + if (request->MediaIds().Count() > 1) + { + iMediaArray = CMPXMediaArray::NewL(); + } + + if (request->MediaIds()[0] == KGlxCollectionRootId) + { + __ASSERT_DEBUG(request->MediaIds().Count() == 1, User::Invariant()); + AddCollectionAttributesL(iResponse); + } + 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) + { + case EGlxFilterVideoAndImages: + case EGlxFilterImage: + case EGlxFilterVideo: + { + QueueImageVideoObjectQueriesL(request->MediaIds(), iFilterProperties); + if (LocationAttributeRequested()) + { + QueueLocaitonQueryL(); + } + break; + } + case EGlxFilterAlbum: + { + QueueAlbumObjectQueryL(request->MediaIds()); + break; + } + case EGlxFilterTag: + { + QueueTagObjectQueryL(request->MediaIds()); + break; + } + case EGlxFilterMonth: + { + QueueMonthObjectQueryL(request->MediaIds()); + break; + } + } + + } + + DoNextQueryL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoHandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) + { + TRACER("CGlxDataSourceTaskMdeAttribute::DoHandleQueryCompletedL()") + switch (iQueryTypes[0]) + { + case ELocationAttributeQuery: + DoHandleLocationQueryCompletedL(); + break; + case EAttributeQuery: + DoHandleAttributeQueryCompletedL(); + break; + case EImageVideoQuery: + DoHandleImageVideoQueryCompletedL(); + break; + case EContainerFirstItemQuery: + // Fall through to panic, DoHandleQueryCompletedL can't handle this query type. + default: + Panic(EGlxPanicLogicError); + break; + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoNextQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::DoNextQueryL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::DoNextQueryL()") + if (iQueries.Count()) + { + ExecuteQueryL(); + } + else + { + DoHandleAttributeResponseCompleteL(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::DoHandleAttributeResponseCompleteL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL()") + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + if(request->MediaIds().Count() > 1) + { + iResponse->SetCObjectValueL(KMPXMediaArrayContents, iMediaArray); + iResponse->SetTObjectValueL(KMPXMediaArrayCount, iMediaArray->Count()); + delete iMediaArray; + iMediaArray = NULL; + } + HandleRequestComplete(KErrNone); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddAttributesLC +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry) + { + TRACER("CGlxDataSourceTaskMdeAttribute::AddAttributesL()") + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + + CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(&aObject); + if( containerType != CGlxDataSource::EContainerTypeNotAContainer ) + { + AddContainerAttributesL(aEntry, &aObject, containerType); + } + else + { + CGlxDataSource::TItemType itemType = DataSource()->ItemType(&aObject); + if ( itemType != CGlxDataSource::EItemTypeNotAnItem ) + { + AddItemAttributesL(aEntry, &aObject, itemType); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::AddCollectionAttributesL(CMPXMedia* aEntry) + { + TRACER("CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL()") + __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + for ( TInt i = 0; i < request->Attributes().Count(); i++ ) + { + if ( request->Attributes()[i] == KMPXMediaGeneralId ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralId, ( + TMPXItemId)request->CollectionPluginUid().iUid); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXNoType); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXCollection); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) + { + request->AppendCpiAttributeL(KMPXMediaGeneralTitle); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + } + + //Attributes to get the Count of Images in Collection + else if ( request->Attributes()[i] == KGlxMediaItemTypeImage ) + { + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + TGlxFilterProperties filterProperties = iFilterProperties; + + switch(iRequest->CollectionPluginUid().iUid) + { + case KGlxCollectionPluginCameraImplementationUid: + { +#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); + break; + } + default: + { + break; + } + } + } + + //Attributes to get the Count of Videos in Collection + else if ( request->Attributes()[i] == KGlxMediaItemTypeVideo ) + { + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + TGlxFilterProperties filterProperties = iFilterProperties; + + switch(iRequest->CollectionPluginUid().iUid) + { + case KGlxCollectionPluginCameraImplementationUid: + { +#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); + break; + } + default: + { + break; + } + } + } + + + else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || + ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) + { + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + TGlxFilterProperties filterProperties = iFilterProperties; + + switch(iRequest->CollectionPluginUid().iUid) + { + + case KGlxCollectionPluginAlbumsImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxCollectionPluginCameraImplementationUid: + { + filterProperties.iOrigin = EGlxFilterOriginCamera; + break; + } + case KGlxTagCollectionPluginImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->TagDef(); + break; + } + case KGlxCollectionPluginMonthsImplementationUid: + { + 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); + } + else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) + { + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, + KGlxDataSourceMdeImplementationUid); + } + else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) + { + TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); + TGlxFilterProperties filterProperties = iFilterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + filterProperties.iOrigin = EGlxFilterOriginAll; + + 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 + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSlideshowableContent, 0); + } + else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) + { + // collection itself is not protected + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + } + + else if ( request->Attributes()[i] == KGlxMediaGeneralDRMRightsValid ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsValid); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::AddContainerAttributesL(CMPXMedia* aEntry, + CMdEObject* aContainer, CGlxDataSource::TContainerType aType) + { + TRACER("CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL()") + __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(aContainer, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + /// 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXGroup); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) + { + if( CGlxDataSource::EContainerTypeAlbum == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXAlbum); + } + else if( CGlxDataSource::EContainerTypeTag == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXTag); + } + else if( CGlxDataSource::EContainerTypeMonth == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXMonth); + } + else + { + User::Leave(KErrNotSupported); + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralUri ) + { + aEntry->SetTextValueL(KMPXMediaGeneralUri, aContainer->Uri()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) + { + CMdEProperty* title; + CMdEPropertyDef& titleProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameTitle); + TInt titleIndex = aContainer->Property(titleProperty, title); + if(titleIndex == KErrNotFound) + { + TParsePtrC parser(aContainer->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name()); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast + (title)->Value()); + } + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + { + CMdEProperty* albumType; + CMdEPropertyDef& albumTypeProperty = + aContainer->Def().GetPropertyDefL( KPropertyDefNameAlbumType); + TInt albumTypeIndex = aContainer->Property(albumTypeProperty, albumType); + if( KErrNotFound != albumTypeIndex ) + { + TUint16 albumTypeValue = + static_cast(albumType)->Value(); + if ( albumTypeValue != MdeConstants::Album::EAlbumUser ) + { + request->AppendCpiAttributeL(KMPXMediaGeneralTitle); + aEntry->SetTObjectValueL(KGlxMediaCollectionInternalSystemItemType, + albumTypeValue); + } + } + break; + } + case CGlxDataSource::EContainerTypeTag: + { + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + request->AppendCpiAttributeL(KMPXMediaGeneralTitle); + CMdEProperty* time; + 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()); + break; + } + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) + { + CMdEProperty* size; + CMdEPropertyDef& sizeProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameSize); + TInt sizeIndex = aContainer->Property(sizeProperty, size); + TInt sizeValue; + if(sizeIndex == KErrNotFound) + { + sizeValue = 0; + } + else + { + sizeValue = size->Uint32ValueL(); + } + aEntry->SetTObjectValueL(KMPXMediaGeneralSize, sizeValue); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDrive ) + { + TParsePtrC parser(aContainer->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralDrive, parser.Drive()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) + { + CMdEProperty* mimeType; + CMdEPropertyDef& mimeTypeProperty = aContainer->Def().GetPropertyDefL( + KPropertyDefNameItemType); + TInt mimeTypeIndex = aContainer->Property(mimeTypeProperty, mimeType); + if( KErrNotFound == mimeTypeIndex) + { + aEntry->SetTextValueL(KMPXMediaGeneralMimeType, KNullDesC); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralMimeType, + static_cast(mimeType)->Value()); + } + } + else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || + ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) + { + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + case CGlxDataSource::EContainerTypeTag: + { + TUint32 countTypeIndex = aContainer->UsageCount(); + aEntry->SetTObjectValueL(request->Attributes()[i], countTypeIndex); + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + iFilterProperties.iOrigin = EGlxFilterOriginAll; + TGlxFilterProperties filterProperties = iFilterProperties; + AddMonthFilterL(aContainer, filterProperties); + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, TGlxMediaId(KGlxCollectionRootId), + request->Attributes()[i], aEntry, filterProperties); + break; + } + } + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem ) + { + TBool systemItem = EFalse; + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + { + CMdEProperty* 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 ) ) + { + systemItem = ETrue; + } + } + break; + } + case CGlxDataSource::EContainerTypeTag: + { + systemItem = EFalse; + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + systemItem = ETrue; + break; + } + } + aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, systemItem); + } + + //Attributes to get the Count of Images in Container + else if ( request->Attributes()[i] == KGlxMediaItemTypeImage ) + { + switch (aType) + { + case CGlxDataSource::EContainerTypeMonth: + { + TGlxFilterProperties filterProperties = iFilterProperties; + AddMonthFilterL(aContainer, filterProperties); + filterProperties.iItemType = EGlxFilterImage; +#if 0 /// AB camera album + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, DataSource()->CameraAlbumId(), + request->Attributes()[i], aEntry, filterProperties); +#endif + break; + } + default: + { + break; + } + } + } + // Attributes to get the Count of Videos in Container + + else if ( request->Attributes()[i] == KGlxMediaItemTypeVideo ) + { + switch (aType) + { + case CGlxDataSource::EContainerTypeMonth: + { + TGlxFilterProperties filterProperties = iFilterProperties; + AddMonthFilterL(aContainer, filterProperties); + filterProperties.iItemType = EGlxFilterVideo; +#if 0 /// AB camera album + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, DataSource()->CameraAlbumId(), + request->Attributes()[i], aEntry, filterProperties); +#endif + break; + } + default: + { + break; + } + } + } + + else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) + { + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, + KGlxDataSourceMdeImplementationUid); + } + else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) + { + // nothing returned for container but is valid for CPI to request + } + else if ( request->Attributes()[i] == KGlxMediaCollectionInternalEndDate ) + { + // nothing returned for container but is valid for CPI to request + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) + { + // return zero size for container (thumbnail only used in preview list) + aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(0,0)); + } + else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) + { + // container itself is not protected + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralFramecount ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) + { + TGlxFilterProperties filterProperties = iFilterProperties; + filterProperties.iItemType = EGlxFilterImage; + filterProperties.iNoDRM = ETrue; + filterProperties.iExcludeAnimation = ETrue; + switch (aType) + { + case CGlxDataSource::EContainerTypeAlbum: + case CGlxDataSource::EContainerTypeTag: + { + QueueObjectQueryL(aContainer->Def(), ETrue, EAttributeQuery, + EQueryResultModeCount, TGlxMediaId(aContainer->Id()), + request->Attributes()[i], aEntry, filterProperties); + break; + } + case CGlxDataSource::EContainerTypeMonth: + { + filterProperties.iOrigin = EGlxFilterOriginAll; + AddMonthFilterL(aContainer, filterProperties); + QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, + EQueryResultModeCount, TGlxMediaId(KGlxCollectionRootId), + request->Attributes()[i], aEntry, filterProperties); + break; + } + } + } + else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) + { + TSize dimensions(0,0); + + aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, dimensions); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDRMRightsValid ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsValid); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::AddItemAttributesL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::AddItemAttributesL(CMPXMedia* aEntry, + CMdEObject* aItem, CGlxDataSource::TItemType aType) + { + TRACER("CGlxDataSourceTaskMdeAttribute::AddItemAttributesL()") + __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(aItem, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + /// 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) + { + if( CGlxDataSource::EItemTypeImage == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + } + else if( CGlxDataSource::EItemTypeVideo == aType) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + } + else + { + User::Leave(KErrNotSupported); + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralUri ) + { + aEntry->SetTextValueL(KMPXMediaGeneralUri, aItem->Uri()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) + { + CMdEProperty* title; + CMdEPropertyDef& titleProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameTitle); + TInt titleIndex = aItem->Property(titleProperty, title); + if( KErrNotFound == titleIndex ) + { + TParsePtrC parser(aItem->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name()); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralTitle, + static_cast(title)->Value()); + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) + { + CMdEProperty* time; + 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()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) + { + CMdEProperty* size; + CMdEPropertyDef& sizeProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameSize); + TInt sizeIndex = aItem->Property(sizeProperty, size); + User::LeaveIfError(sizeIndex); + + aEntry->SetTObjectValueL(KMPXMediaGeneralSize, size->Uint32ValueL()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralDrive ) + { + TParsePtrC parser(aItem->Uri()); + aEntry->SetTextValueL(KMPXMediaGeneralDrive, parser.Drive()); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) + { + CMdEProperty* mimeType; + CMdEPropertyDef& mimeTypeProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameItemType); + TInt mimeTypeIndex = aItem->Property(mimeTypeProperty, mimeType); + 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 ) + { + if( CGlxDataSource::EItemTypeImage == aType ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, 0); + } + else + { + CMdEProperty* duration; + CMdEPropertyDef& durationProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameDuration); + TInt durationIndex = aItem->Property(durationProperty, duration); + if(durationIndex == KErrNotFound) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralDuration,0); + } + else + { + aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, + static_cast(duration)->Value()); + } + } + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) + { + TSize dimensions(0,0); + + CMdEProperty* xDim; + CMdEPropertyDef& xDimProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameWidth); + TInt xDimIndex = aItem->Property(xDimProperty, xDim); + if( KErrNotFound == xDimIndex ) + { + //User::Leave(KErrCorrupt); + } + else + { + dimensions.iWidth = static_cast(xDim)->Value(); + } + + CMdEProperty* yDim; + CMdEPropertyDef& yDimProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameHeight); + TInt yDimIndex = aItem->Property(yDimProperty, yDim); + if( KErrNotFound == yDimIndex ) + { + //User::Leave(KErrCorrupt); + } + else + { + dimensions.iHeight = static_cast(yDim)->Value(); + } + if ( ( dimensions.iWidth == 0 ) || ( dimensions.iHeight == 0 ) ) + { + if( CGlxDataSource::EItemTypeImage == aType) + { + // EXIF header is corrupt, must read size from file. + CImageDecoder* decoder = NULL; + + TRAPD(err, decoder = CImageDecoder::FileNewL( + DataSource()->FileServerSession(), aItem->Uri(), + CImageDecoder::EOptionNone )); + if (err == KErrNone) + { + dimensions = decoder->FrameInfo().iOverallSizeInPixels; + } + delete decoder; + } + } + + aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, dimensions); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralFramecount ) + { + CMdEProperty* framecount; + TInt fcount = 1; + // AB test this + CMdEPropertyDef* framecountProperty = NULL; + TRAP_IGNORE(framecountProperty = &aItem->Def().GetPropertyDefL( + KPropertyDefNameFrameCount)); + if( framecountProperty ) + { + TInt framecountIndex = aItem->Property(*framecountProperty, framecount); + if( KErrNotFound != framecountIndex ) + { + fcount = framecount->Int32ValueL(); + } + } + aEntry->SetTObjectValueL(KGlxMediaGeneralFramecount, fcount); + } + else if ( request->Attributes()[i] == KMPXMediaGeneralComment ) + { + CMdEProperty* comment; + 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) + { + aEntry->SetTextValueL(KMPXMediaGeneralComment, KNullDesC); + } + else + { + aEntry->SetTextValueL(KMPXMediaGeneralComment, + static_cast(comment)->Value()); + } + } + else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) + { + CMdEProperty* drmProtected; + CMdEPropertyDef& drmProtectedProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameDRM); + TInt drmProtectedIndex = aItem->Property(drmProtectedProperty, drmProtected); + if( KErrNotFound == drmProtectedIndex) + { + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + } + else + { + aEntry->SetTObjectValueL(KMPXMediaDrmProtected, + static_cast(drmProtected)->Value()); + } + } + else if ( request->Attributes()[i] == KGlxMediaGeneralDRMRightsValid ) + { + CMdEProperty* drmProtected; + CMdEPropertyDef& drmProtectedProperty = aItem->Def().GetPropertyDefL( + KPropertyDefNameDRM); + TInt drmProtectedIndex = aItem->Property(drmProtectedProperty, drmProtected); + if( KErrNotFound == drmProtectedIndex) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, + EGlxDrmRightsValidityUnknown); + } + else + { + if( static_cast(drmProtected)->Value() ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, + EGlxDrmRightsValidityUnknown); + } + else + { + aEntry->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, + EGlxDrmRightsValid); + } + } + } + else if ( request->Attributes()[i] == KMPXMediaGeneralCount ) + { + aEntry->SetTObjectValueL(KMPXMediaGeneralCount, 1); + } + else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) + { + aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, + KGlxDataSourceMdeImplementationUid); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) + { + aEntry->SetTObjectValueL(KGlxMediaGeneralSlideshowableContent, -1); + } + else if ( request->Attributes()[i] == KGlxMediaGeneralLocation) + { + // Set the attribute to a TCoordinate initialised to NaN. + aEntry->SetTObjectValueL(KGlxMediaGeneralLocation, TCoordinate()); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::AddLocationAttributeToMediaL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::AddLocationAttributeToMediaL( + CMPXMedia& aMedia, const TItemId& aLocationId) + { + TRACER("CGlxDataSourceTaskMdeAttribute::AddLocationAttributeToMediaL()") + 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); + TInt longitudeIndex = location->Property(longitudePropertyDef, longitude); + CMdEProperty* latitude = NULL; + 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()); + aMedia.SetTObjectValueL(KGlxMediaGeneralLocation, coordinate); + } + + CleanupStack::PopAndDestroy(location); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::DoHandleAttributeQueryCompletedL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL()") + __ASSERT_DEBUG(iQueryAttributes.Count(), Panic(EGlxPanicIllegalState)); + CMdEQuery* query = iQueries[0]; + + if( query->ResultMode() == EQueryResultModeItem ) + { + __ASSERT_DEBUG(( iQueryAttributes[0].iAttribute == + KGlxMediaCollectionInternalStartDate ), Panic(EGlxPanicIllegalState)); + CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL( + KPropertyDefNameCreationDate); + if (creationDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + TTime startMonth(0); + TTime endMonth(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(); + } + 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()); + } + else + { + Panic(EGlxPanicIllegalState); + } + iQueryAttributes.Remove(0); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoHandleLocationQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::DoHandleLocationQueryCompletedL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::DoHandleLocationQueryCompletedL()") + TInt queryResultsCount = iQueries[0]->Count(); + + for (TInt queryResultsPos = 0; queryResultsPos < queryResultsCount; queryResultsPos++) + { + CMdERelation& relation = static_cast( + iQueries[0]->ResultItem(queryResultsPos)); + CMPXMedia* targetMedia = NULL; + if (iMediaArray) + { + TInt mediaArrayCount = iMediaArray->Count(); + for (TInt mediaArrayPos = 0; mediaArrayPos < mediaArrayCount; mediaArrayPos++) + { + CMPXMedia* media = (*iMediaArray)[mediaArrayPos]; + TMPXItemId id = media->ValueTObjectL(KMPXMediaGeneralId); + if (id.iId1 == relation.LeftObjectId()) + { + targetMedia = media; + break; + } + } + } + else + { + targetMedia = iResponse; +#ifdef _DEBUG + TMPXItemId id = targetMedia->ValueTObjectL(KMPXMediaGeneralId); + __ASSERT_DEBUG(id.iId1 == relation.LeftObjectId(), Panic(EGlxPanicLogicError)); +#endif + } + + __ASSERT_DEBUG(targetMedia, Panic(EGlxPanicLogicError)); + AddLocationAttributeToMediaL(*targetMedia, relation.RightObjectId()); + + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::DoHandleImageVideoQueryCompletedL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL()") + CMdEQuery* query = iQueries[0]; + + TInt queryResultsCount = query->Count(); + GLX_DEBUG2("CGlxDataSourceTaskMdeAttributeMde::DoHandleImageVideoQueryCompletedL()" + " queryResultsCount=%d", queryResultsCount); + + if( ( queryResultsCount == 1 ) && ( !iMediaArray ) ) + { + CMdEObject& object = static_cast(query->ResultItem(0)); + + delete iResponse; + // setiing iResponse to NULL to remove CodeScanner warning + iResponse = NULL; + iResponse = CMPXMedia::NewL(); + AddAttributesL(object, iResponse); + } + else + { + 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::Pop(entry); + AddAttributesL(object, (*iMediaArray)[iMediaArray->Count() - 1]); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::QueueLocaitonQueryL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL()") + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + CMdEQuery* query = DataSource()->Session().NewRelationQueryL( + *DataSource()->NamespaceDef(), this); + CleanupStack::PushL(query); + + CMdELogicCondition& rootCondition = query->Conditions(); + CMdERelationCondition& containerRelationCondition = + rootCondition.AddRelationConditionL(DataSource()->ContainsLocationDef(), + ERelationConditionSideRight); + CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); + CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); + locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); + locationLogicCondition.SetOperator(ELogicConditionOperatorOr); + itemLogicCondition.SetOperator(ELogicConditionOperatorOr); + + TInt mediaIdCount = request->MediaIds().Count(); + + RArray mediaIdArray; + CleanupClosePushL(mediaIdArray); + + for (TInt i = 0; i < mediaIdCount; i++) + { + mediaIdArray.AppendL(request->MediaIds()[i].Value()); + } + + itemLogicCondition.AddObjectConditionL(mediaIdArray); + CleanupStack::PopAndDestroy(&mediaIdArray); + + query->SetResultMode(EQueryResultModeItem); + + CleanupStack::Pop(query); + AppendQueryL(query, ELocationAttributeQuery); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::ExecuteQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::ExecuteQueryL() + { + TRACER("CGlxDataSourceTaskMdeAttribute::ExecuteQueryL()") + switch (iQueryTypes[0]) + { + case EAttributeQuery: + { + iQueries[0]->FindL(MaxQueryResultsCount(iQueryAttributes[0].iFilterProperties)); + } + break; + case EImageVideoQuery: // fall through + case ELocationAttributeQuery: + { + iQueries[0]->FindL(); + } + break; + default: + { + Panic(EGlxPanicUnsupportedQueryType); + } + break; + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested +// ---------------------------------------------------------------------------- +// +TBool CGlxDataSourceTaskMdeAttributeMde::LocationAttributeRequested() + { + TRACER("CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested()") + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxGetRequest* request = static_cast(iRequest); + + TInt attributeArrayCount = request->Attributes().Count(); + for (TInt i = 0; i < attributeArrayCount; i++) + { + if (request->Attributes()[i] == KGlxMediaGeneralLocation) + { + return ETrue; + } + } + return EFalse; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTask::QueueObjectQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeAttributeMde::QueueObjectQueryL(CMdEObjectDef& aObjectDef, + TBool aIsContent, TGlxQueryType aQueryType, + TQueryResultMode aResultMode, const TGlxMediaId& aContainerId, + TMPXAttribute aAttribute, CMPXMedia* aEntry, + const TGlxFilterProperties& aFilterProperties) + { + TRACER("CGlxDataSourceTaskMdeAttribute::QueueObjectQueryL()") + CMdEObjectDef* queryBaseObject = &aObjectDef; + if( aIsContent ) + { + switch(aFilterProperties.iItemType) + { + case EGlxFilterImage: + { + queryBaseObject = &DataSource()->ImageDef(); + break; + } + case EGlxFilterVideo: + { + queryBaseObject = &DataSource()->VideoDef(); + break; + } + default: + { + queryBaseObject = &DataSource()->ObjectDef(); + break; + } + } + } + + CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), + *queryBaseObject, this); + CleanupStack::PushL(query); + SetQueryConditionsL(*query, aFilterProperties, aContainerId, aObjectDef); + query->SetResultMode(aResultMode); + + iQueryAttributes.AppendL(TGlxQueryAttribute(aAttribute, aEntry, aFilterProperties)); + + CleanupStack::Pop(query); + + TRAPD(err, AppendQueryL(query,aQueryType)); + + if (err != KErrNone) + { + iQueryAttributes.Remove(iQueryAttributes.Count() - 1); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1214 @@ +/* +* Copyright (c) 2008-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: Data Source Task MDS Command Class +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + + +#include "glxdatasourcetaskmdscommand.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "glxdatasourcemds.h" +#include "glxdatasourcemdsutility.h" +#include "glxdatasourcemds.hrh" + +#include + +#include +#include +#include +#include + +// CONSTANTS +_LIT(KPropertyDefNameDescription, "Comment"); +_LIT(KPropertyDefNameTitle, "Title" ); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KPropertyDefNameCreationDate, "CreationDate"); +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameAlbumType, "Type"); +_LIT(KPropertyDefItemType, "ItemType"); +// Item type for Album +_LIT( KAlbumItemType, "application/vnd.nokia.mde.album" ); +// Item type for Tag +_LIT( KTagItemType, "application/vnd.nokia.mde.tag" ); + +const TInt KDriveLetterLength = 1; +_LIT(KColonBackslash, ":\\"); +_LIT(KFileNameFormatString, "(%+02u)"); + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand() + { + TRACER("CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand()"); + iLeftIds.Close(); + iRightIds.Close(); + delete iTitle; + delete iObjectToRename; + delete iStringCache; + } + + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand( + CGlxCommandRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, + CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + TRACER("CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand()"); + // No implementation required + } + +// ---------------------------------------------------------------------------- +// Second phase constructor +// ---------------------------------------------------------------------------- +// +void 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 + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ExecuteRequestL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::ExecuteRequestL() + { + TRACER("CGlxDataSourceTaskMdeCommand::ExecuteRequestL()"); + __ASSERT_DEBUG(DataSource()->NamespaceDef(), Panic(EGlxPanicIllegalState)); + + const CMPXCommand& command = static_cast(iRequest)->Command(); + + if ( command.IsSupported(KMPXCommandGeneralCollectionId) ) + { + iCollectionUid = command.ValueTObjectL(KMPXCommandGeneralCollectionId); + } + else + { + // if the collection Uid has not been set on the command, use the Ud of the plugin in use. + iCollectionUid = iRequest->CollectionPluginUid(); + } + + TGlxCommandParser::ParseL(*this, command); + } + +// ---------------------------------------------------------------------------- +// Add container +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::AddContainerL(const TDesC& aContainerName) + { + TRACER("CGlxDataSourceTaskMdeCommand::AddContainerL()"); + iTitle = aContainerName.AllocL(); + AppendContainerTitleCountQueryL(ECommandAddContainer, aContainerName); + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Add items to container by id +// ---------------------------------------------------------------------------- +// +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)); + + iLeftIds.Reset(); + iRightIds.Reset(); + + CMdEQuery* query = DataSource()->Session().NewRelationQueryL( + *DataSource()->NamespaceDef(), this); + AppendQueryL(query, ECommandAddToContainer); + + CMdELogicCondition& rootCondition = query->Conditions(); + CMdERelationCondition& containerRelationCondition = + rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), + ERelationConditionSideLeft); + CMdELogicCondition& leftLogicCondition = containerRelationCondition.LeftL(); + CMdELogicCondition& rightLogicCondition = containerRelationCondition.RightL(); + leftLogicCondition.SetOperator(ELogicConditionOperatorOr); + rightLogicCondition.SetOperator(ELogicConditionOperatorOr); + + TItemId containerId = ContainerItemId(aTargetContainers[0]); + // It is currenly a safe assumption that all containers are of the same type (either albums or tags) + // and thus they will either all be on the left or all be on the right of the logic condition. Therefore, + // we only need to test the first container to see if it is on the left or on the right. + CMdEObject* container = DataSource()->Session().GetObjectL(containerId); + if (!container) + { + User::Leave(KErrNotFound); + } + TBool containerIsLeft = DataSource()->ContainerIsLeft(container->Def()); + + delete container; + container = NULL; + + + if (containerIsLeft) + { + // the container is on the left + NGlxDataSourceMdsUtility::CopyMediaIdArrayL(iLeftIds, aTargetContainers); + NGlxDataSourceMdsUtility::CopyMediaIdArrayL(iRightIds, aSourceIds); + } + else + { + // the container is on the right + NGlxDataSourceMdsUtility::CopyMediaIdArrayL(iRightIds, aTargetContainers); + NGlxDataSourceMdsUtility::CopyMediaIdArrayL(iLeftIds, aSourceIds); + } + + leftLogicCondition.AddObjectConditionL(iLeftIds); + rightLogicCondition.AddObjectConditionL(iRightIds); + + query->SetResultMode(EQueryResultModeItem); + + ExecuteQueryL(); + + } + +// ---------------------------------------------------------------------------- +// Add item to containers by URI. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::AddToContainerL(const TDesC& aSourceUri, + const RArray< TGlxMediaId >& aTargetContainers) + { + TRACER("CGlxDataSourceTaskMdeCommand::AddToContainerL()"); + CMdEObject* sourceObject = DataSource()->Session().GetObjectL(aSourceUri); + if (!sourceObject) + { + User::Leave(KErrNotFound); + } + RArray sourceIds; + CleanupClosePushL(sourceIds); + sourceIds.AppendL(TGlxMediaId(sourceObject->Id())); + + AddToContainerL(sourceIds, aTargetContainers); + CleanupStack::PopAndDestroy(&sourceIds); + } + +// ---------------------------------------------------------------------------- +// 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) + { + TRACER("CGlxDataSourceTaskMdeCommand::CopyL()"); + FileOperationL(aSourceIds.Array(), aDrive, ECopy); + } + +// ---------------------------------------------------------------------------- +// 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) + { + TRACER("CGlxDataSourceTaskMdeCommand::MoveL()"); + FileOperationL(aSourceIds.Array(), aDrive, EMove); + } + +// ---------------------------------------------------------------------------- +// Remove items from a container. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::RemoveFromContainerL( + const RArray& aItemIds, const TGlxMediaId& aContainerId) + { + TRACER("CGlxDataSourceTaskMdeCommand::RemoveFromContainerL()"); + // Answer to question in @bug above: No + + CMdEObject* object = NULL; + object = DataSource()->Session().GetObjectL(aContainerId.Value()); + CleanupStack::PushL(object); + if (!object) + { + User::Leave(KErrNotFound); + } + + 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); + CMdELogicCondition* containerLogicCondition = NULL; + CMdELogicCondition* itemLogicCondition = NULL; + // Containers are on the left for albums, right for tags + if ( DataSource()->ContainerIsLeft(object->Def()) ) + { + containerLogicCondition = &containerRelationCondition.LeftL(); + itemLogicCondition = &containerRelationCondition.RightL(); + } + else + { + containerLogicCondition = &containerRelationCondition.RightL(); + itemLogicCondition = &containerRelationCondition.LeftL(); + } + + containerLogicCondition->AddObjectConditionL(aContainerId.Value()); + + itemLogicCondition->SetOperator(ELogicConditionOperatorOr); + + NGlxDataSourceMdsUtility::AddObjectConditionL(*itemLogicCondition,aItemIds); + + query->SetResultMode(EQueryResultModeId); + CleanupStack::PopAndDestroy(object); + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Delete files, Remove container. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DeleteL(const RArray& aItemIds) + { + TRACER("CGlxDataSourceTaskMdeCommand::DeleteL()"); + CMdEObjectDef* containerObjectDef = NULL; + TInt err = ContainerObjectDef(containerObjectDef); + if (err == KErrNone) + { + QueueObjectQueryL(*containerObjectDef, + aItemIds, ECommandDeleteContainers); + } + // Assume that only items are left + QueueObjectQueryL(DataSource()->ObjectDef(), + aItemIds, ECommandDeleteItems); + + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Rename files, Rename container. +// +/// @todo test this method. +// +// ---------------------------------------------------------------------------- +// +/// @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) + { + TRACER("CGlxDataSourceTaskMdeCommand::RenameL()"); + delete iTitle; + iTitle = NULL; + iTitle = aTitle.AllocL(); + + RArray sourceIdArray; + CleanupClosePushL(sourceIdArray); + sourceIdArray.AppendL(aSourceItemId); + + QueueObjectQueryL(DataSource()->ObjectDef(), sourceIdArray , ECommandRename); + CleanupStack::PopAndDestroy(&sourceIdArray); + + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// Set description. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::SetDescriptionL(const RArray& aItemIds, + const TDesC& aDescription) + { + TRACER("CGlxDataSourceTaskMdeCommand::SetDescriptionL()"); + CMdEPropertyDef& descriptionPropertyDef = DataSource()->MediaDef().GetPropertyDefL( + KPropertyDefNameDescription); + if (descriptionPropertyDef.PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + + TInt count = aItemIds.Count(); + for (TInt i = 0; i < count; i++) + { + TItemId itemId = aItemIds[i].Value(); + CMdEObject* object = DataSource()->Session().OpenFullObjectL(itemId); + if (!object) + { + User::Leave(KErrNotFound); + } + CleanupStack::PushL(object); + CMdEProperty* descriptionProperty = NULL; + + + TInt index = object->Property(descriptionPropertyDef, descriptionProperty); + if (index < KErrNotFound) + { + User::Leave(index); + } + if (index != KErrNotFound) + { + // Check whether the description string is empty + if( aDescription.Length() ) + { + static_cast(descriptionProperty)->SetValueL(aDescription); + } + + //if entered description string is blank then remove the old property + else + { + object->RemoveProperty(index); + } + } + else + { + if( aDescription.Length() ) + { + object->AddTextPropertyL(descriptionPropertyDef, aDescription); + } + } + DataSource()->Session().CommitObjectL(*object); + CleanupStack::PopAndDestroy(object); + } + + HandleRequestComplete(KErrNone); + } + + +// ---------------------------------------------------------------------------- +// Set capture location. +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::SetCaptureLocationL(const RArray& aItemIds, + const TCoordinate& aCoordinate) + { + TRACER("CGlxDataSourceTaskMdeCommand::SetCaptureLocationL()") ; + if (!Math::IsNaN(aCoordinate.Latitude()) || !Math::IsNaN(aCoordinate.Longitude())) + { + User::Leave(KErrArgument); + } + + CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); + AppendQueryL(query, ECommandRemoveLocation); // query is now owned by the query array. + + CMdELogicCondition& rootCondition = query->Conditions(); + + CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL( + ERelationConditionSideLeft); + CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); + CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); + locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); + + itemLogicCondition.SetOperator(ELogicConditionOperatorOr); + + + itemLogicCondition.AddObjectConditionL(reinterpret_cast&>(aItemIds)); + + query->SetResultMode(EQueryResultModeId); + ExecuteQueryL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL() + { + TRACER("CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL()"); +#ifndef USE_S60_TNM + CGlxDataSourceMde* ds = DataSource(); + ds->ThumbnailCreator().CleanupThumbnailsL(&ds->ThumbnailDatabase()); +#endif + HandleRequestComplete(KErrNone); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::HandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL(CMdEQuery& aQuery) + { + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL()"); + TGlxQueryType queryType = iQueryTypes[0]; + + switch (queryType) + { + + case ECommandRemoveFromContainer: // don't break + case ECommandRemoveLocation: + { + TInt queryCount = aQuery.Count(); + RArray relationsToRemove; + CleanupClosePushL(relationsToRemove); + User::LeaveIfError(relationsToRemove.Reserve(queryCount)); + + RArray successfullyRemovedReleations; + CleanupClosePushL(successfullyRemovedReleations); + User::LeaveIfError(successfullyRemovedReleations.Reserve(queryCount)); + + for(TInt i = queryCount - 1; i >= 0; i--) + { + relationsToRemove.AppendL(aQuery.ResultId(i)); + } + + if (queryCount) + { + User::LeaveIfError(DataSource()->Session().RemoveRelationsL( + relationsToRemove, successfullyRemovedReleations)); + } + + CleanupStack::PopAndDestroy(&successfullyRemovedReleations); + CleanupStack::PopAndDestroy(&relationsToRemove); + } + break; + case ECommandAddToContainer: + { + DoHandleAddToContainerQueryCompletedL(aQuery); + } + break; + case ECommandAddContainer: + { + DoHandleAddContainerQueryCompletedL(aQuery); + } + break; + case ECommandDeleteContainers: + { + DoHandleDeleteContainersQueryCompletedL(aQuery); + } + break; + case ECommandDeleteItems: + { + DoHandleDeleteItemsQueryCompletedL(aQuery); + } + break; + case ECommandRename: + { + DoHandleRenameQueryCompletedL(aQuery); + } + break; + case ECommandRenameContainer: + { + DoHandleRenameConainerQueryCompletedL(aQuery); + } + break; + } + } +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoNextQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoNextQueryL() + { + TRACER("CGlxDataSourceTaskMdeCommand::DoNextQueryL()"); + if (iQueries.Count()) + { + ExecuteQueryL(); + } + else + { + HandleRequestComplete(KErrNone); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::FileOperationL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::FileOperationL(const TArray& aSourceIds, + const TDesC& aDrive, TFileOperation aFileOperation) + { + 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. + // We don't have an EikonEnv as we are running in a server process. + RFs rfs; // used for BaflUtils::FileExists + + CleanupClosePushL(rfs); + User::LeaveIfError(rfs.Connect()); + for (TInt i = 0; i < aSourceIds.Count(); i++) + { + CMdEObject* sourceObject = DataSource()->Session().GetObjectL(aSourceIds[i].Value()); + if (!sourceObject) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(sourceObject); + + const TDesC& sourceFileName = sourceObject->Uri(); + TFileName sourceRootPath; + + RootPath(sourceFileName, sourceRootPath); + TPtrC fileNameWithoutRoot(NULL,0); + if (sourceFileName.Left(sourceRootPath.Length()).CompareF(sourceRootPath) == 0) + // This is the expected case. The file to be copied is under the 'root' of + // 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())); + } + else + { + fileNameWithoutRoot.Set(sourceFileName); + } + + TFileName destinationFileName; + // Set destination file name to destination 'root' path + RootPath(aDrive, destinationFileName); + // 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. + if (BaflUtils::FileExists(rfs, destinationFileName)) + { + // 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 i = 1; + do + { + destinationFileName.SetLength(destinationFileNameWithoutExtensionLength); + destinationFileName.AppendFormat(KFileNameFormatString,i++); + destinationFileName.Append(destinationFileNameParse.Ext()); + } + while (BaflUtils::FileExists(rfs, destinationFileName)); + } + + // Ensure the path that we are copying to exists. + // Fixed error ID: ELLZ-798BP3 Lumiere 07.46.08_MC Photo: + // "System: System error." is displayed when copying/moving image which is saved in a user created folder. + BaflUtils::EnsurePathExistsL(rfs,destinationFileName); + + if (aFileOperation == ECopy) + { + User::LeaveIfError(manager->CopyFile(sourceFileName, destinationFileName)); + } + else + { + User::LeaveIfError(manager->RenameFile(sourceFileName, destinationFileName)); + } + + } + + CleanupStack::PopAndDestroy(sourceObject); + } + + CleanupStack::PopAndDestroy(&rfs); + CleanupStack::PopAndDestroy(manager); + + HandleRequestComplete(KErrNone); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ContainerItemId +// ---------------------------------------------------------------------------- +// +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; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ContainerItemId +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::RootPath(const TDesC& aDrive, TDes& aRootPath) + { + 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) + { + aRootPath = PathInfo::MemoryCardRootPath(); + } + else if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::RomRootPath().Left( + KDriveLetterLength)) == 0) + { + aRootPath = PathInfo::RomRootPath(); + } + else + { + aRootPath = aDrive.Left(KDriveLetterLength); + aRootPath.Append(KColonBackslash); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::SendProgressMessageL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::SendProgressMessageL(TInt aCurrentStep, TInt aStepCount) + { + TRACER("CGlxDataSourceTaskMdeCommand::SendProgressMessageL()"); + MGlxDataSourceUpdateObserver& observer = + static_cast(iRequest)->DataSourceUpdateObserver(); + + const CMPXCommand& command = static_cast(iRequest)->Command(); + __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(KMPXCommandGeneralSessionId, sessionId); + + observer.HandleMessage(*progressMessage); + + CleanupStack::PopAndDestroy(progressMessage); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::ContainerObjectDef +// ---------------------------------------------------------------------------- +// +TInt CGlxDataSourceTaskMdeCommand::ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef) +{ + TRACER("CGlxDataSourceTaskMdeCommand::ContainerObjectDef()"); + //__ASSERT_DEBUG( (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid) + //|| iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)), Panic(EGlxPanicInvalidCollectionUid)); + TInt err = KErrNone; + if (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid)) + { + aContainerObjectDef = &DataSource()->TagDef(); + } + else if (iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)) + { + aContainerObjectDef = &DataSource()->AlbumDef(); + } + else if(iCollectionUid == TUid::Uid(KGlxCollectionPluginAllImplementationUid)) + { + aContainerObjectDef = &DataSource()->MediaDef(); + } + else + { + err = KErrNotFound; + } + return err; +} + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL + (CMdEQuery& aQuery) + { + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL()"); + RPointerArray relations; + CleanupClosePushL(relations); + + TInt leftCount = iLeftIds.Count(); + User::LeaveIfError(relations.Reserve(leftCount)); // this is a bigest reservation that could be required. + for (TInt leftPos = 0; leftPos < leftCount; leftPos++) + { + TInt rightCount = iRightIds.Count(); + for (TInt rightPos = 0; rightPos < rightCount; rightPos++) + { + // Check to see if id already exists + TBool alreadyExists = EFalse; + for(TInt queryPos = aQuery.Count() - 1; queryPos >= 0; queryPos--) + { + CMdERelation& relation = static_cast(aQuery.ResultItem(queryPos)); + if (relation.LeftObjectId() == iLeftIds[leftPos] + && relation.RightObjectId() == iRightIds[rightPos]) + { + alreadyExists = ETrue; + break; + } + } + + if (!alreadyExists) + { + CMdERelation* relation = DataSource()->Session().NewRelationL( + DataSource()->ContainsDef(), iLeftIds[leftPos], iRightIds[rightPos]); + CleanupStack::PushL(relation); + relations.AppendL(relation); + CleanupStack::Pop(relation); + } + } + + } + + if (relations.Count()) + { + User::LeaveIfError(DataSource()->Session().AddItemsL(relations)); + } + + CleanupStack::PopAndDestroy(&relations); + + iLeftIds.Reset(); + iRightIds.Reset(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL + (CMdEQuery& aQuery) + + { + 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 || + SearchStringL(R_ALBUM_CAMERA_TITLE) == 0 ) + { + User::Leave(KErrAlreadyExists); + } + } + + if (aQuery.Count()) + { + // An object (or more strickly objects) with the given container name already exist + User::Leave(KErrAlreadyExists); + } + + CMdEObject* object = NULL; + CMdEObjectDef* containerObjectDef = NULL; + TInt err = ContainerObjectDef(containerObjectDef ); + __ASSERT_ALWAYS(err == KErrNone, Panic(EGlxPanicInvalidCollectionUid)); + + object = DataSource()->Session().NewObjectLC(*containerObjectDef, KNullDesC); + + // A title property def of type text is required. + CMdEPropertyDef& titlePropertyDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameTitle); + if (titlePropertyDef.PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + // Set the object title. + object->AddTextPropertyL(titlePropertyDef, *iTitle); + + //ItemType property def of type text is required. + CMdEPropertyDef& itemTypePropertyDef = containerObjectDef->GetPropertyDefL( + KPropertyDefItemType); + if (itemTypePropertyDef.PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + + // Checks the Container type whether it is Tag or Album + if (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid)) + { + object->AddTextPropertyL (itemTypePropertyDef, KTagItemType); + } + else + { + object->AddTextPropertyL (itemTypePropertyDef, KAlbumItemType); + } + + + // A size property is required. + + CMdEPropertyDef& sizePropertyDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameSize); + if (sizePropertyDef.PropertyType() != EPropertyUint32) + { + User::Leave(KErrCorrupt); + } + object->AddUint32PropertyL(sizePropertyDef,0); + + + // A creation date property is required. + CMdEPropertyDef& creationDateDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameCreationDate); + if (creationDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + // A last modified date property is required. + CMdEPropertyDef& lmDateDef = containerObjectDef->GetPropertyDefL( + KPropertyDefNameLastModifiedDate); + if (lmDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + TTime uTime; + uTime.UniversalTime(); + object->AddTimePropertyL(creationDateDef, uTime); + object->AddTimePropertyL(lmDateDef, uTime); + + TItemId id = DataSource()->Session().AddObjectL(*object); + CleanupStack::PopAndDestroy(object); + + iResponse->SetTObjectValueL(KMPXMediaGeneralId, id); + iResponse->SetTObjectValueL(KMPXMessageMediaGeneralId, id); + iResponse->SetTObjectValueL(KMPXMessageChangeEventType, + EMPXItemInserted); + } +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL + (CMdEQuery& aQuery) + { + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL()"); + CMdEPropertyDef& albumTypeProperty = DataSource()->AlbumDef().GetPropertyDefL( + KPropertyDefNameAlbumType); + TInt queryCount = aQuery.Count(); + + RArray objectsForRemoval; + CleanupClosePushL(objectsForRemoval); + User::LeaveIfError(objectsForRemoval.Reserve(queryCount)); + + RArray sucessfullyRemovedObjects; + CleanupClosePushL(sucessfullyRemovedObjects); + User::LeaveIfError(sucessfullyRemovedObjects.Reserve(queryCount)); + + // Ensure that deletion is legal and that deletion + for(TInt queryPos = 0; queryPos < queryCount; queryPos++) + { + CMdEObject& object = static_cast(aQuery.ResultItem(queryPos)); + + CMdEProperty* albumType; + TInt albumTypeIndex = object.Property(albumTypeProperty, albumType); + if (KErrNotFound != albumTypeIndex) + { + TInt albumTypeValue = static_cast(albumType)->Value(); + if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || + (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) + { + User::Leave(KErrAccessDenied); + } + } + objectsForRemoval.AppendL(object.Id()); + } + + if (queryCount) + { + User::LeaveIfError(DataSource()->Session().RemoveObjectsL(objectsForRemoval, + sucessfullyRemovedObjects)); + } + + CleanupStack::PopAndDestroy(&sucessfullyRemovedObjects); + CleanupStack::PopAndDestroy(&objectsForRemoval); + } +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsContainersQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL + (CMdEQuery& aQuery) + { + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL()"); + ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); + CleanupStack::PushL(manager); + TInt queryCount = aQuery.Count(); + RArray objectsForRemoval; + CleanupClosePushL(objectsForRemoval); + User::LeaveIfError(objectsForRemoval.Reserve(queryCount)); + + RArray sucessfullyRemovedObjects; + CleanupClosePushL(sucessfullyRemovedObjects); + User::LeaveIfError(sucessfullyRemovedObjects.Reserve(queryCount)); + //Handle to a file server session + RFs fs; + // Pushing the handle in Clean-up Stack to call Close() on file server session + CleanupClosePushL( fs ); + //Connects a client to the file server + User::LeaveIfError( fs.Connect() ); + + TInt lastErr = KErrNone; + for(TInt queryPos = queryCount - 1; queryPos >= 0; queryPos--) + { + CMdEObject& object = static_cast(aQuery.ResultItem(queryPos)); + //Removes the Read Only attributes of the file + fs.SetAtt(object.Uri(), 0, KEntryAttReadOnly); + TInt err = manager->DeleteFile(object.Uri()); + if (err != KErrNone) + { + lastErr = err; + } + objectsForRemoval.AppendL(object.Id()); + } + // Calling Close() on file server session + CleanupStack::PopAndDestroy( &fs ); + + User::LeaveIfError(lastErr); + + if (queryCount) + { + // Some objects may have already been removed by the harvester + DataSource()->Session().RemoveObjectsL(objectsForRemoval, sucessfullyRemovedObjects); + } + + CleanupStack::PopAndDestroy(&sucessfullyRemovedObjects); + CleanupStack::PopAndDestroy(&objectsForRemoval); + + CleanupStack::PopAndDestroy(manager); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL + (CMdEQuery& aQuery) + { + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL()"); + __ASSERT_DEBUG(iObjectToRename, Panic(EGlxPanicLogicError)); + if (aQuery.Count()) + { + User::Leave(KErrAlreadyExists); + } + + CMdEObject* object = DataSource()->Session().OpenObjectL(iObjectToRename->Id(), iObjectToRename->Def()); + CleanupStack::PushL(object); + CMdEProperty* albumType; + // @todo AB test this + CMdEPropertyDef* albumTypeProperty = NULL; + TRAP_IGNORE(albumTypeProperty = &object->Def().GetPropertyDefL(KPropertyDefNameAlbumType)); + TInt albumTypeIndex = KErrNotFound; + // Must guard against non-existance of albumTypeProperty (e.g. when renaming a tag) + if (albumTypeProperty) + { + albumTypeIndex = object->Property(*albumTypeProperty, albumType); + } + if( KErrNotFound != albumTypeIndex ) + { + TInt albumTypeValue = static_cast(albumType)->Value(); + if ( albumTypeValue == MdeConstants::Album::EAlbumUserPredefined ) + { + // Want to rename a predefined, localised album name so reclassify + // 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)) + { + // Cannot rename system albums + User::Leave(KErrAccessDenied); + } + } + + + CMdEPropertyDef& titlePropertyDef = object->Def().GetPropertyDefL(KPropertyDefNameTitle); + if (titlePropertyDef.PropertyType() != EPropertyText) + { + User::Leave(KErrCorrupt); + } + + CMdEProperty* titleProperty = NULL; + TInt index = object->Property(titlePropertyDef, titleProperty); + if (index < KErrNotFound) + { + User::Leave(index); + } + if (index != KErrNotFound) + { + // Remove the old property + object->RemoveProperty(index); + } + // Set the object title + object->AddTextPropertyL(titlePropertyDef, *iTitle); + + // Get time propertydef of current session object + CMdEPropertyDef& timePropertyDef = object->Def().GetPropertyDefL( + KPropertyDefNameLastModifiedDate); + + // Check the validty of the time def + if (timePropertyDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + + // Get index and check the validity + CMdEProperty* timeProperty = NULL; + index = object->Property(timePropertyDef, timeProperty); + + if (index < KErrNotFound) + { + User::Leave(index); + } + + if (index != KErrNotFound) + { + // Remove the old property + object->RemoveProperty(index); + } + + // Take current universal time + TTime currentTime; + currentTime.UniversalTime(); + + // Set the object current time + object->AddTimePropertyL(timePropertyDef, currentTime); + + DataSource()->Session().CommitObjectL(*object); + CleanupStack::PopAndDestroy(object); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL + (CMdEQuery& aQuery) + { + TRACER("CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL()"); + __ASSERT_DEBUG(aQuery.Count() == 1, Panic(EGlxPanicUnexpectedQueryResultCount )); + delete iObjectToRename; + iObjectToRename = static_cast(aQuery.TakeOwnershipOfResult(0)); + + CMdEObjectDef* containerObjectDef = NULL; + TInt err = ContainerObjectDef(containerObjectDef); + if (err == KErrNone) + { + AppendContainerTitleCountQueryL(ECommandRenameContainer, *iTitle); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL + (const TGlxQueryType& aQueryType, const TDesC& aTitle) + { + 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); + CleanupStack::PushL(query); + + CMdEPropertyDef& titlePropertyDef = DataSource()->ObjectDef().GetPropertyDefL( + KPropertyDefNameTitle); + + query->SetResultMode(EQueryResultModeCount); + + query->Conditions().AddPropertyConditionL(titlePropertyDef, + ETextPropertyConditionCompareEquals, aTitle); + + CleanupStack::Pop(query); + + AppendQueryL(query, aQueryType); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeCommand::SearchString +// ---------------------------------------------------------------------------- +// +TInt CGlxDataSourceTaskMdeCommand::SearchStringL(TInt aResourceId) + { + TRACER("CGlxDataSourceTaskMdeCommand::SearchStringL()"); + _LIT(KResourceFile, "z:glxpluginalbums.rsc"); + + if (!iStringCache) + { + iStringCache = CGlxStringCache::NewL(); + } + //Get the localized string from the cache + HBufC* string = iStringCache->LoadLocalizedStringLC(KResourceFile,aResourceId); + + TInt result = string->CompareF(iTitle->Des()); + + CleanupStack::PopAndDestroy(string); + + return result; + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,314 @@ +/* +* Copyright (c) 2008-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: The Data Source Task MDS IDlist class +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by M Byrne + */ + +#include "glxdatasourcetaskmdsidlist.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcemds.h" +#include "glxdatasourcemds.hrh" +#include "glxdatasourcemdsutility.h" + +// CONSTANTS +//const TInt KGlxAlbumPromotionPosition = 0; + +_LIT(KPropertyDefNameCreationDate, "CreationDate"); + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + TRACER("CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList()") + iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeIdList::~CGlxDataSourceTaskMdeIdList() + { + TRACER("CGlxDataSourceTaskMdeIdList::~CGlxDataSourceTaskMdeIdList()") + // No implementation required + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::FilterAvailableComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::FilterAvailableComplete( + const RArray& aIdArray, TInt aErrorCode) + { + TRACER("CGlxDataSourceTaskMdeIdList::FilterAvailableComplete()") + DoPostFilterComplete(aIdArray, aErrorCode); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::ExecuteRequestL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::ExecuteRequestL() + { + TRACER("CGlxDataSourceTaskMdeIdList::ExecuteRequestL()") + CGlxIdListRequest* request = static_cast(iRequest); + TGlxMediaId container = request->ContainerId(); + TGlxQueryType queryType = EIdListQuery; + TQueryResultMode resultMode = EQueryResultModeId; + CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); + TBool isContent = ETrue; + + if( KGlxCollectionRootId == container.Value() ) // The root. + { + switch(request->CollectionPluginUid().iUid) + { + + case KGlxCollectionPluginAlbumsImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxCollectionPluginCameraImplementationUid: + { + iFilterProperties.iOrigin = EGlxFilterOriginCamera; + break; + } + case KGlxTagCollectionPluginImplementationUid: + { + isContent = EFalse; + objectDef = &DataSource()->TagDef(); + break; + } + case KGlxCollectionPluginMonthsImplementationUid: + { + iFilterProperties.iOrigin = EGlxFilterOriginAll; + container = TGlxMediaId(KGlxCollectionRootId); + resultMode = EQueryResultModeItem; + break; + } + case KGlxCollectionPluginImageViewerImplementationUid: + { + RArray list; + CleanupClosePushL(list); + list.AppendL(TGlxMediaId(request->CollectionPluginUid().iUid)); + DoPostFilterComplete(list, KErrNone); + CleanupStack::PopAndDestroy(&list); + return; + } + default: + { + // default gallery query returns all objects as per filter + break; + } + } + } + else // return the content of a container + { + switch(request->CollectionPluginUid().iUid) + { + case KGlxCollectionPluginAlbumsImplementationUid: + { + objectDef = &DataSource()->AlbumDef(); + break; + } + case KGlxTagCollectionPluginImplementationUid: + { + objectDef = &DataSource()->TagDef(); + break; + } + case KGlxCollectionPluginMonthsImplementationUid: + { + iFilterProperties.iOrigin = EGlxFilterOriginAll; + AddMonthFilterL(container, iFilterProperties); + container = TGlxMediaId(KGlxCollectionRootId); + break; + } + default: + { + User::Leave(KErrNotSupported); + break; + } + } + } + + DoQueryL(*objectDef, isContent, queryType, resultMode, container); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::DoHandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) + { + TRACER("CGlxDataSourceTaskMdeIdList::DoHandleQueryCompletedL()") + __ASSERT_DEBUG(iQueryTypes[0] == EIdListQuery, Panic(EGlxPanicLogicError)); + DoHandleListQueryCompletedL(); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL() + { + TRACER("CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL()") + if(iQueries[0]->ResultMode() == EQueryResultModeItem) + { + DoMonthListCreationL(*iQueries[0], iFilterProperties); + } + else // only id or item supported + { + + RArray localList; + CleanupClosePushL(localList); + NGlxDataSourceMdsUtility::CopyItemIdArrayL(localList,iQueries[0]->ResultIds()); + PostFilterL(localList, iFilterProperties); + CleanupStack::PopAndDestroy(&localList); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::DoMonthListCreationL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoMonthListCreationL(CMdEQuery& aQuery, + const TGlxFilterProperties& aFilterProperties) + { + TRACER("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL()") + CMdEProperty* time; + CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); + if (creationDateDef.PropertyType() != EPropertyTime) + { + User::Leave(KErrCorrupt); + } + RArray monthList; + CleanupClosePushL(monthList); + TTime lastMonth; + TTime currentMonth; + TInt count = aQuery.Count(); + for( TInt i = 0 ; i < count ; i++ ) + { + CMdEObject& object = (CMdEObject&)aQuery.ResultItem(i); + TInt timeIndex = object.Property(creationDateDef, time); + if( KErrNotFound == timeIndex ) + { + User::Leave(KErrCorrupt); + } + currentMonth = static_cast(time)->Value(); + if( !DataSource()->SameMonth(lastMonth, currentMonth) ) + { + const TGlxMediaId monthId = DataSource()->GetMonthIdL(currentMonth); + monthList.AppendL(monthId); + lastMonth = currentMonth; + } + } + PostFilterL(monthList, aFilterProperties); + CleanupStack::PopAndDestroy(&monthList); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeIdList::DoPostFilterComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::DoPostFilterComplete( + const RArray& aIdArray, TInt aErrorCode) + { + TRACER("CGlxDataSourceTaskMdeIdList::DoPostFilterComplete()") + if (aErrorCode == KErrNone) + { + TRAP(aErrorCode, ListToMediaL(aIdArray)); + } + + HandleRequestComplete(aErrorCode); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMde::PostFilterL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeIdList::PostFilterL(const RArray& + aFilteredList, const TGlxFilterProperties& aFilterProperties) + { + TRACER("CGlxDataSourceTaskMdeIdList::PostFilterL()") + + if( aFilterProperties.iPromoteSystemItems ) + { + RArray list = aFilteredList; + /* + TInt favoritesIndex = list.Find(DataSource()->FavoritesId()); + if( KErrNotFound != favoritesIndex ) + { + list.Remove(favoritesIndex); + list.Insert(DataSource()->FavoritesId(), KGlxAlbumPromotionPosition); + } + */ + DoPostFilterComplete(list, KErrNone); + } + else + { + DoPostFilterComplete(aFilteredList, KErrNone); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,610 @@ +/* +* Copyright (c) 2008-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: The data Source task MDS thumbnail class +* +*/ + + + + +#include "glxdatasourcetaskmdsthumbnail.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxdatasourcemds.h" +#include "glxdatasourcemds.hrh" + +// CONSTANTS + +_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameDRM, "DRM"); +_LIT(KPropertyDefNameItemType, "ItemType"); +//_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); +_LIT(KPropertyDefNameSize, "Size"); +_LIT(KUnsupportedItemType, "video/x-pn-realvideo"); +_LIT(KUnsupportedItemType1, "video/x-pn-multirate-realvideo"); +_LIT(KUnsupportedItemType2, "video/vnd.rn-realvideo"); +_LIT(KUnsupportedItemType3, "video/x-ms-wmv"); + +// ---------------------------------------------------------------------------- +// IsUnsupportedL +// Tests to see if an item type is unsupported +// ---------------------------------------------------------------------------- +// +TBool IsUnsupportedL(CMdESession& aSession, TItemId aItemId) + { + TRACER("IsUnsupportedL()"); + TBool isUnsupported = EFalse; + CMdEObject* item = aSession.GetObjectL(aItemId); + + if (!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + CMdEProperty* itemType = NULL; + + CMdEPropertyDef& itemTypeProperty = item->Def().GetPropertyDefL(KPropertyDefNameItemType); + + TInt itemTypeIndex = item->Property(itemTypeProperty, itemType); + if (itemTypeIndex > KErrNotFound) + { + const TDesC& des = static_cast< CMdETextProperty *>(itemType)->Value(); + if (des.Compare(KUnsupportedItemType) == 0 || + des.Compare(KUnsupportedItemType1) == 0 || + des.Compare(KUnsupportedItemType2) == 0 || + des.Compare(KUnsupportedItemType3) == 0) + { + // The item is unsupported + isUnsupported = ETrue; + } + } + CleanupStack::PopAndDestroy(item); + + return isUnsupported; + } +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeThumbnail:: CGlxDataSourceTaskMdeThumbnail(CGlxThumbnailRequest* aRequest, + MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) + : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::CGlxDataSourceTaskMdeThumbnail()") + iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail() + { + TRACER("CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail()") +#ifdef USE_S60_TNM + DataSource()->CancelFetchThumbnail(); + delete iTnFileInfo; + iTnFileInfo = NULL; +#else + if( iTnRequestStatus ) + { + CancelFetchUri(TGlxMediaId()); + } + if( iTnRequestInProgress ) + { + CGlxThumbnailRequest* request = static_cast(iRequest); + + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); + DataSource()->ThumbnailCreator().CancelRequest(tnReq.iId); + } +#endif + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::ExecuteRequest +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL() + { + TRACER("CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL()") + CGlxThumbnailRequest* request = static_cast(iRequest); + + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); + 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()) + { + if (tnReq.iSizeClass.iWidth > 0 && tnReq.iSizeClass.iHeight > 0 ) + { + DataSource()->FetchThumbnailL(iRequest, *this); + } + else + { + ThumbnailFetchComplete(KErrNone, ETrue); + } + } + else + { + FetchFileInfoL(); + } +#else + iTnRequestInProgress = ETrue; + DataSource()->ThumbnailCreator().FetchThumbnailL(tnReq, *this); +#endif + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete(TInt aError) + { + TRACER("void CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete()"); + CGlxThumbnailRequest* request = static_cast(iRequest); + if(request && !(aError == KErrNone || aError == KErrNoMemory)) + { + // An error has occured. + TBool isUnsupported = EFalse; + // If the item type is unsupported the we want to display the default + // icon rather than the corrupt icon. + TRAPD(err, isUnsupported = IsUnsupportedL(DataSource()->Session(), + TItemId(request->ItemId().Value()))); + if (isUnsupported) + { + aError = KErrNotSupported; + } + else if (err != KErrNone) + { + aError = err; + } + } + CGlxDataSourceTask::HandleRequestComplete(aError); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL()") + if (EContainerFirstItemQuery == iQueryTypes[0]) + { + TRAPD(err, DoHandleContainerFirstItemQueryCompletedL()); + + if (err != KErrNone) + { + CompleteThumbnailRequest(err); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL(const TGlxMediaId& aId, + TGlxThumbnailQuality aQuality) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL()") + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxThumbnailRequest* req = static_cast(iRequest); + GLX_DEBUG2("*** CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL() Id=%d ***", req->ItemId().Value()); + delete iResponse; + iResponse = NULL; + iResponse = CMPXMedia::NewL(); + CGlxThumbnailAttribute* tnAttribute = new (ELeave) CGlxThumbnailAttribute; + CleanupStack::PushL(tnAttribute); + TGlxThumbnailRequest tnRequest; + req->ThumbnailRequest(tnRequest); + TSize size(tnRequest.iSizeClass); + tnAttribute->iDimensions = size; + tnAttribute->iCroppingRect = tnRequest.iCroppingRect; + tnAttribute->iThumbnailQuality = aQuality; + GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL() aQuality=%d", aQuality); + + TUint attributeId = req->AttributeId(); + if ( GlxIsFullThumbnailAttribute(attributeId) ) + { + TBool quality = (EGlxThumbnailQualityHigh == aQuality); + attributeId = GlxFullThumbnailAttributeId(quality, + size.iWidth, size.iHeight); + } + + iResponse->SetTObjectValueL(KMPXMediaGeneralId, aId.Value()); + iResponse->SetNoNewLCObjectL( + TMPXAttribute(KGlxMediaIdThumbnail, attributeId), tnAttribute); + CleanupStack::PopAndDestroy(tnAttribute); + } + +#ifdef USE_S60_TNM +void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TInt aError, + TBool aQuality) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TNM)") + CGlxThumbnailRequest* request = static_cast(iRequest); + TGlxThumbnailRequest tnRequest; + request->ThumbnailRequest(tnRequest); + TInt err = aError; + if(!err) + { + TGlxThumbnailQuality tnQuality = EGlxThumbnailQualityHigh; + if (!aQuality) + { + tnQuality = EGlxThumbnailQualityLow; + } + TRAP(err, HandleThumbnailFetchCompleteL(tnRequest.iId, tnQuality)); + } + HandleRequestComplete(err); + } +#else +// ----------------------------------------------------------------------------- +// ThumbnailFetchComplete +// Notifies that a thumbnail for a given item is available, or that +// thumbnail generation failed. +// ----------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete( + const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete()") + GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete() aErrorCode=%d", aErrorCode); + iTnRequestInProgress = EFalse; + TInt err = aErrorCode; + if(!err) + { + TRAP(err, HandleThumbnailFetchCompleteL(aItemId, aQuality)); + } + HandleRequestComplete(err); + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete( + const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete()") + } + + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete( + const RArray& /*aIdArray*/, TInt /*aErrorCode*/) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete()") + // No implementation + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL(CGlxtnFileInfo* aInfo, + const TGlxMediaId& aItemId, TRequestStatus* aStatus) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL()") + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxThumbnailRequest* request = static_cast(iRequest); + if(request->ThumbnailInfo()) + { + aInfo->CopyInfoL(*request->ThumbnailInfo()); + *aStatus = KRequestPending; + User::RequestComplete(aStatus, KErrNone); + return; + } + + CMdEObject* item = DataSource()->Session().GetObjectL((TItemId)aItemId.Value()); + if(!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + iTnRequestStatus = aStatus; + iTnFileInfo = aInfo; + *iTnRequestStatus = KRequestPending; + + CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(item); + if( CGlxDataSource::EContainerTypeNotAContainer != containerType ) + { + iTnFileInfo->iTemporary = ETrue; + + TGlxMediaId container = aItemId; + CMdEObjectDef* objectDef = &item->Def(); + + /// @todo: use default filter so we can ensure we always get correct first item if filters change + iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + iFilterProperties.iSortDirection = EGlxFilterSortDirectionOverrideToDescendingIfDate; + iFilterProperties.iLastCaptureDate = ETrue; + + if( CGlxDataSource::EContainerTypeMonth == containerType ) + { + iFilterProperties.iOrigin = EGlxFilterOriginAll; + AddMonthFilterL(item, iFilterProperties); + container = TGlxMediaId(KGlxCollectionRootId); + objectDef = &DataSource()->ObjectDef(); + } + + DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, + EQueryResultModeItem, container); + } + else + { + CompleteFetchFileInfoL(item); + } + + CleanupStack::PopAndDestroy(item); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::CancelFetchUri +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::CancelFetchUri(const TGlxMediaId& /*aItemId*/) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::CancelFetchUri()") + CompleteThumbnailRequest(KErrCancel); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage +// ---------------------------------------------------------------------------- +// +MGlxtnThumbnailStorage* CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage() + { + TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage()") + return &DataSource()->ThumbnailDatabase(); + } +#endif + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL(CMdEObject* aItem) + { + TRACER("CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL()") + TParsePtrC parser(aItem->Uri()); + iTnFileInfo->SetFilePathL(parser.FullName()); + + CMdEProperty* size; + CMdEPropertyDef& sizeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameSize); + TInt sizeIndex = aItem->Property(sizeProperty, size); + if( KErrNotFound == sizeIndex ) + { + iTnFileInfo->iFileSize = 0; + } + else + { + iTnFileInfo->iFileSize = size->Uint32ValueL(); + } + + CMdEProperty* lastModifiedDateProperty; + 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 + // #ifdef _DEBUG, it will cause a warning in non debug builds. +#endif + aItem->Property(lastModifiedDatePropertyDef, lastModifiedDateProperty); + __ASSERT_DEBUG(index > KErrNotFound, Panic(EGlxPanicRequiredPropertyNotFound)); + + iTnFileInfo->iFileTime = static_cast(lastModifiedDateProperty)->Value(); + + CGlxDataSource::TItemType itemType = DataSource()->ItemType(aItem); + iTnFileInfo->iIsVideo = ( CGlxDataSource::EItemTypeVideo == itemType ); + + CMdEProperty* drmProtected; + CMdEPropertyDef* drmProtectedProperty = NULL; + + ///@todo AB test + TRAP_IGNORE(drmProtectedProperty = &aItem->Def().GetPropertyDefL(KPropertyDefNameDRM)); + TInt drmProtectedIndex = KErrNotFound; + + if (drmProtectedProperty) + { + drmProtectedIndex= aItem->Property(*drmProtectedProperty, drmProtected); + } + + TInt err = KErrNone; + if( KErrNotFound == drmProtectedIndex) + { + // should be present for all normally harvested images + // so this should only be where we didn't pre-fetch the attributes + // 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()); + content->GetAttribute(ContentAccess::EIsProtected, iTnFileInfo->iIsProtected); + CleanupStack::PopAndDestroy(content); + ); + } + else + { + iTnFileInfo->iIsProtected = static_cast(drmProtected)->Value(); + } + + CompleteThumbnailRequest(err); + iTnFileInfo = NULL; + iTnRequestStatus = NULL; + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL() + { + TRACER("CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL()") + if( !iQueries[0]->Count() ) + { + User::Leave(KErrGlxEmptyContainer); // leave with a specific Error code so UI can display empty folder icon + } + + CMdEObject* item = static_cast(iQueries[0]->TakeOwnershipOfResult(0)); + if(!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + CompleteFetchFileInfoL(item); + CleanupStack::PopAndDestroy(item); + } + +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest +// ---------------------------------------------------------------------------- +// +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, EFalse); + } + else + { + CGlxThumbnailRequest* request = static_cast(iRequest); + TGlxThumbnailRequest tnReq; + request->ThumbnailRequest(tnReq); + + 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 + { + GLX_LOG_INFO("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest KErrArgument"); + ThumbnailFetchComplete(KErrArgument, EFalse); + } + } +#else + if (iTnRequestStatus) + { + *iTnRequestStatus = KRequestPending; + User::RequestComplete(iTnRequestStatus, aError); + } +#endif + } + +#ifdef USE_S60_TNM +// ---------------------------------------------------------------------------- +// CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL +// ---------------------------------------------------------------------------- +// +void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL() + { + TRACER("CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL()") + __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); + CGlxThumbnailRequest* request = static_cast(iRequest); + CMdEObject* item = DataSource()->Session().GetObjectL(request->ItemId().Value()); + if(!item) + { + User::Leave(KErrNotFound); + } + + CleanupStack::PushL(item); + iTnFileInfo = new (ELeave) CGlxtnFileInfo; + + CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(item); + if( CGlxDataSource::EContainerTypeNotAContainer != containerType ) + { + iTnFileInfo->iTemporary = ETrue; + + TGlxMediaId container = request->ItemId(); + CMdEObjectDef* objectDef = &item->Def(); + + /// @todo: use default filter so we can ensure we always get correct first item if filters change + iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + iFilterProperties.iSortDirection = EGlxFilterSortDirectionOverrideToDescendingIfDate; + iFilterProperties.iLastCaptureDate = ETrue; + + if( CGlxDataSource::EContainerTypeMonth == containerType ) + { + iFilterProperties.iOrigin = EGlxFilterOriginAll; + AddMonthFilterL(item, iFilterProperties); + container = TGlxMediaId(KGlxCollectionRootId); + objectDef = &DataSource()->ObjectDef(); + } + + DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, + EQueryResultModeItem, container); + } + else + { + CompleteFetchFileInfoL(item); + } + + CleanupStack::PopAndDestroy(item); + } + +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/datasource/plugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/datasource/plugins/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +PRJ_MMPFILES + +#ifdef RD_MDS_2_0 +#include "../glxdatasourcemde/group/bld.inf" +#else +#include "../glxdatasourcemde2.5/group/bld.inf" +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include "../thumbnailcreator/group/bld.inf" +#include + +PRJ_TESTEXPORTS +../../gallery/data/abstract5.jpg /epoc32/winscw/c/abstract5.jpg +../../gallery/data/Battle.jpg /epoc32/winscw/c/battle.jpg +../../gallery/data/text_element_left_cap.png /epoc32/winscw/c/text_element_left_cap.png +../../gallery/data/text_element_mid.png /epoc32/winscw/c/text_element_mid.png +../../gallery/data/text_element_right_cap.png /epoc32/winscw/c/text_element_right_cap.png +../../gallery/data/qgn_prop_image_notcreated.png /epoc32/winscw/c/qgn_prop_image_notcreated.png + +../../gallery/data/Image1.jpg /epoc32/winscw/c/image1.jpg +../../gallery/data/Image2.jpg /epoc32/winscw/c/image2.jpg +../../gallery/data/Image3.jpg /epoc32/winscw/c/image3.jpg +../../gallery/data/Image4.jpg /epoc32/winscw/c/image4.jpg +../../gallery/data/Image5.jpg /epoc32/winscw/c/image5.jpg +../../gallery/data/Image6.jpg /epoc32/winscw/c/image6.jpg +../../gallery/data/Image7.jpg /epoc32/winscw/c/image7.jpg +../../gallery/data/Image8.jpg /epoc32/winscw/c/image8.jpg +../../gallery/data/Image9.jpg /epoc32/winscw/c/image9.jpg +../../gallery/data/Image10.jpg /epoc32/winscw/c/image10.jpg +../../gallery/data/Image11.jpg /epoc32/winscw/c/image11.jpg +../../gallery/data/Image12.jpg /epoc32/winscw/c/image12.jpg +../../gallery/data/Image13.jpg /epoc32/winscw/c/image13.jpg +../../gallery/data/Image14.jpg /epoc32/winscw/c/image14.jpg +../../gallery/data/Image15.jpg /epoc32/winscw/c/image15.jpg +../../gallery/data/Image16.jpg /epoc32/winscw/c/image16.jpg +../../gallery/data/Image17.jpg /epoc32/winscw/c/image17.jpg +../../gallery/data/Image18.jpg /epoc32/winscw/c/image18.jpg +../../gallery/data/Image19.jpg /epoc32/winscw/c/image19.jpg +../../gallery/data/Image20.jpg /epoc32/winscw/c/image20.jpg +../../gallery/data/Image21.jpg /epoc32/winscw/c/image21.jpg +../../gallery/data/Image22.jpg /epoc32/winscw/c/image22.jpg + +../../gallery/data/newitem1.jpg /epoc32/winscw/c/newitem1.jpg +../../gallery/data/newitem2.jpg /epoc32/winscw/c/newitem2.jpg +../../gallery/data/newitem3.jpg /epoc32/winscw/c/newitem3.jpg +../../gallery/data/newitem4.jpg /epoc32/winscw/c/newitem4.jpg +../../gallery/data/newitem5.jpg /epoc32/winscw/c/newitem5.jpg +../../gallery/data/newitem6.jpg /epoc32/winscw/c/newitem6.jpg +../../gallery/data/newitem7.jpg /epoc32/winscw/c/newitem7.jpg +../../gallery/data/newitem8.jpg /epoc32/winscw/c/newitem8.jpg +../../gallery/data/newitem9.jpg /epoc32/winscw/c/newitem9.jpg +../../gallery/data/newitem10.jpg /epoc32/winscw/c/newitem10.jpg +../../gallery/data/newitem11.jpg /epoc32/winscw/c/newitem11.jpg +../../gallery/data/newitem12.jpg /epoc32/winscw/c/newitem12.jpg +../../gallery/data/newitem13.jpg /epoc32/winscw/c/newitem13.jpg +../../gallery/data/newitem14.jpg /epoc32/winscw/c/newitem14.jpg + + +PRJ_EXPORTS + + +PRJ_MMPFILES +../datasource/manager/group/glxdatasourcemanager.mmp +../plugins/glxcollectionpluginall/group/glxcollectionpluginall.mmp +//../plugins/glxcollectionplugincamera/group/glxcollectionplugincamera.mmp +../plugins/glxcollectionpluginmonths/group/glxcollectionpluginmonths.mmp +../plugins/glxcollectionpluginalbums/group/glxcollectionpluginalbums.mmp +../plugins/glxcollectionpluginimageviewer/group/glxcollectionpluginimageviewer.mmp + +#include "../plugins/group/bld.inf" +#include "../datasource/plugins/group/bld.inf" + +PRJ_TESTMMPFILES + +// Alex Birkett 16/01/2008 The following plugins will prevent gallery starting up because they don't return the +// KMPXMediaColDetailSpaceId attribute (the ID space ID). Build them at your own risk! +// ../plugins/Test/albumcollectionplugin/group/glxalbumcollectionplugin.mmp +// ../plugins/Test/glxtestcollectionplugin/group/glxtestcollectionplugin.mmp +// ../plugins/Test/glxmedialiststestcollectionplugin/group/glxmedialiststestcollectionplugin.mmp + +//#include "../tsrc/gallerytestapp/group/bld.inf" diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginalbums/data/20007196.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginalbums/data/20007196.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +#include +#include "glxcollectionpluginalbums.hrh" +#include +#include +#include //Uid of the plugine for priority in opaque-data + + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: Supported plugin types. + * E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic + * + * uid + * uid: plugin type uid. + * E.g. for music plugin will be: 0x101FFCDA + * + * flags [optional] + * flags: sum of the required feature flags, not used now + * + * priority [optional] + * priority: a value of type TMPXCollectionPluginPriorities. This value determines + * the returning order when several plugins can support the same set of Uids. + * Default value of this field is EMPXCollectionPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxCollectionPluginAlbumsDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FFC36; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCollectionPluginAlbumsImplementationUid; + version_no = 1; + display_name = qtn_lgal_list_title_albums; + default_data = ""; + opaque_data = ""EGlxCollectionPluginShowInMainListView"" + ""EGlxCollectionPluginAlbums"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded + } + }; + } + }; + } + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginalbums/data/glxpluginalbums.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginalbums/data/glxpluginalbums.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Cloud View +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME PALB + +#include +#include + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + + +// RESOURCE DEFINITIONS + +RESOURCE BA_RSS_SIGNATURE { } + +RESOURCE TBUF { buf="PALB"; } + +RESOURCE LBUF r_album_sub_title_single { txt=qtn_lgal_list_detail_one_alb; } +RESOURCE LBUF r_album_sub_title_multi { txt=qtn_lgal_list_detail_multi_alb; } +RESOURCE LBUF r_album_item_sub_title_single { txt=qtn_lgal_list_detail_one_item; } +RESOURCE LBUF r_album_item_sub_title_multi { txt=qtn_lgal_list_detail_multi_item; } +RESOURCE LBUF r_album_item_sub_title_empty { txt=qtn_lgal_list_detail_no_img_vid; } +RESOURCE LBUF r_album_popup_title { txt=qtn_lgal_title_select_albums; } +RESOURCE LBUF r_album_item_title { txt=qtn_lgal_album_create; } +RESOURCE LBUF r_album_default_title { txt=qtn_lgal_name_album; } +RESOURCE LBUF r_album_general_title { txt=qtn_lgal_list_title_albums; } +RESOURCE LBUF r_album_favorites_title { txt=qtn_lgal_list_title_favourites; } +RESOURCE LBUF r_album_camera_title { txt=qtn_lgal_list_title_my_captured; } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginalbums/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginalbums/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + + +PRJ_MMPFILES +glxcollectionpluginalbums.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginalbums/group/glxcollectionpluginalbums.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginalbums/group/glxcollectionpluginalbums.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008-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: Project information for album collection plugin +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionpluginalbums.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20007196 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxcollectionpluginalbums.cpp +SOURCE glxcollectionpluginalbumsproxy.cpp + +SOURCEPATH ../data +START RESOURCE 20007196.rss +TARGET glxcollectionpluginalbums.rsc +END + +SOURCEPATH ../data +START RESOURCE glxpluginalbums.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +LANGUAGE_IDS +END + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../datasource/manager/inc + + +LIBRARY commonengine.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY glxcommon.lib +LIBRARY glxdatasourcemanager.lib +LIBRARY mpxcommon.lib +LIBRARY flogger.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginalbums/inc/glxcollectionpluginalbums.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginalbums/inc/glxcollectionpluginalbums.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + + +#ifndef C_GLXCOLLECTIONPLUGINALBUMS_H +#define C_GLXCOLLECTIONPLUGINALBUMS_H + +// INCLUDES +#include +#include "glxcollectionpluginbase.h" + + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// FORWARD DECLARATIONS + +// CONSTANTS +const TInt KGlxCollectionAlbumLevel = KGlxCollectionRootLevel + 1; +const TInt KGlxCollectionAlbumContentsLevel = KGlxCollectionRootLevel + 2; +const TInt KGlxCollectionAlbumContentsFSLevel = KGlxCollectionRootLevel + 3; + +// CLASS DECLARATION + +/** + * CGlxCollectionPluginAlbums class + * + * Plug-in basically provides browsing. + * @ingroup collection_component_design + */ +NONSHARABLE_CLASS(CGlxCollectionPluginAlbums) : public CGlxCollectionPluginBase + { +public: // Constructors and destructor + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CGlxCollectionPluginAlbums* NewL(TAny* aObs); + + /** + * Destructor + */ + ~CGlxCollectionPluginAlbums(); + +private: + /** + * Checks to see if any additional attributes are required to construct required + * CPI specific attribute + * + * @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); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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 + * @param aMediaIds list of CPI specific media Ids + */ + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray aMediaIds); + + TBool IsUpdateMessageIgnored(CMPXMessage& aMessage); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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 + * @param aMediaId CPI specific media Id + */ + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TGlxMediaId aMediaId); + + TGlxFilterProperties DefaultFilter(TInt aLevel); + +private: + /** + * Constructor + * @param aObs MMPXCollectionPluginObserver instance + */ + CGlxCollectionPluginAlbums(MMPXCollectionPluginObserver* aObs); + void ConstructL(); + }; + + + +#endif // C_GLXCOLLECTIONPLUGINALBUMS_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginalbums/src/glxcollectionpluginalbums.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginalbums/src/glxcollectionpluginalbums.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,337 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcollectionpluginalbums.h" +#include "glxcollectionpluginalbums.hrh" +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// CONSTANTS +const TInt KFavoriteAlbumId = 1 ; +const TInt KCapturedAlbumId = 2 ; + + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + + +// ============================ LOCAL FUNCTIONS ============================== + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginAlbums* CGlxCollectionPluginAlbums::NewL(TAny* aObs) + { + CGlxCollectionPluginAlbums* self = new (ELeave) CGlxCollectionPluginAlbums( + static_cast(aObs)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginAlbums::~CGlxCollectionPluginAlbums() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginAlbums::CGlxCollectionPluginAlbums( + MMPXCollectionPluginObserver* aObs) + { + iObs = aObs; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginAlbums::ConstructL() + { + iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); + } + +void CGlxCollectionPluginAlbums::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray) + { + TRACER("CGlxCollectionPluginAlbums::CpiAttributeAdditionalAttributes"); + // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files + // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count + if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) + { + // need to add the usage count. but check first if it is already present + TInt attrCount = aAttributeArray.Count(); + TBool found = EFalse; + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if ( aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + break; + } + } + + if (!found) + { + aAttributeArray.Append(KGlxMediaCollectionInternalUsageCount); + } + } + } +void CGlxCollectionPluginAlbums::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray aMediaIds) + { + TRACER("CGlxCollectionPluginAlbums::HandleCpiAttributeResponseL"); + const TInt mediaIdCount = aMediaIds.Count(); + + switch (mediaIdCount) + { + case 0: + User::Leave(KErrNotSupported); + break; + case 1: + HandleCpiAttributeResponseL(aResponse, aCpiAttributes, aMediaIds[0]); + break; + default: + { + // We have an array of CMPXMedia items + + if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0]) + { + User::Leave(KErrNotSupported); + } + + CMPXMediaArray* mediaArray = aResponse->ValueCObjectL(KMPXMediaArrayContents); + CleanupStack::PushL(mediaArray); + + const TInt arrayCount = mediaArray->Count(); + + // Sanity check + if (arrayCount != mediaIdCount) + { + User::Leave(KErrArgument); + } + + for (TInt index = 0; index < arrayCount; index++) + { + HandleCpiAttributeResponseL((*mediaArray)[index], aCpiAttributes, aMediaIds[index]); + } + + aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray); + CleanupStack::PopAndDestroy(mediaArray); + } + break; + } + } + +void CGlxCollectionPluginAlbums::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TGlxMediaId aMediaId) + { + _LIT(KResourceFile, "z:glxpluginalbums.rsc"); + + const TInt attribCount = aCpiAttributes.Count(); + + for (TInt index = 0; index < attribCount ; index++) + { + const TMPXAttribute attr = aCpiAttributes[index]; + + if (attr == KGlxMediaCollectionPluginSpecificSubTitle) + { + TInt usageCount = 0; + if ( aResponse->IsSupported(KMPXMediaGeneralCount) ) + { + usageCount = aResponse->ValueTObjectL(KMPXMediaGeneralCount); + } + else if ( aResponse->IsSupported(KGlxMediaCollectionInternalUsageCount) ) + { + usageCount = aResponse->ValueTObjectL(KGlxMediaCollectionInternalUsageCount); + aResponse->Delete(KGlxMediaCollectionInternalUsageCount); + } + else + { + User::Leave(KErrNotSupported); + } + HBufC* tempTitle = NULL; + + if (TGlxMediaId(KGlxCollectionRootId) == aMediaId) + { + if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALBUM_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALBUM_SUB_TITLE_MULTI); + } + } + else + { + if(0 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALBUM_ITEM_SUB_TITLE_EMPTY); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALBUM_ITEM_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALBUM_ITEM_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); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(tempTitle); + } + else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALBUM_POPUP_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALBUM_ITEM_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALBUM_DEFAULT_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + else if (attr == KMPXMediaGeneralTitle) + { + if( TGlxMediaId(KGlxCollectionRootId) == aMediaId ) + { + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALBUM_GENERAL_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + else + { + if( aResponse->IsSupported(KGlxMediaCollectionInternalSystemItemType) ) + { + if( TGlxMediaId(KCapturedAlbumId) == aMediaId ) + { + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALBUM_CAMERA_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + else if (TGlxMediaId(KFavoriteAlbumId) == aMediaId ) + { + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALBUM_FAVORITES_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + } + aResponse->Delete(KGlxMediaCollectionInternalSystemItemType); + } + } + } + } + +TBool CGlxCollectionPluginAlbums::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/) + { + TBool ignore = EFalse; + return ignore; + } + +TGlxFilterProperties CGlxCollectionPluginAlbums::DefaultFilter(TInt aLevel) + { + __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || (aLevel == KGlxCollectionAlbumLevel) + || (aLevel == KGlxCollectionAlbumContentsLevel) || (aLevel == KGlxCollectionAlbumContentsFSLevel)), + Panic(EGlxPanicInvalidPathLevel)); + TGlxFilterProperties filterProperties; + filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + switch(aLevel) + { + case KGlxCollectionRootLevel: + case KGlxCollectionAlbumLevel: + { + filterProperties.iPromoteSystemItems = ETrue; + filterProperties.iSortOrder = EGlxFilterSortOrderAlphabetical; + filterProperties.iItemType = EGlxFilterAlbum; + break; + } + case KGlxCollectionAlbumContentsLevel: + { + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + } + case KGlxCollectionAlbumContentsFSLevel: + { + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + break; + } + } + return filterProperties; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginalbums/src/glxcollectionpluginalbumsproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginalbums/src/glxcollectionpluginalbumsproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Standard proxy of the ECOM plugin +* +*/ + + + + +#include +#include "glxcollectionpluginalbums.h" + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) + {{aUid},(TProxyNewLPtr)(aFuncPtr)} +#endif + +/**~ + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(0x20007197, CGlxCollectionPluginAlbums::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy); + return ImplementationTable; + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginall/data/2000A7C0.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginall/data/2000A7C0.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +/** + * @internal reviewed 13/06/2007 by Alex Birkett + * @internal reviewed 24/07/2007 by K Hoikka, SCO 403-8472 removal of all view + */ + +/** + * @bug:minor:abirkett:13/06/2007: Missing author. + */ + +#include +#include "glxcollectionpluginall.hrh" +#include +#include +#include //Uid of the plugine for priority in opaque-data +#include // for v8.0 feature flags + +/** + * Bug Fix @ ESLM-7VWF28 :: In case the "ALL" Collection should not be shown in the Photos Matrix Menu View, + * then Uncomment the following line inorder to define the Macro " GLX_NO_ALL_VIEW " + */ +//#define GLX_NO_ALL_VIEW + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: Supported plugin types. + * E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic + * + * uid + * uid: plugin type uid. + * E.g. for music plugin will be: 0x101FFCDA + * + * flags [optional] + * flags: sum of the required feature flags, not used now + * + * priority [optional] + * priority: a value of type TMPXCollectionPluginPriorities. This value determines + * the returning order when several plugins can support the same set of Uids. + * Default value of this field is EMPXCollectionPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxCollectionPluginAllDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FFC36; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCollectionPluginAllImplementationUid; + version_no = 1; + display_name = qtn_lgal_list_title_all; + default_data = ""; +#ifdef GLX_NO_ALL_VIEW + opaque_data = ""EGlxCollectionPluginAll"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded +#else +// specify that this collection plugin should be shown in the main list view + opaque_data = ""EGlxCollectionPluginShowInMainListView"" + ""EGlxCollectionPluginAll"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded +#endif + } + }; + } + }; + } + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginall/data/glxpluginall.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginall/data/glxpluginall.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Cloud View +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME PALL + +#include +#include + + +// RESOURCE DEFINITIONS + +RESOURCE BA_RSS_SIGNATURE { } + +RESOURCE TBUF { buf="PALL"; } + +RESOURCE LBUF r_all_sub_title_single { txt=qtn_lgal_list_detail_one_item; } +RESOURCE LBUF r_all_sub_title_multi { txt=qtn_lgal_list_detail_multi_item; } +RESOURCE LBUF r_all_item_sub_title_empty { txt=qtn_lgal_list_detail_no_img_vid; } +RESOURCE LBUF r_all_general_title { txt=qtn_lgal_list_title_all; } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginall/group/glxcollectionpluginall.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginall/group/glxcollectionpluginall.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: Project information about ALL collection PLugin +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionpluginall.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2000A7C0 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxcollectionpluginall.cpp +SOURCE glxcollectionpluginallproxy.cpp + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../datasource/manager/inc +SYSTEMINCLUDE ../../../thumbnailcreator/inc + + + +SOURCEPATH ../data +START RESOURCE 2000A7C0.rss +TARGET glxcollectionpluginall.rsc +END + +SOURCEPATH ../data +START RESOURCE glxpluginall.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +LANGUAGE_IDS +END + +LIBRARY commonengine.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY glxdatasourcemanager.lib +LIBRARY mpxcommon.lib +LIBRARY glxcommon.lib +LIBRARY flogger.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginall/inc/glxcollectionpluginall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginall/inc/glxcollectionpluginall.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + + +#ifndef C_GLXCOLLECTIONPLUGINALL_H +#define C_GLXCOLLECTIONPLUGINALL_H + +// INCLUDES +#include +#include "glxcollectionpluginbase.h" + +/** + * @internal reviewed 13/06/2007 by Alex Birkett + */ + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxCollectionPluginAll class + * + * Plug-in basically provides browsing. + * @ingroup collection_component_design + */ +NONSHARABLE_CLASS(CGlxCollectionPluginAll) : public CGlxCollectionPluginBase + { +public: // Constructors and destructor + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CGlxCollectionPluginAll* NewL(TAny* aObs); + + /** + * Destructor + */ + ~CGlxCollectionPluginAll(); + +private: + /** + * Checks to see if any additional attributes are required to construct required + * CPI specific attribute + * + * @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); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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); + + TBool IsUpdateMessageIgnoredL(CMPXMessage& aMessage); + +private: + /** + * Constructor + * @param aObs MMPXCollectionPluginObserver instance + */ + CGlxCollectionPluginAll(MMPXCollectionPluginObserver* aObs); + /** + * 2nd stage Constructor + */ + void ConstructL(); + }; + +#endif // C_GLXCOLLECTIONPLUGINALL_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginall/src/glxcollectionpluginall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginall/src/glxcollectionpluginall.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcollectionpluginall.h" +#include "glxcollectionpluginall.hrh" +#include "glxmediageneraldefs.h" +#include "glxcollectiongeneraldefs.h" +#include "glxlog.h" + + +#include "glxpanic.h" +#include "mglxdatasource.h" +#include "glxrequest.h" +#include "glxidlistrequest.h" +#include "glxfilterfactory.h" + +/** + * @internal reviewed 13/06/2007 by Alex Birkett + */ + +// CONSTANTS + +// ============================ LOCAL FUNCTIONS ============================== + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginAll* CGlxCollectionPluginAll::NewL(TAny* aObs) + { + CGlxCollectionPluginAll* self = new (ELeave) CGlxCollectionPluginAll( + static_cast(aObs)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginAll::~CGlxCollectionPluginAll() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginAll::CGlxCollectionPluginAll( + MMPXCollectionPluginObserver* aObs) + { + iObs = aObs; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginAll::ConstructL() + { + iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); + } + +void CGlxCollectionPluginAll::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray) + { + TRACER("CGlxCollectionPluginAll::CpiAttributeAdditionalAttributes()"); + // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files + // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count + if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) + { + // need to add the usage count. but check first if it is already present + TInt attrCount = aAttributeArray.Count(); + TBool found = EFalse; + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if (aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + break; + } + } + + if (!found) + { + aAttributeArray.Append(KMPXMediaGeneralCount); + } + } + } + +void CGlxCollectionPluginAll::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray /* aMediaIds */) + { + TRACER("CGlxCollectionPluginAll::HandleCpiAttributeResponseL"); + _LIT(KResourceFile, "z:glxpluginall.rsc"); + + TInt count = aCpiAttributes.Count(); + + for (TInt index = 0; index < count ; index++) + { + const TMPXAttribute attr = aCpiAttributes[index]; + + if (attr == KGlxMediaCollectionPluginSpecificSubTitle) + { + if (!aResponse->IsSupported(KMPXMediaGeneralCount)) + { + User::Leave(KErrNotSupported); + } + else + { + TInt usageCount = aResponse->ValueTObjectL(KMPXMediaGeneralCount); + HBufC* tempTitle = NULL; + + if(0 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALL_ITEM_SUB_TITLE_EMPTY); + // Set the title in the response. + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + // Get the format string + else if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALL_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_ALL_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); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(tempTitle); + } + } + else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + User::Leave(KErrNotSupported); + } + else if (attr == KMPXMediaGeneralTitle) + { + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_ALL_GENERAL_TITLE); + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + } + } + +TBool CGlxCollectionPluginAll::IsUpdateMessageIgnoredL(CMPXMessage& /*aMessage*/) + { + TBool ignore = EFalse; + return ignore; + } + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginall/src/glxcollectionpluginallproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginall/src/glxcollectionpluginallproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + +#include +#include "glxcollectionpluginall.h" + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) + {{aUid},(TProxyNewLPtr)(aFuncPtr)} +#endif + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(0x2000A7C1, CGlxCollectionPluginAll::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy); + return ImplementationTable; + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugincamera/data/2000a766.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugincamera/data/2000a766.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +#include +#include "glxcollectionplugincamera.hrh" +#include +#include +#include +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: Supported plugin types. + * E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic + * + * uid + * uid: plugin type uid. + * E.g. for music plugin will be: 0x101FFCDA + * + * flags [optional] + * flags: sum of the required feature flags, not used now + * + * priority [optional] + * priority: a value of type TMPXCollectionPluginPriorities. This value determines + * the returning order when several plugins can support the same set of Uids. + * Default value of this field is EMPXCollectionPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxCollectionPluginCameraDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FFC36; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCollectionPluginCameraImplementationUid; + version_no = 1; + display_name = qtn_lgal_list_title_captured_nseries; + default_data = ""; + opaque_data = ""EGlxCollectionPluginCamera"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded + } + }; + } + }; + } + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugincamera/data/glxplugincamera.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugincamera/data/glxplugincamera.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2008-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: Resource information for camera collection plugin +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME PCAM + +#include +#include + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// RESOURCE DEFINITIONS + +RESOURCE BA_RSS_SIGNATURE { } + +RESOURCE TBUF { buf="PCAM"; } + + +//RESOURCE LBUF r_camera_sub_title_no_image_no_video { txt=qtn_lgal_list_detail_no_img_vid; } +RESOURCE LBUF r_camera_sub_title_no_image_no_video { txt=qtn_lgal_list_detail_no_img_vid_nseries; } +RESOURCE LBUF r_camera_sub_title_single { txt=qtn_lgal_list_detail_one_item; } +RESOURCE LBUF r_camera_sub_title_multi { txt=qtn_lgal_list_detail_multi_item; } +//RESOURCE LBUF r_camera_general_title { txt=qtn_lgal_list_title_captured; } +RESOURCE LBUF r_camera_general_title { txt=qtn_lgal_list_title_captured_nseries; } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugincamera/group/glxcollectionplugincamera.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugincamera/group/glxcollectionplugincamera.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: Project information for collection plugin camera +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionplugincamera.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2000a766 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxcollectionplugincamera.cpp +SOURCE glxcollectionplugincameraproxy.cpp + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../datasource/manager/inc +SYSTEMINCLUDE ../../../thumbnailcreator/inc + + + +SOURCEPATH ../data +START RESOURCE 2000a766.rss +TARGET glxcollectionplugincamera.rsc +END + +SOURCEPATH ../data +START RESOURCE glxplugincamera.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +LANGUAGE_IDS +END + +LIBRARY commonengine.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY glxdatasourcemanager.lib +LIBRARY mpxcommon.lib +LIBRARY glxcommon.lib +LIBRARY flogger.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugincamera/inc/glxcollectionplugincamera.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugincamera/inc/glxcollectionplugincamera.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + + +#ifndef C_GLXCOLLECTIONPLUGINCAMERA_H +#define C_GLXCOLLECTIONPLUGINCAMERA_H + +// INCLUDES +#include +#include "glxcollectionpluginbase.h" + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxCollectionPluginCamera class + * + * Plug-in basically provides browsing. + * @ingroup collection_component_design + */ +NONSHARABLE_CLASS(CGlxCollectionPluginCamera) : public CGlxCollectionPluginBase + { +public: // Constructors and destructor + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CGlxCollectionPluginCamera* NewL(TAny* aObs); + + /** + * Destructor + */ + ~CGlxCollectionPluginCamera(); + +private: + /** + * Constructor + * @param aObs MMPXCollectionPluginObserver instance + */ + CGlxCollectionPluginCamera(MMPXCollectionPluginObserver* aObs); + /** + * 2nd stage Constructor + */ + void ConstructL(); + +private: + /** + * Checks to see if any additional attributes are required to construct required + * CPI specific attribute + * + * @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); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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); + TBool IsUpdateMessageIgnoredL(CMPXMessage& aMessage); + + TGlxFilterProperties DefaultFilter(TInt aLevel); + }; + +#endif // C_GLXCOLLECTIONPLUGINCAMERA_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugincamera/src/glxcollectionplugincamera.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugincamera/src/glxcollectionplugincamera.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,392 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + +// INCLUDE FILES + +#include "glxcollectionplugincamera.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcollectionplugincamera.hrh" + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// CONSTANTS + +// ============================ LOCAL FUNCTIONS ============================== + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginCamera* CGlxCollectionPluginCamera::NewL(TAny* aObs) + { + CGlxCollectionPluginCamera* self = new (ELeave) CGlxCollectionPluginCamera( + static_cast(aObs)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginCamera::~CGlxCollectionPluginCamera() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginCamera::CGlxCollectionPluginCamera( + MMPXCollectionPluginObserver* aObs) + { + iObs = aObs; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginCamera::ConstructL() + { + iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); + } +// ---------------------------------------------------------------------------- +// CpiAttributeAdditionalAttributes +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginCamera::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray) + { + TRACER("CGlxCollectionPluginCamera::CpiAttributeAdditionalAttributes"); + // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the other attributes + // are reading straight from resource files KGlxMediaCollectionPluginSpecificSubTitle + // requires a image and the Video count in the collection + + if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) + { + // need to add the usage count. but check first if it is already present + TInt attrCount = aAttributeArray.Count(); + + TBool found = EFalse; + +#ifdef GLX_SUB_TITLE_REL8 + + TBool videofound = EFalse; + TBool imagefound = EFalse; + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if (aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + } + else if (aAttributeArray[index] == KGlxMediaItemTypeVideo) + { + videofound = ETrue; + } + else if(aAttributeArray[index] == KGlxMediaItemTypeImage) + { + imagefound = ETrue; + } + + if (!videofound) + { + aAttributeArray.Append(KGlxMediaItemTypeVideo); + } + if (!imagefound) + { + aAttributeArray.Append(KGlxMediaItemTypeImage); + } + if (!found) + { + aAttributeArray.Append(KMPXMediaGeneralCount); + } + +#else + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if (aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + } + } + if (!found) + { + aAttributeArray.Append(KMPXMediaGeneralCount); + } +#endif + } + } + +// ---------------------------------------------------------------------------- +// HandleCpiAttributeResponseL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginCamera::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray /* aMediaIds */) + { + TRACER("CGlxCollectionPluginCamera::HandleCpiAttributeResponseL"); + + _LIT(KResourceFile, "z:glxplugincamera.rsc"); + + TInt count = aCpiAttributes.Count(); + + for (TInt index = 0; index < count ; index++) + { + const TMPXAttribute attr = aCpiAttributes[index]; + + if (attr == KGlxMediaCollectionPluginSpecificSubTitle) + { + GLX_LOG_INFO("Attribute is :Subtitle"); + + if (!aResponse->IsSupported(KMPXMediaGeneralCount)) + { + User::Leave(KErrNotSupported); + } + + else + { + TInt usageCount = aResponse->ValueTObjectL(KMPXMediaGeneralCount); + + HBufC* tempTitle = NULL; + +#ifdef GLX_SUB_TITLE_REL8 + + if (!aResponse->IsSupported(KGlxMediaItemTypeImage)) + { + User::Leave(KErrNotSupported); + } + + if (!aResponse->IsSupported(KGlxMediaItemTypeVideo)) + { + User::Leave(KErrNotSupported); + } + + TInt videoCount = aResponse->ValueTObjectL(KGlxMediaItemTypeVideo); + + TInt imageCount = aResponse->ValueTObjectL(KGlxMediaItemTypeImage); + + //No Images or Videos + if ((0 == videoCount) && (0 == imageCount )) + { + GLX_LOG_INFO("ImageCount and VideoCount is 0"); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_CAMERA_SUB_TITLE_NO_IMAGE_NO_VIDEO); + aResponse->SetTextValueL(attr, *tempTitle); + } + + // 1 Image and multi/0 Videos + else if (1 == imageCount) + { + GLX_LOG_INFO1("ImageCount is 0 and VideoCount is %d",videoCount); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_CAMERA_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); + TPtr ptr = title->Des(); + + StringLoader::Format(ptr, formatString, -1, videoCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + } + + // Multi/0 Image and 1 Video + else if (1 == videoCount) + { + GLX_LOG_INFO1("ImageCount is %d and VideoCount is 0",imageCount); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_CAMERA_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); + TPtr ptr = title->Des(); + + StringLoader::Format(ptr, formatString, -1, imageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + } + + // Multi Image and Multi Video + else + { + GLX_LOG_INFO2("ImageCount is %d,VideoCount is %d",imageCount,videoCount); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_CAMERA_SUB_TITLE_MULTI_IMAGE_MULTI_VIDEO); + TPtr formatString = tempTitle->Des(); + + HBufC* title = HBufC::NewLC(formatString.Length() + 10); + TPtr ptr = title->Des(); + + HBufC* title1 = HBufC::NewLC(formatString.Length() + 10); + TPtr ptr1 = title1->Des(); + + StringLoader::Format(ptr, formatString, 0, imageCount); + StringLoader::Format(ptr1, ptr, 1, videoCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title1); + + CleanupStack::PopAndDestroy(title1); + CleanupStack::PopAndDestroy(title); + } + CleanupStack::PopAndDestroy(tempTitle); + +#else + if(0 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_CAMERA_SUB_TITLE_NO_IMAGE_NO_VIDEO); + // Set the title in the response. + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + // Get the format string + else if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_CAMERA_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_CAMERA_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); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(tempTitle); +#endif + } + } + + else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + GLX_LOG_INFO("Attribute is :MediaPopupTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + GLX_LOG_INFO("Attribute is :NewMediaItemTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + GLX_LOG_INFO("Attribute is :DefaultMediaTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KMPXMediaGeneralTitle) + { + GLX_LOG_INFO("Attribute is :GenrealTitle"); + + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_CAMERA_GENERAL_TITLE); + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + } + aResponse->Delete(KGlxMediaItemTypeImage); + aResponse->Delete(KGlxMediaItemTypeVideo); + + } + +// ---------------------------------------------------------------------------- +// IsUpdateMessageIgnoredL +// ---------------------------------------------------------------------------- +// +TBool CGlxCollectionPluginCamera::IsUpdateMessageIgnoredL(CMPXMessage& /*aMessage*/) + { + TRACER("CGlxCollectionPluginCamera::IsUpdateMessageIgnoredL"); + + TBool ignore = EFalse; + return ignore; + } + +// ---------------------------------------------------------------------------- +// DefaultFilter +// ---------------------------------------------------------------------------- +// +TGlxFilterProperties CGlxCollectionPluginCamera::DefaultFilter(TInt aLevel) + { + TRACER("CGlxCollectionPluginCamera::DefaultFilter"); + + __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || (aLevel == KGlxCollectionRootLevel+1) + || (aLevel == KGlxCollectionRootLevel+2) ), Panic(EGlxPanicInvalidPathLevel)); + TGlxFilterProperties filterProperties; + + filterProperties.iSortOrder = EGlxFilterSortOrderModifiedDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + + filterProperties.iOrigin = EGlxFilterOriginCamera; + + return filterProperties; + } + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugincamera/src/glxcollectionplugincameraproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugincamera/src/glxcollectionplugincameraproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + +#include +#include "glxcollectionplugincamera.h" +#include "glxcollectionplugincamera.hrh" + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) + {{aUid},(TProxyNewLPtr)(aFuncPtr)} +#endif + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(KGlxCollectionPluginCameraImplementationUid, CGlxCollectionPluginCamera::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy); + return ImplementationTable; + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugindownloads/data/2000a76A.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugindownloads/data/2000a76A.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +#include +#include "glxcollectionplugindownloads.hrh" +#include +#include +#include + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: Supported plugin types. + * E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic + * + * uid + * uid: plugin type uid. + * E.g. for music plugin will be: 0x101FFCDA + * + * flags [optional] + * flags: sum of the required feature flags, not used now + * + * priority [optional] + * priority: a value of type TMPXCollectionPluginPriorities. This value determines + * the returning order when several plugins can support the same set of Uids. + * Default value of this field is EMPXCollectionPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxCollectionPluginDownloadsDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FFC36; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCollectionPluginDownloadsImplementationUid; + version_no = 1; + display_name = qtn_lgal_list_title_downloads; + default_data = ""; + opaque_data = ""EGlxCollectionPluginShowInMainListView"" + ""EGlxCollectionPluginDownloads"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded + } + }; + } + }; + } + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugindownloads/data/glxplugindownloads.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugindownloads/data/glxplugindownloads.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2008-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: Resource definitions +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME PDOW + +#include +#include + +#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="PDOW"; } + + +RESOURCE LBUF r_downloads_sub_title_no_img_no_vid { txt = qtn_lgal_list_detail_no_img_vid; } +RESOURCE LBUF r_downloads_sub_title_single { txt=qtn_lgal_list_detail_one_item; } +RESOURCE LBUF r_downloads_sub_title_multi { txt=qtn_lgal_list_detail_multi_item; } +RESOURCE LBUF r_downloads_general_title { txt=qtn_lgal_list_title_downloads; } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugindownloads/group/glxcollectionplugindownloads.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugindownloads/group/glxcollectionplugindownloads.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: Project information for Collection plugin DOwnloads +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionplugindownloads.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2000a76a +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxcollectionplugindownloads.cpp +SOURCE glxcollectionplugindownloadsproxy.cpp + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../datasource/manager/inc +SYSTEMINCLUDE ../../../thumbnailcreator/inc + + + +SOURCEPATH ../data +START RESOURCE 2000a76A.rss +TARGET glxcollectionplugindownloads.rsc +END + +SOURCEPATH ../data +START RESOURCE glxplugindownloads.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +LANGUAGE_IDS +END + +LIBRARY commonengine.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY glxdatasourcemanager.lib +LIBRARY mpxcommon.lib +LIBRARY glxcommon.lib +LIBRARY flogger.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugindownloads/inc/glxcollectionplugindownloads.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugindownloads/inc/glxcollectionplugindownloads.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + + +#ifndef C_GLXCOLLECTIONPLUGINDOWNLOADS_H +#define C_GLXCOLLECTIONPLUGINDOWNLOADS_H + +// INCLUDES +#include +#include "glxcollectionpluginbase.h" + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxCollectionPluginDownloads class + * + * Plug-in basically provides browsing. + * @ingroup collection_component_design + */ +NONSHARABLE_CLASS(CGlxCollectionPluginDownloads) : public CGlxCollectionPluginBase + { +public: // Constructors and destructor + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CGlxCollectionPluginDownloads* NewL(TAny* aObs); + + /** + * Destructor + */ + ~CGlxCollectionPluginDownloads(); + +private: + /** + * Constructor + * @param aObs MMPXCollectionPluginObserver instance + */ + CGlxCollectionPluginDownloads(MMPXCollectionPluginObserver* aObs); + /** + * 2nd stage Constructor + */ + void ConstructL(); + +private: + /** + * Checks to see if any additional attributes are required to construct required + * CPI specific attribute + * + * @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); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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); + + + TBool IsUpdateMessageIgnoredL(CMPXMessage& aMessage); + + TGlxFilterProperties DefaultFilter(TInt aLevel); + + }; + +#endif // C_GLXCOLLECTIONPLUGINDOWNLOADS_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugindownloads/src/glxcollectionplugindownloads.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugindownloads/src/glxcollectionplugindownloads.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,294 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + +// INCLUDE FILES +#include "glxcollectionplugindownloads.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcollectionplugindownloads.hrh" +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// CONSTANTS + +// ============================ LOCAL FUNCTIONS ============================== + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginDownloads* CGlxCollectionPluginDownloads::NewL(TAny* aObs) + { + CGlxCollectionPluginDownloads* self = new (ELeave) CGlxCollectionPluginDownloads( + static_cast(aObs)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginDownloads::~CGlxCollectionPluginDownloads() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginDownloads::CGlxCollectionPluginDownloads( + MMPXCollectionPluginObserver* aObs) + { + iObs = aObs; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginDownloads::ConstructL() + { + iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); + } +// ---------------------------------------------------------------------------- +// CpiAttributeAdditionalAttributes +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginDownloads::CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray) + { + TRACER("CGlxCollectionPluginDownloads::CpiAttributeAdditionalAttributes"); + // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all the others are reading straight from resource files + // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count + if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) + { + // need to add the usage count. but check first if it is already present + TInt attrCount = aAttributeArray.Count(); + TBool found = EFalse; + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if (aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + break; + } + } + + if (!found) + { + aAttributeArray.Append(KMPXMediaGeneralCount); + } + } + } + +// ---------------------------------------------------------------------------- +// HandleCpiAttributeResponseL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginDownloads::HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray /* aMediaIds */) + { + TRACER("CGlxCollectionPluginDownloads::HandleCpiAttributeResponseL"); + + _LIT(KResourceFile, "z:glxplugindownloads.rsc"); + + TInt count = aCpiAttributes.Count(); + + for (TInt index = 0; index < count ; index++) + { + const TMPXAttribute attr = aCpiAttributes[index]; + + if (attr == KGlxMediaCollectionPluginSpecificSubTitle) + { + GLX_LOG_INFO("Attribute : Sub Title"); + + if (!aResponse->IsSupported(KMPXMediaGeneralCount)) + { + User::Leave(KErrNotSupported); + } + else + { + TInt usageCount = aResponse->ValueTObjectL(KMPXMediaGeneralCount); + + // Get the format string + HBufC* tempTitle = NULL; + +#ifdef GLX_SUB_TITLE_REL8 + + if(0 == usageCount) + { + GLX_LOG_INFO("Count is 0 items"); + + tempTitle = LoadLocalizedStringLC(KResourceFile,R_DOWNLOADS_SUB_TITLE_NO_IMG_NO_VID); + aResponse->SetTextValueL(attr, *tempTitle); + } + + else if (1 == usageCount) + { + GLX_LOG_INFO("Count is 1 item"); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + } + else + { + GLX_LOG_INFO1("Count is %d items",usageCount); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_MULTI); + //Format the string + 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); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + CleanupStack::PopAndDestroy(tempTitle); +#else + if(0 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_NO_IMG_NO_VID); + // Set the title in the response. + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + // Get the format string + else if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_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); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(tempTitle); +#endif + } + } + else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + GLX_LOG_INFO("Attribute : MediaPopupTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + GLX_LOG_INFO("Attribute : NewMediaItemTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + GLX_LOG_INFO("Attribute : DefaultMediaTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KMPXMediaGeneralTitle) + { + GLX_LOG_INFO("Attribute : GeneralTitle"); + + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_DOWNLOADS_GENERAL_TITLE); + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + } + + } + + +// ---------------------------------------------------------------------------- +// IsUpdateMessageIgnoredL +// ---------------------------------------------------------------------------- +// +TBool CGlxCollectionPluginDownloads::IsUpdateMessageIgnoredL(CMPXMessage& /*aMessage*/) + { + TRACER("CGlxCollectionPluginDownloads::IsUpdateMessageIgnoredL"); + /// @todo origin could be passed up to allow downloads to ignore irrelevant adds, wait until inheritance is resolved + TBool ignore = EFalse; + return ignore; + } + + +// ---------------------------------------------------------------------------- +// DefaultFilter +// ---------------------------------------------------------------------------- +// +TGlxFilterProperties CGlxCollectionPluginDownloads::DefaultFilter(TInt aLevel) + { + TRACER("CGlxCollectionPluginDownloads::DefaultFilter"); + + __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || (aLevel == KGlxCollectionRootLevel+1) + || (aLevel == KGlxCollectionRootLevel+2) ), Panic(EGlxPanicInvalidPathLevel)); + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; +#ifdef RD_MDS_2_5 + filterProperties.iOrigin = EGlxFilterOriginDownload; +#endif + + return filterProperties; + } + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionplugindownloads/src/glxcollectionplugindownloadsproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionplugindownloads/src/glxcollectionplugindownloadsproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + +#include +#include "glxcollectionplugindownloads.h" +#include "glxcollectionplugindownloads.hrh" + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) + {{aUid},(TProxyNewLPtr)(aFuncPtr)} +#endif + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(KGlxCollectionPluginDownloadsImplementationUid, CGlxCollectionPluginDownloads::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy); + return ImplementationTable; + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/data/200104E5.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/data/200104E5.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +#include +#include "glxcollectionpluginimageviewer.hrh" +#include +#include +#include //Uid of the plugine for priority in opaque-data + + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: Supported plugin types. + * E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic + * + * uid + * uid: plugin type uid. + * E.g. for music plugin will be: 0x101FFCDA + * + * flags [optional] + * flags: sum of the required feature flags, not used now + * + * priority [optional] + * priority: a value of type TMPXCollectionPluginPriorities. This value determines + * the returning order when several plugins can support the same set of Uids. + * Default value of this field is EMPXCollectionPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxCollectionPluginImageViewerDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FFC36; // = KMPXCollectionInterfaceUid defined in mpxcollectionplugin.h + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCollectionPluginImageViewerImplementationUid; + version_no = 1; + display_name = qtn_lgal_list_title_captured; + default_data = ""; + opaque_data = ""EGlxCollectionPluginImageViewer"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded + } + }; + } + }; + } + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/data/glxpluginimageviewer.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/data/glxpluginimageviewer.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Cloud View +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME PALB + +#include +#include + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + + +// RESOURCE DEFINITIONS + +RESOURCE BA_RSS_SIGNATURE { } + +RESOURCE TBUF { buf="PALB"; } + +RESOURCE LBUF r_album_sub_title_single { txt=qtn_lgal_list_detail_one_alb; } +RESOURCE LBUF r_album_sub_title_multi { txt=qtn_lgal_list_detail_multi_alb; } +RESOURCE LBUF r_album_item_sub_title_single { txt=qtn_lgal_list_detail_one_item; } +RESOURCE LBUF r_album_item_sub_title_multi { txt=qtn_lgal_list_detail_multi_item; } +RESOURCE LBUF r_album_item_sub_title_empty { txt=qtn_lgal_list_detail_no_img_vid; } +RESOURCE LBUF r_album_popup_title { txt=qtn_lgal_title_select_albums; } +RESOURCE LBUF r_album_item_title { txt=qtn_lgal_album_create; } +RESOURCE LBUF r_album_default_title { txt=qtn_lgal_name_album; } +RESOURCE LBUF r_album_general_title { txt=qtn_lgal_list_title_albums; } +RESOURCE LBUF r_album_favorites_title { txt=qtn_lgal_list_title_favourites; } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + + +PRJ_MMPFILES +glxcollectionpluginimageviewer.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/group/glxcollectionpluginimageviewer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/group/glxcollectionpluginimageviewer.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008-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: Project information for album collection plugin +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionpluginimageviewer.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200104E5 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxcollectionpluginimageviewer.cpp +SOURCE glxcollectionpluginimageviewerproxy.cpp + +SOURCEPATH ../data +START RESOURCE 200104E5.rss +TARGET glxcollectionpluginimageviewer.rsc +END + +SOURCEPATH ../data +START RESOURCE glxpluginimageviewer.rss +HEADER + +TARGETPATH ECOM_RESOURCE_DIR +LANGUAGE_IDS +END + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../datasource/manager/inc + + +LIBRARY commonengine.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY glxcommon.lib +LIBRARY glxdatasourcemanager.lib +LIBRARY mpxcommon.lib +LIBRARY flogger.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/inc/glxcollectionpluginimageviewer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/inc/glxcollectionpluginimageviewer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + + +#ifndef C_GLXCOLLECTIONPLUGINIMAGEVIEWER_H +#define C_GLXCOLLECTIONPLUGINIMAGEVIEWER_H + +// INCLUDES +#include +#include "glxcollectionpluginbase.h" + + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** + * CGlxCollectionPluginImageViewer class + * + * Plug-in basically provides image viewing experience. + * @ingroup collection_component_design + */ +NONSHARABLE_CLASS(CGlxCollectionPluginImageViewer) : public CGlxCollectionPluginBase + { +public: // Constructors and destructor + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CGlxCollectionPluginImageViewer* NewL(TAny* aObs); + + /** + * Destructor + */ + ~CGlxCollectionPluginImageViewer(); + +private: + /** + * Checks to see if any additional attributes are required to construct required + * CPI specific attribute + * + * @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); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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 + * @param aMediaIds list of CPI specific media Ids + */ + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TArray aMediaIds); + + TBool IsUpdateMessageIgnored(CMPXMessage& aMessage); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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 + * @param aMediaId CPI specific media Id + */ + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, TGlxMediaId aMediaId); + + TGlxFilterProperties DefaultFilter(TInt aLevel); + +private: + /** + * Constructor + * @param aObs MMPXCollectionPluginObserver instance + */ + CGlxCollectionPluginImageViewer(MMPXCollectionPluginObserver* aObs); + void ConstructL(); + }; + + + +#endif // C_GLXCOLLECTIONPLUGINIMAGEVIEWER_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/src/glxcollectionpluginimageviewer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/src/glxcollectionpluginimageviewer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcollectionpluginimageviewer.h" +#include "glxcollectionpluginimageviewer.hrh" +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// ============================ LOCAL FUNCTIONS ============================== + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginImageViewer* CGlxCollectionPluginImageViewer::NewL(TAny* aObs) + { + CGlxCollectionPluginImageViewer* self = + new (ELeave) CGlxCollectionPluginImageViewer( + static_cast(aObs)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginImageViewer::~CGlxCollectionPluginImageViewer() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginImageViewer::CGlxCollectionPluginImageViewer( + MMPXCollectionPluginObserver* aObs) + { + iObs = aObs; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginImageViewer::ConstructL() + { + iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); + } + +void CGlxCollectionPluginImageViewer::CpiAttributeAdditionalAttributes( + const TMPXAttribute& aCpiAttribute, + RArray& aAttributeArray) + { + // Nothing to be shared apart from the ones that are commonly loaded. + } + +void CGlxCollectionPluginImageViewer::HandleCpiAttributeResponseL( + CMPXMedia* aResponse, TArray aCpiAttributes, + TArray aMediaIds) + { + TRACER("CGlxCollectionPluginImageViewer::HandleCpiAttributeResponseL"); + const TInt mediaIdCount = aMediaIds.Count(); + + switch (mediaIdCount) + { + case 0: + User::Leave(KErrNotSupported); + break; + case 1: + HandleCpiAttributeResponseL(aResponse, aCpiAttributes, aMediaIds[0]); + break; + default: + { + // We have an array of CMPXMedia items + + if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0]) + { + User::Leave(KErrNotSupported); + } + + CMPXMediaArray* mediaArray = aResponse->ValueCObjectL(KMPXMediaArrayContents); + CleanupStack::PushL(mediaArray); + + const TInt arrayCount = mediaArray->Count(); + + // Sanity check + if (arrayCount != mediaIdCount) + { + User::Leave(KErrArgument); + } + + for (TInt index = 0; index < arrayCount; index++) + { + HandleCpiAttributeResponseL((*mediaArray)[index], aCpiAttributes, aMediaIds[index]); + } + + aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray); + CleanupStack::PopAndDestroy(mediaArray); + } + break; + } + } + +void CGlxCollectionPluginImageViewer::HandleCpiAttributeResponseL( + CMPXMedia* aResponse, TArray aCpiAttributes, + TGlxMediaId aMediaId) + { + const TInt attribCount = aCpiAttributes.Count(); + + for (TInt index = 0; index < attribCount ; index++) + { + const TMPXAttribute attr = aCpiAttributes[index]; + + if (attr == KGlxMediaCollectionPluginSpecificSubTitle) + { + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + User::Leave(KErrNotSupported); + } + else if (attr == KMPXMediaGeneralTitle) + { + User::Leave(KErrNotSupported); + } + } + } + +TBool CGlxCollectionPluginImageViewer::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/) + { + TBool ignore = EFalse; + return ignore; + } + +TGlxFilterProperties CGlxCollectionPluginImageViewer::DefaultFilter(TInt /*aLevel*/) + { + TGlxFilterProperties filterProperties; + + filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + filterProperties.iMinCount = 1; + filterProperties.iItemType = EGlxFilterImage; + + return filterProperties; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/src/glxcollectionpluginimageviewerproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginimageviewer/src/glxcollectionpluginimageviewerproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Standard proxy of the ECOM plugin +* +*/ + + + + +#include +#include "glxcollectionpluginimageviewer.h" +#include + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) + {{aUid},(TProxyNewLPtr)(aFuncPtr)} +#endif + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(KGlxCollectionPluginImageViewerImplementationUid, CGlxCollectionPluginImageViewer::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy); + return ImplementationTable; + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginmonths/data/2000a768.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginmonths/data/2000a768.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +#include +#include "glxcollectionpluginmonths.hrh" +#include +#include +#include + + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: Supported plugin types. + * E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic + * + * uid + * uid: plugin type uid. + * E.g. for music plugin will be: 0x101FFCDA + * + * flags [optional] + * flags: sum of the required feature flags, not used now + * + * priority [optional] + * priority: a value of type TMPXCollectionPluginPriorities. This value determines + * the returning order when several plugins can support the same set of Uids. + * Default value of this field is EMPXCollectionPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxCollectionPluginMonthsDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FFC36; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCollectionPluginMonthsImplementationUid; + version_no = 1; + display_name = qtn_lgal_list_title_months; + default_data = ""; + opaque_data = ""EGlxCollectionPluginShowInMainListView"" + ""EGlxCollectionPluginMonths"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded + } + }; + } + }; + } + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginmonths/data/glxpluginmonths.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginmonths/data/glxpluginmonths.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2009-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: Resource definitions for Cloud View +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME PMON + +#include +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE BA_RSS_SIGNATURE { } + +RESOURCE TBUF { buf="PMON"; } + +RESOURCE LBUF r_months_general_title { txt=qtn_lgal_list_title_months; } +RESOURCE LBUF r_months_sub_title_single { txt=qtn_lgal_list_detail_one_item; } +RESOURCE LBUF r_months_sub_title_multi { txt=qtn_lgal_list_detail_multi_item; } +RESOURCE LBUF r_months_sub_title_no_image_no_video { txt=qtn_lgal_list_detail_no_img_vid; } +RESOURCE LBUF r_months_item_title { txt=qtn_lgal_title_month_year; } +RESOURCE LBUF r_months_sub_title { txt=qtn_lgal_list_title_month_year; } +RESOURCE LBUF r_months_title_jan { txt=qtn_month_three_chars_jan; } +RESOURCE LBUF r_months_title_feb { txt=qtn_month_three_chars_feb; } +RESOURCE LBUF r_months_title_mar { txt=qtn_month_three_chars_mar; } +RESOURCE LBUF r_months_title_apr { txt=qtn_month_three_chars_apr; } +RESOURCE LBUF r_months_title_may { txt=qtn_month_three_chars_may; } +RESOURCE LBUF r_months_title_jun { txt=qtn_month_three_chars_jun; } +RESOURCE LBUF r_months_title_jul { txt=qtn_month_three_chars_jul; } +RESOURCE LBUF r_months_title_aug { txt=qtn_month_three_chars_aug; } +RESOURCE LBUF r_months_title_sep { txt=qtn_month_three_chars_sep; } +RESOURCE LBUF r_months_title_oct { txt=qtn_month_three_chars_oct; } +RESOURCE LBUF r_months_title_nov { txt=qtn_month_three_chars_nov; } +RESOURCE LBUF r_months_title_dec { txt=qtn_month_three_chars_dec; } +RESOURCE LBUF r_months_sub_title_jan { txt=qtn_month_three_chars_jan; } +RESOURCE LBUF r_months_sub_title_feb { txt=qtn_month_three_chars_feb; } +RESOURCE LBUF r_months_sub_title_mar { txt=qtn_month_three_chars_mar; } +RESOURCE LBUF r_months_sub_title_apr { txt=qtn_month_three_chars_apr; } +RESOURCE LBUF r_months_sub_title_may { txt=qtn_month_three_chars_may; } +RESOURCE LBUF r_months_sub_title_jun { txt=qtn_month_three_chars_jun; } +RESOURCE LBUF r_months_sub_title_jul { txt=qtn_month_three_chars_jul; } +RESOURCE LBUF r_months_sub_title_aug { txt=qtn_month_three_chars_aug; } +RESOURCE LBUF r_months_sub_title_sep { txt=qtn_month_three_chars_sep; } +RESOURCE LBUF r_months_sub_title_oct { txt=qtn_month_three_chars_oct; } +RESOURCE LBUF r_months_sub_title_nov { txt=qtn_month_three_chars_nov; } +RESOURCE LBUF r_months_sub_title_dec { txt=qtn_month_three_chars_dec; } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginmonths/group/glxcollectionpluginmonths.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginmonths/group/glxcollectionpluginmonths.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008-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: Build information of Collection framework collection plugin months +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionpluginmonths.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2000a768 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxcollectionpluginmonths.cpp +SOURCE glxcollectionpluginmonthsproxy.cpp + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../datasource/manager/inc +SYSTEMINCLUDE ../../../thumbnailcreator/inc + + +SOURCEPATH ../data +START RESOURCE 2000a768.rss +TARGET glxcollectionpluginmonths.rsc +END + +SOURCEPATH ../data +START RESOURCE glxpluginmonths.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +LANGUAGE_IDS +END + + +LIBRARY commonengine.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY glxdatasourcemanager.lib +LIBRARY mpxcommon.lib +LIBRARY glxcommon.lib +LIBRARY flogger.lib +LIBRARY avkon.lib + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginmonths/inc/glxcollectionpluginmonths.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginmonths/inc/glxcollectionpluginmonths.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + + +#ifndef C_GLXCOLLECTIONPLUGINMONTHS_H +#define C_GLXCOLLECTIONPLUGINMONTHS_H + +// INCLUDES +#include +#include "glxcollectionpluginbase.h" + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// FORWARD DECLARATIONS + +// CONSTANTS +const TInt KGlxCollectionMonthsLevel = KGlxCollectionRootLevel + 1; +const TInt KGlxCollectionMonthContentsLevel = KGlxCollectionRootLevel + 2; +const TInt KGlxCollectionMonthFSLevel = KGlxCollectionRootLevel + 3; +// CLASS DECLARATION + +/** + * CGlxCollectionPluginMonths class + * + * Plug-in basically provides browsing. + * @ingroup collection_component_design + */ +NONSHARABLE_CLASS(CGlxCollectionPluginMonths) : public CGlxCollectionPluginBase + { +public: // Constructors and destructor + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CGlxCollectionPluginMonths* NewL(TAny* aObs); + + /** + * Destructor + */ + ~CGlxCollectionPluginMonths(); + +private: + /** + * Constructor + * @param aObs MMPXCollectionPluginObserver instance + */ + CGlxCollectionPluginMonths(MMPXCollectionPluginObserver* aObs); + /** + * 2nd stage Constructor + */ + void ConstructL(); + +private: + /** + * Checks to see if any additional attributes are required to construct required + * CPI specific attribute + * + * @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); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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); + + /** + * Modifies the response to include all requested CPI specific attributes or Leaves. + * + * @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 + * @param aMediaId CPI specific media Id + */ + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TGlxMediaId aMediaId); + + TBool IsUpdateMessageIgnored(CMPXMessage& aMessage); + + TGlxFilterProperties DefaultFilter(TInt aLevel); + }; + +#endif // C_GLXCOLLECTIONPLUGINMONTHS_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonths.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonths.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,856 @@ +/* +* Copyright (c) 2008-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: This class browses file system +* +*/ + + + + +// INCLUDE FILES + +#include "glxcollectionpluginmonths.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcollectionpluginmonths.hrh" +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ +// CONSTANTS + +// Constants introduced to solve Codescanner warnings +// about magic number usage +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 ============================== + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginMonths* CGlxCollectionPluginMonths::NewL(TAny* aObs) + { + CGlxCollectionPluginMonths* self = new (ELeave) CGlxCollectionPluginMonths( + static_cast(aObs)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginMonths::~CGlxCollectionPluginMonths() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxCollectionPluginMonths::CGlxCollectionPluginMonths( + MMPXCollectionPluginObserver* aObs) + { + iObs = aObs; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginMonths::ConstructL() + { + iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); + } + + +// ---------------------------------------------------------------------------- +// CpiAttributeAdditionalAttributes +// ---------------------------------------------------------------------------- +// +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 + // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count + if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) + { + // need to add the usage count. but check first if it is already present + TInt attrCount = aAttributeArray.Count(); + TBool found = EFalse; + TBool startfound = EFalse; + +#ifdef GLX_SUB_TITLE_REL8 + + TBool videofound = EFalse; + TBool imagefound = EFalse; + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if (aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + } + else if ( aAttributeArray[index] == KGlxMediaCollectionInternalStartDate ) + { + startfound = ETrue; + } + + else if (aAttributeArray[index] == KGlxMediaItemTypeVideo) + { + videofound = ETrue; + } + else if(aAttributeArray[index] == KGlxMediaItemTypeImage) + { + imagefound = ETrue; + } + } + + if (!found) + { + aAttributeArray.Append(KGlxMediaCollectionInternalUsageCount); + } + + if (!startfound) + { + aAttributeArray.Append(KGlxMediaCollectionInternalStartDate); + } + // end date will be returned when start date is requested. + + if (!videofound) + { + aAttributeArray.Append(KGlxMediaItemTypeVideo); + } + + if (!imagefound) + { + aAttributeArray.Append(KGlxMediaItemTypeImage); + } +#else + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if (aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + } + else if ( aAttributeArray[index] == KGlxMediaCollectionInternalStartDate ) + { + startfound = ETrue; + } + } + + if (!found) + { + aAttributeArray.Append(KGlxMediaCollectionInternalUsageCount); + } + if (!startfound) + { + aAttributeArray.Append(KGlxMediaCollectionInternalStartDate); + } +#endif + // end date will be returned when start date is requested. + } + } + +// ---------------------------------------------------------------------------- +// HandleCpiAttributeResponseL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TArray aMediaIds) + { + TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL"); + + const TInt mediaIdCount = aMediaIds.Count(); + + switch (mediaIdCount) + { + case 0: + User::Leave(KErrNotSupported); + break; + + case 1: + HandleCpiAttributeResponseL(aResponse, aCpiAttributes, aMediaIds[0]); + break; + + + default: + { + // We have an array of CMPXMedia items + + if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0]) + { + User::Leave(KErrNotSupported); + } + + CMPXMediaArray* mediaArray = + aResponse->ValueCObjectL(KMPXMediaArrayContents); + CleanupStack::PushL(mediaArray); + + const TInt arrayCount = mediaArray->Count(); + + // Sanity check + if (arrayCount != mediaIdCount) + { + User::Leave(KErrArgument); + } + + for (TInt index = 0; index < arrayCount; index++) + { + HandleCpiAttributeResponseL((*mediaArray)[index], + aCpiAttributes, aMediaIds[index]); + } + + aResponse->SetCObjectValueL(KMPXMediaArrayContents, mediaArray); + CleanupStack::PopAndDestroy(mediaArray); + } + break; + } + } + + +// ---------------------------------------------------------------------------- +// HandleCpiAttributeResponseL +// ---------------------------------------------------------------------------- +// +void CGlxCollectionPluginMonths::HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TGlxMediaId aMediaId) + { + TRACER("CGlxCollectionPluginMonths::HandleCpiAttributeResponseL"); + + _LIT(KResourceFile, "z:glxpluginmonths.rsc"); + + TInt count = aCpiAttributes.Count(); + TLanguage lang; + lang = User::Language(); + + for (TInt index = 0; index < count ; index++) + { + const TMPXAttribute attr = aCpiAttributes[index]; + + if (attr == KGlxMediaCollectionPluginSpecificSubTitle) + { + GLX_LOG_INFO("Attribute : SubTitle"); + + if (TGlxMediaId(KGlxCollectionRootId) == aMediaId) + { + GLX_LOG_INFO("Attribute : SubTitle-RootId"); + +#ifdef GLX_SUB_TITLE_REL8 + + //The usage Count is required for the subtitle in the main list view + if (!aResponse->IsSupported(KGlxMediaCollectionInternalUsageCount)) + { + User::Leave(KErrNotSupported); + } + else + { + TInt usageCount = aResponse->ValueTObjectL(KGlxMediaCollectionInternalUsageCount); + + // Get the format string + HBufC* tempTitle = NULL; + + if(0 == usageCount) + { + GLX_LOG_INFO("SubTitle:0 Items"); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO); + aResponse->SetTextValueL(attr, *tempTitle); + } + + // Get the format string + else if (1 == usageCount) + { + GLX_LOG_INFO("SubTitle:1 Item"); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_SINGLE_BY_MONTH); + aResponse->SetTextValueL(attr, *tempTitle); + } + else + { + GLX_LOG_INFO1("SubTitle: %d Items",usageCount); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MULTI_BY_MONTH); + 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() + KDateBufferPaddingMin); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + CleanupStack::PopAndDestroy(tempTitle); + } +#else + if (!aResponse->IsSupported(KGlxMediaCollectionInternalStartDate)) + { + User::Leave(KErrNotSupported); + } + if (!aResponse->IsSupported(KGlxMediaCollectionInternalEndDate)) + { + User::Leave(KErrNotSupported); + } + TTime start = aResponse->ValueTObjectL(KGlxMediaCollectionInternalStartDate); + TTime end = aResponse->ValueTObjectL(KGlxMediaCollectionInternalEndDate); + HBufC* tempTitle = NULL; + if( TTime(0) == start ) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + _LIT(KGlxTempMonthYearTitleFormat, "%F%Y"); + + tempTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE); + TPtr formatString = tempTitle->Des(); + TBuf yearTitle; + start.FormatL(yearTitle, KGlxTempMonthYearTitleFormat); + + // Ensure that the number conversion takes place only for Arabic + if (lang == ELangArabic) + { + AknTextUtils::DisplayTextLanguageSpecificNumberConversion(yearTitle); + } + + HBufC* monthTitle = NULL; + switch(start.DateTime().Month()) + { + case EJanuary: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_JAN); + break; + } + case EFebruary: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_FEB); + break; + } + case EMarch: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MAR); + break; + } + case EApril: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_APR); + break; + } + case EMay: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MAY); + break; + } + case EJune: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_JUN); + break; + } + case EJuly: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_JUL); + break; + } + case EAugust: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_AUG); + break; + } + case ESeptember: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_SEP); + break; + } + case EOctober: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_OCT); + break; + } + case ENovember: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NOV); + break; + } + case EDecember: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_DEC); + break; + } + } + TBuf yearTitle2; + end.FormatL(yearTitle2, KGlxTempMonthYearTitleFormat); + + // Ensure that the number conversion takes place only for Arabic + if (lang == ELangArabic) + { + AknTextUtils::DisplayTextLanguageSpecificNumberConversion(yearTitle2); + } + + HBufC* monthTitle2 = NULL; + switch(end.DateTime().Month()) + { + case EJanuary: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_JAN); + break; + } + case EFebruary: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_FEB); + break; + } + case EMarch: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MAR); + break; + } + case EApril: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_APR); + break; + } + case EMay: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_MAY); + break; + } + case EJune: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_JUN); + break; + } + case EJuly: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_JUL); + break; + } + case EAugust: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_AUG); + break; + } + case ESeptember: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_SEP); + break; + } + case EOctober: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_OCT); + break; + } + case ENovember: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_NOV); + break; + } + case EDecember: + { + monthTitle2 = LoadLocalizedStringLC(KResourceFile, R_MONTHS_SUB_TITLE_DEC); + break; + } + } + + HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); + TPtr ptr1 = title1->Des(); + HBufC* title2 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); + TPtr ptr2 = title2->Des(); + HBufC* title3 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); + TPtr ptr3 = title3->Des(); + 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, KDateFormat1, yearTitle); + StringLoader::Format(ptr3, ptr2, KDateFormat2, monthPtr2); + StringLoader::Format(ptr4, ptr3, KDateFormat3, yearTitle2); + + + aResponse->SetTextValueL(attr, *title4); + CleanupStack::PopAndDestroy(title4); + CleanupStack::PopAndDestroy(title3); + CleanupStack::PopAndDestroy(title2); + CleanupStack::PopAndDestroy(title1); + CleanupStack::PopAndDestroy(monthTitle2); + CleanupStack::PopAndDestroy(monthTitle); + CleanupStack::PopAndDestroy(tempTitle); +#endif + } + else + { + +#ifdef GLX_SUB_TITLE_REL8 + + HBufC* tempTitle = NULL; + + TInt videoCount = aResponse->ValueTObjectL(KGlxMediaItemTypeVideo); + + TInt imageCount = aResponse->ValueTObjectL(KGlxMediaItemTypeImage); + + //No Images or Videos + if ((0 == videoCount) && (0 == imageCount )) + { + GLX_LOG_INFO("VideoCount:0,ImageCount:0"); + + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_NO_IMAGE_NO_VIDEO); + aResponse->SetTextValueL(attr, *tempTitle); + } + else + { + // 1 Image and multi/0 Videos + if (1 == imageCount) + { + GLX_LOG_INFO1("ImageCount:1,VideoCount:%d",videoCount); + + 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() + KDateBufferPaddingMin); + TPtr ptr = title->Des(); + + StringLoader::Format(ptr, formatString, -1, videoCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + } + + // Multi/0 Image and 1 Video + else if (1 == videoCount) + { + GLX_LOG_INFO1("ImageCount: %d,VideoCount:1",imageCount); + + 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() + KDateBufferPaddingMin); + TPtr ptr = title->Des(); + + StringLoader::Format(ptr, formatString, -1, imageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + } + + // Multi Image and Multi Video + else + { + GLX_LOG_INFO2("ImageCount %d,VideoCount %d",imageCount,videoCount); + + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_MULTI_IMAGE_MULTI_VIDEO); + + TPtr formatString = tempTitle->Des(); + + HBufC* title = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); + TPtr ptr = title->Des(); + + HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMin); + TPtr ptr1 = title1->Des(); + + StringLoader::Format(ptr, formatString, 0, imageCount); + StringLoader::Format(ptr1, ptr, KDateFormat1, videoCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title1); + + CleanupStack::PopAndDestroy(title1); + CleanupStack::PopAndDestroy(title); + } + } + CleanupStack::PopAndDestroy(tempTitle); +#else + + TInt usageCount = 0; + + if ( aResponse->IsSupported(KMPXMediaGeneralCount) ) + { + usageCount = aResponse->ValueTObjectL(KMPXMediaGeneralCount); + } + else if ( aResponse->IsSupported(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); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + + else if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_SUB_TITLE_SINGLE); + + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + 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() + KDateBufferPaddingMin); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(tempTitle); +#endif + } + } + else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + GLX_LOG_INFO("Attribute : MediaPopupTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + GLX_LOG_INFO("Attribute : NewMediaItemTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + GLX_LOG_INFO("Attribute : DefaultMediaTitle"); + + User::Leave(KErrNotSupported); + } + else if (attr == KMPXMediaGeneralTitle) + { + GLX_LOG_INFO("Attribute : GeneralTitle"); + + if( TGlxMediaId(KGlxCollectionRootId) == aMediaId ) + { + GLX_LOG_INFO("Attribute : GeneralTitle:RootId"); + + HBufC* title = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_GENERAL_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + else + { + if( aResponse->IsSupported(KGlxMediaCollectionInternalStartDate) ) + { + HBufC* tempTitle = LoadLocalizedStringLC(KResourceFile, + R_MONTHS_ITEM_TITLE); + TPtr formatString = tempTitle->Des(); + TTime month = + aResponse->ValueTObjectL(KGlxMediaCollectionInternalStartDate); + _LIT(KGlxTempMonthYearTitleFormat, "%F%Y"); + TBuf yearTitle; + month.FormatL(yearTitle, KGlxTempMonthYearTitleFormat); + + // Ensure that the number conversion takes place only for Arabic + if (lang == ELangArabic) + { + AknTextUtils::DisplayTextLanguageSpecificNumberConversion(yearTitle); + } + + HBufC* monthTitle = NULL; + switch(month.DateTime().Month()) + { + case EJanuary: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_JAN); + break; + } + case EFebruary: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_FEB); + break; + } + case EMarch: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_MAR); + break; + } + case EApril: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_APR); + break; + } + case EMay: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_MAY); + break; + } + case EJune: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_JUN); + break; + } + case EJuly: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_JUL); + break; + } + case EAugust: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_AUG); + break; + } + case ESeptember: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_SEP); + break; + } + case EOctober: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_OCT); + break; + } + case ENovember: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_NOV); + break; + } + case EDecember: + { + monthTitle = LoadLocalizedStringLC(KResourceFile, R_MONTHS_TITLE_DEC); + break; + } + } + + HBufC* title1 = HBufC::NewLC(formatString.Length() + KDateBufferPaddingMax); + TPtr ptr = title1->Des(); + 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, KDateFormat1, yearTitle); + + + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(title1); + CleanupStack::PopAndDestroy(monthTitle); + CleanupStack::PopAndDestroy(tempTitle); + } + } + } + } + aResponse->Delete(KGlxMediaCollectionInternalUsageCount); + aResponse->Delete(KGlxMediaCollectionInternalStartDate); + aResponse->Delete(KGlxMediaCollectionInternalEndDate); + aResponse->Delete(KGlxMediaItemTypeImage); + aResponse->Delete(KGlxMediaItemTypeVideo); + } + +// ---------------------------------------------------------------------------- +// IsUpdateMessageIgnored +// ---------------------------------------------------------------------------- +// + +TBool CGlxCollectionPluginMonths::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/) + { + TBool ignore = EFalse; + return ignore; + } + +// ---------------------------------------------------------------------------- +// DefaultFilter +// ---------------------------------------------------------------------------- +// +TGlxFilterProperties CGlxCollectionPluginMonths::DefaultFilter(TInt aLevel) + { + __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || + (aLevel == KGlxCollectionMonthsLevel) || (aLevel == KGlxCollectionMonthContentsLevel) + || (aLevel == KGlxCollectionMonthFSLevel)), Panic(EGlxPanicInvalidPathLevel)); + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + filterProperties.iOrigin = EGlxFilterOriginAll; + switch(aLevel) + { + case KGlxCollectionRootLevel: + case KGlxCollectionMonthsLevel: + case KGlxCollectionMonthFSLevel: + { + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + filterProperties.iItemType = EGlxFilterMonth; + break; + } + } + return filterProperties; + } + + + // End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonthsproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/glxcollectionpluginmonths/src/glxcollectionpluginmonthsproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + +#include +#include "glxcollectionpluginmonths.h" +#include "glxcollectionpluginmonths.hrh" + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) + {{aUid},(TProxyNewLPtr)(aFuncPtr)} +#endif + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY(KGlxCollectionPluginMonthsImplementationUid, + CGlxCollectionPluginMonths::NewL) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount) + { + aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy); + return ImplementationTable; + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2008-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: Build information file for all collection plugins. +* +*/ + + + + +// Plugin build files +#include "../tagcollectionplugin/group/bld.inf" diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/bwins/ut_cglxcollectionplugintagsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/bwins/ut_cglxcollectionplugintagsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/data/200071BC.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/data/200071BC.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2000 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: Resource definitions * +*/ + + + + +// INCLUDES + +#include //Ecom Registry + +#include "glxcollectionplugintags.hrh" //Uid of the Dll and the Implementaion +#include //Uid of the Gallery for opaque-data +#include //Uid of the plugine for priority in opaque-data +#include //LOC file for the strings + +//#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxTagCollectionPluginDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101FFC36; //KMPXCollectionInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxTagCollectionPluginImplementationUid; + version_no = 1; + display_name = qtn_lgal_list_title_tags; + default_data = ""; + opaque_data = ""EGlxCollectionPluginShowInMainListView"" + ""EGlxCollectionPluginTags"" + "0x0001"; // KMPXVpFeaturePreLoaded (yet to be defined) Keeps the plugin loaded + } + }; + } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/data/glxplugintags.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/data/glxplugintags.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Cloud View +* +*/ + + + + +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + + +// RESOURCE IDENTIFIER +NAME PTAG + +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE BA_RSS_SIGNATURE { } + +RESOURCE TBUF { buf="PTAG"; } + +RESOURCE LBUF r_tag_sub_title_single { txt=qtn_lgal_list_detail_one_tag; } +RESOURCE LBUF r_tag_sub_title_multi { txt=qtn_lgal_list_detail_multi_tag; } +RESOURCE LBUF r_tag_item_sub_title_single { txt=qtn_lgal_list_detail_one_item; } +RESOURCE LBUF r_tag_item_sub_title_multi { txt=qtn_lgal_list_detail_multi_item; } +RESOURCE LBUF r_tag_item_sub_title_no_image_no_video { txt=qtn_lgal_list_detail_no_img_vid; } +RESOURCE LBUF r_tag_popup_title { txt=qtn_lgal_title_select_tags; } +RESOURCE LBUF r_tag_item_title { txt=qtn_lgal_tag_create; } +RESOURCE LBUF r_tag_default_title { txt=qtn_lgal_name_tag; } +RESOURCE LBUF r_tag_general_title { txt=qtn_lgal_list_title_tags; } +RESOURCE LBUF r_tag_sub_title_no_items { txt=qtn_lgal_list_detail_no_tagged_items; } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/eabi/ut_cglxcollectionplugintagsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/eabi/ut_cglxcollectionplugintagsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008-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: Build information file for tagcollectionplugin. +* +*/ + + + + +#include + +PRJ_EXPORTS +../rom/tagcollectionplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tagcollectionplugin.iby) + + + +PRJ_MMPFILES +glxcollectionplugintags.mmp + +PRJ_TESTMMPFILES +// ../tsrc/ut_cglxcollectionplugintags.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/group/glxcollectionplugintags.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/group/glxcollectionplugintags.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-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: Build information for collection plugin tags +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionplugintags.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200071BC + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxcollectionplugintags.cpp +SOURCE glxcollectionplugintagsproxy.cpp + +//RESOURCE - Ecom Plugin + +SOURCEPATH ../data +START RESOURCE 200071BC.rss +TARGET glxcollectionplugintags.rsc +END + +SOURCEPATH ../data +START RESOURCE glxplugintags.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +LANGUAGE_IDS +END + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../inc //Gallery includes +SYSTEMINCLUDE ../../../../gallery/loc //Gallery Loc +SYSTEMINCLUDE ../../../datasource/manager/inc //DataSource Include +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../thumbnailcreator/inc + + +LIBRARY commonengine.lib +LIBRARY euser.lib //Mandatory +LIBRARY ecom.lib //Ecom Library +LIBRARY estor.lib +LIBRARY mpxcommon.lib //CollectionPath Level +LIBRARY glxdatasourcemanager.lib //DataSource Request +LIBRARY glxcommon.lib //Filters +LIBRARY flogger.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/inc/glxcollectionplugintags.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/inc/glxcollectionplugintags.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: Tag collection plugin definition +* +*/ + + + + + +#ifndef C_GLXTAGCOLLECTIONPLUGIN_H +#define C_GLXTAGCOLLECTIONPLUGIN_H + +// INCLUDES +#include //Plugin Base Class +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +const TInt KGlxCollectionTagLevel = KGlxCollectionRootLevel + 1; //Tag Collection Level +const TInt KGlxCollectionTagContentsLevel = KGlxCollectionRootLevel + 2; //Tag contents Level +const TInt KGlxCollectionTagFSContentsLevel = KGlxCollectionRootLevel + 3; //Tag FS contents Level + + + +// CLASS DECLARATION +/** +* Tag collection plugin +*/ +NONSHARABLE_CLASS(CGlxCollectionPluginTags) : public CGlxCollectionPluginBase + { +public: // Constructors and destructor + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CGlxCollectionPluginTags* NewL(TAny* aObs); + + /** + * Destructor + */ + ~CGlxCollectionPluginTags(); + + private : + /** + * Constructor + * @param aObs MMPXCollectionPluginObserver instance + */ + CGlxCollectionPluginTags(MMPXCollectionPluginObserver* aObs); + + /** + * ConstructL + */ + void ConstructL(); + +private: + //From CGlxCollectionPluginBase + + void CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute + , RArray& aAttributeArray); + + + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TArray aMediaIds); + TBool IsUpdateMessageIgnored(CMPXMessage& aMessage); + + void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray aCpiAttributes, + TGlxMediaId aMediaId); + + TGlxFilterProperties DefaultFilter(TInt aLevel); + +}; + +#endif // C_GLXTAGCOLLECTIONPLUGIN_H + +//End Of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/rom/tagcollectionplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/rom/tagcollectionplugin.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-2008 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: TagCollectionPlugin's iby file. +* +*/ + + + + +#ifndef __TAGCOLLECTIONPLUGIN_IBY__ +#define __TAGCOLLECTIONPLUGIN_IBY__ + +ECOM_PLUGIN( glxcollectionplugintags.dll, glxcollectionplugintags.rsc ) + +#endif // __TAGCOLLECTIONPLUGIN_IBY__ + +// End of file +----------------------------------------------------------- \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/src/glxcollectionplugintags.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/src/glxcollectionplugintags.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,364 @@ +/* +* Copyright (c) 2008-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: Tag collection plugin implementation +* +*/ + + + + +// INCLUDE FILES +#include "glxcollectionplugintags.h" +#include "glxcollectionplugintags.hrh" + + +#include //KMPXMediaIdGeneral +#include //Attributes for KMPXMediaIdContainer +#include +#include +#include //MGlxDataSource +#include //For Logging +#include + +_LIT(KResourceFile, "z:glxplugintags.rsc"); +/** + * @internal reviewed 14/06/2007 by Alex Birkett + */ + +// ---------------------------------------------------------------------------- +// Two-Phased Constructor +// ---------------------------------------------------------------------------- + +CGlxCollectionPluginTags* CGlxCollectionPluginTags::NewL(TAny* aObs) + { + TRACER("CGlxCollectionPluginTags::NewL"); + + CGlxCollectionPluginTags* self = new (ELeave) CGlxCollectionPluginTags( + static_cast(aObs)); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// + CGlxCollectionPluginTags::~CGlxCollectionPluginTags() + { + //Do Nothing + } + + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +void CGlxCollectionPluginTags::ConstructL() + { + TRACER("CGlxCollectionPluginTags::ConstructL"); + + // iDataSource - @owner is CGlxCollectionPluginBase + iDataSource = MGlxDataSource::OpenDataSourceL(KGlxDefaultDataSourceUid, *this); + } + + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- + +CGlxCollectionPluginTags::CGlxCollectionPluginTags( + MMPXCollectionPluginObserver* aObs) + { + iObs = aObs; + } + + +// ---------------------------------------------------------------------------- +// Add Additional attributes +// ---------------------------------------------------------------------------- + +void CGlxCollectionPluginTags::CpiAttributeAdditionalAttributes( + const TMPXAttribute& aCpiAttribute, RArray& aAttributeArray) + { + TRACER("CGlxCollectionPluginTags::CpiAttributeAdditionalAttributes"); + // Only need to process KGlxMediaCollectionPluginSpecificSubTitle here as all + // the others are reading straight from resource files + // KGlxMediaCollectionPluginSpecificSubTitle requires a usage count + if (aCpiAttribute == KGlxMediaCollectionPluginSpecificSubTitle) + { + // need to add the usage count. but check first if it is already present + TInt attrCount = aAttributeArray.Count(); + TBool found = EFalse; + + GLX_DEBUG1("CGlxCollectionPluginTags::CpiAttributeAdditionalAttributes-AttributesCount"); + + for ( TInt index = 0 ; index < attrCount ; index++) + { + if (aAttributeArray[index] == KMPXMediaGeneralCount) + { + found = ETrue; + break; + } + } + + if (!found) + { + aAttributeArray.Append(KMPXMediaGeneralCount); + } + } + } + + +// ---------------------------------------------------------------------------- +// Modify the response +// ---------------------------------------------------------------------------- + +void CGlxCollectionPluginTags::HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TArray aMediaIds) + { + TRACER("CGlxCollectionPluginTags::HandleCpiAttributeResponseL"); + const TInt mediaIdCount = aMediaIds.Count(); + + switch (mediaIdCount) + { + case 0: + User::Leave(KErrNotSupported); + break; + + case 1: + GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-MediaID"); + + HandleCpiAttributeResponseL(aResponse, aCpiAttributes, aMediaIds[0]); + break; + + + default: + { + // We have an array of CMPXMedia items + + if (TGlxMediaId(KGlxCollectionRootId) == aMediaIds[0]) + { + User::Leave(KErrNotSupported); + } + + CMPXMediaArray* mediaArray = aResponse->ValueCObjectL(KMPXMediaArrayContents); + CleanupStack::PushL(mediaArray); + + const TInt arrayCount = mediaArray->Count(); + + // Sanity check + if (arrayCount != mediaIdCount) + { + User::Leave(KErrArgument); + } + + for (TInt index = 0; index < arrayCount; index++) + { + 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); + } + break; + } + } + + +// ---------------------------------------------------------------------------- +// Modify the response +// ---------------------------------------------------------------------------- + +void CGlxCollectionPluginTags::HandleCpiAttributeResponseL(CMPXMedia* aResponse, + TArray aCpiAttributes, TGlxMediaId aMediaId) + { + + TRACER("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Enter"); + + const TInt attribCount = aCpiAttributes.Count(); + + GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Attributes created"); + + for (TInt index = 0; index < attribCount ; index++) + { + const TMPXAttribute attr = aCpiAttributes[index]; + + if (attr == KGlxMediaCollectionPluginSpecificSubTitle) + { + GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Subtitle"); + + if (!aResponse->IsSupported(KMPXMediaGeneralCount)) + { + User::Leave(KErrNotSupported); + } + else + { + TInt usageCount = aResponse->ValueTObjectL(KMPXMediaGeneralCount); + HBufC* tempTitle = NULL; + + if (TGlxMediaId(KGlxCollectionRootId) == aMediaId) + { + if(0 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_TAG_SUB_TITLE_NO_ITEMS); + // Set the title in the response. + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_TAG_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_TAG_SUB_TITLE_MULTI); + } + } + else + { + if(0 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_TAG_SUB_TITLE_NO_ITEMS); + // Set the title in the response. + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else if (1 == usageCount) + { + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_TAG_ITEM_SUB_TITLE_SINGLE); + aResponse->SetTextValueL(attr, *tempTitle); + CleanupStack::PopAndDestroy(tempTitle); + continue; + } + else + { + tempTitle = LoadLocalizedStringLC(KResourceFile, + R_TAG_ITEM_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); + TPtr ptr = title->Des(); + StringLoader::Format(ptr, formatString, -1, usageCount); + + // Set the title in the response. + aResponse->SetTextValueL(attr, *title); + + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(tempTitle); + } + } + else if (attr == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Popup Title"); + + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_TAG_POPUP_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + + } + else if (attr == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Mediaitem"); + + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_TAG_ITEM_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + + } + + else if (attr == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Defualt mediatitle"); + + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_TAG_DEFAULT_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + + } + else if (attr == KMPXMediaGeneralTitle) + { + GLX_LOG_INFO("CGlxCollectionPluginTags::HandleCpiAttributeResponseL-Attr Title"); + + HBufC* title = LoadLocalizedStringLC(KResourceFile, R_TAG_GENERAL_TITLE); + aResponse->SetTextValueL(attr, *title); + CleanupStack::PopAndDestroy(title); + } + } + } + +// ---------------------------------------------------------------------------- +// Ignore the Updated Message +// ---------------------------------------------------------------------------- +TBool CGlxCollectionPluginTags::IsUpdateMessageIgnored(CMPXMessage& /*aMessage*/) + { + TRACER("CGlxCollectionPluginTags::IsUpdateMessageIgnored"); + TBool ignore = EFalse; + return ignore; + } + +// ---------------------------------------------------------------------------- +// Set the filter Properties +// ---------------------------------------------------------------------------- + +TGlxFilterProperties CGlxCollectionPluginTags::DefaultFilter(TInt aLevel) + { + TRACER("CGlxCollectionPluginTags::DefaultFilter"); + __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || (aLevel == KGlxCollectionTagLevel) + || (aLevel == KGlxCollectionTagContentsLevel) || (aLevel == KGlxCollectionTagFSContentsLevel)), + Panic(EGlxPanicInvalidPathLevel)); + TGlxFilterProperties filterProperties; + filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + switch(aLevel) + { + case KGlxCollectionRootLevel: + case KGlxCollectionTagLevel: + { + filterProperties.iMinCount = 1; + filterProperties.iSortOrder = EGlxFilterSortOrderAlphabetical; + filterProperties.iItemType = EGlxFilterTag; + + break; + } + case KGlxCollectionTagContentsLevel: + { + filterProperties.iSortDirection = EGlxFilterSortDirectionDescending; + } + case KGlxCollectionTagFSContentsLevel: + { + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + break; + } + } + return filterProperties; + } + +//End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/plugins/tagcollectionplugin/src/glxcollectionplugintagsproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/plugins/tagcollectionplugin/src/glxcollectionplugintagsproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin* +*/ + + + + +#include //Definition for the TImplementationProxy structure. + +#include "glxcollectionplugintags.h" +#include "glxcollectionplugintags.hrh" + + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; + +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) + {{aUid},(TProxyNewLPtr)(aFuncPtr)} +#endif + + + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KGlxTagCollectionPluginImplementationUid, + CGlxCollectionPluginTags::NewL) + }; + + +// --------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/Cenrep/02000A09.cre Binary file photosgallery/collectionframework/thumbnailcreator/Cenrep/02000A09.cre has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/Cenrep/02000A09.txt Binary file photosgallery/collectionframework/thumbnailcreator/Cenrep/02000A09.txt has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/Cenrep/keys_thumbnailcreator.xls Binary file photosgallery/collectionframework/thumbnailcreator/Cenrep/keys_thumbnailcreator.xls has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/bwins/glxthumbnailcreatoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/bwins/glxthumbnailcreatoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,10 @@ +EXPORTS + ?CancelRequest@CGlxtnThumbnailCreator@@QAEXABVTGlxMediaId@@@Z @ 1 NONAME ; void CGlxtnThumbnailCreator::CancelRequest(class TGlxMediaId const &) + ?CleanupThumbnailsL@CGlxtnThumbnailCreator@@QAEXPAVMGlxtnThumbnailStorage@@@Z @ 2 NONAME ; void CGlxtnThumbnailCreator::CleanupThumbnailsL(class MGlxtnThumbnailStorage *) + ?Close@CGlxtnThumbnailCreator@@QAEXPAVMGlxtnThumbnailStorage@@@Z @ 3 NONAME ; void CGlxtnThumbnailCreator::Close(class MGlxtnThumbnailStorage *) + ?DeleteThumbnailsL@CGlxtnThumbnailCreator@@QAEXABVTGlxMediaId@@AAVMGlxtnThumbnailCreatorClient@@@Z @ 4 NONAME ; void CGlxtnThumbnailCreator::DeleteThumbnailsL(class TGlxMediaId const &, class MGlxtnThumbnailCreatorClient &) + ?FetchThumbnailL@CGlxtnThumbnailCreator@@QAEXABVTGlxThumbnailRequest@@AAVMGlxtnThumbnailCreatorClient@@@Z @ 5 NONAME ; void CGlxtnThumbnailCreator::FetchThumbnailL(class TGlxThumbnailRequest const &, class MGlxtnThumbnailCreatorClient &) + ?FilterAvailableThumbnailsL@CGlxtnThumbnailCreator@@QAEXABV?$TArray@VTGlxMediaId@@@@ABVTSize@@AAVMGlxtnThumbnailCreatorClient@@@Z @ 6 NONAME ; void CGlxtnThumbnailCreator::FilterAvailableThumbnailsL(class TArray const &, class TSize const &, class MGlxtnThumbnailCreatorClient &) + ?InstanceL@CGlxtnThumbnailCreator@@SAPAV1@XZ @ 7 NONAME ; class CGlxtnThumbnailCreator * CGlxtnThumbnailCreator::InstanceL(void) + ?NewL@CGlxtnThumbnailDatabase@@SAPAV1@ABVTDesC16@@PAVMGlxtnThumbnailStorageObserver@@@Z @ 8 NONAME ; class CGlxtnThumbnailDatabase * CGlxtnThumbnailDatabase::NewL(class TDesC16 const &, class MGlxtnThumbnailStorageObserver *) + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/conf/thumbnailcreator.confml Binary file photosgallery/collectionframework/thumbnailcreator/conf/thumbnailcreator.confml has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/conf/thumbnailcreator_02000A09.crml Binary file photosgallery/collectionframework/thumbnailcreator/conf/thumbnailcreator_02000A09.crml has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/eabi/glxthumbnailcreatoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/eabi/glxthumbnailcreatoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,14 @@ +EXPORTS + _ZN22CGlxtnThumbnailCreator13CancelRequestERK11TGlxMediaId @ 1 NONAME + _ZN22CGlxtnThumbnailCreator15FetchThumbnailLERK20TGlxThumbnailRequestR28MGlxtnThumbnailCreatorClient @ 2 NONAME + _ZN22CGlxtnThumbnailCreator17DeleteThumbnailsLERK11TGlxMediaIdR28MGlxtnThumbnailCreatorClient @ 3 NONAME + _ZN22CGlxtnThumbnailCreator18CleanupThumbnailsLEP22MGlxtnThumbnailStorage @ 4 NONAME + _ZN22CGlxtnThumbnailCreator26FilterAvailableThumbnailsLERK6TArrayI11TGlxMediaIdERK5TSizeR28MGlxtnThumbnailCreatorClient @ 5 NONAME + _ZN22CGlxtnThumbnailCreator5CloseEP22MGlxtnThumbnailStorage @ 6 NONAME + _ZN22CGlxtnThumbnailCreator9InstanceLEv @ 7 NONAME + _ZN23CGlxtnThumbnailDatabase4NewLERK7TDesC16P30MGlxtnThumbnailStorageObserver @ 8 NONAME + _ZTI22CGlxtnThumbnailCreator @ 9 NONAME ; ## + _ZTI23CGlxtnThumbnailDatabase @ 10 NONAME ; ## + _ZTV22CGlxtnThumbnailCreator @ 11 NONAME ; ## + _ZTV23CGlxtnThumbnailDatabase @ 12 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxthumbnailcreator. +* +*/ + + + + +PRJ_MMPFILES +../group/glxthumbnailcreator.mmp + +// Don't build glxthumbnailcomposerplugin as S60 TNM is enabled and has this feature. +//../thumbnailcomposerplugin/glxthumbnailcomposerplugin.mmp + +PRJ_TESTEXPORTS +../../../gallery/data/Battle.jpg /epoc32/winscw/c/tnctest/test.jpg +../../../gallery/data/Image1.jpg /epoc32/winscw/c/tnctest/no_exif.jpg +//../tsrc/data/tall.jpg /epoc32/winscw/c/TncTest/tall.jpg +//../tsrc/data/wide.jpg /epoc32/winscw/c/TncTest/wide.jpg +//../tsrc/data/red_1x1.jpg /epoc32/winscw/c/TncTest/red_1x1.jpg +//../tsrc/data/corrupt.jpg /epoc32/winscw/c/TncTest/corrupt.jpg + +// Don't build glxthumbnailcomposerplugin as S60 TNM is enabled and has this feature. +//PRJ_EXPORTS +//../cenrep/02000A09.txt /epoc32/data/z/private/10202be9/02000A09.txt +//../cenrep/02000A09.txt /epoc32/release/winscw/udeb/z/private/10202be9/02000A09.txt +//../conf/thumbnailcreator.confml CONFML_EXPORT_PATH(thumbnailcreator.confml,customsw) +//../conf/thumbnailcreator_02000A09.crml CRML_EXPORT_PATH(thumbnailcreator_02000A09.crml,customsw) + +// Generic configuration interface for component cenrep settings +// component_1000292B implementation specifics for cenrep data +// component_12345678 implementation specifics for genconf ml data + +//gnumakefile bld_cenrep_entry.mk + + +PRJ_TESTMMPFILES +//../tsrc/group/ut_cglxtndeletethumbnailstask.mmp +//../tsrc/group/ut_cglxtnfilteravailabletask.mmp +//../tsrc/group/ut_cglxtngeneratethumbnailtask.mmp +//../tsrc/group/ut_cglxtnquickthumbnailtask.mmp +//../tsrc/group/ut_cglxtnzoomedimagetask.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/group/create-ut_cglxtngeneratethumbnailtask-sis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/group/create-ut_cglxtngeneratethumbnailtask-sis.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Bat file for creating the Sis for testing Generate thumbnail Task +rem + +@echo off +echo. +echo ==================================== +echo. +echo Digia EUnit - Test +echo. +echo This BAT copies Test DLL +echo to local folder and makes SIS file +echo. +echo ==================================== +echo. + +:CHECK_EPOCROOT +echo. +echo - verify epoc root +set EPOCROOT +if errorlevel == 1 goto END_ERROR + +:COPY_DLL +echo. +echo - copy test dll to current directory +copy %EPOCROOT%epoc32\release\thumb\urel\ut_cglxtngeneratethumbnailtask.dll . +if errorlevel == 1 goto END_ERROR + +:CREATE_DIR +echo. +echo - create Sis folder (created only if needed) +mkdir ..\Sis + +:MAKESIS +echo. +echo - makesis ut_cglxtngeneratethumbnailtask.pkg ..\sis\ut_cglxtngeneratethumbnailtask.sis +call makesis ut_cglxtngeneratethumbnailtask.pkg ..\sis\ut_cglxtngeneratethumbnailtask.sis +if errorlevel == 1 goto END_ERROR + +:DELETE_DLL +echo. +echo - remove the copied dll from current folder +del ut_cglxtngeneratethumbnailtask.dll +goto END + +:END_ERROR +echo. +echo Sis creation failed. +goto FINAL_END + +:END +echo. +echo Sis file created succesfully +echo ============================ + +:FINAL_END +echo. + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/group/create-ut_cglxtnquickthumbnailtask-sis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/group/create-ut_cglxtnquickthumbnailtask-sis.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Bat file for creating the Sis for testing Quick thumbnail Task +rem + +@echo off +echo. +echo ==================================== +echo. +echo Digia EUnit - Test +echo. +echo This BAT copies Test DLL +echo to local folder and makes SIS file +echo. +echo ==================================== +echo. + +:CHECK_EPOCROOT +echo. +echo - verify epoc root +set EPOCROOT +if errorlevel == 1 goto END_ERROR + +:COPY_DLL +echo. +echo - copy test dll to current directory +copy %EPOCROOT%epoc32\release\thumb\urel\ut_cglxtnquickthumbnailtask.dll . +if errorlevel == 1 goto END_ERROR + +:CREATE_DIR +echo. +echo - create Sis folder (created only if needed) +mkdir ..\Sis + +:MAKESIS +echo. +echo - makesis ut_cglxtnquickthumbnailtask.pkg ..\sis\ut_cglxtnquickthumbnailtask.sis +call makesis ut_cglxtnquickthumbnailtask.pkg ..\sis\ut_cglxtnquickthumbnailtask.sis +if errorlevel == 1 goto END_ERROR + +:DELETE_DLL +echo. +echo - remove the copied dll from current folder +del ut_cglxtnquickthumbnailtask.dll +goto END + +:END_ERROR +echo. +echo Sis creation failed. +goto FINAL_END + +:END +echo. +echo Sis file created succesfully +echo ============================ + +:FINAL_END +echo. + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/group/glxthumbnailcreator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/group/glxthumbnailcreator.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: Project information for the Thumbnail Creator Module +* +*/ + + + + +#include +#include +#include + +#include "../../../group/glxbuildcommon.mmh" + + +TARGET glxthumbnailcreator.dll +TARGETTYPE dll +UID 0x1000008d 0x02000A09 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL WriteDeviceData + +SOURCEPATH ../src + +SOURCE glxtnbackgroundgenerationtask.cpp +SOURCE glxtncleanuptask.cpp +SOURCE glxtndatabase.cpp +SOURCE glxtndeletethumbnailstask.cpp +SOURCE glxtnfileinfo.cpp +SOURCE glxtnfileutility.cpp +SOURCE glxtnfilteravailabletask.cpp +SOURCE glxtngeneratethumbnailtask.cpp +SOURCE glxtnimagedecoderfactory.cpp +SOURCE glxtnimageutility.cpp +SOURCE glxtnloadthumbnailtask.cpp +SOURCE glxtnquickthumbnailtask.cpp +SOURCE glxtnsavethumbnailtask.cpp +SOURCE glxtntaskmanager.cpp +SOURCE glxtntask.cpp +SOURCE glxtnthumbnailcreator.cpp +SOURCE glxtnvideoutility.cpp +SOURCE glxtnvolumedatabase.cpp +SOURCE glxtnzoomedimagetask.cpp + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../common/inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY ihl.lib // For IHL Library +LIBRARY featmgr.lib +LIBRARY bitgdi.lib +LIBRARY caf.lib +LIBRARY bafl.lib +LIBRARY edbms.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY exiflib.lib +LIBRARY fbscli.lib +LIBRARY glxcommon.lib +LIBRARY iclextjpegapi.lib +LIBRARY imageconversion.lib +LIBRARY platformenv.lib +LIBRARY centralrepository.lib +LIBRARY flogger.lib // For Logging Tracer +#ifdef ENABLE_VED +LIBRARY vedengine.lib +#else +LIBRARY tneengine.lib +#endif + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/group/ut_cglxtngeneratethumbnailtask.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/group/ut_cglxtngeneratethumbnailtask.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2004 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: Package info for test module for Generate thumbnail Task +; + +; Supported languages +&en + +; Package header (one name for each supported language) +#{"ut_cglxtngeneratethumbnailtask"},(0x01700000),0,10,0 + +; Package signature + + +; Options line not supported currently + +; Conditions blocks not supported currently + +; Language independent files that are always installed +"ut_cglxtngeneratethumbnailtask.dll"-"!:\DigiaEUnit\Tests\ut_cglxtngeneratethumbnailtask.dll" + +; Language dependent files + + +; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) +(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/group/ut_cglxtnquickthumbnailtask.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/group/ut_cglxtnquickthumbnailtask.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2004 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: Package info for test module for Quick thumbnail Task +; + +; Supported languages +&en + +; Package header (one name for each supported language) +#{"ut_cglxtnquickthumbnailtask"},(0x01700000),0,10,0 + +; Package signature + + +; Options line not supported currently + +; Conditions blocks not supported currently + +; Language independent files that are always installed +"ut_cglxtnquickthumbnailtask.dll"-"!:\DigiaEUnit\Tests\ut_cglxtnquickthumbnailtask.dll" + +; Language dependent files + + +; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) +(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnbackgroundgenerationtask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnbackgroundgenerationtask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2008-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: Thumbnail background generation task implementation +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNBACKGROUNDGENERATIONTASK_H +#define GLXTNBACKGROUNDGENERATIONTASK_H + +// INCLUDES + +#include "glxtnsavethumbnailtask.h" +#include + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +class CGlxtnFileUtility; +class CGlxtnImageUtility; +class CGlxtnVideoUtility; + +// CLASS DECLARATION + +/** +* Background task to generate a thumbnail. +* +* @author Dan Rhodes +* @ingroup glx_thumbnail_creator +*/ +NONSHARABLE_CLASS(CGlxtnBackgroundGenerationTask) : public CGlxtnSaveThumbnailTask + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param iItemId Media ID of item to thumbnail. + * @param aFileUtility File utility for use by the task. + * @param aClient Client initiating the request. + */ + static CGlxtnBackgroundGenerationTask* NewL( + const TGlxMediaId& iItemId, CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient, + CGlxSettingsModel::TSupportedOrientations aSupportedOrientations); + + /** + * Destructor. + */ + virtual ~CGlxtnBackgroundGenerationTask(); + + private: // From CGlxtnTask + TBool DoStartL(TRequestStatus& aStatus); + void DoCancel(); + TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + + private: + /** + * C++ default constructor. + * @param iItemId Media ID of item to thumbnail. + * @param aFileUtility File utility for use by the task. + * @param aClient Client initiating the request. + */ + CGlxtnBackgroundGenerationTask(const TGlxMediaId& iItemId, + CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient, + CGlxSettingsModel::TSupportedOrientations aSupportedOrientations); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Check whether next size already exists or needs to be generated. + * @param aStatus Request status for the asynchronous operation. + * @return ETrue if the task has issued an asyncronous request. + */ + TBool CheckNextL(TRequestStatus& aStatus); + + /** + * Create the next size to be generated. + * @param aStatus Request status for the asynchronous operation. + * @return ETrue if the task has issued an asyncronous request. + */ + TBool ProcessNextL(TRequestStatus& aStatus); + + /** + * Filter the thumbnail for the next required size. + * @param aStatus Request status for the asynchronous operation. + */ + void FilterThumbnailL(TRequestStatus& aStatus); + + /** + * Scale the thumbnail to the next required size. + * @param aStatus Request status for the asynchronous operation. + */ + void ScaleThumbnailL(TRequestStatus& aStatus); + + /** + * Decode the image for the required size. + * @param aStatus Request status for the asynchronous operation. + */ + void DecodeImageL(TRequestStatus& aStatus); + /** + * calculates Grid Icon Size for landscape orientation and Fullscreen + * Image size depending on Layout defines. + */ + void LayoutSpecificDataL(); + + + private: // Data + /** Pointer to client, or NULL after client goes away */ + MGlxtnThumbnailCreatorClient* iClient; + /** File utility */ + CGlxtnFileUtility& iFileUtility; + /** Array of sizes to check if need to generate */ + RArray iSizes; + /** Array of sizes to generate */ + RArray iTodoSizes; + /** Utility to get thumbnail from image */ + CGlxtnImageUtility* iImageUtility; + /** Utility to get thumbnail from video */ + CGlxtnVideoUtility* iVideoUtility; + /** Image loaded from file */ + CFbsBitmap* iImage; + /** Image loaded from file */ + CFbsBitmap* iFilteredImage; + /** Flag to show BadFileMarker not created so no need to delete **/ + TBool iBadFileMarkerNotNeededFlag; + /** Flag to show whether image has been decoded yet **/ + TBool iImageDecoded; + /** Flag to show which orientations are supported **/ + CGlxSettingsModel::TSupportedOrientations iSupportedOrientations; + TSize iGridIconSize; + TSize iCoverflowIconSize; + }; + +#endif // GLXTNBACKGROUNDGENERATIONTASK_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtncleanuptask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtncleanuptask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: Thumbnail storage cleanup task implementation +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNCLEANUPTASK_H +#define GLXTNCLEANUPTASK_H + +// INCLUDES + +#include "glxtntask.h" + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Background task to clean thumbnail storage of thumbnails for files which no +* longer exist. +* +* @author Dan Rhodes +* @ingroup glx_thumbnail_creator +*/ +NONSHARABLE_CLASS(CGlxtnCleanupTask) : public CGlxtnTask + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aStorage Client's storage interface. + */ + static CGlxtnCleanupTask* NewL(MGlxtnThumbnailStorage* aStorage); + + /** + * Destructor. + */ + virtual ~CGlxtnCleanupTask(); + + private: // From CGlxtnTask + TBool DoStartL(TRequestStatus& aStatus); + void DoCancel(); + TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + + private: + /** + * C++ default constructor. + * @param aStorage Client's storage interface. + */ + CGlxtnCleanupTask(MGlxtnThumbnailStorage* aStorage); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + }; + +#endif // GLXTNCLEANUPTASK_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtndatabase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtndatabase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2008-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: Thumbnail storage implementation +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNDATABASE_H +#define GLXTNDATABASE_H + +// INCLUDES + +#include +#include +#include +#include "mglxtnstorage.h" +#include "mglxtnvolumedatabaseobserver.h" + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +class CGlxtnVolumeDatabase; + +// CLASS DECLARATION + +/** +* Default implementation of thumbnail storage. +* +* @author Dan Rhodes +* @ingroup glx_thumbnail_creator +*/ +class CGlxtnThumbnailDatabase : public CBase, public MGlxtnThumbnailStorage, + public MGlxtnVolumeDatabaseObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aDbFilename Filename (without path) for database. + * @param aStorageObserver Observer of storage operations. + */ + IMPORT_C static CGlxtnThumbnailDatabase* NewL(const TDesC& aDbFilename, + MGlxtnThumbnailStorageObserver* aStorageObserver = NULL); + + /** + * Destructor. + */ + virtual ~CGlxtnThumbnailDatabase(); + + public: // New functions + + public: // Functions from MGlxtnThumbnailStorage + void LoadThumbnailDataL(HBufC8*& aData, TGlxImageDataFormat& aFormat, + const TGlxMediaId& aId, const CGlxtnFileInfo& aFileInfo, + const TSize& aSize, TRequestStatus* aStatus); + void SaveThumbnailDataL(const TDesC8& aData, + TGlxImageDataFormat aFormat, const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, const TSize& aSize, + TRequestStatus* aStatus); + void DeleteThumbnailsL(const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus); + void CleanupThumbnailsL(TRequestStatus* aStatus); + void IsThumbnailAvailableL(const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, + const TSize& aSize, TRequestStatus* aStatus); + void StorageCancel(); + void NotifyBackgroundError(const TGlxMediaId& aId, TInt aError); + + private: // From MGlxtnVolumeDatabaseObserver + void HandleDatabaseError(TInt aError); + void HandleThumbnailIdFromMediaIdL( + const TGlxtnThumbnailId& aThumbId ); + void HandleThumbnailIdFromFilenameL( + const TGlxtnThumbnailId& aThumbId ); + void HandleThumbnailIdStoredL(); + void HandleThumbnail(TGlxImageDataFormat aFormat, HBufC8* aData); + void HandleThumbnailStored(); + void HandleMediaIdDeletedL(); + void HandleThumbnailsDeletedL(); + void HandleItemDeletedL(); + void HandleAvailabilityChecked(TInt aResult); + void HandleDatabaseCleanedL(); + TInt DriveName(const TInt& aDefaultDrive, TDes& aDriveName); + + private: + + /** + * C++ default constructor. + */ + CGlxtnThumbnailDatabase(); + + /** + * By default Symbian 2nd phase constructor is private. + * @param aDbFilename Filename (without path) for database. + * @param aStorageObserver Observer of storage operations. + */ + void ConstructL(const TDesC& aDbFilename, + MGlxtnThumbnailStorageObserver* aStorageObserver); + + /** + * Continue current operation after receiving the thumbnail ID. + */ + void DoHandleThumbnailIdL(); + + /** + * Open a volume database on the specified drive. + * @param aDrive String beginnning with drive letter and colon. + */ + CGlxtnVolumeDatabase* OpenDatabaseL(const TDesC& aDrive); + + CGlxtnVolumeDatabase* OpenDatabaseL(const DriveInfo::TDefaultDrives& aDrive); + + /** + * Delete the volume database if the storage media has changed. + * @param aDrive String beginnning with drive letter and colon. + */ + void DeleteDBIfStorageChangedL(TFileName aPath); + + /** + * Delete the file at location aPath + * @param aPath The location of the file to be deleted. + */ + void DeleteFile(const TDesC& aPath) ; + + /** + * Recover from database file handling error + */ + void RecoverFromDatabaseError(); + + private: // Data + enum TDatabaseOperation + { + ELoading, ESaving, EDeleting, ECleaning, ECheckingAvailable + }; + + /** Pointer to a storage observer */ + MGlxtnThumbnailStorageObserver* iStorageObserver; + /** File server session */ + RFs iFs; + /** Path to the database files (excluding drive letter) */ + TFileName iDatabasePath; + /** Drive name of the phone memory drive */ + TDriveName iInternalDrive; + /** Array of open databases (one per volume) */ + RPointerArray iDatabaseArray; + /** Request status for asynchronous operation */ + TRequestStatus* iClientStatus; + /** Operation currently being carried out by the database */ + TDatabaseOperation iCurrentOperation; + /** Media ID for request */ + TGlxMediaId iMediaId; + /** URI for request (not owned) */ + const CGlxtnFileInfo* iFileInfo; + /** Thumbnail size for request */ + TSize iSize; + /** Data buffer for load request */ + HBufC8** iLoadData; + /** Data buffer for save request */ + TPtrC8 iSaveData; + /** Thumbnail format for load request */ + TGlxImageDataFormat* iLoadFormat; + /** Thumbnail format for save request */ + TGlxImageDataFormat iSaveFormat; + /** ID for thumbnail */ + TGlxtnThumbnailId iThumbId; + /** Index to count through iDatabaseArray */ + TInt iDatabaseIndex; + }; + +#endif // GLXTNDATABASE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtndeletethumbnailstask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtndeletethumbnailstask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2008-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: Definition of CGlxtnDeleteThumbnailsTask +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNDELETETHUMBNAILSTASK_H +#define C_GLXTNDELETETHUMBNAILSTASK_H + +// INCLUDES + +#include "glxtntask.h" + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +class CGlxtnFileInfo; + +// CLASS DECLARATION + +/** +* Task to delete all stored thumbnails for a media item. +* +* @author Dan Rhodes +* @ingroup glx_thumbnail_creator +*/ +NONSHARABLE_CLASS(CGlxtnDeleteThumbnailsTask) : public CGlxtnClientTask + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param iItemId Media ID of item whose thumbnails should be deleted. + * @param aClient Client initiating the request. + */ + static CGlxtnDeleteThumbnailsTask* NewL(const TGlxMediaId& aItemId, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Destructor. + */ + virtual ~CGlxtnDeleteThumbnailsTask(); + + protected: // From CGlxtnTask + + TBool DoStartL(TRequestStatus& aStatus); + void DoCancel(); + TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + + private: + + /** + * C++ default constructor. + * @param iItemId Media ID of item whose thumbnails should be deleted. + * @param aClient Client initiating the request. + */ + CGlxtnDeleteThumbnailsTask(const TGlxMediaId& aItemId, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + /** File information for item whose thumbnails are to be deleted */ + CGlxtnFileInfo* iInfo; + /** Whether delete operation has been started */ + TBool iDeleting; + }; + +#endif // C_GLXTNDELETETHUMBNAILSTASK_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnfileinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnfileinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: Definition of CGlxtnFileInfo +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNFILEINFO_H +#define C_GLXTNFILEINFO_H + +#include + +/** + * Object holding information about a file to be thumbnailed. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +class CGlxtnFileInfo : public CBase + { +public: + inline CGlxtnFileInfo(); + inline ~CGlxtnFileInfo(); + + /** + * Copy info from one object to another. + */ + inline void CopyInfoL(CGlxtnFileInfo& aInfo); + + /** + * Get the full path to the media file. + * @return Media file path. + */ + inline const TDesC& FilePath() const; + + /** + * Set the full path to the media file. + * @param aPath Media file path (takes ownership). + */ + inline void SetFilePath(HBufC* aPath); + + /** + * Set the full path to the media file. + * @param aPath Media file path. + */ + inline void SetFilePathL(const TDesC& aPath); + + /** + * Set the full path to the media file. + * @param aIsVideo Set to true if the file is a video. + * @param aIsProtected Set to true if the file is DRM protected. + */ + void IdentifyFileL(TBool& aIsVideo, TBool& aIsProtected); + +public: + /** Size of the media file */ + TInt iFileSize; + /** Last modified time of the media file */ + TTime iFileTime; + /** True if the thumbnail is temporary and should not be stored */ + TBool iTemporary; + TBool iIsVideo; + TBool iIsProtected; + +private: + /** Full path of the media file */ + HBufC* iFilePath; + }; + +#include "glxtnfileinfo.inl" + +#endif // C_GLXTNFILEINFO_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnfileinfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnfileinfo.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2008-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: Definition of CGlxtnFileInfo +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline CGlxtnFileInfo::CGlxtnFileInfo() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +inline CGlxtnFileInfo::~CGlxtnFileInfo() + { + delete iFilePath; + } + +// ----------------------------------------------------------------------------- +// CopyInfoL +// ----------------------------------------------------------------------------- +// +inline void CGlxtnFileInfo::CopyInfoL(CGlxtnFileInfo& aInfo) + { + SetFilePathL(aInfo.FilePath()); + iFileSize = aInfo.iFileSize; + iFileTime = aInfo.iFileTime; + iTemporary = aInfo.iTemporary; + iIsVideo = aInfo.iIsVideo; + iIsProtected = aInfo.iIsProtected; + } + +// ----------------------------------------------------------------------------- +// FilePath +// Get the full path to the media file. +// ----------------------------------------------------------------------------- +// +inline const TDesC& CGlxtnFileInfo::FilePath() const + { + return *iFilePath; + } + +// ----------------------------------------------------------------------------- +// SetFilePathL +// Set the full path to the media file. +// ----------------------------------------------------------------------------- +// +inline void CGlxtnFileInfo::SetFilePath(HBufC* aPath) + { + delete iFilePath; + iFilePath = aPath; + } + +// ----------------------------------------------------------------------------- +// SetFilePathL +// Set the full path to the media file. +// ----------------------------------------------------------------------------- +// +inline void CGlxtnFileInfo::SetFilePathL(const TDesC& aPath) + { + delete iFilePath; + iFilePath = NULL; + iFilePath = aPath.AllocL(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnfileutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnfileutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2008-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: Utility for thumbnail tasks handling files +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNFILEUTILITY_H +#define GLXTNFILEUTILITY_H + +#include +#include + +/** + * Utility for thumbnail tasks handling files. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnFileUtility) : public CBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CGlxtnFileUtility* NewL(); + + /** + * Destructor. + */ + ~CGlxtnFileUtility(); + + /** + * Provide file server session for opening images from files. + */ + RFs& FsSession(); + + /** + * Test whether a file is on the bad file list. If so this method leaves. + * If not the bad file marker is set to the filename, so that if a panic + * occurs the file will be added to the bad file list. + * @param aFilename Path of file for which a thumbnail is to be generated. + */ + void CheckBadFileListL(const TDesC& aFilename); + + /** + * Clear the bad file marker. Called when processing a file is complete (no + * panic occurred). + */ + void ClearBadFileMarker(); + + /** + * Test whether a generated thumbnail should be stored in persistent storage. + * @param aSize Requested size of thumbnail. + */ + TBool IsPersistentSize(const TSize& aSize); + +private: + + /** + * C++ default constructor. + */ + CGlxtnFileUtility(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Read bad file list from file and add file from marker, if present. + */ + void ReadBadFileListL(); + /** + * Write bad file list to file. + */ + void WriteBadFileListL(); + /** + * calculates Grid Icon Size for landscape orientation and Fullscreen + * Image size depending on Layout defines. + */ + void LayoutSpecificDataL(); + +private: + /** File server session for opening images from files */ + RFs iFs; + /** Directory in which to store bad file list and marker */ + TFileName iBadFileDir; + /** Filenames of media files which cause panics when decoding */ + RPointerArray iBadFileArray; + /** Persistent thumbnail size classes */ + RArray iPersistentSizeClasses; + }; + +#endif // GLXTNFILEUTILITY_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnfilteravailabletask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnfilteravailabletask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2008-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: Task used for thumbnail availability filter. +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNFILTERAVAILABLETASK_H +#define C_GLXTNFILTERAVAILABLETASK_H + +#include "glxtntask.h" + +// Forward declarations +class CGlxtnFileInfo; + +/** + * Task to filter a list of media item IDs to include only those which don't + * have a high quality thumbnail of a given size. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnFilterAvailableTask) : public CGlxtnClientTask + { +public: + /** + * Two-phased constructor. + * @param aItemArray Array of item IDs, from which those with thumbnails + * should be removed. + * @param aSize Size of thumbnail required. + * @param aClient Client initiating the request. + */ + static CGlxtnFilterAvailableTask* NewL( + const TArray& aItemArray, const TSize& aSize, + MGlxtnThumbnailCreatorClient& aClient); + /** + * Destructor. + */ + ~CGlxtnFilterAvailableTask(); + +protected: // From CGlxtnTask + + TBool DoStartL(TRequestStatus& aStatus); + void DoCancel(); + TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + +private: + /** + * C++ default constructor. + * @param aSize Size of thumbnail required. + * @param aClient Client initiating the request. + */ + CGlxtnFilterAvailableTask(const TSize& aSize, + MGlxtnThumbnailCreatorClient& aClient); + /** + * Symbian 2nd phase constructor. + * @param aItemArray Array of item IDs, from which those with thumbnails + * should be removed. + */ + void ConstructL(const TArray& aItemArray); + + /** + * Start asynchronous request for file information for an item. + * @param aStatus Request status for the asynchronous operation. + */ + TBool GetFileInfoL(TRequestStatus& aStatus); + /** + * Start asynchronous check for thumbnail in persistent storage. + * @param aStatus Request status for the asynchronous operation. + */ + TBool CheckIdL(TRequestStatus& aStatus); + +private: + enum TFilterState + { + EStateFetchingUri, EStateChecking + }; + + /** Size of thumbnail for which to check */ + TSize iSize; + /** Array of media IDs from which those with thumbnails are removed */ + RArray iIdArray; + /** Current task state */ + TFilterState iState; + /** Current index in Id array */ + TInt iIndex; + /** File info for current item */ + CGlxtnFileInfo* iFileInfo; + }; + +#endif // C_GLXTNFILTERAVAILABLETASK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtngeneratethumbnailtask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtngeneratethumbnailtask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2008-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: Classes for thumbnail-related tasks. +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNGENERATETHUMBNAILTASK_H +#define C_GLXTNGENERATETHUMBNAILTASK_H + +#include "glxtnloadthumbnailtask.h" + +class CGlxtnFileInfo; +class CGlxtnFileUtility; +class CGlxtnImageUtility; +class CGlxtnVideoUtility; +class CFbsBitmap; +class CImageDecoder; +class RFs; + +/** + * Task to generate a high quality thumbnail for a media item. + * + * An instance of CImageDecoder is constructed to produce a bitmap from the + * image file, scaling to the smallest possible size not smaller than the + * required size. + * + * The task then uses ADIS to scale to the exact size required, and also uses + * the sharpening and IETD algorithms to enhance the image. + * + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS( CGlxtnGenerateThumbnailTask ) + : public CGlxtnLoadThumbnailTask + { +public: + /** + * Two-phased constructor. + * @param aRequestInfo Parameters for the thumbnail request. + * @param aFileUtility File utility for use by the task. + * @param aClient Client initiating the request. + */ + static CGlxtnGenerateThumbnailTask* NewL( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); + /** + * Destructor. + */ + ~CGlxtnGenerateThumbnailTask(); + +protected: // From CGlxtnTask + void SetManager(CGlxtnTaskManager* aManager); + virtual TBool DoStartL(TRequestStatus& aStatus); + virtual void DoCancel(); + virtual TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + +private: + /** + * C++ default constructor. + * @param aRequestInfo Parameters for the thumbnail request. + * @param aFileUtility File utility for use by the task. + * @param aClient Client initiating the request. + */ + CGlxtnGenerateThumbnailTask(const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); + /** + * Symbian 2nd phase constructor. + * @param aBitmapHandle Handle to bitmap in which to store the thumbnail. + */ + void ConstructL(TInt aBitmapHandle); + + /** + * Start asynchronous decoding process for a high quality thumbnail. + * @param aStatus Request status for the asynchronous operation. + */ + void HighQualityDecodeL( TRequestStatus& aStatus ); + /** + * @return ETrue if viewing the requested thumbnail size would require + * DRM rights. + */ + TBool SizeRequiresDrmRights(); + +private: + /** Pointer to task manager (not owned) */ + CGlxtnTaskManager* iTaskManager; + /** Utility to get thumbnail from image (owned) */ + CGlxtnImageUtility* iImageUtility; + /** Utility to get thumbnail from video (owned) */ + CGlxtnVideoUtility* iVideoUtility; + /** Image loaded from file (owned) */ + CFbsBitmap* iImage; + /** Whether current item is a video */ + TBool iVideo; + /** Whether current file is DRM protected */ + TBool iProtected; + /** Flag to show BadFileMarker not created so no need to delete **/ + TBool iBadFileMarkerNotNeededFlag; + }; + +#endif // C_GLXTNGENERATETHUMBNAILTASK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnimagedecoderfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnimagedecoderfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2008-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: Definition of GlxtnImageDecoderFactory +* +*/ + + + + +#ifndef GLXTNIMAGEDECODERFACTORY_H +#define GLXTNIMAGEDECODERFACTORY_H + +#include + +class CImageDecoder; +class RFs; + +/** + * Factory to create appropriate decoder for a given image. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +class GlxtnImageDecoderFactory + { +public: + /** + * Create a decoder for an image file. If the file is a JPEG, the function + * will first try to create a hardware decoder. If that fails a software + * decoder will be created. + * @param aFs File server session. + * @param aFilename Full path of the file. + * @return Pointer to image decoder (caller takes ownership). + */ + static CImageDecoder* NewL( RFs& aFs, const TDesC& aFilename ); + /** + * Create a decoder for JPEG image data. + * @param aFs File server session. + * @param aData Buffer containing the image to be decoded. + * @return Pointer to image decoder (caller takes ownership). + */ + static CImageDecoder* NewL( RFs& aFs, const TDesC8& aData ); + /** + * Create a decoder for an image file. If the file is a JPEG, the function + * will first try to create a hardware decoder. If that fails a software + * decoder will be created.It also returns the type of decoder used + * @param aFs File server session. + * @param aFilename Full path of the file. + * @param + * @return Pointer to image decoder (caller takes ownership). + */ + static CImageDecoder* NewL( RFs& aFs, const TDesC& aFilename, TBool& aDecoderType ); + }; + +#endif // GLXTNIMAGEDECODERFACTORY_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnimageutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnimageutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2008-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: Utility for creating bitmaps from image files +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNIMAGEUTILITY_H +#define GLXTNIMAGEUTILITY_H + +#include +#include // For TDisplayMode + +class MIHLScaler; +class CFbsBitmap; +class CFbsBitGc; +class CImageDecoder; +class RFs; + +/** + * Utility for creating bitmaps from image files + * + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnImageUtility) : public CBase + { +public: + CGlxtnImageUtility(RFs& aFs); + ~CGlxtnImageUtility(); + + void Cancel(); + + /** + * Reduce target size to same aspect ratio as source image. + */ + void AdjustSize(TSize& aTargetSize, const TSize& aSourceSize); + + /** + * Start asynchronous decoding process for a high quality thumbnail. + * @param aStatus Request status for the asynchronous operation. + * @param aFileName Full path of image file. + * @param aTargetSize Size for the image - modified by this function to + * preserve the aspect ratio. + * @param aMode Display mode for the image. + */ + CFbsBitmap* DecodeImageL(TRequestStatus& aStatus, const TDesC& aFileName, + RArray& aTargetSizes, TDisplayMode aMode); + + /** + * Free resources used by decoding. + */ + void FreeDecoder(); + + /** + * Get the original size of the image decoded. + */ + const TSize& OriginalSize() const; + + /** + * Start asynchronous filtering process for a high quality thumbnail. + * @param aStatus Request status for the asynchronous operation. + * @param aSource Source image bitmap. + * @param aFilteredSource Filtered image bitmap. + * @param aTarget Target thumbnail bitmap. + */ + void FilterImageL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, CFbsBitmap* aTarget); + + /** + * Start asynchronous scaling process for a high quality thumbnail. + * @param aStatus Request status for the asynchronous operation. + * @param aSrcBitmap Source image bitmap. + * @param aSrcRect Source image rectangle. + * @param aDstBitmap Destination thumbnail bitmap. + * @param aDstRect Destination image rectangle. + */ + void ScaleImageL(TRequestStatus& aStatus, CFbsBitmap& aSrcBitmap, const TRect& aSrcRect, CFbsBitmap& aDstBitmap, const TRect& aDstRect); + + /** + * Start asynchronous scaling process for a high quality thumbnail. + * @param aStatus Request status for the asynchronous operation. + * @param aSource Source image bitmap. + * @param aFilteredSource Filtered Source image bitmap. + * @param aTarget Target thumbnail bitmap. + */ + void ScaleImage64kL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap* aFilteredSource, CFbsBitmap* aTarget); + +private: + + void ScaleColor64K( TUint16* aSrc, TInt aSrcStride, TInt aSrcCols, TInt aSrcRows, + TInt aX, TInt aY, TInt aW, TInt aH, + TUint16* aDst, TInt aDstStride, TInt aDstCols, TInt aDstRows ); + + void FilterL( CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, TInt aFilterPercent ); + + void FIRFiltering( + TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ); + + void FIRFiltering4( + TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ); + + void FIRFiltering8( + TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ); + /* + * Get the orientation of the file + * This API reads the Exif tag in an image and returns the orientation of that Image + */ + TUint16 GetOrientationL(const TDesC& aFileName) ; + /* + * Get the Rotation Angle and Mirroring status of the image so as to set it on the decoder + * This API calculates the rotation angle and the Mirroring status required by the decoder + * @param aOrientation Orientation of the image. + * @param aRotAngle Rotation angle to be set on the image decoder. + * @param aFlipStatus Mirroring status for the decoder if 1 then mirroring should be set. + * Internally it also sets the iOriginalSize to the required size + */ + void GetRotationParameters(TUint16 aOrientation, TInt& aRotAngle, TBool& aFlipStatus) ; +private: + // File server session + RFs& iFs; + // Decoder used to read image from file + CImageDecoder* iDecoder; + // Bitmap scaler + MIHLScaler* iScaler; + /** Size of the image in the file being decoded */ + TSize iOriginalSize; + CFbsBitmap* iImage; + TUint16* iAddress; + CFbsBitGc* iBitGc; + }; + +#endif // GLXTNIMAGEUTILITY_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnloadthumbnailtask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnloadthumbnailtask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,116 @@ +/* +* 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: Base class for tasks which load thumbnails +* +*/ + + + + +#ifndef C_GLXTNLOADTHUMBNAILTASK_H +#define C_GLXTNLOADTHUMBNAILTASK_H + +#include "glxtntask.h" +#include "glxtnstd.h" + +// Forward declarations +class CGlxtnFileInfo; +class CGlxtnFileUtility; +class CFbsBitmap; +class CImageDecoder; +class TGlxThumbnailRequest; + +/** + * Base class for tasks which load thumbnails. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS( CGlxtnLoadThumbnailTask ) : public CGlxtnClientTask + { +public: + /** + * Destructor. + */ + ~CGlxtnLoadThumbnailTask(); + +protected: // From CGlxtnTask + void DoCancel(); + +protected: + /** + * C++ default constructor. + * @param aId Task type ID. + * @param aRequestInfo Parameters for the thumbnail request. + * @param aFileUtility File utility for use by the task. + * @param aClient Client initiating the request. + */ + CGlxtnLoadThumbnailTask( const TGlxtnTaskId& aId, + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient ); + /** + * Symbian 2nd phase constructor. + * @param aBitmapHandle Handle to bitmap in which to store the thumbnail. + */ + void ConstructL( TInt aBitmapHandle ); + + /** + * Start asynchronous loading. + * @param aStatus Request status for the asynchronous operation. + * @return ETrue if an asynchronous operation has been started. + */ + TBool LoadThumbnailL( TRequestStatus& aStatus ); + /** + * Create bitmap from loaded thumbnail data. + * @param aStatus Request status for the asynchronous operation. + * @return ETrue if an asynchronous operation has been started. + */ + TBool HandleLoadedThumbnailL( TRequestStatus& aStatus ); + /** + * Start asynchronous decoding. iDecoder should point to a valid decoder. + * @param aStatus Request status for the asynchronous operation. + * @param aScaleBitmap If true, scale the loaded bitmap close to + * requested size. + */ + void DecodeThumbnailL( TRequestStatus& aStatus, TBool aScaleBitmap ); + +protected: + enum TGeneratorState + { + EStateFetchingUri, EStateLoading, EStateDecodingThumbnail, + EStateDecodingImage, EStateScaling, EStateFiltering + }; + + /** File utility */ + CGlxtnFileUtility& iFileUtility; + /** Current state for task state machine */ + TGeneratorState iState; + /** File information for item to thumbnail (owned) */ + CGlxtnFileInfo* iInfo; + /** Requested thumbnail size */ + TSize iRequestedSize; + /** Thumbnail image data (owned) */ + HBufC8* iThumbData; + /** Thumbnail data format */ + TGlxImageDataFormat iFormat; + /** Decoder to decode the thumbnail data (owned) */ + CImageDecoder* iDecoder; + /** Bitmap to decode image into (owned) */ + CFbsBitmap* iThumbnail; + /** DRM allowed flag passed from thumbnail request */ + TBool iDrmAllowed; + }; + +#endif // C_GLXTNLOADTHUMBNAILTASK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnquickthumbnailtask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnquickthumbnailtask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Quick thumbnail generation task. +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNQUICKTHUMBNAILTASK_H +#define C_GLXTNQUICKTHUMBNAILTASK_H + +#include "glxtnloadthumbnailtask.h" +#include "glxthumbnailinfo.h" + +// Forward declarations +class CGlxtnFileUtility; +class CGlxtnVideoUtility; +class CFbsBitmap; + +/** + * Task to quickly produce a thumbnail for an item, usually from the EXIF + * thumbnail. + * + * The task first attempts to extract the EXIF thumbnail data from the file + * using ExifLib. If this succeeds, an instance of CImageDecoder is constructed + * from the data and used to produce a bitmap. + * + * If this fails, an instance of CImageDecoder is constructed from the file, + * and set to use the thumbnail. If this fails, it is assumed that there is no + * EXIF thumbnail in the file, and the decoder is set to scale the main image + * as close as possible to the required thumbnail size. + * + * No scaling or image enhancement is applied to the decoded bitmap. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS( CGlxtnQuickThumbnailTask ) : public CGlxtnLoadThumbnailTask + { +public: + /** + * Two-phased constructor. + * @param aRequestInfo Parameters for the thumbnail request. + * @param aFileUtility File utility for use by the task. + * @param aClient Client initiating the request. + */ + static CGlxtnQuickThumbnailTask* NewL( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); + /** + * Destructor. + */ + ~CGlxtnQuickThumbnailTask(); + +protected: // From CGlxtnTask + + TBool DoStartL(TRequestStatus& aStatus); + void DoCancel(); + TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + +private: + /** + * C++ default constructor. + * @param aRequestInfo Parameters for the thumbnail request. + * @param aFileUtility File utility for use by the task. + * @param aClient Client initiating the request. + */ + CGlxtnQuickThumbnailTask(const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); + + /** + * Start asynchronous decoding process for a low quality thumbnail. + * @param aStatus Request status for the asynchronous operation. + */ + void QuickDecodeL(TRequestStatus& aStatus); + /** + * Decode an image file using thumbnail embedded in the file if possible. + * @param aStatus Request status for the asynchronous operation. + */ + void ReadThumbnailL(TRequestStatus& aStatus); + /** + * Read thumbnail data from the file using ExifLib. + */ + void ReadExifThumbnailL(); + void QuickScaleL(); + +private: + /** Quality of thumbnail (high if loaded, low if generated) */ + TGlxThumbnailQuality iQuality; + /** Utility to get thumbnail from video (owned) */ + CGlxtnVideoUtility* iUtility; + /** Bitmap to hold video frame (owned) */ + CFbsBitmap* iVideoFrame; + /** Whether the media file is a video */ + TBool iVideo; + /** Flag to show BadFileMarker not created so no need to delete **/ + TBool iBadFileMarkerNotNeededFlag; + }; + +#endif // C_GLXTNQUICKTHUMBNAILTASK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnsavethumbnailtask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnsavethumbnailtask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2008-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: Thumbnail save task implementation +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNSAVETHUMBNAILTASK_H +#define GLXTNSAVETHUMBNAILTASK_H + +// INCLUDES + +#include "glxtntask.h" + +// CONSTANTS + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +class CFbsBitmap; +class CImageEncoder; +class CGlxtnFileInfo; + +// CLASS DECLARATION + +/** +* Task to save a generated thumbnail in persistent storage. +* +* @author Dan Rhodes +* @ingroup glx_thumbnail_creator +*/ +NONSHARABLE_CLASS(CGlxtnSaveThumbnailTask) : public CGlxtnTask + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param iItemId Media ID of item whose thumbnail is to be saved. + * @param aFileInfo Information about the media file. + * @param aSize Requested thumbnail size. + * @param aThumbnail Thumbnail bitmap to save. + * @param aStorage Client's storage interface. + */ + static CGlxtnSaveThumbnailTask* NewL( + const TGlxMediaId& aItemId, + CGlxtnFileInfo* aFileInfo, const TSize& aSize, + CFbsBitmap* aThumbnail, MGlxtnThumbnailStorage* aStorage); + + /** + * Destructor. + */ + virtual ~CGlxtnSaveThumbnailTask(); + + protected: // From CGlxtnTask + TBool DoStartL(TRequestStatus& aStatus); + void DoCancel(); + TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + + protected: + /** + * Constructor for derived classes. + * @param aId Task type ID. + * @param iItemId Media ID of item whose thumbnail is to be saved. + * @param aStorage Client's storage interface. + */ + CGlxtnSaveThumbnailTask(const TGlxtnTaskId& aId, + const TGlxMediaId& aItemId, MGlxtnThumbnailStorage* aStorage); + + /** + * Encode the bitmap to a data buffer. + * @param aStatus Request status for the asynchronous operation. + */ + void EncodeThumbnailL(TRequestStatus& aStatus); + /** + * Save buffer to storage. + * @param aStatus Request status for the asynchronous operation. + */ + void SaveThumbnailL(TRequestStatus& aStatus); + + private: + /** + * Constructor. + * @param iItemId Media ID of item whose thumbnail is to be saved. + * @param aSize Requested thumbnail size. + * @param aStorage Client's storage interface. + */ + CGlxtnSaveThumbnailTask(const TGlxMediaId& aItemId, const TSize& aSize, + MGlxtnThumbnailStorage* aStorage); + + /** + * By default Symbian 2nd phase constructor is private. + * @param aFileInfo Information about the media file. + * @param aThumbnail Thumbnail bitmap to save. + */ + void ConstructL(CGlxtnFileInfo* aFileInfo, CFbsBitmap* aThumbnail); + + protected: // Data + /** + * States for the task's state machine. + */ + enum TSaveState + { + EStateEncoding, EStateSaving, EStateFetchingUri, + EStateDecoding, EStateChecking, EStateScaling, EStateFiltering + }; + + /** Requested thumbnail size */ + TSize iSize; + /** Information about the item's media file */ + CGlxtnFileInfo* iFileInfo; + /** Thumbnail bitmap to save (owned) */ + CFbsBitmap* iThumbnail; + /** Current task state */ + TSaveState iState; + + private: // Data + /** Format in which the bitmap was encoded */ + TGlxImageDataFormat iFormat; + /** Encoder for the bitmap (owned) */ + CImageEncoder* iEncoder; + /** Buffer for encoded data (owned) */ + HBufC8* iData; + }; + +#endif // GLXTNSAVETHUMBNAILTASK_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnstd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnstd.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2008-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: Global defs +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + + +#ifndef _GLXTNSTD_H +#define _GLXTNSTD_H + +#include "glxid.h" +#include +class TGlxTasktnIdTypeBase {}; // Don't use this +typedef TGlxId TGlxtnTaskId; // Use this + +// Thumbnail task Ids +const TUint KGlxtnTaskIdGenerateThumbnail = 1; +const TUint KGlxtnTaskIdSaveThumbnail = 2; +const TUint KGlxtnTaskIdBackgroundThumbnailGeneration = 3; +const TUint KGlxtnTaskIdQuickThumbnail = 4; +const TUint KGlxtnTaskIdDeleteThumbnails = 5; +const TUint KGlxtnTaskIdFilterAvailable = 6; +const TUint KGlxtnTaskIdCleanupThumbnails = 7; +const TUint KGlxtnTaskIdZoomedThumbnail = 8; + +// Task priorities +const TInt KGlxTaskPriorityCreateList = CActive::EPriorityStandard + 1; +const TInt KGlxTaskPriorityFetchProperties = KGlxTaskPriorityCreateList - 1; +const TInt KGlxTaskPriorityForegroundThumbnailProvisioning = KGlxTaskPriorityFetchProperties - 1; +const TInt KGlxTaskPriorityFileSystemScan = KGlxTaskPriorityForegroundThumbnailProvisioning - 1; +const TInt KGlxTaskPriorityBackgroundThumbnailProvisioning = EPriorityLow; +const TInt KGlxTaskPriorityBackgroundThumbnailGenerator = EPriorityLow - 1; + +// Thumbnail availablity +const TInt KGlxThumbnailAvailable = 0; +const TInt KGlxThumbnailNotAvailable = 1; + + + +/** + * Thumbnail image formats + */ +enum TGlxImageDataFormat + { + EGlxIDF_Bitmap, // Externalised CFbsBitmap + EGlxIDF_JPEG // Encoded with JPEG format + }; + +#endif // _GLXTNSTD_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtntask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtntask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2008-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: Base classes for multi-purpose tasks. +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNTASK_H +#define C_GLXTNTASK_H + +#include "glxtnstd.h" +#include +#include + +// Forward declarations +class CGlxtnTaskManager; +class MGlxtnThumbnailCreatorClient; +class MGlxtnThumbnailStorage; + +/** + * Base class for thumbnail tasks. + * + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnTask) : public CBase + { + friend class CGlxtnTaskManager; +public: + /** + * Different state a task can go through + */ + enum TState + { + EIdle, /**< Task is not ready to start */ + EStarting, /**< Task is ready to start */ + ERunning, /**< Task is currently running */ + ECanceled, /**< Task has been cancelled, and can be deleted */ + EComplete /**< Task has finished, and can be deleted */ + }; + +public: + CGlxtnTask(const TGlxtnTaskId& aId, const TGlxMediaId& aItemId, + MGlxtnThumbnailStorage* aStorage); + ~CGlxtnTask(); + + /** + * Gets the current task specific state + * @returns TState The task current state. + */ + inline TState State() const; + + /** + * Gets the type of task this is. + * @returns TGlxtnTaskId Task type ID. + */ + inline TGlxtnTaskId Id() const; + + /** + * Gets the media ID of the item to which this task relates. + * @returns TGlxMediaId Media ID. + */ + inline TGlxMediaId ItemId() const; + + /** + * Sets the priority of the task. By default it is set to + * EPriorityStandard. + */ + inline void SetPriority(TInt aPriority); + /** + * Gets the task priority. + * @returns TInt Task priority. + */ + inline TInt Priority() const; + + /** + * Get thumbnail storage for the task to use, if any. + * @returns Pointer to thumbnail storage, or NULL if none. + */ + inline MGlxtnThumbnailStorage* Storage() const; + + /** + * Provides a pointer to the task manager. + * @param aManager Pointer to the task manager. + */ + virtual void SetManager(CGlxtnTaskManager* aManager); + +private: // For CGlxTaskManager only + /** + * Starts the task + */ + void StartL(TRequestStatus& aStatus); + + /** + * Cancels the task + */ + void Cancel(); + + /** + * Runs a bit of the task + */ + void RunL(TRequestStatus& aStatus); + + /** + * Handle a leave in StartL or RunL. + */ + void RunError(TInt aError); + +protected: + /** + * Starts the task. + * @param aStatus Request status for asynchronous operations + * @returns -ETrue if the task has issued an asyncronous request. + * CActive::SetActive() will be called in this case and the + * task state will be ERunning. + * -EFalse if the task has not issued a request. + * SetActive will not be called and the task state will be + * EComplete. + */ + virtual TBool DoStartL(TRequestStatus& aStatus) = 0; + + /** + * Cancels the task. The task's state will be set to ECanceled. + */ + virtual void DoCancel() = 0; + + /** + * Runs a bit of the task + * @param aStatus Request status for asynchronous operations + * @returns -ETrue if the task has issued an asyncronous request. + * CActive::SetActive() will be called in this case and the + * task state will be ERunning. + * -EFalse if the task has not issued a request. + * SetActive will not be called and the task state will be + * EComplete. + */ + virtual TBool DoRunL(TRequestStatus& aStatus) = 0; + + /** + * Handle a leave in StartL or RunL. + * @param aError The error that occurred. + * @returns -ETrue if the task has issued an asyncronous request. + * CActive::SetActive() will be called in this case and the + * task state will be ERunning. + * -EFalse if the task has not issued a request. + * SetActive will not be called and the task state will be + * EComplete. + */ + virtual TBool DoRunError(TInt aError) = 0; + +protected: + /** + * Issues a request and sets the aStatus as KRequestPending + * Use this to make a synchronous operation asynchronous. + */ + void SelfComplete(TRequestStatus& aStatus); + +private: + /** Task state */ + TState iState; + + /** Task id */ + TGlxtnTaskId iId; + + /** Media item id */ + TGlxMediaId iItemId; + + /** + * Priority of this task. + * The task schedule will execute tasks based on this priority + * When this task is run, the execution priority in CActiveScheduler + * will be this priority. (So it is comparable to priorities of active + * objects in the system.) + */ + TInt iPriority; + + /** Thumbnail storage for the task to use (can be NULL) */ + MGlxtnThumbnailStorage* iStorage; + }; + +/** + * Base class for thumbnail tasks which return results to a client. + * + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnClientTask) : public CGlxtnTask + { +protected: + CGlxtnClientTask(const TGlxtnTaskId& aId, const TGlxMediaId& aItemId, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Get the client for this task. + */ + inline MGlxtnThumbnailCreatorClient& Client(); + +private: + /** Client for this task */ + MGlxtnThumbnailCreatorClient& iClient; + }; + +#include "glxtntask.inl" + +#endif // C_GLXTNTASK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtntask.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtntask.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-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: Base classes for multi-purpose tasks. +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +// ----------------------------------------------------------------------------- +// SetPriority +// Gets the current task specific state +// ----------------------------------------------------------------------------- +// +inline CGlxtnTask::TState CGlxtnTask::State() const + { + return iState; + } + +// ----------------------------------------------------------------------------- +// SetPriority +// Gets the type of task this is. +// ----------------------------------------------------------------------------- +// +inline TGlxtnTaskId CGlxtnTask::Id() const + { + return iId; + } + +// ----------------------------------------------------------------------------- +// SetPriority +// Gets the media ID of the item to which this task relates. +// ----------------------------------------------------------------------------- +// +inline TGlxMediaId CGlxtnTask::ItemId() const + { + return iItemId; + } + +// ----------------------------------------------------------------------------- +// SetPriority +// Sets the priority of the task. By default it is set to EPriorityStandard. +// ----------------------------------------------------------------------------- +// +inline void CGlxtnTask::SetPriority(TInt aPriority) + { + iPriority = aPriority; + } + +// ----------------------------------------------------------------------------- +// Priority +// Gets the task priority. +// ----------------------------------------------------------------------------- +// +inline TInt CGlxtnTask::Priority() const + { + return iPriority; + } + +// ----------------------------------------------------------------------------- +// Storage +// Get the thumbnail storage for this task to use, if any. +// ----------------------------------------------------------------------------- +// +inline MGlxtnThumbnailStorage* CGlxtnTask::Storage() const + { + return iStorage; + } + +// ----------------------------------------------------------------------------- +// Client +// Get the client for this task. +// ----------------------------------------------------------------------------- +// +inline MGlxtnThumbnailCreatorClient& CGlxtnClientTask::Client() + { + return iClient; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtntaskmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtntaskmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2008-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: Task manager for multiple tasks. Allows asynchronosity and +* tracking/callback for long running tasks. +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNTASKMANAGER_H +#define C_GLXTNTASKMANAGER_H + +#include "glxtnstd.h" +#include +#include + +// Forward declarations +class CGlxtnTask; +class MGlxtnThumbnailStorage; + +/** + * Active object which maintains a priority queue of long running tasks, and + * provides callback upon task completion or error. + * + * The highest priority task in the queue which has @ref CGlxtnTask::TState "state" + * EStarting is started and the task manager's RunL then delegates to the task's + * RunL until the task is complete, or is cancelled. The task is then deleted + * and another task is started, if any are ready to start. + * + * The task manager's DoCancel and RunError methods also delegate to the current + * task, if any. + * + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnTaskManager) : public CActive + { +public: + enum TExecutionOrder + { + ELastOut, // Old tasks with the same priority get executed before the new task + EFirstOut // New task gets executed before other tasks with the same priority + }; +public: + /** + * Static constructor. + */ + static CGlxtnTaskManager* NewL(); + + /** + * Destructor. + */ + ~CGlxtnTaskManager(); + +public: + /** + * @returns CVieTask task at an index + */ + + inline CGlxtnTask* Task(TInt aIndex) const { return iTasks[aIndex]; }; + + /** + * Returns the highest priority task with the id. + * If there are multiple tasks with same id and priority, + * returns the one of those that will be executed first + */ + CGlxtnTask* Task(const TGlxtnTaskId& aId) const; + + /** + * Adds a task to the task list. If no task is currently running, the task + * is started. + * + * @param aTask Task to add. Takes ownership, task is deleted if a leave occurs. + * + * @param aExecutionOrder -if ELastOut, the tast gets added to the bottom + * of the queue of the tasks with the same priority + * as the new tasks. This means that the task is + * executed after the previously added tasks (with + * same priority) have been run. + * -if EFirstOut, the task gets added to the top, + * and will be executed before the other tasks + * with the same priority (unless more tasks added + * later, of course) + */ + void AddTaskL(CGlxtnTask* aTask, TExecutionOrder aExecutionOrder = ELastOut); + + /** + * Cancel all tasks relating to a given media item. + * @param aItemId ID of media item. + */ + void CancelTasks(const TGlxMediaId& aItemId); + + /** + * Cancel all tasks using a given storage. + * @param aClient Reference to thumbnail storage. + */ + void CancelTasks(MGlxtnThumbnailStorage* aStorage); + + /** + * Gets the total task count + * + * @return TInt task count + */ + inline TInt TaskCount() const { return iTasks.Count(); }; + +protected: + /** + * Constructors + */ + CGlxtnTaskManager(); + void ConstructL(); + +private: // From CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: + /** + * Issue a self-completing request causing RunL to be called. + */ + void AsyncRun(); + +private: + /** + * Task list in priority order + */ + RPointerArray iTasks; + + /** + * Task that is currently being run. + */ + CGlxtnTask* iCurrentTask; + }; + +#endif // C_GLXTNTASKMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2008-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: Thumbnail creator: provides thumbnails and generates on background +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNTHUMBNAILCREATOR_H +#define C_GLXTNTHUMBNAILCREATOR_H + +#include "glxtnstd.h" +#include "glxtntask.h" +#include +#include +#include + +class CGlxtnFileUtility; +class CGlxSettingsModel; +class MGlxtnThumbnailCreatorClient; +class MGlxtnThumbnailStorage; +class TGlxThumbnailRequest; + +/** + * CGlxtnThumbnailCreator + * + * Thumbnail creator is the thumbnail engine, and it loads and generates + * thumbnails on the foreground and generates non-created thumbnails on + * the background + * + * @ingroup glx_thumbnail_creator + */ +class CGlxtnThumbnailCreator : public CBase + { +public: + /** + * Starts the provisioning of a thumbnail. This will result in a callback + * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete(). + */ + IMPORT_C static CGlxtnThumbnailCreator* InstanceL(); + /** + * Decrement the reference count, and delete the instance if the count + * becomes zero. Ensures any tasks using the given storage are cancelled. + * @param aStorage Pointer to storage used by client, or NULL. + */ + IMPORT_C void Close(MGlxtnThumbnailStorage* aStorage); + + /** + * Destructor. + */ + ~CGlxtnThumbnailCreator(); + + /** + * Starts the provisioning of a thumbnail. This will result in a callback + * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete(). + * @param aRequestInfo Parameters for required thumbnail. + * @param aClient Client initiating the request. + */ + IMPORT_C void FetchThumbnailL(const TGlxThumbnailRequest& aRequestInfo, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Starts deleting all stored thumbnails for a given item. This will result + * in a callback to MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete(). + * @param aItemId ID of the media item. + * @param aClient Client initiating the request. + */ + IMPORT_C void DeleteThumbnailsL(const TGlxMediaId& aItemId, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Starts the filtering of items for which a thumbnail is available from a + * list of item IDs. This will result in a callback to + * MGlxtnThumbnailCreatorClient::FilterAvailableComplete(). + * @param aItemArray Array of item IDs, from which those with thumbnails + * should be removed. + * @param aSize Size of thumbnail required. + * @param aClient Client initiating the request. + */ + IMPORT_C void FilterAvailableThumbnailsL( + const TArray& aItemArray, const TSize& aSize, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Starts the cleanup of obsolete thumbnails from storage. There is no + * callback indicating completion of the request. + * @param aStorage Pointer to storage used by client. + */ + IMPORT_C void CleanupThumbnailsL(MGlxtnThumbnailStorage* aStorage); + + /** + * Cancel any ongoing tasks for a given item. This ensures the TNC is not + * locking the media file. + * @param aItemId ID of the media item. + */ + IMPORT_C void CancelRequest(const TGlxMediaId& aItemId); + +private: + CGlxtnThumbnailCreator(); + void ConstructL(); + +private: + /** Task manager */ + CGlxtnTaskManager* iTaskManager; + /** File utility used by the tasks */ + CGlxtnFileUtility* iFileUtility; + /** Reference count of the single instance */ + TInt iReferenceCount; + /** Settings Model used by the background tasks */ + CGlxSettingsModel* iSettingsModel; + }; + +#endif // C_GLXTNTHUMBNAILCREATOR_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2008-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: Represents a thumbnail request +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef T_GLXTHUMBNAILREQUEST_H +#define T_GLXTHUMBNAILREQUEST_H + +#include "glxmediaid.h" +#include "glxthumbnailinfo.h" + +class TGlxThumbnailRequest + { +public: + enum TPriorityMode + { + EPrioritizeSpeed, // Speed of thumbnail provisioning is mode important that quality + EPrioritizeQuality, // Quality of thumbnail provisioning is mode important that speed + }; + +public: + inline TGlxThumbnailRequest(); + + inline TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed); + + inline TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed, + const TRect& aCroppingRect, TGlxThumbnailFilter aFilter); + +public: + TGlxMediaId iId; + TSize iSizeClass; + TPriorityMode iPriorityMode; + TInt iBitmapHandle; // Handle of target bitmap for the thumbnail + TBool iDrmAllowed; // True if client has DRM capability + TRect iCroppingRect; + TGlxThumbnailFilter iFilter; + }; + +#include "glxtnthumbnailrequest.inl" + +#endif // T_GLXTHUMBNAILREQUEST_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Represents a thumbnail request +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +inline TGlxThumbnailRequest::TGlxThumbnailRequest() : + iPriorityMode(EPrioritizeQuality), iBitmapHandle(0), + iDrmAllowed(EFalse), iFilter(EGlxThumbnailFilterNone) + { + } + +inline TGlxThumbnailRequest::TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed) : + iId(aId), iSizeClass(aSizeClass), iPriorityMode(aPriorityMode), + iBitmapHandle(aBitmapHandle), iDrmAllowed(aDrmAllowed), + iFilter(EGlxThumbnailFilterNone) + { + } + +inline TGlxThumbnailRequest::TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed, + const TRect& aCroppingRect, TGlxThumbnailFilter aFilter) : + iId(aId), iSizeClass(aSizeClass), iPriorityMode(aPriorityMode), + iBitmapHandle(aBitmapHandle), iDrmAllowed(aDrmAllowed), + iCroppingRect(aCroppingRect), iFilter(aFilter) + { + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnvideoutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnvideoutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: Utility for creating bitmaps from video files +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNVIDEOUTILITY_H +#define GLXTNVIDEOUTILITY_H + +#include +#ifdef ENABLE_VED +#include +#else +#include +#endif + +class CFbsBitmap; + +/** + * Utility for creating bitmaps from video files + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS( CGlxtnVideoUtility ) : public CBase, +#ifdef ENABLE_VED + public MVedVideoClipInfoObserver, public MVedVideoClipFrameObserver +#else + public MTNEVideoClipInfoObserver, public MTNEVideoClipThumbObserver +#endif + { +public: + /** + * Default constructor. + */ + CGlxtnVideoUtility(); + /** + * Destructor. + */ + ~CGlxtnVideoUtility(); + + /** + * Start asynchronous frame decoding. + * @param aRequestStatus Request status for the asynchronous operation. + * @param aDestination Bitmap in which to store the frame. + * @param aFileName Full name of video file. + */ + void GetVideoFrameL( TRequestStatus* aRequestStatus, + CFbsBitmap*& aDestination, const TDesC& aFileName, + RArray& aTargetSizes, TDisplayMode aMode ); + /** + * Cancel asynchronous frame decoding. + */ + void Cancel(); + +#ifdef ENABLE_VED +private: // From MVedVideoClipInfoObserver + void NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, TInt aError ); + +private: // From MVedVideoClipFrameObserver + void NotifyVideoClipFrameCompleted( CVedVideoClipInfo& aInfo, + TInt aError, CFbsBitmap* aFrame ); +#else +private: // From MTNEVideoClipInfoObserver + void NotifyVideoClipInfoReady( CTNEVideoClipInfo& aInfo, TInt aError ); + +private: // From MTNEVideoClipThumbObserver + void NotifyVideoClipThumbCompleted( CTNEVideoClipInfo& aInfo, + TInt aError, CFbsBitmap* aFrame ); +#endif + +private: +#ifdef ENABLE_VED + CVedVideoClipInfo* iVideoInfo; +#else + CTNEVideoClipInfo* iVideoInfo; +#endif + /** Client's request status */ + TRequestStatus* iRequestStatus; + /** Pointer to variable to hold returned frame */ + CFbsBitmap** iDestination; + TSize iSize; + TDisplayMode iDisplayMode; + }; + +#endif // GLXTNVIDEOUTILITY_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnvolumedatabase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnvolumedatabase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,257 @@ +/* +* Copyright (c) 2008-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: Definition of CGlxtnVolumeDatabase +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef GLXTNVOLUMEDATABASE_H +#define GLXTNVOLUMEDATABASE_H + +#include +#include // For RDbStoreDatabase +#include // For TDriveName + +#include +#include "glxtnstd.h" // For TGlxImageDataFormat +#include "mglxtnvolumedatabaseobserver.h" // For TGlxtnThumbnailId + +class CFileStore; +class CGlxtnFileInfo; +class MGlxtnVolumeDatabaseObserver; + +const TInt KErrCorruptThumbnailDatabase = -10001; +const TInt KErrEofThumbnailDatabase = -10002; + +/** + * CGlxtnVolumeDatabase implements the database for a single volume. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnVolumeDatabase) : public CActive + { +public: + /** + * Static constructor. + * @param aObserver Observer of database operations. + * @param aFs File server handle. + * @param aPath Full path to the database file to use. + */ + static CGlxtnVolumeDatabase* NewLC(MGlxtnVolumeDatabaseObserver& aObserver, + RFs& aFs, + const TDesC& aPath); + + /** + * Destructor + */ + ~CGlxtnVolumeDatabase(); + + /** + * Get the drive this database is stored on + */ + const TDesC& Drive() const; + + /** + * Look up thumbnail ID from Ids table + * @param aMediaId Media item ID. + */ + void GetThumbnailIdL( const TGlxMediaId& aMediaId ); + + /** + * Look up thumbnail ID from Items table. If not found, add new record. + * @param aInfo File info for media item. + */ + void GetThumbnailIdL(const CGlxtnFileInfo* aInfo); + + /** + * Retrieve the thumbnail id to be assigned to the next thumbnail that gets stored in teh database. + * @param None. + */ + TGlxtnThumbnailId GetThumbnailId(); + + /** + * Add record to Ids table + * @param aMediaId Media item ID. + * @param aThumbId Thumbnail ID. + */ + void StoreThumbnailIdL( const TGlxMediaId& aMediaId, + const TGlxtnThumbnailId& aThumbId ); + /** + * Look up thumbnail from Thumbnails table + * @param aThumbId Thumbnail ID. + * @param aSize Thumbnail size. + */ + void GetThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize ); + /** + * Check if a particular thumbnail is in Thumbnails table + * @param aThumbId Thumbnail ID. + * @param aSize Thumbnail size. + */ + void CheckAvailableL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize ); + /** + * Add record to Thumbnails table + * @param aThumbId Thumbnail ID. + * @param aSize Thumbnail size. + * @param aFormat Thumbnail data format. + * @param aData Thumbnail binary data. + */ + void StoreThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize, + TGlxImageDataFormat aFormat, const TDesC8& aData ); + + /** + * Add record to Items table, if not found. + * @param aThumbId Thumbnail Id. + * @param aInfo File info for media item. + */ + void StoreItemsL( const TGlxtnThumbnailId& aThumbId, const CGlxtnFileInfo* aInfo ); + + /** + * Initialize thumbnail identifier to the last known value plus one. + */ + void InitializeThumbIdL(); + + /** + * Delete a record from the Ids table + * @param aMediaId MediaId of record to delete. + */ + void DeleteIdL( const TGlxMediaId& aMediaId ); + + /** + * Delete a record from the Thumbnails table + * @param aThumbId ThumbId of records to delete. + */ + void DeleteThumbnailsL( const TGlxtnThumbnailId& aThumbId ); + + /** + * Delete a record from the Items table + * @param aThumbId ThumbId of record to delete. + */ + void DeleteItemL( const TGlxtnThumbnailId& aThumbId ); + + /** + * Cleanup Database (remove entries that do not have corresponding file) + */ + void CleanupDatabaseL(); + +protected: // From CActive + void DoCancel(); + void RunL(); + TInt RunError(TInt aError); + +private: + /** + * Default constructor. + * @param aObserver Observer of database operations. + * @param aFs File server handle. + */ + CGlxtnVolumeDatabase(MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs); + /** + * 2nd phase constructor. + * @param aPath Full path to the database file to use. + */ + void ConstructL(const TDesC& aPath); + + /** + * Open an existing database. + * @param aFs File server handle. + * @param aPath Full path to the database file to use. + */ + void OpenDbL(RFs& aFs, const TDesC& aFilename); + + /** + * Create a new database. + * @param aFs File server handle. + * @param aPath Full path to the database file to use. + */ + void CreateDbL(RFs& aFs, const TDesC& aFilename); + + /** + * Add record to Items table + * @return Thumbnail ID of new record. + */ + TGlxtnThumbnailId DoAddItemL(); + + /** + * Evaluate a view based on a SQL query. + * @param aQuery The SQL select statement. + */ + void EvaluateQueryL( const TDbQuery &aQuery ); + + /** + * Execute a SQL data update statement. + * @param aSql The SQL statement. + */ + void UpdateDataL( const TDesC& aSql ); + + /** + * Test and cleanup a row in Items table + */ + void CleanupRowL(); + + /** + * Modify SQL string to handle quotes correctly + * @param aText String to be modified + * @return New HBufC containing modified string + */ + HBufC* QuoteSqlStringLC(const TDesC& aText); + +private: + enum TDatabaseState + { + EStateIdle, + EStateGettingIdFromMediaId, + EStateGettingIdFromFilename, + EStateGettingThumbnail, + EStateDeletingId, + EStateDeletingThumbnails, + EStateDeletingItem, + EStateCheckingAvailability, + EStateCleaning, + EStateCleaningDeletingThumbnails + }; + + /** Observer of this database */ + MGlxtnVolumeDatabaseObserver& iObserver; + /** File server session */ + RFs& iFs; + /** Drive name of the volume */ + TDriveName iDrive; + /** Handle to the database */ + RDbStoreDatabase iDatabase; + /** Store used by the database */ + CFileStore* iStore; + /** ID for next stored thumbnail */ + TUint iNextThumbId; + /** File info for media item current query relates to (not owned) */ + const CGlxtnFileInfo* iInfo; + /** Current state */ + TDatabaseState iState; + /** View used for current query */ + RDbView iView; + /** Updater to update a table */ + RDbUpdate iDbUpdater; + /** Table used for query/deletion of rows in table */ + RDbTable iTable; + /** Flag to determine if cleanup operation did anything requiring compacting */ + TBool iItemsCleaned; + }; + +#endif // GLXTNVOLUMEDATABASE_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnzoomedimagetask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnzoomedimagetask.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2008-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: Task to generate a cropped thumbnail for a JPEG image. +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + + +#ifndef C_GLXTNZOOMEDIMAGETASK_H +#define C_GLXTNZOOMEDIMAGETASK_H + +#include "glxtntask.h" + +#include // For TGlxThumbnailFilter + +class CGlxtnFileInfo; +class CGlxtnFileUtility; +class TGlxThumbnailRequest; +class CFbsBitmap; +class CExtJpegDecoder; + +/** + * Task to generate a cropped thumbnail for a JPEG image. + * + * @ingroup glx_thumbnail_creator + */ +NONSHARABLE_CLASS(CGlxtnZoomedImageTask) : public CGlxtnClientTask + { +public: + /** + * Two-phased constructor. + */ + static CGlxtnZoomedImageTask* NewL( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); + ~CGlxtnZoomedImageTask(); + +protected: // From CGlxtnTask + virtual TBool DoStartL(TRequestStatus& aStatus); + virtual void DoCancel(); + virtual TBool DoRunL(TRequestStatus& aStatus); + TBool DoRunError(TInt aError); + +private: + CGlxtnZoomedImageTask(const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); + void ConstructL(TInt aBitmapHandle); + + void DecodePartialImageL(TRequestStatus& aStatus); + void CreateDecoderL(TInt aDecoderType); + +private: + enum TTaskState + { + EStateFetchingUri, EStateDecoding, EStateProcessing + }; + + /** File utility (not owned) */ + CGlxtnFileUtility& iFileUtility; + /** File information for item to thumbnail */ + CGlxtnFileInfo* iInfo; + /** Current state for task state machine */ + TTaskState iState; + /** Bitmap for the generated thumbnail */ + CFbsBitmap* iThumbnail; + /** Decoder for the JPEG file */ + CExtJpegDecoder* iDecoder; + /** Requested thumbnail size */ + TSize iRequestedSize; + /** Part of image to keep */ + TRect iCroppingRect; + /** Filtering to apply to generated image */ + TGlxThumbnailFilter iFilter; + /** DRM allowed flag passed from thumbnail request */ + TBool iDrmAllowed; + /** Whether current file is DRM protected */ + TBool iProtected; + }; + +#endif // C_GLXTNZOOMEDIMAGETASK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/mglxtnstorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/mglxtnstorage.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008-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: Thumbnail storage interface +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef M_GLXTNSTORAGE_H +#define M_GLXTNSTORAGE_H + +// INCLUDES + +#include +#include +#include "glxtnstd.h" + +class CGlxtnFileInfo; + +// CLASS DECLARATION + +/** +* Interface for thumbnail persistent storage. +* +* @ingroup glx_thumbnail_creator +*/ +class MGlxtnThumbnailStorage + { +public: + /** + * Start asynchronous loading of thumbnail data. + * @param aData Buffer pointer for the loaded data. Memory is allocated + internally and ownership passed to the caller. + * @param aFormat Format of the thumbnail in aData. + * @param aId Media item ID. + * @param aFileInfo File info for media item. + * @param aSize Requested thumbnail size. + * @param aStatus Request status for the asynchronous operation. + */ + virtual void LoadThumbnailDataL(HBufC8*& aData, + TGlxImageDataFormat& aFormat, const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, const TSize& aSize, + TRequestStatus* aStatus) = 0; + /** + * Start asynchronous saving of thumbnail data. + * @param aData Buffer containing the data to be saved. + * @param aFormat Format of the thumbnail in aData. + * @param aId Media item ID. + * @param aFileInfo File info for media item. + * @param aSize Requested thumbnail size. + * @param aStatus Request status for the asynchronous operation. + */ + virtual void SaveThumbnailDataL(const TDesC8& aData, + TGlxImageDataFormat aFormat, const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, const TSize& aSize, + TRequestStatus* aStatus) = 0; + /** + * Start asynchronous deletion of all saved thumbnails for an item. + * @param aId Media item ID. + * @param aFileInfo File info for media item. + * @param aStatus Request status for the asynchronous operation. + */ + virtual void DeleteThumbnailsL(const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus) = 0; + /** + * Start asynchronous deletion of all saved thumbnails for items which no + * longer exist. + * @param aStatus Request status for the asynchronous operation. + */ + virtual void CleanupThumbnailsL(TRequestStatus* aStatus) = 0; + /** + * Test whether a given thumbnail is available in storage. + * @param aId Media item ID. + * @param aFileInfo File info for media item. + * @param aSize Requested thumbnail size. + * @param aStatus Request status for the asynchronous operation. + */ + virtual void IsThumbnailAvailableL(const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, + const TSize& aSize, TRequestStatus* aStatus) = 0; + /** + * Cancel an ongoing asynchronous operation. + */ + virtual void StorageCancel() = 0; + /** + * Notify that an error occurred in background generation. + * @param aId Media item ID. + * @param aError Error code. + */ + virtual void NotifyBackgroundError(const TGlxMediaId& aId, TInt aError) = 0; + }; + +/** +* Interface for notification of thumbnails becoming available in storage. +* +* @ingroup glx_thumbnail_creator +*/ +class MGlxtnThumbnailStorageObserver + { +public: + /** + * Notify that a given thumbnail is available in storage. + * @param aId Media item ID. + * @param aSize Requested thumbnail size. + */ + virtual void ThumbnailAvailable(const TGlxMediaId& aId, const TSize& aSize) = 0; + /** + * Notify that an error occurred in background generation. + * @param aId Media item ID. + * @param aError Error code. + */ + virtual void BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError) = 0; + }; + +#endif // M_GLXTNSTORAGE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/mglxtnthumbnailcreatorclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/mglxtnthumbnailcreatorclient.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008-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: Thumbnail creator client interface +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef M_GLXTNTHUMBNAILCREATORCLIENT_H +#define M_GLXTNTHUMBNAILCREATORCLIENT_H + +// INCLUDES + +#include +#include + +// FUNCTION PROTOTYPES + +class CGlxtnFileInfo; +class MGlxtnThumbnailStorage; +class TGlxMediaId; + +// CLASS DECLARATION + +/** +* Interface for clients of the TNC. +* +* @ingroup glx_thumbnail_creator +*/ +class MGlxtnThumbnailCreatorClient + { +public: + /** + * Notifies that a thumbnail for a given item is available, or that + * thumbnail generation failed. + * @param aItemId The item for which the thumbnail was required. + * @param aQuality quality of the thumbnail + * @param aErrorCode KErrNone if successful, otherwise an error code. + */ + virtual void ThumbnailFetchComplete(const TGlxMediaId& aItemId, + TGlxThumbnailQuality aQuality, TInt aErrorCode) = 0; + /** + * Notifies that deletion of thumbnails for a given item is complete, or + * the operation failed. + * @param aItemId The item whose thumbnails were deleted. + * @param aErrorCode KErrNone if successful, otherwise an error code. + */ + virtual void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, + TInt aErrorCode) = 0; + /** + * Notifies that filtering items with available thumbnails from a list is + * complete, or the operation failed. + * @param aIdArray Array of IDs of items which don't have a thumbnail + * available. + * @param aErrorCode KErrNone if successful, otherwise an error code. + */ + virtual void FilterAvailableComplete(const RArray& aIdArray, + TInt aErrorCode) = 0; + /** + * Called by a task to request file information for an item. The + * information is returned asynchronously. + * @param aInfo Buffer to hold the information. + * @param aItemId The item for which the URI is required. + * @param aStatus Request status for the asynchronous operation. + */ + virtual void FetchFileInfoL(CGlxtnFileInfo* aInfo, + const TGlxMediaId& aItemId, TRequestStatus* aStatus) = 0; + /** + * Cancel the request for an URI. + * @param aItemId The item for which the URI was required. + */ + virtual void CancelFetchUri(const TGlxMediaId& aItemId) = 0; + /** + * Get the thumbnail storage used by this client. + * @return Pointer to the storage. + */ + virtual MGlxtnThumbnailStorage* ThumbnailStorage() = 0; + }; + +#endif // M_GLXTNTHUMBNAILCREATORCLIENT_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/mglxtnvolumedatabaseobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/mglxtnvolumedatabaseobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008-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: Definition of CGlxtnVolumeDatabase +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef M_GLXTNVOLUMEDATABASEOBSERVER_H +#define M_GLXTNVOLUMEDATABASEOBSERVER_H + +#include "glxtnstd.h" // For TGlxImageDataFormat + +/** + * Typesafe thumbnail ID. + */ +class TGlxtnThumbnailIdTypeBase {}; // Don't use this +typedef TGlxId TGlxtnThumbnailId; // Use this + +/** + * Interface to receive callbacks from a CGlxtnVolumeDatabase. + * + * @author Dan Rhodes + * @ingroup glx_thumbnail_creator + */ +class MGlxtnVolumeDatabaseObserver + { +public: + /** + * Called when a database operation cannot be completed. + * @param aError Error code. + */ + virtual void HandleDatabaseError(TInt aError) = 0; + /** + * Called when a thumbnail ID has been found in the Ids table. + * @param aThumbId Thumbnail ID for the media item. + */ + virtual void HandleThumbnailIdFromMediaIdL( + const TGlxtnThumbnailId& aThumbId ) = 0; + /** + * Called when a thumbnail ID has been found in the Items table. + * @param aThumbId Thumbnail ID for the media item. + */ + virtual void HandleThumbnailIdFromFilenameL( + const TGlxtnThumbnailId& aThumbId ) = 0; + /** + * Called when a thumbnail ID has been saved in the Ids table. + */ + virtual void HandleThumbnailIdStoredL() = 0; + /** + * Called when a thumbnail has been found in the Thumbnails table. + * @param aFormat Thumbnail data format. + * @param aData Thumbnail binary data (ownership passed). + */ + virtual void HandleThumbnail(TGlxImageDataFormat aFormat, HBufC8* aData) = 0; + /** + * Called when a thumbnail has been saved in the Thumbnails table. + */ + virtual void HandleThumbnailStored() = 0; + /** + * Called when a record has been deleted from a Ids table. + */ + virtual void HandleMediaIdDeletedL() = 0; + /** + * Called when records have been deleted from a Thumbnails table. + */ + virtual void HandleThumbnailsDeletedL() = 0; + /** + * Called when a record has been deleted from a Items table. + */ + virtual void HandleItemDeletedL() = 0; + /** + * Called when availability has been chaecked. + * @param aResult The result of the check. + */ + virtual void HandleAvailabilityChecked(TInt aResult) = 0; + /** + * Called after the database has been cleaned up. + */ + virtual void HandleDatabaseCleanedL() = 0; + }; + +#endif // M_GLXTNVOLUMEDATABASEOBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnbackgroundgenerationtask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnbackgroundgenerationtask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,421 @@ +/* +* Copyright (c) 2008-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: Thumbnail background generation task implementation +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +// INCLUDE FILES + +#include "glxtnbackgroundgenerationtask.h" + +#include +#include +#include +#include +#include +#include // For feature constants + +#include "glxtnfileinfo.h" +#include "glxtnfileutility.h" +#include "glxtnimageutility.h" +#include "glxtnvideoutility.h" +#include "mglxtnstorage.h" +#include "mglxtnthumbnailcreatorclient.h" + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CGlxtnBackgroundGenerationTask::CGlxtnBackgroundGenerationTask +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CGlxtnBackgroundGenerationTask::CGlxtnBackgroundGenerationTask( + const TGlxMediaId& iItemId, CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient, + CGlxSettingsModel::TSupportedOrientations aSupportedOrientations) : + CGlxtnSaveThumbnailTask(KGlxtnTaskIdBackgroundThumbnailGeneration, + iItemId, aClient.ThumbnailStorage()), + iClient(&aClient), iFileUtility(aFileUtility), + iSupportedOrientations(aSupportedOrientations) + { + TRACER("CGlxtnBackgroundGenerationTask::CGlxtnBackgroundGenerationTask()"); + // Background task is always low priority + SetPriority(EPriorityLow); + } + +// ----------------------------------------------------------------------------- +// CGlxtnBackgroundGenerationTask::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxtnBackgroundGenerationTask::ConstructL() + { + TRACER("void CGlxtnBackgroundGenerationTask::ConstructL()"); + iImageUtility = new (ELeave) CGlxtnImageUtility(iFileUtility.FsSession()); + LayoutSpecificDataL(); + + } + +// ----------------------------------------------------------------------------- +// CGlxtnBackgroundGenerationTask::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CGlxtnBackgroundGenerationTask* CGlxtnBackgroundGenerationTask::NewL( + const TGlxMediaId& iItemId, CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient, + CGlxSettingsModel::TSupportedOrientations aSupportedOrientations) + { + TRACER("CGlxtnBackgroundGenerationTask* CGlxtnBackgroundGenerationTask::NewL()"); + CGlxtnBackgroundGenerationTask* self + = new (ELeave) CGlxtnBackgroundGenerationTask( + iItemId, aFileUtility, aClient, + aSupportedOrientations); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// Destructor +CGlxtnBackgroundGenerationTask::~CGlxtnBackgroundGenerationTask() + { + TRACER("Destructor CGlxtnBackgroundGenerationTask::~CGlxtnBackgroundGenerationTask()"); + delete iImageUtility; + delete iVideoUtility; + delete iImage; + delete iFilteredImage; + iSizes.Close(); + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnBackgroundGenerationTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("CGlxtnBackgroundGenerationTask::DoStartL()"); + // Sizes to generate, largest first + + + iSizes.AppendL(iGridIconSize); + if( CGlxSettingsModel::ELandscapeAndPortrait == iSupportedOrientations ) + { + iSizes.AppendL(iCoverflowIconSize); + iSizes.AppendL(TSize(iCoverflowIconSize.iHeight, iCoverflowIconSize.iWidth)); + } + else if(CGlxSettingsModel::ELandscape == iSupportedOrientations) + { + iSizes.AppendL(iCoverflowIconSize); + } + else + { + iSizes.AppendL(TSize(iCoverflowIconSize.iHeight, iCoverflowIconSize.iWidth)); + } + + iFileInfo = new (ELeave) CGlxtnFileInfo; + iClient->FetchFileInfoL(iFileInfo, ItemId(), &aStatus); + iState = EStateFetchingUri; + + return ETrue; // Request has been issued + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnBackgroundGenerationTask::DoCancel() + { + TRACER("void CGlxtnBackgroundGenerationTask::DoCancel()"); + CGlxtnSaveThumbnailTask::DoCancel(); + + Storage()->NotifyBackgroundError(ItemId(), KErrCancel); + + if ( iClient && EStateFetchingUri == iState ) + { + iClient->CancelFetchUri(ItemId()); + } + + iImageUtility->Cancel(); + + if ( iVideoUtility ) + { + iVideoUtility->Cancel(); + } + + iFileUtility.ClearBadFileMarker(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnBackgroundGenerationTask::DoRunL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnBackgroundGenerationTask::DoRunL()"); + User::LeaveIfError(aStatus.Int()); + + TBool active = EFalse; + + switch ( iState ) + { + case EStateFetchingUri: + { + iImageDecoded = EFalse; + iBadFileMarkerNotNeededFlag = ETrue; + // Client is no longer needed + iClient->ThumbnailFetchComplete(ItemId(), + EGlxThumbnailQualityHigh, KErrNone); + iClient = NULL; + + User::LeaveIfNull(iFileInfo); + + TBool isVideo, isProtected; + iFileInfo->IdentifyFileL(isVideo, isProtected); + // if DRM protected leave + // assume DRM capablity not present + if(isProtected) + { + User::Leave(KErrAccessDenied); + } + + active = CheckNextL(aStatus); + } + break; + + case EStateDecoding: + iImageUtility->FreeDecoder(); + iImageDecoded = ETrue; + FilterThumbnailL(aStatus); + active = ETrue; + break; + + case EStateFiltering: + ScaleThumbnailL(aStatus); + active = ETrue; + break; + + case EStateSaving: + active = ProcessNextL(aStatus); + break; + + case EStateChecking: + if ( KGlxThumbnailNotAvailable == aStatus.Int() ) + { + iTodoSizes.AppendL(iSize); + } + active = CheckNextL(aStatus); + break; + + case EStateScaling: + EncodeThumbnailL(aStatus); + active = ETrue; + break; + + case EStateEncoding: + SaveThumbnailL(aStatus); + active = ETrue; + break; + + default: + GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), + "CGlxtnBackgroundGenerationTask: Illegal state" ); + break; + } + + if ( !active ) + { + if( !iBadFileMarkerNotNeededFlag ) + { + iFileUtility.ClearBadFileMarker(); + } + // Send notification that we've finished + Storage()->NotifyBackgroundError( ItemId(), KErrNone ); + } + + return active; // Task is complete + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnBackgroundGenerationTask::DoRunError(TInt aError) + { + TRACER("CGlxtnBackgroundGenerationTask::DoRunError()"); + if( !iBadFileMarkerNotNeededFlag ) + { + iFileUtility.ClearBadFileMarker(); + } + if ( iClient ) + { + iClient->ThumbnailFetchComplete( + ItemId(), EGlxThumbnailQualityHigh, aError); + } + else + { + Storage()->NotifyBackgroundError(ItemId(), aError); + } + + return EFalse; // Task is complete + } + +// ----------------------------------------------------------------------------- +// CheckNextL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnBackgroundGenerationTask::CheckNextL(TRequestStatus& aStatus) + { + TRACER("CGlxtnBackgroundGenerationTask::CheckNextL()"); + if ( iSizes.Count() == 0 ) + { + return ProcessNextL(aStatus); + } + + iSize = iSizes[0]; + iSizes.Remove(0); + + Storage()->IsThumbnailAvailableL(ItemId(), *iFileInfo, iSize, &aStatus); + iState = EStateChecking; + return ETrue; + } + +// ----------------------------------------------------------------------------- +// ProcessNextL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnBackgroundGenerationTask::ProcessNextL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnBackgroundGenerationTask::ProcessNextL()"); + if ( iTodoSizes.Count() == 0 ) + { + return EFalse; + } + + iSize = iTodoSizes[0]; + if( iImageDecoded ) + { + FilterThumbnailL(aStatus); + } + else + { + DecodeImageL(aStatus); + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// FilterThumbnailL +// ----------------------------------------------------------------------------- +// +void CGlxtnBackgroundGenerationTask::FilterThumbnailL(TRequestStatus& aStatus) + { + TRACER("void CGlxtnBackgroundGenerationTask::FilterThumbnailL()"); + // Create thumbnail bitmap of required size + TSize targetSize(iTodoSizes[0]); + iTodoSizes.Remove(0); + iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); + + delete iThumbnail; + iThumbnail = NULL; + iThumbnail = new (ELeave) CFbsBitmap; + User::LeaveIfError(iThumbnail->Create(targetSize, KGlxThumbnailDisplayMode)); + + iImageUtility->FilterImageL(&aStatus, iImage, iFilteredImage, iThumbnail); + iState = EStateFiltering; + } + +// ----------------------------------------------------------------------------- +// ScaleThumbnailL +// ----------------------------------------------------------------------------- +// +void CGlxtnBackgroundGenerationTask::ScaleThumbnailL(TRequestStatus& aStatus) + { + TRACER("void CGlxtnBackgroundGenerationTask::ScaleThumbnailL()"); + TSize targetSize(iSize); + const TSize srcSize = iImage->SizeInPixels(); + iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); + iImageUtility->ScaleImageL(aStatus, *iImage, srcSize, *iThumbnail, targetSize); + iState = EStateScaling; + } + +// ----------------------------------------------------------------------------- +// DecodeImageL +// ----------------------------------------------------------------------------- +// +void CGlxtnBackgroundGenerationTask::DecodeImageL(TRequestStatus& aStatus) + { + TRACER("void CGlxtnBackgroundGenerationTask::DecodeImageL()"); + iBadFileMarkerNotNeededFlag = EFalse; + iFileUtility.CheckBadFileListL( iFileInfo->FilePath() ); + TBool isVideo, isProtected; + iFileInfo->IdentifyFileL(isVideo, isProtected); + if ( isVideo ) + { + iVideoUtility = new (ELeave) CGlxtnVideoUtility; + iVideoUtility->GetVideoFrameL(&aStatus, iImage, + iFileInfo->FilePath(), iTodoSizes, KGlxThumbnailDisplayMode); + } + else + { + iImage = iImageUtility->DecodeImageL(aStatus, + iFileInfo->FilePath(), iTodoSizes, KGlxThumbnailDisplayMode); + } + delete iFilteredImage; + iFilteredImage = NULL; + iState = EStateDecoding; + } +// ----------------------------------------------------------------------------- +// LayoutSpecificDataL +// ----------------------------------------------------------------------------- +// +void CGlxtnBackgroundGenerationTask::LayoutSpecificDataL() + { + TRACER("void CGlxtnBackgroundGenerationTask::LayoutSpecificDataL()"); + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + + if(FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch )) + { + iGridIconSize = TSize(111,83); + iCoverflowIconSize = TSize(640,360); + } + else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640)) + { + iGridIconSize = TSize(146,110); + iCoverflowIconSize = TSize(640,480); + } + else + { + iGridIconSize = TSize(146,110); + iCoverflowIconSize = TSize(640,480); + } + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + + + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtncleanuptask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtncleanuptask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2008-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: Thumbnail storage cleanup task implementation +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +// INCLUDE FILES + +#include "glxtncleanuptask.h" + +#include +#include + +#include "mglxtnstorage.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CGlxtnCleanupTask::CGlxtnCleanupTask +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CGlxtnCleanupTask::CGlxtnCleanupTask(MGlxtnThumbnailStorage* aStorage) : + CGlxtnTask(KGlxtnTaskIdCleanupThumbnails, KGlxIdNone, aStorage) + { + TRACER("CGlxtnCleanupTask::CGlxtnCleanupTask(MGlxtnThumbnailStorage* aStorage)"); + GLX_ASSERT_ALWAYS( aStorage, Panic( EGlxPanicIllegalArgument ), + "CGlxtnCleanupTask created without storage" ); + + // Background task is always low priority + SetPriority(EPriorityLow); + } + +// ----------------------------------------------------------------------------- +// CGlxtnCleanupTask::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxtnCleanupTask::ConstructL() + { + TRACER("void CGlxtnCleanupTask::ConstructL()"); + } + +// ----------------------------------------------------------------------------- +// CGlxtnCleanupTask::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CGlxtnCleanupTask* CGlxtnCleanupTask::NewL(MGlxtnThumbnailStorage* aStorage) + { + TRACER("CGlxtnCleanupTask* CGlxtnCleanupTask::NewL(MGlxtnThumbnailStorage* aStorage)"); + CGlxtnCleanupTask* self = new (ELeave) CGlxtnCleanupTask(aStorage); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +// Destructor +CGlxtnCleanupTask::~CGlxtnCleanupTask() + { + TRACER("Destructor CGlxtnCleanupTask::~CGlxtnCleanupTask()"); + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnCleanupTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnCleanupTask::DoStartL(TRequestStatus& aStatus)"); + Storage()->CleanupThumbnailsL(&aStatus); + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnCleanupTask::DoCancel() + { + TRACER("void CGlxtnCleanupTask::DoCancel()"); + Storage()->StorageCancel(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnCleanupTask::DoRunL(TRequestStatus& /*aStatus*/) + { + TRACER("TBool CGlxtnCleanupTask::DoRunL(TRequestStatus& /*aStatus*/)"); + return EFalse; // Task is complete + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnCleanupTask::DoRunError(TInt /*aError*/) + { + TRACER("TBool CGlxtnCleanupTask::DoRunError(TInt /*aError*/)"); + return EFalse; // Task is complete + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtndatabase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtndatabase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,757 @@ +/* +* Copyright (c) 2008-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: Thumbnail storage implementation +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +// INCLUDE FILES + +#include "glxtndatabase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxtnfileinfo.h" +#include "glxtnvolumedatabase.h" + +// ============================ CONSTANTS =============================== +_LIT(KDriveNameFormat, "%c:\\"); + +const TInt KLoggingDriveLetterLength = 8; +const TInt KGlxmediaSerialIdLength = 64; +const TUint32 KGlxTnMassStorageNotFreshlyFlashed = 0x00000001 ; +const TUint32 KGlxTnSDCardVolumeId = 0x00000001 ; +const TUint32 KGlxTnHardDriveFlashState = 0x00000002 ; + +const TInt KRepositoryId = 0x2000A09 ; + + +// ----------------------------------------------------------------------------- +// CGlxtnThumbnailDatabase::CGlxtnThumbnailDatabase +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CGlxtnThumbnailDatabase::CGlxtnThumbnailDatabase() + { + TRACER("CGlxtnThumbnailDatabase::CGlxtnThumbnailDatabase()"); + iInternalDrive = PathInfo::PhoneMemoryRootPath().Left( KMaxDriveName ); + } + +// ----------------------------------------------------------------------------- +// CGlxtnThumbnailDatabase::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::ConstructL(const TDesC& aDbFilename, + MGlxtnThumbnailStorageObserver* aStorageObserver) + { + TRACER("void CGlxtnThumbnailDatabase::ConstructL()"); + User::LeaveIfError(iFs.Connect()); + + User::LeaveIfError(iFs.PrivatePath(iDatabasePath)); + iDatabasePath.Append(aDbFilename); + iStorageObserver = aStorageObserver; + } + +// ----------------------------------------------------------------------------- +// CGlxtnThumbnailDatabase::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxtnThumbnailDatabase* CGlxtnThumbnailDatabase::NewL( + const TDesC& aDbFilename, + MGlxtnThumbnailStorageObserver* aStorageObserver) + { + TRACER("CGlxtnThumbnailDatabase* CGlxtnThumbnailDatabase::NewL()"); + CGlxtnThumbnailDatabase* self = new (ELeave) CGlxtnThumbnailDatabase; + + CleanupStack::PushL(self); + self->ConstructL(aDbFilename, aStorageObserver); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnThumbnailDatabase::~CGlxtnThumbnailDatabase() + { + TRACER("CGlxtnThumbnailDatabase::~CGlxtnThumbnailDatabase()"); + iDatabaseArray.ResetAndDestroy(); + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// LoadThumbnailDataL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::LoadThumbnailDataL(HBufC8*& aData, + TGlxImageDataFormat& aFormat, const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, const TSize& aSize, + TRequestStatus* aStatus) + { + TRACER("void CGlxtnThumbnailDatabase::LoadThumbnailDataL()"); + if ( iClientStatus ) + { + User::Leave(KErrNotReady); + } + + iCurrentOperation = ELoading; + iLoadData = &aData; + iLoadFormat = &aFormat; + iMediaId = aId; + iFileInfo = &aFileInfo; + iSize = aSize; + + OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); + + iClientStatus = aStatus; + *iClientStatus = KRequestPending; + } + +// ----------------------------------------------------------------------------- +// SaveThumbnailDataL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::SaveThumbnailDataL(const TDesC8& aData, + TGlxImageDataFormat aFormat, const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, const TSize& aSize, + TRequestStatus* aStatus) + { + TRACER("void CGlxtnThumbnailDatabase::SaveThumbnailDataL()"); + if ( iClientStatus ) + { + User::Leave(KErrNotReady); + } + + iCurrentOperation = ESaving; + iSaveData.Set(aData); + ASSERT(iSaveData.Length() == aData.Length()); + iSaveFormat = aFormat; + iMediaId = aId; + iFileInfo = &aFileInfo; + iSize = aSize; + + OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); + + iClientStatus = aStatus; + *iClientStatus = KRequestPending; + } + +// ----------------------------------------------------------------------------- +// DeleteThumbnailsL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::DeleteThumbnailsL(const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus) + { + TRACER("void CGlxtnThumbnailDatabase::DeleteThumbnailsL()"); + if ( iClientStatus ) + { + User::Leave(KErrNotReady); + } + iCurrentOperation = EDeleting; + iMediaId = aId; + iFileInfo = &aFileInfo; + + OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); + + iClientStatus = aStatus; + *iClientStatus = KRequestPending; + } + +// ----------------------------------------------------------------------------- +// CleanupThumbnailsL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::CleanupThumbnailsL(TRequestStatus* aStatus) + { + TRACER("void CGlxtnThumbnailDatabase::CleanupThumbnailsL()"); + if ( iClientStatus ) + { + User::Leave(KErrNotReady); + } + + OpenDatabaseL( iInternalDrive ); + GLX_ASSERT_ALWAYS( iDatabaseArray.Count() > 0, + Panic( EGlxPanicLogicError ), "No databases to clean" ); + + iDatabaseIndex = 0; + iDatabaseArray[iDatabaseIndex]->CleanupDatabaseL(); + + iClientStatus = aStatus; + *iClientStatus = KRequestPending; + } + +// ----------------------------------------------------------------------------- +// IsThumbnailAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::IsThumbnailAvailableL(const TGlxMediaId& aId, + const CGlxtnFileInfo& aFileInfo, + const TSize& aSize, TRequestStatus* aStatus) + { + TRACER("void CGlxtnThumbnailDatabase::IsThumbnailAvailableL()"); + if ( iClientStatus ) + { + User::Leave(KErrNotReady); + } + + iCurrentOperation = ECheckingAvailable; + iMediaId = aId; + iFileInfo = &aFileInfo; + iSize = aSize; + + OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); + + iClientStatus = aStatus; + *iClientStatus = KRequestPending; + } + +// ----------------------------------------------------------------------------- +// StorageCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::StorageCancel() + { + TRACER("void CGlxtnThumbnailDatabase::StorageCancel()"); + TInt count = iDatabaseArray.Count(); + for ( TInt i = 0; i < count; i++ ) + { + iDatabaseArray[i]->Cancel(); + } + + if ( iClientStatus ) + { + User::RequestComplete(iClientStatus, KErrCancel); + } + } + +// ----------------------------------------------------------------------------- +// NotifyBackgroundError +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::NotifyBackgroundError( + const TGlxMediaId& aId, TInt aError ) + { + TRACER("void CGlxtnThumbnailDatabase::NotifyBackgroundError()"); + if ( iStorageObserver ) + { + iStorageObserver->BackgroundThumbnailError(aId, aError); + } + } + +// ----------------------------------------------------------------------------- +// HandleDatabaseError +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleDatabaseError(TInt aError) + { + TRACER("void CGlxtnThumbnailDatabase::HandleDatabaseError()"); + __ASSERT_DEBUG(KErrNone != aError, Panic(EGlxPanicIllegalArgument)); + __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); + + // Recover from database file corruption + // though the database file opening is successful + if (aError == KErrCorruptThumbnailDatabase) + { + RecoverFromDatabaseError(); + aError = KErrCorrupt; + } + else if (aError == KErrEofThumbnailDatabase) + { + RecoverFromDatabaseError(); + aError = KErrEof; + } + + if ( iClientStatus ) + { + User::RequestComplete(iClientStatus, aError); + } + } + +// ----------------------------------------------------------------------------- +// RecoverFromDatabaseError +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::RecoverFromDatabaseError() + { + TRACER("void CGlxtnThumbnailDatabase::RecoverFromDatabaseError()"); + GLX_LOG_INFO("*** Database Corrupted ***"); + + TFileName path(iFileInfo->FilePath().Left(KMaxDriveName)); + TInt count = iDatabaseArray.Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( 0 == path.CompareF(iDatabaseArray[i]->Drive()) ) + { + + CGlxtnVolumeDatabase* volDb = iDatabaseArray[i]; + iDatabaseArray.Remove(i); + + delete volDb; + volDb = NULL; + + break; + } + } + + path.Append(iDatabasePath); + DeleteFile(path); + } + +// ----------------------------------------------------------------------------- +// HandleThumbnailIdFromMediaIdL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleThumbnailIdFromMediaIdL( + const TGlxtnThumbnailId& aThumbId ) + { + TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailIdFromMediaIdL()"); + if ( aThumbId == KGlxIdNone ) + { + CGlxtnVolumeDatabase* db = OpenDatabaseL(iInternalDrive); + iThumbId = db->GetThumbnailId(); + // Store thumbnail ID to speed up future lookups + db->StoreThumbnailIdL(iMediaId, iThumbId); + } + else + { + iThumbId = aThumbId; + if(iCurrentOperation == EDeleting) + { + OpenDatabaseL( iInternalDrive )->DeleteIdL( iMediaId ); + } + else + { + DoHandleThumbnailIdL(); + } + } + } + +// ----------------------------------------------------------------------------- +// HandleMediaIdDeletedL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleMediaIdDeletedL() + { + TRACER("void CGlxtnThumbnailDatabase::HandleMediaIdDeletedL()"); + OpenDatabaseL(iFileInfo->FilePath())->DeleteThumbnailsL(iThumbId); + } + +// ----------------------------------------------------------------------------- +// HandleThumbnailsDeletedL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleThumbnailsDeletedL() + { + TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailsDeletedL()"); + OpenDatabaseL(iFileInfo->FilePath())->DeleteItemL(iThumbId); + } + +// ----------------------------------------------------------------------------- +// HandleItemsDeletedL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleItemDeletedL() + { + TRACER("void CGlxtnThumbnailDatabase::HandleItemDeletedL()"); + __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); + if ( iClientStatus ) + { + User::RequestComplete(iClientStatus, KErrNone); + } + } + +// ----------------------------------------------------------------------------- +// HandleThumbnailIdFromFilenameL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL( + const TGlxtnThumbnailId& aThumbId ) + { + TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL()"); + iThumbId = aThumbId; + if(iCurrentOperation == EDeleting) + { + GLX_LOG_INFO1("GlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL Current Operation Deleting. aThumbId = %d", aThumbId.Value()); + OpenDatabaseL(iFileInfo->FilePath())->DeleteThumbnailsL(iThumbId); + } + else + { + GLX_LOG_INFO1("GlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL Current Operation NOT Deleting. aThumbId = %d", aThumbId.Value()); + // Store thumbnail ID to speed up future lookups + OpenDatabaseL( iInternalDrive )->StoreThumbnailIdL( + iMediaId, iThumbId ); + } + } + +// ----------------------------------------------------------------------------- +// HandleThumbnailIdStoredL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleThumbnailIdStoredL() + { + TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailIdStoredL()"); + DoHandleThumbnailIdL(); + } + +// ----------------------------------------------------------------------------- +// HandleThumbnail +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleThumbnail( + TGlxImageDataFormat aFormat, HBufC8* aData ) + { + TRACER("void CGlxtnThumbnailDatabase::HandleThumbnail()"); + __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); + if ( iClientStatus ) + { + *iLoadData = aData; + *iLoadFormat = aFormat; + User::RequestComplete(iClientStatus, KErrNone); + } + else + { + // Data loaded, but client doesn't want it (shouldn't ever happen) + delete aData; + } + } + +// ----------------------------------------------------------------------------- +// HandleThumbnailStored +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleThumbnailStored() + { + TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailStored()"); + if ( iStorageObserver ) + { + iStorageObserver->ThumbnailAvailable(iMediaId, iSize); + } + + __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); + if ( iClientStatus ) + { + User::RequestComplete(iClientStatus, KErrNone); + } + } + +// ----------------------------------------------------------------------------- +// HandleAvailabilityChecked +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleAvailabilityChecked(TInt aResult) + { + TRACER("void CGlxtnThumbnailDatabase::HandleAvailabilityChecked()"); + __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); + if ( iClientStatus ) + { + GLX_LOG_INFO1("HandleAvailabilityChecked+ aResult= %d [0-Av / 1-NotAv]", aResult); + User::RequestComplete(iClientStatus, aResult); + } + } + +// ----------------------------------------------------------------------------- +// HandleDatabaseCleanedL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::HandleDatabaseCleanedL() + { + TRACER("void CGlxtnThumbnailDatabase::HandleDatabaseCleanedL()"); + + // the following three lines of code make the assumption that (in the worst case) (atleast) + // some databases are not present in the iDatabaseArray. This would then prevent those + // from being cleaned, since only the databases contained in the iDatabaseArray will be cleaned. + // this will in effect cause those databases to keep growing. + + // The OpenDatabaseL method also adds the database into iDatabaseArray if it + // already was not part of it. Here we are using this behaviour of the method + + OpenDatabaseL(DriveInfo::EDefaultPhoneMemory); + OpenDatabaseL(DriveInfo::EDefaultMassStorage); + OpenDatabaseL(DriveInfo::EDefaultRemovableMassStorage); + + iDatabaseIndex++; + if(iDatabaseIndex < iDatabaseArray.Count()) + { + // cleanup next database + iDatabaseArray[iDatabaseIndex]->CleanupDatabaseL(); + } + else + { + // Finished cleanup + __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); + if ( iClientStatus ) + { + User::RequestComplete(iClientStatus, KErrNone); + } + } + } + +// ----------------------------------------------------------------------------- +// DoHandleThumbnailIdL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::DoHandleThumbnailIdL() + { + TRACER("void CGlxtnThumbnailDatabase::DoHandleThumbnailIdL()"); + CGlxtnVolumeDatabase* db = OpenDatabaseL(iFileInfo->FilePath()); + + switch ( iCurrentOperation ) + { + case ELoading: + db->GetThumbnailL(iThumbId, iSize); + break; + case ESaving: + db->StoreItemsL(iThumbId, iFileInfo); + db->StoreThumbnailL(iThumbId, iSize, iSaveFormat, iSaveData); + break; + case ECheckingAvailable: + db->CheckAvailableL(iThumbId, iSize); + break; + default: + Panic(EGlxPanicIllegalState); + break; + } + } + +// ----------------------------------------------------------------------------- +// OpenDatabaseL +// ----------------------------------------------------------------------------- +// +CGlxtnVolumeDatabase* CGlxtnThumbnailDatabase::OpenDatabaseL(const TDesC& aDrive) + { + TRACER("CGlxtnVolumeDatabase* CGlxtnThumbnailDatabase::OpenDatabaseL(const TDesC& aDrive)"); + TBuf drive; + drive.Append(aDrive.Left(KMaxDriveName)); + TDriveUnit driveNumber(aDrive); + if (EDriveZ == driveNumber) + { + GLX_LOG_INFO("CGlxtnThumbnailDatabase::OpenDatabaseL EDriveZ == DriveNumber"); + drive.FillZ(0); + drive.Append(iInternalDrive); + } + + TInt count = iDatabaseArray.Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( 0 == drive.CompareF(iDatabaseArray[i]->Drive()) ) + { + return iDatabaseArray[i]; + } + } + + // Get path of DB on specified drive + TFileName path(drive); + path.Append(iDatabasePath); + + // If the media(removable drive) has changed or the mass storage has been reflashed, + // then the existing thumbnail database (if any) needs to be regenerated as per the new images in the media. + // else there might be a mismatch between the existing images and their thumbnails. this is achieved by the \ + // following function + DeleteDBIfStorageChangedL(path); + + CGlxtnVolumeDatabase* database = CGlxtnVolumeDatabase::NewLC(*this, iFs, path); + GLX_LOG_INFO("New Volume database creation attempted. "); + iDatabaseArray.AppendL(database); + CleanupStack::Pop(database); + + // The thumbnail id is placed only in the IDs table of the thumbnail database in the internal phone memory, + // irrespective of which drive the images or their databses are placed in. + // And since the thumbnail id has to be unique across drives, the 'next' thumbnail Id to be used + // is initialized by incrementing the thumbnail id in the internal drive by one. + if (KErrNone == drive.CompareF(iInternalDrive)) + { + database->InitializeThumbIdL(); + } + return database; + } +// ----------------------------------------------------------------------------- +// DeleteFile +// +// Common function for deletion of files. +// This function removes any 'read only' protection that may be there on the file +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::DeleteFile(const TDesC& aPath) + { + GLX_LOG_ENTRY_EXIT("void CGlxtnThumbnailDatabase::DeleteFile()"); + + if (BaflUtils::FileExists( iFs, aPath )) + { + GLX_LOG_INFO("void CGlxtnThumbnailDatabase::DeleteFile(): File Exists, Now check if it is read only"); + + TUint fileAttributes = KEntryAttNormal; + iFs.Att(aPath, fileAttributes ) ; + + if ( fileAttributes & KEntryAttReadOnly ) + { + GLX_LOG_INFO("void CGlxtnThumbnailDatabase::DeleteFile(): File is Read-Only . Make it 'not Read-Only' "); + iFs.SetAtt(aPath, 0 , KEntryAttReadOnly); + } + + GLX_LOG_INFO("void CGlxtnThumbnailDatabase::DeleteFile(): File is (or is made) 'Not Read-Only'. Delete it"); + iFs.Delete(aPath); + + GLX_LOG_INFO("void CGlxtnThumbnailDatabase::DeleteFile(): File Deleted"); + } + } + + +// ----------------------------------------------------------------------------- +// DeleteDBIfStorageChanged +// +// This case is useful if the device hard drive was reflashed after the last access. +// or the Memory card has changed after last access to the Memorycard. +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailDatabase::DeleteDBIfStorageChangedL(TFileName aPath) + { + TRACER("CGlxtnThumbnailDatabase::DeleteDBIfStorageChangedL"); + + TUint driveStatus = 0 ; + TPtrC drive(aPath.Left(KMaxDriveName)); + TDriveUnit driveNumber(drive); + TDriveUnit romDrive(EDriveZ); + + // this will make sure that we are not dealing with the intenral phone memory. + if ((0 != drive.CompareF(PathInfo::PhoneMemoryRootPath().Left( KMaxDriveName ))) && + (0 != drive.CompareF(romDrive.Name()))) + { + GLX_LOG_INFO("Not Phone Memory / ROM"); + + CRepository * pCenRep = CRepository::NewLC(TUid::Uid( KRepositoryId )); + + // that leaves the memory card and the hard drive + User::LeaveIfError(DriveInfo::GetDriveStatus( iFs, driveNumber, driveStatus ) ); + + // take care of the removable drives now + if (driveStatus & DriveInfo::EDriveRemovable) + { + GLX_LOG_INFO("CGlxtnThumbnailDatabase::DeleteDBIfStorageChangedL. DriveInfo::EDriveRemovable"); + + // get the serial number of the drive. + TBuf8 serialNumDriveBuf ; + serialNumDriveBuf.FillZ(KGlxmediaSerialIdLength); + iFs.GetMediaSerialNumber( serialNumDriveBuf, driveNumber ) ; + + // get the serial number from the Cen Rep. + TBuf8 serialNumCenRepBuf ; + serialNumCenRepBuf.FillZ(KGlxmediaSerialIdLength); + pCenRep->Get(KGlxTnSDCardVolumeId, serialNumCenRepBuf) ; + + if (serialNumCenRepBuf.Compare(serialNumDriveBuf)) + { + GLX_LOG_INFO("SerialNumCenRepBuf.Compare(serialNumDriveBuf) returned a difference between the drive ids"); + + User::LeaveIfError(pCenRep->Set(KGlxTnSDCardVolumeId, serialNumDriveBuf)) ; + + // delete the database so that later when we try to open the database a + // new database is created. + DeleteFile(aPath); + GLX_LOG_INFO("CGlxtnThumbnailDatabase::DeleteDBIfStorageChangedL(): Deleted file"); + } + } + else + // a rough assumption here. if this is not an internal drive and if it is not a removable drive + // then it must most probably be the hard drive. + { + GLX_LOG_INFO("CGlxtnThumbnailDatabase::DeleteDBIfStorageChangedL(): Mass Memory"); + TInt freshlyFlashed = 0 ; + pCenRep->Get(KGlxTnHardDriveFlashState , freshlyFlashed) ; + + // The default value set in a freshly flased drive for this key ID is 0. + // (theorotically anything other than int(1) can be used as a + // value for the cenrep key ID KGlxTnHardDriveFlashState.) + if ( KGlxTnMassStorageNotFreshlyFlashed != freshlyFlashed ) + { + User::LeaveIfError(pCenRep->Set(KGlxTnHardDriveFlashState , TInt(KGlxTnMassStorageNotFreshlyFlashed)) ); + + // delete the database so that later when we try to open the database a + // new database is created. + DeleteFile(aPath); + GLX_LOG_INFO("CGlxtnThumbnailDatabase::DeleteDBIfStorageChangedL(): Deleted File"); + } + } + CleanupStack::PopAndDestroy(pCenRep); + } + } + +// OpenDatabaseL +// ----------------------------------------------------------------------------- +// +CGlxtnVolumeDatabase* CGlxtnThumbnailDatabase::OpenDatabaseL(const DriveInfo::TDefaultDrives& aDrive) + { + TRACER("void CGlxtnThumbnailDatabase::OpenDatabaseL(const DriveInfo::TDefaultDrives& aDrive)"); + GLX_LOG_ENTRY_EXIT("void CGlxtnThumbnailDatabase::OpenDatabaseL(const DriveInfo::TDefaultDrives& aDrive)"); + + TBuf drivePath; + if ( KErrNone == DriveName(aDrive , drivePath)) + { + return OpenDatabaseL(drivePath) ; + } + else + { + return NULL; + } + } +// ----------------------------------------------------------------------------- +// DriveName +// ----------------------------------------------------------------------------- +// +TInt CGlxtnThumbnailDatabase::DriveName(const TInt& aDefaultDrive, TDes& aDriveName) + { + TRACER("void CGlxtnThumbnailDatabase::DriveName()"); + GLX_LOG_ENTRY_EXIT("void CGlxtnThumbnailDatabase::DriveName()"); + GLX_LOG_INFO1("DriveName aDefaultDrive = %d", aDefaultDrive); + TChar driveLetter; + TInt error = DriveInfo::GetDefaultDrive(aDefaultDrive, driveLetter); + + if ( KErrNotSupported != error ) + { + TUint driveStatus = 0 ; + TDriveUnit driveNumber(aDefaultDrive); + error = DriveInfo::GetDriveStatus( iFs, driveNumber, driveStatus ); + GLX_LOG_INFO1("GetDriveStatus returns = %d", error); + if (error == KErrNone && ( driveStatus & DriveInfo::EDrivePresent )) + { + aDriveName.Format(KDriveNameFormat, TUint(driveLetter)); + GLX_LOG_INFO1("aDriveName=%S", &aDriveName); + } + else + { + error = KErrNotReady; + } + } + GLX_LOG_INFO1("DriveName returns = %d", error); + return error; + } +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtndeletethumbnailstask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtndeletethumbnailstask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CGlxtnDeleteThumbnailsTask +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +// INCLUDE FILES + +#include "glxtndeletethumbnailstask.h" + +#include +#include "glxtnfileinfo.h" +#include "mglxtnstorage.h" +#include "mglxtnthumbnailcreatorclient.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CGlxtnDeleteThumbnailsTask::CGlxtnDeleteThumbnailsTask( + const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) : + CGlxtnClientTask(KGlxtnTaskIdDeleteThumbnails, aItemId, aClient) + { + TRACER("CGlxtnDeleteThumbnailsTask::CGlxtnDeleteThumbnailsTask()"); + GLX_ASSERT_ALWAYS( Storage(), Panic( EGlxPanicIllegalArgument ), + "CGlxtnDeleteThumbnailsTask created without storage" ); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxtnDeleteThumbnailsTask::ConstructL() + { + TRACER("void CGlxtnDeleteThumbnailsTask::ConstructL()"); + } + +// ----------------------------------------------------------------------------- +// NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CGlxtnDeleteThumbnailsTask* CGlxtnDeleteThumbnailsTask::NewL( + const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("CGlxtnDeleteThumbnailsTask::NewL()"); + CGlxtnDeleteThumbnailsTask* self = new (ELeave) CGlxtnDeleteThumbnailsTask( + aItemId, aClient); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// Destructor +CGlxtnDeleteThumbnailsTask::~CGlxtnDeleteThumbnailsTask() + { + TRACER("Destructor CGlxtnDeleteThumbnailsTask::~CGlxtnDeleteThumbnailsTask()"); + delete iInfo; + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnDeleteThumbnailsTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("CGlxtnDeleteThumbnailsTask::DoStartL()"); + iInfo = new (ELeave) CGlxtnFileInfo; + Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnDeleteThumbnailsTask::DoCancel() + { + TRACER("CGlxtnDeleteThumbnailsTask::DoCancel()"); + Storage()->StorageCancel(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnDeleteThumbnailsTask::DoRunL(TRequestStatus& aStatus) + { + TRACER("CGlxtnDeleteThumbnailsTask::DoRunL()"); + User::LeaveIfError(aStatus.Int()); + + TBool active = EFalse; + + if ( iDeleting ) + { + Client().ThumbnailDeletionComplete(ItemId(), KErrNone); + } + else + { + User::LeaveIfNull(iInfo); + Storage()->DeleteThumbnailsL(ItemId(), *iInfo, &aStatus); + iDeleting = ETrue; + active = ETrue; + } + + return active; + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnDeleteThumbnailsTask::DoRunError(TInt aError) + { + TRACER("CGlxtnDeleteThumbnailsTask::DoRunError()"); + Client().ThumbnailDeletionComplete(ItemId(), aError); + + return EFalse; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnfileinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnfileinfo.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CGlxtnFileInfo +* +*/ + + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ +#include "glxtnfileinfo.h" + +#include +// ----------------------------------------------------------------------------- +// IdentifyFileL +// ----------------------------------------------------------------------------- +// +void CGlxtnFileInfo::IdentifyFileL(TBool& aIsVideo, TBool& aIsProtected) + { + TRACER("void CGlxtnFileInfo::IdentifyFileL()"); + User::LeaveIfNull(iFilePath); + + aIsVideo = iIsVideo; + aIsProtected = iIsProtected; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnfileutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnfileutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,290 @@ +/* +* Copyright (c) 2008-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: Utility for thumbnail tasks handling files +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnfileutility.h" +#include +#include +#include +#include +#include +#include +#include // For feature constants + +_LIT(KGlxBadFileList, "glxbadfilelist.dat"); +_LIT(KGlxBadFileMarker, "glxbadfilemarker.dat"); + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnFileUtility::CGlxtnFileUtility() + { + TRACER("CGlxtnFileUtility::CGlxtnFileUtility()"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxtnFileUtility::ConstructL() + { + TRACER("CGlxtnFileUtility::ConstructL()"); + User::LeaveIfError(iFs.Connect()); + + iFs.PrivatePath(iBadFileDir); + iBadFileDir.Insert( + 0, PathInfo::PhoneMemoryRootPath().Left( KMaxDriveName ) ); + + TRAP_IGNORE(ReadBadFileListL()); + + LayoutSpecificDataL(); + + } + +// ----------------------------------------------------------------------------- +// NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CGlxtnFileUtility* CGlxtnFileUtility::NewL() + { + TRACER("CGlxtnFileUtility::NewL()"); + CGlxtnFileUtility* self = new (ELeave) CGlxtnFileUtility; + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnFileUtility::~CGlxtnFileUtility() + { + TRACER("CGlxtnFileUtility::~CGlxtnFileUtility()"); + iFs.Close(); + iBadFileArray.ResetAndDestroy(); + iPersistentSizeClasses.Close(); + } + +// ----------------------------------------------------------------------------- +// FsSession +// Provide file server session for opening images from files. +// ----------------------------------------------------------------------------- +// +RFs& CGlxtnFileUtility::FsSession() + { + TRACER("RFs& CGlxtnFileUtility::FsSession()"); + return iFs; + } + +// ----------------------------------------------------------------------------- +// CheckBadFileListL +// Test whether a file is on the bad file list. If not the bad file marker +// is set to the filename, so that if a panic occurs it will be added to the +// bad file list. +// ----------------------------------------------------------------------------- +// +void CGlxtnFileUtility::CheckBadFileListL(const TDesC& aFilename) + { + TRACER("0CGlxtnFileUtility::CheckBadFileListL(const TDesC& aFilename)"); + for ( TInt i = 0; i < iBadFileArray.Count(); i++ ) + { + if ( 0 == iBadFileArray[i]->CompareF(aFilename) ) + { + // File is bad + User::Leave( KErrCorrupt ); + } + } + + // Set bad file marker + TPath path(iBadFileDir); + path.Append(KGlxBadFileMarker); + + // Ensure directory exists + TInt err = iFs.MkDirAll(path); + if ( err != KErrAlreadyExists ) + { + User::LeaveIfError(err); + } + + RFileWriteStream stream; + CleanupClosePushL(stream); + User::LeaveIfError(stream.Replace( + iFs, path, EFileWrite | EFileShareExclusive)); + stream << aFilename; + stream.CommitL(); + CleanupStack::PopAndDestroy(&stream); + } + +// ----------------------------------------------------------------------------- +// ClearBadFileMarker +// Clear the bad file marker. Called when processing a file is complete (no +// panic occurred). +// ----------------------------------------------------------------------------- +// +void CGlxtnFileUtility::ClearBadFileMarker() + { + TRACER("void CGlxtnFileUtility::ClearBadFileMarker()"); + TPath path(iBadFileDir); + path.Append(KGlxBadFileMarker); + + ( void )iFs.Delete( path ); // Ignore error + } + +// ----------------------------------------------------------------------------- +// IsPersistentSize +// Test whether a generated thumbnail should be stored in persistent storage. +// ----------------------------------------------------------------------------- +// +TBool CGlxtnFileUtility::IsPersistentSize(const TSize& aSize) + { + TRACER("CGlxtnFileUtility::IsPersistentSize()"); + for ( TInt i = 0; i < iPersistentSizeClasses.Count(); i++ ) + { + if ( iPersistentSizeClasses[i] == aSize ) + { + return ETrue; + } + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// ReadBadFileListL +// ----------------------------------------------------------------------------- +// +void CGlxtnFileUtility::ReadBadFileListL() + { + TRACER("void CGlxtnFileUtility::ReadBadFileListL()"); + TPath pathList(iBadFileDir); + pathList.Append(KGlxBadFileList); + TPath pathMarker(iBadFileDir); + pathMarker.Append(KGlxBadFileMarker); + + RFileReadStream stream; + CleanupClosePushL(stream); + + // Check bad file list + if ( KErrNone == stream.Open( + iFs, pathList, EFileRead | EFileShareReadersOnly) ) + { + TInt err; + // Loop until end of file + do + { + TRAP(err, + HBufC* file = HBufC::NewLC(stream, KMaxTInt); + iBadFileArray.AppendL(file); + CleanupStack::Pop(file); + ) + } while ( KErrNone == err ); + + stream.Close(); + // NOTE: We always get KErrEof even if the file is corrupted + } + + // Check bad file marker + if ( KErrNone == stream.Open( + iFs, pathMarker, EFileRead | EFileShareReadersOnly) ) + { + // File exists, file in marker must be bad + HBufC* file = HBufC::NewLC(stream, KMaxTInt); + iBadFileArray.AppendL(file); + CleanupStack::Pop(file); + + // Save the list for next gallery session + // Recreate whole file in case existing file is corrupted + WriteBadFileListL(); + + stream.Close(); + ClearBadFileMarker(); + } + + CleanupStack::Pop(&stream); // Stream already closed + } + +// ----------------------------------------------------------------------------- +// WriteBadFileListL +// ----------------------------------------------------------------------------- +// +void CGlxtnFileUtility::WriteBadFileListL() + { + TRACER("void CGlxtnFileUtility::WriteBadFileListL()"); + TPath path(iBadFileDir); + path.Append(KGlxBadFileList); + + RFileWriteStream stream; + CleanupClosePushL(stream); + User::LeaveIfError(stream.Replace( + iFs, path, EFileWrite | EFileShareExclusive)); + + for ( TInt i = 0; i < iBadFileArray.Count() ; i++ ) + { + stream << *iBadFileArray[i]; + } + stream.CommitL(); + + CleanupStack::PopAndDestroy(&stream); + } +// ----------------------------------------------------------------------------- +// LayoutSpecificDataL +// ----------------------------------------------------------------------------- +// +void CGlxtnFileUtility::LayoutSpecificDataL() + { + TRACER("void CGlxtnFileUtility::LayoutSpecificDataL()"); + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + + if(FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch )) + { + iPersistentSizeClasses.AppendL(TSize(111,83)); + iPersistentSizeClasses.AppendL(TSize(640,360)); + iPersistentSizeClasses.AppendL(TSize(360,640)); + } + else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640)) + { + iPersistentSizeClasses.AppendL(TSize(146,110)); + iPersistentSizeClasses.AppendL(TSize(640,480)); + iPersistentSizeClasses.AppendL(TSize(480,640)); + } + else + { + iPersistentSizeClasses.AppendL(TSize(146,110)); + iPersistentSizeClasses.AppendL(TSize(640,480)); + iPersistentSizeClasses.AppendL(TSize(480,640)); + } + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + } + + + // End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnfilteravailabletask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnfilteravailabletask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2008-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: Task used for thumbnail availability filter. +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnfilteravailabletask.h" + +#include +#include + +#include "glxtnfileinfo.h" +#include "mglxtnstorage.h" +#include "mglxtnthumbnailcreatorclient.h" + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxtnFilterAvailableTask* CGlxtnFilterAvailableTask::NewL( + const TArray& aItemArray, const TSize& aSize, + MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("CGlxtnFilterAvailableTask* CGlxtnFilterAvailableTask::NewL()"); + CGlxtnFilterAvailableTask* task = new (ELeave) CGlxtnFilterAvailableTask( + aSize, aClient); + CleanupStack::PushL(task); + task->ConstructL(aItemArray); + CleanupStack::Pop(task); + return task; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnFilterAvailableTask::CGlxtnFilterAvailableTask(const TSize& aSize, + MGlxtnThumbnailCreatorClient& aClient) : + CGlxtnClientTask(KGlxtnTaskIdFilterAvailable, KGlxIdNone, aClient), + iSize(aSize) + { + TRACER("CGlxtnFilterAvailableTask::CGlxtnFilterAvailableTask()"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxtnFilterAvailableTask::ConstructL( + const TArray& aItemArray) + { + TRACER("void CGlxtnFilterAvailableTask::ConstructL()"); + TInt count = aItemArray.Count(); + for ( TInt i = 0; i < count; i++ ) + { + iIdArray.AppendL(aItemArray[i]); + } + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnFilterAvailableTask::~CGlxtnFilterAvailableTask() + { + TRACER("CGlxtnFilterAvailableTask::~CGlxtnFilterAvailableTask()"); + delete iFileInfo; + iIdArray.Close(); + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnFilterAvailableTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnFilterAvailableTask::DoStartL()"); + iIndex = 0; + + GLX_ASSERT_DEBUG( !iFileInfo, Panic( EGlxPanicAlreadyInitialised ), + "iFileInfo not NULL" ); + iFileInfo = new (ELeave) CGlxtnFileInfo; + + return GetFileInfoL(aStatus); + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnFilterAvailableTask::DoCancel() + { + TRACER("void CGlxtnFilterAvailableTask::DoCancel()"); + Storage()->StorageCancel(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnFilterAvailableTask::DoRunL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnFilterAvailableTask::DoRunL()"); + TInt result = aStatus.Int(); + User::LeaveIfError(result); + + TBool active = EFalse; + + switch ( iState ) + { + case EStateFetchingUri: + Storage()->IsThumbnailAvailableL(iIdArray[iIndex], *iFileInfo, + iSize, &aStatus); + iState = EStateChecking; + active = ETrue; + break; + + case EStateChecking: + if ( KGlxThumbnailNotAvailable == result ) + { + iIndex++; + } + else + { + iIdArray.Remove(iIndex); + } + + active = GetFileInfoL(aStatus); + break; + + default: + GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), + "CGlxtnFilterAvailableTask: Illegal state" ); + break; + } + + return active; + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnFilterAvailableTask::DoRunError(TInt aError) + { + TRACER("CGlxtnFilterAvailableTask::DoRunError()"); + Client().FilterAvailableComplete(iIdArray, aError); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// GetFileInfoL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnFilterAvailableTask::GetFileInfoL(TRequestStatus& aStatus) + { + TRACER("CGlxtnFilterAvailableTask::GetFileInfoL()"); + if ( iIndex < iIdArray.Count() ) + { + Client().FetchFileInfoL(iFileInfo, iIdArray[iIndex], &aStatus); + iState = EStateFetchingUri; + + return ETrue; + } + + // Finished checking the array + Client().FilterAvailableComplete(iIdArray, KErrNone); + + return EFalse; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtngeneratethumbnailtask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtngeneratethumbnailtask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,336 @@ +/* +* Copyright (c) 2008-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: Classes for thumbnail-related tasks. +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtngeneratethumbnailtask.h" + +#include +#include +#include +#include +#include +#include + +#include "glxtnfileinfo.h" +#include "glxtnfileutility.h" +#include "glxtnimageutility.h" +#include "glxtnsavethumbnailtask.h" +#include "glxtntaskmanager.h" +#include "glxtnthumbnailrequest.h" +#include "glxtnvideoutility.h" +#include "mglxtnthumbnailcreatorclient.h" + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxtnGenerateThumbnailTask* CGlxtnGenerateThumbnailTask::NewL( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("CGlxtnGenerateThumbnailTask::NewL()"); + CGlxtnGenerateThumbnailTask* task + = new (ELeave) CGlxtnGenerateThumbnailTask( + aRequestInfo, aFileUtility, aClient); + CleanupStack::PushL(task); + task->ConstructL(aRequestInfo.iBitmapHandle); + CleanupStack::Pop( task ); + return task; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnGenerateThumbnailTask::CGlxtnGenerateThumbnailTask( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) : + CGlxtnLoadThumbnailTask( KGlxtnTaskIdGenerateThumbnail, + aRequestInfo, aFileUtility, aClient ) + { + TRACER("CGlxtnGenerateThumbnailTask::CGlxtnGenerateThumbnailTask()"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxtnGenerateThumbnailTask::ConstructL(TInt aBitmapHandle) + { + TRACER("CGlxtnGenerateThumbnailTask::ConstructL()"); + CGlxtnLoadThumbnailTask::ConstructL( aBitmapHandle ); + + iImageUtility = new (ELeave) CGlxtnImageUtility(iFileUtility.FsSession()); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnGenerateThumbnailTask::~CGlxtnGenerateThumbnailTask() + { + TRACER("CGlxtnGenerateThumbnailTask::~CGlxtnGenerateThumbnailTask()"); + delete iImageUtility; + delete iVideoUtility; + delete iImage; + } + +// ----------------------------------------------------------------------------- +// SetManager +// ----------------------------------------------------------------------------- +// +void CGlxtnGenerateThumbnailTask::SetManager(CGlxtnTaskManager* aManager) + { + TRACER("void CGlxtnGenerateThumbnailTask::SetManager()"); + iTaskManager = aManager; + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnGenerateThumbnailTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("CGlxtnGenerateThumbnailTask::DoStartL()"); + iInfo = new (ELeave) CGlxtnFileInfo; + Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); + iState = EStateFetchingUri; + + return ETrue; // Request has been issued + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnGenerateThumbnailTask::DoCancel() + { + TRACER("void CGlxtnGenerateThumbnailTask::DoCancel()"); + CGlxtnLoadThumbnailTask::DoCancel(); + + iImageUtility->Cancel(); + + if ( iVideoUtility ) + { + iVideoUtility->Cancel(); + } + + iFileUtility.ClearBadFileMarker(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnGenerateThumbnailTask::DoRunL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnGenerateThumbnailTask::DoRunL()"); + TInt error = aStatus.Int(); + + TBool active = EFalse; + + if ( KErrNone == error ) + { + switch ( iState ) + { + case EStateFetchingUri: + { + User::LeaveIfNull(iInfo); + iBadFileMarkerNotNeededFlag = ETrue; + + iInfo->IdentifyFileL(iVideo, iProtected); + // leave if file is DRM protected and client has no DRM + // capablity + if ( iProtected && !iDrmAllowed ) + { + User::Leave(KErrAccessDenied); + } + + if ( !LoadThumbnailL( aStatus ) ) + { + iBadFileMarkerNotNeededFlag = EFalse; + iFileUtility.CheckBadFileListL( iInfo->FilePath() ); + HighQualityDecodeL( aStatus ); + } + active = ETrue; + } + break; + + case EStateLoading: + active = HandleLoadedThumbnailL( aStatus ); + break; + + case EStateDecodingThumbnail: + // Nothing to do + break; + + case EStateDecodingImage: + { + iImageUtility->FreeDecoder(); + + // Resize empty bitmap to required size + TSize targetSize(iRequestedSize); + iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); + User::LeaveIfError(iThumbnail->Resize(targetSize)); + + iImageUtility->FilterImageL(&aStatus, iImage, iImage, iThumbnail); + iState = EStateFiltering; + active = ETrue; + } + break; + + case EStateFiltering: + { + TSize targetSize(iRequestedSize); + const TSize srcSize = iImage->SizeInPixels(); + iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); + iImageUtility->ScaleImageL(aStatus, *iImage, srcSize, *iThumbnail, targetSize); + iState = EStateScaling; + active = ETrue; + } + break; + + case EStateScaling: + { + User::LeaveIfError(iThumbnail->SetDisplayMode(KGlxThumbnailDisplayMode)); + + // Create task to save generated thumbnail + if ( Storage() && !iInfo->iTemporary + && !SizeRequiresDrmRights() + && iFileUtility.IsPersistentSize(iRequestedSize) ) + { + CGlxtnSaveThumbnailTask* task + = CGlxtnSaveThumbnailTask::NewL(ItemId(), iInfo, + iRequestedSize, iThumbnail, Storage()); + iThumbnail = NULL; // Task has ownership + iInfo = NULL; // Task has ownership + iTaskManager->AddTaskL(task); + } + break; + } + + default: + GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), + "CGlxtnGenerateThumbnailTask: Illegal state" ); + break; + } + } + else + { + if ( EStateLoading == iState ) + { + // Loading failed - generate new thumbnail instead + HighQualityDecodeL( aStatus ); + active = ETrue; + } + } + + if ( !active ) + { + if ( !iBadFileMarkerNotNeededFlag ) + { + iFileUtility.ClearBadFileMarker(); + } + Client().ThumbnailFetchComplete(ItemId(), + EGlxThumbnailQualityHigh, error); + } + + return active; + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnGenerateThumbnailTask::DoRunError(TInt aError) + { + TRACER("TBool CGlxtnGenerateThumbnailTask::DoRunError(TInt aError)"); + iFileUtility.ClearBadFileMarker(); + Client().ThumbnailFetchComplete(ItemId(), EGlxThumbnailQualityHigh, aError); + + return EFalse; + } + +// --------------------------------------------------------------------------- +// HighQualityDecodeL +// --------------------------------------------------------------------------- +// +void CGlxtnGenerateThumbnailTask::HighQualityDecodeL( + TRequestStatus& aStatus ) + { + TRACER("void CGlxtnGenerateThumbnailTask::HighQualityDecodeL()"); + RArray targetSizes; + CleanupClosePushL(targetSizes); + targetSizes.AppendL( TSize(iRequestedSize) ); + if ( iVideo ) + { + iVideoUtility = new (ELeave) CGlxtnVideoUtility; + iVideoUtility->GetVideoFrameL( &aStatus, iImage, iInfo->FilePath(), targetSizes, KGlxThumbnailDisplayMode ); + } + else + { + iImage = iImageUtility->DecodeImageL( aStatus, iInfo->FilePath(), + targetSizes, KGlxThumbnailDisplayMode ); + } + CleanupStack::PopAndDestroy(&targetSizes); + iState = EStateDecodingImage; + } + +// ----------------------------------------------------------------------------- +// SizeRequiresDrmRights +// ----------------------------------------------------------------------------- +// +TBool CGlxtnGenerateThumbnailTask::SizeRequiresDrmRights() + { + TRACER("TBool CGlxtnGenerateThumbnailTask::SizeRequiresDrmRights()"); + if ( iProtected ) + { + if ( iVideo ) + { + return ETrue; + } + + // Rights are required if thumbnail doesn't fit in KGlxThumbnailDrmWidth + // by KGlxThumbnailDrmHeight box either portrait or landscape + if ( (iRequestedSize.iWidth > KGlxThumbnailDrmWidth + || iRequestedSize.iHeight > KGlxThumbnailDrmHeight) + && (iRequestedSize.iWidth > KGlxThumbnailDrmHeight + || iRequestedSize.iHeight > KGlxThumbnailDrmWidth) ) + { + return ETrue; + } + + const TSize& imageSize(iImageUtility->OriginalSize()); + + // Rights are required if thumbnail is greater than 25% of image size + // Due to preserving aspect ratio, this will only happen if both width + // and height are greater than half the image width and height + if ( iRequestedSize.iWidth > imageSize.iWidth / 2 + && iRequestedSize.iHeight> imageSize.iHeight / 2 ) + { + return ETrue; + } + } + + return EFalse; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnimagedecoderfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnimagedecoderfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of GlxtnImageDecoderFactory +* +*/ + + + + +#include "glxtnimagedecoderfactory.h" + +#include +#include // For CExtJpegDecoder + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CImageDecoder* GlxtnImageDecoderFactory::NewL( RFs& aFs, + const TDesC& aFilename ) + { + TRACER("CImageDecoder* GlxtnImageDecoderFactory::NewL()"); + CImageDecoder* decoder = NULL; + TBool aIsExtDecoderUsed = EFalse; + decoder = GlxtnImageDecoderFactory::NewL(aFs, aFilename, aIsExtDecoderUsed); + return decoder; + } +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CImageDecoder* GlxtnImageDecoderFactory::NewL( RFs& aFs, + const TDesC& aFilename, TBool& aIsExtDecoderUsed ) + { + TRACER("CImageDecoder* GlxtnImageDecoderFactory::NewL()"); + CImageDecoder* decoder = NULL; + aIsExtDecoderUsed = ETrue; //setting decoder type to CExtJpegDecoder + // Use extended JPEG decoder + TRAPD( err, decoder = CExtJpegDecoder::FileNewL( + CExtJpegDecoder::EHwImplementation, aFs, aFilename, CImageDecoder::EOptionNone ) ); + if ( KErrNone != err ) + { + TRAP(err,decoder = CExtJpegDecoder::FileNewL( + CExtJpegDecoder::ESwImplementation, aFs, aFilename, CImageDecoder::EOptionNone ) ); + if ( KErrNone != err ) + { + // Not a JPEG - use standard decoder + decoder = CImageDecoder::FileNewL( aFs, aFilename, CImageDecoder::EOptionNone ); + aIsExtDecoderUsed = EFalse; + } + } + + return decoder; + } +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CImageDecoder* GlxtnImageDecoderFactory::NewL( RFs& aFs, const TDesC8& aData ) + { + TRACER("CImageDecoder* GlxtnImageDecoderFactory::NewL()"); + CImageDecoder* decoder = NULL; + + TRAPD( err, decoder = CExtJpegDecoder::DataNewL( + CExtJpegDecoder::EHwImplementation, aFs, aData ) ); + if ( KErrNone != err ) + { + TRAP(err, decoder = CExtJpegDecoder::DataNewL( + CExtJpegDecoder::ESwImplementation, aFs, aData ) ); + if ( KErrNone != err ) + { + // Not a JPEG - use standard decoder + decoder = CImageDecoder::DataNewL( aFs, aData, CImageDecoder::EOptionNone ); + } + } + + return decoder; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnimageutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnimageutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,737 @@ +/* +* Copyright (c) 2008-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: Utility for creating bitmaps from video files +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnimageutility.h" + +#include // MIHLScaler +#include +#include +#include +#include +#include + +#include "glxtnimagedecoderfactory.h" + +#include +#include + +// All EXIF data is within the first KGlxMaxExifSize bytes of the file +const TInt KGlxMaxExifSize = 0x10000; +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnImageUtility::CGlxtnImageUtility(RFs& aFs) : iFs(aFs) + { + TRACER("CGlxtnImageUtility::CGlxtnImageUtility()"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnImageUtility::~CGlxtnImageUtility() + { + TRACER("CGlxtnImageUtility::~CGlxtnImageUtility()"); + delete iDecoder; + delete iScaler; + delete iBitGc; + } + +// ----------------------------------------------------------------------------- +// Cancel +// ----------------------------------------------------------------------------- +// +void CGlxtnImageUtility::Cancel() + { + TRACER("void CGlxtnImageUtility::Cancel()"); + if ( iDecoder ) + { + iDecoder->Cancel(); + } + if ( iScaler && iScaler->IsBusy()) + { + iScaler->CancelProcess(); + } + } + +// ----------------------------------------------------------------------------- +// AdjustSize +// ----------------------------------------------------------------------------- +// +void CGlxtnImageUtility::AdjustSize(TSize& aTargetSize, const TSize& aSourceSize) + { + TRACER("void CGlxtnImageUtility::AdjustSize()"); + if( (aSourceSize.iWidth <= aTargetSize.iWidth ) && (aSourceSize.iHeight <= aTargetSize.iHeight )) + { + aTargetSize.iWidth = aSourceSize.iWidth; + aTargetSize.iHeight = aSourceSize.iHeight; + } + else if ( aTargetSize.iHeight * aSourceSize.iWidth + < aTargetSize.iWidth * aSourceSize.iHeight ) + { + // Source has taller aspect than target so reduce target width + aTargetSize.iWidth = ( ( aTargetSize.iHeight * aSourceSize.iWidth ) + / ( aSourceSize.iHeight ) ); + } + else + { + // Source has wider aspect than target so reduce target height + aTargetSize.iHeight = (aTargetSize.iWidth * aSourceSize.iHeight) + / aSourceSize.iWidth; + } + } + +// ----------------------------------------------------------------------------- +// DecodeImageL +// ----------------------------------------------------------------------------- +// +CFbsBitmap* CGlxtnImageUtility::DecodeImageL(TRequestStatus& aStatus, + const TDesC& aFileName, RArray& aTargetSizes, TDisplayMode aMode) + { + TRACER("CFbsBitmap* CGlxtnImageUtility::DecodeImageL()"); + delete iDecoder; + iDecoder = NULL; + //Get Exif Metadata and the orientation tag from the file first + TUint16 orientation = GetOrientationL(aFileName); + TInt isExtDecoderUsed = 0; + ///iDecoder = GlxtnImageDecoderFactory::NewL( iFs, aFileName ); + iDecoder = GlxtnImageDecoderFactory::NewL( iFs, aFileName, isExtDecoderUsed ); + iOriginalSize = iDecoder->FrameInfo().iOverallSizeInPixels; + //Get the orientation and set rotation on the decoder + //as well as update the original size + if (isExtDecoderUsed) + { + TInt rotAngle = 0; + TBool flip = EFalse; + GetRotationParameters(orientation,rotAngle,flip); + CExtJpegDecoder* extDecoder = (CExtJpegDecoder*)iDecoder; + extDecoder->SetRotationL(rotAngle); + if(flip) + { + extDecoder->SetMirroringL(); + } + } + if ( 0 == iOriginalSize.iWidth || 0 == iOriginalSize.iHeight ) + { + User::Leave(KErrCorrupt); + } + + TInt count = aTargetSizes.Count(); + TSize testSize; + TSize targetSize; + for ( TInt i = 0 ; i < count ; i++ ) + { + testSize = aTargetSizes[i]; + AdjustSize(testSize, iOriginalSize); + if( ( testSize.iWidth > targetSize.iWidth ) || ( testSize.iHeight > targetSize.iHeight ) ) + { + targetSize = testSize; + } + } + + // Find max scaling factor which won't make image smaller than target size + TInt shift = 3; + while ( shift + && ((iOriginalSize.iWidth >> shift) < targetSize.iWidth + || (iOriginalSize.iHeight >> shift) < targetSize.iHeight ) ) + { + shift--; + } + TInt roundUp = (1 << shift) - 1; + TSize loadSize((iOriginalSize.iWidth + roundUp) >> shift, + (iOriginalSize.iHeight + roundUp) >> shift); + + CFbsBitmap* image = new (ELeave) CFbsBitmap; + CleanupStack::PushL(image); + User::LeaveIfError(image->Create(loadSize, aMode)); + + iDecoder->Convert(&aStatus, *image); + + CleanupStack::Pop(image); + return image; + } + +// ----------------------------------------------------------------------------- +// FreeDecoder +// ----------------------------------------------------------------------------- +// +void CGlxtnImageUtility::FreeDecoder() + { + TRACER("void CGlxtnImageUtility::FreeDecoder()"); + delete iDecoder; + iDecoder = NULL; + } + +// ----------------------------------------------------------------------------- +// OriginalSize +// ----------------------------------------------------------------------------- +// +const TSize& CGlxtnImageUtility::OriginalSize() const + { + TRACER("TSize& CGlxtnImageUtility::OriginalSize()"); + return iOriginalSize; + } + +//--------------------------------------------------------------------------- +/** + K-Nearest neighbour scaling for EColor64K. + Code originally inherited from t_display.cpp by Toni Hemminki. + Added windowing and further optimized by Jarmo Nikula 2006-2007. + + @param aSrc Source buffer pointer + @param aSrcStride Source buffer stride in bytes + @param aSrcCols Source columns + @param aSrcRows Source rows + @param aX Source window top-left X-coordinate + @param aY Source window top-left Y-coordinate + @param aW Source window width + @param aH Source window height + @param aDst Destination buffer pointer + @param aDstStride Destination buffer stride in bytes + @param aDstCols Destination columns, must be even + @param aDstRows Destination rows +*/ +// OPTION's for MMP file: +// Interleave assembly code with C, output can be found on txt-files on some BUILD directory: +// OPTION ARMCC --asm --interleave +// Modify optimization for ARM insturcion set and for maximum speed +// OPTION_REPLACE ARMCC --arm -Otime +/* aSource->LockHeap(); + TUint16* sourceAddress = (TUint16*)aSource->DataAddress(); + aSource->UnlockHeap(); + aTarget->LockHeap(); + TUint16* targetAddress = (TUint16*)aTarget->DataAddress(); + aTarget->UnlockHeap(); + ScaleColor64K(sourceAddress, aSource->DataStride(), + sourceSize.iWidth, sourceSize.iHeight, 0, 0, sourceSize.iWidth, sourceSize.iHeight, + targetAddress, aTarget->DataStride(), + targetSize.iWidth, targetSize.iHeight); +*/ + +void CGlxtnImageUtility::FilterImageL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, CFbsBitmap* aTarget) + { + TRACER("void CGlxtnImageUtility::FilterImageL()"); + TSize sourceSize(aSource->SizeInPixels()); + TSize targetSize(aTarget->SizeInPixels()); + + //Fix for EKLG-7PTET2:mpxcollectionserver.exe crash in thumbnailcreator because of div by zero event + if (targetSize.iWidth <= 0) + { + User::Leave(KErrDivideByZero); + } + + TInt scalePercent = ((100*sourceSize.iWidth)/targetSize.iWidth) - 100; + + // no need to filter if close enough or smaller + if ( scalePercent >= 2 && ( aTarget->DisplayMode() == EColor64K ) ) + { + FilterL(aSource, aFilteredSource, scalePercent); + } + + *aStatus = KRequestPending; + User::RequestComplete(aStatus, KErrNone); + } + +// ----------------------------------------------------------------------------- +// ScaleImageL +// ----------------------------------------------------------------------------- +// +void CGlxtnImageUtility::ScaleImageL(TRequestStatus& aStatus, CFbsBitmap& aSrcBitmap, + const TRect& aSrcRect, CFbsBitmap& aDstBitmap, + const TRect& aDstRect) + { + TRACER("void CGlxtnImageUtility::ScaleImageL(IHL)"); + if (!iScaler) + { + iScaler = IHLScaler::CreateL(); + } + User::LeaveIfError(iScaler->Scale(aStatus, aSrcBitmap, aSrcRect, aDstBitmap, aDstRect)); + } + +void CGlxtnImageUtility::ScaleImage64kL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap* aFilteredSource, CFbsBitmap* aTarget) + { + TRACER("void CGlxtnImageUtility::ScaleImage64kL()"); + TSize sourceSize(aSource->SizeInPixels()); + TSize targetSize(aTarget->SizeInPixels()); + TInt scalePercent = ((100*sourceSize.iWidth)/targetSize.iWidth) - 100; + TRect targetRect(targetSize); + TRect sourceRect(sourceSize); + + CFbsBitmap* sourceImage = aFilteredSource; + if ( !aFilteredSource ) + { + sourceImage = aSource; + } + if ( scalePercent < 2 ) + { + if ( scalePercent > 0 ) + { + sourceRect = targetRect; + } + sourceImage = aSource; + } + sourceImage->LockHeap(); + TUint16* sourceAddress = (TUint16*)sourceImage->DataAddress(); + sourceImage->UnlockHeap(); + aTarget->LockHeap(); + TUint16* targetAddress = (TUint16*)aTarget->DataAddress(); + aTarget->UnlockHeap(); + ScaleColor64K(sourceAddress, sourceImage->DataStride(), + sourceImage->SizeInPixels().iWidth, sourceImage->SizeInPixels().iHeight, 0, 0, sourceImage->SizeInPixels().iWidth, sourceImage->SizeInPixels().iHeight, + targetAddress, aTarget->DataStride(), + targetSize.iWidth, targetSize.iHeight); + +/* if ( !iBitGc ) + { + iBitGc = CFbsBitGc::NewL(); + } + CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(aTarget); + CleanupStack::PushL(bitmapDevice); + iBitGc->Activate(bitmapDevice); + iBitGc->DrawBitmap(targetRect, sourceImage, sourceRect); + CleanupStack::PopAndDestroy(bitmapDevice); +*/ + *aStatus = KRequestPending; + User::RequestComplete(aStatus, KErrNone); + } + +void CGlxtnImageUtility::ScaleColor64K( TUint16* aSrc, TInt aSrcStride, TInt /*aSrcCols*/, TInt /*aSrcRows*/, + TInt aX, TInt aY, TInt aW, TInt aH, + TUint16* aDst, TInt aDstStride, TInt aDstCols, TInt aDstRows ) + { + TRACER("void CGlxtnImageUtility::ScaleColor64K()"); + const TUint KPrecision = 16; + TUint hInc = ( aW<< KPrecision ) / aDstCols; + TUint vInc = ( aH << KPrecision ) / aDstRows; + TUint v = 0; + for ( TUint row = aDstRows; row > 0; --row ) + { + TInt h = hInc * (aDstCols - 1); + TUint linestart = aSrcStride * ( aY + ( v >> KPrecision ) ) / sizeof(TUint16) + aX; + TUint16* src = &aSrc[ linestart ]; + TUint32* dst = (TUint32*)aDst + aDstCols / 2; + TUint32 pxl2x; + // This loop generates 11 assembly instructions per round + // when using "--arm --Otime" options. Since two pixels are handled per round, + // it means 5.5 instructions per pixel on average. + do { + pxl2x = src[ h >> KPrecision ]<<16; + h -= hInc; + pxl2x |= src[ h >> KPrecision ]; + *--dst = pxl2x; + // Compiler eliminates CMP instruction when substraction + // is done inside the while () statement. + } while ( ( h -= hInc ) >= 0 ); + v += vInc; + aDst += aDstStride / sizeof(TUint16); + } + } + +void CGlxtnImageUtility::FilterL( CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, TInt aFilterPercent ) + { + TRACER("void CGlxtnImageUtility::FilterL()"); + if ( !aFilteredSource ) + { + TSize imageSize = aSource->SizeInPixels(); + aFilteredSource = new (ELeave) CFbsBitmap; + aFilteredSource->Create(imageSize, aSource->DisplayMode()); + + CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(aFilteredSource); + if ( !iBitGc ) + { + iBitGc = CFbsBitGc::NewL(); + } + iBitGc->Activate(bitmapDevice); + iBitGc->BitBlt(TPoint(), aSource, imageSize); + delete bitmapDevice; + } + + TSize imageSize = aFilteredSource->SizeInPixels(); + aFilteredSource->LockHeap(); + TUint16* sourceAddress = (TUint16*)aFilteredSource->DataAddress(); + aFilteredSource->UnlockHeap(); + const TInt KGlxScalingNeeds4Filtering = 80; // if scaling more than 1.8 need to filter by 4 + const TInt KGlxScalingNeeds8Filtering = 260; // if scaling more than 3.6 need to filter by 8 + if ( KGlxScalingNeeds8Filtering < aFilterPercent ) + { + FIRFiltering8( + sourceAddress, aFilteredSource->DataStride() / sizeof(TUint16), + imageSize.iWidth, imageSize.iHeight ); + } + else if ( KGlxScalingNeeds4Filtering < aFilterPercent ) + { + FIRFiltering4( + sourceAddress, aFilteredSource->DataStride() / sizeof(TUint16), + imageSize.iWidth, imageSize.iHeight ); + } + else + { + FIRFiltering( + sourceAddress, aFilteredSource->DataStride() / sizeof(TUint16), + imageSize.iWidth, imageSize.iHeight ); + } + } + +#define rmask565 0xf800 +#define gmask565 0x07e0 +#define bmask565 0x001f +#define rbmask565 (rmask565|bmask565) +#define rm565( rgb ) ((rgb) & rmask565) +#define gm565( rgb ) ((rgb) & gmask565) +#define bm565( rgb ) ((rgb) & bmask565) +#define rbm565( rgb ) ((rgb) & rbmask565) +#define r565( rgb ) ((rgb)>>11) +#define g565( rgb ) (gm565(rgb)>>5) +#define b565( rgb ) (bm565(rgb)) +#define rgb565( r, g, b ) (((r)<<11)|((g)<<5)|(b)) + +#define mask32gbr655 0x07e0f81f + +// Keep below three defs in sync with each other! +#define KFIRLen 2 +#define KFIRCen (KFIRLen / 2) +#define incFIRIndex( i ) i = (i + 1) & (KFIRLen - 1) +// Keep above three defs in sync with each other! + +void CGlxtnImageUtility::FIRFiltering( + TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ) + { + TRACER("void CGlxtnImageUtility::FIRFiltering( )"); + TUint firFifo[ KFIRLen ]; + TUint i; // index for fifo in&out + TUint16 *p; + TUint32 px; + TInt row, col; + TUint FIRsum; + // Horizontal scan. + p = aDst; + for ( row = aDstRows - 1; row >= 0; row-- ) + { + // read for cache + //for ( col = aDstCols - 1; col >= 0; col-- ) TInt temp = p[ col ]; + // Fill in the FIR first. + // TODO: Fill in with extrapolated values at edges! + FIRsum = ((KFIRLen / 2)<<21) | ((KFIRLen / 2)<<11) | (KFIRLen / 2); // for correct rounding + i = 0; + TUint32 mask1 = mask32gbr655; + for ( col = 0; col < KFIRLen; col++ ) + { + px = p[ col ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex( i ); + } + TUint32 ave; + for ( ; col < aDstCols; col++ ) + { + ave = ( FIRsum / KFIRLen ) & mask1; + p[ col - KFIRCen ] = TUint16( ave | (ave>>16) ); + FIRsum -= firFifo[ i ]; + px = p[ col ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex( i ); + } + p += aDstStridep; + } + // Vertical scan. + for ( col = aDstCols - 1; col >= 0; col-- ) + { + // Fill in the FIR first. + FIRsum = ((KFIRLen / 2)<<21) | ((KFIRLen / 2)<<11) | (KFIRLen / 2); // for correct rounding + TUint32 mask1 = mask32gbr655; + i = 0; + p = aDst + col; + for ( row = 0; row < KFIRLen; row++ ) + { + px = *p; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex( i ); + p += aDstStridep; + } + TUint32 ave; + p -= aDstStridep * KFIRCen; + for ( ; row < aDstRows; row++ ) + { + ave = ( FIRsum / KFIRLen ) & mask1; + p[0] = TUint16( ave | (ave>>16) ); + FIRsum -= firFifo[ i ]; + px = p[ aDstStridep * KFIRCen ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex( i ); + p += aDstStridep; + } + } + } +// +// Keep below three defs in sync with each other! +#define KFIRLen4 4 +#define KFIRCen4 (KFIRLen4 / 2) +#define incFIRIndex4( i ) i = (i + 1) & (KFIRLen4 - 1) +// Keep above three defs in sync with each other! + +void CGlxtnImageUtility::FIRFiltering4( + TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ) + { + TRACER("void CGlxtnImageUtility::FIRFiltering4()"); + TUint firFifo[ KFIRLen4 ]; + TUint i; // index for fifo in&out + TUint16 *p; + TUint32 px; + TInt row, col; + TUint FIRsum; + // Horizontal scan. + p = aDst; + for ( row = aDstRows - 1; row >= 0; row-- ) + { + // read for cache + //for ( col = aDstCols - 1; col >= 0; col-- ) TInt temp = p[ col ]; + // Fill in the FIR first. + // TODO: Fill in with extrapolated values at edges! + FIRsum = ((KFIRLen4 / 2)<<21) | ((KFIRLen4 / 2)<<11) | (KFIRLen4 / 2); // for correct rounding + i = 0; + TUint32 mask1 = mask32gbr655; + for ( col = 0; col < KFIRLen4; col++ ) + { + px = p[ col ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex4( i ); + } + TUint32 ave; + for ( ; col < aDstCols; col++ ) + { + ave = ( FIRsum / KFIRLen4 ) & mask1; + p[ col - KFIRCen4 ] = TUint16( ave | (ave>>16) ); + FIRsum -= firFifo[ i ]; + px = p[ col ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex4( i ); + } + p += aDstStridep; + } + // Vertical scan. + for ( col = aDstCols - 1; col >= 0; col-- ) + { + // Fill in the FIR first. + FIRsum = ((KFIRLen4 / 2)<<21) | ((KFIRLen4 / 2)<<11) | (KFIRLen4 / 2); // for correct rounding + TUint32 mask1 = mask32gbr655; + i = 0; + p = aDst + col; + for ( row = 0; row < KFIRLen4; row++ ) + { + px = *p; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex4( i ); + p += aDstStridep; + } + TUint32 ave; + p -= aDstStridep * KFIRCen4; + for ( ; row < aDstRows; row++ ) + { + ave = ( FIRsum / KFIRLen4 ) & mask1; + p[0] = TUint16( ave | (ave>>16) ); + FIRsum -= firFifo[ i ]; + px = p[ aDstStridep * KFIRCen4 ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex4( i ); + p += aDstStridep; + } + } + } + +// Keep below three defs in sync with each other! +#define KFIRLen8 8 +#define KFIRCen8 (KFIRLen8 / 2) +#define incFIRIndex8( i ) i = (i + 1) & (KFIRLen8 - 1) +// Keep above three defs in sync with each other! + +void CGlxtnImageUtility::FIRFiltering8( + TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ) + { + TRACER("void CGlxtnImageUtility::FIRFiltering8()"); + TUint firFifo[ KFIRLen8 ]; + TUint i; // index for fifo in&out + TUint16 *p; + TUint32 px; + TInt row, col; + TUint FIRsum; + // Horizontal scan. + p = aDst; + for ( row = aDstRows - 1; row >= 0; row-- ) + { + // read for cache + //for ( col = aDstCols - 1; col >= 0; col-- ) TInt temp = p[ col ]; + // Fill in the FIR first. + // TODO: Fill in with extrapolated values at edges! + FIRsum = ((KFIRLen8 / 2)<<21) | ((KFIRLen8 / 2)<<11) | (KFIRLen8 / 2); // for correct rounding + i = 0; + TUint32 mask1 = mask32gbr655; + for ( col = 0; col < KFIRLen8; col++ ) + { + px = p[ col ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex8( i ); + } + TUint32 ave; + for ( ; col < aDstCols; col++ ) + { + ave = ( FIRsum / KFIRLen8 ) & mask1; + p[ col - KFIRCen8 ] = TUint16( ave | (ave>>16) ); + FIRsum -= firFifo[ i ]; + px = p[ col ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex8( i ); + } + p += aDstStridep; + } + // Vertical scan. + for ( col = aDstCols - 1; col >= 0; col-- ) + { + // Fill in the FIR first. + FIRsum = ((KFIRLen8 / 2)<<21) | ((KFIRLen8 / 2)<<11) | (KFIRLen8 / 2); // for correct rounding + TUint32 mask1 = mask32gbr655; + i = 0; + p = aDst + col; + for ( row = 0; row < KFIRLen8; row++ ) + { + px = *p; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex8( i ); + p += aDstStridep; + } + TUint32 ave; + p -= aDstStridep * KFIRCen8; + for ( ; row < aDstRows; row++ ) + { + ave = ( FIRsum / KFIRLen8 ) & mask1; + p[0] = TUint16( ave | (ave>>16) ); + FIRsum -= firFifo[ i ]; + px = p[ aDstStridep * KFIRCen8 ]; + px = ((px<<16) | px) & mask1; + firFifo[ i ] = px; + FIRsum += px; + incFIRIndex8( i ); + p += aDstStridep; + } + } + } +// ----------------------------------------------------------------------------- +// GetOrientation +// ----------------------------------------------------------------------------- +// +TUint16 CGlxtnImageUtility::GetOrientationL(const TDesC& aFileName) + { + //Get Exif Metadata and the orientation tag from the file first + RFile file; + CleanupClosePushL(file); + User::LeaveIfError(file.Open(iFs, + aFileName, EFileRead)); + TInt size; + User::LeaveIfError(file.Size(size)); + if ( KGlxMaxExifSize < size ) + { + size = KGlxMaxExifSize; + } + TUint16 orientation = 9; + HBufC8* exifData = HBufC8::NewLC(size); + TPtr8 ptr(exifData->Des()); + User::LeaveIfError(file.Read(ptr)); + CExifRead* exifReader = NULL; + TRAPD(exifErr,exifReader = CExifRead::NewL(*exifData, CExifRead::ENoJpeg)); + if(exifErr == KErrNone) + { + CleanupStack::PushL(exifReader); + + TInt readErr = exifReader->GetOrientation(orientation); + if(readErr != KErrNone) + { + orientation = 9; + } + CleanupStack::PopAndDestroy(exifReader); + } + CleanupStack::PopAndDestroy(exifData); + //Close and pop file Session + CleanupStack::PopAndDestroy(&file); + return orientation; + } + +// ----------------------------------------------------------------------------- +// GetRotationParameters +// ----------------------------------------------------------------------------- +// +void CGlxtnImageUtility::GetRotationParameters(TUint16 aOrientation, + TInt& aRotAngle, TBool& aFlipStatus) + { + //Get the orientation and set rotation on the decoder + //as well as update the original size + aRotAngle = 0; + aFlipStatus = EFalse; + TInt isOrientationOdd = aOrientation%2; + if(aOrientation>8) + { + return; + } + if(aOrientation >= 3 && aOrientation < 5) + { + aRotAngle = 180; + } + else if(aOrientation >= 5 && aOrientation < 7) + { + aRotAngle = 90; + + } + else if(aOrientation >= 7 && aOrientation <= 8) + { + aRotAngle = 270; + } + if(aOrientation>4 ) + { + iOriginalSize.SetSize(iOriginalSize.iHeight,iOriginalSize.iWidth); //Switch Height and width + if(isOrientationOdd ) + { + aFlipStatus = ETrue; + } + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnloadthumbnailtask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnloadthumbnailtask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2008-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: Base class for tasks which load thumbnails +* +*/ + + + + +#include "glxtnloadthumbnailtask.h" + +#include +#include +#include +#include +#include +#include + +#include "glxtnfileinfo.h" +#include "glxtnfileutility.h" +#include "glxtnimagedecoderfactory.h" +#include "glxtnthumbnailrequest.h" +#include "mglxtnstorage.h" + + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxtnLoadThumbnailTask::CGlxtnLoadThumbnailTask( const TGlxtnTaskId& aId, + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient) : + CGlxtnClientTask( aId, aRequestInfo.iId, aClient ), + iFileUtility( aFileUtility ), iRequestedSize( aRequestInfo.iSizeClass ), + iDrmAllowed( aRequestInfo.iDrmAllowed ) + { + TRACER("CGlxtnLoadThumbnailTask::CGlxtnLoadThumbnailTask()"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxtnLoadThumbnailTask::~CGlxtnLoadThumbnailTask() + { + TRACER("CGlxtnLoadThumbnailTask::~CGlxtnLoadThumbnailTask()"); + delete iDecoder; + delete iThumbnail; + delete iThumbData; + delete iInfo; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxtnLoadThumbnailTask::ConstructL( TInt aBitmapHandle ) + { + TRACER("void CGlxtnLoadThumbnailTask::ConstructL()"); + // Duplicate the client's bitmap + iThumbnail = new (ELeave) CFbsBitmap(); + User::LeaveIfError( iThumbnail->Duplicate( aBitmapHandle ) ); + } + +// --------------------------------------------------------------------------- +// DoCancel +// --------------------------------------------------------------------------- +// +void CGlxtnLoadThumbnailTask::DoCancel() + { + TRACER("void CGlxtnLoadThumbnailTask::DoCancel()"); + if ( iDecoder ) + { + iDecoder->Cancel(); + } + + Storage()->StorageCancel(); + } + +// --------------------------------------------------------------------------- +// LoadThumbnailL +// --------------------------------------------------------------------------- +// +TBool CGlxtnLoadThumbnailTask::LoadThumbnailL( TRequestStatus& aStatus ) + { + TRACER("TBool CGlxtnLoadThumbnailTask::LoadThumbnailL()"); + GLX_ASSERT_DEBUG( iInfo, Panic( EGlxPanicNullPointer ), "No file info" ); + + if ( Storage() && iFileUtility.IsPersistentSize( iRequestedSize ) ) + { + Storage()->LoadThumbnailDataL( iThumbData, iFormat, ItemId(), + *iInfo, iRequestedSize, &aStatus ); + iState = EStateLoading; + + return ETrue; + } + + return EFalse; + } + +// --------------------------------------------------------------------------- +// HandleLoadedThumbnailL +// --------------------------------------------------------------------------- +// +TBool CGlxtnLoadThumbnailTask::HandleLoadedThumbnailL(TRequestStatus& aStatus) + { + TRACER("CGlxtnLoadThumbnailTask::HandleLoadedThumbnailL()"); + TBool active = EFalse; + + User::LeaveIfNull( iThumbData ); + + switch ( iFormat ) + { + case EGlxIDF_Bitmap: + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL( bitmap ); + + RDesReadStream stream( *iThumbData ); + CleanupClosePushL( stream ); + stream >> *bitmap; + CleanupStack::PopAndDestroy( &stream ); + + User::LeaveIfError( iThumbnail->Resize( bitmap->SizeInPixels() ) ); + + CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( iThumbnail ); + CleanupStack::PushL( device ); + CFbsBitGc* context = NULL; + User::LeaveIfError( device->CreateContext( context ) ); + CleanupStack::PushL( context ); + + context->BitBlt( TPoint(), bitmap ); + + CleanupStack::PopAndDestroy( context ); + CleanupStack::PopAndDestroy( device ); + + CleanupStack::PopAndDestroy( bitmap ); + } + break; + + case EGlxIDF_JPEG: + iDecoder = GlxtnImageDecoderFactory::NewL( + iFileUtility.FsSession(), *iThumbData ); + DecodeThumbnailL( aStatus, EFalse ); + active = ETrue; + break; + + default: + User::Leave( KErrNotSupported ); + break; + } + + return active; + } + +// --------------------------------------------------------------------------- +// DecodeThumbnailL +// --------------------------------------------------------------------------- +// +void CGlxtnLoadThumbnailTask::DecodeThumbnailL( TRequestStatus& aStatus, + TBool /*aScaleBitmap*/ ) + { + TRACER("CGlxtnLoadThumbnailTask::DecodeThumbnailL()"); + GLX_ASSERT_DEBUG( iDecoder, Panic( EGlxPanicNullPointer ), "No decoder" ); + + // Resize empty bitmap to required size + TSize thumbSize( iDecoder->FrameInfo().iOverallSizeInPixels ); + GLX_DEBUG3("CGlxtnLoadThumbnailTask::DecodeThumbnailL() thumbSize w(%d) h(%d)", + thumbSize.iWidth, thumbSize.iHeight); + + // Always adjust the target bitmap size + // as Exif thumbnail could be bigger in size + TSize targetSize = iRequestedSize; + if( (thumbSize.iWidth <= targetSize.iWidth ) && + (thumbSize.iHeight <= targetSize.iHeight ) ) + { + targetSize.iWidth = thumbSize.iWidth; + targetSize.iHeight = thumbSize.iHeight; + } + else if ( targetSize.iHeight * thumbSize.iWidth + < targetSize.iWidth * thumbSize.iHeight ) + { + // Source has taller aspect than target so reduce target width + targetSize.iWidth = ( ( targetSize.iHeight * thumbSize.iWidth ) + / ( thumbSize.iHeight ) ); + } + else + { + // Source has wider aspect than target so reduce target height + targetSize.iHeight = (targetSize.iWidth * thumbSize.iHeight) + / thumbSize.iWidth; + } + GLX_DEBUG3("CGlxtnLoadThumbnailTask::DecodeThumbnailL() targetSize w(%d) h(%d)", + targetSize.iWidth, targetSize.iHeight); + + User::LeaveIfError( iThumbnail->Resize(targetSize) ); + + iDecoder->Convert( &aStatus, *iThumbnail ); + iState = EStateDecodingThumbnail; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnquickthumbnailtask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnquickthumbnailtask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,353 @@ +/* +* Copyright (c) 2008-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: Classes for thumbnail-related tasks. +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnquickthumbnailtask.h" + +#include +#include +#include +#include + +#include "glxtnfileinfo.h" +#include "glxtnfileutility.h" +#include "glxtnimagedecoderfactory.h" +#include "glxtnthumbnailrequest.h" +#include "glxtnvideoutility.h" +#include "mglxtnthumbnailcreatorclient.h" + + +// All EXIF data is within the first KGlxMaxExifSize bytes of the file +const TInt KGlxMaxExifSize = 0x10000; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxtnQuickThumbnailTask* CGlxtnQuickThumbnailTask::NewL( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("CGlxtnQuickThumbnailTask::NewL()"); + CGlxtnQuickThumbnailTask* task = new (ELeave) CGlxtnQuickThumbnailTask( + aRequestInfo, aFileUtility, aClient); + CleanupStack::PushL(task); + task->ConstructL(aRequestInfo.iBitmapHandle); + CleanupStack::Pop( task ); + return task; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnQuickThumbnailTask::CGlxtnQuickThumbnailTask( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient ) : + CGlxtnLoadThumbnailTask( KGlxtnTaskIdQuickThumbnail, + aRequestInfo, aFileUtility, aClient ), + iQuality( EGlxThumbnailQualityLow ) + { + TRACER("CGlxtnQuickThumbnailTask::CGlxtnQuickThumbnailTask()"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnQuickThumbnailTask::~CGlxtnQuickThumbnailTask() + { + TRACER("CGlxtnQuickThumbnailTask::~CGlxtnQuickThumbnailTask()"); + delete iUtility; + delete iVideoFrame; + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnQuickThumbnailTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnQuickThumbnailTask::DoStartL()"); + iInfo = new (ELeave) CGlxtnFileInfo; + Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); + iState = EStateFetchingUri; + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnQuickThumbnailTask::DoCancel() + { + TRACER("void CGlxtnQuickThumbnailTask::DoCancel()"); + CGlxtnLoadThumbnailTask::DoCancel(); + + if ( EStateFetchingUri == iState ) + { + Client().CancelFetchUri( ItemId() ); + } + + if ( iUtility ) + { + iUtility->Cancel(); + } + + iFileUtility.ClearBadFileMarker(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnQuickThumbnailTask::DoRunL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnQuickThumbnailTask::DoRunL()"); + TInt error = aStatus.Int(); + TBool active = EFalse; + + if ( KErrNone == error ) + { + switch ( iState ) + { + case EStateFetchingUri: + User::LeaveIfNull(iInfo); + iBadFileMarkerNotNeededFlag = ETrue; + + TBool protectedFile; + iInfo->IdentifyFileL(iVideo, protectedFile); + + // leave if file is DRM protected and client has no DRM + // capablity + if ( protectedFile && !iDrmAllowed ) + { + User::Leave(KErrAccessDenied); + } + + if ( !LoadThumbnailL( aStatus ) ) + { + iBadFileMarkerNotNeededFlag = EFalse; + iFileUtility.CheckBadFileListL( iInfo->FilePath() ); + QuickDecodeL(aStatus); + } + active = ETrue; + break; + + case EStateLoading: + iQuality = EGlxThumbnailQualityHigh; + active = HandleLoadedThumbnailL(aStatus); + break; + + case EStateDecodingThumbnail: + // Nothing to do + break; + + case EStateDecodingImage: + QuickScaleL(); + break; + + default: + GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), + "CGlxtnQuickThumbnailTask: Illegal state" ); + break; + } + } + else + { + if ( EStateLoading == iState ) + { + // Loading failed - generate low quality thumbnail instead + iBadFileMarkerNotNeededFlag = EFalse; + iFileUtility.CheckBadFileListL( iInfo->FilePath() ); + QuickDecodeL(aStatus); + active = ETrue; + } + } + + if ( !active ) + { + if ( !iBadFileMarkerNotNeededFlag ) + { + iFileUtility.ClearBadFileMarker(); + } + Client().ThumbnailFetchComplete(ItemId(), iQuality, error); + } + + return active; + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnQuickThumbnailTask::DoRunError(TInt aError) + { + TRACER("TBool CGlxtnQuickThumbnailTask::DoRunError(TInt aError)"); + iFileUtility.ClearBadFileMarker(); + Client().ThumbnailFetchComplete(ItemId(), iQuality, aError); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// QuickDecodeL +// ----------------------------------------------------------------------------- +// +void CGlxtnQuickThumbnailTask::QuickDecodeL(TRequestStatus& aStatus) + { + TRACER("void CGlxtnQuickThumbnailTask::QuickDecodeL(TRequestStatus& aStatus)"); + iQuality = EGlxThumbnailQualityLow; + + if ( iVideo ) + { + RArray targetSizes; + CleanupClosePushL(targetSizes); + targetSizes.AppendL( TSize(iRequestedSize) ); + iUtility = new (ELeave) CGlxtnVideoUtility; + iUtility->GetVideoFrameL(&aStatus, iVideoFrame, iInfo->FilePath(), targetSizes, iThumbnail->DisplayMode() ); + iState = EStateDecodingImage; + CleanupStack::PopAndDestroy(&targetSizes); + } + else + { + ReadThumbnailL(aStatus); + } + } + +// ----------------------------------------------------------------------------- +// ReadThumbnailL +// ----------------------------------------------------------------------------- +// +void CGlxtnQuickThumbnailTask::ReadThumbnailL(TRequestStatus& aStatus) + { + TRACER("void CGlxtnQuickThumbnailTask::ReadThumbnailL(TRequestStatus& aStatus)"); + TBool scaleBitmap = ETrue; + + TRAPD(error, ReadExifThumbnailL()); + if ( KErrNotFound == error || KErrCorrupt == error + || KErrNotSupported == error ) + { + GLX_DEBUG2("CGlxtnQuickThumbnailTask::ReadThumbnailL() EXIF error(%d)", error); + // Use CImageDecoder to get the EXIF thumbnail instead + iDecoder = GlxtnImageDecoderFactory::NewL( + iFileUtility.FsSession(), iInfo->FilePath() ); + + TRAPD( error2, iDecoder->SetImageTypeL( + CImageDecoder::EImageTypeThumbnail ) ); + if ( KErrNotFound == error2 ) + { + // No EXIF thumbnail - load whole image and scale quickly + scaleBitmap = ETrue; + } + else + { + User::LeaveIfError( error2 ); + } + } + else + { + User::LeaveIfError(error); + GLX_DEBUG1("CGlxtnQuickThumbnailTask::ReadThumbnailL() EXIF TN Found"); + iDecoder = GlxtnImageDecoderFactory::NewL( + iFileUtility.FsSession(), *iThumbData ); + } + + DecodeThumbnailL(aStatus, scaleBitmap); + } + +// ----------------------------------------------------------------------------- +// ReadExifThumbnailL +// ----------------------------------------------------------------------------- +// +void CGlxtnQuickThumbnailTask::ReadExifThumbnailL() + { + TRACER("void CGlxtnQuickThumbnailTask::ReadExifThumbnailL()"); + __ASSERT_ALWAYS(iInfo, Panic(EGlxPanicNullPointer)); + + RFile file; + CleanupClosePushL(file); + User::LeaveIfError(file.Open(iFileUtility.FsSession(), + iInfo->FilePath(), EFileRead)); + TInt size; + User::LeaveIfError(file.Size(size)); + if ( KGlxMaxExifSize < size ) + { + size = KGlxMaxExifSize; + } + + HBufC8* exifData = HBufC8::NewLC(size); + TPtr8 ptr(exifData->Des()); + User::LeaveIfError(file.Read(ptr)); + + CExifRead* exifReader = CExifRead::NewL(*exifData, CExifRead::ENoJpeg); + CleanupStack::PushL(exifReader); + delete iThumbData; + iThumbData = NULL; + iThumbData = exifReader->GetThumbnailL(); + + CleanupStack::PopAndDestroy(exifReader); + CleanupStack::PopAndDestroy(exifData); + CleanupStack::PopAndDestroy(&file); + } + +// ----------------------------------------------------------------------------- +// QuickScaleL +// ----------------------------------------------------------------------------- +// +void CGlxtnQuickThumbnailTask::QuickScaleL() + { + TRACER("void CGlxtnQuickThumbnailTask::QuickScaleL()"); + User::LeaveIfNull(iVideoFrame); + + TSize frameSize(iVideoFrame->SizeInPixels()); + TSize thumbSize(iRequestedSize); + + // Reduce target thumbSize to same aspect ratio as source image + if ( thumbSize.iHeight * frameSize.iWidth < thumbSize.iWidth * frameSize.iHeight ) + { + // Source has taller aspect than target so reduce target width + thumbSize.iWidth = (thumbSize.iHeight * frameSize.iWidth) / frameSize.iHeight; + } + else + { + // Source has wider aspect than target so reduce target height + thumbSize.iHeight = (thumbSize.iWidth * frameSize.iHeight) / frameSize.iWidth; + } + + // Resize empty bitmap to required size + User::LeaveIfError( iThumbnail->Resize( thumbSize ) ); + + CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( iThumbnail ); + CleanupStack::PushL(device); + CFbsBitGc* context = NULL; + User::LeaveIfError(device->CreateContext(context)); + CleanupStack::PushL(context); + + context->DrawBitmap(TRect(thumbSize), iVideoFrame); + + CleanupStack::PopAndDestroy(context); + CleanupStack::PopAndDestroy(device); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnsavethumbnailtask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnsavethumbnailtask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2008-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: Thumbnail save task implementation +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +// INCLUDE FILES + +#include "glxtnsavethumbnailtask.h" + +#include +#include +#include +#include +#include + +#include "glxtnfileinfo.h" +#include "mglxtnstorage.h" + +// Minimum size of thumbnail to be saved as JPEG rather than bitmap +const TInt KGlxMinPixelsForJpeg = 30000; + +const TInt KGlxBitmapBufferGranularity = 1024; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask(const TGlxMediaId& aItemId, + const TSize& aSize, MGlxtnThumbnailStorage* aStorage) : + CGlxtnTask(KGlxtnTaskIdSaveThumbnail, aItemId, aStorage), iSize(aSize) + { + TRACER("CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask()"); + GLX_ASSERT_ALWAYS( aStorage, Panic( EGlxPanicIllegalArgument ), + "CGlxtnSaveThumbnailTask created without storage" ); + + // Save task is always low priority + SetPriority(EPriorityLow); + } + +// ----------------------------------------------------------------------------- +// CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask +// Constructor for derived classes. +// ----------------------------------------------------------------------------- +// +CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask(const TGlxtnTaskId& aId, + const TGlxMediaId& aItemId, MGlxtnThumbnailStorage* aStorage) : + CGlxtnTask(aId, aItemId, aStorage) + { + TRACER("CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask()"); + GLX_ASSERT_ALWAYS( aStorage, Panic( EGlxPanicIllegalArgument ), + "CGlxtnSaveThumbnailTask created without storage" ); + } + +// ----------------------------------------------------------------------------- +// CGlxtnSaveThumbnailTask::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxtnSaveThumbnailTask::ConstructL(CGlxtnFileInfo* aFileInfo, + CFbsBitmap* aThumbnail) + { + TRACER("void CGlxtnSaveThumbnailTask::ConstructL()"); + // Shouldn't create save task if client doesn't use storage + if ( !(Storage() && aFileInfo && aThumbnail) ) + { + User::Leave(KErrArgument); + } + + // Must not leave after taking ownership of these + iFileInfo = aFileInfo; + iThumbnail = aThumbnail; + } + +// ----------------------------------------------------------------------------- +// CGlxtnSaveThumbnailTask::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CGlxtnSaveThumbnailTask* CGlxtnSaveThumbnailTask::NewL( + const TGlxMediaId& aItemId, + CGlxtnFileInfo* aFileInfo, const TSize& aSize, + CFbsBitmap* aThumbnail, MGlxtnThumbnailStorage* aStorage) + { + TRACER("CGlxtnSaveThumbnailTask* CGlxtnSaveThumbnailTask::NewL()"); + CGlxtnSaveThumbnailTask* self = new (ELeave) CGlxtnSaveThumbnailTask( + aItemId, aSize, aStorage); + CleanupStack::PushL(self); + self->ConstructL(aFileInfo, aThumbnail); + CleanupStack::Pop( self ); + + return self; + } + +// Destructor +CGlxtnSaveThumbnailTask::~CGlxtnSaveThumbnailTask() + { + TRACER("Destructor CGlxtnSaveThumbnailTask::~CGlxtnSaveThumbnailTask()"); + delete iEncoder; + delete iThumbnail; + delete iData; + delete iFileInfo; + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnSaveThumbnailTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("CGlxtnSaveThumbnailTask::DoStartL()"); + EncodeThumbnailL(aStatus); + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnSaveThumbnailTask::DoCancel() + { + TRACER("CGlxtnSaveThumbnailTask::DoCancel()"); + if ( iEncoder ) + { + iEncoder->Cancel(); + } + + Storage()->StorageCancel(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnSaveThumbnailTask::DoRunL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnSaveThumbnailTask::DoRunL()"); + if ( KErrNone == aStatus.Int() && EStateEncoding == iState ) + { + SaveThumbnailL(aStatus); + return ETrue; + } + + return EFalse; // Task is complete + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnSaveThumbnailTask::DoRunError(TInt /*aError*/) + { + TRACER("CGlxtnSaveThumbnailTask::DoRunError()"); + delete iEncoder; + iEncoder = NULL; + + return EFalse; // Task is complete + } + +// ----------------------------------------------------------------------------- +// EncodeThumbnailL +// ----------------------------------------------------------------------------- +// +void CGlxtnSaveThumbnailTask::EncodeThumbnailL(TRequestStatus& aStatus) + { + TRACER("CGlxtnSaveThumbnailTask::EncodeThumbnailL()"); + TSize size(iThumbnail->SizeInPixels()); + User::LeaveIfError(iThumbnail->SetDisplayMode(KGlxThumbnailDisplayMode)); + + delete iData; + iData = NULL; + + if ( KGlxMinPixelsForJpeg <= size.iWidth * size.iHeight ) + { + // Encode as JPEG + iFormat = EGlxIDF_JPEG; + delete iEncoder; + iEncoder = NULL; + iEncoder = CImageEncoder::DataNewL(iData, CImageEncoder::EOptionNone, + KImageTypeJPGUid); + iState = EStateEncoding; + iEncoder->Convert(&aStatus, *iThumbnail); + } + else + { + // Externalise bitmap into buffer + iFormat = EGlxIDF_Bitmap; + CBufBase* buffer = CBufSeg::NewL(KGlxBitmapBufferGranularity); + CleanupStack::PushL(buffer); + + RBufWriteStream stream(*buffer); + CleanupClosePushL(stream); + stream << *iThumbnail; + stream.CommitL(); + CleanupStack::PopAndDestroy(&stream); + + TInt length = buffer->Size(); + iData = HBufC8::NewL(length); + TPtr8 ptr(iData->Des()); + buffer->Read(0, ptr, length); + + CleanupStack::PopAndDestroy(buffer); + + SaveThumbnailL(aStatus); + } + } + +// ----------------------------------------------------------------------------- +// SaveThumbnailL +// ----------------------------------------------------------------------------- +// +void CGlxtnSaveThumbnailTask::SaveThumbnailL(TRequestStatus& aStatus) + { + TRACER("CGlxtnSaveThumbnailTask::SaveThumbnailL()"); + delete iEncoder; + iEncoder = NULL; + + iState = EStateSaving; + Storage()->SaveThumbnailDataL(*iData, iFormat, ItemId(), + *iFileInfo, iSize, &aStatus); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtntask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtntask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2008-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: Base classes for multi-purpuse tasks +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + + +#include "glxtntask.h" + +#include + +#include "mglxtnthumbnailcreatorclient.h" + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnTask::CGlxtnTask(const TGlxtnTaskId& aId, const TGlxMediaId& aItemId, + MGlxtnThumbnailStorage* aStorage) + : iState(EStarting), iId(aId), iItemId(aItemId), iStorage(aStorage) + { + TRACER("CGlxtnTask::CGlxtnTask()"); + iPriority = CActive::EPriorityStandard; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnTask::~CGlxtnTask() + { + TRACER("CGlxtnTask::~CGlxtnTask()"); + } + +// ----------------------------------------------------------------------------- +// SetManager +// ----------------------------------------------------------------------------- +// +void CGlxtnTask::SetManager(CGlxtnTaskManager* /*aManager*/) + { + TRACER("CGlxtnTask::SetManager()"); + // No implementation - can be overridden by subclasses + } + +// ----------------------------------------------------------------------------- +// StartL +// ----------------------------------------------------------------------------- +// +void CGlxtnTask::StartL(TRequestStatus& aStatus) + { + TRACER("CGlxtnTask::StartL()"); + __ASSERT_DEBUG(iState == EIdle || iState == EStarting, Panic(EGlxPanicIllegalState)); + + iState = EStarting; + + TBool active = DoStartL(aStatus); + + if (active) + { + iState = ERunning; + } + else + { + iState = EComplete; // Well, that was quick + } + } + +// ----------------------------------------------------------------------------- +// Cancel +// ----------------------------------------------------------------------------- +// +void CGlxtnTask::Cancel() + { + TRACER("CGlxtnTask::Cancel()"); + if ( ERunning == iState ) + { + DoCancel(); + } + + iState = ECanceled; + } + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +// +void CGlxtnTask::RunL(TRequestStatus& aStatus) + { + TRACER("void CGlxtnTask::RunL()"); + __ASSERT_DEBUG(iState == ERunning, Panic(EGlxPanicIllegalState)); + + TBool active = DoRunL(aStatus); + + if (!active) + { + iState = EComplete; // The task is done + } + } + +// ----------------------------------------------------------------------------- +// RunError +// ----------------------------------------------------------------------------- +// +void CGlxtnTask::RunError(TInt aError) + { + TRACER("void CGlxtnTask::RunError()"); + if ( !DoRunError(aError) ) + { + iState = EComplete; // The task is done + } + } + +// ----------------------------------------------------------------------------- +// SelfComplete +// ----------------------------------------------------------------------------- +// +void CGlxtnTask::SelfComplete(TRequestStatus& aStatus) + { + TRACER("CGlxtnTask::SelfComplete()"); + aStatus = KRequestPending; + TRequestStatus* status = &aStatus; + User::RequestComplete(status, KErrNone); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnClientTask::CGlxtnClientTask(const TGlxtnTaskId& aId, + const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) : + CGlxtnTask(aId, aItemId, aClient.ThumbnailStorage()), iClient(aClient) + { + TRACER("CGlxtnClientTask::CGlxtnClientTask()"); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtntaskmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtntaskmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,346 @@ +/* +* Copyright (c) 2008-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: Task manager for multiple tasks. Allows asynchronosity and +* tracking/callback for long running tasks. +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtntaskmanager.h" + +#include + +#include "glxtnbackgroundgenerationtask.h" +#include "glxtntask.h" + +const TInt KGlxTMMaxTasksToRunInOneRound = 4; +// ----------------------------------------------------------------------------- +// Static Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnTaskManager* CGlxtnTaskManager::NewL() + { + TRACER("CGlxtnTaskManager::NewL()"); + CGlxtnTaskManager* self = new (ELeave) CGlxtnTaskManager(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnTaskManager::CGlxtnTaskManager() + : CActive(EPriorityStandard) + { + TRACER("CGlxtnTaskManager::CGlxtnTaskManager()"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxtnTaskManager::ConstructL() + { + TRACER("void CGlxtnTaskManager::ConstructL()"); + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnTaskManager::~CGlxtnTaskManager() + { + TRACER("CGlxtnTaskManager::~CGlxtnTaskManager()"); + Cancel(); + iTasks.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// Task by id +// ----------------------------------------------------------------------------- +// +CGlxtnTask* CGlxtnTaskManager::Task(const TGlxtnTaskId& aId) const + { + TRACER("CGlxtnTaskManager::Task(const TGlxtnTaskId& aId)"); + TInt count = iTasks.Count(); + for (TInt i = 0; i < count; i++) + { + CGlxtnTask* task = iTasks[i]; + if (task->Id() == aId) + { + return task; + } + } + + // Not found + return NULL; + } + +// ----------------------------------------------------------------------------- +// AddTaskL +// ----------------------------------------------------------------------------- +// +void CGlxtnTaskManager::AddTaskL(CGlxtnTask* aTask, TExecutionOrder aExecutionOrder) + { + TRACER("CGlxtnTaskManager::AddTaskL()"); + __ASSERT_DEBUG(aTask, Panic(EGlxPanicNullPointer)); + __ASSERT_DEBUG(iTasks.Find(aTask) == KErrNotFound, Panic(EGlxPanicIllegalArgument)); // Task already added + CleanupStack::PushL(aTask); + + // Order manually to allow full control over placement of tasks when + // priorities are the same + TInt priority = aTask->Priority(); + TInt count = iTasks.Count(); + + TInt pos = 0; + while ( pos < count ) + { + TInt compPriority = iTasks[pos]->Priority(); + if ( compPriority < priority + || (compPriority == priority && EFirstOut == aExecutionOrder) ) + { + break; + } + + pos++; + } + + iTasks.InsertL(aTask, pos); + CleanupStack::Pop(aTask); + + aTask->SetManager(this); + + // Start processing the task if this active object is not already doing something else + if ( !iCurrentTask && !IsActive() ) + { + AsyncRun(); + } + else if( dynamic_cast(iCurrentTask) && (!dynamic_cast(aTask)) ) + { + iCurrentTask->Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// CancelTasks +// Cancel all tasks relating to a given media item. +// ----------------------------------------------------------------------------- +// +void CGlxtnTaskManager::CancelTasks(const TGlxMediaId& aItemId) + { + TRACER("CGlxtnTaskManager::CancelTasks()"); + TInt count = iTasks.Count(); + + if( aItemId == TGlxMediaId(0) ) + { + if( dynamic_cast(iCurrentTask) ) + { + iCurrentTask->Cancel(); + } + } + + for ( TInt i = 0; i < count; i++ ) + { + CGlxtnTask* task = iTasks[i]; + + if ( task->ItemId() == aItemId ) + { + task->Cancel(); + } + } + } + +// ----------------------------------------------------------------------------- +// CancelTasks +// Cancel all tasks using a given storage. +// ----------------------------------------------------------------------------- +// +void CGlxtnTaskManager::CancelTasks(MGlxtnThumbnailStorage* aStorage) + { + TRACER("void CGlxtnTaskManager::CancelTasks()"); + TInt count = iTasks.Count(); + + for ( TInt i = 0; i < count; i++ ) + { + CGlxtnTask* task = iTasks[i]; + + if ( task->Storage() == aStorage ) + { + task->Cancel(); + } + } + } + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +// +void CGlxtnTaskManager::RunL() + { + TRACER("void CGlxtnTaskManager::RunL()"); + TInt taskIndex = 0; + TInt tasksRun = 0; + while ( taskIndex < iTasks.Count() ) + { + if ( iCurrentTask ) + { + if ( CGlxtnTask::EStarting == iCurrentTask->State() ) + { + // Start the task + iCurrentTask->StartL(iStatus); + } + else if ( CGlxtnTask::ERunning == iCurrentTask->State() ) + { + // Let the task run + iCurrentTask->RunL(iStatus); + } + + if ( CGlxtnTask::ERunning == iCurrentTask->State() ) + { + SetActive(); + return; + } + + // Task completed or cancelled, delete the task immediately + __ASSERT_DEBUG(iStatus != KRequestPending, Panic(EGlxPanicIllegalState)); + __ASSERT_DEBUG(CGlxtnTask::EComplete == iCurrentTask->State() + || CGlxtnTask::ECanceled == iCurrentTask->State(), Panic(EGlxPanicIllegalState)); + + // Search for the task again, since the processing of the task might have added new tasks to the queue + TInt index = iTasks.Find(iCurrentTask); + __ASSERT_DEBUG(index != KErrNotFound, Panic(EGlxPanicLogicError)); + iTasks.Remove(index); + delete iCurrentTask; + iCurrentTask = NULL; + + // Start from top, since the task might have added another task + taskIndex = 0; + } + else + { + CGlxtnTask* task = iTasks[taskIndex]; + CGlxtnTask::TState state = task->State(); + + switch ( state ) + { + case CGlxtnTask::EIdle: + // Task not started. Ignore and try next task + taskIndex++; // Skip + break; + case CGlxtnTask::EStarting: + { + // Start the task + iCurrentTask = task; + + // Update active object priority to match task priority + TInt priority = task->Priority(); + if ( priority != Priority() ) + { + SetPriority(priority); + } + + // Check if too many tasks have been run during this call to RunL. + // This check exist to make sure a blocking loop does not occur, in which + // a task creates another task which completes immediately, which creates + // another task, which also completes immediately. (Task don't have to + // be asynchronous.) + tasksRun++; + if ( tasksRun >= KGlxTMMaxTasksToRunInOneRound ) + { + AsyncRun(); + return; + } + } + break; + case CGlxtnTask::ECanceled: + // Task is canceled, remove from queue + delete task; + iTasks.Remove(taskIndex); + break; + default: + Panic(EGlxPanicIllegalState); // Unknown or wrong state + break; + } + } + } + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnTaskManager::DoCancel() + { + TRACER("CGlxtnTaskManager::DoCancel()"); + TInt count = iTasks.Count(); + for (TInt i = 0; i < count; i++) + { + CGlxtnTask* task = iTasks[i]; + CGlxtnTask::TState state = task->State(); + if (state == CGlxtnTask::ERunning) + { + task->Cancel(); + } + } + } + +// ----------------------------------------------------------------------------- +// RunError +// ----------------------------------------------------------------------------- +// +TInt CGlxtnTaskManager::RunError(TInt aError) + { + TRACER("CGlxtnTaskManager::RunError()"); + if ( iCurrentTask ) + { + iCurrentTask->RunError(aError); + + if ( CGlxtnTask::ERunning == iCurrentTask->State() ) + { + SetActive(); + } + else + { + AsyncRun(); + } + + return KErrNone; + } + + return aError; + } + +// ----------------------------------------------------------------------------- +// AsyncRun +// ----------------------------------------------------------------------------- +// +void CGlxtnTaskManager::AsyncRun() + { + TRACER("CGlxtnTaskManager::AsyncRun()"); + // Issue a self-completing request. + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnthumbnailcreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnthumbnailcreator.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2008-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: Classes for thumbnail-related tasks. +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnthumbnailcreator.h" + +#include "glxpanic.h" +#include "glxtnbackgroundgenerationtask.h" +#include "glxtncleanuptask.h" +#include "glxtndeletethumbnailstask.h" +#include "glxtnfileutility.h" +#include "glxtnfilteravailabletask.h" +#include "glxtngeneratethumbnailtask.h" +#include "glxtnquickthumbnailtask.h" +#include "glxtntaskmanager.h" +#include "glxtnthumbnailrequest.h" +#include "glxtnzoomedimagetask.h" +#include "mglxtnthumbnailcreatorclient.h" + +#include +#include + +// ----------------------------------------------------------------------------- +// InstanceL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxtnThumbnailCreator* CGlxtnThumbnailCreator::InstanceL() + { + TRACER("CGlxtnThumbnailCreator::InstanceL()"); + CGlxtnThumbnailCreator* instance + = reinterpret_cast(Dll::Tls()); + + // Create instance if does not exist + if ( !instance ) + { + instance = new (ELeave) CGlxtnThumbnailCreator(); + CleanupStack::PushL(instance); + instance->ConstructL(); + CleanupStack::Pop(instance); + + Dll::SetTls(instance); + } + + // Add user + instance->iReferenceCount++; + + return instance; + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxtnThumbnailCreator::Close(MGlxtnThumbnailStorage* aStorage) + { + TRACER("CGlxtnThumbnailCreator::Close()"); + // Cancel any tasks using the client's storage + if ( aStorage ) + { + iTaskManager->CancelTasks(aStorage); + } + + __ASSERT_DEBUG(iReferenceCount > 0, Panic(EGlxPanicIllegalState)); + iReferenceCount--; + if ( iReferenceCount < 1 ) + { + Dll::SetTls(NULL); + delete this; + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnThumbnailCreator::CGlxtnThumbnailCreator() + { + TRACER("CGlxtnThumbnailCreator::CGlxtnThumbnailCreator()"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxtnThumbnailCreator::ConstructL() + { + TRACER("CGlxtnThumbnailCreator::ConstructL()"); + iFileUtility = CGlxtnFileUtility::NewL(); + iTaskManager = CGlxtnTaskManager::NewL(); + iSettingsModel = CGlxSettingsModel::InstanceL(); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnThumbnailCreator::~CGlxtnThumbnailCreator() + { + TRACER("CGlxtnThumbnailCreator::~CGlxtnThumbnailCreator()"); + delete iTaskManager; + delete iFileUtility; + if (iSettingsModel) + { + iSettingsModel->Close(); + } + } + +// ----------------------------------------------------------------------------- +// FetchThumbnailL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxtnThumbnailCreator::FetchThumbnailL( + const TGlxThumbnailRequest& aRequestInfo, + MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("void CGlxtnThumbnailCreator::FetchThumbnailL()"); + // Create the task + CGlxtnTask* task = NULL; + + if ( 0 == aRequestInfo.iBitmapHandle ) + { + task = CGlxtnBackgroundGenerationTask::NewL(aRequestInfo.iId, + *iFileUtility, aClient, iSettingsModel->SupportedOrientations() ); + } + else if ( ( 0 == aRequestInfo.iSizeClass.iWidth) || ( 0 == aRequestInfo.iSizeClass.iHeight ) ) + { + User::Leave(KErrArgument); + } + else if ( !aRequestInfo.iCroppingRect.IsEmpty() ) + { + task = CGlxtnZoomedImageTask::NewL(aRequestInfo, + *iFileUtility, aClient); + } + else if ( TGlxThumbnailRequest::EPrioritizeQuality == aRequestInfo.iPriorityMode ) + { + task = CGlxtnGenerateThumbnailTask::NewL(aRequestInfo, + *iFileUtility, aClient); + } + else + { + task = CGlxtnQuickThumbnailTask::NewL(aRequestInfo, + *iFileUtility, aClient); + } + + iTaskManager->AddTaskL(task); // Takes ownership + } + +// ----------------------------------------------------------------------------- +// DeleteThumbnailsL +// Starts deleting all stored thumbnails for a given item. This will result +// in a callback to MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete(). +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxtnThumbnailCreator::DeleteThumbnailsL( + const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("void CGlxtnThumbnailCreator::DeleteThumbnailsL()"); + iTaskManager->AddTaskL(CGlxtnDeleteThumbnailsTask::NewL(aItemId, aClient)); + } + +// ----------------------------------------------------------------------------- +// FilterAvailableThumbnailsL +// Starts the filtering of items for which a thumbnail is available from a +// list of item IDs. This will result in a callback to +// MGlxtnThumbnailCreatorClient::FilterAvailableComplete(). +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxtnThumbnailCreator::FilterAvailableThumbnailsL( + const TArray& aItemArray, const TSize& aSize, + MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("void CGlxtnThumbnailCreator::FilterAvailableThumbnailsL()"); + iTaskManager->AddTaskL(CGlxtnFilterAvailableTask::NewL(aItemArray, aSize, + aClient)); + } + +// ----------------------------------------------------------------------------- +// CleanupThumbnailsL +// Starts the cleanup of obsolete thumbnails from storage. There is no +// callback indicating completion of the request. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxtnThumbnailCreator::CleanupThumbnailsL( + MGlxtnThumbnailStorage* aStorage) + { + TRACER("void CGlxtnThumbnailCreator::CleanupThumbnailsL()"); + iTaskManager->AddTaskL(CGlxtnCleanupTask::NewL(aStorage)); + } + +// ----------------------------------------------------------------------------- +// CancelRequest +// Cancel any ongoing tasks for a given item. This ensures the TNC is not +// locking the media file. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxtnThumbnailCreator::CancelRequest(const TGlxMediaId& aItemId) + { + TRACER("void CGlxtnThumbnailCreator::CancelRequest()"); + iTaskManager->CancelTasks(aItemId); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnvideoutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnvideoutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2008-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: Utility for creating bitmaps from video files +* +*/ + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnvideoutility.h" + +#include +#include +#include + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnVideoUtility::CGlxtnVideoUtility() : iDestination(NULL) + { + TRACER("CGlxtnVideoUtility::CGlxtnVideoUtility()"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnVideoUtility::~CGlxtnVideoUtility() + { + TRACER("CGlxtnVideoUtility::~CGlxtnVideoUtility()"); + delete iVideoInfo; + } + +// ----------------------------------------------------------------------------- +// GetVideoFrameL +// ----------------------------------------------------------------------------- +// +void CGlxtnVideoUtility::GetVideoFrameL(TRequestStatus* aRequestStatus, + CFbsBitmap*& aDestination, const TDesC& aFileName, + RArray& aTargetSizes, TDisplayMode aMode) + { + TRACER("void CGlxtnVideoUtility::GetVideoFrameL(TRequestStatus* aRequestStatus, CFbsBitmap*& aDestination, const TDesC& aFileName, RArray& aTargetSizes, TDisplayMode aMode)"); + if ( iRequestStatus ) + { + User::Leave(KErrNotReady); + } + + iDisplayMode = aMode; + iSize = aTargetSizes[0]; + + iRequestStatus = aRequestStatus; + *iRequestStatus = KRequestPending; + + iDestination = &aDestination; + delete *iDestination; + *iDestination = NULL; + + delete iVideoInfo; + iVideoInfo = NULL; +#ifdef ENABLE_VED + iVideoInfo = CVedVideoClipInfo::NewL(aFileName, *this); +#else + iVideoInfo = CTNEVideoClipInfo::NewL(aFileName, *this); +#endif + } + + +// ----------------------------------------------------------------------------- +// Cancel +// ----------------------------------------------------------------------------- +// +void CGlxtnVideoUtility::Cancel() + { + TRACER("void CGlxtnVideoUtility::Cancel()"); + if ( iVideoInfo ) + { +#ifdef ENABLE_VED + iVideoInfo->CancelFrame(); +#else + iVideoInfo->CancelThumb(); +#endif + delete iVideoInfo; + iVideoInfo = NULL; + + if (iRequestStatus) + { + User::RequestComplete(iRequestStatus, KErrCancel); + } + } + } + +// ----------------------------------------------------------------------------- +// NotifyVideoClipInfoReady +// ----------------------------------------------------------------------------- +// +#ifdef ENABLE_VED +void CGlxtnVideoUtility::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, + TInt aError ) +#else +void CGlxtnVideoUtility::NotifyVideoClipInfoReady( CTNEVideoClipInfo& aInfo, + TInt aError ) +#endif + { + TRACER("void CGlxtnVideoUtility::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, TInt aError )"); + __ASSERT_DEBUG(&aInfo == iVideoInfo, Panic(EGlxPanicIllegalArgument)); + + + + if ( KErrNone == aError ) + { +#ifdef ENABLE_VED + TRAP(aError, iVideoInfo->GetFrameL(*this, KFrameIndexBestThumb, + NULL /*aResolution*/, iDisplayMode)); +#else + TRAP(aError, iVideoInfo->GetThumbL(*this, KBestThumbIndex, + NULL/*&iSize*/, iDisplayMode)); +#endif + } + + if ( KErrNone != aError ) + { + User::RequestComplete(iRequestStatus, aError); + } + } + +// ----------------------------------------------------------------------------- +// NotifyVideoClipFrameCompleted +// ----------------------------------------------------------------------------- +// +#ifdef ENABLE_VED +void CGlxtnVideoUtility::NotifyVideoClipFrameCompleted( + CVedVideoClipInfo& aInfo, TInt aError, CFbsBitmap* aFrame ) +#else +void CGlxtnVideoUtility::NotifyVideoClipThumbCompleted( + CTNEVideoClipInfo& aInfo, TInt aError, CFbsBitmap* aFrame ) +#endif + { + TRACER("void CGlxtnVideoUtility::NotifyVideoClipFrameCompleted( CVedVideoClipInfo& aInfo, TInt aError, CFbsBitmap* aFrame )"); + __ASSERT_DEBUG(&aInfo == iVideoInfo, Panic(EGlxPanicIllegalArgument)); + *iDestination = aFrame; + + User::RequestComplete(iRequestStatus, aError); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnvolumedatabase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnvolumedatabase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,937 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CGlxtnVolumeDatabase +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnvolumedatabase.h" + +#include +#include +#include + +#include "glxtnfileinfo.h" +#include "mglxtnvolumedatabaseobserver.h" + +#include +_LIT(KGlxCreateTableIds, "CREATE TABLE Ids (MediaId UNSIGNED INTEGER NOT NULL, ThumbId UNSIGNED INTEGER NOT NULL)"); +_LIT(KGlxCreateTableItems, "CREATE TABLE Items (Uri VARCHAR NOT NULL, ThumbId UNSIGNED INTEGER NOT NULL, FileSize INTEGER, ModTime TIME)"); +_LIT(KGlxCreateTableThumbnails, "CREATE TABLE Thumbnails (ThumbId UNSIGNED INTEGER NOT NULL, Width INTEGER NOT NULL, Height INTEGER NOT NULL, Format INTEGER NOT NULL, ImageData LONG VARBINARY NOT NULL)"); +_LIT(KGlxCreateIndexIds, "CREATE UNIQUE INDEX IdIndex ON Ids (MediaId)"); +_LIT(KGlxCreateIndexItems, "CREATE UNIQUE INDEX ItemIndex ON Items (ThumbId ASC)"); +_LIT(KGlxCreateIndexThumbnails, "CREATE UNIQUE INDEX ThumbnailIndex ON Thumbnails (ThumbId, Width, Height)"); +_LIT(KGlxCreateIndexThumbIds, "CREATE UNIQUE INDEX ThumbIdIndex ON Ids (ThumbId)"); + +_LIT(KGlxTableIds, "Ids"); +_LIT(KGlxTableItems, "Items"); +_LIT(KGlxTableThumbnails, "Thumbnails"); +_LIT(KGlxIndexItems, "ItemIndex"); +_LIT(KGlxIndexThumbIds, "ThumbIdIndex"); + +const TInt KGlxColIdMediaId = 1; +const TInt KGlxColIdThumbId = 2; + +const TInt KGlxColItemUri = 1; +const TInt KGlxColItemId = 2; +const TInt KGlxColItemFileSize = 3; +const TInt KGlxColItemModTime = 4; + +const TInt KGlxColThumbnailId = 1; +const TInt KGlxColThumbnailWidth = 2; +const TInt KGlxColThumbnailHeight = 3; +const TInt KGlxColThumbnailFormat = 4; +const TInt KGlxColThumbnailData = 5; + +_LIT(KGlxQueryThumbIdFromIds, "SELECT * FROM Ids WHERE MediaId = "); +_LIT(KGlxQueryThumbIdFromItems, "SELECT * FROM Items WHERE Uri = "); +_LIT(KGlxQueryThumbnail, "SELECT * FROM Thumbnails WHERE ThumbId = %d AND Width = %d AND Height = %d"); +_LIT(KGlxQueryAvailable, "SELECT ThumbId, Width, Height FROM Thumbnails WHERE ThumbId = %d AND Width = %d AND Height = %d"); +_LIT(KGlxQueryItems, "SELECT * FROM Items WHERE ThumbId = %d"); + +_LIT(KGlxDeleteId, "DELETE FROM Ids WHERE MediaId = %d"); +_LIT(KGlxDeleteThumbnails, "DELETE FROM Thumbnails WHERE ThumbId = %d"); +_LIT(KGlxDeleteItem, "DELETE FROM Items WHERE ThumbId = %d"); + +const TInt KGlxTIntMaxDigits = 11; + +const TUint KGlxFirstThumbnailId = 1; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxtnVolumeDatabase* CGlxtnVolumeDatabase::NewLC( + MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs, const TDesC& aPath) + { + TRACER("CGlxtnVolumeDatabase* CGlxtnVolumeDatabase::NewLC( MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs, const TDesC& aPath)"); + CGlxtnVolumeDatabase* self = + new (ELeave) CGlxtnVolumeDatabase(aObserver, aFs); + CleanupStack::PushL(self); + self->ConstructL(aPath); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnVolumeDatabase::CGlxtnVolumeDatabase( + MGlxtnVolumeDatabaseObserver& aObserver, + RFs& aFs) + : CActive(EPriorityStandard), + iObserver(aObserver), iFs(aFs), iState(EStateIdle) + { + TRACER("CGlxtnVolumeDatabase::CGlxtnVolumeDatabase( MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs)"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::ConstructL(const TDesC& aPath) + { + TRACER("void CGlxtnVolumeDatabase::ConstructL(const TDesC& aPath)"); + iDrive = aPath.Left(KMaxDriveName); + + TRAPD(error, OpenDbL(iFs, aPath)); + GLX_LOG_INFO1("CGlxtnVolumeDatabase::ConstructL OpenDbL TRAP error = %d", error); + if ( KErrNone != error ) + { + iDatabase.Close(); + delete iStore; + iStore = NULL; + CreateDbL(iFs, aPath); + } + + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnVolumeDatabase::~CGlxtnVolumeDatabase() + { + TRACER("CGlxtnVolumeDatabase::~CGlxtnVolumeDatabase()"); + Cancel(); + iView.Close(); + iTable.Close(); + iDbUpdater.Close(); + iDatabase.Close(); + delete iStore; + } + +// ----------------------------------------------------------------------------- +// Drive +// ----------------------------------------------------------------------------- +// +const TDesC& CGlxtnVolumeDatabase::Drive() const + { + TRACER("TDesC& CGlxtnVolumeDatabase::Drive()"); + return iDrive; + } + +// ----------------------------------------------------------------------------- +// GetThumbnailIdL +// Look up thumbnail ID from Ids table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::GetThumbnailIdL( const TGlxMediaId& aMediaId ) + { + TRACER("void CGlxtnVolumeDatabase::GetThumbnailIdL( const TGlxMediaId& aMediaId )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + + GLX_LOG_INFO1("CGlxtnVolumeDatabase::GetThumbnailIdL() Media Id= %d",aMediaId.Value()); + HBufC* sql = HBufC::NewLC( + KGlxQueryThumbIdFromIds().Length() + KGlxTIntMaxDigits ); + *sql = KGlxQueryThumbIdFromIds; + sql->Des().AppendNum( aMediaId.Value() ); + + EvaluateQueryL( *sql ); + iState = EStateGettingIdFromMediaId; + + CleanupStack::PopAndDestroy(sql); + } + +// ----------------------------------------------------------------------------- +// GetThumbnailIdL +// Look up thumbnail ID from Items table. If not found, add new record. +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::GetThumbnailIdL(const CGlxtnFileInfo* aInfo) + { + TRACER("void CGlxtnVolumeDatabase::GetThumbnailIdL(const CGlxtnFileInfo* aInfo)"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + + iInfo = aInfo; + HBufC* uri = QuoteSqlStringLC(iInfo->FilePath()); + HBufC* sql = HBufC::NewLC( + KGlxQueryThumbIdFromItems().Length() + uri->Length()); + *sql = KGlxQueryThumbIdFromItems; + sql->Des().Append(*uri); + + EvaluateQueryL( *sql ); + iState = EStateGettingIdFromFilename; + + CleanupStack::PopAndDestroy(sql); + CleanupStack::PopAndDestroy(uri); + } + +// ----------------------------------------------------------------------------- +// GetThumbnailIdL +// Retrieve the thumbnail id to be assigned to the next thumbnail that gets stored in the database. +// ----------------------------------------------------------------------------- +// +TGlxtnThumbnailId CGlxtnVolumeDatabase::GetThumbnailId() + { + GLX_LOG_ENTRY_EXIT("void CGlxtnVolumeDatabase::GetThumbnailIdL()"); + TGlxtnThumbnailId thumbId( iNextThumbId ); + iNextThumbId++; + GLX_LOG_INFO1("CGlxtnVolumeDatabase::InitializeThumbIdL iNextThumbId=%d", iNextThumbId); + return thumbId; + } + +// ----------------------------------------------------------------------------- +// StoreThumbnailIdL +// Add record to Ids table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::StoreThumbnailIdL( const TGlxMediaId& aMediaId, + const TGlxtnThumbnailId& aThumbId ) + { + TRACER("void CGlxtnVolumeDatabase::StoreThumbnailIdL( const TGlxMediaId& aMediaId, const TGlxtnThumbnailId& aThumbId )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + GLX_LOG_INFO1("StoreThumbnailIdL():- Media Id = %d",aMediaId.Value()); + GLX_LOG_INFO1("StoreThumbnailIdL():- aThumbId = %d",aThumbId.Value()); + RDbTable table; + CleanupClosePushL(table); + User::LeaveIfError( table.Open( + iDatabase, KGlxTableIds, RDbRowSet::EInsertOnly ) ); + + table.InsertL(); + table.SetColL( KGlxColIdMediaId, aMediaId.Value() ); + table.SetColL( KGlxColIdThumbId, aThumbId.Value() ); + table.PutL(); + GLX_LOG_INFO2("StoreThumbnailIdL():- Added media id [%d] and thumb id [%d] to Ids table. ", aMediaId.Value(), aThumbId.Value()); + + CleanupStack::PopAndDestroy(&table); + + iObserver.HandleThumbnailIdStoredL(); + } + +void CGlxtnVolumeDatabase::StoreItemsL( const TGlxtnThumbnailId& aThumbId, const CGlxtnFileInfo* aInfo ) + { + __ASSERT_ALWAYS(aInfo, Panic(EGlxPanicNullPointer)); + GLX_LOG_ENTRY_EXIT("void CGlxtnVolumeDatabase::StoreItemsL()"); + GLX_LOG_INFO1("StoreItemsL():- ThumbId Id = %d",aThumbId.Value()); + RDbTable table; + CleanupClosePushL(table); + User::LeaveIfError(table.Open(iDatabase, KGlxTableItems, RDbRowSet::EUpdatable)); + User::LeaveIfError(table.SetIndex(KGlxIndexItems)); + + TGlxtnThumbnailId thumbId( aThumbId ); + + HBufC* sql = HBufC::NewLC( KGlxQueryItems().Length() + KGlxTIntMaxDigits); + sql->Des().Format( KGlxQueryItems, thumbId.Value()); + + RDbView view; + CleanupClosePushL(view); + User::LeaveIfError(view.Prepare( + iDatabase, *sql, RDbRowSet::EReadOnly ) ); + view.EvaluateAll(); + + if (view.IsEmptyL()) + { + GLX_LOG_INFO("StoreItemsL() - Add a new record"); + table.InsertL(); + table.SetColL( KGlxColItemUri, aInfo->FilePath() ); + table.SetColL( KGlxColItemId, thumbId.Value() ); + table.SetColL( KGlxColItemFileSize, aInfo->iFileSize ); + table.SetColL( KGlxColItemModTime, aInfo->iFileTime ); + table.PutL(); + } + + CleanupStack::PopAndDestroy(&view); + CleanupStack::PopAndDestroy(sql); + CleanupStack::PopAndDestroy(&table); + } + +// ----------------------------------------------------------------------------- +// GetThumbnailL +// Look up thumbnail from Thumbnails table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::GetThumbnailL( const TGlxtnThumbnailId& aThumbId, + const TSize& aSize ) + { + TRACER("void CGlxtnVolumeDatabase::GetThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + + GLX_LOG_INFO1("GetThumbnailL():- ThumbId Id = %d",aThumbId.Value()); + GLX_LOG_INFO2("GetThumbnailL Width=%d, Height=%d", aSize.iWidth, aSize.iHeight); + HBufC* sql = HBufC::NewLC( KGlxQueryThumbnail().Length() + + 3 * KGlxTIntMaxDigits); + sql->Des().Format( KGlxQueryThumbnail, + aThumbId.Value(), aSize.iWidth, aSize.iHeight ); + + EvaluateQueryL( *sql ); + iState = EStateGettingThumbnail; + + CleanupStack::PopAndDestroy(sql); + } + +// ----------------------------------------------------------------------------- +// CheckAvailableL +// Check if thumbnail is in Thumbnails table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::CheckAvailableL( const TGlxtnThumbnailId& aThumbId, + const TSize& aSize ) + { + TRACER("void CGlxtnVolumeDatabase::CheckAvailableL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + GLX_LOG_INFO1("CheckAvailableL():- ThumbId = %d", aThumbId.Value()); + + HBufC* sql = HBufC::NewLC( KGlxQueryAvailable().Length() + + 3 * KGlxTIntMaxDigits); + sql->Des().Format( KGlxQueryAvailable, + aThumbId.Value(), aSize.iWidth, aSize.iHeight ); + + EvaluateQueryL( *sql ); + iState = EStateCheckingAvailability; + + CleanupStack::PopAndDestroy(sql); + } + +// ----------------------------------------------------------------------------- +// StoreThumbnailL +// Add record to Thumbnails table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::StoreThumbnailL( const TGlxtnThumbnailId& aThumbId, + const TSize& aSize, + TGlxImageDataFormat aFormat, + const TDesC8& aData ) + { + TRACER("void CGlxtnVolumeDatabase::StoreThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize, TGlxImageDataFormat aFormat, const TDesC8& aData )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + GLX_LOG_INFO1("StoreThumbnailL():- aThumbId = %d",aThumbId.Value()); + GLX_LOG_INFO2("StoreThumbnailL Width=%d, Height=%d", aSize.iWidth, aSize.iHeight); + + RDbTable table; + CleanupClosePushL(table); + User::LeaveIfError( table.Open( + iDatabase, KGlxTableThumbnails, RDbRowSet::EInsertOnly ) ); + + table.InsertL(); + table.SetColL( KGlxColThumbnailId, aThumbId.Value() ); + table.SetColL( KGlxColThumbnailWidth, aSize.iWidth ); + table.SetColL( KGlxColThumbnailHeight, aSize.iHeight ); + table.SetColL( KGlxColThumbnailFormat, aFormat ); + table.SetColL( KGlxColThumbnailData, aData ); + table.PutL(); + + CleanupStack::PopAndDestroy(&table); + + iObserver.HandleThumbnailStored(); + } + +// ----------------------------------------------------------------------------- +// DeleteFromIdsL +// Delete from IDs table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::DeleteIdL( const TGlxMediaId& aMediaId ) + { + TRACER("void CGlxtnVolumeDatabase::DeleteIdL( const TGlxMediaId& aMediaId )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + + GLX_LOG_INFO1("DeleteIdL():- Media Id = %d",aMediaId.Value()); + HBufC* sql = HBufC::NewLC( KGlxDeleteId().Length() + KGlxTIntMaxDigits); + + sql->Des().Format( KGlxDeleteId, aMediaId.Value() ); + + UpdateDataL( *sql ); + iState = EStateDeletingId; + + CleanupStack::PopAndDestroy(sql); + } + +// ----------------------------------------------------------------------------- +// DeleteThumbnailsL +// Delete Thumbnails from Thumbnail table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::DeleteThumbnailsL( + const TGlxtnThumbnailId& aThumbId ) + { + TRACER("void CGlxtnVolumeDatabase::DeleteThumbnailsL( const TGlxtnThumbnailId& aThumbId )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + GLX_LOG_INFO1("DeleteThumbnailsL():- aThumbId = %d",aThumbId.Value()); + + HBufC* sql = HBufC::NewLC(KGlxDeleteThumbnails().Length() + + KGlxTIntMaxDigits); + + sql->Des().Format( KGlxDeleteThumbnails, aThumbId.Value() ); + + UpdateDataL( *sql ); + iState = EStateDeletingThumbnails; + + CleanupStack::PopAndDestroy(sql); + } + +// ----------------------------------------------------------------------------- +// DeleteItemL +// Delete Item from Items table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::DeleteItemL( const TGlxtnThumbnailId& aThumbId ) + { + TRACER("void CGlxtnVolumeDatabase::DeleteItemL( const TGlxtnThumbnailId& aThumbId )"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + + GLX_LOG_INFO1("DeleteItemL():- aThumbId = %d",aThumbId.Value()); + HBufC* sql = HBufC::NewLC( KGlxDeleteItem().Length() + KGlxTIntMaxDigits); + + sql->Des().Format( KGlxDeleteItem, aThumbId.Value() ); + + UpdateDataL( *sql ); + iState = EStateDeletingItem; + + CleanupStack::PopAndDestroy(sql); + } + +// ----------------------------------------------------------------------------- +// CleanupDatabaseL +// Clean from database entries that do not have a corresponding media file +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::CleanupDatabaseL() + { + TRACER("void CGlxtnVolumeDatabase::CleanupDatabaseL()"); + if ( EStateIdle != iState ) + { + User::Leave(KErrNotReady); + } + User::LeaveIfError( iTable.Open( + iDatabase, KGlxTableItems, RDbRowSet::EUpdatable ) ); + iTable.BeginningL(); + + SetActive(); + TRequestStatus* ts = &iStatus; + User::RequestComplete(ts, KErrNone); + + iState = EStateCleaning; + } + + +// ----------------------------------------------------------------------------- +// CleanupRowL +// Test entry in one row in Items table to see if file is available. If it is +// not, delete this row and start process of deleting corresponding entries +// from Ids table and Thumbnails table +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::CleanupRowL() + { + TRACER("void CGlxtnVolumeDatabase::CleanupRowL()"); + // Get filename + iTable.GetL(); + TPtrC filename = iTable.ColDes(KGlxColItemUri); + + // does file exist? + TTime time(0); + TInt err = iFs.Modified(filename, time); + GLX_LOG_INFO1("void CGlxtnVolumeDatabase::CleanupRowL() New Time = %Ld",time.Int64()); + TTime modifiedTime(0); + modifiedTime = iTable.ColTime(KGlxColItemModTime); + GLX_LOG_INFO1("void CGlxtnVolumeDatabase::CleanupRowL() modifiedTime (from thumb Db) = %Ld",modifiedTime.Int64()); + if(err == KErrNone && (modifiedTime.Int64() == time.Int64())) + { + GLX_LOG_INFO("void CGlxtnVolumeDatabase::CleanupRowL() DBmodTime and FileModTime Same"); + //yes, file exists and not modified, so complete to go to next row + SetActive(); + TRequestStatus* ts = &iStatus; + User::RequestComplete(ts, KErrNone); + iState = EStateCleaning; + } + else + { + GLX_LOG_INFO("void CGlxtnVolumeDatabase::CleanupRowL() DBmodTime and FileModTime NOT Same"); + TUint thumbId = iTable.ColUint( KGlxColItemId ); + if (err != KErrNone) + { + GLX_LOG_INFO1("void CGlxtnVolumeDatabase::CleanupRowL() DBmodTime and FileModTime NOT Same But err = %d", err); + // Problem accessing file, so delete database entries + // First delete row in Items table + // Delete the row (entry in Items) + iTable.DeleteL(); + } + else + { + // file modified, so update the modified time in items table + iTable.UpdateL(); + iTable.SetColL(KGlxColItemModTime, time); + iTable.PutL(); + } + + // Now delete from Thumbnails + HBufC* sql = HBufC::NewLC(KGlxDeleteThumbnails().Length() + + KGlxTIntMaxDigits); + sql->Des().Format( KGlxDeleteThumbnails, thumbId ); + UpdateDataL( *sql ); + iState = EStateCleaningDeletingThumbnails; + CleanupStack::PopAndDestroy(sql); + } + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::DoCancel() + { + TRACER("void CGlxtnVolumeDatabase::DoCancel()"); + iView.Cancel(); + iTable.Close(); + iDbUpdater.Close(); + iState = EStateIdle; + } + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::RunL() + { + TRACER("void CGlxtnVolumeDatabase::RunL()"); + User::LeaveIfError(iStatus.Int()); + + // Continue any database operations which aren't finished + switch ( iState ) + { + case EStateGettingIdFromMediaId: + case EStateGettingIdFromFilename: + case EStateGettingThumbnail: + case EStateCheckingAvailability: + if ( iView.Unevaluated() ) + { + iView.Evaluate(iStatus); + SetActive(); + return; + } + break; + case EStateDeletingId: + case EStateDeletingThumbnails: + case EStateDeletingItem: + case EStateCleaningDeletingThumbnails: + if(iStatus.Int() != 0) + { + iDbUpdater.Next(iStatus); + SetActive(); + return; + } + break; + case EStateCleaning: + // do nothing + break; + default: + Panic(EGlxPanicIllegalState); + break; + } + + // Handle results of database operation + switch ( iState ) + { + case EStateGettingIdFromMediaId: + { + TGlxtnThumbnailId thumbId; + if ( iView.FirstL() ) + { + iView.GetL(); + thumbId = iView.ColUint(KGlxColIdThumbId); + GLX_LOG_INFO1("RunL - EStateGettingIdFromMediaId IF (iView.FirstL()): ThumbId = %d", thumbId.Value()); + } + else + { + GLX_LOG_INFO("RunL - EStateGettingIdFromMediaId (iView.FirstL()): ELSE -> thumbId not retrieved" ); + } + iView.Close(); + iState = EStateIdle; + iObserver.HandleThumbnailIdFromMediaIdL(thumbId); + } + break; + + case EStateGettingIdFromFilename: + { + TGlxtnThumbnailId thumbId; + if ( iView.FirstL() ) + { + iView.GetL(); + thumbId = iView.ColUint(KGlxColItemId); + iView.Close(); + GLX_LOG_INFO1("RunL - EStateGettingIdFromFilename IF (iView.FirstL()): ThumbId = %d", thumbId.Value()); + } + else + { + iView.Close(); + GLX_LOG_INFO("RunL - EStateGettingIdFromMediaId (iView.FirstL()): ELSE -> no Thumbnail Yet. So DoAddItemL() being called" ); + thumbId = DoAddItemL(); + GLX_LOG_INFO1("RunL - EStateGettingIdFromMediaId (iView.FirstL()): ELSE -> ThumbId = %d", thumbId.Value()); + } + iState = EStateIdle; + iInfo = NULL; + GLX_LOG_INFO1("RunL - EStateGettingIdFromFilename - aThumbId = %d", thumbId.Value()); + iObserver.HandleThumbnailIdFromFilenameL(thumbId); + } + break; + + case EStateGettingThumbnail: + if ( iView.FirstL() ) + { + iView.GetL(); + TGlxImageDataFormat format = static_cast( + iView.ColInt(KGlxColThumbnailFormat)); + TInt size = iView.ColSize(KGlxColThumbnailData); + + GLX_LOG_INFO("RunL: Reading Thumbnail from dB"); + RDbColReadStream stream; + stream.OpenLC(iView, KGlxColThumbnailData); + HBufC8* data = HBufC8::NewLC(size); + TPtr8 ptr(data->Des()); + // Need to specify amount to read, as the HBufC8 can be bigger + // than requested + stream.ReadL(ptr, size); + + CleanupStack::Pop(data); + CleanupStack::PopAndDestroy(&stream); + + iView.Close(); + iState = EStateIdle; + iObserver.HandleThumbnail(format, data); + } + else + { + iView.Close(); + iState = EStateIdle; + GLX_LOG_INFO("RunL: HandleDatabaseError - KErrNotFound"); + iObserver.HandleDatabaseError(KErrNotFound); + } + break; + + case EStateDeletingId: + iState = EStateIdle; + iDbUpdater.Close(); + iObserver.HandleMediaIdDeletedL(); + break; + + case EStateDeletingThumbnails: + iState = EStateIdle; + iDbUpdater.Close(); + iObserver.HandleThumbnailsDeletedL(); + break; + + case EStateDeletingItem: + iState = EStateIdle; + iDbUpdater.Close(); + iObserver.HandleItemDeletedL(); + break; + + case EStateCheckingAvailability: + { + TInt result = KGlxThumbnailAvailable; + if ( iView.IsEmptyL() ) + { + result = KGlxThumbnailNotAvailable; + } + iView.Close(); + iState = EStateIdle; + GLX_LOG_INFO1("RunL - EStateCheckingAvailability - result = %d", result); + iObserver.HandleAvailabilityChecked(result); + } + break; + + case EStateCleaningDeletingThumbnails: + iState = EStateCleaning; + iDbUpdater.Close(); // deliberate fall through to next row + case EStateCleaning: + if(iTable.NextL()) + { + // next row + CleanupRowL(); + } + else + { + // no more rows + iTable.Close(); + iState = EStateIdle; + iObserver.HandleDatabaseCleanedL(); + } + break; + default: + Panic(EGlxPanicIllegalState); + break; + } + } + +// ----------------------------------------------------------------------------- +// RunError +// ----------------------------------------------------------------------------- +// +TInt CGlxtnVolumeDatabase::RunError(TInt aError) + { + TRACER("TInt CGlxtnVolumeDatabase::RunError(TInt aError)"); + GLX_LOG_INFO2("RunL: HandleDatabaseError - iState=%d, error=%d", + iState, aError); + TInt error = aError; + iTable.Close(); + iView.Close(); + iDbUpdater.Close(); + iInfo = NULL; + + if (aError == KErrCorrupt) + { + error = KErrCorruptThumbnailDatabase; + } + else if (aError == KErrEof) + { + error = KErrEofThumbnailDatabase; + } + + iObserver.HandleDatabaseError(error); + iState = EStateIdle; + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// OpenDbL +// Open an existing database. +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::OpenDbL(RFs& aFs, const TDesC& aFilename) + { + TRACER("void CGlxtnVolumeDatabase::OpenDbL(RFs& aFs, const TDesC& aFilename)"); + iStore = CFileStore::OpenL(aFs, aFilename, EFileRead | EFileWrite); + iDatabase.OpenL(iStore, iStore->Root()); + User::LeaveIfError(iDatabase.Recover()); + + RDbTable tableIds; + CleanupClosePushL(tableIds); + + // open and check the Ids table + User::LeaveIfError( tableIds.Open( + iDatabase, KGlxTableIds, RDbRowSet::EReadOnly ) ); + + User::LeaveIfError(tableIds.SetIndex(KGlxIndexThumbIds)); + + CleanupStack::PopAndDestroy(&tableIds); + + } + +// ----------------------------------------------------------------------------- +// InitializeThumbIdL +// Initialize thumbnail identifier to the last known value plus one. +// ----------------------------------------------------------------------------- +void CGlxtnVolumeDatabase::InitializeThumbIdL() + { + GLX_LOG_ENTRY_EXIT("void CGlxtnThumbnailDatabase::InitializeThumbIdL()"); + // Get next available thumbnail ID (synchronous) + RDbTable tableIds; + CleanupClosePushL(tableIds); + + // open and check the Ids table + User::LeaveIfError( tableIds.Open( + iDatabase, KGlxTableIds, RDbRowSet::EReadOnly ) ); + + User::LeaveIfError(tableIds.SetIndex(KGlxIndexThumbIds)); + + // Find highest thumbnail ID in use. New entries are added to the Items + // table first, and deleted from the Items table last, so all IDs in use + // will always be found there. + // Thumbnail IDs are only unique within a volume. + if ( tableIds.LastL() ) + { + tableIds.GetL(); + iNextThumbId = tableIds.ColUint(KGlxColIdThumbId) + 1; + } + else + { + // Database is empty + iNextThumbId = KGlxFirstThumbnailId; + } + GLX_LOG_INFO1("CGlxtnVolumeDatabase::InitializeThumbIdL iNextThumbId=%d", iNextThumbId); + + CleanupStack::PopAndDestroy(&tableIds); + } + +// ----------------------------------------------------------------------------- +// CreateDbL +// Create a new database. +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::CreateDbL(RFs& aFs, const TDesC& aFilename) + { + TRACER("void CGlxtnVolumeDatabase::CreateDbL(RFs& aFs, const TDesC& aFilename)"); + // Create database, overwriting any existing file + TInt err = aFs.MkDirAll(aFilename); + if ( err != KErrAlreadyExists ) + { + User::LeaveIfError(err); + } + iStore = CPermanentFileStore::ReplaceL(aFs, aFilename, + EFileRead | EFileWrite); + + iStore->SetTypeL(KPermanentFileStoreLayoutUid); + iStore->SetRootL(iDatabase.CreateL(iStore)); + iStore->CommitL(); + + + User::LeaveIfError(iDatabase.Execute(KGlxCreateTableIds)); + User::LeaveIfError(iDatabase.Execute(KGlxCreateTableItems)); + User::LeaveIfError(iDatabase.Execute(KGlxCreateTableThumbnails)); + + User::LeaveIfError(iDatabase.Execute(KGlxCreateIndexIds)); + User::LeaveIfError(iDatabase.Execute(KGlxCreateIndexThumbIds)); + User::LeaveIfError(iDatabase.Execute(KGlxCreateIndexItems)); + User::LeaveIfError(iDatabase.Execute(KGlxCreateIndexThumbnails)); + } + +// ----------------------------------------------------------------------------- +// DoAddItemL +// ----------------------------------------------------------------------------- +// +TGlxtnThumbnailId CGlxtnVolumeDatabase::DoAddItemL() + { + TRACER("TGlxtnThumbnailId CGlxtnVolumeDatabase::DoAddItemL()"); + __ASSERT_ALWAYS(iInfo, Panic(EGlxPanicNullPointer)); + RDbTable table; + CleanupClosePushL(table); + User::LeaveIfError(table.Open(iDatabase, KGlxTableItems, RDbRowSet::EInsertOnly)); + TGlxtnThumbnailId thumbId( iNextThumbId ); + GLX_LOG_INFO1("TGlxtnThumbnailId CGlxtnVolumeDatabase::DoAddItemL() thumbId =%d", thumbId.Value()); + + table.InsertL(); + table.SetColL( KGlxColItemUri, iInfo->FilePath() ); + table.SetColL( KGlxColItemId, thumbId.Value() ); + table.SetColL( KGlxColItemFileSize, iInfo->iFileSize ); + table.SetColL( KGlxColItemModTime, iInfo->iFileTime ); + table.PutL(); + + CleanupStack::PopAndDestroy(&table); + return thumbId; + } + +// ----------------------------------------------------------------------------- +// EvaluateQueryL +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::EvaluateQueryL( const TDbQuery &aQuery ) + { + TRACER("void CGlxtnVolumeDatabase::EvaluateQueryL( const TDbQuery &aQuery )"); + User::LeaveIfError( iView.Prepare( + iDatabase, aQuery, RDbRowSet::EReadOnly ) ); + iView.Evaluate( iStatus ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// UpdateDataL +// ----------------------------------------------------------------------------- +// +void CGlxtnVolumeDatabase::UpdateDataL( const TDesC& aSql ) + { + TRACER("void CGlxtnVolumeDatabase::UpdateDataL( const TDesC& aSql )"); + TInt result = iDbUpdater.Execute( iDatabase, aSql ); + + if ( result < KErrNone ) + { + iDbUpdater.Close(); + User::Leave( result ); + } + + // According to documentation a result of 0 should indicate complete + // but this does not seem to be the case + iDbUpdater.Next( iStatus ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// QuoteSqlStringLC +// ----------------------------------------------------------------------------- +// +HBufC* CGlxtnVolumeDatabase::QuoteSqlStringLC(const TDesC& aText) + { + TRACER("HBufC* CGlxtnVolumeDatabase::QuoteSqlStringLC(const TDesC& aText)"); + const TText quote('\''); + TInt length = aText.Length() + 2; + + for ( TInt i = 0; i < aText.Length(); i++ ) + { + if ( quote == aText[i] ) + { + length++; + } + } + + HBufC* text = HBufC::NewLC(length); + TPtr ptr(text->Des()); + + ptr.Append(quote); + for ( TInt i = 0; i < aText.Length(); i++ ) + { + TText chr = aText[i]; + ptr.Append(chr); + if ( quote == chr ) + { + ptr.Append(quote); + } + } + ptr.Append(quote); + + return text; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/src/glxtnzoomedimagetask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/src/glxtnzoomedimagetask.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,257 @@ +/* +* Copyright (c) 2008-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: Task to generate a cropped thumbnail for a JPEG image. +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Simon Brooks + */ + +#include "glxtnzoomedimagetask.h" + +#include +#include +#include +#include // For CExtJpegDecoder +#include + +#include "glxtnfileinfo.h" +#include "glxtnfileutility.h" +#include "glxtnthumbnailrequest.h" +#include "mglxtnthumbnailcreatorclient.h" + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxtnZoomedImageTask* CGlxtnZoomedImageTask::NewL( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) + { + TRACER("CGlxtnZoomedImageTask* CGlxtnZoomedImageTask::NewL( const TGlxThumbnailRequest& aRequestInfo, CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient)"); + CGlxtnZoomedImageTask* task = new (ELeave) CGlxtnZoomedImageTask( + aRequestInfo, aFileUtility, aClient); + CleanupStack::PushL(task); + task->ConstructL(aRequestInfo.iBitmapHandle); + CleanupStack::Pop( task ); + return task; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxtnZoomedImageTask::~CGlxtnZoomedImageTask() + { + TRACER("CGlxtnZoomedImageTask::~CGlxtnZoomedImageTask()"); + delete iDecoder; + delete iInfo; + delete iThumbnail; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxtnZoomedImageTask::CGlxtnZoomedImageTask( + const TGlxThumbnailRequest& aRequestInfo, + CGlxtnFileUtility& aFileUtility, + MGlxtnThumbnailCreatorClient& aClient) : + CGlxtnClientTask(KGlxtnTaskIdZoomedThumbnail, aRequestInfo.iId, aClient), + iFileUtility(aFileUtility), iRequestedSize(aRequestInfo.iSizeClass), + iCroppingRect(aRequestInfo.iCroppingRect), iFilter(aRequestInfo.iFilter), + iDrmAllowed(aRequestInfo.iDrmAllowed) + { + TRACER("CGlxtnZoomedImageTask::CGlxtnZoomedImageTask( const TGlxThumbnailRequest& aRequestInfo, CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient)"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxtnZoomedImageTask::ConstructL(TInt aBitmapHandle) + { + TRACER("void CGlxtnZoomedImageTask::ConstructL(TInt aBitmapHandle)"); + // Duplicate the client's bitmap + iThumbnail = new (ELeave) CFbsBitmap(); + User::LeaveIfError(iThumbnail->Duplicate(aBitmapHandle)); + } + +// ----------------------------------------------------------------------------- +// DoStartL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnZoomedImageTask::DoStartL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnZoomedImageTask::DoStartL(TRequestStatus& aStatus)"); + iInfo = new (ELeave) CGlxtnFileInfo; + Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); + iState = EStateFetchingUri; + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxtnZoomedImageTask::DoCancel() + { + TRACER("void CGlxtnZoomedImageTask::DoCancel()"); + if ( EStateFetchingUri == iState ) + { + Client().CancelFetchUri(ItemId()); + } + if ( iDecoder ) + { + iDecoder->Cancel(); + } + + iFileUtility.ClearBadFileMarker(); + } + +// ----------------------------------------------------------------------------- +// DoRunL +// ----------------------------------------------------------------------------- +// +TBool CGlxtnZoomedImageTask::DoRunL(TRequestStatus& aStatus) + { + TRACER("TBool CGlxtnZoomedImageTask::DoRunL(TRequestStatus& aStatus)"); + TInt error = aStatus.Int(); + TBool active = EFalse; + + if ( KErrNone == error ) + { + switch ( iState ) + { + case EStateFetchingUri: + { + User::LeaveIfNull(iInfo); + iFileUtility.CheckBadFileListL( iInfo->FilePath() ); + + TBool video; + iInfo->IdentifyFileL(video, iProtected); + if ( iProtected && !iDrmAllowed ) + { + User::Leave(KErrAccessDenied); + } + + DecodePartialImageL(aStatus); + active = ETrue; + iState = EStateDecoding; + } + break; + + case EStateDecoding: + // Nothing to do + break; + + default: + GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), + "CGlxtnZoomedImageTask: Illegal state" ); + break; + } + } + + if ( !active ) + { + iFileUtility.ClearBadFileMarker(); + Client().ThumbnailFetchComplete(ItemId(), + EGlxThumbnailQualityHigh, error); + } + + return active; + } + +// ----------------------------------------------------------------------------- +// DoRunError +// ----------------------------------------------------------------------------- +// +TBool CGlxtnZoomedImageTask::DoRunError(TInt aError) + { + TRACER("TBool CGlxtnZoomedImageTask::DoRunError(TInt aError)"); + iFileUtility.ClearBadFileMarker(); + Client().ThumbnailFetchComplete(ItemId(), EGlxThumbnailQualityHigh, aError); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// DecodePartialImageL +// ----------------------------------------------------------------------------- +// +void CGlxtnZoomedImageTask::DecodePartialImageL(TRequestStatus& aStatus) + { + TRACER("void CGlxtnZoomedImageTask::DecodePartialImageL(TRequestStatus& aStatus)"); + TRAPD(err, CreateDecoderL(CExtJpegDecoder::EHwImplementation)); + if ( KErrNone != err ) + { + CreateDecoderL(CExtJpegDecoder::ESwImplementation); + } + + TSize sourceSize(iDecoder->FrameInfo().iOverallSizeInPixels); + if ( 0 == sourceSize.iWidth || 0 == sourceSize.iHeight ) + { + User::Leave(KErrCorrupt); + } + + iCroppingRect.Intersection(TRect(sourceSize)); + if ( iCroppingRect.IsEmpty() ) + { + User::Leave(KErrArgument); + } + + // Find max scaling factor which won't make image smaller than target size + TInt shift = 3; + while ( shift + && (sourceSize.iWidth >> shift) < iRequestedSize.iWidth + && (sourceSize.iHeight >> shift) < iRequestedSize.iHeight ) + { + shift--; + } + TInt fudge = (1 << shift) - 1; // Used to "round up" the scaled values + TSize loadSize((iCroppingRect.Width() + fudge) >> shift, + (iCroppingRect.Height() + fudge) >> shift); + + // Resize empty bitmap to required size + User::LeaveIfError(iThumbnail->Resize(loadSize)); + + iDecoder->SetCroppingL(iCroppingRect); + iDecoder->Convert(&aStatus, *iThumbnail); + } + +// ----------------------------------------------------------------------------- +// CreateDecoderL +// ----------------------------------------------------------------------------- +// +void CGlxtnZoomedImageTask::CreateDecoderL(TInt aDecoderType) + { + TRACER("void CGlxtnZoomedImageTask::CreateDecoderL(TInt aDecoderType)"); + delete iDecoder; + iDecoder = NULL; + iDecoder = CExtJpegDecoder::FileNewL( + static_cast(aDecoderType), + iFileUtility.FsSession(), iInfo->FilePath()); + + if ( !(CExtJpegDecoder::ECapCropping & iDecoder->CapabilitiesL()) ) + { + User::Leave(KErrNotSupported); + } + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/200071D4.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/200071D4.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Simon Brooks + */ + +#include +#include "glxthumbnailcomposerplugin.hrh" + +/** + * @author David Holland + */ +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x200071D4; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2000717E; + implementations = + { + // Info for CGlxThumbnailComposerPlugin + IMPLEMENTATION_INFO + { + implementation_uid = KGlxThumbnailComposerImplementationId; + version_no = 1; + display_name = "Thumbnail Composer plugin"; + default_data = "ThumbnailComposer"; + // We for now use just extension - now way to convert MIME-type to file extensio +// opaque_data = "jpg,3gp"; + opaque_data = "jpg"; + } + }; + } + }; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,684 @@ +/* +* Copyright (c) 2008-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: Thumbnail Composer plugin +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Simon Brooks + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxthumbnailcomposerplugin.h" + +// This can be any number other than zero +const TUint KGlxBackgroundThumbnailAttributeId = 1; +const TInt KGlxThumbnailComposerInactivityTimeout = 30; // seconds +const TInt KGlxThumbnailComposerDelay = 10000; // microseconds +const TInt KGlxThumbnailComposerHarvestDelay = 5000000; // microseconds +const TInt KGlxThumbnailComposerLargeDelay = 30000000; // microseconds +const TInt KGlxDisplayStatusTimeOutDelay = 5000000; // 5 secs + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +// +CGlxThumbnailCompeserInactivityTimer::~CGlxThumbnailCompeserInactivityTimer() + { + // no implementation + } + + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CGlxThumbnailCompeserInactivityTimer* CGlxThumbnailCompeserInactivityTimer::NewL(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback) + { + TRACER("CGlxThumbnailCompeserInactivityTimer::NewL"); + CGlxThumbnailCompeserInactivityTimer* self = + new (ELeave) CGlxThumbnailCompeserInactivityTimer(aPriority, aCallback); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + CActiveScheduler::Add(self); + return self; + } + +// --------------------------------------------------------------------------- +// After +// --------------------------------------------------------------------------- +// +void CGlxThumbnailCompeserInactivityTimer::After( TTimeIntervalMicroSeconds32 aInterval ) + { + TRACER("CGlxThumbnailCompeserInactivityTimer::After"); + + // Fix for ELLZ-7DBBDZ and JPKN-7M2AYJ: to prevent a KERN EXEC 15 panic that occurs + // if a timer request is made while one is already outstanding. + Cancel(); + // Forward the call on to the base class. + CTimer::After( aInterval ); + } + +// --------------------------------------------------------------------------- +// constructor +// --------------------------------------------------------------------------- +// +CGlxThumbnailCompeserInactivityTimer::CGlxThumbnailCompeserInactivityTimer(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback) + : CTimer(aPriority), iCallback(aCallback) + { + // no implementation + } + +// --------------------------------------------------------------------------- +// RunL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailCompeserInactivityTimer::RunL() + { + TRACER("CGlxThumbnailCompeserInactivityTimer::RunL"); + + TInt dispState = KErrNotFound; + TInt ret = HAL::Get(HALData::EDisplayState, dispState); + GLX_DEBUG4("CGlxThumbnailCompeserInactivityTimer::RunL iCallback.iState = %d, ret=%d, dispState= %d", + iCallback.iState, ret, dispState ); + if (iCallback.iState && ret == KErrNone && dispState) + { + iCallback.DelayDisplayStateCheck(); + GLX_LOG_INFO("GlxThumbnailCompeser - DISPLAY ON - DO NOT PROCESS" ); + return; + } + + GLX_LOG_INFO("GlxThumbnailCompeser - DISPLAY OFF - ALLOW TO PROCESS" ); + + switch (iCallback.iState) + { + case CGlxThumbnailComposerPlugin::EStateFirstOpening: + case CGlxThumbnailComposerPlugin::EStateOpening: + { + iCallback.DoOpenCollectionL(); + break; + } + case CGlxThumbnailComposerPlugin::EStateActiveSmall: + case CGlxThumbnailComposerPlugin::EStateActiveLarge: + { + iCallback.DoRequestItemL(); + break; + } + case CGlxThumbnailComposerPlugin::EStateClosing: + { + iCallback.CloseCollection(); + break; + } + } + } + +// --------------------------------------------------------------------------- +// DoCancel +// --------------------------------------------------------------------------- +// +void CGlxThumbnailCompeserInactivityTimer::DoCancel() + { + // no implementation + } + +// --------------------------------------------------------------------------- +// RunError +// --------------------------------------------------------------------------- +// +TInt CGlxThumbnailCompeserInactivityTimer::RunError(TInt /*aError*/) + { + TRACER("CGlxThumbnailCompeserInactivityTimer::RunError"); + iCallback.ReturnToIdle(); + return KErrNone; + } + + + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CGlxThumbnailComposerPlugin* CGlxThumbnailComposerPlugin::NewL() + { + TRACER("CGlxThumbnailComposerPlugin::NewL"); + CGlxThumbnailComposerPlugin* self = + new (ELeave) CGlxThumbnailComposerPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// ~CGlxThumbnailComposerPlugin +// --------------------------------------------------------------------------- +// +CGlxThumbnailComposerPlugin::~CGlxThumbnailComposerPlugin() + { + delete iPath; + if (iCollectionUtility) + { + iCollectionUtility->Close(); + } + + if ( iInactivityTimer ) + { + iInactivityTimer->Cancel(); + } + delete iInactivityTimer; + } + +// --------------------------------------------------------------------------- +// CGlxThumbnailComposerPlugin +// --------------------------------------------------------------------------- +// +CGlxThumbnailComposerPlugin::CGlxThumbnailComposerPlugin() : iLastError(KErrNone) + { + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::ConstructL() + { + TRACER("CGlxThumbnailComposerPlugin::ConstructL"); + iInactivityTimer = CGlxThumbnailCompeserInactivityTimer::NewL(CActive::EPriorityIdle, *this); + } + +// --------------------------------------------------------------------------- +// SetObservers +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::SetObservers() + { + TRAPD(err, SetObserversL()); + GLX_ASSERT_ALWAYS( KErrNone == err, Panic( EGlxPanicEnvironment ), + "CGlxThumbnailComposerPlugin cannot set observers, reset Harvester server" ); + } + +// --------------------------------------------------------------------------- +// SetObserversL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::SetObserversL() + { + TRACER("CGlxThumbnailComposerPlugin::SetObserversL"); + if ( iSession ) + { + CMdELogicCondition* condition = + CMdELogicCondition::NewLC( ELogicConditionOperatorOr ); + +#ifdef RD_MDS_2_0 + + CMdENamespaceDef* defaultNamespace = + iSession->GetDefaultNamespaceDefL(); + + CMdEObjectDef* imageDef = defaultNamespace->GetObjectDefL( + MdeConstants::Image::KImageObject ); + condition->AddObjectConditionL( *imageDef ); + + CMdEObjectDef* videoDef = defaultNamespace->GetObjectDefL( + MdeConstants::Video::KVideoObject ); + condition->AddObjectConditionL( *videoDef ); + +#else + + CMdENamespaceDef& defaultNamespace = + iSession->GetDefaultNamespaceDefL(); + + CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( + MdeConstants::Image::KImageObject ); + condition->AddObjectConditionL( imageDef ); + + CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( + MdeConstants::Video::KVideoObject ); + condition->AddObjectConditionL( videoDef ); + +#endif + + iSession->AddObjectObserverL( *this, condition ); + CleanupStack::Pop( condition ); + + if ( iState == EStateIdle ) + { + iState = EStateFirstOpening; + iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); + } + } + } + +// --------------------------------------------------------------------------- +// RemoveObservers +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::RemoveObservers() + { + if ( iSession ) + { +#ifdef RD_MDS_2_0 + iSession->RemoveObjectObserver( *this ); +#else + TRAP_IGNORE(iSession->RemoveObjectObserverL( *this )); +#endif + } + } + +// --------------------------------------------------------------------------- +// IsComposingComplete +// --------------------------------------------------------------------------- +// +TBool CGlxThumbnailComposerPlugin::IsComposingComplete() + { + TRACER("CGlxThumbnailComposerPlugin::IsComposingComplete"); + // Need to stop background thumbnail generation activity + // when harvester requests to pause. + + if (iState != EStateIdle) + { + iState = EStateClosing; + + if ( iInactivityTimer ) + { + iInactivityTimer->Cancel(); + } + + if (iCollectionUtility) + { + iCollectionUtility->Close(); + iCollectionUtility = NULL; + } + + iState = EStateIdle; + } + + return ETrue ; //( iState == EStateIdle ); + } + +#ifdef RD_MDS_2_0 + +// --------------------------------------------------------------------------- +// HandleObjectAdded +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleObjectAdded( + CMdESession& /*aSession*/, const RArray& /*aObjectIdArray*/ ) + { + TRACER("CGlxThumbnailComposerPlugin::HandleObjectAdded"); + if ( ( iState == EStateIdle ) || ( iState == EStateFirstOpening ) || ( iState == EStateClosing ) ) + { + iInactivityTimer->Cancel(); + iState = EStateOpening; + iInactivityTimer->After(20000000); + } + else + { + iLastError = 1; + iState = EStateActiveLarge; + } + } + +// --------------------------------------------------------------------------- +// HandleObjectModified +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleObjectModified( + CMdESession& /*aSession*/, + const RArray& /*aObjectIdArray*/) + { + //no implemention needed + } + +// --------------------------------------------------------------------------- +// HandleObjectRemoved +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleObjectRemoved( + CMdESession& /*aSession*/, + const RArray& /*aObjectIdArray*/) + { + //no implemention needed + } + +#else + +void CGlxThumbnailComposerPlugin::HandleObjectNotification(CMdESession& /*aSession*/, + TObserverNotificationType aType, + const RArray& /*aObjectIdArray*/) + { + TRACER("CGlxThumbnailComposerPlugin::HandleObjectNotification"); + if (aType == ENotifyAdd) + { + if ( iState == EStateIdle ) + { + iState = EStateOpening; + iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); + } + else + { + iLastError = 1; + iState = EStateActiveLarge; + iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); + } + } + } + +#endif + +// --------------------------------------------------------------------------- +// HandleCollectionMediaL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleCollectionMediaL( + const CMPXMedia& /*aMedia*/, TInt aError ) + { + TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMediaL"); + if ( iPath && KErrNone != aError ) + { + GLX_LOG_WARNING1( "Error %d getting media", aError ); + + // Error generating thumbnails, try the next item + iLastError = aError; + iCurrentIndex++; + RequestItemL(); + } + } + +// --------------------------------------------------------------------------- +// HandleCollectionMessageL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleCollectionMessage( + CMPXMessage* aMsg, TInt /*aErr*/ ) + { + TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMessage"); + if ( iState != EStateIdle && aMsg ) + { + TRAPD( err, DoHandleCollectionMessageL( *aMsg ) ); + if ( KErrNone != err ) + { + GLX_LOG_WARNING1( "Error %d handling message", err ); + ReturnToIdle(); + } + } + } + +// --------------------------------------------------------------------------- +// HandleOpenL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleOpenL( const CMPXMedia& /*aEntries*/, + TInt /*aIndex*/, TBool /*aComplete*/, TInt aError ) + { + TRACER("CGlxThumbnailComposerPlugin::HandleOpenL"); + if ( KErrNone != aError ) + { + GLX_LOG_WARNING1( "Error %d opening collection", aError ); + ReturnToIdle(); + } + } + +// --------------------------------------------------------------------------- +// HandleOpenL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleOpenL( + const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ ) + { + // No implemention needed + } + +// --------------------------------------------------------------------------- +// HandleCommandComplete +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::HandleCommandComplete( + CMPXCommand* /*aCommandResult*/, TInt /*aError*/ ) + { + TRACER("CGlxThumbnailComposerPlugin::HandleCommandComplete"); + if( EStateCleanup == iState ) + { + ReturnToIdle(); + } + else + { + iInactivityTimer->After(0); + } + } + +// --------------------------------------------------------------------------- +// DoOpenCollectionL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::DoOpenCollectionL() + { + TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMediaL"); + if ( !iCollectionUtility ) + { + // Open isolated collection utility + iCollectionUtility = MMPXCollectionUtility::NewL( + this, KMcModeIsolated ); + } + + CMPXFilter* filter = CMPXFilter::NewL(); + CleanupStack::PushL(filter); + filter->SetTObjectValueL(KGlxFilterGeneralSortDirection, EGlxFilterSortDirectionDescending); + iCollectionUtility->Collection().SetFilterL(filter); + CleanupStack::PopAndDestroy(filter); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + // argument path all collection id + path->AppendL( KGlxCollectionPluginAllImplementationUid ); + + iCollectionUtility->Collection().OpenL( *path ); + CleanupStack::PopAndDestroy( path ); + + iState = EStateActiveSmall; + } + +// --------------------------------------------------------------------------- +// DoHandleCollectionMessageL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::DoHandleCollectionMessageL( + const CMPXMessage& aMsg ) + { + TRACER("CGlxThumbnailComposerPlugin::DoHandleCollectionMessageL"); + if ( aMsg.IsSupported( KMPXMessageGeneralId ) ) + { + TInt messageId = aMsg.ValueTObjectL( KMPXMessageGeneralId ); + + // Is it a background thumbnail message + if ( KGlxMessageIdBackgroundThumbnail == messageId ) + { + // Is it the item expected + TGlxMediaId id( ( TUint32 ) + aMsg.ValueTObjectL( KGlxBackgroundThumbnailMediaId ) ); + if ( iPath && id.Value() + == ( TUint32 )iPath->IdOfIndex( iCurrentIndex ) ) + { + TInt error = aMsg.ValueTObjectL( KGlxBackgroundThumbnailError ); + if ( error == KErrCancel ) + { + iState = EStateActiveLarge; + iLastError = error; + } + else if( KErrNone != error ) + { + GLX_LOG_WARNING1( "Error %d in command", error ); + error = KErrNone; + } + // Yes, then request the next item + iCurrentIndex++; + RequestItemL(); + } + } + else if ( KMPXMessageGeneral == messageId + && aMsg.IsSupported( KMPXMessageGeneralEvent ) ) + { + TInt messageEvent = aMsg.ValueTObjectL( KMPXMessageGeneralEvent ); + + // Is it a path changed event + if ( TMPXCollectionMessage::EPathChanged == messageEvent + && aMsg.IsSupported( KMPXMessageGeneralType ) ) + { + TInt messageType = aMsg.ValueTObjectL( KMPXMessageGeneralType ); + + if ( EMcPathChangedByOpen == messageType + && iCollectionUtility && !iPath ) + { + iPath = iCollectionUtility->Collection().PathL(); + + iCurrentIndex = 0; + RequestItemL(); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// RequestItemL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::RequestItemL() + { + TRACER("CGlxThumbnailComposerPlugin::RequestItemL"); + if ( iLastError == KErrCancel ) + { + iInactivityTimer->Inactivity(KGlxThumbnailComposerInactivityTimeout); + } + else if ( iLastError == 1 ) + { + iInactivityTimer->After(KGlxThumbnailComposerHarvestDelay); + } + else + { + iInactivityTimer->After(KGlxThumbnailComposerDelay); + } + iLastError = KErrNone; + } + +// --------------------------------------------------------------------------- +// DoRequestItemL +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::DoRequestItemL() + { + TRACER("CGlxThumbnailComposerPlugin::DoRequestItemL"); + + if ( iPath && iCurrentIndex < iPath->Count() ) + { + GLX_ASSERT_ALWAYS( iCollectionUtility, Panic( EGlxPanicNullPointer ), + "No collection utility" ); + // request next item + iPath->Set( iCurrentIndex ); + + RArray attrs; + CleanupClosePushL( attrs ); + // Add thumbnail attribute + attrs.AppendL( TMPXAttribute( + KGlxMediaIdThumbnail, KGlxBackgroundThumbnailAttributeId ) ); + + // Don't add spec for bitmap handle, to request background thumbnail + CMPXAttributeSpecs* attrSpecs = NULL; + + // Start first task + iCollectionUtility->Collection().MediaL( + *iPath, attrs.Array(), attrSpecs ); + CleanupStack::PopAndDestroy( &attrs ); + } + else + { + delete iPath; + iPath = NULL; + + if ( iState == EStateActiveLarge ) + { + // go on to do small thumbnails + DoOpenCollectionL(); + } + else + { + CMPXCommand* command + = TGlxCommandFactory::ThumbnailCleanupCommandLC(); + iCollectionUtility->Collection().CommandL( *command ); + CleanupStack::PopAndDestroy( command ); + + iState = EStateCleanup; + } + } + } + +// --------------------------------------------------------------------------- +// ReturnToIdle +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::ReturnToIdle() + { + TRACER("CGlxThumbnailComposerPlugin::ReturnToIdle"); + iState = EStateClosing; + iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); + } + +// --------------------------------------------------------------------------- +// DelayDisplayStateCheck +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::DelayDisplayStateCheck() + { + TRACER("CGlxThumbnailComposerPlugin::DelayDisplayStateCheck"); + iInactivityTimer->After(KGlxDisplayStatusTimeOutDelay); + } + +// --------------------------------------------------------------------------- +// CloseCollection +// --------------------------------------------------------------------------- +// +void CGlxThumbnailComposerPlugin::CloseCollection() + { + TRACER("CGlxThumbnailComposerPlugin::CloseCollection"); + if ( ( EStateClosing == iState ) && iCollectionUtility ) + { + iCollectionUtility->Close(); + iCollectionUtility = NULL; + iState = EStateIdle; + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2008-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: Thumbnail Composer plugin +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Simon Brooks + */ + +#ifndef __CTHUMBNAILCOMPOSERPLUGIN_H__ +#define __CTHUMBNAILCOMPOSERPLUGIN_H__ + +#include +#include +#include +class MMPXCollectionUtility; +class CMPXCollectionPath; +class CGlxThumbnailComposerPlugin; + +/** + * Timer to allow inactivity delay if background generation task is cancelled + */ +class CGlxThumbnailCompeserInactivityTimer : public CTimer + { + public: + ~CGlxThumbnailCompeserInactivityTimer(); + static CGlxThumbnailCompeserInactivityTimer* NewL(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback); + void After(TTimeIntervalMicroSeconds32 aInterval); + private: + CGlxThumbnailCompeserInactivityTimer(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback); + private: // from CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + private: + CGlxThumbnailComposerPlugin& iCallback; + }; + + +/** + * Composer plugin to initiate background generation when new items are + * harvested by the MDS harvester. + * + * @author David Holland + */ +NONSHARABLE_CLASS( CGlxThumbnailComposerPlugin ) : + public CComposerPlugin, MMPXCollectionObserver + { + public: + /** + * Construction + */ + static CGlxThumbnailComposerPlugin* NewL(); + + /** + * Destruction + */ + ~CGlxThumbnailComposerPlugin(); + + private: // From CComposerPlugin + + TBool IsComposingComplete(); + void SetObservers(); + void RemoveObservers(); + + private: // From MMdEObjectObserver + +#ifdef RD_MDS_2_0 + void HandleObjectAdded(CMdESession& aSession, + const RArray& aObjectIdArray); + void HandleObjectModified(CMdESession& aSession, + const RArray& aObjectIdArray); + void HandleObjectRemoved(CMdESession& aSession, + const RArray& aObjectIdArray); +#else + /** + * See @ref MMdEObjectObserver::HandleObjectNotification + */ + void HandleObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray); +#endif + + private: // From MMPXCollectionObserver + + void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); + void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr ); + void HandleOpenL( const CMPXMedia& aEntries, + TInt aIndex, TBool aComplete, TInt aError ); + void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, + TInt aError ); + void HandleCommandComplete( CMPXCommand* aCommandResult, + TInt aError ); + + private: + + /** + * Private constructor + */ + CGlxThumbnailComposerPlugin(); + + /** + * 2nd phase construction + */ + void ConstructL(); + + /** + * Add observers to MdE session. + */ + void SetObserversL(); + + void DoHandleCollectionMessageL( const CMPXMessage& aMsg ); + + /** + * Send next media request to the collection. + */ + void RequestItemL(); + + public: + /** + * Open "all" collection with thumbnail loadability filter. + */ + void DoOpenCollectionL(); + + /** + * Send next media request to the collection. + */ + void DoRequestItemL(); + + /** + * Free resources and go to idle state. + */ + void ReturnToIdle(); + + /** + * Delay display state check, if screen is on. + */ + void DelayDisplayStateCheck(); + + /** + * Callback for iCollectionCloser + */ + void CloseCollection(); + + public: + /** + * Enumeration of states for the plugin. + */ + enum TComposerState + { + EStateIdle, + EStateFirstOpening, + EStateOpening, + EStateActiveLarge, + EStateActiveSmall, + EStateCleanup, + EStateClosing + }; + + /** Current state of the plugin */ + TComposerState iState; + + private: + /** Isolated collection utility (owned) */ + MMPXCollectionUtility* iCollectionUtility; + + /** Path from collection (owned) */ + CMPXCollectionPath* iPath; + + /** Index of item to thumbnail */ + TInt iCurrentIndex; + + /** Timer to restart Background Harvesting once inactive */ + CGlxThumbnailCompeserInactivityTimer* iInactivityTimer; + + TInt iLastError; + }; + +#endif // __CTHUMBNAILCOMPOSERPLUGIN_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXTHUMBNAILCOMPOSERPLUGIN_HRH +#define GLXTHUMBNAILCOMPOSERPLUGIN_HRH + +// CONSTANTS + +#define KGlxThumbnailComposerImplementationId 0x200071D5 + +#endif // GLXTHUMBNAILCOMPOSERPLUGIN_HRH diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2008-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: Thumbnail Composer plugin +* +*/ + + + + +#include "../../../group/glxbuildcommon.mmh" +#include + +CAPABILITY CAP_ECOM_PLUGIN + +TARGET glxthumbnailcomposerplugin.dll +TARGETTYPE PLUGIN + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x200071D4 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +SOURCEPATH . +SOURCE glxthumbnailcomposerplugin.cpp +SOURCE glxthumbnailcomposerpluginproxy.cpp + +USERINCLUDE .. + +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../common/inc + +//System Includes for epoc32/include +APP_LAYER_SYSTEMINCLUDE + + + +start RESOURCE ./200071D4.rss +target glxthumbnailcomposerplugin.rsc +end + +LIBRARY euser.lib +LIBRARY ECom.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY glxcommon.lib +LIBRARY hal.lib // HAL + +LIBRARY ComposerPluginInterface.lib +LIBRARY MdEClient.lib +LIBRARY flogger.lib // For Logging Tracer + diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008-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: Thumbnail Composer plugin +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Simon Brooks + */ + +#include +#include +#include "glxthumbnailcomposerplugin.h" +#include "glxthumbnailcomposerplugin.hrh" + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KGlxThumbnailComposerImplementationId, + CGlxThumbnailComposerPlugin::NewL ) + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/bwins/glxcommonu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/bwins/glxcommonu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +EXPORTS + ?CopyCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVTDesC16@@ABVCMPXCollectionPath@@@Z @ 1 NONAME ; class CMPXMedia * TGlxCommandFactory::CopyCommandLC(class TDesC16 const &, class CMPXCollectionPath const &) + ?ShowRotateInToolbar@CGlxSettingsModel@@QAEHXZ @ 2 NONAME ; int CGlxSettingsModel::ShowRotateInToolbar(void) + ?CreateURIFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@ABVTDesC16@@@Z @ 3 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateURIFilterL(class TDesC16 const &) + ?CreateItemTypeFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@W4TGlxFilterItemType@@@Z @ 4 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateItemTypeFilterL(enum TGlxFilterItemType) + ?CreateExcludeContainersWithoutItemFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@VTGlxMediaId@@@Z @ 5 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(class TGlxMediaId) + ?GetResourceFilenameL@CGlxResourceUtilities@@SAXAAV?$TBuf@$0BAA@@@@Z @ 6 NONAME ; void CGlxResourceUtilities::GetResourceFilenameL(class TBuf<256> &) + ?BasicCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@HABVCMPXCollectionPath@@@Z @ 7 NONAME ; class CMPXMedia * TGlxCommandFactory::BasicCommandLC(int, class CMPXCollectionPath const &) + ?SetDescriptionCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVTDesC16@@ABVCMPXCollectionPath@@@Z @ 8 NONAME ; class CMPXMedia * TGlxCommandFactory::SetDescriptionCommandLC(class TDesC16 const &, class CMPXCollectionPath const &) + ?CreateCameraAlbumExclusionFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@XZ @ 9 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(void) + ?RemoveFromContainerCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVCMPXCollectionPath@@@Z @ 10 NONAME ; class CMPXMedia * TGlxCommandFactory::RemoveFromContainerCommandLC(class CMPXCollectionPath const &) + ?GetResourceFilenameL@CGlxResourceUtilities@@SAXAAV?$TBuf@$0BAA@@@AAVRFs@@@Z @ 11 NONAME ; void CGlxResourceUtilities::GetResourceFilenameL(class TBuf<256> &, class RFs &) + ?StartL@CGlxIadUpdate@@QAEXXZ @ 12 NONAME ; void CGlxIadUpdate::StartL(void) + ?AddToContainerCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVCMPXCollectionPath@@0@Z @ 13 NONAME ; class CMPXMedia * TGlxCommandFactory::AddToContainerCommandLC(class CMPXCollectionPath const &, class CMPXCollectionPath const &) + ?CreateCaptureDateSortFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@W4TGlxFilterSortDirection@@@Z @ 14 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateCaptureDateSortFilterL(enum TGlxFilterSortDirection) + ?MoveCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVTDesC16@@ABVCMPXCollectionPath@@@Z @ 15 NONAME ; class CMPXMedia * TGlxCommandFactory::MoveCommandLC(class TDesC16 const &, class CMPXCollectionPath const &) + ?CreateSlideShowFilterFromExistingFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@PAV2@PAVCMPXCollectionPath@@H@Z @ 16 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateSlideShowFilterFromExistingFilterL(class CMPXMedia *, class CMPXCollectionPath *, int) + ?CreateLastCaptureDateFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@XZ @ 17 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateLastCaptureDateFilterL(void) + ?CreateExcludeAnimationFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@W4TGlxFilterSortDirection@@@Z @ 18 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateExcludeAnimationFilterL(enum TGlxFilterSortDirection) + ?SupportedOrientations@CGlxSettingsModel@@QAE?AW4TSupportedOrientations@1@XZ @ 19 NONAME ; enum CGlxSettingsModel::TSupportedOrientations CGlxSettingsModel::SupportedOrientations(void) + ?ShowGeoCoordinatesInDisplay@CGlxSettingsModel@@QAEHXZ @ 20 NONAME ; int CGlxSettingsModel::ShowGeoCoordinatesInDisplay(void) + ?IsTextEntryPortrait@CGlxSettingsModel@@QAEHXZ @ 21 NONAME ; int CGlxSettingsModel::IsTextEntryPortrait(void) + ?CreateItemCountSortFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@W4TGlxFilterSortDirection@@@Z @ 22 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateItemCountSortFilterL(enum TGlxFilterSortDirection) + ?RenameCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVTDesC16@@ABVCMPXCollectionPath@@@Z @ 23 NONAME ; class CMPXMedia * TGlxCommandFactory::RenameCommandLC(class TDesC16 const &, class CMPXCollectionPath const &) + ?ExtractAttributes@TGlxFilterFactory@@SA?AVTGlxFilterProperties@@PAVCMPXMedia@@@Z @ 24 NONAME ; class TGlxFilterProperties TGlxFilterFactory::ExtractAttributes(class CMPXMedia *) + ?ParseL@TGlxCommandParser@@SAXAAVMGlxCommandParserCallback@@ABVCMPXMedia@@@Z @ 25 NONAME ; void TGlxCommandParser::ParseL(class MGlxCommandParserCallback &, class CMPXMedia const &) + ?AddToContainerCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVTDesC16@@ABVCMPXCollectionPath@@@Z @ 26 NONAME ; class CMPXMedia * TGlxCommandFactory::AddToContainerCommandLC(class TDesC16 const &, class CMPXCollectionPath const &) + ?CreateExcludeEmptyContainersFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@PAV2@@Z @ 27 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateExcludeEmptyContainersFilterL(class CMPXMedia *) + ?InstanceLC@CGlxSingletonStore@@CAPAV1@XZ @ 28 NONAME ; class CGlxSingletonStore * CGlxSingletonStore::InstanceLC(void) + ?Close@CGlxSettingsModel@@QAEXXZ @ 29 NONAME ; void CGlxSettingsModel::Close(void) + ?CreateCombinedFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@ABVTGlxFilterProperties@@PAV2@H@Z @ 30 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateCombinedFilterL(class TGlxFilterProperties const &, class CMPXMedia *, int) + ?RemoveFromContainerCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@VTGlxMediaId@@ABVCMPXCollectionPath@@@Z @ 31 NONAME ; class CMPXMedia * TGlxCommandFactory::RemoveFromContainerCommandLC(class TGlxMediaId, class CMPXCollectionPath const &) + ?NewL@CGlxIadUpdate@@SAPAV1@XZ @ 32 NONAME ; class CGlxIadUpdate * CGlxIadUpdate::NewL(void) + ??1CGlxSingletonStore@@UAE@XZ @ 33 NONAME ; CGlxSingletonStore::~CGlxSingletonStore(void) + ?IdsL@TGlxCommandParser@@SAHAAVTUid@@AAKABVCMPXMedia@@@Z @ 34 NONAME ; int TGlxCommandParser::IdsL(class TUid &, unsigned long &, class CMPXMedia const &) + ?CreateModifiedDateFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@W4TGlxFilterSortDirection@@@Z @ 35 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateModifiedDateFilterL(enum TGlxFilterSortDirection) + ?AddContainerCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVTDesC16@@H@Z @ 36 NONAME ; class CMPXMedia * TGlxCommandFactory::AddContainerCommandLC(class TDesC16 const &, int) + ?DeleteLocationCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVCMPXCollectionPath@@@Z @ 37 NONAME ; class CMPXMedia * TGlxCommandFactory::DeleteLocationCommandLC(class CMPXCollectionPath const &) + ?CreateAlphabeticSortFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@W4TGlxFilterSortDirection@@@Z @ 38 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateAlphabeticSortFilterL(enum TGlxFilterSortDirection) + ?CreateThumbnailLoadabilityFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@VTSize@@@Z @ 39 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateThumbnailLoadabilityFilterL(class TSize) + ?ThumbnailCleanupCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@XZ @ 40 NONAME ; class CMPXMedia * TGlxCommandFactory::ThumbnailCleanupCommandLC(void) + ?ShowSlideshowInToolbar@CGlxSettingsModel@@QAEHXZ @ 41 NONAME ; int CGlxSettingsModel::ShowSlideshowInToolbar(void) + ?InstanceL@CGlxSettingsModel@@SAPAV1@XZ @ 42 NONAME ; class CGlxSettingsModel * CGlxSettingsModel::InstanceL(void) + ?CreateIncludeEmptyContainersFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@PAV2@@Z @ 43 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateIncludeEmptyContainersFilterL(class CMPXMedia *) + ?DeleteCommandLC@TGlxCommandFactory@@SAPAVCMPXMedia@@ABVCMPXCollectionPath@@@Z @ 44 NONAME ; class CMPXMedia * TGlxCommandFactory::DeleteCommandLC(class CMPXCollectionPath const &) + ?CreateSlideShowFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@PAVCMPXCollectionPath@@W4TGlxFilterSortDirection@@W4TGlxFilterSortOrder@@@Z @ 45 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateSlideShowFilterL(class CMPXCollectionPath *, enum TGlxFilterSortDirection, enum TGlxFilterSortOrder) + ?Close@CGlxSingletonStore@@SAXPAVCBase@@@Z @ 46 NONAME ; void CGlxSingletonStore::Close(class CBase *) + ?CreateContainerPreviewFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@XZ @ 47 NONAME ; class CMPXMedia * TGlxFilterFactory::CreateContainerPreviewFilterL(void) + ?CreatePreviewFilterL@TGlxFilterFactory@@SAPAVCMPXMedia@@XZ @ 48 NONAME ; class CMPXMedia * TGlxFilterFactory::CreatePreviewFilterL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/cenrep/200009EE.txt Binary file photosgallery/common/cenrep/200009EE.txt has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/common/cenrep/200009EE_orientation_landscape.txt Binary file photosgallery/common/cenrep/200009EE_orientation_landscape.txt has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/common/cenrep/200009EE_orientation_portrait_landscape.txt Binary file photosgallery/common/cenrep/200009EE_orientation_portrait_landscape.txt has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/common/cenrep/keys_gallery.xls Binary file photosgallery/common/cenrep/keys_gallery.xls has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/common/eabi/glxcommonu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/eabi/glxcommonu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,54 @@ +EXPORTS + _ZN13CGlxIadUpdate4NewLEv @ 1 NONAME + _ZN13CGlxIadUpdate6StartLEv @ 2 NONAME + _ZN17CGlxSettingsModel19IsTextEntryPortraitEv @ 3 NONAME + _ZN17CGlxSettingsModel19ShowRotateInToolbarEv @ 4 NONAME + _ZN17CGlxSettingsModel21SupportedOrientationsEv @ 5 NONAME + _ZN17CGlxSettingsModel22ShowSlideshowInToolbarEv @ 6 NONAME + _ZN17CGlxSettingsModel27ShowGeoCoordinatesInDisplayEv @ 7 NONAME + _ZN17CGlxSettingsModel5CloseEv @ 8 NONAME + _ZN17CGlxSettingsModel9InstanceLEv @ 9 NONAME + _ZN17TGlxCommandParser4IdsLER4TUidRmRK9CMPXMedia @ 10 NONAME + _ZN17TGlxCommandParser6ParseLER25MGlxCommandParserCallbackRK9CMPXMedia @ 11 NONAME + _ZN17TGlxFilterFactory16CreateURIFilterLERK7TDesC16 @ 12 NONAME + _ZN17TGlxFilterFactory17ExtractAttributesEP9CMPXMedia @ 13 NONAME + _ZN17TGlxFilterFactory20CreatePreviewFilterLEv @ 14 NONAME + _ZN17TGlxFilterFactory21CreateCombinedFilterLERK20TGlxFilterPropertiesP9CMPXMediai @ 15 NONAME + _ZN17TGlxFilterFactory21CreateItemTypeFilterLE18TGlxFilterItemType @ 16 NONAME + _ZN17TGlxFilterFactory22CreateSlideShowFilterLEP18CMPXCollectionPath23TGlxFilterSortDirection19TGlxFilterSortOrder @ 17 NONAME + _ZN17TGlxFilterFactory25CreateModifiedDateFilterLE23TGlxFilterSortDirection @ 18 NONAME + _ZN17TGlxFilterFactory26CreateItemCountSortFilterLE23TGlxFilterSortDirection @ 19 NONAME + _ZN17TGlxFilterFactory27CreateAlphabeticSortFilterLE23TGlxFilterSortDirection @ 20 NONAME + _ZN17TGlxFilterFactory28CreateCaptureDateSortFilterLE23TGlxFilterSortDirection @ 21 NONAME + _ZN17TGlxFilterFactory28CreateLastCaptureDateFilterLEv @ 22 NONAME + _ZN17TGlxFilterFactory29CreateContainerPreviewFilterLEv @ 23 NONAME + _ZN17TGlxFilterFactory29CreateExcludeAnimationFilterLE23TGlxFilterSortDirection @ 24 NONAME + _ZN17TGlxFilterFactory33CreateCameraAlbumExclusionFilterLEv @ 25 NONAME + _ZN17TGlxFilterFactory33CreateThumbnailLoadabilityFilterLE5TSize @ 26 NONAME + _ZN17TGlxFilterFactory35CreateExcludeEmptyContainersFilterLEP9CMPXMedia @ 27 NONAME + _ZN17TGlxFilterFactory35CreateIncludeEmptyContainersFilterLEP9CMPXMedia @ 28 NONAME + _ZN17TGlxFilterFactory40CreateSlideShowFilterFromExistingFilterLEP9CMPXMediaP18CMPXCollectionPathi @ 29 NONAME + _ZN17TGlxFilterFactory41CreateExcludeContainersWithoutItemFilterLE11TGlxMediaId @ 30 NONAME + _ZN18CGlxSingletonStore10InstanceLCEv @ 31 NONAME + _ZN18CGlxSingletonStore5CloseEP5CBase @ 32 NONAME + _ZN18CGlxSingletonStoreD0Ev @ 33 NONAME + _ZN18CGlxSingletonStoreD1Ev @ 34 NONAME + _ZN18CGlxSingletonStoreD2Ev @ 35 NONAME + _ZN18TGlxCommandFactory13CopyCommandLCERK7TDesC16RK18CMPXCollectionPath @ 36 NONAME + _ZN18TGlxCommandFactory13MoveCommandLCERK7TDesC16RK18CMPXCollectionPath @ 37 NONAME + _ZN18TGlxCommandFactory14BasicCommandLCEiRK18CMPXCollectionPath @ 38 NONAME + _ZN18TGlxCommandFactory15DeleteCommandLCERK18CMPXCollectionPath @ 39 NONAME + _ZN18TGlxCommandFactory15RenameCommandLCERK7TDesC16RK18CMPXCollectionPath @ 40 NONAME + _ZN18TGlxCommandFactory21AddContainerCommandLCERK7TDesC16i @ 41 NONAME + _ZN18TGlxCommandFactory23AddToContainerCommandLCERK18CMPXCollectionPathS2_ @ 42 NONAME + _ZN18TGlxCommandFactory23AddToContainerCommandLCERK7TDesC16RK18CMPXCollectionPath @ 43 NONAME + _ZN18TGlxCommandFactory23DeleteLocationCommandLCERK18CMPXCollectionPath @ 44 NONAME + _ZN18TGlxCommandFactory23SetDescriptionCommandLCERK7TDesC16RK18CMPXCollectionPath @ 45 NONAME + _ZN18TGlxCommandFactory25ThumbnailCleanupCommandLCEv @ 46 NONAME + _ZN18TGlxCommandFactory28RemoveFromContainerCommandLCE11TGlxMediaIdRK18CMPXCollectionPath @ 47 NONAME + _ZN18TGlxCommandFactory28RemoveFromContainerCommandLCERK18CMPXCollectionPath @ 48 NONAME + _ZN21CGlxResourceUtilities20GetResourceFilenameLER4TBufILi256EE @ 49 NONAME + _ZN21CGlxResourceUtilities20GetResourceFilenameLER4TBufILi256EER3RFs @ 50 NONAME + _ZTI13CGlxIadUpdate @ 51 NONAME + _ZTV13CGlxIadUpdate @ 52 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Project definition file for project glxdatasourcemanager. +* +*/ + + + +#include +#include + +PRJ_EXPORTS + +/* +* To rebuild the slideshow setting central repository txt file then rebuild +* the file using this tool +* /epoc32/tools/cenrep> generate_cenrep_inifile.pl -r 3.1 -d S:mgallery/viewframework +* /uiutilities/cenrep -rd S:/mgallery/viewframework/uiutilities/cenrep +*/ + +// flags for setting the orientation + + // for device + ../cenrep/200009EE.txt /epoc32/data/z/private/10202be9/200009ee.txt + // for emulator + ../cenrep/200009EE.txt /epoc32/release/winscw/udeb/z/private/10202be9/200009ee.txt + +// Generic configuration interface for component cenrep settings +../../conf/gallery.confml CONFML_EXPORT_PATH(gallery.confml,customsw) +../../conf/gallery_200009EE.crml CRML_EXPORT_PATH(gallery_200009EE.crml,customsw) + +PRJ_MMPFILES +glxcommon.mmp + + +PRJ_TESTMMPFILES +//#include "../tsrc/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/common/group/glxcommon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/group/glxcommon.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008-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: Project definition file for project glxdatasourcemanager. +* +*/ + + + + + + + +#include +#include +#include + +#include "../../group/glxbuildcommon.mmh" + + + +TARGET glxcommon.dll +TARGETTYPE dll +UID 0x1000008d 0x200071C8 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../collectionframework/plugins/glxcollectionpluginalbums/inc +SYSTEMINCLUDE ../../collectionframework/plugins/glxcollectionpluginall/inc + +APP_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../src +SOURCE glxcommandfactory.cpp +SOURCE glxcommandparser.cpp +SOURCE glxfilterfactory.cpp +SOURCE glxresourceutilities.cpp +SOURCE glxsettingsmodel.cpp +SOURCE glxsingletonstore.cpp +SOURCE glxiadupdate.cpp + + +LIBRARY bafl.lib +LIBRARY centralrepository.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY featmgr.lib +LIBRARY lbs.lib // For TCoordinate +LIBRARY mpxcommon.lib +LIBRARY flogger.lib +LIBRARY iaupdateapi.lib //for IAD update + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxcommandfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxcommandfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,192 @@ +/* +* Copyright (c) 2008-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: Command object factory +* +*/ + + + + +#ifndef T_GLXCOMMANDFACTORY_H +#define T_GLXCOMMANDFACTORY_H + +#include +#include +#include +#include +#include + +class CMPXCollectionPath; +class MGlxMediaList; + +/** + * TGlxCommandFactory + * + * Factory that creates CMPXCommand objects that can be issued via + * CGlxMediaListCommandHandler::IssueCommandL + * + * @lib glxcommoncommandhandlers.lib + */ + NONSHARABLE_CLASS (TGlxCommandFactory) + { +public: + /** + * Creates a basic command, when a method to create a specific command is + * not available. Use of the more specific methods below instead of this method is encouranged. + * + * @param aCommandId Id of the MPX command + * @param aPath aSourcePath path for using as source items (i.e., selection information) + * and collection plugin id + * Will be included in the command object in + * KMPXCommandGeneralSourceIds + * @return a command object that has the following attributes filled in: + * KMPXCommandGeneralId + * KMPXCommandGeneralCollectionId + * KMPXCommandGeneralSourcePath (if requested) + */ + IMPORT_C static CMPXCommand* BasicCommandLC(TInt aCommandId, const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object to add a new container (album or tag). + * + * @param aTitle Title (name) of the new container. + * @param aCollectionId Id of the collection (plugin) to which the new container + * will be added. + * @return a command object. + */ + IMPORT_C static CMPXCommand* AddContainerCommandLC(const TDesC& aTitle, TInt aCollectionUid); + + /** + * Creates a command object to add items to a container. + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will be added. + * @param aSourceItems Items to add to the container. + * @param aTargetContainers Containers that items will be added to. + * Only containers that are focused (using CMPXCollectionPath::Set()) + * or selected will have the items added to them. + * @return a command object. + */ + IMPORT_C static CMPXCommand* AddToContainerCommandLC( + const CMPXCollectionPath& aSourceItems, + const CMPXCollectionPath& aTargetContainers); + + /** + * Creates a command object to add items to a container + * @param aUri source item uri. + * @param aTargetContainers Containers that item will be added to. + * Only containers that are focused (using CMPXCollectionPath::Set()) + * or selected will have the item added to them. + * @return a command object. + */ + IMPORT_C static CMPXCommand* AddToContainerCommandLC( + const TDesC& aUri, + const CMPXCollectionPath& aTargetContainers); + + /** + * Creates a command object to move items to a different drive + * @param aTargetDrive Drive to move files to, in format "C:\" + * @param aSourcePath Path to be used for selection and collection plugin id. + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will be moved. + * @return a command object. + */ + IMPORT_C static CMPXCommand* MoveCommandLC(const TDesC& aTargetDrive, + const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object to copy items to a different drive + * @param aTargetDrive Drive to copy files to, in format "C:\". + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will be copied. + * @param aSourcePath Path to be used for selection and collection plugin id. + * @return a command object. + */ + IMPORT_C static CMPXCommand* CopyCommandLC(const TDesC& aTargetDrive, + const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object for renaming a media object (container or file) + * @param aNewTitle New title (or name) for the object. + * @param aList Media list with the item that should be renamed in focus. + * Panics if more than one item has been selected on the media list. + * Panics if media list is empty. + * Panics if media list has a static item in focus. + * @return a command object. + */ + IMPORT_C static CMPXCommand* RenameCommandLC(const TDesC& aNewTitle, + const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object for deleting a media object. If media + * object is a file, it will be deleted when the command is issued. + * @param aSourcePath Path to be used for selection and collection plugin id + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will be deleted. + * @return a command object. + */ + IMPORT_C static CMPXCommand* DeleteCommandLC(const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object to remove items from a container. + * + * @param aSourcePath Path to be used for selection and collection plugin id. + * Uses the parent item in the path as the container to remove from. + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will be removed. + * @return a command object. + */ + IMPORT_C static CMPXCommand* RemoveFromContainerCommandLC(const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object to remove items from a specific container. + * + * @param aContainerId Id of the container to remove from. + * @param aSourcePath Path to be used for selection and collection plugin id. + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will be removed. + * @return a command object. + */ + IMPORT_C static CMPXCommand* RemoveFromContainerCommandLC(TGlxMediaId aContainerId, + const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object to set the description of an object. + * @param aDescription Description to set. + * @param aSourcePath Path to be used for selection and collection plugin id. + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will have their descriptions set. + * @return a command object. + */ + IMPORT_C static CMPXCommand* SetDescriptionCommandLC(const TDesC& aDescription, + const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command object to delete the location information associated with an object. + * @param aSourcePath Path to be used for selection and collection plugin id + * Only items that are focused (using CMPXCollectionPath::Set()) + * or selected will have their location deleted. + * @return a command object. + */ + IMPORT_C static CMPXCommand* DeleteLocationCommandLC(const CMPXCollectionPath& aSourcePath); + + /** + * Creates a command that cleans up thumbnails. + * @todo Improve method description. + * @return a command object. + */ + IMPORT_C static CMPXCommand* ThumbnailCleanupCommandLC(); + + }; + +#endif // T_GLXCOMMANDFACTORY_H diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxcommandparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxcommandparser.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2008-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: Command request +* +*/ + + + + +#ifndef GLXCOMMANDPARSER_H_ +#define GLXCOMMANDPARSER_H_ + +#include +#include +#include +#include + +/** + * MGlxCommandParserCallback command handling interface. + */ +NONSHARABLE_CLASS (MGlxCommandParserCallback) + { +public: + + /** + * Add container. + * @param aContainerName New container name. + */ + virtual void AddContainerL(const TDesC& aContainerName) = 0; + + /** + * Add items to container by id. + * @param aSourceIds Items to be added. + * @param aTargetContainers Containers to add items to. + */ + virtual void AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers) = 0; + + /** + * Add item to containers by URI. + * @param aSourceUri URI of item to add to the container. + * @param aTargetContainers Containers to add items to. + */ + virtual void AddToContainerL(const TDesC& aSourceUri, const RArray& aTargetContainers) = 0; + + /** + * Copy files to another drive. + * @param aSourceIds Items to be copied. + * @param aDrive Drive to copy items to. + */ + virtual void CopyL(const RArray& aSourceIds, const TDesC& aDrive) = 0; + + /** + * Move files to another drive. + * @param aSourceIds Items to be moved. + * @param aDrive Drive to move items to. + */ + virtual void MoveL(const RArray& aSourceIds, const TDesC& aDrive) = 0; + + /** + * Remove items from a container. + * @param aItemIds Items to be removed. + * @aContainerId Container id. + */ + virtual void RemoveFromContainerL(const RArray& aItemIds, const TGlxMediaId& aContainerId) = 0; + + /** + * Delete files, Remove container. + * @param aItemIds Items to be removed. + */ + virtual void DeleteL(const RArray& aItemIds) = 0; + + /** + * Rename files, Rename container. + * @param aSourceItemId Item or container to be renamed. + * @param aTitle New name (Without file extension for files). + */ + virtual void RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle) = 0; + + /** + * Set description. + * @param aItemIds Items to apply the new description to. + * @param aDescription The new description. + */ + virtual void SetDescriptionL(const RArray& aItemIds, const TDesC& aDescription) = 0; + + + /** + * Set capature location + * @param aItemIds Items to apply the capture location to. + * @param aCoordinate The capture location. + */ + virtual void SetCaptureLocationL(const RArray& aItemIds, const TCoordinate& aCoordinate) = 0; + + /** + * Clean up thumbnails. + */ + virtual void ThumbnailCleanupL() = 0; + }; + +/** + * TGlxCommandParser Parses CMPXCommand objects. + * + */ +NONSHARABLE_CLASS (TGlxCommandParser) + { +public: + /** + * Parse a command. + * This method will leave with KErrAttribute if aCommand is not valid. + * @param aCommandHandler A MGlxCommandParserCallback derived object that will be synchronously called back to handle the command. + * @param aCommand Command to be parsed. + */ + IMPORT_C static void ParseL(MGlxCommandParserCallback& aCommandHandler, const CMPXCommand& aCommand); + + /** + * Get the Ids of a command request. + * @param aCollectionUid Contains the collection UID on completion of the call. + * @param aSessionId Contains the session id on completion of the call. + * @param aCommand Command to be parsed. + * @return ETrue if the command has a session ID else EFalse. + */ + IMPORT_C static TBool IdsL(TUid& aCollectionUid, TUint32& aSessionId, const CMPXCommand& aCommand); + +private: +/// @todo minor: add method and parameter descriptions + /** + * Get an array of TGlxMediaIds from a CMPXCommand object. + * @param aAttribute required attribute (attribute must be of type CMPXCollectionPath) + * @param aIdArray on return contains a list of Ids + * @param aCommand command object that aAttribute will be requested from. + */ + static void ArrayValueL(const TMPXAttribute &aAttribute, RArray& aIdArray, const CMPXCommand& aCommand); +/// @todo minor: add method and parameter descriptions + /** + * Get an attribute of arbitary type from CMPXCommand object. + * @param aAttribute required attribute. + * @param aCommand command object that aAttribute will be requested from. + * This method will leave with KErrArgument if the requested attribute is not found. + */ + template static T ValueL(const TMPXAttribute & aAttribute, const CMPXCommand& aCommand); +/// @todo minor: add method and parameter descriptions + /** + * Get a descriptor from CMPXCommand object. + * @param aAttribute required attribute. + * @param aCommand command object that aAttribute will be requested from. + * @return Requested attribute. + * This method will leave with KErrArgument if the requested attribute is not found. + */ + static const TDesC& DescriptorValueL(const TMPXAttribute & aAttribute, const CMPXCommand& aCommand); + }; + +#endif // GLXCOMMANDPARSER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxfilterfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxfilterfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2008-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: Command object factory +* +*/ + + + + +#ifndef T_GLXFILTERFACTORY_H +#define T_GLXFILTERFACTORY_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "glxmediaid.h" +/** + * TGlxFilterFactory + * + * Factory that creates CMPXFilter objects + * + * @lib glxcommonfilters.lib + * @internal reviewed 06/06/2007 by Kimmo Hoikka + */ + +class TGlxFilterFactory + { +public: + + // The General category types + + +public: + /** + * Creates a basic filter, Used to specify Images of Video. + * + * @param TGlxMediaGeneralCategory ( EMPXImage or EMPXVideo) + * @return a filter object with array elements set specifying the filter type (Images or Video) + */ + IMPORT_C static CMPXFilter* CreateItemTypeFilterL(TGlxFilterItemType aItemType); + + /** + * Creates a URI filter, Used to specify 1 particular item (no wild cards allowed). + * + * @param const TDesC& aURI ( URI to item) + * @return a filter object with array elements set specifying URI filter type, and the + * text object set to the URI + */ + IMPORT_C static CMPXFilter* CreateURIFilterL(const TDesC& aURI); + + /** + * Creates an Alphabetic Sort filter. + * + * @return a filter object with array elements set specifying an alphabetic sort + */ + IMPORT_C static CMPXFilter* CreateAlphabeticSortFilterL(const TGlxFilterSortDirection aSortDirection = EGlxFilterSortDirectionAscending); + + /** + * Creates an Item Count Sort filter. Containers will be sorted with the greatest number + * of items first. + * + * @return a filter object with array elements set specifying an item count sort + */ + IMPORT_C static CMPXFilter* CreateItemCountSortFilterL(const TGlxFilterSortDirection aSortDirection = EGlxFilterSortDirectionDescending); + + /** + * Creates a Capture Date Sort filter. items will be sorted by capture date + * + * @return a filter object with array elements set specifying a capture date sort + */ + IMPORT_C static CMPXFilter* CreateCaptureDateSortFilterL(const TGlxFilterSortDirection aSortDirection = EGlxFilterSortDirectionAscending); + + /** + * Creates a Modified Date Sort filter. items will be sorted by modified date + * + * @return a filter object with array elements set specifying a modified date sort + */ + IMPORT_C static CMPXFilter* CreateModifiedDateFilterL(const TGlxFilterSortDirection aSortDirection = EGlxFilterSortDirectionAscending); + + /** + * Creates a System Camera Album exclusion filter. + * + * @return a filter object with array elements set specifying the Camera Album Exclusion + */ + IMPORT_C static CMPXFilter* CreateCameraAlbumExclusionFilterL(); + + /** + * Creates an min count container exclusion filter. + * + * @return a filter object with array elements set specifying exclude empty containers + */ + IMPORT_C static CMPXFilter* CreateIncludeEmptyContainersFilterL(CMPXMedia* aOriginalFilter = NULL); + + /** + * Creates a filter that excludes all containers that do not contain the specified item + * + * @return a filter object with array elements set specifying exclude empty containers + */ + IMPORT_C static CMPXFilter* CreateExcludeContainersWithoutItemFilterL(TGlxMediaId aItemId); + + /** + * Creates a filter that only contains the last captured image/video + * + * @return a filter object with array elements set specifying the only the last captured image/video to be displayed + */ + IMPORT_C static CMPXFilter* CreateLastCaptureDateFilterL(); + + /** + * Creates a filter that sets filters for the previews + * + * @return a filter object with array elements set for previews + */ + IMPORT_C static CMPXFilter* CreatePreviewFilterL(); + + + /** + * Creates a filter that sets filters for the previews for items which have containers( albums, tags ) + * + * @return a filter object with array elements set for previews + */ + IMPORT_C static CMPXFilter* CreateContainerPreviewFilterL(); + + /** + * Creates a filter that excludes anything with more than one frame + * + * @return a filter object with array elements set specifying the only the last captured image/video to be displayed + */ + IMPORT_C static CMPXFilter* CreateExcludeAnimationFilterL(const TGlxFilterSortDirection aSortDirection = EGlxFilterSortDirectionNotUsed); + + /** + * Creates a filter that only contains the thumbnails yet to be loaded + * + * @return a filter object with array elements set specifying the only the items for which thumbnail are yet to be loaded + */ + IMPORT_C static CMPXFilter* CreateThumbnailLoadabilityFilterL(TSize aSize); + + /** + * Creates a filter that most suited for the SlideShow + * + * @param aSelectedListPath - this contains the list of Id's required. If NULL it is ignored + * @param aSortDirection - Acsending or Descending + * @param aSortFilter - Alphabetic, Item Count, Capture date, Modified date, + * @param aItemTypeFilter - All, Image, Video, Video and Images, Album + * @Param aExcludeAnimation - Exlude images with FrameCount > 1, include all images + * + * @return a filter object with array elements set according to filters specified + */ + IMPORT_C static CMPXFilter* CreateSlideShowFilterL( CMPXCollectionPath* aSelectedListPath = NULL, + TGlxFilterSortDirection aSortDirection = EGlxFilterSortDirectionAscending, + TGlxFilterSortOrder aSortFilter = EGlxFilterSortOrderCaptureDate); + + /** + * Creates a filter that most suited for the SlideShow + * + * @param aOriginalFilter - Use values in this filter but overide with other parameters + * @param aSelectedListPath - this contains the list of Id's required. If NULL it is ignored + * @param aSortDirection - Acsending, Descending or use value in aOriginalFilter + * @param aItemTypeFilter - All, Image, Video, Video and Images, Album or use value in aOriginalFilter + * @Param aExcludeAnimation - Exlude images with FrameCount > 1, include all images or use value in aOriginalFilter + * + * @return a filter object with array elements set according to filters specified + */ + IMPORT_C static CMPXFilter* CreateSlideShowFilterFromExistingFilterL( CMPXFilter* aOriginalFilter, + CMPXCollectionPath* aSelectedListPath = NULL, + TBool aReverseSortDirection = EFalse); + + /** + * Creates a combined filter. items will be sorted by the filters specified + * + * @param aItemTypeFilter - Images / Video or All + * @param aSortFilter - Type of sort + * @param aSortDirection - Ascending or Descending + * @param aCameraAlbumFilter - Exclusion of Camera System Album + * @param aMinCountFilter - Min Count Fliter + * @param Min Count value + * @param aItemId, the Id of the item that containers must contain + * @param aLastCaptureDateFilter return only the last captured item + * @param aExcludeAnimation excludes images with more than 1 frame count + * @param aThumbnailLoadability return a list of items for which a thumbnail has not been generated + * @param aSize, size of thumnails for Thumbnail Loadibility filter + * @param aSelectedListPath, supplies list of requiered Ids + * @param aOriginalFilter, If supplied then aSortFilter, aSortDirection, aItemTypeFilter, and aExcludeAnimation can be inherited from this + * + * @return a filter object with array elements set as specified by the supplied filters + */ + IMPORT_C static CMPXFilter* CreateCombinedFilterL( const TGlxFilterProperties& aFilterProperties, + CMPXFilter* aOriginalFilter = NULL, + TBool aOverrideOriginal = ETrue); + + /** + * Creates a combined filter. items will be sorted by the filters specified + * + * @param aFilter - filter which may contain filter attributes + * + * @return filter properties populated from aFilter + */ + IMPORT_C static TGlxFilterProperties ExtractAttributes(CMPXFilter* aFilter); + + /** + * Creates an min count container(albums) exclusion filter. + * + * @return a filter object with array elements set specifying exclude empty containers + */ + IMPORT_C static CMPXFilter* CreateExcludeEmptyContainersFilterL(CMPXMedia* aOriginalFilter = NULL); + }; + +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxiadupdate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxiadupdate.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2008-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: Updation via IAD +* +*/ + + +#ifndef GLXIADUPDATE_H_ +#define GLXIADUPDATE_H_ + +// INCLUDES +#include +#include +#include + +// CONSTANTS +// None + +// FORWARD DECLARATIONS +class CIAUpdate; +class CIAUpdateParameters; + +// CLASS DECLARATION + + +class CGlxIadUpdate : public CBase, public MIAUpdateObserver + { + +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CGlxIadUpdate* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxIadUpdate(); + +public: // New methods + + /** + * Start IAD update process. + */ + IMPORT_C void StartL(); + +private: // Constructors and destructor + + /** + * C++ default constructor. + */ + CGlxIadUpdate(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: // New methods + + + /** + * From MIAUpdateObserver. + * This callback function is called when the update checking operation has completed. + * + * @param aErrorCode The error code of the observed update operation. + * KErrNone for successful completion, + * otherwise a system wide error code. + * @param aAvailableUpdates Number of the updates that were found available. + * + * @since S60 v3.2 + */ + void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ); + + + /** + * From MIAUpdateObserver. + * This callback function is called when an update operation has completed. + * Even if multiple functions are provided to start different update operations, + * this callback function is always called after an update operation has completed. + * + * @param aErrorCode The error code of the completed update operation. + * KErrNone for successful completion, + * otherwise a system wide error code. + * @param aResult Details about the completed update operation. + * Ownership is transferred. + * + * @since S60 v3.2 + */ + void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResultDetails ); + + + /** + * From MIAUpdateObserver. + * This callback function is called when an update query operation has completed. + * + * @param aErrorCode The error code of the observed query operation. + * KErrNone for successful completion, + * otherwise a system wide error code. + * @param aUpdateNow ETrue informs that an update operation should be started. + * EFalse informs that there is no need to start an update + * operation. + * @since Series 60 3.2 + */ + void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ); + + + /** + * Clears IAD update. + * @since Series 60 3.2 + * @param none. + * @return none. + */ + void ReleaseIADUpdate(); + +private: // Data + + + /** + * IAD update API. + */ + CIAUpdate* iUpdate; + + /** + * IAD update parameters. + */ + CIAUpdateParameters* iParameters; + + + }; + +#endif /* GLXIADUPDATE_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxresourceutilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxresourceutilities.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2008-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: Resource loading utility +* +*/ + + + + +#ifndef __C_GLXRESOURCELOADER_H__ +#define __C_GLXRESOURCELOADER_H__ + +#include +#include // for TFileName +#include +#include // Rfs + +/** + * Class with a single static method which + * finds the resource file on either the c or z drive + * class CGlxResourceUtil + * @author Loughlin Spollen + */ +NONSHARABLE_CLASS( CGlxResourceUtilities ) : CBase + { +public: + + /** + * Retrieve the full resource file name and path for a give resource + * file name. + * Note! this version connects a RFs session + * @param The resource filename to search + */ + IMPORT_C static void GetResourceFilenameL( TFileName& aResFile ); + + /** + * Retrieve the full resource file name and path for a give resource + * file name. + * @param The resource filename to search + * @param The file server session, must be connected before the call + */ + IMPORT_C static void GetResourceFilenameL( TFileName& aResFile, RFs& aFs ); + }; + + +#endif // __C_GLXRESOURCELOADER_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxsettingsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxsettingsmodel.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2008-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: MC Photos settings model + * +*/ + + + + + +#ifndef _GLXSETTINGSMDL_H_ +#define _GLXSETTINGSMDL_H_ + +#include + +// FORWARD DECLARATIONS + +class CRepository; + +// CONSTANTS +// LOCAL CONSTANTS NAMESPACE +namespace + { + // CenRep Key Ids + const TUint32 KGlxSortOrderTagManager = 0x00000001; + const TUint32 KGlxSortOrderTagBrowser = 0x00000002; + const TUint32 KGlxIconHiddenState = 0x00000003; + const TUint32 KGlxDefaultOrientation = 0x00000004; + const TUint32 KGlxDownloadLink = 0x00000005; + const TUint32 KGlxDownloadLinkIcon = 0x00000006; + const TUint32 KGlxDownloadLinkText = 0x00000007; + const TUint32 KGlxShowGeoCoordinates = 0x00000008; + } + +// CLASS DECLARATION + +/** + * GlxSettingsModel class + * + */ +NONSHARABLE_CLASS( CGlxSettingsModel ) : public CBase + { + public: + /** + * Possible values for the "supported orientations" CR key. + */ + enum TSupportedOrientations + { + ELandscapeAndPortrait = 1, + ELandscape = 2 + }; + + public: + /** + * Get singleton instance of the settings model. + */ + IMPORT_C static CGlxSettingsModel* InstanceL(); + /** + * Release instance of the settings model. + */ + IMPORT_C void Close(); + /** + * Destructor. + */ + ~CGlxSettingsModel(); + + /** + * Get the supported screen orientations for the application. + */ + IMPORT_C TSupportedOrientations SupportedOrientations(); + /** + * Does screen orientation change to portrait for text entry? + */ + IMPORT_C TBool IsTextEntryPortrait(); + /** + * Is "view in portrait/landscape" available in the toolbar? + */ + IMPORT_C TBool ShowRotateInToolbar(); + /** + * Is slideshow available in the toolbar? + */ + IMPORT_C TBool ShowSlideshowInToolbar(); + + /** + * Should geocoordinates be shown in display? + */ + IMPORT_C TBool ShowGeoCoordinatesInDisplay(); + + /** + * DEPRECATED - Introduce a new function instead of using this for more things + * Retrieves the settings value for the attribute identifier + * @param aSettingsId the identity of the setting + * @return The setting value + */ + template + /* Deprecated */ static inline T ValueL(const TUint32& aSettingsId); + + + /** + * DEPRECATED - Introduce a new function instead of using this for more things + * Persist the value of a gallery setting. + * @param aSettingsId The settings identifier for which the value is + * persisted + * @param aValue The value that is written + */ + template + /* Deprecated */ static inline void SetValueL(const TUint32& aSettingsId, T aValue); + + private: + /** + * Two phase constructor. + */ + static CGlxSettingsModel* NewL(); + /** + * Default constructor. + */ + CGlxSettingsModel(); + /** + * 2nd phase constructor. + */ + void ConstructL(); + + private: + /** Whether feature manager was successfully initialised */ + TBool iFeatureManagerInitialised; + /** Central repository for reading settings */ + CRepository* iRepository; + }; + +#include "glxsettingsmodel.inl" + +#endif // _GLXSETTINGSMDL_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxsettingsmodel.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxsettingsmodel.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2008-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 file for Gallery settings model. +* +*/ + + + + + +// CLASS HEADER +#include "glxsettingsmodel.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include + +namespace + { + const TUid KCRUidGallery = { 0x200009EE }; + } + + +// ---------------------------------------------------------------------------- +// Retrieve value for a specific attribute uid +// ---------------------------------------------------------------------------- +// +template +inline T CGlxSettingsModel::ValueL(const TUint32& aSettingsId) + { + GLX_LOG_INFO( "CGlxSettingsModel::ValueL" ); + CRepository* repository = CRepository::NewLC(KCRUidGallery); + T retVal; + User::LeaveIfError(repository->Get(aSettingsId, retVal)); + CleanupStack::PopAndDestroy(repository); + repository = NULL; + return retVal; + } + +// ---------------------------------------------------------------------------- +// Set the value for a specific attribute uid +// ---------------------------------------------------------------------------- +// +template +inline void CGlxSettingsModel::SetValueL(const TUint32& aSettingsId, T aValue) + { + GLX_LOG_INFO( "CGlxSettingsModel::SetValueL" ); +/* + TAny* ptr = User::AllocL(sizeof(T)); + memcpy(ptr, &aValue, sizeof(T)); +*/ + CRepository* repository = CRepository::NewLC(KCRUidGallery); + User::LeaveIfError(repository->Set(aSettingsId, aValue)); + CleanupStack::PopAndDestroy(repository); + repository = NULL; + } \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxsingletonstore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxsingletonstore.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: TLS store for singleton objects +* +*/ + + + + +#ifndef __C_GLXSINGLETONSTORE_H__ +#define __C_GLXSINGLETONSTORE_H__ + +#include + +/** + * CGlxSingletonStore + * + * Store for singleton objects + * + * Usage: + * + * Singleton class must be derived from CBase (either + * directly or via base class). Otherwise, singleton's destructor + * is not called correctly. + * + * class CMyClass : public CBase ... + * { + * public: + * static CMyClass* InstanceL() + * { + * // Pass in the factory function + * return CGlxSingletonStore::InstanceL(&NewL); + * } + * + * void Close() + * { + * CGlxSingletonStore::Close(this); + * } + * + * private: + * static CMyClass* NewL() + * { + * ... + * } + * }; + * + */ +NONSHARABLE_CLASS(CGlxSingletonStore) : public CBase + { +public: + /** + * Return a singleton instance and add to reference count + */ + template + static T* InstanceL(T* (*aFactoryFuncL)()); + + /** + * Decrement reference count of singleton instance + * and delete if last reference removed + */ + IMPORT_C static void Close(CBase* aInstance); + + /** Destructor */ + IMPORT_C ~CGlxSingletonStore(); + +private: + /** Constructor */ + CGlxSingletonStore(); + + /** + * Two-phase constructor + * Creates an instance if one does not already exist + * Exported for accessing from inline function + */ + IMPORT_C static CGlxSingletonStore* InstanceLC(); + + /** Cleanup function for Cleanup Stack */ + static void Cleanup(TAny* aSingletonStore); + +private: + /** Struct to store a singleton an its ref count */ + class TSingleton + { + public: + CBase* iObject; + TInt iReferenceCount; + }; + + /** Array of singletons */ + RArray iSingletons; + }; + +#include "glxsingletonstore.inl" + +#endif // __C_GLXSINGLETONSTORE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/common/inc/glxsingletonstore.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/inc/glxsingletonstore.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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: TLS store for singleton objects +* +*/ + + + + +#include +#include + +// ----------------------------------------------------------------------------- +// Return new or existing instance +// ----------------------------------------------------------------------------- +// +template +T* CGlxSingletonStore::InstanceL( T* (*aFactoryFuncL)() ) + { + // Get new or existing pointer to store. + // InstanceL stores the pointer in TLS + CGlxSingletonStore* store = InstanceLC(); + + // Try to find existing object of type T + TInt count = store->iSingletons.Count(); + TInt i = 0; + T* obj = NULL; + while (i < count && !obj) + { + obj = dynamic_cast(store->iSingletons[i].iObject); + if (obj) + { + // Found an existing object of type T + GLX_LOG_INFO1("CGlxSingletonStore::InstanceL, Found existing object %x", obj); + // Add another reference + store->iSingletons[i].iReferenceCount++; + } + i++; + } + + // Create new object if one did not exist + if ( !obj ) + { + // If these calls leave, Cleanup stack will make sure tls + // pointer is cleared, if there are no other clients for CGlxSingletonStore + // class + + // Reserve space in the array so that can safely append + store->iSingletons.ReserveL( count + 1 ); + + // Create a new object via provided factory function + obj = aFactoryFuncL(); + + // Give ownership of the new object to store + TSingleton singleton; + singleton.iObject = obj; + singleton.iReferenceCount = 1; + store->iSingletons.Append(singleton); + + GLX_LOG_INFO1 ("CGlxSingletonStore::InstanceL, Created new object %x", obj); + } + + // Remove singleton store from cleanup stack + CleanupStack::Pop(store); + + return obj; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/src/glxcommandfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/src/glxcommandfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,275 @@ +/* +* Copyright (c) 2008-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: Photos / Common +* +*/ + + + + +#include "glxcommandfactory.h" + +#include +#include +#include +#include +#include +#include + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::BasicCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::BasicCommandLC(TInt aCommandId, + const CMPXCollectionPath& aPath) + { + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL(command); + + // Set command id + command->SetTObjectValueL(KMPXCommandGeneralId, aCommandId); + + // Add collection plugin id to command object + if (aPath.Levels() > 0) + { + command->SetTObjectValueL(KMPXCommandGeneralCollectionId, TUid::Uid(aPath.Id(0))); + } + // Add path to command object + command->SetCObjectValueL(KMPXCommandGeneralSourceIds, &const_cast(aPath)); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::AddContainerCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::AddContainerCommandLC(const TDesC& aTitle, + TInt aCollectionUid) + { + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL(command); + + // Add collection plugin id to command object + command->SetTObjectValueL(KMPXCommandGeneralCollectionId, TUid::Uid(aCollectionUid)); + + // Set command id + command->SetTObjectValueL(KMPXCommandGeneralId, KGlxCommandIdAdd); + + // Set title of new object + command->SetTextValueL(KMPXMediaGeneralTitle, aTitle); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::AddToContainerCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::AddToContainerCommandLC( + const CMPXCollectionPath& aSourceItems, + const CMPXCollectionPath& aTargetContainers) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdAdd, aSourceItems); + + // Add path of selected items + command->SetCObjectValueL(KMPXMediaGeneralContainerId, &const_cast(aTargetContainers)); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::AddToContainerCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::AddToContainerCommandLC( + const TDesC& aUri, + const CMPXCollectionPath& aTargetContainers) + { + + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL(command); + + // Set command id + command->SetTObjectValueL(KMPXCommandGeneralId, KGlxCommandIdAdd); + + // Set URI + command->SetTextValueL(KMPXCommandGeneralSourceUri, aUri); + + // Add path of selected items + command->SetCObjectValueL(KMPXMediaGeneralContainerId, &const_cast(aTargetContainers)); + + // Add collection plugin id to command object +/// @todo minor: Add comment as to the meaning of the value zero in Comparison and aTargetContainers.Id(0) + if (aTargetContainers.Levels() > 0) + { + command->SetTObjectValueL(KMPXCommandGeneralCollectionId, TUid::Uid(aTargetContainers.Id(0))); + } + + return command; + } + + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::MoveCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::MoveCommandLC(const TDesC& aTargetDrive, + const CMPXCollectionPath& aSourcePath) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdSet, aSourcePath); + + // Set target drive + command->SetTextValueL(KMPXMediaGeneralDrive, aTargetDrive); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::CopyCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::CopyCommandLC(const TDesC& aTargetDrive, + const CMPXCollectionPath& aSourcePath) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdAdd, aSourcePath); + + // Set target drive + command->SetTextValueL(KMPXMediaGeneralDrive, aTargetDrive); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::RenameCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::RenameCommandLC(const TDesC& aNewTitle, + const CMPXCollectionPath& aSourcePath) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdSet, aSourcePath); + + // Set title + command->SetTextValueL(KMPXMediaGeneralTitle, aNewTitle); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::DeleteCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::DeleteCommandLC(const CMPXCollectionPath& aSourcePath) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdRemove, aSourcePath); + + // Set container as "device" + command->SetTObjectValueL(KMPXMediaGeneralContainerId, KGlxContainerDevice); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::RemoveFromContainerCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::RemoveFromContainerCommandLC( + const CMPXCollectionPath& aSourcePath) + { + const TInt KMinLevels = 2; + + CMPXCommand* command = BasicCommandLC(KGlxCommandIdRemove, aSourcePath); + // The first level should be the UID of the collection plugin. + // The second level should be an id of a container (tag or album). + ASSERT(aSourcePath.Levels() > KMinLevels); + // Set container to remove from as container of items in path + command->SetTObjectValueL( + KMPXMediaGeneralContainerId, + aSourcePath.Id(aSourcePath.Levels() - KMinLevels)); // The index of the level below the current level. (Levels() returns a count not an index) + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::RemoveFromContainerCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::RemoveFromContainerCommandLC(TGlxMediaId aContainerId, + const CMPXCollectionPath& aSourcePath) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdRemove, aSourcePath); + + command->SetTObjectValueL( + KMPXMediaGeneralContainerId, aContainerId.Value()); + + return command; + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::SetDescriptionCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::SetDescriptionCommandLC(const TDesC& aDescription, + const CMPXCollectionPath& aSourcePath) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdSet, aSourcePath); + + // Set description + command->SetTextValueL(KMPXMediaGeneralComment, aDescription); + + return command; + } + + +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::DeleteLocationCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::DeleteLocationCommandLC( + const CMPXCollectionPath& aSourcePath) + { + CMPXCommand* command = BasicCommandLC(KGlxCommandIdSet, aSourcePath); + + // Set command id + command->SetTObjectValueL(KGlxMediaGeneralLocation, TCoordinate()); + + return command; + } + +// ----------------------------------------------------------------------------- +// TGlxCommandFactory::ThumbnailCleanupCommandLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCommand* TGlxCommandFactory::ThumbnailCleanupCommandLC() + { + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL(command); + + // Set command id + command->SetTObjectValueL(KMPXCommandGeneralId, KGlxCommandThumbnailCleanup); + + return command; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/src/glxcommandparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/src/glxcommandparser.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2008-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: Command request +* +*/ + + + + + +#include "glxcommandparser.h" + +#include +#include +#include +#include +#include +#include + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandParser::ParseL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxCommandParser::ParseL(MGlxCommandParserCallback& aCommandHandler, const CMPXCommand& aCommand) + { + TUint32 commandId = ValueL(KMPXCommandGeneralId, aCommand); + + RArray sourceIdArray; + CleanupClosePushL(sourceIdArray); + + RArray targetIdArray; + CleanupClosePushL(targetIdArray); + + switch (commandId) + { + case KGlxCommandIdAdd: + { + TBool hasTitle = aCommand.IsSupported(KMPXMediaGeneralTitle); + TBool hasSourceIds = aCommand.IsSupported(KMPXCommandGeneralSourceIds); + TBool hasUri = aCommand.IsSupported(KMPXCommandGeneralSourceUri); + TBool hasTargetIds = aCommand.IsSupported(KMPXMediaGeneralContainerId); + TBool hasDrive = aCommand.IsSupported(KMPXMediaGeneralDrive); + + if (hasSourceIds) + { + ArrayValueL(KMPXCommandGeneralSourceIds, sourceIdArray, aCommand); + } + if (hasTargetIds) + { + ArrayValueL(KMPXMediaGeneralContainerId, targetIdArray, aCommand); + } + +/// @todo minor: Rowland Cook 12/06/2007 Could this be restrctured to be more efficient? +// IE - Test for invalid combiations before retrieving the data. + + if(hasTitle) + { + if(hasUri || hasSourceIds || hasDrive || hasTargetIds) + { + User::Leave(KErrArgument); + } + aCommandHandler.AddContainerL(DescriptorValueL(KMPXMediaGeneralTitle, aCommand)); + } + else if (hasUri) + { + if (hasSourceIds || hasDrive || !hasTargetIds) + // Illegal parameter combination + { + User::Leave(KErrArgument); + } + aCommandHandler.AddToContainerL(DescriptorValueL(KMPXCommandGeneralSourceUri, aCommand), targetIdArray); + } + else if (hasSourceIds) + { + if (hasTargetIds) + { + if (hasDrive) + // Illegal parameter combination + { + User::Leave(KErrArgument); + } + aCommandHandler.AddToContainerL(sourceIdArray, targetIdArray); + } + else if (hasDrive) + { + aCommandHandler.CopyL(sourceIdArray, DescriptorValueL(KMPXMediaGeneralDrive, aCommand)); + } + else + // There isn't a target + { + User::Leave(KErrArgument); + } + } + else // There isn't a source + { + User::Leave(KErrArgument); + } + break; + } + case KGlxCommandIdRemove: + { + ArrayValueL(KMPXCommandGeneralSourceIds, sourceIdArray, aCommand); + TGlxMediaId containerId (ValueL(KMPXMediaGeneralContainerId, aCommand)); + if (containerId == KGlxContainerDevice) + { + aCommandHandler.DeleteL(sourceIdArray); + } + else + { + aCommandHandler.RemoveFromContainerL(sourceIdArray, containerId); + } + break; + } + case KGlxCommandIdSet: + { + TBool hasTitle = aCommand.IsSupported(KMPXMediaGeneralTitle); + TBool hasDrive = aCommand.IsSupported(KMPXMediaGeneralDrive); + TBool hasComment = aCommand.IsSupported(KMPXMediaGeneralComment); + TBool hasLocation = aCommand.IsSupported(KGlxMediaGeneralLocation); + + ArrayValueL(KMPXCommandGeneralSourceIds, sourceIdArray, aCommand); + + if (hasTitle) + // Rename operation + { + if (hasDrive || hasComment || hasLocation || sourceIdArray.Count() < 1) + // Unsupported attribute combination + { + User::Leave(KErrArgument); + } + const TDesC& title = DescriptorValueL(KMPXMediaGeneralTitle, aCommand); + aCommandHandler.RenameL(sourceIdArray[0], title); + } + else if (hasDrive) + { + if(hasComment || hasLocation) + // Unsupported attribute combination + { + User::Leave(KErrArgument); + } + const TDesC& drive = DescriptorValueL(KMPXMediaGeneralDrive, aCommand); + aCommandHandler.MoveL(sourceIdArray, drive); + } + else if (hasComment) + { + if ( hasLocation ) + // Unsupported attribute combination + { + User::Leave(KErrArgument); + } + const TDesC& comment = DescriptorValueL(KMPXMediaGeneralComment, aCommand); + aCommandHandler.SetDescriptionL(sourceIdArray, comment); + } + else if (hasLocation) + { + TCoordinate coordinate = aCommand.ValueTObjectL(KGlxMediaGeneralLocation); + aCommandHandler.SetCaptureLocationL(sourceIdArray, coordinate); + } + else + { + + User::Leave(KErrArgument); + } + break; + } + case KGlxCommandThumbnailCleanup: + { + aCommandHandler.ThumbnailCleanupL(); + break; + } + } + CleanupStack::PopAndDestroy(&targetIdArray); + CleanupStack::PopAndDestroy(&sourceIdArray); + + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandParser::IdsL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TGlxCommandParser::IdsL(TUid& aCollectionUid, TUint32& aSessionId, const CMPXCommand& aCommand) + { + aCollectionUid = ValueL(KMPXCommandGeneralCollectionId, aCommand); + if ( aCommand.IsSupported(KMPXCommandGeneralSessionId) ) + { + aSessionId = aCommand.ValueTObjectL(KMPXCommandGeneralSessionId); + return ETrue; + } + else + { + return EFalse; + } + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TTGlxCommandParser::ArrayValueL +// ----------------------------------------------------------------------------- +// +void TGlxCommandParser::ArrayValueL(const TMPXAttribute & aAttribute, RArray& aArray, const CMPXCommand& aCommand) + { + if (!aCommand.IsSupported(aAttribute) || aCommand.Type(aAttribute) != EMPXTypeCObject) + { + User::Leave(KErrArgument); + } + + const CMPXCollectionPath* path = aCommand.ValueCObjectL(aAttribute); + RArray list; + path->SelectionL(list); + + if (list.Count() == 0) // append the current item + { + aArray.AppendL(TGlxMediaId(path->Id())); + } + else + { + for( TInt i = 0 ; i < list.Count() ; i++ ) + { + aArray.AppendL(TGlxMediaId(list[i])); + } + } + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandParser::ValueL +// ----------------------------------------------------------------------------- +// +template T TGlxCommandParser::ValueL(const TMPXAttribute & aAttribute, const CMPXCommand& aCommand) + { + if ( !aCommand.IsSupported(aAttribute) ) + { + User::Leave(KErrArgument); + } + return aCommand.ValueTObjectL(aAttribute); + } + +/// @todo minor: Rowland Cook 12/06/2007 Add method decription. +// ----------------------------------------------------------------------------- +// TGlxCommandParser::DescriptorValueL +// ----------------------------------------------------------------------------- +// +const TDesC& TGlxCommandParser::DescriptorValueL(const TMPXAttribute& aAttribute, const CMPXCommand& aCommand) + { + if (!aCommand.IsSupported(aAttribute) || aCommand.Type(aAttribute) != EMPXTypeText) + { + User::Leave(KErrArgument); + } + return aCommand.ValueText(aAttribute); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/common/src/glxfilterfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/src/glxfilterfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,557 @@ +/* +* Copyright (c) 2008-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: Command object factory +* +*/ + + + +#include +#include "glxfilterfactory.h" + +// --------------------------------------------------------------------------- +// Creates a General filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateItemTypeFilterL(TGlxFilterItemType aItemType) + { + TGlxFilterProperties filterProperties; + filterProperties.iItemType = aItemType; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a URI filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateURIFilterL(const TDesC& aURI) + { + GLX_FUNCL("TGlxFilterFactory::CreateURIFilterL()"); + + TGlxFilterProperties filterProperties; + filterProperties.iUri = &aURI; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates an alpabetic sort filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateAlphabeticSortFilterL(const TGlxFilterSortDirection aSortDirection) + { + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderAlphabetical; + filterProperties.iSortDirection = aSortDirection; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates an item count sort filter object. The containers with the greatest +// number of items are listed first +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateItemCountSortFilterL(const TGlxFilterSortDirection aSortDirection) + { + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderItemCount; + filterProperties.iSortDirection = aSortDirection; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a capture date sort filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateCaptureDateSortFilterL(const TGlxFilterSortDirection aSortDirection) + { + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = aSortDirection; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a modified date sort filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateModifiedDateFilterL(const TGlxFilterSortDirection aSortDirection) + { + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderModifiedDate; + filterProperties.iSortDirection = aSortDirection; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a camera album exclusion filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateCameraAlbumExclusionFilterL() + { + TGlxFilterProperties filterProperties; + filterProperties.iIncludeCameraAlbum = EFalse; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates an empty container exclusion filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateIncludeEmptyContainersFilterL(CMPXMedia* aOriginalFilter) + { + TGlxFilterProperties filterProperties; + filterProperties.iMinCount = -1; + return CreateCombinedFilterL(filterProperties, aOriginalFilter, ETrue); + } + +// --------------------------------------------------------------------------- +// Creates aa filter that excludes all caontainers that does not contain a +// specified item id. +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(TGlxMediaId aItemId) + { + TGlxFilterProperties filterProperties; + filterProperties.iContainsItem = aItemId; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a last capture date filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateLastCaptureDateFilterL() + { + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; + filterProperties.iLastCaptureDate = ETrue; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a preview filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreatePreviewFilterL() + { + TGlxFilterProperties filterProperties; + // Exclude empty containers + filterProperties.iMinCount = 1; + // If sorting on date, override sort direction to descending + filterProperties.iSortDirection = EGlxFilterSortDirectionOverrideToDescendingIfDate; + return CreateCombinedFilterL(filterProperties); + } + + +// --------------------------------------------------------------------------- +// Creates a preview filter object for container items (album, tags) +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateContainerPreviewFilterL() + { + TGlxFilterProperties filterProperties; + // If sorting on date, override sort direction to descending + filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; + filterProperties.iSortDirection = EGlxFilterSortDirectionOverrideToDescendingIfDate; + return CreateCombinedFilterL(filterProperties); + } + + +// --------------------------------------------------------------------------- +// Creates a last capture date filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateExcludeAnimationFilterL(const TGlxFilterSortDirection aSortDirection) + { + TGlxFilterProperties filterProperties; + filterProperties.iItemType = EGlxFilterImage; + filterProperties.iExcludeAnimation = ETrue; + filterProperties.iSortDirection = aSortDirection; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a thumbnail loadibility filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateThumbnailLoadabilityFilterL(TSize aSize) + { + TGlxFilterProperties filterProperties; + filterProperties.iThumbnailLoadability = aSize; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a filter most suited for the SlideShow +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateSlideShowFilterL( CMPXCollectionPath* aSelectedListPath, + TGlxFilterSortDirection aSortDirection, + TGlxFilterSortOrder aSortFilter) + { + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = aSortFilter; + filterProperties.iSortDirection = aSortDirection; + filterProperties.iItemType = EGlxFilterImage; + filterProperties.iPath = aSelectedListPath; + filterProperties.iNoDRM = ETrue;; + filterProperties.iExcludeAnimation = ETrue; + return CreateCombinedFilterL(filterProperties); + } + +// --------------------------------------------------------------------------- +// Creates a filter most suited for the SlideShow +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateSlideShowFilterFromExistingFilterL( CMPXFilter* aOriginalFilter, + CMPXCollectionPath* aSelectedListPath, + TBool aReverseSortDirection) + { + TGlxFilterProperties filterProperties; + filterProperties.iSortDirection = aReverseSortDirection ? EGlxFilterSortDirectionReverse : EGlxFilterSortDirectionNotUsed; + filterProperties.iItemType = EGlxFilterImage; + filterProperties.iPath = aSelectedListPath; + filterProperties.iNoDRM = ETrue;; + filterProperties.iExcludeAnimation = ETrue;; + return CreateCombinedFilterL(filterProperties, aOriginalFilter); + } + +// --------------------------------------------------------------------------- +// Creates a combined filter object. +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateCombinedFilterL( const TGlxFilterProperties& aFilterProperties, + CMPXFilter* aOriginalFilter, + TBool aOverrideOriginal) + { + GLX_FUNCL("TGlxFilterFactory::CreateCombinedFilterL()"); + + CMPXFilter* filter = CMPXFilter::NewL(); + CleanupStack::PushL(filter); + + // to prevent needing to check if aOriginalFilter is not NULL each time, + // if it is we point it to filter, which supports nothing (support is checked only before setting) + if( !aOriginalFilter ) + { + aOriginalFilter = filter; + } + + TGlxFilterItemType itemType = aFilterProperties.iItemType; + if( ( EGlxFilterMediaTypeSuppliedInFilter == aFilterProperties.iItemType ) || !aOverrideOriginal ) + { + if( aOriginalFilter->IsSupported(KGlxFilterGeneralItemType) ) + { + itemType = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralItemType); + } + } + + filter->SetTObjectValueL(KGlxFilterGeneralItemType, itemType); + + + TGlxFilterSortOrder sortFilter = aFilterProperties.iSortOrder; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralSortType) ) + { + if( !aOverrideOriginal || ( EGlxFilterSortOrderNotUsed == aFilterProperties.iSortOrder ) ) + { + sortFilter = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralSortType); + } + } + if( EGlxFilterSortOrderNotUsed != sortFilter ) + { + filter->SetTObjectValueL(KGlxFilterGeneralSortType, sortFilter); + } + + + TGlxFilterSortDirection sortDirection = aFilterProperties.iSortDirection; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralSortDirection) ) + { + if( !aOverrideOriginal || ( EGlxFilterSortDirectionNotUsed == aFilterProperties.iSortDirection ) ) + { + sortDirection = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralSortDirection); + TBool descendIfDate = ( EGlxFilterSortDirectionOverrideToDescendingIfDate == sortDirection ) && ( ( EGlxFilterSortOrderCaptureDate == sortFilter ) || ( EGlxFilterSortOrderModifiedDate == sortFilter ) ); + if( EGlxFilterSortDirectionReverse == sortDirection ) + { + if( EGlxFilterSortDirectionDescending == aFilterProperties.iSortDirection ) + { + sortDirection = EGlxFilterSortDirectionAscending; + } + else if( EGlxFilterSortDirectionAscending == aFilterProperties.iSortDirection ) + { + sortDirection = EGlxFilterSortDirectionDescending; + } + } + else if( descendIfDate ) + { + sortDirection = EGlxFilterSortDirectionDescending; + } + else if( EGlxFilterSortDirectionOverrideToDescendingIfDate == sortDirection ) + { + sortDirection = aFilterProperties.iSortDirection; + } + } + else if( aOverrideOriginal && ( EGlxFilterSortDirectionReverse == aFilterProperties.iSortDirection ) ) + { + switch(aOriginalFilter->ValueTObjectL(KGlxFilterGeneralSortDirection)) + { + case EGlxFilterSortDirectionNotUsed: + case EGlxFilterSortDirectionReverse: + { + sortDirection = EGlxFilterSortDirectionReverse; + break; + } + case EGlxFilterSortDirectionAscending: + { + sortDirection = EGlxFilterSortDirectionDescending; + break; + } + case EGlxFilterSortDirectionDescending: + { + sortDirection = EGlxFilterSortDirectionAscending; + break; + } + } + } + } + if( EGlxFilterSortDirectionNotUsed != sortDirection ) + { + filter->SetTObjectValueL(KGlxFilterGeneralSortDirection, sortDirection); + } + + TBool cameraAlbumFilter = aFilterProperties.iIncludeCameraAlbum; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralIncludeCameraAlbum) ) + { + if( !aOverrideOriginal || !aFilterProperties.iIncludeCameraAlbum ) + { + cameraAlbumFilter = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralIncludeCameraAlbum); + } + } + if( !cameraAlbumFilter ) + { + filter->SetTObjectValueL(KGlxFilterGeneralIncludeCameraAlbum, cameraAlbumFilter); + } + + + TInt minCount = aFilterProperties.iMinCount; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralMinCount) ) + { + if( !aOverrideOriginal || ( 0 == aFilterProperties.iMinCount ) ) + { + minCount = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralMinCount); + } + } + if( !(minCount == 0) ) + { + filter->SetTObjectValueL(KGlxFilterGeneralMinCount, minCount); + } + + + TGlxMediaId itemId = aFilterProperties.iContainsItem; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralItemId) ) + { + if( !aOverrideOriginal || ( TGlxMediaId(0) == aFilterProperties.iContainsItem ) ) + { + itemId = (TGlxMediaId)(TUint32)aOriginalFilter->ValueTObjectL(KGlxFilterGeneralItemId); + } + } + if( TGlxMediaId(0) != itemId ) + { + filter->SetTObjectValueL(KGlxFilterGeneralItemId, itemId.Value()); + } + + + TBool lastCaptureDateFilter = aFilterProperties.iLastCaptureDate; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralLastCaptureDate) ) + { + if( !aOverrideOriginal || !aFilterProperties.iLastCaptureDate ) + { + lastCaptureDateFilter = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralLastCaptureDate); + } + } + if( lastCaptureDateFilter ) + { + filter->SetTObjectValueL(KGlxFilterGeneralLastCaptureDate, lastCaptureDateFilter); + } + + TBool excludeAnimation = aFilterProperties.iExcludeAnimation; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralExcludeAnimation) ) + { + if( !aOverrideOriginal || !aFilterProperties.iExcludeAnimation ) + { + excludeAnimation = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralExcludeAnimation); + } + } + if( excludeAnimation ) + { + filter->SetTObjectValueL(KGlxFilterGeneralExcludeAnimation, excludeAnimation); + } + + TBool noDRM = aFilterProperties.iNoDRM; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralNoDRM) ) + { + if( !aOverrideOriginal || !aFilterProperties.iNoDRM ) + { + noDRM = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralNoDRM); + } + } + if( noDRM ) + { + filter->SetTObjectValueL(KGlxFilterGeneralNoDRM, noDRM); + } + + TSize thumbnailLoadability = aFilterProperties.iThumbnailLoadability; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralThumbnailLoadability) ) + { + if( !aOverrideOriginal || ( TSize(0,0) == aFilterProperties.iThumbnailLoadability ) ) + { + thumbnailLoadability = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralThumbnailLoadability); + } + } + if( TSize(0,0) != thumbnailLoadability ) + { + filter->SetTObjectValueL(KGlxFilterGeneralThumbnailLoadability, thumbnailLoadability); + } + + CMPXCollectionPath* path = aFilterProperties.iPath; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralMPXCollectionPath) ) + { + if( !aOverrideOriginal || !aFilterProperties.iPath ) + { + path = aOriginalFilter->ValueCObjectL(KGlxFilterGeneralMPXCollectionPath); + } + } + if( path ) + { + filter->SetCObjectValueL(KGlxFilterGeneralMPXCollectionPath, path); + } + + TBool promoteSystemItems = aFilterProperties.iPromoteSystemItems; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralSortOrderPromoteSystemItems) ) + { + if( !aOverrideOriginal || !aFilterProperties.iPromoteSystemItems ) + { + promoteSystemItems = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralSortOrderPromoteSystemItems); + } + } + if( promoteSystemItems ) + { + filter->SetTObjectValueL(KGlxFilterGeneralSortOrderPromoteSystemItems, promoteSystemItems); + } + + TGlxFilterOrigin origin = aFilterProperties.iOrigin; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralOrigin) ) + { + if( !aOverrideOriginal || ( EGlxFilterOriginNotUsed == aFilterProperties.iOrigin ) ) + { + origin = aOriginalFilter->ValueTObjectL(KGlxFilterGeneralOrigin); + } + } + if( EGlxFilterOriginNotUsed != origin ) + { + filter->SetTObjectValueL(KGlxFilterGeneralOrigin, origin); + } + + const TDesC* uri = aFilterProperties.iUri; + if( aOriginalFilter->IsSupported(KGlxFilterGeneralUri) ) + { + if( !aOverrideOriginal || ( !aFilterProperties.iUri ) ) + { + uri = &aOriginalFilter->ValueText(KGlxFilterGeneralUri); + } + } + if( uri ) + { + filter->SetTextValueL(KGlxFilterGeneralUri, *uri); + } + + CleanupStack::Pop(filter); + return filter; + } + +// --------------------------------------------------------------------------- +// Creates an empty container(for albums with no images) exclusion filter object +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXFilter* TGlxFilterFactory::CreateExcludeEmptyContainersFilterL(CMPXMedia* aOriginalFilter) + { + TGlxFilterProperties filterProperties; + filterProperties.iMinCount = 1; + return CreateCombinedFilterL(filterProperties, aOriginalFilter, ETrue); + } + + +EXPORT_C TGlxFilterProperties TGlxFilterFactory::ExtractAttributes(CMPXFilter* aFilter) + { + TGlxFilterProperties filterProperties; + // Now get the KGlxFilterGeneralibutes specified in the filter + if (aFilter->IsSupported(KGlxFilterGeneralItemType)) + { + filterProperties.iItemType = aFilter->ValueTObjectL(KGlxFilterGeneralItemType); + } + if (aFilter->IsSupported(KGlxFilterGeneralSortType)) + { + filterProperties.iSortOrder = aFilter->ValueTObjectL(KGlxFilterGeneralSortType); + } + if (aFilter->IsSupported(KGlxFilterGeneralSortDirection)) + { + filterProperties.iSortDirection = aFilter->ValueTObjectL(KGlxFilterGeneralSortDirection); + } + if (aFilter->IsSupported(KGlxFilterGeneralIncludeCameraAlbum)) + { + filterProperties.iIncludeCameraAlbum = aFilter->ValueTObjectL(KGlxFilterGeneralIncludeCameraAlbum); + } + if (aFilter->IsSupported(KGlxFilterGeneralMinCount)) + { + filterProperties.iMinCount = aFilter->ValueTObjectL(KGlxFilterGeneralMinCount); + } + if (aFilter->IsSupported(KGlxFilterGeneralItemId)) + { + filterProperties.iContainsItem = (TGlxMediaId)(TUint32)aFilter->ValueTObjectL(KGlxFilterGeneralItemId); + } + if (aFilter->IsSupported(KGlxFilterGeneralExcludeAnimation)) + { + filterProperties.iExcludeAnimation = aFilter->ValueTObjectL(KGlxFilterGeneralExcludeAnimation); + } + if (aFilter->IsSupported(KGlxFilterGeneralNoDRM)) + { + filterProperties.iNoDRM = aFilter->ValueTObjectL(KGlxFilterGeneralNoDRM); + } + if (aFilter->IsSupported(KGlxFilterGeneralLastCaptureDate)) + { + filterProperties.iLastCaptureDate = aFilter->ValueTObjectL(KGlxFilterGeneralLastCaptureDate); + } + if ( aFilter->IsSupported( KGlxFilterGeneralThumbnailLoadability ) ) + { + filterProperties.iThumbnailLoadability = aFilter->ValueTObjectL( + KGlxFilterGeneralThumbnailLoadability ); + } + if (aFilter->IsSupported(KGlxFilterGeneralMPXCollectionPath)) + { + filterProperties.iPath = aFilter->ValueCObjectL(KGlxFilterGeneralMPXCollectionPath); + } + if( aFilter->IsSupported(KGlxFilterGeneralSortOrderPromoteSystemItems) ) + { + filterProperties.iPromoteSystemItems = aFilter->ValueTObjectL(KGlxFilterGeneralSortOrderPromoteSystemItems); + } + if( aFilter->IsSupported(KGlxFilterGeneralOrigin) ) + { + filterProperties.iOrigin = aFilter->ValueTObjectL(KGlxFilterGeneralOrigin); + } + if( aFilter->IsSupported(KGlxFilterGeneralUri) ) + { + filterProperties.iUri = &aFilter->ValueText(KGlxFilterGeneralUri); + } + return filterProperties; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/src/glxiadupdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/src/glxiadupdate.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2008-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: Updation via IAD +* +*/ + + + +// INCLUDE FILES +#include "glxiadupdate.h" +#include +#include +#include +#include +#include +#include + + + +// CONSTANTS +const TUid KIADParamUid = { 0x200009EE }; // Uid of glxgallary.sis +_LIT( KIADParamExec, "glx.exe" ); + +// ======== MEMBER FUNCTIONS ======== + +// -------------------------------------------------------------------------- +// CGlxIadUpdate::NewL +// Two-phased constructor. +// -------------------------------------------------------------------------- +// +EXPORT_C CGlxIadUpdate* CGlxIadUpdate::NewL() + { + TRACER( "CGlxIadUpdate::NewL()" ); + CGlxIadUpdate* self = new( ELeave ) CGlxIadUpdate(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CGlxIadUpdate::CGlxIadUpdate +// C++ default constructor can NOT contain any code, that might leave. +// -------------------------------------------------------------------------- +// +CGlxIadUpdate::CGlxIadUpdate() + : iUpdate( NULL ), iParameters( NULL ) + { + // None + } + +// ----------------------------------------------------------------------------- +// CGlxIadUpdate::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxIadUpdate::ConstructL() + { + TRACER( "CGlxIadUpdate::ConstructL()" ); + + if( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) + { + iUpdate = CIAUpdate::NewL( *this ); + iParameters = CIAUpdateParameters::NewL(); + } + else + { + GLX_LOG_INFO( "CGlxIadUpdate::ConstructL(), Feature not supported" ); + } + } + +// -------------------------------------------------------------------------- +// CGlxIadUpdate::~CGlxIadUpdate +// Destructor +// -------------------------------------------------------------------------- +// +CGlxIadUpdate::~CGlxIadUpdate() + { + TRACER( "CGlxIadUpdate::~CGlxIadUpdate()" ); + ReleaseIADUpdate(); + } + +// -------------------------------------------------------------------------- +// CGlxIadUpdate::StartL +// Starts update process. +// -------------------------------------------------------------------------- +// +EXPORT_C void CGlxIadUpdate::StartL() + { + TRACER( "CGlxIadUpdate::StartL()" ); + + if( iUpdate && iParameters ) + { + iParameters->SetUid( KIADParamUid ); + // We want VC to be started after update is finished + iParameters->SetCommandLineExecutableL( KIADParamExec ); + iParameters->SetShowProgress( EFalse ); + + // Check the updates + iUpdate->CheckUpdates( *iParameters ); + } + } + +// ----------------------------------------------------------------------------- +// CGlxIadUpdate::CheckUpdatesComplete +// ----------------------------------------------------------------------------- +// +void CGlxIadUpdate::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) + { + TRACER( "CGlxIadUpdate::CheckUpdatesComplete()" ); + GLX_LOG_INFO2("CGlxIadUpdate::CheckUpdatesComplete(), aErrorCode: %d, aAvailableUpdates: %d",aErrorCode, aAvailableUpdates ); + if ( aErrorCode == KErrNone ) + { + if ( aAvailableUpdates > 0 ) + { + // There were some updates available. + iUpdate->UpdateQuery(); + } + else + { + // No updates available. + ReleaseIADUpdate(); + } + } + } + +// ----------------------------------------------------------------------------- +// CGlxIadUpdate::UpdateComplete +// ----------------------------------------------------------------------------- +// +void CGlxIadUpdate::UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult ) + { + TRACER( "CGlxIadUpdate::UpdateComplete()" ); + GLX_LOG_INFO2("CGlxIadUpdate::UpdateComplete(), aErrorCode: %d, SuccessCount: %d",aErrorCode, aResult->SuccessCount()); + if ( aErrorCode == KErrNone ) + { + // The update process that the user started from IAUpdate UI is now completed. + // If the client application itself was updated in the update process, this callback + // is never called, since the client is not running anymore. + GLX_LOG_INFO1("UpdateComplete(), SuccessCount: %d", aResult->SuccessCount()); + } + + delete aResult; // Ownership was transferred, so this must be deleted by the client + + // We do not need the client-server session anymore + ReleaseIADUpdate(); + } + +// ----------------------------------------------------------------------------- +// CGlxIadUpdate::UpdateQueryComplete +// ----------------------------------------------------------------------------- +// +void CGlxIadUpdate::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ) + { + TRACER( "CGlxIadUpdate::UpdateQueryComplete()" ); + GLX_LOG_INFO2("CGlxIadUpdate::UpdateComplete(), aErrorCode: %d, aUpdateNow: %d",aErrorCode, aUpdateNow); + if ( aErrorCode == KErrNone ) + { + if ( aUpdateNow ) + { + // User choosed to update now, so let's launch the IAUpdate UI. + iUpdate->ShowUpdates( *iParameters ); + } + else + { + // The answer was 'Later'. + ReleaseIADUpdate(); + } + } + } + +// ----------------------------------------------------------------------------- +// CGlxIadUpdate::ReleaseIADUpdate +// ----------------------------------------------------------------------------- +// +void CGlxIadUpdate::ReleaseIADUpdate() + { + TRACER( "CGlxIadUpdate::ReleaseIADUpdate()" ); + + delete iUpdate; + iUpdate = NULL; + + delete iParameters; + iParameters = NULL; + } + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/src/glxresourceutilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/src/glxresourceutilities.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008-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: Utility for loading resource files +* +*/ + + + + +// CLASS HEADER +#include "glxresourceutilities.h" + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + CGlxResourceUtilities::GetResourceFilenameL( aResFile, fs ); + CleanupStack::PopAndDestroy( &fs ); + } + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile, RFs& aFs ) + { + // don't use AknUtils CompleteWithAppPath + aResFile.Insert( 0, TDriveUnit( EDriveC).Name() ); + // try to locate the localised resource + BaflUtils::NearestLanguageFile( aFs, aResFile ); + // if the localised resource is found, the file name is changed to + // the localised name (z:\apps\resources\xxx.r001) + if( !BaflUtils::FileExists( aFs, aResFile ) ) + { + // not found on c drive, try z + aResFile.Replace( 0, KMaxDriveName, TDriveUnit( EDriveZ ).Name() ); + // try to locate the localised resource again + BaflUtils::NearestLanguageFile( aFs, aResFile ); + // if file was not found this time, there is no localised + // resource with the name + if (!BaflUtils::FileExists( aFs, aResFile ) ) + { + User::Leave( KErrNotFound ); + } + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/common/src/glxsettingsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/src/glxsettingsmodel.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2008-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: MC Photos settings model +* +*/ + + + + +// INCLUDE FILES + +#include "glxsettingsmodel.h" + +#include +#include + +#include +#include +#include "glxsingletonstore.h" + +// --------------------------------------------------------------------------- +// InstanceL +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxSettingsModel* CGlxSettingsModel::InstanceL() + { + return CGlxSingletonStore::InstanceL(&NewL); + } + +// --------------------------------------------------------------------------- +// Close +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxSettingsModel::Close() + { + CGlxSingletonStore::Close(this); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxSettingsModel::~CGlxSettingsModel() + { + if ( iFeatureManagerInitialised ) + { + FeatureManager::UnInitializeLib(); + } + + delete iRepository; + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CGlxSettingsModel* CGlxSettingsModel::NewL() + { + CGlxSettingsModel* self = new (ELeave) CGlxSettingsModel(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CGlxSettingsModel::CGlxSettingsModel() + { + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CGlxSettingsModel::ConstructL() + { + TRACER( "CGlxSettingsModel::ConstructL()" ); + iRepository = CRepository::NewL( TUid::Uid(KGlxGalleryApplicationUid) ); + + FeatureManager::InitializeLibL(); + iFeatureManagerInitialised = ETrue; + } + +// --------------------------------------------------------------------------- +// SupportedOrientations +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxSettingsModel::TSupportedOrientations + CGlxSettingsModel::SupportedOrientations() + { + TInt value = ELandscapeAndPortrait; + iRepository->Get( KGlxDefaultOrientation, value ); + + return static_cast( value ); + } + +// --------------------------------------------------------------------------- +// ShowGeoCoordinatesInDisplay +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxSettingsModel::ShowGeoCoordinatesInDisplay() + { + TRACER( "CGlxSettingsModel::ShowGeoCoordinatesInDisplay()" ); + TInt value = ETrue; + iRepository->Get( KGlxShowGeoCoordinates, value ); + + return ( value > 0); + } + +// --------------------------------------------------------------------------- +// IsTextEntryPortrait +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxSettingsModel::IsTextEntryPortrait() + { + // Orientation changes to portrait for text entry in monoblock products + return FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); + } + +// --------------------------------------------------------------------------- +// ShowRotateInToolbar +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxSettingsModel::ShowRotateInToolbar() + { + // View in landscape/portrait toolbar option shown only in monoblock products + return FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); + } + +// --------------------------------------------------------------------------- +// ShowSlideshowInToolbar +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxSettingsModel::ShowSlideshowInToolbar() + { + // Slideshow toolbar option shown only in slide products + return !FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/common/src/glxsingletonstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/common/src/glxsingletonstore.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2008-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: Store for singletons +* +*/ + + + + +// INCLUDE FILES +#include "glxsingletonstore.h" + +#include + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxSingletonStore::CGlxSingletonStore() + { + GLX_LOG_INFO("CGlxSingletonStore::CGlxSingletonStore"); + } + +// ----------------------------------------------------------------------------- +// return new instance +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxSingletonStore* CGlxSingletonStore::InstanceLC() + { + CGlxSingletonStore* store = reinterpret_cast(Dll::Tls()); + + // Create new object, if one has not been created previously + if ( !store ) + { + store = new (ELeave) CGlxSingletonStore; + + // Store in tls pointer + Dll::SetTls( reinterpret_cast(store)); + } + + // Push to cleanup stack - will make sure tls pointer is cleared if + // something leaves + CleanupStack::PushL( TCleanupItem(&Cleanup, store) ); + + return store; + } + +// ----------------------------------------------------------------------------- +// Cleanup function +// ----------------------------------------------------------------------------- +// +void CGlxSingletonStore::Cleanup( TAny* /*aStore*/ ) + { + // In case of one singleton owning another there can be nested calls to + // CGlxSingletonStore::InstanceL, and so multiple Cleanup items on the + // stack to delete the store. + // Get the store pointer from TLS to ensure it hasn't already been deleted + CGlxSingletonStore* obj + = reinterpret_cast( Dll::Tls() ); + + // Delete the object if instance was just created, and singleton + // was _not_ successfully added + if ( obj && obj->iSingletons.Count() == 0 ) + { + delete obj; + } + + GLX_LOG_WARNING("Singleton factory function has (probably) left"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxSingletonStore::~CGlxSingletonStore() + { + GLX_LOG_INFO("CGlxSingletonStore::~CGlxSingletonStore"); + + // Delete remaining objects, if any + TInt count = iSingletons.Count(); + for (TInt i = 0; i < count; i++) + { + delete iSingletons[i].iObject; + } + + // Close the singletons array + iSingletons.Close(); + + // Clear tls pointer + Dll::SetTls( NULL ); + } + +// ----------------------------------------------------------------------------- +// Decrement reference count, and potentially delete object(s) +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxSingletonStore::Close(CBase* aObj) + { + CGlxSingletonStore* store = reinterpret_cast(Dll::Tls()); + if ( store ) + { + // Find an object by type + TInt count = store->iSingletons.Count(); + TInt i = 0; + while ( i < count ) + { + TSingleton& singleton = store->iSingletons[i]; + if ( aObj == singleton.iObject ) + { + // Found an existing object of type T + // Remove reference + singleton.iReferenceCount--; + GLX_LOG_INFO2("CGlxSingletonStore::Close, Ref count %d, %x", singleton.iReferenceCount, singleton.iObject); + + // Delete object if no more references + if ( !singleton.iReferenceCount ) + { + store->iSingletons.Remove(i); + + // Delete store object if last singleton + if ( store->iSingletons.Count() == 0 ) + { + // CGlxSingletonStore destructor will clean up DLL's TLS pointer + delete store; + } + + delete aObj; + } + break; + } + i++; + } + } + else + { + GLX_LOG_ERROR("CGlxSingletonStore::Close - Too many calls to Close()"); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/bwins/glxcommonuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/bwins/glxcommonuiu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +EXPORTS + ??1CGlxResolutionManager@@UAE@XZ @ 1 NONAME ; CGlxResolutionManager::~CGlxResolutionManager(void) + ?ActivatePreviousViewL@CGlxNavigationalState@@QAEXXZ @ 2 NONAME ; void CGlxNavigationalState::ActivatePreviousViewL(void) + ?AddObserverL@CGlxNavigationalState@@QAEXAAVMGlxNavigationalStateObserver@@@Z @ 3 NONAME ; void CGlxNavigationalState::AddObserverL(class MGlxNavigationalStateObserver &) + ?AddObserverL@CGlxResolutionUtility@@QAEXAAVMGlxResolutionChangeObserver@@@Z @ 4 NONAME ; void CGlxResolutionUtility::AddObserverL(class MGlxResolutionChangeObserver &) + ?BackExitStatus@CGlxNavigationalState@@QAEHXZ @ 5 NONAME ; int CGlxNavigationalState::BackExitStatus(void) + ?Close@CGlxErrorPoster@@QAEXXZ @ 6 NONAME ; void CGlxErrorPoster::Close(void) + ?Close@CGlxNavigationalState@@QAEXXZ @ 7 NONAME ; void CGlxNavigationalState::Close(void) + ?Close@CGlxResolutionUtility@@QAEXXZ @ 8 NONAME ; void CGlxResolutionUtility::Close(void) + ?ForwardActivationEventL@CGlxBackServiceWrapper@@QAEHABVTDesC8@@H@Z @ 9 NONAME ; int CGlxBackServiceWrapper::ForwardActivationEventL(class TDesC8 const &, int) + ?HandleBackCommandL@CGlxBackServiceWrapper@@QAEHABVTDesC8@@H@Z @ 10 NONAME ; int CGlxBackServiceWrapper::HandleBackCommandL(class TDesC8 const &, int) + ?InstanceL@CGlxErrorPoster@@SAPAV1@XZ @ 11 NONAME ; class CGlxErrorPoster * CGlxErrorPoster::InstanceL(void) + ?InstanceL@CGlxNavigationalState@@SAPAV1@XZ @ 12 NONAME ; class CGlxNavigationalState * CGlxNavigationalState::InstanceL(void) + ?InstanceL@CGlxResolutionUtility@@SAPAV1@XZ @ 13 NONAME ; class CGlxResolutionUtility * CGlxResolutionUtility::InstanceL(void) + ?NavigateToChildL@CGlxNavigationalState@@QAEXABVTGlxMediaId@@@Z @ 14 NONAME ; void CGlxNavigationalState::NavigateToChildL(class TGlxMediaId const &) + ?NavigateToL@CGlxNavigationalState@@QAEXABVCMPXCollectionPath@@@Z @ 15 NONAME ; void CGlxNavigationalState::NavigateToL(class CMPXCollectionPath const &) + ?NavigateToParentL@CGlxNavigationalState@@QAEXXZ @ 16 NONAME ; void CGlxNavigationalState::NavigateToParentL(void) + ?NewL@CGlxBackServiceWrapper@@SAPAV1@VTUid@@@Z @ 17 NONAME ; class CGlxBackServiceWrapper * CGlxBackServiceWrapper::NewL(class TUid) + ?NewL@CGlxResolutionManager@@SAPAV1@XZ @ 18 NONAME ; class CGlxResolutionManager * CGlxResolutionManager::NewL(void) + ?NewLC@CGlxBackServiceWrapper@@SAPAV1@VTUid@@@Z @ 19 NONAME ; class CGlxBackServiceWrapper * CGlxBackServiceWrapper::NewLC(class TUid) + ?PixelsToPoss@CGlxResolutionUtility@@QBEMABM@Z @ 20 NONAME ; float CGlxResolutionUtility::PixelsToPoss(float const &) const + ?PossToPixels@CGlxResolutionUtility@@QBEMABM@Z @ 21 NONAME ; float CGlxResolutionUtility::PossToPixels(float const &) const + ?PostError@CGlxErrorPoster@@QAEXH@Z @ 22 NONAME ; void CGlxErrorPoster::PostError(int) + ?PublishStateL@NGlxZoomStatePublisher@@YAXH@Z @ 23 NONAME ; void NGlxZoomStatePublisher::PublishStateL(int) + ?RemoveObserver@CGlxNavigationalState@@QAEXAAVMGlxNavigationalStateObserver@@@Z @ 24 NONAME ; void CGlxNavigationalState::RemoveObserver(class MGlxNavigationalStateObserver &) + ?RemoveObserver@CGlxResolutionUtility@@QAEXAAVMGlxResolutionChangeObserver@@@Z @ 25 NONAME ; void CGlxResolutionUtility::RemoveObserver(class MGlxResolutionChangeObserver &) + ?ScreenSize@CGlxResolutionUtility@@QBE?AVTSize@@XZ @ 26 NONAME ; class TSize CGlxResolutionUtility::ScreenSize(void) const + ?SetBackExitStatus@CGlxNavigationalState@@QAEXH@Z @ 27 NONAME ; void CGlxNavigationalState::SetBackExitStatus(int) + ?SetScreenSizeL@CGlxResolutionManager@@QAEXVTSize@@@Z @ 28 NONAME ; void CGlxResolutionManager::SetScreenSizeL(class TSize) + ?SetToViewMode@CGlxNavigationalState@@QAEXXZ @ 29 NONAME ; void CGlxNavigationalState::SetToViewMode(void) + ?StateLC@CGlxNavigationalState@@QBEPAVCMPXCollectionPath@@XZ @ 30 NONAME ; class CMPXCollectionPath * CGlxNavigationalState::StateLC(void) const + ?ViewingMode@CGlxNavigationalState@@QAE?AW4TViewingMode@NGlxNavigationalState@@XZ @ 31 NONAME ; enum NGlxNavigationalState::TViewingMode CGlxNavigationalState::ViewingMode(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/eabi/glxcommonuiu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/eabi/glxcommonuiu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +EXPORTS + _ZN15CGlxErrorPoster5CloseEv @ 1 NONAME + _ZN15CGlxErrorPoster9InstanceLEv @ 2 NONAME + _ZN15CGlxErrorPoster9PostErrorEi @ 3 NONAME + _ZN21CGlxNavigationalState11NavigateToLERK18CMPXCollectionPath @ 4 NONAME + _ZN21CGlxNavigationalState11ViewingModeEv @ 5 NONAME + _ZN21CGlxNavigationalState12AddObserverLER29MGlxNavigationalStateObserver @ 6 NONAME + _ZN21CGlxNavigationalState13SetToViewModeEv @ 7 NONAME + _ZN21CGlxNavigationalState14BackExitStatusEv @ 8 NONAME + _ZN21CGlxNavigationalState14RemoveObserverER29MGlxNavigationalStateObserver @ 9 NONAME + _ZN21CGlxNavigationalState16NavigateToChildLERK11TGlxMediaId @ 10 NONAME + _ZN21CGlxNavigationalState17NavigateToParentLEv @ 11 NONAME + _ZN21CGlxNavigationalState17SetBackExitStatusEi @ 12 NONAME + _ZN21CGlxNavigationalState21ActivatePreviousViewLEv @ 13 NONAME + _ZN21CGlxNavigationalState5CloseEv @ 14 NONAME + _ZN21CGlxNavigationalState9InstanceLEv @ 15 NONAME + _ZN21CGlxResolutionManager14SetScreenSizeLE5TSize @ 16 NONAME + _ZN21CGlxResolutionManager4NewLEv @ 17 NONAME + _ZN21CGlxResolutionManagerD0Ev @ 18 NONAME + _ZN21CGlxResolutionManagerD1Ev @ 19 NONAME + _ZN21CGlxResolutionManagerD2Ev @ 20 NONAME + _ZN21CGlxResolutionUtility12AddObserverLER28MGlxResolutionChangeObserver @ 21 NONAME + _ZN21CGlxResolutionUtility14RemoveObserverER28MGlxResolutionChangeObserver @ 22 NONAME + _ZN21CGlxResolutionUtility5CloseEv @ 23 NONAME + _ZN21CGlxResolutionUtility9InstanceLEv @ 24 NONAME + _ZN22CGlxBackServiceWrapper18HandleBackCommandLERK6TDesC8i @ 25 NONAME + _ZN22CGlxBackServiceWrapper23ForwardActivationEventLERK6TDesC8i @ 26 NONAME + _ZN22CGlxBackServiceWrapper4NewLE4TUid @ 27 NONAME + _ZN22CGlxBackServiceWrapper5NewLCE4TUid @ 28 NONAME + _ZN22NGlxZoomStatePublisher13PublishStateLEi @ 29 NONAME + _ZNK21CGlxNavigationalState7StateLCEv @ 30 NONAME + _ZNK21CGlxResolutionUtility10ScreenSizeEv @ 31 NONAME + _ZNK21CGlxResolutionUtility12PixelsToPossERKf @ 32 NONAME + _ZNK21CGlxResolutionUtility12PossToPixelsERKf @ 33 NONAME + _ZTI21CGlxNavigationalState @ 34 NONAME ; ## + _ZTI22CGlxBackServiceWrapper @ 35 NONAME ; ## + _ZTV21CGlxNavigationalState @ 36 NONAME ; ## + _ZTV22CGlxBackServiceWrapper @ 37 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Project definition file for project glxdatasourcemanager. +* +*/ + + + + +PRJ_EXPORTS + +PRJ_MMPFILES +glxcommonui.mmp + + +PRJ_TESTMMPFILES +//#include "../tsrc/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/group/glxcommonui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/group/glxcommonui.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2008-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: Project definition file for project glxdatasourcemanager. +* +*/ + + + + +#include +#include +#include + +#include "../../group/glxbuildcommon.mmh" + +TARGET glxcommonui.dll +TARGETTYPE dll +UID 0x1000008d 0x2000A7C2 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +APP_LAYER_SYSTEMINCLUDE + + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../common/inc + + +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE glxerrorposter.cpp +SOURCE glxresolutionmanager.cpp +SOURCE glxresolutionutility.cpp +SOURCE glxzoomstatepublisher.cpp +SOURCE glxnavigationalstate.cpp + +SOURCE glxbackservicewrapper.cpp + + +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY glxcommon.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY mpxcollectionutility.lib //for MMPXCollectionUtility +LIBRARY mpxcommon.lib // CMPXCollectionPath +LIBRARY mpxviewutility.lib //for MMPXViewUtility + +LIBRARY liwservicehandler.lib //CLiwVariant + +LIBRARY flogger.lib +// if photos need to publish zooming state, include the context framework +#ifdef GLX_PUBLISH_ZOOMING_STATE +LIBRARY cfclient.lib // for CCFClient +LIBRARY cfservices.lib // for CCFContextObject +#endif + +//EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/glxbackservicewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/glxbackservicewrapper.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-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: wrapper for Back Stepping Service +* +*/ + + + + +#ifndef C_GLX_BACKSERVICE_WRAPPER +#define C_GLX_BACKSERVICE_WRAPPER + +#include + +class MLiwInterface; +class CLiwGenericParamList; +class CLiwServiceHandler; + +/** + * BS Service wrapper + * + * @since S60 v3.2 + */ +class CGlxBackServiceWrapper : public CBase + { + +public: + + /** + * Two-phased constructors + * @param aUid client application UID + */ + static CGlxBackServiceWrapper* NewL( const TUid aUid ); + static CGlxBackServiceWrapper* NewLC( const TUid aUid ); + + /** + * Destructor. + */ + virtual ~CGlxBackServiceWrapper(); + + /** + * Forwards activation event + * + * @since S60 v3.2 + * @param aState state of application like view ids + * @param aEnter indicate if it is entry/exit activation + * @return result code retutned by BS Service interface + * @leave leaves from HandleResultL are propagated + */ + IMPORT_C TInt ForwardActivationEventL( const TDesC8& aState, const TBool aEnter ); + + /** + * Handles back command + * + * @since S60 v3.2 + * @param aState state of application like view ids + * @return result code retutned by BS Service interface + * @leave leaves from HandleResultL are propagated + */ + IMPORT_C TInt HandleBackCommandL( const TDesC8& aState, const TBool aCheckOnly = EFalse ); + +private: + + CGlxBackServiceWrapper(); + + /** + * 2nd phase constructor + * @param aUid client application UID + */ + void ConstructL( const TUid aUid ); + + /** + * Initializes BS Service + * @param aUid client application UID + * @leave KErrNotSupported or KErrArgument + * (if arguments passed to BS Service are incorrect + * or could not initialize BS) + * KErrNotFound (if there was no return value) + */ + void InitializeL( const TUid aUid ); + + /** + * Handles the result of a LIW command + * @return result code retutned by BS Service interface + * @leave KErrNotSupported or KErrArgument + * (if arguments passed to BS Service are incorrect) + * KErrNotFound (if there was no return value) + */ + TInt HandleResultL(); + +private: // data + + /** + * Liw Service Handler + * Own. + */ + CLiwServiceHandler* iServiceHandler; + + /** + * BS Service interface returned by LIW + * Own. + */ + MLiwInterface* iBSInterface; + + /** + * In param list + * Not own. + */ + CLiwGenericParamList* iInParamList; + + /** + * Out param list + * Not own. + */ + CLiwGenericParamList* iOutParamList; + + }; + +#endif // C_GLX_BACKSERVICE_WRAPPER diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/glxbsserviceconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/glxbsserviceconstants.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Constants for Back Stepping Service Provider + * +*/ + + + + +#ifndef BS_SERVICE_CONSTANTS_H +#define BS_SERVICE_CONSTANTS_H + +// BS Service implementation UID +const TInt KBSServiceImplUid( 0x2000F840); + +// from LIW +_LIT8( KGenericParamServiceCmdIDStr, "cmd" ); + +// BSS Service and Interface ID +_LIT8( KBSServiceID, "Service.BackStepping" ); +_LIT8( KBSInterface, "IBackStepping" ); + +// BSS commands +_LIT8( KBSCmdInitialize, "Initialize" ); +_LIT8( KBSCmdForwardActivationEvent, "ForwardActivationEvent" ); +_LIT8( KBSCmdHandleBackCommand, "HandleBackCommand" ); + +// BSS in param names +_LIT8( KBSInParamAppUid, "AppUid" ); +_LIT8( KBSInParamState, "State" ); +_LIT8( KBSInParamEnter, "Enter" ); +_LIT8( KBSInParamCheckOnly, "CheckOnly" ); + +// BSS out param names +_LIT8( KBSOutParamStatusInfo, "StatusInfo" ); + +#endif // BS_SERVICE_CONSTANTS_H diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/glxerrorposter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/glxerrorposter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: Singleton that posts errors to the framework +* +*/ + + + + +#ifndef GLXERRORPOSTER_H_ +#define GLXERRORPOSTER_H_ + +#include + +/** + * CGlxErrorPoster + * Posts errors to the framework. + * (Causes a Leave() to occur from a RunL()) + * + * @author Alex Birkett + */ +NONSHARABLE_CLASS(CGlxErrorPoster) : public CActive + { +public: + /** + * Provides instance of error poster and increments ref count + */ + IMPORT_C static CGlxErrorPoster* InstanceL(); + + /** + * Removes instance of error poster and decrements ref count + */ + IMPORT_C void Close(); + + /** + * Post an error + * The error is stored in a member variable and providing the + * active object is not already active, a call back to RunL() + * is requested. When called by the active scheduler RunL() + * leaves with the error code stored in the member variable. + * This causes a dialog displaying an error note to be invoked + * by the framework. + * + * @param aError Error to post + */ + IMPORT_C void PostError(TInt aError); + +public: // from CActive + /** See @ref CActive::RunL */ + void RunL(); + + /** See @ref CActive::DoCancel */ + void DoCancel(); + +private: + /** + * Two phase constructor + */ + static CGlxErrorPoster* NewL(); + + /** + * Constructor + */ + CGlxErrorPoster(); + + /** + * Destructor + */ + ~CGlxErrorPoster(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + +private: + /** + * latest error + */ + TInt iLatestError; + }; + +#endif /*GLXERRORPOSTER_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/glxnavigationalstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/glxnavigationalstate.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2008-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: Navigational state of the app +* +*/ + + + + +#ifndef __C_GLXNAVIGATIONALSTATE_H__ +#define __C_GLXNAVIGATIONALSTATE_H__ + +#include + +#include +#include +#include + +class CGlxNavigationalStateImp; +class CMPXCollectionPath; +class MGlxNavigationalStateObserver; + +/** + * CGlxNavigationalState + * + * Class that stores the navigational state of the application. + * Navigational state means the currently viewed node in UI hierarchy + * + * Design: CGlxNavigationalState delegates all operations to + * CGlxNavigationalStateImp, to avoid client having to include mpx dependencies. + * CGlxNavigationalStateImp stores the navigational state in MPX collection + * server by owning an MMPXCollectionUtility. + * + * @author Aki Vanhatalo + */ +class CGlxNavigationalState : public CBase + { +private: + +public: + /** + * Return a (singleton) instance of the class + * Close the instance by calling Close() when done with the instance + */ + IMPORT_C static CGlxNavigationalState* InstanceL(); + + /** + * Close the instance and remove observer if any + * See @ref MGlxActiveMediaListResolver::Close + * @param aObserver Observer to remove + */ + IMPORT_C void Close(); + + /** + * Add an observer + * @param aObserver Observer of changes to the state + */ + IMPORT_C void AddObserverL( MGlxNavigationalStateObserver& aObserver ); + + /** + * Remove an observer + * @param aObserver Observer to remove. + */ + IMPORT_C void RemoveObserver( MGlxNavigationalStateObserver& aObserver ); + + /** + * @return the current navigational state. Caller gets ownership. + */ + IMPORT_C CMPXCollectionPath* StateLC() const; + + /** + * Navigate back in the UI hierarchy + * Does nothing, if currently at root. + */ + IMPORT_C void NavigateToParentL(); + + /** + * Navigate forward to provided item + * @param aItemToOpen Id of item to navigate to + */ + IMPORT_C void NavigateToChildL( const TGlxMediaId& aItemIdToOpen ); + + /** + * Navigate to provided position in hierarchy + * @param aNewState Path object which describes the new position in hierarchy + */ + IMPORT_C void NavigateToL( const CMPXCollectionPath& aNewState ); + + /** + * Activate previous view + */ + IMPORT_C void ActivatePreviousViewL(); + + /** + * returns the current viewing mode of the application + */ + IMPORT_C NGlxNavigationalState::TViewingMode ViewingMode(); + + /** + * Sets the mode to "view" + */ + IMPORT_C void SetToViewMode(); + + IMPORT_C void SetBackExitStatus(TBool aStatus); + + IMPORT_C TBool BackExitStatus(); + +private: + /** Constructor for singleton store */ + static CGlxNavigationalState* NewL(); + + /** Destructor */ + ~CGlxNavigationalState(); + +private: + /// Implementation + CGlxNavigationalStateImp* iImp; + +public: + TBool iBackExitStatus; + }; + + +#endif // __C_GLXNAVIGATIONALSTATE_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/glxresolutionmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/glxresolutionmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2008-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: Allows change the screen size +* +*/ + + + + +#ifndef __GLX_RESOLUTION_MANAGER__ +#define __GLX_RESOLUTION_MANAGER__ + +#include + + +// Forward Declarations +class CGlxResolutionUtility; + +/** + * Class Description + * Restricted Resolution Implementation + * Dont use this class directly, + * use CGlxResolutionUtility instead + * @author Loughlin + */ +NONSHARABLE_CLASS (CGlxResolutionManager) : public CBase + { +public: + /** + * Symbian Constructor + * @return a CGlxResolutionManager object. + */ + IMPORT_C static CGlxResolutionManager* NewL(); + + /** + * Destructor + */ + IMPORT_C ~CGlxResolutionManager(); + + +private: + /** + * C++ Constructor + */ + CGlxResolutionManager(); + +public: + /** + * Sets the screen size + * @param The screens size + */ + IMPORT_C void SetScreenSizeL( TSize aScrnSz ); + + +private: + + /// Onw: the client side resolution implementation + CGlxResolutionUtility* iResUtility; + }; + +#endif // __GLX_RESOLUTION_MANAGER__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/glxresolutionutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/glxresolutionutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2008-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: Utility class for managing the screen size +* +*/ + + + + +#ifndef __CGLXRESOLUTIONUTILITY_H__ +#define __CGLXRESOLUTIONUTILITY_H__ + +#include // for RPointerArray +#include + +// forward declarations +class MGlxResolutionChangeObserver; +class MGlxResolutionSize; + + +/** + * Class Description + * Singleton containing resolution utility methods + * @author Loughlin + */ +NONSHARABLE_CLASS (CGlxResolutionUtility) : public CBase + { +public: + /** + * Construction of singleton + * @return A pointer to the single instance of CGlxResolutionUtility + */ + IMPORT_C static CGlxResolutionUtility* InstanceL(); + + /** + * Destroys the renderer instance of CGlxResolutionUtility when the + * reference count is zero + */ + IMPORT_C void Close(); + + /** + * Get the screen size + * @return The screen size in POSS + */ + IMPORT_C TSize ScreenSize() const; + + /** + * Get the lenght of in POSS + * @param The lenght in pixels which is to be converted to POSS + * @return The converted lenght & width in POSS + */ + IMPORT_C TReal32 PixelsToPoss( const TReal32& aLenPixels ) const; + + /** + * Get the lenght of in pixels + * @param The length in POSS which is to be converted to pixels + * @return The converted size in pixels + */ + IMPORT_C TReal32 PossToPixels( const TReal32& aSzPoss ) const; + + /** + * Add a resolution change observer + * @param The observer that will recieve notification on resolution + * change + */ + IMPORT_C void AddObserverL( MGlxResolutionChangeObserver& aObserver ); + + /** + * Remove a resolution change observer + * @param The observer that will no longer recieve notification on + * resolution change + */ + IMPORT_C void RemoveObserver( MGlxResolutionChangeObserver& aObserver ); + +public: // not exported + + /** + * Receives notification of a change in the screen size + * All resolution observers are notified of the resolution change + * @param aScreenSize the new screen size + */ + void SetScreenSizeL( TSize aScreenSize ); + +private: + + /** + * Symbian constructor - used by SingletonStore to create instance + */ + static CGlxResolutionUtility* NewL(); + + /** + * C++ constructor + */ + CGlxResolutionUtility(); + + /** + * 2 Phase ctor + */ + void ConstructL(); + /** + * Destructor + */ + ~CGlxResolutionUtility(); + +private: // class member variables + + // Size of the screen + TSize iScreenSize; + // Screen Size aspect ratio - POSS is a unit of measurement + // where 1 == the longest screen axis + TReal32 iOnePossToPixelRatio; + // The ratio of pixels to poss - stored to save on division + TReal32 iPixelToPossRatio; + // Own: The container for the event observers + RPointerArray < MGlxResolutionChangeObserver > iObserverList; + }; + +#endif //__CGLXRESOLUTIONUTILITY_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/glxzoomstatepublisher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/glxzoomstatepublisher.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2008-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: Utility class for publishing the zoom state +* +*/ + + + + +#ifndef __CGLXZOOMSTATEPUBLISHER_H__ +#define __CGLXZOOMSTATEPUBLISHER_H__ + +/** + * @internal reviewed 5/02/2007 by Alex Birkett + */ + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * NGlxZoomStatePublisher + * Utility to publish the zooming state of photos + */ +namespace NGlxZoomStatePublisher + { + /** + * Publishes the zooming state + * @param aEnabled ETrue if it is possible to zoom + */ + IMPORT_C void PublishStateL( TBool aEnabled ); + } + +#endif // __CGLXZOOMSTATEPUBLISHER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/mglxnavigationalstateobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/mglxnavigationalstateobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2008-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: Observer of navigational state +* +*/ + + + + +#ifndef __M_GLXNAVIGATIONALSTATEOBSERVER_H__ +#define __M_GLXNAVIGATIONALSTATEOBSERVER_H__ + +/** + * MGlxNavigationalStateObserver + * + * Class that will be notified when navigational state changes + * See @ref CGlxNavigationalState + * + * @author Aki Vanhatalo + */ +class MGlxNavigationalStateObserver + { +public: + /** + * Called when navigational state has changed + */ + virtual void HandleNavigationalStateChangedL() = 0; + }; + +#endif // __M_GLXNAVIGATIONALSTATEOBSERVER_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/inc/mglxresolutionchangeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/inc/mglxresolutionchangeobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2008-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: Screen resolution changed observer +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +#ifndef M_GLXRESOLUTIONCHANGEOBSERVER_H +#define M_GLXRESOLUTIONCHANGEOBSERVER_H + + +/** + * Class that observes the screen resolution change + */ +NONSHARABLE_CLASS( MGlxResolutionChangeObserver ) + { + /* + * Handle notification of change in the screen resolution + */ +public: + virtual void HandleResolutionChangedL () = 0; + }; + + + +#endif // M_GLXRESOLUTIONCHANGEOBSERVER_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/src/glxbackservicewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/src/glxbackservicewrapper.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2008-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: wrapper for Back Stepping Service +* +*/ + + + + +// from AIW and LIW +#include +#include + +#include +#include + +// parameter names used by BS Service +#include "glxbsserviceconstants.h" + +// for CleanupResetAndDestroyPushL +#include + + +#include "glxbackservicewrapper.h" + +using namespace LIW; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CGlxBackServiceWrapper::CGlxBackServiceWrapper() + { + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CGlxBackServiceWrapper::ConstructL( const TUid aUid ) + { + TRACER( "CGlxBackServiceWrapper::ConstructL" ); + // create Service Handler and keep as long as access to BS Service needed + iServiceHandler = CLiwServiceHandler::NewL(); + // for convinience keep pointers to Service Handler param lists + iInParamList = &iServiceHandler->InParamListL(); + iOutParamList = &iServiceHandler->OutParamListL(); + + RCriteriaArray criteriaArray; + CleanupResetAndDestroyPushL( criteriaArray ); + + // create Liw criteria + CLiwCriteriaItem* criterion = + CLiwCriteriaItem::NewLC( KLiwCmdAsStr, KBSInterface, KBSServiceID ); + criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) ); + + criteriaArray.AppendL( criterion ); + CleanupStack::Pop( criterion ); + + // attach Liw criteria + iServiceHandler->AttachL( criteriaArray ); + // get BS Service interface + iServiceHandler->ExecuteServiceCmdL( *criterion, + *iInParamList, + *iOutParamList ); + + CleanupStack::PopAndDestroy( &criteriaArray ); + + // extract BS interface from output params + TInt pos( 0 ); + iOutParamList->FindFirst( pos, KBSInterface ); + if( pos != KErrNotFound ) + { + iBSInterface = (*iOutParamList)[pos].Value().AsInterface(); + } + + if ( !iBSInterface ) + { + // handle no BS Service + User::Leave( KErrNotFound ); + } + + InitializeL( aUid ); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxBackServiceWrapper* CGlxBackServiceWrapper::NewL( + const TUid aUid ) + { + TRACER( "CGlxBackServiceWrapper::NewL" ); + CGlxBackServiceWrapper* self = + CGlxBackServiceWrapper::NewLC( aUid ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxBackServiceWrapper* CGlxBackServiceWrapper::NewLC( + const TUid aUid ) + { + TRACER( "CGlxBackServiceWrapper::NewLC" ); + CGlxBackServiceWrapper* self = new( ELeave ) CGlxBackServiceWrapper; + CleanupStack::PushL( self ); + self->ConstructL( aUid ); + return self; + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CGlxBackServiceWrapper::~CGlxBackServiceWrapper() + { + TRACER( "CGlxBackServiceWrapper::~CGlxBackServiceWrapper" ); + if ( iBSInterface ) + { + iBSInterface->Close(); + } + + delete iServiceHandler; + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxBackServiceWrapper::ForwardActivationEventL( const TDesC8& aState, + const TBool aEnter ) + { + TRACER( "CGlxBackServiceWrapper::ForwardActivationEventL" ); + iInParamList->Reset(); + iOutParamList->Reset(); + + TLiwGenericParam state( KBSInParamState, TLiwVariant( aState ) ); + iInParamList->AppendL( state ); + TLiwGenericParam enter( KBSInParamEnter, TLiwVariant( aEnter ) ); + iInParamList->AppendL( enter ); + + iBSInterface->ExecuteCmdL( KBSCmdForwardActivationEvent, + *iInParamList, + *iOutParamList ); + + TInt result = HandleResultL(); + + iInParamList->Reset(); + iOutParamList->Reset(); + + return result; + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxBackServiceWrapper::HandleBackCommandL( const TDesC8& aState, + const TBool aCheckOnly) + { + TRACER( "CGlxBackServiceWrapper::HandleBackCommandL" ); + iInParamList->Reset(); + iOutParamList->Reset(); + + TLiwGenericParam state( KBSInParamState, TLiwVariant( aState ) ); + iInParamList->AppendL( state ); + TLiwGenericParam checkOnly( KBSInParamCheckOnly, TLiwVariant( aCheckOnly ) ); + iInParamList->AppendL( checkOnly ); + + iBSInterface->ExecuteCmdL( KBSCmdHandleBackCommand, + *iInParamList, + *iOutParamList ); + + TInt result = HandleResultL(); + + iInParamList->Reset(); + iOutParamList->Reset(); + + return result; + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CGlxBackServiceWrapper::InitializeL( const TUid aUid ) + { + TRACER( "CGlxBackServiceWrapper::InitializeL" ); + iInParamList->Reset(); + iOutParamList->Reset(); + + TLiwGenericParam appUid( KBSInParamAppUid, TLiwVariant( aUid.iUid ) ); + iInParamList->AppendL( appUid ); + + iBSInterface->ExecuteCmdL( KBSCmdInitialize, + *iInParamList, + *iOutParamList ); + + if ( HandleResultL() != 1 ) + { + // Initialize command was not consumed - handle failiure + User::Leave( KErrArgument ); + } + + iInParamList->Reset(); + iOutParamList->Reset(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CGlxBackServiceWrapper::HandleResultL() + { + TRACER( "CGlxBackServiceWrapper::HandleResultL" ); + TInt statusInfo( KErrNotFound ); + + TInt posErr( 0 ); + iOutParamList->FindFirst( posErr, EGenericParamError ); + if( posErr != KErrNotFound ) + { + // error code found - extract and handle + TInt errorCode( KErrNone ); + (*iOutParamList)[posErr].Value().Get( errorCode ); + + User::LeaveIfError( errorCode ); + } + + // if no error returned, carry on + TInt posStat( 0 ); + iOutParamList->FindFirst( posStat, KBSOutParamStatusInfo ); + if( posStat != KErrNotFound ) + { + // status info present - extract and return + (*iOutParamList)[posStat].Value().Get( statusInfo ); + } + else + { + // no return value + // this should not happen + User::Leave( KErrNotFound ); + } + + return statusInfo; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/src/glxerrorposter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/src/glxerrorposter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2008-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: Singleton that posts errors to the framework +* +*/ + + + + +#include "glxerrorposter.h" + +#include + +#include + +// --------------------------------------------------------------------------- +// Provides instance of error poster and increments ref count +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxErrorPoster* CGlxErrorPoster::InstanceL() + { + GLX_LOG_INFO( "CGlxErrorPoster::InstanceL" ); + + return CGlxSingletonStore::InstanceL( &NewL ); + } + +// --------------------------------------------------------------------------- +// Removes instance of error poster and decrements ref count +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxErrorPoster::Close() + { + GLX_LOG_INFO( "CGlxErrorPoster::Close" ); + + CGlxSingletonStore::Close( this ); + } + +// --------------------------------------------------------------------------- +// Two phase constructor. +// --------------------------------------------------------------------------- +// +CGlxErrorPoster* CGlxErrorPoster::NewL() + { + GLX_LOG_INFO( "CGlxErrorPoster::NewL" ); + + CGlxErrorPoster* self = new ( ELeave ) CGlxErrorPoster(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CGlxErrorPoster::CGlxErrorPoster() : + CActive(EPriorityStandard) + { + GLX_LOG_INFO( "CGlxErrorPoster::CGlxErrorPoster" ); + + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxErrorPoster::~CGlxErrorPoster() + { + GLX_LOG_INFO( "CGlxErrorPoster::~CGlxErrorPoster" ); + + Cancel(); + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CGlxErrorPoster::ConstructL() + { + GLX_LOG_INFO( "CGlxErrorPoster::ConstructL" ); + } + +// --------------------------------------------------------------------------- +// Post an error +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxErrorPoster::PostError(TInt aError) + { + GLX_LOG_INFO1( "CGlxErrorPoster::PostError %d" , aError); + + iLatestError = aError; + if ( !IsActive() ) + { + TRequestStatus* requestStatus = &iStatus; + User::RequestComplete( requestStatus, KErrNone ); + SetActive(); + } + } + +// --------------------------------------------------------------------------- +// CActive::RunL +// --------------------------------------------------------------------------- +// +void CGlxErrorPoster::RunL() + { + GLX_LOG_INFO( "CGlxErrorPoster::RunL" ); + + TInt error = iLatestError; + iLatestError = KErrNone; + User::Leave( error ); + } + +// --------------------------------------------------------------------------- +// CActive::DoCancel +// --------------------------------------------------------------------------- +// +void CGlxErrorPoster::DoCancel() + { + GLX_LOG_INFO( "CGlxErrorPoster::DoCancel" ); + // No need to do anything + // CActive::Cancel() will wait for the request to complete + } diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/src/glxnavigationalstate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/src/glxnavigationalstate.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,454 @@ +/* +* Copyright (c) 2008-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: Navigational state of the app +* +*/ + + + + +#include "glxnavigationalstate.h" + +#include +#include +#include +#include +#include +#include +#include +#include // MMPXViewUtility +#include "mglxnavigationalstateobserver.h" +#include +#include + +#include + +#include + + /** + * CGlxNavigationalStateImp + * + * Implementation of navigational state + * Note: function entry-exit logging is in CGlxNavigationalState, + * not in CGlxNavigationalStateImp. + * + * @author Aki Vanhatalo + */ +class CGlxNavigationalStateImp : public CBase, public MMPXCollectionObserver + { +public: + /** + * Second-phase constructor + * inlined since used only once from CGlxNavigationalState + */ + inline void ConstructL() + { + iCollectionUtility = MMPXCollectionUtility::NewL( this ); + iViewUtility = MMPXViewUtility::UtilityL(); + iViewingMode = NGlxNavigationalState::EBrowse; + } + + /** Destructor */ + ~CGlxNavigationalStateImp() + { + GLX_LOG_ENTRY_EXIT( "CGlxNavigationalStateImp::~CGlxNavigationalStateImp"); + if ( iCollectionUtility ) + { + iCollectionUtility->Close(); + } + + if ( iViewUtility ) + { + iViewUtility->Close(); + } + // Log a warning if observers remaining; they should have been removed by the client + __ASSERT_DEBUG( !iObservers.Count(), + GLX_LOG_WARNING1( "CGlxNavigationalStateImp - %d observers not removed", iObservers.Count() ) ); + + iObservers.Close(); + } + + /** + * Add an observer + * inlined since used only once from CGlxNavigationalState + * @param aObserver Observer of changes to state + */ + inline void AddObserverL( MGlxNavigationalStateObserver& aObserver ) + { + GLX_LOG_INFO1("CGlxNavigationalStateImp::AddObserverL %x", &aObserver); + __ASSERT_DEBUG( KErrNotFound == iObservers.Find( &aObserver ), + GLX_LOG_WARNING( "CGlxNavigationalStateImp - Observer already added" ) ); + + // Add the observer, unless already added + if ( KErrNotFound == iObservers.Find( &aObserver ) ) + { + iObservers.AppendL( &aObserver ); + } + } + + /** + * Remove an observer + * inlined since used only once from CGlxNavigationalState + * @param aObserver Observer to remove + */ + inline void RemoveObserver( MGlxNavigationalStateObserver& aObserver ) + { + GLX_LOG_INFO1("CGlxNavigationalStateImp::RemoveObserver %x", &aObserver); + + // Remove the observer if exists + TInt index = iObservers.Find( &aObserver ); + if ( KErrNotFound != index ) + { + iObservers.Remove( index ); + } + + __ASSERT_DEBUG( KErrNotFound != index, + GLX_LOG_WARNING( "CGlxNavigationalStateImp - No such observer to remove" ) ); + } + + /** + * @return the current navigational state. Caller gets ownership. + */ + CMPXCollectionPath* StateLC() const + { + GLX_LOG_ENTRY_EXIT("CGlxNavigationalStateImp::StateLC"); + + // state is stored in the collection utility as a collection path + CMPXCollectionPath* state = Collection().PathL(); + CleanupStack::PushL( state ); + + // go up one level in hierarchy, since the path contains also the + // currently open level, not only the nodes to the level + state->Back(); + + return state; + } + + /** + * Navigate back in the UI hierarchy + * Does nothing, if currently at root. + */ + inline void NavigateToParentL() + { + if ( ViewingMode()== NGlxNavigationalState::EView ) + { + iViewingMode = NGlxNavigationalState::EBrowse; + //Collection().BackL(); // added by gopakumar + NotifyObserversOfStateChange(); + } + else + { + Collection().BackL(); + } + } + + /** + * Navigate forward to provided item + * @param aItemToOpen Id of item to navigate to + */ + void NavigateToChildL( const TGlxMediaId& aItemIdToOpen ) + { + // there is no way to open MPX collection utility's current state with + // and id of a child item, so create a full path object and add the + // requested item's id as the new level + iViewingMode = NGlxNavigationalState::EBrowse; + CMPXCollectionPath* state = StateLC(); + state->AppendL( aItemIdToOpen.Value() ); + + NavigateToL( *state ); + + CleanupStack::PopAndDestroy( state ); + } + + /** + * Navigate to provided position in hierarchy + * @param aNewState Path object which describes the new position in hierarchy + */ + inline void NavigateToL( const CMPXCollectionPath& aNewState ) + { + // (it does not matter that the root level is opened without + // gallery plugin filter (EGlxCollectionPluginGallery), as long as + // the root level is *rendered* with something that uses the filter, + // such as a media list) + if(!iIsNavigating) + { + iViewingMode = NGlxNavigationalState::EBrowse; + Collection().OpenL( aNewState ); + iIsNavigating = ETrue; + } + } + + // commented off by gopakumar , as this is no longer needed . + /** + * Set the ID of the view that will be activated if there are no other + * view's in the view history + */ + /*inline void SetFirstViewId( TVwsViewId aViewId ) + { + // Save the view Id + iViewId = aViewId; + }*/ + + /** + * Activate previous view + */ + inline void ActivatePreviousViewL() + { + iViewingMode = NGlxNavigationalState::EBrowse; + //go back one view + if ( iViewUtility->ViewHistoryDepth() > 1 ) + { + iViewUtility->ActivatePreviousViewL(); + + } + } + + + // From MMPXCollectionObserver + void HandleCollectionMessageL( const CMPXMessage& aMessage ) + { + TRACER( "CGlxNavigationalStateImp::HandleCollectionMessageL" ); + + if ( IsPathChangedMessage( aMessage ) ) + { + NotifyObserversOfStateChange(); + iIsNavigating = EFalse; + } + } + + // From MMPXCollectionObserver + void HandleOpenL( const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, + TBool /*aComplete*/, TInt /*aError*/ ) + { + // do nothing + } + + // From MMPXCollectionObserver + void HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ ) + { + // do nothing + } + + // From MMPXCollectionObserver + void HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt /*aError*/ ) + { + // do nothing + } + void SetToViewMode() + { + iViewingMode = NGlxNavigationalState::EView; + // inform the observers( only appui!! ) that the mode is view + NotifyObserversOfStateChange(); + + } + NGlxNavigationalState::TViewingMode ViewingMode() + { + return iViewingMode; + } + +private: + /** Notify observers of state change */ + inline void NotifyObserversOfStateChange() + { + GLX_LOG_ENTRY_EXIT( "CGlxNavigationalStateImp::NotifyObserversOfStateChange" ); + // iObservers::Count() used in loop: ok, since unlikely to have many observers + for ( TInt i = 0; i < iObservers.Count(); i++ ) + { + iObservers[ i ]->HandleNavigationalStateChangedL(); + } + } + + /** @return MPX collection */ + inline MMPXCollection& Collection() const + { + return iCollectionUtility->Collection(); + } + + /** + * @param aMessage message to test + * @return ETrue if the message is a "path changed" message + */ + inline TBool IsPathChangedMessage( const CMPXMessage& aMessage ) + { + // message is a "path changed" message if message id is KMPXMessageGeneral + // and KMPXMessageGeneralEvent attribute is EPathChanged + return ( aMessage.IsSupported(KMPXMessageGeneralId ) + && KMPXMessageGeneral == aMessage.ValueTObjectL( KMPXMessageGeneralId ) + && aMessage.IsSupported( KMPXMessageGeneralEvent ) + && TMPXCollectionMessage::EPathChanged == aMessage.ValueTObjectL( KMPXMessageGeneralEvent ) ); + } + +private: + /// Collection utility that stores the path to represent current navigational + /// state + MMPXCollectionUtility* iCollectionUtility; + MMPXViewUtility* iViewUtility; + NGlxNavigationalState::TViewingMode iViewingMode; + // commented off by gopakumar as this is not used anymore + // TVwsViewId iViewId; + /// List of observers + RPointerArray< MGlxNavigationalStateObserver > iObservers; + + TBool iIsNavigating; // If ETrue it means Navigating is already happening, so not allowed to navigate before current navigation Completes. + // If EFalse it means Navigation can happen + + }; + +// ----------------------------------------------------------------------------- +// InstanceL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxNavigationalState* CGlxNavigationalState::InstanceL() + { + GLX_LOG_INFO( "CGlxNavigationalState::InstanceL" ); + return CGlxSingletonStore::InstanceL( &NewL ); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxNavigationalState* CGlxNavigationalState::NewL() + { + GLX_LOG_INFO( "CGlxNavigationalState::NewL" ); + CGlxNavigationalState* self = new ( ELeave ) CGlxNavigationalState; + CleanupStack::PushL( self ); + + // Construct implementation object + self->iImp = new ( ELeave ) CGlxNavigationalStateImp; + self->iImp->ConstructL(); + + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxNavigationalState::~CGlxNavigationalState() + { + delete iImp; + } + +// ----------------------------------------------------------------------------- +// Close a reference +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxNavigationalState::Close() + { + GLX_LOG_ENTRY_EXIT( "CGlxNavigationalState::Close"); + + // Decrease reference count, and delete if last one + CGlxSingletonStore::Close( this ); + // Member variable access not safe after CGlxSingletonStore::Close() + } + +// ----------------------------------------------------------------------------- +// Close a reference +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxNavigationalState::AddObserverL( + MGlxNavigationalStateObserver& aObserver ) + { + GLX_LOG_INFO1( "CGlxNavigationalState::AddObserverL %x", &aObserver ); + iImp->AddObserverL( aObserver ); + } + +// ----------------------------------------------------------------------------- +// Close a reference +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxNavigationalState::RemoveObserver( + MGlxNavigationalStateObserver& aObserver ) + { + GLX_LOG_INFO1( "CGlxNavigationalState::RemoveObserver %x", &aObserver ); + iImp->RemoveObserver( aObserver ); + } + +// ----------------------------------------------------------------------------- +// Close a reference +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath* CGlxNavigationalState::StateLC() const + { + GLX_LOG_ENTRY_EXIT( "CGlxNavigationalState::StateLC" ); + return iImp->StateLC(); + } + +// ----------------------------------------------------------------------------- +// Navigate to parent item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxNavigationalState::NavigateToParentL() + { + GLX_LOG_ENTRY_EXIT( "CGlxNavigationalState::NavigateToParentL" ); + iImp->NavigateToParentL(); + } + +// ----------------------------------------------------------------------------- +// Navigate to a child item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxNavigationalState::NavigateToChildL( + const TGlxMediaId& aItemIdToOpen ) + { + // GLX_LOG_INFO1( "CGlxNavigationalState::NavigateToChildL %d", aItemIdToOpen.Value() ); + iImp->NavigateToChildL( aItemIdToOpen ); + } + +// ----------------------------------------------------------------------------- +// Navigate to a path +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxNavigationalState::NavigateToL( const CMPXCollectionPath& aState ) + { + GLX_LOG_ENTRY_EXIT( "CGlxNavigationalState::NavigateToL"); + iImp->NavigateToL( aState ); + } + +// ----------------------------------------------------------------------------- +// Activate previous view +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxNavigationalState::ActivatePreviousViewL() + { + GLX_LOG_ENTRY_EXIT( "CGlxNavigationalState::ActivatePreviousViewL"); + iImp->ActivatePreviousViewL(); + } + +EXPORT_C void CGlxNavigationalState::SetToViewMode() + { + iImp->SetToViewMode(); + // inform the observers( only appui!! ) that the mode is view + } + +EXPORT_C NGlxNavigationalState::TViewingMode CGlxNavigationalState::ViewingMode() + { + return iImp->ViewingMode(); + } + + +EXPORT_C void CGlxNavigationalState::SetBackExitStatus(TBool aStatus) + { + iBackExitStatus = aStatus; + } + +EXPORT_C TBool CGlxNavigationalState::BackExitStatus() + { + return iBackExitStatus; + } + +// EOF diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/src/glxresolutionmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/src/glxresolutionmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Allows change the screen size +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +// CLASS HEADER +#include "glxresolutionmanager.h" + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "glxresolutionutility.h" +#include + +// --------------------------------------------------------------------------- +// CGlxResolutionManager, inlined to save a few bytes of ROM +// --------------------------------------------------------------------------- +// +inline CGlxResolutionManager::CGlxResolutionManager() + { + } + +// --------------------------------------------------------------------------- +// CGlxResolutionManager::NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxResolutionManager* CGlxResolutionManager::NewL() + { + GLX_LOG_INFO("CGlxResolutionManager::NewL"); + CGlxResolutionManager* self = new ( ELeave ) CGlxResolutionManager(); + CleanupStack::PushL( self ); + self->iResUtility = CGlxResolutionUtility::InstanceL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CGlxResolutionManager +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxResolutionManager::~CGlxResolutionManager() + { + GLX_LOG_INFO("CGlxResolutionManager::~CGlxResolutionManager"); + if (iResUtility) + { + iResUtility->Close(); + iResUtility = NULL; + } + } + +// --------------------------------------------------------------------------- +// SetScreenSize +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxResolutionManager::SetScreenSizeL( TSize aScreenSize ) + { + GLX_LOG_INFO2( + "CGlxResolutionManager::SetScreenSize (%d,%d)", + aScreenSize.iWidth, aScreenSize.iHeight ); + iResUtility->SetScreenSizeL( aScreenSize ); + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/src/glxresolutionutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/src/glxresolutionutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2008-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: Utility class for managing the screen size +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +// CLASS HEADER +#include "glxresolutionutility.h" + +// EXTERNAL INCLUDES +#include // for AknLayoutUtils + +// INTERNAL INCLUDES +#include // for singletonstore +#include "mglxresolutionchangeobserver.h" // for MGlxResolutionChangeObserver + +#include + +//----------------------------------------------------------------------------- +// CGlxResolutionUtility::InstanceL +//----------------------------------------------------------------------------- +// +EXPORT_C CGlxResolutionUtility* CGlxResolutionUtility::InstanceL() + { + GLX_LOG_INFO("CGlxResolutionUtility::InstanceL"); + CGlxResolutionUtility* self = CGlxSingletonStore::InstanceL( &NewL ); + return self; + } + +//----------------------------------------------------------------------------- +// CGlxResolutionUtility::Close +//----------------------------------------------------------------------------- +// +EXPORT_C void CGlxResolutionUtility::Close() + { + GLX_LOG_INFO("CGlxResolutionUtility::Close"); + CGlxSingletonStore::Close( this ); + } + +//----------------------------------------------------------------------------- +// ScreenSize +//----------------------------------------------------------------------------- +// +EXPORT_C TSize CGlxResolutionUtility::ScreenSize() const + { + GLX_LOG_INFO("CGlxResolutionUtility::ScreenSize"); + return iScreenSize; + } + +//----------------------------------------------------------------------------- +// PixelsToPoss +//----------------------------------------------------------------------------- +// +EXPORT_C TReal32 CGlxResolutionUtility::PixelsToPoss( + const TReal32& aPixelLen ) const + { + GLX_LOG_INFO("CGlxResolutionUtility::PixelsToPoss"); + // Screen = 240 : 320 + // POSS = .75 : 1 + // aPixelLen= 240 + // retVal = .75 + return aPixelLen * iPixelToPossRatio; + } + +//----------------------------------------------------------------------------- +// PossToPixels +//----------------------------------------------------------------------------- +// +EXPORT_C TReal32 CGlxResolutionUtility::PossToPixels( + const TReal32& aPossLen ) const + { + GLX_LOG_INFO("CGlxResolutionUtility::PossToPixels"); + // Screen = 240 : 320 + // POSS = .75 : 1 + // aLenPoss = .75 + // retVal = 240 + return aPossLen * iOnePossToPixelRatio; + } + + + +//----------------------------------------------------------------------------- +// AddObserverL. +//----------------------------------------------------------------------------- +// +EXPORT_C void CGlxResolutionUtility::AddObserverL( + MGlxResolutionChangeObserver& aObserver ) + { + GLX_LOG_INFO( "CGlxResolutionUtility::AddObserverL" ); + if( KErrNotFound == iObserverList.Find( &aObserver ) ) + { + iObserverList.AppendL( &aObserver ); + } + } + + + +//----------------------------------------------------------------------------- +// RemoveObserver +//----------------------------------------------------------------------------- +// +EXPORT_C void CGlxResolutionUtility::RemoveObserver( + MGlxResolutionChangeObserver& aObserver ) + { + GLX_LOG_INFO("CGlxResolutionUtility::RemoveObserver"); + + TInt index = iObserverList.Find( &aObserver ); + if ( KErrNotFound != index ) + { + iObserverList.Remove( index ); + } + } + +//----------------------------------------------------------------------------- +// HandleScreenSizeChanged +//----------------------------------------------------------------------------- +// +void CGlxResolutionUtility::SetScreenSizeL( TSize aScreenSize ) + { + GLX_LOG_INFO("CGlxResolutionUtility::HandleScreenSizeChanged"); + + if( iScreenSize != aScreenSize ) + { + // "Percentage Of Screen Size". A unit of measurement, in which 1.0 + // is as long as the longer edge of the screen. + iOnePossToPixelRatio = + ( aScreenSize.iHeight > aScreenSize.iWidth ) ? + aScreenSize.iHeight : aScreenSize.iWidth; + // calculate the multiplier + iPixelToPossRatio = 1.0 / iOnePossToPixelRatio; + iScreenSize = aScreenSize; + + // Notify observers of a change in the screen resolution + TInt ii = iObserverList.Count(); + while ( ii-- > 0 ) + { + iObserverList[ ii ]->HandleResolutionChangedL(); + } + } + } + +//----------------------------------------------------------------------------- +// NewL +//----------------------------------------------------------------------------- +// +CGlxResolutionUtility* CGlxResolutionUtility::NewL() + { + GLX_LOG_INFO("CGlxResolutionUtility::NewL"); + CGlxResolutionUtility* self = new( ELeave ) CGlxResolutionUtility; + self->ConstructL(); + return self; + } + +//----------------------------------------------------------------------------- +// ~CGlxResolutionUtility +//----------------------------------------------------------------------------- +// +CGlxResolutionUtility::CGlxResolutionUtility() + { + // Do Nothing + } + +//----------------------------------------------------------------------------- +// ConstructL +//----------------------------------------------------------------------------- +// +void CGlxResolutionUtility::ConstructL() + { + // set the initial screen size + // ask avkon for the full screen size + TRect screen; + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); + // set the initial size + SetScreenSizeL( screen.Size() ); + } + + +//----------------------------------------------------------------------------- +// ~CGlxResolutionUtility +//----------------------------------------------------------------------------- +// +CGlxResolutionUtility::~CGlxResolutionUtility() + { + GLX_LOG_INFO("CGlxResolutionUtility::~CGlxResolutionUtility"); + // Close the observer array + iObserverList.Close(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/commonui/src/glxzoomstatepublisher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/commonui/src/glxzoomstatepublisher.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-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: Utility class for publishing the zoom state +* +*/ + + + + +// Class header +#include "glxzoomstatepublisher.h" + +// External includes +#include // for feature flag +#include +#include + +// Internal includes +#include + +/** + * @internal reviewed 5/02/2007 by Alex Birkett + */ + +// ----------------------------------------------------------------------------- +// NGlxZoomStatePublisher +// ----------------------------------------------------------------------------- +namespace NGlxZoomStatePublisher + { +#ifdef GLX_PUBLISH_ZOOMING_STATE + // local constants + _LIT( KGlxContextSource, "Application" ); + _LIT( KGlxContextType, "Photos.Zoom" ); + _LIT_SECURITY_POLICY_PASS( KGlxContextSec ); + + _LIT( KGlxContextValueEnabled, "Enabled" ); + _LIT( KGlxContextValueDisabled, "Disabled" ); + + /** + * Implementation of MCFListener, needed + * since CCFClient takes a reference + */ + class TemporaryListener : public MCFListener + { + private: // From MCFListener + /// @ref MCFListener + void ContextIndicationL( + const CCFContextIndication& /*aChangedContext*/ ) + { + // nothing to do + } + /// @ref MCFListener + void ActionIndicationL( + const CCFActionIndication& /*aActionToExecute*/ ) + { + // nothing to do + } + /// @ref MCFListener + void HandleContextFrameworkError( + TCFError /*aError*/, + const TDesC& /*aSource*/, + const TDesC& /*aType*/ ) + { + // nothing to do + } + /// @ref MCFListener + TAny* Extension( const TUid& /*aExtensionUid*/ ) const + { + // nothing to do + return NULL; + } + }; + +// ----------------------------------------------------------------------------- +// PublishStateL +// ----------------------------------------------------------------------------- +EXPORT_C void PublishStateL( TBool aEnabled ) + { + TRACER( "NGlxZoomStatePublisher::PublishStateL" ); + // publish zooming state if the feature is enabled + TemporaryListener templistener; + // create client and keep it on the cleanupstack + CCFClient* client = CCFClient::NewLC( templistener ); + // define the context + TInt err = client->DefineContext( + KGlxContextSource, KGlxContextType, KGlxContextSec ); + // if either success or context already there + if( ( err == KErrNone )|| + ( err == KErrAlreadyExists ) ) + { + // create context object and keep it on the cleanupstack + CCFContextObject* context = CCFContextObject::NewLC(); + // set source and type + context->SetSourceL( KGlxContextSource ); + context->SetTypeL( KGlxContextType ); + // default zoom state is disabled + context->SetValueL( KGlxContextValueDisabled ); + if( aEnabled ) + { + // enable zoom state + context->SetValueL( KGlxContextValueEnabled ); + } + // publish, cant really deal with the error so just ignore it + (void)client->PublishContext( *context ); + CleanupStack::PopAndDestroy( context ); + } + // release client + CleanupStack::PopAndDestroy( client ); + } // PublishStateL +#else +// ----------------------------------------------------------------------------- +// PublishStateL +// ----------------------------------------------------------------------------- +EXPORT_C void PublishStateL( TBool /*aEnabled*/ ) + { + } +#endif + } // namespace + diff -r 000000000000 -r 4e91876724a2 photosgallery/conf/gallery.confml Binary file photosgallery/conf/gallery.confml has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/conf/gallery_200009EE.crml Binary file photosgallery/conf/gallery_200009EE.crml has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/conf/slideshow.confml Binary file photosgallery/conf/slideshow.confml has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/conf/slideshow_200071D3.crml Binary file photosgallery/conf/slideshow_200071D3.crml has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/data/200104DF.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/data/200104DF.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + +// INCLUDES +#include +#include "glxcontentharvesterplugin.hrh" + + +//CONSTANTS +#define KCCHarvesterServerPluginUid 0x10282E5B + + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// REGISTRY_INFO theInfo +// Declares info for the "all" implementation +// +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = KGlxCHPluginDllUid; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KCCHarvesterServerPluginUid; + implementations = + { + // Info for ContentHarvesterPlugin + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCHPluginImplUid; + version_no = 1; + display_name = "photos"; + default_data = "photos"; + opaque_data = "photos"; + } + }; + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcontentharvesterplugin +* +*/ + + + + +#include +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +glxcontentharvesterplugin.mmp + +PRJ_EXPORTS +../rom/glxcontentharvesterplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxcontentharvesterplugin.iby) + +// End of file + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/group/glxcontentharvesterplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/group/glxcontentharvesterplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008-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: Project definition file for project CHPlugin +* +*/ + + + + +#include + +TARGET glxcontentharvesterplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200104DF + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src + +SOURCE glxcontentharvesterplugin.cpp +SOURCE glxcontentharvesterpluginall.cpp +SOURCE glxcontentharvesterpluginmonths.cpp +SOURCE glxcontentharvesterpluginalbums.cpp +SOURCE glxcontentharvesterpluginbase.cpp +SOURCE glxcontentharvesterplugintags.cpp +SOURCE glxcontentharvesterpluginproxy.cpp + +TARGETPATH resource/apps +START RESOURCE ../data/200104DF.rss +TARGET glxcontentharvesterplugin.rsc +END // RESOURCE + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../viewframework/medialists/inc +SYSTEMINCLUDE ../../viewframework/inc +SYSTEMINCLUDE ../../common/inc +SYSTEMINCLUDE ../../commonui/inc +SYSTEMINCLUDE ../../collectionframework/thumbnailcreator/inc +SYSTEMINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY cdlengine.lib +LIBRARY ws32.lib +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxlogging.lib +LIBRARY liwservicehandler.lib +LIBRARY mpxcommon.lib // CMPXCollectionPath +LIBRARY glxmedialists.lib // medialist +LIBRARY glxcommon.lib // CMPXmedia +LIBRARY featmgr.lib // For FeatureManager::FeatureSupported +LIBRARY mpxcollectionutility.lib +LIBRARY aknicon.lib +LIBRARY apgrfx.lib +DEBUGLIBRARY flogger.lib + +//end of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2008-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: Publish the content in the photosuite + * + */ + +#ifndef C_GLXCONTENTHARVESTERPLUGIN_H +#define C_GLXCONTENTHARVESTERPLUGIN_H + +// INCLUDES + +#include + +#include // for MGlxMediaListObserver +#include // for TGlxMediaId + +#include +#include + +// FORWARD DECLARATIONS + +class MGlxMediaList; +class CGlxAttributeContext; +class TGlxSequentialIterator; +class MGlxContentHarvesterPluginEntry; +class CGlxDefaultAttributeContext; +class CMPXCollectionPath; +class CLiwGenericParamList; +class CLiwServiceHandler; + + +class MGlxContentHarvesterPlugin + { +public : + virtual void UpdatePlugins(TBool aValue=ETrue)=0; + virtual TBool IsRefreshNeeded()=0; + virtual void SetRefreshNeeded(TBool aRefreshNeed) =0; + virtual TBool SuiteInFocus()=0; + }; + +// CLASS DECLARATION +/** + * CP Content Harvester plugin + * + */ + +class CGlxContentHarvesterPlugin : public CContentHarvesterPlugin, public MGlxMediaListObserver, + public MGlxContentHarvesterPlugin + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CGlxContentHarvesterPlugin* NewL( MLiwInterface* aCPSInterface ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPlugin(); + + // from base class + + void UpdateL(); + +private: + + /** + * Perform the second phase construction + */ + void ConstructL(); + + /** + * Default constructor. + */ + CGlxContentHarvesterPlugin( MLiwInterface* aCPSInterface ); + + void UpdateDataL(); + + CMPXCollectionPath* CollectionPathLC ( const TGlxMediaId& aPluginId ) const; + + void UpdateDataInCPSL(TInt aCollection); + + void FillInputListWithDataL( + CLiwGenericParamList* aInParamList, + const TDesC& aPublisherId, const TDesC& aContentType, + TInt aCollection ); + + void CreateContextsL(); + + void CreateMedialistL(); + + /*To update the plugins based on the matrix menu is on foreground or background + * @parm: aUpdate :if it is true then update all the plugins + * @parm: aUpdate :if it is false then remove all the observers. + */ + void UpdatePlugins(TBool aUpdate); + + /* + * Sets if the refresh of the collection is required or not + * @parm: aUpdate :if it is true,then plugin has to be updated. + * @parm: aUpdate :if it is false,then plugin need not be updated. + */ + void SetRefreshNeeded(TBool aRefreshNeed); + + /* + * check if refresh needed flag is set + */ + TBool IsRefreshNeeded(); + + void DestroyMedialist(); + + /* + * Check if photossuite is in focus + */ + TBool SuiteInFocus(); + + //Call back from the Media list for any error occured + void HandleError( TInt aError ); + +private: // from MGlxMediaListObserver + + /** + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemRemoved + */ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemSelected + */ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + MLiwInterface* iCPSInterface; + + /// Owned: Media list + MGlxMediaList* iMediaList; + + /// Own: the attribute context + CGlxDefaultAttributeContext* iSubtitleAttributeContext; + + // Owned: array of implementation objects + RPointerArray iEntries; + + // to check if refresh needed for plugins + TBool iIsRefreshNeeded; + + // Collection Indexes array to refresh the screen + RArray iCollectionIndexes; + }; + +#endif // C_GLXCONTENTHARVESTERPLUGIN_H diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2008-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: Resource headers + * + */ + + + + + +#ifndef GLXCONTENTHARVESTERPLUGIN_HRH +#define GLXCONTENTHARVESTERPLUGIN_HRH + +// CONSTANTS + +#define KGlxCHPluginDllUid 0x200104DF //dll uid +#define KGlxCHPluginImplUid 0x200104E0 //implementation uid + + + +#endif // GLXCONTENTHARVESTERPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginalbums.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginalbums.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2008-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: Publish the albums collection content in the photosuite + * + */ + +#ifndef GLXCONTENTHARVESTERPLUGINALBUMS_H +#define GLXCONTENTHARVESTERPLUGINALBUMS_H + +// INCLUDES +#include + +#include // for TGlxMediaId +#include // for MGlxMediaListObserver +#include // for TGlxSequentialIterator + +#include +#include +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterpluginbase.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CLiwGenericParamList; +class CLiwServiceHandler; +class CPeriodic; +class MLiwInterface; +class CGlxAttributeContext; +class CGlxThumbnailContext; + +// CLASS DECLARATION +/** + * CP Content Harvester plugin + * + */ + +class CGlxContentHarvesterPluginAlbums : public CGlxContentHarvesterPluginBase, +public MGlxMediaListObserver, public MLiwNotifyCallback + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CGlxContentHarvesterPluginAlbums* NewLC( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPluginAlbums(); + + // from base class + + /** + * Here the preview Thumbnails are updated + */ + void UpdateDataL(); + + /** + * This is a call back from the Matrix Menu whenever there is change in focus + */ + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + + /** + * updates media list with coressponding context depending on the focus + * to show the thumbnails + */ + void UpdatePreviewThumbnailListL( ); + + /** + * Returns the collection items count + */ + TInt Count(); + +private: + + /** + * Perform the second phase construction + */ + void ConstructL(); + + /** + * Default constructor. + */ + CGlxContentHarvesterPluginAlbums( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Update data in Content Publisher Storage + */ + void UpdateDataInCPSL(TInt aHandle); + + /** + * This retrievs the bitmap handle and updates the index of the + * thumbnail to be shown + */ + TInt UpdateItem(TInt aItemIndex); + + /* + * This Updates the thumbnail/Preview list with thumbnails already present + */ + void HandleItemChanged(); + + /* + * This Function is called when the collection recives a focus and losses the focus + * @param aOn :True : The collection is in focus + * : False : The collection lost the focus + */ + void ActivateL( TBool aOn ); + + /** + * Delets the medial list created. + */ + void DestroyMedialist(); + + /** + * Creates a media list + */ + void CreateMedialistL(); + + /** + * Adds the context and observers to the media list + */ + void AddContextAndObserverL(); + + /** + * Adds the context and observers to the media list + */ + void RemoveContextAndObserver(); + + //Call back from the Media list for any error occured + void HandleError( TInt /*aError*/ ); + + +private: // from MGlxMediaListObserver + + /** + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemRemoved + */ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemSelected + */ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + MLiwInterface* iCPSInterface; + CLiwGenericParamList* iInParamList; + CLiwGenericParamList* iOutParamList; + CPeriodic* iPeriodic; + + /// Owned: Media list + MGlxMediaList* iMediaList; + + /// Own: the thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + /// Own: Thuimbnail Iterator + TGlxSequentialIterator iThumbnailIterator; + + RArray iPreviewItemCount; + + // Preview thumbnail index + TInt iProgressIndex; + + }; + +#endif /*GLXCONTENTHARVESTERPLUGINALBUMS_H*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginall.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2008-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: Publish the All collection content in the photosuite + * + */ + +#ifndef GLXCONTENTHARVESTERPLUGINALL_H_ +#define GLXCONTENTHARVESTERPLUGINALL_H_ + + + +// INCLUDES +#include +#include // for TGlxMediaId +#include // for MGlxMediaListObserver +#include // for TGlxSequentialIterator +#include +#include +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterpluginbase.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CLiwGenericParamList; +class CLiwServiceHandler; +class CPeriodic; +class MLiwInterface; +class CGlxAttributeContext; +class CGlxThumbnailContext; + +// CLASS DECLARATION +/** + * CP Content Harvester plugin + * + */ + +class CGlxContentHarvesterPluginAll : public CGlxContentHarvesterPluginBase, +public MGlxMediaListObserver, public MLiwNotifyCallback + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CGlxContentHarvesterPluginAll* NewLC( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPluginAll(); + + // from base class + + /** + * Here the preview Thumbnails are updated + */ + void UpdateDataL(); + + /** + * This is a call back from the Matrix Menu whenever there is change in focus + */ + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + + /** + * updates media list with coressponding context depending on the focus + * to show the thumbnails + */ + void UpdatePreviewThumbnailListL( ); + + /** + * Returns the collection items count + */ + TInt Count(); + +private: + + /** + * Perform the second phase construction + */ + void ConstructL(); + + /** + * Default constructor. + */ + CGlxContentHarvesterPluginAll( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Update data in Content Publisher Storage + */ + void UpdateDataInCPSL(TInt aHandle); + + /** + * This retrievs the bitmap handle and updates the index of the + * thumbnail to be shown + */ + TInt UpdateItem(TInt aItemIndex); + + /* + * This Updates the thumbnail/Preview list with thumbnails already present + */ + void HandleItemChanged(); + + /* + * This Function is called when the collection recives a focus and losses the focus + * @param aOn :True : The collection is in focus + * : False : The collection lost the focus + */ + void ActivateL( TBool aOn ); + + /** + * Delets the medial list created. + */ + void DestroyMedialist(); + + /** + * Creates a media list + */ + void CreateMedialistL(); + + /** + * Adds the context and observers to the media list + */ + void AddContextAndObserverL(); + + /** + * Adds the context and observers to the media list + */ + void RemoveContextAndObserver(); + + //Call back from the Media list for any error occured + void HandleError( TInt /*aError*/ ); + +private: // from MGlxMediaListObserver + + /** + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemRemoved + */ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemSelected + */ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + MLiwInterface* iCPSInterface; + CLiwGenericParamList* iInParamList; + CLiwGenericParamList* iOutParamList; + CPeriodic* iPeriodic; + + /// Owned: Media list + MGlxMediaList* iMediaList; + + /// Own: the thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + /// Own: Thuimbnail Iterator + TGlxSequentialIterator iThumbnailIterator; + + RArray iPreviewItemCount; + + // Preview thumbnail index + TInt iProgressIndex; + + //this variable holds the value ,whether the collection is in focus or not + TBool iIsFocused; + }; + +#endif /*GLXCONTENTHARVESTERPLUGINALL_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2008-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: Base class for publishing all the content +* +*/ + + + + +#ifndef GLXCONTENTHARVESTERPLUGINBASE_H +#define GLXCONTENTHARVESTERPLUGINBASE_H + +//includes + +#include + +//Forward Declarations + +class CLiwGenericParamList; +class CLiwServiceHandler; +class MLiwInterface; +class CGlxContentHarvesterPluginBase; +class CGlxThumbnailContext; +class MGlxMediaList; +class MGlxContentHarvesterPlugin; + +class MGlxContentHarvesterPluginEntry : public MLiwNotifyCallback + { +public: + /** + * Virtual destructor + */ + virtual ~MGlxContentHarvesterPluginEntry() {}; + virtual void ContainerCacheCleanupL(MGlxMediaList* aMediaList)=0; + virtual void UpdatePreviewThumbnailListL()=0; + virtual void RemoveContextAndObserver()=0; + virtual TBool Focused()=0; + virtual TInt Count()=0; + }; + + +class CGlxContentHarvesterPluginBase : public CBase, public MGlxContentHarvesterPluginEntry + { +public: // Constructors and destructor + + /** + * Default constructor. + */ + CGlxContentHarvesterPluginBase( ); + + /** + * Perform the second phase construction + */ + void ConstructL(TInt aDefaultIconId ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPluginBase(); + + TSize GetGridIconSize(); + + /* Calculate the Grid Icon Size for Grid Widget. It always calculate + * size for Landscape orientation. This is done to avoid saving two + * different thumbnail icons in Thumbnail database. + */ + void SetGridIconSizeL(); + + /** + * Returns the focus status of this photossuite collection + */ + TBool Focused(); + + /*This returns the bitmap handle used to display the + * default thumbnail. + */ + TInt GetBitmapHandle() const; + + /** + * Returns if the collection is in focus or not + */ + TBool IsFocused() const; + + /** + * Updates the focus value of the collection to true or false + * @param aFoucs :True : updates the collection is in focus + * :False : updates the collection is not in focus + * + */ + void SetFocus(TBool aFocus ); + + //To check if the matrix menu is in foreground or not + TBool IsMatrixMenuInForegroundL(); + + /* To register for Liw notifications + */ + void GetInterfaceForNotificationL(); + void RequestCpsNotificationL(TInt aSuiteItem); + void SetupPublisherL(TInt aSuiteItem); + void HandleStateChangeL(TInt aSuiteItem); + + /* Virtual APi which will be implemented in child classes + * Basically gives info if the item in suite has gained focus + * or lost it + */ + virtual void ActivateL(TBool aOn) = 0; + + /* + * Creates Medialist based on the plugin id + */ + MGlxMediaList* CreateMedialistAndThumbnailContextL(const TGlxMediaId& aPluginId, + CGlxThumbnailContext* aThumbnailContext) const; + + /** + * Method to fill input list for CPS add command + */ + void FillInputListWithDataL( + CLiwGenericParamList* aInParamList, + const TDesC& aPublisherId, const TDesC& aContentType, + const TDesC& aContentId, TInt aHandle); + + /* Cleanup medialist cache */ + void ContainerCacheCleanupL(MGlxMediaList* aMediaList); + + /* Set content harvester plugin instance */ + void SetCHPlugin(MGlxContentHarvesterPlugin* aCHplugin); + + /* Get content harvester plugin instance */ + MGlxContentHarvesterPlugin* GetCHPlugin(); + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + TSize iGridIconSize; + CLiwServiceHandler* iServiceHandler; + CLiwGenericParamList* iInParamList; + CLiwGenericParamList* iOutParamList; + + MLiwInterface* iCPSNotificationInterface; + TGlxSequentialIterator iThumbnailIterator; + + // Instance of content harvester plugin + MGlxContentHarvesterPlugin* iCHplugin; + + //This variable holds the value ,whether the collection is in focus or not + TBool iIsFocused; + + //This variable is initialised with the default bitmap. + CFbsBitmap* iBitmap; + }; +#endif /*GLXCONTENTHARVESTERPLUGINBASE_H*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugincaptured.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugincaptured.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2008-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: Publish the captured collection content in the photosuite + * + */ + +#ifndef GLXCONTENTHARVESTERPLUGINCAPTURED_H_ +#define GLXCONTENTHARVESTERPLUGINCAPTURED_H_ + + +// INCLUDES +#include + +#include // for TGlxMediaId +#include // for MGlxMediaListObserver +#include // for TGlxSequentialIterator + +#include +#include +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterpluginbase.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CLiwGenericParamList; +class CLiwServiceHandler; +class CPeriodic; +class MLiwInterface; +class CGlxAttributeContext; +class CGlxThumbnailContext; + +// CLASS DECLARATION +/** + * CP Content Harvester plugin + * + */ + +class CGlxContentHarvesterPluginCaptured : public CGlxContentHarvesterPluginBase, +public MGlxMediaListObserver, public MLiwNotifyCallback + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CGlxContentHarvesterPluginCaptured* NewLC( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPluginCaptured(); + + // from base class + + /** + * Here the preview Thumbnails are updated + */ + void UpdateDataL(); + + /** + * This is a call back from the Matrix Menu whenever there is change in focus + */ + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + + /** + * updates media list with coressponding context depending on the focus + * to show the thumbnails + */ + void UpdatePreviewThumbnailListL( ); + + /** + * Returns the collection items count + */ + TInt Count(); + +private: + + /** + * Perform the second phase construction + */ + void ConstructL(); + + /** + * Default constructor. + */ + CGlxContentHarvesterPluginCaptured( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Update data in Content Publisher Storage + */ + void UpdateDataInCPSL(TInt aHandle); + + /** + * This retrievs the bitmap handle and updates the index of the + * thumbnail to be shown + */ + TInt UpdateItem(TInt aItemIndex); + + /* + * This Updates the thumbnail/Preview list with thumbnails already present + */ + void HandleItemChanged(); + + /* + * This Function is called when the collection recives a focus and losses the focus + * @param aOn :True : The collection is in focus + * : False : The collection lost the focus + */ + void ActivateL( TBool aOn ); + + /** + * Delets the medial list created. + */ + void DestroyMedialist(); + + /** + * Creates a media list + */ + void CreateMedialistL(); + + /** + * Adds the context and observers to the media list + */ + void AddContextAndObserverL(); + + /** + * Adds the context and observers to the media list + */ + void RemoveContextAndObserver(); + + //Call back from the Media list for any error occured + void HandleError( TInt /*aError*/ ); + + +private: // from MGlxMediaListObserver + + /** + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemRemoved + */ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemSelected + */ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + MLiwInterface* iCPSInterface; + CLiwGenericParamList* iInParamList; + CLiwGenericParamList* iOutParamList; + CPeriodic* iPeriodic; + + /// Owned: Media list + MGlxMediaList* iMediaList; + + /// Own: the thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + /// Own: Thuimbnail Iterator + TGlxSequentialIterator iThumbnailIterator; + + RArray iPreviewItemCount; + + // Preview thumbnail index + TInt iProgressIndex; + //this variable holds the value ,whether the collection is in focus or not + TBool iIsFocused; + }; + +#endif /*GLXCONTENTHARVESTERPLUGINCAPTURED_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugindownloads.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugindownloads.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2008-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: Publish the downloads collection content in the photosuite + * + */ + +#ifndef GLXCONTENTHARVESTERPLUGINDOWNLOADS_H_ +#define GLXCONTENTHARVESTERPLUGINDOWNLOADS_H_ + + + +// INCLUDES +#include + +#include // for TGlxMediaId +#include // for MGlxMediaListObserver +#include // for TGlxSequentialIterator + +#include +#include +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterpluginbase.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CLiwGenericParamList; +class CLiwServiceHandler; +class CPeriodic; +class MLiwInterface; +class CGlxAttributeContext; +class CGlxThumbnailContext; + +// CLASS DECLARATION +/** + * CP Content Harvester plugin + * + */ + +class CGlxContentHarvesterPluginDownloads : public CGlxContentHarvesterPluginBase, +public MGlxMediaListObserver, public MLiwNotifyCallback + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CGlxContentHarvesterPluginDownloads* NewLC( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPluginDownloads(); + + // from base class + + /** + * Here the preview Thumbnails are updated + */ + void UpdateDataL(); + + /** + * This is a call back from the Matrix Menu whenever there is change in focus + */ + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + + /** + * updates media list with coressponding context depending on the focus + * to show the thumbnails + */ + void UpdatePreviewThumbnailListL( ); + + /** + * Returns the collection items count + */ + TInt Count(); + +private: + + /** + * Perform the second phase construction + */ + void ConstructL(); + + /** + * Default constructor. + */ + CGlxContentHarvesterPluginDownloads( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Update data in Content Publisher Storage + */ + void UpdateDataInCPSL(TInt aHandle); + + /** + * This retrievs the bitmap handle and updates the index of the + * thumbnail to be shown + */ + TInt UpdateItem(TInt aItemIndex); + + /* + * This Updates the thumbnail/Preview list with thumbnails already present + */ + void HandleItemChanged(); + + /* + * This Function is called when the collection recives a focus and losses the focus + * @param aOn :True : The collection is in focus + * : False : The collection lost the focus + */ + void ActivateL( TBool aOn ); + + /** + * Delets the medial list created. + */ + void DestroyMedialist(); + + /** + * Creates a media list + */ + void CreateMedialistL(); + + /** + * Adds the context and observers to the media list + */ + void AddContextAndObserverL(); + + /** + * Adds the context and observers to the media list + */ + void RemoveContextAndObserver(); + + //Call back from the Media list for any error occured + void HandleError( TInt /*aError*/ ); + + +private: // from MGlxMediaListObserver + + /** + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemRemoved + */ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemSelected + */ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + MLiwInterface* iCPSInterface; + CLiwGenericParamList* iInParamList; + CLiwGenericParamList* iOutParamList; + CPeriodic* iPeriodic; + + /// Owned: Media list + MGlxMediaList* iMediaList; + + /// Own: the thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + /// Own: Thuimbnail Iterator + TGlxSequentialIterator iThumbnailIterator; + + RArray iPreviewItemCount; + + // Preview thumbnail index + TInt iProgressIndex; + + //this variable holds the value ,whether the collection is in focus or not + TBool iIsFocused; + }; + +#endif /*GLXCONTENTHARVESTERPLUGINDOWNLOADS_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginmonths.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterpluginmonths.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2008-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: Publish the months collection content in the photosuite + * + */ + +#ifndef GLXCONTENTHARVESTERPLUGINMONTHS_H_ +#define GLXCONTENTHARVESTERPLUGINMONTHS_H_ + + +// INCLUDES +#include + + +#include // for TGlxMediaId +#include // for MGlxMediaListObserver +#include // for TGlxSequentialIterator + +#include +#include +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterpluginbase.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CLiwGenericParamList; +class CLiwServiceHandler; +class CPeriodic; +class MLiwInterface; +class CGlxAttributeContext; +class CGlxThumbnailContext; + +// CLASS DECLARATION +/** + * CP Content Harvester plugin + * + */ + +class CGlxContentHarvesterPluginMonths : public CGlxContentHarvesterPluginBase, +public MGlxMediaListObserver, public MLiwNotifyCallback + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CGlxContentHarvesterPluginMonths* NewLC( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPluginMonths(); + + // from base class + + /** + * Here the preview Thumbnails are updated + */ + void UpdateDataL(); + + /** + * This is a call back from the Matrix Menu whenever there is change in focus + */ + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + + /** + * updates media list with coressponding context depending on the focus + * to show the thumbnails + */ + void UpdatePreviewThumbnailListL( ); + + /** + * Returns the collection items count + */ + TInt Count(); + +private: + + /** + * Perform the second phase construction + */ + void ConstructL(); + + /** + * Default constructor. + */ + CGlxContentHarvesterPluginMonths( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin); + + /** + * Update data in Content Publisher Storage + */ + void UpdateDataInCPSL(TInt aHandle); + + /** + * This retrievs the bitmap handle and updates the index of the + * thumbnail to be shown + */ + TInt UpdateItem(TInt aItemIndex); + + /* + * This Updates the thumbnail/Preview list with thumbnails already present + */ + void HandleItemChanged(); + + /* + * This Function is called when the collection recives a focus and losses the focus + * @param aOn :True : The collection is in focus + * : False : The collection lost the focus + */ + void ActivateL( TBool aOn ); + + /** + * Delets the medial list created. + */ + void DestroyMedialist(); + + /** + * Creates a media list + */ + void CreateMedialistL(); + + /** + * Adds the context and observers to the media list + */ + void AddContextAndObserverL(); + + /** + * Adds the context and observers to the media list + */ + void RemoveContextAndObserver(); + + //Call back from the Media list for any error occured + void HandleError( TInt /*aError*/ ); + + +private: // from MGlxMediaListObserver + + /** + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemRemoved + */ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemSelected + */ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + MLiwInterface* iCPSInterface; + CLiwGenericParamList* iInParamList; + CLiwGenericParamList* iOutParamList; + CPeriodic* iPeriodic; + + /// Owned: Media list + MGlxMediaList* iMediaList; + + /// Own: the thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + /// Own: Thuimbnail Iterator + TGlxSequentialIterator iThumbnailIterator; + + RArray iPreviewItemCount; + + // Preview thumbnail index + TInt iProgressIndex; + + //this variable holds the value ,whether the collection is in focus or not + TBool iIsFocused; + }; + +#endif /*GLXCONTENTHARVESTERPLUGINMONTHS_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugintags.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugintags.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2008-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: Publish the tags collection content in the photosuite + * + */ +#ifndef GLXCONTENTHARVESTERPLUGINTAGS_H_ +#define GLXCONTENTHARVESTERPLUGINTAGS_H_ + + +// INCLUDES +#include + +#include // for TGlxMediaId +#include // for MGlxMediaListObserver +#include // for TGlxSequentialIterator + +#include +#include +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterpluginbase.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CLiwGenericParamList; +class CLiwServiceHandler; +class CPeriodic; +class MLiwInterface; +class CGlxAttributeContext; +class CGlxThumbnailContext; + +// CLASS DECLARATION +/** + * CP Content Harvester plugin + * + */ + +class CGlxContentHarvesterPluginTags : public CGlxContentHarvesterPluginBase, +public MGlxMediaListObserver, public MLiwNotifyCallback + { +public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CGlxContentHarvesterPluginTags* NewLC( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Destructor. + */ + virtual ~CGlxContentHarvesterPluginTags(); + + // from base class + + /** + * Here the preview Thumbnails are updated + */ + void UpdateDataL(); + + /** + * This is a call back from the Matrix Menu whenever there is change in focus + */ + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + + /** + * updates media list with coressponding context depending on the focus + * to show the thumbnails + */ + void UpdatePreviewThumbnailListL( ); + + /** + * Returns the collection items count + */ + TInt Count(); + +private: + + /** + * Perform the second phase construction + */ + void ConstructL(); + + /** + * Default constructor. + */ + CGlxContentHarvesterPluginTags( MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ); + + /** + * Update data in Content Publisher Storage + */ + void UpdateDataInCPSL(TInt aHandle); + + /** + * This retrievs the bitmap handle and updates the index of the + * thumbnail to be shown + */ + TInt UpdateItem(TInt aItemIndex); + + /* + * This Updates the thumbnail/Preview list with thumbnails already present + */ + void HandleItemChanged(); + + /* + * This Function is called when the collection recives a focus and losses the focus + * @param aOn :True : The collection is in focus + * : False : The collection lost the focus + */ + void ActivateL( TBool aOn ); + + /** + * Delets the medial list created. + */ + void DestroyMedialist(); + + /** + * Creates a media list + */ + void CreateMedialistL(); + + /** + * Adds the context and observers to the media list + */ + void AddContextAndObserverL(); + + /** + * Adds the context and observers to the media list + */ + void RemoveContextAndObserver(); + + //Call back from the Media list for any error occured + void HandleError( TInt /*aError*/ ); + + +private: // from MGlxMediaListObserver + + /** + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemRemoved + */ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleItemSelected + */ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /** + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + +private: // data + + /** + * Instance of CPS interface used for update with CPS. + */ + MLiwInterface* iCPSInterface; + CLiwGenericParamList* iInParamList; + CLiwGenericParamList* iOutParamList; + CPeriodic* iPeriodic; + + /// Owned: Media list + MGlxMediaList* iMediaList; + + /// Own: the thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + /// Own: Thuimbnail Iterator + TGlxSequentialIterator iThumbnailIterator; + + RArray iPreviewItemCount; + + // Preview thumbnail index + TInt iProgressIndex; + + //this variable holds the value ,whether the collection is in focus or not + TBool iIsFocused; + }; + +#endif /*GLXCONTENTHARVESTERPLUGINTAGS_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/inc/glxmapconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/inc/glxmapconstants.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2008 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: Global definitions + * +*/ + + + + +#ifndef GLXMAPCONSTANTS_H +#define GLXMAPCONSTANTS_H + +/** Data types for CP content */ +enum TDataTypes + { + ECPHardcodedText = 1, // 0001 + ECPResourceText = 2, // 0010 + ECPFilepathImage = 4, // 0100 + ECPResourceIcon = 8 // 1000 + }; + +enum TCPGetListOrder + { + ECPRecent = 1, // 0001 + ECPPublisher = 2, // 0010 + ECPContent = 4, // 0100 + ECPContentId = 8 // 1000 + }; + +enum TFlag + { + EActivate = 1, // 0001 + }; + +const TInt KNameArgumentsLimit = 5; + +//This variables are used by the Plugins +//Time Interval to show the thumbnail when the collection is in focus +const TInt KTimerInterval( 2000000 ); +//The Thumbnails to shown/fetched when the collection is in focus +const TInt KPreviewThumbnailFetchCount(15); +//The Thumbnails to shown/fetched when the collection is not in focus +const TInt KSinglePreviewThumbnail(1); + +//The constants to identify the plugin/collection +const TInt KMaxInt = 0x7fffffff; + +// Bug Fix @ ESLM-7VWF28 :: Change to Display the " ALL " collection folder as the very first collection folder in the Photos Matrix Menu View +const TInt KItemIndexAll = 0; +const TInt KItemIndexMonths = 1; +const TInt KItemIndexAlbums = 2; +const TInt KItemIndexTags = 3; +const TInt KListDataWindowSize = 10; +//Total collection count +const TInt KTotalCollection=4; + +//Written for photos specific usage - START + +_LIT8(KMonthsSubtitle, "MonthsSubtitle"); +_LIT8(KAllSubtitle, "AllcsSubtitle"); +_LIT8(KTagsSubtitle, "TagsSubtitle"); +_LIT8(KAlbumsSubtitle, "AlbumsSubtitle"); + +_LIT(KPublisherTextMonths,"photossuiteMonths"); +_LIT(KPublisherTextAlbums,"photossuiteAlbums"); +_LIT(KPublisherTextTags,"photossuiteTags"); +_LIT(KPublisherTextAll,"photossuiteAllcs"); + +_LIT(KContTypeTextMonths,"months1"); +_LIT(KContTypeTextAlbums,"albums1"); +_LIT(KContTypeTextTags,"tags1"); +_LIT(KContTypeTextAll,"allcs1"); +_LIT(KContId1,"category1"); + +_LIT8(KFirstIcon, "first_icon"); + +_LIT(KSuitePublisher,"photossuite"); +_LIT(KContentActivationMonths,"months"); +_LIT(KContentActivationAlbums,"albums"); +_LIT(KContentActivationTags,"tags"); +_LIT(KContentActivationAll,"allcs"); + +_LIT(KContentDefault,"default"); + +//Written for photos specific usage - END + + +_LIT( KService, "CP Service" ); + +_LIT8( KCPInterface, "IDataSource" ); +_LIT8( KCPContentInterface, "IContentPublishing" ); +_LIT8( KCPService, "Service.ContentPublishing" ); +_LIT8( KCommand, "cmd" ); + +//Supported Commands +_LIT8( KGetList, "GetList" ); +_LIT8( KAdd, "Add" ); +_LIT8( KDelete, "Delete" ); +_LIT8( KRequestNotification, "RequestNotification" ); +_LIT8( KExecuteAction, "ExecuteAction" ); +_LIT8( KCmdCancel, "Cancel" ); +_LIT8( KActivate, "Activate" ); +_LIT8( KActivateTrigger, "activate" ); +_LIT8( KDeactivateTrigger, "deactivate" ); + +// Input arguments +_LIT8( KType, "type" ); +_LIT8( KAction, "action" ); +_LIT8( KItem, "item" ); +_LIT8( KFilter, "filter" ); +_LIT8( KData, "data" ); +_LIT8( KSortOrder, "sort_order" ); +_LIT8( KItemId, "item_id" ); +_LIT8( KByPublisher, "by_publisher" ); +_LIT8( KByEntryIds, "by_entryids" ); +_LIT8( KPublisherId, "publisher" ); +_LIT8( KContentType, "content_type" ); +_LIT8( KContentId, "content_id" ); +_LIT8( KExpirationDate, "expiration_date" ); +_LIT8( KActivatePublisher, "activate" ); +_LIT8( KIds, "ids" ); +_LIT8( KId, "id" ); +_LIT8( KFlag, "flag"); +_LIT8( KAccessList, "ACL" ); +_LIT8( KACLRead, "read"); +_LIT8( KACLWrite, "write"); +_LIT8( KACLDelete, "delete"); +_LIT8( KUIDs, "UID" ); +_LIT8( KCapability, "Capability" ); +_LIT( KAll, "all"); +_LIT( KSortPublisher, "publisher"); +_LIT( KSortContentType, "content_type"); +_LIT( KSortContentId, "content_id"); +_LIT( KSortRecent, "recent"); +_LIT( KOperationAdd, "add" ); +_LIT( KOperationUpdate, "update" ); +_LIT( KOperationDelete, "delete" ); +_LIT( KOperationExecute, "execute" ); +_LIT8( KDataType, "data_type" ); +_LIT8( KOperation, "operation" ); +_LIT8( KActionTrigger, "action_trigger" ); +_LIT8( KHardcodedText, "harcoded_text" ); +_LIT8( KResourceText, "resource_text" ); +_LIT8( KFilepathImage, "filepath_image" ); +_LIT8( KIdMask, "id_mask" ); +_LIT8( KResourceIcon, "resource_icon" ); +_LIT8( KIdIcon, "id_icon" ); +_LIT8( KIdText, "id_text" ); +_LIT( KCpData, "cp_data" ); +_LIT( KPublisher, "publisher" ); +_LIT8( KChangeInfo, "change_info" ); + +_LIT8( KPublisher_Uid, "publisher_Uid" ); + +// Argument in Action +_LIT8( KActionHandlerInterface, "IDataAction" ); +_LIT8( KActionHandlerService, "Service.ActionHandler" ); +_LIT8( KCmdExecute, "Execute" ); +_LIT8( KPluginUid, "plugin_id" ); +_LIT8( KDataForActionHandler, "data" ); + +_LIT8( KLaunchMethod, "launch_method" ); +_LIT8( KApplicationUid, "application_uid" ); +_LIT8( KDocumentName, "document_name" ); +_LIT8( KViewId, "view_id" ); +_LIT8( KMessageUid, "message_uid" ); + +// Output +_LIT8( KResults, "results" ); +_LIT8( KListMap, "list_map" ); +_LIT8( KStatus, "status" ); +_LIT8( KDataMap, "data_map" ); +_LIT8( KActionMap, "action_map" ); +_LIT8( KKey, "key" ); + +_LIT8( KTransactionID, "TransactionID" ); + +#endif /*GLXMAPCONSTANTS_H*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/rom/glxcontentharvesterplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/rom/glxcontentharvesterplugin.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008-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: iby file for content harvester plugin. +* +*/ + + + + +#ifndef __GLXCONTENTHARVESTERPLUGIN_IBY__ +#define __GLXCONTENTHARVESTERPLUGIN_IBY__ + +ECOM_PLUGIN( glxcontentharvesterplugin.dll, glxcontentharvesterplugin.rsc ) + +#endif // __GLXCONTENTHARVESTERPLUGIN_IBY__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,551 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage + * + */ + +// INCLUDE FILES + +//photo headers + + +#include +#include +#include +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include +#include + +#include +#include + +//local headers +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterplugin.hrh" +#include "glxmapconstants.h" + +#include "glxcontentharvesterpluginmonths.h" +#include "glxcontentharvesterpluginalbums.h" +#include "glxcontentharvesterplugintags.h" +#include "glxcontentharvesterpluginall.h" + + + + + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPlugin::CGlxContentHarvesterPlugin( MLiwInterface* aCPSInterface ) + { + TRACER( "CGlxContentHarvesterPlugin::CGlxContentHarvesterPlugin" ); + iCPSInterface = aCPSInterface; + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::ConstructL() + { + TRACER( "CGlxContentHarvesterPlugin::ConstructL" ); + + CreateMedialistL(); + + // Bug Fix @ ESLM-7VWF28 :: " Downloads " collection folder is replaced by " ALL " collection folder + CGlxContentHarvesterPluginAll* allContents = CGlxContentHarvesterPluginAll::NewLC(iCPSInterface,this); + iEntries.AppendL(allContents); + CleanupStack::Pop(allContents); + + CGlxContentHarvesterPluginMonths* monthsContents = CGlxContentHarvesterPluginMonths::NewLC(iCPSInterface,this); + iEntries.AppendL(monthsContents); + CleanupStack::Pop(monthsContents); + + CGlxContentHarvesterPluginAlbums* albumContents = CGlxContentHarvesterPluginAlbums::NewLC(iCPSInterface,this); + iEntries.AppendL(albumContents); + CleanupStack::Pop(albumContents); + + CGlxContentHarvesterPluginTags* tagContents = CGlxContentHarvesterPluginTags::NewLC(iCPSInterface,this); + iEntries.AppendL(tagContents); + CleanupStack::Pop(tagContents); + for(TInt pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++) + { + iCollectionIndexes.Insert(KErrNotFound, pluginIndex); + } + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPlugin* CGlxContentHarvesterPlugin::NewL( MLiwInterface* aCPSInterface ) + { + TRACER( "CGlxContentHarvesterPlugin::NewL" ); + CGlxContentHarvesterPlugin* self = new ( ELeave ) CGlxContentHarvesterPlugin( aCPSInterface ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPlugin::~CGlxContentHarvesterPlugin() + { + TRACER( "CGlxContentHarvesterPlugin::~CGlxContentHarvesterPlugin" ); + // destroy entries + iEntries.ResetAndDestroy(); + DestroyMedialist(); + iCollectionIndexes.Reset(); + } + +// ---------------------------------------------------------------------------- +// This function updates information in CPS storage +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::UpdateL() + { + TRACER( "CGlxContentHarvesterPlugin::UpdateL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::CollectionPathLC( ) +// --------------------------------------------------------------------------- +// +CMPXCollectionPath* CGlxContentHarvesterPlugin::CollectionPathLC( + const TGlxMediaId& aPluginId ) const + { + TRACER( "CGlxContentHarvesterPlugin::CollectionPathLC" ); + // create the collection path - uses the category ID from the constructor + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( aPluginId.Value() ); + return path; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList*/* aList*/) + { + // Do Nothing + TRACER( "CGlxContentHarvesterPlugin::HandleItemAddedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPlugin::HandleMediaL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPlugin::HandleItemRemovedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleItemModifiedL( + const RArray& aItemIndexes, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPlugin::HandleItemModifiedL" ); + TInt countOfIndexesChanged = aItemIndexes.Count(); + for (TInt i = 0; i < countOfIndexesChanged ; i++ ) + { + UpdateDataInCPSL(i); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPlugin::HandleAttributesAvailableL" ); + TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle); + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + GLX_LOG_INFO1("CGlxContentHarvesterPlugin::HandleAttributesAvailableL,aItemIndex=%d",aItemIndex); + if (KErrNotFound != aAttributes.Find(subTitleAttrib, match)) + { + GLX_LOG_INFO("CGlxContentHarvesterPlugin::HandleAttributesAvailableL,MATCH Found"); + if (aItemIndex < KTotalCollection) + { + TInt mediaCount = iEntries[aItemIndex]->Count(); + GLX_LOG_INFO1("GlxCH: HandleAttributesAvailableL mediaCount(%d)", mediaCount); + if (iCollectionIndexes[aItemIndex] != mediaCount) + { + GLX_LOG_INFO("GlxCH: *** UpdateDataInCPSL ***"); + SetRefreshNeeded(ETrue); + UpdateDataInCPSL(aItemIndex); + iCollectionIndexes[aItemIndex] = mediaCount; + + // Fix for ESLM-7WKJZR :: Sometimes Thumbnails are not updating when + // connecting/disconnecting USB + // If there is a change in media count, when photo suite is in forground, + // Update preview thumbnails of all collections. + if(SuiteInFocus()) + { + GLX_LOG_INFO("CGlxContentHarvesterPlugin : *** SuiteInFocus ***"); + iEntries[aItemIndex]->UpdatePreviewThumbnailListL(); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPlugin::HandleFocusChangedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPlugin::HandleItemSelectedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPlugin::HandleMessageL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::FillInputListWithDataL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::FillInputListWithDataL( + CLiwGenericParamList* aInParamList, + const TDesC& aPublisherId, const TDesC& aContentType, + TInt aCollection) + { + TRACER( "CGlxContentHarvesterPlugin::FillInputListWithDataL" ); + + if(iMediaList) + { + aInParamList->Reset(); + if (!iCPSInterface) + { + User::Leave( KErrNotFound ); + } + else + { + TLiwGenericParam cptype( KType, TLiwVariant( KCpData )); + aInParamList->AppendL( cptype ); + + CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC(); + CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); + + TBuf8 subTitleTxt; + const TGlxMedia& glxMedia = iMediaList->Item(aCollection); + switch (aCollection) + { + // Bug Fix @ ESLM-7VWF28 :: " Downloads " collection folder is replaced by " ALL " collection folder + case KItemIndexAll: + subTitleTxt.Append(KAllSubtitle); + break; + + case KItemIndexMonths: + subTitleTxt.Append(KMonthsSubtitle); + break; + + case KItemIndexAlbums: + subTitleTxt.Append(KAlbumsSubtitle); + break; + + case KItemIndexTags: + subTitleTxt.Append(KTagsSubtitle); + break; + + default: + break; + } + +#ifdef _DEBUG + TPtrC pStr= glxMedia.SubTitle(); + TBuf buf; + buf.Copy(pStr); + GLX_LOG_INFO1("CGlxContentHarvesterPlugin::FillInputListWithDataL,SUB TITLE=%S", &subTitleTxt); + GLX_LOG_INFO1("CGlxContentHarvesterPlugin::FillInputListWithDataL,SUB TITLE=%S", &buf); +#endif + + map->Remove(subTitleTxt); + map->InsertL( subTitleTxt, TLiwVariant( glxMedia.SubTitle() ) ); + + cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId )); + cpdatamap->InsertL( KContentType, TLiwVariant( aContentType )); + cpdatamap->InsertL( KContentId, TLiwVariant( KContId1 )); + cpdatamap->InsertL( KDataMap, TLiwVariant(map) ); + + TLiwGenericParam item( KItem, TLiwVariant( cpdatamap )); + aInParamList->AppendL( item ); + CleanupStack::PopAndDestroy( map ); + CleanupStack::PopAndDestroy( cpdatamap ); + item.Reset(); + cptype.Reset(); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::UpdateDataInCPSL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::UpdateDataInCPSL(TInt aCollection) + { + TRACER( "CGlxContentHarvesterPlugin::UpdateDataInCPSL" ); + GLX_LOG_INFO1("GlxCH::UpdateDataInCPSL(%d)", aCollection); + + TInt mtpStatus = KErrNotFound; + RProperty::Get(KMtpPSUid, KMtpPSStatus, mtpStatus); + GLX_LOG_INFO1("GlxCH::UpdateDataInCPSL mtpStatus(%d)",mtpStatus); + if ( (mtpStatus != KErrNotFound) && + (mtpStatus != EMtpPSStatusUninitialized) ) + { + if (!SuiteInFocus()) + { + GLX_LOG_INFO("GlxCH: *** MTP ACTIVE & SUITE NOT IN FOCUS ***"); + return; + } + } + + //update data in CPS + CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC(); + CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC(); + TBuf publisherTxt; + TBuf contTypeTxt; + + switch (aCollection) + { + // Bug Fix @ ESLM-7VWF28 :: " Downloads " collection folder is replaced by " ALL " collection folder + case KItemIndexAll: + publisherTxt.Append(KPublisherTextAll); + contTypeTxt.Append(KContTypeTextAll); + break; + + case KItemIndexMonths: + publisherTxt.Append(KPublisherTextMonths); + contTypeTxt.Append(KContTypeTextMonths); + break; + + case KItemIndexAlbums: + publisherTxt.Append(KPublisherTextAlbums); + contTypeTxt.Append(KContTypeTextAlbums); + break; + + case KItemIndexTags: + publisherTxt.Append(KPublisherTextTags); + contTypeTxt.Append(KContTypeTextTags); + break; + + default: + break; + } + + FillInputListWithDataL(inParamList, publisherTxt, contTypeTxt, aCollection); + + iCPSInterface->ExecuteCmdL( KAdd, *inParamList, *outParamList ); + CleanupStack::PopAndDestroy(outParamList); + CleanupStack::PopAndDestroy(inParamList); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::CreateMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::CreateMedialistL() + { + TRACER( "CGlxContentHarvesterPlugin::CreateMedialistL" ); + if(!iMediaList) + { + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + iMediaList = MGlxMediaList::InstanceL( *path ); + CreateContextsL(); + iMediaList->AddMediaListObserverL( this ); + CleanupStack::PopAndDestroy( path ); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::DestroyMedialist +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::DestroyMedialist() + { + TRACER( "CGlxContentHarvesterPlugin::DestroyMedialist" ); + if( iMediaList ) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iSubtitleAttributeContext); + delete iSubtitleAttributeContext; + iSubtitleAttributeContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::CreateContextsL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::CreateContextsL() + { + TRACER( "CGlxContentHarvesterPlugin::CreateContextsL" ); + iSubtitleAttributeContext = CGlxDefaultAttributeContext::NewL(); + iSubtitleAttributeContext->SetRangeOffsets( KListDataWindowSize, KListDataWindowSize ); + iSubtitleAttributeContext->AddAttributeL( KGlxMediaCollectionPluginSpecificSubTitle ); + iMediaList->AddContextL( iSubtitleAttributeContext, KMaxInt ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::HandleError +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::HandleError(TInt /*aError*/) + { + TRACER( "CGlxContentHarvesterPlugin::HandleError" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::UpdatePlugins +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::UpdatePlugins(TBool aUpdate) + { + TRACER( "CGlxContentHarvesterPlugin::UpdatePlugins" ); + TInt pluginIndex; + if(aUpdate) + { + if(IsRefreshNeeded()) + { + GLX_LOG_INFO1("CGlxContentHarvesterPlugin::UpdatePlugins=%d",iIsRefreshNeeded); + for(pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++) + { + iEntries[pluginIndex]->UpdatePreviewThumbnailListL(); + } + SetRefreshNeeded(EFalse); + } + } + else + { + //This check is added here,since all the collection are not created on the power + // up of the phone,so we dont need to remove the context at that stage else it will panic. + if(iEntries.Count()== KTotalCollection) + { + for(pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++) + { + iEntries[pluginIndex]->RemoveContextAndObserver(); + } + //before exiting the matrix menu , need to set this to true + //when again matrix menu is launched,the thumbnails has to be updated + //this use case is when we have not modified any items in the photos + //so refreshneeded will not be set and UpdatePreviewThumbnailListL is not called when + //matrix menu gets the focused,so update the refresh state + SetRefreshNeeded(ETrue); + } + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::IsRefreshNeeded +// --------------------------------------------------------------------------- +// +TBool CGlxContentHarvesterPlugin::IsRefreshNeeded() + { + TRACER( "CGlxContentHarvesterPlugin::IsRefreshNeeded" ); + GLX_LOG_INFO1("CGlxContentHarvesterPlugin::IsRefreshNeeded(%d)", iIsRefreshNeeded); + return iIsRefreshNeeded; + } +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::SetRefreshNeeded +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPlugin::SetRefreshNeeded(TBool aRefreshNeed) + { + TRACER( "CGlxContentHarvesterPlugin::SetRefreshNeeded" ); + GLX_LOG_INFO1("CGlxContentHarvesterPlugin::SetRefreshNeeded(%d)", aRefreshNeed); + iIsRefreshNeeded = aRefreshNeed; + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPlugin::SuiteInFocus +// --------------------------------------------------------------------------- +// +TBool CGlxContentHarvesterPlugin::SuiteInFocus() + { + TRACER( "CGlxContentHarvesterPlugin::SuiteInFocus" ); + TBool focus = EFalse; + for(TInt pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++) + { + focus = iEntries[pluginIndex]->Focused(); + if (focus) + { + GLX_LOG_INFO1("GlxCH: SuiteInFocus pluginIndex(%d)", pluginIndex); + break; + } + } + GLX_LOG_INFO1("CGlxContentHarvesterPlugin::SuiteInFocus focus(%d)", focus); + return focus; + } + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginalbums.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginalbums.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,604 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage for albums collection + * + */ + +// INCLUDE FILES + +#include +#include + +#include +#include // Glx Icons +#include //for KGlxCollectionPluginAlbumsImplementationUid +#include // for KGlxMediaIdThumbnail +#include +#include +#include //for tracer +#include // for log +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include + +#include "glxcontentharvesterpluginalbums.h" +#include "glxcontentharvesterplugin.hrh" +#include "glxmapconstants.h" + + +// ============================ MEMBER FUNCTIONS ============================== +LOCAL_C TInt TimerCallbackL( TAny* aPtr ) + { + TRACER( "CGlxContentHarvesterPluginAlbums::TimerCallbackL" ); + static_cast(aPtr)->UpdateDataL(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginAlbums::CGlxContentHarvesterPluginAlbums( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginAlbums::CGlxContentHarvesterPluginAlbums" ); + iCPSInterface = aCPSInterface; + SetCHPlugin(aCHplugin); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::ConstructL() + { + TRACER( "CGlxContentHarvesterPluginAlbums::ConstructL" ); + + //Call the base class ConstructL + CGlxContentHarvesterPluginBase::ConstructL(EMbmGlxiconsQgn_prop_image_notcreated); + + iPeriodic = CPeriodic::NewL( CActive::EPriorityLow ); + iThumbnailContext = CGlxThumbnailContext::NewL(&iThumbnailIterator); + + //Register/Subscribe with matrix menu for the notifications + GetInterfaceForNotificationL(); + SetupPublisherL(KItemIndexAlbums); + RequestCpsNotificationL(KItemIndexAlbums); + HandleStateChangeL(KItemIndexAlbums); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginAlbums* CGlxContentHarvesterPluginAlbums::NewLC( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginAlbums::NewL" ); + CGlxContentHarvesterPluginAlbums* self = new ( ELeave ) CGlxContentHarvesterPluginAlbums( aCPSInterface,aCHplugin ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginAlbums::~CGlxContentHarvesterPluginAlbums() + { + TRACER( "CGlxContentHarvesterPluginAlbums::~CGlxContentHarvesterPluginAlbums" ); + + DestroyMedialist(); + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + delete iPeriodic; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::UpdateDataL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::UpdateDataL() + { + TRACER( "CGlxContentHarvesterPluginAlbums::UpdateDataL" ); + if(iMediaList && iMediaList->Count() && iPreviewItemCount.Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::UpdateDataL(),iProgressIndex=%d",iProgressIndex); + TInt ret = UpdateItem(iPreviewItemCount[iProgressIndex]); + if(ret != KErrNotFound) + { + //Updates the thumbnail in the collection + UpdateDataInCPSL(ret); + } + else + { + UpdateDataInCPSL(GetBitmapHandle()); + } + } + else + { + // Show previous thumbnail until the new thumbnail is + // fecthed.Added this check to avoid flicker + if(!GetCHPlugin()->IsRefreshNeeded() || (iMediaList->Count() == 0)) + { + //Don't Show the Thumbnail/Show nothing + GLX_LOG_INFO("CGlxContentHarvesterPluginAlbums::UpdateDataL() --O"); + UpdateDataInCPSL(GetBitmapHandle()); + } + + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleNotifyL() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginAlbums::HandleNotifyL( + TInt /* aCmdId*/, + TInt/* aEventId */, + CLiwGenericParamList& /*aEventParamList*/, + const CLiwGenericParamList& /*aInParamList*/ ) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleNotifyL" ); + HandleStateChangeL(KItemIndexAlbums); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleItemChanged() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleItemChanged() + { + TRACER("CGlxContentHarvesterPluginAlbums::HandleItemChanged"); + + iProgressIndex = 0; + iPreviewItemCount.Reset(); + + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + if(iMediaList) + { + TInt count = iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums:: HandleItemChanged ,count=%d",count); + + TBool inFocus = IsFocused(); + for(TInt aItemIndex = 0; aItemIndex < count; aItemIndex++) + { + const TGlxMedia& item = iMediaList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + iPreviewItemCount.InsertInOrder(aItemIndex); + if(!inFocus) + { + //if the collection is in Focus,retrieve only one thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::HandleItemChanged,iRange=1,aItemIndex=%d",aItemIndex); + break; + } + else if(iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == count ) + { + //if the collection is not in Focus,retrieve 15 thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::HandleItemChanged,iRange=15,aItemIndex=%d",aItemIndex); + break; + } + + } + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::UpdateDataInCPSL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::UpdateDataInCPSL(TInt aHandle) + { + TRACER( "CGlxContentHarvesterPluginAlbums::UpdateDataInCPSL" ); + //update data in CPS + _LIT(KExamplePluginPub,"photossuite"); + _LIT(KContTypeText,"albums"); + _LIT(KContId1,"category1"); + + if(iCPSInterface && iMediaList ) + { + CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC(); + CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC(); + + FillInputListWithDataL(inParamList, KExamplePluginPub, KContTypeText , + KContId1, aHandle); + + iCPSInterface->ExecuteCmdL( KAdd, *inParamList, *outParamList ); + CleanupStack::PopAndDestroy(outParamList); + CleanupStack::PopAndDestroy(inParamList); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::UpdateItem() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginAlbums::UpdateItem(TInt aItemIndex) + { + TRACER( "CGlxContentHarvesterPluginAlbums::UpdateItem" ); + const TGlxMedia& item = iMediaList->Item(aItemIndex); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::UpdateItem,aItemIndex=%d ",aItemIndex); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::UpdateItem,iProgressIndex=%d ",iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iPreviewItemCount.Count() || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + return value->iBitmap->Handle(); + } + return KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::ActivateL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::ActivateL( TBool aOn ) + { + TRACER( "CGlxContentHarvesterPluginAlbums::ActivateL" ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::ActivateL aOn =%d",aOn); + SetFocus(aOn); + + if (IsMatrixMenuInForegroundL() && aOn && !iPeriodic->IsActive() ) + { + if(GetCHPlugin()->IsRefreshNeeded()) + { + //Update the rest of all the collections on receving the focus... + GetCHPlugin()->UpdatePlugins(aOn); + } + else + { + //As the collection is not updated by the contentharvester plugin + //to update the thumbnails on the focus , need to call the below function + UpdatePreviewThumbnailListL(); + } + + iPeriodic->Start( KTimerInterval, + KTimerInterval, + TCallBack( TimerCallbackL, this ) ); + } + else if ( !aOn ) + { + if(!IsMatrixMenuInForegroundL()) + { + //use case:Matrix Menu is exited, by entering into grid view,application view,capture mode... + //Need to destroy all the collection's observers and context + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::ActivateL !aOn =%d and matrix not in foreground",aOn); + GetCHPlugin()->UpdatePlugins(aOn); + } + iPeriodic->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleItemAddedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleMediaL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /* aEndIndex */, MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleItemRemovedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleItemModifiedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleAttributesAvailableL" ); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::HandleAttributesAvailableL =%d ",aItemIndex); + + if (KErrNotFound != aAttributes.Find( thumbnailAttribute, match )) + { + const TGlxMedia& item = aList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginAlbums::HandleAttributesAvailableL Thumbnail is present "); + iPreviewItemCount.InsertInOrder(aItemIndex); + //if the collection on the matrix menu is not focused,then show only one thumbnail + if(!IsFocused()) + { + //if one thumbnail is fetched,it is sufficent when the collection is not in focus. + //remove the observer as client need not listen to the callbacks + GLX_LOG_INFO("CGlxContentHarvesterPluginAll::HandleAttributesAvailableL,one thumbnail fetched"); + UpdateDataInCPSL( value->iBitmap->Handle()); + iMediaList->RemoveMediaListObserver( this ); + } + else if (iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == aList->Count() ) + { + + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::HandleAttributesAvailableL,media list count=%d",aList->Count()); + //if the PreviewItemCount equals 15 or if it is eqaul to the total count + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + }//end of check against value + }//end of attribute match + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleFocusChangedL" ); + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleItemSelectedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleMessageL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::DestroyMedialist +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::DestroyMedialist() + { + TRACER( "CGlxContentHarvesterPluginAlbums::DestroyMedialist" ); + if( iMediaList ) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginAlbums::DestroyMedialist,media list deleted"); + RemoveContextAndObserver(); + delete iThumbnailContext; + iThumbnailContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::CreateMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::CreateMedialistL( ) + { + TRACER( "CGlxContentHarvesterPluginAlbums::CreateMedialistL" ); + if(!iMediaList) + { + //if the collection is in focus then , create media list with context of 15 items else + // with context of single item. + if(IsFocused()) + { + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + } + else + { + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + } + + iMediaList = CreateMedialistAndThumbnailContextL( TGlxMediaId( + KGlxCollectionPluginAlbumsImplementationUid ),iThumbnailContext); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::UpdatePreviewThumbnailListL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::UpdatePreviewThumbnailListL( ) + { + TRACER( "CGlxContentHarvesterPluginAlbums::UpdatePreviewThumbnailListL" ); + + //when there is an update of content in the collection + //this function is executed or when the collection recives the focus. + if(!iMediaList) + { + //media list is not created yet,create it. + CreateMedialistL( ); + //This is called to show the preview thumbnails. If no thumbnails are + //present, display nothing + UpdateDataL(); + } + else + { + if(GetCHPlugin()->IsRefreshNeeded()) + { + ContainerCacheCleanupL(iMediaList); + } + if(IsFocused()) + { + //1.This loop is executed,when the collection gets focus + //2.This loop is executed,when the contents are updated for this collection + //and this collection has focus,so 15 thumbnails are fetched. + HandleItemChanged(); + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + else + { + //1.This loop is executed,when the contents are updated for this collection + //and this collection doesn't have the focus,so only one thumbnail is fetched. + + //here we need to fetch only one item + //1.if the content is deleted,then creating a context doesn't fetch the attributes + //2.if the content is added and the content is not the latest as per the sorted order of the + // media list,then the thumbnails are not fetched. + // so show the first available thumbnail in the media list. + + HandleItemChanged(); + UpdateDataL(); + + //Adding the context doesn't gaurantee we get a call back for + //Handle attributes available,if the latest item is already fetched. + //and for the content added for this collection,if it is not latest + //we will not recieve the attributes .so show the first available thumbnail + //in the media list.if there is any new latest content added,the thumbnail will be + //fetched and shown. + + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::AddContextAndObserverL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::AddContextAndObserverL() + { + TRACER( "CGlxContentHarvesterPluginAlbums::AddRemoveContextAndObserverL" ); + if(iMediaList) + { + iMediaList->AddMediaListObserverL( this ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::RemoveContextAndObserver +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::RemoveContextAndObserver() + { + TRACER( "CGlxContentHarvesterPluginAlbums::RemoveContextAndObserver" ); + if(iMediaList) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::HandleError +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAlbums::HandleError(TInt /*aError*/) + { + TRACER( "CGlxContentHarvesterPluginAlbums::HandleError" ); + +#ifdef _DEBUG + if(iMediaList) + { + TInt count=iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::HandleError,count=%d",count); + for ( TInt i = 0; i < count ; i++ ) + { + const TGlxMedia& item = iMediaList->Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAlbums::HandleError,Error=%d ",thumbnailError); + + } + } +#endif + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::Count +// --------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginAlbums::Count() + { + TRACER( "CGlxContentHarvesterPluginAlbums::Count" ); + TInt count = KErrNone; + if(iMediaList) + { + count = iMediaList->Count(); + GLX_LOG_INFO1("GlxCHP:Albums::Count(%d)",count); + } + return count; + } +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginall.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,610 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage for all collection + * + */ + +// INCLUDE FILES + +#include +#include + +#include +#include // Glx Icons +#include // for KGlxMediaIdThumbnail +#include +#include +#include //for KGlxCollectionPluginAllImplementationUid +#include //for Traces +#include //for Log +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include + +#include "glxcontentharvesterplugin.hrh" +#include "glxcontentharvesterpluginall.h" + +#include "glxmapconstants.h" + + +// ============================ MEMBER FUNCTIONS ============================== +LOCAL_C TInt TimerCallbackL( TAny* aPtr ) + { + TRACER( "CGlxContentHarvesterPluginAll::TimerCallbackL" ); + static_cast(aPtr)->UpdateDataL(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginAll::CGlxContentHarvesterPluginAll( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginAll::CGlxContentHarvesterPluginAll" ); + iCPSInterface = aCPSInterface; + SetCHPlugin(aCHplugin); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::ConstructL() + { + TRACER( "CGlxContentHarvesterPluginAll::ConstructL" ); + + //Call the base class ConstructL,to create the default thumbnail + CGlxContentHarvesterPluginBase::ConstructL(EMbmGlxiconsQgn_prop_image_notcreated); + + iPeriodic = CPeriodic::NewL( CActive::EPriorityLow ); + iThumbnailContext = CGlxThumbnailContext::NewL(&iThumbnailIterator); + + //Register/Subscribe with matrix menu for the notifications + GetInterfaceForNotificationL(); + SetupPublisherL(KItemIndexAll); + RequestCpsNotificationL(KItemIndexAll); + HandleStateChangeL(KItemIndexAll); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginAll* CGlxContentHarvesterPluginAll::NewLC( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginAll::NewL" ); + CGlxContentHarvesterPluginAll* self = new ( ELeave ) CGlxContentHarvesterPluginAll( aCPSInterface,aCHplugin ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginAll::~CGlxContentHarvesterPluginAll() + { + TRACER( "CGlxContentHarvesterPluginAll::~CGlxContentHarvesterPluginAll" ); + + DestroyMedialist(); + + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + delete iPeriodic; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::UpdateDataL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::UpdateDataL() + { + TRACER( "CGlxContentHarvesterPluginAll::UpdateDataL" ); + if(iMediaList && iMediaList->Count() && iPreviewItemCount.Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::UpdateDataL(),iProgressIndex=%d",iProgressIndex); + TInt ret = UpdateItem(iPreviewItemCount[iProgressIndex]); + if(ret != KErrNotFound) + { + //Updates the thumbnail in the collection + UpdateDataInCPSL(ret); + } + else + { + UpdateDataInCPSL(GetBitmapHandle()); + } + } + else + { + // Show previous thumbnail until the new thumbnail is + // fecthed.Added this check to avoid flicker + if(iMediaList->Count() == 0) + { + //Don't Show the Thumbnail/Show nothing + GLX_LOG_INFO("CGlxContentHarvesterPluginAll::UpdateDataL() --O"); + UpdateDataInCPSL(GetBitmapHandle()); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleNotifyL() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginAll::HandleNotifyL( + TInt /* aCmdId*/, + TInt/* aEventId */, + CLiwGenericParamList& /*aEventParamList*/, + const CLiwGenericParamList& /*aInParamList*/ ) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleNotifyL" ); + + // First time when we enter matrix menu from shortcut or app. launcher, set + // IsRefreshNeeded flag to ETrue. so that thumbnail attributes are fetched again + // for all containers. This is to avoid preview thumbnails not getting shown in + // matirix menu under low memory conditions. + GetCHPlugin()->SetRefreshNeeded(ETrue); + + HandleStateChangeL(KItemIndexAll); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleItemChanged() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleItemChanged() + { + TRACER("CGlxContentHarvesterPluginAll::HandleItemChanged"); + + iProgressIndex = 0; + iPreviewItemCount.Reset(); + + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + if(iMediaList) + { + TInt count = iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll:: HandleItemChanged ,count=%d",count); + + TBool inFocus = IsFocused(); + for(TInt aItemIndex = 0; aItemIndex < count; aItemIndex++) + { + const TGlxMedia& item = iMediaList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + iPreviewItemCount.InsertInOrder(aItemIndex); + if(!inFocus) + { + //if the collection is NOT in Focus,retrive only one thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::HandleItemChanged,Range=1,aItemIndex=%d",aItemIndex); + break; + } + else if(iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == count ) + { + //if the collection is not in Focus,retrive 15 thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::HandleItemChanged,Range=15,aItemIndex=%d",aItemIndex); + break; + } + + } + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::UpdateDataInCPSL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::UpdateDataInCPSL(TInt aHandle) + { + TRACER( "CGlxContentHarvesterPluginAll::UpdateDataInCPSL" ); + //update data in CPS + _LIT(KExamplePluginPub,"photossuite"); + _LIT(KContentActivation,"allcs"); + _LIT(KContId1,"category1"); + + if(iCPSInterface && iMediaList ) + { + CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC(); + CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC(); + + //Shows the thumbnail in the matrix view + FillInputListWithDataL(inParamList, KExamplePluginPub, KContentActivation , + KContId1, aHandle); + + iCPSInterface->ExecuteCmdL( KAdd, *inParamList, *outParamList ); + CleanupStack::PopAndDestroy(outParamList); + CleanupStack::PopAndDestroy(inParamList); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::UpdateItem() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginAll::UpdateItem(TInt aItemIndex) + { + TRACER( "CGlxContentHarvesterPluginAll::UpdateItem" ); + const TGlxMedia& item = iMediaList->Item(aItemIndex); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::UpdateItem,aItemIndex=%d ",aItemIndex); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::UpdateItem,iProgressIndex=%d ",iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iPreviewItemCount.Count() || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + return value->iBitmap->Handle(); + } + return KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::ActivateL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::ActivateL( TBool aOn ) + { + TRACER( "CGlxContentHarvesterPluginAll::ActivateL" ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::ActivateL aOn =%d",aOn); + SetFocus(aOn); + + if (IsMatrixMenuInForegroundL() && aOn && !iPeriodic->IsActive() ) + { + if(GetCHPlugin()->IsRefreshNeeded()) + { + //Update the rest of all the collections on receving the focus... + GetCHPlugin()->UpdatePlugins(aOn); + } + else + { + //As the collection is not updated by the contentharvester plugin + //to update the thumbnails on the focus , need to call the below function + UpdatePreviewThumbnailListL(); + } + + iPeriodic->Start( KTimerInterval, + KTimerInterval, + TCallBack( TimerCallbackL, this ) ); + } + else if ( !aOn ) + { + if(!IsMatrixMenuInForegroundL()) + { + //use case:Matrix Menu is exited, by entering into grid view,application view,capture mode... + //Need to destroy all the collection's observers and context + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::ActivateL !aOn =%d and matrix not in foreground",aOn); + GetCHPlugin()->UpdatePlugins(aOn); + } + iPeriodic->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList*/*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleItemAddedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleMediaL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /* aEndIndex */, MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleItemRemovedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleItemModifiedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleAttributesAvailableL" ); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::HandleAttributesAvailableL =%d ",aItemIndex); + if (KErrNotFound != aAttributes.Find( thumbnailAttribute, match )) + { + const TGlxMedia& item = aList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginAll::HandleAttributesAvailableL Thumbnail is present "); + iPreviewItemCount.InsertInOrder(aItemIndex); + + //if the collection on the matrix menu is not focused,then show only one thumbnail + if(!IsFocused()) + { + //if one thumbnail is fetched,it is sufficent when the collection is not in focus. + //remove the observer as client need not listen to the callbacks + GLX_LOG_INFO("CGlxContentHarvesterPluginAll::HandleAttributesAvailableL,one thumbnail fetched"); + UpdateDataInCPSL( value->iBitmap->Handle()); + iMediaList->RemoveMediaListObserver( this ); + } + else if (iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == aList->Count() ) + { + //if the PreviewItemCount equals 15 or if it is eqaul to the total count + //remove the observer as client need not listen to the callbacks + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::HandleAttributesAvailableL,media list count=%d",aList->Count()); + iMediaList->RemoveMediaListObserver( this ); + } + }//end of check against value + }//end of attribute match + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleFocusChangedL" ); + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleItemSelectedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPluginAll::HandleMessageL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::DestroyMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::DestroyMedialist() + { + TRACER( "CGlxContentHarvesterPluginAll::DestroyMedialist" ); + if( iMediaList ) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginAll::DestroyMedialist,media list deleted"); + RemoveContextAndObserver(); + delete iThumbnailContext; + iThumbnailContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::CreateSingleItemMedialist +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::CreateMedialistL( ) + { + TRACER( "CGlxContentHarvesterPluginAll::CreateMedialistL" ); + if(!iMediaList) + { + //if the collection is in focus then , create media list with context of 15 items else + // with context of single item. + if(IsFocused()) + { + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + } + else + { + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + } + + iMediaList = CreateMedialistAndThumbnailContextL( TGlxMediaId( + KGlxCollectionPluginAllImplementationUid ),iThumbnailContext); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::UpdateMedialistContext +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::UpdatePreviewThumbnailListL( ) + { + TRACER( "CGlxContentHarvesterPluginAll::UpdatePreviewThumbnailListL" ); + + //when there is an update of content in the collection + //this function is executed or when the collection recives the focus. + if(!iMediaList) + { + //medis list is not created yet,create it. + CreateMedialistL( ); + //This is called to show the preview thumbnails. If no thumbnails are + //present, display nothing + UpdateDataL(); + } + else if(IsFocused()) + { + //1.This loop is executed,when the collection gets focus + //2.This loop is executed,when the contents are added/deleted for this collection + //and this collection has focus,so 15 thumbnails are fetched. + //say for example + //1.focus is on "All" collection/view and you insert MMC + //2.capture in burst mode and return quickly to photos suite and focus on "All" + HandleItemChanged(); + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + else + { + //1.This loop is executed,when the contents are updated for this collection + //and this collection doesn't have the focus,so only one thumbnail is fetched. + + //here we need to fetch only one item + //1.if the content is deleted,then creating a context doesn't fetch the attributes + //2.if the content is added and the content is not the latest as per the sorted order of the + // media list,then the thumbnails are not fetched. + // so show the first available thumbnail in the media list. + + HandleItemChanged(); + UpdateDataL(); + + //Adding the context doesn't gaurantee we get a call back for + //Handle attributes available,if the latest item is already fetched. + //and for the content added for this collection,if it is not latest + //we will not recieve the attributes .so show the first available thumbnail + //in the media list.if there is any new latest content added,the thumbnail will be + //fetched and shown. + + + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::AddContextAndObserverL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::AddContextAndObserverL() + { + TRACER( "CGlxContentHarvesterPluginAll::AddRemoveContextAndObserverL" ); + if(iMediaList) + { + iMediaList->AddMediaListObserverL( this ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::RemoveContextAndObserver +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::RemoveContextAndObserver() + { + TRACER( "CGlxContentHarvesterPluginAll::RemoveContextAndObserver" ); + if(iMediaList) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::HandleError +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginAll::HandleError(TInt /*aError*/) + { + TRACER( "CGlxContentHarvesterPluginAll::HandleError" ); + +#ifdef _DEBUG + if(iMediaList) + { + TInt count=iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::HandleError,count=%d",count); + for ( TInt i = 0; i < count ; i++ ) + { + const TGlxMedia& item = iMediaList->Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginAll::HandleError,Error=%d ",thumbnailError); + + } + } +#endif + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAll::Count +// --------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginAll::Count() + { + TRACER( "CGlxContentHarvesterPluginAll::Count" ); + TInt count = KErrNone; + if(iMediaList) + { + count = iMediaList->Count(); + GLX_LOG_INFO1("GlxCHP:All::Count(%d)",count); + } + return count; + } +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,570 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage + * + */ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include // KGlxFetchontextPriorityNormal and KGlxIconsFilename +#include +#include + +#include +#include +#include +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include +#include +#include +#include + +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterpluginbase.h" +#include "glxcontentharvesterplugin.hrh" +#include "glxmapconstants.h" +#include "glxcontentharvesterpluginalbums.h" + +// Matrixmenu uid - needed to check if photo suite is in foreground +const TInt KMatrixMenuUid = 0x101F4CD2; + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginBase::CGlxContentHarvesterPluginBase( ) + { + TRACER( "CGlxContentHarvesterPluginBase::CGlxContentHarvesterPluginBase" ); + // No Implementation + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::ConstructL(TInt aDefaultIconId ) + { + SetGridIconSizeL(); + TSize gridIconSize = GetGridIconSize(); + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + iBitmap = AknIconUtils::CreateIconL(resFile,aDefaultIconId); + AknIconUtils::SetSize(iBitmap, gridIconSize); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginBase::~CGlxContentHarvesterPluginBase() + { + TRACER( "CGlxContentHarvesterPluginBase::~CGlxContentHarvesterPluginBase" ); + if ( iCPSNotificationInterface ) + { + iCPSNotificationInterface->Close(); + } + + delete iServiceHandler; + + if(iBitmap) + { + delete iBitmap; + iBitmap=NULL; + } + } + +// --------------------------------------------------------------------------- +// SetGridIconSizeL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::SetGridIconSizeL() + { + TRACER("CGlxContentHarvesterPluginBase::SetGridIconSizeL()"); + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + + if(FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch )) + { + iGridIconSize = TSize(111,83); + } + else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640)) + { + iGridIconSize = TSize(146,110); + } + else + { + iGridIconSize = TSize(146,110); + } + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + } + +// --------------------------------------------------------------------------- +// GetGridIconSize +// --------------------------------------------------------------------------- +// +TSize CGlxContentHarvesterPluginBase::GetGridIconSize() + { + TRACER("CGlxContentHarvesterPluginBase::GetGridIconSize()"); + return iGridIconSize; + } + +// --------------------------------------------------------------------------- +// GetBitmapHandle +// --------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginBase::GetBitmapHandle() const + { + TRACER("CGlxContentHarvesterPluginBase::GetBitmapHandle"); + return iBitmap->Handle(); + } + +// --------------------------------------------------------------------------- +// GetInterfaceForNotificationL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::GetInterfaceForNotificationL() + { + TRACER( "CGlxContentHarvesterPluginBase::GetInterfaceForNotificationL" ); + // create Service Handler and keep as long as access to Service needed + iServiceHandler = CLiwServiceHandler::NewL(); + //keep for convenience, not owned + iInParamList = &iServiceHandler->InParamListL(); + iOutParamList = &iServiceHandler->OutParamListL(); + + RCriteriaArray criteriaArray; + CleanupResetAndDestroyPushL( criteriaArray ); + + // create Liw criteria + CLiwCriteriaItem* criterion = + CLiwCriteriaItem::NewLC( KLiwCmdAsStr, KCPInterface, KCPService ); + criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) ); + + criteriaArray.AppendL( criterion ); + CleanupStack::Pop( criterion ); + + // attach Liw criteria + iServiceHandler->AttachL( criteriaArray ); + // get Service interface + iServiceHandler->ExecuteServiceCmdL( *criterion, + *iInParamList, + *iOutParamList ); + + CleanupStack::PopAndDestroy( &criteriaArray ); + + // extract interface from output params + TInt pos( 0 ); + iOutParamList->FindFirst( pos, KCPInterface ); + if( pos != KErrNotFound ) + { + iCPSNotificationInterface = + (*iOutParamList)[pos].Value().AsInterface(); + } + + iInParamList->Reset(); + iOutParamList->Reset(); + + if ( !iCPSNotificationInterface ) + { + // handle no Service + User::Leave( KErrNotFound ); + } + } + +// --------------------------------------------------------------------------- +// RequestCpsNotificationL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::RequestCpsNotificationL(TInt aSuiteItem) + { + TRACER( "CGlxContentHarvesterPluginBase::RequestCpsNotificationL" ); + + TLiwGenericParam cptype( KType, TLiwVariant( KPublisherId )); + iInParamList->AppendL( cptype ); + + //create filter + CLiwDefaultMap* filterMap = CLiwDefaultMap::NewLC(); + filterMap->InsertL( KPublisherId, TLiwVariant( KSuitePublisher )); + + switch (aSuiteItem) + { + case KItemIndexMonths: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationMonths ) ); + break; + case KItemIndexAlbums: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAlbums ) ); + break; + case KItemIndexTags: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationTags ) ); + break; + case KItemIndexAll: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAll ) ); + break; + } + + filterMap->InsertL( KContentId, TLiwVariant( KContentDefault ) ); + + //we are only interested in update events + filterMap->InsertL( KOperation, TLiwVariant( KOperationUpdate ) ); + + TLiwGenericParam filter( KFilter, TLiwVariant( filterMap )); + iInParamList->AppendL( filter ); + + iCPSNotificationInterface->ExecuteCmdL( KRequestNotification, + *iInParamList, + *iOutParamList, + KLiwOptASyncronous, + this ); + + CleanupStack::PopAndDestroy( filterMap ); + filter.Reset(); + cptype.Reset(); + + iInParamList->Reset(); + iOutParamList->Reset(); + } + +// --------------------------------------------------------------------------- +// SetupPublisherL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::SetupPublisherL(TInt aSuiteItem) + { + TRACER( "CGlxContentHarvesterPluginBase::SetupPublisherL" ); + + //add mandatory type param + TLiwGenericParam cptype( KType, TLiwVariant( KPublisherId )); + iInParamList->AppendL( cptype ); + + //create publisher definition + CLiwDefaultMap* filterMap = CLiwDefaultMap::NewLC(); + filterMap->InsertL( KPublisherId, TLiwVariant( KSuitePublisher )); + switch (aSuiteItem) + { + case KItemIndexMonths: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationMonths ) ); + break; + case KItemIndexAlbums: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAlbums ) ); + break; + case KItemIndexTags: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationTags ) ); + break; + case KItemIndexAll: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAll ) ); + break; + } + filterMap->InsertL( KContentId, TLiwVariant( KContentDefault ) ); + // initial value for activation flag + filterMap->InsertL( KFlag, TLiwVariant( TUint(0) ) ); + + + // prepare Access Control List for the publisher + CLiwDefaultMap* cpsAclMap = CLiwDefaultMap::NewLC(); + CLiwDefaultMap* cpsAclWriteMap = CLiwDefaultMap::NewLC(); + CLiwDefaultMap* cpsAclReadMap = CLiwDefaultMap::NewLC(); + + // write policy - allow only MatrixMenu, + // Matrix has 2 UIDs: + // - 0x20012474 is used if it is compiled as a standalone application + // - 0x101F4CD2 is used if it should replace AppShell + // add both for convenience + cpsAclWriteMap->InsertL( KUIDs, TLiwVariant( _L("0x101F4CD2:0x20012474") ) ); + + // read policy - allow only the Content Harvester plug-in, + // this plug-in runs inside Content Harvester server - UID 0x10282E5A + cpsAclReadMap->InsertL( KUIDs, TLiwVariant( _L("0x10282E5A") ) ); + + cpsAclMap->InsertL( KACLWrite, TLiwVariant( cpsAclWriteMap ) ); + cpsAclMap->InsertL( KACLRead, TLiwVariant( cpsAclReadMap ) ); + + filterMap->InsertL( KAccessList, TLiwVariant( cpsAclMap ) ); + + // create a dummy data map, + // mandatory for adding publisher data - can be left empty + CLiwDefaultMap* cpsDummyDataMap = CLiwDefaultMap::NewLC(); + filterMap->InsertL( KDataMap, TLiwVariant( cpsDummyDataMap ) ); + + TLiwGenericParam cpsItemParam( KItem, TLiwVariant( filterMap ) ); + iInParamList->AppendL( cpsItemParam ); + + + iCPSNotificationInterface->ExecuteCmdL( KAdd, + *iInParamList, + *iOutParamList, + 0, + NULL ); + CleanupStack::PopAndDestroy( cpsDummyDataMap ); + CleanupStack::PopAndDestroy( cpsAclReadMap ); + CleanupStack::PopAndDestroy( cpsAclWriteMap ); + CleanupStack::PopAndDestroy( cpsAclMap ); + CleanupStack::PopAndDestroy( filterMap ); + cpsItemParam.Reset(); + // filter.Reset(); + cptype.Reset(); + + iInParamList->Reset(); + iOutParamList->Reset(); + } + +// --------------------------------------------------------------------------- +// HandleStateChangeL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::HandleStateChangeL(TInt aSuiteItem) + { + TRACER( "CGlxContentHarvesterPluginBase::HandleStateChangeL" ); + + TLiwGenericParam cptype( KType, TLiwVariant( KPublisher )); + iInParamList->AppendL( cptype ); + + CLiwDefaultMap* filterMap = CLiwDefaultMap::NewLC(); + filterMap->InsertL( KPublisherId, TLiwVariant( KSuitePublisher )); + switch (aSuiteItem) + { + case KItemIndexMonths: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationMonths ) ); + break; + + case KItemIndexAlbums: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAlbums ) ); + break; + + case KItemIndexTags: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationTags ) ); + break; + + case KItemIndexAll: + filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAll ) ); + break; + } + + TLiwGenericParam filter( KFilter, TLiwVariant( filterMap )); + iInParamList->AppendL( filter ); + + + iCPSNotificationInterface->ExecuteCmdL( KGetList, + *iInParamList, + *iOutParamList, + 0, + NULL ); + + CleanupStack::PopAndDestroy( filterMap ); + + filter.Reset(); + cptype.Reset(); + + TInt posStat( 0 ); + iOutParamList->FindFirst( posStat, KResults ); + if( posStat != KErrNotFound ) + { + // status info present - extract and return + CLiwIterable* results = (*iOutParamList)[posStat].Value().AsIterable(); + TLiwVariant cpdata; + if ( results->NextL( cpdata ) ) + { + const CLiwMap* map = cpdata.AsMap(); + TLiwVariant dataMapVar; + if ( map->FindL( _L8("flag"), dataMapVar ) ) + { + ActivateL(dataMapVar.AsTInt32()); + } + dataMapVar.Reset(); + } + cpdata.Reset(); + } + else + { + // no return value + // this will happen if suite was never activated/deactivated before + // handle gracefuly - ignore and wait for action ;] + } + + iInParamList->Reset(); + iOutParamList->Reset(); + + } + + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginBase::FillInputListWithDataL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::FillInputListWithDataL( + CLiwGenericParamList* aInParamList, + const TDesC& aPublisherId, const TDesC& aContentType, + const TDesC& aContentId, TInt aHandle) + { + TRACER( "CGlxContentHarvesterPluginBase::FillInputListWithDataL" ); + + aInParamList->Reset(); + + TLiwGenericParam cptype( KType, TLiwVariant( KCpData )); + aInParamList->AppendL( cptype ); + + CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC(); + CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); + + if(aHandle) + { + map->InsertL( KFirstIcon, TLiwVariant( (TInt32)aHandle) ); + } + + cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId )); + cpdatamap->InsertL( KContentType, TLiwVariant( aContentType )); + cpdatamap->InsertL( KContentId, TLiwVariant( aContentId )); + cpdatamap->InsertL( KDataMap, TLiwVariant(map) ); + + TLiwGenericParam item( KItem, TLiwVariant( cpdatamap )); + aInParamList->AppendL( item ); + CleanupStack::PopAndDestroy( map ); + CleanupStack::PopAndDestroy( cpdatamap ); + item.Reset(); + cptype.Reset(); + + } + +// --------------------------------------------------------------------------- +// CreateMedialistAndThumbnailContextL +// --------------------------------------------------------------------------- +// +MGlxMediaList* CGlxContentHarvesterPluginBase::CreateMedialistAndThumbnailContextL(const TGlxMediaId& + aPluginId,CGlxThumbnailContext* aThumbnailContext) const + { + TRACER( "CGlxContentHarvesterPluginBase::CreateMedialistAndThumbnailContextL" ); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( aPluginId.Value() ); + + CMPXFilter* filter = NULL; + filter = TGlxFilterFactory::CreatePreviewFilterL(); + CleanupStack::PushL( filter ); + + MGlxMediaList* mediaList = MGlxMediaList::InstanceL( *path, KGlxIdNone , filter); + CleanupStack::PopAndDestroy( filter ); + CleanupStack::PopAndDestroy( path ); + aThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth,iGridIconSize.iHeight); + return mediaList; + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginBase::IsFocused +// --------------------------------------------------------------------------- +// +TBool CGlxContentHarvesterPluginBase::IsFocused() const + { + TRACER( "CGlxContentHarvesterPluginBase::IsFocused" ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginBase::IsFocused,isFocused=%d",iIsFocused); + return iIsFocused; + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginBase::Focused +// --------------------------------------------------------------------------- +// +TBool CGlxContentHarvesterPluginBase::Focused() + { + TRACER( "CGlxContentHarvesterPluginBase::Focused" ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginBase::Focused(%d)", iIsFocused); + return iIsFocused; + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginBase::SetFocus +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::SetFocus(TBool aFocus ) + { + TRACER( "CGlxContentHarvesterPluginBase::SetFocus" ); + iIsFocused=aFocus; + } + +// --------------------------------------------------------------------------- +// ContainerCacheCleanupL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::ContainerCacheCleanupL(MGlxMediaList* aMediaList) + { + TRACER( "CGlxContentHarvesterPluginBase::ContainerCacheCleanupL" ); + + if ( IsMatrixMenuInForegroundL() ) + { + MGlxCache* cacheManager = MGlxCache::InstanceL(); + for(TInt i=0 ; i< aMediaList->Count();i++) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginBase::ForceCleanupMedia(%d)", i); + cacheManager->ForceCleanupMedia(aMediaList->IdSpaceId(i), + aMediaList->Item(i).Id()); + } + cacheManager->Close(); + } + } + +// --------------------------------------------------------------------------- +// IsMatrixMenuInForegroundL +// --------------------------------------------------------------------------- +// +TBool CGlxContentHarvesterPluginBase::IsMatrixMenuInForegroundL() + { + TRACER( "CGlxContentHarvesterPluginBase::IsMatrixMenuInForegroundL" ); + + RWsSession wssession; + User::LeaveIfError(wssession.Connect()); + CleanupClosePushL(wssession); + + TApaTaskList taskList( wssession ); + TApaTask task = taskList.FindApp( TUid::Uid( KMatrixMenuUid ) ); + // get fopreground app + TApaTask taskForeGround = taskList.FindByPos(0); + + if ( task.Exists() && task.ThreadId() == taskForeGround.ThreadId() ) + { + CleanupStack::PopAndDestroy( &wssession ); + return ETrue; + } + CleanupStack::PopAndDestroy( &wssession ); + return EFalse; + } + +// --------------------------------------------------------------------------- +// SetCHPlugin +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginBase::SetCHPlugin(MGlxContentHarvesterPlugin* aCHplugin) + { + iCHplugin = aCHplugin; + } + +// --------------------------------------------------------------------------- +// GetCHPlugin +// --------------------------------------------------------------------------- +// +MGlxContentHarvesterPlugin* CGlxContentHarvesterPluginBase::GetCHPlugin() + { + return iCHplugin; + } + +// EOF diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterplugincaptured.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterplugincaptured.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,600 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage for captured collection + * + */ + +// INCLUDE FILES + +#include +#include + +#include +#include // Glx Icons +#include +#include // for KGlxMediaIdThumbnail +#include +#include +#include +#include +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include + +#include "glxcontentharvesterplugincaptured.h" +#include "glxcontentharvesterplugin.hrh" +#include "glxmapconstants.h" + + +// ============================ MEMBER FUNCTIONS ============================== +LOCAL_C TInt TimerCallbackL( TAny* aPtr ) + { + TRACER( "CGlxContentHarvesterPluginCaptured::TimerCallbackL" ); + static_cast(aPtr)->UpdateDataL(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginCaptured::CGlxContentHarvesterPluginCaptured( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + + { + TRACER( "CGlxContentHarvesterPluginCaptured::CGlxContentHarvesterPluginCaptured" ); + iCPSInterface = aCPSInterface; + SetCHPlugin(aCHplugin); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::ConstructL() + { + TRACER( "CGlxContentHarvesterPluginCaptured::ConstructL" ); + + //Call the base class ConstructL,to create the default thumbnail + CGlxContentHarvesterPluginBase::ConstructL(EMbmGlxiconsQgn_prop_image_notcreated); + + iPeriodic = CPeriodic::NewL( CActive::EPriorityLow ); + iThumbnailContext = CGlxThumbnailContext::NewL(&iThumbnailIterator); + + //Register/Subscribe with matrix menu for the notifications + GetInterfaceForNotificationL(); + SetupPublisherL(KItemIndexCaptured); + RequestCpsNotificationL(KItemIndexCaptured); + HandleStateChangeL(KItemIndexCaptured); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginCaptured* CGlxContentHarvesterPluginCaptured::NewLC( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginCaptured::NewL" ); + CGlxContentHarvesterPluginCaptured* self = new ( ELeave ) CGlxContentHarvesterPluginCaptured( aCPSInterface,aCHplugin ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginCaptured::~CGlxContentHarvesterPluginCaptured() + { + TRACER( "CGlxContentHarvesterPluginCaptured::~CGlxContentHarvesterPluginCaptured" ); + + DestroyMedialist(); + + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + delete iPeriodic; + + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::UpdateDataL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::UpdateDataL() + { + TRACER( "CGlxContentHarvesterPluginCaptured::UpdateDataL" ); + if(iMediaList && iMediaList->Count() && iPreviewItemCount.Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::UpdateDataL(),iProgressIndex=%d",iProgressIndex); + TInt ret = UpdateItem(iPreviewItemCount[iProgressIndex]); + if(ret != KErrNotFound) + { + //Updates the thumbnail in the collection + UpdateDataInCPSL(ret); + } + else + { + UpdateDataInCPSL(GetBitmapHandle()); + } + } + else + { + // Show previous thumbnail until the new thumbnail is + // fecthed.Added this check to avoid flicker + if(iMediaList->Count() == 0) + { + //Don't Show the Thumbnail/Show nothing + GLX_LOG_INFO("CGlxContentHarvesterPluginCaptured::UpdateDataL() --O"); + UpdateDataInCPSL(GetBitmapHandle()); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleNotifyL() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginCaptured::HandleNotifyL( + TInt /* aCmdId*/, + TInt/* aEventId */, + CLiwGenericParamList& /*aEventParamList*/, + const CLiwGenericParamList& /*aInParamList*/ ) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleNotifyL" ); + + HandleStateChangeL(KItemIndexCaptured); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleItemChanged() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleItemChanged() + { + TRACER("CGlxContentHarvesterPluginCaptured::HandleItemChanged"); + + iProgressIndex = 0; + iPreviewItemCount.Reset(); + + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + if(iMediaList) + { + TInt count = iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured:: HandleItemChanged ,count=%d",count); + + TBool inFocus = IsFocused(); + for(TInt aItemIndex = 0; aItemIndex < count ; aItemIndex++) + { + const TGlxMedia& item = iMediaList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + iPreviewItemCount.InsertInOrder(aItemIndex); + if(!inFocus) + { + //if the collection is NOT in Focus,retrive only one thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::HandleItemChanged,iRange=1,aItemIndex=%d",aItemIndex); + break; + } + else if(iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == count ) + { + //if the collection is not in Focus,retrive 15 thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::HandleItemChanged,iRange=15,aItemIndex=%d",aItemIndex); + break; + } + + } + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::UpdateDataInCPSL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::UpdateDataInCPSL(TInt aHandle) + { + TRACER( "CGlxContentHarvesterPluginCaptured::UpdateDataInCPSL" ); + //update data in CPS + _LIT(KExamplePluginPub,"photossuite"); + _LIT(KContTypeText,"captured"); + _LIT(KContId1,"category1"); + + if(iCPSInterface && iMediaList ) + { + CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC(); + CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC(); + + FillInputListWithDataL(inParamList, KExamplePluginPub, KContTypeText , + KContId1, aHandle); + + iCPSInterface->ExecuteCmdL( KAdd, *inParamList, *outParamList ); + CleanupStack::PopAndDestroy(outParamList); + CleanupStack::PopAndDestroy(inParamList); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::UpdateItem() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginCaptured::UpdateItem(TInt aItemIndex) + { + TRACER( "CGlxContentHarvesterPluginCaptured::UpdateItem" ); + const TGlxMedia& item = iMediaList->Item(aItemIndex); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::UpdateItem,aItemIndex=%d ",aItemIndex); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::UpdateItem,iProgressIndex=%d ",iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iPreviewItemCount.Count() || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + return value->iBitmap->Handle(); + } + return KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::ActivateL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::ActivateL( TBool aOn ) + { + TRACER( "CGlxContentHarvesterPluginCaptured::ActivateL" ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::ActivateL aOn =%d",aOn); + SetFocus(aOn); + + if (IsMatrixMenuInForegroundL() && aOn && !iPeriodic->IsActive() ) + { + + if(GetCHPlugin()->IsRefreshNeeded()) + { + //Update the rest of all the collections on receving the focus... + GetCHPlugin()->UpdatePlugins(aOn); + } + else + { + //As the collection is not updated by the contentharvester plugin + //to update the thumbnails on the focus , need to call the below function + UpdatePreviewThumbnailListL(); + } + + iPeriodic->Start( KTimerInterval, + KTimerInterval, + TCallBack( TimerCallbackL, this ) ); + } + else if ( !aOn ) + { + if(!IsMatrixMenuInForegroundL()) + { + //use case:Matrix Menu is exited, by entering into grid view,application view,capture mode... + //Need to destroy all the collection's observers and context + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::ActivateL !aOn =%d and matrix not in foreground",aOn); + GetCHPlugin()->UpdatePlugins(aOn); + } + iPeriodic->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleItemAddedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleMediaL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /* aEndIndex */, MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleItemRemovedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleItemModifiedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleAttributesAvailableL" ); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::HandleAttributesAvailableL =%d ",aItemIndex); + if (KErrNotFound != aAttributes.Find( thumbnailAttribute, match )) + { + const TGlxMedia& item = aList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginCaptured::HandleAttributesAvailableL Thumbnail is present "); + iPreviewItemCount.InsertInOrder(aItemIndex); + + //if the collection on the matrix menu is not focused,then show only one thumbnail + if(!IsFocused()) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginCaptured::HandleAttributesAvailableL,one thumbnail fetched"); + UpdateDataInCPSL( value->iBitmap->Handle()); + //if one thumbnail is fetched,it is sufficent when the collection is not in focus. + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + else if (iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == aList->Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::HandleAttributesAvailableL,media list count=%d",aList->Count()); + //if the PreviewItemCount equals 15 or if it is eqaul to the total count + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + }//end of check against value + }//end of attribute match + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleFocusChangedL" ); + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleItemSelectedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPluginCaptured::HandleMessageL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::DestroyMedialist +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::DestroyMedialist() + { + TRACER( "CGlxContentHarvesterPluginCaptured::DestroyMedialist" ); + if( iMediaList ) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginCaptured::DestroyMedialist,media list deleted"); + RemoveContextAndObserver(); + delete iThumbnailContext; + iThumbnailContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::CreateMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::CreateMedialistL( ) + { + TRACER( "CGlxContentHarvesterPluginCaptured::CreateMedialistL" ); + if(!iMediaList) + { + //if the collection is in focus then , create media list with context of 15 items else + // with context of single item. + if(IsFocused()) + { + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + } + else + { + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + } + + iMediaList = CreateMedialistAndThumbnailContextL( TGlxMediaId( + KGlxCollectionPluginCameraImplementationUid ),iThumbnailContext); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::UpdatePreviewThumbnailListL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::UpdatePreviewThumbnailListL( ) + { + TRACER( "CGlxContentHarvesterPluginCaptured::UpdatePreviewThumbnailListL" ); + + //when there is an update of content in the collection + //this function is executed or when the collection recives the focus. + if(!iMediaList) + { + //medis list is not created yet,create it. + CreateMedialistL( ); + //This is called to show the preview thumbnails. If no thumbnails are + //present, display nothing + UpdateDataL(); + } + else if(IsFocused()) + { + //1.This loop is executed,when the collection gets focus + //2.This loop is executed,when the contents are updated for this collection + //and this collection has focus,so 15 thumbnails are fetched. + HandleItemChanged(); + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + else + { + //1.This loop is executed,when the contents are updated for this collection + //and this collection doesn't have the focus,so only one thumbnail is fetched. + + //here we need to fetch only one item + //1.if the content is deleted,then creating a context doesn't fetch the attributes + //2.if the content is added and the content is not the latest as per the sorted order of the + // media list,then the thumbnails are not fetched. + // so show the first available thumbnail in the media list. + + HandleItemChanged(); + UpdateDataL(); + + //Adding the context doesn't gaurantee we get a call back for + //Handle attributes available,if the latest item is already fetched. + //and for the content added for this collection,if it is not latest + //we will not recieve the attributes .so show the first available thumbnail + //in the media list.if there is any new latest content added,the thumbnail will be + //fetched and shown. + + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::AddContextAndObserverL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::AddContextAndObserverL() + { + TRACER( "CGlxContentHarvesterPluginCaptured::AddContextAndObserverL" ); + if(iMediaList) + { + iMediaList->AddMediaListObserverL( this ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::RemoveContextAndObserver +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::RemoveContextAndObserver() + { + TRACER( "CGlxContentHarvesterPluginCaptured::RemoveContextAndObserver" ); + if(iMediaList) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::HandleError +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginCaptured::HandleError(TInt /*aError*/) + { + TRACER( "CGlxContentHarvesterPluginCaptured::HandleError" ); + +#ifdef _DEBUG + if(iMediaList) + { + TInt count=iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::HandleError,count=%d",count); + for ( TInt i = 0; i < count ; i++ ) + { + const TGlxMedia& item = iMediaList->Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginCaptured::HandleError,Error=%d ",thumbnailError); + + } + } +#endif + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginCaptured::Count +// --------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginCaptured::Count() + { + TRACER( "CGlxContentHarvesterPluginCaptured::Count" ); + TInt count = KErrNone; + if(iMediaList) + { + count = iMediaList->Count(); + GLX_LOG_INFO1("GlxCHP:Captured::Count(%d)",count); + } + return count; + } +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterplugindownloads.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterplugindownloads.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,602 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage for downloads collection + * + */ + +// INCLUDE FILES + +#include +#include + +#include +#include // Glx Icons +#include +#include // for KGlxMediaIdThumbnail +#include +#include +#include +#include // For Log +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include + +#include "glxcontentharvesterplugindownloads.h" +#include "glxcontentharvesterplugin.hrh" +#include "glxmapconstants.h" + + + + +// ============================ MEMBER FUNCTIONS ============================== +LOCAL_C TInt TimerCallbackL( TAny* aPtr ) + { + TRACER( "CGlxContentHarvesterPluginDownloads::TimerCallbackL" ); + static_cast(aPtr)->UpdateDataL(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginDownloads::CGlxContentHarvesterPluginDownloads( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + + { + TRACER( "CGlxContentHarvesterPluginDownloads::CGlxContentHarvesterPluginDownloads" ); + iCPSInterface = aCPSInterface; + SetCHPlugin(aCHplugin); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::ConstructL() + { + TRACER( "CGlxContentHarvesterPluginDownloads::ConstructL" ); + + //Call the base class ConstructL,to create the default thumbnail + CGlxContentHarvesterPluginBase::ConstructL(EMbmGlxiconsQgn_prop_image_notcreated); + + iPeriodic = CPeriodic::NewL( CActive::EPriorityLow ); + iThumbnailContext = CGlxThumbnailContext::NewL(&iThumbnailIterator); + + //Register/Subscribe with matrix menu for the notifications + GetInterfaceForNotificationL(); + SetupPublisherL(KItemIndexDownloads); + RequestCpsNotificationL(KItemIndexDownloads); + HandleStateChangeL(KItemIndexDownloads); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginDownloads* CGlxContentHarvesterPluginDownloads::NewLC( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginDownloads::NewL" ); + CGlxContentHarvesterPluginDownloads* self = new ( ELeave ) CGlxContentHarvesterPluginDownloads( aCPSInterface,aCHplugin ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginDownloads::~CGlxContentHarvesterPluginDownloads() + { + TRACER( "CGlxContentHarvesterPluginDownloads::~CGlxContentHarvesterPluginDownloads" ); + + DestroyMedialist(); + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + delete iPeriodic; + + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::UpdateDataL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::UpdateDataL() + { + TRACER( "CGlxContentHarvesterPluginDownloads::UpdateDataL" ); + if(iMediaList && iMediaList->Count() && iPreviewItemCount.Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::UpdateDataL(),iProgressIndex=%d",iProgressIndex); + TInt ret = UpdateItem(iPreviewItemCount[iProgressIndex]); + if(ret != KErrNotFound) + { + //Updates the thumbnail in the collection + UpdateDataInCPSL(ret); + } + else + { + UpdateDataInCPSL(GetBitmapHandle()); + } + } + else + { + // Show previous thumbnail until the new thumbnail is + // fecthed.Added this check to avoid flicker + if(iMediaList->Count() == 0) + { + //Don't Show the Thumbnail/Show nothing + GLX_LOG_INFO("CGlxContentHarvesterPluginDownloads::UpdateDataL() --O"); + UpdateDataInCPSL(GetBitmapHandle()); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleNotifyL() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginDownloads::HandleNotifyL( + TInt /* aCmdId*/, + TInt/* aEventId */, + CLiwGenericParamList& /*aEventParamList*/, + const CLiwGenericParamList& /*aInParamList*/ ) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleNotifyL" ); + HandleStateChangeL(KItemIndexDownloads); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleItemChanged() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleItemChanged() + { + TRACER("CGlxContentHarvesterPluginDownloads::HandleItemChanged"); + + iProgressIndex = 0; + iPreviewItemCount.Reset(); + + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + if(iMediaList) + { + + TInt count = iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads:: HandleItemChanged ,count=%d",count); + + TBool inFocus = IsFocused(); + for(TInt aItemIndex = 0; aItemIndex < count; aItemIndex++) + { + const TGlxMedia& item = iMediaList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + iPreviewItemCount.InsertInOrder(aItemIndex); + if(!inFocus) + { + //if the collection is not in Focus,retrive only one thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::HandleItemChanged,Range=1,aItemIndex=%d",aItemIndex); + break; + } + else if(iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == count ) + { + //if the collection is not in Focus,retrive 15 thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::HandleItemChanged,Range=15,aItemIndex=%d",aItemIndex); + break; + } + + } + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::UpdateDataInCPSL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::UpdateDataInCPSL(TInt aHandle) + { + TRACER( "CGlxContentHarvesterPluginDownloads::UpdateDataInCPSL" ); + //update data in CPS + _LIT(KExamplePluginPub,"photossuite"); + _LIT(KContentActivation,"downloads"); + _LIT(KContId1,"category1"); + + if(iCPSInterface && iMediaList ) + { + CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC(); + CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC(); + + FillInputListWithDataL(inParamList, KExamplePluginPub, KContentActivation , + KContId1, aHandle); + + iCPSInterface->ExecuteCmdL( KAdd, *inParamList, *outParamList ); + CleanupStack::PopAndDestroy(outParamList); + CleanupStack::PopAndDestroy(inParamList); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::UpdateItem() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginDownloads::UpdateItem(TInt aItemIndex) + { + TRACER( "CGlxContentHarvesterPluginDownloads::UpdateItem" ); + const TGlxMedia& item = iMediaList->Item(aItemIndex); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::UpdateItem,aItemIndex=%d ",aItemIndex); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::UpdateItem,iProgressIndex=%d ",iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iPreviewItemCount.Count() || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + return value->iBitmap->Handle(); + } + return KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::ActivateL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::ActivateL( TBool aOn ) + { + TRACER( "CGlxContentHarvesterPluginDownloads::ActivateL" ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::ActivateL aOn =%d",aOn); + SetFocus(aOn); + + if (IsMatrixMenuInForegroundL() && aOn && !iPeriodic->IsActive() ) + { + + if(GetCHPlugin()->IsRefreshNeeded()) + { + //Update the rest of all the collections on receving the focus... + GetCHPlugin()->UpdatePlugins(aOn); + } + else + { + //As the collection is not updated by the contentharvester plugin + //to update the thumbnails on the focus , need to call the below function + UpdatePreviewThumbnailListL(); + } + + iPeriodic->Start( KTimerInterval, + KTimerInterval, + TCallBack( TimerCallbackL, this ) ); + } + else if ( !aOn ) + { + if(!IsMatrixMenuInForegroundL()) + { + //use case:Matrix Menu is exited, by entering into grid view,application view,capture mode... + //Need to destroy all the collection's observers and context + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::ActivateL !aOn =%d and matrix not in foreground",aOn); + GetCHPlugin()->UpdatePlugins(aOn); + } + iPeriodic->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleItemAddedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleMediaL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /* aEndIndex */, MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleItemRemovedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleItemModifiedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleAttributesAvailableL" ); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::HandleAttributesAvailableL =%d ",aItemIndex); + if (KErrNotFound != aAttributes.Find( thumbnailAttribute, match )) + { + const TGlxMedia& item = aList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginDownloads::HandleAttributesAvailableL Thumbnail is present "); + iPreviewItemCount.InsertInOrder(aItemIndex); + + //if the collection on the matrix menu is not focused,then show only one thumbnail + if(!IsFocused()) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginDownloads::HandleAttributesAvailableL,one thumbnail fetched"); + UpdateDataInCPSL( value->iBitmap->Handle()); + //if one thumbnail is fetched,it is sufficent when the collection is not in focus. + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + else if (iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == aList->Count() ) + { + //if the PreviewItemCount equals 15 or if it is eqaul to the total count + //remove the observer as client need not listen to the callbacks + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::HandleAttributesAvailableL,media list count=%d",aList->Count()); + iMediaList->RemoveMediaListObserver( this ); + } + }//end of check against value + }//end of attribute match + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleFocusChangedL" ); + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleItemSelectedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPluginDownloads::HandleMessageL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::DestroyMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::DestroyMedialist() + { + TRACER( "CGlxContentHarvesterPluginDownloads::DestroyMedialist" ); + if( iMediaList ) + { + RemoveContextAndObserver(); + delete iThumbnailContext; + iThumbnailContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::CreateMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::CreateMedialistL( ) + { + TRACER( "CGlxContentHarvesterPluginDownloads::CreateMedialistL" ); + if(!iMediaList) + { + //if the collection is in focus then , create media list with context of 15 items else + // with context of single item. + if(IsFocused()) + { + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + } + else + { + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + } + + iMediaList = CreateMedialistAndThumbnailContextL( TGlxMediaId( + KGlxCollectionPluginDownloadsImplementationUid ),iThumbnailContext); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::UpdatePreviewThumbnailListL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::UpdatePreviewThumbnailListL( ) + { + TRACER( "CGlxContentHarvesterPluginDownloads::UpdatePreviewThumbnailListL" ); + + //when there is an update of content in the collection + //this function is executed or when the collection recives the focus. + if(!iMediaList) + { + //medis list is not created yet,create it. + CreateMedialistL( ); + //This is called to show the preview thumbnails. If no thumbnails are + //present, display nothing + UpdateDataL(); + } + else if(IsFocused()) + { + //1.This loop is executed,when the collection gets focus + //2.This loop is executed,when the contents are updated for this collection + //and this collection has focus,so 15 thumbnails are fetched. + HandleItemChanged(); + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + else + { + //1.This loop is executed,when the contents are updated for this collection + //and this collection doesn't have the focus,so only one thumbnail is fetched. + + //here we need to fetch only one item + //1.if the content is deleted,then creating a context doesn't fetch the attributes + //2.if the content is added and the content is not the latest as per the sorted order of the + // media list,then the thumbnails are not fetched. + // so show the first available thumbnail in the media list. + + HandleItemChanged(); + UpdateDataL(); + + //Adding the context doesn't gaurantee we get a call back for + //Handle attributes available,if the latest item is already fetched. + //and for the content added for this collection,if it is not latest + //we will not recieve the attributes .so show the first available thumbnail + //in the media list.if there is any new latest content added,the thumbnail will be + //fetched and shown. + + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::AddContextAndObserverL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::AddContextAndObserverL() + { + TRACER( "CGlxContentHarvesterPluginDownloads::AddRemoveContextAndObserverL" ); + if(iMediaList) + { + iMediaList->AddMediaListObserverL( this ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::RemoveContextAndObserver +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::RemoveContextAndObserver() + { + TRACER( "CGlxContentHarvesterPluginDownloads::RemoveContextAndObserver" ); + if(iMediaList) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + } + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::HandleError +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginDownloads::HandleError(TInt /*aError*/) + { + TRACER( "CGlxContentHarvesterPluginDownloads::HandleError" ); + +#ifdef _DEBUG + if(iMediaList) + { + TInt count=iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::HandleError,count=%d",count); + for ( TInt i = 0; i < count ; i++ ) + { + const TGlxMedia& item = iMediaList->Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginDownloads::HandleError,Error=%d ",thumbnailError); + + } + } +#endif + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginDownloads::Count +// --------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginDownloads::Count() + { + TRACER( "CGlxContentHarvesterPluginDownloads::Count" ); + TInt count = KErrNone; + if(iMediaList) + { + count = iMediaList->Count(); + GLX_LOG_INFO1("GlxCHP:Downloads::Count(%d)",count); + } + return count; + } +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginmonths.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginmonths.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,605 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage for months collection + * + */ + +// INCLUDE FILES + +#include +#include + +#include +#include // Glx Icons +#include +#include // for KGlxMediaIdThumbnail +#include +#include + +#include +#include +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include + +#include "glxcontentharvesterpluginmonths.h" +#include "glxcontentharvesterplugin.hrh" +#include "glxmapconstants.h" + +// ============================ MEMBER FUNCTIONS ============================== +LOCAL_C TInt TimerCallbackL( TAny* aPtr ) + { + TRACER( "CGlxContentHarvesterPluginMonths::TimerCallbackL" ); + static_cast(aPtr)->UpdateDataL(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginMonths::CGlxContentHarvesterPluginMonths( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + + { + TRACER( "CGlxContentHarvesterPluginMonths::CGlxContentHarvesterPluginMonths" ); + iCPSInterface = aCPSInterface; + SetCHPlugin(aCHplugin); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::ConstructL() + { + TRACER( "CGlxContentHarvesterPluginMonths::ConstructL" ); + + //Call the base class ConstructL to create default bitmap + CGlxContentHarvesterPluginBase::ConstructL(EMbmGlxiconsQgn_prop_image_notcreated); + + iPeriodic = CPeriodic::NewL( CActive::EPriorityLow ); + iThumbnailContext = CGlxThumbnailContext::NewL(&iThumbnailIterator); + + //Register/Subscribe with matrix menu for the notifications + GetInterfaceForNotificationL(); + SetupPublisherL(KItemIndexMonths); + RequestCpsNotificationL(KItemIndexMonths); + HandleStateChangeL(KItemIndexMonths); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginMonths* CGlxContentHarvesterPluginMonths::NewLC( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin *aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginMonths::NewL" ); + CGlxContentHarvesterPluginMonths* self = new ( ELeave ) CGlxContentHarvesterPluginMonths( aCPSInterface,aCHplugin ); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginMonths::~CGlxContentHarvesterPluginMonths() + { + TRACER( "CGlxContentHarvesterPluginMonths::~CGlxContentHarvesterPluginMonths" ); + DestroyMedialist(); + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + delete iPeriodic; + + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::UpdateDataL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::UpdateDataL() + { + TRACER( "CGlxContentHarvesterPluginMonths::UpdateDataL" ); + if(iMediaList && iMediaList->Count() && iPreviewItemCount.Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::UpdateDataL(),iProgressIndex=%d",iProgressIndex); + TInt ret = UpdateItem(iPreviewItemCount[iProgressIndex]); + if(ret != KErrNotFound) + { + //Updates the thumbnail in the collection + UpdateDataInCPSL(ret); + } + else + { + UpdateDataInCPSL(GetBitmapHandle()); + } + } + else + { + // Show previous thumbnail until the new thumbnail is + // fecthed.Added this check to avoid flicker + if(!GetCHPlugin()->IsRefreshNeeded() || (iMediaList->Count() == 0)) + { + //Don't Show the Thumbnail/Show nothing + GLX_LOG_INFO("CGlxContentHarvesterPluginMonths::UpdateDataL() --O"); + UpdateDataInCPSL(GetBitmapHandle()); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleNotifyL() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginMonths::HandleNotifyL( + TInt /* aCmdId*/, + TInt/* aEventId */, + CLiwGenericParamList& /*aEventParamList*/, + const CLiwGenericParamList& /*aInParamList*/ ) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleNotifyL" ); + HandleStateChangeL(KItemIndexMonths); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleItemChanged() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleItemChanged() + { + TRACER("CGlxContentHarvesterPluginMonths::HandleItemChanged"); + + iProgressIndex = 0; + iPreviewItemCount.Reset(); + + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + if(iMediaList) + { + TInt count = iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths:: HandleItemChanged ,count=%d",count); + + TBool inFocus = IsFocused(); + for(TInt aItemIndex = 0; aItemIndex < count; aItemIndex++) + { + const TGlxMedia& item = iMediaList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + iPreviewItemCount.InsertInOrder(aItemIndex); + if(!inFocus) + { + //if the collection is NOT in Focus,retrieve only one thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::HandleItemChanged,Range=1,aItemIndex=%d",aItemIndex); + break; + } + else if(iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == count ) + { + //if the collection is not in Focus,retrieve 15 thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::HandleItemChanged,Range=15,aItemIndex=%d",aItemIndex); + break; + } + + } + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::UpdateDataInCPSL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::UpdateDataInCPSL(TInt aHandle) + { + TRACER( "CGlxContentHarvesterPluginMonths::UpdateDataInCPSL" ); + //update data in CPS + _LIT(KExamplePluginPub,"photossuite"); + _LIT(KContTypeText,"months"); + _LIT(KContId1,"category1"); + + if(iCPSInterface && iMediaList ) + { + CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC(); + CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC(); + + FillInputListWithDataL(inParamList, KExamplePluginPub, KContTypeText , + KContId1, aHandle); + + iCPSInterface->ExecuteCmdL( KAdd, *inParamList, *outParamList ); + CleanupStack::PopAndDestroy(outParamList); + CleanupStack::PopAndDestroy(inParamList); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::UpdateItem() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginMonths::UpdateItem(TInt aItemIndex) + { + TRACER( "CGlxContentHarvesterPluginMonths::UpdateItem" ); + const TGlxMedia& item = iMediaList->Item(aItemIndex); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::UpdateItem,aItemIndex=%d ",aItemIndex); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::UpdateItem,iProgressIndex=%d ",iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iPreviewItemCount.Count() || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + return value->iBitmap->Handle(); + } + return KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::ActivateL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::ActivateL( TBool aOn ) + { + TRACER( "CGlxContentHarvesterPluginMonths::ActivateL" ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::ActivateL aOn =%d",aOn); + SetFocus(aOn); + + if (IsMatrixMenuInForegroundL() && aOn && !iPeriodic->IsActive() ) + { + if(GetCHPlugin()->IsRefreshNeeded()) + { + //Update the rest of all the collections on receving the focus... + GetCHPlugin()->UpdatePlugins(aOn); + } + else + { + //As the collection is not updated by the contentharvester plugin + //to update the thumbnails on the focus , need to call the below function + UpdatePreviewThumbnailListL(); + } + + iPeriodic->Start( KTimerInterval, + KTimerInterval, + TCallBack( TimerCallbackL, this ) ); + } + else if ( !aOn ) + { + if(!IsMatrixMenuInForegroundL()) + { + //use case:Matrix Menu is exited, by entering into grid view,application view,capture mode... + //Need to destroy all the collection's observers and context + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::ActivateL !aOn =%d and matrix not in foreground",aOn); + GetCHPlugin()->UpdatePlugins(aOn); + } + iPeriodic->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleItemAddedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleMediaL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /* aEndIndex */, MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleItemRemovedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleItemModifiedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleAttributesAvailableL" ); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::HandleAttributesAvailableL =%d ",aItemIndex); + if (KErrNotFound != aAttributes.Find( thumbnailAttribute, match )) + { + const TGlxMedia& item = aList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginMonths::HandleAttributesAvailableL Thumbnail is present "); + iPreviewItemCount.InsertInOrder(aItemIndex); + + //if the collection on the matrix menu is not focused,then show only one thumbnail + if(!IsFocused()) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginMonths::HandleAttributesAvailableL,one thumbnail fetched"); + UpdateDataInCPSL( value->iBitmap->Handle()); + //if one thumbnail is fetched,it is sufficent when the collection is not in focus. + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + else if (iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == aList->Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::HandleAttributesAvailableL,media list count=%d",aList->Count()); + //if the PreviewItemCount equals 15 or if it is eqaul to the total count + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + }//end of check against value + }//end of attribute match + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleFocusChangedL" ); + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleItemSelectedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPluginMonths::HandleMessageL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::DestroyMedialist +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::DestroyMedialist() + { + TRACER( "CGlxContentHarvesterPluginMonths::DestroyMedialist" ); + if( iMediaList ) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginMonths::DestroyMedialist,media list deleted"); + RemoveContextAndObserver(); + delete iThumbnailContext; + iThumbnailContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::CreateMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::CreateMedialistL( ) + { + TRACER( "CGlxContentHarvesterPluginMonths::CreateMedialistL" ); + if(!iMediaList) + { + //if the collection is in focus then , create media list with context of 15 items else + // with context of single item. + if(IsFocused()) + { + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + } + else + { + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + } + + iMediaList = CreateMedialistAndThumbnailContextL( TGlxMediaId( + KGlxCollectionPluginMonthsImplementationUid ),iThumbnailContext); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::UpdatePreviewThumbnailListL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::UpdatePreviewThumbnailListL( ) + { + TRACER( "CGlxContentHarvesterPluginMonths::UpdatePreviewThumbnailListL" ); + + //when there is an update of content in the collection + //this function is executed or when the collection recives the focus. + if(!iMediaList) + { + //medis list is not created yet,create it. + CreateMedialistL( ); + //This is called to show the preview thumbnails. If no thumbnails are + //present, display nothing + UpdateDataL(); + } + else + { + if(GetCHPlugin()->IsRefreshNeeded()) + { + ContainerCacheCleanupL(iMediaList); + } + if(IsFocused()) + { + //1.This loop is executed,when the collection gets focus + //2.This loop is executed,when the contents are updated for this collection + //and this collection has focus,so 15 thumbnails are fetched. + HandleItemChanged(); + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + else + { + //1.This loop is executed,when the contents are updated for this collection + //and this collection doesn't have the focus,so only one thumbnail is fetched. + + //here we need to fetch only one item + //1.if the content is deleted,then creating a context doesn't fetch the attributes + //2.if the content is added and the content is not the latest as per the sorted order of the + // media list,then the thumbnails are not fetched. + // so show the first available thumbnail in the media list. + + HandleItemChanged(); + UpdateDataL(); + + //Adding the context doesn't gaurantee we get a call back for + //Handle attributes available,if the latest item is already fetched. + //and for the content added for this collection,if it is not latest + //we will not recieve the attributes .so show the first available thumbnail + //in the media list.if there is any new latest content added,the thumbnail will be + //fetched and shown. + + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + } + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::AddContextAndObserverL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::AddContextAndObserverL() + { + TRACER( "CGlxContentHarvesterPluginMonths::AddRemoveContextAndObserverL" ); + if(iMediaList) + { + iMediaList->AddMediaListObserverL( this ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginAlbums::RemoveContextAndObserver +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::RemoveContextAndObserver() + { + TRACER( "CGlxContentHarvesterPluginMonths::RemoveContextAndObserver" ); + if(iMediaList) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::HandleError +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginMonths::HandleError(TInt /*aError*/) + { + TRACER( "CGlxContentHarvesterPluginMonths::HandleError" ); + +#ifdef _DEBUG + if(iMediaList) + { + TInt count=iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::HandleError,count=%d",count); + for ( TInt i = 0; i < count ; i++ ) + { + const TGlxMedia& item = iMediaList->Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginMonths::HandleError,Error=%d ",thumbnailError); + + } + } +#endif + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginMonths::Count +// --------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginMonths::Count() + { + TRACER( "CGlxContentHarvesterPluginMonths::Count" ); + TInt count = KErrNone; + if(iMediaList) + { + count = iMediaList->Count(); + GLX_LOG_INFO1("GlxCHP:Months::Count(%d)",count); + } + return count; + } +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2008-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: A Proxy file. +* +*/ + + + + +// INCLUDE FILES + +#include + +#include "glxcontentharvesterplugin.h" +#include "glxcontentharvesterplugin.hrh" + + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) + typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) + { { aUid },( TProxyNewLPtr )( aFuncPtr ) } +#endif + +// ---------------------------------------------------------------------------- +// Map the interface UIDs to the implementation +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KGlxCHPluginImplUid, CGlxContentHarvesterPlugin::NewL) + }; + +// ---------------------------------------------------------------------------- +// ImplementationGroupProxy +// Exported proxy for instantiation method resolution +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* +ImplementationGroupProxy(TInt& aTableCount) + { + + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/contentharvesterplugin/src/glxcontentharvesterplugintags.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/contentharvesterplugin/src/glxcontentharvesterplugintags.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,605 @@ +/* + * Copyright (c) 2008-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: Updates CPS storage for all collection + * + */ + +// INCLUDE FILES + +#include +#include + +#include +#include // Glx Icons +#include +#include // for KGlxMediaIdThumbnail +#include +#include +#include +#include +#include // for MGlxMediaList +#include +#include // for KGlxGalleryApplicationUid +#include +#include + +#include "glxcontentharvesterplugintags.h" +#include "glxcontentharvesterplugin.hrh" +#include "glxmapconstants.h" + +// ============================ MEMBER FUNCTIONS ============================== +LOCAL_C TInt TimerCallbackL( TAny* aPtr ) + { + TRACER( "CGlxContentHarvesterPluginTags::TimerCallbackL" ); + static_cast(aPtr)->UpdateDataL(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginTags::CGlxContentHarvesterPluginTags( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ) + + { + TRACER( "CGlxContentHarvesterPluginTags::CGlxContentHarvesterPluginTags" ); + iCPSInterface = aCPSInterface; + SetCHPlugin(aCHplugin); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::ConstructL() + { + TRACER( "CGlxContentHarvesterPluginTags::ConstructL" ); + + //Call the base class ConstructL to create default bitmap + CGlxContentHarvesterPluginBase::ConstructL(EMbmGlxiconsQgn_prop_image_notcreated); + + iPeriodic = CPeriodic::NewL( CActive::EPriorityLow ); + iThumbnailContext = CGlxThumbnailContext::NewL(&iThumbnailIterator); + + //Register/Subscribe with matrix menu for the notifications + GetInterfaceForNotificationL(); + SetupPublisherL(KItemIndexTags); + RequestCpsNotificationL(KItemIndexTags); + HandleStateChangeL(KItemIndexTags); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginTags* CGlxContentHarvesterPluginTags::NewLC( + MLiwInterface* aCPSInterface, + MGlxContentHarvesterPlugin* aCHplugin ) + { + TRACER( "CGlxContentHarvesterPluginTags::NewL" ); + CGlxContentHarvesterPluginTags* self = new ( ELeave )CGlxContentHarvesterPluginTags( aCPSInterface,aCHplugin ); + + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContentHarvesterPluginTags::~CGlxContentHarvesterPluginTags() + { + TRACER( "CGlxContentHarvesterPluginTags::~CGlxContentHarvesterPluginTags" ); + + DestroyMedialist(); + if ( iPeriodic ) + { + iPeriodic->Cancel(); + } + delete iPeriodic; + + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::UpdateDataL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::UpdateDataL() + { + TRACER( "CGlxContentHarvesterPluginTags::UpdateDataL" ); + if(iMediaList && iMediaList->Count() && iPreviewItemCount.Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::UpdateDataL(),iProgressIndex=%d",iProgressIndex); + TInt ret = UpdateItem(iPreviewItemCount[iProgressIndex]); + if(ret != KErrNotFound) + { + //Updates the thumbnail in the collection + UpdateDataInCPSL(ret); + } + else + { + UpdateDataInCPSL(GetBitmapHandle()); + } + } + else + { + // Show previous thumbnail until the new thumbnail is + // fecthed.Added this check to avoid flicker + if(!GetCHPlugin()->IsRefreshNeeded() || (iMediaList->Count() == 0)) + { + //Don't Show the Thumbnail/Show nothing + GLX_LOG_INFO("CGlxContentHarvesterPluginTags::UpdateDataL() --O"); + UpdateDataInCPSL(GetBitmapHandle()); + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleNotifyL() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginTags::HandleNotifyL( + TInt /* aCmdId*/, + TInt/* aEventId */, + CLiwGenericParamList& /*aEventParamList*/, + const CLiwGenericParamList& /*aInParamList*/ ) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleNotifyL" ); + HandleStateChangeL(KItemIndexTags); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleItemChanged() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleItemChanged() + { + TRACER("CGlxContentHarvesterPluginTags::HandleItemChanged"); + + iProgressIndex = 0; + iPreviewItemCount.Reset(); + + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + if(iMediaList) + { + TInt count = iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags:: HandleItemChanged ,count=%d",count); + + TBool inFocus = IsFocused(); + for(TInt aItemIndex = 0; aItemIndex < count; aItemIndex++) + { + const TGlxMedia& item = iMediaList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + iPreviewItemCount.InsertInOrder(aItemIndex); + if(!inFocus) + { + //if the collection is in Focus,retrieve only one thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::HandleItemChanged,iRange=1,aItemIndex=%d",aItemIndex); + break; + } + else if(iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == count ) + { + //if the collection is not in Focus,retrieve 15 thumbnail and break + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::HandleItemChanged,iRange=15,aItemIndex=%d",aItemIndex); + break; + } + + } + } + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::UpdateDataInCPSL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::UpdateDataInCPSL(TInt aHandle) + { + TRACER( "CGlxContentHarvesterPluginTags::UpdateDataInCPSL" ); + //update data in CPS + _LIT(KExamplePluginPub,"photossuite"); + _LIT(KContTypeText,"tags"); + _LIT(KContId1,"category1"); + + if(iCPSInterface && iMediaList ) + { + CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC(); + CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC(); + + FillInputListWithDataL(inParamList, KExamplePluginPub, KContTypeText , + KContId1, aHandle); + + iCPSInterface->ExecuteCmdL( KAdd, *inParamList, *outParamList ); + CleanupStack::PopAndDestroy(outParamList); + CleanupStack::PopAndDestroy(inParamList); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::UpdateItem() +// ---------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginTags::UpdateItem(TInt aItemIndex) + { + TRACER( "CGlxContentHarvesterPluginTags::UpdateItem" ); + const TGlxMedia& item = iMediaList->Item(aItemIndex); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::UpdateItem,aItemIndex=%d ",aItemIndex); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::UpdateItem,iProgressIndex=%d ",iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iPreviewItemCount.Count() || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + return value->iBitmap->Handle(); + } + return KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::ActivateL() +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::ActivateL( TBool aOn ) + { + TRACER( "CGlxContentHarvesterPluginTags::ActivateL" ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::ActivateL aOn =%d",aOn); + SetFocus(aOn); + + if (IsMatrixMenuInForegroundL() && aOn && !iPeriodic->IsActive() ) + { + if(GetCHPlugin()->IsRefreshNeeded()) + { + //Update the rest of all the collections on receving the focus... + GetCHPlugin()->UpdatePlugins(aOn); + } + else + { + //As the collection is not updated by the contentharvester plugin + //to update the thumbnails on the focus , need to call the below function + UpdatePreviewThumbnailListL(); + } + + iPeriodic->Start( KTimerInterval, + KTimerInterval, + TCallBack( TimerCallbackL, this ) ); + } + else if ( !aOn ) + { + if(!IsMatrixMenuInForegroundL()) + { + //use case:Matrix Menu is exited, by entering into grid view,application view,capture mode... + //Need to destroy all the collection's observers and context + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::ActivateL !aOn =%d and matrix not in foreground",aOn); + GetCHPlugin()->UpdatePlugins(aOn); + } + iPeriodic->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleItemAddedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleMediaL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /* aEndIndex */, MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleItemRemovedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleItemModifiedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleAttributesAvailableL" ); + TSize gridIconSize = GetGridIconSize(); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, gridIconSize.iWidth, gridIconSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::HandleAttributesAvailableL =%d ",aItemIndex); + if (KErrNotFound != aAttributes.Find( thumbnailAttribute, match )) + { + const TGlxMedia& item = aList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginTags::HandleAttributesAvailableL Thumbnail is present "); + iPreviewItemCount.InsertInOrder(aItemIndex); + + //if the collection on the matrix menu is not focused,then show only one thumbnail + if(!IsFocused()) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginTags::HandleAttributesAvailableL,one thumbnail fetched"); + UpdateDataInCPSL( value->iBitmap->Handle()); + //if one thumbnail is fetched,it is sufficent when the collection is not in focus. + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + else if (iPreviewItemCount.Count() == KPreviewThumbnailFetchCount || + iPreviewItemCount.Count() == aList->Count() ) + { + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::HandleAttributesAvailableL,media list count=%d",aList->Count()); + //if the PreviewItemCount equals 15 or if it is eqaul to the total count + //remove the observer as client need not listen to the callbacks + iMediaList->RemoveMediaListObserver( this ); + } + }//end of check against value + }//end of attribute match + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleFocusChangedL" ); + } + + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleItemSelectedL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + TRACER( "CGlxContentHarvesterPluginTags::HandleMessageL" ); + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::DestroyMedialist +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::DestroyMedialist() + { + TRACER( "CGlxContentHarvesterPluginTags::DestroyMedialist" ); + if( iMediaList ) + { + GLX_LOG_INFO("CGlxContentHarvesterPluginTags::DestroyMedialist,media list deleted"); + RemoveContextAndObserver(); + delete iThumbnailContext; + iThumbnailContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::CreateMedialistL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::CreateMedialistL( ) + { + TRACER( "CGlxContentHarvesterPluginTags::CreateMedialistL" ); + if(!iMediaList) + { + //if the collection is in focus then , create media list with context of 15 items else + // with context of single item. + if(IsFocused()) + { + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + } + else + { + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + } + + iMediaList = CreateMedialistAndThumbnailContextL( TGlxMediaId( + KGlxTagCollectionPluginImplementationUid ),iThumbnailContext); + AddContextAndObserverL(); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::UpdatePreviewThumbnailListL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::UpdatePreviewThumbnailListL( ) + { + TRACER( "CGlxContentHarvesterPluginTags::UpdatePreviewThumbnailListL" ); + + //when there is an update of content in the collection + //this function is executed or when the collection recives the focus. + if(!iMediaList) + { + //medis list is not created yet,create it. + CreateMedialistL( ); + //This is called to show the preview thumbnails. If no thumbnails are + //present, display nothing + UpdateDataL(); + } + else + { + if(GetCHPlugin()->IsRefreshNeeded()) + { + ContainerCacheCleanupL(iMediaList); + } + if(IsFocused()) + { + //1.This loop is executed,when the collection gets focus + //2.This loop is executed,when the contents are updated for this collection + //and this collection has focus,so 15 thumbnails are fetched. + HandleItemChanged(); + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + else + { + //1.This loop is executed,when the contents are updated for this collection + //and this collection doesn't have the focus,so only one thumbnail is fetched. + + //here we need to fetch only one item + //1.if the content is deleted,then creating a context doesn't fetch the attributes + //2.if the content is added and the content is not the latest as per the sorted order of the + // media list,then the thumbnails are not fetched. + // so show the first available thumbnail in the media list. + + HandleItemChanged(); + UpdateDataL(); + + //Adding the context doesn't gaurantee we get a call back for + //Handle attributes available,if the latest item is already fetched. + //and for the content added for this collection,if it is not latest + //we will not recieve the attributes .so show the first available thumbnail + //in the media list.if there is any new latest content added,the thumbnail will be + //fetched and shown. + + iThumbnailIterator.SetRange( KSinglePreviewThumbnail ); + RemoveContextAndObserver(); + AddContextAndObserverL(); + } + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::AddContextAndObserverL +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::AddContextAndObserverL() + { + TRACER( "CGlxContentHarvesterPluginTags::AddRemoveContextAndObserverL" ); + if(iMediaList) + { + iMediaList->AddMediaListObserverL( this ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::RemoveContextAndObserver +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::RemoveContextAndObserver() + { + TRACER( "CGlxContentHarvesterPluginTags::RemoveContextAndObserver" ); + if(iMediaList) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + } + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::HandleError +// --------------------------------------------------------------------------- +// +void CGlxContentHarvesterPluginTags::HandleError(TInt /*aError*/) + { + TRACER( "CGlxContentHarvesterPluginTags::HandleError" ); + +#ifdef _DEBUG + if(iMediaList) + { + TInt count=iMediaList->Count(); + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::HandleError,count=%d",count); + for ( TInt i = 0; i < count ; i++ ) + { + const TGlxMedia& item = iMediaList->Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + GLX_LOG_INFO1("CGlxContentHarvesterPluginTags::HandleError,Error=%d ",thumbnailError); + + } + } +#endif + } + +// --------------------------------------------------------------------------- +// CGlxContentHarvesterPluginTags::Count +// --------------------------------------------------------------------------- +// +TInt CGlxContentHarvesterPluginTags::Count() + { + TRACER( "CGlxContentHarvesterPluginTags::Count" ); + TInt count = KErrNone; + if(iMediaList) + { + count = iMediaList->Count(); + GLX_LOG_INFO1("GlxCHP:Tags::Count(%d)",count); + } + return count; + } +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/bwins/glxcollectionmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/bwins/glxcollectionmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,14 @@ +EXPORTS + ??1CGlxCollectionInfo@@UAE@XZ @ 1 NONAME ; CGlxCollectionInfo::~CGlxCollectionInfo(void) + ??1CGlxCollectionManager@@UAE@XZ @ 2 NONAME ; CGlxCollectionManager::~CGlxCollectionManager(void) + ?AddToCollectionL@CGlxCollectionManager@@QAEXABVTDesC16@@KAAVTRequestStatus@@@Z @ 3 NONAME ; void CGlxCollectionManager::AddToCollectionL(class TDesC16 const &, unsigned long, class TRequestStatus &) + ?AddToCollectionL@CGlxCollectionManager@@QAEXABVTDesC16@@W4TCollection@1@AAVTRequestStatus@@@Z @ 4 NONAME ; void CGlxCollectionManager::AddToCollectionL(class TDesC16 const &, enum CGlxCollectionManager::TCollection, class TRequestStatus &) + ?Cancel@CGlxCollectionManager@@QAEXXZ @ 5 NONAME ; void CGlxCollectionManager::Cancel(void) + ?CollectionInfoL@CGlxCollectionManager@@QAEXAAVCGlxCollectionInfo@@AAVTRequestStatus@@@Z @ 6 NONAME ; void CGlxCollectionManager::CollectionInfoL(class CGlxCollectionInfo &, class TRequestStatus &) + ?Exists@CGlxCollectionInfo@@QBEHXZ @ 7 NONAME ; int CGlxCollectionInfo::Exists(void) const + ?Id@CGlxCollectionInfo@@QBEKXZ @ 8 NONAME ; unsigned long CGlxCollectionInfo::Id(void) const + ?NewL@CGlxCollectionInfo@@SAPAV1@K@Z @ 9 NONAME ; class CGlxCollectionInfo * CGlxCollectionInfo::NewL(unsigned long) + ?NewL@CGlxCollectionManager@@SAPAV1@XZ @ 10 NONAME ; class CGlxCollectionManager * CGlxCollectionManager::NewL(void) + ?ShowPopupL@TGlxCollectionSelectionPopup@@SAHAAV?$RArray@K@@KHH@Z @ 11 NONAME ; int TGlxCollectionSelectionPopup::ShowPopupL(class RArray &, unsigned long, int, int) + ?Title@CGlxCollectionInfo@@QBEABVTDesC16@@XZ @ 12 NONAME ; class TDesC16 const & CGlxCollectionInfo::Title(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/eabi/glxcollectionmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/eabi/glxcollectionmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,18 @@ +EXPORTS + _ZN18CGlxCollectionInfo4NewLEm @ 1 NONAME + _ZN18CGlxCollectionInfoD0Ev @ 2 NONAME + _ZN18CGlxCollectionInfoD1Ev @ 3 NONAME + _ZN18CGlxCollectionInfoD2Ev @ 4 NONAME + _ZN21CGlxCollectionManager15CollectionInfoLER18CGlxCollectionInfoR14TRequestStatus @ 5 NONAME + _ZN21CGlxCollectionManager16AddToCollectionLERK7TDesC16NS_11TCollectionER14TRequestStatus @ 6 NONAME + _ZN21CGlxCollectionManager16AddToCollectionLERK7TDesC16mR14TRequestStatus @ 7 NONAME + _ZN21CGlxCollectionManager4NewLEv @ 8 NONAME + _ZN21CGlxCollectionManager6CancelEv @ 9 NONAME + _ZN21CGlxCollectionManagerD0Ev @ 10 NONAME + _ZN21CGlxCollectionManagerD1Ev @ 11 NONAME + _ZN21CGlxCollectionManagerD2Ev @ 12 NONAME + _ZN28TGlxCollectionSelectionPopup10ShowPopupLER6RArrayImEmii @ 13 NONAME + _ZNK18CGlxCollectionInfo2IdEv @ 14 NONAME + _ZNK18CGlxCollectionInfo5TitleEv @ 15 NONAME + _ZNK18CGlxCollectionInfo6ExistsEv @ 16 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: Build information file. +* +*/ + + + + +#include + + +PRJ_EXPORTS + + +PRJ_EXPORTS + +PRJ_MMPFILES + +glxcollectionmanager.mmp + +//#include "../tsrc/group/bld.inf" + +PRJ_TESTMMPFILES +../../../../photos_plat/controllers_collection_api/tsrc/ut_collectionmanager/group/ut_collectionmanager.mmp +../../../../photos_plat/controllers_collection_api/tsrc/ut_collectioninfo/group/ut_collectioninfo.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/group/glxcollectionmanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/group/glxcollectionmanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2008-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: Project definition file for project Collection manager +* +*/ + + + + +#include +#include + + +#include "../../../inc/glxcapabilities.hrh" +#include "../../../group/glxbuildcommon.mmh" + +TARGET glxcollectionmanager.dll +TARGETTYPE dll +UID 0x1000008d 0x20000A11 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxcollectioninfo.cpp +SOURCE glxcollectionmanager.cpp +SOURCE glxcollectionmanagerimpl.cpp +SOURCE glxcollectionselectionpopup.cpp + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../common/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../viewframework/commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../viewframework/inc +SYSTEMINCLUDE ../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../viewframework/views/viewbase/inc + + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY glxcommon.lib +LIBRARY glxcommoncommandhandlers.lib +LIBRARY glxmedialists.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib + +//EXPORTUNFROZEN diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/inc/glxcollectionmanagerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/inc/glxcollectionmanagerimpl.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of collection manager API for external use +* +*/ + + + + +#ifndef __C_GLXCOLLECTIONMANAGERIMPL_H__ +#define __C_GLXCOLLECTIONMANAGERIMPL_H__ + +#include +#include +#include + +#include "glxcollectionmanager.h" + +class CGlxCollectionInfo; +class MMPXCollectionUtility; +class CMPXCollectionPath; + +/** + * Collection manager internal implementation. + * + * @lib glxuiutilities.lib + */ +NONSHARABLE_CLASS( CGlxCollectionManagerImpl ) + : public CBase, public MMPXCollectionObserver + { +public: + /** + * Constructor + */ + CGlxCollectionManagerImpl(); + + /** + * Destructor + */ + ~CGlxCollectionManagerImpl(); + + /** + * Adds a file to container asynchronously. + * @param aUri URI of file to be added to the container. + * @param aContainer Container to which item should be added. + * @param aRequestStatus Request status that will be signalled when + * request is complete or fails due to an error. aRequestStatus must + * be an iStatus member variable of an active object. Using + * User::WaitForRequest() will not work. + */ + void AddToContainerL(const TDesC& aUri, + CGlxCollectionManager::TCollection aContainer, TRequestStatus& aRequestStatus); + + /** + * Adds a file to container asynchronously. + * @param aUri URI of file to be added to the container. + * @param aConatinerId MDS ID of container (album, tag, etc.) + * @param aRequestStatus Request status that will be signalled when + * request is complete or fails due to an error. aRequestStatus must + * be an iStatus member variable of an active object. Using + * User::WaitForRequest() will not work. + */ + void AddToContainerL(const TDesC& aUri, + TUint32 aContainerId, TRequestStatus& aRequestStatus); + + /** + * Retrieves collection info + * @param aRequestStatus Request status that will be signalled when + * request is complete or fails due asynchronous error + * @param aInfo Contain the collection information upon return + * Must contain the collection info when called + */ + void CollectionInfoL(CGlxCollectionInfo& aInfo, + TRequestStatus& aRequestStatus); + + /** + * Cancel an outstanding request + */ + void Cancel(); + +public: // from MMPXCollectionObserver + /** + * See @ref MMPXCollectionObserver::HandleCollectionMessageL + */ + void HandleCollectionMessageL(const TMPXCollectionMessage& aMessage); + + /** + * See @ref MMPXCollectionObserver::HandleCollectionMessageL + */ + void HandleCollectionMessageL(const CMPXMessage& aMsg); + + /** + * See @ref MMPXCollectionObserver::HandleOpenL + */ + void HandleOpenL(const CMPXMedia& aEntries, + TInt aIndex,TBool aComplete,TInt aError); + /** + * See @ref MMPXCollectionObserver::HandleOpenL + */ + void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist ,TInt aError); + + /** + * See @ref MMPXCollectionObserver::HandleCollectionMediaL + */ + void HandleCollectionMediaL(const CMPXMedia& aMedia, + TInt aError); + + /** + * See @ref MMPXCollectionObserver::HandleCommandComplete + */ + void HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError); + +private: + + /** + * Initialise the request. + * Stores a pointer to aRequestStatus and sets aRequestStatus to KRequestPending. + * @param aRequestStatus request to be signaled when asynchronous + * operation completes. + */ + void InitializeRequest(TRequestStatus& aRequestStatus); + + /** + * Completes the request. + * Calls User::RequestComplete() on the request set by InitializeRequest(). + * @aError error message passed to User::RequestComplete() + */ + void CompleteRequest(TInt aError); + + /** + * Creates and opens an MPX collection utility. + */ + void OpenCollectionL(); + + /** + * Closes the MPX collection utitlity. + */ + void CloseCollection(); + + /** + * Performs the addition of an item to a container. + * Assumes that the collection is open. + */ + void DoAddToContainerL(); + + /** + * Helper method that is called by the two public AddToContainerL overloads + * and in turn calls DoAddToContainer. + * @param aUri URI of file to be added to the container. + * @param aRequestStatus Request status that will be signalled when + * request is complete or fails due to an error. aRequestStatus must + * be an iStatus member variable of an active object. Using + * User::WaitForRequest() will not work. + */ + void AddToContainerL(const TDesC& aUri, TRequestStatus& aRequestStatus); + + /* + * Retrieves collection info + * Assumes that the collection is open. + */ + void DoCollectionInfoL(); + +private: + /** + * Collection utitility (onwed) + */ + MMPXCollectionUtility* iCollectionUtility; + + /** + * Collection UID. + */ + TUid iCollectionId; + + /** + * Container id + */ + TMPXItemId iContainerId; + + /** + * Uri (owned) + */ + HBufC* iUri; + + /** + * Collection info (not owned) + */ + CGlxCollectionInfo* iCollectionInfo; + + /** + * Request status (not owned) + */ + TRequestStatus* iRequestStatus; + + enum TState + { + EClosed, + EOpeningForAdd, + EOpeningForCollectionInfo, + EOpening, + EOpen, + EAdding, + ERequestingMedia + }; + + /** + * In the following states an asynchronous request is outstanding: + * + * EOpeningForAdd, + * EOpeningForCollectionInfo + * EOpening + * EAdding + * ERequestingMedia + * + */ + TState iState; + }; + +#endif // __C_GLXCOLLECTIONMANAGERIMPL_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/src/glxcollectioninfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/src/glxcollectioninfo.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2008-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: Collection info class +* +*/ + + + + +#include "glxcollectioninfo.h" + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCollectionInfo* CGlxCollectionInfo::NewL(TUint32 aCollectionId) + { + CGlxCollectionInfo* self = new (ELeave) CGlxCollectionInfo(aCollectionId); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCollectionInfo::~CGlxCollectionInfo() + { + delete iTitle; + } + +// ----------------------------------------------------------------------------- +// Id +// ----------------------------------------------------------------------------- +// +EXPORT_C TUint32 CGlxCollectionInfo::Id() const + { + return iItemId; + } + +// ----------------------------------------------------------------------------- +// Exists +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxCollectionInfo::Exists() const + { + return iExists; + } + +// ----------------------------------------------------------------------------- +// Title +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CGlxCollectionInfo::Title() const + { + if (iTitle) + { + return *iTitle; + } + else + { + return KNullDesC; + } + } + +// ----------------------------------------------------------------------------- +// SetExists +// ----------------------------------------------------------------------------- +// +void CGlxCollectionInfo::SetExists(TBool aExists) + { + iExists = aExists; + } + +// ----------------------------------------------------------------------------- +// SetTitleL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionInfo::SetTitleL(const TDesC& aTitle) + { + delete iTitle; + iTitle = NULL; + iTitle = aTitle.AllocL(); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCollectionInfo::CGlxCollectionInfo(TInt aCollectionId) + : iItemId(aCollectionId) + { + } + +// ----------------------------------------------------------------------------- +// Second stage constructor +// ----------------------------------------------------------------------------- +// +void CGlxCollectionInfo::ConstructL() + { + } diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/src/glxcollectionmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/src/glxcollectionmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of collection manager API for external use +* +*/ + + + + +#include "glxcollectionmanager.h" +#include "glxcollectionmanagerimpl.h" + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCollectionManager* CGlxCollectionManager::NewL() + { + CGlxCollectionManager* self = new (ELeave) CGlxCollectionManager(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCollectionManager::CGlxCollectionManager() + { + + } +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCollectionManager::~CGlxCollectionManager() + { + delete iImplementation; + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManager::AddToCollectionL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionManager::AddToCollectionL(const TDesC& aUri, + TCollection aCollection, TRequestStatus& aRequestStatus) + { + iImplementation->AddToContainerL(aUri, aCollection, aRequestStatus); + } +// ----------------------------------------------------------------------------- +// CGlxCollectionManager::AddToCollectionL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionManager::AddToCollectionL(const TDesC& aUri, + TUint32 aCollectionId, TRequestStatus& aRequestStatus) + { + iImplementation->AddToContainerL(aUri, aCollectionId, aRequestStatus); + } +// ----------------------------------------------------------------------------- +// CGlxCollectionManager::CollectionInfoL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionManager::CollectionInfoL(CGlxCollectionInfo& aInfo, + TRequestStatus& aRequestStatus) + { + iImplementation->CollectionInfoL(aInfo, aRequestStatus); + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManager::Cancel +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxCollectionManager::Cancel() + { + iImplementation->Cancel(); + } + +// ----------------------------------------------------------------------------- +// Second phase constructor +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManager::ConstructL() + { + iImplementation = new (ELeave) + CGlxCollectionManagerImpl(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/src/glxcollectionmanagerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/src/glxcollectionmanagerimpl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,387 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of collection manager API for external use +* +*/ + + + + +#include "glxcollectionmanagerimpl.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxcollectioninfo.h" + +#include +#include + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCollectionManagerImpl::CGlxCollectionManagerImpl() + { + } +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxCollectionManagerImpl::~CGlxCollectionManagerImpl() + { + CloseCollection(); + delete iUri; + } +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::AddToContainerL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::AddToContainerL(const TDesC& aUri, + CGlxCollectionManager::TCollection aContainer, TRequestStatus& aRequestStatus) + { + __ASSERT_DEBUG(CGlxCollectionManager::ECollectionCameraAlbum == aContainer, Panic(EGlxPanicUnsupportedCollection)); + + iCollectionId.iUid = KGlxCollectionPluginCameraImplementationUid; + iContainerId = 0; // A zero container id indicates to the data source that we wish to the + // 'special album' related to the collection id. e.g. the camera album. + + AddToContainerL(aUri,aRequestStatus); + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::AddToContainerL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::AddToContainerL(const TDesC& aUri, + TUint32 aCollectionId, TRequestStatus& aRequestStatus) + { + iCollectionId.iUid = KGlxCollectionPluginAlbumsImplementationUid; + iContainerId = aCollectionId; + + AddToContainerL(aUri,aRequestStatus); + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::CollectionInfoL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::CollectionInfoL(CGlxCollectionInfo& aInfo, + TRequestStatus& aRequestStatus) + { + __ASSERT_DEBUG(iState == EClosed || iState == EOpen, Panic(EGlxPanicIllegalState)); + + iCollectionInfo = &aInfo; + InitializeRequest(aRequestStatus); + + if (iState == EOpen) + { + CloseCollection(); // Close and re-open the collection to ensure we have the + // latest changes. + } + + iState = EOpeningForCollectionInfo; + OpenCollectionL(); + + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::Cancel +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::Cancel() + { + ///@todo test canceling + + switch (iState) + { + case EClosed: + case EOpen: + case EOpening: + { + // no request outstanding + break; + } + case EOpeningForAdd: + case EOpeningForCollectionInfo: + { + iState = EOpening; // Complete open if we can. + break; + } + case EAdding: + case ERequestingMedia: + { + iState = EOpen; + iCollectionUtility->Collection().CancelRequest(); + } + } + CompleteRequest(KErrCancel); + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::HandleCollectionMessageL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::HandleCollectionMessageL(const TMPXCollectionMessage& /*aMessage*/) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::HandleCollectionMessageL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::HandleCollectionMessageL(const CMPXMessage& aMsg) + { + if (aMsg.IsSupported(KMPXMessageGeneralEvent)) + { + switch (aMsg.ValueTObjectL(KMPXMessageGeneralEvent)) + { + case TMPXCollectionMessage::EPathChanged: + { + __ASSERT_DEBUG(iState == EOpeningForAdd || iState == EOpeningForCollectionInfo || iState == EOpening || iState == EOpen, Panic(EGlxPanicIllegalState)); + + TState oldState = iState; + iState = EOpen; + + switch(oldState) + { + case EOpeningForAdd: + { + iState = EOpen; + DoAddToContainerL(); + break; + } + case EOpeningForCollectionInfo: + { + iState = EOpen; + __ASSERT_DEBUG(iCollectionInfo, Panic(EGlxPanicNullPointer)); + + DoCollectionInfoL(); + break; + } + case EOpening: + { + // don't do anything + break; + } + } + } + break; + default: + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::HandleOpenL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::HandleOpenL(const CMPXMedia& /*aEntries*/, + TInt /*aIndex*/,TBool /*aComplete*/,TInt aError) + { + // Handle open only gets called when an error occurs + ///@todo check that this method works + + __ASSERT_DEBUG(iState == EOpening || iState == EOpeningForAdd || iState == EOpeningForCollectionInfo, Panic(EGlxPanicIllegalState)); + + if (aError != KErrNone) + { + CompleteRequest(aError); + iState = EClosed; + } + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::HandleOpenL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/ ,TInt /*aError*/) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::HandleCollectionMediaL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::HandleCollectionMediaL(const CMPXMedia& aMedia, TInt aError) + { + iState = EOpen; + + if (aError == KErrNone && iCollectionInfo) + { + iCollectionInfo->SetExists(ETrue); + iCollectionInfo->SetTitleL(aMedia.ValueText(KMPXMediaGeneralTitle)); + } + + CompleteRequest(aError); + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::HandleCommandComplete +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::HandleCommandComplete(CMPXCommand* /*aCommandResult*/, TInt aError) + { + CompleteRequest(aError); + iState = EOpen; + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::CompleteRequest +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::CompleteRequest(TInt aError) + { + if (iRequestStatus) + { + User::RequestComplete(iRequestStatus, aError); + iRequestStatus = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::InitializeRequest +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::InitializeRequest(TRequestStatus& aRequestStatus) + { + __ASSERT_DEBUG(!iRequestStatus, Panic(EGlxPanicCollectionManagerOutstandingRequest)); + iRequestStatus = &aRequestStatus; + *iRequestStatus = KRequestPending; + } + +/// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::OpenCollectionL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::OpenCollectionL() + { + if (iCollectionUtility) + { + iCollectionUtility->Close(); // deletes the collection utility's this pointer. + } + iCollectionUtility = NULL; + iCollectionUtility = MMPXCollectionUtility::NewL(this); + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); //Open the albums collection plugin + // We can use this plugin to add things to the camera album. + iCollectionUtility->Collection().OpenL(*path); + CleanupStack::PopAndDestroy(path); + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::CloseCollection +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::CloseCollection() + { + if (iCollectionUtility) + { + iCollectionUtility->Close(); + iCollectionUtility = NULL; + } + iState = EClosed; + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::DoAddToContainerL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::DoAddToContainerL() + { + __ASSERT_DEBUG(iState == EOpen, Panic(EGlxPanicIllegalState)); + CMPXCollectionPath* targetContainerPath = CMPXCollectionPath::NewL(); + CleanupStack::PushL(targetContainerPath); + targetContainerPath->AppendL(iCollectionId.iUid); + + targetContainerPath->AppendL(iContainerId); + CMPXCommand* command = TGlxCommandFactory::AddToContainerCommandLC(*iUri, *targetContainerPath); + CleanupStack::Pop(command); + CleanupStack::PopAndDestroy(targetContainerPath); + CleanupStack::PushL(command); + iCollectionUtility->Collection().CommandL(*command); + CleanupStack::PopAndDestroy(command); + iState = EAdding; + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::AddToContainerL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::AddToContainerL(const TDesC& aUri, TRequestStatus& aRequestStatus) + { + __ASSERT_DEBUG(iState == EClosed || iState == EOpen, Panic(EGlxPanicIllegalState)); + + InitializeRequest(aRequestStatus); + + delete iUri; + iUri = NULL; + iUri = aUri.AllocL(); + + if (iState == EClosed) + { + iState = EOpeningForAdd; + OpenCollectionL(); + } + else + { + DoAddToContainerL(); + } + } + +// ----------------------------------------------------------------------------- +// CGlxCollectionManagerImpl::DoCollectionInfoL +// ----------------------------------------------------------------------------- +// +void CGlxCollectionManagerImpl::DoCollectionInfoL() + { + __ASSERT_DEBUG(iState == EOpen, Panic(EGlxPanicIllegalState)); + CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); + CleanupStack::PushL(path); + + TInt index = path->IndexOfId(iCollectionInfo->Id()); + if (index == KErrNotFound) + { + iCollectionInfo->SetExists(EFalse); + CompleteRequest(KErrNone); + } + else if(index < 0) // Index is an error other than KErrNotFound + { + CompleteRequest(index); + } + else + { + // the index is good get the title + path->Set(index); + + RArray attributeArray; + CleanupClosePushL(attributeArray); + attributeArray.AppendL(KMPXMediaGeneralTitle); + iCollectionUtility->Collection().MediaL(*path, attributeArray.Array()); + CleanupStack::PopAndDestroy(&attributeArray); + iState = ERequestingMedia; + } + CleanupStack::PopAndDestroy(path); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/collectionmanager/src/glxcollectionselectionpopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/collectionmanager/src/glxcollectionselectionpopup.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2008-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: Interface for displaying/using the popup to select collections +* +*/ + + + +#include "glxcollectionselectionpopup.h" + +#include +#include +#include +#include +#include +#include + + +// ----------------------------------------------------------------------------- +// ShowPopupL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TGlxCollectionSelectionPopup::ShowPopupL( + RArray& aSelectedIds, TUint32 aCollectionType, + TBool aAllowMultipleSelection, TBool aEnableContainerCreation) + { + TUint32 collectionId = 0; + CMPXFilter* filter = NULL; + + if (aCollectionType == KGlxCollectionTypeIdAlbum) + { + aAllowMultipleSelection = EFalse; + collectionId = KGlxCollectionPluginAlbumsImplementationUid; + filter = TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(); + CleanupStack::PushL(filter); + } + else if (aCollectionType == KGlxCollectionTypeIdTag) + { + collectionId = KGlxTagCollectionPluginImplementationUid; + filter = TGlxFilterFactory::CreateIncludeEmptyContainersFilterL(); + CleanupStack::PushL(filter); + } + + __ASSERT_DEBUG(collectionId, Panic(EGlxPanicIllegalState)); + // build the path. + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + + path->AppendL(collectionId); + + CGlxMediaSelectionPopup* popup = new (ELeave) CGlxMediaSelectionPopup; + + TBool accepted = EFalse; + CMPXCollectionPath* selection = popup->ExecuteLD(*path, accepted, aAllowMultipleSelection, aEnableContainerCreation, filter); + + if (accepted) + { + CleanupStack::PushL(selection); + aSelectedIds.Reset(); + + TArray selectionArray = selection->Selection(); + + TInt count = selectionArray.Count(); + if (count) + { + for (TInt i = 0; i < count; i++) + { + aSelectedIds.AppendL(selection->IdOfIndex(selectionArray[i])); + } + } + else + { + aSelectedIds.AppendL(selection->Id()); + } + + CleanupStack::PopAndDestroy(selection); + } + + CleanupStack::PopAndDestroy(path); + + if (filter) + { + CleanupStack::PopAndDestroy(filter); + } + + + if (accepted) + { + return KErrNone; + } + else + { + return KErrCancel; + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/data/200071B3.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/data/200071B3.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +// INCLUDES +#include "glxfetcher.hrh" +#include +#include + +// ----------------------------------------------------------------------------- +// theInfo +// Info resource of the ECOM plugin +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // use resource format version 2 to enable ROM only plugins + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KGlxFetcherDllUid ; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = MEDIAFETCH_ECOM_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxFetcherImplementationUid; + version_no = 2; + display_name = ""; + default_data = "00000003"; + opaque_data = ""; + rom_only = 0; + } + }; + + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/data/glxfetcherdialog.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/data/glxfetcherdialog.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Fetcher Plugin +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME GLFP // 4 letter ID + +// INCLUDES +#include "glxcommandhandlers.hrh" +#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="FETC"; } + +RESOURCE AVKON_VIEW r_fetcher_dialog + { + menubar = r_fetcher_menubar; + } + +RESOURCE MENU_BAR r_fetcher_menubar + { + titles = + { + MENU_TITLE {menu_pane=r_fetcher_menu; txt="";} + }; + } + +RESOURCE MENU_PANE r_fetcher_menu + { + items= + { + }; + } + +RESOURCE TBUF r_fetcher_dialog_title_image + { + buf = qtn_lgal_title_fetcher_select_image; + } + +RESOURCE TBUF r_fetcher_dialog_title_video + { + buf = qtn_lgal_title_fetcher_select_video; + } + +//MultiSelect + +RESOURCE MENU_BAR r_multiselect_fetcher_menubar + { + titles = + { + MENU_TITLE {menu_pane=r_multiselect_fetcher_menu; txt="";} + }; + } + +RESOURCE MENU_PANE r_multiselect_fetcher_menu + { + items= + { + + //should be Select Select marked + MENU_ITEM + { + command=EAknSoftkeySelect; + txt = qtn_cffh_options_select; + }, + + MENU_ITEM + { + command=EGlxCmdSelectMarked; + txt = qtn_cffh_select_marked; + }, + + MENU_ITEM + { + command=EGlxCmdMarkingSubmenu; + txt = qtn_options_list; + cascade = r_multiselect_marking_submenu; + }, + + MENU_ITEM + { + command=EAknCmdHelp; + txt = qtn_options_help; + } + }; + } + +RESOURCE TBUF r_fetcher_dialog_title_images + { + buf = qtn_lgal_title_fetcher_select_images; + } + +RESOURCE TBUF r_fetcher_dialog_title_videos + { + buf = qtn_lgal_title_fetcher_select_videos; + } + +RESOURCE MENU_PANE r_multiselect_marking_submenu + { + items= + { + MENU_ITEM + { + command = EAknCmdMark; + txt = qtn_options_list_mark_one; + }, + MENU_ITEM + { + command = EAknMarkAll; + txt = qtn_options_list_mark_all; + }, + MENU_ITEM + { + command = EAknCmdUnmark; + txt = qtn_options_list_unmark_one; + }, + MENU_ITEM + { + command = EAknUnmarkAll; + txt = qtn_options_list_unmark_all; + } + }; + } + +RESOURCE MENU_BAR r_multiselect_ok_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_multiselect_ok_menu; txt=""; } + }; + } + + +RESOURCE MENU_PANE r_multiselect_ok_menu + { + items= + { + MENU_ITEM + { + command=EAknSoftkeySelect; + txt = qtn_cffh_options_select; + }, + + MENU_ITEM + { + command=EGlxCmdSelectMarked; + txt = qtn_cffh_select_marked; + }, + MENU_ITEM + { + command = EGlxCmdStartMultipleMarking; + txt = qtn_lgal_options_mark_multi; + }, + MENU_ITEM + { + command=EGlxCmdMarkingSubmenu; + txt = qtn_options_list; + cascade = r_multiselect_marking_submenu; + } + }; + } + + +//End of MultiSelect + +RESOURCE DIALOG r_modal_single_dialog + { + // blocking dialog with CBA and no border please + flags=EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagCbaButtons | EEikDialogFlagWait | + EEikDialogFlagNoBackgroundFade |EEikDialogFlagNoBorder; + // softkeys: left select, middle select, right cancel + buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + // Do not add any items + } + +RESOURCE DIALOG r_modal_multi_dialog + { + // blocking dialog with CBA and no border please + flags=EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagCbaButtons | EEikDialogFlagWait | + EEikDialogFlagNoBackgroundFade |EEikDialogFlagNoBorder; + // softkeys: left options, middle select, right cancel + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; + // Do not add any items + } + +RESOURCE TBUF r_fetcher_empty_view_text + { + buf = qtn_lgal_empty_grid_no_items; + } + +RESOURCE TBUF r_fetcher_empty_view_text_image + { + buf = qtn_lgal_empty_grid_no_images; + } + +RESOURCE TBUF r_fetcher_empty_view_text_video + { + buf = qtn_lgal_empty_grid_no_videos; + } + +RESOURCE TBUF r_glx_softkey_cancel { buf = text_softkey_cancel; } + +RESOURCE TBUF r_glx_marking_mark + { buf=qtn_msk_mark; } + +// custom CBA resource for options - ok options menu - cancel +RESOURCE CBA r_glx_softkeys_options_cancel_context + { + buttons = + { + CBA_BUTTON { id=EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id=EAknSoftkeyCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id=EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxfetcher.dll +* +*/ + + + + +#include +PRJ_EXPORTS + +../rom/glxfetcher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxfetcher.iby) +../rom/glxfetcher_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(glxfetcher_resources.iby) + +PRJ_MMPFILES + +glxfetcher.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/group/glxfetcher.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/group/glxfetcher.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008-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: Project definition file for project Media Fetcher Utility +* +*/ + + + + +#include +#include +#include + +#include "../../../group/glxbuildcommon.mmh" +#include "../../../inc/glxalfhelper.mmh" + +TARGET glxfetcher.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x200071B3 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxfetcher.cpp +SOURCE glxfetcherproxy.cpp +SOURCE glxfetcherdialog.cpp +SOURCE glxfetchercontainer.cpp +SOURCE glxfetchercommandhandler.cpp + + +APP_LAYER_SYSTEMINCLUDE + + +START RESOURCE ../data/200071B3.rss +TARGET glxfetcher.rsc +END + +START RESOURCE ../data/glxfetcherdialog.rss +TARGET glxfetcherdialog.rsc +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +// User include path +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../viewframework/inc +SYSTEMINCLUDE ../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../viewframework/views/viewbase/inc +SYSTEMINCLUDE ../../../viewframework/views/gridview/inc +SYSTEMINCLUDE ../../../viewframework/uiutilities/inc +SYSTEMINCLUDE ../../../viewframework/drmutility/inc +SYSTEMINCLUDE ../../../collectionframework/plugins/glxcollectionpluginall/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../commonui/inc +SYSTEMINCLUDE ../../../viewframework/commandhandlers/inc +SYSTEMINCLUDE ../../../viewframework/commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../viewframework/commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../viewframework/commandhandlers/commandhandlermarking/inc +SYSTEMINCLUDE ../../../viewframework/dataprovider/inc +SYSTEMINCLUDE ../../../gallery/loc + +// Libraries +LIBRARY euser.lib +LIBRARY ecom.lib // Ecom Plugin +LIBRARY efsrv.lib // TParser +LIBRARY cone.lib // CCoeEnv +LIBRARY avkon.lib // Avkon related +LIBRARY eikcore.lib +LIBRARY eikdlg.lib // for CEikDialog +LIBRARY eikcoctl.lib // for CEikDialog +LIBRARY mpxcommon.lib // CMPXCollectionPath +LIBRARY commonengine.lib // String Loader +LIBRARY glxmedialists.lib // MGlxMediaList +LIBRARY glxviewbase.lib // View base +LIBRARY glxcommon.lib // for CResourceUtilities, CMPXMedia +LIBRARY glxcommandhandlermarking.lib // CGlxCommandHandlerMarking +LIBRARY glxuiutilities.lib // CGlxUiUtility +LIBRARY bafl.lib // For BaflUtils +LIBRARY glxcommandhandlerbase.lib // For MediaListCommandHandler +LIBRARY alfclient.lib // MAlfWidgetFactory +LIBRARY aknskins.lib // Skin Support for dialog +LIBRARY glxgridview.lib // Medialist observer for HG Grid +LIBRARY flogger.lib // For Logging Tracer +LIBRARY ganes.lib // Hg Grid +LIBRARY egul.lib // Gul Icons +LIBRARY fbscli.lib +LIBRARY aknicon.lib +LIBRARY glxdrmutility.lib // For Drm Utility + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/inc/glxfetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/inc/glxfetcher.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2008-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: Header class for fetcher application plugin +* +*/ + + + + +#ifndef GLXFETCHER_H_ +#define GLXFETCHER_H_ + + +// INCLUDES +#include +#include +#include // MMGFetchCanceler + +#include // CMPXFilter + +// CLASS FWD DECLARATION +class CGlxFetcherDialog; +// CLASS DECLARATION +NONSHARABLE_CLASS( CGlxFetcher ) : public CMediaFetchImplementation, + public MMGFetchCanceler + + { +public: //constructor and desctructor + /** + * Two-phased constructor. + * + * @since 3.2 + * @return Pointer to newly created object. + */ + static CGlxFetcher* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxFetcher(); + +protected: // from CMediaFetchImplementation + /** + * By default fetcher is single selection fetcher. + * If multi-selection is enabled then plug-in should display a + * multi-selection fetcher and allow user to select several items. + * @param aMultiSelect if ETrue then multiselection fetcher is enabled + */ + void SetMultiSelectionL( TBool aMultiSelect ); + + /** + * Not in requirement + * @param aMimeTypes plug-in should show only files with given Mime types + */ + void SetMimeTypesL( const MDesCArray& aMimeTypes ); + + /** + * Plug-in should use given text as selection key (SK1) label + * @param aSelectionSoftkey Custom selection softkey label + */ + void SetSelectionSoftkeyL( const TDesC& aSelectionSoftkey ); + + /** + * Plug-in should use given text as heading + * @param aTitle Custom title text for fetcher + */ + void SetHeadingL( const TDesC& aTitle ); + + /** + * Plug-in should call this interface before selection is done. + * if MMGFetchVerifier::VerifySelectionL() returns ETrue + * then the user's selection should be accepted and the fetcher + * closed. If EFalse is returned then user should change the current + * selection before it can be accepted and the fetcher closed. + * @param aVerifier See MMGFetchVerifier.h + */ + void SetVerifierL( MMGFetchVerifier& aVerifier ); + + /** + * Plug-in should return canceler interface. + * @param aCanceler See MMGFetchCanceler.h + */ + void GetCancelerL( MMGFetchCanceler*& aCanceler ); + + /** + * Plug-in should launch fetcher popup for given media type. + * @param aSelectedFiles plug-in appends selected files to this array + * @param aMediaType plug-in should display only files with this media type + * return ETrue if user selected file(s), EFalse if use cancelled. + */ + TBool LaunchL( CDesCArray& aSelectedFiles, TMediaFileType aMediaType ); + + +private : //constructor and desctructor + /** + * C++ default constructor. + */ + CGlxFetcher(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** @return view title when fetcher is opened for selecting images */ + HBufC* TitleForImageFetcherL() const; + + /** @return view title when fetcher is opened for selecting videos */ + HBufC* TitleForVideoFetcherL() const; + + /** + * @param aSingleSelectionTitleResourceId Resource id for view title when + * single selection is active + * @param aMultiSelectionTitleResourceId Resource id for view title when + * multiselection is active + * @return view title depending whether fetcher is in multiselection or + * single selection mode, and whether client has defined the title + */ + HBufC* TitleL( TInt aSingleSelectionTitleResourceId, + TInt aMultiSelectionTitleResourceId ) const; + + // From MMgFetchCanceler + void CancelFetcherL(); + +private: + /// Resource offset + TInt iResourceOffset; + + /// media type + TMediaFileType iMediaType; + + /// Is multiselection active or not + /// ETrue multiselection + /// EFalse single selection + TBool iIsMultiSelection; + + /** + * Left softkey label + * Own. + */ + HBufC* iSelectionSoftkey; + + /** + * Popup heading text + * Own. + */ + HBufC* iTitle; + + /** + * Verifier + */ + MMGFetchVerifier* iVerifier; + + TGlxFilterItemType iFilterType; + + /** + * Fetcher dialog + */ + CGlxFetcherDialog* iDialog; + }; + +#endif //GLXFETCHER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/inc/glxfetcher.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/inc/glxfetcher.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXTAGVIEWPLUGIN_HRH +#define GLXTAGVIEWPLUGIN_HRH + +// CONSTANTS + +#define KGlxFetcherDllUid 0x200071B3 //dll uid +#define KGlxFetcherImplementationUid 0x200071D7 //implementation uid + +enum TControlId + { + EFetcherControl = 2300// any arbitary value + }; + +#endif // GLXTAGVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/inc/glxfetchercommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/inc/glxfetchercommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Commandhandler that requests the marking commandhandler to +* mark items onto the medialist during multiple selection +* +*/ + + + + +#ifndef GLXFETCHERCOMMANDHANDLER_H_ +#define GLXFETCHERCOMMANDHANDLER_H_ + +#include +#include + +//Forward Decleration +class MGlxTitleObserver; + +/** +* CGlxFetcherCommandHandler +* +*/ +class CGlxFetcherCommandHandler : public CGlxMediaListCommandHandler + +{ +public: + /** + * Two-phase constructor NewL + * @param aMediaListProvider Medialist provider + * @param aTitleObserver Title observer + */ + static CGlxFetcherCommandHandler* NewL(MGlxMediaListProvider + *aMediaListProvider ,MGlxTitleObserver* aTitleObserver); + + /** + * Destructor + */ + ~CGlxFetcherCommandHandler(); + +public: + /// From CGlxMediaListCommandHandler + /// See @ref CGlxMediaListCommandHandler::ExecuteL */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + +protected: + /** See @ref CGlxMediaListCommandHandler */ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + /** + * ConstructorL + */ + void ConstructL(); + + /** + * Default Constructor + */ + CGlxFetcherCommandHandler(MGlxMediaListProvider* aMediaListProvider, + MGlxTitleObserver* aTitleObserver ); + +private: + // (Not owned) + MGlxMediaListProvider* iMediaListProvider; + MGlxTitleObserver* iTitleObserver; + + // (Owned) + CGlxCommandHandlerMarking* iCommandhandlerMarking; + }; +#endif /*GLXFETCHERCOMMANDHANDLER_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/inc/glxfetchercontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/inc/glxfetchercontainer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2008-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: Container class for fetcher plugin +* +*/ + + + + +#ifndef GLXFETCHERCONTAINER_H_ +#define GLXFETCHERCONTAINER_H_ + +// INCLUDES + +// Photos Headers +#include +#include // Interface for going through items in +#include // MGlxMediaListFactory + +// Ganes Headers +#include // HG Scrollbuffer interface +#include // HG Selection Observer interface +#include + +// User Includes +#include "mglxtitleobserver.h" // Title observer + +// FORWARD Declaration +class MGlxMediaList; +class MGlxEventObserver; +class CGlxFetcherCommandHandler; +class CGlxGridViewMLObserver; +class CGlxThumbnailContext; +class CHgGrid; +class CGlxUiUtility; +class CGlxDRMUtility; +/** +* CGlxFetcherContainer +* +*/ +class CGlxFetcherContainer : public CCoeControl, + public MGlxTitleObserver, + public MGlxMediaListProvider, + public MHgScrollBufferObserver, + public MHgSelectionObserver, + public MHgMarkingObserver + { +public: + + /** + * Two-phase constructor NewL + * + * @param aFilterType the filter item type + * @param aTitle the title + */ + static CGlxFetcherContainer* NewL( + TGlxFilterItemType aFilterType ,const TDesC& aTitle, + MGlxEventObserver& aEventObserver, TBool aMultiSelectionEnabled ); + + /** Destructor + * + */ + ~CGlxFetcherContainer(); + + /** + * RetrieveUrisL + */ + TBool RetrieveUrisL( CDesCArray& aSelectedFiles,TBool& aFetchUri ); + + /** + * DoExecuteL + */ + TBool DoExecuteL(TInt aCommandId); + + /** + * OfferKeyEventL, from CCoeControl + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType ); + + /** + * CreateAndDisplayGridL + */ + void CreateAndDisplayGridL( ); + + /** + * Creates and Displays appropriate empty Strings when no + * items selected + */ + void CreateEmptyDisplayL(TGlxFilterItemType aFilterType ); + + /** + * SetPreviousTitleL + * Sets the status pane title with what it was for the calling application + */ + void SetPreviousTitleL(); + +public: + /** + * HandleSizeChange + */ + void HandleSizeChangeL ( ); + + /* + * MopSupplyObject + * Framework call for the skin updates + */ + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + +public:// From MGlxTitleObserver + + void UpdateTitleL(); + +public: + MGlxMediaList& MediaList(); + +protected: // from MHgScrollBufferObserver + void Request(TInt aRequestStart, TInt aRequestEnd, THgScrollDirection aDirection); + void Release(TInt aReleaseStart, TInt aReleaseEnd); + +protected: // from MHgMarkingObserver + void HandleMarkingL( TInt aIndex, TBool /*aMarked*/ ); + +protected: // from MHgSelectionObserver + void HandleSelectL( TInt aIndex ); + void HandleOpenL( TInt aIndex ); + +private: + /** CreateMediaListL + * This function creates the collection path filter and finally the MediaList + */ + void CreateMediaListL(); + + /** + * 2nd phase Constructor + */ + void ConstructL(); + + /** + * Constructor + */ + CGlxFetcherContainer( TGlxFilterItemType aFilterType, const TDesC& aTitle , + MGlxEventObserver& aEventObserver, TBool aMultiSelectionEnabled); + + /** + * SetTitleL + */ + void SetTitleL(const TDesC& aTitleText); + + /** + * Create Grid Widget + */ + void CreateHgGridWidgetL(); + + /** + * Create The Medialist observer + * An interface required for the HG Grid data updates with the photos data + * Taken from GlxGridview + */ + void CreateGridMediaListObserverL(); + + /* + * HandleMultipleMarkingL + * To handle multiple marking, if marked then unmark, else vice versa + */ + void HandleMultipleMarkingL(TInt aIndex); + + /** + * Set the Icons + */ + void SetIconsL(TInt index); + + /** + * This doesnt add up any value to the code, just to satisfy the compiler + */ + void RequestL(TInt aRequestStart, TInt aRequestEnd); + +private: + MGlxMediaList* iMediaList; // MGlxMedialist , to Create MediaList + CHgGrid* iHgGrid; // HGGrid + CGlxGridViewMLObserver* iGlxGridMLObserver; // Medilaist observer from GlxGridview + // Iterator + TGlxFromManualIndexBlockyIterator iBlockyIterator; + CAknsBasicBackgroundControlContext* iBgContext; //Own for background context + + TGlxFilterItemType iFilterType; // Filtertype, Image /Video + + const TDesC& iTitle; // To Store the title + HBufC* iPreviousTitle; // Previous Title + + // CommandHandler to handle marking for multiple fetcher + // (Owned) + CGlxFetcherCommandHandler* iFetcherCommandHandler; + MGlxEventObserver& iEventObserver; // Event Observer to pass doubletap event to dialog + + // Thumbnail context + CGlxThumbnailContext* iThumbnailContext; + TBool iMultiSelectionEnabled; // Flag to notify if multiple fetcher called + TBool iMultipleMarkNotStarted; // Multiple mark started flag + + CGlxUiUtility* iUiUtility; + + // Provides DRM related functionality + CGlxDRMUtility* iDRMUtility; + + // Grid Icon size from FS view + TSize iGridIconSize; + //Is File Attached + TBool iIsFileAttached; + }; + +#endif /*GLXFETCHERCONTAINER_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/inc/glxfetcherdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/inc/glxfetcherdialog.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2008-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: Dialog class for fetcher plugin app +* +*/ + + + + +#ifndef GLXFETCHERDIALOG_H_ +#define GLXFETCHERDIALOG_H_ + +// EXTERNAL INCLUDES +#include // for CAknDialog +#include // CMPXFilter +#include +#include + +#include "mglxeventobserver.h" + +// Forward Declerations +class CGlxFetcherContainer; +class CGlxUiUtility; +class MMGFetchVerifier; +class CAlfEnv; + + +// INTERNAL INCLUDES + +NONSHARABLE_CLASS (CGlxFetcherDialog) : public CAknDialog , + public MGlxEventObserver + { + public: // Constructors and destructor + /** + * Two-phased constructor. + * @param reference to an array where the selected files are set + * @param selection verifier interface + * @param filtertype, either images or videos + * @param the title for the dialog + */ + static CGlxFetcherDialog* NewL( + CDesCArray& aSelectedFiles, + MMGFetchVerifier* aVerifier, + TGlxFilterItemType aFilterType, + const TDesC& aTitle, + TBool aMultiSelectionEnabled); + + /** + * Destructor. + */ + ~CGlxFetcherDialog(); + + public: // from MEikCommandObserver + /** + * @ref MEikCommandObserver + */ + void ProcessCommandL(TInt aCommandId); + + protected: // Functions CEikDialog + + /** + * @ref CEikDialog + */ + TBool OkToExitL(TInt aKeycode); + + /** + * From MEikMenuObserver + */ + void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane) ; + + protected: // From CAknDialog + /** + * From MEikMenuObserver + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/); + + private: + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CGlxFetcherDialog( + CDesCArray& aSelectedFiles, MMGFetchVerifier* aVerifier, + TGlxFilterItemType aFilterType, const TDesC& aTitle, + TBool aMultiSelectionEnabled); + + private: // from CCoeControl + /** + * @ref CCoeControl::SizeChanged + */ + void SizeChanged(); + + private: + /** + * Initializes the dialog's controls before the dialog is sized and + * layed out. + */ + void PreLayoutDynInitL(); + + /** + * Initializes the dialog's controls after the dialog has been sized + * but before it has been activated. + */ + void PostLayoutDynInitL(); + + private: // from MEikDialogPageObserver + /** + * @ref MEikDialogPageObserver::CreateCustomControlL + */ + SEikControlInfo CreateCustomControlL(TInt aControlType); + + private: // CAknDialog + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + private:// From MGlxEventObserver + + virtual void HandleDoubleTapEventL(TInt aCommandId); + + public:// to exit the fetcher dialog + void CallCancelFetcherL(TInt aCommandId); + + private: + CGlxFetcherContainer* iFetcherContainer ; //Container Object + CGlxUiUtility* iUiUtility; // UiUtility + CAlfEnv* iEnv; // Alf Environment + + // Selected items array + // Not Own. Owned by the client + CDesCArray& iSelectedFiles; + + MMGFetchVerifier* iVerifier; + + TGlxFilterItemType iFilterType; // GlxFilterType + + /// Ref: the title + const TDesC& iTitle; + + TBool iMultiSelectionEnabled; + + // Flag to check for mark started or not + TBool iMarkStarted; + + TBool iFetchUri; // This is to check if uri is being fetcher or not + }; + +#endif /*GLXFETCHERDIALOG_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/inc/mglxeventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/inc/mglxeventobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2008-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: Tap event observer class for fetcher app +* +*/ + + + +#ifndef MGLXEVENTOBSERVER_H_ +#define MGLXEVENTOBSERVER_H_ + +/** + * MGlxEventObserver + * + * List event notification interface + */ +class MGlxEventObserver + { +public: + /** + * Called from Container to pass Select event (double tap )to Dialog. + */ + virtual void HandleDoubleTapEventL(TInt aCommandId) = 0; + + /** + * Destructor. Dont allow deleting objects through this interface. + */ + virtual ~MGlxEventObserver() {}; + }; + +#endif /*MGLXEVENTOBSERVER_H_*/ + +//EOF diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/inc/mglxtitleobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/inc/mglxtitleobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Title observer class for fetcher app +* +*/ + + + + +/** + * MGlxTitleObserver + * + * List event notification interface + */ +class MGlxTitleObserver + { +public: + /** + * Called when title need to be updated. + */ + virtual void UpdateTitleL() = 0; + }; + +//END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/rom/glxfetcher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/rom/glxfetcher.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008-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: MGallery / glxfetcher's iby file. +* +*/ + + + + +#ifndef __GLXFETCHER_IBY__ +#define __GLXFETCHER_IBY__ + +#ifdef GALLERY_TESTING +ECOM_PLUGIN( glxfetcher.dll, glxfetcher.rsc ) +#else +ECOM_PLUGIN( glxfetcher.dll, glxfetcher.rsc ) +#endif // GALLERY_TESTING + +#endif // __GLXFETCHER_IBY__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/rom/glxfetcher_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/rom/glxfetcher_resources.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008-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: MGallery / glxfetcher resource's iby file. +* +*/ + + + + +#ifndef __GLXFETCHER_RESOURSES_IBY__ +#define __GLXFETCHER_RESOURSES_IBY__ + +#ifdef GALLERY_TESTING +data=DATAZ_\APP_RESOURCE_DIR\glxfetcherdialog.rsc APP_RESOURCE_DIR\glxfetcherdialog.rsc +#else +data=DATAZ_\APP_RESOURCE_DIR\glxfetcherdialog.rsc APP_RESOURCE_DIR\glxfetcherdialog.rsc +#endif // GALLERY_TESTING + +#endif // __GLXFETCHER_RESOURSES_IBY__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/src/glxfetcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/src/glxfetcher.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,270 @@ +/* +* Copyright (c) 2008-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: provide synchronized access to file systema and metadata source +* +*/ + + + + +#include // CAknViewAppUi +#include +#include // KDC_APP_RESOURCE_DIR +#include // CEikApplication +#include // FOR GETTING VIEW ID AND RESOURCE ID +#include // All item collection plugin id +#include // Logging macros +#include // for CGlxResourceUtilities +#include +#include // MGlxMediaList, CMPXCollectionPath + +#include "glxfetcher.hrh" // For implementation id +#include "glxfetcherdialog.h" // CGlxFetcherDialog +#include "glxfetcher.h" // CGlxFetcher +#include "glxtracer.h" +#include "glxlog.h" + +_LIT(KFetcherGridViewResource,"glxfetcherdialog.rsc"); //FetcherGridDialog Resource File + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxFetcher* CGlxFetcher::NewL() + { + TRACER("CGlxFetcher::NewL"); + CGlxFetcher* self = new( ELeave ) CGlxFetcher(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxFetcher::ConstructL() + { + TRACER("CGlxFetcher::ConstructL"); + // No implementation required + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// --------------------------------------------------------------------------- +// +CGlxFetcher::CGlxFetcher() + { + TRACER("CGlxFetcher::CGlxFetcher"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxFetcher::~CGlxFetcher() + { + TRACER("CGlxFetcher::~CGlxFetcher"); + + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + if(iDialog) + { + iDialog = NULL; + } + delete iSelectionSoftkey; + delete iTitle; + + } + +// --------------------------------------------------------------------------- +// SetMultiSelectionL +// --------------------------------------------------------------------------- +// +void CGlxFetcher::SetMultiSelectionL( TBool aMultiSelect ) + { + TRACER("CGlxFetcher::SetMultiSelectionL"); + iIsMultiSelection = aMultiSelect; + } + +// --------------------------------------------------------------------------- +// SetMimeTypesL +// --------------------------------------------------------------------------- +// +void CGlxFetcher::SetMimeTypesL( const MDesCArray& /*aMimeTypes*/ ) + { + TRACER("CGlxFetcher::SetMimeTypesL (not supported)"); + // No implementation required (not supported) + } + +// --------------------------------------------------------------------------- +// SetSelectionSoftkeyL +// --------------------------------------------------------------------------- +// +void CGlxFetcher::SetSelectionSoftkeyL( const TDesC& aSelectionSoftkey ) + { + TRACER("CGlxFetcher::SetSelectionSoftkeyL"); + + HBufC* tmp = aSelectionSoftkey.AllocL(); + delete iSelectionSoftkey; + iSelectionSoftkey = tmp; + } + +// --------------------------------------------------------------------------- +// SetHeadingL +// --------------------------------------------------------------------------- +// +void CGlxFetcher::SetHeadingL( const TDesC& aTitle ) + { + TRACER("CGlxFetcher::SetHeadingL"); + + HBufC* tmp = aTitle.AllocL(); + delete iTitle; + iTitle = tmp; + } + +// --------------------------------------------------------------------------- +// SetVerifierL +// --------------------------------------------------------------------------- +// +void CGlxFetcher::SetVerifierL( MMGFetchVerifier& aVerifier ) + { + TRACER("CGlxFetcher::SetVerifierL"); + + iVerifier = &aVerifier; + } + +// --------------------------------------------------------------------------- +// GetCancelerL +// --------------------------------------------------------------------------- +// +void CGlxFetcher::GetCancelerL( MMGFetchCanceler*& aCanceler ) + { + TRACER("CGlxFetcher::GetCancelerL"); + + aCanceler = this; + } + + +// --------------------------------------------------------------------------- +// LaunchL +// --------------------------------------------------------------------------- +// +TBool CGlxFetcher::LaunchL( CDesCArray& aSelectedFiles, + TMediaFileType aMediaType ) + { + TRACER("CGlxFetcher::LaunchL"); + TInt buttonId; + TFileName resFile; + TParse parse; + parse.Set(KFetcherGridViewResource, &KDC_APP_RESOURCE_DIR, NULL); + + resFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resFile); + + // Configure heading and filter type + switch ( aMediaType ) + { + case EImageFile: + { + iTitle = TitleForImageFetcherL(); + iFilterType = EGlxFilterImage; + break; + } + case EVideoFile: + { + iTitle = TitleForVideoFetcherL(); + iFilterType = EGlxFilterVideo; + break; + } + default: + { + GLX_LOG_INFO("CGlxFetcher::LaunchL - Error: Unsupported media type, Leaving"); + User::Leave( KErrNotSupported ); + } + } + // create the dialog first + iDialog = + CGlxFetcherDialog::NewL( aSelectedFiles, iVerifier ,iFilterType ,*iTitle, iIsMultiSelection ); + // Returns zero when Fetcher is cancelled by User. + + if( iIsMultiSelection ) + { + buttonId = iDialog->ExecuteLD( R_MODAL_MULTI_DIALOG ); + } + else + { + buttonId = iDialog->ExecuteLD( R_MODAL_SINGLE_DIALOG ); + } + // Return false if the fetcher was canceled by user + return ( 0 != buttonId && aSelectedFiles.Count()!=0); + } + +// --------------------------------------------------------------------------- +// Return Dialog title +// --------------------------------------------------------------------------- +// +HBufC* CGlxFetcher::TitleForImageFetcherL() const + { + TRACER("CGlxFetcher::TitleForImageFetcherL()"); + return TitleL( R_FETCHER_DIALOG_TITLE_IMAGE, R_FETCHER_DIALOG_TITLE_IMAGES ); + } + +// --------------------------------------------------------------------------- +// Return Dialog title +// --------------------------------------------------------------------------- +// +HBufC* CGlxFetcher::TitleForVideoFetcherL() const + { + TRACER("CGlxFetcher::TitleForVideoFetcherL()"); + return TitleL( R_FETCHER_DIALOG_TITLE_VIDEO, R_FETCHER_DIALOG_TITLE_VIDEOS ); + } + +// --------------------------------------------------------------------------- +// Return Dialog title +// --------------------------------------------------------------------------- +// +HBufC* CGlxFetcher::TitleL( TInt aSingleSelectionTitleResourceId, + TInt aMultiSelectionTitleResourceId ) const + { + TRACER("CGlxFetcher::TitleL()"); + if( !iTitle ) + { + TInt resourceId = aSingleSelectionTitleResourceId; + if ( iIsMultiSelection ) + { + resourceId = aMultiSelectionTitleResourceId; + } + return CCoeEnv::Static()->AllocReadResourceL( resourceId ); + } + return iTitle; + } + +// ----------------------------------------------------------------------------- +// From MMGFetchCanceler +// ----------------------------------------------------------------------------- +// +void CGlxFetcher::CancelFetcherL() + { + TRACER("CGlxFetcher::CancelFetcherL"); + //pass EAknCmdExit as parameter to exit the fetcher dialog + if(iDialog) + { + iDialog->CallCancelFetcherL(EAknCmdExit ); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/src/glxfetchercommandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/src/glxfetchercommandhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2008-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: CCommandhandler that requests the marking commandhandler to +* mark items onto the medialist during multiple selection +* +*/ + + + + +#include // FOR GETTING VIEW ID AND RESOURCE ID +#include // To get AppUi instance +#include // To get AppUi instance +#include // For Tracer Logs +#include "glxfetchercommandhandler.h" + + +//----------------------------------------------------------------------------- +// C++ default constructor. +//----------------------------------------------------------------------------- +CGlxFetcherCommandHandler::CGlxFetcherCommandHandler( + MGlxMediaListProvider* aMediaListProvider, + MGlxTitleObserver* aTitleObserver ) + : CGlxMediaListCommandHandler( aMediaListProvider ), + iTitleObserver( aTitleObserver ) + { + TRACER("CGlxFetcherCommandHandler::CGlxFetcherCommandHandler()"); + + iMediaListProvider = aMediaListProvider; + } + +//----------------------------------------------------------------------------- +// Two-phased constructor. +//----------------------------------------------------------------------------- +CGlxFetcherCommandHandler* CGlxFetcherCommandHandler::NewL( + MGlxMediaListProvider* aMediaListProvider, + MGlxTitleObserver* aTitleObserver ) + { + TRACER("CGlxFetcherCommandHandler::NewL()"); + + CGlxFetcherCommandHandler* self = new( ELeave ) + CGlxFetcherCommandHandler( aMediaListProvider, aTitleObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +void CGlxFetcherCommandHandler::ConstructL() + { + TRACER("CGlxFetcherCommandHandler::ConstructL()"); + + iCommandhandlerMarking = CGlxCommandHandlerMarking::NewL(iMediaListProvider,EFalse); + + // Get AppUi instance + // This class does not have access to a CEikonEnv and hence + // pls ignore the code scanner warning - Using CEikonEnv::Static + CEikAppUi* appUi = CEikonEnv::Static()->EikAppUi(); + + // Make sure the active view is our view, in case the view + // activation failed + TVwsViewId activeViewId; + appUi->GetActiveViewId( activeViewId ); + + // Specify to the commandhandler about the active viewid + iCommandhandlerMarking->ActivateL( activeViewId.iViewUid.iUid ); + + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +CGlxFetcherCommandHandler::~CGlxFetcherCommandHandler() + { + TRACER("CGlxFetcherCommandHandler::~CGlxFetcherCommandHandler()"); + + if (iCommandhandlerMarking) + { + // Deactivate the commandhandler before deleting it. + iCommandhandlerMarking->Deactivate(); + delete iCommandhandlerMarking; + } + } + +//----------------------------------------------------------------------------- +// DoExecuteL +//----------------------------------------------------------------------------- +TBool CGlxFetcherCommandHandler::DoExecuteL(TInt aCommandId, MGlxMediaList& /*aList*/) + { + TRACER("CGlxFetcherCommandHandler::DoExecuteL()"); + + return iCommandhandlerMarking->ExecuteL( aCommandId ); + } + +// --------------------------------------------------------------------------- +// DoIsDisabled +// --------------------------------------------------------------------------- +TBool CGlxFetcherCommandHandler::DoIsDisabled(TInt /*aCommandId*/, + MGlxMediaList& /*aList*/) const + { + TRACER("CGlxFetcherCommandHandler::DoIsDisabled()"); + + return EFalse; + } + +// END OF FILE + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/src/glxfetchercontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/src/glxfetchercontainer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,778 @@ +/* +* Copyright (c) 2008-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: Container for Fecther Dialog +* +*/ + + + + +// System includes +#include +#include // For AknLayoutUtils to calculate rect +#include // KDC_APP_RESOURCE_DIR +#include // For Empty text reading from resource +#include // Title Pane + +#include // Mpx Collection path for medialist craetion +#include // Gul Icon +#include // HG Item +#include // Hg Grid Widget +#include // Background Context + +#include // KGlxFetchontextPriorityNormal and KGlxIconsFilename +#include // All item collection plugin id +#include // For Filters required in Medilaits +#include // for CGlxResourceUtilities +#include // FOR GETTING Dialog ID AND RESOURCE ID +#include // TMPXAttribute +#include // CGlxAttributeRetriever +#include // TGlxfetchContextRemover +#include // AknIconUtils and EikStatusPane +#include // For Tracer logs +#include // Glx Logger +#include // Medialistobserver for HgGrid +#include // Thumbnailcontext for HgGrid +#include // Glx Icons for HgGrid +#include // MGlxMediaList, CMPXCollectionPath +#include // For EGlxCmdEndMultiplemarking and EGlxCmdStartMultiplemarking +#include // KGlxMediaIdThumbnail +#include +#include // DRM utility class to provide DRM-related functionality + +// User includes +#include "glxfetchercontainer.h" +#include "mglxeventobserver.h" +#include "glxfetcher.hrh" +#include "glxfetchercommandhandler.h" + +const TInt KPadding(7); +const TInt KNoOfPages(4); +const TInt KBufferTreshold(1); +const TInt KItemsPerPage(18); +const TInt KBufferSize(KNoOfPages * KItemsPerPage); +const TInt KBufferTresholdSize(KBufferTreshold * KItemsPerPage); + +//----------------------------------------------------------------------------- +// Two-phased constructor. +//----------------------------------------------------------------------------- +CGlxFetcherContainer* CGlxFetcherContainer::NewL( + TGlxFilterItemType aFilterType, const TDesC& aTitle, + MGlxEventObserver& aEventObserver, TBool aMultiSelectionEnabled ) + { + TRACER("CGlxFetcherContainer::NewL"); + CGlxFetcherContainer* self = + new( ELeave ) CGlxFetcherContainer( aFilterType ,aTitle, + aEventObserver, aMultiSelectionEnabled); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------- +// C++ default constructor. +//----------------------------------------------------------------------------- +CGlxFetcherContainer::CGlxFetcherContainer( + TGlxFilterItemType aFilterType ,const TDesC& aTitle, + MGlxEventObserver& aEventObserver, TBool aMultiSelectionEnabled ) + : iFilterType( aFilterType ), + iTitle( aTitle ),iEventObserver(aEventObserver), + iMultiSelectionEnabled(aMultiSelectionEnabled) + { + TRACER("CGlxFetcherContainer::CGlxFetcherContainer"); + // No implementation required + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +void CGlxFetcherContainer::ConstructL() + { + TRACER("CGlxFetcherContainer::ConstructL"); + iBgContext = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgAreaMain, Rect(), EFalse ); + iUiUtility = CGlxUiUtility::UtilityL(); + iGridIconSize = iUiUtility->GetGridIconSize(); + + // For DRM Utility + iDRMUtility = CGlxDRMUtility::InstanceL(); + iIsFileAttached = EFalse; + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +CGlxFetcherContainer::~CGlxFetcherContainer() + { + TRACER("CGlxFetcherContainer::~CGlxFetcherContainer"); + if (iDRMUtility) + { + iDRMUtility->Close(); + } + delete iBgContext; + delete iPreviousTitle; + delete iFetcherCommandHandler; + delete iGlxGridMLObserver; + if (iHgGrid) + { + iHgGrid->SetFocus(EFalse); + delete iHgGrid; + iHgGrid = NULL; + } + if (iMediaList) + { + iMediaList->RemoveContext(iThumbnailContext); + delete iThumbnailContext; + iMediaList->Close(); + } + if (iUiUtility) + { + iUiUtility->Close() ; + } + } + + +// --------------------------------------------------------------------------- +// CreateAndDisplayGridL +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::CreateAndDisplayGridL() + { + TRACER("CGlxFetcherContainer::CreateAndDisplayGridL"); + //Create Medialist + CreateMediaListL(); + + // Create the control here + CreateHgGridWidgetL(); + + CreateGridMediaListObserverL(); + + CreateEmptyDisplayL( iFilterType ); + + // If multiple image selection is allowed, then set marking flag on grid widget. + if(iMultiSelectionEnabled) + { + // Fetcher CommandHandler must be created after creating the medialist + iFetcherCommandHandler = CGlxFetcherCommandHandler::NewL( this , this ); + + iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode ); + iMultipleMarkNotStarted = EFalse; + } + } +// --------------------------------------------------------------------------- +// CreateEmptyDisplayL +// Displays the empty string if no items in grid with respect to item selected. +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::CreateEmptyDisplayL( TGlxFilterItemType aFilterType ) + { + TRACER("CGlxFetcherContainer::CreateEmptyDisplayL"); + if (aFilterType == EGlxFilterImage) + { + HBufC* emptyText = + StringLoader::LoadLC(R_FETCHER_EMPTY_VIEW_TEXT_IMAGE); + iHgGrid->SetEmptyTextL(*emptyText); + CleanupStack::PopAndDestroy(emptyText); + } + else if (aFilterType == EGlxFilterVideo) + { + HBufC* emptyText = + StringLoader::LoadLC(R_FETCHER_EMPTY_VIEW_TEXT_VIDEO); + iHgGrid->SetEmptyTextL(*emptyText); + CleanupStack::PopAndDestroy(emptyText); + } + } +// --------------------------------------------------------------------------- +// CreateMediaListL() +// Creates a collection path +// Create a filter as requested filtertype +// Creates the medialist +// --------------------------------------------------------------------------- +void CGlxFetcherContainer::CreateMediaListL() + { + TRACER("CGlxFetcherContainer::CreateMediaListL"); + + // Create path to the list of images and videos + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL(KGlxCollectionPluginAllImplementationUid); // All item collection plugin + + // Create filter to filter out either images or videos + GLX_LOG_INFO1("CGlxFetcherContainer::MediaListL - Filter Type = %d",iFilterType); + CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(iFilterType); + CleanupStack::PushL(filter); + + // Create the media list + iMediaList = MGlxMediaList::InstanceL( *path, + TGlxHierarchyId(KGlxFetcherDllUid), filter ); + CleanupStack::PopAndDestroy( filter ); + + GLX_LOG_INFO1("CGlxFetcherContainer::MediaListL - Path level = %d", + path->Levels()); + + CleanupStack::PopAndDestroy( path ); + } +// --------------------------------------------------------------------------- +// CreateHgGridWidgetL +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::CreateHgGridWidgetL() + { + TRACER("CGlxFetcherContainer::CreateHgGridWidgetL"); + //Setting the Title + SetTitleL( iTitle); + + iThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context + iThumbnailContext->SetDefaultSpec( iUiUtility->GetGridIconSize().iWidth, + iUiUtility->GetGridIconSize().iHeight ); + + CGlxDefaultAttributeContext* attrContext = CGlxDefaultAttributeContext::NewL(); + CleanupStack::PushL(attrContext); + attrContext->AddAttributeL(KMPXMediaGeneralCount); + attrContext->SetRangeOffsets(KItemsPerPage, KItemsPerPage); + iMediaList->AddContextL(attrContext, KGlxFetchContextPriorityGridViewVisibleThumbnail); + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attrContext,*iMediaList,EFalse)); + iMediaList->RemoveContext(attrContext); + CleanupStack::PopAndDestroy( attrContext ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal ); + + if (!iHgGrid) + { + TRect rect; + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); + TSize iconSize (iUiUtility->GetGridIconSize().iWidth - (2*KPadding), + iUiUtility->GetGridIconSize().iHeight -(2*KPadding)); + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_notcreated); + AknIconUtils::SetSize(bitmap, iconSize); + + // Create Hg grid object + iHgGrid = CHgGrid::NewL ( + rect, + iMediaList->Count(), + CGulIcon::NewL(bitmap) ); + } + iHgGrid->SetSelectedIndex(iMediaList->FocusIndex()); + // Setting to MopParent to update background skin + iHgGrid->SetMopParent(this); + // Setting Selction observer for getting callback on key event change + iHgGrid->SetSelectionObserver(*this); + // This Displays the scrollbar at the opening of the Grid view + iHgGrid->SetScrollBarTypeL(CHgScroller::EHgScrollerTimeStrip ); + // Enable Buffer support + iHgGrid->EnableScrollBufferL(*this, KBufferSize, KBufferTresholdSize); + // Enable Marking support + iHgGrid->SetMarkingObserver(*this); + + iHgGrid->SetFocus(ETrue); + } + +// --------------------------------------------------------------------------- +// CreateGridMediaListObserverL +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::CreateGridMediaListObserverL() + { + iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*iMediaList , iHgGrid); + } + +// --------------------------------------------------------------------------- +// BufferPositionChanged +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::Request(TInt aRequestStart, TInt aRequestEnd, + THgScrollDirection /*aDirection*/) + { + TRACER("CGlxFetcherContainer::Request()"); + RequestL(aRequestStart, aRequestEnd); + } +// --------------------------------------------------------------------------- +// RequestL +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::RequestL(TInt aRequestStart, TInt aRequestEnd) + { + TRACER("CGlxFetcherContainer::RequestL()"); + TInt mediaCount = iMediaList->Count(); + + aRequestStart = (aRequestStart<0 ? 0 : aRequestStart) ; + aRequestEnd = (aRequestEnd>=mediaCount? mediaCount : aRequestEnd); + + if (aRequestEnd - aRequestStart) + { + TInt visIndex = iHgGrid->FirstIndexOnScreen(); + if (visIndex < 0) + { + visIndex = 0; + } + + else if (visIndex >= mediaCount) + { + visIndex = mediaCount-1; + } + + GLX_LOG_INFO1("CGlxGridViewImp::Request - SetVisibleWindowIndex " + "visIndex(%d)", visIndex); + iMediaList->SetVisibleWindowIndexL(visIndex); + } + for (TInt i=aRequestStart; i<= aRequestEnd; i++) + { + SetIconsL(i); + TInt firstIndex = iHgGrid->FirstIndexOnScreen(); + TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; + if (i >= firstIndex && i <= lastOnScreen) + { + GLX_LOG_INFO1("CGlxGridViewImp::Request - RefreshScreen i(%d)", i); + iHgGrid->RefreshScreen(i); + } + } + } +// --------------------------------------------------------------------------- +// SetIcons +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::SetIconsL(TInt aIndex) + { + TRACER("CGlxFetcherContainer::SetIconsL()"); + const TGlxMedia& item = iMediaList->Item(aIndex); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + TIconInfo icon; + TInt tnError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + bitmap->Duplicate( value->iBitmap->Handle()); + iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewImp::Request value-Index is %d",aIndex); + } + else if (item.GetIconInfo(icon)) + { + GLX_LOG_INFO1("CGlxGridViewImp::Request - icon(%d)", aIndex); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(icon.bmpfile, icon.bitmapId); + AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); + iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewImp::Request GetIconInfo-Index is %d",aIndex); + } + else if ( KErrNone != tnError && KErrNotSupported != tnError ) + { + GLX_LOG_INFO2("CGlxGridViewImp::Request - image_corrupted tnError(%d), " + "i(%d)", tnError, aIndex); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_corrupted); + AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); + iHgGrid->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); + } + + if (item.IsDrmProtected()) + { + const TDesC& uri = item.Uri(); + if( uri.Length() > 0) + { + if(iDRMUtility->IsForwardLockedL(uri)) + { + iHgGrid->ItemL(aIndex).SetFlags( + CHgItem::EHgItemFlagsDrmRightsValid); + } + else + { + TMPXGeneralCategory cat = item.Category(); + TBool checkViewRights = (cat==EMPXImage); + + if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights)) + { + iHgGrid->ItemL(aIndex).SetFlags( + CHgItem::EHgItemFlagsDrmRightsValid); + } + else + { + iHgGrid->ItemL(aIndex).SetFlags( + CHgItem::EHgItemFlagsDrmRightsExpired); + } + } + } + } + TTime time(0); + if (item.GetDate(time)) + { + iHgGrid->ItemL(aIndex).SetTime(time); + } + + if (item.Category() == EMPXVideo) + { + iHgGrid->ItemL(aIndex).SetFlags(CHgItem::EHgItemFlagsVideo); + } + } + +// --------------------------------------------------------------------------- +// Release +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::Release(TInt /*aReleaseStart*/, TInt /*aReleaseEnd*/) + { + TRACER("CGlxFetcherContainer::Release()"); + // This has to do nothing on default + } + +// --------------------------------------------------------------------------- +// HandleSelect +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::HandleSelectL( TInt aIndex ) + { + TRACER("CGlxGridViewImp::HandleSelect()"); + // Make sure that the Selection Index is inside medialist count + if (aIndex Count() && aIndex >=0) + { + // Setting the focus of the medialist + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); + } + } + +// --------------------------------------------------------------------------- +// HandleOpen +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::HandleOpenL( TInt aIndex ) + { + TRACER("CGlxGridViewImp::HandleOpen()"); + // Make sure that the Selection Index is inside medialist count + if (aIndex Count() && aIndex >=0) + { + //ignore multiple tap events for single selection cases + //if file has already been selected + if(!iMultiSelectionEnabled && !iIsFileAttached) + { + iEventObserver.HandleDoubleTapEventL(EAknSoftkeySelect); + } + } + } + +// --------------------------------------------------------------------------- +// HandleMarkingL +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::HandleMarkingL( TInt aIndex, TBool/* aMarked*/ ) + { + TRACER("CGlxGridViewImp::HandleMarkingL()"); + HandleMultipleMarkingL(aIndex); + } + +// --------------------------------------------------------------------------- +// HandleMultipleMarkingL +// --------------------------------------------------------------------------- +// +void CGlxFetcherContainer::HandleMultipleMarkingL(TInt aIndex ) + { + TRACER("CGlxGridViewImp::HandleMultipleMarkingL()"); + if(iMediaList->IsSelected(aIndex)) + { + if(iHgGrid) + { + if(iMultiSelectionEnabled) + { + iFetcherCommandHandler->DoExecuteL(EAknCmdUnmark, MediaList()); + } + } + } + else + { + if(iHgGrid) + { + if(iUiUtility->IsPenSupported()) + { + //This is required for the touch because here when we select + //we do not get the event for mark in processcommandL + //of FetcherDialog. So we explicitly send the event to ourselves + //to mark the item. + if (!iMultipleMarkNotStarted) + { + DoExecuteL(EAknCmdMark); + } + } + if(iMultiSelectionEnabled) + { + iFetcherCommandHandler->DoExecuteL(EAknCmdMark, MediaList()); + } + } + } + } + +// --------------------------------------------------------------------------- +// DoExecuteL() +// --------------------------------------------------------------------------- +TBool CGlxFetcherContainer::DoExecuteL(TInt aCommandId) + { + TRACER("CGlxFetcherContainer::DoExecuteL"); + + TBool retVal = EFalse; + /* + * fix for EBYU-7UV4MW-- when user presses selection key + * very fast that time if hggrid is not created and we are trying to + * access hghgrid for marking it is giving crash. So need to chk if + * hggrid id created or not.same will also happen if media list is + * not created + */ + if(!iHgGrid || !iMediaList) + { + return retVal; + } + + TInt focusIndex = iMediaList->FocusIndex(); + + switch(aCommandId) + { + case EAknCmdMark: + case EAknMarkAll: + case EGlxCmdStartMultipleMarking: + { + //@ fix for ELWU-7RA7NX + if (iMultiSelectionEnabled ) + { + if (!iMultipleMarkNotStarted) + { + //This will start multiple marking and not mark any items + iFetcherCommandHandler->DoExecuteL(EAknCmdMark, MediaList()); + iMultipleMarkNotStarted = ETrue ; + } + //@ Mark in HG Grid + iHgGrid->Mark(focusIndex); + iHgGrid->RefreshScreen(focusIndex); + + } + retVal = ETrue; + break; + } + case EAknCmdUnmark: + case EAknUnmarkAll: + { + //@ fix for ELWU-7RA7NX + if (iMultiSelectionEnabled) + { + //@ UnMark in HG Grid + iHgGrid->UnMark(focusIndex); + iHgGrid->RefreshScreen(focusIndex); + } + + if( iMediaList->SelectionCount() <= 0 ) + { + iMultipleMarkNotStarted = EFalse; + } + retVal = ETrue; + break; + } + case EGlxCmdEndMultipleMarking: + { + iHgGrid->ClearFlags( CHgScroller::EHgScrollerSelectionMode ); + iFetcherCommandHandler->DoExecuteL(aCommandId, MediaList()); + } + retVal = ETrue; + break; + default: + break; + } + return retVal; + } + + +// ----------------------------------------------------------------------------- +// Retrieve Uris +// ----------------------------------------------------------------------------- +TBool CGlxFetcherContainer::RetrieveUrisL( CDesCArray& aSelectedFiles, TBool& aFetchUri) + { + TRACER("CGlxFetcherContainer::RetrieveUrisL"); + // check that the medialist is really constructed + // we can get this call while MGlxMediaList::InstanceL has not yet returned + // as it starts a new asynch wait loop and during that it is possible + // to send key events to the dialog. + if( !iMediaList || !iHgGrid ) + { + aFetchUri = EFalse; + iIsFileAttached = EFalse; + return iIsFileAttached; + } + //To Block call to HandleDoubleTapEventL() when control is in RetrieveUrisL() + iIsFileAttached = ETrue; + GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() Medialist count is %d", + iMediaList->Count()); + TGlxSelectionIterator iterator; + CGlxAttributeContext* context = new (ELeave) CGlxAttributeContext( &iterator ); + CleanupStack::PushL( context ); + + // Configure the context to retrieve the URI attribute + context->AddAttributeL( KMPXMediaGeneralUri ); + + iMediaList->AddContextL( context, KGlxFetchContextPriorityBlocking ); + + // Create remover object to remove the context from the list + // even if a leave occurs + TGlxFetchContextRemover remover( context, *iMediaList ); + // put to cleanupstack as cleanupstack is emptied before stack objects + // are deleted + CleanupClosePushL( remover ); + // block until all content retrieved (shows progress note) + TInt error = GlxAttributeRetriever::RetrieveL( *context, + *iMediaList, ETrue ) ; + GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() Error %d", error); + // context off the list + CleanupStack::PopAndDestroy( &remover ); + GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() Medialist count after GlxAttributeRetriever is %d", + iMediaList->Count()); + + // if error or if medialist count is 0 then do not proceed further with the iterator. + if (error == KErrNone && iMediaList->Count() !=0) + { + GLX_LOG_INFO1("CGlxFetcherContainer::RetrieveUrisL() inside loop and medialist count is %d", + iMediaList->Count()); + // Add all selected items to client's array + iterator.SetToFirst( iMediaList ); + TInt index = KErrNotFound; + while ( KErrNotFound != (index = iterator++) ) + { + const TDesC& uri = iMediaList->Item( index ).Uri(); + if( uri != KNullDesC ) + { + aSelectedFiles.AppendL( uri ); + iIsFileAttached = ETrue; + } + else + { + iIsFileAttached = EFalse; + } + } + } + CleanupStack::PopAndDestroy( context ); + // Set the Fetch uri value as false, as it could be a drm image and calling + // application might not allow that to be selected, thus fetcher could be launched again. + aFetchUri = EFalse; + return iIsFileAttached; + } + +//----------------------------------------------------------------------------- +// CGlxFetcherContainer::OfferKeyEventL +//----------------------------------------------------------------------------- +TKeyResponse CGlxFetcherContainer::OfferKeyEventL( + const TKeyEvent& aKeyEvent,TEventCode aType ) + { + TRACER("CGlxFetcherContainer::OfferKeyEventL"); + return iHgGrid->OfferKeyEventL(aKeyEvent,aType); + } + +// --------------------------------------------------------------------------- +// SetTitleL() +// --------------------------------------------------------------------------- +void CGlxFetcherContainer::SetTitleL(const TDesC& aTitleText) + { + TRACER("CGlxFetcherContainer::SetTitleL"); + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CleanupStack::PushL(statusPane); + CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + CleanupStack::PushL(titlePane); + // To Store Title and to make sure, Previous Title is only stored once + if (!iPreviousTitle) + { + iPreviousTitle = titlePane->Text()->AllocL(); + } + + // Set the required Title + titlePane->SetTextL( aTitleText ); + CleanupStack::Pop(titlePane); + CleanupStack::Pop(statusPane); + } + +// --------------------------------------------------------------------------- +// SetPreviousTitleL() +// --------------------------------------------------------------------------- +void CGlxFetcherContainer::SetPreviousTitleL() + { + TRACER("CGlxFetcherContainer::SetPreviousTitleL"); + CEikStatusPane* prevStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CleanupStack::PushL(prevStatusPane); + CAknTitlePane* prevTitlePane = ( CAknTitlePane* )prevStatusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + CleanupStack::PushL(prevTitlePane); + + // Restore the Title back of the Calling Application + prevTitlePane->SetTextL( *iPreviousTitle ); + CleanupStack::Pop(prevTitlePane); + CleanupStack::Pop(prevStatusPane); + } + +// ----------------------------------------------------------------------------- +// UpdateTitle +// ----------------------------------------------------------------------------- +// +void CGlxFetcherContainer::UpdateTitleL() + { + TRACER("CGlxFetcherContainer::UpdateTitleL"); + SetTitleL( iTitle); + } + +// ----------------------------------------------------------------------------- +// MediaList +// ----------------------------------------------------------------------------- +// +MGlxMediaList& CGlxFetcherContainer::MediaList() + { + TRACER("CGlxFetcherContainer::MediaList"); + return *iMediaList; + } + +// ----------------------------------------------------------------------------- +// HandleSizeChange +// ----------------------------------------------------------------------------- +// +void CGlxFetcherContainer::HandleSizeChangeL ( ) + { + TRACER("CGlxFetcherContainer::HandleSizeChangeL"); + SetTitleL(iTitle); + TRect rect; + if(iHgGrid) + { + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); + iHgGrid->InitScreenL(rect); + } + if ( iBgContext ) + { + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EApplicationWindow, rect); + iBgContext->SetRect( rect ); + } + } + +// ----------------------------------------------------------------------------- +// MopSupplyObject +// ----------------------------------------------------------------------------- +// +TTypeUid::Ptr CGlxFetcherContainer::MopSupplyObject(TTypeUid aId) + { + TRACER("CGlxFetcherContainer::MopSupplyObject"); + if (iBgContext) + { + return MAknsControlContext::SupplyMopObject(aId, iBgContext ); + } + return CCoeControl::MopSupplyObject(aId); + } + +//END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/src/glxfetcherdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/src/glxfetcherdialog.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,412 @@ +/* +* Copyright (c) 2008-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: Creates a Fetcher Dialog +* +*/ + + + +// EXTERNAL INCLUDES +#include +#include +#include // for CEikDialog +#include +#include +#include +#include +#include // For VerifySelectionL() + +#include +#include +#include // Logging macros +#include +#include //command ids + +#include // MGlxMediaList, CMPXCollectionPath + +#include +#include + +// CLASS HEADER +#include // FOR GETTING VIEW ID AND RESOURCE ID +#include "glxfetcherdialog.h" +#include "glxfetchercontainer.h" +#include "glxfetcher.hrh" + +#define GetAppUi() (dynamic_cast(iEikonEnv->EikAppUi())) +const TInt KControlId = 1; + +//----------------------------------------------------------------------------- +// C++ default constructor. +//----------------------------------------------------------------------------- +inline CGlxFetcherDialog::CGlxFetcherDialog( + CDesCArray& aSelectedFiles, + MMGFetchVerifier* aVerifier, + TGlxFilterItemType aFilterType, + const TDesC& aTitle, + TBool aMultiSelectionEnabled) + : iSelectedFiles( aSelectedFiles ), + iVerifier( aVerifier ), + iFilterType( aFilterType ), + iTitle( aTitle ), + iMultiSelectionEnabled(aMultiSelectionEnabled) + { + TRACER("CGlxFetcherDialog::CGlxFetcherDialog"); + // No implementation required + } + +//----------------------------------------------------------------------------- +// Two-phased constructor. +//----------------------------------------------------------------------------- +CGlxFetcherDialog* CGlxFetcherDialog::NewL(CDesCArray& aSelectedFiles, + MMGFetchVerifier* aVerifier, TGlxFilterItemType aFilterType , + const TDesC& aTitle, TBool aMultiSelectionEnabled ) + { + TRACER("CGlxFetcherDialog::NewL"); + CGlxFetcherDialog* self= + new( ELeave ) CGlxFetcherDialog( + aSelectedFiles, aVerifier, aFilterType, aTitle, aMultiSelectionEnabled ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +CGlxFetcherDialog::~CGlxFetcherDialog() + { + TRACER("CGlxFetcherDialog::~CGlxFetcherDialog"); + if(iFetcherContainer) + { + // Restore the Toolbar as it was in the Calling application + if(GetAppUi()->CurrentFixedToolbar()) // there is Hardware Specific Output for Fixed ToolBar + { + GetAppUi()->CurrentFixedToolbar()->SetToolbarVisibility(ETrue); + } + + TRAP_IGNORE(iFetcherContainer->SetPreviousTitleL()); + } + if (iUiUtility) + { + iUiUtility->Close(); + } + } + +//----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// Create the alfscreenbuffer with a generic buffer screen id +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::ConstructL() + { + TRACER("CGlxFetcherDialog::ConstructL"); + // always first call the base class + CAknDialog::ConstructL( R_MULTISELECT_FETCHER_MENUBAR ); + + // Get the Instance of the toolbar and disable it as it is note required in the Fetcher Application + if(GetAppUi()->CurrentFixedToolbar()) // there is Hardware Specific Output for Fixed ToolBar + { + GetAppUi()->CurrentFixedToolbar()->SetToolbarVisibility(EFalse); + } + // Get the Hitchcock environment. + iUiUtility = CGlxUiUtility::UtilityL(); + iEnv = iUiUtility->Env(); + iFetchUri = EFalse; + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::CreateCustomControlL +//----------------------------------------------------------------------------- +SEikControlInfo CGlxFetcherDialog::CreateCustomControlL(TInt aControlType) + { + TRACER("CGlxFetcherDialog::CreateCustomControlL"); + // Create Carousal control and add it to HUI CCoecontrol + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + + switch( aControlType ) + { + case EFetcherControl : + { + iFetcherContainer = CGlxFetcherContainer::NewL( + iFilterType, iTitle, *this, iMultiSelectionEnabled ); + controlInfo.iControl = iFetcherContainer; // transfers ownership + break; + } + default : + break; + } + return controlInfo; + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::ProcessCommandL +// This processes the events to the OkToExitL +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::ProcessCommandL(TInt aCommandId) + { + TRACER("CGlxFetcherDialog::ProcessCommandL"); + + if( iMenuBar ) + { + iMenuBar->StopDisplayingMenuBar(); + } + switch( aCommandId ) + { + case EAknSoftkeyCancel : + { + TryExitL( aCommandId ); + break; + } + case EAknSoftkeySelect : + case EGlxCmdSelectMarked : + case EAknSoftkeyOk : + { + GLX_LOG_INFO("CGlxFetcherDialog::ProcessCommandL() : EAknSoftkeyOk"); + TryExitL( aCommandId ); + break; + } + default : + { + iFetcherContainer->DoExecuteL( aCommandId ); + break; + } + } + } +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::OkToExitL +//----------------------------------------------------------------------------- +TBool CGlxFetcherDialog::OkToExitL(TInt aKeycode) + { + TRACER("CGlxFetcherDialog::OkToExitL"); + GLX_LOG_INFO1("CGlxFetcherDialog::OkToExitL : %d",aKeycode ); + TBool retVal = ETrue; + TBool retrieveUriValue = EFalse; + switch( aKeycode ) + { + case EAknSoftkeySelect : + case EGlxCmdSelectMarked : + case EAknSoftkeyOk : + case EAknCmdOpen : + { + // Retreives the uri's of the selected files and verifies if it is a + // supported format + if (!iFetchUri) + { + iFetchUri = ETrue; + retrieveUriValue = iFetcherContainer->RetrieveUrisL(iSelectedFiles, iFetchUri); + if ( iVerifier && !iVerifier->VerifySelectionL( &iSelectedFiles ) ) + { + iSelectedFiles.Reset(); + retVal = EFalse; + } + if (!retrieveUriValue) + { + retVal = EFalse; + } + if (iMultiSelectionEnabled) + { + iFetcherContainer->DoExecuteL(EGlxCmdEndMultipleMarking); + } + } + else + { + // if uri is being fetched then do not set the return value true, else it would cause + // Destructor of Dialog to be called and result in a crash when OKtoExitL is called multiple times. + retVal = EFalse; + } + break; + } + case EAknSoftkeyCancel : // exit dialog + case EAknCmdExit : + { + break; + } + case EAknCmdMark: + case EAknSoftkeyMark: + { + if (iMultiSelectionEnabled) + { + if(iUiUtility->IsPenSupported()) + { + //Since the MSK is disabled we always get EAknCmdMark + //when we select msk hardkey in touch phone, so we need + //to toggle between mark/unmark on the same hardkey event + if (!iMarkStarted) + { + iFetcherContainer->DoExecuteL(EGlxCmdStartMultipleMarking); + iMarkStarted = ETrue; + } + else + { + MGlxMediaList& mediaList = iFetcherContainer->MediaList(); + TInt focusIdx = mediaList.FocusIndex(); + if ( mediaList.IsSelected(focusIdx) ) + iFetcherContainer->DoExecuteL(EAknCmdUnmark); + else + iFetcherContainer->DoExecuteL(EAknCmdMark); + } + } + else + { + if (!iMarkStarted) + { + iFetcherContainer->DoExecuteL(EGlxCmdStartMultipleMarking); + iMarkStarted = ETrue; + } + else + { + iFetcherContainer->DoExecuteL(EAknCmdMark); + } + } + } + retVal = EFalse; + break; + } + case EAknCmdUnmark: + case EAknSoftkeyUnmark: + { + if (iMultiSelectionEnabled) + { + iFetcherContainer->DoExecuteL(EAknCmdUnmark); + + //@ fix for ELWU-7RA7NX + //@ Reset the flag on no selection, else it'll not pass the events to container for + //@ EGlxCmdStartMultipleMarking case. + MGlxMediaList& mediaList = iFetcherContainer->MediaList() ; + if ( mediaList.SelectionCount() <= 0 ) + { + iMarkStarted = EFalse; + } + + HBufC* mskTextMark = StringLoader::LoadLC( R_GLX_MARKING_MARK ); + HBufC* rskTextCancel = StringLoader::LoadLC( R_GLX_SOFTKEY_CANCEL ); + iUiUtility->ScreenFurniture()->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdMark, 0, *mskTextMark); + iUiUtility->ScreenFurniture()->ModifySoftkeyIdL( + CEikButtonGroupContainer::ERightSoftkeyPosition, + EAknSoftkeyCancel, 0, *rskTextCancel); + CleanupStack::PopAndDestroy(rskTextCancel); + CleanupStack::PopAndDestroy(mskTextMark); + } + retVal = EFalse; + break; + } + default : + break; + } + return retVal; + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::SizeChanged +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::SizeChanged() + { + TRACER("CGlxFetcherDialog::SizeChanged"); + if (iFetcherContainer) + { + TRAP_IGNORE (iFetcherContainer->HandleSizeChangeL()); + } + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::PreLayoutDynInitL +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::PreLayoutDynInitL() + { + TRACER("CGlxFetcherDialog::PreLayoutDynInitL"); + CreateLineByTypeL( KNullDesC, KControlId, EFetcherControl, NULL ); + } +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::PostLayoutDynInitL +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::PostLayoutDynInitL() + { + TRACER("CGlxFetcherDialog::PostLayoutDynInitL"); + + // Create and Display Grid widget + iFetcherContainer->CreateAndDisplayGridL(); + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::DynInitMenuPaneL +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::DynInitMenuPaneL( + TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) + { + TRACER("CGlxFetcherDialog::DynInitMenuPaneL"); + // No Implementation + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::OfferKeyEventL +//----------------------------------------------------------------------------- +TKeyResponse CGlxFetcherDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) + { + TRACER("CGlxFetcherDialog::OfferKeyEventL"); + TKeyResponse response = EKeyWasNotConsumed; + response = iFetcherContainer->OfferKeyEventL(aKeyEvent,aType); + + if(response == EKeyWasNotConsumed) + response = CAknDialog::OfferKeyEventL(aKeyEvent,aType); + + return response; + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::HandlePointerEventL +// Handles all pointer events to the screen. +// Offers the events to the primary display control (container - widgets) +// and also finally calls handlescreenbufferevent and draws the bitmap onto +// the screen +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::HandlePointerEventL( + const TPointerEvent& aPointerEvent) + { + TRACER("CGlxFetcherDialog::HandlePointerEventL"); + CCoeControl::HandlePointerEventL( aPointerEvent ); + iEnv->PrimaryDisplay().HandlePointerEventL( aPointerEvent ); + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::HandleDoubleTapEvent +// Callback from the container for double tap events +// Offers the event from container to Dialog +//----------------------------------------------------------------------------- +void CGlxFetcherDialog::HandleDoubleTapEventL(TInt aCommandId) + { + TRACER("CGlxFetcherDialog::HandleTapEvent"); + Extension()->iPublicFlags.Set(CEikDialogExtension::EDelayedExit); + ProcessCommandL(aCommandId); + Extension()->iPublicFlags.Clear(CEikDialogExtension::EDelayedExit); + } + +//----------------------------------------------------------------------------- +// CGlxFetcherDialog::CallCancelFetcherL +// This function will be called from CGlxFetcher::CancelFetcherL +// This will ensure exit of fetcher dialog & fetcher app +//----------------------------------------------------------------------------- + +void CGlxFetcherDialog::CallCancelFetcherL(TInt aCommandId) + { + TRACER("CGlxFetcherDialog::CallCancelFetcherL"); + TryExitL(aCommandId); + } +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/fetcher/src/glxfetcherproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/fetcher/src/glxfetcherproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + +// INCLUDE FILES + +#include + +#include "glxfetcher.hrh" //to get UID's +#include "glxfetcher.h" // pluigin + +#if ( !defined IMPLEMENTATION_PROXY_ENTRY ) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) } +#endif + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KGlxFetcherImplementationUid,CGlxFetcher::NewL) + }; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2008-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: Build information file for controllers. +* +*/ + + + + +// Controller build files +#include "../fetcher/group/bld.inf" +#include "../collectionmanager/group/bld.inf" diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/imageviewer/bwins/glximageviewermanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/imageviewer/bwins/glximageviewermanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,11 @@ +EXPORTS + ?SetImageUriL@CGlxImageViewerManager@@QAEXABVTDesC16@@@Z @ 1 NONAME ; void CGlxImageViewerManager::SetImageUriL(class TDesC16 const &) + ?Reset@CGlxImageViewerManager@@QAEXXZ @ 2 NONAME ; void CGlxImageViewerManager::Reset(void) + ?ImageUri@CGlxImageViewerManager@@QAEPAVHBufC16@@XZ @ 3 NONAME ; class HBufC16 * CGlxImageViewerManager::ImageUri(void) + ?ImageFileHandle@CGlxImageViewerManager@@QBEAAVRFile64@@XZ @ 4 NONAME ; class RFile64 & CGlxImageViewerManager::ImageFileHandle(void) const + ?InstanceL@CGlxImageViewerManager@@SAPAV1@XZ @ 5 NONAME ; class CGlxImageViewerManager * CGlxImageViewerManager::InstanceL(void) + ?IncrementRefCount@CGlxImageViewerManager@@QAEXXZ @ 6 NONAME ; void CGlxImageViewerManager::IncrementRefCount(void) + ?SetImageFileHandleL@CGlxImageViewerManager@@QAEXABVRFile@@@Z @ 7 NONAME ; void CGlxImageViewerManager::SetImageFileHandleL(class RFile const &) + ?DeleteInstance@CGlxImageViewerManager@@QAEXXZ @ 8 NONAME ; void CGlxImageViewerManager::DeleteInstance(void) + ?IsPrivate@CGlxImageViewerManager@@QAEHXZ @ 9 NONAME ; int CGlxImageViewerManager::IsPrivate(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/imageviewer/eabi/glximageviewermanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/imageviewer/eabi/glximageviewermanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,10 @@ +EXPORTS + _ZN22CGlxImageViewerManager12SetImageUriLERK7TDesC16 @ 1 NONAME + _ZN22CGlxImageViewerManager14DeleteInstanceEv @ 2 NONAME + _ZN22CGlxImageViewerManager17IncrementRefCountEv @ 3 NONAME + _ZN22CGlxImageViewerManager19SetImageFileHandleLERK5RFile @ 4 NONAME + _ZN22CGlxImageViewerManager5ResetEv @ 5 NONAME + _ZN22CGlxImageViewerManager9InstanceLEv @ 6 NONAME + _ZTI22CGlxImageViewerManager @ 7 NONAME + _ZTV22CGlxImageViewerManager @ 8 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/imageviewer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/imageviewer/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Build information file. +* +*/ + + + + +#include + + +PRJ_EXPORTS +../inc/glximageviewermanager.h APP_LAYER_PLATFORM_EXPORT_PATH(glximageviewermanager.h) +../inc/glximageviewermanager.inl APP_LAYER_PLATFORM_EXPORT_PATH(glximageviewermanager.inl) + +PRJ_MMPFILES +glximageviewermanager.mmp + +PRJ_TESTMMPFILES diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/imageviewer/group/glximageviewermanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/imageviewer/group/glximageviewermanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* 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 "../../../inc/glxcapabilities.hrh" +#include "../../../group/glxbuildcommon.mmh" + +TARGET glximageviewermanager.dll +TARGETTYPE DLL +UID 0x1000008d 0x20000A12 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY ALL -TCB // CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glximageviewermanager.cpp + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../inc + +USERINCLUDE ../inc + +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY flogger.lib // For Logging Tracer + +EXPORTUNFROZEN \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/imageviewer/inc/glximageviewermanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/imageviewer/inc/glximageviewermanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,98 @@ +/* + ============================================================================ + Name : glximageviewermanager.h + Author : Hariharan Narayanan + Version : 1.0 + Copyright : /* + * Copyright (c) 2008-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: Image Viewer Manager + * + */ + +/* + * Description : CCGlxImageViewerManager declaration + */ + +#ifndef GLXIMAGEVIEWERMANAGER_H +#define GLXIMAGEVIEWERMANAGER_H + +// INCLUDES +#include +#include + +// CLASS DECLARATION +class RFile; +class RFile64; + +/** + * CGlxImageViewerManager + * + */ +class CGlxImageViewerManager : public CBase + { +public: // Constructors and destructor + + /** + * Destructor. + */ + ~CGlxImageViewerManager(); + + /** + * Singleton constructor. + */ + static CGlxImageViewerManager* InstanceL(); + +public: + IMPORT_C inline HBufC* ImageUri( void ); + IMPORT_C inline RFile64& ImageFileHandle() const; + IMPORT_C inline TBool IsPrivate(); + IMPORT_C inline void IncrementRefCount(); + IMPORT_C void DeleteInstance( void ); + IMPORT_C void SetImageUriL(const TDesC& aFileName); + IMPORT_C void SetImageFileHandleL(const RFile& aFileHandle); + IMPORT_C void Reset(); + +private: + + /** + * Two-phased constructor. + */ + static CGlxImageViewerManager* NewL(); + + /** + * Two-phased constructor. + */ + static CGlxImageViewerManager* NewLC(); + + /** + * Constructor for performing 1st stage construction + */ + CGlxImageViewerManager(); + + /** + * EPOC default constructor for performing 2nd stage construction + */ + void ConstructL(); + + +private: + HBufC* iImageUri; /// image file uri in case of Photos starting as Image viewer + RFile64* iFile; /// Handle to image file which will be shown in Image viewer + TBool iIsPrivate; /// Flag that stores if the image file is in a private folder. ETrue means the image is private, else EFalse + TInt iRefCount; /// Reference count + }; + +#include "glximageviewermanager.inl" + +#endif // GLXIMAGEVIEWERMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/imageviewer/inc/glximageviewermanager.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/imageviewer/inc/glximageviewermanager.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,47 @@ +/* + ============================================================================ + Name : glximageviewermanager.inl + Author : Hariharan Narayanan + Version : 1.0 + Copyright : /* + * Copyright (c) 2008-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: Image Viewer Manager + * + */ + +/* + * Description : CCGlxImageViewerManager declaration + */ + +// INCLUDES + +EXPORT_C HBufC* CGlxImageViewerManager::ImageUri( void ) + { + return iImageUri; + } + +EXPORT_C RFile64& CGlxImageViewerManager::ImageFileHandle() const + { + return *iFile; + } + +EXPORT_C TBool CGlxImageViewerManager::IsPrivate() + { + return iIsPrivate; + } + +EXPORT_C void CGlxImageViewerManager::IncrementRefCount() + { + iRefCount++; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/controllers/imageviewer/src/glximageviewermanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/controllers/imageviewer/src/glximageviewermanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2008-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: CGlxImageViewerManager implementation + * + */ + + +#include "glximageviewermanager.h" + +#include + +#include + +CGlxImageViewerManager* singleInstance = NULL; /// The singleton instance + +EXPORT_C CGlxImageViewerManager* CGlxImageViewerManager::InstanceL() + { + TRACER("CGlxImageViewerManager::InstanceL()"); + if ( NULL != singleInstance ) + { + singleInstance->IncrementRefCount(); + } + else + { + singleInstance = CGlxImageViewerManager::NewLC(); + CleanupStack::Pop( singleInstance ); + } + + return singleInstance; + } + +EXPORT_C void CGlxImageViewerManager::DeleteInstance() + { + TRACER("CGlxImageViewerManager::DeleteInstance()"); + iRefCount--; + + if (0 == iRefCount) + { + delete this; + } + } + +CGlxImageViewerManager::CGlxImageViewerManager() + : iRefCount(0), iImageUri(NULL), iFile(NULL), iIsPrivate(EFalse) + { + TRACER("CGlxImageViewerManager::CGlxImageViewerManager()"); + // No implementation required + } + +CGlxImageViewerManager::~CGlxImageViewerManager() + { + TRACER("CGlxImageViewerManager::~CGlxImageViewerManager()"); + delete iImageUri; + + if( iFile ) + { + iFile->Close(); + } + } + +CGlxImageViewerManager* CGlxImageViewerManager::NewLC() + { + TRACER("CGlxImageViewerManager::NewLC()"); + CGlxImageViewerManager* self = new (ELeave) CGlxImageViewerManager(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +CGlxImageViewerManager* CGlxImageViewerManager::NewL() + { + TRACER("CGlxImageViewerManager::NewLC()"); + CGlxImageViewerManager* self = CGlxImageViewerManager::NewLC(); + CleanupStack::Pop(); // self; + return self; + } + +void CGlxImageViewerManager::ConstructL() + { + TRACER("CGlxImageViewerManager::ConstructL()"); + IncrementRefCount(); + } + +// --------------------------------------------------------------------------- +// SetImageUri +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxImageViewerManager::SetImageUriL(const TDesC& aFileName) + { + TRACER("void CGlxImageViewerManager::SetImageUriL()"); + if ( iImageUri ) + { + delete iImageUri; + iImageUri = NULL; + } + iImageUri = aFileName.AllocL(); + } + +// --------------------------------------------------------------------------- +// Reset +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxImageViewerManager::Reset() + { + TRACER("void CGlxImageViewerManager::Reset()"); + if( iFile ) + { + iFile->Close(); + } + delete iFile; + + if ( iImageUri ) + { + delete iImageUri; + iImageUri = NULL; + } + iIsPrivate = EFalse; + } + +// --------------------------------------------------------------------------- +// SetImageFileHandleL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxImageViewerManager::SetImageFileHandleL(const RFile& aFileHandle) + { + TRACER("void CGlxImageViewerManager::SetImageFileHandleL()"); + _LIT( KPrivateFolder, "\\Private\\" ); // Platsec private folder + TFileName filePath; + User::LeaveIfError( aFileHandle.FullName( filePath ) ); + SetImageUriL( filePath ); + TParsePtrC parse( filePath ); + if( parse.PathPresent() && + parse.Path().Length() > KPrivateFolder().Length() && + parse.Path().Left( KPrivateFolder().Length() ).CompareF( KPrivateFolder ) == 0 ) + { + // File is in private folder; duplicate file handle + iFile = new (ELeave) RFile64; + User::LeaveIfError( iFile->Duplicate( aFileHandle ) ); + iIsPrivate = ETrue; + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/cenrep/200009EE.txt Binary file photosgallery/gallery/cenrep/200009EE.txt has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Battle.jpg Binary file photosgallery/gallery/data/Battle.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image1.jpg Binary file photosgallery/gallery/data/Image1.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image10.jpg Binary file photosgallery/gallery/data/Image10.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image11.jpg Binary file photosgallery/gallery/data/Image11.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image12.jpg Binary file photosgallery/gallery/data/Image12.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image13.jpg Binary file photosgallery/gallery/data/Image13.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image14.jpg Binary file photosgallery/gallery/data/Image14.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image15.jpg Binary file photosgallery/gallery/data/Image15.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image16.jpg Binary file photosgallery/gallery/data/Image16.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image17.jpg Binary file photosgallery/gallery/data/Image17.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image18.jpg Binary file photosgallery/gallery/data/Image18.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image19.jpg Binary file photosgallery/gallery/data/Image19.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image2.jpg Binary file photosgallery/gallery/data/Image2.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image20.jpg Binary file photosgallery/gallery/data/Image20.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image21.jpg Binary file photosgallery/gallery/data/Image21.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image22.jpg Binary file photosgallery/gallery/data/Image22.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image3.jpg Binary file photosgallery/gallery/data/Image3.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image4.jpg Binary file photosgallery/gallery/data/Image4.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image5.jpg Binary file photosgallery/gallery/data/Image5.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image6.jpg Binary file photosgallery/gallery/data/Image6.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image7.jpg Binary file photosgallery/gallery/data/Image7.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image8.jpg Binary file photosgallery/gallery/data/Image8.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/Image9.jpg Binary file photosgallery/gallery/data/Image9.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/abstract5.jpg Binary file photosgallery/gallery/data/abstract5.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem1.jpg Binary file photosgallery/gallery/data/newitem1.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem10.jpg Binary file photosgallery/gallery/data/newitem10.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem11.jpg Binary file photosgallery/gallery/data/newitem11.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem12.jpg Binary file photosgallery/gallery/data/newitem12.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem13.jpg Binary file photosgallery/gallery/data/newitem13.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem14.jpg Binary file photosgallery/gallery/data/newitem14.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem2.jpg Binary file photosgallery/gallery/data/newitem2.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem3.jpg Binary file photosgallery/gallery/data/newitem3.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem4.jpg Binary file photosgallery/gallery/data/newitem4.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem5.jpg Binary file photosgallery/gallery/data/newitem5.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem6.jpg Binary file photosgallery/gallery/data/newitem6.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem7.jpg Binary file photosgallery/gallery/data/newitem7.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem8.jpg Binary file photosgallery/gallery/data/newitem8.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/newitem9.jpg Binary file photosgallery/gallery/data/newitem9.jpg has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/qgn_prop_image_notcreated.png Binary file photosgallery/gallery/data/qgn_prop_image_notcreated.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/text_element_left_cap.png Binary file photosgallery/gallery/data/text_element_left_cap.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/text_element_mid.png Binary file photosgallery/gallery/data/text_element_mid.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/data/text_element_right_cap.png Binary file photosgallery/gallery/data/text_element_right_cap.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Build information for mgallery application. +* +*/ + +PRJ_EXTENSIONS +#ifdef MARM +START EXTENSION app-services/buildstubsis +OPTION SRCDIR ../sis +OPTION SISNAME glxgallery_stub +END +#endif + +PRJ_MMPFILES +glx.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/group/glx.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/group/glx.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project Media gallery +* +*/ + + + + +#include +#include + +#include "../../inc/glxcapabilities.hrh" +#include "../../../photos_plat/gallery_utilities_api/inc/glxgallery.hrh" +#include "../../group/glxbuildcommon.mmh" +#include "../../inc/glxalfhelper.mmh" + +TARGET glx.exe +TARGETTYPE exe +UID 0x100039CE KGlxGalleryApplicationUid + +CAPABILITY GLX_CAPABILITIES + +SOURCEPATH ../src +SOURCE glxapplication.cpp +SOURCE glxappui.cpp +SOURCE glxdocument.cpp + +SOURCEPATH ../group + +START RESOURCE glx.rss +HEADER +TARGETPATH /resource/apps +LANGUAGE_IDS +END // RESOURCE + +USERINCLUDE ../inc +USERINCLUDE ../../viewframework/medialists/inc + +APP_LAYER_SYSTEMINCLUDE + +// System includes from the source tree +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../common/inc +SYSTEMINCLUDE ../../commonui/inc +SYSTEMINCLUDE ../../slideshow/engine/inc +SYSTEMINCLUDE ../../slideshow/utils +SYSTEMINCLUDE ../../viewframework/inc +SYSTEMINCLUDE ../../viewframework/uiutilities/inc +SYSTEMINCLUDE ../../viewframework/plugins/gridviewplugin/inc +SYSTEMINCLUDE ../../viewframework/plugins/fullscreenviewplugin/inc +SYSTEMINCLUDE ../../viewframework/commandhandlers/commandhandlerupnp/inc //Upnp Stop Showing +SYSTEMINCLUDE ../../viewframework/commandhandlers/inc +SYSTEMINCLUDE ../../gallery/loc +SYSTEMINCLUDE ../../controllers/imageviewer/inc + +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY ws32.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib +LIBRARY glxuiutilities.lib +LIBRARY centralrepository.lib +LIBRARY glxupnpcommandhandler.lib //Upnp Stop Showing +LIBRARY glxcommonui.lib // for NGlxZoomStatePublisher::PublishStateL +LIBRARY alfclient.lib // for CAlfEnv +LIBRARY glxmedialists.lib // to get the cache manager handle +LIBRARY apgrfx.lib +LIBRARY glximageviewermanager.lib + + +LIBRARY liwservicehandler.lib //CLiwVariant +LIBRARY glxcommon.lib +LIBRARY efsrv.lib // for RFile + +EPOCHEAPSIZE 0x1000 0xC00000 //HEAP SIZE SET TO DEFAULT MIN OF 4KB AND MAX OF 12 MB +START WINS +END + +START MARM +END + +// DEFFILE ?filename + +START RESOURCE glx_loc.rss +HEADER +TARGETPATH /resource/apps +LANGUAGE_IDS +END // RESOURCE + +START RESOURCE glx_reg.rss +DEPENDS glx_loc.rsg +// Do not change the UID 10003a3f below. +TARGETPATH /private/10003a3f/import/apps +LANGUAGE_IDS +END // RESOURCE + + +LIBRARY oommonitor.lib +LIBRARY aknnotify.lib +LIBRARY hal.lib // HAL, HALData +LIBRARY commonengine.lib // for StringLoader +// MACRO ?macro_name diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/group/glx.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/group/glx.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Media Gallery +* +*/ + + + + +NAME HELL + +#include +#include +#include +#include + +#include + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name { buf=""; } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + cba = r_glx_default_cba; + status_pane = r_glx_default_pane; + } + +// Title Setting for Main View of Photos +RESOURCE STATUS_PANE_APP_MODEL r_glx_default_pane + { + layout = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT; + panes= + { + SPANE_PANE + { + id = EEikStatusPaneUidTitle; + type = EAknCtTitlePane; + resource = r_overriden_app_name; + } + }; + } +RESOURCE TITLE_PANE r_overriden_app_name +{ +txt = ""; +} + +// --------------------------------------------------------- +// +// Default CBA keys +// +// --------------------------------------------------------- +// +RESOURCE CBA r_glx_default_cba + { + buttons= + { + CBA_BUTTON + { + txt=""; + id=EAknSoftkeyForwardKeyEvent; + }, + CBA_BUTTON + { + txt=""; + id=EAknSoftkeyForwardKeyEvent; + }, + CBA_BUTTON + { + txt=""; + id=EAknSoftkeyForwardKeyEvent; + } + }; + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/group/glx_loc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/group/glx_loc.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Media Gallery +* +*/ + + + + + +// RESOURCE IDENTIFIER +NAME GLXA +#include +#include +#include +#include + +#include +#include + + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +RESOURCE LOCALISABLE_APP_INFO r_glx_localisable_app_info + { + short_caption = qtn_lgal_title_main_view; + caption_and_icon = + { + CAPTION_AND_ICON_INFO + { + caption=qtn_lgal_title_main_view; + number_of_icons=1; + icon_file="\\resource\\apps\\glx_aif.mif"; + } + }; + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/group/glx_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/group/glx_reg.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2008-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: Application's registration resource file +* +*/ + + + + +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 KGlxGalleryApplicationUid + +RESOURCE APP_REGISTRATION_INFO + { + app_file="glx"; + // + localisable_resource_file="\\resource\\apps\\glx_loc"; + localisable_resource_id = R_GLX_LOCALISABLE_APP_INFO; + // + hidden = KAppIsHidden; + + datatype_list = + { + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/jpeg"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/jpg"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/jp2"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/tiff"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-wmf"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/ico"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/gif"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/bmp"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-bmp"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-bitmap"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-xbitmap"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-win-bitmap"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-windows-bmp"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/ms-bmp"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-ms-bmp"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/vnd.wap.wbmp"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/png"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-epoc-mbm"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/vnd.nokia.ota-bitmap"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/x-ota-bitmap"; + }, + DATATYPE + { + priority = EDataTypePriorityHigh; + type = "image/mng"; + } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/inc/glxapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/inc/glxapplication.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-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: Symbian application class +* +*/ + + + + +#ifndef C_VIEWERAPPLICATION_H +#define C_VIEWERAPPLICATION_H + +#include + +/** + * CGlxApplication + * + * @lib ViewerApplication + */ +class CGlxApplication : public CAknApplication + { +public: // from CAknApplication + TUid AppDllUid() const; + +protected: // from CAknApplication + CApaDocument* CreateDocumentL(); + }; + +#endif // C_VIEWERAPPLICATION_H diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/inc/glxappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/inc/glxappui.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2008-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: AppUi class +* +*/ + + + + +#ifndef C_GLXWERAPPUI_H +#define C_GLXWERAPPUI_H + +#include +#include +#include +#include +#include "glxiadupdate.h" + +class MMPXViewUtility; +class MMPXCollectionUtility; +class CGlxUiUtility; +class CRepository; +class CGlxNavigationalState; +class CAknGlobalNote; + +class CGlxBackServiceWrapper; + +/** + * CGlxAppUi + * + * @lib ViewerApplication + */ + +class CGlxAppUi : public CAknViewAppUi, public MGlxNavigationalStateObserver + { +public: + CGlxAppUi(); + void ConstructL(); + ~CGlxAppUi(); + +public: // from CAknAppUi + /** + * From CAknAppUi + * Handle user menu selections + * @param aCommand Id of the command + */ + void HandleCommandL(TInt aCommand); + + // From MGlxNavigationalStateObserver + void HandleNavigationalStateChangedL(); + //OOM Method + void HandleApplicationSpecificEventL(TInt aEventType, const TWsEvent& aWsEvent); + + +private: // From CEikAppUi + MCoeMessageObserver::TMessageResponse HandleMessageL( + TUint32 aClientHandleOfTargetWindowGroup, + TUid aMessageUid, const TDesC8& aMessageParameters); + TBool ProcessCommandParametersL(TApaCommand aCommand, + TFileName& aDocumentName, const TDesC8& aTail); + +private: // From CCoeAppUi + + void HandleForegroundEventL( TBool aForeground ); + +private: + enum TEntryType + { + EEntryTypeStartUp = 0, + EEntryTypeFocusGained + }; + + + /** + * Handle an activation message. + * @param aCommand command data sent from the activating application. + * @param aDocumentName image file name data sent from the activating application. + * @param aData Message data from activating application. + */ + void HandleActivationMessageL(const TApaCommand& aCommand, const TFileName& aDocumentName, const TDesC8& aData); + /** + * Handle an activation message. + * @param aData Message data from activating application. + */ + void HandleActivationMessageL(const TDesC8& aData); + /** + * Set activation parameter for startup view, converting to 16-bit + * descriptor used by MPX. + * @param aParam Activation parameter. + */ + void SetActivationParamL(const TDesC8& aParam); + + /** + * Get view scoring ids based on current navigational state + * (using Get in the name since the function does not return anything) + * @param aIns list that will be populated with scoring ids + */ + void GetViewScoringIdsL( RArray& aIds ) const; + + /** + * Get view scoring id for collection plugin + * @param naviState Path to represent navigational state + * @return scoding id + */ + TUid GetViewScoringIdForCollectionPlugin( const CMPXCollectionPath& aNaviState ) const; + + /** + * Get view scoring id for depth in ui hierarchy + * @param naviState Path to represent navigational state + * @return scoding id + */ + TUid ViewScoringIdForNaviStateDepth( const CMPXCollectionPath& aNaviState ) const; + + /** + * Requesting OOM to Free Some Memory, so that photos can Start + * @return Error if Memory Cannot be freed else Error None + */ + TInt OOMRequestFreeMemoryL( TInt aBytesRequested) ; + + /** + * Finds Current Memory Availability And Decides to Send a Request for freeing the memory + * @param aCriticalMemoryRequired Bare Minimum to start photos + * @return Error Code from OOM + */ + TInt ReserveMemoryL(TInt aCriticalMemoryRequired); + + /** + * Finds Current Minimum Required memory to start photos + * @param Type of application invokation + * @return Required Critical Memory + */ + TInt RamRequiredInBytesL(TEntryType aType); + + /** + * @todo: + * Get view scoring id for depth in ui hierarchy + * @param naviState Path to represent navigational state + * @return scoding id + */ + void ReserveMemoryL(TEntryType aType); + + //OOM + /* + *Invoked by the OOM framwork when photos app needs to free memory for other applications. + */ + void StartCleanupL(); + + //OOM + /* + *Invoked by the OOM framwork when photos app needs to free memory for other applications. + */ + void StopCleanupL(); + /** + * To move back to the app which started photossuite when done options->exit from + * within the app. + * @param aMessage exit action from photossuite + */ + void LaunchMmViewL(const TDesC8& aMessage); + + /** + * Check for updates via IAD. + */ + void DoCheckForIADUpdatesL(); + /** + * close photos app. + */ + void ClosePhotosL(); + +private: + MMPXViewUtility* iViewUtility; + + CAknGlobalNote* iGlobalWaitNote; + TInt iNoteId; + HBufC* iFreeMemText; + + /// Singleton that stores gallery's navigational state + CGlxNavigationalState* iNavigationalState; + + /** Optional view plugin UID to activate when the collection is opened */ + TUid iStartupViewUid; + + /** Optional activation parameter for the next view */ + HBufC* iActivationParam; + + TBool iFocusLostLowMemory; + TBool iStartUpSequence; + + ///Ui utility + CGlxUiUtility* iUiUtility; + + /// Central repository entry for app (owned) + CRepository* iRepository; + + CGlxBackServiceWrapper* iBSWrapper; + /** + * IAD updater class + */ + CGlxIadUpdate* iIadUpdate; + + /** + *This flag to chk whether red key has been pressed + */ + TBool iEndKeyPressed; + +}; + + +#endif // C_GLXWERAPPUI_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/inc/glxdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/inc/glxdocument.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-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: Document class +* +*/ + + + + +#ifndef C_GLXDOCUMENT_H +#define C_GLXDOCUMENT_H + +#include + +// Forward references +class CEikApplication; +class MMPXViewUtility; +class CGlxImageViewerManager; + +/** + * CViewerDocument + * + * @lib ViewerApplication + */ +class CGlxDocument : public CAknDocument + { +public: + static CGlxDocument* NewL(CEikApplication& aApp); + static CGlxDocument* NewLC(CEikApplication& aApp); + ~CGlxDocument(); + +public: // from CAknDocument + CEikAppUi* CreateAppUiL(); + +public: // from CEikDocument + void OpenFileL( CFileStore*& aFileStore, RFile& aFile ); + +private: + void ConstructL(); + + CGlxDocument(CEikApplication& aApp); + void ResetDocument(); + +private: + MMPXViewUtility* iViewUtility; + CGlxImageViewerManager* iImageViewerInstance; + }; + +#endif // C_GLXDOCUMENT_H diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/loc/photos.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/loc/photos.loc Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1332 @@ +/* +* Copyright (c) 2007-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: Localisation file for Gallery/Photos application +* +*/ + + + + +/* + The syntax of a logical name entry in this file is the following: + + // d:context description (line 1) + // d:context description (line N) + // l:layout id + // w: + // r:release information + // + #define qtn__?freetext "?text" + + where + "qtn_" starts a logical name. Note: "text_" has been used in + old logical names, but is deprecated. + "?feature/application" is 2-5 lower-case characters and/or numbers + identifying the larger context of the display text. + "?freetext" is the free text portion of the logical name. + It may contain only lower-case letters ('a' to 'z'), numbers + ('0' to '9'), and the underscore ('_'). The total length of + the logical name does must not exceed 50 characters. + "d:" Starts a description line clarifying the entry's context with + information like: + - Is a word a verb gin imperative or is it a noun? (For instance, + what does "Set" mean?) + - What will replace %U (unicode text parameter) or %N (number + parameter) included in texts? (For instance, is it a phone + number or an e-mail address?) + "l:" Starts a layout id information (one line). + "P" and "No" are symbols in LAF's information table + - "P" is parent pane or current pane + - "No" is reference number in table + "r:" Starts a release information: one line indicating in which + gallery increment (NOT RELEASE) the text was used for the first time. + +*/ + +// ----------------------------------------------------------------------------- +// +// Abbreviations +// +// ----------------------------------------------------------------------------- + +// d:UPnP: Universal Plug and Play. A communication technology that is used to show and play digital content and transfer content in home networks. +// d:DRM: Digital Rights Management. DRM is used to control how commercial content can be shared and viewed to protect the interest of content creators. +// d:In English language, "home network" should be shortened to "home net." if the longer version does not fit. + + + +// d:Delete single item confirmation note +// d:%U will be replaced with name of item about to be deleted +// l:popup_note_window +// r:4.0 +// +#define qtn_lgal_note_delete_image "Delete \n%U?" + +// d:Delete multiple items confirmation note +// d:%N will be replaced with count of items about to be deleted +// l:popup_note_window +// r:6.0 +// +#define qtn_lgal_note_delete_items "Delete %N items?" + +// d:Delete a single album or tag (or other container) confirmation note +// d:%U will be replaced with name of the album or tag +// d:about to be deleted +// l:popup_note_window +// r:4.0 +// +#define qtn_lgal_note_delete_container "Delete \n%U? (The files will not be deleted.)" + +// d:Remove single item from album confirmation note +// d:Command doesn't delete original item from gallery +// d:%U will be replaced with name of item about to be removed +// d:When translating this to other languages make sure that +// d:later "Note: the file will not..." part will get translated also. +// l:popup_note_window +// r:6.0 (4.0, but new English) +// +#define qtn_lgal_note_remove_name_album "Remove \n%U from album?(The file will not be deleted.)" + +// d:Remove multiple items from album confirmation note +// d:Command doesn't delete original items from gallery +// d:%N will be replaced with count of items about to be removed from album +// d:When translating this to other languages make sure that +// d:later "Note: the files will not..." part will get translated also. +// l:popup_note_window +// r:6.0 (4.0, but new English) +// +#define qtn_lgal_note_remove_items_album "Remove %N items from album? (The files will not be deleted.)" + +// d:Remove single item from tag confirmation note +// d:Command doesn't delete original item from gallery +// d:%U will be replaced with name of item about to be removed +// d:When translating this to other languages make sure that +// d:later "Note: the file will not..." part will get translated also. +// l:popup_note_window +// r:6.0 +// +#define qtn_lgal_note_remove_name_tag "Remove from tag? (The file will not be deleted.)\n%U " + + +// d:Remove multiple items from album confirmation note +// d:Command doesn't delete original items from gallery +// d:%N will be replaced with count of items about to be removed from album +// d:When translating this to other languages make sure that +// d:later "Note: the files will not..." part will get translated also. +// l:popup_note_window +// r:6.0 +// +#define qtn_lgal_note_remove_items_tag "Remove %N items from tag? (The files will not be deleted.)" + +// d:delete location information note title +// l:popup_note_window +// r:6.0 +// +#define qtn_lgal_note_delete_location "Delete location information? (This cannot be undone)" + +// +// album pop-up texts +// + +// d:New Album option in select album pop-up +// l:list_single_pane_t1 +// r:4.0 +// +#define qtn_lgal_album_create "New Album" + +// d:Query for entering a name in album popup +// l:heading_pane_t1 +// r:6.0 +// +#define qtn_lgal_query_enter_name "Enter name:" + +// d:Default name for a new album +// d:When the end-user creates a new album this string will be used as a default name +// l:query_popup_data_pane/opt1 +// r:4.0 +// +#define qtn_lgal_name_album "Album" + + +// d:If an album already exists the next incremental number is added in the series of default album name. +// l:query_popup_data_pane/opt1 +// r:9.1 +// +#define qtn_lgal_album_create_incr "Album%n" + + +// +// Tag picker popup texts +// + +// d:New tag option in tag picker pop-up +// l:list_single_pane_t1 +// r:6.0 +// +#define qtn_lgal_tag_create "New Tag" + +// d:Default name for a new tag +// d:When the end-user creates a new tag this string will be used as a default name +// l:query_popup_data_pane/opt1 +// r:6.0 +// +#define qtn_lgal_name_tag "Tag" + +// +// Wait and progress notes +// + +// d:Generic progress or wait note text +// d:Shown when device is busy +// l:popup_note_wait_window +// r:4.0 +// +#define qtn_lgal_note_wait_processing "Processing..." + +// +// options menu +// + +// d:Option in Options Menu +// d:Option name for "Adding focused / selected item(s) to an album" +// d:Opens the Select Album pop-up +// l:list_single_pane_t1_cp2 +// r:4.0 +// +#define qtn_lgal_options_add_to_album "Add to album" + +// d:Option in Album list view Options Menu +// d:Option name for Creating a new album. +// l:list_single_pane_t1_cp2 +// r:4.0 +// +#define qtn_lgal_options_new_album "New album" + + +// d:Option in Options Menu +// d:Option name for "delete marked media files or focused media file" +// d:Selecting this option deletes the files phone the phone memory +// d:and memory card. +// l:list_single_pane_t1_cp2 +// r:6.0 +// +#define qtn_lgal_options_delete "Delete" + +// d:Option in Options Menu +// d:Option name for "Edit" submenu title +// l:list_single_pane_t1_cp2/opt3 +// r:4.0 +// +#define qtn_lgal_options_edit "Edit" + +// d:Option in Tile view Options Menu +// d:Move and copy option menu. +// d:This option opens submenu where the Move/Copy commands can be executed. +// l:list_single_pane_t1_cp2/opt3 +// r:4.0 +// +#define qtn_lgal_move_copy "Move and copy" + +// d:Option in Move and copy submenu +// d:Choosing this option allows user to move images or videos to +// d:memory card or phone memory from current memory location +// l:list_single_popup_submenu_pane_t1 +// r:6.0 +// +#define qtn_lgal_options_move "Move" + +// d:Option in Move and copy submenu +// d:Choosing this option allows user to copy images or videos to +// d:memory card or phone memory +// l:list_single_popup_submenu_pane_t1 +// r:6.0 +// +#define qtn_lgal_options_copy "Copy" + + +// d:Option in Options Menu +// d:Option name for "Removing focused/selected item(s) from the album" +// d:This option is available in album tile and album fullscreen views +// l:list_single_pane_t1_cp2 +// r:4.0 +// +#define qtn_lgal_options_remove_from_album "Remove from album" + + +// d:Option in Options Menu +// d:Option name for "Removing focused/selected item(s) from the tag" +// d:This option is available in tags tile view and tags full screen view +// l:list_single_pane_t1_cp2 +// r:4.0 +// +#define qtn_lgal_options_remove_from_tag "Remove from tag" + +// d:Option in Options Menu +// d:Choosing this option will allow the user to give a new name for the +// d:selected file or album +// l:list_single_pane_t1_cp2 +// r:6.0 +// +#define qtn_lgal_options_rename "Rename" + +// d:Submenu in Options Menu +// d:Submenu name for Slide show +// d:opens the Slide show submenu +// l:list_single_pane_t1_cp2 +// r:4.0 +// +#define qtn_lgal_options_slideshow "Slide show" + +// d:Submenu option in slide show Options Menu +// d:Choosing this option opens the slide show settings dialog and allows +// d:the user to change the slide show settings +// l:list_single_popup_submenu_pane_t1 +// r:4.0 +// +#define qtn_lgal_options_slideshow_settings_general "Settings" + + +// d:Submenu in Options Menu +// d:This text is used as submenu title for "use items" submenu +// d:when only one image is selected +// d:Submenu contains commands for using the image for different purposes, such as wallpaper or assign to contact +// l:list_single_pane_t1_cp2/opt3 +// r:4.0 +// +#define qtn_lgal_options_use_image_as "Use image" + +// d:Submenu in Options Menu +// d:This text is used when multiple items are selected (image and video, or images and/or videos) +// d:Submenu contains commands for using the images/videos in various ways. +// l:list_single_pane_t1_cp2/opt3 +// r:4.0 +// +#define qtn_lgal_options_use_items "Use items" + +// d:Submenu in Options Menu +// d:Submenu contains commands for using the video for different purposes, such as ring tone +// l:list_single_pane_t1_cp2/opt3 +// r:4.0 +// +#define qtn_lgal_options_use_video_as "Use video" + + +// d:Option in Options Menu +// d:Choosing this option will enter a mode in which the focused +// d:image or video is shown on a remote display via a wireless link, +// d:as the user navigates from item to item +// l:list_single_popup_submenu_pane_t1 +// r:4.0 +// +#define qtn_lgal_options_show_ext "Show on home network" + +// d:Option in Options Menu +// d:Choosing this option will stop showing items on home network. +// d:(See qtn_lgal_options_show_ext) +// l:list_single_pane_t1_cp2 +// r:4.0 +// +#define qtn_lgal_options_stop_show "Stop showing" + +// d:Option in Options Menu +// d:Choosing this option will copy items to the home network. +// l:list_single_popup_submenu_pane_t1 +// r:6.5 +// +#define qtn_lgal_options_copy_to_home_net "Copy to home network" + +// d:Home network submenu +// d:Choosing this option will invoke the home network submenu +// l:list_single_pane_t1_cp2/opt3 +// r:6.5 +// +#define qtn_lgal_options_home_network "Home network" + +// d:Option in Home network sub menu +// d:Choosing this option will enter a mode in which the focused +// d:image or video is shown on a remote display via a wireless link, +// d:as the user navigates from item to item +// l:list_single_popup_submenu_pane_t1 +// r:6.5 +// +#define qtn_lgal_options_sub_show_ext "Show on home network" + +// d:Option in Home network sub menu +// d:Choosing this option will stop showing items on home network. +// l:list_single_popup_submenu_pane_t1 +// r:6.5 +#define qtn_lgal_options_sub_stop_show "Stop showing" + +// d:Submenu name in Options Menu +// d:This submenu contains different printing options for focused/selected item(s) +// l:list_single_pane_t1_cp2 +// r:4.0 +// +#define qtn_lgal_options_print_menu "Print" + + +// d:Option in Options Menu +// d:This submenu allows user to view and edit the properties +// l:list_single_pane_t1_cp2 +// r:6.0 +// +#define qtn_lgal_options_properties_edit "Edit" + + +// d:Option in Options Menu +// d:This submenu item allows users to show the item on a map +// d:if the item contains location data +// l:list_single_pane_t1_cp2 +// r:6.0 +// +#define qtn_lgal_option_show_on_map "Show on map" + + +// d:Title text when marking mode is set to on in the grid view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_marking_mode "Mark items" + +// d:Title of photos suite main view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_main_view "Photos" + +// d:Title of the grid view showing the items of one month. +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_months "Months" + +// d:Title of months grid view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_month_year "%0U %1U" + +// d:Title of captured grid view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_captured "Captured" + +// d:Title of albums list view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_albums "Albums" + +// d:Title of the favourites album grid view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_favourites "Favourites" + +// d:Title of the tags browser view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_tags "Tags" + +// d:Title of the All collection grid view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_all "All" + +// d:Title of the Captured album grid view +// l:title_pane_t2/opt9 +// r:11.0 +// +#define qtn_lgal_title_my_captured "My Captured" + +// d:Title of details view +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_details "Details" + +// d:Title of the select container multiselection list view when tags are selected +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_select_tags "Select tags" + +// d:Title of the select container multiselection list view when albums are selected +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_select_albums "Select albums" + +// d:Title of the fetcher when only one image has to be selected +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_fetcher_select_image "Select image:" + +// d:Title of the fetcher when only one video has to be selected +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_fetcher_select_video "Select video:" + +// d:Title of the fetcher when more than one images have to be selected +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_fetcher_select_images "Select images:" + +// d:Title of the fetcher when more than one videos have to be selected +// l:title_pane_t2/opt9 +// r:8.0 +// +#define qtn_lgal_title_fetcher_select_videos "Select videos:" + +// d:Title for captured item in photos suite main view +// l:list_logical_template_8_title +// r:8.0 +// +#define qtn_lgal_list_title_captured "Captured" + +// d:Title for months item in photos suite main view +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_list_title_months "Months" + +// d:Title for albums item in photos suite main view +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_list_title_albums "Albums" + +// d:Title for tags item in photos suite main view +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_list_title_tags "Tags" + +// d:Title for downloads item in photos suite main view +// l:list_logical_template_8_title +// r:8.0 +// +#define qtn_lgal_list_title_downloads "Downloads" + +// d:Title for a month item in Months list view. %0U is a +// d:month and %1U is the year.AVKON 3-character month +// d:strings are used to populate %0U. +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_monthlist_title_month_year "%0U %1U" + +// d:Title for favourites item in albums list view +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_list_title_favourites "Favourites" + +// d:Title for All item in photos suite main view +// l:list_double_large_graphic_pane_t1 +// r:11.0 +// +#define qtn_lgal_list_title_all "All" + +// d:Title for the predefined camera albums in the Albums list view. +// d:This folder contains all images captured using the device camera. +// l:list_double_large_graphic_pane_t1 +// r:11.0 +// +#define qtn_lgal_list_title_my_captured "My Captured" + +// d:Number of items (images or videos) in category. +// d:Shown in photos suite main view when captured album category is focused. +// d:Used when no images or videos exist in the category. +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_list_detail_no_img_vid "No images or videos" + +// d:Number of tags and number of items the tag(s) has been added to. +// d:Shown in photos suite main view when tags category is focused. +// d:Used when no tagged items are present. +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_list_detail_no_tagged_items "No tagged images or videos" + +// d:Title field in the details view. +// l:list_double_large_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_details_title "Title" + +// d:Albums field in the details view. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_albums "Albums" + +// d:Tags field in the details view. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_tags "Tags" + +// d:Description field in the details view. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_description "Description" + +// d:Location field in the details view. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_location "Location" + +// d:Resolution field in the details view. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_resolution_title "Resolution" + +// d:Duration field in the details view. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_duration "Duration" + +// d:Usage rights field in the details view. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_detail_drm "Usage rights" + +// d:Resolution of the item +// d:Used in the resolution pane of the details view +// d:%0N is the width of the video/image in pixels and %1N is the height in pixels. +// l:list_logical_template_5_detail +// r:8.0 +// +#define qtn_lgal_details_resolution_detail "%0N x %1N" + +// d:Index of the displayed item among the total number of items +// d:in the previous grid view. +// d:Used in the full screen view. +// l:photos_counter_text +// r:8.0 +// +#define qtn_lgal_item_counter "%0N/%1N" + +// d:Displayed in an empty grid view +// d:Used when a user enter the grid view when no items are present +// l:grid_view_text_empty +// r:8.0 +// +#define qtn_lgal_empty_grid_no_items "No images or videos to display" + +// d:Displayed in an empty cloud view. +// d:Used when a user enter the tag browser view when no tags have been assigned +// d:to any items +// l:grid_view_text_empty +// r:8.0 +// +#define qtn_lgal_empty_tag_browser "No tags added to images or videos" + +// d:Used when user enter months list view when no items +// d:are yet on the device. +// l:list_view_text_empty +// r:8.0 +// +#define qtn_lgal_empty_list_no_captured_items "No captured images or videos" + +// d:Zoom ratio +// l:slider_3_counter_text +// r:8.0 +// +#define qtn_lgal_zoom_ratio "%N %" + +// d:Text prompt to download images in downloads grid. +// d:Used when image download link is present +// l:metadata_pane_2_title +// r:8.0 +// +#define qtn_lgal_grid_meta_download_images "Download images" + +// d:Text prompt to download videos in downloads grid. +// d:Used when video download link is present +// l:metadata_pane_2_title +// r:8.0 +// +#define qtn_lgal_grid_meta_download_videos "Download videos" + +// d:Text to display the number of items assigned with a tag. +// d:Used in tags browser view when more than 1 items are +// d:assigned with a tag. +// l:Deswcc_tb_highlight_text2 +// r:8.0 +// +#define qtn_lgal_tag_popup_multi_items "%N items" + +// d:Text to display the number of items assigned with a tag. +// d:Used in tags browser view when exactly 1 item is assigned +// d:to a tag. +// l:Deswcc_tb_highlight_text2 +// r:8.0 +// +#define qtn_lgal_tag_popup_one_item "1 item" + +// d:No location information note +// l:popup_note_window +// r:8.0 +// +#define qtn_lgal_note_no_location "No location information. Record location by turning on the location setting in Camera." + +// d:Confirmation note shown when the user adds one item to an album +// l:popup_note_window +// r:8.0 +// +#define qtn_lgal_note_added_one_item_album "Added" + +// d:Confirmation note shown when the user adds multiple item to an album +// l:popup_note_window +// r:8.0 +// +#define qtn_lgal_note_added_multi_item_album "Added" + +// d:Confirmation note shown when the user adds one item to an tag +// l:popup_note_window +// r:8.0 +// +#define qtn_lgal_note_added_one_item_tag "Added" + +// d:Confirmation note shown when the user adds multiple item to an tag +// l:popup_note_window +// r:8.0 +// +#define qtn_lgal_note_added_multi_item_tag "Added" + +// d:Tooltip displayed when user focuses on delete icon in the toolbar. +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_delete "Delete " + +// d:Tooltip displayed when user focuses on mark items icon in the toolbar. +// d:Used to turn on the marking mode in grid view +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_mark_items "Mark items" + +// d:Tooltip displayed when user focuses on un mark icon in the toolbar. +// d:Used to stop or turn off the marking mode in grid view +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_unmark_all "Unmark all" + +// d:Tooltip displayed when user focuses on send icon in the toolbar. +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_send "Send" + +// d:Tooltip displayed when user focuses on new album icon in the toolbar. +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_new_album "New album" + +// d:Tooltip displayed when user focuses on play icon in the toolbar. +// d:Used when video item is in focus in the grid view. +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_play "Play " + +// d:Tooltip displayed when user focuses on rename icon in the toolbar. +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_rename "Rename " + +// d:Tooltip displayed when user focuses on start slideshow icon in the toolbar. +// l:toolbar_text_tooltip +// r:8.0 +// +#define qtn_lgal_tooltip_slideshow "Start slideshow" + +// d:Details options menu string. +// d:Used to open details view +// l:list_single_pane_t1_cp2 +// r:8.0 +// +#define qtn_lgal_options_details "Details" + +// d:View options menu string. +// d:Shown in Details view when Usage rights item is focused. +// d:Opens the DRM details view provided by S60 +// l:list_single_pane_t1_cp2 +// r:8.0 +// +#define qtn_lgal_options_view "View" + +// d:View options menu string. +// d:Shown in single line metapane to mark the current focussed image/video as favourite. +// l:list_single_pane_t1_cp2 +// r:11.0 +// +#define qtn_lgal_options_mark_as_favorite "Mark as Favorite" + +// d:View options menu string. +// d:Shown in single line metapane to unmark the current focussed image/video +// d:from being a favourite. +// l:list_single_pane_t1_cp2 +// r:11.0 +// +#define qtn_lgal_options_unmark_as_favorite "UnMark as Favorite" + +// d:Top-level option to open image rotate sub-menu +// l:list_single_pane_t1_cp2/opt3 +// r:8.0 +// +#define qtn_lgal_options_rotate "Rotate" + + +// d:Rotate sub-meu option +// d:Used to rotate the image to left. +// l:list_single_popup_submenu_pane_t1 +// r:8.0 +// +#define qtn_lgal_options_rotate_left "Left" + +// d:Rotate sub-meu option +// d:Used to rotate the image to right. +// l:list_single_popup_submenu_pane_t1 +// r:8.0 +// +#define qtn_lgal_options_rotate_right "Right" + +// d:Slideshow submenu option +// d:Used to start the slide show +// l:list_single_popup_submenu_pane_t1 +// r:8.0 +// +#define qtn_lgal_options_slideshow_play "Play" + +// d:option menu item when video item is focussed. +// d:Used to trigger video player to play the focussed video item. +// l:list_single_pane_t1_cp2 +// r:8.0 +// +#define qtn_lgal_options_play "Play" + +// d:Fullscreen metapane option +// d:Used to open the details view where all the image/video details will be listed +// l:metadata_pane_5_detail +// r:8.0 +// +#define qtn_lgal_metapane_more_details "More details" + +// d:File size shown in metapane +// d:Used to display the file size of the focused item. +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_file_size "File size" + +// d:Details view list option +// d:Date and time of the image/video when it was shot +// l:list_logical_template_5_title +// r:8.0 +// +#define qtn_lgal_details_date_and_time "Date and time" + +// d:Fullscreen option in metapane +// d:Show on map +// l:metadata_pane_6_detail +// r:8.0 +// +#define qtn_lgal_metapane_show_map "Show map" + +// d:image fetcher +// d:If there are no items to show in the image fetcher view, this text is displayed. +// l:grid_view_text_empty +// r:8.0 +// +#define qtn_lgal_empty_grid_no_images "No images to display" + +// d:video fetcher +// d:If there are no items to show in the fetcher view, this text is displayed. +// l:grid_view_text_empty +// r:8.0 +// +#define qtn_lgal_empty_grid_no_videos "No videos to display" + +// d:info note +// d:This information note is shown when the user presses Slideshow toolbar +// d:button and all the items of the container are non-playable items.. +// l:popup_note_window +// r:8.0 +// +#define qtn_lgal_note_no_images_to_play_slideshow "No images to play slideshow" + +// d:Number of items (images or videos) in category. Shown in list view when +// d:camera album, all images and videos and downloads category is focused. +// d:Used when 1 item exists in the category. +// l:list_double_large_graphic_pane_t2 +// r:8.0 +// +#define qtn_lgal_list_detail_one_item "1 item" + +// d:Number of items (images or videos) in category. Shown in list view when +// d:camera album, all images and videos and downloads category is focused. +// d:Used when 0 or more than 1 items exist in the category. +// l:list_double_large_graphic_pane_t2 +// r:8.0 +// +#define qtn_lgal_list_detail_multi_item "%N items" + +// d:the text showing the 'from' month - year 'to' month - year +// d:when highlighting the months item in main menu +// d:Abbreviated month name %0U and full year %1U of oldest item and +// d:Abbreviated month name %2U and full year %3U of newest item +// l:list_double_large_graphic_pane_t2 +// r:8.0 +// +#define qtn_lgal_list_title_month_year "%0U %1U - %2U %3U" + +// d:Number of albums in category. Shown in list view when +// d:albums category is focused. +// d:Used when 1 album exists in the category. +// l:list_double_large_graphic_pane_t2 +// r:8.0 +// +#define qtn_lgal_list_detail_one_alb "1 album" + +// d:Number of albums in category. Shown in list view when +// d:albums category is focused. +// d:Used when 0 or more than 1 albums exist in the category. +// l:list_double_large_graphic_pane_t2 +// r:8.0 +// +#define qtn_lgal_list_detail_multi_alb "%N albums" + +// d:Number of tags in category. Shown in list view when +// d:tags category is focused. +// d:Used when 1 tag exists in the category. +// l:list_double_large_graphic_pane_t2 +// r:8.0 +// +#define qtn_lgal_list_detail_one_tag "1 tag" + +// d:Number of tags in category. Shown in list view when +// d:tags category is focused. +// d:Used when 0 or more than 1 tags exist in the category. +// l:list_double_large_graphic_pane_t2 +// r:8.0 +// +#define qtn_lgal_list_detail_multi_tag "%N tags" + + +// d:Submenu name in Options Menu +// d:This submenu allows user to view tags in alphabetical order +// l:list_single_popup_submenu_pane_t1 +// r:8.0 +// +#define qtn_lgal_options_alphabetical "Alphabetical" + +// d:Submenu name in Options Menu +// d:This submenu allows user to view tags in most used order +// l:list_single_popup_submenu_pane_t1 +// r:8.0 +// +#define qtn_lgal_options_most_used "Most used" + + +// d:Submenu name in Options Menu +// d:This submenu option allows users to add tags to items +// d:Selecting the option opens a tag selection popup +// l:list_single_pane_t1_cp2 +// r:8.0 +// +#define qtn_lgal_options_properties_add_tag "Add tag" + + + +// d:Tooltip for floating tool bar +// d:This option in tool bar enables user to view the details of the particular item +// l:popup_preview_text_window_t1 +// r:8.0 +// +#define qtn_lgal_tooltip_details "Details" + + +// d:Submenu name in Options Menu +// d:This submenu option allows users to hide the toolbar to background +// l:list_single_pane_t1_cp2 +// r:8.0 +// +#define qtn_lgal_options_hide_toolbar "Hide toolbar" + + +// d:Tooltip for floating tool bar +// d:This option in tool bar enables user to add a particular image/video to an album +// l:popup_preview_text_window_t1 +// r:8.0 +// +#define qtn_lgal_tooltip_add_to_album "Add to album" + + +// d:Tooltip for floating tool bar +// d:This option in tool bar enables user to view the image in landscape orientation +// l:popup_preview_text_window_t1 +// r:8.0 +// +#define qtn_lgal_tooltip_view_in_landscape "View in landscape" + + +// d:Tooltip for floating tool bar +// d:This option in tool bar enables user to view the image in potrait orientation +// l:popup_preview_text_window_t1 +// r:8.0 +// +#define qtn_lgal_tooltip_view_in_portrait "View in portrait" + + +// d:Submenu name in Options Menu +// d:This submenu option is seen in tag view +// d:This submenu option opens another menu to enable user to sort the tags +// d:The tags can be sorted in alphabetical order or in the order of most used tag +// l:list_single_pane_t1_cp2/opt3 +// r:8.0 +// +#define qtn_lgal_options_sort "Sort by" + +//----------------------------------------------------------------------------- +// single line metapane strings +//----------------------------------------------------------------------------- +// d:Tooltip displayed when user focuses on favourite button on single line metapane. +// d:This submenu option enables the image to be added into Favourites album when it is not already marked as favourite. +// l:toolbar_text_tooltip +// r:11.0 +// +#define qtn_lgal_toopltip_mark_as_favorite "Mark as favorite" + +// d:Tooltip displayed when user focuses on favourite button on single line metapane. +// d:This submenu option enables the image to be removed from Favourites album when it is already marked as favourite. +// l:toolbar_text_tooltip +// r:11.0 +// +#define qtn_lgal_toopltip_unmark_as_favorite "Unmark as favorite" + +//----------------------------------------------------------------------------- +// Image viewer strings +//----------------------------------------------------------------------------- +// d:Tooltip displayed when user focuses on save icon in the toolbar. +// d:This submenu option enables the current image to be saved +// l:toolbar_text_tooltip +// r:11.0 +// +#define qtn_lgal_tooltip_save "Save" + +// d:Tooltip displayed when user focuses on use-image icon in the toolbar. +// d:This submenu option enables the image to be set as wallpaper, as caller image, and so on +// l:toolbar_text_tooltip +// r:11.0 +// +#define qtn_lgal_tooltip_use_image "Use image" + +// d:Information note displayed if the selected image cannot be shown in imageviewer +// l:popup_note_window +// r:11.0 +// +#define qtn_lgal_format_unknown "Unable to open image" + +// d:Confimation note displayed if Image Viewer has been opened after +// downloading/receiving image and user has not saved the same image before backstepping +// %U will be replaced with name of image +// l:popup_note_window +// r:11.0 +// +#define qtn_lgal_query_conf_save_downloaded "%U has not been saved. Save now ?" + +// d:Confimation note displayed if the user selects options-->use image / toolbar-->use image before image has been saved +// downloading/receiving image and user has not saved the same image before backstepping +// %U will be replaced with name of image +// l:popup_note_window +// r:11.0 +// +#define qtn_lgal_query_conf_save_before_using "%U needs to be saved before this operation. Save now?" + +// d:Confimation note displayed when the image is saved +// l:popup_note_window +// r:11.0 +// +#define qtn_lgal_note_file_saved_to "File saved to Photos" + +//----------------------------------------------------------------------------- +// Photos-on-maps strings +//----------------------------------------------------------------------------- +// d:Title of the grid view showing the photos selected from a map. +// l:title_pane_t2/opt9 +// r:11.0 +// +#define qtn_lgal_title_photos_from_map "Photos from Map" + +// d:Tooltip of show-grid button on photos-on-map view +// d:When selected, photos currently plotted on the map will be displayed in a grid view. +// l:toolbar_text_tooltip +// r:11.0 +// +#define qtn_lgal_tooltip_show_grid "Show grid" + +// d:Tooltip of show-world-view button +// d:When selected, world view of the map is displayed. This provides a quick way of zooming out to the top level. +// l:toolbar_text_tooltip +// r:11.0 +// +#define qtn_lgal_tooltip_show_world_view "Show world view" + +// d:Tooltip of return-to-photos button +// d:When selected, control goes back to the photos app location, more specifically to the location from where map was launched. +// l:toolbar_text_tooltip +// r:11.0 +// +#define qtn_lgal_tooltip_return_to_photos "Return to Photos" + +// d:Option in Options menu +// d:When selected, photos currently plotted on the map will be displayed in a grid view. +// l:list_single_pane_t1_cp2 +// r:11.0 +// +#define qtn_lgal_options_show_grid "Show grid" + +// d:Option in Options menu +// d:When selected, world view of the map is displayed. This provides a quick way of zooming out to the top level. +// l:list_single_pane_t1_cp2 +// r:11.0 +// +#define qtn_lgal_options_show_world_view "Show world view" + +// d:Option in Options menu +// d:When selected, control goes back to the photos app location, more specifically to the location from where map was launched. +// l:list_single_pane_t1_cp2 +// r:11.0 +// +#define qtn_lgal_options_return_to_photos "Return to photos" + +//----------------------------------------------------------------------------- +// Photos sorted by location +//----------------------------------------------------------------------------- +// d:Name of the Places collection shown in Photos main view +// l:list_double_large_graphic_pane_t1 +// r:11.0 +// +#define qtn_lgal_list_title_places "Places" + +// d:Subtitle for Places collection when only one Place is present +// l:list_double_large_graphic_pane_t2 +// r:11.0 +// +#define qtn_lgal_list_detail_one_cty "1 city" + +// d:Subtitle for Places collection when several Places is present +// %N% will be replaced with the number of places present +// l:list_double_large_graphic_pane_t2 +// r:11.0 +// +#define qtn_lgal_list_detail_multi_cty "%N cities" + +// d:Subtitle for Places collection when no itmes with location info is present +// l:list_double_large_graphic_pane_t2 +// r:11.0 +// +#define qtn_lgal_list_detail_no_items_with_places "No images or videos" + +// d:Title of the Places list view +// l:title_pane_t2/opt9 +// r:11.0 +// +#define qtn_lgal_title_places "Places" + +//----------------------------------------------------------------------------- +// Slideshow related strings +//----------------------------------------------------------------------------- +// +// d:slideshow settings view title text +// l:title_pane_t2/opt9 +// r:4.0 +// +#define qtn_lgal_view_slideshow_settings_title_general "Slide show settings" + +// +// d:Direction Setting item text +// l:list_setting_pane_t1 +// r:8.0 +// +#define qtn_lgal_slideshow_settings_order "Slideshow order" + +// +// d:slideshow play order "old to new" +// l:list_set_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_slideshow_settings_older_to_newer "From older to newer" + +// +// d:slideshow play order "new to old" +// l:list_set_graphic_pane_t1 +// r:8.0 +// +#define qtn_lgal_slideshow_settings_newer_to_older "From newer to older" + +// +// d:Music Setting item text +// l:list_setting_pane_t1 +// r:4.0 +// +#define qtn_lgal_slideshow_settings_music "Music" + +// +// d:slideshow music settings 'on' text +// l:list_set_graphic_pane_t1 +// r:4.0 +// +#define qtn_lgal_slideshow_settings_music_on "On" + +// +// d:slideshow music settings 'off' text +// l:list_set_graphic_pane_t1 +// r:4.0 +// +#define qtn_lgal_slideshow_settings_music_off "Off" + +// d:Track Setting item text +// l:list_setting_pane_t1 +// r:4.0 +// +#define qtn_lgal_slideshow_settings_track "Track" + +// +// d:slideshow settings no tracks available text +// l:list_set_graphic_pane_t1 +// r:4.0 +// +#define qtn_lgal_slideshow_settings_track_none "None" + +// +// d:slideshow setting transition text, to select an effect that is shown for images during the slide show +// l:list_setting_pane_t1 +// r:6.0 +// +#define qtn_lgal_slideshow_settings_transition "Transition" + +// +// d:slideshow transition setting "fade" or "cross dissolve" or "cross fade", representing a +// d:transition in which the next image is smoothly faded over to replace the currently shown image, +// d:from transparent to fully opaque. +// d:Selected from qtn_lgal_slideshow_settings_transition setting. +// l:list_set_graphic_pane_t1 +// r:6.0 +// +#define qtn_lgal_slideshow_settings_transition_xdissolve "Cross dissolve" + +// d:slideshow transition setting zoom and pan text, representing simultaneous zooming and panning of items in slideshow +// d:Selected from qtn_lgal_slideshow_settings_transition setting. +// l:list_set_graphic_pane_t1 +// r:6.0 +// +#define qtn_lgal_slideshow_settings_transition_kenburns "Zoom and pan" + +// d:Select track dialog title (Fetcher title) +// d:User can select music file also known as track using this dialog +// l:popup_query_data_window +// r:4.0 +// +#define qtn_lgal_popup_select_track "Select track:" + +// d:note that is shown if user starts the slide show but selected music track no longer exists +// l:popup_note_window/opt2 +// r:4.0 +// +#define qtn_lgal_note_slideshow_track "Music track does not exist" + +// d:Confirmation note +// d:This note is shown if the user tries to set the 'Music' setting +// d:to 'On' but has not yet defined a music track. +// l:popup_note_window/opt2 +// r:4.0 +// +#define qtn_lgal_note_track_define "No track defined. Define now?" + +// +// d:Note text for invalid drm rights +// l:popup_note_window/opt2 +// r:4.0 +// +#define qtn_lgal_note_slideshow_drm "Track rights are not valid. Music will not play" + +// d:Tempo setting item. The value of this settings item is used as the delay between each slide in the slide show. +// l:list_setting_pane_t1 +// r:4.0 +// +#define qtn_lgal_slideshow_settings_delay_slides "Delay between slides" + +// +// d:slideshow delay text slow setting text +// d:This setting is accessible via qtn_lgal_slideshow_settings_delay_slides option +// l:setting_slider_graphic_pane_t1 +// r:6.0 +// +#define qtn_lgal_slideshow_settings_delay_slow "Slow" + +// +// d:slideshow delay text fast setting text +// d:This setting is accessible via qtn_lgal_slideshow_settings_delay_slides option +// l:setting_slider_graphic_pane_t2 +// r:6.0 +// +#define qtn_lgal_slideshow_settings_delay_fast "Fast" + +// +// d:slideshow music playback's volume percentage +// d:This text is shown when the user adjusts the music volume +// l:slider_3_counter_text +// r:6.0 +// +#define qtn_lgal_slideshow_volume_percentage "%N%" + + +//----------------------------------------------------------------------------- +// Slideshow soft keys +//----------------------------------------------------------------------------- + +// +// d:Softkey text for continuing slide show +// l:control_pane_t1/opt7 +// r:4.0 +// +#define qtn_lgal_slideshow_softkey_continue "Continue" + +// +// d:Softkey text for ending slide show +// l:control_pane_t1/opt7 +// r:4.0 +// +#define qtn_lgal_slideshow_softkey_end "End" diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/rom/gallery.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/rom/gallery.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2008-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: (ROM) Image description file for Media gallery +* +*/ + + + + +#ifndef GLX_IBY +#define GLX_IBY + +#include + +S60_APP_EXE( viewer.exe ) +// S60_APP_AIF_ICONS( ?myapp ) +// S60_APP_AIF_RSC( ?myapp ) +// SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, ?myapp ) + +// DLLs +// file=\epoc32\release\armv5\urel\viewer.exe sys\bin\viewer.exe +// ABI_DIR\BUILD_DIR\?myapp_engine_1.dll SHARED_LIB_DIR\?myapp_engine_1.dll +// file=ABI_DIR\BUILD_DIR\?myapp_engine_2.dll SHARED_LIB_DIR\?myapp_engine_2.dll + +// configuration files +// data=\epoc32\data\c\private\?uid3\?inifile.ini private\?uid3\?inifile.ini +// data=\epoc32\data\c\private\?uid3\?datafile.dat private\?uid3\?datafile.dat +// data=DATAZ_\RESOURCE_FILES_DIR\?myapp.rsc RESOURCE_FILES_DIR\?myapp.rsc +data=\epoc32\data\z\private\10003a3f\import\apps\Viewer_reg.rsc private\10003a3f\import\apps\Viewer_reg.rsc +data=DATAZ_\RESOURCE_FILES_DIR\Viewer_loc.Rsc RESOURCE_FILES_DIR\Viewer_loc.Rsc +data=DATAZ_\RESOURCE_FILES_DIR\Viewer.Rsc RESOURCE_FILES_DIR\Viewer.Rsc +//data=\epoc32\data\z\private\10003a3f\import\apps\Viewer_reg.rsc private\10003a3f\import\apps\Viewer_reg.rsc +//data=\epoc32\data\z\resource\apps\Viewer_loc.Rsc resource\apps\Viewer_loc.Rsc +//data=\epoc32\data\z\resource\apps\Viewer.Rsc resource\apps\Viewer.Rsc + +// AUTO-BITMAP must be used and only used for MBM-files for file +// compression. Example: +AUTO-BITMAP=ZSYSTEM\apps\?myapp\?myapp.mbm system\apps\?myapp\?myapp.mbm + +// ECOM plugin +// ECOM_PLUGIN( ?myplugin.dll, ?myplugin.rsc ) +// DLLs that are also part of the plugin +// file=ABI_DIR\BUILD_DIR\?myplugin_dll_1.dll SHARED_LIB_DIR\?myplugin_dll_1.dll +// file=ABI_DIR\BUILD_DIR\?myplugin_dll_2.dll SHARED_LIB_DIR\?myplugin_dll_2.dll + +// STUB_SIS File +data=ZSYSTEM\install\glxgallery_stub.SIS System\Install\glxgallery_stub.SIS +#endif // GLX_IBY diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/RDTest_02.der Binary file photosgallery/gallery/sis/RDTest_02.der has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/RDTest_02.key --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/sis/RDTest_02.key Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC/TDP7KKIaf5+uW4OD2iVZuUMC2a+SeQTjf6srlKcOm+CpPNXn +uLNm/8fdEnyOIuRXPRKmqhs1n0JkxEGHynELWMTuKXbQx9SRAGUXzyneGn+IJNnO +vOKHWgKCouX2hfI8rtkdqJpqmO460gGsMgw+lsbeyWyW9lnfLxq+ZC7sqQIDAQAB +AoGBALmUWZE8GBaQ3P4u9WUCSd3DJkkrmXIFSULSZeH/chlwCwDjbbhArHothVzo +REE3hEFFlERvHbplZ+mNouzy7boduvgUzbksGrbGMLJ2qO1GzWWVwV+GzOWKd3ss +/98Gwoy5R8pjnkqUE2wP1iJFw0FjvUTKcYv/z6t3LLJ0CsoBAkEA+c7ixvsviQ3J +s0INytCKU2bf8fqFQJi1VI82ukxNsujGTQ9upVSjuvqPvWyDvvTdrUBHqO+3qPut +sEh01Q8aiQJBAMQKDJPVRu4ud3mwUfEavzL5EjqwG1k9VCNGYsT4FwtrHcxu1oP/ +pk6M3rIZukqomoEEnHWPMwhrK3fhBqi0OSECQQDr40VXege4FnH5OI2Hj4afHMyp +VdQQXGMWFyopnzXblFz0lXb43cTCIiorR9XcMqNFHybLypkWE5o+lRzlt55pAkBQ +P/zeF5Sts//cpL0mgdh7OVKpC6ZmZaCnwAx2rUhhuDu+kDDoYCLoTOps5fNI1LRK +1GRoC3LMo3Jr5IYhUYWBAkBpCpN6k4JU/mszq98EojHerQNxk8sPqvQKUzTutohT +1gLX9yepGayB/TtT2EEJDkWOlnTy/dvN6W3vzbJYz97x +-----END RSA PRIVATE KEY----- diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/createsis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/sis/createsis.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Batch file to create sis file for photos application +rem + +call makesis glxgallery.pkg +call signsis -s glxgallery.sis glxgallery.sisx RDTest_02.der RDTest_02.key \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/createsis_udeb.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/sis/createsis_udeb.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Batch file to create sis file for udeb +rem + +call makesis glxgallery_udeb.pkg +call signsis -s glxgallery_udeb.sis glxgallery_udeb.sisx RDTest_02.der RDTest_02.key \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/glxgallery.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/sis/glxgallery.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,179 @@ +; +; Copyright (c) 2008 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: Package file for project Gallery +; + +; -------- general -------- + +; Languages +&EN + +; Package header +#{"Photos"},(0x200009EE),9,20,0,TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Dependency for S60 3.0 +[0x101F7961],0,0,0,{"Series60v3.0"} + +; -------- files -------- + +;; ui files + +"\epoc32\release\armv5\urel\glx.exe"-"!:\sys\bin\glx.exe" +"\epoc32\data\z\private\10003a3f\import\apps\glx_reg.rsc"-"!:\private\10003a3f\import\apps\glx_reg.rsc" +"\epoc32\data\z\resource\apps\glx_loc.Rsc"-"!:\resource\apps\glx_loc.Rsc" +"\epoc32\data\z\resource\apps\glx.Rsc"-"!:\resource\apps\glx.Rsc" + + +"\epoc32\data\z\resource\apps\glxicons.mif" -"!:\resource\apps\glxicons.mif" +"\epoc32\data\z\resource\apps\glx_aif.mif" -"!:\resource\apps\glx_aif.mif" + + +;; language-dependent resource files + +;; engines + + + +"\epoc32\release\armv5\urel\glxmetadatadialog.dll" -"!:\sys\bin\glxmetadatadialog.dll" +"\epoc32\data\Z\resource\apps\glxmetadatadialog.rsc" -"!:\resource\apps\glxmetadatadialog.rsc" + +"\epoc32\release\armv5\urel\glxcloudview.dll" -"!:\sys\bin\glxcloudview.dll" +"\epoc32\release\armv5\urel\glxtagsbrowserviewplugin.dll" -"!:\sys\bin\glxtagsbrowserviewplugin.dll" +"\epoc32\data\Z\resource\plugins\glxtagsbrowserviewplugin.rsc" -"!:\resource\plugins\glxtagsbrowserviewplugin.rsc" +"\epoc32\data\Z\resource\apps\glxtagsbrowserview.RSC" -"!:\resource\apps\glxtagsbrowserview.RSC" +"\epoc32\release\armv5\urel\glxupnpcommandhandler.dll" -"!:\sys\bin\glxupnpcommandhandler.dll" +"\epoc32\release\armv5\urel\glxcollectionplugintags.dll" -"!:\sys\bin\glxcollectionplugintags.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionplugintags.rsc" -"!:\resource\plugins\glxcollectionplugintags.rsc" +"\epoc32\data\Z\resource\plugins\glxplugintags.rsc" -"!:\resource\plugins\glxplugintags.rsc" +"\epoc32\release\armv5\urel\glxtexturemanager.dll" -"!:\sys\bin\glxtexturemanager.dll" +"\epoc32\release\armv5\urel\glxfetcher.dll" -"!:\sys\bin\glxfetcher.dll" +"\epoc32\data\Z\resource\plugins\glxfetcher.rsc" -"!:\resource\plugins\glxfetcher.rsc" +"\epoc32\data\Z\resource\apps\glxfetcherdialog.rsc" -"!:\resource\apps\glxfetcherdialog.rsc" +"\epoc32\release\armv5\urel\glxcollectionmanager.dll" -"!:\sys\bin\glxcollectionmanager.dll" +"\epoc32\release\armv5\urel\glxviewbase.dll" -"!:\sys\bin\glxviewbase.dll" +"\epoc32\data\z\resource\apps\glxviewbase.rsc" -"!:\resource\apps\glxviewbase.rsc" +"\epoc32\release\armv5\urel\glxcommandhandlerbase.dll" -"!:\sys\bin\glxcommandhandlerbase.dll" +"\epoc32\release\armv5\urel\glxcommoncommandhandlers.dll" -"!:\sys\bin\glxcommoncommandhandlers.dll" +"\epoc32\data\Z\resource\apps\glxcommoncommandhandlers.rsc" -"!:\resource\apps\glxcommoncommandhandlers.rsc" +"\epoc32\release\armv5\urel\glxcommandhandlermarking.dll" -"!:\sys\bin\glxcommandhandlermarking.dll" +"\epoc32\release\armv5\urel\glxcommandhandlerdrm.dll" -"!:\sys\bin\glxcommandhandlerdrm.dll" +"\epoc32\release\armv5\urel\glxcommandhandlermoreinfo.dll" -"!:\sys\bin\glxcommandhandlermoreinfo.dll" +"\epoc32\data\z\resource\apps\glxcommandhandlermarking.rsc" -"!:\resource\apps\glxcommandhandlermarking.rsc" +"\epoc32\release\armv5\urel\glxcommon.dll" -"!:\sys\bin\glxcommon.dll" +"\epoc32\release\armv5\urel\glximageviewermanager.dll" -"!:\sys\bin\glximageviewermanager.dll" +"\epoc32\release\armv5\urel\glxcommonui.dll" -"!:\sys\bin\glxcommonui.dll" +"\epoc32\release\armv5\urel\shwslideshowengine.dll" -"!:\sys\bin\shwslideshowengine.dll" +"\epoc32\data\Z\resource\apps\shwslideshowengine.rsc" -"!:\resource\apps\shwslideshowengine.rsc" +"\epoc32\release\armv5\urel\shwslideshowviewplugin.dll" -"!:\sys\bin\shwslideshowviewplugin.dll" +"\epoc32\data\Z\resource\plugins\shwslideshowviewplugin.rsc" -"!:\resource\plugins\shwslideshowviewplugin.rsc" +"\epoc32\data\Z\resource\apps\shwslideshowview.rsc" -"!:\resource\apps\shwslideshowview.rsc" +"\epoc32\release\armv5\urel\shwsettingsplugin.dll" -"!:\sys\bin\shwsettingsplugin.dll" +"\epoc32\data\Z\resource\plugins\shwsettingsplugin.rsc" -"!:\resource\plugins\shwsettingsplugin.rsc" +"\epoc32\data\Z\resource\apps\shwsettingsdialog.rsc" -"!:\resource\apps\shwsettingsdialog.rsc" +"\epoc32\release\armv5\urel\glxthumbnailcreator.dll" -"!:\sys\bin\glxthumbnailcreator.dll" +"\epoc32\release\armv5\urel\glxdatasourcemanager.dll" -"!:\sys\bin\glxdatasourcemanager.dll" +"\epoc32\release\armv5\urel\glxdatasourcemde.dll" -"!:\sys\bin\glxdatasourcemde.dll" +"\epoc32\data\Z\resource\plugins\glxdatasourcemde.rsc" -"!:\resource\plugins\glxdatasourcemde.rsc" +"\epoc32\release\armv5\urel\glxcollectionpluginalbums.dll" -"!:\sys\bin\glxcollectionpluginalbums.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginalbums.rsc" -"!:\resource\plugins\glxcollectionpluginalbums.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginalbums.rsc" -"!:\resource\plugins\glxpluginalbums.rsc" +"\epoc32\release\armv5\urel\glxcollectionpluginall.dll" -"!:\sys\bin\glxcollectionpluginall.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginall.rsc" -"!:\resource\plugins\glxcollectionpluginall.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginall.rsc" -"!:\resource\plugins\glxpluginall.rsc" +"\epoc32\release\armv5\urel\glxcollectionplugincamera.dll" -"!:\sys\bin\glxcollectionplugincamera.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionplugincamera.rsc" -"!:\resource\plugins\glxcollectionplugincamera.rsc" +"\epoc32\data\Z\resource\plugins\glxplugincamera.rsc" -"!:\resource\plugins\glxplugincamera.rsc" +"\epoc32\release\armv5\urel\glxcollectionplugindownloads.dll" -"!:\sys\bin\glxcollectionplugindownloads.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionplugindownloads.rsc" -"!:\resource\plugins\glxcollectionplugindownloads.rsc" +"\epoc32\data\Z\resource\plugins\glxplugindownloads.rsc" -"!:\resource\plugins\glxplugindownloads.rsc" +"\epoc32\release\armv5\urel\glxcollectionpluginmonths.dll" -"!:\sys\bin\glxcollectionpluginmonths.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginmonths.rsc" -"!:\resource\plugins\glxcollectionpluginmonths.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginmonths.rsc" -"!:\resource\plugins\glxpluginmonths.rsc" +"\epoc32\release\armv5\urel\glxcollectionpluginimageviewer.dll" -"!:\sys\bin\glxcollectionpluginimageviewer.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginimageviewer.rsc" -"!:\resource\plugins\glxcollectionpluginimageviewer.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginimageviewer.rsc" -"!:\resource\plugins\glxpluginimageviewer.rsc" +"\epoc32\release\armv5\urel\glxzoomview.dll" -"!:\sys\bin\glxzoomview.dll" + +;"\epoc32\release\armv5\urel\glxthumbnailcomposerplugin.dll" -"!:\sys\bin\glxthumbnailcomposerplugin.dll" +;"\epoc32\data\Z\resource\plugins\glxthumbnailcomposerplugin.rsc" -"!:\resource\plugins\glxthumbnailcomposerplugin.rsc" + +;"\epoc32\release\armv5\urel\glxtvout.dll" -"!:\sys\bin\glxtvout.dll" + +"\epoc32\release\armv5\urel\glxlayouts.dll" -"!:\sys\bin\glxlayouts.dll" +"\epoc32\release\armv5\urel\glxmedialists.dll" -"!:\sys\bin\glxmedialists.dll" +"\epoc32\release\armv5\urel\glxvisuallistmanager.dll" -"!:\sys\bin\glxvisuallistmanager.dll" +"\epoc32\release\armv5\urel\glxuiutilities.dll" -"!:\sys\bin\glxuiutilities.dll" +"\epoc32\data\z\resource\apps\glxuiutilities.rsc" -"!:\resource\apps\glxuiutilities.rsc" +"\epoc32\release\armv5\urel\glxdrmutility.dll" -"!:\sys\bin\glxdrmutility.dll" + +"\epoc32\release\armv5\urel\glxgridview.dll" -"!:\sys\bin\glxgridview.dll" +"\epoc32\data\z\resource\apps\glxgridviewdata.rsc" -"!:\resource\apps\glxgridviewdata.rsc" +"\epoc32\data\z\resource\apps\glxdownloadtext.rsc" -"!:\resource\apps\glxdownloadtext.rsc" +"\epoc32\release\armv5\urel\glxgridviewpluginbase.dll" -"!:\sys\bin\glxgridviewpluginbase.dll" +"\epoc32\release\armv5\urel\glxgridviewplugin.dll" -"!:\sys\bin\glxgridviewplugin.dll" +"\epoc32\data\Z\resource\plugins\glxgridviewplugin.rsc" -"!:\resource\plugins\glxgridviewplugin.rsc" + + +"\epoc32\release\armv5\urel\glxfullscreenview.dll" -"!:\sys\bin\glxfullscreenview.dll" +"\epoc32\release\armv5\urel\glxfullscreenviewpluginbase.dll" -"!:\sys\bin\glxfullscreenviewpluginbase.dll" +"\epoc32\release\armv5\urel\glxfullscreenviewplugin.dll" -"!:\sys\bin\glxfullscreenviewplugin.dll" +"\epoc32\data\z\resource\apps\glxfullscreenviewdata.rsc" -"!:\resource\apps\glxfullscreenviewdata.rsc" +"\epoc32\data\Z\resource\plugins\glxfullscreenviewplugin.rsc" -"!:\resource\plugins\glxfullscreenviewplugin.rsc" + +"\epoc32\release\armv5\urel\glxlistview.dll" -"!:\sys\bin\glxlistview.dll" +"\epoc32\data\z\resource\apps\glxlistviewplugin.rsc" -"!:\resource\apps\glxlistviewplugin.rsc" +"\epoc32\release\armv5\urel\glxlistviewpluginbase.dll" -"!:\sys\bin\glxlistviewpluginbase.dll" +"\epoc32\release\armv5\urel\glxlistviewplugin.dll" -"!:\sys\bin\glxlistviewplugin.dll" +"\epoc32\data\Z\resource\plugins\glxlistviewplugin.rsc" -"!:\resource\plugins\glxlistviewplugin.rsc" + +"\epoc32\data\z\private\10202be9\200071d3.txt" -"!:\system\data\10202BE9\200071d3.txt" +"\epoc32\data\z\private\10202be9\200009EE.txt" -"!:\system\data\10202BE9\200009EE.txt" + +; Glx logging client +"\epoc32\release\armv5\urel\glxlogging.dll"-"!:\sys\bin\glxlogging.dll" + +; For contentharvester plugin component +"\epoc32\release\armv5\urel\glxcontentharvesterplugin.dll" -"!:\sys\bin\glxcontentharvesterplugin.dll" +"\epoc32\data\Z\resource\plugins\glxcontentharvesterplugin.rsc" -"!:\resource\plugins\glxcontentharvesterplugin.rsc" + +;photosuitelauncher - for the shortcut. + +"\epoc32\release\armv5\urel\photossuitelauncher.exe"-"!:\sys\bin\photossuitelauncher.exe" +"\epoc32\data\z\resource\apps\photossuitelauncher.mif"-"!:\resource\apps\photossuitelauncher.mif" +"\epoc32\data\z\private\10003a3f\import\apps\photossuitelauncher_reg.rsc"-"!:\private\10003a3f\import\apps\photossuitelauncher_reg.rsc" +"\epoc32\data\z\resource\apps\photossuitelauncher.Rsc"-"!:\resource\apps\photossuitelauncher.Rsc" + +; For photossuite component + + +"\epoc32\data\z\resource\apps\photossuite.rsc" -"!:\resource\apps\photossuite.rsc" +"\epoc32\include\photossuite.rsg" -"!:\resource\apps\photossuite.rsg" +"\epoc32\data\Z\private\101F4CD2\import\suites\photossuite\suite.xml" -"!:\private\101F4CD2\import\suites\photossuite\suite.xml" +"\epoc32\data\Z\private\101F4CD2\import\suites\photossuite\photos_items.xml" -"!:\private\101F4CD2\import\suites\photossuite\photos_items.xml" + + +"\epoc32\data\Z\resource\xhtml\01\0x200009EE\contents.zip" -"!:\resource\xhtml\01\0x200009EE\contents.zip" +"\epoc32\data\Z\resource\xhtml\01\0x200009EE\index.xml" -"!:\resource\xhtml\01\0x200009EE\index.xml" +"\epoc32\data\Z\resource\xhtml\01\0x200009EE\keywords.xml" -"!:\resource\xhtml\01\0x200009EE\keywords.xml" +"\epoc32\data\Z\resource\xhtml\01\0x200009EE\meta.xml" -"!:\resource\xhtml\01\0x200009EE\meta.xml" + +; For memory plugin +"\epoc32\release\armv5\urel\glxmemoryplugin.dll" -"!:\sys\bin\glxmemoryplugin.dll" +"\epoc32\data\Z\resource\plugins\glxmemoryplugin.rsc" -"!:\resource\plugins\glxmemoryplugin.rsc" \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/glxgallery_stub.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/sis/glxgallery_stub.mk Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +# +# Copyright (c) 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: creates stub sis file +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) + ZDIR = $(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else + ZDIR = $(EPOCROOT)epoc32\data\z +endif + + + +do_nothing : + @rem do_nothing +MAKMAKE : do_nothing +BLD : do_nothing +CLEAN : do_nothing +LIB : do_nothing +CLEANLIB : do_nothing + +RESOURCE : do_nothing +FREEZE : do_nothing +SAVESPACE : do_nothing +RELEASABLES : do_nothing +FINAL : + echo ============================================================= + echo Starting to create stub file.. + makesis -v -s glxgallery_stub.pkg glxgallery_stub.sis + echo Copying stub sis.. + copy glxgallery_stub.sis $(EPOCROOT)epoc32\data\Z\System\Install\glxgallery_stub.sis + echo Stub created and copied. + echo ============================================================= diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/glxgallery_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/sis/glxgallery_stub.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,173 @@ +; +; Copyright (c) 2008 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: Stub package file for project Gallery +; + +; -------- general -------- + +; Languages +&EN + +; Package header +#{"Photos"},(0x200009EE),9,200,0,TYPE=SA + + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; -------- files -------- + +""-"z:\private\10003a3f\import\apps\glx_reg.rsc" + +""-"z:\sys\bin\glx.exe" +""-"z:\resource\apps\glx_loc.Rsc" +""-"z:\resource\apps\glx.Rsc" + + +""-"z:\resource\apps\glxicons.mif" +""-"z:\resource\apps\glx_aif.mif" + + +;; language-dependent resource files + +;; engines + +""-"z:\sys\bin\glxsimplelistview.dll" +""-"z:\sys\bin\glxtagsmanagerviewplugin.dll" +""-"z:\resource\plugins\glxtagsmanagerviewplugin.rsc" +""-"z:\resource\apps\glxtagsmanagerview.RSC" +""-"z:\resource\plugins\glxlistviewplugin.rsc" +""-"z:\sys\bin\glxmetadatadialog.dll" +""-"z:\resource\apps\glxmetadatadialog.rsc" +""-"z:\sys\bin\glxcloudview.dll" +""-"z:\sys\bin\glxtagsbrowserviewplugin.dll" +""-"z:\resource\plugins\glxtagsbrowserviewplugin.rsc" +""-"z:\resource\apps\glxtagsbrowserview.RSC" +""-"z:\sys\bin\glxupnpcommandhandler.dll" +""-"z:\sys\bin\glxcollectionplugintags.dll" +""-"z:\resource\plugins\glxcollectionplugintags.rsc" +""-"z:\resource\plugins\glxplugintags.rsc" +""-"z:\sys\bin\glxtexturemanager.dll" +""-"z:\sys\bin\glxfetcher.dll" +""-"z:\resource\plugins\glxfetcher.rsc" +""-"z:\resource\apps\glxfetcherdialog.rsc" +""-"z:\sys\bin\glxcollectionmanager.dll" +;""-"z:\sys\bin\glxactivedataplugin.dll" +;""-"z:\resource\plugins\glxactivedataplugin.rsc" +""-"z:\sys\bin\glxviewbase.dll" +""-"z:\resource\apps\glxviewbase.rsc" +""-"z:\sys\bin\glxcommandhandlerbase.dll" +""-"z:\sys\bin\glxcommoncommandhandlers.dll" +""-"z:\resource\apps\glxcommoncommandhandlers.rsc" +""-"z:\sys\bin\glxcommandhandlermarking.dll" +""-"z:\sys\bin\glxcommandhandlerdrm.dll" +""-"z:\sys\bin\glxcommandhandlermoreinfo.dll" +""-"z:\resource\apps\glxcommandhandlermarking.rsc" +""-"z:\sys\bin\glxcommon.dll" +""-"z:\sys\bin\glximageviewermanager.dll" +""-"z:\sys\bin\glxcommonui.dll" +""-"z:\sys\bin\shwslideshowengine.dll" +""-"z:\resource\apps\shwslideshowengine.rsc" +""-"z:\sys\bin\shwslideshowviewplugin.dll" +""-"z:\resource\plugins\shwslideshowviewplugin.rsc" +""-"z:\resource\apps\shwslideshowview.rsc" +""-"z:\sys\bin\shwsettingsplugin.dll" +""-"z:\resource\plugins\shwsettingsplugin.rsc" +""-"z:\resource\apps\shwsettingsdialog.rsc" +""-"z:\sys\bin\glxthumbnailcreator.dll" +""-"z:\sys\bin\glxdatasourcemanager.dll" +""-"z:\sys\bin\glxdatasourcemde.dll" +""-"z:\resource\plugins\glxdatasourcemde.rsc" +""-"z:\sys\bin\glxcollectionpluginalbums.dll" +""-"z:\resource\plugins\glxcollectionpluginalbums.rsc" +""-"z:\resource\plugins\glxpluginalbums.rsc" +""-"z:\sys\bin\glxcollectionpluginall.dll" +""-"z:\resource\plugins\glxcollectionpluginall.rsc" +""-"z:\resource\plugins\glxpluginall.rsc" +""-"z:\sys\bin\glxcollectionplugincamera.dll" +""-"z:\resource\plugins\glxcollectionplugincamera.rsc" +""-"z:\resource\plugins\glxplugincamera.rsc" +""-"z:\sys\bin\glxcollectionplugindownloads.dll" +""-"z:\resource\plugins\glxcollectionplugindownloads.rsc" +""-"z:\resource\plugins\glxplugindownloads.rsc" +""-"z:\sys\bin\glxcollectionpluginmonths.dll" +""-"z:\resource\plugins\glxcollectionpluginmonths.rsc" +""-"z:\resource\plugins\glxpluginmonths.rsc" +""-"z:\sys\bin\glxcollectionpluginimageviewer.dll" +""-"z:\resource\plugins\glxcollectionpluginimageviewer.rsc" +""-"z:\resource\plugins\glxpluginimageviewer.rsc" +""-"z:\sys\bin\glxzoomview.dll" + +;""-"z:\sys\bin\glxthumbnailcomposerplugin.dll" +;""-"z:\resource\plugins\glxthumbnailcomposerplugin.rsc" + +;""-"z:\sys\bin\glxtvout.dll" + +""-"z:\sys\bin\glxlayouts.dll" +""-"z:\sys\bin\glxmedialists.dll" +""-"z:\sys\bin\glxvisuallistmanager.dll" +""-"z:\sys\bin\glxuiutilities.dll" +""-"z:\resource\apps\glxuiutilities.rsc" +""-"z:\sys\bin\glxdrmutility.dll" + +""-"z:\sys\bin\glxgridview.dll" +""-"z:\resource\apps\glxgridviewdata.rsc" +""-"z:\sys\bin\glxgridviewpluginbase.dll" +""-"z:\sys\bin\glxgridviewplugin.dll" +""-"z:\resource\plugins\glxgridviewplugin.rsc" +""-"z:\resource\apps\glxdownloadtext.rsc" + + +""-"z:\sys\bin\glxfullscreenview.dll" + +""-"z:\sys\bin\glxlistview.dll" +""-"z:\resource\apps\glxlistviewplugin.rsc" +""-"z:\sys\bin\glxlistviewpluginbase.dll" +""-"z:\sys\bin\glxlistviewplugin.dll" +""-"z:\resource\plugins\glxlistviewplugin.rsc" + +""-"z:\system\data\10202BE9\200071d3.txt" +""-"z:\system\data\10202BE9\200009EE.txt" + +; Glx logging client +""-"z:\sys\bin\glxlogging.dll" + + +""-"z:\sys\bin\glxtileview.dll" +""-"z:\sys\bin\glxtileviewpluginbase.dll" +""-"z:\sys\bin\glxtileviewplugin.dll" +""-"z:\sys\bin\glxtagcollectionplugin.dll" +""-"z:\sys\bin\glxalbumcollectionplugin.dll" +""-"z:\sys\bin\glxfullscreenviewpluginbase.dll" +""-"z:\sys\bin\glxfullscreenviewplugin.dll" +""-"z:\sys\bin\glxdataprovider.dll" +""-"z:\sys\bin\glxuitilities.dll" +""-"z:\sys\bin\glxaddtoalbumhandler.dll" + +; For contentharvester plugin component +""-"z:\sys\bin\glxcontentharvesterplugin.dll" + + +""-"z:\resource\xhtml\01\0x200009EE\contents.zip" +""-"z:\resource\xhtml\01\0x200009EE\index.xml" +""-"z:\resource\xhtml\01\0x200009EE\keywords.xml" +""-"z:\resource\xhtml\01\0x200009EE\meta.xml" + +; For photossuite component +""-"z:\resource\apps\photossuite.rsc" +""-"z:\private\101F4CD2\import\suites\photossuite\suite.xml" +""-"z:\private\101F4CD2\import\suites\photossuite\photos_items.xml" diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/sis/glxgallery_udeb.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/sis/glxgallery_udeb.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,223 @@ +; +; Copyright (c) 2008 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: Package file for project Gallery +; + +; -------- general -------- + +; Languages +&EN + +; Package header +#{"Photos"},(0x200009EE),1,0,0,TYPE=SA + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; Dependency for S60 3.0 +[0x101F7961],0,0,0,{"Series60v3.0"} + +; -------- files -------- + +; NOTE: This installation package does not include huitoolkit.dll, +; so you have to install it separately! + +;; ui files + +"..\data\abstract5.jpg"-"c:\abstract5.jpg" +"..\data\Battle.jpg"-"c:\Battle.jpg" +"..\data\text_element_left_cap.png"-"c:\text_element_left_cap.png" +"..\data\text_element_mid.png"-"c:\text_element_mid.png" +"..\data\text_element_right_cap.png"-"c:\text_element_right_cap.png" +"..\data\qgn_prop_image_notcreated.png"-"c:\qgn_prop_image_notcreated.png" +"..\data\Image1.jpg"-"c:\Image1.jpg" +"..\data\Image2.jpg"-"c:\Image2.jpg" +"..\data\Image3.jpg"-"c:\Image3.jpg" +"..\data\Image4.jpg"-"c:\Image4.jpg" +"..\data\Image5.jpg"-"c:\Image5.jpg" +"..\data\Image6.jpg"-"c:\Image6.jpg" +"..\data\Image7.jpg"-"c:\Image7.jpg" +"..\data\Image8.jpg"-"c:\Image8.jpg" +"..\data\Image9.jpg"-"c:\Image9.jpg" +"..\data\Image10.jpg"-"c:\Image10.jpg" +"..\data\Image11.jpg"-"c:\Image11.jpg" +"..\data\Image12.jpg"-"c:\Image12.jpg" +"..\data\Image13.jpg"-"c:\Image13.jpg" +"..\data\Image14.jpg"-"c:\Image14.jpg" +"..\data\Image15.jpg"-"c:\Image15.jpg" +"..\data\Image16.jpg"-"c:\Image16.jpg" +"..\data\Image17.jpg"-"c:\Image17.jpg" +"..\data\Image18.jpg"-"c:\Image18.jpg" +"..\data\Image19.jpg"-"c:\Image19.jpg" +"..\data\Image20.jpg"-"c:\Image20.jpg" +"..\data\Image21.jpg"-"c:\Image21.jpg" +"..\data\Image22.jpg"-"c:\Image22.jpg" +"..\data\newitem1.jpg"-"c:\newitem1.jpg" +"..\data\newitem2.jpg"-"c:\newitem2.jpg" +"..\data\newitem3.jpg"-"c:\newitem3.jpg" +"..\data\newitem4.jpg"-"c:\newitem4.jpg" +"..\data\newitem5.jpg"-"c:\newitem5.jpg" +"..\data\newitem6.jpg"-"c:\newitem6.jpg" +"..\data\newitem7.jpg"-"c:\newitem7.jpg" +"..\data\newitem8.jpg"-"c:\newitem8.jpg" +"..\data\newitem9.jpg"-"c:\newitem9.jpg" +"..\data\newitem10.jpg"-"c:\newitem10.jpg" +"..\data\newitem11.jpg"-"c:\newitem11.jpg" +"..\data\newitem12.jpg"-"c:\newitem12.jpg" +"..\data\newitem13.jpg"-"c:\newitem13.jpg" +"..\data\newitem14.jpg"-"c:\newitem14.jpg" + +"\epoc32\release\armv5\udeb\glx.exe"-"!:\sys\bin\glx.exe" +"\epoc32\data\z\private\10003a3f\import\apps\glx_reg.rsc"-"!:\private\10003a3f\import\apps\glx_reg.rsc" +"\epoc32\data\z\resource\apps\glx_loc.Rsc"-"!:\resource\apps\glx_loc.Rsc" +"\epoc32\data\z\resource\apps\glx.Rsc"-"!:\resource\apps\glx.Rsc" + +;"\epoc32\release\armv5\udeb\proto.exe"-"!:\sys\bin\proto.exe" +;"\epoc32\data\z\private\10003a3f\import\apps\proto_reg.rsc"-"!:\private\10003a3f\import\apps\proto_reg.rsc" +;"\epoc32\data\z\resource\apps\proto.Rsc"-"!:\resource\apps\proto.Rsc" + +;"\epoc32\release\armv5\udeb\albumpopuptest.exe"-"!:\sys\bin\albumpopuptest.exe" +;"\epoc32\data\z\private\10003a3f\import\apps\albumpopuptest_reg.rsc"-"!:\private\10003a3f\import\apps\albumpopuptest_reg.rsc" +;"\epoc32\data\z\resource\apps\albumpopuptest.Rsc"-"!:\resource\apps\albumpopuptest.Rsc" + +;"..\..\viewframework\uiutilities\data\icon4.png" -"!:\private\200009EE\icon4.png" +;"..\..\viewframework\uiutilities\data\listbox_bar.png" -"!:\private\200009EE\listbox_bar.png" +;"..\..\viewframework\uiutilities\data\listbox_thumb.png" -"!:\private\200009EE\listbox_thumb.png" +;"..\..\viewframework\uiutilities\data\selector.png" -"!:\private\200009EE\selector.png" +;"..\..\viewframework\uiutilities\data\capped_element.png" -"!:\private\200009EE\capped_element.png" + +"\epoc32\data\z\resource\apps\glxicons.mbm" -"!:\resource\apps\glxicons.mbm" +"\epoc32\data\z\resource\apps\glxicons.mif" -"!:\resource\apps\glxicons.mif" +"\epoc32\data\z\resource\apps\glx_aif.mif" -"!:\resource\apps\glx_aif.mif" + + +;; language-dependent resource files + +;; engines + + +"\epoc32\data\Z\resource\plugins\glxlistviewplugin.rsc" -"!:\resource\plugins\glxlistviewplugin.rsc" +;"\epoc32\release\armv5\udeb\glxunifiedmetadataview.dll" -"!:\sys\bin\glxunifiedmetadataview.dll" +"\epoc32\data\Z\resource\apps\glxmetadatadialog.rsc" -"!:\resource\apps\glxmetadatadialog.rsc" +"\epoc32\release\armv5\udeb\glxmetadatadialog.dll" -"!:\sys\bin\glxmetadatadialog.dll" +"\epoc32\data\Z\resource\apps\glxmetadatadialog.rsc" -"!:\resource\apps\glxmetadatadialog.rsc" +"\epoc32\release\armv5\udeb\glxcloudview.dll" -"!:\sys\bin\glxcloudview.dll" +"\epoc32\release\armv5\udeb\glxtagsbrowserviewplugin.dll" -"!:\sys\bin\glxtagsbrowserviewplugin.dll" +"\epoc32\data\Z\resource\plugins\glxtagsbrowserviewplugin.rsc" -"!:\resource\plugins\glxtagsbrowserviewplugin.rsc" +"\epoc32\data\Z\resource\apps\glxtagsbrowserview.RSC" -"!:\resource\apps\glxtagsbrowserview.RSC" +"\epoc32\release\armv5\udeb\glxupnpcommandhandler.dll" -"!:\sys\bin\glxupnpcommandhandler.dll" +"\epoc32\release\armv5\udeb\glxcollectionplugintags.dll" -"!:\sys\bin\glxcollectionplugintags.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionplugintags.rsc" -"!:\resource\plugins\glxcollectionplugintags.rsc" +"\epoc32\data\Z\resource\plugins\glxplugintags.rsc" -"!:\resource\plugins\glxplugintags.rsc" +"\epoc32\release\armv5\udeb\glxtexturemanager.dll" -"!:\sys\bin\glxtexturemanager.dll" +"\epoc32\release\armv5\udeb\glxfetcher.dll" -"!:\sys\bin\glxfetcher.dll" +"\epoc32\data\Z\resource\plugins\glxfetcher.rsc" -"!:\resource\plugins\glxfetcher.rsc" + +"\epoc32\release\armv5\udeb\glxcollectionmanager.dll" -"!:\sys\bin\glxcollectionmanager.dll" + + +"\epoc32\release\armv5\udeb\glxviewbase.dll" -"!:\sys\bin\glxviewbase.dll" +"\epoc32\data\z\resource\apps\glxviewbase.rsc" -"!:\resource\apps\glxviewbase.rsc" +;"\epoc32\release\armv5\udeb\glxtesttileview.dll" -"!:\sys\bin\glxtesttileview.dll" +;"\epoc32\data\z\resource\apps\glxtesttileview.rsc" -"!:\resource\apps\glxtesttileview.rsc" +;"\epoc32\release\armv5\udeb\glxtesttileviewplugin.dll" -"!:\sys\bin\glxtesttileviewplugin.dll" +;"\epoc32\data\Z\resource\plugins\glxtesttileviewplugin.rsc" -"!:\resource\plugins\glxtesttileviewplugin.rsc" +;"\epoc32\release\armv5\udeb\glxtestremovehandler.dll" -"!:\sys\bin\glxtestremovehandler.dll" +;"\epoc32\release\armv5\udeb\glxaddtoalbumhandler.dll" -"!:\sys\bin\glxaddtoalbumhandler.dll" +"\epoc32\release\armv5\udeb\glxcommandhandlerbase.dll" -"!:\sys\bin\glxcommandhandlerbase.dll" +"\epoc32\release\armv5\udeb\glxcommoncommandhandlers.dll" -"!:\sys\bin\glxcommoncommandhandlers.dll" +"\epoc32\data\Z\resource\apps\glxcommoncommandhandlers.rsc" -"!:\resource\apps\glxcommoncommandhandlers.rsc" +"\epoc32\release\armv5\udeb\glxcommandhandlermarking.dll" -"!:\sys\bin\glxcommandhandlermarking.dll" +"\epoc32\release\armv5\udeb\glxcommandhandlerdrm.dll" -"!:\sys\bin\glxcommandhandlerdrm.dll" +"\epoc32\release\armv5\udeb\glxcommandhandlermoreinfo.dll" -"!:\sys\bin\glxcommandhandlermoreinfo.dll" +"\epoc32\data\z\resource\apps\glxcommandhandlermarking.rsc" -"!:\resource\apps\glxcommandhandlermarking.rsc" +"\epoc32\release\armv5\udeb\glxcommon.dll" -"!:\sys\bin\glxcommon.dll" +"\epoc32\release\armv5\udeb\glximageviewermanager.dll" -"!:\sys\bin\glximageviewermanager.dll" +"\epoc32\release\armv5\udeb\glxcommonui.dll" -"!:\sys\bin\glxcommonui.dll" +;"\epoc32\data\z\resource\apps\glxaddtoalbumhandler.rsc" -"!:\resource\apps\glxaddtoalbumhandler.rsc" +"\epoc32\release\armv5\udeb\shwslideshowengine.dll" -"!:\sys\bin\shwslideshowengine.dll" +"\epoc32\data\Z\resource\apps\shwslideshowengine.rsc" -"!:\resource\apps\shwslideshowengine.rsc" +"\epoc32\release\armv5\udeb\shwslideshowviewplugin.dll" -"!:\sys\bin\shwslideshowviewplugin.dll" +"\epoc32\data\Z\resource\plugins\shwslideshowviewplugin.rsc" -"!:\resource\plugins\shwslideshowviewplugin.rsc" +"\epoc32\data\Z\resource\apps\shwslideshowview.rsc" -"!:\resource\apps\shwslideshowview.rsc" +"\epoc32\release\armv5\udeb\shwsettingsplugin.dll" -"!:\sys\bin\shwsettingsplugin.dll" +"\epoc32\data\Z\resource\plugins\shwsettingsplugin.rsc" -"!:\resource\plugins\shwsettingsplugin.rsc" +"\epoc32\data\Z\resource\apps\shwsettingsdialog.rsc" -"!:\resource\apps\shwsettingsdialog.rsc" +"\epoc32\release\armv5\udeb\glxthumbnailcreator.dll" -"!:\sys\bin\glxthumbnailcreator.dll" +"\epoc32\release\armv5\udeb\glxdatasourcemanager.dll" -"!:\sys\bin\glxdatasourcemanager.dll" +"\epoc32\release\armv5\udeb\glxdatasourcemde.dll" -"!:\sys\bin\glxdatasourcemde.dll" +"\epoc32\data\Z\resource\plugins\glxdatasourcemde.rsc" -"!:\resource\plugins\glxdatasourcemde.rsc" +;"\epoc32\release\armv5\udeb\glxdatasourcetest.dll" -"!:\sys\bin\glxdatasourcetest.dll" +;"\epoc32\data\Z\resource\plugins\glxdatasourcetest.rsc" -"!:\resource\plugins\glxdatasourcetest.rsc" +"\epoc32\release\armv5\udeb\glxcollectionpluginalbums.dll" -"!:\sys\bin\glxcollectionpluginalbums.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginalbums.rsc" -"!:\resource\plugins\glxcollectionpluginalbums.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginalbums.rsc" -"!:\resource\plugins\glxpluginalbums.rsc" +;"\epoc32\release\armv5\udeb\glxalbumcollectionplugin.dll" -"!:\sys\bin\glxalbumcollectionplugin.dll" +;"\epoc32\release\armv5\udeb\glxtestcollectionplugin.dll" -"!:\sys\bin\glxtestcollectionplugin.dll" +;"\epoc32\data\Z\resource\plugins\glxtestcollectionplugin.rsc" -"!:\resource\plugins\glxtestcollectionplugin.rsc" +;"\epoc32\data\Z\resource\plugins\glxalbumcollectionplugin.rsc" -"!:\resource\plugins\glxalbumcollectionplugin.rsc" +"\epoc32\release\armv5\udeb\glxcollectionpluginall.dll" -"!:\sys\bin\glxcollectionpluginall.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginall.rsc" -"!:\resource\plugins\glxcollectionpluginall.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginall.rsc" -"!:\resource\plugins\glxpluginall.rsc" +"\epoc32\release\armv5\udeb\glxcollectionplugincamera.dll" -"!:\sys\bin\glxcollectionplugincamera.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionplugincamera.rsc" -"!:\resource\plugins\glxcollectionplugincamera.rsc" +"\epoc32\data\Z\resource\plugins\glxplugincamera.rsc" -"!:\resource\plugins\glxplugincamera.rsc" +"\epoc32\release\armv5\udeb\glxcollectionplugindownloads.dll" -"!:\sys\bin\glxcollectionplugindownloads.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionplugindownloads.rsc" -"!:\resource\plugins\glxcollectionplugindownloads.rsc" +"\epoc32\data\Z\resource\plugins\glxplugindownloads.rsc" -"!:\resource\plugins\glxplugindownloads.rsc" +"\epoc32\release\armv5\udeb\glxcollectionpluginmonths.dll" -"!:\sys\bin\glxcollectionpluginmonths.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginmonths.rsc" -"!:\resource\plugins\glxcollectionpluginmonths.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginmonths.rsc" -"!:\resource\plugins\glxpluginmonths.rsc" +"\epoc32\release\armv5\udeb\glxcollectionpluginimageviewer.dll" -"!:\sys\bin\glxcollectionpluginimageviewer.dll" +"\epoc32\data\Z\resource\plugins\glxcollectionpluginimageviewer.rsc" -"!:\resource\plugins\glxcollectionpluginimageviewer.rsc" +"\epoc32\data\Z\resource\plugins\glxpluginimageviewer.rsc" -"!:\resource\plugins\glxpluginimageviewer.rsc" +"\epoc32\release\armv5\udeb\glxzoomview.dll" -"!:\sys\bin\glxzoomview.dll" + +;"\epoc32\release\armv5\udeb\glxthumbnailcomposerplugin.dll" -"!:\sys\bin\glxthumbnailcomposerplugin.dll" +;"\epoc32\data\Z\resource\plugins\glxthumbnailcomposerplugin.rsc" -"!:\resource\plugins\glxthumbnailcomposerplugin.rsc" + +"\epoc32\release\armv5\udeb\glxlayouts.dll" -"!:\sys\bin\glxlayouts.dll" +"\epoc32\release\armv5\udeb\glxmedialists.dll" -"!:\sys\bin\glxmedialists.dll" +"\epoc32\release\armv5\udeb\glxvisuallistmanager.dll" -"!:\sys\bin\glxvisuallistmanager.dll" +"\epoc32\release\armv5\udeb\glxuiutilities.dll" -"!:\sys\bin\glxuiutilities.dll" +"\epoc32\data\z\resource\apps\glxuiutilities.rsc" -"!:\resource\apps\glxuiutilities.rsc" +"\epoc32\release\armv5\udeb\glxdrmutility.dll" -"!:\sys\bin\glxdrmutility.dll" + + + +"\epoc32\data\z\resource\apps\glxdownloadtext.rsc" -"!:\resource\apps\glxdownloadtext.rsc" + + + + +"\epoc32\release\armv5\udeb\glxfullscreenview.dll" -"!:\sys\bin\glxfullscreenview.dll" +"\epoc32\release\armv5\udeb\glxfullscreenviewpluginbase.dll" -"!:\sys\bin\glxfullscreenviewpluginbase.dll" +"\epoc32\release\armv5\udeb\glxfullscreenviewplugin.dll" -"!:\sys\bin\glxfullscreenviewplugin.dll" +"\epoc32\data\z\resource\apps\glxfullscreenviewdata.rsc" -"!:\resource\apps\glxfullscreenviewdata.rsc" +"\epoc32\data\Z\resource\plugins\glxfullscreenviewplugin.rsc" -"!:\resource\plugins\glxfullscreenviewplugin.rsc" + +"\epoc32\release\armv5\udeb\glxlistview.dll" -"!:\sys\bin\glxlistview.dll" +"\epoc32\data\z\resource\apps\glxlistviewplugin.rsc" -"!:\resource\apps\glxlistviewplugin.rsc" +"\epoc32\release\armv5\udeb\glxlistviewpluginbase.dll" -"!:\sys\bin\glxlistviewpluginbase.dll" +"\epoc32\release\armv5\udeb\glxlistviewplugin.dll" -"!:\sys\bin\glxlistviewplugin.dll" +"\epoc32\data\Z\resource\plugins\glxlistviewplugin.rsc" -"!:\resource\plugins\glxlistviewplugin.rsc" + +"\epoc32\data\z\private\10202be9\200071d3.txt" -"!:\system\data\10202BE9\200071d3.txt" + + +; Glx logging client +"\epoc32\release\armv5\udeb\glxlogging.dll"-"!:\sys\bin\glxlogging.dll" diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/src/glxapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/src/glxapplication.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: Symbian application class +* +*/ + + + + +#include "glxapplication.h" + +#include +#include + +#include "glxdocument.h" + +// UID for the application, this should correspond to the uid defined in the mmp file +static const TUid KUidGlxApp = {KGlxGalleryApplicationUid}; + +// ----------------------------------------------------------------------------- +// CreateDocumentL +// ----------------------------------------------------------------------------- +// +CApaDocument* CGlxApplication::CreateDocumentL() + { + GLX_LOG_INFO("CGlxApplication::CreateDocumentL"); + // Create a Viewer document, and return a pointer to it + CApaDocument* document = CGlxDocument::NewL(*this); + return document; + } + +// ----------------------------------------------------------------------------- +// AppDllUid +// ----------------------------------------------------------------------------- +// +TUid CGlxApplication::AppDllUid() const + { + // Return the UID for the Viewer application + return KUidGlxApp; + } + +#include + +#ifdef __UI_FRAMEWORKS_V2__ + +// ----------------------------------------------------------------------------- +// NewApplication +// ----------------------------------------------------------------------------- +// +CApaApplication* NewApplication() + { + return new CGlxApplication; + } + +// ----------------------------------------------------------------------------- +// E32Main +// ----------------------------------------------------------------------------- +// +TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +/////////////////////////////////////////////////////////////////////////////// +// +// The following is required for wins on EKA1 (using the exedll target) +// +#if defined(__WINS__) && !defined(EKA2) +EXPORT_C TInt WinsMain(TDesC* aCmdLine) + { + return EikStart::RunApplication(NewApplication, aCmdLine); + } + +TInt E32Dll(TDllReason) + { + return KErrNone; + } +#endif + +#else // __UI_FRAMEWORKS_V2__ + +// Create an application, and return a pointer to it +EXPORT_C CApaApplication* NewApplication() + { + return new CGlxApplication; + } + +// DLL entry point, return that everything is ok +GLDEF_C TInt E32Dll(TDllReason) + { + return KErrNone; + } + +#endif // __UI_FRAMEWORKS_V2__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/src/glxappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/src/glxappui.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,844 @@ +/* +* Copyright (c) 2008-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: AppUi class +* +*/ + + + + +#include "glxappui.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "glxcachemanager.h"//OOM +//OOM + +#include +#include + +//OOM + + +#include + + +#include +#include +#include "glxiadupdate.h" + +//constants +const TInt KGlxGridThumbnailPages = 9 ; // 4 page Down + 4 page Up + 1 Visible page = 9 page +const TInt KGlxFullThumbnailCount = 11 ; // 5 Thumnail Front + 5 Thumbnail Rear + 1 Visible = 11 page +const TInt KGlxMaxMegaPixelsSupportedByCamera = 5242880 ; // 5 MB +const TInt KGlxMaxMemoryToDecodeCapturedPicture = 2 * KGlxMaxMegaPixelsSupportedByCamera ; +const TInt KGlxMemoryForOOMFwk = 1048576 ; // 1 MB +const TInt KGlxThumbNailRepresentation = 2; // Thumbnail Representation; Could be 3 also + +_LIT8( KPhotosSuiteNavigation, "SuiteNavigation" ); +_LIT8( KPhotosCaptured, "Captured" ); +_LIT8( KPhotosMonths, "Months" ); +_LIT8( KPhotosTags, "Tags" ); +_LIT8( KPhotosAlbums, "Albums" ); +_LIT8( KPhotosAllValue,"Allcs"); + +_LIT8( KPhotosSuiteExitMessage, "mm://photossuite?action=exit" ); + +// Matrix uid, needed for activating the suite view. +const TInt KMatrixUid = 0x101F4CD2; +const TInt KCapturedAlbumId = 2 ; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxAppUi::CGlxAppUi() + { + } + +// ----------------------------------------------------------------------------- +// ConstructL is called by the application framework +// ----------------------------------------------------------------------------- +// +void CGlxAppUi::ConstructL() + { + TRACER("void CGlxAppUi::ConstructL()"); + + // Enable Avkon skins. + BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); + // Create navigational state + iNavigationalState = CGlxNavigationalState::InstanceL(); + + iNavigationalState->AddObserverL( *this ); + + // Create Back Stepping Service wrapper + iBSWrapper = CGlxBackServiceWrapper::NewL( TUid::Uid( KGlxGalleryApplicationUid ) ); + iNavigationalState->SetBackExitStatus(EFalse); + + iFocusLostLowMemory = EFalse; + + // Get an instance of view utility + iViewUtility = MMPXViewUtility::UtilityL(); + + iUiUtility = CGlxUiUtility::UtilityL(); + // Always start in default orientation + iUiUtility->SetAppOrientationL(EGlxOrientationDefault); + ReserveMemoryL(EEntryTypeStartUp); + // publish zoom context, no zoom keys for now + NGlxZoomStatePublisher::PublishStateL( EFalse ); + iEndKeyPressed = EFalse; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxAppUi::~CGlxAppUi() + { + TRACER("CGlxAppUi::~CGlxAppUi()"); + iEndKeyPressed = EFalse; + if ( iNavigationalState ) + { + iNavigationalState->RemoveObserver(*this); + iNavigationalState->Close(); + } + + if ( iViewUtility ) + { + iViewUtility->Close(); + } + + delete iActivationParam; + + if ( iUiUtility ) + { + iUiUtility->Close(); + } + + if( iBSWrapper ) + { + delete iBSWrapper; + } + + if( iIadUpdate ) + { + delete iIadUpdate; + } + } + +// ----------------------------------------------------------------------------- +// HandleCommandL +// ----------------------------------------------------------------------------- +// +void CGlxAppUi::HandleCommandL(TInt aCommand) + { + TRACER("void CGlxAppUi::HandleCommandL(TInt aCommand)"); + GLX_LOG_INFO1("PHOTOS LOGS: void CGlxAppUi::HandleCommandL(TInt aCommand = %d)",aCommand ); + switch(aCommand) + { + case EEikCmdExit: + { + // Send message to Menu and exit. + /** + * In case of exit is pressed from options menu of photos grid, this flag will be + * false. so it will launch matrix menu. If we don't call LaunchMmViewL, in the above + * scenario, photos will exit,but photosuite will come. This is misleading to user. + */ + if(!iEndKeyPressed) + { + LaunchMmViewL( KPhotosSuiteExitMessage ); + } + Exit(); + } + break; + case EAknSoftkeyExit: + { + ClosePhotosL(); + GLX_LOG_INFO("CGlxAppUi::HandleCommandL: Exit() being Called"); + Exit(); + } + break; + + case EAknSoftkeyBack: + iNavigationalState->ActivatePreviousViewL(); + break; + + default: + break; + } + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +// +MCoeMessageObserver::TMessageResponse CGlxAppUi::HandleMessageL( + TUint32 /*aClientHandleOfTargetWindowGroup*/, + TUid aMessageUid, const TDesC8& aMessageParameters) + { + TRACER("MCoeMessageObserver::TMessageResponse CGlxAppUi::HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup,TUid aMessageUid, const TDesC8& aMessageParameters)"); + + // TO DO: Check if gallery is in background + MCoeMessageObserver::TMessageResponse + response = MCoeMessageObserver::EMessageHandled; + + + switch ( aMessageUid.iUid ) + { + case KGlxActivationCmdShowLastModified: + case KGlxActivationCameraAlbum: + HandleActivationMessageL(aMessageParameters); + break; + + case KGlxActivationPhotosMenu: + case KGlxActivationCameraView: + case KGlxActivationMonthsView: + case KGlxActivationAlbumsView: + case KGlxActivationTagsView: + case KGlxActivationAllView: + { + TApaTaskList taskList( iCoeEnv->WsSession() ); + TApaTask task = taskList.FindApp( TUid::Uid( KGlxGalleryApplicationUid ) ); + TApaTask taskForeGround = taskList.FindByPos(0); // get fopreground app + if ( task.Exists() && task.ThreadId() != taskForeGround.ThreadId() ) + { + // No matter which collection is selected, + // Photos is running in background, bring to foreground + iEikonEnv->RootWin().SetOrdinalPosition(0); + } + } + break; + default: + //To prevent Continues Activation of the Same View; Same is Triggered in ProcessCommandParametersL + HandleActivationMessageL(aMessageParameters); + break; + } + return response; + } + +// --------------------------------------------------------------------------- +// ProcessCommandParametersL +// --------------------------------------------------------------------------- +// +TBool CGlxAppUi::ProcessCommandParametersL(TApaCommand aCommand, + TFileName& aDocumentName, const TDesC8& aTail) + { + TRACER("TBool CGlxAppUi::ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail)"); + + TRAPD(err, HandleActivationMessageL(aCommand, aDocumentName, aTail)); + if ( KErrNone != err ) + { + // Open collection for main view + iStartupViewUid = TUid::Null(); + // Open navigational state at root level + CMPXCollectionPath* newState = CMPXCollectionPath::NewL(); + CleanupStack::PushL( newState ); + iNavigationalState->NavigateToL( *newState ); + CleanupStack::PopAndDestroy( newState ); + } + + return (EApaCommandOpen == aCommand) && (0 != aDocumentName.Size()); + } + +// --------------------------------------------------------------------------- +// Handle navigational state change +// --------------------------------------------------------------------------- +// +void CGlxAppUi::HandleNavigationalStateChangedL() + { + TRACER("void CGlxAppUi::HandleNavigationalStateChangedL()"); + + /* + * This thread chk is added for EDDG-7UUC53. In this scenario we get EPathChanged from MPX. + * That initiates a viewnavigational change from CGlxNavigationalStateImp HandleCollectionMessageL() + * In these types of scenarios we don't want a view switch. So ignoring the event. + */ + TApaTaskList taskList( iCoeEnv->WsSession() ); + TApaTask task = taskList.FindApp( TUid::Uid( KGlxGalleryApplicationUid ) ); + TApaTask taskForeGround = taskList.FindByPos(0); // get fopreground app + if ( task.Exists() && task.ThreadId() != taskForeGround.ThreadId() ) + { + GLX_LOG_INFO("CGlxAppUi::HandleNavigationalStateChanged: Return "); + return; + } + HBufC* activationParam = iActivationParam; + iActivationParam = NULL; // release ownership + CleanupStack::PushL( activationParam ); + + if ( TUid::Null() != iStartupViewUid ) + { + GLX_LOG_INFO("CGlxAppUi::HandleNavigationalStateChanged: Activating startup view"); + // Activate startup view + iViewUtility->ActivateViewL( iStartupViewUid, activationParam ); + iStartupViewUid = TUid::Null(); + } + else + { + GLX_LOG_INFO("CGlxAppUi::HandleNavigationalStateChanged: Activating view"); + + // get ids for scoring a view + RArray< TUid > scoringIds; + CleanupClosePushL( scoringIds ); + GetViewScoringIdsL( scoringIds ); + + GLX_LOG_INFO1( "CGlxAppUi::HandleNavigationalStateChanged: Uid count %d", scoringIds.Count()); + // let view utility to select the best view based on scoring ids + iViewUtility->ActivateViewL( scoringIds, activationParam ); + + CleanupStack::PopAndDestroy( &scoringIds ); + } + + CleanupStack::PopAndDestroy( activationParam ); + } + +// --------------------------------------------------------------------------- +// Populate array with view scoring ids +// --------------------------------------------------------------------------- +// +void CGlxAppUi::GetViewScoringIdsL( RArray& aIds ) const + { + TRACER("void CGlxAppUi::GetViewScoringIdsL( RArray& aIds ) const"); + + aIds.Reset(); // For maintenance safety + + // get current navigational state + CMPXCollectionPath* naviState = iNavigationalState->StateLC(); + + // no if check in needed here ,it makes the aapui aware of the list view depth + // to be removed.added by gopa + if ( naviState->Levels() >= 1) + { + if (iNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) + { + // For image viewer collection, goto view mode + if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + { + aIds.AppendL( TUid::Uid( KGlxViewingModeView ) ); + } + else + { + aIds.AppendL( TUid::Uid( KGlxViewingModeBrowse ) ); + } + } + else + { + aIds.AppendL( TUid::Uid( KGlxViewingModeView ) ); + } + } + + if( TUid::Null() != GetViewScoringIdForCollectionPlugin( *naviState ) ) + { + // add scoring id for collection plugin + aIds.AppendL( GetViewScoringIdForCollectionPlugin( *naviState ) ); + } + + if( TUid::Null() != ViewScoringIdForNaviStateDepth( *naviState ) ) + { + // add scoring id for depth in the ui hierarchy + aIds.AppendL( ViewScoringIdForNaviStateDepth( *naviState ) ); + } + + CleanupStack::PopAndDestroy( naviState ); + } +// --------------------------------------------------------------------------- +// Handles the foreground events +// --------------------------------------------------------------------------- +// + void CGlxAppUi::HandleForegroundEventL( TBool aForeground ) + { + TRACER("void CGlxAppUi::HandleForegroundEventL( TBool aForeground )"); + + // first let base class handle it so that we dont break anything + CAknViewAppUi::HandleForegroundEventL( aForeground ); + + } +// --------------------------------------------------------------------------- +// Return scoring id for collection plugin +// --------------------------------------------------------------------------- +// +TUid CGlxAppUi::GetViewScoringIdForCollectionPlugin( const CMPXCollectionPath& aNaviState ) const + { + TRACER("TUid CGlxAppUi::GetViewScoringIdForCollectionPluginL( const CMPXCollectionPath& aNaviState ) const"); + + GLX_LOG_INFO1( "CGlxAppUi::GetViewScoringIdForCollectionPluginL: Depth %d", aNaviState.Levels() ); + // score view based on collection plugin if not on root level + if ( aNaviState.Levels() ) + { + return TUid::Uid( aNaviState.Id( 0 ) ); + } + // return null as id to be ignored in scoring + return TUid::Null(); + } + + +// --------------------------------------------------------------------------- +// Return scoring id for depth +// --------------------------------------------------------------------------- +// +TUid CGlxAppUi::ViewScoringIdForNaviStateDepth( const CMPXCollectionPath& aNaviState ) const + { + TRACER("TUid CGlxAppUi::ViewScoringIdForNaviStateDepthL( const CMPXCollectionPath& aNaviState ) const"); + GLX_LOG_INFO1( "CGlxAppUi::ViewScoringIdForNaviStateDepthL: Level %d", aNaviState.Levels() ); + + switch ( aNaviState.Levels() ) + { + case 0: + + GLX_LOG_INFO1( "CGlxAppUi::ViewScoringIdForNaviStateDepthL: \ + Depth case 0 %x", TUid::Uid( KGlxDepthOne ) ); + return TUid::Uid( KGlxDepthOne ); + + case 1: + + GLX_LOG_INFO1( "CGlxAppUi::ViewScoringIdForNaviStateDepthL: \ + Depth case 1 %x", TUid::Uid( KGlxDepthTwo ) ); + return TUid::Uid( KGlxDepthTwo ); + + + case 2: + + GLX_LOG_INFO1( "CGlxAppUi::GetViewScoringIdForUiHieararchyDepthL: \ + Depth case 2 %x", TUid::Uid( KGlxDepthThree ) ); + return TUid::Uid( KGlxDepthThree ); + + default: + GLX_LOG_WARNING( "CGlxAppUi::GetViewScoringIdsL: Navigational state deeper than supported" ); + // return null as an id to be ignored in scoring + return TUid::Null(); + } + } + +// --------------------------------------------------------------------------- +// HandleActivationMessageL +// --------------------------------------------------------------------------- +// +void CGlxAppUi::HandleActivationMessageL(const TApaCommand& aCommand, + const TFileName& aDocumentName, const TDesC8& aData) + { + TRACER("void CGlxAppUi::HandleActivationMessageL(const TApaCommand& aCommand, const TFileName& aDocumentName, const TDesC8& aData)"); + + delete iActivationParam; + iActivationParam = NULL; + + //Check for the IADUpdate + //TBD: Need to check the location this has to be called. + //This might not be proper place. + DoCheckForIADUpdatesL(); + + if ( aDocumentName.Length() > 0 && EApaCommandOpen == aCommand ) + { + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + iNavigationalState->SetBackExitStatus( EFalse ); + path->AppendL( KGlxCollectionPluginImageViewerImplementationUid ); + iNavigationalState->NavigateToL( *path ); + CleanupStack::PopAndDestroy( path ); + } + else + { + HandleActivationMessageL( aData ); + } + + // Introduced to fix bug EMJN-78GH6N. Rowland Cook 10/12/2007 + if (0 != iEikonEnv->RootWin().OrdinalPosition()) + { + iEikonEnv->RootWin().SetOrdinalPosition(0); + } + } + +// --------------------------------------------------------------------------- +// HandleActivationMessageL +// --------------------------------------------------------------------------- +// +void CGlxAppUi::HandleActivationMessageL(const TDesC8& aData) + { + TRACER("void CGlxAppUi::HandleActivationMessageL(const TDesC8& aData)"); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + + delete iActivationParam; + iActivationParam = NULL; + + TUid msgUid; + RDesReadStream stream(aData); + CleanupClosePushL(stream); + stream >> msgUid; + + //Check for the IADUpdate + //TBD: Need to check the location this has to be called. + //This might not be proper place. + DoCheckForIADUpdatesL(); + + switch ( msgUid.iUid ) + { + case KGlxActivationCmdShowLastModified: + // Go to camera album full screen view + GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: show last modified"); + // Send the command to reset the view + ProcessCommandL(EGlxCmdResetView); + // Not using KGlxCollectionPluginCameraImplementationUid + path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + path->AppendL(KCapturedAlbumId); + SetActivationParamL(KGlxActivationFullScreen); + break; + + case KGlxActivationCameraAlbum: + // Go to camera album tile view + GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: camera album"); + path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + path->AppendL(KCapturedAlbumId); + break; + + case KGlxActivationPhotosMenu: + // Open the main view + GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: photos menu"); + break; + + default: + GLX_LOG_INFO("CGlxAppUi::HandleActivationMessageL: unknown command"); + + + if(0 == aData.CompareC(KPhotosCaptured)) + { + iNavigationalState->SetBackExitStatus(ETrue); + path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + path->AppendL(KCapturedAlbumId); + } + else if(0 == aData.CompareC(KPhotosAllValue)) + { + iNavigationalState->SetBackExitStatus(ETrue); + path->AppendL(KGlxCollectionPluginAllImplementationUid); + } + else if(0 == aData.CompareC(KPhotosMonths)) + { + iNavigationalState->SetBackExitStatus(ETrue); + path->AppendL(KGlxCollectionPluginMonthsImplementationUid); + } + else if(0 == aData.CompareC(KPhotosAlbums)) + { + iNavigationalState->SetBackExitStatus(ETrue); + path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + } + else if(0 == aData.CompareC(KPhotosTags)) + { + iNavigationalState->SetBackExitStatus(ETrue); + path->AppendL(KGlxTagCollectionPluginImplementationUid); + } + else + { + User::Leave(KErrNotSupported); + } + TBuf8<15> buf; + buf.Append( KPhotosSuiteNavigation ); + TRAP_IGNORE(iBSWrapper->ForwardActivationEventL( buf, ETrue )) + + break; + } + CleanupStack::PopAndDestroy(&stream); + iNavigationalState->NavigateToL( *path ); + CleanupStack::PopAndDestroy(path); + + // Introduced to fix bug EMJN-78GH6N. Rowland Cook 10/12/2007 + if (0 != iEikonEnv->RootWin().OrdinalPosition()) + { + iEikonEnv->RootWin().SetOrdinalPosition(0); + } + } + +// --------------------------------------------------------------------------- +// SetActivationParamL +// --------------------------------------------------------------------------- +// +void CGlxAppUi::SetActivationParamL(const TDesC8& aParam) + { + TRACER("void CGlxAppUi::SetActivationParamL(const TDesC8& aParam)"); + iActivationParam = HBufC::NewL(aParam.Length()); + iActivationParam->Des().Copy(aParam); + } + +// --------------------------------------------------------------------------- +// RequestFreeMemory +// --------------------------------------------------------------------------- +// +TInt CGlxAppUi::OOMRequestFreeMemoryL( TInt aBytesRequested) + { + TRACER("TInt CGlxAppUi::OOMRequestFreeMemoryL( TInt aBytesRequested)"); + GLX_LOG_INFO1("CGlxAppUi::OOMRequestFreeMemoryL() aBytesRequested=%d", + aBytesRequested); + + ROomMonitorSession oomMonitor; + User::LeaveIfError( oomMonitor.Connect() ); + // No leaving code after this point, so no need to use cleanup stack + // for oomMonitor + TInt errorCode = oomMonitor.RequestFreeMemory( aBytesRequested ); + GLX_LOG_INFO1("CGlxAppUi::OOMRequestFreeMemoryL(1) errorCode=%d",errorCode); + if ( errorCode != KErrNone ) + { + // try one more time + errorCode = oomMonitor.RequestFreeMemory( aBytesRequested ); + GLX_LOG_INFO1("CGlxAppUi::OOMRequestFreeMemoryL(2) errorCode=%d",errorCode); + } + oomMonitor.Close(); + return errorCode; + } + + +// --------------------------------------------------------------------------- +// ReserveMemory +// --------------------------------------------------------------------------- +// +TInt CGlxAppUi::ReserveMemoryL(TInt aCriticalMemoryRequired) + { + TRACER("void CGlxAppUi::ReserveMemory(TInt aCriticalMemoryRequired)"); + + TInt memoryLeft = 0; + TInt error = KErrNone ; + HAL::Get( HALData::EMemoryRAMFree, memoryLeft ); + GLX_LOG_INFO2("CGlxAppUi::ReserveMemoryL() - aCriticalMemoryRequired=%d, memoryLeft=%d", + aCriticalMemoryRequired, memoryLeft); + if ( aCriticalMemoryRequired > memoryLeft ) + { + // Request for critical memory required + error = OOMRequestFreeMemoryL( aCriticalMemoryRequired); + GLX_LOG_INFO1("CGlxAppUi::ReserveMemoryL() - OOMRequestFreeMemoryL() error=%d", error); + } + return error; + } + +// --------------------------------------------------------------------------- +// CriticalRamMemory +// --------------------------------------------------------------------------- +// +TInt CGlxAppUi::RamRequiredInBytesL(TEntryType aType) + { + TRACER("TInt CGlxAppUi::RamRequiredInBytesL(TEntryType aType)"); + TSize gridIconSize = iUiUtility->GetGridIconSize(); + TInt criticalRamMemory = 0 ; + TSize displaySize = iUiUtility->DisplaySize(); + TInt itemsInPage = iUiUtility->VisibleItemsInPageGranularityL(); + if(EEntryTypeStartUp == aType) + { + // This is Bare Minimum Required Memory for Photos to start + // For Framework to work and to do the on-the-fly decoding + // for the just captured picture = KGlxMemoryForOOMFwk + KGlxMaxMemoryToDecodeCapturedPicture + // For Grid Number of pages * Thumbnail width * Thumbnail Height * KGlxThumbNailRepresentation * + // Number of images in a page + + // For FullScreen to Work Number of Thumbnails * Width * Height * Representation + criticalRamMemory = KGlxMemoryForOOMFwk + KGlxMaxMemoryToDecodeCapturedPicture + + (KGlxFullThumbnailCount * + displaySize.iWidth * displaySize.iHeight * + KGlxThumbNailRepresentation ) + + (KGlxGridThumbnailPages * + itemsInPage * gridIconSize.iWidth * + gridIconSize.iHeight * + KGlxThumbNailRepresentation); + + GLX_LOG_INFO1("CGlxAppUi::RamRequiredInBytesL(EEntryTypeStartUp): criticalRamMemory=%d", + criticalRamMemory); + } + else + { + GLX_LOG_INFO("CGlxAppUi::RamRequiredInBytesL(): Photos Already Running"); + } + + return criticalRamMemory; + } + +// --------------------------------------------------------------------------- +// ReserveMemoryL +// --------------------------------------------------------------------------- +// +void CGlxAppUi::ReserveMemoryL(TEntryType aType) + { + TRACER("TInt CGlxAppUi::ReserveMemoryL(TEntryType aType)"); + + TInt error = ReserveMemoryL(RamRequiredInBytesL(aType)); + GLX_LOG_INFO1("CGlxAppUi::ReserveMemoryL() error=%d", error); + + if (KErrNoMemory == error) + { + GLX_LOG_INFO("CGlxAppUi::ReserveMemoryL(): LEAVE with KErrNoMemory "); + User::Leave(KErrNoMemory); + } + } + +//OOM + +// --------------------------------------------------------------------------- +// HandleApplicationSpecificEventL +// Handle OOM events. +// --------------------------------------------------------------------------- +// + +void CGlxAppUi::HandleApplicationSpecificEventL(TInt aEventType, const TWsEvent& aWsEvent) +{ +TRACER("CGlxAppUi::HandleApplicationSpecificEventL"); +CAknViewAppUi::HandleApplicationSpecificEventL(aEventType,aWsEvent); + if(aWsEvent.Type() == KAknUidValueEndKeyCloseEvent) + { + /** + * Making the flag etrue ensures that it will not call LaunchMmViewL in handlecommandl while + * red key is pressed. Otherwise it will launch matrix menu, not idle screen. + */ + iEndKeyPressed = ETrue; + ClosePhotosL(); + } +switch(aEventType) + { + case KAppOomMonitor_FreeRam: + { + StartCleanupL(); + } + break; + case KAppOomMonitor_MemoryGood: + { + StopCleanupL(); + } + break; + default: + break; + } +} + +// --------------------------------------------------------------------------- +// StartCleanup +// Initiate cleanup from cache manager on low memory event +// --------------------------------------------------------------------------- +// +void CGlxAppUi::StartCleanupL() + { + MGlxCache* cacheManager = MGlxCache::InstanceL(); + cacheManager->ReleaseRAML(); + cacheManager->Close(); + } + +// --------------------------------------------------------------------------- +// StopCleanup +// Cancel cache cleanup on memory good event +// --------------------------------------------------------------------------- +// +void CGlxAppUi::StopCleanupL() + { + MGlxCache* cacheManager = MGlxCache::InstanceL(); + cacheManager->StopRAMReleaseL(); + cacheManager->Close(); + } + +// --------------------------------------------------------------------------- +// CCGlxNsAppUi::DoCheckForIADUpdatesL() +// Check for updates via IAD +// --------------------------------------------------------------------------- +// +void CGlxAppUi::DoCheckForIADUpdatesL() + { + TRACER("CGlxNsAppUi::CheckForUpdatesL()"); + + if ( !iIadUpdate ) + { + iIadUpdate = CGlxIadUpdate::NewL(); + } + iIadUpdate->StartL(); + } + +// --------------------------------------------------------------------------- +// LaunchMmViewL +// +// --------------------------------------------------------------------------- +// +void CGlxAppUi::LaunchMmViewL( const TDesC8& aMessage ) + { + TRACER("CGlxNsAppUi::LaunchMmViewL()"); + TApaTaskList taskList( iCoeEnv->WsSession() ); + TApaTask task = taskList.FindApp( TUid::Uid( KMatrixUid ) ); + + if ( task.Exists() ) + { + task.SendMessage( TUid::Uid( KUidApaMessageSwitchOpenFileValue ),aMessage ); + } + else + { // app not yet running + RApaLsSession appArcSession; + CleanupClosePushL( appArcSession ); + User::LeaveIfError( appArcSession.Connect() ); + TApaAppInfo appInfo; + TInt err = appArcSession.GetAppInfo( appInfo, + TUid::Uid( KMatrixUid ) ); + if( err == KErrNone ) + { + CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); + cmdLine->SetExecutableNameL( appInfo.iFullName ); + cmdLine->SetCommandL( EApaCommandRun ); + cmdLine->SetTailEndL( aMessage ); + appArcSession.StartApp( *cmdLine ); + CleanupStack::PopAndDestroy( cmdLine ); + } + CleanupStack::PopAndDestroy( &appArcSession ); + } + } + +// ----------------------------------------------------------------------------- +// ClosePhotosL +// ----------------------------------------------------------------------------- +// +void CGlxAppUi::ClosePhotosL() + { + TRACER("CGlxNsAppUi::ClosePhotosL()"); + iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards); + //Temparory fix provided for Kern Exec 3 bug + //UPnP Stop Showin is explicitly called when exiting the gallery + GlxUpnpRenderer:: StopShowingL(); + + iUiUtility->SetExitingState(ETrue); + GLX_LOG_INFO("CGlxAppUi::HandleWsEventL: Exit() for C key being Called"); + + } +//OOM diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/src/glxdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/src/glxdocument.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2008-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: Document class +* +*/ + +#include + +#include "glxappui.h" +#include "glxdocument.h" +#include +#include + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxDocument* CGlxDocument::NewL(CEikApplication& aApp) + { + TRACER("CGlxDocument::NewL"); + CGlxDocument* self = NewLC(aApp); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +// +CGlxDocument* CGlxDocument::NewLC(CEikApplication& aApp) + { + TRACER("CGlxDocument::NewLC"); + CGlxDocument* self = new (ELeave) CGlxDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxDocument::ConstructL() + { + TRACER("CGlxDocument::ConstructL"); + iViewUtility = MMPXViewUtility::UtilityL(); + iImageViewerInstance = CGlxImageViewerManager::InstanceL(); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxDocument::CGlxDocument(CEikApplication& aApp) : CAknDocument(aApp) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxDocument::~CGlxDocument() + { + TRACER("CGlxDocument::~CGlxDocument()"); + if (iViewUtility != NULL) + { + iViewUtility->Close(); + } + if ( NULL != iImageViewerInstance) + { + iImageViewerInstance->DeleteInstance(); + } + } + +// ----------------------------------------------------------------------------- +// CGlxDocument::OpenFileL() +// Open document. +// ----------------------------------------------------------------------------- +void CGlxDocument::OpenFileL( CFileStore*& /*aFileStore*/, RFile& aFile ) + { + TRACER("CGlxDocument::OpenFileL()"); + // Make sure that aFile is closed in leave situation + CleanupClosePushL( aFile ); + + // Reset old data + ResetDocument(); + iImageViewerInstance->SetImageFileHandleL(aFile); + CleanupStack::PopAndDestroy(); // Close aFile + } + +// ---------------------------------------------------------------------------- +// CGlxDocument::ResetDocument +// Reset the document +// ---------------------------------------------------------------------------- +// +void CGlxDocument::ResetDocument() + { + TRACER("CGlxDocument::ResetDocument()"); + // Set document to NULL + iImageViewerInstance->Reset(); + } + +// ----------------------------------------------------------------------------- +// CreateAppUiL +// ----------------------------------------------------------------------------- +// +CEikAppUi* CGlxDocument::CreateAppUiL() + { + TRACER("CGlxDocument::CreateAppUiL()"); + // Create the application user interface, and return a pointer to it, + // the framework takes ownership of this object + CEikAppUi* appUi = new (ELeave) CGlxAppUi(); + return appUi; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/gallery/xml_data/Photos_settings.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/gallery/xml_data/Photos_settings.xml Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + 1 + 1 + + \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Build information for project mgallery. +* +*/ + + + + + + +#include + +PRJ_PLATFORMS +DEFAULT + +// Help exports +#include "../help/group/bld.inf" + + +PRJ_EXPORTS +../rom/glxgallery.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxgallery.iby) +../rom/glxgallery_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(glxgallery_resources.iby) + + +#ifdef APP_LAYER_LOC_EXPORT_PATH +// export engineering english loc file +../gallery/loc/photos.loc APP_LAYER_LOC_EXPORT_PATH(photos.loc) +#endif + + +// Include the glxlogging.dll +#include "../logging/group/bld.inf" + +// Include the glxcommon dll +#include "../common/group/bld.inf" + +// Include the glxcommonui dll +#include "../commonui/group/bld.inf" + +// include the collection framework subsystem +#include "../collectionframework/group/bld.inf" + +// include the icons +#include "../icons/bld.inf" + +// include the image viewer +#include "../controllers/imageviewer/group/bld.inf" + +// include the view framework subsystem +#include "../viewframework/group/bld.inf" + +// include the controllers subsystem +#include "../controllers/group/bld.inf" + +// Include the application +#include "../gallery/group/bld.inf" + +// include the slideshow build +#include "../slideshow/group/bld.inf" + + +#include "../contentharvesterplugin/group/bld.inf" +#include "../photossuite/group/bld.inf" + +//include photos memory plug-in +#include "../memoryplugin/group/bld.inf" + +//include Photos Suite Launcher +#include "../photossuitelauncher/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/group/glxbuildcommon.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/group/glxbuildcommon.mmh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Generic project definition file for gallery. +* +*/ + + +OPTION CW -W empty,possible,unused,pedantic,largeargs,structclass,missingreturn +//OPTION CW -W empty,possible,unused,pedantic,largeargs,structclass,missingreturn,err +//OPTION ARMCC --diag_error 111,177,546,940,1299,2874 +//OPTION ARMCC --diag_warning 111,177,546,940,1299,2874 + +VENDORID VID_DEFAULT + +LIBRARY glxlogging.lib + +// End of file \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/help/data/xhtml.zip Binary file photosgallery/help/data/xhtml.zip has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/help/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* 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: +* Export help related files. +* +*/ + +#include +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/lgal.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/lgal.hlp.hrh) +../rom/photossuitehelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(photossuitehelps_variant.iby) diff -r 000000000000 -r 4e91876724a2 photosgallery/help/inc/lgal.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/help/inc/lgal.hlp.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* 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: +* +*/ + +// +// lgal.hlp.hrh generated by CSXHelp Utilities. +// + +#ifndef __LGAL_HLP_HRH__ +#define __LGAL_HLP_HRH__ + +_LIT(KLGAL_HLP_ALBUM_LIST, "LGAL_HLP_ALBUM_LIST"); // +_LIT(KLGAL_HLP_ALL_GRID, "LGAL_HLP_ALL_GRID"); // +_LIT(KLGAL_HLP_ALBUM_GRID, "LGAL_HLP_ALBUM_GRID"); // +_LIT(KLGAL_HLP_CAPTURED_GRID, "LGAL_HLP_CAPTURED_GRID"); // +_LIT(KLGAL_HLP_TAGS_GRID, "LGAL_HLP_TAGS_GRID"); // +_LIT(KLGAL_HLP_DETAILS_VIEW, "LGAL_HLP_DETAILS_VIEW"); // +_LIT(KLGAL_HLP_METADATA_VIEW, "LGAL_HLP_METADATA_VIEW"); // +_LIT(KLGAL_HLP_TAGS_BROWSER, "LGAL_HLP_TAGS_BROWSER"); // +_LIT(KLGAL_HLP_MONTH_FULLSCREEN, "LGAL_HLP_MONTH_FULLSCREEN"); // +_LIT(KLGAL_HLP_CAPTURED_FULLSCREEN, "LGAL_HLP_CAPTURED_FULLSCREEN"); // +_LIT(KLGAL_HLP_MONTH_GRID, "LGAL_HLP_MONTH_GRID"); // +_LIT(KLGAL_HLP_VIEW_LIST, "LGAL_HLP_VIEW_LIST"); // +_LIT(KLGAL_HLP_MONTH_LIST, "LGAL_HLP_MONTH_LIST"); // +_LIT(KLGAL_HLP_SLIDESHOW_SETTINGS, "LGAL_HLP_SLIDESHOW_SETTINGS"); // +_LIT(KLGAL_HLP_ALL_FULLSCREEN, "LGAL_HLP_ALL_FULLSCREEN"); // +_LIT(KLGAL_HLP_ALBUM_FULLSCREEN, "LGAL_HLP_ALBUM_FULLSCREEN"); // +_LIT(KLGAL_HLP_TAGS_FULLSCREEN, "LGAL_HLP_TAGS_FULLSCREEN"); // + +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/help/rom/photossuitehelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/help/rom/photossuitehelps_variant.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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: Help project iby file. +* +*/ + + +#ifndef __PHOTOSSUITEHELPS_VARIANT_IBY__ +#define __PHOTOSSUITEHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x200009EE\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x200009EE\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x200009EE\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x200009EE\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x200009EE\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x200009EE\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x200009EE\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x200009EE\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/icons/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/icons/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information for mgallery icons. +* +*/ + +// This are temporary files exported , would be removed once the layout icons from s60 are received. +PRJ_EXPORTS +qgn_lgal_bg.svg /epoc32/s60/icons/qgn_lgal_bg.svg +qgn_lgal_fav2.svg /epoc32/s60/icons/qgn_lgal_fav2.svg +qgn_lgal_fav1.svg /epoc32/s60/icons/qgn_lgal_fav1.svg +save.svg /epoc32/s60/icons/save.svg +use_as.svg /epoc32/s60/icons/use_as.svg + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE glx_aif.mif +OPTION SOURCEDIR ../icons +OPTION SOURCES -c32 qgn_menu_photos.svg +END + +START EXTENSION s60/mifconv +OPTION TARGETFILE glxicons.mif +OPTION HEADERFILE glxicons.mbg +OPTION SOURCEDIR ../icons +OPTION SOURCEFILE iconlist.txt +END \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/icons/iconlist.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/icons/iconlist.txt Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,45 @@ +-c8,8 qgn_indi_media_fullscreen_play.svg +-c8,8 qgn_indi_media_thumbnail.svg +-c8,8 qgn_prop_download_images.svg +-c8,8 qgn_prop_download_video.svg +-c8,8 qgn_indi_gallery_edit_add.svg +-c8,8 qgn_indi_tb_slideshow.svg +-c8,8 qgn_indi_tb_new_album.svg +-c8,8 qgn_graf_mediatag_side_r.svg +-c8,8 qgn_graf_mediatag_bubble_tail.svg +-c8,8 qgn_graf_mediatag_bubble_side_t.svg +-c8,8 qgn_graf_mediatag_bubble_side_l.svg +-c8,8 qgn_graf_mediatag_bubble_side_b.svg +-c8,8 qgn_graf_mediatag_bubble_corner_tr.svg +-c8,8 qgn_graf_mediatag_bubble_corner_tl.svg +-c8,8 qgn_graf_mediatag_bubble_corner_br.svg +-c8,8 qgn_graf_mediatag_bubble_corner_bl.svg +-c8,8 qgn_graf_mediatag_bubble_center.svg +-c8,8 qgn_indi_mg_tvscreen.svg +-c8,8 qgn_prop_image_notcreated.svg +-c8,8 qgn_prop_file_video.svg +-c8,8 qgn_prop_image_corrupted.svg +-c8,8 qgn_prop_video_corrupted.svg +-c8,8 qgn_indi_cam4_geotag_on.svg +-c8,8 qgn_indi_cam4_tb_upload.svg +-c8,8 qgn_indi_cam4_tb_mark.svg +-c8,8 qgn_indi_tb_gallery_rename.svg +-c8,8 qgn_indi_tb_unmark.svg +-c8,8 qgn_indi_cam4_tb_send.svg +-c8,8 qgn_indi_cam4_tb_delete.svg +-c8,8 qgn_menu_photos.svg +-c8,8 qgn_prop_album_photo_small.svg +-c8,8 qgn_indi_mup_speaker.svg +-c8,8 qgn_indi_mup_speaker_muted.svg +-c8,8 qgn_indi_fmgr_ms_add.svg +-c8,8 qgn_indi_phone_add.svg +-c8,8 qgn_prop_drm_rights_valid_super.svg +-c8,8 qgn_prop_drm_rights_exp_super.svg +-c8,8 qgn_indi_mmc_add.svg +-c8,8 qgn_graf_adapt_search_bg.svg +-c8,8 qgn_menu_maps.svg +-c8,8 qgn_lgal_fav1.svg +-c8,8 qgn_lgal_fav2.svg +-c8,8 qgn_lgal_bg.svg +-c8,8 save.svg +-c8,8 use_as.svg diff -r 000000000000 -r 4e91876724a2 photosgallery/icons/qgn_lgal_bg.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/icons/qgn_lgal_bg.svg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,12 @@ + + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/icons/qgn_lgal_fav1.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/icons/qgn_lgal_fav1.svg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/icons/qgn_lgal_fav2.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/icons/qgn_lgal_fav2.svg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/icons/save.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/icons/save.svg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/icons/use_as.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/icons/use_as.svg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxalfhelper.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxalfhelper.mmh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,24 @@ + +/* +* 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: Generic project definition file for gallery. + * +*/ + + + +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_STDCPP_SYSTEMINCLUDE + +LIBRARY libpthread.lib diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxassert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxassert.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008-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: Type-safe unique id template +* +*/ + + + +#ifndef GLXASSERT_H +#define GLXASSERT_H + +#include +#include // enable client to directly use GLX - Panic + +/** + * Used to assert the truth of some condition. If the condition is false, logging will be performed + * and appropriate action taken. Unlike GLX_ASSERT_DEBUG it is defined in both release and debug builds. + * + * Logging is performed using GLX_LOG_WARNING and is subject to GLX_LOG_WARNING being enabled. + * + * Code is generated for both debug and release builds. + * + * @param c A conditional expression which results in true or false. + * @param p A function which is called if the conditional expression c is false. + * @param l logging that is performed before function p is called. + * + * @see GLX_ASSERT_DEBUG + * @see GLX_LOG_WARNING + */ +#define GLX_ASSERT_ALWAYS( c, p, l ) \ + { \ + if ( !( c ) ) \ + { \ + GLX_LOG_WARNING( l ); \ + p; \ + } \ + } + +#ifdef _DEBUG +/** + * Used to assert the truth of some condition. If the condition is false, logging will be performed + * and appropriate action taken. Used in the same way as GLX_ASSERT_ALWAYS, except that it is only + * defined for debug builds. + * + * Logging is performed using GLX_LOG_WARNING and is subject to GLX_LOG_WARNING being enabled. + * + * Code is generated for debug builds only. + * + * @param c A conditional expression which results in true or false. + * @param p A function which is called if the conditional expression c is false. + * @param l logging that is performed before function p is called. + * + * @see GLX_ASSERT_ALWAYS + * @see GLX_LOG_WARNING + */ +# define GLX_ASSERT_DEBUG( c, p, l ) GLX_ASSERT_ALWAYS( c, p, l ) +#else // _DEBUG +# define GLX_ASSERT_DEBUG( c, p, l ) +#endif // _DEBUG + +#endif //GLXASSERT_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxbackgroundtnmessagedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxbackgroundtnmessagedefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008-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: Background Thumbnail messages +* +*/ + + + + +#ifndef _GLXBACKGROUNDTNMESSAGEDEFS_H +#define _GLXBACKGROUNDTNMESSAGEDEFS_H + +#include + +class CFbsBitmap; + +/** + * Background Thumbnail message + */ +const TInt KGlxMessageIdBackgroundThumbnail = 0x2000A76E; + +/** + * Attributes supported for KGlxMessageIdBackgroundThumbnail + */ +/** + * TMPXItemId (as def'd in CollectionPath) + * ID of media changed + */ +const TMPXAttributeData KGlxBackgroundThumbnailMediaId={KGlxMessageIdBackgroundThumbnail, 0x01}; +/** + * TSize + * (Optional) size of thumbnail created + */ +const TMPXAttributeData KGlxBackgroundThumbnailSize={KGlxMessageIdBackgroundThumbnail, 0x02}; +/** + * TInt + * (Optional) size of thumbnail created + */ +const TMPXAttributeData KGlxBackgroundThumbnailError={KGlxMessageIdBackgroundThumbnail, 0x04}; + + +#endif // _GLXBACKGROUNDTNMESSAGEDEFS_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxcapabilities.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxcapabilities.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Capabilities definition +* +*/ + + + + +#ifndef GLXCAPABILITIES_HRH +#define GLXCAPABILITIES_HRH + +#define GLX_CAPABILITIES LocalServices ReadUserData WriteUserData \ + ReadDeviceData WriteDeviceData DRM SwEvent \ + NetworkServices + +#endif // GLXCAPABILITIES_HRH diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxcollectionmessagedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxcollectionmessagedefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2008-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: Definitions for media attributes +* +*/ + + + + +#ifndef __T_GLXCOLLECTIONMESSAGEDEFS_H__ +#define __T_GLXCOLLECTIONMESSAGEDEFS_H__ + +#include + +/** +* Content ID identifying progress messages +*/ +const TInt KGlxCollectionMessageSpecific = 0x2000A763; + +/** +* Attributes supported for KGlxMediaIdCollectionPluginSpecific +*/ +enum + { + /** + * TMPXItemId + */ + EGlxCollectionMessageContainerId = 0x01, + + /** + * TMPXGeneralCategory + */ + EGlxCollectionMessageContainerCategory = 0x02, + + /** + * TBool + */ + EGlxCollectionMessageContainerCameraAlbum = 0x04 + + }; +// TMPXItemId +const TMPXAttributeData KGlxCollectionMessageContainerId = {KGlxCollectionMessageSpecific, EGlxCollectionMessageContainerId}; +// TMPXGeneralCategory +const TMPXAttributeData KGlxCollectionMessageContainerCategory = {KGlxCollectionMessageSpecific, EGlxCollectionMessageContainerCategory}; +// TBool +const TMPXAttributeData KGlxCollectionMessageContainerCameraAlbum = {KGlxCollectionMessageSpecific, EGlxCollectionMessageContainerCameraAlbum}; + +#endif // __T_GLXCOLLECTIONMESSAGEDEFS_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxcommandgeneraldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxcommandgeneraldefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2008-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: Definitions for command type +* +*/ + + + + + +#ifndef __T_GLXCOMMANDGENERALDEFS_H__ +#define __T_GLXCOMMANDGENERALDEFS_H__ + +#include + +// Unique command ids +const TUint32 KGlxCommandIdAdd = 0x200071A0; +const TUint32 KGlxCommandIdRemove = 0x200071A1; +const TUint32 KGlxCommandIdSet = 0x200071A2; +const TUint32 KGlxCommandThumbnailCleanup = 0x200071A3; +/// @todo Should these UIDs be properly described in \doc\allocated_uid_list.txt? + +const TUint32 KGlxContainerDevice = 0; + +#endif // __T_GLXCOMMANDGENERALDEFS_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxcontrolgroupid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxcontrolgroupid.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2008-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: Control Group ids +* +*/ + + + + +#ifndef __GLXCONTROLGROUPID_HRH__ +#define __GLXCONTROLGROUPID_HRH__ + +// CONSTANTS + +enum TGlxControlGroupId + { + //List View + EGlxMainListControlId = 0x111, + EGlxMonthsListControlId, + EGlxAlbumListControlID, + EGlxAlbumGridControlID, + EGlxTagsGridControlID, + EGlxMonthsGridControlID, + EGlxDownloadsGridControlID, + EGlxCapturedGridControlID, + EGlxMainGridControlID, + EGlxAlbumFullScreenControlID, + EGlxTagsFullScreenControlID, + EGlxMonthsFullScreenControlID, + EGlxDownloadsFullScreenControlID, + EGlxCapturedFullScreenControlID, + EGlxMainFullScreenControlID + }; + + + + + +#endif // __GLXCONTROLGROUPID_HRH__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxerrors.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxerrors.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Photos errors codes +* +*/ + + + + +#ifndef T_GLXERRORS_H +#define T_GLXERRORS_H + +#include + +const TInt KErrGlxEmptyContainer = -9001; + +#endif // T_GLXERRORS_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxfiltergeneraldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxfiltergeneraldefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2008-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: Definitions for media attributes +* +*/ + + + + +#ifndef __T_GLXFILTERGENERALDEFS_H__ +#define __T_GLXFILTERGENERALDEFS_H__ + +#include +#include + +/** +* Content ID identifying filter messages +*/ +const TInt KGlxFilterIdGeneral = 0x2000A777; + +/** +* Attributes supported for KGlxFilterIdGeneral +*/ +enum + { + /** + * Filter + * specifying sort order + */ + + EGlxFilterSortType = 0x01, + + EGlxFilterSortDirection = 0x02, + + EGlxFilterIncludeCameraAlbum = 0x04, + + EGlxFilterMinItemCount = 0x08, + + EGlxFilterContainsItem = 0x10, + + EGlxFilterLastCaptureDate = 0x20, + + EGlxFilterExcludeAnimation = 0x40, + + EGlxFilterThumbnailLoadability = 0x80, + + EGlxFilterMPXCollectionPath = 0x100, + + EGlxFilterItemType = 0x200, + + EGlxFilterUri = 0x400, + + EGlxFilterSortOrderPromoteSystemItems = 0x0800, + + EGlxFilterOrigin = 0x1000, + + EGlxFilterNoDRM = 0x2000 + + }; + +/** +* Attributes supported for KGlxFilterIdGeneral +*/ +const TMPXAttributeData KGlxFilterGeneralSortType = { KGlxFilterIdGeneral, EGlxFilterSortType }; // TGlxFilterSortOrder +const TMPXAttributeData KGlxFilterGeneralSortDirection = { KGlxFilterIdGeneral, EGlxFilterSortDirection }; // TGlxFilterSortDirection +const TMPXAttributeData KGlxFilterGeneralIncludeCameraAlbum = { KGlxFilterIdGeneral, EGlxFilterIncludeCameraAlbum }; // TBool +const TMPXAttributeData KGlxFilterGeneralMinCount = { KGlxFilterIdGeneral, EGlxFilterMinItemCount }; // TInt +const TMPXAttributeData KGlxFilterGeneralItemId = { KGlxFilterIdGeneral, EGlxFilterContainsItem }; // TMPXItemId +const TMPXAttributeData KGlxFilterGeneralExcludeAnimation = { KGlxFilterIdGeneral, EGlxFilterExcludeAnimation }; // TBool +const TMPXAttributeData KGlxFilterGeneralLastCaptureDate = { KGlxFilterIdGeneral, EGlxFilterLastCaptureDate }; // TBool ? +const TMPXAttributeData KGlxFilterGeneralThumbnailLoadability = { KGlxFilterIdGeneral, EGlxFilterThumbnailLoadability }; // TSize +const TMPXAttributeData KGlxFilterGeneralMPXCollectionPath = { KGlxFilterIdGeneral, EGlxFilterMPXCollectionPath }; // CMPXCollectionPath +const TMPXAttributeData KGlxFilterGeneralItemType = { KGlxFilterIdGeneral, EGlxFilterItemType }; // TGlxFilterItemType +const TMPXAttributeData KGlxFilterGeneralUri = { KGlxFilterIdGeneral, EGlxFilterUri }; // Text +const TMPXAttributeData KGlxFilterGeneralSortOrderPromoteSystemItems = { KGlxFilterIdGeneral, EGlxFilterSortOrderPromoteSystemItems }; // TBool +const TMPXAttributeData KGlxFilterGeneralOrigin = { KGlxFilterIdGeneral, EGlxFilterOrigin }; /// TGlxFilterOrigin +const TMPXAttributeData KGlxFilterGeneralNoDRM = { KGlxFilterIdGeneral, EGlxFilterNoDRM }; /// TBool +const TMPXAttributeData KGlxFilterGeneralNavigationalStateOnly = { KGlxFilterIdGeneral, 0x4000 }; /// TBool + +enum TGlxFilterSortOrder + { + EGlxFilterSortOrderNotUsed, + EGlxFilterSortOrderAlphabetical, + EGlxFilterSortOrderItemCount, + EGlxFilterSortOrderCaptureDate, + EGlxFilterSortOrderModifiedDate + }; + +enum TGlxFilterSortDirection + { + EGlxFilterSortDirectionNotUsed, + EGlxFilterSortDirectionReverse, + EGlxFilterSortDirectionAscending, + EGlxFilterSortDirectionDescending, + EGlxFilterSortDirectionOverrideToDescendingIfDate + }; + +enum TGlxFilterItemType + { + EGlxFilterItemAll, + EGlxFilterMediaTypeSuppliedInFilter, + EGlxFilterImage, + EGlxFilterVideo, + EGlxFilterVideoAndImages, + EGlxFilterAlbum, + EGlxFilterTag, + EGlxFilterMonth + }; + +enum TGlxFilterOrigin + { + EGlxFilterOriginNotUsed=0, + EGlxFilterOriginCamera, + EGlxFilterOriginDownload, + EGlxFilterOriginAll + }; + +#endif // __T_GLXFILTERGENERALDEFS_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxfilterproperties.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxfilterproperties.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2008-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: Represents a set of filter properties +* +*/ + + + + +#ifndef T_GLXFILTERPROPERTIES_H +#define T_GLXFILTERPROPERTIES_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CMPXCollectionPath; + +// CONSTANTS + +// CLASS DECLARATION + + +class TGlxFilterProperties + { +public: + inline TGlxFilterProperties () : + iSortOrder(EGlxFilterSortOrderNotUsed), + iSortDirection(EGlxFilterSortDirectionNotUsed), + iIncludeCameraAlbum(ETrue), + iMinCount(0), + iContainsItem(0), + iExcludeAnimation(EFalse), + iLastCaptureDate(EFalse), + iThumbnailLoadability(0,0), + iPath(NULL), + iItemType(EGlxFilterVideoAndImages), + iPromoteSystemItems(EFalse), + iOrigin(EGlxFilterOriginNotUsed), + iUri(NULL), + iStartDate(0), + iEndDate(0), + iNoDRM(EFalse) + {} + +public: + TGlxFilterSortOrder iSortOrder; + TGlxFilterSortDirection iSortDirection; + TBool iIncludeCameraAlbum; + TInt iMinCount; + TGlxMediaId iContainsItem; + TBool iExcludeAnimation; + TBool iLastCaptureDate; + TSize iThumbnailLoadability; + CMPXCollectionPath* iPath; + TGlxFilterItemType iItemType; + TBool iPromoteSystemItems; + TGlxFilterOrigin iOrigin; + const TDesC* iUri; + TTime iStartDate; + TTime iEndDate; + TBool iNoDRM; + }; + + +#endif // T_GLXFILTERPROPERTIES_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxhierarchyid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxhierarchyid.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2008-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: Media list hierarchy id +* +*/ + + + + +#ifndef T_GLXHIERARCHYID_H +#define T_GLXHIERARCHYID_H + +#include + +#include "glxid.h" + +/** + * TGlxIdHierarchyBase + * + * Don't use this. This is just to make TGlxId type-safe for TGlxHierarchyId + * + * @lib none + */ +class TGlxIdHierarchyBase {}; + +/** + * TGlxHierarchyId + * + * Typesafe Hierarchy identifier. + * + * @lib none + */ +typedef TGlxId TGlxHierarchyId; + +#endif // T_GLXHIERARCHYID_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxid.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2008-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: Type-safe unique id template +* +*/ + + + + +#ifndef T_GLXID_H +#define T_GLXID_H + +#include "e32std.h" +#include "glxpanic.h" + +/** Invalid or undefined id value */ +// Use "id == KGlxIdNone" and "id != KGlxIdNone" to check for +// id validity. +class TGlxIdNone {}; +const TGlxIdNone KGlxIdNone = TGlxIdNone(); + +/** + * TGlxId + * + * Type-safe template for ids + * Id value of KMaxTUint is consided to be undefined. + * @usage Define like this: + * class TMyIdBase {}; + * typedef TGlxId TMyId; + * Now use can use TMyId in other code + */ +template +class TGlxId : public T { +public: + inline TGlxId(); + inline TGlxId(const TGlxId& aId); + inline TGlxId(TUint aIdValue); + inline TGlxId(const TGlxIdNone&); + inline TGlxId& operator=(const TGlxId& aId); + inline TGlxId& operator=(TUint aIdValue); + + inline TGlxId& operator=(const TGlxIdNone&); + inline TGlxId operator++(int); // Postfix, keep dummy parameter as int + inline TBool operator!=(const TGlxId& aId) const; + inline TBool operator==(const TGlxId& aId) const; + inline TBool operator!=(const TGlxIdNone&) const; + inline TBool operator==(const TGlxIdNone&) const; + inline TBool operator>(const TGlxId& aId) const; + inline TBool operator<(const TGlxId& aId) const; + + inline TUint Value() const; + inline void SetValue(TUint aIdValue); // Allows setting undefined as value (KMaxTUint) + +private: + TUint iIdValue; +}; + +/** + * MGlxIdProvider + * Abstract interface class to provide ids + * Define as MGlxIdProvider + */ +template +class MGlxIdProvider { +public: + /** + * getNextId + * Returns the next unique id. + * Returns value in the argument, since otherwise cannot have the same + * deriving class provide multiple different types of ids + */ + virtual void NextId(T& aId) = 0; +}; + +/** + * TGlxDefaultIdProvider + * Simple implementation of id provider + */ +template +class TGlxDefaultIdProvider : public MGlxIdProvider { +private: + TUint iNextIdValue; +public: + inline TGlxDefaultIdProvider(); + virtual void NextId(T& aId); +}; + +#include "glxid.inl" + +#endif // T_GLXID_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxid.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxid.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,216 @@ +/* +* Copyright (c) 2008-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: Type-safe unique id template +* +*/ + + + + +#include "glxpanic.h" + +const TUint KGlxInvalidIdValue = KMaxTUint; + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +template +inline TGlxId::TGlxId() + { + iIdValue = KGlxInvalidIdValue; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +template +inline TGlxId::TGlxId(const TGlxId& aId) + { + iIdValue = aId.iIdValue; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +template +inline TGlxId::TGlxId(TUint aIdValue) + { + __ASSERT_DEBUG(aIdValue != KGlxInvalidIdValue, Panic(EGlxPanicIllegalArgument)); + iIdValue = aIdValue; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +template +inline TGlxId::TGlxId(const TGlxIdNone&) + { + iIdValue = KGlxInvalidIdValue; + } + +// ----------------------------------------------------------------------------- +// Assignment, checks for invalid value +// ----------------------------------------------------------------------------- +// +template +inline TGlxId& TGlxId::operator=(const TGlxId& aId) + { + __ASSERT_DEBUG(aId.iIdValue != KGlxInvalidIdValue, Panic(EGlxPanicIllegalArgument)); // Use SetValue to set undefined value + iIdValue = aId.iIdValue; + return *this; + } + +// ----------------------------------------------------------------------------- +// Assignment, checks for invalid value +// ----------------------------------------------------------------------------- +// +template +inline TGlxId& TGlxId::operator=(TUint aIdValue) + { + __ASSERT_DEBUG(aIdValue != KGlxInvalidIdValue, Panic(EGlxPanicIllegalArgument)); + iIdValue = aIdValue; + return *this; + } + +// ----------------------------------------------------------------------------- +// Assignment +// ----------------------------------------------------------------------------- +// +template +inline TGlxId& TGlxId::operator=(const TGlxIdNone&) + { + iIdValue = KGlxInvalidIdValue; + return *this; + } + +// ----------------------------------------------------------------------------- +// Post-increment +// ----------------------------------------------------------------------------- +// +template +inline TGlxId TGlxId::operator++(int) + { + TUint value = iIdValue; + iIdValue++; + return TGlxId(value); + } + +// ----------------------------------------------------------------------------- +// Comparison +// ----------------------------------------------------------------------------- +// +template +inline TBool TGlxId::operator!=(const TGlxId& aId) const + { + return iIdValue != aId.iIdValue; + } + +// ----------------------------------------------------------------------------- +// Comparison +// ----------------------------------------------------------------------------- +// +template +inline TBool TGlxId::operator==(const TGlxId& aId) const + { + return iIdValue == aId.iIdValue; + } + +// ----------------------------------------------------------------------------- +// Comparison +// ----------------------------------------------------------------------------- +// +template +inline TBool TGlxId::operator!=(const TGlxIdNone&) const + { + return iIdValue != KGlxInvalidIdValue; + } + +// ----------------------------------------------------------------------------- +// Comparison +// ----------------------------------------------------------------------------- +// +template +inline TBool TGlxId::operator==(const TGlxIdNone&) const + { + return iIdValue == KGlxInvalidIdValue; + } + +// ----------------------------------------------------------------------------- +// Comparison +// ----------------------------------------------------------------------------- +// +template +inline TBool TGlxId::operator>(const TGlxId& aId) const + { + return iIdValue > aId.iIdValue; + } + +// ----------------------------------------------------------------------------- +// Comparison +// ----------------------------------------------------------------------------- +// +template +inline TBool TGlxId::operator<(const TGlxId& aId) const + { + return iIdValue < aId.iIdValue; + } + +// ----------------------------------------------------------------------------- +// Returns current value +// ----------------------------------------------------------------------------- +// +template +inline TUint TGlxId::Value() const + { + return iIdValue; + } + +// ----------------------------------------------------------------------------- +// Allows setting undefined as value +// ----------------------------------------------------------------------------- +// +template +inline void TGlxId::SetValue(TUint aIdValue) + { + iIdValue = aIdValue; + } + +/** + * TGlxDefaultIdProvider + * Simple implementation of id provider + */ +// ----------------------------------------------------------------------------- +// Allows setting undefined as value +// ----------------------------------------------------------------------------- +// +template +TGlxDefaultIdProvider::TGlxDefaultIdProvider() + { + iNextIdValue = 0; + } + +// ----------------------------------------------------------------------------- +// Allows setting undefined as value +// ----------------------------------------------------------------------------- +// +template +void TGlxDefaultIdProvider::NextId(T& aId) + { + aId = iNextIdValue++; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxlistdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxlistdefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2008-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: List definitions +* +*/ + + + + +#ifndef __GLXLISTDEFS_H__ +#define __GLXLISTDEFS_H__ + +#include + +/** + * Namespace for list-related definitions + */ +namespace NGlxListDefs + { + /// Focus change type + enum TFocusChangeType + { + EUnknown, + EForward, + EBackward + }; + + /** + * Indicates absolute or relative change to focus + */ + enum TFocusSetType + { + EAbsolute, + ERelative + }; + + enum TCountType + { + ECountAll, + ECountNonStatic, + ECountAllStatic, + ECountPreStatic, + ECountPostStatic + }; + + enum TInsertionPosition + { + EInsertFirst, + EInsertLast + }; + + /// Indicates components to be populated in a path + enum TPathType + { + EPathAllOrSelection, + EPathFocusOrSelection, + EPathParent + }; + + /// Indicates initial focus position when populated + enum TFocusInitialPosition + { + EFocusFirst, + EFocusLast + }; + } + +#endif // __GLXLISTDEFS_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxlog.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,422 @@ +/* +* Copyright (c) 2008-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: Logging macros +* +*/ + + + + +#ifndef GLXLOG_H +#define GLXLOG_H + +// KH 3-August-2007, from now on only log on debug builds because of performance +#ifdef _DEBUG +#define GLX_LOGGING_ENABLED +#endif + +#ifndef GLX_LOGGING_ENABLED + + // empty declarations to clean up code + #define GLX_LOG_ENTRY_EXIT( s ) + #define GLX_LOG_ENTRY_EXIT_LEAVE_L( s ) + #define GLX_LOG_INFO( s ) + #define GLX_LOG_INFO1( s, i ) + #define GLX_LOG_INFO2( s, i, j ) + #define GLX_LOG_INFO3( s, i, j, k ) + #define GLX_LOG_INFO4( s, i, j, k, l ) + #define GLX_LOG_INFO5( s, i, j, k, l, m ) + #define GLX_LOG_WARNING( s ) + #define GLX_LOG_WARNING1( s, i ) + #define GLX_LOG_WARNING2( s, i, j ) + #define GLX_LOG_WARNING3( s, i, j, k ) + #define GLX_LOG_ERROR( s ) + #define GLX_LOG_ERROR1( s, i ) + #define GLX_LOG_ERROR2( s, i, j ) + #define GLX_LOG_ERROR3( s, i, j, k ) + #define GLX_FUNC( s ) + #define GLX_FUNCL( s ) + #define GLX_DEBUG1( s ) + #define GLX_DEBUG2( s, i ) + #define GLX_DEBUG3( s, i, j ) + #define GLX_DEBUG4( s, i, j, k ) + #define GLX_DEBUG5( s, i, j, k, l ) + +#else + +// only include headers if logging is enabled +#include +#include +#include + + + /** + * Helper macro for defining debug string with filename + * Note! this is internal so dont use outside this header + */ +/* #ifdef __arm__ + // use the module name instead as its the filename without path + #define GLX_DEBUG_STR( cat, str ) __MODULE__ "(%d) : " ##cat " : " ##str + #else + // put full file paths off for __FILE__ macro to make the log entries shorter + #pragma fullpath_file off*/ + #define GLX_DEBUG_STR( cat, str ) __FILE__ "(%d) : " ##cat " : " ##str +// #endif + + /** + * Helper macro for defining debug string with filename and linenumber + * @param category the category string for the log entry + * @param string the string for the log entry + * Note! this is internal so dont use outside this header + */ + #define GLX_DEBUG_LINE( category, string ) \ + TPtrC8((const TText8*) GLX_DEBUG_STR( category, string ) ), __LINE__ + + /** + * Output to glx logger + * Note! this is internal so dont use outside this header + */ + #define GLX_DEBUG_PRINT GlxLogger::WriteFormat + + // LOGGING MACROS + /** + * Logs the entry and exit point of the function + * Does not log the filename nor linenumber as inlining does not work + * if you want to log the filename and linenumber, + * use GLX_LOG_INFO macros instead + * Example usage: + * GLX_LOG_ENTRY_EXIT( "CFoo::Bar()" ); + * @param a string to be added to the log + */ + #define GLX_LOG_ENTRY_EXIT( s ) TGlxFunctionTrace _tracer( _L8( s ) ) + + /** + * Logs the entry, exit and possible leave point of the function. + * Note! cannot be used in a non leaving function or inside a LC function + * as this macro uses the cleanup stack + * Does not log the filename nor linenumber as inlining does not work + * if you want to log the filename and linenumber, + * use GLX_LOG_INFO macros instead + * Example usage: + * GLX_LOG_ENTRY_EXIT_LEAVE_L( "CFoo::Bar()" ); + * @param a string to be added to the log + * @deprecated use GLX_LOG_ENTRY_EXIT instead as it also detects leave and does not require cleanupstack to work + */ + #define GLX_LOG_ENTRY_EXIT_LEAVE_L( s ) \ + TGlxFunctionTraceWithLeaveDetection _tracer( _L8( s ) ); \ + CleanupClosePushL( _tracer ) + + /** + * Logs a single line of information and the filename and linenumber + * Example usage: + * GLX_LOG_INFO( "CFoo::Bar()" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + */ + #define GLX_LOG_INFO( s ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "info", s ) ) + + /** + * Logs a single line of information with one parameter + * and the filename and linenumber + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * Example usage: + * GLX_LOG_INFO1( "CFoo::Bar(%d)", aInt ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_INFO1( s, i ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "info", s ), i ) + + /** + * Logs a single line of information with two parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_INFO2( "CFoo::Bar(%d,%f)", aInt, aFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_INFO2( s, i, j ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "info", s ), i, j ) + + /** + * Logs a single line of information with three parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_INFO3( "CFoo::Bar(%d,%S,%f)", aInt, &aDesC, aFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_INFO3( s, i, j, k ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "info", s ), i, j, k ) + + /** + * Logs a single line of information with four parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_INFO4( "CFoo::Bar(%d,%f,%S,%s)", aInt, aFloat, "string" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + * @param l, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_INFO4( s, i, j, k, l ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "info", s ), i, j, k, l ) + + /** + * Logs a single line of information with five parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_INFO5( + * "CFoo::Bar(%.1f,%.2f,%.3f,%.4f,%.5f)", aFloat1, aFloat2, aFloat3, aFloat4, aFloat5 ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + * @param l, value to be inserted to the string, can be of any type + * @param m, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_INFO5( s, i, j, k, l, m ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "info", s ), i, j, k, l, m ) + + /** + * Logs a single line of warning and the filename and linenumber + * Example usage: + * GLX_LOG_WARNING( "Incorrect state, resetting state" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + */ + #define GLX_LOG_WARNING( s ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "warning", s ) ) + + /** + * Logs a single line of warning with one parameter + * and the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_WARNING1( "Incorrect parameter %d", aInt ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_WARNING1( s, i ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "warning", s ), i ) + + /** + * Logs a single line of warning with two parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_WARNING2( "Incorrect parameter %f, defaulting to %f", aInputFloat, KDefaultFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_WARNING2( s, i, j ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "warning", s ), i , j ) + + /** + * Logs a single line of warning with three parameters + * along with the filename and linenumber + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_WARNING3( "Incorrect size (%d,%d), scale is %f", aWidth, aHeight, aScale ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_WARNING3( s, i, j, k ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "warning", s ), i, j, k ) + + /** + * Logs a single line of error and the filename and linenumber. + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_ERROR( "Incorrect state, going to panic" ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + */ + #define GLX_LOG_ERROR( s ) GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "error", s ) ) + + /** + * Logs a single line of error with one parameter and the filename and linenumber + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_ERROR1( "Incorrect parameter %d, panicing", aInt ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_ERROR1( s, i ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "error", s ), i ) + + /** + * Logs a single line of error with one parameter and the filename and linenumber + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_ERROR2( "Incorrect size (%d,%d), panicking", aWidth, aHeight ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_ERROR2( s, i, j ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "error", s ), i, j ) + + /** + * Logs a single line of error with one parameter and the filename and linenumber + * Use this macro to track your asserts and panics so you can see them in the log and + * have a trace to come back to later on. + * For the parameter string, use %d for int, %f for float and %S for address of descriptor + * NOTE! logging is done in 8 bit strings so you cannot format 16 bit descriptor + * values. + * Example usage: + * GLX_LOG_ERROR3( "Incorrect state %d,%d,%f, panicking", aInt, aInt2, aFloat ); + * @param s, the string to be inserted to the log, plain compile time string, not a descriptor + * @param i, value to be inserted to the string, can be of any type + * @param j, value to be inserted to the string, can be of any type + * @param k, value to be inserted to the string, can be of any type + */ + #define GLX_LOG_ERROR3( s, i, j, k ) \ + GLX_DEBUG_PRINT( GLX_DEBUG_LINE( "error", s ), i, j, k ) + + // Old macros for compatibility + ///@deprecated, use GLX_LOG_ENTRY_EXIT instead + #define GLX_FUNC( s ) GLX_LOG_ENTRY_EXIT( s ) + ///@deprecated, use GLX_LOG_ENTRY_EXIT_LEAVE_L instead + #define GLX_FUNCL( s ) GLX_LOG_ENTRY_EXIT_LEAVE_L( s ) + ///@deprecated, use GLX_LOG_INFO instead + #define GLX_DEBUG1( s ) GLX_LOG_INFO( s ) + ///@deprecated, use GLX_LOG_INFO1 instead + #define GLX_DEBUG2( s, i ) GLX_LOG_INFO1( s, i ) + ///@deprecated, use GLX_LOG_INFO2 instead + #define GLX_DEBUG3( s, i, j ) GLX_LOG_INFO2( s, i, j ) + ///@deprecated, use GLX_LOG_INFO3 instead + #define GLX_DEBUG4( s, i, j, k ) GLX_LOG_INFO3( s, i, j, k ) + ///@deprecated, use GLX_LOG_INFO4 instead + #define GLX_DEBUG5( s, i, j, k, l ) GLX_LOG_INFO4( s, i, j, k, l ) + + /** + * TRAP instrumentation for Leave + */ + #undef TRAP_INSTRUMENTATION_LEAVE + #define TRAP_INSTRUMENTATION_LEAVE( aResult ) \ + GLX_LOG_INFO1( "Leave %d TRAPPED", aResult ) + + /** + * Helper class to track function entry and exit. + */ + class TGlxFunctionTrace + { + public: + inline TGlxFunctionTrace( TRefByValue< const TDesC8 > aName ) + : iStr( aName ) + { + // not using GLX_DEBUG2 as this function does not inline + GLX_DEBUG_PRINT( _L8( "Entry : %S" ), &iStr ); + } + inline ~TGlxFunctionTrace() + { + if( std::uncaught_exception() ) + { + // not using GLX_DEBUG2 as this function does not inline + GLX_DEBUG_PRINT( _L8( "Leave: %S" ), &iStr ); + } + else + { + // not using GLX_DEBUG2 as this function does not inline + GLX_DEBUG_PRINT( _L8( "Exit : %S" ), &iStr ); + } + } + private: + TPtrC8 iStr; + }; + + /** + * Helper class to track function entry, exit and possible leave. + * Never instantiate this class by itself. + * Only ever user the macro GLX_FUNCL as this calls CleanupClosePushL + * If you don't use the macro the destructor will panic in CleanupStack::Pop( this ) + * DO NOT use this in a LC method such as NewLC. + * Cleanup stack will be popped in the wrong order causing unwanted behaviour + */ + class TGlxFunctionTraceWithLeaveDetection + { + public: + inline TGlxFunctionTraceWithLeaveDetection( TRefByValue aName ) + : iStr( aName ), iLeave( EFalse ) + { + // not using GLX_DEBUG2 as this function does not inline + GLX_DEBUG_PRINT( _L8( "Entry : %S" ), &iStr ); + } + inline ~TGlxFunctionTraceWithLeaveDetection() + { + // Did we leave + if( iLeave ) + { + // not using GLX_DEBUG2 as this function does not inline + GLX_DEBUG_PRINT( _L8( "Leave : %S" ), &iStr ); + } + else + { + // not using GLX_DEBUG2 as this function does not inline + GLX_DEBUG_PRINT( _L8( "Exit : %S" ), &iStr ); + // Remove this from Cleanup. + CleanupStack::Pop( this ); + } + } + void Close() // This is only called if a leave happens. + { + iLeave = ETrue; + } + private: + TPtrC8 iStr; + TBool iLeave; + }; + +#endif + +#endif // GLXLOG_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxlogattribute.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxlogattribute.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,396 @@ +/* +* Copyright (c) 2008-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: Logging macros +* +*/ + + + + +#ifndef ATTRIBUTELOG_H_ +#define ATTRIBUTELOG_H_ + +#include +#include // KMPXMediaIdGeneral attributes +#include // KGlxMediaIdCollectionInternal +#include // KGlxMessageIdBackgroundThumbnail +#include // KGlxMediaIdCollectionPluginSpecific +#include // KGlxCollectionMessageSpecific +#include // KGlxFilterIdGeneral +#include // KGlxMediaIdGeneral +//#include // KGlxMediaIdStaticItem +#include // KMPXMediaIdDrm + +void LogAttribute(const TDesC8& aText, const TMPXAttribute& aAttribute) + { + TBuf8<0x50> attributeName; + + // KMPXMediaIdGeneral attributes + if (aAttribute == KMPXMediaGeneralType) + { + attributeName.Append(_L8("KMPXMediaGeneralType")); + } + else if (aAttribute == KMPXMediaGeneralCategory) + { + attributeName.Append(_L8("KMPXMediaGeneralCategory")); + } + else if (aAttribute == KMPXMediaGeneralUri) + { + attributeName.Append(_L8("KMPXMediaGeneralUri")); + } + else if (aAttribute == KMPXMediaGeneralDrive) + { + attributeName.Append(_L8("KMPXMediaGeneralDrive")); + } + else if (aAttribute == KMPXMediaGeneralSize) + { + attributeName.Append(_L8("KMPXMediaGeneralSize")); + } + else if (aAttribute == KMPXMediaGeneralDuration) + { + attributeName.Append(_L8("KMPXMediaGeneralDuration")); + } + else if (aAttribute == KMPXMediaGeneralTitle) + { + attributeName.Append(_L8("KMPXMediaGeneralTitle")); + } + else if (aAttribute == KMPXMediaGeneralDate) + { + attributeName.Append(_L8("KMPXMediaGeneralDate")); + } + else if (aAttribute == KMPXMediaGeneralDate) + { + attributeName.Append(_L8("KMPXMediaGeneralDate")); + } + else if (aAttribute == KMPXMediaGeneralComment) + { + attributeName.Append(_L8("KMPXMediaGeneralComment")); + } + else if (aAttribute == KMPXMediaGeneralMimeType) + { + attributeName.Append(_L8("KMPXMediaGeneralMimeType")); + } + else if (aAttribute == KMPXMediaGeneralThumbnail1) + { + attributeName.Append(_L8("KMPXMediaGeneralThumbnail1")); + } + else if (aAttribute == KMPXMediaGeneralThumbnail2) + { + attributeName.Append(_L8("KMPXMediaGeneralThumbnail2")); + } + else if (aAttribute == KMPXMediaGeneralIcon) + { + attributeName.Append(_L8("KMPXMediaGeneralIcon")); + } + else if (aAttribute == KMPXMediaGeneralRemote) + { + attributeName.Append(_L8("KMPXMediaGeneralRemote")); + } + else if (aAttribute == KMPXMediaGeneralSynchronized) + { + attributeName.Append(_L8("KMPXMediaGeneralSynchronized")); + } + else if (aAttribute == KMPXMediaGeneralDeleted) + { + attributeName.Append(_L8("KMPXMediaGeneralDeleted")); + } + else if (aAttribute == KMPXMediaGeneralModified) + { + attributeName.Append(_L8("KMPXMediaGeneralModified")); + } + else if (aAttribute == KMPXMediaGeneralCount) + { + attributeName.Append(_L8("KMPXMediaGeneralCount")); + } + else if (aAttribute == KMPXMediaGeneralId) + { + attributeName.Append(_L8("KMPXMediaGeneralId")); + } + else if (aAttribute == KMPXMediaGeneralCollectionId) + { + attributeName.Append(_L8("KMPXMediaGeneralCollectionId")); + } + else if (aAttribute == KMPXMediaGeneralBrokenLink) + { + attributeName.Append(_L8("KMPXMediaGeneralBrokenLink")); + } + else if (aAttribute == KMPXMediaGeneralNonPermissibleActions) + { + attributeName.Append(_L8("KMPXMediaGeneralNonPermissibleActions")); + } + else if (aAttribute == KMPXMediaGeneralContainerId) + { + attributeName.Append(_L8("KMPXMediaGeneralContainerId")); + } + else if (aAttribute == KMPXMediaGeneralSubTitle) + { + attributeName.Append(_L8("KMPXMediaGeneralSubTitle")); + } + else if (aAttribute == KMPXMediaGeneralCopyright) + { + attributeName.Append(_L8("KMPXMediaGeneralCopyright")); + } + else if (aAttribute == KMPXMediaGeneralFlags) + { + attributeName.Append(_L8("KMPXMediaGeneralFlags")); + } + else if (aAttribute == KMPXMediaGeneralLastPlaybackPosition) + { + attributeName.Append(_L8("KMPXMediaGeneralLastPlaybackPosition")); + } + else if (aAttribute == KMPXMediaGeneralLastPlaybackTime) + { + attributeName.Append(_L8("KMPXMediaGeneralLastPlaybackTime")); + } + else if (aAttribute == KMPXMediaGeneralPlayCount) + { + attributeName.Append(_L8("KMPXMediaGeneralPlayCount")); + } + else if (aAttribute == KMPXMediaGeneralContainerPath) + { + attributeName.Append(_L8("KMPXMediaGeneralContainerPath")); + } + else if (aAttribute == KMPXMediaGeneralPath) + { + attributeName.Append(_L8("KMPXMediaGeneralPath")); + } + else if (aAttribute == KMPXMediaGeneralValue) + { + attributeName.Append(_L8("KMPXMediaGeneralValue")); + } + else if (aAttribute == KMPXMediaGeneralAll) + { + attributeName.Append(_L8("KMPXMediaGeneralAll")); + } + // KGlxMediaIdCollectionInternal attributes + else if (aAttribute == KGlxMediaCollectionInternalStartDate) + { + attributeName.Append(_L8("KGlxMediaCollectionInternalStartDate")); + } + else if (aAttribute == KGlxMediaCollectionInternalEndDate) + { + attributeName.Append(_L8("KGlxMediaCollectionInternalEndDate")); + } + else if (aAttribute == KGlxMediaCollectionInternalUsageCount) + { + attributeName.Append(_L8("KGlxMediaCollectionInternalUsageCount")); + } + else if (aAttribute == KGlxMediaCollectionInternalSystemItemType) + { + attributeName.Append(_L8("KGlxMediaCollectionInternalSystemItemType")); + } + // KGlxMessageIdBackgroundThumbnail attributes + else if (aAttribute == KGlxBackgroundThumbnailMediaId) + { + attributeName.Append(_L8("KGlxBackgroundThumbnailMediaId")); + } + else if (aAttribute == KGlxBackgroundThumbnailSize) + { + attributeName.Append(_L8("KGlxBackgroundThumbnailSize")); + } + else if (aAttribute == KGlxBackgroundThumbnailError) + { + attributeName.Append(_L8("KGlxBackgroundThumbnailError")); + } + // KGlxMediaIdCollectionPluginSpecific attributes + else if (aAttribute == KGlxMediaCollectionPluginSpecificSubTitle) + { + attributeName.Append(_L8("KGlxMediaCollectionPluginSpecificSubTitle")); + } + else if (aAttribute == KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle) + { + attributeName.Append(_L8("KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle")); + } + else if (aAttribute == KGlxMediaCollectionPluginSpecificNewMediaItemTitle) + { + attributeName.Append(_L8("KGlxMediaCollectionPluginSpecificNewMediaItemTitle")); + } + else if (aAttribute == KGlxMediaCollectionPluginSpecificDefaultMediaTitle) + { + attributeName.Append(_L8("KGlxMediaCollectionPluginSpecificDefaultMediaTitle")); + } + // KGlxCollectionMessageSpecific attributes + else if (aAttribute == KGlxCollectionMessageContainerId) + { + attributeName.Append(_L8("KGlxCollectionMessageContainerId")); + } + else if (aAttribute == KGlxCollectionMessageContainerCategory) + { + attributeName.Append(_L8("KGlxCollectionMessageContainerCategory")); + } + else if (aAttribute == KGlxCollectionMessageContainerCameraAlbum) + { + attributeName.Append(_L8("KGlxCollectionMessageContainerCameraAlbum")); + } + // KGlxFilterIdGeneral attributes + else if (aAttribute == KGlxFilterGeneralSortType) + { + attributeName.Append(_L8("KGlxFilterGeneralSortType")); + } + else if (aAttribute == KGlxFilterGeneralSortDirection) + { + attributeName.Append(_L8("KGlxFilterGeneralSortDirection")); + } + else if (aAttribute == KGlxFilterGeneralIncludeCameraAlbum) + { + attributeName.Append(_L8("KGlxFilterGeneralIncludeCameraAlbum")); + } + else if (aAttribute == KGlxFilterGeneralMinCount) + { + attributeName.Append(_L8("KGlxFilterGeneralMinCount")); + } + else if (aAttribute == KGlxFilterGeneralItemId) + { + attributeName.Append(_L8("KGlxFilterGeneralItemId")); + } + else if (aAttribute == KGlxFilterGeneralExcludeAnimation) + { + attributeName.Append(_L8("KGlxFilterGeneralExcludeAnimation")); + } + else if (aAttribute == KGlxFilterGeneralLastCaptureDate) + { + attributeName.Append(_L8("KGlxFilterGeneralLastCaptureDate")); + } + else if (aAttribute == KGlxFilterGeneralThumbnailLoadability) + { + attributeName.Append(_L8("KGlxFilterGeneralThumbnailLoadability")); + } + else if (aAttribute == KGlxFilterGeneralMPXCollectionPath) + { + attributeName.Append(_L8("KGlxFilterGeneralMPXCollectionPath")); + } + else if (aAttribute == KGlxFilterGeneralItemType) + { + attributeName.Append(_L8("KGlxFilterGeneralItemType")); + } + else if (aAttribute == KGlxFilterGeneralUri) + { + attributeName.Append(_L8("KGlxFilterGeneralUri")); + } + else if (aAttribute == KGlxFilterGeneralSortOrderPromoteSystemItems) + { + attributeName.Append(_L8("KGlxFilterGeneralSortOrderPromoteSystemItems")); + } + else if (aAttribute == KGlxFilterGeneralOrigin) + { + attributeName.Append(_L8("KGlxFilterGeneralOrigin")); + } + else if (aAttribute == KGlxFilterGeneralNoDRM) + { + attributeName.Append(_L8("KGlxFilterGeneralNoDRM")); + } + else if (aAttribute == KGlxFilterGeneralNavigationalStateOnly) + { + attributeName.Append(_L8("KGlxFilterGeneralNavigationalStateOnly")); + } + // KGlxMediaIdGeneral attributes + else if (aAttribute == KGlxMediaGeneralSystemItem) + { + attributeName.Append(_L8("KGlxMediaGeneralSystemItem")); + } + else if (aAttribute == KGlxMediaGeneralDimensions) + { + attributeName.Append(_L8("KGlxMediaGeneralDimensions")); + } + else if (aAttribute == KGlxMediaGeneralFramecount) + { + attributeName.Append(_L8("KGlxMediaGeneralFramecount")); + } + else if (aAttribute == KGlxMediaGeneralLocation) + { + attributeName.Append(_L8("KGlxMediaGeneralLocation")); + } + else if (aAttribute == KGlxMediaGeneralSlideshowableContent) + { + attributeName.Append(_L8("KGlxMediaGeneralSlideshowableContent")); + } + else if (aAttribute == KGlxMediaGeneralLastModifiedDate) + { + attributeName.Append(_L8("KGlxMediaGeneralLastModifiedDate")); + } + // KMPXMediaIdDrm attributes + else if (aAttribute == KMPXMediaDrmType) + { + attributeName.Append(_L8("KMPXMediaDrmType")); + } + else if (aAttribute == KMPXMediaDrmProtected) + { + attributeName.Append(_L8("KMPXMediaDrmProtected")); + } + else if (aAttribute == KMPXMediaDrmRightsStatus) + { + attributeName.Append(_L8("KMPXMediaDrmRightsStatus")); + } + else if (aAttribute == KMPXMediaDrmRightsType) + { + attributeName.Append(_L8("KMPXMediaDrmRightsType")); + } + else if (aAttribute == KMPXMediaDrmCount) + { + attributeName.Append(_L8("KMPXMediaDrmCount")); + } + else if (aAttribute == KMPXMediaDrmStartTime) + { + attributeName.Append(_L8("KMPXMediaDrmStartTime")); + } + else if (aAttribute == KMPXMediaDrmEndTime) + { + attributeName.Append(_L8("KMPXMediaDrmEndTime")); + } + else if (aAttribute == KMPXMediaDrmInterval) + { + attributeName.Append(_L8("KMPXMediaDrmInterval")); + } + else if (aAttribute == KMPXMediaDrmIntervalStartTime) + { + attributeName.Append(_L8("KMPXMediaDrmIntervalStartTime")); + } + else if (aAttribute == KMPXMediaDrmAccumulatedTime) + { + attributeName.Append(_L8("KMPXMediaDrmAccumulatedTime")); + } + else if (aAttribute == KMPXMediaDrmSendingAllowed) + { + attributeName.Append(_L8("KMPXMediaDrmSendingAllowed")); + } + else if (aAttribute == KMPXMediaDrmCanSetAutomated) + { + attributeName.Append(_L8("KMPXMediaDrmCanSetAutomated")); + } + else if (aAttribute == KMPXMediaDrmHasInfoUrl) + { + attributeName.Append(_L8("KMPXMediaDrmHasInfoUrl")); + } + else if (aAttribute == KMPXMediaDrmHasPreviewUrl) + { + attributeName.Append(_L8("KMPXMediaDrmHasPreviewUrl")); + } + else if (aAttribute == KMPXMediaDrmAboutToExpire) + { + attributeName.Append(_L8("KMPXMediaDrmAboutToExpire")); + } + else if (aAttribute == KMPXMediaDrmAll) + { + attributeName.Append(_L8("KMPXMediaDrmAll")); + } + else + { + attributeName.AppendFormat(_L8("context id: %d, attribute id %d"), aAttribute.ContentId(), aAttribute.AttributeId()); + } + + GlxLogger::WriteFormat(_L8("%S %S"), &aText, &attributeName); + } + + +#endif /*ATTRIBUTELOG_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxlogger.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2008-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: Logging utility for MC Photos +* +*/ + + + + +#ifndef T_GLXLOGGER_H +#define T_GLXLOGGER_H + +// CLASS HEADER +#include "glxlogger.h" + +// EXTERNAL INCLUDES +#include + +namespace GlxLogger + { + /** + * Logging utility, writes the given log to a shared chunk if the chunk + * exists or to RDebug if not. + * Note! due to performance reasons only 8 bit descriptor allowed + * @param The descriptor containing the format string. + * @param The arguments to append to the format string (ellipsis notation) + */ + IMPORT_C void WriteFormat( TRefByValue aFmt, ... ); + } + +#endif // T_GLXLOGGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxmediaid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxmediaid.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2008-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: Media item id +* +*/ + + + + +#ifndef T_GLXMEDIAID_H +#define T_GLXMEDIAID_H + +#include + +#include "glxid.h" + +const TUint KGlxCollectionRootId = 0; +// Media type ID definitions - may need to be moved somewhere else + +/** + * TGlxIdSpaceIdBase + * + * Don't use this. This is just to make TGlxId type-safe for TGlxIdSpaceId + * + * @lib none + */ +class TGlxIdSpaceIdBase {}; + + +/** + * TGlxIdSpaceId + * + * Typesafe Id-space identifier. + * + * @lib none + */ +typedef TGlxId TGlxIdSpaceId; + +/** + * Known Id Spaces + */ +const TUint KGlxIdSpaceIdRoot = 0x200071A6; ///< Root menu id space + +/** + * Don't use this. This is just to make TGlxId concrete + */ +class TGlxIdMediaBase {}; + +/** + * TGlxMediaId + * + * Type safe id class for media item id. Provides getters/setters for all bit groupings. + * + * @lib ViewerEngine + */ +class TGlxMediaId : public TGlxId + { +public: + /** + * Default constructor + */ + inline TGlxMediaId() : TGlxId() { }; + /** + * Constructor + */ + inline TGlxMediaId(const TGlxMediaId& aId) : TGlxId(aId) { }; + /** + * Constructor + */ + explicit inline TGlxMediaId(TUint aId) : TGlxId(aId) { }; + /** + * Constructor + */ + inline TGlxMediaId(const TGlxIdNone& aIdNone) : TGlxId(aIdNone) { }; + }; + +#endif // T_GLXMEDIAID_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxnavigationalstatedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxnavigationalstatedefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Renderer Status +* +*/ + + + + + +#ifndef __GLXNAVIGATIONALSTATEDEFS_H__ +#define __GLXNAVIGATIONALSTATEDEFS_H__ + +#include + +namespace NGlxNavigationalState + { + enum TViewingMode + { + EBrowse,EView + }; + } + +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxpanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxpanic.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Viewer Panics +* +*/ + + + + +#ifndef T_GLXPANIC_H +#define T_GLXPANIC_H + +#include + +/** Viewer application panic codes */ +enum TGlxPanics + { + EGlxPanicNotImplemented = 1, // Feature not implemented yet + EGlxPanicNotInitialised, // Object is used without having been initialised + EGlxPanicAlreadyInitialised, // Object has already been initialised + EGlxPanicIllegalState, // The current internal state of the object(s) is not allowed + EGlxPanicNullPointer, // Null pointer + EGlxPanicNullLayout, // Null Layout + EGlxPanicNullTHuiImage, // Null THuiImage in layouts + EGlxPanicNullCHuiVisual, // Null CHuiVisual + EGlxPanicNullVisualList, // Null Visual List + EGlxPanicNullScreenInfo, // Null screen info in layouts + EGlxPanicWrongLayoutType, // Wrong layout type for this amount of parameters + EGlxPanicNullDescriptor, // Provided descriptor pointer was null + EGlxPanicNullMediaList, // Provided media list pointer was null + EGlxPanicIllegalArgument, // Argument is not valid + EGlxPanicUnhandledError, // Error occured, but it is not being handled + EGlxPanicLogicError, // Error in code logic + EGlxPanicTaskNotAddedToManager, // The task has not been added to the task manager + EGlxPanicMemoryLeak, + EGlxPanicAlreadyAdded, // Item has been already added to the array/list + EGlxPanicDebugUnexpectedError, // A legal error occured, but so unusual that panic is in order in debug builds + EGlxPanicInvalidIdentifier, // Invalid identifier + EGlxPanicInvalidPathLevel, // An invalid path level + EGlxPanicMediaRequestedWithEmptyPath, // MediaL has been called with a path that has a count of 0. + EGlxPanicCollectionManagerOutstandingRequest, // A request has been made to the collection manager while an outstanding request exists. + EGlxPanicDatasourceMdeSessionNotOpen, // An attempt has been made to access the MDE session before it has been opened. + EGlxPanicDatasourceMdeTaskExecutedTwice, // An attempt has been made to execute a task a second time. + EGlxPanicWrongAttributeType, // Attempt to read attribute as wrong type (text, C-class, T-class) + EGlxPanicCastFailed, // An attempt to cast an object from one class to another has failed. + EGlxPanicRequiredItemNotFound, // An item that is required to be in a media list was not found. + EGlxPanicEnvironment, // Problem with the environment at run time found + EGlxPanicSmoothedValueIllegalState, // A TGlxSmoothedValue is misbehaving + EGlxPanicUnhandledValue, // An unexpected value has been encountered + EGlxPanicUnsupportedCollection, // The collection is specified is unsupported by the collection manager. + EGlxPanicWrongMediaList, // The media list instance passed to a method is not the expected instance. + EGlxPanicNoReservation, // Attempt made to add an item to a list without reserving space first + EGlxPanicIndexOutOfRange, // Index is out of range + EGlxPanicRequiredPropertyNotFound, // A required property was not found + EGlxPanicEmptyArray, // An array was empty when it was expected that it contained values. + EGlxPanicCommandHasNoGeneralSessionId, // A command has been sent to the server that does not have the KMPXCommandGeneralSessionId attribute set + EGlxPanicUnsupportedQueryType, // An attempt has been made to execute a query of an unsupported type + EGlxPanicQueryLogicError, // A logic error occurred executing a query. + EGlxPanicInvalidCollectionUid, // An attempt was made to get a container id for a collection that does not have a container id associated with it. + EGlxPanicUnexpectedQueryResultCount // The query did not return a single result as expected. + // add further panics here + }; + +inline void Panic(TGlxPanics aReason) + { + _LIT(applicationName,"Images & videos"); + User::Panic(applicationName, aReason); + } + +#endif // T_GLXPANIC_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxpointer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxpointer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2008-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: Smart pointer +* +*/ + + + + +#ifndef T_GLXPOINTER_H +#define T_GLXPOINTER_H + +#include "glxpanic.h" + +/** + * TGlxPointer + * + * Smart pointer class. Template that can house any object + * + * @lib None + */ +template +class TGlxPointer { +private: + T* pointer; + const void* iOwns; // Defined as void* instead of TBool so that can use directly as boolean value + +public: + /** + * Default constructor + */ + TGlxPointer() { + pointer = NULL; + iOwns = 0; + } + + /** + * Constructor T* + */ + explicit TGlxPointer(T* pointer) { + this->pointer = pointer; + iOwns = pointer; + } + + /** + * Constructor + */ + TGlxPointer(const TGlxPointer& ptrObj) { // Should not be const, but without this, ARM compiler refuses + iOwns = ptrObj.iOwns; + pointer = const_cast&>(ptrObj).Release(); + } + + /** + * Destructor + */ + ~TGlxPointer() { + if (iOwns) { + __ASSERT_DEBUG(pointer != NULL, Panic(EGlxPanicIllegalState)); + delete pointer; + } + } + + /** + * Operator = + */ + TGlxPointer& operator=(TGlxPointer& ptrObj) { + if (this != &ptrObj) { + if (iOwns && pointer != ptrObj.pointer) { + delete this->pointer; + } + iOwns = ptrObj.iOwns; + pointer = ptrObj.Release(); + } + return *this; + } + + /** + * Operator = + */ + TGlxPointer& operator=(T* pointer) { + if (iOwns && pointer != this->pointer) { + delete this->pointer; + } + iOwns = pointer; + this->pointer = pointer; + return *this; + } + + /** + * operator* + */ + inline T& operator*() const { + __ASSERT_DEBUG(pointer != NULL, Panic(EGlxPanicNullPointer)); + return *pointer; + } + + /** + * operator -> + */ + inline T* operator->() const { + __ASSERT_DEBUG(pointer != NULL, Panic(EGlxPanicNullPointer)); + return pointer; + } + + /** + * Ptr + */ + inline T* Ptr() const { + return pointer; + } + + /** + * Release + * Return the pointer and release ownership + */ + T* Release() { + iOwns = 0; + return pointer; + } + + /** + * Owns + * Returns ETrue if the object owns the pointer + */ + inline TBool Owns() const { + return (TBool)iOwns; + } + + /** + * PtrRef + * Return a reference to the pointer + */ + inline T*& PtrRef() { + __ASSERT_DEBUG(pointer != NULL, Panic(EGlxPanicNullPointer)); + return pointer; + } +}; + +#endif // T_GLXPOINTER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxpsstatesourceappstatedomainpskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxpsstatesourceappstatedomainpskeys.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2008-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: This header file contains the definition for the app state P&S +* API. Purpose of this API is for applications to publish their internal +* state information. This information is used for example in light control +* use cases +* +*/ + + + + +#ifndef PSSTATESOURCEAPPSTATEDOMAINPSKEYS_H +#define PSSTATESOURCEAPPSTATEDOMAINPSKEYS_H + +/**< The UID of the category we use. */ +const TUid KPCFWAppStatePSUid = {0x10282BC4}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////// +/// /// +/// Each application has own P&S key for publishing state information. Following definitions define /// +/// what key value corresponds to which application and what are the possible values for each /// +/// application state(= key). /// +/// /// +/////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +* Music player app key +* Value See KPCFWAppStatePSMusicPlayerState +* Type RProperty::EInt. +*/ +const TUint32 KPCFWAppStatePSMusicPlayer = 0x00000000; + +/** +* Possible states for music player +*/ +enum KPCFWAppStatePSMusicPlayerStoppedState + { + MusicPlayerPlayPaused, /**< Music player playback in play or pause mode */ + MusicPlayerStopped /**< Music player playback in stop mode*/ + }; + +/** +* Gallery app key +* Value See KPCFWAppStatePSGalleryState +* Type RProperty::EInt. +*/ +const TUint32 KPCFWAppStatePSGallery = 0x00000001; + +/** +* Possible states for gallery application +*/ +enum KPCFWAppStatePSGalleryState + { + GalleryInCarouselView, + GalleryInFullScreenView, + GalleryInZoomedView, + GalleryInVideoPlaybackView, + GalleryInSlideshowView, + GalleryInListView, /**< Covers a multitude of misc. views all based on non-carousel lists */ + GalleryInTagBrowserView, + GalleryInMapBrowserView, + GalleryInTextEntry + }; + +/** +* NGI app key +* Value See KPCFWAppStatePSNGIState +* Type RProperty::EInt. +*/ +const TUint32 KPCFWAppStatePSNGI = 0x00000002; + +/** +* Possible states for NGI (N-Gage inside) +*/ +enum KPCFWAppStatePSNGIState + { + NGIGameForegroundLandscape, /**< NGI game in foreground and in landscape 90 degree mode */ + NGIGameForegroundLandscapeUpsideDown, /**< NGI game in foreground and in landscape 270 degree mode */ + NGIGameForegroundPortrait, /**< NGI game in foreground and in portrait mode */ + NGIGameBackground /**< NGI game in background or closing down */ + }; + +/** +* NGI app key +* Value See KPCFWAppStatePSNGIState +* Type RProperty::EInt. +*/ +const TUint32 KPCFWAppStatePSCamera = 0x00000003; + +enum KPCFWAppStatePSCameraState + { + CameraStartUp, /** < Startup*/ + CameraMainStillCaptureView, /**
KPCFWAppStatePSVRState +* Type RProperty::EInt. +*/ +const TUint32 KPCFWAppStatePSVR = 0x00000004; + +/** +* Possible states for NGI (N-Gage inside) +*/ +enum KPCFWAppStatePSVRState + { + VisualRadioBackgroundPlaying, + VisualRadioForegroundPlaying, + VisualRadioForegroundPlayingDisplayLightsAlwaysOn + }; + +#endif//PSSTATESOURCEAPPSTATEDOMAINPSKEYS_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxthumbnail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxthumbnail.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2008-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: Thumbnail constants +* +*/ + + + + +#ifndef GLXTHUMBNAIL_H +#define GLXTHUMBNAIL_H + +#include + +// Display mode for generated thumbnails +const TDisplayMode KGlxThumbnailCreationMode = EColor16M; +const TDisplayMode KGlxThumbnailDisplayMode = EColor64K; + + + +#endif // GLXTHUMBNAIL_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/glxtracer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/glxtracer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2008-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: Logging macros +* +*/ + + + + +#ifndef GLXTRACER_H +#define GLXTRACER_H + +/** + * This file has been copied from the forum nokia wiki and renamed to glxtracer.h + * http://wiki.forum.nokia.com/index.php/Trace_Function_Enter%2C_Exit_and_Leave + */ + +#include + +// Define tracer logging method +// 0 = Logging off +// 1 = Log to RDebug +// 2 = Log to file (RFileLogger) +#define TRACER_LOG_METHOD 0 + +// ============================================================================ + +// Logging off, define empty macros and skip all the rest +#if TRACER_LOG_METHOD == 0 + + #define TRACER(func) + #define TRACER_RET(func,format) + +#else // Logging on + + // Macro to print function entry, exit and leave. + // Example: TRACER("CMyClass::MyFunction"); + #define TRACER(func) TTracer function_tracer( _S(func), _S("") ); + + // Macro to print function return value in addition to entry, exit + // and leave conditions Second parameter is a formatting string used + // to print the return value Example to print an integer return value: + // TRACER_RET("CMyclass::MyFunction", "%d"); + #define TRACER_RET(func,format) TTracer func_tracer( _S(func), _S(format) ); + + #if TRACER_LOG_METHOD == 1 // Print to RDebug + + #include + #define TRACER_PRINT(a) RDebug::Print(a,&iFunc); + #define TRACER_PRINT_RET(a,b) RDebug::Print(a,&iFunc,b); + + #elif TRACER_LOG_METHOD == 2 // Print to file + + #include + _LIT( KLogDir, "tracer" ); // Log directory: C:\logs\tracer + _LIT( KLogFile, "tracer.txt" ); // Log file: c:\logs\tracer\tracer.txt + #define TRACER_PRINT(a) RFileLogger::WriteFormat(KLogDir, \ + KLogFile,EFileLoggingModeAppend,a,&iFunc); + #define TRACER_PRINT_RET(a,b) RFileLogger::WriteFormat(KLogDir, \ + KLogFile,EFileLoggingModeAppend,a,&iFunc,b); + + #endif + + _LIT( KLogEnter, "%S: ENTER" ); + _LIT( KLogExit, "%S: EXIT" ); + _LIT( KLogLeave, "%S: LEAVE!" ); + _LIT( KLogExitRet, "%S: EXIT, Returning " ); + + /** + * Simple tracer class that logs function enter, exit or leave + */ + class TTracer + { + public: + + /** + * inline constructor to write log of entering a function + */ + TTracer( const TText* aFunc, const TText* aRetFormat ) + : iFunc( aFunc ) + , iRetFormat( aRetFormat ) + { + TRACER_PRINT( KLogEnter ); + } + + /** + * inline destructor to write log of exiting a function + * normally or with a leave + */ + ~TTracer() + { + if ( std::uncaught_exception() ) // Leave is an exception + { + // The function exited with a leave + TRACER_PRINT( KLogLeave ); + } + else + { + // The function exited normally + if ( iRetFormat.Length() == 0 ) + { + TRACER_PRINT( KLogExit ); + } + else + { + // Log the return value + #ifdef __WINS__ + TInt32 retVal = 0; + + // The assembly bit. This needs to be reimplemented + // for every target. + _asm( mov retVal, ebx ); + + TBuf<100> format( KLogExitRet ); + format.Append( iRetFormat ); + TRACER_PRINT_RET( format, retVal ); + #else + TRACER_PRINT( KLogExit ); + #endif + } + } + } + + private: + + /** + * Pointer descriptor to function signature that is to be logged. + */ + TPtrC iFunc; + + /** + * Formatting string used to print the function return value + */ + TPtrC iRetFormat; + + }; + +#endif // TRACER_LOG_METHOD == 0 + +#endif // GLXTRACER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/inc/photos.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/inc/photos.hlp.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -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: Help MACROS +* +*/ + + +// +// mcphotos.hlp.hrh +// + +#ifndef __MCPHOTOS_HLP_HRH__ +#define __MCPHOTOS_HLP_HRH__ + +_LIT(LGAL_HLP_VIEW_LIST,"LGAL_HLP_VIEW_LIST"); +_LIT(LGAL_HLP_CAMERA_ALBUM_GRID,"LGAL_HLP_CAPTURED_GRID"); +_LIT(LGAL_HLP_CAMERA_ALBUM_FULLSCRN,"LGAL_HLP_CAPTURED_FULLSCREEN"); +_LIT(LGAL_HLP_ALBUM_LIST,"LGAL_HLP_ALBUM_LIST"); +_LIT(LGAL_HLP_ALBUM_GRID,"LGAL_HLP_ALBUM_GRID"); +_LIT(LGAL_HLP_ALBUM_FULLSCREEN,"LGAL_HLP_ALBUM_FULLSCREEN"); +_LIT(LGAL_HLP_MONTH_LIST,"LGAL_HLP_MONTH_LIST"); +_LIT(LGAL_HLP_MONTH_GRID,"LGAL_HLP_MONTH_GRID"); +_LIT(LGAL_HLP_MONTH_FULLSCREEN,"LGAL_HLP_MONTH_FULLSCREEN"); +_LIT(LGAL_HLP_TAGS_BROWSER,"LGAL_HLP_TAGS_BROWSER"); +_LIT(LGAL_HLP_TAGS_GRID,"LGAL_HLP_TAGS_GRID"); +_LIT(LGAL_HLP_TAGS_FULLSCREEN,"LGAL_HLP_TAGS_FULLSCREEN"); +_LIT(LGAL_HLP_TAGS_LIST,"LGAL_HLP_TAGS_BROWSER"); +_LIT(LGAL_HLP_DOWNLOADS_GRID,"LGAL_HLP_DOWNLOADS_GRID"); +_LIT(LGAL_HLP_DOWNLOADS_FULLSCREEN,"LGAL_HLP_DOWNLOADS_FULLSCREEN"); +_LIT(LGAL_HLP_ALL_GRID,"LGAL_HLP_ALL_GRID"); +_LIT(LGAL_HLP_ALL_FULLSCREEN,"LGAL_HLP_ALL_FULLSCREEN"); +_LIT(LGAL_HLP_DETAILS_VIEW,"LGAL_HLP_DETAILS_VIEW"); +_LIT(LGAL_HLP_FETCHER,"LGAL_HLP_FETCHER"); + +#endif + + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/data/glxloggingapp.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/data/glxloggingapp.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2008-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: Project definition file for Photos logging application +* +*/ + + + +NAME HELL + +#include +#include +#include +#include + +#include "glxloggingapp.hrh" + + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name { buf=""; } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_glxlogging_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + +// --------------------------------------------------------- +// +// r_GlxLogging_menubar +// Menubar for GlxLogging example +// +// --------------------------------------------------------- +// +RESOURCE MENU_BAR r_glxlogging_menubar + { + titles = + { + MENU_TITLE {menu_pane = r_glxlogging_menu;} + }; + } + + +// --------------------------------------------------------- +// +// r_GlxLogging_menu +// Menu for "Options" +// +// --------------------------------------------------------- +// +RESOURCE MENU_PANE r_glxlogging_menu + { + items = + { + MENU_ITEM {command = EGlxLoggingCommandToggle; txt = "Toggle Logging";}, + MENU_ITEM {command = EAknSoftkeyExit; txt = "Exit";} + }; + } + +RESOURCE TBUF r_glxlogging_start_logging + { + buf = "Start Logging"; + } + +RESOURCE TBUF r_glxlogging_stop_logging + { + buf = "Stop Logging"; + } \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/data/glxloggingapp_loc.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/data/glxloggingapp_loc.rls Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2008-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: Project definition file for Photos logging application +* +*/ + + + + +//rls_string STRING_r_glxlogging_icon_path "z:\\resource\\apps\\glxloggingicon.mbm" +rls_string STRING_short_caption "GlxLoggingApp" +rls_string STRING_r_glxlogging_caption "Glx Log" + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/data/glxloggingapp_loc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/data/glxloggingapp_loc.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008-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: Project definition file for Photos logging application +* +*/ + + + + +#include +#include "glxloggingapp_loc.rls" + +RESOURCE LOCALISABLE_APP_INFO + { + short_caption = STRING_short_caption; + caption_and_icon = + { + CAPTION_AND_ICON_INFO + { + caption=STRING_r_glxlogging_caption; + //number_of_icons=3; + //icon_file=STRING_r_glxlogging_icon_path; + } + }; + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/data/glxloggingapp_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/data/glxloggingapp_reg.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Project definition file for Photos logging application +* +*/ + + + +//glxlogging application's registration resource file + +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x2000A7BD + +RESOURCE APP_REGISTRATION_INFO + { + app_file="glxloggingapp"; + // + localisable_resource_file="\\resource\\apps\\glxloggingappp_loc"; + // + } diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2008-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: Logging client side + * +*/ + + + + +PRJ_MMPFILES + +glxloggingapp.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/group/glxloggingapp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/group/glxloggingapp.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2008-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: Project definition file for Photos logging application +* +*/ + + + + +#include "../../../group/glxbuildcommon.mmh" +#include + +CAPABILITY CAP_APPLICATION + +TARGET glxloggingapp.exe +TARGETTYPE exe + +//deffile /epoc32/release/winscw/glxlogging.def + +UID 0x100039CE 0x2000A7BD + +LANGUAGE_IDS + +SOURCEPATH ../src +SOURCE glxloggingapp.cpp +SOURCE glxloggingapplication.cpp +SOURCE glxloggingappui.cpp +SOURCE glxloggingdocument.cpp + +SOURCEPATH ../group + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../client/inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY gdi.lib +LIBRARY efsrv.lib + +SOURCEPATH ../data +START RESOURCE glxloggingapp.RSS +HEADER +TARGETPATH /resource/apps +LANGUAGE_IDS +END + +START RESOURCE glxloggingapp_reg.rss +TARGETPATH /private/10003a3f/import/apps +END + +START RESOURCE glxloggingapp_loc.RSS +TARGETPATH /resource/apps +LANGUAGE_IDS +END diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/inc/glxlogging.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/inc/glxlogging.pan Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +#ifndef __GLXLOGGING_PAN__ +#define __GLXLOGGING_PAN__ + +/** glx logging application panic codes */ +enum TGlxLoggingPanics + { + EGlxLoggingBasicUi = 1 + // add further panics here + }; + +inline void Panic(TGlxLoggingPanics aReason) + { + _LIT(applicationName,"GlxLogging"); + User::Panic(applicationName, aReason); + } + +#endif // __GLXLOGGING_PAN__ diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/inc/glxloggingapp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/inc/glxloggingapp.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +#ifndef __GLXLOGGING_HRH__ +#define __GLXLOGGING_HRH__ + +/** GlxLogging enumerate command codes */ +enum TGlxLoggingIds + { + EGlxLoggingCommandToggle = 1 // start value must not be 0 + }; + + +#endif // __GLXLOGGING_HRH__ diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/inc/glxloggingapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/inc/glxloggingapplication.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +#ifndef __GLXLOGGING_APPLICATION_H__ +#define __GLXLOGGING_APPLICATION_H__ + +#include + + +/** + @class CGlxLoggingApplication + + @discussion An instance of CGlxLoggingApplication is the application part of the AVKON + application framework for the GlxLogging example application + */ +NONSHARABLE_CLASS( CGlxLoggingApplication ) : public CAknApplication + { + public: // from CAknApplication + + /** + @function AppDllUid + + @discussion Returns the application DLL UID value + @result the UID of this Application/Dll + */ + TUid AppDllUid() const; + + protected: // from CAknApplication + /** + @function CreateDocumentL + + @discussion Create a CApaDocument object and return a pointer to it + @result a pointer to the created document + */ + CApaDocument* CreateDocumentL(); + }; + +#endif // __GLXLOGGING_APPLICATION_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/inc/glxloggingappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/inc/glxloggingappui.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +#ifndef __GLXLOGGING_APPUI_H__ +#define __GLXLOGGING_APPUI_H__ + +#include +#include + +/** + @class CGlxLoggingAppUi + + @discussion An instance of class CGlxLoggingAppUi is the UserInterface part of the AVKON + application framework for the GlxLogging example application + */ +NONSHARABLE_CLASS( CGlxLoggingAppUi ) : public CAknAppUi + { + public: + + /** + * @function CGlxLoggingAppUi + * + * @discussion Perform the first phase of two phase construction. + * This needs to be public due to the way the framework constructs the AppUi + */ + CGlxLoggingAppUi(); + + /** + * @function ~CGlxLoggingAppUi + * + * @discussion Destroy the object and release all memory objects + */ + ~CGlxLoggingAppUi(); + + /** + * @function ConstructL + * + * @discussion Perform the second phase construction of a CGlxLoggingAppUi object + * this needs to be public due to the way the framework constructs the AppUi + */ + void ConstructL(); + + public: // from CAknAppUi + + /** + * @function HandleCommandL + * + * @discussion Handle user menu selections + * @param aCommand the enumerated code for the option selected + */ + void HandleCommandL(TInt aCommand); + + public: // log writing + + static TInt TimerCallback( TAny* aParam ); + TInt DoLog(); + + private: // Data + + /// Own: log manager + RGlxLogManager iLogManager; + /// Own: timer for log write + CPeriodic* iTimer; + + }; + + +#endif // __GLXLOGGING_APPUI_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/inc/glxloggingdocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/inc/glxloggingdocument.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +#ifndef __GLXLOGGING_DOCUMENT_H__ +#define __GLXLOGGING_DOCUMENT_H__ + + +#include + +// Forward references +class CGlxLoggingAppUi; +class CEikApplication; + + +/** + @class CGlxLoggingDocument + + @discussion An instance of class CGlxLoggingDocument is the Document part of the AVKON + application framework for the GlxLogging application + */ +NONSHARABLE_CLASS( CGlxLoggingDocument ) : public CAknDocument + { +public: + + /** + @function NewL + @param aApp application creating this document + @result a pointer to the created instance of CGlxLoggingDocument + */ + static CGlxLoggingDocument* NewL(CEikApplication& aApp); + + /** + @function NewLC + + @param aApp application creating this document + @result a pointer to the created instance of CGlxLoggingDocument + */ + static CGlxLoggingDocument* NewLC(CEikApplication& aApp); + + /** + @function ~CGlxLoggingDocument + */ + ~CGlxLoggingDocument(); + +public: // from CAknDocument + /** + @function CreateAppUiL + @result a pointer to the created instance of the AppUi created + */ + CEikAppUi* CreateAppUiL(); + +private: + + /** + @function ConstructL + */ + void ConstructL(); + + /** + @function CGlxLoggingDocument + @param aApp application creating this document + */ + CGlxLoggingDocument(CEikApplication& aApp); + + }; + + +#endif // __GLXLOGGING_DOCUMENT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/src/glxloggingapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/src/glxloggingapp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +// INCLUDES +#include +#include "glxloggingapplication.h" + +// Create an application, and return a pointer to it +LOCAL_C CApaApplication* NewApplication() + { + return new CGlxLoggingApplication; + } + + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/src/glxloggingapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/src/glxloggingapplication.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +// INCLUDES +#include "glxloggingdocument.h" +#include "glxloggingapplication.h" + +// CONSTANTS +static const TUid KUidGlxLoggingApp = {0x2000A7BD}; + +// ----------------------------------------------------------------------------- +// CGlxLoggingApplication::CreateDocumentL +// ----------------------------------------------------------------------------- +CApaDocument* CGlxLoggingApplication::CreateDocumentL() + { + // Create an GlxLogging document, and return a pointer to it + CApaDocument* document = CGlxLoggingDocument::NewL(*this); + return document; + } + +// ----------------------------------------------------------------------------- +// CGlxLoggingApplication::AppDllUid +// ----------------------------------------------------------------------------- +TUid CGlxLoggingApplication::AppDllUid() const + { + // Return the UID for the GlxLogging application + return KUidGlxLoggingApp; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/src/glxloggingappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/src/glxloggingappui.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +#include +#include + +#include + +#include "glxlogging.pan" +#include "glxloggingappui.h" +#include "glxloggingapp.hrh" + + +// Constants +namespace + { + +const TInt KLoggingDriveLetterLength = 3; + +_LIT(KColonBackSlash, ":\\"); + +#ifdef __WINSCW__ + // log to the c: drive on the emulator + _LIT(KGlxLoggingFolderDrive, "c"); +#else + // log to the root of the removable media card on hardware + _LIT(KGlxLoggingFolderDrive, "e"); +#endif + + // write logged data to the file every 0.5s + const TInt KGlxLoggingIntervalMicroSec = 500000; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxLoggingAppUi::ConstructL() + { + BaseConstructL(); + + // we dont want to respond to shutdown events + iEikonEnv->SetRespondsToShutdownEvent( EFalse ); + + // Log manager + iLogManager.CreateL(); + + // Create and start the timer + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + iTimer->Start( KGlxLoggingIntervalMicroSec, + KGlxLoggingIntervalMicroSec, TCallBack( TimerCallback, this ) ); + } + +// ----------------------------------------------------------------------------- +// CGlxLoggingAppUi +// ----------------------------------------------------------------------------- +CGlxLoggingAppUi::CGlxLoggingAppUi() + { + // delete timer + delete iTimer; + // release the chunks + iLogManager.Release(); + } + +// ----------------------------------------------------------------------------- +// ~CGlxLoggingAppUi +// ----------------------------------------------------------------------------- +CGlxLoggingAppUi::~CGlxLoggingAppUi() + { + // try to write the remainder of the log + DoLog(); + } + +// ----------------------------------------------------------------------------- +// TimerCallback +// ----------------------------------------------------------------------------- +TInt CGlxLoggingAppUi::TimerCallback( TAny* aParam ) + { + return reinterpret_cast( aParam )->DoLog(); + } + +// ----------------------------------------------------------------------------- +// DoLog +// ----------------------------------------------------------------------------- +TInt CGlxLoggingAppUi::DoLog() + { + // Timer has called back so update the log file with all the entries + // that have been written to the chunks in the meantime + // just try to write all, nothing to do on leave + TBuf driveLetter; + driveLetter.Append(KGlxLoggingFolderDrive); + driveLetter.Append(KColonBackSlash); + TRAP_IGNORE( iLogManager.CommitToFileL( driveLetter ) ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// HandleCommandL. handle any menu commands +// ----------------------------------------------------------------------------- +void CGlxLoggingAppUi::HandleCommandL(TInt aCommand) + { + switch(aCommand) + { + case EEikCmdExit: + case EAknSoftkeyExit: + Exit(); + break; + default: + Panic(EGlxLoggingBasicUi); + break; + } + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/app/src/glxloggingdocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/app/src/glxloggingdocument.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2008-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: Logging utility application for MC Photos +* +*/ + + + + +#include "glxloggingappui.h" +#include "glxloggingdocument.h" + + +CGlxLoggingDocument* CGlxLoggingDocument::NewL(CEikApplication& aApp) + { + CGlxLoggingDocument* self = NewLC(aApp); + CleanupStack::Pop(self); + return self; + } + +CGlxLoggingDocument* CGlxLoggingDocument::NewLC(CEikApplication& aApp) + { + CGlxLoggingDocument* self = new (ELeave) CGlxLoggingDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +void CGlxLoggingDocument::ConstructL() + { + // no implementation required + } + +CGlxLoggingDocument::CGlxLoggingDocument(CEikApplication& aApp) : CAknDocument(aApp) + { + // no implementation required + } + +CGlxLoggingDocument::~CGlxLoggingDocument() + { + // no implementation required + } + +CEikAppUi* CGlxLoggingDocument::CreateAppUiL() + { + // Create the application user interface, and return a pointer to it, + // the framework takes ownership of this object + CEikAppUi* appUi = new (ELeave) CGlxLoggingAppUi; + return appUi; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/client/bwins/glxloggingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/client/bwins/glxloggingu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + ?Close@RGlxLogClient@@QAEXXZ @ 1 NONAME ; void RGlxLogClient::Close(void) + ?CommitToFileL@RGlxLogManager@@QAEXABVTDesC16@@@Z @ 2 NONAME ; void RGlxLogManager::CommitToFileL(class TDesC16 const &) + ?CreateL@RGlxLogManager@@QAEXXZ @ 3 NONAME ; void RGlxLogManager::CreateL(void) + ?Open@RGlxLogClient@@QAEHVTObjectId@@@Z @ 4 NONAME ; int RGlxLogClient::Open(class TObjectId) + ?Release@RGlxLogManager@@QAEXXZ @ 5 NONAME ; void RGlxLogManager::Release(void) + ?Write@RGlxLogClient@@QAEXABVTDesC8@@@Z @ 6 NONAME ; void RGlxLogClient::Write(class TDesC8 const &) + ?WriteFormat@GlxLogger@@YAXV?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 7 NONAME ; void GlxLogger::WriteFormat(class TRefByValue, ...) + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/client/eabi/glxloggingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/client/eabi/glxloggingu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _ZN13RGlxLogClient4OpenE9TObjectId @ 1 NONAME + _ZN13RGlxLogClient5CloseEv @ 2 NONAME + _ZN13RGlxLogClient5WriteERK6TDesC8 @ 3 NONAME + _ZN14RGlxLogManager13CommitToFileLERK7TDesC16 @ 4 NONAME + _ZN14RGlxLogManager7CreateLEv @ 5 NONAME + _ZN14RGlxLogManager7ReleaseEv @ 6 NONAME + _ZN9GlxLogger11WriteFormatE11TRefByValueIK6TDesC8Ez @ 7 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/client/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/client/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2008-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: Logging client side + * +*/ + + + + +PRJ_MMPFILES +glxlogging.mmp + +PRJ_TESTMMPFILES +//../tsrc/group/t_glxlogging.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/client/group/glxlogging.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/client/group/glxlogging.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: MMP for Logging utility +* +*/ + + + + +#include +#include +#include + +TARGET glxlogging.dll +TARGETTYPE dll +UID 0x1000008d 0x2000A7BB + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../../../inc +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE glxlogger.cpp +SOURCE glxlogchunk.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib + +// allow writable static data only on hardware +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/client/inc/glxlogchunk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/client/inc/glxlogchunk.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2008-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: Logging to chunk wrapper for MC Photos +* +*/ + + + + +#ifndef T_GLXLOGCHUNK_H +#define T_GLXLOGCHUNK_H + +// EXTERNAL INCLUDES +#include +#include + +/** + * RGlxLogUtility. + * Encapsulates the use of RChunk for log writing + */ +NONSHARABLE_CLASS( RGlxLogUtility ) + { + public: + /** + * Opens the log chunk with given name + * @param aName, the full name of the chunk + * @param aReadOnly, whether to open in readonly or read-write + */ + TInt Open( const TDesC& aName, TBool aReadOnly ); + + /** + * Creates the log chunk with given name + * @param aName, the full name of the chunk + */ + void CreateL( const TDesC& aName ); + + /** + * Closes the opened chunk. This needs to be called + * before an object of this class goes out of scope + */ + void Close(); + + /** + * @return the size of the log chunk + */ + TInt ChunkSize(); + + /** + * @return the chunk unique Id (set by client) + */ + TObjectId Id(); + + /** + * Sets the unique id for the log chunk + * @param aId the id to set for the chunk + */ + void SetId( TObjectId aId ); + + /** + * @return Current chunk write address + */ + TUint8* CurrentAddress(); + + /** + * Sets the current write address + * @param New write address + */ + void SetCurrentAddress( TUint8* aValue ); + + /** + * @return Last address written to file + */ + TUint8* LastLoggedAddress(); + + /** + * Sets the last logged address + * @param New last logged address + */ + void SetLastLoggedAddress( TUint8* aValue ); + + /** + * @return The topmost writable address of the chunk + */ + TUint8* BaseAddress(); + + /** + * @return The bottom most writable address of the chunk + */ + TUint8* LastAddress(); + + private: + + /// Own: chunk to write to + RChunk iChunk; + }; + +/** + * RGlxLogClient. + * Client API for log writing to chunk + */ +NONSHARABLE_CLASS( RGlxLogClient ) + { + public: + + /** + * Opens the log chunk with the given unique id + * @param aId unique id for the log writing thread + */ + IMPORT_C TInt Open( TObjectId aId ); + + /** + * Closes the log handle, needs to be called before an + * object of this class goes out of scope + */ + IMPORT_C void Close(); + + /** + * Writes a descriptor to the log + * @param aLogEntry the log entry to write + */ + IMPORT_C void Write( const TDesC8& aLogEntry ); + + private: + + /// Own: log utility + RGlxLogUtility iLogUtility; + + }; + +/** + * RGlxLogManager. + * Management API for log creation and committing to file + */ +NONSHARABLE_CLASS( RGlxLogManager ) + { + public: + + /** + * Creates the log chunks + */ + IMPORT_C void CreateL(); + + /** + * Releases the log chunks + */ + IMPORT_C void Release(); + + /** + * Writes the log to a file + * One file is created per chunk. + * @param aFolder the directory where to store the logs + */ + IMPORT_C void CommitToFileL( const TDesC& aFolder ); + + private: + + // helper method to write all descriptors of a chunk to a + // file + void CommitToFileL( RGlxLogUtility& aUtility, RFile& aFile ); + + private: + + /// Own: log utility + RGlxLogUtility iLogUtility1; + /// Own: log utility + RGlxLogUtility iLogUtility2; + /// Own: file server handle + RFs iFs; + + }; + +#endif // T_GLXLOGCHUNK_H + + \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/client/src/glxlogchunk.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/client/src/glxlogchunk.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,453 @@ +/* +* Copyright (c) 2008-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: Logging to chunk wrappe for MC Photos +* +*/ + + + + +// CLASS HEADER +#include "glxlogchunk.h" + +// EXTERNAL INCLUDES +#include + +// LOCAL DECLARATIONS +namespace + { + // size for the chunks + const TInt KLogChunkSize = 1000000; // 1 million bytes + // name for chunk 1 + _LIT( KLogChunk1Name, "MC_Photos_Logchunk1" ); + // name for chunk 2 + _LIT( KLogChunk2Name, "MC_Photos_Logchunk2" ); + // extension for log file + _LIT( KLogFileExtension, ".log" ); + // carriage return / line feed + _LIT8( KLogCR, "\r" ); + _LIT8( KLogLF, "\n" ); + // constant for machine word alignment + const TInt KBytesInAWord = sizeof( TInt32 ); + } + +inline void Panic(TInt aReason) + { + _LIT(applicationName,"Glx Logging"); + User::Panic(applicationName, aReason); + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::Open +// ----------------------------------------------------------------------------- +TInt RGlxLogUtility::Open( const TDesC& aName, TBool aReadOnly ) + { + // open the chunk + return iChunk.OpenGlobal( aName, aReadOnly ); + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::CreateL +// ----------------------------------------------------------------------------- +void RGlxLogUtility::CreateL( const TDesC& aName ) + { + // create the chunk, leave if error + TInt error = iChunk.CreateGlobal( aName, KLogChunkSize, KLogChunkSize ); + // dont treate already exists as an error + if( KErrAlreadyExists == error ) + { + // open in read-write + User::LeaveIfError( iChunk.OpenGlobal( aName, EFalse ) ); + } + else + { + User::LeaveIfError( error ); + } + + // initialise the iChunk to all zeros. + Mem::FillZ( iChunk.Base(), iChunk.Size() ); + // initialise current address to base + SetCurrentAddress( BaseAddress() ); + // initialise last logged address to base + SetLastLoggedAddress( BaseAddress() ); + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::Close +// ----------------------------------------------------------------------------- +void RGlxLogUtility::Close() + { + iChunk.Close(); + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::ChunkSize +// ----------------------------------------------------------------------------- +TInt RGlxLogUtility::ChunkSize() + { + return iChunk.Size(); + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::Id +// ----------------------------------------------------------------------------- +TObjectId RGlxLogUtility::Id() + { + // take chunk base address + TUint8* ptr_in_chunk = iChunk.Base(); + // cast that to TObjectId* + TObjectId* ptr_as_tobjectid = reinterpret_cast< TObjectId* >( ptr_in_chunk ); + // return the id + return *ptr_as_tobjectid; + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::SetId +// ----------------------------------------------------------------------------- +void RGlxLogUtility::SetId( TObjectId aId ) + { + // take chunk base address + TUint8* ptr_in_chunk = iChunk.Base(); + // cast that to TObjectId* + TObjectId* ptr_as_tobjectid = reinterpret_cast< TObjectId* >( ptr_in_chunk ); + // assign the id in place + *ptr_as_tobjectid = aId; + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::CurrentAddress +// ----------------------------------------------------------------------------- +TUint8* RGlxLogUtility::CurrentAddress() + { + // take chunk base address plus object id + TUint8* ptr_in_chunk = iChunk.Base() + sizeof( TObjectId ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // dereference that pointer to read the 32 bits that are the address + TUint32 value_of_pointer = *ptr_as_tint; + // then return the value as TUint8* + return reinterpret_cast< TUint8* >( value_of_pointer ); + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::SetCurrentAddress +// ----------------------------------------------------------------------------- +void RGlxLogUtility::SetCurrentAddress( TUint8* aValue ) + { + // take chunk base address plus object id + TUint8* ptr_in_chunk = iChunk.Base() + sizeof( TObjectId ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // assign the addres to TInt + TUint32 new_value = reinterpret_cast< TUint32 >( aValue ); + // ensure we're byte aligned - ARM requires 32 bit alignment to machine word + // boundary!! + TInt remainder = new_value % KBytesInAWord; + if ( remainder > 0 ) + { + new_value += ( KBytesInAWord - remainder ); + } + // set the new value to the chunk + *ptr_as_tint = new_value; + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::LastLoggedAddress +// ----------------------------------------------------------------------------- +TUint8* RGlxLogUtility::LastLoggedAddress() + { + // take chunk base address plus object id plus one pointer + TUint8* ptr_in_chunk = + iChunk.Base() + sizeof( TObjectId ) + sizeof( TUint8* ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // dereference that pointer to read the 32 bits that are the address + TUint32 value_of_pointer = *ptr_as_tint; + // then return the value as TUint8* + return reinterpret_cast< TUint8* >( value_of_pointer ); + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::SetLastLoggedAddress +// ----------------------------------------------------------------------------- +void RGlxLogUtility::SetLastLoggedAddress( TUint8* aValue ) + { + // take chunk base address plus object id plus one pointer + TUint8* ptr_in_chunk = + iChunk.Base() + sizeof( TObjectId ) + sizeof( TUint8* ); + // cast that to TInt* + TUint32* ptr_as_tint = reinterpret_cast< TUint32* >( ptr_in_chunk ); + // assign the addres to TInt + TUint32 new_value = reinterpret_cast< TUint32 >( aValue ); + // ensure we're byte aligned - ARM requires 32 bit alignment to machine word + // boundary!! + TInt remainder = new_value % KBytesInAWord; + if ( remainder > 0 ) + { + new_value += ( KBytesInAWord - remainder ); + } + // set the new value to the chunk + *ptr_as_tint = new_value; + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::BaseAddress +// ----------------------------------------------------------------------------- +TUint8* RGlxLogUtility::BaseAddress() + { + // take chunks base address + TUint8* base = iChunk.Base(); + // calculate the topmost write address, our header is + // TObjectId and two TUint8* + return base + sizeof( TObjectId ) + sizeof( TUint8* ) * 2; + } + +// ----------------------------------------------------------------------------- +// RGlxLogUtility::LastAddress +// ----------------------------------------------------------------------------- +TUint8* RGlxLogUtility::LastAddress() + { + // return chunks base address plus its size + return iChunk.Base() + iChunk.Size(); + } + +// ----------------------------------------------------------------------------- +// RGlxLogClient::Open +// ----------------------------------------------------------------------------- +EXPORT_C TInt RGlxLogClient::Open( TObjectId aId ) + { + // try to open first log chunk, in read-write mode + TInt err = iLogUtility.Open( KLogChunk1Name(), EFalse ); + if ( err != KErrNone ) + { + return err; + } + // check id + TObjectId id = iLogUtility.Id(); + if ( id == TObjectId( 0 ) ) + { + // no id set, so reserve this for us and use this chunk + iLogUtility.SetId( aId ); + } + // check if our id was there? + else if( id != aId ) + { + // not our chunk, try second chunk in read-write mode + err = iLogUtility.Open( KLogChunk2Name(), EFalse ); + if ( err != KErrNone ) + { + return err; + } + // check id + id = iLogUtility.Id(); + if ( id == TObjectId( 0 ) ) + { + // no id, reserve this for us and use this chunk + iLogUtility.SetId( aId ); + } + else if ( id != aId ) + { + // both chunks already reserved, return error + return KErrNotFound; + } + } + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// RGlxLogClient::Close +// ----------------------------------------------------------------------------- +EXPORT_C void RGlxLogClient::Close() + { + iLogUtility.Close(); + } + +// ----------------------------------------------------------------------------- +// RGlxLogClient::Write +// ----------------------------------------------------------------------------- +EXPORT_C void RGlxLogClient::Write( const TDesC8& aLogEntry ) + { + // get the size of log entry (in bytes) + TInt num_bytes = aLogEntry.Size(); + // take current address and chunk size to ensure log entry fits + TUint8* current_address = iLogUtility.CurrentAddress(); + // calculate the new current address, we write the size and the data + TUint8* after_write = current_address + num_bytes + sizeof( TInt ); + // chck that we fit + if( after_write >= iLogUtility.LastAddress() ) + { + // we dont fit in the end + // need to mark the old current_address so that + // manager knows we jumped to the start + TInt* last_indicator_ptr = + reinterpret_cast< TInt* >( current_address ); + // assign KErrNotFound there + *last_indicator_ptr = KErrNotFound; + // write this entry to the base address + current_address = iLogUtility.BaseAddress(); + } + // we need to store the size in the chunk first so take a TInt* + TInt* size_ptr = reinterpret_cast< TInt* >( current_address ); + // assign new value in place + *size_ptr = num_bytes; + // increase address + current_address += sizeof( TInt ); + // copy the data, first target, then source and last number of bytes + Mem::Copy( current_address, aLogEntry.Ptr(), num_bytes ); + // and set the new current address + iLogUtility.SetCurrentAddress( current_address + num_bytes ); + } + +// ----------------------------------------------------------------------------- +// RGlxLogManager::CreateL +// ----------------------------------------------------------------------------- +EXPORT_C void RGlxLogManager::CreateL() + { + // connect to the file server + User::LeaveIfError( iFs.Connect() ); + + // create two log chunks + iLogUtility1.CreateL( KLogChunk1Name ); + iLogUtility2.CreateL( KLogChunk2Name ); + } + +// ----------------------------------------------------------------------------- +// RGlxLogManager::Release +// ----------------------------------------------------------------------------- +EXPORT_C void RGlxLogManager::Release() + { + // close file server handle + iFs.Close(); + + // release both log chunks + iLogUtility1.Close(); + iLogUtility2.Close(); + } + +// ----------------------------------------------------------------------------- +// RGlxLogManager::CommitToFileL +// ----------------------------------------------------------------------------- +EXPORT_C void RGlxLogManager::CommitToFileL( const TDesC& aFolder ) + { + // open the file + RFile file; + CleanupClosePushL( file ); + + // chunk1 + // create the file name + TFileName fileName; + fileName = aFolder; + fileName.Append( KLogChunk1Name ); + fileName.Append( KLogFileExtension ); + // try to open the file + TInt err = file.Open( iFs, fileName, EFileWrite ); + if ( err == KErrNotFound ) + { + // file doesn't exist so create it + err = file.Create( iFs, fileName, EFileWrite ); + } + User::LeaveIfError( err ); + // write the first chunk to file + CommitToFileL( iLogUtility1, file ); + // close the file + file.Close(); + + // chunk2 + // reset the file name + fileName.Zero(); + // create the file name + fileName = aFolder; + fileName.Append( KLogChunk2Name ); + fileName.Append( KLogFileExtension ); + // try to open the file + err = file.Open( iFs, fileName, EFileWrite ); + if ( err == KErrNotFound ) + { + // file doesn't exist so create it + err = file.Create( iFs, fileName, EFileWrite ); + } + User::LeaveIfError( err ); + // write the second chunk to file + CommitToFileL( iLogUtility2, file ); + + CleanupStack::PopAndDestroy( &file ); + } + +// ----------------------------------------------------------------------------- +// RGlxLogManager::CommitToFileL +// ----------------------------------------------------------------------------- +void RGlxLogManager::CommitToFileL( RGlxLogUtility& aUtility, RFile& aFile ) + { + // Need to explicitly move to the end of the file as it's not done + // automatically on call to Write + TInt pos = 0; + TInt err = aFile.Seek( ESeekEnd, pos ); + User::LeaveIfError( err ); + TPtr8 logEntryPtr( 0, 0 ); + TInt logEntrySize = 0; + + // what's previously been logged to the file? + TUint8* lastLoggedAddress = aUtility.LastLoggedAddress(); + + // how much more has been added to the chunk? + TUint8* currentAddress = aUtility.CurrentAddress(); + + // write each of the chunk's logged entries to the file + TInt32* sizePtr = NULL; + while ( currentAddress != lastLoggedAddress && err == KErrNone ) + { + // get the logEntry's size + sizePtr = reinterpret_cast< TInt32* >( lastLoggedAddress ); + logEntrySize = *sizePtr; + if ( logEntrySize == KErrNotFound ) + { + // logged entries have wrapped around the end of the chunk + // so start from the beginning + lastLoggedAddress = aUtility.BaseAddress(); + sizePtr = reinterpret_cast< TInt32* >( lastLoggedAddress ); + logEntrySize = *sizePtr; + } + // set an error - this will be reset to KErrNone if we succeed + // with finding and writing a log entry + err = KErrNotFound; + if ( logEntrySize > 0 ) + { + // move the current address to the data + lastLoggedAddress += sizeof( TInt32 ); + // extract the log entry's data + logEntryPtr.Set( lastLoggedAddress, logEntrySize, logEntrySize ); + // write the log entry to the file + err = aFile.Write( logEntryPtr ); + // append carriage return and line feed to the entry + err = aFile.Write( KLogCR ); + err = aFile.Write( KLogLF ); + // ensure we align to a multiple of a 4-byte boundary + TInt remainder = logEntrySize % KBytesInAWord; + if ( remainder > 0 ) + { + // not aligned so add some padding + logEntrySize += ( KBytesInAWord - remainder ); + } + + // update the last logged address + lastLoggedAddress += logEntrySize; + } + } + // update the last logged address + aUtility.SetLastLoggedAddress( lastLoggedAddress ); + // + // commit the data + err = aFile.Flush(); + User::LeaveIfError( err ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/client/src/glxlogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/client/src/glxlogger.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2008-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: Logging utility for MC Photos +* +*/ + + + + +// CLASS HEADER +#include "glxlogger.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +//#include "glxlogchunk.h" + +namespace GlxLogger + { + /// constants + const TInt KMaxLoggingBufferLength = 256; +/*#ifndef __WINSCW__ + /// writeable buffer, this requires static data + TBuf8< KMaxLoggingBufferLength > gWriteBuffer; + _LIT( KGlxLoggingDirectory, "MCPhotos" ); + _LIT( KGlxLoggingFileName, "debug_%d.log" ); +#endif*/ + +/** + * TDes overflow handler + * Default overflow handler panics and we dont want to do + * that in logging so need to implement our own handler. + */ +class TDes8OverFlowHandler : public TDes8Overflow + { + public: // from TDes8Overflow + /// @ref TDes8Overflow::Overflow + void Overflow( TDes8& /*aDes*/ ) + { + // do nothing, we cant allocate so just eat the error + } + }; + +// ----------------------------------------------------------------------------- +// GlxLogger::WriteFormat +// ----------------------------------------------------------------------------- +EXPORT_C void WriteFormat( TRefByValue< const TDesC8 > aFmt, ... ) + { + /// writeable buffer, in emulator this is in stack + TBuf8< KMaxLoggingBufferLength > gWriteBuffer; + // take the ellipsis parameter + VA_LIST args; + VA_START( args, aFmt ); + // create overflow handler + TDes8OverFlowHandler overflowhandler; + // clear old data by setting length to zero + gWriteBuffer.SetLength( 0 ); + // append the parameters to the descriptor + gWriteBuffer.AppendFormatList( aFmt, args, &overflowhandler ); + // end the ellipsis handling + VA_END( args ); + + TBuf16<256> buffer; + buffer.Copy(gWriteBuffer); + RDebug::Print(_L("MCPhotos:-%S"),&buffer); + + } // namespace + +} // namespace diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Logging client side + * +*/ + + + + +#include +// rom file +PRJ_EXPORTS +../rom/glxlogging.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxlogging.iby) + +// include the logging client +#include "../client/group/bld.inf" + +// include the logging app +//#include "../app/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/logging/rom/glxlogging.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/logging/rom/glxlogging.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008-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: (ROM) Image description file for logging +* +*/ + + + + +#ifndef GLX_LOGGING_IBY +#define GLX_LOGGING_IBY + +file=ABI_DIR\BUILD_DIR\glxlogging.dll SHARED_LIB_DIR\glxlogging.dll + +#endif // GLX_LOGGING_IBY diff -r 000000000000 -r 4e91876724a2 photosgallery/memoryplugin/data/0x200104E3.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/memoryplugin/data/0x200104E3.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2008-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: Resource definitions for memoryplugin +* +*/ + + + +#include +#include + +RESOURCE REGISTRY_INFO theInfo +{ + dll_uid = 0x200104E3; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KOomPluginInterfaceUidValue; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x200104E3; + version_no = 1 ; + display_name = "photos"; + default_data = "photos"; + opaque_data = "photos"; + } + }; + } + }; +} + diff -r 000000000000 -r 4e91876724a2 photosgallery/memoryplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/memoryplugin/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2004 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: Build information for project memoryplugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +glxmemoryplugin.mmp + +PRJ_EXPORTS +../rom/glxmemoryplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxmemoryplugin.iby) diff -r 000000000000 -r 4e91876724a2 photosgallery/memoryplugin/group/glxmemoryplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/memoryplugin/group/glxmemoryplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project glxmemoryplugin.DLL +* +*/ + +TARGET glxmemoryplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200104E3 + +#include +#include +#include + + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +USERINCLUDE . +APP_LAYER_SYSTEMINCLUDE + + +TARGETPATH resource/apps +START RESOURCE ../data/0x200104E3.rss +TARGET glxmemoryplugin.rsc +END + +SOURCEPATH ../src +SOURCE glxmemoryplugin.cpp + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY oommonitor.lib diff -r 000000000000 -r 4e91876724a2 photosgallery/memoryplugin/rom/glxmemoryplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/memoryplugin/rom/glxmemoryplugin.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2008-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 __GLXMEMORYPLUGIN_IBY__ +#define __GLXMEMORYPLUGIN_IBY__ + +ECOM_PLUGIN( glxmemoryplugin.dll, glxmemoryplugin.rsc ) + +#endif // __GLXMEMORYPLUGIN_IBY__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/memoryplugin/src/glxmemoryplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/memoryplugin/src/glxmemoryplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of OOM memory plugin. Registers Photos UID with +* the framework to receive OOM notifications. +* +*/ + + +#include +#include +#include + +TAny* CreatePhotosOOMPluginL() + { + const TUid KGlxGalleryApplicationUid = { 0x200009EE }; + return CAppOomMonitorPlugin::NewL(KGlxGalleryApplicationUid); + } + +const TImplementationProxy ImplementationTable[] = + { + {{0x200104E3}, ::CreatePhotosOOMPluginL} + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ; + return ImplementationTable; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/bwins/dummyCu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/bwins/dummyCu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?E32Main@@YAHXZ @ 1 NONAME ; int E32Main(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/data/photos_items.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/data/photos_items.xml Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,524 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/data/photossuite.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/data/photossuite.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Photos Suite +* +*/ + +NAME PHTS + +#include +#include +#include + +RESOURCE RSS_SIGNATURE { } +RESOURCE TBUF { buf=""; } + +// from avkon.loc +RESOURCE TBUF R_OPTIONS_OPEN { buf = qtn_options_open; } +RESOURCE TBUF R_OPTIONS_HELP { buf = qtn_options_help; } + +// photos specific +RESOURCE TBUF R_LGAL_TITLE_MAIN_VIEW { buf = qtn_lgal_title_main_view; } +//RESOURCE TBUF R_LGAL_LIST_TITLE_CAPTURED_NSERIES { buf = qtn_lgal_list_title_captured; } +RESOURCE TBUF R_LGAL_LIST_TITLE_MONTHS_NSERIES { buf = qtn_lgal_list_title_months; } +RESOURCE TBUF R_LGAL_LIST_TITLE_ALBUMS_NSERIES { buf = qtn_lgal_list_title_albums; } +RESOURCE TBUF R_LGAL_LIST_TITLE_TAGS_NSERIES { buf = qtn_lgal_list_title_tags; } +//RESOURCE TBUF R_LGAL_LIST_TITLE_DOWNLOADS_NSERIES { buf = qtn_lgal_list_title_downloads; } +RESOURCE TBUF R_LGAL_LIST_TITLE_ALL_NSERIES { buf = qtn_lgal_list_title_all; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_ONE_ALBUM_NSERIES { buf = qtn_lgal_list_detail_one_alb; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_MULTI_ALBUMS_NSERIES { buf = qtn_lgal_list_detail_multi_alb; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_ONE_TAG_NSERIES { buf = qtn_lgal_list_detail_one_tag; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_MULTI_TAGS_NSERIES { buf = qtn_lgal_list_detail_multi_tag; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_NO_TAGS_NSERIES { buf = qtn_lgal_list_detail_no_tagged_items; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_ONE_ITEM_NSERIES { buf = qtn_lgal_list_detail_one_item; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_MULTI_ITEMS_NSERIES { buf = qtn_lgal_list_detail_multi_item; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_NO_ITEMS_NSERIES { buf = qtn_lgal_list_detail_no_img_vid; } +RESOURCE TBUF R_LGAL_LIST_DETAIL_MULTI_MONTHS_NSERIES { buf = qtn_lgal_list_title_month_year; } + + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/data/suite.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/data/suite.xml Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ + + + + + + + + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/eabi/dummyCu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/eabi/dummyCu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z7E32Mainv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2008-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: Build information file Photos Suite +* +*/ + + + + +#include +//#include + +PRJ_EXPORTS +../rom/photossuite.iby CORE_APP_LAYER_IBY_EXPORT_PATH(photossuite.iby) +../rom/photossuite_localization.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(photossuite_localization.iby) + +//SUITE_EXPORT_PATH_WINSCW(../data/suite.xml,photossuite/suite.xml) +//SUITE_EXPORT_PATH_ARMV5(../data/suite.xml,photossuite/suite.xml) +//SUITE_EXPORT_PATH_WINSCW(../data/photos_items.xml,photossuite/photos_items.xml) +//SUITE_EXPORT_PATH_ARMV5(../data/photos_items.xml,photossuite/photos_items.xml) + +../data/suite.xml /epoc32/release/winscw/udeb/z/private/101f4cd2/import/suites/photossuite/suite.xml +../data/photos_items.xml /epoc32/release/winscw/udeb/z/private/101f4cd2/import/suites/photossuite/photos_items.xml + +../data/suite.xml /epoc32/data/z/private/101f4cd2/import/suites/photossuite/suite.xml +../data/photos_items.xml /epoc32/data/z/private/101f4cd2/import/suites/photossuite/photos_items.xml + + +PRJ_MMPFILES +photossuite.mmp +#ifndef SBSV2 +gnumakefile export_photossuite.mk +#endif + + +PRJ_EXTENSIONS +#if defined(SBSV2) && defined(WINSCW) +START EXTENSION general/copyheaderfile +SRCFILE photossuite.rsg +END +#endif + + + + + + + + + + + + + + + + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/group/export_photossuite.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/group/export_photossuite.mk Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2008 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: export makefile for Photos Suite +# + + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=\epoc32\data\z +endif + + +FINAL : + @echo Exporting .rsg files... + perl -S ecopyfile.pl $(EPOCROOT)epoc32/include/photossuite.rsg $(EPOCROOT)epoc32/release/winscw/udeb/Z/resource/apps/photossuite.rsg + + +MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE : diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/group/photossuite.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/group/photossuite.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2008-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: Project definition file for Photos Suite +* +*/ + + + + +#include +#include + +TARGET dummyc.dll +TARGETTYPE dll + +UID 0x1000008d 0x200104E1 +CAPABILITY CAP_GENERAL_DLL + +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE dummy.cpp + +SOURCEPATH . +SYSTEMINCLUDE ../../gallery/loc //Gallery Loc + +START RESOURCE ../data/photossuite.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/rom/photossuite.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/rom/photossuite.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Image description file for Photos Suite +* +*/ + +#ifndef photossuiteSUITE_IBY +#define photossuiteSUITE_IBY + + +data=\epoc32\data\Z\private\101F4CD2\import\suites\photossuite\suite.xml private\101F4CD2\import\suites\photossuite\suite.xml +data=\epoc32\data\Z\private\101F4CD2\import\suites\photossuite\photos_items.xml private\101F4CD2\import\suites\photossuite\photos_items.xml + + +#endif // photossuiteSUITE_IBY + +// End of File \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/rom/photossuite_localization.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/rom/photossuite_localization.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2008-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: Image description file for Photos Suite +* +*/ + +#ifndef photossuiteSUITE_LOCALIZATION_IBY +#define photossuiteSUITE_LOCALIZATION_IBY + + +data=\epoc32\data\z\resource\apps\photossuite.rsc resource\apps\photossuite.rsc +data=\epoc32\include\photossuite.rsg resource\apps\photossuite.rsg + +#endif // photossuiteSUITE_LOCALIZATION_IBY + +// End of File \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuite/src/dummy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuite/src/dummy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008-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: dummy +* +*/ + + + + +#include + +EXPORT_C int E32Main() +{ + return 0; +} diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/data/photossuitelauncher.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/data/photossuitelauncher.rss Thu Dec 17 08:45:44 2009 +0200 @@ -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: Resource definitions for photos suite launcher +* +*/ +// RESOURCE IDENTIFIER +NAME PHOT // 4 letter ID + + +// INCLUDES +#include +#include +#include +#include +#include "matrixmenudata.loc" + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + + +// ---------------------------------------------------------------------------- +// +// r_localisable_app_info +// +// ---------------------------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info + { + short_caption = qtn_apps_photos_grid; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_apps_photos_grid; + + number_of_icons = 1; + icon_file = "\\resource\\apps\\photossuitelauncher.mif"; + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/data/photossuitelauncher_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/data/photossuitelauncher_reg.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* +* 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: Application's registration resource file +* +*/ + +#include +#include +#include "photossuitelauncher.hrh" + +UID2 KUidAppRegistrationResourceFile +UID3 _UID3 + +RESOURCE APP_REGISTRATION_INFO + { + app_file="photossuitelauncher"; + localisable_resource_file = "\\resource\\apps\\photossuitelauncher"; + localisable_resource_id = R_LOCALISABLE_APP_INFO; + + embeddability=KAppNotEmbeddable; + newfile=KAppDoesNotSupportNewFile; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* 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: This file provides the information required for building the +* whole of a photossuitelauncher. +* +*/ + + +PRJ_PLATFORMS +WINSCW ARMV5 + + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE photossuitelauncher.mif +OPTION SOURCES -c8,8 qgn_menu_photos +END + +PRJ_MMPFILES +photossuitelauncher.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/group/photossuitelauncher.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/group/photossuitelauncher.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -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: This is the project specification file for photossuitelauncher. +* +*/ + +#include +#include +#include "../inc/photossuitelauncher.hrh" + +CAPABILITY CAP_APPLICATION +TARGET photossuitelauncher.exe +TARGETTYPE exe +UID 0x100039CE _UID3 + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../inc + +SOURCEPATH ../src +SOURCE photossuitelauncher.cpp + +SOURCEPATH ../data + +START RESOURCE photossuitelauncher.rss +HEADER +TARGET photossuitelauncher +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END //RESOURCE + +START RESOURCE photossuitelauncher_reg.rss +DEPENDS photossuitelauncher.rsg +TARGET photossuitelauncher_reg +TARGETPATH /private/10003a3f/import/apps +END //RESOURCE + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY commonengine.lib +LIBRARY apgrfx.lib +LIBRARY ws32.lib +LIBRARY glxlogging.lib + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/inc/photossuitelauncher.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/inc/photossuitelauncher.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,24 @@ +/* +* 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: This file contains declarations for constants of photossuitelauncher. +* The file can be included in C++ or resource file. +* +*/ + +#ifndef __PHOTOSSUITELAUNCHER_HRH__ +#define __PHOTOSSUITELAUNCHER_HRH__ + +#define _UID3 0x200104E4 + +#endif // __PHOTOSSUITELAUNCHER_HRH__ diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/sis/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/sis/backup_registration.xml Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/sis/createsis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/sis/createsis.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Batch file to create sis file for photossuite launcher +rem + +makesis photossuitelauncher.pkg +signsis photossuitelauncher.sis photossuitelauncher.sisx rd.cer rd-key.pem diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/sis/photossuitelauncher.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/sis/photossuitelauncher.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +; +; 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: Package file for photossuitelauncher application +; + + +;Language - standard language definitions +&EN + +; standard SIS file header +#{"photossuitelauncher"},(0x200104E4),1,0,0 + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"Series60v3.0"} + +;Files to install +;You should change the source paths to match that of your environment +; +"\Epoc32\release\armv5\urel\photossuitelauncher.exe" -"!:\sys\bin\photossuitelauncher.exe" +"\Epoc32\data\z\resource\apps\photossuitelauncher.rsc" -"!:\resource\apps\photossuitelauncher.rsc" +"\Epoc32\data\z\private\10003a3f\apps\photossuitelauncher_reg.rsc" -"!:\private\10003a3f\import\apps\photossuitelauncher_reg.rsc" +"\Epoc32\data\z\resource\apps\photossuitelauncher.mif" -"!:\resource\apps\photossuitelauncher.mif" diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/sis/photossuitelauncher.sis Binary file photosgallery/photossuitelauncher/sis/photossuitelauncher.sis has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/sis/photossuitelauncher.sisx Binary file photosgallery/photossuitelauncher/sis/photossuitelauncher.sisx has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/sis/rd-key.pem --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/sis/rd-key.pem Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4 +6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh +7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB +gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX +pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB +yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j +KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003 +iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3 +2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+ +9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0 +aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO +TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8 +mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ= +-----END RSA PRIVATE KEY----- diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/sis/rd.cer --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/sis/rd.cer Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD +ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z +NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl +cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT +rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa +gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI +f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL +BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud +IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD +ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd +IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE +IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G +CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9 +Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT +7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR +-----END CERTIFICATE----- diff -r 000000000000 -r 4e91876724a2 photosgallery/photossuitelauncher/src/photossuitelauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/photossuitelauncher/src/photossuitelauncher.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* 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: Main application class +* +*/ + + +// INCLUDE FILES + +// Command Line and APA +#include +#include +#include +#include + +#include + +const TInt KPhotosSuiteUid ( 0x101f4cd2 ); + +// ----------------------------------------------------------------------------- +// LaunchMenuViewL +// ----------------------------------------------------------------------------- +// +void LaunchMenuViewL( const TDesC8& aMessage ) + { + GLX_LOG_INFO("PhotosSuiteLauncher LaunchMenuViewL"); + RWsSession wssession; + User::LeaveIfError(wssession.Connect()); + CleanupClosePushL(wssession); + + TApaTaskList taskList( wssession ); + TApaTask task = taskList.FindApp( TUid::Uid( KPhotosSuiteUid ) ); + + if ( task.Exists() ) + { + TInt err = task.SendMessage( TUid::Uid( KUidApaMessageSwitchOpenFileValue ), + aMessage ); + } + else + { // app not yet running + RApaLsSession appArcSession; + CleanupClosePushL( appArcSession ); + User::LeaveIfError( appArcSession.Connect() ); + TApaAppInfo appInfo; + TInt err = appArcSession.GetAppInfo( appInfo, + TUid::Uid( KPhotosSuiteUid ) ); + if( err == KErrNone ) + { + CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); + cmdLine->SetExecutableNameL( appInfo.iFullName ); + cmdLine->SetCommandL( EApaCommandRun ); + cmdLine->SetTailEndL( aMessage ); + + appArcSession.StartApp( *cmdLine ); + CleanupStack::PopAndDestroy( cmdLine ); + } + CleanupStack::PopAndDestroy( &appArcSession ); + } + CleanupStack::PopAndDestroy( &wssession ); + } + +// ----------------------------------------------------------------------------- +// DoItL +// ----------------------------------------------------------------------------- +// +void DoItL() + { + GLX_LOG_INFO("PhotosSuiteLauncher DoItL"); + LaunchMenuViewL(_L8("mm://photossuite?exit=hide")); + } + + +// ----------------------------------------------------------------------------- +// E32Main +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack + TRAPD(error,DoItL()); // more initialization, then do example + if(error != KErrNone) + { + GLX_LOG_INFO1("PhotosSuiteLauncher DoItL Error %d",error); + } + delete cleanup; // destroy clean-up stack + __UHEAP_MARKEND; + return 0; // and return + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/rom/glxgallery.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/rom/glxgallery.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2008-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: Image description file for project GLX. +* +*/ + + + + +#ifndef __GLXGALLERY_IBY__ +#define __GLXGALLERY_IBY__ + + +data=\epoc32\data\z\private\10003a3f\import\apps\glx_reg.rsc private\10003a3f\import\apps\glx_reg.rsc + +//photosuitelauncher application resource file +data=\epoc32\data\z\private\10003a3f\import\apps\photossuitelauncher_reg.rsc private\10003a3f\import\apps\photossuitelauncher_reg.rsc + +// stub sisx file to be included in ROM +data=\epoc32\data\z\system\install\glxgallery_stub.sis \system\install\glxgallery_stub.sis + +S60_APP_EXE(glx) + +//photosuitelauncher application +S60_APP_EXE(photossuitelauncher) +data=DATAZ_\APP_RESOURCE_DIR\photossuitelauncher.mif APP_RESOURCE_DIR\photossuitelauncher.mif + + +data=DATAZ_\APP_RESOURCE_DIR\glxicons.mif APP_RESOURCE_DIR\glxicons.mif +data=DATAZ_\APP_RESOURCE_DIR\glx_aif.mif APP_RESOURCE_DIR\glx_aif.mif + + +//file=ABI_DIR\BUILD_DIR\glxunifiedmetadataview.dll SHARED_LIB_DIR\glxunifiedmetadataview.dll + +file=ABI_DIR\BUILD_DIR\glxupnpcommandhandler.dll SHARED_LIB_DIR\glxupnpcommandhandler.dll + +file=ABI_DIR\BUILD_DIR\glxtexturemanager.dll SHARED_LIB_DIR\glxtexturemanager.dll + +file=ABI_DIR\BUILD_DIR\glxcollectionmanager.dll SHARED_LIB_DIR\glxcollectionmanager.dll + +file=ABI_DIR\BUILD_DIR\glxviewbase.dll SHARED_LIB_DIR\glxviewbase.dll + +file=ABI_DIR\BUILD_DIR\glxcommandhandlermarking.dll SHARED_LIB_DIR\glxcommandhandlermarking.dll + +file=ABI_DIR\BUILD_DIR\glxcommon.dll SHARED_LIB_DIR\glxcommon.dll + +file=ABI_DIR\BUILD_DIR\glximageviewermanager.dll SHARED_LIB_DIR\glximageviewermanager.dll + +file=ABI_DIR\BUILD_DIR\glxcommonui.dll SHARED_LIB_DIR\glxcommonui.dll + +file=ABI_DIR\BUILD_DIR\glxthumbnailcreator.dll SHARED_LIB_DIR\glxthumbnailcreator.dll + +file=ABI_DIR\BUILD_DIR\glxdatasourcemanager.dll SHARED_LIB_DIR\glxdatasourcemanager.dll + +ECOM_PLUGIN( glxdatasourcemde.dll, glxdatasourcemde.rsc ) + +ECOM_PLUGIN( glxcollectionpluginalbums.dll, glxcollectionpluginalbums.rsc ) + +ECOM_PLUGIN( glxcollectionpluginall.dll, glxcollectionpluginall.rsc ) + +ECOM_PLUGIN( glxcollectionpluginmonths.dll, glxcollectionpluginmonths.rsc ) + +ECOM_PLUGIN( glxcollectionpluginimageviewer.dll, glxcollectionpluginimageviewer.rsc ) +//ECOM_PLUGIN( glxthumbnailcomposerplugin.dll, glxthumbnailcomposerplugin.rsc ) + +file=ABI_DIR\BUILD_DIR\glxlayouts.dll SHARED_LIB_DIR\glxlayouts.dll +file=ABI_DIR\BUILD_DIR\glxmedialists.dll SHARED_LIB_DIR\glxmedialists.dll +file=ABI_DIR\BUILD_DIR\glxdataprovider.dll SHARED_LIB_DIR\glxdataprovider.dll +file=ABI_DIR\BUILD_DIR\glxvisuallistmanager.dll SHARED_LIB_DIR\glxvisuallistmanager.dll +file=ABI_DIR\BUILD_DIR\glxuiutilities.dll SHARED_LIB_DIR\glxuiutilities.dll + +file=ABI_DIR\BUILD_DIR\glxgridview.dll SHARED_LIB_DIR\glxgridview.dll + +file=ABI_DIR\BUILD_DIR\glxgridviewpluginbase.dll SHARED_LIB_DIR\glxgridviewpluginbase.dll + +ECOM_PLUGIN( glxgridviewplugin.dll, glxgridviewplugin.rsc ) + +file=ABI_DIR\BUILD_DIR\glxfullscreenview.dll SHARED_LIB_DIR\glxfullscreenview.dll +file=ABI_DIR\BUILD_DIR\glxfullscreenviewpluginbase.dll SHARED_LIB_DIR\glxfullscreenviewpluginbase.dll +ECOM_PLUGIN( glxfullscreenviewplugin.dll, glxfullscreenviewplugin.rsc ) + +file=ABI_DIR\BUILD_DIR\glxlistview.dll SHARED_LIB_DIR\glxlistview.dll +file=ABI_DIR\BUILD_DIR\glxlistviewpluginbase.dll SHARED_LIB_DIR\glxlistviewpluginbase.dll +ECOM_PLUGIN( glxlistviewplugin.dll, glxlistviewplugin.rsc ) + + +file=ABI_DIR\BUILD_DIR\glxcommandhandlerbase.dll SHARED_LIB_DIR\glxcommandhandlerbase.dll +file=ABI_DIR\BUILD_DIR\glxzoomview.dll SHARED_LIB_DIR\glxzoomview.dll +file=ABI_DIR\BUILD_DIR\glxmetadatadialog.dll SHARED_LIB_DIR\glxmetadatadialog.dll + +data = \epoc32\data\Z\private\10202be9\200009EE.txt private\10202be9\200009EE.txt +data = \epoc32\data\Z\private\10202be9\02000A09.txt private\10202be9\02000A09.txt + +#endif // __GLXGALLERY_IBY__ diff -r 000000000000 -r 4e91876724a2 photosgallery/rom/glxgallery_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/rom/glxgallery_resources.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2008-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: Image description file for project GLX. +* +*/ + + + + +#ifndef __GLXGALLERY_RESOURCES_IBY__ +#define __GLXGALLERY_RESOURCES_IBY__ + + + + + +data=DATAZ_\APP_RESOURCE_DIR\glx_loc.Rsc APP_RESOURCE_DIR\glx_loc.Rsc +data=DATAZ_\APP_RESOURCE_DIR\glx.Rsc APP_RESOURCE_DIR\glx.Rsc + +//photosuitelauncher application resource file +data=DATAZ_\APP_RESOURCE_DIR\photossuitelauncher.Rsc APP_RESOURCE_DIR\photossuitelauncher.Rsc + +//data=DATAZ_\APP_RESOURCE_DIR\glxtagsmanagerview.rsc APP_RESOURCE_DIR\glxtagsmanagerview.rsc + + +data=DATAZ_\APP_RESOURCE_DIR\glxtagsbrowserview.rsc APP_RESOURCE_DIR\glxtagsbrowserview.rsc + +data=DATAZ_\resource\plugins\glxplugintags.rsc resource\plugins\glxplugintags.rsc + +data=DATAZ_\APP_RESOURCE_DIR\glxviewbase.rsc APP_RESOURCE_DIR\glxviewbase.rsc + +data=DATAZ_\APP_RESOURCE_DIR\glxcommandhandlermarking.rsc APP_RESOURCE_DIR\glxcommandhandlermarking.rsc + +data=DATAZ_\resource\plugins\glxpluginalbums.rsc resource\plugins\glxpluginalbums.rsc + +data=DATAZ_\resource\plugins\glxpluginall.rsc resource\plugins\glxpluginall.rsc + +data=DATAZ_\resource\plugins\glxpluginmonths.rsc resource\plugins\glxpluginmonths.rsc + +data=DATAZ_\APP_RESOURCE_DIR\glxuiutilities.rsc APP_RESOURCE_DIR\glxuiutilities.rsc + +data=DATAZ_\APP_RESOURCE_DIR\glxgridviewdata.rsc APP_RESOURCE_DIR\glxgridviewdata.rsc + +data=DATAZ_\APP_RESOURCE_DIR\glxfullscreenviewdata.rsc APP_RESOURCE_DIR\glxfullscreenviewdata.rsc +data=DATAZ_\APP_RESOURCE_DIR\glxlistviewplugin.rsc APP_RESOURCE_DIR\glxlistviewplugin.rsc + +data=DATAZ_\APP_RESOURCE_DIR\glxdownloadtext.rsc APP_RESOURCE_DIR\glxdownloadtext.rsc +data=DATAZ_\APP_RESOURCE_DIR\glxmetadatadialog.rsc APP_RESOURCE_DIR\glxmetadatadialog.rsc +#endif // __GLXGALLERY_RESOURCES_IBY__ + + + \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/bwins/shwslideshowengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/bwins/shwslideshowengineu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,27 @@ +EXPORTS + ??1CShwSettingsModel@@UAE@XZ @ 1 NONAME ; CShwSettingsModel::~CShwSettingsModel(void) + ??1CShwSlideshowEngine@@UAE@XZ @ 2 NONAME ; CShwSlideshowEngine::~CShwSlideshowEngine(void) + ?AvailableEffectsL@CShwSlideshowEngine@@SAXAAV?$RArray@VTShwEffectInfo@@@@@Z @ 3 NONAME ; void CShwSlideshowEngine::AvailableEffectsL(class RArray &) + ?LSKPressedL@CShwSlideshowEngine@@QAEXXZ @ 4 NONAME ; void CShwSlideshowEngine::LSKPressedL(void) + ?MusicNamePathL@CShwSettingsModel@@QBEXAAVTDes16@@@Z @ 5 NONAME ; void CShwSettingsModel::MusicNamePathL(class TDes16 &) const + ?MusicOnL@CShwSettingsModel@@QBEHXZ @ 6 NONAME ; int CShwSettingsModel::MusicOnL(void) const + ?NewL@CShwSettingsModel@@SAPAV1@XZ @ 7 NONAME ; class CShwSettingsModel * CShwSettingsModel::NewL(void) + ?NewL@CShwSlideshowEngine@@SAPAV1@AAVMShwEngineObserver@@@Z @ 8 NONAME ; class CShwSlideshowEngine * CShwSlideshowEngine::NewL(class MShwEngineObserver &) + ?NextItemL@CShwSlideshowEngine@@QAEXXZ @ 9 NONAME ; void CShwSlideshowEngine::NextItemL(void) + ?PauseL@CShwSlideshowEngine@@QAEXXZ @ 10 NONAME ; void CShwSlideshowEngine::PauseL(void) + ?PlayOrderL@CShwSettingsModel@@QAEHXZ @ 11 NONAME ; int CShwSettingsModel::PlayOrderL(void) + ?PreviousItemL@CShwSlideshowEngine@@QAEXXZ @ 12 NONAME ; void CShwSlideshowEngine::PreviousItemL(void) + ?ResumeL@CShwSlideshowEngine@@QAEXXZ @ 13 NONAME ; void CShwSlideshowEngine::ResumeL(void) + ?SaveMusicNamePathL@CShwSettingsModel@@QAEXABVTDesC16@@@Z @ 14 NONAME ; void CShwSettingsModel::SaveMusicNamePathL(class TDesC16 const &) + ?SaveMusicStateL@CShwSettingsModel@@QAEXH@Z @ 15 NONAME ; void CShwSettingsModel::SaveMusicStateL(int) + ?SavePlayOrderL@CShwSettingsModel@@QAEXH@Z @ 16 NONAME ; void CShwSettingsModel::SavePlayOrderL(int) + ?SaveTransDelayL@CShwSettingsModel@@QAEXH@Z @ 17 NONAME ; void CShwSettingsModel::SaveTransDelayL(int) + ?SaveTransitionTypeL@CShwSettingsModel@@QAEXVTUid@@I@Z @ 18 NONAME ; void CShwSettingsModel::SaveTransitionTypeL(class TUid, unsigned int) + ?StartL@CShwSlideshowEngine@@QAEXAAVCAlfEnv@@AAVCAlfDisplay@@AAVMGlxMediaList@@AAVMShwMusicObserver@@VTSize@@@Z @ 19 NONAME ; void CShwSlideshowEngine::StartL(class CAlfEnv &, class CAlfDisplay &, class MGlxMediaList &, class MShwMusicObserver &, class TSize) + ?State@CShwSlideshowEngine@@QBE?AW4TShwState@1@XZ @ 20 NONAME ; enum CShwSlideshowEngine::TShwState CShwSlideshowEngine::State(void) const + ?ToggleUiControlsVisibiltyL@CShwSlideshowEngine@@QAEXXZ @ 21 NONAME ; void CShwSlideshowEngine::ToggleUiControlsVisibiltyL(void) + ?TransDelayL@CShwSettingsModel@@QBEHXZ @ 22 NONAME ; int CShwSettingsModel::TransDelayL(void) const + ?TransitionTypeL@CShwSettingsModel@@QBEXAAVTUid@@AAI@Z @ 23 NONAME ; void CShwSettingsModel::TransitionTypeL(class TUid &, unsigned int &) const + ?VolumeDownL@CShwSlideshowEngine@@QAEXXZ @ 24 NONAME ; void CShwSlideshowEngine::VolumeDownL(void) + ?VolumeUpL@CShwSlideshowEngine@@QAEXXZ @ 25 NONAME ; void CShwSlideshowEngine::VolumeUpL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/cenrep/200071D3.txt Binary file photosgallery/slideshow/engine/cenrep/200071D3.txt has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/cenrep/200071d3.cre Binary file photosgallery/slideshow/engine/cenrep/200071d3.cre has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/cenrep/keys_slideshow.xls Binary file photosgallery/slideshow/engine/cenrep/keys_slideshow.xls has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweffectcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweffectcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,820 @@ +/* +* Copyright (c) 2007-2008 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: The effect control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "shweffectcontrol.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +// INTERNAL INCLUDES +#include "shweffectmanager.h" +#include "shweffect.h" +#include "shwthumbnailloader.h" +#include "shwslideshowenginepanic.h" +#include "shwcallback.h" +#include "shwtimer.h" +#include "shwconstants.h" + +using namespace NShwSlideshow; + +// LOCAL NAMESPACE +namespace + { + // local constants, the visual list range + const TInt KRangeLeftFromFocus = -1; + const TInt KRangeRightFromFocus = 1; + } + +// LOCAL FUNCTIONS AND CONSTANTS +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwEffectControl::CShwEffectControl( + MShwEffectManager& aEffectManager, + MGlxVisualList& aVisualList, + MGlxMediaList& aMediaList, + TSize aScreenSize ) + : iEffectManager( aEffectManager ), + iVisualList( aVisualList ), + iMediaList( aMediaList ), + iEffectLoopRestarted( EFalse ), + iFailedThumbnailIndex( KErrNotFound ) + { + // initialize the default layout chain + iDefaultIconLayout.SetOpacity( KMaxOpacity, 0 ); + iDefaultIconLayout.SetSize( aScreenSize.iWidth, aScreenSize.iHeight, 0 ); + // initialise the not visible layout + iNotVisibleLayout.SetOpacity(KMinOpacity,0); + iNotVisibleLayout.SetSize( 0, 0, 0 ); + iSplitter.SetDefaultLayout(&iNotVisibleLayout); + // initialise the paused layout + iPausedLayout.SetOpacity( KMaxOpacity, 0); + iPausedLayout.SetSize( aScreenSize.iWidth, aScreenSize.iHeight, 0 ); + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwEffectControl* CShwEffectControl::NewL( + MShwEffectManager& aEffectManager, + MGlxVisualList& aVisualList, + MGlxMediaList& aMediaList, + TSize aScreenSize ) + { + TRACER("CShwEffectControl* CShwEffectControl::NewL"); + GLX_LOG_INFO( "CShwEffectControl::NewL" ); + CShwEffectControl* self = + new( ELeave ) CShwEffectControl( + aEffectManager, + aVisualList, + aMediaList, + aScreenSize ); + + // 2nd phase construct + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwEffectControl::~CShwEffectControl() + { + TRACER("CShwEffectControl::~CShwEffectControl()"); + GLX_LOG_INFO( "CShwEffectControl::~CShwEffectControl" ); + + iPausedVisuals.Close(); + + // stop observing the visual list + iVisualList.RemoveObserver( this ); + // delete timer, it cancels itself + delete iTransitionTimer; + // remove viewing context + iVisualList.RemoveContext( iContextId ); + // delete the thumbnail loader + delete iThumbnailLoader; + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::ConstructL() + { + TRACER("CShwEffectControl::ConstructL()"); + GLX_LOG_INFO( "CShwEffectControl::ConstructL" ); + + // create thumbnail loader for the medialist + iThumbnailLoader = CShwThumbnailLoader::NewL( iMediaList, *this ); + + // create the timer to end the transition phase + iTransitionTimer = CShwTimer::NewL( CActive::EPriorityStandard ); + + // add us as visual list observer + iVisualList.AddObserverL( this ); + + // specify viewing range for the visual list + iContextId = iVisualList.AddContextL( + KRangeLeftFromFocus, KRangeRightFromFocus ); + + // initialize splitter + iSplitter.SetVisualListL( &iVisualList ); + // add the splitter layout on the bottom + //subhasis commented 1 line + //API depricated in visual list manager + iVisualList.AddLayoutL( &iSplitter ); + } + +// ----------------------------------------------------------------------------- +// SendTransitionReadyL. +// ----------------------------------------------------------------------------- +TInt CShwEffectControl::SendTransitionReadyL() + { + TRACER("CShwEffectControl::SendTransitionReadyL()"); + GLX_LOG_INFO( "CShwEffectControl::SendTransitionReadyL" ); + // cancel the timer + iTransitionTimer->Cancel(); + // we need to remove the high quality thumbnails we dont plan + // to show in near future, so focus minus range to left + // is the first to unload + TInt indexToUnloadBackwards = NextListIndex( KRangeLeftFromFocus ); + // check that this index is not in focus or next from focus + // this can happen if the list to play is really short + TInt focusIndex = iMediaList.FocusIndex(); + if( ( indexToUnloadBackwards != focusIndex )&& + ( indexToUnloadBackwards != NextListIndex( KNavigateForwards ) ) ) + { + // ok, not visible so can unload + iThumbnailLoader->Unload( indexToUnloadBackwards ); + } + // send the event + TShwEventTransitionReady transitionReady; + SendEventL( &transitionReady ); + // return KErrNone, return value is ignored by CPeriodic + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// NotifyL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::NotifyL( MShwEvent* aEvent ) + { + TRACER("CShwEffectControl::NotifyL"); + // we got an event + // is it initialize + TShwEventInitialize* init = + dynamic_cast( aEvent ); + // is it start view + TShwEventStartView* viewEvent = + dynamic_cast( aEvent ); + // start transition? + TShwEventStartTransition* transEvent = + dynamic_cast( aEvent ); + // was it a pause or resume event? + TShwEventPause* pauseEvent = + dynamic_cast( aEvent ); + TShwEventResume* resumeEvent = + dynamic_cast( aEvent ); + // or a navigation event? + TShwEventNextImage* nextImageEvent = + dynamic_cast< TShwEventNextImage* >( aEvent ); + TShwEventPreviousImage* previousImageEvent = + dynamic_cast< TShwEventPreviousImage* >( aEvent ); + TShwEventToggleControlUi* toggleControlUiEvent = + dynamic_cast< TShwEventToggleControlUi* >( aEvent ); + + // process init event + if( init ) + { + // prepare the first effect and load the correct size thumbnail + // thumbnail loader ensures that the size attribute is available + PrepareAndLoadImageToViewL(); + } + // process start view event + else if( viewEvent ) + { + HandleStartViewEventL( *viewEvent ); + } + // process start transition event + else if( transEvent ) + { + HandleStartTransitionEventL( *transEvent ); + } + // process pause event + else if( pauseEvent ) + { + HandlePauseEventL(); + } + // process resume event + else if( resumeEvent ) + { + HandleResumeEventL(); + } + // process user navigate to next + else if( nextImageEvent ) + { + HandleNextImageEventL(); + } + // process toggling UI by pressing selection key + else if( toggleControlUiEvent ) + { + HandleToggleControlUiEventL(); + } + // process user navigate to previous + else if ( previousImageEvent ) + { + HandlePreviousImageEventL(); + } + // no other events are interesting for us + } + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleFocusChangedL( + TInt aFocusIndex, TReal32 /*aItemsPerSecond*/, MGlxVisualList* /*aList*/, + NGlxListDefs::TFocusChangeType /*aType*/ ) + { + TRACER("CShwEffectControl::HandleFocusChangedL"); + GLX_LOG_INFO1( "CShwEffectControl::HandleFocusChangedL %d", aFocusIndex ); + // set current as previous + iPreviousVisual = iCurrentVisual; + // take new current + iCurrentVisual = iVisualList.Visual( aFocusIndex ); + // we need to remove the high quality thumbnails we dont plan + // to show in near future, so focus minus range to left minus one + // is the first to unload + TInt indexToUnloadBackwards = NextListIndex( KRangeLeftFromFocus - 1 ); + // check that this index is not in focus or next from focus + // this can happen if the list to play is really short + if( ( indexToUnloadBackwards != aFocusIndex )&& + ( indexToUnloadBackwards != NextListIndex( KNavigateForwards ) ) ) + { + // ok, not visible so can unload + iThumbnailLoader->Unload( indexToUnloadBackwards ); + } + // unload also range + 1 as user might navigate backwards fast + TInt indexToUnloadForwards = NextListIndex( KRangeRightFromFocus + 1 ); + // check that this index is not in focus or next from focus + // this can happen if the list to play is really short + if( ( indexToUnloadForwards != aFocusIndex )&& + ( indexToUnloadForwards != NextListIndex( KNavigateForwards ) ) ) + { + // ok, not visible so can unload + iThumbnailLoader->Unload( indexToUnloadForwards ); + } + } + +// ----------------------------------------------------------------------------- +// HandleSizeChanged. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleSizeChanged( + const TSize& /*aSize*/, MGlxVisualList* /*aList*/ ) + { + // nothing to be done + } +// ----------------------------------------------------------------------------- +// HandleToggleControlUiEventL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleToggleControlUiEventL() + { + // nothing to be done + } + +// ----------------------------------------------------------------------------- +// HandleVisualRemoved. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleVisualRemoved( + const CAlfVisual* aVisual, MGlxVisualList* /*aList*/ ) + { + TRACER("CShwEffectControl::HandleVisualRemoved"); + GLX_LOG_INFO( "CShwEffectControl::HandleVisualRemoved" ); + // remove the layout for this visual just to make sure we dont use it + //subhasis commented 1 line + //API depricated in visual list manager + iSplitter.RemoveLayout( aVisual ); + } + +// ----------------------------------------------------------------------------- +// HandleVisualAddedL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleVisualAddedL( + CAlfVisual* /*aVisual*/, TInt /*aIndex*/, MGlxVisualList* /*aList*/ ) + { + // nothing to be done + } + +// ----------------------------------------------------------------------------- +// HandleThumbnailLoadedL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleThumbnailLoadedL( TInt aIndex ) + { + TRACER("CShwEffectControl::HandleThumbnailLoadedL"); + TInt focus = iVisualList.FocusIndex(); + GLX_LOG_INFO2( + "CShwEffectControl::HandleThumbnailLoadedL %d, focus %d", aIndex, focus ); + // check the index + // was it on focus, we cannot check the state as it can be either + // view or transition because of user navigation + if( aIndex == focus ) + { + GLX_LOG_INFO( + "HandleThumbnailLoadedL - sending TShwEventReadyToView" ); + // its focus index so lets send ready to view + // send ready to view event + TShwEventReadyToView readyToView; + SendEventL( &readyToView ); + } + // is it next from focus + else if( aIndex == NextListIndex( KNavigateForwards ) ) + { + GLX_LOG_INFO( + "HandleThumbnailLoadedL - sending TShwEventReadyToAdvance" ); + // send ready to advance command, + // it tells the observers that we are ready to advance to next image + TShwEventReadyToAdvance readyToAdvance; + SendEventL( &readyToAdvance ); + } + } + +// ----------------------------------------------------------------------------- +// HandleThumbnailLoadFailureL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleThumbnailLoadFailureL( TInt aIndex ) + { + TRACER("CShwEffectControl::HandleThumbnailLoadFailureL"); + GLX_LOG_INFO1( "CShwEffectControl::HandleThumbnailLoadFailureL %d", aIndex ); + // We cant remove the errornous item from the medialist so + // at the moment we just proceed as normal + // user will then see a broken icon for a while + // we need to remember this index however as we dont want to start the + // effect for it + iFailedThumbnailIndex = aIndex; + HandleThumbnailLoadedL( aIndex ); + } + +// ----------------------------------------------------------------------------- +// HandleMediaListEmpty +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleMediaListEmpty() + { + TRACER("CShwEffectControl::HandleMediaListEmpty"); + GLX_LOG_INFO( "CShwEffectControl::HandleMediaListEmpty" ); + // need to remove the contexts from medialist as closing down will + // take a while + // stop observing the visual list + iVisualList.RemoveObserver( this ); + // delete the thumbnail loader + delete iThumbnailLoader; + // set to NULL to prevent double delete + iThumbnailLoader = NULL; + // send fatal error message + TShwEventFatalError errmessage; + // need to TRAP as we cannot leave + TRAPD( error, SendEventL( &errmessage ) ); + // was there an error + if( error != KErrNone ) + { + // panic engine as nothing else can be done + NShwEngine::Panic( NShwEngine::EEngineFatalError ); + } + } + +// ----------------------------------------------------------------------------- +// PrepareAndLoadImageToViewL +// ----------------------------------------------------------------------------- +void CShwEffectControl::PrepareAndLoadImageToViewL() + { + TRACER("CShwEffectControl::PrepareAndLoadImageToViewL"); + // get current index + TInt currentIndex = iVisualList.FocusIndex(); + // get current effect + MShwEffect* currentEffect = iEffectManager.CurrentEffect(); + __ASSERT_ALWAYS( + currentEffect, NShwEngine::Panic( NShwEngine::ENullCurrentEffect ) ); + // set the current visual, since on first time there has not been navigation + iCurrentVisual = iVisualList.Visual( currentIndex ); + /// get the image size from thumbnail loader + TSize imgSize = iThumbnailLoader->ImageSizeL( currentIndex ); + // tell the effect to prepare for viewing current visual + // thumbnail size is returned + TSize thumbnailSize = + currentEffect->PrepareViewL( iCurrentVisual, imgSize ); + // ask the thumbnail loader to load the thumbnail + // once the thumbnail is loaded, we get a callback + iThumbnailLoader->LoadAndNotifyL( + currentIndex, thumbnailSize ); + } + +// ----------------------------------------------------------------------------- +// HandleStartViewEventL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleStartViewEventL( TShwEventStartView& aEvent ) + { + TRACER("CShwEffectControl::HandleStartViewEventL"); + GLX_LOG_INFO( "CShwEffectControl::HandleStartViewEventL" ); + + // remember the current view length, it is packaged into the event + iViewDuration = aEvent.Parameter(); + + // update the state + iState = EShwEffectStateInView; + + //following code commented to remove layout dependency + //! to be refactored + + // get the focus index + TInt currentIndex = iVisualList.FocusIndex(); + // tell effect to exit transition + // if we got view event and loop is already started + if( iEffectLoopRestarted ) + { + // exit transition for the previous effect and visual + // this is done first since the next effect may be same + // as previous + iPreviousEffect->ExitTransition( iPreviousVisual ); + // remove layout from splitter + iSplitter.RemoveLayout( iPreviousVisual ); + } + else + { + // get the current effect + MShwEffect* currentEffect = iEffectManager.CurrentEffect(); + // remove the old layout + iSplitter.RemoveLayout( iCurrentVisual ); + // was this thumbnail succesfully loaded? + if ( iFailedThumbnailIndex == currentIndex ) + { + // set the temporary layout for default icon + iSplitter.SetLayoutL( &iDefaultIconLayout, iCurrentVisual ); + } + else + { + // Set paused effect on current visual + //if(iPausedVisuals.Count()) + // { + // iSplitter.SetLayoutL( &iPausedLayout, iCurrentVisual ); + // } + //else + // { + // enter the view mode for visual + // ask the layout chain and set that to the current visual + // set also effect fade-in + iSplitter.SetLayoutL( + currentEffect->EnterViewL( + iCurrentVisual, + iViewDuration, + KFirstEffectFadeInDuration ), + iCurrentVisual ); + // } + } + // bring the focus visual to the front + iCurrentVisual->MoveToFront(); + } + //parts of the code commented to remove layout dependency + //! to be refactored + // get next index forwards + TInt nextIndex = NextListIndex( KNavigateForwards ); + // need to tell the next effect to prepare for the view + // get next effect + MShwEffect* nextEffect = iEffectManager.Effect( KNavigateForwards ); + // get next visual + CAlfVisual* nextVisual = iVisualList.Visual( nextIndex ); + // get the real size of the image + TSize imgSize = iThumbnailLoader->ImageSizeL( nextIndex ); + // tell the effect to prepare to view the next visual + // thumbnail size is returned + TSize thumbnailSize = + nextEffect->PrepareViewL( nextVisual, imgSize ); + // ask the thumbnail loader to load next thumbnail + iThumbnailLoader->LoadAndNotifyL( nextIndex, thumbnailSize ); + } + +// ----------------------------------------------------------------------------- +// HandleStartTransitionEventL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleStartTransitionEventL( + TShwEventStartTransition& aEvent ) + { + TRACER("CShwEffectControl::HandleStartTransitionEventL"); + GLX_LOG_INFO( "CShwEffectControl::HandleStartTransitionEventL" ); + //following code was commented to remove layout dependency + //! to be refactored + // update the state + iState = EShwEffectStateInTransition; + + // duration is in event parameters + TInt duration = aEvent.Parameter(); + // enter current effects transition mode for current visual + // get current effect + MShwEffect* currentEffect = iEffectManager.CurrentEffect(); + // inform the effect that view mode ended + currentEffect->ExitView( iCurrentVisual ); + // remove the view layout + iSplitter.RemoveLayout( iCurrentVisual ); + // add the layout chain to the current visual + iSplitter.SetLayoutL( + currentEffect->EnterTransitionL( + iCurrentVisual, duration ), iCurrentVisual ); + // ok, now we have the loop started so next time we get view_event + // we stop this transition + iEffectLoopRestarted = ETrue; + + // enter next effects view mode for next visual + // get next effect, given the direction stored in the event + MShwEffect* nextEffect = iEffectManager.Effect( KNavigateForwards ); + // get next list index forwards + TInt nextIndex = NextListIndex( KNavigateForwards ); + GLX_LOG_INFO1( "CShwEffectControl::NextVisual, %d", nextIndex ); + // get next visual, focus plus 1 modulo itemcount + CAlfVisual* nextVisual = iVisualList.Visual( nextIndex ); + + // remove old layout + iSplitter.RemoveLayout( nextVisual ); + // was the next thumbnail succesfully loaded? + if ( iFailedThumbnailIndex == nextIndex ) + { + TAlfTimedValue opacity(KMaxOpacity,0); + // Set Opacity to make it visible + nextVisual->SetOpacity(opacity); + // set the temporary layout for default icon + iSplitter.SetLayoutL( &iDefaultIconLayout, nextVisual ); + } + else + { + // enter view mode for the effect + // add the layout chain to the current visual + iSplitter.SetLayoutL( + nextEffect->EnterViewL( nextVisual, iViewDuration, duration ), + nextVisual ); + } + + + // proceed on the list, 1 step forward + NavigateListL( KNavigateForwards ); + + + // fix for EVTY-7H8BV5 + // When transition is happening from current to next visual, we are seeing next to next visual + // which is not needed so making next to next visual to invisible + TInt nextToNextIndex = NextListIndex( KNavigateForwards ); + CAlfVisual* nextToNextVisual = iVisualList.Visual( nextToNextIndex ); + if(nextToNextVisual != iPreviousVisual) + { + TAlfTimedValue opacity(KMinOpacity,0); + nextToNextVisual->SetOpacity(opacity); + } + + // need to send ready to view as in the normal case we already are + // (the image is already there) + TShwEventReadyToView readyToView; + SendEventL( &readyToView ); + + // need to start timer to send the transition ready + iTransitionTimer->Start( + duration, duration, + TShwCallBack< CShwEffectControl, SendTransitionReadyL >( this ) ); + } + +// ----------------------------------------------------------------------------- +// HandlePauseEventL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandlePauseEventL() + { + TRACER("CShwEffectControl::HandlePauseEventL"); + GLX_LOG_INFO( "CShwEffectControl::HandlePauseEventL" ); + + // Need to know if user navigates during pause + iUserNavigated = EFalse; + + // if we are in transition, pause the timer + if ( iState == EShwEffectStateInTransition ) + { + iTransitionTimer->Pause(); + iPausedVisuals.AppendL(iPreviousVisual); + } + // Store the current visual + iPausedVisuals.AppendL(iCurrentVisual); + //subhasis commented 1 line + //API depricated in visual list manager + iSplitter.RemoveLayout( iCurrentVisual ); + iSplitter.SetLayoutL( &iPausedLayout, iCurrentVisual ); + // we need to pause all effects as user may navigate while we are in pause + // and user navigation may change the current and next effect + RPointerArray< MShwEffect > effects; + // need to close the array in case of a leave + CleanupClosePushL( effects ); + iEffectManager.GetActiveEffectsL( effects ); + // loop through all active ones + for( TInt i = 0; i < effects.Count(); ++i ) + { + // get the effect and pause it + effects[ i ]->PauseL(); + } + CleanupStack::PopAndDestroy( &effects ); + } + +// ----------------------------------------------------------------------------- +// HandleResumeEventL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleResumeEventL() + { + TRACER("CShwEffectControl::HandleResumeEventL"); + GLX_LOG_INFO( "CShwEffectControl::HandleResumeEventL" ); + // we need to resume all effects as user may navigate while we are in pause + // and user navigation may change the current and next effect + RPointerArray< MShwEffect > effects; + // need to close the array in case of a leave + CleanupClosePushL( effects ); + iEffectManager.GetActiveEffectsL( effects ); + // loop through all active ones + for( TInt i = 0; i < effects.Count(); ++i ) + { + // get the effect and pause it + effects[ i ]->Resume(); + } + CleanupStack::PopAndDestroy( &effects ); + + // did user navigate while paused? + if( iUserNavigated ) + { + // resume and cancel the transition timer for its next use + // if user navigates while pause + // we never continue from transition so we need + // to resume the timer, otherwise it stays paused forever + iTransitionTimer->Resume(); + iTransitionTimer->Cancel(); + } + // if we are in transition, resume the timer + else if ( iState == EShwEffectStateInTransition ) + { + // restart timer to continue the transition + iTransitionTimer->Resume(); + TInt count = iPausedVisuals.Count(); + if (count > 0) + { + while (count > 0) + { + // unpause and remove the visuals + //iPausedVisuals[count]->Resume(); + iPausedVisuals.Remove(--count); + } + } + } + } + +// ----------------------------------------------------------------------------- +// HandleNextImageEventL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandleNextImageEventL() + { + TRACER("CShwEffectControl::HandleNextImageEventL"); + GLX_LOG_INFO( "CShwEffectControl::HandleNextImageEventL" ); + + // reset the flag so that we do prepare and start view for the visual + iEffectLoopRestarted = EFalse; + // set user navigate flag so that we do ExitView in resume + iUserNavigated = ETrue; + + // get current effect + MShwEffect* currentEffect = iEffectManager.CurrentEffect(); + // inform the effect that view mode ended + currentEffect->ExitView( iCurrentVisual ); + // remove the view layout + //subhasis commented 1 line + //API depricated in visual list manager + iSplitter.RemoveLayout( iCurrentVisual ); + // were we in transition + if ( iState == EShwEffectStateInTransition ) + { + // we're in transition so the navigation is complete but we + // want to view to the current visual immediately + // in transition two effects exist, previous and current + // and we're moving from the previous visual to the current visual + + // remove the layout from previous + //subhasis commented 1 line + //API depricated in visual list manager + iSplitter.RemoveLayout( iPreviousVisual ); + // cancel the timer to prevent a duplicate start view event + iTransitionTimer->Cancel(); + } + else + { + // we're in the view state + // so we want to stop viewing the current visual + // and show the next one + + // proceed on the list, 1 step forward + NavigateListL( KNavigateForwards ); + + // set the temporary layout for default icon + iSplitter.SetLayoutL( &iDefaultIconLayout, iCurrentVisual ); + } + + // call prepareview for the effect and load the image + PrepareAndLoadImageToViewL(); + } + +// ----------------------------------------------------------------------------- +// HandlePreviousImageEventL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::HandlePreviousImageEventL() + { + TRACER("CShwEffectControl::HandlePreviousImageEventL"); + GLX_LOG_INFO( "CShwEffectControl::HandlePreviousImageEventL" ); + + // reset the flag so that we do prepare and start view for the visual + iEffectLoopRestarted = EFalse; + // set user navigate flag so that we do EnterView in next StartView + iUserNavigated = ETrue; + + // ExitView - current + // get current effect + MShwEffect* currentEffect = iEffectManager.CurrentEffect(); + // inform the effect that view mode ended + currentEffect->ExitView( iCurrentVisual ); + // remove the current layout + //subhasis commented 1 line + //API depricated in visual list manager + iSplitter.RemoveLayout( iCurrentVisual ); + // remove the previous layout as well, its no-op if there wasnt one + iSplitter.RemoveLayout( iPreviousVisual ); + // proceed on the list, 1 step backwards + NavigateListL( KNavigateBackwards ); + + // were we in transition + if ( iState == EShwEffectStateInTransition ) + { + // as we're in transition, the focus index has already been + // updated to the next item so we need to step back + + // cancel the timer to prevent a duplicate start view event + iTransitionTimer->Cancel(); + } + else + { + // EnterView - previous + // set the temporary layout for default icon + iSplitter.SetLayoutL( &iDefaultIconLayout, iCurrentVisual ); + } + + // call prepareview for the effect and load the image + PrepareAndLoadImageToViewL(); + } + +// ----------------------------------------------------------------------------- +// NavigateListL. +// ----------------------------------------------------------------------------- +void CShwEffectControl::NavigateListL( TInt aDirection ) + { + TRACER("CShwEffectControl::NavigateListL"); + // reset the failed index value as the failure might be temporary + iFailedThumbnailIndex = KErrNotFound; + // navigate the visual list + iVisualList.NavigateL( aDirection ); + // store current effect as previous + iPreviousEffect = iEffectManager.CurrentEffect(); + // navigate to the next effect + iEffectManager.ProceedToEffect( aDirection ); + } + +// ----------------------------------------------------------------------------- +// NextListIndex. +// ----------------------------------------------------------------------------- +TInt CShwEffectControl::NextListIndex( TInt aDirection ) + { + TRACER("CShwEffectControl::NextListIndex"); + // next index in list is focus plus direction and then wrap around + TInt newIndex = + ( iVisualList.FocusIndex() + aDirection ) % iVisualList.ItemCount(); + if( newIndex < 0 ) + { + // navigating left + // sign for modulo is the same as left side so need to add itemcount + newIndex += iVisualList.ItemCount(); + } + return newIndex; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweffectcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweffectcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2007-2008 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: The effect control for the slideshow + * +*/ + + + + +#ifndef __CSHWEFFECTCONTROL_H__ +#define __CSHWEFFECTCONTROL_H__ + +// INCLUDES +#include +#include + +#include +#include +#include +#include + +#include "shwevent.h" +#include "shweventobserver.h" +#include "shweventpublisherbase.h" +#include "shwthumbnailloader.h" + +// FORWARD DECLARATIONS +class MShwEffectManager; +class MGlxVisualList; +class MGlxMediaList; +class MShwEffect; +class CAlfVisual; +class CShwTimer; + +// CLASS DECLARATION + +/** + * CShwEffectControl + * + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + */ +NONSHARABLE_CLASS( CShwEffectControl ) + : public CShwEventPublisherBase, + public MShwEventObserver, + public MGlxVisualListObserver, + public MShwThumbnailLoadObserver + { + private: + + /// effect control state + enum TShwEffectState + { + EShwEffectStateInView = 1, + EShwEffectStateInTransition + }; + + public: // Constructors and destructor + + /** + * Constructor. + * @param aEffectManager the owner and manager of the effects + * @param aVisualList the visual list where to apply the effects + * @param aMediaList the media list which is used for item loading + * @param aScreenSize the screen size for the default layout + */ + static CShwEffectControl* NewL( + MShwEffectManager& aEffectManager, + MGlxVisualList& aVisualList, + MGlxMediaList& aMediaList, + TSize aScreenSize ); + + /** + * Destructor. + */ + ~CShwEffectControl(); + + private: + + /** + * Constructor + * See NewL for parameters + */ + CShwEffectControl( + MShwEffectManager& aEffectManager, + MGlxVisualList& aVisualList, + MGlxMediaList& aMediaList, + TSize aScreenSize ); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + public: // Callback API, dont use directly + + /** + * This method is called when the transition is complete + * @param aEffectControl, pointer to this object + */ + TInt SendTransitionReadyL(); + + public: // From MShwEventObserver + + /// @ref MShwEventObserver::NotifyL + void NotifyL( MShwEvent* aEvent ); + + public: // from MGlxVisualListObserver + + /// @ref MGlxVisualListObserver::HandleFocusChangedL + void HandleFocusChangedL( + TInt aFocusIndex, TReal32 aItemsPerSecond, + MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType ); + /// @ref MGlxVisualListObserver::HandleSizeChanged + void HandleSizeChanged( + const TSize& aSize, MGlxVisualList* aList ); + /// @ref MGlxVisualListObserver::HandleVisualRemoved + void HandleVisualRemoved( + const CAlfVisual* aVisual, MGlxVisualList* aList ); + /// @ref MGlxVisualListObserver::HandleVisualAddedL + void HandleVisualAddedL( + CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + + private: // from MShwThumbnailLoadObserver + + /// @ref MShwThumbnailLoadObserver::HandleThumbnailLoadedL + void HandleThumbnailLoadedL( TInt aIndex ); + /// @ref MShwThumbnailLoadObserver::HandleThumbnailLoadFailureL + void HandleThumbnailLoadFailureL( TInt aIndex ); + /// @ref MShwThumbnailLoadObserver::HandleMediaListEmpty + void HandleMediaListEmpty(); + + private: // Implementation + + /** + * Prepare view for given effect for focus index + * and load the thumbnail in correct size + * @param aEffect the effect + */ + void PrepareAndLoadImageToViewL(); + + /** + * StartView event handler + * @param the start view event + */ + void HandleStartViewEventL( TShwEventStartView& aEvent ); + + /** + * StartTransition event handler + * @param the start transition event + */ + void HandleStartTransitionEventL( TShwEventStartTransition& aEvent ); + + /** + * Pause event handler + */ + void HandlePauseEventL(); + + /** + * Resume event handler + */ + void HandleResumeEventL(); + + /** + * Next item event handler + */ + void HandleNextImageEventL(); + + /** + * Previous item event handler + */ + void HandlePreviousImageEventL(); + + /** + * Toogle Control Ui event handler + */ + void HandleToggleControlUiEventL(); + /** + * Navigates the list and effects to given direction + * @param the direction + */ + void NavigateListL( TInt aDirection ); + + /** + * Returns the next index to the left or right + * @param the direction + * @return the next index in the visual list + */ + TInt NextListIndex( TInt aDirection ); + + private: // Implementation + + /// Ref: the effect manager + MShwEffectManager& iEffectManager; + /// Ref: the visual list + MGlxVisualList& iVisualList; + /// Ref: the media list + MGlxMediaList& iMediaList; + + /// Own: the timer + CShwTimer* iTransitionTimer; + /// Own: the layout splitter + TGlxLayoutSplitter iSplitter; + /// Own: the default size layout + TGlxSetValueLayout iDefaultIconLayout; + /// Own: the default opacity layout + TGlxSetValueLayout iPausedLayout; + /// Own: the default layout when a visual is not visible + TGlxSetValueLayout iNotVisibleLayout; + /// Own: state flag to know if loop is started + TBool iEffectLoopRestarted; + /// Own: the context id + TGlxViewContextId iContextId; + /// Own: the thumbnail loader + CShwThumbnailLoader* iThumbnailLoader; + /// Ref: the previous effect (fading out) + MShwEffect* iPreviousEffect; + /// Ref: the current visual (shown in view) + CAlfVisual* iCurrentVisual; + /// Ref: the previous visual (fading out) + CAlfVisual* iPreviousVisual; + /// Own: current state + TShwEffectState iState; + /// Own: current view duration + TInt iViewDuration; + /// Own: flag to tell if user navigated during pause + TBool iUserNavigated; + RPointerArray iPausedVisuals; + + TInt iFailedThumbnailIndex; + + }; + +#endif // __CSHWEFFECTCONTROL_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shwevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shwevent.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2007-2008 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: Default event implementations + * +*/ + + + + +// INCLUDES +#include "shwevent.h" + +// ----------------------------------------------------------------------------- +// Constructor. iValue is set +// ----------------------------------------------------------------------------- +TShwParametrizedEvent::TShwParametrizedEvent( TInt aValue ) : iValue( aValue ) + { + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +TShwParametrizedEvent::~TShwParametrizedEvent() + { + } + +// ----------------------------------------------------------------------------- +// Parameter. +// ----------------------------------------------------------------------------- +TInt TShwParametrizedEvent::Parameter() + { + return iValue; + } + +// Macro to avoid copy & pasting similar code throughout the event classes +#define SHW_DEFINE_EVENT_CLASS( cls ) \ +cls::cls() \ + { } \ +cls::~cls() \ + { } \ +MShwEvent* cls::CloneLC()\ + { \ + cls* copy = new( ELeave ) cls; \ + CleanupStack::PushL( copy ); \ + return copy; \ + } + +#define SHW_DEFINE_PARAMETER_EVENT_CLASS( cls ) \ +cls::cls( TInt aValue ) : TShwParametrizedEvent( aValue ) \ + { } \ +cls::~cls() \ + { } \ +MShwEvent* cls::CloneLC() \ + { \ + cls* copy = new( ELeave ) cls( Parameter() ); \ + CleanupStack::PushL( copy ); \ + return copy; \ + } + +/** + * Initialize the show + */ +SHW_DEFINE_EVENT_CLASS( TShwEventInitialize ) + +/** + * Start the slideshow + */ +SHW_DEFINE_EVENT_CLASS( TShwEventStart ) + +/** + * Pause the slideshow + */ +SHW_DEFINE_EVENT_CLASS( TShwEventPause ) + +/** + * Resume from pause + */ +SHW_DEFINE_EVENT_CLASS( TShwEventResume ) + +/** + * Next image by the user + */ +SHW_DEFINE_EVENT_CLASS( TShwEventNextImage ) + +/** + * Previous image by the user + */ +SHW_DEFINE_EVENT_CLASS( TShwEventPreviousImage ) + +/** + * Timer beat occurred + */ +SHW_DEFINE_EVENT_CLASS( TShwEventTimerBeat ) + +/** + * View mode is starting + */ +SHW_DEFINE_PARAMETER_EVENT_CLASS( TShwEventStartView ) + +/** + * Ready to start viewing current slide + */ +SHW_DEFINE_EVENT_CLASS( TShwEventReadyToView ); + +/** + * Ready to advance to next slide + */ +SHW_DEFINE_EVENT_CLASS( TShwEventReadyToAdvance ) + +/** + * Transition mode is starting + */ +SHW_DEFINE_PARAMETER_EVENT_CLASS( TShwEventStartTransition ) + +/** + * Transition mode is ready + */ +SHW_DEFINE_EVENT_CLASS( TShwEventTransitionReady ) + +/** + * Music volume is adjusted down + */ +SHW_DEFINE_EVENT_CLASS( TShwEventVolumeDown ); + +/** + * Music volume is adjusted up + */ +SHW_DEFINE_EVENT_CLASS( TShwEventVolumeUp ); + +/** + * Slideshow needs to be exited because of a fatal error + */ +SHW_DEFINE_EVENT_CLASS( TShwEventFatalError ); + +/** + * Selection key pressed for changed ui state (Hide or visible) + */ +SHW_DEFINE_EVENT_CLASS( TShwEventToggleControlUi); diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweventobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2008 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: The event observer interface + * +*/ + + + + +#ifndef __MSHWEVENTOBSERVER_H__ +#define __MSHWEVENTOBSERVER_H__ + +// INCLUDES +#include +#include + +// Forward declarations +class MShwEvent; + +// CLASS DECLARATION + +/** + * MShwEventObserver + */ +class MShwEventObserver + { + protected: + + /** + * Destructor. Dont allow deleting objects through this interface. + */ + virtual ~MShwEventObserver() {}; + + public: // the API + + /** + * Get notification that an event has occurred. + * This method may leave, it is event queues task to handle errors. + * @param aEvent, the event object describing the insident. + */ + virtual void NotifyL( MShwEvent* aEvent ) = 0; + + }; + +#endif // __MShwEventObserver_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweventpublisher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweventpublisher.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2008 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: The event publisher interface + * +*/ + + + + +#ifndef __MSHWEVENTPUBLISHER_H__ +#define __MSHWEVENTPUBLISHER_H__ + +// INCLUDES +#include +#include + +// Forward declarations +class MShwEventQueue; + +// CLASS DECLARATION + +/** + * MShwEventPublisher + * @author Kimmo Hoikka + */ +class MShwEventPublisher + { + protected: + + /** + * Destructor. Dont allow deleting objects through this interface. + */ + virtual ~MShwEventPublisher() {}; + + public: // the API + + /** + * Set the event queue. + * @param aQueue, the event queue where to send the events. + */ + virtual void SetEventQueue( MShwEventQueue* aQueue ) = 0; + + }; + +#endif // __MSHWEVENTPUBLISHER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweventpublisherbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweventpublisherbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007-2008 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: The base class for event publishers + * +*/ + + + + +#include "shweventpublisherbase.h" +#include "shweventqueue.h" + +#include +#include + +// ----------------------------------------------------------------------------- +// C++ Constructor. +// ----------------------------------------------------------------------------- +CShwEventPublisherBase::CShwEventPublisherBase() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwEventPublisherBase::~CShwEventPublisherBase() + { + // No implementation needed + } + +// ----------------------------------------------------------------------------- +// SendEventL. +// ----------------------------------------------------------------------------- +void CShwEventPublisherBase::SendEventL( MShwEvent* aEvent ) + { + __ASSERT_DEBUG( iQueue, User::Panic( _L("Null event Queue"), 1 ) ); + this->iQueue->SendEventL( aEvent ); + } + +// ----------------------------------------------------------------------------- +// SetEventQueue. +// ----------------------------------------------------------------------------- +void CShwEventPublisherBase::SetEventQueue( MShwEventQueue* aQueue ) + { + TRACER("CShwEventPublisherBase::SetEventQueue"); + GLX_LOG_INFO("CShwEventPublisherBase::SetEventQueue"); + this->iQueue = aQueue; + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweventpublisherbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweventpublisherbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007-2008 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: The base class for event publishers + * +*/ + + + + +#ifndef __CSHWEVENTPUBLISHERBASE_H__ +#define __CSHWEVENTPUBLISHERBASE_H__ + +// INCLUDES +#include +#include + +#include "shweventpublisher.h" + +// Forward declarations +class MShwEvent; +class MShwEventQueue; + +// CLASS DECLARATION + +/** + * CShwEventPublisherBase + * @author Kimmo Hoikka + */ +NONSHARABLE_CLASS( CShwEventPublisherBase ) : public CBase, public MShwEventPublisher + { + public: // Constructors and destructor + + /** + * Constructor + */ + CShwEventPublisherBase(); + + /** + * Destructor. + */ + ~CShwEventPublisherBase(); + + public: // New API + + /** + * This method can be used by the deriving classes to send events to the queue + * @param aEvent, the event to be sent to the queue + */ + void SendEventL( MShwEvent* aEvent ); + + public: // From MShwEventPublisher + + /** @see MShwEventPublisher::SetEventQueue */ + void SetEventQueue( MShwEventQueue* aQueue ); + + private: + + /// Ref: The event queue + MShwEventQueue* iQueue; + + }; + +#endif // __CSHWEVENTPUBLISHERBASE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweventqueue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweventqueue.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2008 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: The event queue interface + * +*/ + + + + +#ifndef __MSHWEVENTQUEUE_H__ +#define __MSHWEVENTQUEUE_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MShwEvent; + +// CLASS DECLARATION + +/** + * MShwEventQueue + * Event queue, provides the API to send events to Event Observers + */ +class MShwEventQueue + { + protected: + + /** + * Destructor. Dont allow deleting objects through this interface + */ + virtual ~MShwEventQueue() {}; + + public: // the API + + /** + * Send event to the event observers. + * @param aEvent, the event object that describes the incident + */ + virtual void SendEventL( MShwEvent* aEvent ) = 0; + + }; + +#endif // __MSHWEVENTQUEUE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweventrouter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweventrouter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2007-2008 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: The scheduler for the slideshow + * +*/ + + + + +#include "shweventrouter.h" +#include "shweventobserver.h" +#include "shweventpublisher.h" +#include "shwevent.h" +#include "shwslideshowenginepanic.h" + +#include +#include + +// constants +namespace + { + // the typical amount of observers. In current design six, + // increase if there is more observers in future + const TInt KEventObserverGranularity = 7; + const TInt KMaxNumberOfConcurrentEvents = 10; + } + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwEventRouter::CShwEventRouter() + : iObservers( KEventObserverGranularity ), + iEvents( KMaxNumberOfConcurrentEvents ) + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwEventRouter* CShwEventRouter::NewL() + { + TRACER("CShwEventRouter::NewL()"); + CShwEventRouter* self = new( ELeave ) CShwEventRouter; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwEventRouter::~CShwEventRouter() + { + TRACER("CShwEventRouter::~CShwEventRouter"); + GLX_LOG_INFO("CShwEventRouter::~CShwEventRouter"); + // need to cleanup cloned events if we did get run down + if( iEvents.Count() > 0 ) + { + for( int i = 0; i < iEvents.Count(); i++ ) + { + // call the destructor + delete iEvents[ i ]; + } + } + // close the event array itself, this frees the memory + iEvents.Close(); + // close the observer array itself, this frees the memory + // NOTE! we did not have ownership of the observers + iObservers.Close(); + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwEventRouter::ConstructL() + { + TRACER("CShwEventRouter::ConstructL"); + GLX_LOG_INFO("CShwEventRouter::ConstructL"); + // reserve space for the events so we should never leave in event handling + iEvents.ReserveL( KMaxNumberOfConcurrentEvents ); + iInsideEventLoop = EFalse; + } + +// ----------------------------------------------------------------------------- +// AddObserversL. +// ----------------------------------------------------------------------------- +void CShwEventRouter::AddObserversL( TArray aObservers ) + { + TRACER("CShwEventRouter::AddObserversL"); + GLX_LOG_INFO( "CShwEventRouter::AddObserversL" ); + // add each observer + for( TInt i = 0; i < aObservers.Count(); i++ ) + { + AddObserverL( aObservers[ i ] ); + } + } + +// ----------------------------------------------------------------------------- +// AddObserverL. +// ----------------------------------------------------------------------------- +void CShwEventRouter::AddObserverL( MShwEventObserver* aObserver ) + { + TRACER("CShwEventRouter::AddObserverL( MShwEventObserver* aObserver )"); + GLX_LOG_INFO("CShwEventRouter::AddObserverL(MShwEventObserver* aObserver)"); + __ASSERT_DEBUG( aObserver, User::Panic( _L("Null observer not allowed"), 1 ) ); + iObservers.AppendL( aObserver ); + } + +// ----------------------------------------------------------------------------- +// AddProducers. +// ----------------------------------------------------------------------------- +void CShwEventRouter::AddProducers( TArray< MShwEventPublisher* > aPublishers ) + { + TRACER("CShwEventRouter::AddProducers"); + GLX_LOG_INFO( "CShwEventRouter::AddProducers" ); + // add each publisher + for( TInt i = 0; i < aPublishers.Count(); i++ ) + { + AddProducer( aPublishers[ i ] ); + } + } + +// ----------------------------------------------------------------------------- +// AddProducer. +// ----------------------------------------------------------------------------- +void CShwEventRouter::AddProducer( MShwEventPublisher* aPublisher ) + { + TRACER("CShwEventRouter::AddProducers(MShwEventPublisher* aPublisher)"); + GLX_LOG_INFO( "CShwEventRouter::AddProducer" ); + // give the publisher the event queue so they can start calling us + aPublisher->SetEventQueue( this ); + } + +// ----------------------------------------------------------------------------- +// SendEventL. The method that handles the event dispatching. +// The events are dispatched in same order as they are sent, so if an event +// is sent while previous is beeing dispatched we queue the event and +// send it after the previous is dispatched to all observers +// ----------------------------------------------------------------------------- +void CShwEventRouter::SendEventL( MShwEvent* aEvent ) + { + TRACER("CShwEventRouter::SendEventL( MShwEvent* aEvent )"); + GLX_LOG_INFO( "CShwEventRouter::SendEvent" ); + __ASSERT_DEBUG( aEvent, User::Panic( _L("Null event not allowed"), 2 ) ); + + // add the event to the queue + // need to clone the event as the calling code may get out of scope + // before we have time to deliver the event + // this should never leave as we have reserved space in the array + MShwEvent* clone = aEvent->CloneLC(); + iEvents.AppendL( clone ); + // we take ownership of the clone so pop it off the stack + CleanupStack::Pop( clone ); + + // are we inside event loop: when an event is beeing sent we may be + // delivering an earlier event + if( iInsideEventLoop ) + { + // there is an event beeing served so queue the event and return + // the event will be served once previous one is served + return; + } + // ok, dwell into the event serving loop + // when we fall here we are just about to serve the one event + // we may get new events while processing the old ones however + iInsideEventLoop = ETrue; + do + { + // take the first event + MShwEvent* event = iEvents[ 0 ]; + TInt i = 0; + // notify all observers + for( ; i < iObservers.Count(); i++ ) + { + iObservers[ i ]->NotifyL( event ); + } + // this event is served, remove it and delete it + iEvents.Remove( 0 ); + // delete the clone + delete event; + // if there are new events, deliver them as well + } + while( iEvents.Count() > 0 ); + // done processing events, safe to enter the loop again + iInsideEventLoop = EFalse; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shweventrouter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shweventrouter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2007-2008 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: The event router for the slideshow engine + * +*/ + + + + +#ifndef __CSHWEVENTROUTER_H__ +#define __CSHWEVENTROUTER_H__ + +// INCLUDES +#include +#include + +#include "shweventqueue.h" + +// FORWARD DECLARATIONS +class MShwEventObserver; +class MShwEventPublisher; +class MShwEvent; + +// CLASS DECLARATION + +/** + * CShwEventRouter + * + * @lib shwslideshowengine.lib + */ +NONSHARABLE_CLASS( CShwEventRouter ) : public CBase, public MShwEventQueue + { + public: // Constructors and destructor + + /** + * Constructor + */ + static CShwEventRouter* NewL(); + + /** + * Destructor. + */ + ~CShwEventRouter(); + + private: + + /** + * Constructor + */ + CShwEventRouter(); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + public: // the API + + /** + * Add to the list of observers. Conveniency overload + * @param aObservers, list containing the observers to add. + */ + void AddObserversL( TArray aObservers ); + + /** + * Add to the list of observers. + * @param aObserver, the observer to add. + */ + void AddObserverL( MShwEventObserver* aObserver ); + + /** + * Add a list of publisher to the system. Conveniency overload + * @param aPublisher, list contanining the producers to add + */ + void AddProducers( TArray< MShwEventPublisher* > aPublishers ); + + /** + * Add a publisher to the system. + * @param aPublisher, the producer to add + */ + void AddProducer( MShwEventPublisher* aPublisher ); + + public: // From MShwEventQueue + + /** @ref MShwEventQueue::SendEvent */ + void SendEventL( MShwEvent* aEvent ); + + private: + + /// Own: The container for the event observers + RPointerArray< MShwEventObserver > iObservers; + + /// Own: The queue for the events + RArray< MShwEvent* > iEvents; + + /// Own: Flag to tell when an event is beeing served + TBool iInsideEventLoop; + + }; + +#endif // __CSHWEVENTROUTER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shwmusiccontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shwmusiccontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,361 @@ +/* +* Copyright (c) 2007-2008 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: The music control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "shwmusiccontrol.h" + +// EXTERNAL INCLUDES +#include // RFs +#include // MMPXPlaybackUtility +#include // TMPXPlaybackProperty, EPbRepeatOne +#include // TMPXPlaybackMessage +#include + +// INTERNAL INCLUDES +#include "shwevent.h" +#include "shwslideshowenginepanic.h" + +#include +#include + +// ----------------------------------------------------------------------------- +// C++ Constructor. save a few bits of ROM by inlining it. +// ----------------------------------------------------------------------------- +inline CShwMusicControl::CShwMusicControl( + MShwMusicObserver& aMusicObsvr, + const TDesC& aFilePath ) + : iFilePath( aFilePath ), + iMusicObsvr( aMusicObsvr ), + iMaxVolume( KErrNotFound ), + iCurrentVolume( KErrNotFound ), + iState( EMusicOff ) + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwMusicControl* CShwMusicControl::NewL( + MShwMusicObserver& aMusicObsvr, const TDesC& aFilePath ) + { + TRACER(" CShwMusicControl::NewL"); + GLX_LOG_INFO( "CShwMusicControl::NewL" ); + CShwMusicControl* self = + new( ELeave ) CShwMusicControl( aMusicObsvr, aFilePath ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwMusicControl::~CShwMusicControl() + { + TRACER(" CShwMusicControl::~CShwMusicControl"); + GLX_LOG_INFO( "CShwMusicControl::~CShwMusicControl" ); + if( iPlaybackUtility ) + { + //The Code Scanner Error is not corrected here in the case of + //calling a leaving function in the Non Leaving Function + //We need to write a seperate Function for this. + //but will reduce not reduce any error. + iPlaybackUtility->RemoveObserverL(*this); + // Tell player to close the music playback + TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) ); + + + + // Don't destroy, close releases resources. + iPlaybackUtility->Close(); + } + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwMusicControl::ConstructL() + { + TRACER("CShwMusicControl::ConstructL"); + GLX_LOG_INFO("CShwMusicControl::ConstructL"); + // need to specify the mode and observer, without these we get a crash + iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeNewPlayer, this ); + // music playback is sacrificed if MPX fails + TRAPD( err, InitPlayerL() ); + if( err == KErrNone ) + { + iState = EMusicOn; + } + } + +// --------------------------------------------------------------------------- +// Initialize the player with File Path +// --------------------------------------------------------------------------- +void CShwMusicControl::InitPlayerL() + { + TRACER("CShwMusicControl::InitPlayerL"); + GLX_LOG_INFO( "CShwMusicControl::InitPlayerL" ); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + User::LeaveIfError( fs.ShareProtected() ); + RFile file; + // try to open the file + TInt error = file.Open( + fs, + iFilePath, + EFileRead | EFileShareReadersOrWriters ); + // was there an error + if( KErrNone != error ) + { + GLX_LOG_INFO1( + "CShwMusicControl error in track %d", error ); + // let the observer know there was an error + iMusicObsvr.ErrorWithTrackL( error ); + User::Leave( error ); + } + + CleanupClosePushL( file ); + iPlaybackUtility->InitL( file ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( &fs ); + + // The track should loop + iPlaybackUtility->SetL( EPbPropertyRepeatMode, EPbRepeatOne ); + } + +// ----------------------------------------------------------------------------- +// VolumeL +// Retrieve the volume values +// ----------------------------------------------------------------------------- +void CShwMusicControl::VolumeL() + { + TRACER("CShwMusicControl::VolumeL"); + GLX_LOG_INFO( "CShwMusicControl::VolumeL" ); + // Retrieve the volume - Volume indicator is shown upon slideshow start and + // when the volume is changed + if (iMaxVolume == KErrNotFound) + { + iPlaybackUtility->ValueL( *this, EPbPropertyMaxVolume ); + } + iPlaybackUtility->ValueL( *this, EPbPropertyVolume ); + } + +// ----------------------------------------------------------------------------- +// NotifyL. +// ----------------------------------------------------------------------------- +void CShwMusicControl::NotifyL( MShwEvent* aEvent ) + { + TRACER("CShwMusicControl::NotifyL"); + GLX_LOG_INFO( "CShwMusicControl::NotifyL" ); + // only handle events if music initialisation succeeded + if( iState == EMusicOn ) + { + // reset state flag + iSwitchingMusicOn = EFalse; + // music playback is sacrificed if MPX fails + TRAPD( errr, HandleEventL( aEvent ) ); + // if we had an error while switching music back on, tell observer + // that music is off + if( ( errr != KErrNone )&& + ( iSwitchingMusicOn ) ) + { + iMusicObsvr.MusicOff(); + } + } + } + +// --------------------------------------------------------------------------- +// From class MMPXPlaybackCallback. +// Handle the change of status of playback engine +// --------------------------------------------------------------------------- +void CShwMusicControl::HandlePropertyL( TMPXPlaybackProperty aProperty, + TInt aValue, + TInt aError ) + { + TRACER("CShwMusicControl::HandlePropertyL"); + GLX_LOG_INFO( "CShwMusicControl::HandlePropertyL" ); + + // leave if there was an error + User::LeaveIfError( aError ); + + // handle max volume and volume, ignore other properties + if( EPbPropertyMaxVolume == aProperty ) + { + iMaxVolume = aValue; + } + else if( EPbPropertyVolume == aProperty ) + { + // set the current volume + iCurrentVolume = aValue; + // call observer only when max volume is also known + // iMaxVolume and iCurrentVolume are initialized to KErrNotFound + if( iMaxVolume != KErrNotFound ) + { + iMusicObsvr.MusicVolumeL( iCurrentVolume, iMaxVolume ); + } + } + } + +// ----------------------------------------------------------------------------- +// From MMPXPlaybackCallback +// Method is called continously until aComplete=ETrue, signifying that +// it is done and there will be no more callbacks +// Only new items are passed each time +// ----------------------------------------------------------------------------- +void CShwMusicControl::HandleSubPlayerNamesL( + TUid /*aPlayer*/, const MDesCArray* /*aSubPlayers*/, + TBool /*aComplete*/, TInt /*aError*/ ) + { + } + +// --------------------------------------------------------------------------- +// From class MMPXPlaybackCallback. +// Call back of media request +// --------------------------------------------------------------------------- +void CShwMusicControl::HandleMediaL( + const CMPXMedia& /*aProperties*/, TInt /*aError*/ ) + { + } + +// --------------------------------------------------------------------------- +// From class MMPXPlaybackObserver +// Handle playback message - required for debugging state of MPX +// Player component +// --------------------------------------------------------------------------- +void CShwMusicControl::HandlePlaybackMessageL( + const TMPXPlaybackMessage& /*aMessage*/ ) + { + } + +// --------------------------------------------------------------------------- +// From MMPXPlaybackObserver +// --------------------------------------------------------------------------- +void CShwMusicControl::HandlePlaybackMessage(const CMPXMessage& aMsg) + { + TRACER("CShwMusicControl::HandlePlaybackMessage"); + GLX_LOG_ENTRY_EXIT( "CShwMusicControl::HandlePlaybackMessageL()" ); + + switch(*aMsg.Value( KMPXMessageGeneralEvent )) + { + case TMPXPlaybackMessage::EInitializeComplete: + { + GLX_LOG_INFO( "TMPXPlaybackMessage::EInitializeComplete" ); + // at here, can play the track + iCanPlay = ETrue; + + //execute the cached "play" command + if ( iPlayCached ) + { + GLX_LOG_INFO( "iPlayCached" ); + // Play the track + //The Code Scanner Error is not corrected here in the case of + //calling a leaving function in the Non Leaving Function + //We need to write a seperate Function for this. + //but will reduce only one error. + TRAP_IGNORE(iPlaybackUtility->CommandL( EPbCmdPlay ) ); + iMusicObsvr.MusicOnL(); + // need to call volume ourself to show the + // volume indicator in start + VolumeL(); + iPlayCached = EFalse; + } + break; + } + default: + { + GLX_LOG_INFO( "CShwMusicControl::HandlePlaybackMessage: Default" ); + break; + } + } + } + +// ----------------------------------------------------------------------------- +// HandleEventL. +// ----------------------------------------------------------------------------- +void CShwMusicControl::HandleEventL( MShwEvent* aEvent ) + { + TRACER("CShwMusicControl::HandleEventL( MShwEvent* aEvent )"); + GLX_LOG_INFO( "CShwTimerControl::HandleEventL" ); + // we got an event, was it start + if( dynamic_cast< TShwEventStart* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwMusicControl::NotifyL - TShwEventStart" ); + // set state flag + iSwitchingMusicOn = ETrue; + // iCanPlay is True when Player is Initialized. + if ( iCanPlay ) + { + GLX_LOG_INFO( "inside ICanPlay" ); + // Play the track + TRAP_IGNORE(iPlaybackUtility->CommandL( EPbCmdPlay ) ); + iMusicObsvr.MusicOnL(); + // need to call volume ourself to show the + // volume indicator in start + VolumeL(); + } + else + { + GLX_LOG_INFO( "inside Else: ICanPlay" ); + // initialization is not finished ,and cache the "play" command + iPlayCached = ETrue; + } + } + else if( dynamic_cast< TShwEventPause* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwMusicControl::NotifyL - TShwEventPause" ); + // pause playback + iPlaybackUtility->CommandL( EPbCmdPause ); + // let the observer know + iMusicObsvr.MusicOff(); + } + else if( dynamic_cast< TShwEventResume* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwMusicControl::NotifyL - TShwEventResume" ); + // set state flag + iSwitchingMusicOn = ETrue; + // resume + iPlaybackUtility->CommandL( EPbCmdPlay ); + // let the observer know + iMusicObsvr.MusicOnL(); + } + else if( dynamic_cast< TShwEventVolumeDown* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwMusicControl::NotifyL - TShwEventVolumeDown" ); + + iPlaybackUtility->CommandL( EPbCmdDecreaseVolume ); + VolumeL(); + } + else if( dynamic_cast< TShwEventVolumeUp* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwMusicControl::NotifyL - TShwEventVolumeUp" ); + + iPlaybackUtility->CommandL( EPbCmdIncreaseVolume ); + VolumeL(); + } + else if( dynamic_cast< TShwEventToggleControlUi* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwMusicControl::NotifyL - TShwEventToggleControlUi" ); + // Have to impliment if need comes + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shwmusiccontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shwmusiccontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2007-2008 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: The music control for the slideshow + * +*/ + + + +#ifndef __CSHWMUSICCONTROL_H__ +#define __CSHWMUSICCONTROL_H__ + +// INCLUDES +#include +#include + +#include // MMPXPlaybackCallback +#include // TMPXPlaybackProperty + +#include "shwmusicobserver.h" // MShwMusicObserver +#include "shweventobserver.h" +#include "shweventpublisherbase.h" + + +// FORWARD DECLARATIONS +class MMPXPlaybackUtility; + + +// CLASS DECLARATION + +/** + * CShwMusicControl + * Slideshow music control wraps the MPX music control for slideshow + * @lib shwslideshowengine.lib + * @author Loughlin Spollen + */ +NONSHARABLE_CLASS( CShwMusicControl ) + : public CShwEventPublisherBase, + public MShwEventObserver, + public MMPXPlaybackCallback, + public MMPXPlaybackObserver + { + public: // Constructors and destructor + + /** + * Constructor. + * @param aFilePath, the list that this view control manages + * @param aMusicObsvr, the music control observer which receives + * notification of music on/off and + * volume level. + */ + static CShwMusicControl* NewL(MShwMusicObserver& aMusicObsvr, + const TDesC& aFilePath); + + /** + * Destructor. + */ + ~CShwMusicControl(); + + private: + + /** + * Constructor + * @param aFilePath, the list that this view control manages + * @param aMusicObsrvr* the music control observer. May be Null. + */ + CShwMusicControl(MShwMusicObserver& aMusicObsvr, + const TDesC& aFilePath); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + /** + * Initialise the player utility member + */ + void InitPlayerL(); + + /** + * Retrieve the current volume settings from the player + * utility member + * Volume settins are retrieved asyncronously + */ + void VolumeL(); + + public: // From MShwEventObserver + + /** @ref MShwEventObserver::NotifyL */ + void NotifyL(MShwEvent* aEvent); + + public: // From MMPXPlaybackCallback + + /** + * Handle playback property + * @ref MMPXPlaybackCallback::HandlePropertyL + */ + void HandlePropertyL( + TMPXPlaybackProperty aProperty, + TInt aValue, TInt aError ); + + /** + * Method is called continously until aComplete=ETrue, + * signifying that it is done and there will be no more + * callbacks + * Only new items are passed each time + * @ref MMPXPlaybackCallback::HandleSubPlayerNamesL + */ + void HandleSubPlayerNamesL( + TUid aPlayer, const MDesCArray* aSubPlayers, + TBool aComplete, TInt aError ); + + /** + * Handle extended media properties + * @ref MMPXPlaybackCallback::HandleMediaL + */ + void HandleMediaL( + const CMPXMedia& aProperties, TInt aError ); + + private: // From MMPXPlaybackObserver + + /** + * Handle playback message - required for debugging state of MPX + * Player component + */ + void HandlePlaybackMessageL( + const TMPXPlaybackMessage& aMessage ); + + /** + * Handle playback message + * NOTE: only one of HandlePlaybackMessage callback can be implemented + * + * @param aMsg playback message, ownership not transferred. + * Please check aMsg is not NULL before using it. If aErr is not + * KErrNone, plugin might still call back with more info in the aMsg. + * @param aErr system error code. + */ + void HandlePlaybackMessage(const CMPXMessage& aMsg); + + private: // Implementation + + // implmentation of the NotifyL + void HandleEventL( MShwEvent* aEvent ); + + /// Own: music is beeing switched on + TBool iSwitchingMusicOn; + + /// Ref: the path to the music file + const TDesC& iFilePath; + + /// Own: the MPX player utility + MMPXPlaybackUtility* iPlaybackUtility; + + /// Ref: Music Observer + MShwMusicObserver& iMusicObsvr; + + /// Own: the max volume setting + TInt iMaxVolume; + + /// Own: the current volume setting + TInt iCurrentVolume; + + // It is set to ETrue if music can be played + TBool iCanPlay; + + // It is set to ETrue if music player is not yet initialized + TBool iPlayCached; + + /// Own: state flag + enum TState + { + EMusicOn, + EMusicOff + } iState; + + }; + +#endif // __CSHWMUSICCONTROL_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shwtimercontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shwtimercontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2007-2008 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: The timer control for the slideshow + * +*/ + + + + +#include "shwtimercontrol.h" +#include "shwevent.h" +#include "shwcallback.h" +#include "shwtimer.h" + +#include +#include + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwTimerControl::CShwTimerControl() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwTimerControl* CShwTimerControl::NewL() + { + TRACER("CShwTimerControl::NewL"); + GLX_LOG_INFO( "CShwTimerControl::NewL" ); + CShwTimerControl* self = new( ELeave ) CShwTimerControl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwTimerControl::~CShwTimerControl() + { + TRACER("CShwTimerControl::~CShwTimerControl"); + GLX_LOG_INFO( "CShwTimerControl::~CShwTimerControl" ); + // just delete, it cancels the timer + delete iTimer; + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwTimerControl::ConstructL() + { + TRACER("CShwTimerControl::ConstructL"); + // create the timer + iTimer = CShwTimer::NewL( CActive::EPriorityStandard ); // neutral priority + } + +// ----------------------------------------------------------------------------- +// SendTimerBeatL. +// ----------------------------------------------------------------------------- +TInt CShwTimerControl::SendTimerBeatL() + { + TRACER("CShwTimerControl::SendTimerBeatL"); + GLX_LOG_INFO( "CShwTimerControl::SendTimerBeatL" ); + // cancel the timer + iTimer->Cancel(); + // send the timerbeat + TShwEventTimerBeat timerbeat; + SendEventL( &timerbeat ); + // return KErrNone, return value is ignored by CPeriodic + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// NotifyL. +// ----------------------------------------------------------------------------- +void CShwTimerControl::NotifyL( MShwEvent* aEvent ) + { + TRACER("CShwTimerControl::NotifyL"); + GLX_LOG_INFO( "CShwTimerControl::NotifyL" ); + TShwEventStartView* eventStartView = + dynamic_cast( aEvent ); + // was it start view + if( eventStartView ) + { + // event is start view + TInt interval = eventStartView->Parameter(); + // get the relevant delay and interval values + GLX_LOG_INFO1( + "CShwTimerControl::NotifyL - TShwEventStartView %d", interval ); + + // Start the timer with the appropriate values for the event + iTimer->Start( interval, interval, + TShwCallBack< CShwTimerControl, SendTimerBeatL >( this ) ); + } + // was it start pause + else if ( dynamic_cast( aEvent ) ) + { + GLX_LOG_INFO( "CShwTimerControl::NotifyL - TShwEventPause" ); + // pause the timer + iTimer->Pause(); + } + // was it start resume + else if( dynamic_cast( aEvent ) ) + { + // event is resume + GLX_LOG_INFO( "CShwTimerControl::NotifyL - TShwEventResume" ); + // resume the timer + iTimer->Resume(); + } + // was it next or previous image? + else if ( dynamic_cast< TShwEventNextImage* >( aEvent ) || + dynamic_cast< TShwEventPreviousImage* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwTimerControl::NotifyL - TShwEventNext/PreviousImage" ); + // cancel the timer as we have moved to another image + iTimer->Cancel(); + } + else if ( dynamic_cast< TShwEventToggleControlUi* >( aEvent )) + { + GLX_LOG_INFO( "CShwTimerControl::NotifyL - TShwEventToggleControlUi" ); + // Have to impliment if need comes + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shwtimercontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shwtimercontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2007-2008 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: The timer control for the slideshow + * +*/ + + + + +#ifndef __CSHWTIMERCONTROL_H__ +#define __CSHWTIMERCONTROL_H__ + +// INCLUDES +#include +#include + +#include "shweventobserver.h" +#include "shweventpublisherbase.h" + +// FORWARD DECLARATION +class CShwTimer; + +// CLASS DECLARATION + +/** + * CShwTimerControl + * + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + */ +NONSHARABLE_CLASS( CShwTimerControl ) + : public CShwEventPublisherBase, public MShwEventObserver + { + public: // Constructors and destructor + + /** + * Constructor. + */ + static CShwTimerControl* NewL(); + + /** + * Destructor. + */ + ~CShwTimerControl(); + + private: + + /** + * Constructor + */ + CShwTimerControl(); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + public: // API + + /** + * This method is called when the time tick occurs + */ + TInt SendTimerBeatL(); + + public: // From MShwEventObserver + + /// @ref MShwEventObserver::NotifyL + void NotifyL( MShwEvent* aEvent ); + + private: + + /// Own: the timer + CShwTimer* iTimer; + + }; + +#endif // __CSHWTIMERCONTROL_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shwviewcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shwviewcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,230 @@ +/* +* Copyright (c) 2007-2008 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: The view control for the slideshow + * +*/ + + + + +#include "shwviewcontrol.h" + +#include "shwevent.h" +#include "shwslideshowenginepanic.h" + +#include +#include +#include + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwViewControl::CShwViewControl( MGlxMediaList& aList ) + : iList( aList ), + iReadyToViewReceived( EFalse ), + iTransitionReadyReceived( EFalse ), + iReadyToAdvanceReceived( EFalse ), + iTimerReceived( EFalse ), + iUserNavigated( EFalse ), + iPaused( EFalse ), + iUserNavigatedWhilePaused( EFalse ) + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwViewControl* CShwViewControl::NewL( + MGlxMediaList& aList, TInt aTransitionDuration, TInt aViewDuration ) + { + TRACER("CShwViewControl::NewL"); + GLX_LOG_INFO( "CShwViewControl::NewL" ); + CShwViewControl* self = new( ELeave ) CShwViewControl( aList ); + CleanupStack::PushL( self ); + + // set the durations + self->iTransitionDuration = aTransitionDuration; + self->iViewDuration = aViewDuration; + self->ConstructL(); + + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwViewControl::~CShwViewControl() + { + TRACER("CShwViewControl::~CShwViewControl"); + GLX_LOG_INFO( "CShwViewControl::~CShwViewControl" ); + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwViewControl::ConstructL() + { + TRACER("CShwViewControl::ConstructL"); + GLX_LOG_INFO( "CShwViewControl::ConstructL" ); + } + +// ----------------------------------------------------------------------------- +// NotifyL. +// ----------------------------------------------------------------------------- +void CShwViewControl::NotifyL( MShwEvent* aEvent ) + { + TRACER("CShwViewControl::NotifyL"); + GLX_LOG_INFO( "CShwViewControl::NotifyL" ); + // we got an event, was it start slideshow + if( dynamic_cast< TShwEventStart* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwViewControl::NotifyL - TShwEventStart" ); + // start view immediately + // as we do not get transition ready before the first slide + TShwEventStartView startView( iViewDuration ); + SendEventL( &startView ); + } + // was it ready to view + else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwViewControl::NotifyL - TShwEventReadyToView" ); + // set ready to view flag + iReadyToViewReceived = ETrue; + // is transition ready or user did navigate + if( iTransitionReadyReceived || iUserNavigated ) + { + // reset user navigate flag + iUserNavigated = EFalse; + // send start view + SendStartViewL(); + } + } + // was it transition ready + else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwViewControl::NotifyL - TShwEventTransitionReady" ); + // set transition ready flag + iTransitionReadyReceived = ETrue; + // are we ready to start view + if( iReadyToViewReceived ) + { + // send start view + SendStartViewL(); + } + } + // was it timer beat + else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwViewControl::NotifyL - TShwEventTimerBeat" ); + // we got the timer + iTimerReceived = ETrue; + // check if we are ok to go to start transition + CheckAndSendStartTransitionL(); + } + // was it ready to advance + else if( dynamic_cast< TShwEventReadyToAdvance* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwViewControl::NotifyL - TShwEventReadyToAdvance" ); + // we got ready to advance + iReadyToAdvanceReceived = ETrue; + // check if we are ok to go to start transition + CheckAndSendStartTransitionL(); + } + // was it next or previous image? + else if ( dynamic_cast< TShwEventNextImage* >( aEvent ) || + dynamic_cast< TShwEventPreviousImage* >( aEvent ) ) + { + // user did navigate, reset the state flags + iReadyToAdvanceReceived = EFalse; + iReadyToViewReceived = EFalse; + // user did navigate + iUserNavigated = ETrue; + iUserNavigatedWhilePaused = iPaused; + } + // pause event? + else if ( dynamic_cast< TShwEventPause* >( aEvent ) ) + { + // we are paused + iPaused = ETrue; + iUserNavigatedWhilePaused = EFalse; + } + // resume event? + else if ( dynamic_cast< TShwEventResume* >( aEvent ) ) + { + // we are not paused + iPaused = EFalse; + // did user navigate? + if( iUserNavigatedWhilePaused ) + { + // reset the flag + iUserNavigatedWhilePaused = EFalse; + // user navigated while paused so need to reset view mode + // to restart the effect and timer, while on pause it was not + // completely started + SendStartViewL(); + } + } + else if ( dynamic_cast< TShwEventToggleControlUi* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwViewControl::NotifyL - TShwEventToggleControlUi" ); + // Have to impliment if need comes + } + } + +// ----------------------------------------------------------------------------- +// CheckAndSendStartTransitionL. +// ----------------------------------------------------------------------------- +void CShwViewControl::CheckAndSendStartTransitionL() + { + TRACER("CShwViewControl::CheckAndSendStartTransitionL"); + GLX_LOG_INFO( "CShwViewControl::CheckAndSendStartTransitionL" ); + // check if we got timer and ready to advance and + // we are not paused and there is more than one item + if( iTimerReceived && iReadyToAdvanceReceived && + (!iPaused) && (iList.Count() > 1) ) + { + GLX_LOG_INFO( "CShwViewControl::Sending TShwEventStartTransition" ); + // reset timer and viewready flags + iReadyToAdvanceReceived = EFalse; + iTimerReceived = EFalse; + // send start transition event + TShwEventStartTransition startTransition( iTransitionDuration ); + SendEventL( &startTransition ); + // reset also view flags so that we wait for both before starting view + iReadyToViewReceived = EFalse; + iTransitionReadyReceived = EFalse; + } + } + +// ----------------------------------------------------------------------------- +// SendStartViewL. +// ----------------------------------------------------------------------------- +void CShwViewControl::SendStartViewL() + { + TRACER("CShwViewControl::SendStartViewL"); + GLX_LOG_INFO( "CShwViewControl::SendStartViewL" ); + // reset ready to view and transition ready flags + iReadyToViewReceived = EFalse; + iTransitionReadyReceived = EFalse; + // send start view event + TShwEventStartView startView( iViewDuration ); + SendEventL( &startView ); + // reset also transition start flags so that we wait for both + // before starting transition + iTimerReceived = EFalse; + iReadyToAdvanceReceived = EFalse; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/controlsrc/shwviewcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/controlsrc/shwviewcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007-2008 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: The view control for the slideshow + * +*/ + + + + +#ifndef __CSHWVIEWCONTROL_H__ +#define __CSHWVIEWCONTROL_H__ + +// INCLUDES +#include +#include + +#include "shweventobserver.h" +#include "shweventpublisherbase.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; + +// CLASS DECLARATION + +/** + * CShwViewControl + * + * @author Kimmo Hoikka + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + */ +NONSHARABLE_CLASS( CShwViewControl ) + : public CShwEventPublisherBase, public MShwEventObserver + { + public: // Constructors and destructor + + /** + * Constructor. + * @param aList, the list that is shown in slideshow + * @param aTransitionDuration, the duration for transition in milliseconds + * @param aViewDuration, the duration for view in milliseconds + */ + static CShwViewControl* NewL( + MGlxMediaList& aList, TInt aTransitionDuration, TInt aViewDuration ); + + /** + * Destructor. + */ + ~CShwViewControl(); + + private: + + /** + * @param aList, the list that is shown in slideshow + * Constructor + */ + CShwViewControl( MGlxMediaList& aList ); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + public: // From MShwEventObserver + + /// @ref MShwEventObserver::NotifyL + void NotifyL( MShwEvent* aEvent ); + + private: // Implementation + + /// Check if state allows to send start view and send it + void SendStartViewL(); + /// Check if state allows to send start transition and send it + void CheckAndSendStartTransitionL(); + + /// Ref: the medialist + MGlxMediaList& iList; + /// Own: Transition duration + TInt iTransitionDuration; + /// Own: View duration + TInt iViewDuration; + /// Own: Flag to tell whether we received ready to start view + TBool iReadyToViewReceived; + /// Own: Flag to tell whether we received transition ready + TBool iTransitionReadyReceived; + /// Own: Flag to tell whether we received ready to advance + TBool iReadyToAdvanceReceived; + /// Own: Flag to tell whether we received timer beat + TBool iTimerReceived; + /// Own: Flag to tell that user navigated during pause + TBool iUserNavigated; + /// Own: Flag set to ETrue when paused, EFalse when playing + TBool iPaused; + /// Own: Flag to tell if user navigated while paused + TBool iUserNavigatedWhilePaused; + + }; + +#endif // __CSHWVIEWCONTROL_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/enginedllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/enginedllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow engine DLL + * +*/ + + + + +// Include Files + +#include // User::Panic +#include "shwslideshowenginepanic.h" // panic codes + +// Global Functions + +// ----------------------------------------------------------------------------- +// Panics the thread with given panic code +// ----------------------------------------------------------------------------- +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + _LIT( KEnginePanicName, "ShwEngine" ); + User::Panic( KEnginePanicName, aPanic ); + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwhuiutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwhuiutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007-2008 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: Utility that contains HUI related slideshow code + * +*/ + + + + +// INCLUDES +#include "shwhuiutility.h" +#include + +// DEPENDENCIES +#include +#include +#include +#include +#include +#include "shwslideshowenginepanic.h" + +// ----------------------------------------------------------------------------- +// ShowVisualListL. +// ----------------------------------------------------------------------------- +void ShwUiUtility::ShowVisualListL( CAlfDisplay* aDisplay, MGlxVisualList* aVisualList ) + { + TRACER("ShwUiUtility::ShowVisualListL"); + GLX_LOG_INFO("ShwUiUtility::ShowVisualListL"); + // make sure we always got HUI display and the visual list + __ASSERT_ALWAYS( aDisplay, NShwEngine::Panic( NShwEngine::ENullHuiDisplay ) ); + __ASSERT_ALWAYS( aVisualList, NShwEngine::Panic( NShwEngine::ENullVisualList ) ); + // get the control group + CAlfControlGroup* controlGroup = aVisualList->ControlGroup(); + // and show it using the displays roster + aDisplay->Roster().ShowL( *controlGroup ,KAlfRosterShowAtBottom); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwhuiutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwhuiutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2007-2008 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: Utility that contains HUI related slideshow code + * +*/ + + + + +#ifndef __SHWHUIUTILITY_H__ +#define __SHWHUIUTILITY_H__ + +// INCLUDES +#include +#include +#include + +// Forward declarations +class MGlxVisualList; +class CHuiDisplay; + +// CLASS DECLARATION + +/** + * ShwHuiUtility. + * Isolates HUI runtime dependency so that tests can stub it + * @lib shwslideshowengine.lib + */ +NONSHARABLE_CLASS( ShwUiUtility ) + { + private: // Constructors and destructor + + /** + * C++ constructor. Not to be used. + */ + ShwUiUtility(); + + /** + * Destructor. Not to be used. + */ + ~ShwUiUtility(); + + public: // the API + + /** + * This method shows the given visual list on the HUI display + * @param aDisplay the HUI display to use + * @param aVisualList the visual list to display + */ + static void ShowVisualListL( CAlfDisplay* aDisplay, MGlxVisualList* aVisualList ); + + }; + +#endif // __SHWHUIUTILITY_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwplaybackfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwplaybackfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,364 @@ +/* +* Copyright (c) 2007-2008 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: The playback factory, configures the playback for the slideshow + * +*/ + + + +// CLASS HEADER +#include "shwplaybackfactory.h" + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include + +#include "shwtimercontrol.h" +#include "shwviewcontrol.h" +#include "shweffectcontrol.h" +#include "shwdefaulteffectmanager.h" +#include "shwcrossfadeeffect.h" +#include "shwzoomandpaneffect.h" +#include "shwmusiccontrol.h" +#include "shwmusicobserver.h" +#include "shwsettingsmodel.h" +#include "shweffectinfo.h" +#include "shwcleanupwrapper.h" + +using namespace NShwSlideshow; + +// ----------------------------------------------------------------------------- +// Local definitions +// ----------------------------------------------------------------------------- +// +namespace + { + // granularity for observer array, typical count + const TInt KObserverCount = 8; + // granularity for publisher array, typical count + const TInt KPublisherCount = 8; + } + +// ----------------------------------------------------------------------------- +// The implementation class +// ----------------------------------------------------------------------------- +// +NONSHARABLE_CLASS( CShwPlaybackFactory::CShwPlaybackFactoryImpl ) + : public CBase + { + public: + + /** + * Constructors. + */ + CShwPlaybackFactoryImpl(MShwMusicObserver& aMusicObserver); + + /** + * Destructors. + */ + ~CShwPlaybackFactoryImpl(); + + /** + * 2nd stage constructor. + * @param aHuiEnv the HUI environment + * @param aVisualList the visual list of the show + * @param aMediaList the media list of the show + * @param aMusicObserver the music control observer + * @param aScreenSize the screen size to use + */ + void ConstructL( + CAlfEnv* aAlfEnv, + MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, + TSize aScreenSize ); + + public: + + /// @ref CShwPlaybackFactory::EventObservers + RPointerArray< MShwEventObserver > EventObservers(); + /// @ref CShwPlaybackFactory::EventPublishers + RPointerArray< MShwEventPublisher > EventPublishers(); + /// @ref CShwSlideshowEngine::AvailableEffectsL + // @returns ownership of array of effects + static void CreateEffectsL( RPointerArray& aEffects ); + + private: + + /// Own: Effect manager + CShwDefaultEffectManager* iEffectManager; + /// Own: Timer control + CShwTimerControl* iTimerControl; + /// Own: Music control + CShwMusicControl* iMusicControl; + /// Own: Effect control + CShwEffectControl* iEffectControl; + /// Own: View control + CShwViewControl* iViewControl; + /// Own: the observers + RPointerArray< MShwEventObserver > iObservers; + /// Own: the publishers + RPointerArray< MShwEventPublisher > iPublishers; + + /// Ref: the visual list + MGlxVisualList* iVisualList; + /// Ref: the music control observer + MShwMusicObserver& iMusicObserver; + + }; + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwPlaybackFactory::CShwPlaybackFactory() + { + // No implementation needed + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwPlaybackFactory* CShwPlaybackFactory::NewL( + CAlfEnv* aAlfEnv, + MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, + MShwMusicObserver& aMusicObserver, + TSize aScreenSize ) + { + TRACER("CShwPlaybackFactory::NewL"); + GLX_LOG_INFO( "CShwPlaybackFactory::NewL" ); + + CShwPlaybackFactory* self = new( ELeave ) CShwPlaybackFactory( ); + CleanupStack::PushL( self ); + + // create the implementation, forward the parameters + self->iImpl = new( ELeave ) CShwPlaybackFactoryImpl (aMusicObserver); + self->iImpl->ConstructL( aAlfEnv, aVisualList, aMediaList, aScreenSize ); + + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwPlaybackFactory::~CShwPlaybackFactory() + { + TRACER("CShwPlaybackFactory::~CShwPlaybackFactory"); + GLX_LOG_INFO("CShwPlaybackFactory::~CShwPlaybackFactory"); + delete iImpl; + } + +// ----------------------------------------------------------------------------- +// EventObservers. +// ----------------------------------------------------------------------------- +RPointerArray< MShwEventObserver > CShwPlaybackFactory::EventObservers() + { + TRACER("CShwPlaybackFactory::EventObservers"); + GLX_LOG_INFO("CShwPlaybackFactory::EventObservers"); + return iImpl->EventObservers(); + } + +// ----------------------------------------------------------------------------- +// EventPublishers. +// ----------------------------------------------------------------------------- +RPointerArray< MShwEventPublisher > CShwPlaybackFactory::EventPublishers() + { + TRACER("CShwPlaybackFactory::EventPublishers"); + GLX_LOG_INFO("CShwPlaybackFactory::EventPublishers"); + return iImpl->EventPublishers(); + } + +//------------------------------------------------------------------------------ +// AvailableEffectsL +//------------------------------------------------------------------------------ +void CShwPlaybackFactory::AvailableEffectsL( RArray& + aEffectInfos ) + { + TRACER("CShwPlaybackFactory::AvailableEffectsL"); + GLX_LOG_INFO("CShwPlaybackFactory::AvailableEffectsL"); + aEffectInfos.Reset(); + RPointerArray effects; + // put the array in cleanupstack in case effect construction leaves + ShwCleanupResetAndDestroyPushL( effects ); + CShwPlaybackFactoryImpl::CreateEffectsL( effects ); + TInt i = effects.Count(); + while (i-- > 0) + { + // get the effect info and append it to the given array + aEffectInfos.AppendL( effects[i]->EffectInfo() ); + } + // ownership transferred, remove array from stack + CleanupStack::PopAndDestroy( &effects ); + } + +//------------------------------------------------------------------------------ +// CShwPlaybackFactoryImpl +//------------------------------------------------------------------------------ + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwPlaybackFactory::CShwPlaybackFactoryImpl::CShwPlaybackFactoryImpl( + MShwMusicObserver& aMusicObserver) + : iObservers( KObserverCount ), + iPublishers( KPublisherCount ), + iMusicObserver (aMusicObserver) + { + TRACER("CShwPlaybackFactory::CShwPlaybackFactoryImpl::CShwPlaybackFactoryImpl"); + GLX_LOG_INFO("CShwPlaybackFactory::CShwPlaybackFactoryImpl::CShwPlaybackFactoryImpl"); + } + +// ----------------------------------------------------------------------------- +// Destructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwPlaybackFactory::CShwPlaybackFactoryImpl::~CShwPlaybackFactoryImpl() + { + TRACER("CShwPlaybackFactory::CShwPlaybackFactoryImpl::~CShwPlaybackFactoryImpl"); + GLX_LOG_INFO("CShwPlaybackFactory::CShwPlaybackFactoryImpl::~CShwPlaybackFactoryImpl"); + + delete iEffectManager; + delete iTimerControl; + delete iMusicControl; + delete iEffectControl; + delete iViewControl; + + iObservers.Close(); + iPublishers.Close(); + } + +//------------------------------------------------------------------------------ +// CShwPlaybackFactoryImpl::ConstructL +//------------------------------------------------------------------------------ +void CShwPlaybackFactory::CShwPlaybackFactoryImpl::ConstructL( + CAlfEnv* aAlfEnv, + MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, + TSize aScreenSize ) + { + TRACER("CShwPlaybackFactory::CShwPlaybackFactoryImpl::ConstructL"); + GLX_LOG_INFO( "CShwPlaybackFactoryImpl::ConstructL" ); + + // create the effect manager + iEffectManager = CShwDefaultEffectManager::NewL(); + + // create array for effects + RPointerArray< MShwEffect > effects; + // put the array in cleanupstack in case CreateEffectsL leaves + ShwCleanupResetAndDestroyPushL( effects ); + // create the effects + CShwPlaybackFactoryImpl::CreateEffectsL( effects ); + // need to go from last to first as we remove items + TInt i = effects.Count(); + while (i-- > 0) + { + effects[ i ]->InitializeL( + aAlfEnv, aVisualList, aMediaList, + aScreenSize ); + + // give the effect to the manager, it takes ownership + iEffectManager->AddEffectL( effects[ i ] ); + // remove the effect from original array to prevent + // double delete, effect manager takes care of the effect from now on + effects.Remove( i ); + } + // ownership transferred, remove array from stack + CleanupStack::Pop( &effects ); + // need to also close the array in this case, this frees the array memory + effects.Close(); + + // create the model to retrieve the persisted slideshow settings. + CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); + CleanupStack::PushL( shwSettingsMdl ); + + // retrieve and set the persisted effect settings + TShwEffectInfo effect; + shwSettingsMdl->TransitionTypeL( + effect.iId.iPluginUid, effect.iId.iIndex ); + iEffectManager->SetDefaultEffectL( effect ); + + // create the timer + iTimerControl = CShwTimerControl::NewL(); + iObservers.AppendL( iTimerControl ); + iPublishers.AppendL( iTimerControl ); + + // create effect control + iEffectControl = + CShwEffectControl::NewL( + *iEffectManager, *aVisualList, *aMediaList, aScreenSize ); + iObservers.AppendL( iEffectControl ); + iPublishers.AppendL( iEffectControl ); + + // create view manager, view duration is stored in seconds so need to + // multiply with 1000 + TInt viewDuration = shwSettingsMdl->TransDelayL() * 1000; + iViewControl = + CShwViewControl::NewL( + *aMediaList, KDefaultTransitionDuration, viewDuration ); + iObservers.AppendL( iViewControl ); + iPublishers.AppendL( iViewControl ); + + // create music control last as it is the least important + if (shwSettingsMdl->MusicOnL() ) + { + // retrieve the name of the music file + TFileName fileName; + shwSettingsMdl->MusicNamePathL( fileName ); + // instantiate and initialise the music player + iMusicControl = CShwMusicControl::NewL(iMusicObserver, fileName ); + iObservers.AppendL( iMusicControl ); + iPublishers.AppendL( iMusicControl ); + } + + CleanupStack::PopAndDestroy( shwSettingsMdl ); + GLX_LOG_INFO( "CShwPlaybackFactoryImpl::ConstructL ended" ); + } + +//------------------------------------------------------------------------------ +// CShwPlaybackFactoryImpl::EventObservers +//------------------------------------------------------------------------------ +RPointerArray + CShwPlaybackFactory::CShwPlaybackFactoryImpl::EventObservers() + { + return iObservers; + } + +//------------------------------------------------------------------------------ +// CShwPlaybackFactoryImpl::EventPublishers +//------------------------------------------------------------------------------ +RPointerArray + CShwPlaybackFactory::CShwPlaybackFactoryImpl::EventPublishers() + { + TRACER("CShwPlaybackFactory::CShwPlaybackFactoryImpl::EventPublishers"); + GLX_LOG_INFO( "CShwPlaybackFactoryImpl::EventPublishers" ); + return iPublishers; + } + +//------------------------------------------------------------------------------ +// CShwPlaybackFactoryImpl::CreateEffectsL +//------------------------------------------------------------------------------ +void CShwPlaybackFactory::CShwPlaybackFactoryImpl::CreateEffectsL( + RPointerArray& aEffects ) + { + TRACER("CShwPlaybackFactory::CShwPlaybackFactoryImpl::CreateEffectsL"); + GLX_LOG_INFO( "CShwPlaybackFactoryImpl::CreateEffectsL" ); + aEffects.AppendL( CShwZoomAndPanEffect::NewLC() ); + CleanupStack::Pop(); + aEffects.AppendL( CShwCrossFadeEffect::NewLC() ); + CleanupStack::Pop(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwplaybackfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwplaybackfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007-2008 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: The playback factory, configures the playback for the slideshow + * +*/ + + + + +#ifndef __CSHWPLAYBACKFACTORY_H__ +#define __CSHWPLAYBACKFACTORY_H__ + +// INCLUDES +#include +#include + + +// Forward declarations +class CAlfEnv; +class MGlxVisualList; +class MGlxMediaList; +class MShwEventObserver; +class MShwEventPublisher; +class TShwEffectInfo; +class MShwMusicObserver; +// CLASS DECLARATION + +/** + * CShwPlaybackFactory + * + * @lib shwslideshowengine.lib + * @internal reviewed 08/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CShwPlaybackFactory ) : public CBase + { + public: // Constructors and destructor + + /** + * Constructor + * @param aHuiEnv the HUI environment + * @param aVisualList the visual list of the slide show + * @param aMediaList the media list for the show + * @param aMusicObserver the music control observer. + * @param aScreenSize the screen size to use + */ + static CShwPlaybackFactory* NewL( + CAlfEnv* aAlfEnv, + MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, + MShwMusicObserver& aMusicObserver, + TSize aScreenSize ); + + /** + * Destructor. + */ + ~CShwPlaybackFactory(); + + private: + + /** + * C++ constructor + */ + CShwPlaybackFactory(); + + public: // the API + + /** + * @return the event observers. + * Note! ownership of the real objects stays in the factory. + */ + RPointerArray< MShwEventObserver > EventObservers(); + + /** + * @return the event publishers. + * Note! ownership of the real objects stays in the factory. + */ + RPointerArray< MShwEventPublisher > EventPublishers(); + + /// @ref CShwSlideshowEngine::AvailableEffectsL + static void AvailableEffectsL( RArray& aEffects ); + + private: + + /// Own: The implementation of the class, hidden from the clients + class CShwPlaybackFactoryImpl; + CShwPlaybackFactoryImpl* iImpl; + + }; + +#endif // __CSHWPLAYBACKFACTORY_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwsettingsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwsettingsmodel.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,442 @@ +/* +* Copyright (c) 2007-2008 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: The settings model for the slideshow + * +*/ + + + + + +// CLASS HEADER +#include "shwsettingsmodel.h" + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include +#include +#include "shwconstants.hrh" +#include "shwconstants.h" + +// LOCAL CONSTANTS NAMESPACE +namespace + { + // CenRep Key Ids + const TUint32 KShwMusicOnOffKey = 0x00000001; + const TUint32 KShwMusicNamePathKey = 0x00000002; + const TUint32 KShwTransitionDelayKey= 0x00000003; + const TUint32 KShwTransitionTypeKey = 0x00000004; + const TUint32 KShwTransitionIndexKey= 0x00000005; + const TUint32 KShwPlayOrder = 0x00000006; + } + +/** + * CShwCenRepWatcher + * CShwSettingsModel containted class for observing changes in central + * repository values + * @internal reviewed 08/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CShwSettingsModel::CShwCenRepWatcher ) + : public CActive + { + public: // Constructors and destructor + + /** + * Symbian Constructor. + * @param aRepositoryUid uid of Central Repository file + * @param aId id of the Central Repository key + * @param aObserver obersver - only supplied when the owner is + * interested in changes in key value + * @return contructed object + */ + static CShwCenRepWatcher* NewL(const TUid& aRepositoryUid, + TUint32 aId ); + /** + * Destructor. + */ + ~CShwCenRepWatcher(); + + public: // API + + /** + * Get current value as integer. + * @return Current value of the key as a TInt + */ + TInt KeyValueL() const; + + /** + * Get current value as 16 bit descriptor. + * @param return value of the key in the descriptor + */ + void KeyValueL(TDes& aKeyValue) const; + + /** + * Set integer value + * @param aNewValue New value for the key + */ + void SetKeyValueL(const TInt aNewValue); + + /** + * Set string value + * @param aNewValue New 16 bit descriptor value for the key + */ + void SetKeyValueL(const TDesC& aNewValue); + + private: // Implementation + + /** + * C++ constructor. + * @param aRepositoryUid uid of CenRep file + * @param aId id of the key + * @param aObserver obersver + * @return contructed object + */ + CShwCenRepWatcher(const TUid& aRepositoryUid, TUint32 aId ); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + protected: // from CActive + + /** + * @ref CActive::RunL + */ + void RunL(); + + /** + * @ref CActive::DoCancel + */ + void DoCancel(); + + private: // Implementation + + // Own: the central repository API + CRepository* iRepository; + // the central repository identifier + TUid iRepositoryUid; + // the key id + TUint32 iId; + + }; + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CShwSettingsModel::CShwCenRepWatcher* CShwSettingsModel::CShwCenRepWatcher::NewL + (const TUid& aRepositoryUid, + TUint32 aId ) + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::NewL"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::NewL"); + + CShwCenRepWatcher* self = + new(ELeave) CShwCenRepWatcher( aRepositoryUid, aId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +inline CShwSettingsModel::CShwCenRepWatcher::CShwCenRepWatcher( + const TUid& aRepositoryUid, TUint32 aId ) + : CActive(EPriorityStandard), + iRepositoryUid(aRepositoryUid), + iId(aId) + { + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor +// ---------------------------------------------------------------------------- +void CShwSettingsModel::CShwCenRepWatcher::ConstructL() + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::ConstructL"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::ConstructL"); + iRepository = CRepository::NewL(iRepositoryUid); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +CShwSettingsModel::CShwCenRepWatcher::~CShwCenRepWatcher() + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::~CShwCenRepWatcher"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::~CShwCenRepWatcher"); + Cancel(); + delete iRepository; + } + +// ---------------------------------------------------------------------------- +// CShwCenRepWatcher::KeyValueL +// ---------------------------------------------------------------------------- +TInt CShwSettingsModel::CShwCenRepWatcher::KeyValueL() const + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::KeyValueL() const"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::KeyValueL() const"); + TInt retVal = KErrNone; + User::LeaveIfError( iRepository->Get(iId, retVal) ); + return retVal; + } + +// ---------------------------------------------------------------------------- +// CShwCenRepWatcher::KeyValueL +// ---------------------------------------------------------------------------- +void CShwSettingsModel::CShwCenRepWatcher::KeyValueL(TDes& aKeyValue) const + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::KeyValueL"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::KeyValueL"); + User::LeaveIfError( iRepository->Get(iId, aKeyValue) ); + } + +// ---------------------------------------------------------------------------- +// CShwCenRepWatcher::SetKeyValueL +// ---------------------------------------------------------------------------- +void CShwSettingsModel::CShwCenRepWatcher::SetKeyValueL(const TInt aNewValue) + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::SetKeyValueL(const TInt aNewValue)"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::SetKeyValueL(const TInt aNewValue)"); + User::LeaveIfError( iRepository->Set(iId, aNewValue) ); + } + +// ---------------------------------------------------------------------------- +// CShwCenRepWatcher::SetKeyValueL +// ---------------------------------------------------------------------------- + void CShwSettingsModel::CShwCenRepWatcher::SetKeyValueL(const TDesC& aNewValue) + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::SetKeyValueL"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::SetKeyValueL"); + User::LeaveIfError( iRepository->Set(iId, aNewValue) ); + } + +// ---------------------------------------------------------------------------- +// CShwCenRepWatcher::RunL +// ---------------------------------------------------------------------------- +void CShwSettingsModel::CShwCenRepWatcher::RunL() + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::SetKeyValueL"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::RunL"); + User::LeaveIfError(iRepository->NotifyRequest(iId, iStatus)); + SetActive(); + } + +// ---------------------------------------------------------------------------- +// CShwCenRepWatcher::DoCancel +// ---------------------------------------------------------------------------- +void CShwSettingsModel::CShwCenRepWatcher::DoCancel() + { + TRACER("CShwSettingsModel::CShwCenRepWatcher::DoCancel"); + GLX_LOG_INFO("CShwSettingsModel::CShwCenRepWatcher::DoCancel"); + iRepository->NotifyCancel( iId ); + } + +// ---------------------------------------------------------------------------- +// Symbian 2 phase constructor +// ---------------------------------------------------------------------------- +EXPORT_C CShwSettingsModel* CShwSettingsModel::NewL() + { + TRACER("CShwSettingsModel::NewL"); + GLX_LOG_INFO("CShwSettingsModel::NewL"); + + CShwSettingsModel* self = new(ELeave) CShwSettingsModel(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +EXPORT_C CShwSettingsModel::~CShwSettingsModel() + { + TRACER("CShwSettingsModel::~CShwSettingsModel"); + GLX_LOG_INFO("CShwSettingsModel::~CShwSettingsModel"); + delete iPlayOrder; + delete iMusicOnOffWatcher; + delete iMusicNamePathWatcher; + delete iTransDelayWatcher; + delete iTransTypeWatcher; + delete iTransIndexWatcher; + } + +// ---------------------------------------------------------------------------- +// C++ default constructor +// ---------------------------------------------------------------------------- +inline CShwSettingsModel::CShwSettingsModel() + { + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +void CShwSettingsModel::ConstructL() + { + TRACER("CShwSettingsModel::ConstructL"); + GLX_LOG_INFO("CShwSettingsModel::ConstructL"); + const TInt KEngineId = 0x200071D3; + const TUid KEngineUid = TUid::Uid( KEngineId ); + iPlayOrder = CShwCenRepWatcher::NewL(KEngineUid, + KShwPlayOrder ); + iMusicOnOffWatcher = CShwCenRepWatcher::NewL(KEngineUid, + KShwMusicOnOffKey ); + iMusicNamePathWatcher = CShwCenRepWatcher::NewL(KEngineUid, + KShwMusicNamePathKey ); + iTransDelayWatcher = CShwCenRepWatcher::NewL(KEngineUid, + KShwTransitionDelayKey ); + iTransTypeWatcher = CShwCenRepWatcher::NewL(KEngineUid, + KShwTransitionTypeKey ); + iTransIndexWatcher = CShwCenRepWatcher::NewL(KEngineUid, + KShwTransitionIndexKey ); + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::PlayOrderL +// returns persisted play order +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CShwSettingsModel::PlayOrderL() + { + TRACER("CShwSettingsModel::PlayOrderL"); + GLX_LOG_INFO("CShwSettingsModel::PlayOrderL"); + TInt playState = iPlayOrder->KeyValueL(); + ASSERT(playState == 0 || playState == 1); + return playState; + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::SavePlayOrderL +// Persist the play order state +// ---------------------------------------------------------------------------- +// +EXPORT_C void CShwSettingsModel::SavePlayOrderL(TInt aPlayOrder) + { + TRACER("CShwSettingsModel::SavePlayOrderL"); + GLX_LOG_INFO("CShwSettingsModel::SaveMusicStateL"); + + ASSERT(aPlayOrder == 0 || aPlayOrder == 1); + iPlayOrder->SetKeyValueL(aPlayOrder); + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::SaveMusicOnOff +// Persist the music on/off state +// ---------------------------------------------------------------------------- +EXPORT_C void CShwSettingsModel::SaveMusicStateL(TInt aMusicState) + { + TRACER("CShwSettingsModel::SaveMusicStateL"); + GLX_LOG_INFO("CShwSettingsModel::SaveMusicStateL"); + + ASSERT(aMusicState == 0 || aMusicState == 1); + iMusicOnOffWatcher->SetKeyValueL(aMusicState); + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::MusicOnL +// returns persisted the music on/off state +// ---------------------------------------------------------------------------- +EXPORT_C TInt CShwSettingsModel::MusicOnL() const + { + TRACER("CShwSettingsModel::MusicOnL"); + GLX_LOG_INFO("CShwSettingsModel::MusicOnL"); + TInt musicState = iMusicOnOffWatcher->KeyValueL(); + ASSERT(musicState == 0 || musicState == 1); + return musicState; + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::SaveMusicNamePathL +// Persist the name & path to the music file +// ---------------------------------------------------------------------------- +EXPORT_C void CShwSettingsModel::SaveMusicNamePathL(const TDesC& aMusicNamePath) + { + TRACER("CShwSettingsModel::SaveMusicNamePathL"); + GLX_LOG_INFO("CShwSettingsModel::SaveMusicNamePathL"); + // allow setting also empty value (there used to be an if here...) + iMusicNamePathWatcher->SetKeyValueL( aMusicNamePath ); + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::MusicNamePathL +// returns persisted value of the music file name and path +// ---------------------------------------------------------------------------- +EXPORT_C void CShwSettingsModel::MusicNamePathL(TDes& aMusicNamePath) const + { + TRACER("CShwSettingsModel::MusicNamePathL"); + GLX_LOG_INFO("CShwSettingsModel::MusicNamePathL"); + iMusicNamePathWatcher->KeyValueL(aMusicNamePath); + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::SaveTransDelayL +// Persist the value for transition delay between slide +// ---------------------------------------------------------------------------- +EXPORT_C void CShwSettingsModel::SaveTransDelayL( TInt aTransDelay ) + { + TRACER("CShwSettingsModel::SaveTransDelayL"); + GLX_LOG_INFO1("CShwSettingsModel::SaveTransDelayL %d", aTransDelay ); + // check we are inside bounds + aTransDelay = Max( aTransDelay, KMinTransDelay ); + aTransDelay = Min( aTransDelay, KMaxTransDelay ); + iTransDelayWatcher->SetKeyValueL(aTransDelay); + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::TransDelayL +// returns persisted transition delay value +// ---------------------------------------------------------------------------- +EXPORT_C TInt CShwSettingsModel::TransDelayL() const + { + TRACER("CShwSettingsModel::TransDelayL"); + TInt transDelay = iTransDelayWatcher->KeyValueL(); + GLX_LOG_INFO1( "CShwSettingsModel::TransDelayL %d", transDelay ); + return transDelay; + } + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::SaveTransitionType +// Persist the transition effect type ECOM UID and index +// ---------------------------------------------------------------------------- +EXPORT_C void CShwSettingsModel::SaveTransitionTypeL(const TUid aEffectUid, + const TUint aEffectIndex) + { + TRACER("CShwSettingsModel::SaveTransitionTypeL"); + GLX_LOG_INFO("CShwSettingsModel::SaveTransitionTypeL"); + iTransTypeWatcher->SetKeyValueL(aEffectUid.iUid); + iTransIndexWatcher->SetKeyValueL(aEffectIndex); + } + + +// ---------------------------------------------------------------------------- +// CShwSettingsModel::TransitionTypeL +// returns persisted transition effect type ECOM UID and +// index +// ---------------------------------------------------------------------------- +EXPORT_C void CShwSettingsModel::TransitionTypeL(TUid& aEffectUid, + TUint& aEffectIndex) const + { + TRACER("CShwSettingsModel::TransitionTypeL"); + GLX_LOG_INFO("CShwSettingsModel::TransitionTypeL"); + aEffectUid.iUid = iTransTypeWatcher->KeyValueL(); + aEffectIndex = iTransIndexWatcher->KeyValueL(); + } + +// End of File + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwslideshowengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwslideshowengine.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2007-2008 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: The slideshow engine API + * +*/ + + +#include +#include + +// CLASS HEADER +#include "shwslideshowengine.h" + +// INTERNAL INCLUDES +#include "shwslideshowengineimpl.h" + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwSlideshowEngine::CShwSlideshowEngine() + { + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +EXPORT_C CShwSlideshowEngine* CShwSlideshowEngine::NewL( + MShwEngineObserver& aObserver ) + { + TRACER("CShwSlideshowEngine::NewL"); + GLX_LOG_INFO("CShwSlideshowEngine::NewL"); + CShwSlideshowEngine* self = new (ELeave) CShwSlideshowEngine; + CleanupStack::PushL( self ); + // construct the real implementation + self->iImpl = CShwSlideshowEngineImpl::NewL( aObserver); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +EXPORT_C CShwSlideshowEngine::~CShwSlideshowEngine() + { + TRACER("CShwSlideshowEngine::~CShwSlideshowEngine"); + GLX_LOG_INFO("CShwSlideshowEngine::~CShwSlideshowEngine"); + delete iImpl; + } + + +// ----------------------------------------------------------------------------- +// StartL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::StartL( + CAlfEnv& aEnv, CAlfDisplay& aDisplay, MGlxMediaList& aItemsToShow, + MShwMusicObserver& aMusicObserver, TSize aScreenSize ) + { + TRACER("CShwSlideshowEngine::StartL"); + GLX_LOG_INFO("CShwSlideshowEngine::StartL"); + this->iImpl->StartL( + aEnv, aDisplay, aItemsToShow, aMusicObserver, aScreenSize ); + } + + +// ----------------------------------------------------------------------------- +// NextItemL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::NextItemL() + { + TRACER("CShwSlideshowEngine::NextItemL"); + GLX_LOG_INFO("CShwSlideshowEngine::NextItemL"); + this->iImpl->NextItemL(); + } + +// ----------------------------------------------------------------------------- +// PreviousItemL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::PreviousItemL() + { + TRACER("CShwSlideshowEngine::PreviousItemL"); + GLX_LOG_INFO("CShwSlideshowEngine::PreviousItemL"); + this->iImpl->PreviousItemL(); + } + +// ----------------------------------------------------------------------------- +// PauseL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::PauseL() + { + TRACER("CShwSlideshowEngine::PauseL"); + GLX_LOG_INFO("CShwSlideshowEngine::PauseL"); + this->iImpl->PauseL(); + } + +// ----------------------------------------------------------------------------- +// ResumeL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::ResumeL() + { + TRACER("CShwSlideshowEngine::ResumeL"); + GLX_LOG_INFO("CShwSlideshowEngine::ResumeL"); + this->iImpl->ResumeL(); + } + +// ----------------------------------------------------------------------------- +// State. +// ----------------------------------------------------------------------------- +EXPORT_C CShwSlideshowEngine::TShwState CShwSlideshowEngine::State() const + { + TRACER("CShwSlideshowEngine::TShwState CShwSlideshowEngine::State()"); + GLX_LOG_INFO("CShwSlideshowEngine::TShwState CShwSlideshowEngine::State()"); + return this->iImpl->State(); + } + +// ----------------------------------------------------------------------------- +// AvailableEffectsL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::AvailableEffectsL( + RArray& aEffects ) + { + TRACER("CShwSlideshowEngine::AvailableEffectsL"); + GLX_LOG_INFO("CShwSlideshowEngine::AvailableEffectsL"); + CShwSlideshowEngineImpl::AvailableEffectsL( aEffects ); + } + +// ----------------------------------------------------------------------------- +// ResumeL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::VolumeUpL() + { + TRACER("CShwSlideshowEngine::VolumeUpL"); + GLX_LOG_INFO("CShwSlideshowEngine::VolumeUpL"); + this->iImpl->VolumeUpL(); + } + +// ----------------------------------------------------------------------------- +// ResumeL. +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::VolumeDownL() + { + TRACER("CShwSlideshowEngine::VolumeDownL"); + GLX_LOG_INFO("CShwSlideshowEngine::VolumeDownL"); + this->iImpl->VolumeDownL(); + } +// ----------------------------------------------------------------------------- +// ToggleControlsVisibiltyL. LSKPressed +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::ToggleUiControlsVisibiltyL() + { + TRACER("CShwSlideshowEngine::ToggleUiControlsVisibiltyL"); + GLX_LOG_INFO("CShwSlideshowEngine::ToggleUiControlsVisibiltyL"); + this->iImpl->ToggleUiControlsVisibiltyL(); + } +// ----------------------------------------------------------------------------- +// LSKPressedL +// ----------------------------------------------------------------------------- +EXPORT_C void CShwSlideshowEngine::LSKPressedL() + { + TRACER("CShwSlideshowEngine::LSKPressedL"); + GLX_LOG_INFO("CShwSlideshowEngine::LSKPressedL"); + this->iImpl->LSKPressedL(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwslideshowengineimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwslideshowengineimpl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,361 @@ +/* +* Copyright (c) 2007-2008 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: The implementation of the engine API + * +*/ + + + + +// CLASS HEADER +#include "shwslideshowengineimpl.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "shwengineobserver.h" +#include "shwplaybackfactory.h" +#include "shweventrouter.h" +#include "shwevent.h" +#include "shwslideshowenginepanic.h" +#include "shwhuiutility.h" + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwSlideshowEngineImpl::CShwSlideshowEngineImpl( + MShwEngineObserver& aObserver ) + : iObserver( aObserver ) + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwSlideshowEngineImpl* CShwSlideshowEngineImpl::NewL( + MShwEngineObserver& aObserver ) + { + TRACER("CShwSlideshowEngineImpl::NewL"); + GLX_LOG_INFO("CShwSlideshowEngineImpl::NewL"); + CShwSlideshowEngineImpl* self = + new( ELeave ) CShwSlideshowEngineImpl( aObserver ); + CleanupStack::PushL( self ); + // perform 2nd phase + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwSlideshowEngineImpl::~CShwSlideshowEngineImpl() + { + TRACER("CShwSlideshowEngineImpl::~CShwSlideshowEngineImpl"); + GLX_LOG_INFO("CShwSlideshowEngineImpl::~CShwSlideshowEngineImpl"); + // delete event router, it should not own any external objects + delete iEventRouter; + // delete the playback factory, it deletes the objects it owns + // and they may require media or visual list + delete iFactory; + // clean the visual list (it has reference to media list) + // Check that we got a manager + if( iVisualListManager ) + { + // Check if we got a list + if( iVisualList ) + { + // remove the list + iVisualListManager->ReleaseList( iVisualList ); + } + iVisualListManager->Close(); + } + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::ConstructL() + { + TRACER("CShwSlideshowEngineImpl::ConstructL"); + GLX_LOG_INFO("CShwSlideshowEngineImpl::ConstructL"); + // get the visual list manager + iVisualListManager = CGlxVisualListManager::ManagerL(); + } + +// ----------------------------------------------------------------------------- +// StartL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::StartL( + CAlfEnv& aEnv, CAlfDisplay& aDisplay, MGlxMediaList& aItemsToShow, + MShwMusicObserver& aMusicObserver, TSize aScreenSize ) + { + TRACER("CShwSlideshowEngineImpl::StartL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::Start(Init)L" ); + + // check that we've not already been started + __ASSERT_ALWAYS( !iState, + NShwEngine::Panic( NShwEngine::EEngineStartLCalledInWrongState ) ); + + // remember the display + iDisplay = &aDisplay; + + // the media list is already ordered correctly for use + iMediaList = &aItemsToShow; + + // construct the visual list + iVisualList = iVisualListManager->AllocListL( + *iMediaList, aEnv, aDisplay, CAlfImageVisual::EScaleFitInside ); + + // set the default icons to the list + iVisualList->SetDefaultIconBehaviourL( ETrue ); + + // construct the factory + iFactory = CShwPlaybackFactory::NewL( + &aEnv, + iVisualList, + iMediaList, + aMusicObserver, + aScreenSize ); + + // construct the event router + iEventRouter = CShwEventRouter::NewL(); + // get the observers from factory + // add them to router + iEventRouter->AddObserversL( iFactory->EventObservers().Array() ); + // add ourself as observer + iEventRouter->AddObserverL( this ); + + // get the producers from factory + // set the event producers to the router + iEventRouter->AddProducers( iFactory->EventPublishers().Array() ); + // add ourself as publisher + iEventRouter->AddProducer( this ); + + // now all producers are there but they may need to do some + // initialisation, send initialize event to allow that + TShwEventInitialize initEvent; + SendEventL( &initEvent ); + + // set state now. We will get the event call (Notify) + // once the first thumbnail is loaded and then we really start + iState = CShwSlideshowEngine::EShwStateInitialized; + + GLX_LOG_INFO( "CShwSlideshowEngineImpl::Start(Init)L - End" ); + } + +// ----------------------------------------------------------------------------- +// NextItemL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::NextItemL() + { + TRACER("CShwSlideshowEngineImpl::NextItemL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::NextItemL" ); + + if( CShwSlideshowEngine::EShwStateRunning == iState || + CShwSlideshowEngine::EShwStatePaused == iState ) + { + // only change images if paused or playing + TShwEventNextImage nextItemEvent; + SendEventL( &nextItemEvent ); + } + } + +// ----------------------------------------------------------------------------- +// PreviousItemL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::PreviousItemL() + { + TRACER("CShwSlideshowEngineImpl::PreviousItemL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::PreviousItemL" ); + + if( CShwSlideshowEngine::EShwStateRunning == iState || + CShwSlideshowEngine::EShwStatePaused == iState ) + { + // only change images if paused or playing + TShwEventPreviousImage previousItemEvent; + SendEventL( &previousItemEvent ); + } + } + +// ----------------------------------------------------------------------------- +// PauseL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::PauseL() + { + TRACER("CShwSlideshowEngineImpl::PauseL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::PauseL" ); + // check state, if not running, don't bother pausing + if( CShwSlideshowEngine::EShwStateRunning == iState ) + { + // send the pause event to the router + TShwEventPause pauseEvent; + SendEventL( &pauseEvent ); + + // update the state + iState = CShwSlideshowEngine::EShwStatePaused; + + // tell the observer that we paused the show + iObserver.EnginePausedL(); + } + } +// ----------------------------------------------------------------------------- +// LSKPressedL +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::LSKPressedL() + { + TRACER("CShwSlideshowEngineImpl::LSKPressedL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::LSKPressedL" ); + iObserver.EngineLSKPressedL(); + + } +// ----------------------------------------------------------------------------- +// ToggleControlsVisibiltyL., LSKPressedL +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::ToggleUiControlsVisibiltyL() + { + TRACER("CShwSlideshowEngineImpl::ToggleUiControlsVisibiltyL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::ToggleUiControlsVisibiltyL" ); + + // send the toggleUi event to the router + TShwEventToggleControlUi toggleUi; + SendEventL( &toggleUi ); + // tell the observer that we toggled softkey visibility by + // pressing selection key + iObserver.EngineToggleUiStateL(); + + } + +// ----------------------------------------------------------------------------- +// VolumeUpL +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::VolumeUpL() + { + TRACER("CShwSlideshowEngineImpl::VolumeUpL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::VolumeUpL" ); + + // check state and send the resume event to the router + if( CShwSlideshowEngine::EShwStateInitialized != iState ) + { + TShwEventVolumeUp volumeUp; + SendEventL( &volumeUp ); + } + } + +// ----------------------------------------------------------------------------- +// VolumeDownL +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::VolumeDownL() + { + TRACER("CShwSlideshowEngineImpl::VolumeDownL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::VolumeDownL" ); + + // check state and send the resume event to the router + if( CShwSlideshowEngine::EShwStateInitialized != iState ) + { + TShwEventVolumeDown volumeDown; + SendEventL( &volumeDown ); + } + } + + +// ----------------------------------------------------------------------------- +// ResumeL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::ResumeL() + { + TRACER("CShwSlideshowEngineImpl::ResumeL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::ResumeL" ); + + // check state and send the resume event to the router + if ( iState == CShwSlideshowEngine::EShwStatePaused ) + { + // only valid to resume if we're currently paused + TShwEventResume resumeEvent; + SendEventL( &resumeEvent ); + + // update the state + iState = CShwSlideshowEngine::EShwStateRunning; + + // tell the observer that the show restarted + iObserver.EngineResumedL(); + } + } + +// ----------------------------------------------------------------------------- +// NotifyL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::NotifyL( MShwEvent* aEvent ) + { + TRACER("CShwSlideshowEngineImpl::NotifyL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::NotifyL" ); + + // we got an event, was it ready to view and we are not yet running + if( ( CShwSlideshowEngine::EShwStateInitialized == iState ) && + ( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) ) + { + GLX_LOG_INFO( "CShwSlideshowEngineImpl::send TShwEventStart" ); + // start the playback + TShwEventStart start; + SendEventL( &start ); + + // set state + iState = CShwSlideshowEngine::EShwStateRunning; + + // tell the observer that we are running the show + iObserver.EngineStartedL(); + + // show the control group on the display. + ShwUiUtility::ShowVisualListL( iDisplay, iVisualList ); + } + else if( dynamic_cast< TShwEventFatalError* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwSlideshowEngineImpl fatal error, exit slideshow" ); + // let the observer close down slideshow + iObserver.ErrorDuringSlideshowL(); + } + else if( dynamic_cast< TShwEventToggleControlUi* >( aEvent ) ) + { + GLX_LOG_INFO( "CShwSlideshowEngineImpl:NotifyL - TShwEventToggleControlUi" ); + // Have to impliment if need comes + } + } + +// ----------------------------------------------------------------------------- +// State. +// ----------------------------------------------------------------------------- +CShwSlideshowEngine::TShwState CShwSlideshowEngineImpl::State() const + { + TRACER("CShwSlideshowEngineImpl::State()"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::State()" ); + return iState; + } + +// ----------------------------------------------------------------------------- +// AvailableEffectsL. +// ----------------------------------------------------------------------------- +void CShwSlideshowEngineImpl::AvailableEffectsL( + RArray& aEffects ) + { + TRACER("CShwSlideshowEngineImpl::AvailableEffectsL"); + GLX_LOG_INFO( "CShwSlideshowEngineImpl::AvailableEffectsL" ); + // This should be queried from the playback factory + CShwPlaybackFactory::AvailableEffectsL( aEffects ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwslideshowengineimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwslideshowengineimpl.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 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: The slideshow engine API + * +*/ + + + + +#ifndef __CSHWSLIDESHOWENGINEIMPL_H__ +#define __CSHWSLIDESHOWENGINEIMPL_H__ + +// INCLUDES +#include +#include + +#include "shwslideshowengine.h" +#include "shweventobserver.h" +#include "shweventpublisherbase.h" +#include +#include +// FORWARD DECLARATIONS +class MGlxMediaList; +class CGlxThumbnailContext; +class CGlxVisualListManager; +class MGlxVisualList; +class CShwPlaybackFactory; +class CShwEventRouter; + +class CAlfEnv; +// CLASS DECLARATION + +/** + * CCShwSlideshowEngineImpl + * + * @author Kimmo Hoikka + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + */ +NONSHARABLE_CLASS( CShwSlideshowEngineImpl ) + : public CShwEventPublisherBase, + public MShwEventObserver + { + public: // Constructors and destructor + + /** + * Constructor + * @param aObserver, observer of the engine. + */ + static CShwSlideshowEngineImpl* NewL( MShwEngineObserver& aObserver ); + + /** + * Destructor. + */ + ~CShwSlideshowEngineImpl(); + + private: + + /** + * Constructor for performing 1st stage construction + * @param aObserver, observer of the engine. + */ + CShwSlideshowEngineImpl( MShwEngineObserver& aObserver ); + + /** + * 2nd stage construction + */ + void ConstructL(); + + public: // the API + + /// @ref CShwSlideshowEngine::StartL + void StartL( + CAlfEnv& aEnv, + CAlfDisplay& aDisplay, + MGlxMediaList& aItemsToShow, + MShwMusicObserver& aMusicObserver, + TSize aScreenSize ); + /// @ref CShwSlideshowEngine::NextItemL + void NextItemL(); + /// @ref CShwSlideshowEngine::PreviousItemL + void PreviousItemL(); + /// @ref CShwSlideshowEngine::PauseL + void PauseL(); + /// @ref CShwSlideshowEngine::ResumeL + void ResumeL(); + /// @ref CShwSlideshowEngine::ToggleUiControlsVisibiltyL + void ToggleUiControlsVisibiltyL(); + /// @ref CShwSlideshowEngine::LSKPressedL + void LSKPressedL(); + /// @ref CShwSlideshowEngine::State + CShwSlideshowEngine::TShwState State() const; + /// @ref CShwSlideshowEngine::AvailableEffectsL + static void AvailableEffectsL( RArray& aEffects ); + /// @ref CShwSlideshowEngine::VolumeUpL + void VolumeUpL(); + /// @ref CShwSlideshowEngine::VolumeDownL + void VolumeDownL(); + + public: // From MShwEventObserver + + /// @ref MShwEventObserver::NotifyL + void NotifyL( MShwEvent* aEvent ); + + private: // Implementation + + /// Ref: the observer + MShwEngineObserver& iObserver; + /// Own: the media list to play + MGlxMediaList* iMediaList; + /// Own: the visual list manager + CGlxVisualListManager* iVisualListManager; + /// Own: the visual list to play + MGlxVisualList* iVisualList; + /// Own: the factory that creates the event controllers + CShwPlaybackFactory* iFactory; + /// Own: the event controllers + CShwEventRouter* iEventRouter; + /// Own: state flag + CShwSlideshowEngine::TShwState iState; + /// Ref: The HUI display + CAlfDisplay* iDisplay; + }; + +#endif // __CSHWSLIDESHOWENGINEIMPL_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwthumbnailcontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwthumbnailcontext.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow specific thumbnail context + * +*/ + + + + +// INCLUDES +#include "shwthumbnailcontext.h" + +#include +#include +#include +#include + +#include +#include + +// DEPENDENCIES + +// ----------------------------------------------------------------------------- +// Constructor. +// ----------------------------------------------------------------------------- +inline CShwThumbnailContext::CShwThumbnailContext( + TInt aIndex, TSize aSize ) : iSize(aSize), iCurrentIndex( aIndex ) + { + } + +// ----------------------------------------------------------------------------- +// NewLC. +// ----------------------------------------------------------------------------- +CShwThumbnailContext* CShwThumbnailContext::NewLC( TInt aIndex, TSize aSize ) + { + TRACER("CShwThumbnailContext::NewLC"); + GLX_LOG_INFO1( "CShwThumbnailContext::NewL, aIndex=%d", aIndex ); + CShwThumbnailContext* self = + new (ELeave) CShwThumbnailContext( aIndex, aSize ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwThumbnailContext::ConstructL() + { + TRACER("CShwThumbnailContext::ConstructL"); + GLX_LOG_INFO("CShwThumbnailContext::ConstructL"); + // Create the high quality / slower context + iHighQualityContext = CGlxThumbnailContext::NewL( this ); + // Call both setdefault and add? + iHighQualityContext->SetDefaultSpec( iSize.iWidth, iSize.iHeight ); + iHighQualityContext->AddSpecForItemL( iSize.iWidth, iSize.iHeight, + iCurrentIndex ); + // we want to only load high quality with this context + iHighQualityContext->SetHighQualityOnly( ETrue ); + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwThumbnailContext::~CShwThumbnailContext() + { + TRACER("CShwThumbnailContext::~CShwThumbnailContext"); + GLX_LOG_INFO( "CShwThumbnailContext::~CShwThumbnailContext" ); + delete iHighQualityContext; + } + +// ----------------------------------------------------------------------------- +// SetToFirst. +// ----------------------------------------------------------------------------- +void CShwThumbnailContext::SetToFirst( const MGlxMediaList* /*aList*/ ) + { + TRACER("CShwThumbnailContext::SetToFirst"); + GLX_LOG_INFO( "CShwThumbnailContext::SetToFirst" ); + // reset iterator state + iIterated = EFalse; + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::operator++. +// ----------------------------------------------------------------------------- +TInt CShwThumbnailContext::operator++( TInt ) + { + TRACER("CShwThumbnailContext::operator++"); + GLX_LOG_INFO( "CShwThumbnailContext::operator++" ); + // we want to load all the thumbnails our clients have requested + // notification on, nothing else + // by default tell the thumbnail that we dont have any interesting indexes + TInt wantedIndex = KErrNotFound; + // check if we were asked already + if( !iIterated ) + { + // we want to load thumbnail for the specified index + wantedIndex = iCurrentIndex; + iIterated = ETrue; + } + // finally return the index that was wanted + return wantedIndex; + } + +// ----------------------------------------------------------------------------- +// InRange. +// ----------------------------------------------------------------------------- +TBool CShwThumbnailContext::InRange( TInt aIndex ) const + { + TRACER("CShwThumbnailContext::InRange"); + GLX_LOG_INFO( "CShwThumbnailContext::InRange" ); + // if we got notifications + if ( aIndex == iCurrentIndex ) + { + // is in range so dont remove the item :) + // cache removes thumbnails that are no longer in range + return ETrue; + } + // not in our range + return EFalse; + } + +// ----------------------------------------------------------------------------- +// RequestCountL. +// ----------------------------------------------------------------------------- +TInt CShwThumbnailContext::RequestCountL(const MGlxMediaList* aList) const + { + TRACER("CShwThumbnailContext::RequestCountL"); + GLX_LOG_INFO( "CShwThumbnailContext::RequestCountL" ); + return iHighQualityContext->RequestCountL( aList ); + } + +// ----------------------------------------------------------------------------- +// Index. +// ----------------------------------------------------------------------------- +TInt CShwThumbnailContext::Index() + { + TRACER("CShwThumbnailContext::Index"); + GLX_LOG_INFO1( "CShwThumbnailContext::Index %d", iCurrentIndex ); + return iCurrentIndex; + } + +// ----------------------------------------------------------------------------- +// Context. +// ----------------------------------------------------------------------------- +MGlxFetchContext* CShwThumbnailContext::Context() + { + TRACER("CShwThumbnailContext::Context"); + GLX_LOG_INFO( "CShwThumbnailContext::Context" ); + return iHighQualityContext; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwthumbnailcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwthumbnailcontext.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow thumbnail context + * +*/ + + + + +#ifndef __SHWTHUMBNAILCONTEXT_H__ +#define __SHWTHUMBNAILCONTEXT_H__ + +// INCLUDES +#include +#include + +#include +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** + * CShwThumbnailContext + * + */ +NONSHARABLE_CLASS( CShwThumbnailContext ) : public CBase, + public MGlxMediaListIterator + { + public: + + /** + * Constructor. + * @param aIndex, the medialist index for the thumbnail to load + * @param aSize, the size for the thumbnail + */ + static CShwThumbnailContext* NewLC( TInt aIndex, TSize aSize ); + + /** + * Destructor. + */ + ~CShwThumbnailContext(); + + public: // the API + + /** + * Retrieve the index + * @return the index of the media list item associated with this context + */ + TInt Index(); + + /// @ref MGlxFetchContext::RequestCountL + TInt RequestCountL(const MGlxMediaList* aList) const; + + /** + * Retrieve the context. + * @return the context stored in this class + */ + MGlxFetchContext* Context(); + + public: // from MGlxMediaListIterator + + /// @ref MGlxMediaListIterator::SetToFirst + void SetToFirst( const MGlxMediaList* aList ); + /// @ref MGlxMediaListIterator::operator++ + TInt operator++( TInt ); + /// @ref MGlxMediaListIterator::InRange + TBool InRange( TInt aIndex ) const; + + private: // Constructors + + /** + * C++ constructor. + */ + CShwThumbnailContext( TInt aIndex, TSize aSize ); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + private: + + /// Own: the high quality thumbnail context + CGlxThumbnailContext* iHighQualityContext; + /// Own: flag set to ETrue when all attributes have been iterated + TBool iIterated; + /// Own: the size of the thumbnail for this context + TSize iSize; + /// Own: the currrent focus item + TInt iCurrentIndex; + + }; + +#endif // __SHWTHUMBNAILCONTEXT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwthumbnailloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwthumbnailloader.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,813 @@ +/* +* Copyright (c) 2007-2008 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: Utility that contains HUI related slideshow code + * +*/ + + + + +// INCLUDES +#include "shwthumbnailloader.h" + +// DEPENDENCIES +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "shwslideshowenginepanic.h" +#include "shwthumbnailcontext.h" +#include "shwcallback.h" + +#include "shwconstants.h" // for context priorities + +using namespace NShwSlideshow; + +/** + * CShwThumbnailLoaderImpl + * Implementation dependencies for the thumbnail loading + */ +NONSHARABLE_CLASS( CShwThumbnailLoader::CShwThumbnailLoaderImpl ) + : public CBase, + public MGlxMediaListObserver + { + public: + + /** + * Constructor + * inlined as only ever called inside this cpp + * @param aMedialist the media list + */ + inline CShwThumbnailLoaderImpl( + MGlxMediaList& aMedialist, + MShwThumbnailLoadObserver& aErrorHandler ); + + /** + * Destructor. + * inlined as only ever called inside this cpp + */ + inline ~CShwThumbnailLoaderImpl(); + + /** + * 2nd phase constructor + * inlined as only ever called inside this cpp + */ + inline void ConstructL(); + + /** + * @ref CShwThumbnailLoader::LoadAndNotifyL + * inlined as only ever called inside this cpp + */ + inline void LoadAndNotifyL( TInt aIndex, TSize aSize ); + + /** + * @ref CShwThumbnailLoader::Unload + * inlined as only ever called inside this cpp + */ + inline void Unload( TInt aIndex ); + + /** + * @ref CShwThumbnailLoader::ImageSizeL + * inlined as only ever called inside this cpp + */ + inline TSize ImageSizeL( TInt aIndex ); + + public: // from MGlxMediaListObserver + + /// @ref MGlxMediaListObserver::HandleItemAddedL + void HandleItemAddedL( + TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleMediaL + void HandleMediaL( + TInt aListIndex, MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleItemRemovedL + void HandleItemRemovedL( + TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleItemModifiedL + void HandleItemModifiedL( + const RArray& aItemIndexes, MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleAttributesAvailableL + void HandleAttributesAvailableL( + TInt aItemIndex, + const RArray& aAttributes, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleFocusChangedL + void HandleFocusChangedL( + NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, + TInt aOldIndex, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleItemSelectedL + void HandleItemSelectedL( + TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleMessageL + void HandleMessageL( + const CMPXMessage& aMessage, MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleError + void HandleError( TInt aError ); + + private: // Implementation + + // implementation of the error handler + inline void DoHandleErrorL(); + // Helper functions to find an element in the array given an index + // used in three places, load, unload and handleattributes available + // @param the index of the element to find + // @return the index of the element in the array, KErrNotFound otherwise + inline TInt Find( TInt aIndex ); + // @return the context if found, NULL otherwise + inline CShwThumbnailContext* FindContext( TInt aIndex ); + // Helper function to create the size context + inline void AddSizeContextL(); + /// Helper function to notify client of successfull or failed thumbnail load + inline void NofifyClientIfInterestedL( TInt aIndex, TBool aSuccess ); + // Helper function to remove high quality context from given index + inline void RemoveHighQualityContext( TInt aIndex ); + + public: // TCallBack API + + // Helper function to notify thumbnail completion asynchronously + inline TInt CompletedNotifyL(); + // Helper function to notify thumbnail failure asynchronously + inline TInt ErrorNotifyL(); + // Helper function to handle the error + inline TInt AsyncErrorHandleL(); + + private: // Implementation & Data + + /// Ref: the media list + MGlxMediaList& iMedialist; + /// Ref: the error handler + MShwThumbnailLoadObserver& iThumbnailObserver; + /// Own: the array for the thumbnail notifications + RArray< TInt > iNotificationIndexes; + /// Own: the array for already completed indexes + RArray< TInt > iCompletedIndexes; + /// Own: the array for already faulty indexes + RArray< TInt > iErrorIndexes; + /// Own: the array of high quality contexts + RPointerArray< CShwThumbnailContext > iHighQualityContexts; + /// Own: the size context + CGlxDefaultAttributeContext* iSizeContext; + /// Own: async callback needed in case image is already loaded + CAsyncCallBack* iCompletedCallBack; + /// Own: async callback needed in case image had already an error + CAsyncCallBack* iErrorCallBack; + /// Own: async callback for showing the out of memory system dialog + CAsyncCallBack* iErrorHandlerCallBack; + /// Own: the error code + TInt iError; + + }; + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwThumbnailLoader::CShwThumbnailLoader() + { + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwThumbnailLoader* CShwThumbnailLoader::NewL( + MGlxMediaList& aMedialist, MShwThumbnailLoadObserver& aErrorHandler ) + { + TRACER("CShwThumbnailLoader::NewLs"); + GLX_LOG_INFO( "CShwThumbnailLoader::NewL" ); + CShwThumbnailLoader* self = new( ELeave ) CShwThumbnailLoader; + CleanupStack::PushL( self ); + +// 2nd phase >> + // create implementation + self->iImpl = + new( ELeave ) CShwThumbnailLoaderImpl( aMedialist, aErrorHandler ); + // call 2nd phase + self->iImpl->ConstructL(); +// << 2nd phase + + // pop the stack + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CShwThumbnailLoader::~CShwThumbnailLoader() + { + TRACER("CShwThumbnailLoader::~CShwThumbnailLoader"); + GLX_LOG_INFO( "CShwThumbnailLoader::~CShwThumbnailLoader" ); + delete iImpl; + } + +// ----------------------------------------------------------------------------- +// LoadThumbnailAndNotifyL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::LoadAndNotifyL( TInt aIndex, TSize aSize ) + { + TRACER("CShwThumbnailLoader::LoadAndNotifyL"); + GLX_LOG_INFO( "CShwThumbnailLoader::LoadAndNotifyL" ); + // forward + iImpl->LoadAndNotifyL( aIndex, aSize ); + } + +// ----------------------------------------------------------------------------- +// Unload. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::Unload( TInt aIndex ) + { + TRACER("CShwThumbnailLoader::Unload"); + GLX_LOG_INFO( "CShwThumbnailLoader::Unload" ); + // forward + iImpl->Unload( aIndex ); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::ImageSizeL. +// ----------------------------------------------------------------------------- +TSize CShwThumbnailLoader::ImageSizeL( TInt aIndex ) + { + TRACER("CShwThumbnailLoader::ImageSizeL"); + GLX_LOG_INFO( "CShwThumbnailLoader::ImageSizeL" ); + // forward + return iImpl->ImageSizeL( aIndex ); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwThumbnailLoader::CShwThumbnailLoaderImpl::CShwThumbnailLoaderImpl( + MGlxMediaList& aMedialist, MShwThumbnailLoadObserver& aErrorHandler ) + : iMedialist( aMedialist ), + iThumbnailObserver( aErrorHandler ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::CShwThumbnailLoaderImpl()"); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::Destructor. +// ----------------------------------------------------------------------------- +inline CShwThumbnailLoader::CShwThumbnailLoaderImpl::~CShwThumbnailLoaderImpl() + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::~CShwThumbnailLoaderImpl()"); + GLX_LOG_INFO( "CShwThumbnailLoaderImpl::~CShwThumbnailLoaderImpl" ); + // delete asynch callbacks, delete also cancels them + delete iCompletedCallBack; + delete iErrorCallBack; + delete iErrorHandlerCallBack; + + // size context, remove NULL does nothing + iMedialist.RemoveContext( iSizeContext ); + delete iSizeContext; + + // Remove all contexts from the media list + TInt count = iHighQualityContexts.Count(); + while ( count-- > 0 ) + { + // get the fetch context so that we can remove it from the media list + MGlxFetchContext* context = iHighQualityContexts[ count ]->Context(); + // high quality context, remove NULL does nothing + iMedialist.RemoveContext( context ); + }; + // delete the contexts array, this deletes the CShwThumbnailContexts + iHighQualityContexts.ResetAndDestroy(); + + // remove us from media list observers + iMedialist.RemoveMediaListObserver( this ); + + // close notification indexes array + iNotificationIndexes.Close(); + // close also the already completed indexes array + iCompletedIndexes.Close(); + // close also the errornous indexes array + iErrorIndexes.Close(); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::ConstructL +// ----------------------------------------------------------------------------- +inline void CShwThumbnailLoader::CShwThumbnailLoaderImpl::ConstructL() + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::ConstructL"); + GLX_LOG_INFO( "CShwThumbnailLoader::CShwThumbnailLoaderImpl::ConstructL" ); + // retrieve the size of images with own context + AddSizeContextL(); + + // add us as media list observer + iMedialist.AddMediaListObserverL( this ); + + // create async callback object to give + // callbacks once scheduler runs, give this high priority so that it + // is faster than the timers we have + iCompletedCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityHigh ); + // set the callback + iCompletedCallBack->Set( + TShwCallBack< CShwThumbnailLoaderImpl, CompletedNotifyL >( this ) ); + + // create async callback to give error callbacks once scheduler runs + iErrorCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityHigh ); + // set the callback + iErrorCallBack->Set( + TShwCallBack< CShwThumbnailLoaderImpl, ErrorNotifyL >( this ) ); + + // create async callback to give callback once we run onto errors + iErrorHandlerCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityHigh ); + // set the callback + iErrorHandlerCallBack->Set( + TShwCallBack< CShwThumbnailLoaderImpl, AsyncErrorHandleL >( this ) ); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::ImageSizeL. +// ----------------------------------------------------------------------------- +inline TSize CShwThumbnailLoader::CShwThumbnailLoaderImpl::ImageSizeL( + TInt aIndex ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::ImageSizeL"); + GLX_LOG_INFO1( "CShwThumbnailLoader::ImageSizeL for index %d", aIndex ); + + // default to KErrNotFound + TSize size( KErrNotFound, KErrNotFound ); + + // get the media item + TGlxMedia item = iMedialist.Item( aIndex ); + // get its dimensions, if they are not available, size is not modified + // if size is not available, GetDimensions returns EFalse + if( !item.GetDimensions( size ) ) + { + // size was not available so try to fetch it with attribute retriever + (void)GlxAttributeRetriever::RetrieveL( + *iSizeContext, iMedialist, + EFalse /*aShowDialog*/ ); + // get the media item again since its just a copy and the old one + // might not have had the CGlxMedia* set + item = iMedialist.Item( aIndex ); + // cast to (void) tells the compiler we ignore + // the fetcher error as there is nothing to do if the fetch fails + // in that case the size will be (KErrNotFound,KErrNotFound) + // try getting the dimensions again + (void)item.GetDimensions( size ); + } + + GLX_LOG_INFO2( + "CShwThumbnailLoader::ImageSizeL (%d,%d)", size.iWidth, size.iHeight ); + + return size; + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::LoadAndNotifyL. +// ----------------------------------------------------------------------------- +inline void CShwThumbnailLoader::CShwThumbnailLoaderImpl::LoadAndNotifyL( + TInt aIndex, TSize aSize ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::LoadAndNotifyL"); + GLX_LOG_INFO1( "CShwThumbnailLoader::LoadAndNotifyL %d", aIndex ); + + // check whether a context already exists for this index + CShwThumbnailContext* context = FindContext( aIndex ); + if( !context ) + { + // create new context for the index with the given size + context = CShwThumbnailContext::NewLC( aIndex, aSize ); + iHighQualityContexts.AppendL( context ); + CleanupStack::Pop( context ); + // add the context to the medialist with priority + iMedialist.AddContextL( + context->Context(), KHighQualityContextPriority ); + } + + // add the index to notifications array so that we know to give + // either success or error notification once for the request + // Note that we can have multiple requests for same index + iNotificationIndexes.InsertInOrderAllowRepeatsL( aIndex ); + + // need to check if the thumbnail is already loaded + // when request count is zero (KErrNone) the thumbnail is fully loaded + TInt requestCount = context->RequestCountL( &iMedialist ); + if( requestCount == KErrNone ) + { + // thumbnail is already there + // we cant give the callback right away as the client is expecting + // this method to be always asynchronous + GLX_LOG_INFO1( + "CShwThumbnailLoader::Thumbnail already loaded %d", aIndex ); + // insert index to completed array + // Note that we can have multiple requests for same index + iCompletedIndexes.InsertInOrderAllowRepeatsL( aIndex ); + // cancel the old callback + iCompletedCallBack->Cancel(); + // make the callback + iCompletedCallBack->CallBack(); + } + else if ( requestCount < KErrNone ) + { + // thumbnail had already and error + GLX_LOG_INFO2( + "CShwThumbnailLoader::Thumbnail error %d at index, %d", + requestCount, aIndex ); + // we cant give the callback right away as the client is expecting + // this method to be always asynchronous + // Note that we can have multiple requests for same index + iErrorIndexes.InsertInOrderAllowRepeatsL( aIndex ); + // cancel the old callback + iErrorCallBack->Cancel(); + // make the callback + iErrorCallBack->CallBack(); + } + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::Unload +// ----------------------------------------------------------------------------- +inline void CShwThumbnailLoader::CShwThumbnailLoaderImpl::Unload( TInt aIndex ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::Unload"); + GLX_LOG_INFO1( "CShwThumbnailLoader::Unload %d", aIndex ); + + // client is no longer interested on this indes so remove it from the + // notifications + TInt index; + while( ( index = iNotificationIndexes.Find( aIndex ) ) != KErrNotFound ) + { + // remove the index from array + iNotificationIndexes.Remove( index ); + } + + // remove context for this index + RemoveHighQualityContext( aIndex ); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleItemAddedL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleItemAddedL( + TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleMediaL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleMediaL( + TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + } +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleItemRemovedL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleItemRemovedL( + TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleItemRemovedL"); + GLX_LOG_INFO( "CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleItemRemovedL" ); + // check if we still got some items to show + if( iMedialist.Count() < 1 ) + { + // the media list is empty so call our error handler + iThumbnailObserver.HandleMediaListEmpty(); + } + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleItemModifiedL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleAttributesAvailableL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes/**/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleAttributesAvailableL"); + GLX_LOG_INFO( "CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleAttributesAvailableL" ); + //done to verify context availability + TInt attributeCount = aAttributes.Count(); + for(TInt i = 0; i < attributeCount; i++ ) + { + TMPXAttribute attr = aAttributes[i]; + } + + GLX_LOG_INFO1( + "CShwThumbnailLoader::HandleAttributesAvailableL %d", aItemIndex ); + // check if the thumbnail was fully loaded, first find the related context + CShwThumbnailContext* context = FindContext( aItemIndex ); + if( context ) + { + // was there an error? + TInt requestCount = context->RequestCountL( &iMedialist ); + if ( requestCount == KErrNone ) + { + // no error, notify client + GLX_LOG_INFO1( + "CShwThumbnailLoader::Thumbnail loaded %d", aItemIndex ); + // notidy client of success if it is interested on this index + NofifyClientIfInterestedL( aItemIndex, ETrue ); + } + else if ( requestCount < 0 ) + { + GLX_LOG_INFO1( + "CShwThumbnailLoader::Thumbnail load failed %d", aItemIndex ); + // remove the context since there is an error in loading it + // need to remove first as error handler may add new contexts + RemoveHighQualityContext( aItemIndex ); + // notidy client of error if it is interested on this index + NofifyClientIfInterestedL( aItemIndex, EFalse ); + } + } + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleFocusChangedL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, + TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleItemSelectedL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleItemSelectedL( + TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleMessageL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleMessageL( + const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/ ) + { + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::HandleError. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleError( + TInt aError ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleError"); + GLX_LOG_INFO1( "CShwThumbnailLoader::CShwThumbnailLoaderImpl::HandleError %d", aError ); + // need to remember the error + iError = aError; + // make asynch callback since we cant leave, this is the perfect way to + // handle error as the real processing will be in RunL so it can leave and + // can show a system error note. It is safe to call CallBack even is previous + // one did not complete + iErrorHandlerCallBack->CallBack(); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::DoHandleErrorL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::DoHandleErrorL() + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::DoHandleErrorL"); + GLX_LOG_INFO1( "CShwThumbnailLoader::DoHandleError %d", iError ); + // variable to tell if the error was in some of our fetch contexts + TBool errorInHighQualityContexts = EFalse; + // check if it was any of our high quality fetch contexts + TInt count = iHighQualityContexts.Count(); + // ask all high quality contexts + while ( count-- > 0 ) + { + CShwThumbnailContext* context = iHighQualityContexts[ count ]; + // need to TRAP in case RequestCountL leaves, since if it does + // we need to tell our observer that there is a problem + // requestCount needs to be volatile so that it does get + // optimized to a register and get its initial value returned in leave + volatile TInt requestCount = KErrNone; + TRAPD( error, requestCount = context->RequestCountL( &iMedialist ) ); + // ask if this context had an error or RequestCountL did leave + if( ( requestCount < KErrNone )|| + ( error != KErrNone ) ) + { + // take the index as cant use context once it is removed + TInt index = context->Index(); + // remove the context since there is an error in loading it + // need to remove first as error handler may add new contexts + RemoveHighQualityContext( index ); + // notidy client of error if it is interested on this index + NofifyClientIfInterestedL( index, EFalse ); + // set the flag to tell that there was an error in context + errorInHighQualityContexts = ETrue; + } + } + // check if it was out of memory and in our contexts + if( KErrNoMemory == iError && errorInHighQualityContexts ) + { + // just leave with KErrNoMemory, system will then show the dialog + User::Leave( KErrNoMemory ); + } + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::Find. +// ----------------------------------------------------------------------------- +inline TInt CShwThumbnailLoader::CShwThumbnailLoaderImpl::Find( TInt aIndex ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::Find"); + GLX_LOG_INFO1( "CShwThumbnailLoader::Find %d", aIndex ); + // take the count + TInt index = iHighQualityContexts.Count(); + // browse through all indexes ( count-1 -> 0 ) + while ( index-- > 0 ) + { + // does the index belong to the array? + CShwThumbnailContext* context = iHighQualityContexts[ index ]; + if ( context->Index() == aIndex ) + { + break; + } + } + // if match was not found, index is -1 which is KErrNotFound + return index; + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::FindContext. +// ----------------------------------------------------------------------------- +inline CShwThumbnailContext* + CShwThumbnailLoader::CShwThumbnailLoaderImpl::FindContext( TInt aIndex ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::FindContext"); + GLX_LOG_INFO1( "CShwThumbnailLoader::FindContext %d", aIndex ); + // by default return NULL + CShwThumbnailContext* context = NULL; + // reuse the Find + TInt index = Find( aIndex ); + // if it was found + if( index != KErrNotFound ) + { + // set the context + context = iHighQualityContexts[ index ]; + } + // and return it + return context; + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::AddSizeContextL +// ----------------------------------------------------------------------------- +inline void CShwThumbnailLoader::CShwThumbnailLoaderImpl::AddSizeContextL() + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::AddSizeContextL"); + GLX_LOG_INFO( "CShwThumbnailLoader::FindContext "); + // Create the fetch context to retrieve the attribute + iSizeContext = CGlxDefaultAttributeContext::NewL(); + // Set the range offsets relative to the focus item + // e.g. 0, 1, [2], 3, 4. Focus @ 2 => frontOffset = 2, rearOffset = 2 + iSizeContext->SetRangeOffsets( KSizeContextOffset, KSizeContextOffset ); + + // Add the size attribute to the context + iSizeContext->AddAttributeL( KGlxMediaGeneralDimensions ); + + // Add Drm attribute to the context, + // By default Drm attrib would be ETrue if not fetched already and + // shall result in reduced thumbnail size request + iSizeContext->AddAttributeL(KMPXMediaDrmProtected); + + // add the context with its priority + iMedialist.AddContextL( iSizeContext, KSizeContextPriority ); + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::NofifyClientIfInterestedL. +// ----------------------------------------------------------------------------- +void CShwThumbnailLoader::CShwThumbnailLoaderImpl::NofifyClientIfInterestedL( + TInt aIndex, TBool aSuccess ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::NofifyClientIfInterestedL"); + GLX_LOG_INFO1( "CShwThumbnailLoaderImpl::NofifyClientIfInterestedL %d", aIndex ); + // go through all the notification indexes + TInt arrayIndex = iNotificationIndexes.Find( aIndex ); + if( KErrNotFound != arrayIndex ) + { + // need to remove the index first as handle may insert new ones + // remove the index from array so we dont call twice + iNotificationIndexes.Remove( arrayIndex ); + if( aSuccess ) + { + // let the client know that the thumbnail is there + iThumbnailObserver.HandleThumbnailLoadedL( aIndex ); + } + else + { + // let the client know that there was an error + iThumbnailObserver.HandleThumbnailLoadFailureL( aIndex ); + } + } + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::RemoveHighQualityContext +// ----------------------------------------------------------------------------- +inline void CShwThumbnailLoader::CShwThumbnailLoaderImpl:: + RemoveHighQualityContext( TInt aIndex ) + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::RemoveHighQualityContext"); + GLX_LOG_INFO1( "CShwThumbnailLoaderImpl::RemoveHighQualityContext %d", aIndex ); + // Is there a context for this index? + TInt arrayIndex = Find( aIndex ); + if( KErrNotFound != arrayIndex ) + { + // get the context + CShwThumbnailContext* context = iHighQualityContexts[ arrayIndex ]; + // remove the context from the media list + iMedialist.RemoveContext( context->Context() ); + // and remove the context from the array + iHighQualityContexts.Remove( arrayIndex ); + // finally delete the context + delete context; + } + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::CompletedNotifyL +// ----------------------------------------------------------------------------- +inline TInt CShwThumbnailLoader::CShwThumbnailLoaderImpl::CompletedNotifyL() + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::CompletedNotifyL"); + GLX_LOG_INFO( "CShwThumbnailLoader::CompletedNotifyL" ); + // then we need to also remove all notifications for the given index + TInt count = iCompletedIndexes.Count(); + while( count-- > 0 ) + { + // take the index + TInt index = iCompletedIndexes[ count ]; + // remove the index from array before calling observer as observer + // may add new indexes to the array + iCompletedIndexes.Remove( count ); + // notidy client of success if it is interested on this index + NofifyClientIfInterestedL( index, ETrue ); + } + // need to return value to please TCallBack API + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::ErrorNotifyL +// ----------------------------------------------------------------------------- +inline TInt CShwThumbnailLoader::CShwThumbnailLoaderImpl::ErrorNotifyL() + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::ErrorNotifyL"); + GLX_LOG_INFO( "CShwThumbnailLoader::ErrorNotifyL" ); + // then we need to also remove all notifications for the given index + TInt count = iErrorIndexes.Count(); + while( count-- > 0 ) + { + // take the index + TInt index = iErrorIndexes[ count ]; + // remove the index from array before calling observer as observer + // may add new indexes to the array + iErrorIndexes.Remove( count ); + // remove the context since there is an error in loading it + // need to remove first as error handler may add new contexts + RemoveHighQualityContext( index ); + // notidy client of error if it is interested on this index + NofifyClientIfInterestedL( index, EFalse ); + } + // need to return value to please TCallBack API + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CShwThumbnailLoaderImpl::AsyncErrorHandleL +// ----------------------------------------------------------------------------- +inline TInt CShwThumbnailLoader::CShwThumbnailLoaderImpl::AsyncErrorHandleL() + { + TRACER("CShwThumbnailLoader::CShwThumbnailLoaderImpl::AsyncErrorHandleL"); + GLX_LOG_INFO( "CShwThumbnailLoader::AsyncErrorHandleL" ); + // handle the error + DoHandleErrorL(); + // need to return value to please TCallBack API + return KErrNone; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwthumbnailloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwthumbnailloader.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2007-2008 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: Utility that handles thumbnail loading + * +*/ + + + + +#ifndef __CSHWTHUMBNAILLOADER_H__ +#define __CSHWTHUMBNAILLOADER_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MGlxMediaList; + +// CLASS DECLARATIONS + +/** + * MShwThumbnailLoadObserver + * Interface to handle errors in thumbnail loading + * for the slide show + */ +NONSHARABLE_CLASS( MShwThumbnailLoadObserver ) + { + public: + + /** + * This method gets called when given thumbnail is loaded + * @param aIndex the index for which thumbnail is loaded + */ + virtual void HandleThumbnailLoadedL( TInt aIndex ) = 0; + + /** + * This method gets called when thumbnail loading + * fails for a given index + * @param aIndex the index for which thumbnail load fails + */ + virtual void HandleThumbnailLoadFailureL( TInt aIndex ) = 0; + + /** + * This method gets called when the media list + * becomes empty + */ + virtual void HandleMediaListEmpty() = 0; + + }; + +/** + * CShwThumbnailLoader + * Class to handle proper thumbnail loading and image size retrieval + * for the slide show + * @lib shwslideshowengine.lib + */ +NONSHARABLE_CLASS( CShwThumbnailLoader ) + : public CBase + { + public: // Constructors and destructor + + /** + * Constructor. + * @param aMedialist used for thumbnail loading + */ + static CShwThumbnailLoader* NewL( + MGlxMediaList& aMedialist, + MShwThumbnailLoadObserver& aErrorHandler ); + + /** + * Destructor. + */ + ~CShwThumbnailLoader(); + + public: // the API + + /** + * This method is used to load a thumbnail and get a callback once it + * is loaded. Note! This method is always asynchronous. + * @param aIndex the index + * @param aSize the thumbnail size + */ + void LoadAndNotifyL( TInt aIndex, TSize aSize ); + + /** + * This method is used to unload a thumbnail + * @param aIndex the index + */ + void Unload( TInt aIndex ); + + /** + * This method retrieves the size of an image for a given index. + * It is the caller's responsibility to give a valid index! + * If the imagesize is not yet loaded the method returns + * TSize( KErrNotFound, KErrNotFound ); + * @param aIndex the index + * @return the size of the image + */ + TSize ImageSizeL( TInt aIndex ); + + private: // Data & Implementation + + /// C++ constructor, no derivation intended + CShwThumbnailLoader(); + + /// Own: The implementation details + class CShwThumbnailLoaderImpl; + CShwThumbnailLoaderImpl* iImpl; + + }; + +#endif // __CSHWTHUMBNAILLOADER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwtimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwtimer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow specific timer class + * +*/ + + + + +// INCLUDES +#include "shwtimer.h" + +#include +#include + +// LOCAL CONSTANTS +namespace + { + // how many milliseconds go to microsecond + const TInt KMultiplyMilli2Micro = 1000; + } + +// DEPENDENCIES + +// ----------------------------------------------------------------------------- +// Constructor. +// ----------------------------------------------------------------------------- +inline CShwTimer::CShwTimer() + : iPaused( EFalse ) // not paused by default + { + } + +// ----------------------------------------------------------------------------- +// NewL. +// ----------------------------------------------------------------------------- +CShwTimer* CShwTimer::NewL( TInt aPriority ) + { + TRACER("CShwTimer::NewL"); + GLX_LOG_INFO( "CShwTimer::NewL" ); + CShwTimer* self = new (ELeave) CShwTimer; + CleanupStack::PushL( self ); + self->ConstructL( aPriority ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +void CShwTimer::ConstructL( TInt aPriority ) + { + TRACER("CShwTimer::ConstructL"); + GLX_LOG_INFO( "CShwTimer::ConstructL" ); + iTimer = CPeriodic::NewL( aPriority ); + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwTimer::~CShwTimer() + { + TRACER("CShwTimer::~CShwTimer()"); + GLX_LOG_INFO( "CShwTimer::~CShwTimer" ); + Cancel(); + delete iTimer; + } + +// ----------------------------------------------------------------------------- +// Start. +// ----------------------------------------------------------------------------- +void CShwTimer::Start( TInt aDelay, TInt aInterval, TCallBack aCallback ) + { + TRACER("CShwTimer::Start"); + GLX_LOG_INFO( "CShwTimer::Start" ); + + // convert millisecond to microseconds + TTimeIntervalMicroSeconds32 delay = aDelay * KMultiplyMilli2Micro; + TTimeIntervalMicroSeconds32 interval = aInterval * KMultiplyMilli2Micro; + + // remember the callback + iCallback = aCallback; + // remember the interval + iInterval = interval; + // reset the time left in case start is called during pause + iTimeLeft = delay; + + // No harm in cancelling the timer before start + iTimer->Cancel(); + + // if not paused, start the timer + if( !iPaused ) + { + // Get the current time + iTimeTimerExpires.HomeTime(); + // Add the delay to determine the expiry time + iTimeTimerExpires += iTimeLeft; + // Start the timer + iTimer->Start( iTimeLeft, iInterval, iCallback ); + } + } + +// ----------------------------------------------------------------------------- +// Cancel. +// ----------------------------------------------------------------------------- +void CShwTimer::Cancel() + { + TRACER("CShwTimer::Cancel"); + GLX_LOG_INFO( "CShwTimer::Cancel" ); + if ( iTimer ) + { + iTimer->Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// Pause +// ----------------------------------------------------------------------------- +void CShwTimer::Pause() + { + TRACER("CShwTimer::Pause"); + GLX_LOG_INFO( "CShwTimer::Pause" ); + // pause only if not yet paused + if( !iPaused ) + { + iPaused = ETrue; + // take time left + iTimeLeft = TimeLeft(); + //if the iTimeTimerExpires has already elapsed then we get -ve time left.In this case make it zero + if(iTimeLeft.Int() <= 0) + { + iTimeLeft = 0; + } + GLX_LOG_INFO1( "CShwTimer::Pause timeleft %d", iTimeLeft.Int() ); + // and cancel the timer + iTimer->Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// Resume. +// ----------------------------------------------------------------------------- +void CShwTimer::Resume() + { + TRACER("CShwTimer::Resume"); + GLX_LOG_INFO( "CShwTimer::Resume" ); + // resume only if paused + if( iPaused ) + { + iPaused = EFalse; + // if we had time left + if( 0 <= iTimeLeft.Int() ) + { + GLX_LOG_INFO1( "CShwTimer::Resume timeleft %d", iTimeLeft.Int() ); + // start again, first for time left and after that with interval + // NOTE! cant use Start as it takes time as milliseconds in a TInt + // Get the current time + iTimeTimerExpires.HomeTime(); + // Add the delay to determine the expiry time + iTimeTimerExpires += iTimeLeft; + // Start the timer + iTimer->Start( iTimeLeft, iInterval, iCallback ); + } + } + } + +// ----------------------------------------------------------------------------- +// TimeLeft. +// ----------------------------------------------------------------------------- +TTimeIntervalMicroSeconds32 CShwTimer::TimeLeft() + { + TRACER("CShwTimer::TimeLeft"); + GLX_LOG_INFO( "CShwTimer::TimeLeft" ); + + TTime timeNow; + timeNow.HomeTime(); + + // Difference between time now and the time at which timer should expire + TTimeIntervalMicroSeconds remainingTime; + remainingTime = iTimeTimerExpires.MicroSecondsFrom( timeNow ); + + TTimeIntervalMicroSeconds32 timeLeft = I64INT( remainingTime.Int64() ); + + // In case that 64 bit value is larger than 32 bits, just have the + // maximum 32 bit value + if ( remainingTime > KMaxTInt32 ) + { + timeLeft = TTimeIntervalMicroSeconds32( KMaxTInt32 ); + } + + return timeLeft; + } + +// ----------------------------------------------------------------------------- +// IsActive. +// ----------------------------------------------------------------------------- +TBool CShwTimer::IsActive() + { + TRACER("CShwTimer::IsActive"); + return iTimer->IsActive(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/coresrc/shwtimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/coresrc/shwtimer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow specific timer + * +*/ + + + + +#ifndef __SHWTIMER_H__ +#define __SHWTIMER_H__ + +// INCLUDES +#include +#include + +// Forward declarations + +// CLASS DECLARATION + +/** + * CShwTimer. a Pause-able timer + * + * @lib shwslideshowengine.lib + */ +NONSHARABLE_CLASS( CShwTimer ) : public CBase + { + public: + + /** + * Constructor. + * @param TInt aPriority - the priority of the timer. + */ + static CShwTimer* NewL( TInt aPriority ); + + /** + * Destructor. + */ + ~CShwTimer(); + + public: // the API + + /** + * This method starts the timer. It may be called repeatedly + * as the timer is always first cancelled. + * Note! Time is given in milliseconds + * + * @param aDelay - milliseconds for the first callback + * @param aInterval - milliseconds for the successive callbacks + * @param aCallback - the function to call + */ + void Start( TInt aDelay, TInt aInterval, TCallBack aCallback ); + + /** + * This method cancels the timer. + */ + void Cancel(); + + /** + * Pauses the timer if it is active + */ + void Pause(); + + /** + * Resumes the timer. If timer was paused the timer is restarted + * for the time left and after that for interval. + */ + void Resume(); + + /** + * Method that returns whether the timer is active. + * @return ETrue if the timer is active, EFalse otherwise + */ + TBool IsActive(); + + private: // Constructors + + /** + * C++ constructor. + */ + CShwTimer(); + + /** + * 2nd stage constructor + */ + void ConstructL( TInt aPriority ); + + /** + * This method returns the amount of time remaining until + * the timer is due to expire. + * @return - the time in microseconds left until the timer finishes + * or 0 (whichever is greater). + */ + TTimeIntervalMicroSeconds32 TimeLeft(); + + private: + + /// Own: the timer + CPeriodic* iTimer; + + /// Own: the callback + TCallBack iCallback; + /// Own: the time left in pause + TTimeIntervalMicroSeconds32 iTimeLeft; + /// Own: the interval for the timer + TTimeIntervalMicroSeconds32 iInterval; + /// Own: state flag that tells us if we are paused + TBool iPaused; + + /// Own: the time at which the timer is set to expire + TTime iTimeTimerExpires; + }; + +#endif // __SHWTIMER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/data/shwslideshowengine.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/data/shwslideshowengine.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007-2008 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: Resource definitions for project ?myapp +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME SHWE + +// INCLUDES +#include + +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="SHWE"; } + +RESOURCE TBUF r_shw_effect_cross_fade { buf = qtn_lgal_slideshow_settings_transition_xdissolve; } +RESOURCE TBUF r_shw_effect_zoom_and_pan { buf = qtn_lgal_slideshow_settings_transition_kenburns; } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/eabi/shwslideshowengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/eabi/shwslideshowengineu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +EXPORTS + _ZN17CShwSettingsModel10PlayOrderLEv @ 1 NONAME + _ZN17CShwSettingsModel14SavePlayOrderLEi @ 2 NONAME + _ZN17CShwSettingsModel15SaveMusicStateLEi @ 3 NONAME + _ZN17CShwSettingsModel15SaveTransDelayLEi @ 4 NONAME + _ZN17CShwSettingsModel18SaveMusicNamePathLERK7TDesC16 @ 5 NONAME + _ZN17CShwSettingsModel19SaveTransitionTypeLE4TUidj @ 6 NONAME + _ZN17CShwSettingsModel4NewLEv @ 7 NONAME + _ZN17CShwSettingsModelD0Ev @ 8 NONAME + _ZN17CShwSettingsModelD1Ev @ 9 NONAME + _ZN17CShwSettingsModelD2Ev @ 10 NONAME + _ZN19CShwSlideshowEngine11LSKPressedLEv @ 11 NONAME + _ZN19CShwSlideshowEngine11VolumeDownLEv @ 12 NONAME + _ZN19CShwSlideshowEngine13PreviousItemLEv @ 13 NONAME + _ZN19CShwSlideshowEngine17AvailableEffectsLER6RArrayI14TShwEffectInfoE @ 14 NONAME + _ZN19CShwSlideshowEngine26ToggleUiControlsVisibiltyLEv @ 15 NONAME + _ZN19CShwSlideshowEngine4NewLER18MShwEngineObserver @ 16 NONAME + _ZN19CShwSlideshowEngine6PauseLEv @ 17 NONAME + _ZN19CShwSlideshowEngine6StartLER7CAlfEnvR11CAlfDisplayR13MGlxMediaListR17MShwMusicObserver5TSize @ 18 NONAME + _ZN19CShwSlideshowEngine7ResumeLEv @ 19 NONAME + _ZN19CShwSlideshowEngine9NextItemLEv @ 20 NONAME + _ZN19CShwSlideshowEngine9VolumeUpLEv @ 21 NONAME + _ZN19CShwSlideshowEngineD0Ev @ 22 NONAME + _ZN19CShwSlideshowEngineD1Ev @ 23 NONAME + _ZN19CShwSlideshowEngineD2Ev @ 24 NONAME + _ZNK17CShwSettingsModel11TransDelayLEv @ 25 NONAME + _ZNK17CShwSettingsModel14MusicNamePathLER6TDes16 @ 26 NONAME + _ZNK17CShwSettingsModel15TransitionTypeLER4TUidRj @ 27 NONAME + _ZNK17CShwSettingsModel8MusicOnLEv @ 28 NONAME + _ZNK19CShwSlideshowEngine5StateEv @ 29 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwcrossfadeeffect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwcrossfadeeffect.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,296 @@ +/* +* Copyright (c) 2007-2008 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: Header file for crossfade effect + * +*/ + + + + +// Include Files +#include "shwcrossfadeeffect.h" + +#include +#include +#include + +#include "shwcrossfadelayout.h" +#include "shwresourceutility.h" +#include "shwconstants.h" + +using namespace NShwSlideshow; + +/** + * CShwCrossFadeEffectImpl + * Crossfade dependencies + * This class makes our clients indepandant of the effect implementation + * This gives greater flexibitily in testing as the test suites can just + * re-implement all the methods in the real class interface without the + * need to stub all our dependencies. + * If for example TShwCrossFadeLayout was a direct member of + * CShwCrossFadeEffect class, all the clients would need to have access + * to TShwCrossFadeLayout constructor and destructor and the test suite + * would need to either create a stub implementation for it or include + * the real class in the test (and all its dependencies). + * + * There is however no point of duplicating the whole CShwCrossFadeEffect + * interface as it would mean double maintenance + * so we use the iImpl pointer when referencing the class members + */ +NONSHARABLE_CLASS( CShwCrossFadeEffect::CShwCrossFadeEffectImpl ) + : public CBase + { + public: + + /** + * Constructor + */ + CShwCrossFadeEffectImpl(); + + /** + * Destructor + */ + ~CShwCrossFadeEffectImpl(); + + public: + + /// Own: the size of the screen + TSize iScreenSize; + + /// Own: the layout objects + TGlxSetValueLayout iSizeLayout; + TShwCrossFadeLayout iOpacityLayout; + + /// Own: the effect info. + TShwEffectInfo iEffectInfo; + + /// Own: the effect's name + HBufC* iEffectName; + + }; + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwCrossFadeEffect::CShwCrossFadeEffectImpl::CShwCrossFadeEffectImpl() +// : iSizeLayout( TGlxLayoutInfo::ESize ) + { + TRACER("CShwCrossFadeEffect::CShwCrossFadeEffectImpl::CShwCrossFadeEffectImpl()"); + GLX_LOG_INFO("CShwCrossFadeEffect::CShwCrossFadeEffectImpl::CShwCrossFadeEffectImpl()"); + // set layout chains, opacity -> size + iOpacityLayout.SetNext( &iSizeLayout ); + iSizeLayout.SetNext( NULL ); + + // define initial values + iOpacityLayout.Set( KMinOpacity ); // initial value 0% + } + +// ----------------------------------------------------------------------------- +// Destructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwCrossFadeEffect::CShwCrossFadeEffectImpl::~CShwCrossFadeEffectImpl() + { + TRACER("CShwCrossFadeEffect::CShwCrossFadeEffectImpl::~CShwCrossFadeEffectImpl()"); + GLX_LOG_INFO("CShwCrossFadeEffect::CShwCrossFadeEffectImpl::~CShwCrossFadeEffectImpl()"); + delete iEffectName; + } + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwCrossFadeEffect::CShwCrossFadeEffect() + { + } + +// ----------------------------------------------------------------------------- +// NewLC. Static construction +// ----------------------------------------------------------------------------- +CShwCrossFadeEffect* CShwCrossFadeEffect::NewLC() + { + TRACER("CShwCrossFadeEffect::NewLC"); + GLX_LOG_INFO("CShwCrossFadeEffect::NewLC"); + CShwCrossFadeEffect* self = new (ELeave) CShwCrossFadeEffect; + CleanupStack::PushL( self ); + + // create implementation + self->iImpl = new( ELeave ) CShwCrossFadeEffectImpl; + + // Note that only one name is defined for the cross fade so can only + // distinguish between normal and zoom effects via the uid + self->iImpl->iEffectName = + ShwResourceUtility::LocalisedNameL( R_SHW_EFFECT_CROSS_FADE ); + if( !self->iImpl->iEffectName ) + { + // Have to use a non-localised version + self->iImpl->iEffectInfo.iName = KEffectNameCrossFade; + } + else + { + // set the localised version + self->iImpl->iEffectInfo.iName = *self->iImpl->iEffectName; + } + + // info - uid + self->iImpl->iEffectInfo.iId.iPluginUid = KDefaultEffectPluginUid; + self->iImpl->iEffectInfo.iId.iIndex = KEffectUidXFadeNormal; + + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwCrossFadeEffect::~CShwCrossFadeEffect() + { + TRACER("CShwCrossFadeEffect::~CShwCrossFadeEffect"); + GLX_LOG_INFO("CShwCrossFadeEffect::~CShwCrossFadeEffect"); + delete iImpl; + } + +// ----------------------------------------------------------------------------- +// CloneLC +// ----------------------------------------------------------------------------- +MShwEffect* CShwCrossFadeEffect::CloneLC() + { + TRACER("CShwCrossFadeEffect::CloneLC"); + GLX_LOG_INFO( "CShwCrossFadeEffect::CloneLC" ); + // create a copy of the effect + CShwCrossFadeEffect* copy = CShwCrossFadeEffect::NewLC(); + // transfer the member variables, only size has relevant value + /*copy->iImpl->iSizeLayout.SetValue( + iImpl->iSizeLayout.TimedPoint().iX.Now(), + iImpl->iSizeLayout.TimedPoint().iY.Now(), + 0 );*/ + // copy the screen size + copy->iImpl->iScreenSize = iImpl->iScreenSize; + return copy; + } + +// ----------------------------------------------------------------------------- +// InitializeL +// ----------------------------------------------------------------------------- +void CShwCrossFadeEffect::InitializeL( + CAlfEnv* /*aHuiEnv*/, MGlxVisualList* /*aVisualList*/, + MGlxMediaList* /*aMediaList*/, TSize aScreenSize ) + { + TRACER("CShwCrossFadeEffect::InitializeL"); + GLX_LOG_INFO( "CShwCrossFadeEffect::InitializeL" ); + // set the screen size + iImpl->iScreenSize = aScreenSize; + // set the layout full screen (slideshow is always run on landscape) +// iImpl->iSizeLayout.SetValue( aScreenSize.iWidth, aScreenSize.iHeight, 0 ); + } + +// ----------------------------------------------------------------------------- +// PrepareViewL +// ----------------------------------------------------------------------------- +TSize CShwCrossFadeEffect::PrepareViewL( + CAlfVisual* /*aVisual*/, TSize /*aImageSize*/ ) + { + TRACER("CShwCrossFadeEffect::PrepareViewL"); + GLX_LOG_INFO( "CShwCrossFadeEffect::PrepareViewL" ); + // visual list takes care of fitting the image and maintains aspect ratio + // return the screen size as the thumbnail size + return iImpl->iScreenSize; + } + +// ----------------------------------------------------------------------------- +// EnterViewL. +// ----------------------------------------------------------------------------- +MGlxLayout* CShwCrossFadeEffect::EnterViewL( + CAlfVisual* aVisual/**/, TInt /*aDuration*/, TInt aFadeInDuration ) + { + TRACER("CShwCrossFadeEffect::EnterViewL"); + GLX_LOG_INFO1( + "CShwCrossFadeEffect::EnterViewL( %d )", aFadeInDuration ); + TAlfTimedValue initialValue(0.0,0); + aVisual->SetOpacity(initialValue); + TAlfTimedValue tranition(1.0,aFadeInDuration); + tranition.SetStyle(EAlfTimedValueStyleLinear); + aVisual->SetOpacity(tranition); + // set value, 0% -> 100% + //iImpl->iOpacityLayout.Set( KMinOpacity ); + //iImpl->iOpacityLayout.Set( KMaxOpacity, aFadeInDuration ); + return &iImpl->iOpacityLayout; + } + +// ----------------------------------------------------------------------------- +// ExitView. +// ----------------------------------------------------------------------------- +void CShwCrossFadeEffect::ExitView( CAlfVisual* /*aVisual*/ ) + { + TRACER("CShwCrossFadeEffect::ExitView"); + GLX_LOG_INFO( "CShwCrossFadeEffect::ExitView" ); + } + +// ----------------------------------------------------------------------------- +// EnterTransitionL. +// ----------------------------------------------------------------------------- +MGlxLayout* CShwCrossFadeEffect::EnterTransitionL( + CAlfVisual* /**/aVisual, TInt aDuration ) + { + TRACER("CShwCrossFadeEffect::EnterTransitionL"); + GLX_LOG_INFO1( "CShwCrossFadeEffect::EnterTransitionL( %d )", aDuration ); + + // set value, drop from 100% to 0% + //iImpl->iOpacityLayout.Set( KMaxOpacity ); + //iImpl->iOpacityLayout.Set( KMinOpacity, aDuration ); + TAlfTimedValue tranition(0.0,aDuration); + tranition.SetStyle(EAlfTimedValueStyleLinear); + aVisual->SetOpacity(tranition); + return &iImpl->iOpacityLayout; + } + +// ----------------------------------------------------------------------------- +// ExitTransition. +// ----------------------------------------------------------------------------- +void CShwCrossFadeEffect::ExitTransition( CAlfVisual* /*aVisual*/ ) + { + TRACER("CShwCrossFadeEffect::ExitTransition"); + GLX_LOG_INFO( "CShwCrossFadeEffect::ExitTransition" ); + } + +// ----------------------------------------------------------------------------- +// PauseL. +// ----------------------------------------------------------------------------- +void CShwCrossFadeEffect::PauseL() + { + TRACER("CShwCrossFadeEffect::PauseL"); + GLX_LOG_INFO( "CShwCrossFadeEffect::PauseL()"); + + // pause the opacity, size does not change so no need to pause + iImpl->iOpacityLayout.Pause(); + } + +// ----------------------------------------------------------------------------- +// Resume. +// ----------------------------------------------------------------------------- +void CShwCrossFadeEffect::Resume() + { + TRACER("CShwCrossFadeEffect::Resume"); + GLX_LOG_INFO( "CShwCrossFadeEffect::Resume()"); + + // resume the opacity layout, size does not change so no need to resume + iImpl->iOpacityLayout.Resume(); + } + +// ----------------------------------------------------------------------------- +// EffectInfo. +// ----------------------------------------------------------------------------- +TShwEffectInfo CShwCrossFadeEffect::EffectInfo() + { + TRACER("CShwCrossFadeEffect::EffectInfo"); + GLX_LOG_INFO( "CShwCrossFadeEffect::EffectInfo()"); + return iImpl->iEffectInfo; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwcrossfadeeffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwcrossfadeeffect.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007-2008 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: The crossfade effect + * +*/ + + + + +#ifndef __SHWCROSSFADEEFFECT_H__ +#define __SHWCROSSFADEEFFECT_H__ + +// INCLUDES +#include +#include +#include +#include + +#include "shweffect.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** + * CShwCrossFadeEffect, the crossfade effect. + * Shows images in full screen in view mode and performs smooth crossfade in transition. + * + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + */ +NONSHARABLE_CLASS( CShwCrossFadeEffect ) + : public CBase, public MShwEffect + { + public: + + /** + * Contructor. + */ + static CShwCrossFadeEffect* NewLC(); + + /** + * Destructor. + */ + ~CShwCrossFadeEffect(); + + private: + + /** + * C++ contructor. + */ + CShwCrossFadeEffect(); + + public: // from MShwEffect + + /// @ref MShwEffect::CloneLC + MShwEffect* CloneLC(); + /// @ref MShwEffect::InitializeL + void InitializeL( + CAlfEnv* aHuiEnv, MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, TSize aScreenSize ); + /// @ref MShwEffect::PrepareViewL + TSize PrepareViewL( CAlfVisual* aVisual, TSize aImageSize ); + /// @ref MShwEffect::EnterViewL + MGlxLayout* EnterViewL( + CAlfVisual* aVisual, TInt aDuration, TInt aFadeInDuration ); + /// @ref MShwEffect::ExitView + void ExitView( CAlfVisual* aVisual ); + /// @ref MShwEffect::EnterTransitionL + MGlxLayout* EnterTransitionL( CAlfVisual* aVisual, TInt aDuration ); + /// @ref MShwEffect::ExitTransition + void ExitTransition( CAlfVisual* aVisual ); + /// @ref MShwEffect::PauseL + void PauseL(); + /// @ref MShwEffect::Resume + void Resume(); + /// @ref MShwEffect:EffectInfo + TShwEffectInfo EffectInfo(); + + private: + + /// Own: the implementation + class CShwCrossFadeEffectImpl; + CShwCrossFadeEffectImpl* iImpl; + + }; + +#endif // __SHWCROSSFADEEFFECT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwcrossfadelayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwcrossfadelayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2007-2008 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: Layout that performs crossfade + * +*/ + + + + +// Include Files +#include "shwcrossfadelayout.h" + +#include +#include + +#include "shwconstants.h" + +using namespace NShwSlideshow; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +TShwCrossFadeLayout::TShwCrossFadeLayout() + { + TRACER("TShwCrossFadeLayout::TShwCrossFadeLayout"); + GLX_LOG_INFO("TShwCrossFadeLayout::TShwCrossFadeLayout"); + __DEBUG_ONLY( _iName = _L("TShwCrossfadeLayout") ); + // default values + // style is linear + iOpacity.SetStyle( EAlfTimedValueStyleLinear ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +TShwCrossFadeLayout::~TShwCrossFadeLayout() + { + TRACER("TShwCrossFadeLayout::~TShwCrossFadeLayout"); + GLX_LOG_INFO("TShwCrossFadeLayout::~TShwCrossFadeLayout"); + // Do nothing + } + +// ----------------------------------------------------------------------------- +// Set +// ----------------------------------------------------------------------------- +void TShwCrossFadeLayout::Set( TReal32 aOpacity, TInt aDuration ) + { + TRACER("TShwCrossFadeLayout::Set"); + GLX_LOG_INFO("TShwCrossFadeLayout::Set"); + iOpacity.Set( aOpacity, aDuration ); + } + +// ----------------------------------------------------------------------------- +// Pause +// ----------------------------------------------------------------------------- +void TShwCrossFadeLayout::Pause() + { + TRACER("TShwCrossFadeLayout::Pause"); + GLX_LOG_INFO("TShwCrossFadeLayout::Pause"); + iOpacity.Pause(); + } + +// ----------------------------------------------------------------------------- +// Resume +// ----------------------------------------------------------------------------- +void TShwCrossFadeLayout::Resume() + { + TRACER("TShwCrossFadeLayout::Resume"); + GLX_LOG_INFO("TShwCrossFadeLayout::Resume"); + iOpacity.Resume(); + } + +// ----------------------------------------------------------------------------- +// DoSetLayoutValues +// ----------------------------------------------------------------------------- +void TShwCrossFadeLayout::DoSetLayoutValues( TGlxLayoutInfo& aInfo ) + { + TRACER("TShwCrossFadeLayout::DoSetLayoutValues"); + GLX_LOG_INFO("TShwCrossFadeLayout::DoSetLayoutValues"); + // get new opacity + TReal32 opacity = iOpacity.Now(); + + // ensure value is inside maximum and minimum opacity + opacity = Min( opacity, KMaxOpacity ); + opacity = Max( opacity, KMinOpacity ); + + // set value to the info + //aInfo.iOpacity = opacity; + } + +// ----------------------------------------------------------------------------- +// DoChanged +// ----------------------------------------------------------------------------- +TBool TShwCrossFadeLayout::DoChanged() const + { + TRACER("TShwCrossFadeLayout::DoChanged"); + GLX_LOG_INFO("TShwCrossFadeLayout::DoChanged"); + return iOpacity.Changed(); + } + +// ----------------------------------------------------------------------------- +// DoClearChanged +// ----------------------------------------------------------------------------- +void TShwCrossFadeLayout::DoClearChanged() + { + TRACER("TShwCrossFadeLayout::DoClearChanged"); + GLX_LOG_INFO("TShwCrossFadeLayout::DoClearChanged"); + iOpacity.ClearChanged(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwcrossfadelayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwcrossfadelayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2007-2008 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: Layout that performs cross fade + * +*/ + + + +#ifndef __SHWCROSSFADELAYOUT_H__ +#define __SHWCROSSFADELAYOUT_H__ + +#include + +#include "shwtimedvalue.h" + +// FORWARD DECLARATIONS +class CHuiCurvePath; + +/** + * TShwCrossFadeLayout. + * Layout that handles crossfade effect. + * @author Kimmo Hoikka + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + */ +NONSHARABLE_CLASS( TShwCrossFadeLayout ) : public TGlxLayout + { + public: + + /** + * Constructor, initializes the layout. + */ + TShwCrossFadeLayout(); + + /** + * Destructor + */ + ~TShwCrossFadeLayout(); + + /** + * Specifies the opacity value + * @param aOpacity the desired opacity target + * @param aDuration the target time for opacity + */ + void Set( TReal32 aOpacity, TInt aDuration = 0 ); + + /** + * This method pauses zoom and pan + */ + void Pause(); + + /** + * This method resumes zoom and pan after pause. + */ + void Resume(); + + protected: // From TGlxLayout + + /// @ref TGlxLayout::DoSetLayoutValues + void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + /// @ref TGlxLayout::DoChanged + TBool DoChanged() const; + /// @ref TGlxLayout::DoClearChanged + void DoClearChanged(); + + private: // Data and private parts + + /// Own: the opacity + TShwTimedValue iOpacity; + + }; + +#endif // __SHWCROSSFADELAYOUT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwcurvefactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwcurvefactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007-2008 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: Zoom and pan effect curve factory + * +*/ + + + + +// Include Files +#include "shwcurvefactory.h" + +#include + +// ----------------------------------------------------------------------------- +// NShwCurveFactory. +// ----------------------------------------------------------------------------- +namespace NShwCurveFactory + { + // constant for arc angle + //const TInt KStartAngle = 0; // start at 0 degrees + //const TInt KStopAngle = 360; // end in in 360 degrees + //const TInt KOrigo = 0; // centre is in origo + // ------------------------------------------------------------------------- + // CreateEllipsisL. + // ------------------------------------------------------------------------- + CAlfCurvePath* CreateEllipsisL( TSize /*aSize*/, TInt /*aLength*/ ) + { + //!Nasty Hack to supress compiler warnings + //function no longer used + //needs to be refactored/removed + CAlfCurvePath* curve =NULL; + /* CAlfCurvePath* curve = CAlfCurvePath::NewL(); + CleanupStack::PushL( curve ); + // HUI creates a double sized ellipsis so need to halve the sides + TSize realSize( aSize.iWidth / 2, aSize.iHeight / 2 ); + // create the arch for given length + curve->AppendArcL( + TPoint( KOrigo, KOrigo ), // centre point + realSize, // sides of the rect defining the ellipse + KStartAngle, // start angle + KStopAngle, // end angle + aLength ); // the whole circle + // enable loop + CleanupStack::Pop( curve ); + curve->EnableLoop( ETrue );*/ + return curve; + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwcurvefactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwcurvefactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007-2008 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: Zoom and pan effect curve factory + * +*/ + + + + +// Include Files +#include +#include + +#ifndef __SHWCURVEFACTORY_H__ +#define __SHWCURVEFACTORY_H__ + +// Forward declares +class CAlfCurvePath; + +/** + * NShwCurveFactory. + * Grouping of the slideshow curve creation. + * This is in a namespace to not pollute global namespace and not + * a class as its just a "c-style" function, so no benefit of being a class. + * @internal reviewed 06/06/2007 by Dan Rhodes + */ +namespace NShwCurveFactory + { + /** + * @param aSize the width and height of the ellipsis + * @param aLenght the length of the ellipsis + * @return the HUI curvepath that defines the ellipsis + */ + CAlfCurvePath* CreateEllipsisL( TSize aSize, TInt aLength ); + } + +#endif // __SHWCURVEFACTORY_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwdefaulteffectmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwdefaulteffectmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,312 @@ +/* +* Copyright (c) 2007-2008 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: Default effect order manager + * +*/ + + + + +// Include Files +#include "shwdefaulteffectmanager.h" + +#include + +#include +#include + +#include "shweffect.h" +#include "shwconstants.h" +#include "shwslideshowenginepanic.h" + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwDefaultEffectManager::CShwDefaultEffectManager() + : iEffectOrder( MShwEffectManager::EEffectOrderLinear ) // default order + { + TRACER("CShwDefaultEffectManager::CShwDefaultEffectManager()"); + GLX_LOG_INFO( "CShwDefaultEffectManager::CShwDefaultEffectManager()" ); + // no implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwDefaultEffectManager* CShwDefaultEffectManager::NewL() + { + TRACER("CShwDefaultEffectManager::NewL()"); + GLX_LOG_INFO( "CShwDefaultEffectManager::NewL" ); + CShwDefaultEffectManager* self = new( ELeave ) CShwDefaultEffectManager; + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwDefaultEffectManager::~CShwDefaultEffectManager() + { + TRACER("CShwDefaultEffectManager::~CShwDefaultEffectManager"); + GLX_LOG_INFO( "CShwDefaultEffectManager::~CShwDefaultEffectManager" ); + + // Delete the effect objects + ResetAndDestroyEffects( iAvailableEffects ); + iAvailableEffects.Close(); + + // Close the "working" effects array + // Note that iEffects just references the same elements as iAvailableEffects + // so don't delete them again. + iEffects.Close(); + } + +// ----------------------------------------------------------------------------- +// AddEffectL. +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::AddEffectL( MShwEffect* aEffect ) + { + TRACER("CShwDefaultEffectManager::AddEffectL"); + GLX_LOG_INFO( "CShwDefaultEffectManager::AddEffectL" ); + // dont add NULLs to the array + if( aEffect ) + { + iAvailableEffects.AppendL( aEffect ); + } + } + +// ----------------------------------------------------------------------------- +// CurrentEffect. +// ----------------------------------------------------------------------------- +MShwEffect* CShwDefaultEffectManager::CurrentEffect() + { + TRACER("CShwDefaultEffectManager::CurrentEffect"); + GLX_LOG_INFO( "CShwDefaultEffectManager::CurrentEffect" ); + // check that we have something in iEffects + __ASSERT_DEBUG( iEffects.Count() > 0 && iEffects.Count() > iCurrentEffect, + NShwEngine::Panic( NShwEngine::EIncorrectEffectIndex ) ); + + return iEffects[ iCurrentEffect ]; + } + +// ----------------------------------------------------------------------------- +// Effect +// ----------------------------------------------------------------------------- +MShwEffect* CShwDefaultEffectManager::Effect( TInt aDirection ) + { + TRACER("CShwDefaultEffectManager::Effect"); + GLX_LOG_INFO1( "CShwDefaultEffectManager::Effect, direction %d", + aDirection ); + // check that we have something in iEffects + __ASSERT_DEBUG( iEffects.Count() > 0 && iEffects.Count() > iCurrentEffect, + NShwEngine::Panic( NShwEngine::EIncorrectEffectIndex ) ); + + TInt nextEffectIndex = CalculateNextEffectIndex( aDirection ); + return iEffects[ nextEffectIndex ]; + } + +// ----------------------------------------------------------------------------- +// ProceedToEffect. +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::ProceedToEffect( TInt aDirection ) + { + TRACER("CShwDefaultEffectManager::ProceedToEffect"); + GLX_LOG_INFO1( "CShwDefaultEffectManager::ProceedToEffect,\ + direction %d", aDirection ); + // calculate new effects + CalculateEffects( aDirection ); + } + +// ----------------------------------------------------------------------------- +// SetEffectOrder. +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::SetEffectOrder(MShwEffectManager::TShwEffectOrder + aOrder) + { + TRACER("CShwDefaultEffectManager::SetEffectOrder"); + GLX_LOG_INFO("CShwDefaultEffectManager::SetEffectOrder"); + iEffectOrder = aOrder; + /// @todo implement the rest for increment 7 + } + +// ----------------------------------------------------------------------------- +// EffectOrder. +// ----------------------------------------------------------------------------- +MShwEffectManager::TShwEffectOrder CShwDefaultEffectManager::EffectOrder() + { + TRACER("CShwDefaultEffectManager::EffectOrder"); + GLX_LOG_INFO("CShwDefaultEffectManager::EffectOrder"); + return iEffectOrder; + } + +// ----------------------------------------------------------------------------- +// SetProgrammedEffects. +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::SetProgrammedEffects( + RArray& /*aEffects*/ ) + { + TRACER("CShwDefaultEffectManager::SetProgrammedEffects"); + GLX_LOG_INFO("CShwDefaultEffectManager::SetProgrammedEffects"); + /// @todo implement for increment 7 + } + +// ----------------------------------------------------------------------------- +// SetDefaultEffect. +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::SetDefaultEffectL( TShwEffectInfo aInfo ) + { + TRACER("CShwDefaultEffectManager::SetDefaultEffectL"); + GLX_LOG_INFO( "CShwDefaultEffectManager::SetDefaultEffectL" ); + + // Loop through the effects to find the one with matching info + TInt index = iAvailableEffects.Count(); + MShwEffect* effect = NULL; + while( index-- > 0 ) + { + // get effect + effect = iAvailableEffects[ index ]; + // get its info + TShwEffectInfo info = effect->EffectInfo(); + // check if we got a match + if( info == aInfo ) + { + break; + } + } + // if no effect or no match + if( !effect || index < 0 ) + { + // effect not found + User::Leave( KErrArgument ); + } + + // Need to clone the effect as in current release + // we have once single effect at a time and one effect instance can only + // handle one visual + /// @todo fix this so that once the effect order is solved, the effects + /// are cloned as needed + MShwEffect* clone = effect->CloneLC(); + iAvailableEffects.AppendL( clone ); + CleanupStack::Pop(); + + iEffects.Append( effect ); + iEffects.Append( clone ); + + // calculate the effects + CalculateEffects( 1 ); + } + +// ----------------------------------------------------------------------------- +// GetActiveEffectsL +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::GetActiveEffectsL( + RPointerArray< MShwEffect >& aEffects ) + { + TRACER("CShwDefaultEffectManager::GetActiveEffectsL"); + GLX_LOG_INFO( "CShwDefaultEffectManager::GetActiveEffectsL" ); + // Retrieve each effect + for( TInt i = 0; i < iEffects.Count(); ++i ) + { + // append the effect pointer to the given array + aEffects.AppendL( iEffects[i] ); + } + } + +// ----------------------------------------------------------------------------- +// CalculateEffects. +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::CalculateEffects( TInt aDirection ) + { + TRACER("CShwDefaultEffectManager::CalculateEffects"); + GLX_LOG_INFO1( "CShwDefaultEffectManager::CalculateEffects,\ + direction %d", aDirection ); + // This method updates both the current and next indices for the given + // direction. If we're proceeding forwards, temporarily store the + // "next" index to set it as "current" after the new "next" value has + // been determined (as the next value is determined from the current value). + if ( aDirection > 0 ) + { + // Next effect is "forward" + iCurrentEffect = iNextEffect; + } + else + { + // moving "backwards" + iNextEffect = iCurrentEffect; + } + + if( iEffectOrder == MShwEffectManager::EEffectOrderLinear ) + { + // As iAvailableEffects is used to store the effects it can be + // walked directly and the order will always be correct + // + TInt nextEffect = CalculateNextEffectIndex( aDirection ); + if ( aDirection > 0 ) + { + // moving forwards + iNextEffect = nextEffect; + } + else + { + // moving backwards + iCurrentEffect = nextEffect; + } + } + } + +// ----------------------------------------------------------------------------- +// ResetAndDestroyEffects. +// ----------------------------------------------------------------------------- +void CShwDefaultEffectManager::ResetAndDestroyEffects(RArray< MShwEffect* >& + aArray) + { + TRACER("CShwDefaultEffectManager::ResetAndDestroyEffects"); + // get the count + TInt count = aArray.Count(); + GLX_LOG_INFO1( + "CShwDefaultEffectManager::ResetAndDestroyEffects %d", count ); + + // Delete the effect objects + for( TInt i = 0; i < count; i++ ) + { + // call the destructor + delete aArray[ i ]; + } + aArray.Reset(); + } + +// ----------------------------------------------------------------------------- +// CalculateNextEffectIndex. +// ----------------------------------------------------------------------------- +TInt CShwDefaultEffectManager::CalculateNextEffectIndex( TInt aDirection ) + { + TRACER("CShwDefaultEffectManager::CalculateNextEffectIndex"); + GLX_LOG_INFO1( + "CShwDefaultEffectManager::CalculateNextEffectIndex %d", aDirection); + TInt effectsCount = iEffects.Count(); + // Guard against direction exceeding the number of effects + TInt direction = aDirection % effectsCount; + TInt nextEffect = iCurrentEffect + direction; + + // ensure index is still in bounds + if ( nextEffect < 0 ) + { + // -ve index: wrap around to the last element + nextEffect = effectsCount - 1; + } + else if ( nextEffect >= effectsCount ) + { + // passed the end so return to the start. + nextEffect = 0; + } + return nextEffect; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwdefaulteffectmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwdefaulteffectmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2007-2008 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: Default effect manager + * +*/ + + + + +#ifndef __CSHWDEFAULTEFFECTMANAGER_H__ +#define __CSHWDEFAULTEFFECTMANAGER_H__ + +// INCLUDES +#include +#include + +#include "shweffectmanager.h" +#include "shweffectinfo.h" + +// FORWARD DECLARATIONS +class MShwEffect; + +// CLASS DECLARATION + +/** + * CShwDefaultEffectManager + */ +NONSHARABLE_CLASS( CShwDefaultEffectManager ) : public CBase, public MShwEffectManager + { + public: // Constructors and destructor + + /** + * Constructor. + * @param aVisualList, the list that this view control manages + */ + static CShwDefaultEffectManager* NewL(); + + /** + * Destructor. + */ + ~CShwDefaultEffectManager(); + + private: + + /** + * Constructor + */ + CShwDefaultEffectManager(); + + public: // from MShwEffectManager + + /// @ref MShwEffectManager::AddEffectL + void AddEffectL( MShwEffect* aEffect ); + /// @ref MShwEffectManager::CurrentEffect + MShwEffect* CurrentEffect(); + /// @ref MShwEffectManager::Effect + MShwEffect* Effect( TInt aDirection); + /// @ref MShwEffectManager::ProceedToEffect + void ProceedToEffect( TInt aDirection ); + /// @ref MShwEffectManager::SetEffectOrder + void SetEffectOrder(TShwEffectOrder aOrder); + /// @ref MShwEffectManager::EffectOrder + TShwEffectOrder EffectOrder(); + /** @todo: confirm how to programme effects */ + /// @ref MShwEffectManager::SetProgrammedEffects + void SetProgrammedEffects( RArray< TShwEffectInfo >& aEffects ); + /// @ref MShwEffectManager::SetDefaultEffect + void SetDefaultEffectL(TShwEffectInfo aInfo); + /// @ref MShwEffectManager::GetActiveEffectsL + void GetActiveEffectsL( RPointerArray< MShwEffect >& aEffects ); + + private: // Implementation + + // Default to "forwards" direction. Use negative value for "backwards" + void CalculateEffects( TInt aDirection = 1 ); + void ResetAndDestroyEffects(RArray< MShwEffect* >& aArray); + TInt CalculateNextEffectIndex( TInt aDirection ); + + private: // Data + + /// Own: The effects in use + RArray< MShwEffect* > iEffects; + /// Own: The entire selection of effects + RArray< MShwEffect* > iAvailableEffects; + /// Own: current effect number + TInt iCurrentEffect; + /// Own: next effect number + TInt iNextEffect; + /// Own: the order that the effects are played in + MShwEffectManager::TShwEffectOrder iEffectOrder; + + }; + +#endif // __CSHWDEFAULTEFFECTMANAGER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwresourceutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwresourceutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007-2008 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: Localisation utility for UI visible strings + * +*/ + + + + + +// CLASS HEADER +#include "shwresourceutility.h" + +// EXTERNAL INCLUDES +#include +#include +#include // for BaflUtils +#include // for KDC_APP_RESOURCE_DIR + +// INTERNAL INCLUDES +#include // for CGlxResourceUtilities +#include +#include + +_LIT(KShwSlideshowEngineResource, "shwslideshowengine.rsc"); + +// ----------------------------------------------------------------------------- +// LocalisedNameL +// ----------------------------------------------------------------------------- +HBufC* ShwResourceUtility::LocalisedNameL(TInt aResourceId) + { + TRACER(" ShwResourceUtility::LocalisedNameL"); + GLX_LOG_INFO( "ShwResourceUtility::LocalisedNameL" ); + // Load the engine's resource + TFileName resourceFile( KDC_APP_RESOURCE_DIR ); + // append resource file name + resourceFile.Append( KShwSlideshowEngineResource ); + // add the application path + CGlxResourceUtilities::GetResourceFilenameL( resourceFile ); + // add the resource to CCoeEnv + TInt id = CCoeEnv::Static()->AddResourceFileL( resourceFile ); + // read the string and return it + HBufC* tmp = CCoeEnv::Static()->AllocReadResourceL( aResourceId ); + // remove the resource as its not needed anymore + CCoeEnv::Static()->DeleteResourceFile( id ); + // return the string and ownership + return tmp; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwresourceutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwresourceutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007-2008 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: Localisation utility for UI visible strings + * +*/ + + + + +// Include Files +#include +#include + +/** + * Utility to handle resource file loading. + * Resource file contains the localised effect names + */ +NONSHARABLE_CLASS( ShwResourceUtility ) + { + public: + + /** + * Returns a localised name for the given resource id + * @param aResourceId the id for the string + * @return the localised name or NULL if string not found + */ + static HBufC* LocalisedNameL( TInt aResourceId ); + }; diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwtimedvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwtimedvalue.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2007-2008 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: Wrapper on top of THuiTimedValue to enable pause / resume + * +*/ + + + + +#ifndef __SHWTIMEDVALUE_H__ +#define __SHWTIMEDVALUE_H__ + +// Include Files +#include +#include +//#include + +/** + * Wrapper class to enable pause and resume for timed values. + * + * @author Kimmo Hoikka + * @lib shwslideshowengine.lib + */ +NONSHARABLE_CLASS( TShwTimedValue ) + { + public: // the API + + /** + * Constructor, initializes value to zero + */ + inline TShwTimedValue(); + + /** + * Sets the interpolation style + * @param aStyle, @ref THuiInterpolationStyle + */ + inline void SetStyle( TAlfInterpolationStyle aStyle ); + + /** + * Sets the value to be aValue now + * @param aValue the target value + */ + inline void Set( TReal32 aValue ); + + /** + * Sets the value to be aValue after the specified aTime + * @param aValue the target value + * @param aTime the target time for the value + */ + inline void Set( TReal32 aValue, TInt aTime ); + + /** + * Return the current interpolated value. + * @return the current value + */ + inline TReal32 Now(); + + /** + * Return the target value. + * @return the current value + */ + inline TReal32 Target(); + + /** + * @return ETrue if the value has changed since last time + */ + inline TBool Changed() const; + + /** + * Clears the changed flag + */ + inline void ClearChanged(); + + /** + * Pauses the timed value + */ + inline void Pause(); + + /** + * Resumes the timed value + */ + inline void Resume(); + + private: // Data + + TAlfTimedValue iTimedValue; + TBool iPaused; + TReal32 iTargetValue; + TInt iRemainingTime; + + }; + +/** + * Wrapper class to enable pause and resume for timed values + */ +NONSHARABLE_CLASS( TShwTimedSize ) + { + public: // the API + + /** + * Constructor, initializes value to zero + */ + inline TShwTimedSize(); + + /** + * Sets the interpolation style + * @param aStyle, @ref THuiInterpolationStyle + */ + inline void SetStyle( TAlfInterpolationStyle aStyle ); + + /** + * Sets the value to be aValue now + * @param aValue the target value + */ + inline void Set( TAlfRealSize aValue ); + + /** + * Sets the value to be aValue after the specified aTime + * @param aValue the target value + * @param aTime the target time for the value + */ + inline void Set( TAlfRealSize aValue, TInt aTime ); + + /** + * Return the current interpolated value. + * @return the current value + */ + inline TAlfRealSize Now(); + + /** + * @return ETrue if the value has changed since last time + */ + inline TBool Changed() const; + + /** + * Clears the changed flag + */ + inline void ClearChanged(); + + /** + * Pauses the timed value + */ + inline void Pause(); + + /** + * Resumes the timed value + */ + inline void Resume(); + + public: // Data + + TShwTimedValue iWidth; + TShwTimedValue iHeight; + + }; + +#include "shwtimedvalue.inl" + +#endif // __SHWTIMEDVALUE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwtimedvalue.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwtimedvalue.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2007-2008 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: Wrapper on top of THuiTimedValue to enable pause / resume + * +*/ + + + + +// ----------------------------------------------------------------------------- +// TShwTimedValue +// ----------------------------------------------------------------------------- +inline TShwTimedValue::TShwTimedValue() : + iTimedValue( 0 ), + iPaused( EFalse ), + iTargetValue( 0 ), + iRemainingTime( 0 ) + { + } + +// ----------------------------------------------------------------------------- +// SetStyle +// ----------------------------------------------------------------------------- +inline void TShwTimedValue::SetStyle( TAlfInterpolationStyle aStyle ) + { + iTimedValue.SetStyle( aStyle ); + } + +// ----------------------------------------------------------------------------- +// Set +// ----------------------------------------------------------------------------- +inline void TShwTimedValue::Set( TReal32 /*aValue */) + { + // this version set sets the value always, even in pause +// iTimedValue.Set( aValue ); + } + +// ----------------------------------------------------------------------------- +// Set +// ----------------------------------------------------------------------------- +inline void TShwTimedValue::Set( TReal32 /*aValue*/, TInt /*aTime*/ ) + { + // we dont set the value in pause unless aTime is zero + // as while paused we dont animate. + //if( ( !iPaused ) || ( 0 == aTime ) ) + // { + //iTimedValue.Set( aValue, aTime ); + // } + } + +// ----------------------------------------------------------------------------- +// Now +// ----------------------------------------------------------------------------- +inline TReal32 TShwTimedValue::Now() + { + return iTimedValue.ValueNow(); + } + +// ----------------------------------------------------------------------------- +// Target +// ----------------------------------------------------------------------------- +inline TReal32 TShwTimedValue::Target() + { + return iTimedValue.Target(); + } + +// ----------------------------------------------------------------------------- +// Changed +// ----------------------------------------------------------------------------- +inline TBool TShwTimedValue::Changed() const + { + //return iTimedValue.Changed(); + //!Hack to supress compiler warnings + //function no longer used + //needs to be refactored/removed + return ETrue; + } + +// ----------------------------------------------------------------------------- +// ClearChanged +// ----------------------------------------------------------------------------- +inline void TShwTimedValue::ClearChanged() + { +// iTimedValue.ClearChanged(); + } + +// ----------------------------------------------------------------------------- +// Pause +// ----------------------------------------------------------------------------- +inline void TShwTimedValue::Pause() + { + if ( !iPaused ) + { + iPaused = ETrue; + // remember the target + iTargetValue = iTimedValue.Target(); + // remember the remaining time + //iRemainingTime = iTimedValue.RemainingTime(); + // stop the timed value by setting its value to current + //iTimedValue.Set( iTimedValue.Now() ); + } + } + +// ----------------------------------------------------------------------------- +// Resume +// ----------------------------------------------------------------------------- +inline void TShwTimedValue::Resume() + { + if ( iPaused ) + { + iPaused = EFalse; + // resume the timed value + // set the target to be the original target +// iTimedValue.Set( iTargetValue, iRemainingTime ); + } + } + +// ----------------------------------------------------------------------------- +// TShwTimedSize +// ----------------------------------------------------------------------------- +inline TShwTimedSize::TShwTimedSize() + { + // TShwTimedValue objects reset themselves + } + +// ----------------------------------------------------------------------------- +// SetStyle +// ----------------------------------------------------------------------------- +inline void TShwTimedSize::SetStyle( TAlfInterpolationStyle aStyle ) + { + iWidth.SetStyle( aStyle ); + iHeight.SetStyle( aStyle ); + } + +// ----------------------------------------------------------------------------- +// Set +// ----------------------------------------------------------------------------- +inline void TShwTimedSize::Set( TAlfRealSize aValue ) + { + iWidth.Set( aValue.iWidth ); + iHeight.Set( aValue.iHeight ); + } + +// ----------------------------------------------------------------------------- +// Set +// ----------------------------------------------------------------------------- +inline void TShwTimedSize::Set( TAlfRealSize aValue, TInt aTime ) + { + iWidth.Set( aValue.iWidth, aTime ); + iHeight.Set( aValue.iHeight, aTime ); + } + +// ----------------------------------------------------------------------------- +// Now +// ----------------------------------------------------------------------------- +inline TAlfRealSize TShwTimedSize::Now() + { + return TAlfRealSize( iWidth.Now(), iHeight.Now() ); + } + +// ----------------------------------------------------------------------------- +// Changed +// ----------------------------------------------------------------------------- +inline TBool TShwTimedSize::Changed() const + { + return iWidth.Changed() || iHeight.Changed(); + } + +// ----------------------------------------------------------------------------- +// ClearChanged +// ----------------------------------------------------------------------------- +inline void TShwTimedSize::ClearChanged() + { + iWidth.ClearChanged(); + iHeight.ClearChanged(); + } + +// ----------------------------------------------------------------------------- +// Pause +// ----------------------------------------------------------------------------- +inline void TShwTimedSize::Pause() + { + iWidth.Pause(); + iHeight.Pause(); + } + +// ----------------------------------------------------------------------------- +// Resume +// ----------------------------------------------------------------------------- +inline void TShwTimedSize::Resume() + { + iWidth.Resume(); + iHeight.Resume(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwzoomandpaneffect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwzoomandpaneffect.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,441 @@ +/* +* Copyright (c) 2007-2008 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: The zoom and pan effect + * +*/ + + + + +// Include Files +#include "shwzoomandpaneffect.h" + +#include +#include + +#include +#include + +#include "shwresourceutility.h" +#include "shwzoomandpanlayout.h" +#include "shwcurvefactory.h" +#include "shwconstants.h" +#include "shwslideshowenginepanic.h" +#include "shwcrossfadelayout.h" +#include "shwtimer.h" +#include "shwcallback.h" +#include "shwgeometryutilities.h" + +#include + +using namespace NShwSlideshow; + +/** + * CShwZoomAndPanEffectImpl + * Zoom and pan dependencies + * This class makes our clients indepandant of the effect implementation + * This gives greater flexibitily in testing as the test suites can just + * re-implement all the methods in the real class interface without the + * need to stub all our real dependencies. + * If for example TShwCrossFadeLayout was a direct member of + * CShwZoomAndPanEffect class, all the clients would need to have access + * to TShwCrossFadeLayout constructor and destructor and the test suite + * would need to either create a stub implementation for it or include + * the real class in the test (and all its dependencies) + * + * There is however no point of duplicating the whole CShwZoomAndPanEffect + * interface as it would mean double maintenance + * so we use the iImpl pointer when referencing the class members + */ +NONSHARABLE_CLASS( CShwZoomAndPanEffect::CShwZoomAndPanEffectImpl ) + : public CBase + { + public: + + /** + * Constructor + */ + inline CShwZoomAndPanEffectImpl(); + + /** + * Destructor + */ + inline ~CShwZoomAndPanEffectImpl(); + + /** + * 2nd phase constructor + */ + inline void ConstructL(); + + public: // Data + + /// Own: the size of the screen + TSize iScreenSize; + /// Own: the maximum thumbnail size + TSize iMaxThumbnailSize; + /// Own: the opacity layout + TShwCrossFadeLayout iOpacityLayout; + /// Own: the zoom and pan layout + TShwZoomAndPanLayout iZoomAndPanLayout; + /// Own: the pan curve + CAlfCurvePath* iCurve; + /// Own: Zoom and pan loop timer + CShwTimer* iLoopTimer; + /// Own: flag that defines if the image is large enough for zoom&pan + TBool iShouldZoom; + /// Own: Count to change the zoom direction + TInt iCount; + /// Own: the effect's info. + TShwEffectInfo iEffectInfo; + + }; + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwZoomAndPanEffect::CShwZoomAndPanEffectImpl::CShwZoomAndPanEffectImpl() + { + // CBase clears the values + // set layout chain + iOpacityLayout.SetNext( &iZoomAndPanLayout ); + } + +// ----------------------------------------------------------------------------- +// Destructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwZoomAndPanEffect::CShwZoomAndPanEffectImpl::~CShwZoomAndPanEffectImpl() + { + delete iCurve; + delete iLoopTimer; + } + +// ----------------------------------------------------------------------------- +// 2nd phase constructor for the implementation +// ----------------------------------------------------------------------------- +inline void CShwZoomAndPanEffect::CShwZoomAndPanEffectImpl::ConstructL() + { + // timer for zoom and pan looping + iLoopTimer = CShwTimer::NewL( CActive::EPriorityStandard ); + + // load string for effect name, no need to cleanup stack + // as no leaves between here and delete + HBufC* effectName = + ShwResourceUtility::LocalisedNameL( R_SHW_EFFECT_ZOOM_AND_PAN ); + if( !effectName ) + { + // have to use a non-localised version + iEffectInfo.iName = KEffectNameZoomAndPan; + } + else + { + // set the localised version + iEffectInfo.iName = *effectName; + } + + // info - uid + iEffectInfo.iId.iPluginUid = KDefaultEffectPluginUid; + iEffectInfo.iId.iIndex = KEffectUidZoomAndPan; + // delete the local string + delete effectName; + } + +// ----------------------------------------------------------------------------- +// C++ Constructor. Save a few bits of rom with inlining +// ----------------------------------------------------------------------------- +inline CShwZoomAndPanEffect::CShwZoomAndPanEffect() + { + } + +// ----------------------------------------------------------------------------- +// NewLC. Static construction +// ----------------------------------------------------------------------------- +CShwZoomAndPanEffect* CShwZoomAndPanEffect::NewLC() + { + CShwZoomAndPanEffect* self = new (ELeave) CShwZoomAndPanEffect; + CleanupStack::PushL( self ); + + // create the implementation class + self->iImpl = new( ELeave ) CShwZoomAndPanEffectImpl; + // do the second phase, if it leaves impl will be deleted + self->iImpl->ConstructL(); + + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CShwZoomAndPanEffect::~CShwZoomAndPanEffect() + { + delete iImpl; + } + +// ----------------------------------------------------------------------------- +// CloneLC +// ----------------------------------------------------------------------------- +MShwEffect* CShwZoomAndPanEffect::CloneLC() + { + GLX_LOG_INFO( "CShwZoomAndPanEffect::CloneLC" ); + // create a copy + CShwZoomAndPanEffect* copy = CShwZoomAndPanEffect::NewLC(); + // transfer the member variables, only screen + // size has relevant value this point + copy->iImpl->iScreenSize = iImpl->iScreenSize; + // set count to be one greater so it has a different zoom direction + copy->iImpl->iCount = iImpl->iCount + 1; + // copy the max thumbnail size + copy->iImpl->iMaxThumbnailSize = iImpl->iMaxThumbnailSize; + // return the clone + return copy; + } + +// ----------------------------------------------------------------------------- +// InitializeL +// ----------------------------------------------------------------------------- +void CShwZoomAndPanEffect::InitializeL( + CAlfEnv* /*aHuiEnv*/, MGlxVisualList* /*aVisualList*/, + MGlxMediaList* /*aMediaList*/, TSize aScreenSize ) + { + GLX_LOG_INFO( "CShwZoomAndPanEffect::SetHuiEnv" ); + // set the screen size + iImpl->iScreenSize = aScreenSize; + + // zoom and pan wants at least triple the screen size thumbnails + TInt width = iImpl->iScreenSize.iWidth; + TInt height = iImpl->iScreenSize.iHeight; + + // set the maximum thumbnail size, we need to optimize memory usage + // so dont load more pixels than KMaxThumbnailSize x Screen size thumbnail + iImpl->iMaxThumbnailSize.iWidth = width * KMaxThumbnailSize; + iImpl->iMaxThumbnailSize.iHeight = height * KMaxThumbnailSize; + } + +// ----------------------------------------------------------------------------- +// PrepareViewL +// ----------------------------------------------------------------------------- +TSize CShwZoomAndPanEffect::PrepareViewL( + CAlfVisual* /*aVisual*/, TSize aImageSize ) + { + GLX_LOG_INFO( "CShwZoomAndPanEffect::PrepareViewL()" ); + + // use the namespace for coord utilities + using namespace NShwGeometryUtilities; + + TSize originalImageSize = aImageSize; + // take a local copy of the size + TSize thumbnailSize = aImageSize; + // check that size was really found + if( ( aImageSize.iWidth == KErrNotFound )|| + ( aImageSize.iHeight == KErrNotFound ) ) + { + // size attribute not available so use screen size + thumbnailSize = iImpl->iScreenSize; + // need to also adjust aImageSize as its used further to make sure + // we dont load too big thumbnail; in this case we load screen size + originalImageSize = iImpl->iScreenSize; + } + + // calculate zoom first as after that we know the real panning + // optimist assumes we can zoom every image + iImpl->iShouldZoom = ETrue; + // set the sizes for layout chain, return value is the zoom factor + TReal32 zoomFactor = + iImpl->iZoomAndPanLayout.SetSizes( + iImpl->iScreenSize, thumbnailSize, iImpl->iMaxThumbnailSize ); + // if the zoomfactor is smaller than minimal desired, dont zoom&pan + if( zoomFactor < KMinZoomAndPanFactor ) + { + iImpl->iShouldZoom = EFalse; + } + // ask for the maximum size from the layout + TSize maxSize = iImpl->iZoomAndPanLayout.MaximumSize(); + // make sure we don't load the image larger than maximum size + thumbnailSize = maxSize; + // thumbnail is never loaded larger than image size, + // either in image size or smaller... zooming may go past image size though + FitInsideBox( + thumbnailSize.iWidth, thumbnailSize.iHeight, + originalImageSize.iWidth, originalImageSize.iHeight ); + + // calculate the area for the curve using the maximum size + // it must not cause the panning to get outside screen so need to calculate + // the delta box. We dont allow negative pan, + // however we need to support panning only in either direction. + // Note that curve will have negative values, its just curve -defining + // box that we make positive as negative value means too small image to pan + TInt curveWidth = Max( + ( maxSize.iWidth - iImpl->iScreenSize.iWidth ) / 2, + 0 ); + TInt curveHeight = Max( + ( maxSize.iHeight - iImpl->iScreenSize.iHeight ) / 2, + 0 ); + // delete old curve and set to NULL to prevent double delete + delete iImpl->iCurve; + iImpl->iCurve = NULL; + // if both are zero, dont bother creating curve + if( ( curveWidth > 0 ) || ( curveHeight > 0 ) ) + { + // create size + TSize curvearea( curveWidth, curveHeight ); + + // construct new curve inside TRAP, if it fails we just dont pan + TRAP_IGNORE( + { + CAlfCurvePath* curve = + NShwCurveFactory::CreateEllipsisL( + curvearea, KZoomAndPanCurveLength ); + // set new curve + iImpl->iCurve = curve; + } ); + } + // set the curve for the layout, its ok to set NULL +// iImpl->iZoomAndPanLayout.SetPanningCurve( iImpl->iCurve ); + + // return the calculated thumbnail size + return thumbnailSize; + } + +// ----------------------------------------------------------------------------- +// EnterViewL +// ----------------------------------------------------------------------------- +MGlxLayout* CShwZoomAndPanEffect::EnterViewL( + CAlfVisual* /*aVisual*/, TInt aDuration, TInt aFadeInDuration ) + { + GLX_LOG_INFO1( + "CShwZoomAndPanEffect::EnterViewL( %d )", aDuration ); + + // calculate zoom&pan length + // minimum length is the view duration and transition duration * 2 + // this is because there is transition, view and transition while + // this visual is visible (at least partially) + TInt zoom_and_pan_dur = aDuration + aFadeInDuration * 2; + + // set value, 0% -> 100% + iImpl->iOpacityLayout.Set( KMinOpacity ); + iImpl->iOpacityLayout.Set( KMaxOpacity, aFadeInDuration ); + + // check if the image was large enough for zooming + if( iImpl->iShouldZoom ) + { + // start with zoom in + TShwZoomAndPanLayout::TZoomDirection zoomdir = + TShwZoomAndPanLayout::EZoomIn; + if( iImpl->iCount % 2 ) + { + zoomdir = TShwZoomAndPanLayout::EZoomOut; + } + + // start zoom + // minimum length is the view duration and transition duration * 2 + // this is because there is transition, view and transition while + // this visual is visible (at least partially) + iImpl->iZoomAndPanLayout.StartZoom( + zoomdir, zoom_and_pan_dur ); + + // need to start a timer to invert the zoom in case image load + // takes longer than view mode lasts + iImpl->iLoopTimer->Start( + zoom_and_pan_dur, + zoom_and_pan_dur, + TShwCallBack< + TShwZoomAndPanLayout, + TShwZoomAndPanLayout::InvertZoom >( + &iImpl->iZoomAndPanLayout ) ); + } + else + { + // reset the size to minimum + iImpl->iZoomAndPanLayout.ResetSizeToMinimum(); + // cancel loop timer in case it is running, if not then + // this is a no-op + iImpl->iLoopTimer->Cancel(); + } + // return layout chain + return &iImpl->iOpacityLayout; + } + +// ----------------------------------------------------------------------------- +// ExitView +// ----------------------------------------------------------------------------- +void CShwZoomAndPanEffect::ExitView( CAlfVisual* /*aVisual*/ ) + { + GLX_LOG_INFO( "CShwZoomAndPanEffect::ExitView" ); + // Cancel the loop timer as we are already going to the + // next effect and visual + iImpl->iLoopTimer->Cancel(); + } + +// ----------------------------------------------------------------------------- +// EnterTransitionL +// ----------------------------------------------------------------------------- +MGlxLayout* CShwZoomAndPanEffect::EnterTransitionL( + CAlfVisual* /*aVisual*/, TInt aDuration ) + { + GLX_LOG_INFO1( "CShwZoomAndPanEffect::EnterTransitionL( %d )", aDuration ); + + // increase count, so every other time we can zoom in and out but only if we + // really got to transition + iImpl->iCount++; + + // set value, drop from 100% to 0% + iImpl->iOpacityLayout.Set( KMaxOpacity ); + iImpl->iOpacityLayout.Set( KMinOpacity, aDuration ); + + return &iImpl->iOpacityLayout; + } + +// ----------------------------------------------------------------------------- +// ExitTransition +// ----------------------------------------------------------------------------- +void CShwZoomAndPanEffect::ExitTransition( CAlfVisual* /*aVisual*/ ) + { + GLX_LOG_INFO( "CShwZoomAndPanEffect::ExitTransition" ); + } + +// ----------------------------------------------------------------------------- +// PauseL +// ----------------------------------------------------------------------------- +void CShwZoomAndPanEffect::PauseL() + { + GLX_LOG_INFO( "CShwZoomAndPanEffect::PauseL" ); + // need to pause the layouts, start with opacity + iImpl->iOpacityLayout.Pause(); + // freeze zoom and pan layout + iImpl->iZoomAndPanLayout.Pause(); + // pause loop timer, it is safe to pause the timer even if its not active + iImpl->iLoopTimer->Pause(); + } + +// ----------------------------------------------------------------------------- +// Resume +// ----------------------------------------------------------------------------- +void CShwZoomAndPanEffect::Resume() + { + GLX_LOG_INFO( "CShwZoomAndPanEffect::Resume" ); + // resume layouts + // start with opacity + iImpl->iOpacityLayout.Resume(); + // resume zoom and pan layout + iImpl->iZoomAndPanLayout.Resume(); + // resume loop timer + iImpl->iLoopTimer->Resume(); + } + +// ----------------------------------------------------------------------------- +// EffectInfo. +// ----------------------------------------------------------------------------- +TShwEffectInfo CShwZoomAndPanEffect::EffectInfo() + { + return iImpl->iEffectInfo; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwzoomandpaneffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwzoomandpaneffect.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007-2008 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: The zoom and pan effect + * +*/ + + + + +#ifndef __SHWZOOMANDPANEFFECT_H__ +#define __SHWZOOMANDPANEFFECT_H__ + +// INCLUDES +#include +#include +#include +#include + +#include "shweffect.h" + +// CLASS DECLARATION + +/** + * CShwZoomAndPanEffect, the Zoom And Pan effect. + * Zooms and pans in the image in full screen in view mode and performs smooth transition. + * + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + * @internal reviewed 06/06/2007 by Dan Rhodes + */ +NONSHARABLE_CLASS( CShwZoomAndPanEffect ) : public CBase, public MShwEffect + { + public: + + /** + * Contructor. + */ + static CShwZoomAndPanEffect* NewLC(); + /** + * Destructor. + */ + ~CShwZoomAndPanEffect(); + + private: + + /** + * C++ contructor. + */ + CShwZoomAndPanEffect(); + + public: // from MShwEffect + + /// @ref MShwEffect::CloneLC + MShwEffect* CloneLC(); + /// @ref MShwEffect::InitializeL + void InitializeL( + CAlfEnv* aAlfEnv, MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, TSize aScreenSize ); + /// @ref MShwEffect::PrepareViewL + TSize PrepareViewL( CAlfVisual* aVisual, TSize aImageSize ); + /// @ref MShwEffect::EnterViewL + MGlxLayout* EnterViewL( + CAlfVisual* aVisual, TInt aDuration, TInt aFadeInDuration ); + /// @ref MShwEffect::ExitView + void ExitView( CAlfVisual* aVisual ); + /// @ref MShwEffect::EnterTransitionL + MGlxLayout* EnterTransitionL( CAlfVisual* aVisual, TInt aDuration ); + /// @ref MShwEffect::ExitTransition + void ExitTransition( CAlfVisual* aVisual ); + /// @ref MShwEffect::PauseL + void PauseL(); + /// @ref MShwEffect::Resume + void Resume(); + /// @ref MShwEffect:EffectInfo + TShwEffectInfo EffectInfo(); + + private: // Data + + /// Own: the implementation class + class CShwZoomAndPanEffectImpl; + CShwZoomAndPanEffectImpl* iImpl; + + }; + +#endif // __SHWZOOMANDPANEFFECT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwzoomandpanlayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwzoomandpanlayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,389 @@ +/* +* Copyright (c) 2007-2008 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: Layout that performs crossfade + * +*/ + + + + +// Include Files +#include "shwzoomandpanlayout.h" +#include + +#include + +#include + +#include "shwconstants.h" +#include "shwgeometryutilities.h" + +using namespace NShwSlideshow; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +TShwZoomAndPanLayout::TShwZoomAndPanLayout() + : iScreenSize( 0, 0 ), + iImageSize( 0, 0 ), + iPanningCurve( NULL ) // T-class so need to set value + { + __DEBUG_ONLY( _iName = _L("TShwZoomAndPanLayout") ); + // default values + // curve style is linear + iCurvePosition.SetStyle( EAlfTimedValueStyleLinear ); + // set zoom style to sine so it accelerates and decelerates + iZoomedSize.SetStyle( EAlfTimedValueStyleSineWave ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +TShwZoomAndPanLayout::~TShwZoomAndPanLayout() + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// SetSizes +// ----------------------------------------------------------------------------- +TReal32 TShwZoomAndPanLayout::SetSizes( + TSize aScreenSize, TSize aImageSize, TSize aMaximumSize ) + { + GLX_LOG_INFO( "TShwZoomAndPanLayout::SetSizes" ); + // set the size from TSize (integer) to THuiRealSize (float) + iScreenSize.iWidth = aScreenSize.iWidth; + iScreenSize.iHeight = aScreenSize.iHeight; + iImageSize.iWidth = aImageSize.iWidth; + iImageSize.iHeight = aImageSize.iHeight; + // recalculate min and max size for zoom + CalculateMinAndMaxSize( aMaximumSize ); + // calculate zoom factor for iHeight, iWidth is same as aspect ratio is kept + // maximum per minimum + TReal32 zoomFactor = iMaximumSize.iHeight / iMinimumSize.iHeight; + // return zoom factor + return zoomFactor; + } + +// ----------------------------------------------------------------------------- +// SetPanningCurve +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::SetPanningCurve( CAlfCurvePath* aCurve ) + { + iPanningCurve = aCurve; + } + +// ----------------------------------------------------------------------------- +// MaximumSize +// ----------------------------------------------------------------------------- +TSize TShwZoomAndPanLayout::MaximumSize() + { + return iMaximumSize; + } + +// ----------------------------------------------------------------------------- +// ResetSizeToMinimum +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::ResetSizeToMinimum() + { + GLX_LOG_INFO( "TShwZoomAndPanLayout::ResetSizeToMinimum" ); + // set initial size to minimum size +// iZoomedSize.Set( iMinimumSize ); + } + +// ----------------------------------------------------------------------------- +// StartZoom +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::StartZoom( + TZoomDirection aZoomDirection, TInt aDuration ) + { + GLX_LOG_INFO1( + "TShwZoomAndPanLayout::StartZoom( %d )", aDuration ); + + // remember the zoom direction + iZoomDirection = aZoomDirection; + // remember also the zoom duration + iZoomDuration = aDuration; + + // calculate curve position + TInt curveLength = 0; + // set curvelength, if we have curve + if( iPanningCurve ) + { + curveLength = iPanningCurve->Length(); + } + + // default case is to run the first half of the curve + TInt curveStart = 0; + TInt curveEnd = curveLength / 2; + + // change the zoom according to direction + if( EZoomOut == aZoomDirection ) + { + GLX_LOG_INFO2( + "TShwZoomAndPanLayout:: Zooming out start(%.1f,%.1f)", + iMaximumSize.iWidth, iMaximumSize.iHeight ); + GLX_LOG_INFO2( + "TShwZoomAndPanLayout:: Zooming out target(%.1f,%.1f)", + iMinimumSize.iWidth, iMinimumSize.iHeight ); + // zooming out so we start from maximum size + //iZoomedSize.Set( iMaximumSize ); + // target is the minimum size + // iZoomedSize.Set( iMinimumSize, aDuration ); + // run the latter half of the curve + curveStart = curveLength / 2; + curveEnd = curveLength; + } + else // default case is EZoomIn + { + GLX_LOG_INFO2( + "TShwZoomAndPanLayout:: Zooming in start(%.1f,%.1f)", + iMinimumSize.iWidth, iMinimumSize.iHeight ); + GLX_LOG_INFO2( + "TShwZoomAndPanLayout:: Zooming in target(%.1f,%.1f)", + iMaximumSize.iWidth, iMaximumSize.iHeight ); + // zooming in so we start from minimum size +// iZoomedSize.Set( iMinimumSize ); + // target is maximum size +// iZoomedSize.Set( iMaximumSize, aDuration ); + } + + // set position, if we have curve its either from start to half + // or half to end and if we dont then its always 0 + iCurvePosition.Set( curveStart ); + iCurvePosition.Set( curveEnd, aDuration ); + } + +// ----------------------------------------------------------------------------- +// Pause +// ----------------------------------------------------------------------------- +TInt TShwZoomAndPanLayout::InvertZoom() + { + GLX_LOG_INFO( "TShwZoomAndPanLayout::InvertZoom" ); + if( EZoomOut == iZoomDirection ) + { + StartZoom( EZoomIn, iZoomDuration ); + } + else + { + StartZoom( EZoomOut, iZoomDuration ); + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// Pause +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::Pause() + { + GLX_LOG_INFO( "TShwZoomAndPanLayout::Pause" ); + // pause size + iZoomedSize.Pause(); + // pause curve position + iCurvePosition.Pause(); + } + +// ----------------------------------------------------------------------------- +// Resume +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::Resume() + { + GLX_LOG_INFO( "TShwZoomAndPanLayout::Resume" ); + // resume size + iZoomedSize.Resume(); + // resume pan curve + iCurvePosition.Resume(); + } + +// ----------------------------------------------------------------------------- +// DoSetLayoutValues +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::DoSetLayoutValues( TGlxLayoutInfo& aInfo ) + { + // calculate new x size, current value from zoomedsize + TReal32 x_size = iZoomedSize.iWidth.Now(); + // calculate new y size, current value from zoomedsize + TReal32 y_size = iZoomedSize.iHeight.Now(); + + // ensure x is inside maximum size and minimum size + x_size = Min( x_size, iMaximumSize.iWidth ); + x_size = Max( x_size, iMinimumSize.iWidth ); + // set x size, it is now inside the minimum and maximum + //aInfo.iSize.iX = x_size; + + // ensure y is inside maximum size and minimum size + y_size = Min( y_size, iMaximumSize.iHeight ); + y_size = Max( y_size, iMinimumSize.iHeight ); + // set y size, it is now inside the minimum and maximum +// aInfo.iSize.iY = y_size; + + // set position only if we have a panning curve, this enables the use of this + // layout as only a zooming layout and then some other layout can define + // the position (as we dont overwrite 0,0 there...) + if( iPanningCurve ) + { + // need to ensure that position does not make image + // go outside the bounding box. We trust that the curve has + // been calculated so that in 100% zoom it stays inside the image + // so the only thing needed is to ensure zoom keeps the image inside + // the box as well. + // this is done by scaling the position with the current + // zoomfactor per maximum zoomfactor. The scalefactor is between + // 0 and 1; when size is minimum the scale is 0 and when size + // is maximum the scale is 1. + // If we are in minimum size, we cant do any panning and + // if we are in maximum size we can do the maximum pan. + // current zoomfactor is current height per the minimum height + // formula: + // current.y - minimum.y + // scale = --------------------- + // maximum.y - minimum.y + // and need to ensure maximum.y > minimum.y, otherwise scale becomes + // infinite + if( iMaximumSize.iHeight > iMinimumSize.iHeight ) + { +/* TReal32 scale = ( aInfo.iSize.iY - iMinimumSize.iHeight ) / + ( iMaximumSize.iHeight - iMinimumSize.iHeight ); + // multiply the curve with scale + // set x position + aInfo.iPosition.iX = + scale * iPanningCurve->MapValue( iCurvePosition.Now(), 0 ); + // set y position + aInfo.iPosition.iY = + scale * iPanningCurve->MapValue( iCurvePosition.Now(), 1 );*/ + } + else + { + // Panning curve defined but we either zoomed to screen size or + // the image was smaller than or equal to screen size so + // just set position to origo to see image centered on the screen + // aInfo.iPosition.iX = 0; + // aInfo.iPosition.iY = 0; + } + } + } + +// ----------------------------------------------------------------------------- +// DoChanged +// ----------------------------------------------------------------------------- +TBool TShwZoomAndPanLayout::DoChanged() const + { + TBool ret = EFalse; + if( iPanningCurve ) + { +// ret = iPanningCurve->MappingFunctionChanged(); + } + return iZoomedSize.Changed() || ret; + } + +// ----------------------------------------------------------------------------- +// DoClearChanged +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::DoClearChanged() + { + iZoomedSize.ClearChanged(); + if( iPanningCurve ) + { +// iPanningCurve->MappingFunctionClearChanged(); + } + } + +// ----------------------------------------------------------------------------- +// CalculateMinAndMaxSize +// ----------------------------------------------------------------------------- +void TShwZoomAndPanLayout::CalculateMinAndMaxSize( TSize aMaximumSize ) + { + // use the namespace for coord utilities + using namespace NShwGeometryUtilities; + + // set minimum size to be the image size + iMinimumSize.iWidth = iImageSize.iWidth; + iMinimumSize.iHeight = iImageSize.iHeight; + + // scale minimum size inside the screen + FitToCoverBox( + iMinimumSize.iWidth, + iMinimumSize.iHeight, + iScreenSize.iWidth, + iScreenSize.iHeight ); + + // check if the image is large enough for zooming + TReal32 zoomFactor = + ( iImageSize.iWidth * iImageSize.iHeight ) / + ( iScreenSize.iWidth * iScreenSize.iHeight ); + // if combined zoom factor is big enough then zoom + // so if image is for example half the width but double the height of screen + // we dont zoom + if( zoomFactor > KMinZoomAndPanFactor ) + { + // the image should be zoomed, figure out if its + // from screen size -> image size * KOptimalZoomAndPanFactor or + // from screen size -> image size * KMaxZoomAndPanFactor + // set maximum size to image dimensions multiplied + // by KShwOptimalZoomAndPanFactor + // this defines how much we want the max zoom + // to be in optimal case + iMaximumSize.iWidth = iImageSize.iWidth * KOptimalZoomAndPanFactor; + iMaximumSize.iHeight = iImageSize.iHeight * KOptimalZoomAndPanFactor; + // check if the image is large enough for zooming, + // only need to check either coordinate as aspect ratio is kept + // Images between screen size and screen size * KMaxZoomAndPanFactor + // get zoomed between screen size and screen size * KMaxZoomAndPanFactor + if( ( iMaximumSize.iWidth < iMinimumSize.iWidth * KMaxZoomAndPanFactor )|| + ( iMaximumSize.iHeight < iMinimumSize.iHeight * KMaxZoomAndPanFactor ) ) + { + // image is too small from either dimension + // so zoom from minimum size to Screen x KMaxZoomAndPanFactor + FitToCoverBox( + iMaximumSize.iWidth, + iMaximumSize.iHeight, + iScreenSize.iWidth * KMaxZoomAndPanFactor, + iScreenSize.iHeight * KMaxZoomAndPanFactor ); + } + // calculate maximum Width and Height for this image + // the maximum thumbnailsize defines the maximum amount of pixels + // we should ever load. We need to adjust this box to have the + // same aspect ratio of the image; so in short: + // same amount of pixels than maximum but aspect ratio of image + TReal32 maxWidth = aMaximumSize.iWidth; + TReal32 maxHeight = aMaximumSize.iHeight; + // calculate the image size difference and take square root to get + // multiplier for both width and height, ignore error + // maximumWidth * maximumHeight + // multiplier = sqrt( ---------------------------- ) + // imagewidth * imageheight + TReal64 multiplier; + (void)Math::Sqrt( multiplier, + ( maxHeight * maxWidth ) / + ( iImageSize.iWidth * iImageSize.iHeight ) ); + // maxwidth = imagewidth * multiplier + TReal32 maximumWidth = multiplier * iImageSize.iWidth; + // maxheight = imageheight * multiplier + TReal32 maximumHeight = multiplier * iImageSize.iHeight; + // then fit the maximum size inside that box + FitInsideBox( + iMaximumSize.iWidth, iMaximumSize.iHeight, + maximumWidth, maximumHeight ); + } + else + { + // not enough to zoom so just streth to screen size. + // set maximum to be minimum + iMaximumSize.iWidth = iMinimumSize.iWidth; + iMaximumSize.iHeight = iMinimumSize.iHeight; + } + + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/effectsrc/shwzoomandpanlayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/effectsrc/shwzoomandpanlayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2007-2008 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: Layout that performs zoom and fade + * +*/ + + + + +#ifndef __SHWZOOMANDPANLAYOUT_H__ +#define __SHWZOOMANDPANLAYOUT_H__ + +#include +//#include +#include +#include + +#include "shwtimedvalue.h" + +// FORWARD DECLARATIONS +class CHuiCurvePath; + +/** + * TShwZoomAndPanLayout + * Handles zooming and panning a visual + * + * @author Kimmo Hoikka + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + * @internal reviewed 06/06/2007 by Dan Rhodes + */ +NONSHARABLE_CLASS( TShwZoomAndPanLayout ) : public TGlxLayout + { + public: + + /** + * Enumeration for zoom direction. + */ + enum TZoomDirection + { + EZoomIn = 1, // Zoom in, from minimum to maximum size + EZoomOut = 2 // Zoom out, from maximum to minimum size + }; + + /** + * Constructor, initializes the layout. + */ + TShwZoomAndPanLayout(); + + /** + * Destructor + */ + ~TShwZoomAndPanLayout(); + + /** + * Sets the screen and image size + * @param aScreenSize the size of the screen. + * @param aImageSize the size of the image. + * @param aMaximumSize the maximum ever size for the image + * @return the zoom factor, this enables the client to deside + * if it makes sense to do any zoomimg + */ + TReal32 SetSizes( + TSize aScreenSize, TSize aImageSize, TSize aMaximumSize ); + + /** + * Sets the curve for pan. The curve must be defined so that in + * 100% zoom it stays inside the image (no black borders shown) + * basically this means a box inside image coordinates: + * xi = image.width/2; + * yi = image.height/2; + * + * (-xi,yi)-------------(xi,yi) + * | (-xb,yb)-------(xb,yb) | + * | | | | + * | (-xb,-yb)-----(xb,-yb) | + * (-xi,-yi)-----------(xi,-yi) + * + * where: + * xb = xi - screen.width/2; + * yb = yi - screen.height/2; + * + * During zoom the panning curve is scaled according to current + * zoom factor so that no black borders show in zoom factors < 100% + * + * @param aCurve the curve to use for the panning. + */ + void SetPanningCurve( CAlfCurvePath* aCurve ); + + /** + * This method returns the maximum zoom size for the image + * Should not be called before before SetSizes is called + * @return the maximum size as TSize + */ + TSize MaximumSize(); + + /** + * This method resets the size to minimum. Usefull when you dont + * want to do zoom & pan (for example the image is too small) + */ + void ResetSizeToMinimum(); + + /** + * This method starts the zooming. If a pannig curve is used + * it should be set before calling this method. Note, for zoom in + * the layout uses the first half of the curve and for zoom out + * the latter half; this enables you to use an ellipsis to have + * looping zoomin + * + * @param aZoomDirection the desired zoom direction + * @param aDuration the length of the zoom loop + */ + void StartZoom( TZoomDirection aZoomDirection, TInt aDuration ); + + /** + * This method inverts the zoom the opposite way + */ + TInt InvertZoom(); + + /** + * This method pauses zoom and pan + */ + void Pause(); + + /** + * This method resumes zoom and pan after pause. + */ + void Resume(); + + protected: // From TGlxLayout + + /// @ref TGlxLayout::DoSetLayoutValues + void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + /// @ref TGlxLayout::DoChanged + TBool DoChanged() const; + /// @ref TGlxLayout::DoClearChanged + void DoClearChanged(); + + private: // Data and private parts + + /// Helper to calculate minimum and maximum size + void CalculateMinAndMaxSize( TSize aMaximumSize ); + /// Own: Screen size + TAlfRealSize iScreenSize; + /// Own: Image size + TAlfRealSize iImageSize; + /// Own: the maximum size + TAlfRealSize iMaximumSize; + /// Own: the minimum size + TAlfRealSize iMinimumSize; + /// Own: the zoom direction + TZoomDirection iZoomDirection; + /// Own: the zoom duration + TInt iZoomDuration; + /// Own: the zoomed size + TShwTimedSize iZoomedSize; + /// Own: Pan curve position + TShwTimedValue iCurvePosition; + /// Ref: Pan curve + CAlfCurvePath* iPanningCurve; + + }; + +#endif // __SHWZOOMANDPANLAYOUT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow INF component + * +*/ + + + + +#include + +PRJ_TESTEXPORTS + +PRJ_EXPORTS + +/* + * In order to rebuild the slideshow setting central repository uncomment the + * first line below and the line begining "gnumakefile", then rebuild the + * project + * + * If the gnumakefile tool be missing from your development environment + * then follow these steps + * + * 1. if the initial central repository values are to be reset, then the + * epoc32/WINSCW/C/private/10202be9/persists/200071d3.cre needs to be + * manually deleted + * 2. rebuild the txt file by calling + * /epoc32/tools/cenrep>generate_cenrep_inifile.pl -r 3.1 + * -d S:/mgallery/slideshow/engine/cenrep + * -rd S:/mgallery/slideshow/engine/cenrep\ + * + */ +../cenrep/200071D3.txt /epoc32/data/z/private/10202be9/200071d3.txt +../cenrep/200071D3.txt /epoc32/release/winscw/udeb/z/private/10202be9/200071d3.txt + +// Generic configuration interface for component cenrep settings +../../../conf/slideshow.confml CONFML_EXPORT_PATH(slideshow.confml,customsw) +../../../conf/slideshow_200071D3.crml CRML_EXPORT_PATH(slideshow_200071D3.crml,customsw) +PRJ_MMPFILES +shwslideshowengine.mmp + +// @to build cenrep : Uncomment this line and rebuild the project- c note above +// gnumakefile bld_cenrep_entry.mk + +PRJ_TESTMMPFILES diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/group/bld_cenrep_entry.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/group/bld_cenrep_entry.mk Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,45 @@ +# +# 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: make file +# + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + erase %epocroot%epoc32\release\winscw\udeb\z\private\10202be9\200071d3.cre + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE :do_nothing + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : do_nothing + +FINAL : + echo Creating the Slideshow Engine Central Repository entries + call %epocroot%epoc32\release\winscw\udeb\CentRepConv -nowait 200071d3.txt + copy %epocroot%epoc32\winscw\c\200071d3.cre %epocroot%epoc32\release\winscw\udeb\z\private\10202be9\200071d3.cre + erase %epocroot%epoc32\winscw\c\200071d3.cre + echo Erased temporary files + echo Finished creating the Slideshow Engine Central Repository entries \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/group/possible_state_transitions.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/group/possible_state_transitions.txt Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,14 @@ +Slideshow state transitions: +[view] -> [transition] +[view] -> pause -> resume -> [view] -> [transition] +[view] -> navigate forward -> [view] -> [transition] +[view] -> navigate backward -> [view] -> [transition] +[view] -> pause -> navigate forward -> [view] -> resume -> [view] -> [transition] +[view] -> pause -> navigate backward -> [view] -> resume -> [view] -> [transition] +[transition] -> pause -> resume -> [transition] -> [view] +[transition] -> navigate forward -> [view] -> [transition] +[transition] -> navigate backward -> [view] -> [transition] +[transition] -> pause -> navigate forward -> [view] -> resume -> [view] -> [transition] +[transition] -> pause -> navigate backward -> [view] -> resume -> [view] -> [transition] + +Image can be loaded before navigate or it can load after navigate diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/group/shwslideshowengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/group/shwslideshowengine.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow engine build file + * +*/ + + + +#include +#include + +#include "../../../inc/glxcapabilities.hrh" +#include "../../../group/glxbuildcommon.mmh" +#include "../../../inc/glxalfhelper.mmh" + +TARGET shwslideshowengine.dll +TARGETTYPE dll +UID 0x1000008d 0x200071D3 // real UID reserved + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY GLX_CAPABILITIES + +APP_LAYER_SYSTEMINCLUDE + +// slideshow internal headers +USERINCLUDE ../inc +USERINCLUDE ../coresrc +USERINCLUDE ../controlsrc +USERINCLUDE ../effectsrc +USERINCLUDE ../../utils + +// mc photos dependencies +// for mgallery medialist +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../viewframework/medialists/inc +// for mgallery visuallist +SYSTEMINCLUDE ../../../viewframework/visuallistmanager/inc +// for mgallery layouts +SYSTEMINCLUDE ../../../viewframework/layouts/inc +// for attribute retriever +SYSTEMINCLUDE ../../../viewframework/uiutilities/inc +// for CGlxResourceUtilities +SYSTEMINCLUDE ../../../common/inc +SYSTEMINCLUDE ../../../commonui/inc +SYSTEMINCLUDE ../../../gallery/loc + + + +SOURCEPATH ../coresrc +SOURCE enginedllmain.cpp +SOURCE shwplaybackfactory.cpp +SOURCE shwslideshowengine.cpp +SOURCE shwslideshowengineimpl.cpp +SOURCE shwhuiutility.cpp +SOURCE shwthumbnailloader.cpp +SOURCE shwsettingsmodel.cpp +SOURCE shwtimer.cpp +SOURCE shwthumbnailcontext.cpp + +SOURCEPATH ../controlsrc +SOURCE shweffectcontrol.cpp +SOURCE shwevent.cpp +SOURCE shweventpublisherbase.cpp +SOURCE shweventrouter.cpp +SOURCE shwtimercontrol.cpp +SOURCE shwviewcontrol.cpp +SOURCE shwmusiccontrol.cpp + +SOURCEPATH ../effectsrc +SOURCE shwdefaulteffectmanager.cpp +SOURCE shwcrossfadeeffect.cpp +SOURCE shwcrossfadelayout.cpp +SOURCE shwzoomandpaneffect.cpp +SOURCE shwzoomandpanlayout.cpp +SOURCE shwresourceutility.cpp +SOURCE shwcurvefactory.cpp + +// view resource +START RESOURCE ../data/shwslideshowengine.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +LIBRARY euser.lib + +// mgallery dependencies +LIBRARY glxmedialists.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY glxlayouts.lib +LIBRARY glxuiutilities.lib // for attribute retrieval +LIBRARY glxcommon.lib // for CResourceUtilities + +// HUI +LIBRARY hitchcock.lib +LIBRARY alfclient.lib +// For music playback +LIBRARY mpxplaybackutility.lib // efsrv.lib already included below + +// For central repository +LIBRARY centralrepository.lib + +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY mpxcommon.lib +LIBRARY avkon.lib +LIBRARY eikcore.lib + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwconstants.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007-2008 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: The effect interface + * +*/ + + + + +#ifndef __SHWCONSTANTS_H__ +#define __SHWCONSTANTS_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +/** + * Namespace for slideshow constants. + */ +namespace NShwSlideshow + { + enum TPlayDirection + { + EPlayForwards = 1, // default + EPlayBackwards, + EPlayRandom + }; + + // Named constants for navigation directions + // to avoid "magic number" warnings + const TInt KNavigateForwards = 1; + const TInt KNavigateBackwards = -1; + + // Engine DLL's uid + const TUid KEngineDllUid = {0x200071D3}; + + // First visual fade-in time, also applies when user navigates + const TInt KFirstEffectFadeInDuration = 0; + // default transition duration, milliseconds + const TInt KDefaultTransitionDuration = 2000; + + // @todo get correct UID for effect types + /** + The effect Id is a combination of the ecom plugin UID and an array index + within the plugin. + */ + const TUid KDefaultEffectPluginUid = { 0x200071D6 }; + + // Crossfade effects name - used if no localised strings are available + _LIT( KEffectNameCrossFade, "Cross Fade" ); + + // maximum opacity for TShwCrossFadeLayout + const TReal32 KMaxOpacity = 1.0; + // minimum opacity for TShwCrossFadeLayout + const TReal32 KMinOpacity = 0.0; + + // effect Index - the index within the ecom plugin + const TInt KEffectUidXFadeNormal = 1; + const TInt KEffectUidZoomAndPan = 0; + + // Zoom and Pan effect's name - used if no localised strings are available + _LIT( KEffectNameZoomAndPan, "Zoom and Pan" ); + // maximum zoom ever is 200%, note that this should + // not be larger than MaxThumbnailSize + const TReal32 KMaxZoomAndPanFactor = 2.0; + // optimal zoom is 100% + const TReal32 KOptimalZoomAndPanFactor = 1.0; + // this defines the minimum zoom factor, + // 1.2 means we zoom images that are originally larger than 120% of the screen + const TReal32 KMinZoomAndPanFactor = 1.2; + // this constant specifies the length of the curve for panning + const TInt KZoomAndPanCurveLength = 100; + + // set the maximum loaded thumbnail size to be 2 times the screen + // note that this should not be smaller than KMaxZoomAndPanFactor + // otherwise we zoom beyond 1:1 pixelsize in big pictures + const TInt KMaxThumbnailSize = 2; + + // maximum effect name length + const TUint KMaxEffectNameLen = 64; + + /// Thumbnail loading + // priority 2 is the highest we use, we need size + // attribute to be loaded first + const TInt KSizeContextPriority = 2; + // load image sizes 4 items in front and back + const TInt KSizeContextOffset = 4; + + // lowest priority for the high quality context + // because we have time to wait as we have + // default icon to show + const TInt KHighQualityContextPriority = 0; + } + +#endif // __SHWCONSTANTS_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwconstants.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwconstants.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2007-2008 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: The effect interface + * +*/ + + + + +#ifndef __SHWCONSTANTS_HRH__ +#define __SHWCONSTANTS_HRH__ + + +// Note: KMaxTransDelay is defined in the shwconstants.h for the +// standard c++ files. If this value is changed so too must the .h value +// be changed. + +#define KMaxTransDelay 15 +#define KMinTransDelay 2 +#define KTransDelayStep 1 + + +#endif // __SHWCONSTANTS_HRH__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shweffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shweffect.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2007-2008 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: The effect interface + * +*/ + + + + +#ifndef __SHWEFFECT_H__ +#define __SHWEFFECT_H__ + +// INCLUDES +#include +#include +#include +#include + +#include "shweffectinfo.h" + +// FORWARD DECLARATIONS +class MGlxVisualList; +class MGlxMediaList; +class CAlfEnv; +class MGlxLayout; +class CAlfVisual; +class TShwEffectInfo; + +// CLASS DECLARATION +/** + * MShwEffect, interface for the effects. + * Effect gets the visual and media list and the HUI environment in + * initialisation as well as the screen size. + */ +class MShwEffect + { + public: // Construction & destruction + + /** + * Destructor. Allow deletion through this interface + */ + virtual ~MShwEffect() {}; + + /** + * Clone the effect, this is needed when same effect + * is used multiple times in a row. + * @return a clone of the effect. + */ + virtual MShwEffect* CloneLC() = 0; + + public: // the API + + /** + * Initialize the effect. + * @param aHuiEnv, the HUI environment for the slideshow + * @param aVisualList, the visual list used for the slideshow + * @param aMediaList, the media list used for the slideshow + * @param aScreenSize, the screen size for the slideshow + */ + virtual void InitializeL( + CAlfEnv* aAlfEnv, + MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, + TSize aScreenSize ) = 0; + + /** + * This method is called before the view mode of the effect for + * the given visual is about to start + * @param aVisual the HUI visual that is the target for the effect + * @param aSize the size of the image to view + * @param the size of the thumbnail to load for the effect + */ + virtual TSize PrepareViewL( + CAlfVisual* aVisual, TSize aImageSize ) = 0; + + /** + * Enter view mode. The effect may fade-in itself, + * the duration for this is given as a parameter. + * @param aVisual the HUI visual that is the target for the view + * @param aDuration the whole view mode time + * @param aFadeInDuration the entry "fade-in" time + * @return the layout chain that applies for the view mode + */ + virtual MGlxLayout* EnterViewL( + CAlfVisual* aVisual, TInt aDuration, TInt aFadeInDuration ) = 0; + + /** + * Exit view mode. This gets called just before the transition + * phase starts. + * @param aVisual the HUI visual that was the target for the view + */ + virtual void ExitView( CAlfVisual* aVisual ) = 0; + + /** + * Enter transition mode. The duration for the transition is given + * as a parameter, during this time the effect can animate its exit. + * @param aVisual the HUI visual that is the target for the transition + * @param aDuration the length of the transition + * @return the layout chain that applies for the transition mode + */ + virtual MGlxLayout* EnterTransitionL( + CAlfVisual* aVisual, TInt aDuration ) = 0; + + /** + * Exit from transition mode. This method is called once the transition + * has ended and the corresponding visual is no longer visible on screen. + * @param aVisual the HUI visual that was the target for the transition + */ + virtual void ExitTransition( CAlfVisual* aVisual ) = 0; + + /** + * Go to pause. While on pause the effect is expected to be frozen + */ + virtual void PauseL() = 0; + + /** + * Resume from pause. + */ + virtual void Resume() = 0; + + /** + * Encapsulates the effect's display name and uid + * @return the effect's information + */ + virtual TShwEffectInfo EffectInfo() = 0; + + }; + +#endif // __SHWEFFECT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shweffectinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shweffectinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2007-2008 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: The effect info class + * +*/ + + + + +#ifndef __SHWEFFECTINFO_H__ +#define __SHWEFFECTINFO_H__ + +// INCLUDES +#include +#include + +#include "shwconstants.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** + * TShwEffectInfo, encapsulates the human readable name + * and the uid of an effect. + */ +NONSHARABLE_CLASS( TShwEffectInfo ) + { + public: + /** + * Constructor. Initializes the object + */ + inline TShwEffectInfo() + : iName( 0 ), + iId( KNullUid ) + {} + + /** + * Assignment operator. Ensure that data members get + * properly set + */ + inline void operator=( const TShwEffectInfo& aRhs ) + { + // need to set value as TPtrC does not have assignment + // operator + iName = aRhs.iName; + iId = aRhs.iId; + } + + /** + * Comparison operator. + * @param aRhs, the object to compare against + */ + inline TBool operator==( const TShwEffectInfo& aRhs ) + { + // just check the id + return iId == aRhs.iId; + } + + public: + + /** + * Helper struct to identify the effects + */ + struct TEffectId + { + /** + * Default constructor + */ + inline TEffectId (TUid aEffectUid, TInt aEffectIndex = 0) + : iPluginUid (aEffectUid), iIndex (aEffectIndex) + { + } + + /** + * Comparison operator + * @param aRhs, the object to compare against + */ + inline TBool operator==( const TEffectId& aRhs ) + { + return iPluginUid == aRhs.iPluginUid && + iIndex == aRhs.iIndex; + } + + TUid iPluginUid; + TUint iIndex; + }; + + TEffectId iId; + TBuf< NShwSlideshow::KMaxEffectNameLen > iName; + + }; + + + +#endif // __SHWEFFECTINFO_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shweffectmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shweffectmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2007-2008 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: The effect manager interface + * +*/ + + + + +#ifndef __MSHWEFFECTMANAGER_H__ +#define __MSHWEFFECTMANAGER_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MShwEffect; +class TShwEffectInfo; + +// CLASS DECLARATION + +/** + * MShwEffectManager + * @internal reviewed 07/06/2007 by Loughlin + */ +class MShwEffectManager + { + public: + /** + * The order that the effects are shown. + */ + enum TShwEffectOrder + { + EEffectOrderLinear, + EEffectOrderRandom, + EEffectOrderProgrammed + }; + + protected: + + /** + * Destructor. Dont allow deleting objects through this interface. + */ + virtual ~MShwEffectManager() {}; + + public: // the API + + /** + * This method is used by the framework to give the effect manager the + * ownership of the effect objects. + * @param aEffect a effect + */ + virtual void AddEffectL( MShwEffect* aEffect ) = 0; + + /** + * @return the current effect object. + */ + virtual MShwEffect* CurrentEffect() = 0; + + /** + * @param aIndex the direction that the list is traversed to retrieve + * the effect. A positive value gets a "next" effect, + * negative gets "previous". + * @return the next effect object. Note! this may be the same as current + */ + virtual MShwEffect* Effect(TInt aDirection) = 0; + + /** + * Tells the effect manager to proceed to the next or previous effect. + * @param aDirection, positive for "next" or negative + * for "previous" effect. + */ + virtual void ProceedToEffect( TInt aDirection ) = 0; + + /** + * Sets the effect order. + * @param aOrder the order in which the effects are retrieved. + */ + virtual void SetEffectOrder( TShwEffectOrder aOrder ) = 0; + + /** + * @return the effect order. + */ + virtual TShwEffectOrder EffectOrder() = 0; + + /** + * Sets the programmable effect order. + * Note that the effect order must be set to + * EShwEffectOrderProgrammable for the parameter to be stored. + * @param aEffects array of effects + */ + virtual void SetProgrammedEffects( RArray< TShwEffectInfo >& + aEffects ) = 0; + + /** + * Sets the default effect to use. + * @param aInfo effect info + */ + virtual void SetDefaultEffectL(TShwEffectInfo aInfo) = 0; + + /** + * Gets the active effects. + * This array will contain pointers to all the effects that + * are used in this show + * @param aEffects array of effects + */ + virtual void GetActiveEffectsL( RPointerArray< MShwEffect >& + aEffects ) = 0; + + }; + +#endif // __MSHWEFFECTMANAGER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwengineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwengineobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2007-2008 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: The event observer interface + * +*/ + + + + +#ifndef __MSHWENGINEOBSERVER_H__ +#define __MSHWENGINEOBSERVER_H__ + +// INCLUDES +#include +#include + +// CLASS DECLARATION + +/** + * MShwEventObserver + */ +class MShwEngineObserver + { + protected: + + /** + * Destructor. Dont allow deleting objects through this interface. + */ + virtual ~MShwEngineObserver() {}; + + public: // the API + + /** + * This notification is called once the engine is started, + * meaning that the slideshow is running. + */ + virtual void EngineStartedL() = 0; + + /** + * This notification is called once the engine is paused, + * meaning that the slideshow is frozen. + */ + virtual void EnginePausedL() = 0; + + /** + * This notification is called once the engine is resumed, + * meaning that the slideshow is re-running after a pause + */ + virtual void EngineResumedL() = 0; + + /** + * This notification is called once the selection key, EngineLSKPressedL + * pressed. + */ + virtual void EngineToggleUiStateL() = 0; + + /** + * LSk pressed. + */ + virtual void EngineLSKPressedL() = 0; + + /** + * This notification is called when there is such an error during + * slideshow that it cannot continue, for example all items got removed. + * This method is allowed to leave, in which case slideshow engine panics + * with EEngineFatalError. This is ok as in case of error all we can do is + * try to exit slideshow, either easy way or hard way :) + * @exception EEngineFatalError if this method does leave. + */ + virtual void ErrorDuringSlideshowL() = 0; + + }; + +#endif // __MSHWENGINEOBSERVER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwevent.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2007-2008 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: The event interface + * +*/ + + + + +#ifndef __SHWEVENT_H__ +#define __SHWEVENT_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** + * MShwEvent, interface for event objects + */ +class MShwEvent + { + public: + + /** + * Destructor, Allow deletion through this interface, + * If the event queue needs a copy of the event object it needs to delete the copy. + */ + virtual ~MShwEvent() {}; + + public: // the API + + /** + * This method returns a permanent copy the event object. + * This is needed so that the event queue can keep a pointer to the + * event while the event sending code goes out of scope. + * This method needs to store the original object to cleanupstack + * @return a clone of the event object + */ + virtual MShwEvent* CloneLC() = 0; + + }; + +/** + * TShwParametrizedEvent, event object with a value + */ +NONSHARABLE_CLASS( TShwParametrizedEvent ) : public MShwEvent + { + public: + + /** + * Constructor. + * @param aValue, the value for the parameter + */ + TShwParametrizedEvent( TInt aValue ); + + /** + * Destructor. + */ + ~TShwParametrizedEvent(); + + /** + * This method can be used to get a named parameter from the event. + * @return the integer value + */ + TInt Parameter(); + + private: + /// Own: the value + TInt iValue; + }; + +// Macro to avoid copy & pasting similar code throughout the event classes +#define SHW_DECLARE_EVENT_CLASS( cls ) \ +NONSHARABLE_CLASS( cls ) : public MShwEvent { \ + public: \ + /** Constructor */\ + cls(); \ + /** Destructor */\ + ~cls(); \ + /** @see MShwEvent::CloneLC() */\ + MShwEvent* CloneLC(); }\ + +#define SHW_DECLARE_PARAMETER_EVENT_CLASS( cls ) \ +NONSHARABLE_CLASS( cls ) : public TShwParametrizedEvent { \ + public: \ + /** Constructor */\ + cls( TInt aValue ); \ + /** Destructor */\ + ~cls(); \ + /** @see MShwEvent::CloneLC() */\ + MShwEvent* CloneLC(); } \ + +/** + * Initialize slide show + */ +SHW_DECLARE_EVENT_CLASS( TShwEventInitialize ); + +/** + * Start the slide show + */ +SHW_DECLARE_EVENT_CLASS( TShwEventStart ); + +/** + * Pause the slide show + */ +SHW_DECLARE_EVENT_CLASS( TShwEventPause ); + +/** + * Resume from pause + */ +SHW_DECLARE_EVENT_CLASS( TShwEventResume ); + +/** + * Next image by the user + */ +SHW_DECLARE_EVENT_CLASS( TShwEventNextImage ); + +/** + * Previous image by the user + */ +SHW_DECLARE_EVENT_CLASS( TShwEventPreviousImage ); + +/** + * Timer beat occurred + */ +SHW_DECLARE_EVENT_CLASS( TShwEventTimerBeat ); + +/** + * View mode is starting + */ +SHW_DECLARE_PARAMETER_EVENT_CLASS( TShwEventStartView ); + +/** + * Ready to start viewing current slide + */ +SHW_DECLARE_EVENT_CLASS( TShwEventReadyToView ); + +/** + * Ready to advance to next slide + */ +SHW_DECLARE_EVENT_CLASS( TShwEventReadyToAdvance ); + +/** + * Transition mode is starting + */ +SHW_DECLARE_PARAMETER_EVENT_CLASS( TShwEventStartTransition ); + +/** + * Transition mode is ready + */ +SHW_DECLARE_EVENT_CLASS( TShwEventTransitionReady ); + +/** + * Music volume is adjusted down + */ +SHW_DECLARE_EVENT_CLASS( TShwEventVolumeDown ); + +/** + * Music volume is adjusted up + */ +SHW_DECLARE_EVENT_CLASS( TShwEventVolumeUp ); + +/** + * Exit slide show because of an error + */ +SHW_DECLARE_EVENT_CLASS( TShwEventFatalError ); + +/** + * Selection key pressed for changed ui state (Hide or visible) + */ +SHW_DECLARE_EVENT_CLASS( TShwEventToggleControlUi ); + + +#endif // __SHWEVENT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwmusicobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwmusicobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2007-2008 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: Music control observer interface +* +*/ + + + + +#ifndef __MSHWMUSICOBSERVER_H__ +#define __MSHWMUSICOBSERVER_H__ + +#include + +/*! + @class MShwMusicObserver + + @discussion Observes for changes in the music controls volume and on/off state + MPX-specific + */ +class MShwMusicObserver + { + public: + + /** + * Notification that music is playing. + * If this method leaves, MusicOff will + * be called. + */ + virtual void MusicOnL() = 0; + + /** + * Notification that music is not playing + */ + virtual void MusicOff() = 0; + + /** + * Notification that music volume has changed + * @param aCurrentVolume The current volume + * @param aCurrentVolume The maximum volume + */ + virtual void MusicVolumeL( TInt aCurrentVolume, TInt aMaxVolume ) = 0; + + /** + * Notification that music track had an error + * @param aErrorCode The error code + */ + virtual void ErrorWithTrackL( TInt aErrorCode ) = 0; + + protected: + + /** + * Destructor. No deletion through this interface. + */ + virtual ~MShwMusicObserver() {}; + + }; + +#endif // __MSHWMUSICOBSERVER_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwsettingsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwsettingsmodel.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2007-2008 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: The settings model for the slideshow + * +*/ + + + + +#ifndef __CSHWSETTINGSMDL_H__ +#define __CSHWSETTINGSMDL_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATIONS + +/** + * CShwSettingsModel + * Stores and reads user definable settings for the slideshow + * @internal reviewed 08/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CShwSettingsModel ) : public CBase + { + public: // Constructors and destructor + /** + * Symbian two stage Constructor. + * @return contructed object + */ + IMPORT_C static CShwSettingsModel* NewL(); + + /** + * Destructor. + */ + IMPORT_C ~CShwSettingsModel(); + + private: // member functions + /** + * C++ constructor. + */ + CShwSettingsModel(); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + public: // member funtions + + + /** + * Retrieve the persisted play order setting value. + * @retrun the play order + */ + IMPORT_C TInt PlayOrderL(); + + /** + * Persist the play order setting value. + * @param [in] the play order to be persisted + */ + IMPORT_C void SavePlayOrderL(TInt aOrder); + + /** + * Persist the music on/off setting value. + * @param [in] the music state to be persisted + */ + IMPORT_C void SaveMusicStateL(TInt aMusicState); + + /** + * Retrieve the persisted music on/off setting value. + * @retrun the music on/off state + */ + IMPORT_C TInt MusicOnL() const; + + /** + * Persist the music name and path value. + * @param [in] the music name and path to be persisted + */ + IMPORT_C void SaveMusicNamePathL(const TDesC& aMusicNamePath); + + /** + * Retrieve the persisted music name and path. + * @param [out] the music name and path + */ + IMPORT_C void MusicNamePathL(TDes& aMusicNamePath) const; + + /** + * Persist the transition delay between images. + * @param [in] the transition delay value to be persisted + */ + IMPORT_C void SaveTransDelayL(TInt aTransDelay); + + /** + * Retrieve the persisted transition delay between images. + * @return the transition delay value + */ + IMPORT_C TInt TransDelayL() const; + + /** + * Persist the transition effect type between images. + * @param [in] aEffectUid the transition effect type ECom Uid to be persisted + * @param [in] aEffectIndex the transition effect index to be persisted + * @ref TTransEffectType + */ + + IMPORT_C void SaveTransitionTypeL(const TUid aEffectUid, const TUint aEffectIndex); + /** + * Retrieve the persisted the transition effect type between images. + * @param [out] aEffectUid the transition effect type ECom Uid to be persisted + * @param [out] aEffectIndex the transition effect index to be persisted + * @ref TTransEffectType + */ + IMPORT_C void TransitionTypeL(TUid& aEffectUid, TUint& aEffectIndex) const; + + private: // member variables + + /// The implementation of the class, hidden from the clients + class CShwCenRepWatcher ; + /// Owns: watcher for persisted play backward in time/forward in time value + CShwCenRepWatcher* iPlayOrder; + /// Owns: watcher for persisted music on/off value + CShwCenRepWatcher* iMusicOnOffWatcher; + /// Owns: watcher for persisted music location & name value + CShwCenRepWatcher* iMusicNamePathWatcher; + /// Owns: watcher for persisted transition (between images) delay value + CShwCenRepWatcher* iTransDelayWatcher; + /// Owns: watcher for persisted transition type value + CShwCenRepWatcher* iTransTypeWatcher; + /// Owns: watcher for persisted transition index value + CShwCenRepWatcher* iTransIndexWatcher; + }; + +#endif // __CSHWSETTINGSMDL_H__ + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwslideshowengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwslideshowengine.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2007-2008 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: This file defines the API for ShwSlideshowEngine.dll + * +*/ + + + + +#ifndef __SHWSLIDESHOWENGINE_H__ +#define __SHWSLIDESHOWENGINE_H__ + +// Include Files +#include +#include +#include +#include + +// Forward declarations +class CAlfEnv; +class CAlfDisplay; +class MGlxMediaList; +class MShwEngineObserver; +class CShwSlideshowEngineImpl; +class TShwEffectInfo; +class MShwMusicObserver; + +// Class Definition +/** + * CShwSlideshowEngine + * + * This is the main API for the slideshow engine + * + * @author Kimmo Hoikka + * @lib shwslideshowengine.lib + * @internal reviewed 07/06/2007 by Loughlin + */ +NONSHARABLE_CLASS( CShwSlideshowEngine ) : public CBase + { + public: + + /** + * The state of the engine. + */ + enum TShwState + { + EShwStateInitialized = 1, + EShwStateRunning, + EShwStatePaused + }; + + public: // Construction + + /** + * Constructor + * @param aObserver, observer of the engine. + */ + IMPORT_C static CShwSlideshowEngine* NewL( + MShwEngineObserver& aObserver ); + + /** + * Destructor + */ + IMPORT_C ~CShwSlideshowEngine(); + + public: // the API + + /** + * This method starts the slideshow. + * @param CHuiEnv& the HUI environment to use + * @param CHuiDisplay& the HUI display to draw the list to + * @param MGlxMediaList& the items to show. + * @param MShwMusicObserver& the music control observer. + * @param aScreenSize the size for the slideshow screen + */ + IMPORT_C void StartL( CAlfEnv& aEnv, CAlfDisplay& aDisplay, + MGlxMediaList& aItemsToShow, + MShwMusicObserver& aMusicObserver, + TSize aScreenSize ); + + /** + * This method commands engine to proceed to next item. + */ + IMPORT_C void NextItemL(); + + /** + * This method commands engine to proceed to previous item. + */ + IMPORT_C void PreviousItemL(); + + /** + * This method pauses the slideshow + */ + IMPORT_C void PauseL(); + + /** + * This method resumes the paused slideshow + */ + IMPORT_C void ResumeL(); + + /** + * This method returns the state of the slideshow + * @return the state of the engine + */ + IMPORT_C TShwState State() const; + + /** + * This method retrieves the available effects + * @param an array where the effect infos are added + */ + IMPORT_C static void AvailableEffectsL(RArray& aEffects); + + /** + * This method increases the volume + */ + IMPORT_C void VolumeUpL(); + + /** + * This method decreases the volume + */ + IMPORT_C void VolumeDownL(); + + /** + * This method change the ui staus in slideshow when MSK Preesed + */ + IMPORT_C void ToggleUiControlsVisibiltyL(); + + /** + * This method react when LSK Preesed + */ + IMPORT_C void LSKPressedL(); + + private: // Implementation + + /// C++ constructor, no derivation or use outside the DLL + CShwSlideshowEngine(); + /// Own: the real implementation + CShwSlideshowEngineImpl* iImpl; + + }; + +#endif // __SHWSLIDESHOWENGINE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/inc/shwslideshowenginepanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/inc/shwslideshowenginepanic.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007-2008 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: Panic codes for the slideshow engine + * +*/ + + + + +#ifndef __SHWSLIDESHOWENGINEPANIC_H__ +#define __SHWSLIDESHOWENGINEPANIC_H__ + +// Type definitions +namespace NShwEngine + { + /** + * Slideshow engine panic enumerations + */ + enum TShwEnginePanic + { + EVisualListFocusNotChanged, + EEngineStartLCalledInWrongState, + ENullHuiDisplay, + ENullVisualList, + ENullCurrentEffect, + EIncorrectEffectIndex, // need to call SetDefaultEffectL to get rid of this + EEngineFatalError // this means that engine got onto an non-recoverable state + }; + + /** + * This function is used to panic the slideshowengine + * @param aPanic, the enumeration for the panic @see TShwEnginePanic + */ + extern void Panic( TShwEnginePanic aPanic ); + } + +#endif // __SHWSLIDESHOWENGINEPANIC_H__ + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwdefaulteffectmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwdefaulteffectmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshweffectcontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshweffectcontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshweffectsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshweffectsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshweventrouteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshweventrouteru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwmusiccontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwmusiccontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwplaybackfactoryu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwplaybackfactoryu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwsettingsmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwsettingsmodelu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,15 @@ +EXPORTS + ??1CShwSettingsModel@@UAE@XZ @ 1 NONAME ; CShwSettingsModel::~CShwSettingsModel(void) + ?SaveTransitionTypeL@CShwSettingsModel@@QAEXVTUid@@I@Z @ 2 NONAME ; void CShwSettingsModel::SaveTransitionTypeL(class TUid, unsigned int) + ?SaveMusicNamePathL@CShwSettingsModel@@QAEXABVTDesC16@@@Z @ 3 NONAME ; void CShwSettingsModel::SaveMusicNamePathL(class TDesC16 const &) + ?NewL@CShwSettingsModel@@SAPAV1@XZ @ 4 NONAME ; class CShwSettingsModel * CShwSettingsModel::NewL(void) + ?MusicNamePathL@CShwSettingsModel@@QBEXAAVTDes16@@@Z @ 5 NONAME ; void CShwSettingsModel::MusicNamePathL(class TDes16 &) const + ?MusicOnL@CShwSettingsModel@@QBEHXZ @ 6 NONAME ; int CShwSettingsModel::MusicOnL(void) const + ?TransitionTypeL@CShwSettingsModel@@QBEXAAVTUid@@AAI@Z @ 7 NONAME ; void CShwSettingsModel::TransitionTypeL(class TUid &, unsigned int &) const + ?SavePlayOrderL@CShwSettingsModel@@QAEXH@Z @ 8 NONAME ; void CShwSettingsModel::SavePlayOrderL(int) + ?PlayOrderL@CShwSettingsModel@@QAEHXZ @ 9 NONAME ; int CShwSettingsModel::PlayOrderL(void) + ?SaveMusicStateL@CShwSettingsModel@@QAEXH@Z @ 10 NONAME ; void CShwSettingsModel::SaveMusicStateL(int) + ?SaveTransDelayL@CShwSettingsModel@@QAEXH@Z @ 11 NONAME ; void CShwSettingsModel::SaveTransDelayL(int) + ?TransDelayL@CShwSettingsModel@@QBEHXZ @ 12 NONAME ; int CShwSettingsModel::TransDelayL(void) const + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 13 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwslideshowengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwslideshowengineu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwslideshowkeyhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwslideshowkeyhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwtimercontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwtimercontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwviewcontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwviewcontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/BWINS/t_cshwzoomandpaneffectu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/BWINS/t_cshwzoomandpaneffectu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/data/knightrider.mp3 Binary file photosgallery/slideshow/engine/tsrc/data/knightrider.mp3 has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwdefaulteffectmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwdefaulteffectmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZTI16T_MShwTestEffect @ 2 NONAME ; ## + _ZTV16T_MShwTestEffect @ 3 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshweffectcontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshweffectcontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshweffectsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshweffectsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshweventrouteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshweventrouteru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwmusiccontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwmusiccontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwplaybackfactoryu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwplaybackfactoryu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwsettingsmodelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwsettingsmodelu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,17 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN17CShwSettingsModel10PlayOrderLEv @ 2 NONAME + _ZN17CShwSettingsModel14SavePlayOrderLEi @ 3 NONAME + _ZN17CShwSettingsModel15SaveMusicStateLEi @ 4 NONAME + _ZN17CShwSettingsModel15SaveTransDelayLEi @ 5 NONAME + _ZN17CShwSettingsModel18SaveMusicNamePathLERK7TDesC16 @ 6 NONAME + _ZN17CShwSettingsModel19SaveTransitionTypeLE4TUidj @ 7 NONAME + _ZN17CShwSettingsModel4NewLEv @ 8 NONAME + _ZN17CShwSettingsModelD0Ev @ 9 NONAME + _ZN17CShwSettingsModelD1Ev @ 10 NONAME + _ZN17CShwSettingsModelD2Ev @ 11 NONAME + _ZNK17CShwSettingsModel11TransDelayLEv @ 12 NONAME + _ZNK17CShwSettingsModel14MusicNamePathLER6TDes16 @ 13 NONAME + _ZNK17CShwSettingsModel15TransitionTypeLER4TUidRj @ 14 NONAME + _ZNK17CShwSettingsModel8MusicOnLEv @ 15 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwslideshowengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwslideshowengineu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwslideshowkeyhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwslideshowkeyhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwtimercontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwtimercontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwviewcontrolu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwviewcontrolu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/eabi/t_cshwzoomandpaneffectu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/eabi/t_cshwzoomandpaneffectu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + +PRJ_TESTEXPORTS +../data/knightrider.mp3 /epoc32/winscw/c/knightrider.mp3 + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +//t_cshwzoomandpaneffect.mmp +t_cshwdefaulteffectmanager.mmp +t_cshwtimercontrol.mmp +t_cshwviewcontrol.mmp +t_cshweventrouter.mmp +//t_cshwmusiccontrol.mmp +//t_cshwsettingsmodel.mmp +//t_cshweffects.mmp +//t_cshweffectcontrol.mmp +//t_cshwslideshowengine.mmp +//t_cshwplaybackfactory.mmp + +PRJ_MMPFILES +../../group/shwslideshowengine.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwdefaulteffectmanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwdefaulteffectmanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../inc/glxcapabilities.hrh" +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + + +TARGET t_cshwdefaulteffectmanager.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../t_cshwdefaulteffectmanager +SOURCE t_cshwdefaulteffectmanager.cpp + +// Source required by the test suite +SOURCEPATH ../t_cshwdefaulteffectmanager +SOURCE t_cshwdefaulteffectmanager_DllMain.cpp + +// Code under test +SOURCEPATH ../../effectsrc +SOURCE shwdefaulteffectmanager.cpp +SOURCE shwcrossfadeeffect.cpp +SOURCE shwcrossfadelayout.cpp + +//SOURCE shwzoomandpaneffect.cpp +//SOURCE shwzoomandpanlayout.cpp +SOURCE shwresourceutility.cpp +SOURCE shwcurvefactory.cpp +SOURCEPATH ../../coresrc +SOURCE shwtimer.cpp + +// User include test code +USERINCLUDE ../t_cshwdefaulteffectmanager +USERINCLUDE ../stubs + +// User include folders required by the code under test +USERINCLUDE ../../effectsrc +USERINCLUDE ../../coresrc +USERINCLUDE ../../controlsrc +USERINCLUDE ../../inc +//USERINCLUDE ../../utils + + +//SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../utils +// for mgallery medialist +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +// for mgallery layouts +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +// for mgallery visuallist +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +// for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../gallery/loc +// for attribute retriever +SYSTEMINCLUDE ../../../../viewframework/uiutilities/inc + + + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// Libraries required by the code under test +LIBRARY glxlayouts.lib +LIBRARY glxcommon.lib // for CGlxResourceUtilities::GetResourceFilenameL +LIBRARY glxmedialists.lib +LIBRARY hitchcock.lib // HUI +LIBRARY alfclient.lib + +// Resource string loading +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY bafl.lib +LIBRARY commonengine.lib +LIBRARY avkon.lib + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshweffectcontrol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshweffectcontrol.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* 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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshweffectcontrol.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../t_cshweffectcontrol +SOURCE t_cshweffectcontrol.cpp +SOURCE t_cshweffectcontrol_dllmain.cpp + +SOURCEPATH ../stubs +SOURCE tmglxvisuallist_adapter.cpp +SOURCE stub_tglxlayoutsplitter.cpp +SOURCE tmshweffectmanager_adapter.cpp +SOURCE stub_glxfetchcontexts.cpp + +// Sources required by the test suite +SOURCEPATH ../../controlsrc +SOURCE shweffectcontrol.cpp +SOURCE shweventpublisherbase.cpp +SOURCE shwevent.cpp +SOURCEPATH ../../coresrc +SOURCE shwthumbnailloader.cpp +SOURCE shwthumbnailcontext.cpp +SOURCE shwtimer.cpp + +USERINCLUDE ../t_cshweffectcontrol +USERINCLUDE ../stubs +USERINCLUDE ../../../../viewframework/medialists/tsrc/inc + +// User include folders required by the tested code +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../controlsrc +SYSTEMINCLUDE ../../coresrc +SYSTEMINCLUDE ../../effectsrc +SYSTEMINCLUDE ../../../utils +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +SYSTEMINCLUDE ../../../../viewframework/uiutilities/inc // for attribute retriever + + +// System include folders required by the tested code +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY mpxcommon.lib +// glx dependencies +LIBRARY glxlayouts.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshweffects.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshweffects.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshweffects.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../t_cshweffects +SOURCE t_cshweffects.cpp +SOURCE t_cshweffects_dllmain.cpp + +// Sources required by the test suite +SOURCEPATH ../../effectsrc +SOURCE shwcrossfadeeffect.cpp +SOURCE shwcrossfadelayout.cpp +SOURCE shwzoomandpaneffect.cpp +SOURCE shwzoomandpanlayout.cpp +SOURCE shwcurvefactory.cpp + +SOURCEPATH ../../coresrc +SOURCE shwtimer.cpp + +USERINCLUDE ../t_cshweffects + +// User include folders required by the tested code +USERINCLUDE ../../inc +USERINCLUDE ../../effectsrc +USERINCLUDE ../../../utils +USERINCLUDE ../../coresrc + + + +// System include folders required by the tested code +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +SYSTEMINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// Libraries required by the tested code +LIBRARY glxmedialists.lib +LIBRARY glxlayouts.lib + +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY hitchcock.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY commonengine.lib +LIBRARY avkon.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshweventrouter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshweventrouter.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* 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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshweventrouter.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +// test code +SOURCEPATH ../t_cshweventrouter +SOURCE t_cshweventrouterdllmain.cpp +SOURCE t_cshweventrouter.cpp +// code under test +SOURCEPATH ../../controlsrc +SOURCE shweventrouter.cpp + +USERINCLUDE ../../inc +USERINCLUDE ../../coresrc +USERINCLUDE ../../controlsrc +USERINCLUDE ../../../utils +USERINCLUDE ../t_cshweventrouter + +SYSTEMINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwmusiccontrol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwmusiccontrol.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshwmusiccontrol.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../t_cshwmusiccontrol +SOURCE t_cshwmusiccontrol.cpp +SOURCE t_cshwmusiccontrol_dllmain.cpp + +// Sources required by the test suite +SOURCEPATH ../../controlsrc +SOURCE shwevent.cpp +SOURCE shwmusiccontrol.cpp +SOURCE shweventpublisherbase.cpp + +USERINCLUDE ../t_cshwmusiccontrol + +// User include folders required by the tested code +USERINCLUDE ../../inc +USERINCLUDE ../../coresrc +USERINCLUDE ../../../utils +USERINCLUDE ../../controlsrc +USERINCLUDE ../../effectsrc + + + +// System include folders required by the tested code +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +SYSTEMINCLUDE ../../../../inc +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../../viewframework/views/fullscreenview/inc + +// for mgallery drm +SYSTEMINCLUDE ../../../../viewframework/drmutility/inc + + +LIBRARY eunit.lib +LIBRARY eunitutil.lib +LIBRARY efsrv.lib +LIBRARY euser.lib + +LIBRARY mpxplaybackutility.lib + +// Libraries required by the tested code + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwplaybackfactory.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwplaybackfactory.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshwplaybackfactory.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +// test code +SOURCEPATH ../t_cshwplaybackfactory +SOURCE t_cshwplaybackfactory.cpp +SOURCE t_cshwplaybackfactory_dllmain.cpp + +// stubs for code under test +SOURCEPATH ../stubs +SOURCE tmglxvisuallist_adapter.cpp +SOURCE stub_glxfetchcontexts.cpp + +// code under test +SOURCEPATH ../../controlsrc +SOURCE shwevent.cpp +SOURCE shweffectcontrol.cpp +SOURCE shwviewcontrol.cpp +SOURCE shwtimercontrol.cpp +SOURCE shweventrouter.cpp +SOURCE shwmusiccontrol.cpp +SOURCE shweventpublisherbase.cpp +SOURCEPATH ../../effectsrc +SOURCE shwdefaulteffectmanager.cpp +SOURCEPATH ../../coresrc +SOURCE shwplaybackfactory.cpp +SOURCE shwthumbnailloader.cpp +SOURCE shwsettingsmodel.cpp +SOURCE shwtimer.cpp +SOURCE shwthumbnailcontext.cpp + +// test code +USERINCLUDE ../t_cshwplaybackfactory +USERINCLUDE ../stubs +USERINCLUDE ../../../../viewframework/medialists/tsrc/inc + +// User include folders required by the code under test +USERINCLUDE ../../inc +USERINCLUDE ../../coresrc +USERINCLUDE ../../../utils +USERINCLUDE ../../controlsrc +USERINCLUDE ../../effectsrc + + + +// System include folders required by the code under test +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +SYSTEMINCLUDE ../../../../viewframework/uiutilities/inc // for attribute retriever +SYSTEMINCLUDE ../../../../inc +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// Libraries required by the code under test +LIBRARY glxlayouts.lib +LIBRARY mpxplaybackutility.lib // for music playback +LIBRARY efsrv.lib +LIBRARY mpxcommon.lib + +// For central repository +LIBRARY centralrepository.lib + +// allow writeable statics +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwsettingsmodel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwsettingsmodel.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshwsettingsmodel.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +// test code +SOURCEPATH ../t_cshwsettingsmodel +SOURCE t_cshwsettingsmodel.cpp +SOURCE t_cshwsettingsmodeldllmain.cpp +SOURCEPATH ../../coresrc +SOURCE shwsettingsmodel.cpp + + +// code under test +USERINCLUDE ../../inc +USERINCLUDE ../../../utils +USERINCLUDE ../../../group // for shwbuildvariant.hrh + +// test code +USERINCLUDE ../t_cshwsettingsmodel + + +// System include folders required by the tested code +SYSTEMINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY euser.lib +// For central repository +LIBRARY centralrepository.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwslideshowengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwslideshowengine.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshwslideshowengine.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +// test code +SOURCEPATH ../t_cshwslideshowengine +SOURCE t_cshwslideshowengine.cpp +SOURCE t_cshwslideshowengine_dllmain.cpp + +// stubs for code under test +SOURCEPATH ../stubs +SOURCE tmglxvisuallist_adapter.cpp +SOURCE tmshweventobserver_adapter.cpp +SOURCE stub_tglxlayoutsplitter.cpp +SOURCE stub_glxfetchcontexts.cpp + +// code under test +SOURCEPATH ../../controlsrc +SOURCE shwevent.cpp +SOURCE shweffectcontrol.cpp +SOURCE shwviewcontrol.cpp +SOURCE shwtimercontrol.cpp +SOURCE shwmusiccontrol.cpp +SOURCE shweventrouter.cpp +SOURCE shweventpublisherbase.cpp +SOURCEPATH ../../coresrc +SOURCE shwslideshowengine.cpp +SOURCE shwslideshowengineimpl.cpp +SOURCE shwthumbnailloader.cpp +SOURCE shwtimer.cpp +SOURCE shwthumbnailcontext.cpp + +// test code +USERINCLUDE ../t_cshwslideshowengine +USERINCLUDE ../stubs +USERINCLUDE ../../../../viewframework/medialists/tsrc/inc + +// code under test +USERINCLUDE ../../inc +USERINCLUDE ../../coresrc +USERINCLUDE ../../controlsrc +USERINCLUDE ../../effectsrc +USERINCLUDE ../../../utils + + +// System include folders required by the tested code +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +SYSTEMINCLUDE ../../../../viewframework/uiutilities/inc // for attribute retriever + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// cshwmusiccontrol libraries +LIBRARY efsrv.lib +LIBRARY mpxplaybackutility.lib +LIBRARY mpxcommon.lib + +// Libraries required by the tested code +LIBRARY glxlayouts.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwtimercontrol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwtimercontrol.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshwtimercontrol.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../t_cshwtimercontrol +SOURCE t_cshwtimercontrol.cpp +SOURCE t_cshwtimercontrol_dllmain.cpp + +// Sources required by the test suite +SOURCEPATH ../../controlsrc +SOURCE shwevent.cpp +SOURCE shwtimercontrol.cpp +SOURCE shweventpublisherbase.cpp +SOURCEPATH ../../coresrc +SOURCE shwtimer.cpp + +USERINCLUDE ../t_cshwtimercontrol + +// User include folders required by the tested code +USERINCLUDE ../../inc +USERINCLUDE ../../coresrc +USERINCLUDE ../../../utils +USERINCLUDE ../../controlsrc +USERINCLUDE ../../effectsrc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../inc + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwviewcontrol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwviewcontrol.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,74 @@ +/* +* 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: Slideshow engine build file for test + * +*/ +#include +#include + +#include "../../../../inc/glxcapabilities.hrh" +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + + +TARGET t_cshwviewcontrol.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +// Test code +SOURCEPATH ../t_cshwviewcontrol +SOURCE t_cshwviewcontrol.cpp +SOURCE t_cshwviewcontrol_dllmain.cpp + +// Code under test +SOURCEPATH ../../controlsrc +SOURCE shwevent.cpp +SOURCE shwviewcontrol.cpp +SOURCE shweventpublisherbase.cpp + +// test code +USERINCLUDE ../t_cshwviewcontrol +USERINCLUDE ../../../../viewframework/medialists/tsrc/inc + +// User include folders required by the tested code +USERINCLUDE ../../inc +USERINCLUDE ../../coresrc +USERINCLUDE ../../controlsrc +USERINCLUDE ../../../utils + + +// System include folders required by the tested code +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY mpxcommon.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/group/t_cshwzoomandpaneffect.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/group/t_cshwzoomandpaneffect.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2007-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: Slideshow engine build file for test + * +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_cshwzoomandpaneffect.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../t_cshwzoomandpaneffect +SOURCE t_cshwzoomandpaneffect.cpp +SOURCE t_cshwzoomandpaneffect_dllmain.cpp + +// Sources required by the test suite +SOURCEPATH ../../effectsrc +SOURCE shwzoomandpaneffect.cpp +SOURCE shwresourceutility.cpp +SOURCE shwzoomandpanlayout.cpp +SOURCE shwcurvefactory.cpp +SOURCE shwcrossfadelayout.cpp + +SOURCEPATH ../../coresrc +SOURCE shwtimer.cpp + +USERINCLUDE ../t_cshwzoomandpaneffect + +// User include folders required by the tested code +USERINCLUDE ../../inc +USERINCLUDE ../../coresrc +USERINCLUDE ../../controlsrc +USERINCLUDE ../../effectsrc +USERINCLUDE ../../../utils + + +// System include folders required by the tested code +SYSTEMINCLUDE ../../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../../viewframework/layouts/inc +SYSTEMINCLUDE ../../../../viewframework/visuallistmanager/inc +SYSTEMINCLUDE ../../../../inc +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// Libraries required by the tested code +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY glxlayouts.lib +LIBRARY glxcommon.lib // for CResourceUtilities +LIBRARY estor.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY hitchcock.lib + +// allow static data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// no need to export test DLLs +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/mglxvisuallist_observer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/mglxvisuallist_observer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* 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: Stub file for visual list observer + * +*/ + + + + +#ifndef __MGLXVISUALLIST_OBSERVER_H__ +#define __MGLXVISUALLIST_OBSERVER_H__ + +// EXTERNAL INCLUDES +#include "mglxvisuallist.h" + +/** + * EUnit Wizard generated adapter observer interface. + * The test class is informed about any calls to the + * corresponding adapter using this interface. + */ +NONSHARABLE_CLASS( MGlxVisualList_Observer ) + { + public: // enums + + enum TMGlxVisualListMethodId + { + E_NotCalled, + E_TGlxVisualListId_Id_, + E_CHuiVisual_p_Visual_TInt_, + E_CGlxVisualObject_p_Item_TInt_, + E_TInt_ItemCount_, + E_TInt_FocusIndex_, + E_CHuiControlGroup_p_ControlGroup_, + E_void_AddObserverL_MGlxVisualListObserver_p_, + E_void_RemoveObserver_MGlxVisualListObserver_p_, + E_void_AddLayoutL_MGlxLayout_p_, + E_void_RemoveLayout_const_MGlxLayout_p_, + E_TGlxViewContextId_AddContextL_TInt_TInt_, + E_void_RemoveContext_const_TGlxViewContextId_r_, + E_void_NavigateL_TInt_, + E_TSize_Size_, + E_void_BringVisualsToFront_ + }; + + public: // Destructor + + /** + * Destructor + */ + virtual ~MGlxVisualList_Observer() {} + + public: // Abstract methods + + virtual void MGlxVisualList_MethodCalled(TMGlxVisualListMethodId aMethodId)=0; + + }; + +#endif // __MGLXVISUALLIST_OBSERVER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/mshweffectmanager_observer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/mshweffectmanager_observer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,68 @@ +/* +* 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: Stub file + * +*/ + + + + + +#ifndef __MSHWEFFECTMANAGER_OBSERVER_H__ +#define __MSHWEFFECTMANAGER_OBSERVER_H__ + +// EXTERNAL INCLUDES +#include "shweffectmanager.h" + +/** + * EUnit Wizard generated adapter observer interface. + * The test class is informed about any calls to the + * corresponding adapter using this interface. + */ +NONSHARABLE_CLASS( MShwEffectManager_Observer ) + { + public: // enums + + enum TMShwEffectManagerMethodId + { + E_NotCalled, + E_void_AdoptEffectsL_TArrayMShwEffect_p, + E_MShwEffect_p_PreviousEffect, + E_MShwEffect_p_CurrentEffect, + E_MShwEffect_p_NextEffect, + E_void_ProceedToNextEffect, + E_MGlxLayout_InitializeL, + E_MGlxLayout_PrepareViewL, + E_MGlxLayout_EnterViewL_TInt, + E_void_ExitView, + E_MGlxLayout_EnterTransitionL_TInt, + E_void_ExitTransition + }; + + public: // Destructor + + /** + * Destructor + */ + virtual ~MShwEffectManager_Observer() {} + + public: // Abstract methods + + virtual void MShwEffectManager_MethodCalled(TMShwEffectManagerMethodId aMethodId)=0; + + }; + +#endif // __MSHWEFFECTMANAGER_OBSERVER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/stub_glxfetchcontexts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/stub_glxfetchcontexts.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,328 @@ +/* +* 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: Stubs for thumbnail and attribute context + * +*/ + + + + +#include "stub_glxfetchcontexts.h" + +// this flag defines the return value for CGlxThumbnailContext::RequestCountL +extern TInt gThumbnailContextRequestCount = 1; +// this flag defines the return value for CGlxAttributeContext::RequestCountL +extern TInt gAttributeContextRequestCount = 1; +// this flag defines the return value for GlxAttributeRetriever::RetrieveL +extern TInt gGlxAttributeRetrieverRetrieveL = 1; +// this flag defines the return value for TGlxMedia::GetDimensions +extern TBool gTGlxMediaGetDimensions = ETrue; +// this flag defines if the test is meant to be an alloc test +extern TBool gFetchContextAllocTest = EFalse; + +// helper macro to do an alloc if we are in alloc test +#define MAKE_ALLOC_L \ + if( gFetchContextAllocTest ) \ + { TInt* alloc = new( ELeave ) TInt; \ + delete alloc; } + +// ----------------------------------------------------------------------------- +// Stub for GlxAttributeRetriever --> +// ----------------------------------------------------------------------------- +EXPORT_C TInt GlxAttributeRetriever::RetrieveL( + const MGlxFetchContext& /*aContext*/, + MGlxMediaList& /*aList*/, + TBool /*aShowDialog*/ ) + { + return gGlxAttributeRetrieverRetrieveL; + } + + +// ----------------------------------------------------------------------------- +// <-- Stub for GlxAttributeRetriever +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for TGlxMedia --> +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetDimensions( TSize& /*aSize*/ ) const + { + return gTGlxMediaGetDimensions; + } +// ----------------------------------------------------------------------------- +// <-- Stub for TGlxMedia +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for CGlxThumbnailContext --> +// ----------------------------------------------------------------------------- +CGlxThumbnailContext* CGlxThumbnailContext::NewL( + MGlxMediaListIterator* aIterator ) + { + return new( ELeave ) CGlxThumbnailContext( aIterator ); + } + +CGlxThumbnailContext::CGlxThumbnailContext( + MGlxMediaListIterator* /*aIterator*/ ) + { + } + +CGlxThumbnailContext::~CGlxThumbnailContext() + { + } + +void CGlxThumbnailContext::AddSpecForItemL( + TInt /*aWidth*/, TInt /*aHeight*/, TInt /*aFocusOffset*/ ) + { + MAKE_ALLOC_L + } + +void CGlxThumbnailContext::SetDefaultSpec( + TInt /*aWidth*/, TInt /*aHeight*/ ) + { + } + +void CGlxThumbnailContext::SetHighQualityOnly( TBool /*aHighQualityOnly*/ ) + { + } + +// From MGlxFetchContext +void CGlxThumbnailContext::AllAttributesL( + const MGlxMediaList* /*aList*/, + TInt /*aListIndex*/, + RArray& /*aAttributes*/ ) const + { + MAKE_ALLOC_L + } + +TInt CGlxThumbnailContext::AttributeRequestL( + const MGlxMediaList* /*aList*/, + RArray& /*aItemIndices*/, + RArray& /*aAttributes*/, + CMPXAttributeSpecs*& /*aDetailedSpecs*/ ) const + { + MAKE_ALLOC_L + return 0; + } + +TInt CGlxThumbnailContext::RequestCountL( + const MGlxMediaList* /*aList*/) const + { + MAKE_ALLOC_L + return gThumbnailContextRequestCount; + } + +void CGlxThumbnailContext::HandleResolutionChanged() + { + } + +TInt CGlxThumbnailContext::SelectItemL( + const MGlxMediaList* /*aList*/, + TInt& /*aError*/) const + { + MAKE_ALLOC_L + return 0; + } + +TUint CGlxThumbnailContext::GetThumbnailScoreL( + TInt /*aIndexInList*/, + const MGlxMediaList* /*aList*/, + TInt /*aDistance*/, + TInt& /*aError*/) const + { + MAKE_ALLOC_L + return 0; + } + +const CGlxThumbnailContext::TFetchSpec& CGlxThumbnailContext::SpecForIndex( + TInt /*aListIndex*/, const MGlxMediaList* /*aList*/ ) const + { + return iDefaultSpec; + } +// ----------------------------------------------------------------------------- +// <-- Stub for CGlxThumbnailContext +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for CGlxDefaultThumbnailContext --> +// ----------------------------------------------------------------------------- +CGlxDefaultThumbnailContext* CGlxDefaultThumbnailContext::NewL() + { + return new( ELeave ) CGlxDefaultThumbnailContext; + } + +CGlxDefaultThumbnailContext::~CGlxDefaultThumbnailContext() + { + } + +void CGlxDefaultThumbnailContext::SetRangeOffsets( + TInt /*aFrontOffset*/, TInt /*aRearOffset*/ ) + { + } + +CGlxDefaultThumbnailContext::CGlxDefaultThumbnailContext() + : CGlxThumbnailContext( NULL ) + { + } +// ----------------------------------------------------------------------------- +// <-- Stub for CGlxDefaultThumbnailContext +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for TGlxFromFocusOutwardIterator --> +// ----------------------------------------------------------------------------- +TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator() + { + } + +TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator() + { + } + +void TGlxFromFocusOutwardIterator::SetToFirst(const MGlxMediaList* ) + { + } + +TInt TGlxFromFocusOutwardIterator::operator++(TInt) + { + return 0; + } + +TBool TGlxFromFocusOutwardIterator::InRange(TInt ) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// <-- Stub for TGlxFromFocusOutwardBlockyIterator +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for TGlxFromFocusOutwardIterator --> +// ----------------------------------------------------------------------------- +TGlxFromFocusOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator() + { + } + +TGlxFromFocusOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator() + { + } + +void TGlxFromFocusOutwardBlockyIterator::SetToFirst(const MGlxMediaList* ) + { + } + +TInt TGlxFromFocusOutwardBlockyIterator::operator++(TInt) + { + return 0; + } + +TBool TGlxFromFocusOutwardBlockyIterator::InRange(TInt ) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// <-- Stub for TGlxFromFocusOutwardBlockyIterator +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for CGlxAttributeContext --> +// ----------------------------------------------------------------------------- +CGlxAttributeContext::CGlxAttributeContext(MGlxMediaListIterator* ) + { + } + +CGlxAttributeContext::~CGlxAttributeContext() + { + } + +void CGlxAttributeContext::AddAttributeL(const TMPXAttribute& ) + { + MAKE_ALLOC_L + } + +void CGlxAttributeContext::RemoveAttribute(const TMPXAttribute& ) + { + } + +void CGlxAttributeContext::SetGranularity(TUint ) + { + } + +TInt CGlxAttributeContext::AttributeRequestL(const MGlxMediaList* , RArray& , + RArray& , CMPXAttributeSpecs*& ) const + { + MAKE_ALLOC_L + return 0; + } + +void CGlxAttributeContext::AllAttributesL(const MGlxMediaList* , TInt , + RArray& ) const + { + MAKE_ALLOC_L + } + +TInt CGlxAttributeContext::RequestCountL(const MGlxMediaList* ) const + { + MAKE_ALLOC_L + return gAttributeContextRequestCount; + } +// ----------------------------------------------------------------------------- +// <-- Stub for CGlxAttributeContext +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for CGlxDefaultAttributeContext --> +// ----------------------------------------------------------------------------- +CGlxDefaultAttributeContext* CGlxDefaultAttributeContext::NewL() + { + return new( ELeave ) CGlxDefaultAttributeContext; + } + +CGlxDefaultAttributeContext::~CGlxDefaultAttributeContext() + { + } + +CGlxDefaultAttributeContext::CGlxDefaultAttributeContext() + : CGlxAttributeContext( NULL ) + { + } + +void CGlxDefaultAttributeContext::SetRangeOffsets( + TInt , TInt ) + { + } +// ----------------------------------------------------------------------------- +// <-- Stub for CGlxDefaultAttributeContext +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for TMPXAttribute --> +// ----------------------------------------------------------------------------- +EXPORT_C TMPXAttribute::TMPXAttribute(TInt , TUint ) + { + } + +EXPORT_C TMPXAttribute::TMPXAttribute(const TMPXAttributeData& /*aData*/) + { + } + +EXPORT_C TBool TMPXAttribute::Match( const TMPXAttribute& , const TMPXAttribute& ) + { + return EFalse; + } +// ----------------------------------------------------------------------------- +// <-- Stub for TMPXAttribute +// ----------------------------------------------------------------------------- diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/stub_glxfetchcontexts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/stub_glxfetchcontexts.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: Stub file for thumbnail and attribute context + * +*/ + + + +#ifndef __STUB_GLXFETCHCONTEXTS_H__ +#define __STUB_GLXFETCHCONTEXTS_H__ + +#include +#include +#include +#include + +// this flag defines the return value for CGlxThumbnailContext::RequestCountL +extern TInt gThumbnailContextRequestCount; +// this flag defines the return value for CGlxAttributeContext::RequestCountL +extern TInt gAttributeContextRequestCount; +// this flag defines the return value for GlxAttributeRetriever::RetrieveL +extern TInt gGlxAttributeRetrieverRetrieveL; +// this flag defines the return value for TGlxMedia::GetDimensions +extern TBool gTGlxMediaGetDimensions; +// this flag defines if the test is meant to be an alloc test +extern TBool gFetchContextAllocTest; + + +#endif // __STUB_GLXFETCHCONTEXTS_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/stub_mshweffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/stub_mshweffect.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2007-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: Test stub for MShwEffect + * +*/ + + + + +#include "shweffect.h" + +// ----------------------------------------------------------------------------- +// Stub for MShwEffect --> +// ----------------------------------------------------------------------------- +class T_MShwTestEffect : public MShwEffect + { + public: + T_MShwTestEffect( TInt aIndex ); + ~T_MShwTestEffect(); + + public: // from MShwEffect + + MShwEffect* CloneLC(); + void InitializeL( + CAlfEnv* aAlfEnv, MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, TSize aScreenSize ); + TSize PrepareViewL( CAlfVisual* aVisual, TSize aSize ); + MGlxLayout* EnterViewL( CAlfVisual* aVisual, TInt aDuration, TInt aDuration2 ); + void ExitView( CAlfVisual* aVisual ); + MGlxLayout* EnterTransitionL( CAlfVisual* aVisual, TInt aDuration ); + void ExitTransition( CAlfVisual* aVisual ); + void PauseL(); + void Resume(); + TShwEffectInfo EffectInfo(); + + public: + TInt iIndex; + enum TState + { + EConstruct, + EPrepareView, + EEnterView, + EExitView, + EEnterTransition, + EExitTransition + } iState; // state flag to assert prptocol + CAlfVisual* iVisual; // to track the visual + }; + +T_MShwTestEffect::T_MShwTestEffect( TInt aIndex ) + : iIndex( aIndex ), iState( EConstruct ), iVisual( NULL ) + { + } +T_MShwTestEffect::~T_MShwTestEffect() + { + } +MShwEffect* T_MShwTestEffect::CloneLC() + { + T_MShwTestEffect* effect = new( ELeave ) T_MShwTestEffect( iIndex ); + CleanupStack::PushL( effect ); + return effect; + } + +void T_MShwTestEffect::InitializeL( + CAlfEnv* /*aAlfEnv*/, MGlxVisualList* /*aVisualList*/, + MGlxMediaList* /*aMediaList*/, TSize /*aScreenSize*/ ) + { + } +// this flag defines if the test expects the effects to be called completely +// like Prepare -> Enter view -> Enter trans -> Prepare +// if set to EFalse, then also Prepare -> Enter view -> Exit View -> Prepare +// is allowed +TBool gStrictEffectOrder = ETrue; +TSize T_MShwTestEffect::PrepareViewL( CAlfVisual* aVisual, TSize aSize ) + { + if( gStrictEffectOrder ) + { + EUNIT_ASSERT_DESC( + EConstruct == iState || EExitTransition == iState, + "state needs to be construct or exit transition" ); + } + iState = EPrepareView; // set state + EUNIT_PRINT( _L("effect %d; PrepareViewL visual=%d"), iIndex, (TInt)aVisual ); + // remember the visual + iVisual = aVisual; + // return the given size + return aSize; + } + +MGlxLayout* T_MShwTestEffect::EnterViewL( + CAlfVisual* aVisual, TInt /*aDuration*/, TInt /*aDuration2*/ ) + { + if( gStrictEffectOrder ) + { + EUNIT_ASSERT_DESC( EPrepareView == iState, "state needs to be prepareview" ); + } + else + { + EUNIT_ASSERT_DESC( + EPrepareView == iState || + EEnterView == iState, "state needs to be prepare or enterview" ); + } + iState = EEnterView; // set state + EUNIT_PRINT( _L("effect %d; EnterViewL visual=%d"), iIndex, (TInt)aVisual ); + EUNIT_ASSERT_DESC( aVisual == iVisual, "Visual should be same as for PrepareViewL" ); + return NULL; + } + +void T_MShwTestEffect::ExitView( CAlfVisual* aVisual ) + { + EUNIT_ASSERT_DESC( EEnterView == iState, "state needs to be enterview" ); + iState = EExitView; // set state + EUNIT_PRINT( _L("effect %d; ExitView visual=%d"), iIndex, (TInt)aVisual ); + EUNIT_ASSERT_DESC( aVisual == iVisual, "Visual should be same as for PrepareViewL" ); + } + +MGlxLayout* T_MShwTestEffect::EnterTransitionL( CAlfVisual* aVisual, TInt /*aDuration*/ ) + { + EUNIT_ASSERT_DESC( EExitView == iState, "state needs to be exitview" ); + iState = EEnterTransition; // set state + EUNIT_PRINT( _L("effect %d; EnterTransitionL visual=%d"), iIndex, (TInt)aVisual ); + EUNIT_ASSERT_DESC( aVisual == iVisual, "Visual should be same as for PrepareViewL" ); + return NULL; + } + +void T_MShwTestEffect::ExitTransition( CAlfVisual* aVisual ) + { + EUNIT_ASSERT_DESC( EEnterTransition == iState, "state needs to be entertransition" ); + iState = EExitTransition; // set state + EUNIT_PRINT( _L("effect %d; ExitTransition visual=%d"), iIndex, (TInt)aVisual ); + EUNIT_ASSERT_DESC( aVisual == iVisual, "Visual should be same as for PrepareViewL" ); + } + +void T_MShwTestEffect::PauseL() + { + } + +void T_MShwTestEffect::Resume() + { + } + +_LIT( KTestEffectName, "EffectName" ); +TShwEffectInfo T_MShwTestEffect::EffectInfo() + { + TShwEffectInfo info; + info.iName = KTestEffectName; + info.iId.iIndex = iIndex; + return info; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/stub_tglxlayoutsplitter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/stub_tglxlayoutsplitter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,134 @@ +/* +* 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: Stub file for image transaction in slideshow + * +*/ + + + + +#include "stub_tglxlayoutsplitter.h" + +extern TBool gSplitterAddLayoutLCalled = EFalse; +extern TBool gSplitterRemoveLayoutLCalled = EFalse; + +// ----------------------------------------------------------------------------- +// Stub for TGlxLayout --> +// ----------------------------------------------------------------------------- +TGlxLayout::TGlxLayout() + { + } +TGlxLayout::~TGlxLayout() + { + } +void TGlxLayout::SetNext( MGlxLayout* /*aLayout*/ ) + { + } +MGlxLayout* TGlxLayout::Next() const + { + return NULL; + } +void TGlxLayout::Insert(MGlxLayout* /*aLayout*/) + { + } +void TGlxLayout::Remove(MGlxLayout* /*aLayout*/) + { + } +void TGlxLayout::SetLayoutValues( TGlxLayoutInfo& /*aInfo*/ ) + { + } +TBool TGlxLayout::Changed() const + { + return ETrue; + } +void TGlxLayout::ClearChanged() + { + } +void TGlxLayout::DoSetLayoutValues( TGlxLayoutInfo& /*aInfo*/ ) + { + } +TBool TGlxLayout::DoChanged() const + { + return ETrue; + } +void TGlxLayout::DoClearChanged() + { + } +// ----------------------------------------------------------------------------- +// <-- Stub for TGlxLayout +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for layout splitter --> +// ----------------------------------------------------------------------------- +TGlxLayoutSplitter::TGlxLayoutSplitter() + { + gSplitterAddLayoutLCalled = EFalse; + gSplitterRemoveLayoutLCalled = EFalse; + } +TGlxLayoutSplitter::~TGlxLayoutSplitter() + { + } +void TGlxLayoutSplitter::SetVisualListL(MGlxVisualList* /*aVisualList*/) + { + } + +void TGlxLayoutSplitter::AddLayoutL(MGlxLayout* /*aLayout*/, const CHuiVisual* /*aVisual*/) + { + gSplitterAddLayoutLCalled = ETrue; + } + +void TGlxLayoutSplitter::RemoveLayout(const CHuiVisual* /*aVisual*/) + { + gSplitterRemoveLayoutLCalled = ETrue; + } +void TGlxLayoutSplitter::SetDefaultLayout(MGlxLayout* /*aLayout*/) + { + } + +void TGlxLayoutSplitter::HandleFocusChangedL( + TInt /*aFocusIndex*/, TReal32 /*aItemsPerSecond*/, MGlxVisualList* /*aList*/, + NGlxListDefs::TFocusChangeType /*aType*/ ) + { + + } +void TGlxLayoutSplitter::HandleSizeChanged( const TSize& /*aSize*/, MGlxVisualList* /*aList*/ ) + { + + } +void TGlxLayoutSplitter::HandleVisualRemoved( + const CHuiVisual* /*aVisual*/, MGlxVisualList* /*aList*/ ) + { + + } +void TGlxLayoutSplitter::HandleVisualAddedL( + CHuiVisual* /*aVisual*/, TInt /*aIndex*/, MGlxVisualList* /*aList*/ ) + { + + } +void TGlxLayoutSplitter::DoSetLayoutValues( TGlxLayoutInfo& /*aInfo*/ ) + { + + } +TBool TGlxLayoutSplitter::DoChanged() const + { + return ETrue; + } +void TGlxLayoutSplitter::DoClearChanged() + { + + } +// ----------------------------------------------------------------------------- +// <-- Stub for layout splitter +// ----------------------------------------------------------------------------- diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/stub_tglxlayoutsplitter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/stub_tglxlayoutsplitter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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: Stub file for image transaction in slideshow + * +*/ + + + +#ifndef __STUB_TGLXLAYOUTSPLITTER_H__ +#define __STUB_TGLXLAYOUTSPLITTER_H__ + +#include + +extern TBool gSplitterAddLayoutLCalled; +extern TBool gSplitterRemoveLayoutLCalled; + +#endif // __STUB_TGLXLAYOUTSPLITTER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/tmglxvisuallist_adapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/tmglxvisuallist_adapter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,272 @@ +/* +* 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: Stub file for visual list adapter + * +*/ + + + + +// CLASS HEADER +#include "TMGlxVisualList_Adapter.h" + +// EXTERNAL INCLUDES +#include +#include + +// declate the enum to be printed as TInt +EUNIT_DECLARE_PRINTABLE_AS_TINT( MGlxVisualList_Observer::TMGlxVisualListMethodId ) + +// INTERNAL INCLUDES + +// CONSTRUCTION + +TMGlxVisualList_Adapter::TMGlxVisualList_Adapter( MGlxVisualList_Observer* aObserver ) + : iSize( TMGlxVisualList_Adapter_Config::KDefaultSize ), + iFocus( TMGlxVisualList_Adapter_Config::KDefaultFocus ), + iMGlxVisualList_Observer( aObserver ), + iMGlxVisualList( NULL ) + { + } + +TMGlxVisualList_Adapter::~TMGlxVisualList_Adapter() + { + // release the array + iObservers.Close(); + } + +void TMGlxVisualList_Adapter::SetAdaptee( MGlxVisualList* aAdaptee ) + { + iMGlxVisualList = aAdaptee; + } + +// METHODS +TGlxVisualListId TMGlxVisualList_Adapter::Id() const + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_TGlxVisualListId_Id_ ); + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->Id(); + } + return TGlxVisualListId( reinterpret_cast< unsigned int >( (void*)this ) ); + } + +CHuiVisual* TMGlxVisualList_Adapter::Visual( TInt aListIndex ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_CHuiVisual_p_Visual_TInt_ ); + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->Visual( aListIndex ); + } + // return the index as visual + return (CHuiVisual*)aListIndex; + } + +CGlxVisualObject* TMGlxVisualList_Adapter::Item( TInt aListIndex ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_CGlxVisualObject_p_Item_TInt_ ); + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->Item( aListIndex ); + } + // return the index as item + return (CGlxVisualObject*)aListIndex; + } + +TInt TMGlxVisualList_Adapter::ItemCount() const + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_TInt_ItemCount_ ); + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->ItemCount(); + } + return iSize; + } + +TInt TMGlxVisualList_Adapter::FocusIndex() const + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_TInt_FocusIndex_ ); + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->FocusIndex(); + } + return iFocus; + } + +CHuiControlGroup* TMGlxVisualList_Adapter::ControlGroup() const + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_CHuiControlGroup_p_ControlGroup_ ); + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->ControlGroup(); + } + return NULL; + } + +void TMGlxVisualList_Adapter::AddObserverL( MGlxVisualListObserver* aObserver ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_void_AddObserverL_MGlxVisualListObserver_p_ ); + + // call the actual method + if ( iMGlxVisualList ) + { + iMGlxVisualList->AddObserverL( aObserver ); + } + + // add the observer to array + iObservers.AppendL( aObserver ); + } + +void TMGlxVisualList_Adapter::RemoveObserver( MGlxVisualListObserver* aObserver ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_void_RemoveObserver_MGlxVisualListObserver_p_ ); + // call the actual method + if ( iMGlxVisualList ) + { + iMGlxVisualList->RemoveObserver( aObserver ); + } + } + +void TMGlxVisualList_Adapter::AddLayoutL( MGlxLayout* aLayout ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_void_AddLayoutL_MGlxLayout_p_ ); + + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + + // call the actual method + if ( iMGlxVisualList ) + { + iMGlxVisualList->AddLayoutL( aLayout ); + } + } + +void TMGlxVisualList_Adapter::RemoveLayout( const MGlxLayout* aLayout ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_void_RemoveLayout_const_MGlxLayout_p_ ); + // call the actual method + if ( iMGlxVisualList ) + { + iMGlxVisualList->RemoveLayout( aLayout ); + } + } + +TGlxViewContextId TMGlxVisualList_Adapter::AddContextL( TInt aFrontVisibleRangeOffset, TInt aRearVisibleRangeOffset ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_TGlxViewContextId_AddContextL_TInt_TInt_ ); + + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->AddContextL( aFrontVisibleRangeOffset, aRearVisibleRangeOffset ); + } + return TGlxViewContextId( reinterpret_cast< unsigned int >( (void*)this) ); + } + +void TMGlxVisualList_Adapter::RemoveContext( const TGlxViewContextId& aContextId ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_void_RemoveContext_const_TGlxViewContextId_r_ ); + // call the actual method + if ( iMGlxVisualList ) + { + iMGlxVisualList->RemoveContext( aContextId ); + } + } + +void TMGlxVisualList_Adapter::NavigateL( TInt aIndexCount ) + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_void_NavigateL_TInt_ ); + + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + + // call the actual method + if ( iMGlxVisualList ) + { + iMGlxVisualList->NavigateL( aIndexCount ); + } + + // change the focus + iFocus = (iFocus + aIndexCount)% iSize; + // if navigated backwards, loop the index + if( iFocus < 0 ) + { + iFocus = iSize - 1; + } + + EUNIT_PRINT( _L("Visual list focus %d"), iFocus ); + + for( TInt i=0; iHandleFocusChangedL( iFocus, 0, this, NGlxListDefs::EUnknown ); + } + } + +TSize TMGlxVisualList_Adapter::Size() const + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_TSize_Size_ ); + // call the actual method + if ( iMGlxVisualList ) + { + return iMGlxVisualList->Size(); + } + return TSize( 0, 0 ); + } + +void TMGlxVisualList_Adapter::BringVisualsToFront() + { + // inform the test case + iMGlxVisualList_Observer->MGlxVisualList_MethodCalled( MGlxVisualList_Observer::E_void_BringVisualsToFront_ ); + // call the actual method + if ( iMGlxVisualList ) + { + iMGlxVisualList->BringVisualsToFront(); + } + } + +void TMGlxVisualList_Adapter::EnableAnimationL(TBool /*aAnimate*/, TInt /*aIndex*/) + { + } + +// ----------------------------------------------------------------------------- +// SetDefaultIconBehaviourL +// ----------------------------------------------------------------------------- +void TMGlxVisualList_Adapter::SetDefaultIconBehaviourL( TBool /*aEnable*/ ) + { + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/tmglxvisuallist_adapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/tmglxvisuallist_adapter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* 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: Stub file for visual list adapter + * +*/ + + + + +#ifndef __TMGLXVISUALLIST_ADAPTER_H__ +#define __TMGLXVISUALLIST_ADAPTER_H__ + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "MGlxVisualList_Observer.h" +#include + +// FORWARD DECLARATIONS + +namespace TMGlxVisualList_Adapter_Config + { + const TInt KDefaultSize = 3; + const TInt KDefaultFocus = 1; + } + +// CLASS DEFINITION +/** + * Stub version of visual list + * for testing purposes + */ +class TMGlxVisualList_Adapter + : public MGlxVisualList + { + public: // Constructors and destructors + + /** + * Construction + */ + TMGlxVisualList_Adapter( MGlxVisualList_Observer* aObserver ); + ~TMGlxVisualList_Adapter(); + void SetAdaptee( MGlxVisualList* aAdaptee ); + + public: // from MGlxVisualList + + TGlxVisualListId Id() const; + CHuiVisual* Visual(TInt aListIndex); + CGlxVisualObject* Item(TInt aListIndex); + TInt ItemCount() const; + TInt FocusIndex() const; + CHuiControlGroup* ControlGroup() const; + void AddObserverL(MGlxVisualListObserver* aObserver); + void RemoveObserver(MGlxVisualListObserver* aObserver); + void AddLayoutL(MGlxLayout* aLayout); + void RemoveLayout(const MGlxLayout* aLayout); + TGlxViewContextId AddContextL(TInt aFrontVisibleRangeOffset, TInt aRearVisibleRangeOffset); + void RemoveContext(const TGlxViewContextId& aContextId); + void NavigateL(TInt aIndexCount); + TSize Size() const; + void BringVisualsToFront(); + void EnableAnimationL(TBool aAnimate, TInt aIndex); + /// @ref MGlxVisualList::SetDefaultIconBehaviourL + void SetDefaultIconBehaviourL( TBool aEnable ); + + void AddIconL( TInt , const CHuiTexture& , + NGlxIconMgrDefs::TGlxIconPosition , + TBool , TBool , TInt, TReal32, TReal32 ) { } + + TBool RemoveIcon( TInt , const CHuiTexture& ) { return ETrue;} + + void SetIconVisibility( TInt , const CHuiTexture&, TBool ) { } + + public: // Data + + TInt iSize; + TInt iFocus; + + private: // Data + + RArray iObservers; + MGlxVisualList_Observer* iMGlxVisualList_Observer; + MGlxVisualList* iMGlxVisualList; + + }; + +#endif // __TMGLXVISUALLIST_ADAPTER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/tmshweffectmanager_adapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/tmshweffectmanager_adapter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,246 @@ +/* +* 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: Stub file for managing effect in slideshow + * +*/ + + + + +// CLASS HEADER +#include "tmshweffectmanager_adapter.h" + +// EXTERNAL INCLUDES +// INTERNAL INCLUDES +#include + +// declare the enums to be printable as TInts +EUNIT_DECLARE_PRINTABLE_AS_TINT( MShwEffectManager_Observer::TMShwEffectManagerMethodId ) + +// CONSTRUCTION + +TMShwEffectManager_Adapter::TMShwEffectManager_Adapter( + MShwEffectManager_Observer* aObserver ) + : iViewDuration( 0 ), + iTransitionDuration( 0 ), + iPrepareVisual( NULL ), + iViewVisual( NULL ), + iTransitionVisual( NULL ), + iMShwEffectManager_Observer( aObserver ), + iMShwEffectManager( NULL ) + { + } + +void TMShwEffectManager_Adapter::SetAdaptee( MShwEffectManager* aAdaptee ) + { + iMShwEffectManager = aAdaptee; + } + +// METHODS +void TMShwEffectManager_Adapter::AddEffectL( MShwEffect* aEffect ) + { + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_void_AdoptEffectsL_TArrayMShwEffect_p ); + + // allocate to cause an alloc leave + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + + // call the actual method + if ( iMShwEffectManager ) + { + iMShwEffectManager->AddEffectL( aEffect ); + } + } + +MShwEffect* TMShwEffectManager_Adapter::CurrentEffect() + { + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_MShwEffect_p_CurrentEffect ); + // call the actual method + if ( iMShwEffectManager ) + { + return iMShwEffectManager->CurrentEffect(); + } + return this; + } + +MShwEffect* TMShwEffectManager_Adapter::Effect( TInt aDirection ) + { + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_MShwEffect_p_NextEffect ); + // call the actual method + if ( iMShwEffectManager ) + { + return iMShwEffectManager->Effect( aDirection ); + } + return this; + } + +void TMShwEffectManager_Adapter::ProceedToEffect( TInt aDirection ) + { + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_void_ProceedToNextEffect ); + // call the actual method + if ( iMShwEffectManager ) + { + iMShwEffectManager->ProceedToEffect( aDirection ); + } + } + +void TMShwEffectManager_Adapter::SetEffectOrder( + MShwEffectManager::TShwEffectOrder /*aOrder*/ ) + { + } + +MShwEffectManager::TShwEffectOrder TMShwEffectManager_Adapter::EffectOrder() + { + return EEffectOrderProgrammed; + } + +void TMShwEffectManager_Adapter::SetProgrammedEffects( + RArray< TShwEffectInfo >& /*aEffects*/ ) + { + } + +TInt TMShwEffectManager_Adapter::ProgrammedEffects( + RArray< MShwEffect* >& /*aEffects*/ ) + { + return KErrNone; + } + +void TMShwEffectManager_Adapter::SetDefaultEffectL( TShwEffectInfo /*aInfo*/ ) + { + } + +void TMShwEffectManager_Adapter::GetActiveEffectsL( RPointerArray< MShwEffect >& /*aEffects*/ ) + { + } + +/// MShwEffect part +MShwEffect* TMShwEffectManager_Adapter::CloneLC() + { + return NULL; + } + +void TMShwEffectManager_Adapter::InitializeL( + CHuiEnv* /*aHuiEnv*/, + MGlxVisualList* /*aVisualList*/, + MGlxMediaList* /*aMediaList*/, + TSize /*aScreenSize*/ ) + { + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_MGlxLayout_InitializeL ); + + // allocate to cause an alloc leave in OOM tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +TSize TMShwEffectManager_Adapter::PrepareViewL( CHuiVisual* aVisual, TSize /*aSize*/ ) + { + // store the visual + iPrepareVisual = aVisual; + + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_MGlxLayout_PrepareViewL ); + + // allocate to cause an alloc leave in OOM tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + + return TSize( 0, 0 ); + } + +MGlxLayout* TMShwEffectManager_Adapter::EnterViewL( + CHuiVisual* aVisual, TInt aDuration, TInt /*aDuration2*/ ) + { + iViewDuration = aDuration; + // store the visual + iViewVisual = aVisual; + + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_MGlxLayout_EnterViewL_TInt ); + + // allocate to cause an alloc leave + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + + return NULL; + } + +void TMShwEffectManager_Adapter::ExitView( CHuiVisual* aVisual ) + { + // store the visual + iViewVisual = aVisual; + + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_void_ExitView ); + } + +MGlxLayout* TMShwEffectManager_Adapter::EnterTransitionL( + CHuiVisual* aVisual, TInt aDuration ) + { + iTransitionDuration = aDuration; + // store the visual + iTransitionVisual = aVisual; + + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_MGlxLayout_EnterTransitionL_TInt ); + + // allocate to cause an alloc leave + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + + return NULL; + } + +void TMShwEffectManager_Adapter::ExitTransition( CHuiVisual* aVisual ) + { + // store the visual + iTransitionVisual = aVisual; + + // inform the observer + iMShwEffectManager_Observer->MShwEffectManager_MethodCalled( + MShwEffectManager_Observer::E_void_ExitTransition ); + } + +void TMShwEffectManager_Adapter::PauseL() + { + // allocate to cause an alloc leave + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +void TMShwEffectManager_Adapter::Resume() + { + } + +TShwEffectInfo TMShwEffectManager_Adapter::EffectInfo() + { + TShwEffectInfo info; + info.iName = KNullDesC; + return info; + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/tmshweffectmanager_adapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/tmshweffectmanager_adapter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* 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: Stub file for managing effect in slideshow + * +*/ + + + + +#ifndef __TMSHWEFFECTMANAGER_ADAPTER_H__ +#define __TMSHWEFFECTMANAGER_ADAPTER_H__ + +// EXTERNAL INCLUDES + + +// INTERNAL INCLUDES +#include "mshweffectmanager_observer.h" +#include "shweffectmanager.h" +#include "shweffect.h" + +// FORWARD DECLARATIONS + +// CLASS DEFINITION +/** + * Stub implementation of effect manager and effect. + */ +class TMShwEffectManager_Adapter + : public MShwEffectManager, public MShwEffect + { + public: // Constructors and destructors + + /** + * Construction + */ + TMShwEffectManager_Adapter( MShwEffectManager_Observer* aObserver ); + void SetAdaptee( MShwEffectManager* aAdaptee ); + + public: // From MShwEffectManager + + void AddEffectL( MShwEffect* aEffect ); + MShwEffect* CurrentEffect(); + MShwEffect* Effect( TInt aDirection ); + void ProceedToEffect( TInt aDirection ); + void SetEffectOrder( TShwEffectOrder aOrder ); + TShwEffectOrder EffectOrder(); + void SetProgrammedEffects( RArray< TShwEffectInfo >& aEffects ); + TInt ProgrammedEffects( RArray< MShwEffect* >& aEffects ); + void SetDefaultEffectL(TShwEffectInfo aInfo); + void GetActiveEffectsL( RPointerArray< MShwEffect >& aEffects ); + + public: // From MShwEffect + + MShwEffect* CloneLC(); + void InitializeL( + CHuiEnv* aHuiEnv, + MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, + TSize aScreenSize ); + TSize PrepareViewL( CHuiVisual* aVisual, TSize aSize ); + MGlxLayout* EnterViewL( CHuiVisual* aVisual, TInt aDuration, TInt aDuration2 ); + void ExitView( CHuiVisual* aVisual ); + MGlxLayout* EnterTransitionL( CHuiVisual* aVisual, TInt aDuration ); + void ExitTransition( CHuiVisual* aVisual ); + void PauseL(); + void Resume(); + TShwEffectInfo EffectInfo(); + + public: // Data (for verification) + + TInt iViewDuration; + TInt iTransitionDuration; + CHuiVisual* iPrepareVisual; + CHuiVisual* iViewVisual; + CHuiVisual* iTransitionVisual; + + private: // Data + + MShwEffectManager_Observer* iMShwEffectManager_Observer; + MShwEffectManager* iMShwEffectManager; + + }; + +#endif // __TMSHWEFFECTMANAGER_ADAPTER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/tmshweventobserver_adapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/tmshweventobserver_adapter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +/* +* 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: Stub file for observer of event + * +*/ + + + + +// CLASS HEADER +#include "tmshweventobserver_adapter.h" + +// EXTERNAL INCLUDES +#include +// declate the enum to be printed as TInt +EUNIT_DECLARE_PRINTABLE_AS_TINT( MMShwEventObserver_Observer::TMShwEventObserverMethodId ) + +// INTERNAL INCLUDES + +// CONSTRUCTION + +TMShwEventObserver_Adapter::TMShwEventObserver_Adapter( MMShwEventObserver_Observer* aObserver, MShwEventObserver* aAdaptee ) + : iMMShwEventObserver_Observer( aObserver ), + iMShwEventObserver( aAdaptee ) + { + } + +void TMShwEventObserver_Adapter::NotifyL( MShwEvent* aEvent ) + { + // inform the test case + iMMShwEventObserver_Observer->MShwEventObserver_MethodCalled( MMShwEventObserver_Observer::E_void_NotifyL, aEvent ); + // call the actual method + if ( iMShwEventObserver ) + { + iMShwEventObserver->NotifyL( aEvent ); + } + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/stubs/tmshweventobserver_adapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/stubs/tmshweventobserver_adapter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,84 @@ +/* +* 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: Stub file for observer of event + * +*/ + + + + +#ifndef __TMGLXVISUALLIST_ADAPTER_H__ +#define __TMGLXVISUALLIST_ADAPTER_H__ + +// EXTERNAL INCLUDES +#include "shwevent.h" +#include "shweventobserver.h" + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS + +// CLASS DEFINITION +class MMShwEventObserver_Observer + { + public: // Enums + + enum TMShwEventObserverMethodId + { + E_NotCalled, + E_void_NotifyL + }; + + public: // Destructor + + /** + * Destructor + */ + virtual ~MMShwEventObserver_Observer() {}; + + public: // Abstract methods + + virtual void MShwEventObserver_MethodCalled( TMShwEventObserverMethodId aMethodId, MShwEvent* aEvent ) = 0; + + }; + +// CLASS DEFINITION +/** + * Adapter for event controllers + * for testing purposes + */ +class TMShwEventObserver_Adapter + : public MShwEventObserver + { + public: // Constructors and destructors + + /** + * Construction + */ + TMShwEventObserver_Adapter( MMShwEventObserver_Observer* aObserver, MShwEventObserver* aAdaptee ); + + public: // from MShwEventObserver + + void NotifyL( MShwEvent* aEvent ); + + private: // Data + + MMShwEventObserver_Observer* iMMShwEventObserver_Observer; + MShwEventObserver* iMShwEventObserver; + + }; + +#endif // __TMGLXVISUALLIST_ADAPTER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwdefaulteffectmanager/t_cshwdefaulteffectmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwdefaulteffectmanager/t_cshwdefaulteffectmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,359 @@ +/* +* Copyright (c) 2007-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: Test for default effect order manager + * +*/ + + + +// CLASS HEADER +#include "t_cshwdefaulteffectmanager.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shwdefaulteffectmanager.h" +#include "shweffect.h" +#include "shwslideshowenginepanic.h" + +// STUBS +#include "stub_mshweffect.h" + +// ----------------------------------------------------------------------------- +// Stub for NShwEngine --> +// ----------------------------------------------------------------------------- +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + // do a leave in test situation + User::Leave( aPanic ); + } + } +// ----------------------------------------------------------------------------- +// <-- Stub for NShwEngine +// ----------------------------------------------------------------------------- + +// CONSTRUCTION +T_CShwDefaultEffectManager* T_CShwDefaultEffectManager::NewL() + { + T_CShwDefaultEffectManager* self = T_CShwDefaultEffectManager::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwDefaultEffectManager* T_CShwDefaultEffectManager::NewLC() + { + T_CShwDefaultEffectManager* self = new( ELeave ) T_CShwDefaultEffectManager(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwDefaultEffectManager::~T_CShwDefaultEffectManager() + { + } + +// Default constructor +T_CShwDefaultEffectManager::T_CShwDefaultEffectManager() + { + } + +// Second phase construct +void T_CShwDefaultEffectManager::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS +void T_CShwDefaultEffectManager::EmptySetupL() + { + } + +void T_CShwDefaultEffectManager::SetupL() + { + // create a default effect manager + iDefaultEffectManager = CShwDefaultEffectManager::NewL(); + } + + +void T_CShwDefaultEffectManager::Teardown() + { + delete iDefaultEffectManager; + iDefaultEffectManager = NULL; // set to NULL to prevent double delete + } + +void T_CShwDefaultEffectManager::TestConstructionL() + { + EUNIT_PRINT( _L("TestConstructionL") ); + + // create a default effect manager + CShwDefaultEffectManager* tmp = CShwDefaultEffectManager::NewL(); + + EUNIT_ASSERT_DESC( tmp, "Construction successful"); + + delete tmp; + } + +void T_CShwDefaultEffectManager::TestAddEffectL() + { + T_MShwTestEffect* effect = new(ELeave) T_MShwTestEffect( 0 ); + + CleanupStack::PushL( effect ); + iDefaultEffectManager->AddEffectL( effect ); // takes ownership + CleanupStack::Pop( effect ); + + // TRAP since we expect it to leave + TRAPD( error, iDefaultEffectManager->CurrentEffect() ); + EUNIT_ASSERT_EQUALS_DESC( + NShwEngine::EIncorrectEffectIndex, error, "iEffects was not set"); + // get effects info + TShwEffectInfo info = effect->EffectInfo(); + // set effect order + iDefaultEffectManager->SetDefaultEffectL( info ); + // ask for effect again + MShwEffect* current = iDefaultEffectManager->CurrentEffect(); + // and check that it is the same one as this + EUNIT_ASSERT_DESC( + current == static_cast( effect ), "current effect was set"); + } + +void T_CShwDefaultEffectManager::TestAddNullEffectL() + { + iDefaultEffectManager->AddEffectL( NULL ); + + // TRAP since we expect it to leave + TRAPD( error, iDefaultEffectManager->CurrentEffect() ); + EUNIT_ASSERT_EQUALS_DESC( + NShwEngine::EIncorrectEffectIndex, error, "iEffects was not set"); + + // create empty effect info + TShwEffectInfo info; + // set effect order + TRAP( error, iDefaultEffectManager->SetDefaultEffectL( info ) ); + // ask for effect again + EUNIT_ASSERT_EQUALS_DESC( KErrArgument, error, "illegal argument"); + } + +void T_CShwDefaultEffectManager::TestNextEffectL() + { + // Create two effects + T_MShwTestEffect* effect0 = new(ELeave) T_MShwTestEffect(0); + CleanupStack::PushL( effect0 ); + + // Add the effects + iDefaultEffectManager->AddEffectL( effect0 ); // takes ownership + CleanupStack::Pop( effect0 ); + + // get first effects info + TShwEffectInfo info = effect0->EffectInfo(); + // set default effect, this means that we will take a clone + // of the first effect and return either the original or the + // clone + iDefaultEffectManager->SetDefaultEffectL( info ); + + // Check the current effect + MShwEffect* effect1 = iDefaultEffectManager->CurrentEffect(); + // Expect to get the effects in the order they were added... + EUNIT_ASSERT( effect1 == static_cast( effect0 ) ); + // get the next effect + MShwEffect* effect2 = iDefaultEffectManager->Effect( 1 ); + + // Proceed to next + iDefaultEffectManager->ProceedToEffect( 1 ); + + // + EUNIT_ASSERT( effect2 == iDefaultEffectManager->CurrentEffect() ); + EUNIT_ASSERT( effect1 == iDefaultEffectManager->Effect( 1 ) ); + EUNIT_ASSERT( effect1 == iDefaultEffectManager->Effect( -1 ) ); + EUNIT_ASSERT( effect2 == iDefaultEffectManager->Effect( 2 ) ); + } + +/* +void T_CShwDefaultEffectManager::TestProgrammedEffectL() + { + // Create two effects + T_MShwTestEffect* effect0 = new(ELeave) T_MShwTestEffect(0); + CleanupStack::PushL(effect0); + T_MShwTestEffect* effect1 = new(ELeave) T_MShwTestEffect(1); + CleanupStack::PushL(effect1); + + // Add the effects + iDefaultEffectManager->AddEffectL(effect0); // takes ownership + iDefaultEffectManager->AddEffectL(effect1); // takes ownership + + CleanupStack::Pop(2, effect0); + + // Specify programmed order + iDefaultEffectManager->SetEffectOrder(MShwEffectManager::EShwEffectOrderProgrammed); + + // Create the programmed order + RArray programme; + CleanupClosePushL(programme); +// CleanupStack::PushL(&programme); + programme.AppendL(effect1); + programme.AppendL(effect0); + programme.AppendL(effect1); + + // Set the order + iDefaultEffectManager->SetProgrammedEffects(programme); + + // + // Check the first effect + MShwEffect* inEffect = static_cast(effect1); + MShwEffect* outEffect = iDefaultEffectManager->CurrentEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + + inEffect = static_cast(effect0); + outEffect = iDefaultEffectManager->NextEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + + iDefaultEffectManager->ProceedToNextEffect(); + + inEffect = static_cast(effect1); + outEffect = iDefaultEffectManager->NextEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + + CleanupStack::PopAndDestroy(&programme); + } + + +void T_CShwDefaultEffectManager::TestMultiProgrammedEffectL() + { + // Create two effects + T_MShwTestEffect* effect0 = new(ELeave) T_MShwTestEffect(0); + CleanupStack::PushL(effect0); + T_MShwTestEffect* effect1 = new(ELeave) T_MShwTestEffect(1); + CleanupStack::PushL(effect1); + T_MShwTestEffect* effect2 = new(ELeave) T_MShwTestEffect(2); + CleanupStack::PushL(effect2); + + // Add the effects + iDefaultEffectManager->AddEffectL(effect0); // takes ownership + iDefaultEffectManager->AddEffectL(effect1); // takes ownership + iDefaultEffectManager->AddEffectL(effect2); // takes ownership + + CleanupStack::Pop(3, effect0); + + // Specify programmed order + iDefaultEffectManager->SetEffectOrder(MShwEffectManager::EShwEffectOrderProgrammed); + + // Create the programmed order + RArray programme; + CleanupClosePushL(programme); +// CleanupStack::PushL(&programme); + programme.AppendL(effect2); + programme.AppendL(effect1); + programme.AppendL(effect0); + programme.AppendL(effect2); + programme.AppendL(effect1); + programme.AppendL(effect0); + + // Set the order + iDefaultEffectManager->SetProgrammedEffects(programme); + + // + // Check the effect order is retrieved as 2, 1, 0 + MShwEffect* inEffect = static_cast(effect2); + MShwEffect* outEffect = iDefaultEffectManager->CurrentEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + + inEffect = static_cast(effect1); + outEffect = iDefaultEffectManager->NextEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + + iDefaultEffectManager->ProceedToNextEffect(); + + inEffect = static_cast(effect2); + outEffect = iDefaultEffectManager->NextEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + + iDefaultEffectManager->ProceedToNextEffect(); + + inEffect = static_cast(effect1); + outEffect = iDefaultEffectManager->NextEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + + iDefaultEffectManager->ProceedToNextEffect(); + + inEffect = static_cast(effect0); + outEffect = iDefaultEffectManager->NextEffect(); + EUNIT_ASSERT_EQUALS(inEffect, outEffect); + iDefaultEffectManager->ProceedToNextEffect(); + + CleanupStack::PopAndDestroy(&programme); + } +*/ + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwDefaultEffectManager, + "Test suite for CShwDefaultEffectManager.", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Construct - Destruct Test", + "CShwDefaultEffectManager", + "CShwDefaultEffectManager", + "FUNCTIONALITY", + EmptySetupL, TestConstructionL, Teardown ) // needs to have teardown as alloc test + +EUNIT_TEST( + "Add Effect Test", + "CShwDefaultEffectManager", + "CShwDefaultEffectManager", + "FUNCTIONALITY", + SetupL, TestAddEffectL, Teardown ) + +EUNIT_TEST( + "Add NULL Effect Test", + "CShwDefaultEffectManager", + "CShwDefaultEffectManager", + "FUNCTIONALITY", + SetupL, TestAddNullEffectL, Teardown ) + +EUNIT_TEST( + "Next Effect Test", + "CShwDefaultEffectManager", + "CShwDefaultEffectManager", + "FUNCTIONALITY", + SetupL, TestNextEffectL, Teardown ) + +/* +EUNIT_TEST( + "Programmed Effect Test", + "CShwDefaultEffectManager", + "CShwDefaultEffectManager", + "FUNCTIONALITY", + SetupL, TestProgrammedEffectL, Teardown ) + +EUNIT_TEST( + "Multi Prog Test", + "CShwDefaultEffectManager", + "CShwDefaultEffectManager", + "FUNCTIONALITY", + SetupL, TestMultiProgrammedEffectL, Teardown ) +*/ + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwdefaulteffectmanager/t_cshwdefaulteffectmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwdefaulteffectmanager/t_cshwdefaulteffectmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2007-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: Test for default effect order manager + * +*/ + + + + +#ifndef __T_CSHWDEFAULTEFFECTMANAGER_H__ +#define __T_CSHWDEFAULTEFFECTMANAGER_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CShwDefaultEffectManager; +class CShwCrossFadeEffect; +class CShwZoomAndPanEffect; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_CShwDefaultEffectManager ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwDefaultEffectManager* NewL(); + static T_CShwDefaultEffectManager* NewLC(); + /** + * Destructor + */ + ~T_CShwDefaultEffectManager(); + + private: // Constructors and destructors + + T_CShwDefaultEffectManager(); + void ConstructL(); + + private: // New methods + + void EmptySetupL(); + void SetupL(); + + void Teardown(); + + void TestConstructionL(); + void TestAddEffectL(); + void TestAddNullEffectL(); + void TestNextEffectL(); + void TestProgrammedEffectL(); + void TestMultiProgrammedEffectL(); + + private: // Data + CShwDefaultEffectManager* iDefaultEffectManager; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWDEFAULTEFFECTMANAGER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwdefaulteffectmanager/t_cshwdefaulteffectmanager_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwdefaulteffectmanager/t_cshwdefaulteffectmanager_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2007-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: Test for default effect order manager + * +*/ + + + + + +// CLASS HEADER +#include "t_cshwdefaulteffectmanager.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwDefaultEffectManager::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweffectcontrol/t_cshweffectcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweffectcontrol/t_cshweffectcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,930 @@ +/* +* 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: Test for effect control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "t_cshweffectcontrol.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shwslideshowenginepanic.h" +#include "shweffectcontrol.h" +#include "shwevent.h" +#include "shwthumbnailcontext.h" +#include "shwautoptr.h" + +#include "stub_tglxlayoutsplitter.h" +#include "stub_glxfetchcontexts.h" + +// ----------------------------------------------------------------------------- +// Stub for NShwEngine::Panic --> +// ----------------------------------------------------------------------------- +TBool gNShwEnginePanicCalled = EFalse; +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + gNShwEnginePanicCalled = ETrue; + // in test situation just do a leave + User::Leave( aPanic ); + } + } +// ----------------------------------------------------------------------------- +// <-- Stub for NShwEngine::Panic +// ----------------------------------------------------------------------------- + +// CONSTRUCTION +T_CShwEffectControl* T_CShwEffectControl::NewL() + { + T_CShwEffectControl* self = T_CShwEffectControl::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwEffectControl* T_CShwEffectControl::NewLC() + { + T_CShwEffectControl* self = new( ELeave ) T_CShwEffectControl(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwEffectControl::~T_CShwEffectControl() + { + } + +// Default constructor +T_CShwEffectControl::T_CShwEffectControl() : + iStubEffectManager( this ) + { + } + +// Second phase construct +void T_CShwEffectControl::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS +void T_CShwEffectControl::MGlxMediaList_MethodCalled( TMGlxMediaListMethodId aMethodId ) + { + // append the methodid in the array + TInt error = iMediaListCalls.Append( aMethodId ); + // check that append succeeded + if( error != KErrNone ) + { + // critical error, not enough space to append messages + User::Panic( _L("T_CShwEffectControl::MGlxMediaList_MethodCalled"), __LINE__ ); + } + } + +void T_CShwEffectControl::MGlxVisualList_MethodCalled( TMGlxVisualListMethodId aMethodId ) + { + // append the methodid in the array + TInt error = iVisualListCalls.Append( aMethodId ); + // check that append succeeded + if( error != KErrNone ) + { + // critical error, not enough space to append messages + User::Panic( _L("TestError:AppendFail"), -1 ); + } + } + +void T_CShwEffectControl::MShwEffectManager_MethodCalled( TMShwEffectManagerMethodId aMethodId ) + { + // append the methodid in the array + TInt error = iEffectCalls.Append( aMethodId ); + // check that append succeeded + if( error != KErrNone ) + { + // critical error, not enough space to append messages + User::Panic( _L("TestError:AppendFail"), -2 ); + } + } + +TInt gSendEventLeaveCode = KErrNone; +void T_CShwEffectControl::SendEventL( MShwEvent* aEvent ) + { + // need to clone the event since the caller goes out of scope + TInt error = iEvents.Append( aEvent->CloneLC() ); + CleanupStack::Pop(); + // check that append succeeded + if( error != KErrNone ) + { + // critical error, not enough space to append events + User::Panic( _L("T_CShwEffectControl::NotifyL"), __LINE__ ); + } + User::LeaveIfError( gSendEventLeaveCode ); + + // stop the scheduler loop if its started + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +void T_CShwEffectControl::EmptySetupL() + { + gNShwEnginePanicCalled = EFalse; // by default no panic was called + gSendEventLeaveCode = KErrNone; // by default no leaves in SendEventL + // make room for 20 entries on each array + iVisualListCalls.ReserveL( 20 ); + iMediaListCalls.ReserveL( 20 ); + iEffectCalls.ReserveL( 20 ); + iEvents.ReserveL( 20 ); + + iStubVisualList = new( ELeave ) TMGlxVisualList_Adapter( this ); + iStubMediaList = new( ELeave ) TMGlxMediaList_Stub( this ); + + // set the size and focus of the list + iStubVisualList->iSize = 3; + iStubVisualList->iFocus = 1; + iStubMediaList->iCount = 3; + iStubMediaList->iFocus = 1; + + iStubEffectManager.iViewDuration = 0; + iStubEffectManager.iTransitionDuration = 0; + + // reset the visuals of effect stub + iStubEffectManager.iPrepareVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iViewVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iTransitionVisual = reinterpret_cast( KErrNotFound ); + + // tell the thumbnail stub to add attributes + // this tells the thumbnailcontext stub to add entries to the + // array which then tell the thumbnail loader that the + // thumbnail was not yet loaded + gThumbnailContextRequestCount = 1; + // by default size is available + gTGlxMediaGetDimensions = ETrue; + // by default we dont want alloc behavior + gFetchContextAllocTest = EFalse; + } + +void T_CShwEffectControl::SetupL() + { + // reuse the empty version to create the stubs + EmptySetupL(); + // create the effect control + iCShwEffectControl = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // set the event queue + iCShwEffectControl->SetEventQueue( this ); + + // perform the second phase of construction + TShwEventInitialize initEvent; + iCShwEffectControl->NotifyL( &initEvent ); + } + +void T_CShwEffectControl::Teardown() + { + // delete effect control + delete iCShwEffectControl; + iCShwEffectControl = NULL; + // close the arrays + iEffectCalls.Close(); + iVisualListCalls.Close(); + iMediaListCalls.Close(); + // release events + for( TInt i=0; iiSize = 11; + iStubVisualList->iFocus = 10; + // reset the state as setup uses splitter + gSplitterAddLayoutLCalled = EFalse; + gSplitterRemoveLayoutLCalled = EFalse; + // create an effect control + CShwEffectControl* tmp = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // need to put to cleanupstack in case NotifyL leaves + CleanupStack::PushL( tmp ); + + EUNIT_ASSERT_DESC( tmp, "Construction successfull"); + + EUNIT_ASSERT_EQUALS_DESC( 0, iEffectCalls.Count(), "Effect manager was not called" ); + + // perform the second phase of construction + TShwEventInitialize initEvent; + tmp->NotifyL( &initEvent ); + + // check that the calls made by CShwEffectControl were correct ones + EUNIT_ASSERT_EQUALS_DESC( 2, iEffectCalls.Count(), "Effect manager was called 2 times" ); + EUNIT_ASSERT_EQUALS_DESC( E_MShwEffect_p_CurrentEffect, iEffectCalls[ 0 ], "current effect was called" ); + EUNIT_ASSERT_EQUALS_DESC( E_MGlxLayout_PrepareViewL, iEffectCalls[ 1 ], "current effect was called" ); + + // test notify again with size not available + gTGlxMediaGetDimensions = EFalse; + // call notify again + tmp->NotifyL( &initEvent ); + // check that the calls made by CShwEffectControl were correct ones + EUNIT_ASSERT_EQUALS_DESC( 4, iEffectCalls.Count(), "Effect manager was called 4 times" ); + EUNIT_ASSERT_EQUALS_DESC( E_MShwEffect_p_CurrentEffect, iEffectCalls[ 2 ], "current effect was called" ); + EUNIT_ASSERT_EQUALS_DESC( E_MGlxLayout_PrepareViewL, iEffectCalls[ 3 ], "current effect was called" ); + + // check splitter usage + EUNIT_ASSERT_DESC( !gSplitterAddLayoutLCalled, "layout was not set" ); + EUNIT_ASSERT_DESC( !gSplitterRemoveLayoutLCalled, "layout was not removed" ); + + CleanupStack::PopAndDestroy( tmp ); + } + +void T_CShwEffectControl::TransitionCompletedL() + { + // reset the state as setup uses splitter + gSplitterAddLayoutLCalled = EFalse; + gSplitterRemoveLayoutLCalled = EFalse; + + // call transition completed + iCShwEffectControl->SendTransitionReadyL(); + + // check that we got the correct event + EUNIT_ASSERT_DESC( iEvents.Count() > 0, "we got an event"); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 0 ] ), + "event was correct class" ); + + // check splitter usage + EUNIT_ASSERT_DESC( !gSplitterAddLayoutLCalled, "layout was not set" ); + EUNIT_ASSERT_DESC( !gSplitterRemoveLayoutLCalled, "layout was not removed" ); + } + +void T_CShwEffectControl::TransitionCompleted2L() + { + // tell the thumbnail context that the thumbnail is already loaded + // so that the thumbnail loader will immediately make the callback + gThumbnailContextRequestCount = 0; + // tell the medialist stub to notify that we have the first thumbnail loaded + iStubMediaList->NotifyAttributesAvailableL( iStubMediaList->iFocus ); + + // check that we dont have event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "event received"); + // check that we got the correct event + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 0 ] ), + "event was correct class" ); + + // send the event + TShwEventStartTransition trans( 123 ); + iCShwEffectControl->NotifyL( &trans ); + + // start the wait loop + iWait.Start(); + // check that we got event + EUNIT_ASSERT_EQUALS_DESC( 3, iEvents.Count(), "we got an event"); + // check that we got the correct events + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 1 ] ), + "event was correct class" ); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 2 ] ), + "event was correct class" ); + } + +void T_CShwEffectControl::NotifyLL() + { + TInt initialEffectCalls = iEffectCalls.Count(); + TInt initialVisualCalls = iVisualListCalls.Count(); + + // reset the state as setup uses splitter + gSplitterAddLayoutLCalled = EFalse; + gSplitterRemoveLayoutLCalled = EFalse; + // reset the visuals + iStubEffectManager.iPrepareVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iViewVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iTransitionVisual = reinterpret_cast( KErrNotFound ); + + // test not supported event path + iCShwEffectControl->NotifyL( NULL ); + + // check that there was no new calls made by CShwEffectControl to visual list or effect manager + EUNIT_ASSERT_EQUALS_DESC( initialEffectCalls, iEffectCalls.Count(), "Effect manager was not called" ); + EUNIT_ASSERT_EQUALS_DESC( initialVisualCalls, iVisualListCalls.Count(), "Visual list was not called" ); + + // test if( viewEvent ) + + // tell the stub context that a request is complete + gThumbnailContextRequestCount = KErrNone; + // tell the media list stub to notify that thumbnail in focus is loaded + iStubMediaList->NotifyAttributesAvailableL( iStubMediaList->iFocus ); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + + // tell the stub context that its request is complete, at this point there is no + // context so we only test that thumbnail context works without one + gThumbnailContextRequestCount = KErrNone; + // tell the media list stub to notify that next thumbnail is loaded + // remember the modulo + iStubMediaList->NotifyAttributesAvailableL( + ( iStubMediaList->iFocus + 1 )%iStubMediaList->iCount ); + + // if( view_event ) : true + // if( iLoopStarted ) : false + TShwEventStartView start( 999 ); + iCShwEffectControl->NotifyL( &start ); + + // thumbnail notify is always asynchronous so first check we did not yet get the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got only previous event"); + // start async wait + iWait.Start(); + + // check that we got view ready event + EUNIT_ASSERT_EQUALS_DESC( 2, iEvents.Count(), "we got an event"); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ 1 ] ), "TShwEventReadyToAdvance received" ); + + // check the visual given to effect + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iPrepareVisual, 2, "prepare was given visual 2 (focus is on 1)" ); + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iViewVisual, 1, "view was given visual 1 (focus is on 1)" ); + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iTransitionVisual, KErrNotFound, "transition was not given visual" ); + // check splitter usage + EUNIT_ASSERT_DESC( gSplitterAddLayoutLCalled, "layout was set (view layout)" ); + EUNIT_ASSERT_DESC( gSplitterRemoveLayoutLCalled, "layout was removed (old view layout)" ); + + // test path: + EUNIT_PRINT( _L("if( view_event ) : false") ); + EUNIT_PRINT( _L("else if( trans_event ) : true") ); + // if( view_event ) : false + // else if( trans_event ) : true + TInt effectCalls = iEffectCalls.Count(); + TInt visualCalls = iVisualListCalls.Count(); + // reset the visuals + iStubEffectManager.iPrepareVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iViewVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iTransitionVisual = reinterpret_cast( KErrNotFound ); + // send the event + TShwEventStartTransition trans( 666 ); + iCShwEffectControl->NotifyL( &trans ); + // check that view duration was stored from view event + EUNIT_ASSERT_EQUALS_DESC( 999, iStubEffectManager.iViewDuration, "view duration is set correctly" ); + // check that transition duration was given as parameter + EUNIT_ASSERT_EQUALS_DESC( 666, iStubEffectManager.iTransitionDuration, "transition duration is set correctly" ); + // check the visual given to effect + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iPrepareVisual, KErrNotFound, "prepare was not given visual" ); + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iViewVisual, 2, "view was given visual 2 (focus is on 2)" ); + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iTransitionVisual, 1, "transition was given visual 1 (focus is on 1)" ); + // check splitter usage + EUNIT_ASSERT_DESC( gSplitterAddLayoutLCalled, "layout was set" ); + EUNIT_ASSERT_DESC( gSplitterRemoveLayoutLCalled, "layout was removed" ); + + // test path: + EUNIT_PRINT( _L("if( view_event ) : true") ); + EUNIT_PRINT( _L("if( iLoopStarted ) : true") ); + EUNIT_PRINT( _L("else if( trans_event ) : false") ); + // if( view_event ) : true + // if( iLoopStarted ) : true + // reset the state of splitter stub + gSplitterAddLayoutLCalled = EFalse; + gSplitterRemoveLayoutLCalled = EFalse; + effectCalls = iEffectCalls.Count(); + visualCalls = iVisualListCalls.Count(); + // reset the visuals + iStubEffectManager.iPrepareVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iViewVisual = reinterpret_cast( KErrNotFound ); + iStubEffectManager.iTransitionVisual = reinterpret_cast( KErrNotFound ); + // move focus to 2 + iStubVisualList->iFocus = 2; + iStubMediaList->iFocus = 2; + + // tell the stub context that its request is complete + gThumbnailContextRequestCount = KErrNone; + // tell the media list stub to notify that thumbnail is loaded + // remember the modulo + iStubMediaList->NotifyAttributesAvailableL( + ( iStubMediaList->iFocus + 1 )%iStubMediaList->iCount ); + + // send the event + TShwEventStartView start2( 123 ); + iCShwEffectControl->NotifyL( &start2 ); + + // check we got the ready to view event + EUNIT_ASSERT_EQUALS_DESC( 3, iEvents.Count(), "we got ready to view"); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ 2 ] ), "TShwEventReadyToView received" ); + // start async wait + iWait.Start(); + + // check that view duration was not set + EUNIT_ASSERT_EQUALS_DESC( 999, iStubEffectManager.iViewDuration, "view duration is same as last, see above" ); + // check the visual given to effect + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iPrepareVisual, 0, "prepare view was given visual 0 (focus is on 2, size is 3)" ); + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iViewVisual, KErrNotFound, "view was not given visual" ); + EUNIT_ASSERT_EQUALS_DESC( (TInt)iStubEffectManager.iTransitionVisual, 1, "exit transition was given visual 1 (focus is on 2)" ); + // check that we got view ready event + EUNIT_ASSERT_EQUALS_DESC( 4, iEvents.Count(), "event received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ 3 ] ), "TShwEventReadyToAdvance received" ); + + // check splitter usage + EUNIT_ASSERT_DESC( !gSplitterAddLayoutLCalled, "layout was not set" ); + EUNIT_ASSERT_DESC( gSplitterRemoveLayoutLCalled, "layout was removed" ); + } + +void T_CShwEffectControl::SlowImageLoadL() + { + // test path: + EUNIT_PRINT( _L("if( view_event ) : true") ); + EUNIT_PRINT( _L("if( iLoopStarted ) : false") ); + EUNIT_PRINT( _L("else if( trans_event ) : false") ); + + // tell the stub context that its request is complete + gThumbnailContextRequestCount = KErrNone; + // tell the media list stub to notify that thumbnail in focus is loaded + iStubMediaList->NotifyAttributesAvailableL( iStubMediaList->iFocus ); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + + // tell the stub context that its request is not complete + gThumbnailContextRequestCount = 1; + + // if( view_event ) : true + // if( iLoopStarted ) : false + TShwEventStartView start( 999 ); + iCShwEffectControl->NotifyL( &start ); + // variable iLoopStarted is initialized as false so we dont go through the loop + // check that we got view ready event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "new event not received" ); + + // tell the stub context that its request is complete + gThumbnailContextRequestCount = KErrNone; + // tell the media list stub to notify that thumbnail is loaded + // remember the modulo + iStubMediaList->NotifyAttributesAvailableL( + ( iStubMediaList->iFocus + 1 )%iStubMediaList->iCount ); + + EUNIT_ASSERT_EQUALS_DESC( 2, iEvents.Count(), "we got an event"); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ 1 ] ), "TShwEventReadyToAdvance received" ); + } + +void T_CShwEffectControl::SlowImageLoad2L() + { + // set the size and focus of the list + iStubVisualList->iSize = 10; + iStubVisualList->iFocus = 1; + iStubMediaList->iCount = 10; + iStubMediaList->iFocus = 1; + // test path: + EUNIT_PRINT( _L("if( view_event ) : true") ); + EUNIT_PRINT( _L("if( iLoopStarted ) : false") ); + EUNIT_PRINT( _L("else if( trans_event ) : false") ); + + // tell the stub context that its request is complete + gThumbnailContextRequestCount = KErrNone; + // tell the media list stub to notify that thumbnail in focus is loaded + iStubMediaList->NotifyAttributesAvailableL( iStubMediaList->iFocus ); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + + // tell the stub context that its request is not complete + gThumbnailContextRequestCount = 1; + + // if( view_event ) : true + // if( iLoopStarted ) : false + TShwEventStartView start( 999 ); + iCShwEffectControl->NotifyL( &start ); + // variable iLoopStarted is initialized as false so we dont go through the loop + // check that we got view ready event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "new event not received" ); + + // tell the stub context that its request is complete + gThumbnailContextRequestCount = KErrNone; + // tell the media list stub to notify that thumbnail is loaded + // remember the modulo + iStubMediaList->NotifyAttributesAvailableL( + ( iStubMediaList->iFocus + 3 )%iStubMediaList->iCount ); + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "new event not received" ); + + // tell the media list stub to notify that thumbnail is loaded + // remember the modulo + iStubMediaList->NotifyAttributesAvailableL( + ( iStubMediaList->iFocus + 2 )%iStubMediaList->iCount ); + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "new event not received" ); + + // tell the stub context that its request is not complete + gThumbnailContextRequestCount = 1; + // tell the media list stub to notify that thumbnail is loaded + // remember the modulo + iStubMediaList->NotifyAttributesAvailableL( + ( iStubMediaList->iFocus + 1 )%iStubMediaList->iCount ); + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "new event not received" ); + + // tell the stub context that its request is complete + gThumbnailContextRequestCount = KErrNone; + iStubMediaList->NotifyAttributesAvailableL( + ( iStubMediaList->iFocus + 1 )%iStubMediaList->iCount ); + EUNIT_ASSERT_EQUALS_DESC( 2, iEvents.Count(), "event received" ); + // this was second time the event was received so we get view complete event + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 1 ] ), + "TShwEventViewReady received" ); + } + +void T_CShwEffectControl::HandleFocusChangedL() + { + TInt initialVisualListCalls = iVisualListCalls.Count(); + iCShwEffectControl->HandleFocusChangedL( 0, 0, NULL, NGlxListDefs::EUnknown ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + initialVisualListCalls, iVisualListCalls.Count(), "Visual list was called" ); + } + +void T_CShwEffectControl::TestThumbnailLoadingL() + { + // create shw thumbnail context for index 1 and size 100,100 + const TInt thumbIndex = 1; + CShwThumbnailContext* context = CShwThumbnailContext::NewLC( thumbIndex, TSize( 100, 100 ) ); + + // test that the index is returned + // set iterator to first + context->SetToFirst( iStubMediaList ); + // then iterate once + TInt index = (*context)++; + EUNIT_ASSERT_EQUALS_DESC( thumbIndex, index, "check first iterated index" ); + + index = (*context)++; + EUNIT_ASSERT_EQUALS_DESC( KErrNotFound, index, "next index is KErrNotFound" ); + + // check range + EUNIT_ASSERT_DESC( !context->InRange( thumbIndex-1 ), "thumbIndex-1 is not in range" ); + EUNIT_ASSERT_DESC( !context->InRange( thumbIndex+1 ), "thumbIndex+1 is not in range" ); + EUNIT_ASSERT_DESC( context->InRange( thumbIndex ), "thumbIndex is in range" ); + + CleanupStack::PopAndDestroy( context ); + } + +void T_CShwEffectControl::TestErrorsInThumbnailLoadingL() + { + // set the size and focus of the list + iStubVisualList->iSize = 10; + iStubVisualList->iFocus = 1; + iStubMediaList->iCount = 10; + iStubMediaList->iFocus = 1; +// first test that first thumbnail does not load + // tell the stub context that its request has error + gThumbnailContextRequestCount = KErrCorrupt; + { + // create an effect control, no need to delete or cleanupstack + TShwAutoPtr< CShwEffectControl > tmp = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // need to set the event queue + tmp->SetEventQueue( this ); + // perform the second phase of construction + TShwEventInitialize initEvent; + tmp->NotifyL( &initEvent ); + + // check that we did not get an event + EUNIT_ASSERT_EQUALS_DESC( 0, iEvents.Count(), "we did not yet get an event"); + + // start async wait loop + iWait.Start(); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + // delete and remove the event + delete iEvents[ 0 ]; + iEvents.Remove( 0 ); + // tmp gets deleted here, EUnit checks for memory + } + +// test that second thumbnail does not load + // tell the stub context that its request is not yet completed + gThumbnailContextRequestCount = 1; + { + // create an effect control, no need to delete or cleanupstack + TShwAutoPtr< CShwEffectControl > tmp = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // need to set the event queue + tmp->SetEventQueue( this ); + // perform the second phase of construction + TShwEventInitialize initEvent; + tmp->NotifyL( &initEvent ); + // check that we did not get an event + EUNIT_ASSERT_EQUALS_DESC( 0, iEvents.Count(), "we did not yet get new event"); + + // tell the stub context that the request has error + gThumbnailContextRequestCount = KErrCorrupt; + // tell the media list stub to notify that first thumbnail is loaded + iStubMediaList->NotifyAttributesAvailableL( iStubMediaList->iFocus ); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + // delete and remove the event + delete iEvents[ 0 ]; + iEvents.Remove( 0 ); + // tmp gets deleted here, EUnit checks for memory + } + +// test HandleError call before first thumbnail + // tell the stub context that its request is not yet completed + gThumbnailContextRequestCount = 1; + { + // create an effect control, no need to delete or cleanupstack + TShwAutoPtr< CShwEffectControl > tmp = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // need to set the event queue + tmp->SetEventQueue( this ); + // perform the second phase of construction + TShwEventInitialize initEvent; + tmp->NotifyL( &initEvent ); + // check that we did not get an event + EUNIT_ASSERT_EQUALS_DESC( 0, iEvents.Count(), "we did not yet get new event"); + + // tell the stub context that the request has error + gThumbnailContextRequestCount = KErrCorrupt; + // tell the media list stub to notify that there was an error + iStubMediaList->NotifyError( KErrNoMemory ); + + // start async wait loop + iWait.Start(); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + // delete and remove the event + delete iEvents[ 0 ]; + iEvents.Remove( 0 ); + // tmp gets deleted here, EUnit checks for memory + } + +// test HandleError call after first thumbnail + // tell the stub context that its request is completed + gThumbnailContextRequestCount = KErrNone; + { + // create an effect control, no need to delete or cleanupstack + TShwAutoPtr< CShwEffectControl > tmp = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // need to set the event queue + tmp->SetEventQueue( this ); + // perform the second phase of construction + TShwEventInitialize initEvent; + tmp->NotifyL( &initEvent ); + // check that we did not get an event + EUNIT_ASSERT_EQUALS_DESC( 0, iEvents.Count(), "we did not yet get new event"); + + // start async wait loop + iWait.Start(); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + // delete and remove the event + delete iEvents[ 0 ]; + iEvents.Remove( 0 ); + + // tell the stub context that its request is not yet completed + gThumbnailContextRequestCount = 1; + // send start view + TShwEventStartView startView( 123 ); + tmp->NotifyL( &startView ); + + // tell the stub context that the request has error + gThumbnailContextRequestCount = KErrCorrupt; + // tell the media list stub to notify that there was an error + iStubMediaList->NotifyError( KErrNoMemory ); + + // start async wait loop + iWait.Start(); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToAdvance* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + // delete and remove the event + delete iEvents[ 0 ]; + iEvents.Remove( 0 ); + // tmp gets deleted here, EUnit checks for memory + } + +// test HandleItemRemovedL call + // tell the stub context that its request is not completed + gThumbnailContextRequestCount = KErrNone; + { + // create an effect control, no need to delete or cleanupstack + TShwAutoPtr< CShwEffectControl > tmp = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // need to set the event queue + tmp->SetEventQueue( this ); + // perform the second phase of construction + TShwEventInitialize initEvent; + tmp->NotifyL( &initEvent ); + // check that we did not get an event + EUNIT_ASSERT_EQUALS_DESC( 0, iEvents.Count(), "we did not yet get new event"); + + // start async wait loop + iWait.Start(); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventReadyToView* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + // delete and remove the event + delete iEvents[ 0 ]; + iEvents.Remove( 0 ); + + // tell medialist stub to call HandleItemRemovedL + iStubMediaList->NotifyItemRemoved( 0, 1 ); + // this time the list was not empty so nothing done + // check that we got no event + EUNIT_ASSERT_EQUALS_DESC( 0, iEvents.Count(), "we got no event"); + // remove items from stub medialist + iStubMediaList->iCount = 0; + // tell medialist stub to call HandleItemRemovedL + iStubMediaList->NotifyItemRemoved( 0, 1 ); + + // check that we got the event + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "we got an event"); + // this was the first time the event was received so we get init complete event + EUNIT_ASSERT_DESC( + dynamic_cast< TShwEventFatalError* >( iEvents[ 0 ] ), + "TShwEventReadyToView received" ); + // delete and remove the event + delete iEvents[ 0 ]; + iEvents.Remove( 0 ); + + // tell medialist stub to call HandleItemRemovedL again + iStubMediaList->NotifyItemRemoved( 0, 1 ); + // this does nothing as the thumbnail loader was deleted and all contexts removed + // check that we got no event + EUNIT_ASSERT_EQUALS_DESC( 0, iEvents.Count(), "we got an event"); + // tmp gets deleted here, EUnit checks for memory + } + + // test also leave on SendEventL + // tell the stub context that its request is not completed + gThumbnailContextRequestCount = KErrNone; + { + // create an effect control, no need to delete or cleanupstack + TShwAutoPtr< CShwEffectControl > tmp = + CShwEffectControl::NewL( + iStubEffectManager, *iStubVisualList, *iStubMediaList, TSize( 320, 240 ) ); + // need to set the event queue + tmp->SetEventQueue( this ); + // perform the second phase of construction + TShwEventInitialize initEvent; + tmp->NotifyL( &initEvent ); + // start async wait loop + iWait.Start(); + // remove items from stub medialist + iStubMediaList->iCount = 0; + // tell SendEventL to leave + gSendEventLeaveCode = KErrNoMemory; + // tell medialist stub to call HandleItemRemovedL + TRAPD( error, iStubMediaList->NotifyItemRemoved( 0, 1 ) ); + // check that engine did panic + EUNIT_ASSERT_DESC( gNShwEnginePanicCalled, "Engine panic was called" ); + EUNIT_ASSERT_EQUALS_DESC( + NShwEngine::EEngineFatalError, error, "panic code was fatal error"); + } + + } + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwEffectControl, + "Test suite for CShwEffectControl", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Construct-destruct test", + "CShwEffectControl", + "CShwEffectControl", + "FUNCTIONALITY", + EmptySetupL, TestConstructionL, Teardown ) // needs to have teardown as alloc test + +EUNIT_ALLOC_TEST( + "test TransitionCompleted", + "CShwEffectControl", + "TransitionCompleted", + "FUNCTIONALITY", + SetupL, TransitionCompletedL, Teardown ) + +EUNIT_NOT_DECORATED_TEST( // cant be decorated as active objects + "test TransitionCompleted", + "CShwEffectControl", + "TransitionCompleted", + "FUNCTIONALITY", + SetupL, TransitionCompleted2L, Teardown ) + +EUNIT_NOT_DECORATED_TEST( // cant be decorated as active objects + "test NotifyL", + "CShwEffectControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, NotifyLL, Teardown ) + +EUNIT_NOT_DECORATED_TEST( // cant be decorated as active objects + "slow image load", + "CShwEffectControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, SlowImageLoadL, Teardown ) + +EUNIT_NOT_DECORATED_TEST( // cant be decorated as active objects + "slow image load", + "CShwEffectControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, SlowImageLoad2L, Teardown ) + +EUNIT_TEST( + "HandleFocusChangedL", + "CShwEffectControl", + "HandleFocusChangedL", + "FUNCTIONALITY", + SetupL, HandleFocusChangedL, Teardown ) + +EUNIT_TEST( + "Thumbnail loading", + "CShwThumbnailContext", + "multiple", + "FUNCTIONALITY", + SetupL, TestThumbnailLoadingL, Teardown ) + +EUNIT_TEST( + "Thumbnail errors", + "CShwThumbnailLoader", + "multiple", + "FUNCTIONALITY", + EmptySetupL, TestErrorsInThumbnailLoadingL, Teardown ) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweffectcontrol/t_cshweffectcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweffectcontrol/t_cshweffectcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,112 @@ +/* +* 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: Test for effect control for the slideshow + * +*/ + + + + +#ifndef __T_CSHWEFFECTCONTROL_H__ +#define __T_CSHWEFFECTCONTROL_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES +#include "tmglxvisuallist_adapter.h" +#include "tmglxmedialist_stub.h" +#include "tmshweffectmanager_adapter.h" +#include "shweventqueue.h" + +// FORWARD DECLARATIONS +class CShwEffectControl; + +// CLASS DEFINITION +/** + * EUnit test suite for CShwEffectControl + * + */ +NONSHARABLE_CLASS( T_CShwEffectControl ) + : public CEUnitTestSuiteClass, + public MGlxMediaList_Stub_Observer, + public MGlxVisualList_Observer, + public MShwEffectManager_Observer, + public MShwEventQueue + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwEffectControl* NewL(); + static T_CShwEffectControl* NewLC(); + /** + * Destructor + */ + ~T_CShwEffectControl(); + + private: // Constructors and destructors + + T_CShwEffectControl(); + void ConstructL(); + + public: // from MGlxMediaList_Stub_Observer, MGlxVisualList_Observer, MShwEffectManager_Observer, MShwEventQueue + + void MGlxMediaList_MethodCalled( TMGlxMediaListMethodId aMethodId ); + void MGlxVisualList_MethodCalled( TMGlxVisualListMethodId aMethodId ); + void MShwEffectManager_MethodCalled( TMShwEffectManagerMethodId aMethodId ); + void SendEventL( MShwEvent* aEvent ); + + private: // New methods + + void EmptySetupL(); + void SetupL(); + void Teardown(); + + void TestConstructionL(); + void TransitionCompletedL(); + void TransitionCompleted2L(); + void NotifyLL(); + void SlowImageLoadL(); + void SlowImageLoad2L(); + void HandleFocusChangedL(); + void TestThumbnailLoadingL(); + void TestErrorsInThumbnailLoadingL(); + + private: // Data + + CShwEffectControl* iCShwEffectControl; + + TMGlxVisualList_Adapter* iStubVisualList; + TMGlxMediaList_Stub* iStubMediaList; + + TMShwEffectManager_Adapter iStubEffectManager; + + CActiveSchedulerWait iWait; + + RArray iVisualListCalls; + RArray iMediaListCalls; + RArray iEffectCalls; + RArray iEvents; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWEFFECTCONTROL_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweffectcontrol/t_cshweffectcontrol_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweffectcontrol/t_cshweffectcontrol_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* 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: Test for effect control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "T_CShwEffectControl.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwEffectControl::NewL(); + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweffects/t_cshweffects.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweffects/t_cshweffects.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,321 @@ +/* +* Copyright (c) 2007-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: Test for effect for the slideshow + * +*/ + + + +// CLASS HEADER +#include "t_cshweffects.h" + +// EXTERNAL INCLUDES +#include +#include + +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "shweffect.h" +#include "shwresourceutility.h" +#include "shwslideshowenginepanic.h" + +// ----------------------------------------------------------------------------- +// Stub for NShwEngine::Panic --> +// ----------------------------------------------------------------------------- +TBool gNShwEnginePanicCalled = EFalse; +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + gNShwEnginePanicCalled = ETrue; + // in test situation just do a leave + User::Leave( aPanic ); + } + } +// ----------------------------------------------------------------------------- +// <-- Stub for NShwEngine::Panic +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for LocalisedNameL >>> +// ----------------------------------------------------------------------------- +TPtrC gNameForEffect( 0, 0 ); +_LIT( T_KZoomPanName, "ZoomAndPan" ); +_LIT( T_KCrossfadeName, "Crossfade" ); +HBufC* ShwResourceUtility::LocalisedNameL( TInt aResourceId ) + { + if( aResourceId == R_SHW_EFFECT_ZOOM_AND_PAN ) + { + gNameForEffect.Set( T_KZoomPanName() ); + return T_KZoomPanName().AllocL(); + } + else if( aResourceId == R_SHW_EFFECT_CROSS_FADE ) + { + gNameForEffect.Set( T_KCrossfadeName() ); + return T_KCrossfadeName().AllocL(); + } + gNameForEffect.Set( KNullDesC ); + return NULL; + } +// ----------------------------------------------------------------------------- +// <<< Stub for LocalisedNameL +// ----------------------------------------------------------------------------- + +class CTestControl : public CHuiControl + { + public: + static CTestControl* NewL( CHuiEnv& aEnv ) + { + return new (ELeave) CTestControl( aEnv ); + } + CTestControl( CHuiEnv& aEnv ) + : CHuiControl( aEnv ) + { + } + }; + +// CONSTRUCTION +T_CShwEffects* T_CShwEffects::NewLC( T_ShwEffectFactoryL* aEffectFactory ) + { + T_CShwEffects* self = new( ELeave ) T_CShwEffects; + CleanupStack::PushL( self ); + + self->iEffectFactory = aEffectFactory; + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwEffects::~T_CShwEffects() + { + } + +// Default constructor +T_CShwEffects::T_CShwEffects() + { + } + +// Second phase construct +void T_CShwEffects::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + +void T_CShwEffects::EmptyL() + { + } + +void T_CShwEffects::SetupL() + { + // set name for the effect verification + gNameForEffect.Set( KNullDesC ); + + // create HUI env + iEnv = CHuiEnv::NewL(); + // create Display + iCoeDisplay = CHuiDisplayCoeControl::NewL( *iEnv, TRect( 0, 0, 100, 100 ) ); + + // create control + iControl = CTestControl::NewL( *iEnv ); + + // create the visual, ownership goes to iCoeDisplay + iVisual = CHuiImageVisual::AddNewL( *iControl ); + + // call the factory method to construct the effect + iEffect = (*iEffectFactory)(); + } + +void T_CShwEffects::Teardown() + { + // delete effect + delete iEffect; + iEffect = NULL; + + // delete control, it deletes the visual + delete iControl; + iControl = NULL; + + // delete display + delete iCoeDisplay; + iCoeDisplay = NULL; + + // delete env last + delete iEnv; + iEnv = NULL; + } + +void T_CShwEffects::T_ConstructorL() + { + // call the factory method to construct the effect + iEffect = (*iEffectFactory)(); + + EUNIT_ASSERT_DESC( iEffect, "Effect is constructed"); + // EUnit checks that memory is in balance + // teardown deletes the object + } + +void T_CShwEffects::T_PrepareViewLL() + { + // initialize with null lists but proper screen + iEffect->InitializeL( + NULL, + NULL, + NULL, + TSize( 320, 240 ) ); + // call prepare view with proper size + TSize size = iEffect->PrepareViewL( iVisual, TSize( 320, 240 ) ); + // verify that the thumbnail size is not 0,0 + EUNIT_ASSERT_GREATER_DESC( + size.iWidth, 0, "thumbnail size is set"); + EUNIT_ASSERT_GREATER_DESC( + size.iHeight, 0, "thumbnail size is set"); + + // call prepare view with unknown size + size = iEffect->PrepareViewL( iVisual, TSize( KErrNotFound, KErrNotFound ) ); + // verify that the thumbnail size is not 0,0 + EUNIT_ASSERT_GREATER_DESC( + size.iWidth, 0, "thumbnail size is set"); + EUNIT_ASSERT_GREATER_DESC( + size.iHeight, 0, "thumbnail size is set"); + } + +void T_CShwEffects::T_EnterViewLL() + { + MGlxLayout* layout = iEffect->EnterViewL( iVisual, 123, 345 ); + EUNIT_ASSERT_DESC( layout, "Layout is not NULL"); + } + +void T_CShwEffects::T_ExitViewL() + { + iEffect->ExitView( iVisual ); + // nothing to really verify what the effect is supposed to do + EUNIT_ASSERT_DESC( iEffect, "Effect is constructed"); + } + +void T_CShwEffects::T_EnterTransitionLL() + { + MGlxLayout* layout = iEffect->EnterTransitionL( iVisual, 321 ); + EUNIT_ASSERT_DESC( layout, "Layout is not NULL"); + } + +void T_CShwEffects::T_ExitTransitionL() + { + iEffect->ExitTransition( iVisual ); + // nothing to really verify what the effect is supposed to do + EUNIT_ASSERT_DESC( iEffect, "Effect is constructed"); + } + +void T_CShwEffects::T_PauseLL() + { + iEffect->PauseL(); + // nothing to really verify what the effect is supposed to do + EUNIT_ASSERT_DESC( iEffect, "Effect is constructed"); + } + +void T_CShwEffects::T_ResumeL() + { + iEffect->Resume(); + // nothing to really verify what the effect is supposed to do + EUNIT_ASSERT_DESC( iEffect, "Effect is constructed"); + } + +void T_CShwEffects::T_EffectInfoL() + { + // get effect info + TShwEffectInfo info = iEffect->EffectInfo(); + // assert that the info contains some values + EUNIT_ASSERT_EQUALS_DESC( info.iName, gNameForEffect, "Info has correct name"); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwEffects, + "Test suite for MShwEffect", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Constructor test", + "MShwEffect", + "Constructor test", + "FUNCTIONALITY", + EmptyL, T_ConstructorL, Teardown ) // need teardown since alloc test + +EUNIT_TEST( + "PrepareViewL", + "CShwCrossFadeEffect", + "PrepareViewL", + "FUNCTIONALITY", + SetupL, T_PrepareViewLL, Teardown) + +EUNIT_TEST( + "EnterViewL", + "CShwCrossFadeEffect", + "EnterViewL", + "FUNCTIONALITY", + SetupL, T_EnterViewLL, Teardown) + +EUNIT_TEST( + "ExitView", + "CShwCrossFadeEffect", + "ExitView", + "FUNCTIONALITY", + SetupL, T_ExitViewL, Teardown) + +EUNIT_TEST( + "EnterTransitionL", + "CShwCrossFadeEffect", + "EnterTransitionL", + "FUNCTIONALITY", + SetupL, T_EnterTransitionLL, Teardown) + +EUNIT_TEST( + "ExitTransition", + "CShwCrossFadeEffect", + "ExitTransition", + "FUNCTIONALITY", + SetupL, T_ExitTransitionL, Teardown) + +EUNIT_TEST( + "PauseL", + "CShwCrossFadeEffect", + "PauseL", + "FUNCTIONALITY", + SetupL, T_PauseLL, Teardown) + +EUNIT_TEST( + "Resume", + "CShwCrossFadeEffect", + "Resume", + "FUNCTIONALITY", + SetupL, T_ResumeL, Teardown) + +EUNIT_TEST( + "EffectInfo", + "CShwCrossFadeEffect", + "EffectInfo", + "FUNCTIONALITY", + SetupL, T_EffectInfoL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweffects/t_cshweffects.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweffects/t_cshweffects.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2007-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: Test for control for the slideshow + * +*/ + + + + +#ifndef __T_CSHWEFFECT_H__ +#define __T_CSHWEFFECT_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS +class MShwEffect; +class CHuiEnv; +class CHuiDisplayCoeControl; +class CHuiControl; +class CHuiImageVisual; + +// TYPE DEFINITIONS +typedef MShwEffect* (T_ShwEffectFactoryL)(); + +// CLASS DEFINITION +/** + * EUnit test suite for slideshow effects + */ +NONSHARABLE_CLASS( T_CShwEffects ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwEffects* NewLC( T_ShwEffectFactoryL* aEffectFactory ); + + /** + * Destructor + */ + ~T_CShwEffects(); + + private: // Constructors and destructors + + T_CShwEffects(); + void ConstructL(); + + private: // New methods + + void EmptyL(); + void SetupL(); + void Teardown(); + + void T_ConstructorL(); + void T_PrepareViewLL(); + void T_EnterViewLL(); + void T_ExitViewL(); + void T_EnterTransitionLL(); + void T_ExitTransitionL(); + void T_PauseLL(); + void T_ResumeL(); + void T_EffectInfoL(); + + private: // Data + + T_ShwEffectFactoryL* iEffectFactory; + MShwEffect* iEffect; + + CHuiEnv* iEnv; + CHuiDisplayCoeControl* iCoeDisplay; + CHuiControl* iControl; + CHuiImageVisual* iVisual; + + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWEFFECT_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweffects/t_cshweffects_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweffects/t_cshweffects_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007-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: Test for control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "t_cshweffects.h" + +// EXTERNAL INCLUDES +#include + +// CLASS UNDER TEST +#include "shwcrossfadeeffect.h" +#include "shwzoomandpaneffect.h" + +MShwEffect* CreateCrossfadeL() + { + // create the normal zoom and pan + MShwEffect* eff = CShwCrossFadeEffect::NewLC(); + CleanupStack::Pop(); + return eff; + } + +MShwEffect* CreateZoomAndPanL() + { + MShwEffect* eff = CShwZoomAndPanEffect::NewLC(); + CleanupStack::Pop(); + return eff; + } + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + // Create a root suite to contain tests for both the effects + CEUnitTestSuite* rootSuite = + CEUnitTestSuite::NewLC( _L("ShwEffect Unit Tests") ); + + // Note that NewLC leaves the object in the cleanupstack. + rootSuite->AddL( T_CShwEffects::NewLC( &CreateCrossfadeL ) ); + CleanupStack::Pop(); // T_CShwEffects instance + + rootSuite->AddL( T_CShwEffects::NewLC( &CreateZoomAndPanL ) ); + CleanupStack::Pop(); // T_CShwEffects instance + + CleanupStack::Pop( rootSuite ); // rootSuite instance + + return rootSuite; + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweventrouter/t_cshweventrouter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweventrouter/t_cshweventrouter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,340 @@ +/* +* 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: Test for scheduler for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "T_CShwEventRouter.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shweventrouter.h" +#include "shwevent.h" +#include "shwslideshowenginepanic.h" + +// test state flags +TBool gT_TestEventDestructorCalled = EFalse; +TBool gT_TestEventCloneLCCalled = EFalse; +TBool gT_PanicCalled = EFalse; + +// A test event class +class T_TestEvent : public MShwEvent + { + public: + ~T_TestEvent() + { + gT_TestEventDestructorCalled = ETrue; + } + MShwEvent* CloneLC() + { + gT_TestEventCloneLCCalled = ETrue; + MShwEvent* tmp = new( ELeave ) T_TestEvent; + CleanupStack::PushL( tmp ); + return tmp; + } + + /** + * Helper to check that the event is of this class type + */ + TBool IsOfSameClass( MShwEvent* aLhs ) + { + // here we have to compare agains NULL as TBool cannot be converted from a pointer + return dynamic_cast( aLhs ) != NULL; + } + }; + +// CONSTRUCTION +T_CShwEventRouter* T_CShwEventRouter::NewL() + { + T_CShwEventRouter* self = T_CShwEventRouter::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwEventRouter* T_CShwEventRouter::NewLC() + { + T_CShwEventRouter* self = new( ELeave ) T_CShwEventRouter(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwEventRouter::~T_CShwEventRouter() + { + } + +// Default constructor +T_CShwEventRouter::T_CShwEventRouter() + { + } + +// Second phase construct +void T_CShwEventRouter::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + +void T_CShwEventRouter::NotifyL( MShwEvent* aEvent ) + { + // we got the event + iEventReceiveCount++; + // assert that the event was correct one + EUNIT_ASSERT_DESC( iEventToReceive->IsOfSameClass( aEvent ), "Check that the event class is correct" ); + // for OOM testing, lets make a memory allocation + TInt* intti = new( ELeave ) TInt; + delete intti; + // did the test want us to leave + if( iLeaveInNotify ) + { + User::Leave( KErrCorrupt ); + } + // did the test want us to send new events + if( iSendNewEventCount-- > 0 ) + { + // allocate new event + T_TestEvent testEvent2; + // set the event object pointer so that the notify can verify the event object + iEventToReceive = &testEvent2; + // send the event, + iQueue->SendEventL( &testEvent2 ); + } + } + +void T_CShwEventRouter::SetEventQueue( MShwEventQueue* aQueue ) + { + iQueue = aQueue; + } + +void T_CShwEventRouter::SetupL() + { + // reset information flags + gT_TestEventDestructorCalled = EFalse; + gT_TestEventCloneLCCalled = EFalse; + gT_PanicCalled = EFalse; + // reset test state + iLeaveInNotify = EFalse; + iSendNewEventCount = 0; + iEventReceiveCount = 0; + // construct the router + iRouter = CShwEventRouter::NewL(); + } + +void T_CShwEventRouter::Teardown() + { + delete iRouter; + iRouter = NULL; + } + +void T_CShwEventRouter::TestBasicRoutingL() + { + // add us as observer and producer + iRouter->AddObserverL( this ); + iRouter->AddProducer( this ); + + T_TestEvent testEvent; + // set the event object pointer so that the notify can verify the event object + iEventToReceive = &testEvent; + // send the event, + iQueue->SendEventL( &testEvent ); + // check we got an event + EUNIT_ASSERT_EQUALS_DESC( iEventReceiveCount, 1, "one event expected" ); + // check that our event class methods were correctly called + EUNIT_ASSERT_DESC( gT_TestEventCloneLCCalled, "check that clone was called" ); + EUNIT_ASSERT_DESC( gT_TestEventDestructorCalled, "destructor was called" ); + // there was no panic call + EUNIT_ASSERT( !gT_PanicCalled ); + } + +void T_CShwEventRouter::TestNestedEventsL() + { + // we want the notify to add 2 events during the notify calls so 3 events overall + iSendNewEventCount = 2; + // add us as observer and producer + iRouter->AddObserverL( this ); + iRouter->AddProducer( this ); + + T_TestEvent testEvent; + // set the event object pointer so that the notify can verify the event object + iEventToReceive = &testEvent; + // send the event, + iQueue->SendEventL( &testEvent ); + // check we got events + EUNIT_ASSERT_EQUALS_DESC( iEventReceiveCount, 3, "three events expected" ); + // check that our event class methods were correctly called + EUNIT_ASSERT_DESC( gT_TestEventCloneLCCalled, "check that clone was called" ); + EUNIT_ASSERT_DESC( gT_TestEventDestructorCalled, "destructor was called" ); + // there was no panic call + EUNIT_ASSERT( !gT_PanicCalled ); + } + +void T_CShwEventRouter::TestNestedEventsAndMultipleObserversL() + { +// EUNIT_GET_ALLOC_DECORATOR_FAILCOUNT_D( failurecount ); +// EUNIT_PRINT( _L("Memory alloc %d"), failurecount ); + + // we want the notify to add 2 events during the notify calls so 3 events overall + iSendNewEventCount = 2; + // add us as observer twice + RPointerArray observers; + CleanupClosePushL( observers ); + observers.AppendL( this ); + observers.AppendL( this ); + // add the array of observers + iRouter->AddObserversL( observers.Array() ); + CleanupStack::PopAndDestroy(); + // add us as publisher + RPointerArray publisher; + CleanupClosePushL( publisher ); + publisher.AppendL( this ); + iRouter->AddProducers( publisher.Array() ); + CleanupStack::PopAndDestroy(); + + T_TestEvent testEvent; + // set the event object pointer so that the notify can verify the event object + iEventToReceive = &testEvent; + // send the event, + iQueue->SendEventL( &testEvent ); + // check we got events + EUNIT_ASSERT_EQUALS_DESC( iEventReceiveCount, 6, "six events expected" ); + // check that our event class methods were correctly called + EUNIT_ASSERT_DESC( gT_TestEventCloneLCCalled, "check that clone was called" ); + EUNIT_ASSERT_DESC( gT_TestEventDestructorCalled, "destructor was called" ); + // there was no panic call + EUNIT_ASSERT( !gT_PanicCalled ); + } + +void T_CShwEventRouter::TestLeaveInNotifyL() + { + // we want the notify to leave + iLeaveInNotify = ETrue; + // add us as observer and producer + iRouter->AddObserverL( this ); + iRouter->AddProducer( this ); + + T_TestEvent testEvent; + // set the event object pointer so that the notify can verify the event object + iEventToReceive = &testEvent; + // send the event, TRAP since we need to get out in the event + EUNIT_TRAP_EXCEPT_ALLOC_D( error, + { + iQueue->SendEventL( &testEvent ); + } ); + // there was no panic call + EUNIT_ASSERT( !gT_PanicCalled ); + EUNIT_ASSERT_EQUALS_DESC( error, KErrCorrupt, "test that leave was correct code" ); + + // check we got an event + EUNIT_ASSERT_EQUALS_DESC( iEventReceiveCount, 1, "one event expected" ); + EUNIT_ASSERT_DESC( gT_TestEventCloneLCCalled, "check that clone was called" ); + EUNIT_ASSERT_DESC( !gT_TestEventDestructorCalled, "destructor was not yet called" ); + + // delete router + Teardown(); + // now the event gets deleted + EUNIT_ASSERT_DESC( gT_TestEventDestructorCalled, "destructor was called" ); + } + +void T_CShwEventRouter::TestOOML() + { + // this test case is supposed to be run under alloc decorator + // check that we got alloc decorator on + if( !CEUnitTestCaseDecorator::ActiveTestCaseDecorator( KEUnitAllocTestCaseDecoratorName ) ) + { + EUNIT_FAIL_TEST( "Test configuration failure, alloc decorator not on" ); + } + + // add us as observer and producer + iRouter->AddObserverL( this ); + iRouter->AddProducer( this ); + + T_TestEvent testEvent; + // set the event object pointer so that the notify can verify the event object + iEventToReceive = &testEvent; + // send the event + iQueue->SendEventL( &testEvent ); + + // get the alloc failure count from the alloc decorator + // in the first two alloc failures we dont get to the nofity method + EUNIT_GET_ALLOC_DECORATOR_FAILCOUNT_D( failurecount ); + if( failurecount > 2 ) + { + // ok we should get the event + // check we got an event + EUNIT_ASSERT_EQUALS_DESC( iEventReceiveCount, 1, "one event expected" ); + // check that if clone was called, then also destructor is called + EUNIT_ASSERT_EQUALS( gT_TestEventDestructorCalled, gT_TestEventCloneLCCalled ); + } + } + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + T_CShwEventRouter, + "CShwEventRouter unit tests", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Testing basic functionality", + "CShwEventRouter", + "SendEvent", + "FUNCTIONALITY", + SetupL, TestBasicRoutingL, Teardown) + +EUNIT_ALLOC_TEST( + "Testing nested events", + "CShwEventRouter", + "SendEvent", + "FUNCTIONALITY", + SetupL, TestNestedEventsL, Teardown) + +EUNIT_ALLOC_TEST( + "Testing multiple observers", + "CShwEventRouter", + "SendEvent", + "FUNCTIONALITY", + SetupL, TestNestedEventsAndMultipleObserversL, Teardown) + +EUNIT_ALLOC_TEST( + "Testing error handling", + "CShwEventRouter", + "SendEvent", + "ERRORHANDLING", + SetupL, TestLeaveInNotifyL, Teardown) + +EUNIT_ALLOC_TEST( + "Testing error handling in OOM", + "CShwEventRouter", + "SendEvent", + "ERRORHANDLING", + SetupL, TestOOML, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweventrouter/t_cshweventrouter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweventrouter/t_cshweventrouter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* 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: Test for scheduler for the slideshow + * +*/ + + + + +#ifndef __T_CSHWEVENTROUTER_H__ +#define __T_CSHWEVENTROUTER_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shweventobserver.h" +#include "shweventpublisher.h" + +// FORWARD DECLARATIONS +class CShwEventRouter; +class T_TestEvent; + +// CLASS DEFINITION +/** + * + * EUnitWizard generated test class. + * + */ +NONSHARABLE_CLASS( T_CShwEventRouter ) + : public CEUnitTestSuiteClass, public MShwEventObserver, public MShwEventPublisher + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwEventRouter* NewL(); + static T_CShwEventRouter* NewLC(); + /** + * Destructor + */ + ~T_CShwEventRouter(); + + private: // Constructors and destructors + + T_CShwEventRouter(); + void ConstructL(); + + public: // From MShwEventObserver and MShwEventPublisher + + void NotifyL( MShwEvent* aEvent ); + void SetEventQueue( MShwEventQueue* aQueue ); + + private: // New methods + + void SetupL(); + void Teardown(); + + void TestBasicRoutingL(); + void TestNestedEventsL(); + void TestNestedEventsAndMultipleObserversL(); + void TestLeaveInNotifyL(); + void TestOOML(); + + + private: // Data + + EUNIT_DECLARE_TEST_TABLE; + + CShwEventRouter* iRouter; + MShwEventQueue* iQueue; + MShwEvent* iEvent; + + TInt iEventReceiveCount; + TInt iSendNewEventCount; + TBool iLeaveInNotify; + T_TestEvent* iEventToReceive; + + }; + +#endif // __T_CSHWEVENTROUTER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshweventrouter/t_cshweventrouterdllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshweventrouter/t_cshweventrouterdllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* 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: Test for scheduler for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "T_CShwEventRouter.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwEventRouter::NewL(); + } + + + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwmusiccontrol/t_cshwmusiccontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwmusiccontrol/t_cshwmusiccontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,530 @@ +/* +* Copyright (c) 2007-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: Test for music control for the slideshow + * +*/ + + + +// CLASS HEADER +#include "t_cshwmusiccontrol.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shwevent.h" + +namespace + { + _LIT(KFileName, "c:\\knightrider.mp3"); + } + +// CONSTRUCTION +T_CShwMusicControl* T_CShwMusicControl::NewL() + { + T_CShwMusicControl* self = T_CShwMusicControl::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwMusicControl* T_CShwMusicControl::NewLC() + { + T_CShwMusicControl* self = new( ELeave ) T_CShwMusicControl; + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + + + +// Destructor (virtual by CBase) +T_CShwMusicControl::~T_CShwMusicControl() + { + } + + + +// Default constructor +T_CShwMusicControl::T_CShwMusicControl() + :iMusicOn(EFalse), + iCurrentVolume(KErrNotFound), + iMaxVolume(KErrNotFound), + iPrevVolume(KErrNotFound) + { + } + +// Second phase construct +void T_CShwMusicControl::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +void T_CShwMusicControl::SendEventL(MShwEvent* aEvent) + { + iEvent = aEvent->CloneLC(); + CleanupStack::Pop(); + } + +TBool gMusicOnCalled = EFalse; +void T_CShwMusicControl::MusicOnL() + { + EUNIT_PRINT(_L("Music is ON")); + iMusicOn = ETrue; + gMusicOnCalled = ETrue; + // leave if error code set + User::LeaveIfError( iLeaveInObserver ); + } + +TBool gMusicOffCalled = EFalse; +void T_CShwMusicControl::MusicOff() + { + EUNIT_PRINT(_L("Music is OFF")); + iMusicOn = EFalse; + gMusicOffCalled = ETrue; + } + + +void T_CShwMusicControl::MusicVolume(TInt aCurrentVolume, TInt aMaxVolume) + { + iPrevVolume = iCurrentVolume; + iCurrentVolume = aCurrentVolume; + iMaxVolume = aMaxVolume; + EUNIT_PRINT(_L("current volume %d"),aCurrentVolume); + if(iWait.IsStarted()) + { + iWait.AsyncStop(); + } + } + +void T_CShwMusicControl::ErrorWithTrackL( TInt aErrorCode ) + { + iErrorCode = aErrorCode; + } + +void T_CShwMusicControl::Empty() + { + } + +void T_CShwMusicControl::SetupL() + { + // reset current and max volume + iCurrentVolume = KErrNotFound; + iMaxVolume = KErrNotFound; + // reset error code + iErrorCode = KErrNone; + // reset leave flag + iLeaveInObserver = KErrNone; + // reset state flags + gMusicOnCalled = EFalse; + gMusicOffCalled = EFalse; + + iCShwMusicControl = CShwMusicControl::NewL( *this, KFileName ); + // set the event queue - inherited from parent CShwEventPublisherBase + iCShwMusicControl->SetEventQueue(this); + } + + +void T_CShwMusicControl::Teardown() + { + delete iCShwMusicControl; + iCShwMusicControl = NULL; + + delete iEvent; + iEvent = NULL; + } + +void T_CShwMusicControl::TestConstructL() + { + EUNIT_PRINT(_L("CShwMusicControl::NewL")); + // create + iCShwMusicControl = CShwMusicControl::NewL(*this, KFileName); + // set the event queue + iCShwMusicControl->SetEventQueue(this); + // test that object exists + EUNIT_ASSERT_DESC(iCShwMusicControl, "object created"); + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + // delete music control + delete iCShwMusicControl; + iCShwMusicControl = NULL; + // EUnit checks for memory leaks + } + +void T_CShwMusicControl::T_NotifyLL() + { + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + // send start event + TShwEventStart start; + iCShwMusicControl->NotifyL(&start); + // Need to let the scheduler loop to get first volume callback + iWait.Start(); // Wait for notification of volume + EUNIT_ASSERT(iMusicOn == ETrue); + EUNIT_ASSERT(iCurrentVolume != KErrNotFound && iMaxVolume != KErrNotFound); + } + +void T_CShwMusicControl::T_NotifyL1L() + { + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + // if should evaluate false: if (event) + MShwEvent* iParam1 = NULL; + iCShwMusicControl->NotifyL(iParam1); + + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + + // test also HandlePropertyL with unsupported property + iCShwMusicControl->HandlePropertyL( EPbPropertyMute, 0, 0 ); + // test that volume was not send + EUNIT_ASSERT( iCurrentVolume == KErrNotFound && iMaxVolume == KErrNotFound ); + } + +void T_CShwMusicControl::T_NotifyL2L() + { + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + // send start event + TShwEventStart start; + iCShwMusicControl->NotifyL( &start ); + // Need to let the scheduler loop to get first volume callback + iWait.Start(); + // check that we got the volume + EUNIT_ASSERT(iCurrentVolume != KErrNotFound && iMaxVolume != KErrNotFound); + + // send pause + TShwEventPause pause; + iCShwMusicControl->NotifyL( &pause ); + EUNIT_ASSERT( iMusicOn == EFalse ); + + // send resume + TShwEventResume resume; + iCShwMusicControl->NotifyL( &resume ); + + EUNIT_ASSERT(iMusicOn != EFalse ); + } + +void T_CShwMusicControl::T_NotifyL3L() + { + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + // send resume before start + TShwEventResume resume; + iCShwMusicControl->NotifyL( &resume ); + EUNIT_ASSERT_DESC( iMusicOn == ETrue, "music is on" ); + + // Send pause before start, does not pause + TShwEventPause pause; + iCShwMusicControl->NotifyL( &pause ); + EUNIT_ASSERT_DESC( iMusicOn == EFalse, "music is off" ); + + // send start event + TShwEventStart start; + iCShwMusicControl->NotifyL( &start ); + // Need to let the scheduler loop to get first volume callback + iWait.Start(); + + // Second subsequent pause request + iCShwMusicControl->NotifyL( &pause ); + EUNIT_ASSERT_DESC( iMusicOn == EFalse, "music is now paused" ); + } + +void T_CShwMusicControl::T_NotifyL4L() + { + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + // send start event + TShwEventStart start; + iCShwMusicControl->NotifyL(&start); + // Need to let the scheduler loop to get first volume callback + iWait.Start(); + + // if should evaluate false: if (event) + TShwEventVolumeDown vol; + iCShwMusicControl->NotifyL(&vol); + + // Need to let the scheduler loop to get another volume callback + iWait.Start(); + EUNIT_ASSERT_GREATER_DESC( iPrevVolume, iCurrentVolume, "volume should decrease" ); + EUNIT_ASSERT_NOT_EQUALS( KErrNotFound, iMaxVolume ); + + iMaxVolume = KErrNotFound; + } + +void T_CShwMusicControl::T_NotifyL5L() + { + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + // send start event + TShwEventStart start; + iCShwMusicControl->NotifyL(&start); + // Need to let the scheduler loop to get first volume callback + iWait.Start(); + + // if should evaluate false: if (event) + TShwEventVolumeUp vol; + iCShwMusicControl->NotifyL(&vol); + + // Need to let the scheduler loop to get another volume callback + iWait.Start(); + EUNIT_ASSERT_GREATER_DESC( iCurrentVolume, iPrevVolume, "volume should increase" ); + EUNIT_ASSERT_NOT_EQUALS( KErrNotFound, iMaxVolume ); + iMaxVolume = KErrNotFound; + } + +void T_CShwMusicControl::T_ExtendedPlayL() + { + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNone, iErrorCode, "if there was error, make sure track file exists"); + + TShwEventStart start; + iCShwMusicControl->NotifyL( &start ); + + if (!iTimer) + { + iTimer = CPeriodic::NewL(EPriorityNormal); + } + + // play for 10 seconds + const TInt KPlayPeriod = 10 * 1000000; // Microseconds + TCallBack callBack(StopPlaying, this); + iTimer->Start(KPlayPeriod, KPlayPeriod, callBack); + + iPlayWait.Start(); + + delete iTimer; + iTimer = NULL; + + TShwEventPause pause; + iCShwMusicControl->NotifyL(&pause); + EUNIT_ASSERT(iMusicOn == EFalse); + + } + +TInt T_CShwMusicControl::StopPlaying(TAny* aMusicControl) + { + T_CShwMusicControl* self = reinterpret_cast(aMusicControl); + + if(self->iPlayWait.IsStarted()) + { + self->iPlayWait.AsyncStop(); + } + + return KErrNone; + } + +void T_CShwMusicControl::T_ErrorInFileL() + { + // need to reset state as the setup is empty + gMusicOnCalled = EFalse; + // file that does not exist + _LIT( KErrorFileName, "C:\\juubaduuba.mp123" ); + // create + iCShwMusicControl = CShwMusicControl::NewL( *this, KErrorFileName ); + // set the event queue + iCShwMusicControl->SetEventQueue( this ); + // test that object exists + EUNIT_ASSERT_DESC(iCShwMusicControl, "object created"); + + // test that error was called + // test that no error + EUNIT_ASSERT_EQUALS_DESC( + KErrNotFound, iErrorCode, "track should not exist"); + + // test that start is a no-op + TShwEventStart start; + iCShwMusicControl->NotifyL( &start ); + + // test that music is off + EUNIT_ASSERT_DESC( gMusicOnCalled == EFalse, "music on was not called" ); + + // delete music control + delete iCShwMusicControl; + iCShwMusicControl = NULL; + // EUnit checks for memory leaks + } + +void T_CShwMusicControl::T_LeaveInObserverL() + { + // make observer leave + iLeaveInObserver = KErrCorrupt; + + // send start event + TShwEventStart start; + iCShwMusicControl->NotifyL( &start ); + + // test that music is off + EUNIT_ASSERT_DESC( iMusicOn == EFalse, "music is off"); + EUNIT_ASSERT_DESC( gMusicOnCalled == ETrue, "music on was called (and it did leave)" ); + EUNIT_ASSERT_DESC( gMusicOffCalled == ETrue, "music off was called" ); + // reset flags + gMusicOnCalled = EFalse; + gMusicOffCalled = EFalse; + + // make observer not leave + iLeaveInObserver = KErrNone; + + // resend start event + iCShwMusicControl->NotifyL( &start ); + // test that music is on + EUNIT_ASSERT_DESC( iMusicOn == ETrue, "music is on"); + EUNIT_ASSERT_DESC( gMusicOnCalled == ETrue, "music on was called" ); + EUNIT_ASSERT_DESC( gMusicOffCalled == EFalse, "music off was not called" ); + // reset flags + gMusicOnCalled = EFalse; + gMusicOffCalled = EFalse; + + // send pause + TShwEventPause pause; + iCShwMusicControl->NotifyL( &pause ); + EUNIT_ASSERT_DESC( iMusicOn == EFalse, "music is off" ); + EUNIT_ASSERT_DESC( gMusicOnCalled == EFalse, "music on was not called" ); + EUNIT_ASSERT_DESC( gMusicOffCalled == ETrue, "music off was called" ); + // reset flags + gMusicOnCalled = EFalse; + gMusicOffCalled = EFalse; + + // make observer leave + iLeaveInObserver = KErrCorrupt; + + // send resume + TShwEventResume resume; + iCShwMusicControl->NotifyL( &resume ); + EUNIT_ASSERT_DESC( iMusicOn == EFalse, "music is off" ); + EUNIT_ASSERT_DESC( gMusicOnCalled == ETrue, "music on was called (and it did leave)" ); + EUNIT_ASSERT_DESC( gMusicOffCalled == ETrue, "music off was called" ); + // reset flags + gMusicOnCalled = EFalse; + gMusicOffCalled = EFalse; + + // send volume up + TShwEventVolumeUp vol; + iCShwMusicControl->NotifyL( &vol ); + EUNIT_ASSERT_DESC( gMusicOnCalled == EFalse, "music on was not called" ); + EUNIT_ASSERT_DESC( gMusicOffCalled == EFalse, "music off was not called" ); + // reset flags + gMusicOnCalled = EFalse; + gMusicOffCalled = EFalse; + + // make observer not leave + iLeaveInObserver = KErrNone; + + // send resume + iCShwMusicControl->NotifyL( &resume ); + EUNIT_ASSERT_DESC( iMusicOn == ETrue, "music is on" ); + EUNIT_ASSERT_DESC( gMusicOnCalled == ETrue, "music on was called" ); + EUNIT_ASSERT_DESC( gMusicOffCalled == EFalse, "music off was not called" ); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwMusicControl, + "Test suite for CShwMusicControl", + "UNIT" ) + +/* + Commented out as MPX crashes with Kern-exec 0 +EUNIT_ALLOC_TEST( + "Constructor test", + "CShwMusicControl", + "NewL", + "FUNCTIONALITY", + Empty, TestConstructL, Teardown ) +*/ +// these cant be decorated as the EUnit +// scheduler does not implement Error method +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test 0", + "CShwMusicControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyLL, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test 1", + "CShwMusicControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyL1L, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test 2", + "CShwMusicControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyL2L, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test 3", + "CShwMusicControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyL3L, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test 4", + "CShwMusicControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyL4L, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test 5", + "CShwMusicControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyL5L, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "Test error in file", + "CShwMusicControl", + "ConstructL, NotifyL", + "FUNCTIONALITY", + Empty, T_ErrorInFileL, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "Test leave in observer", + "CShwMusicControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_LeaveInObserverL, Teardown ) + +/* +commented out as no added value for the time beeing +EUNIT_NOT_DECORATED_TEST( + "Play for multitple seconds", + "CShwMusicControl", + "NotifyL - test 6", + "FUNCTIONALITY", + SetupL, T_ExtendedPlayL, Teardown) +*/ + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwmusiccontrol/t_cshwmusiccontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwmusiccontrol/t_cshwmusiccontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2007-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: Test for music control for the slideshow + * +*/ + + + + +#ifndef __T_CSHWMUSICCONTROL_H__ +#define __T_CSHWMUSICCONTROL_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES +#include "shweventqueue.h" +#include "shwmusiccontrol.h" +#include "shwmusicobserver.h" + +// FORWARD DECLARATIONS + + +const TInt KMaxFileLen = 256; + +// CLASS DEFINITION +/** + * EUnit test suite for CShwMusicControl + */ +NONSHARABLE_CLASS( T_CShwMusicControl ) + : public CEUnitTestSuiteClass, + public MShwMusicObserver, + public MShwEventQueue + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwMusicControl* NewL(); + static T_CShwMusicControl* NewLC(); + /** + * Destructor + */ + ~T_CShwMusicControl(); + + private: // Constructors and destructors + + T_CShwMusicControl(); + void ConstructL(); + + public: + static TInt StopPlaying(TAny* aMusicControl); + + public: // From MShwEventQueue + + void SendEventL( MShwEvent* aEvent ); + + + public: // From MShwMusicObserver + + void MusicOnL(); + void MusicOff(); + void MusicVolume(TInt aCurrentVolume, TInt aMaxVolume); + void ErrorWithTrackL(TInt aErrorCode); + + private: // New methods + + void SetupL(); + void Teardown(); + void Empty(); + + void TestConstructL(); + void T_NotifyLL(); + void T_NotifyL1L(); + void T_NotifyL2L(); + void T_NotifyL3L(); + void T_NotifyL4L(); + void T_NotifyL5L(); + void T_ExtendedPlayL(); + void T_ErrorInFileL(); + void T_LeaveInObserverL(); + + private: // Data + // The music state + TBool iMusicOn; + + // The music volume + TInt iCurrentVolume; + + // The maximum music volume + TInt iMaxVolume; + + // The previous music volume setting + // - used to test volume up and down. + TInt iPrevVolume; + + // Own: the class under test + CShwMusicControl* iCShwMusicControl; + + // Own: the event received from SendEventL + MShwEvent* iEvent; + + // Own: scheduler wait object + CActiveSchedulerWait iWait; + + // Own: scheduler wait object + CActiveSchedulerWait iPlayWait; + + // Own: a timer callback + CPeriodic* iTimer; + + /// Own: the error code from ErrorWithTrackL + TInt iErrorCode; + + /// Own: error code to cause a leave in observer + TInt iLeaveInObserver; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWMUSICCONTROL_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwmusiccontrol/t_cshwmusiccontrol_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwmusiccontrol/t_cshwmusiccontrol_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007-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: Test for music control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "t_cshwmusiccontrol.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwMusicControl::NewL(); + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwplaybackfactory/t_cshwplaybackfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwplaybackfactory/t_cshwplaybackfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,333 @@ +/* +* Copyright (c) 2007-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: Test suite for CShwPlaybackFactory + * +*/ + + + +// CLASS HEADER +#include "t_cshwplaybackfactory.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "shwplaybackfactory.h" +#include "shwslideshowenginepanic.h" +#include "shwcrossfadeeffect.h" +#include "shwzoomandpaneffect.h" +#include "shwconstants.h" + +// ----------------------------------------------------------------------------- +// Stub for NShwEngine::Panic --> +// ----------------------------------------------------------------------------- +TBool gNShwEnginePanicCalled = EFalse; +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + gNShwEnginePanicCalled = ETrue; + // in test situation just do a leave + User::Leave( aPanic ); + } + } +// ----------------------------------------------------------------------------- +// <-- Stub for NShwEngine::Panic +// ----------------------------------------------------------------------------- + +TGlxSetValueLayout gStubLayout( TGlxLayoutInfo::EPosition ); + +// ----------------------------------------------------------------------------- +// Stub for CShwCrossFadeEffect --> +// ----------------------------------------------------------------------------- +inline CShwCrossFadeEffect::CShwCrossFadeEffect() + { + } +CShwCrossFadeEffect* CShwCrossFadeEffect::NewLC() + { + CShwCrossFadeEffect* self = new (ELeave) CShwCrossFadeEffect; + CleanupStack::PushL( self ); + return self; + } +CShwCrossFadeEffect::~CShwCrossFadeEffect() + { + } +MShwEffect* CShwCrossFadeEffect::CloneLC() + { + return NewLC(); + } +void CShwCrossFadeEffect::InitializeL( + CHuiEnv* /*aHuiEnv*/, MGlxVisualList* /*aVisualList*/, + MGlxMediaList* /*aMediaList*/, TSize /*aScreenSize*/ ) + { + } +TSize CShwCrossFadeEffect::PrepareViewL( CHuiVisual* /*aVisual*/, TSize /*aSize*/ ) + { + return TSize( 0, 0 ); + } +MGlxLayout* CShwCrossFadeEffect::EnterViewL( + CHuiVisual* /*aVisual*/, TInt /*aDuration*/, TInt /*aDuration2*/ ) + { + return &gStubLayout; + } +void CShwCrossFadeEffect::ExitView( CHuiVisual* /*aVisual*/ ) + { + } +MGlxLayout* CShwCrossFadeEffect::EnterTransitionL( + CHuiVisual* /*aVisual*/, TInt /*aDuration*/ ) + { + return &gStubLayout; + } +void CShwCrossFadeEffect::ExitTransition( CHuiVisual* /*aVisual*/ ) + { + } +void CShwCrossFadeEffect::PauseL() + { + } +void CShwCrossFadeEffect::Resume() + { + } +// the effect info for zoom and pan +TShwEffectInfo gCrossFadeEffectInfo; +TShwEffectInfo CShwCrossFadeEffect::EffectInfo() + { + return gCrossFadeEffectInfo; + } + +// ----------------------------------------------------------------------------- +// <-- Stub for CShwCrossFadeEffect +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for CShwZoomAndPanEffect --> +// ----------------------------------------------------------------------------- +inline CShwZoomAndPanEffect::CShwZoomAndPanEffect() + { + } +CShwZoomAndPanEffect* CShwZoomAndPanEffect::NewLC() + { + CShwZoomAndPanEffect* self = new (ELeave) CShwZoomAndPanEffect; + CleanupStack::PushL( self ); + return self; + } +CShwZoomAndPanEffect::~CShwZoomAndPanEffect() + { + } +MShwEffect* CShwZoomAndPanEffect::CloneLC() + { + return NewLC(); + } +void CShwZoomAndPanEffect::InitializeL( + CHuiEnv* /*aHuiEnv*/, MGlxVisualList* /*aVisualList*/, + MGlxMediaList* /*aMediaList*/, TSize /*aScreenSize*/ ) + { + } +TSize CShwZoomAndPanEffect::PrepareViewL( CHuiVisual* /*aVisual*/, TSize /*aSize*/ ) + { + return TSize( 0, 0 ); + } +MGlxLayout* CShwZoomAndPanEffect::EnterViewL( + CHuiVisual* /*aVisual*/, TInt /*aDuration*/, TInt /*aDuration2*/ ) + { + return &gStubLayout; + } +void CShwZoomAndPanEffect::ExitView( CHuiVisual* /*aVisual*/ ) + { + } +MGlxLayout* CShwZoomAndPanEffect::EnterTransitionL( + CHuiVisual* /*aVisual*/, TInt /*aDuration*/ ) + { + return &gStubLayout; + } +void CShwZoomAndPanEffect::ExitTransition( CHuiVisual* /*aVisual*/ ) + { + } +void CShwZoomAndPanEffect::PauseL() + { + } +void CShwZoomAndPanEffect::Resume() + { + } +// the effect info for zoom and pan +TShwEffectInfo gZoomAndPanEffectInfo; +TShwEffectInfo CShwZoomAndPanEffect::EffectInfo() + { + return gZoomAndPanEffectInfo; + } + +// ----------------------------------------------------------------------------- +// <-- Stub for CShwZoomAndPanEffect +// ----------------------------------------------------------------------------- + +// CONSTRUCTION +T_CShwPlaybackFactory* T_CShwPlaybackFactory::NewL() + { + T_CShwPlaybackFactory* self = T_CShwPlaybackFactory::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwPlaybackFactory* T_CShwPlaybackFactory::NewLC() + { + T_CShwPlaybackFactory* self = new( ELeave ) T_CShwPlaybackFactory(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwPlaybackFactory::~T_CShwPlaybackFactory() + { + } + +// Default constructor +T_CShwPlaybackFactory::T_CShwPlaybackFactory() + { + } + +// Second phase construct +void T_CShwPlaybackFactory::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + +void T_CShwPlaybackFactory::Empty() + { + } + +void T_CShwPlaybackFactory::SetupL() + { + // create the stubs + iStubVisuallist = new( ELeave ) TMGlxVisualList_Adapter( this ); + iStubMedialist = new( ELeave ) TMGlxMediaList_Stub( this ); + + // fix the effect infos + gCrossFadeEffectInfo.iId.iPluginUid = NShwSlideshow::KDefaultEffectPluginUid; + gCrossFadeEffectInfo.iId.iIndex = NShwSlideshow::KEffectUidXFadeNormal; + gZoomAndPanEffectInfo.iId.iPluginUid = NShwSlideshow::KDefaultEffectPluginUid; + gZoomAndPanEffectInfo.iId.iIndex = NShwSlideshow::KEffectUidZoomAndPan; + + /// @todo add an own test case where the music observer is also given + /// so that the music control is constructed + iCShwPlaybackFactory = + CShwPlaybackFactory::NewL( + iHuiEnv, iStubVisuallist, iStubMedialist, *this, TSize( 100, 100 ) ); + } + +void T_CShwPlaybackFactory::Teardown() + { + delete iCShwPlaybackFactory; + iCShwPlaybackFactory = NULL; + delete iStubVisuallist; + iStubVisuallist = NULL; + delete iStubMedialist; + iStubMedialist = NULL; + } + +TInt gCounter = 0; + +void T_CShwPlaybackFactory::T_ContructL() + { + // trap the call as it will leave, dont trap oom as this is alloc test + EUNIT_TRAP_EXCEPT_ALLOC_D( err, + { + iCShwPlaybackFactory = + CShwPlaybackFactory::NewL( + iHuiEnv, iStubVisuallist, iStubMedialist, *this, TSize( 100, 100 ) ); + } ); + EUNIT_ASSERT_EQUALS_DESC( KErrArgument, err, "wrong effect tried to set" ); + EUNIT_ASSERT_DESC( !iCShwPlaybackFactory, "playback factory not created" ); + } + +void T_CShwPlaybackFactory::T_ContructValidEffectL() + { + EUNIT_PRINT( _L("T_ContructValidEffectL") ); + // call setup to test the succesfull case + SetupL(); + + EUNIT_ASSERT_DESC( iCShwPlaybackFactory, "Test that object created" ); + } + +void T_CShwPlaybackFactory::T_EventObserversL() + { + // get observers + RPointerArray< MShwEventObserver > obs = + iCShwPlaybackFactory->EventObservers(); + // check the amount + EUNIT_ASSERT_EQUALS_DESC( + obs.Count(), + 3, + "3 observers returned, music is off by default"); + } + +void T_CShwPlaybackFactory::T_EventPublishersL( ) + { + // get publishers + RPointerArray< MShwEventPublisher > obs = + iCShwPlaybackFactory->EventPublishers(); + // check the amount + EUNIT_ASSERT_EQUALS_DESC( + obs.Count(), + 3, + "3 publishers returned, music is off by default"); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwPlaybackFactory, + "CShwPlaybackFactory test suite", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Constructor invalid effects", + "CShwPlaybackFactory", + "Constructor test", + "FUNCTIONALITY", + Empty, T_ContructL, Teardown ) + +EUNIT_ALLOC_TEST( + "Constructor valid effects", + "CShwPlaybackFactory", + "Constructor test", + "FUNCTIONALITY", + Empty, T_ContructValidEffectL, Teardown ) + +EUNIT_ALLOC_TEST( + "EventObservers", + "CShwPlaybackFactory", + "EventObservers", + "FUNCTIONALITY", + SetupL, T_EventObserversL, Teardown) + +EUNIT_ALLOC_TEST( + "EventPublishers", + "CShwPlaybackFactory", + "EventPublishers", + "FUNCTIONALITY", + SetupL, T_EventPublishersL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwplaybackfactory/t_cshwplaybackfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwplaybackfactory/t_cshwplaybackfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2007-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: Test suite for CShwPlaybackFactory + * +*/ + + + + +#ifndef __T_CSHWPLAYBACKFACTORY_H__ +#define __T_CSHWPLAYBACKFACTORY_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES +#include "shwplaybackfactory.h" +#include "shwmusicobserver.h" + +#include "tmglxmedialist_stub.h" +#include "tmglxvisuallist_adapter.h" + +// FORWARD DECLARATIONS +class CHuiEnv; + +// CLASS DEFINITION +/** + * EUnit test suite for CShwPlaybackFactory + */ +NONSHARABLE_CLASS( T_CShwPlaybackFactory ) + : public CEUnitTestSuiteClass, + public MGlxMediaList_Stub_Observer, + public MGlxVisualList_Observer, + public MShwMusicObserver + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwPlaybackFactory* NewL(); + static T_CShwPlaybackFactory* NewLC(); + /** + * Destructor + */ + ~T_CShwPlaybackFactory(); + + private: // Constructors and destructors + + T_CShwPlaybackFactory(); + void ConstructL(); + + public: // from MGlxMediaList_Stub_Observer and MGlxVisualList_Observer + + void MGlxMediaList_MethodCalled( TMGlxMediaListMethodId /*aMethodId*/ ) + { // not interested on the events + } + void MGlxVisualList_MethodCalled( TMGlxVisualListMethodId /*aMethodId*/ ) + { // not interested on the events + } + + public: // From MShwMusicObserver + + void MusicOnL() + { // not interested on the events + } + void MusicOff() + { // not interested on the events + } + void MusicVolume( TInt /*aCurrentVolume*/, TInt /*aMaxVolume*/ ) + { // not interested on the events + } + void ErrorWithTrackL( TInt /*aErrorCode*/ ) + { // not interested on the events + } + + private: // New methods + + void Empty(); + void SetupL(); + void Teardown(); + void T_ContructL(); + void T_ContructValidEffectL(); + void T_EventObserversL(); + void T_EventPublishersL(); + + private: // Data + + CHuiEnv* iHuiEnv; + TMGlxMediaList_Stub* iStubMedialist; + TMGlxVisualList_Adapter* iStubVisuallist; + + // class under test + CShwPlaybackFactory* iCShwPlaybackFactory; + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWPLAYBACKFACTORY_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwplaybackfactory/t_cshwplaybackfactory_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwplaybackfactory/t_cshwplaybackfactory_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007-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: Test suite for CShwPlaybackFactory + * +*/ + + + + +// CLASS HEADER +#include "t_cshwplaybackfactory.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwPlaybackFactory::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwsettingsmodel/t_cshwsettingsmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwsettingsmodel/t_cshwsettingsmodel.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2004 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: Test for settings model for the slideshow +* +*/ + + + + +// CLASS HEADER +#include "t_cshwsettingsmodel.h" + +// CLASS UNDER TEST +#include "shwsettingsmodel.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + + +// CONSTRUCTION +T_CShwSettingsModel* T_CShwSettingsModel::NewL() + { + T_CShwSettingsModel* self = T_CShwSettingsModel::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwSettingsModel* T_CShwSettingsModel::NewLC() + { + T_CShwSettingsModel* self = new (ELeave) T_CShwSettingsModel(); + CleanupStack::PushL(self); + + self->ConstructL(); + return self; + } + + +// Destructor (virtual by CBase) +T_CShwSettingsModel::~T_CShwSettingsModel() + { + } + + +// Default constructor +T_CShwSettingsModel::T_CShwSettingsModel() + { + } + + +// Second phase construct +void T_CShwSettingsModel::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void T_CShwSettingsModel::SetupL() + { + iShwSettingsModel = CShwSettingsModel::NewL(); + } + +void T_CShwSettingsModel::Teardown() + { + delete iShwSettingsModel; + iShwSettingsModel = NULL; + + const TInt KEngineId = 0x200071D3; + const TUid KEngineUid = TUid::Uid(KEngineId); + TRAP_IGNORE( + { + CRepository* repository = CRepository::NewL(KEngineUid); + TInt err = repository->Reset(); + User::LeaveIfError(err); + delete repository; + } ); + } + + + +void T_CShwSettingsModel::TestGetDefaultValues() + { + TBuf fileNamePath; + iShwSettingsModel->MusicNamePathL(fileNamePath); + _LIT(KDefaultFileName, "None"); + EUNIT_ASSERT(fileNamePath == KDefaultFileName); + + const TUint KDefaultUid = 0x200071D6; + TUid defaultUId; + defaultUId.iUid = KDefaultUid; + + TUid uId; + TUint index = 0; + iShwSettingsModel->TransitionTypeL(uId, index); + EUNIT_ASSERT(defaultUId.iUid == uId.iUid); + EUNIT_ASSERT_EQUALS_DESC( 1, index, "default index is 0"); + } + +void T_CShwSettingsModel::TestSetAndGetMusicPathL() + { + // Set music name and path field. + _LIT(KTestFileName, "c:\\test\\knightrider.mp3"); + iShwSettingsModel->SaveMusicNamePathL( KTestFileName() ); + + // Compare returned values to those set. + TFileName fileNamePath; + iShwSettingsModel->MusicNamePathL(fileNamePath); + EUNIT_ASSERT(fileNamePath == KTestFileName); + + // try setting an empty music name + iShwSettingsModel->SaveMusicNamePathL( KNullDesC() ); + // test that it was not set + iShwSettingsModel->MusicNamePathL(fileNamePath); + EUNIT_ASSERT(fileNamePath == KTestFileName); + } + + +void T_CShwSettingsModel::TestSetAndGetMusicOnOffL() + { + iShwSettingsModel->SaveMusicStateL(ETrue); + EUNIT_ASSERT(iShwSettingsModel->MusicOnL() == ETrue); + } + + +void T_CShwSettingsModel::TestSetAndGetTransDelayL() + { + const TUint KTimeDelay = 5; + iShwSettingsModel->SaveTransDelayL(KTimeDelay); + EUNIT_ASSERT(iShwSettingsModel->TransDelayL() == KTimeDelay); + } + + +void T_CShwSettingsModel::TestSetAndGetTransitionTypeL() + { + const TUint KUid = 0x01234567; + TUid uId1; + uId1.iUid = KUid; + iShwSettingsModel->SaveTransitionTypeL(uId1, 1); + + TUid uId2; + TUint index = 0; + iShwSettingsModel->TransitionTypeL(uId2, index); + EUNIT_ASSERT(uId1.iUid == uId2.iUid); + EUNIT_ASSERT(index == 1); + } + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + T_CShwSettingsModel, + "Test suite for CShwSettingsModel", + "MODULE" ) + +EUNIT_TEST( + "Test Get Default Values", + "TestGetDefaultValues", + "Central Repositoy getter - default values", + "FUNCTIONALITY", + SetupL, TestGetDefaultValues, Teardown) + + +EUNIT_TEST( + "Test Set And Get Music Path", + "TestSetAndGetMusicPath", + "Music name and path Central Repositoy setter and getter", + "FUNCTIONALITY", + SetupL, TestSetAndGetMusicPathL, Teardown) + + +EUNIT_TEST( + "Test Set And Get Music On/Off", + "TestSetAndGetMusicOnOffL", + "Music On/Off Central Repositoy setter and getter", + "FUNCTIONALITY", + SetupL, TestSetAndGetMusicOnOffL, Teardown) + + +EUNIT_TEST( + "Test Set And Get Transition Delay", + "TestSetAndGetTransDelayL", + "Transition Delay Central Repositoy setter and getter", + "FUNCTIONALITY", + SetupL, TestSetAndGetTransDelayL, Teardown) + + +EUNIT_TEST( + "Test Set And Get Transition Type", + "TestSetAndGetTransitionTypeL", + "Transition Type Central Repositoy setter and getter", + "FUNCTIONALITY", + SetupL, TestSetAndGetTransitionTypeL, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwsettingsmodel/t_cshwsettingsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwsettingsmodel/t_cshwsettingsmodel.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2007-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: Test for settings model for the slideshow + * +*/ + + + + + +#ifndef __T_CSHWSETTINGSMODEL_H__ +#define __T_CSHWSETTINGSMODEL_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CShwSettingsModel; + +// CLASS DEFINITION +/** + * + * Test class for CShwSettingsModel + * + */ +NONSHARABLE_CLASS( T_CShwSettingsModel ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwSettingsModel* NewL(); + static T_CShwSettingsModel* NewLC(); + /** + * Destructor + */ + ~T_CShwSettingsModel(); + + private: // Constructors and destructors + + T_CShwSettingsModel(); + void ConstructL(); + + public: // From observer interface + + + + private: // New methods + + void SetupL(); + + void Teardown(); + + void TestGetDefaultValues(); + + void TestSetAndGetMusicPathL(); + + void TestSetAndGetMusicOnOffL(); + + void TestSetAndGetTransDelayL(); + + void TestSetAndGetTransitionTypeL(); + + + private: // Data + + CShwSettingsModel* iShwSettingsModel; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWSETTINGSMODEL_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwsettingsmodel/t_cshwsettingsmodelDllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwsettingsmodel/t_cshwsettingsmodelDllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2004 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: Test for settings model for the slideshow +* +*/ + + + + +// CLASS HEADER +#include "T_CShwSettingsModel.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwSettingsModel::NewL(); + } + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwslideshowengine/t_cshwslideshowengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwslideshowengine/t_cshwslideshowengine.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1190 @@ +/* +* Copyright (c) 2007-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: Test for slideshow engine + * +*/ + + + +// CLASS HEADER +#include "t_cshwslideshowengine.h" + +// CLASS UNDER TEST +#include "shwslideshowengineimpl.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "shwslideshowenginepanic.h" +#include "shwhuiutility.h" + +#include "shwtimercontrol.h" +#include "shwmusiccontrol.h" +#include "shwviewcontrol.h" +#include "shweffectcontrol.h" +#include "shweffect.h" +#include "shwevent.h" + +// STUBS +#include "tmglxvisuallist_adapter.h" +#include "stub_glxfetchcontexts.h" +#include "stub_mshweffect.h" + +class T_Scheduler : public CActiveScheduler + { + public: + // replace the default scheduler behaviour (which is to panic on error) + void Error( TInt aError ) const + { + // we got an error, leave to previous TRAP (that is in alloc decorator) + User::Leave( aError ); + } + }; + +// ----------------------------------------------------------------------------- +// Stub for NShwEngine::Panic --> +// ----------------------------------------------------------------------------- +TBool gNShwEnginePanicCalled = EFalse; +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + gNShwEnginePanicCalled = ETrue; + // in test situation just do a leave + User::Leave( aPanic ); + } + } +// ----------------------------------------------------------------------------- +// <-- Stub for NShwEngine::Panic +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for CGlxVisualListManager --> +// ----------------------------------------------------------------------------- +MGlxVisualList_Observer* gVisualListObserver; +TBool gVisualListWasAllocated = EFalse; +TBool gVisualListWasReleased = EFalse; +TBool gVisualListManagerWasDeleted = EFalse; +TInt gVisualListInitialFocus = 2; + +class CGlxVisualListManager : public CBase + { + public: + CGlxVisualListManager(); + static CGlxVisualListManager* ManagerL(); + ~CGlxVisualListManager(); + MGlxVisualList* AllocListL( + MGlxMediaList* aItemList, + CHuiEnv& aEnv, CHuiDisplay& aDisplay, + CHuiImageVisual::TScaleMode aThumbnailScaleMode = CHuiImageVisual::EScaleFitInside ); + void ReleaseList( MGlxVisualList* aList ); + void Close(); + private: + TMGlxVisualList_Adapter iList; + }; +CGlxVisualListManager::CGlxVisualListManager() + : iList( gVisualListObserver ) + { + } +CGlxVisualListManager::~CGlxVisualListManager() + { + gVisualListManagerWasDeleted = ETrue; + } +CGlxVisualListManager* CGlxVisualListManager::ManagerL() + { + return new( ELeave ) CGlxVisualListManager; + } +MGlxVisualList* CGlxVisualListManager::AllocListL( + MGlxMediaList* , + CHuiEnv& , + CHuiDisplay& , + CHuiImageVisual::TScaleMode ) + { + gVisualListWasAllocated = ETrue; + // set the size and initial focus of the visual list + iList.iFocus = gVisualListInitialFocus; + EUNIT_PRINT( _L("Visual list initial focus %d"), iList.iFocus ); + // this is just long enough not to complicate the test + iList.iSize = 100; + return &iList; + } +void CGlxVisualListManager::ReleaseList( MGlxVisualList* /*aList*/ ) + { + gVisualListWasReleased = ETrue; + } +void CGlxVisualListManager::Close() + { + delete this; + } + +// ----------------------------------------------------------------------------- +// <-- Stub for CGlxVisualListManager +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for CShwPlaybackFactory --> +// ----------------------------------------------------------------------------- +#include "shwplaybackfactory.h" +TBool gPlaybackFactoryWasDeleted = EFalse; + +// static arrays for the observers and publishers +RPointerArray< MShwEventObserver > gEventObservers; +RPointerArray< MShwEventPublisher > gEventPublishers; + +// array of available effects info +RArray gEffects; + +MShwEffectManager* gEffectManager = NULL; +CShwTimerControl* gTimerControl = NULL; +CShwMusicControl* gMusicControl = NULL; +CShwEffectControl* gEffectControl = NULL; +CShwViewControl* gViewControl = NULL; +TBool gIncludeMusicControl = EFalse; // by default no music +TBool gSetRealSong = ETrue; // by default set real song + +namespace + { + // NOTE these values work with the current test configuration + // if you change these some async tests may fail + // default transition duration, milliseconds + const TInt KDefaultTransitionDuration = 100; + // default view duration, milliseconds + const TInt KDefaultViewDuration = 150; + } + +CShwPlaybackFactory* CShwPlaybackFactory::NewL( + CHuiEnv* /*aHuiEnv*/, + MGlxVisualList* aVisualList, + MGlxMediaList* aMediaList, + MShwMusicObserver& aMusicObserver, + TSize aScreenSize ) + { + CShwPlaybackFactory* self = new( ELeave ) CShwPlaybackFactory; + CleanupStack::PushL( self ); + + // create the event classes + // create the timer + gTimerControl = CShwTimerControl::NewL(); + gEventObservers.AppendL( gTimerControl ); + gEventPublishers.AppendL( gTimerControl ); + + // include music control only if wanted + if( gIncludeMusicControl ) + { + // create the music control + _LIT(KTempFileName, "c:\\knightrider.mp3"); + if( gSetRealSong ) + { + gMusicControl = CShwMusicControl::NewL( aMusicObserver, KTempFileName ); + } + else + { + gMusicControl = CShwMusicControl::NewL( aMusicObserver, KNullDesC ); + } + gEventObservers.AppendL( gMusicControl ); + gEventPublishers.AppendL( gMusicControl ); + } + + // create effect manager + gEffectControl = + CShwEffectControl::NewL( + *gEffectManager, *aVisualList, *aMediaList, aScreenSize ); + gEventObservers.AppendL( gEffectControl ); + gEventPublishers.AppendL( gEffectControl ); + + // create view manager + gViewControl = + CShwViewControl::NewL( + *aMediaList, KDefaultTransitionDuration, KDefaultViewDuration ); + gEventObservers.AppendL( gViewControl ); + gEventPublishers.AppendL( gViewControl ); + + CleanupStack::Pop( self ); + return self; + } + +CShwPlaybackFactory::~CShwPlaybackFactory() + { + gPlaybackFactoryWasDeleted = ETrue; + // delete the event objects + delete gTimerControl; + delete gMusicControl; + delete gEffectControl; + delete gViewControl; + + gEventObservers.Close(); + gEventPublishers.Close(); + + gEffects.Close(); + } + +CShwPlaybackFactory::CShwPlaybackFactory() + { + gTimerControl = NULL; + gMusicControl = NULL; + gEffectControl = NULL; + gViewControl = NULL; + } + +RPointerArray< MShwEventObserver > CShwPlaybackFactory::EventObservers() + { + return gEventObservers; + } + +RPointerArray< MShwEventPublisher > CShwPlaybackFactory::EventPublishers() + { + return gEventPublishers; + } + +void CShwPlaybackFactory::AvailableEffectsL(RArray& aEffects) + { + aEffects = gEffects; + } + +// ----------------------------------------------------------------------------- +// <-- Stub for CShwPlaybackFactory +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Stub for ShwHuiUtility --> +// ----------------------------------------------------------------------------- +void ShwHuiUtility::ShowVisualListL( + CHuiDisplay* /*aDisplay*/, MGlxVisualList* /*aVisualList*/ ) + { + // do nothing + } +// ----------------------------------------------------------------------------- +// <-- Stub for ShwHuiUtility +// ----------------------------------------------------------------------------- + +// CONSTRUCTION +T_CShwSlideshowEngine* T_CShwSlideshowEngine::NewL() + { + T_CShwSlideshowEngine* self = T_CShwSlideshowEngine::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwSlideshowEngine* T_CShwSlideshowEngine::NewLC() + { + T_CShwSlideshowEngine* self = new( ELeave ) T_CShwSlideshowEngine; + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwSlideshowEngine::~T_CShwSlideshowEngine() + { + // remove our scheduler + // replace old with our new + iScheduler->Replace( iOldScheduler ); + delete iScheduler; + + delete iTimer; + } + +// Default constructor +T_CShwSlideshowEngine::T_CShwSlideshowEngine() + { + } + +// Second phase construct +void T_CShwSlideshowEngine::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + + // remove the old scheduler + iOldScheduler = CActiveScheduler::Current(); + // create our own scheduler + iScheduler = new( ELeave ) T_Scheduler; + // replace old with our new + iOldScheduler->Replace( iScheduler ); + } + +// METHODS +TBool gObserverEngineStarted = EFalse; +void T_CShwSlideshowEngine::EngineStartedL() + { + gObserverEngineStarted = ETrue; + } +TBool gObserverEnginePaused = EFalse; +void T_CShwSlideshowEngine::EnginePausedL() + { + gObserverEnginePaused = ETrue; + } +TBool gObserverEngineResumed = EFalse; +void T_CShwSlideshowEngine::EngineResumedL() + { + gObserverEngineResumed = ETrue; + } +TBool gObserverEngineError = EFalse; +void T_CShwSlideshowEngine::ErrorDuringSlideshowL() + { + gObserverEngineError = ETrue; + } + +void T_CShwSlideshowEngine::MGlxMediaList_MethodCalled( TMGlxMediaListMethodId aMethodId ) + { + // append the methodid in the array + TInt error = iMediaListCalls.Append( aMethodId ); + // check that append succeeded + if( error != KErrNone ) + { + // critical error, not enough space to append messages + User::Panic( _L("T_CShwSlideshowEngine::MGlxMediaList_MethodCalled"), __LINE__ ); + } + } + +void T_CShwSlideshowEngine::MGlxVisualList_MethodCalled( TMGlxVisualListMethodId aMethodId ) + { + // append the methodid in the array + TInt error = iVisualListCalls.Append( aMethodId ); + // check that append succeeded + if( error != KErrNone ) + { + // critical error, not enough space to append messages + User::Panic( _L("T_CShwSlideshowEngine::MGlxVisualList_MethodCalled"), __LINE__ ); + } + } + +// From MShwEffectManager >> +void T_CShwSlideshowEngine::AddEffectL( MShwEffect* /*aEffect*/ ) + { + // this is not called in this test + } + +MShwEffect* T_CShwSlideshowEngine::CurrentEffect() + { + switch( iCurrentEffect ) + { + case 0 : return iEffect1; + case 1 : return iEffect2; + case 2 : return iEffect3; + // default falls through + } + return NULL; + } + +MShwEffect* T_CShwSlideshowEngine::Effect( TInt aDirection ) + { + TInt index = iCurrentEffect + aDirection; + switch( index ) + { + case -1 : return iEffect3; + case 0 : return iEffect1; + case 1 : return iEffect2; + case 2 : return iEffect3; + case 3 : return iEffect1; + // default falls through + } + return NULL; + } +void T_CShwSlideshowEngine::ProceedToEffect( TInt aDirection ) + { + // inc and modulo with 3 -> values are: 0, 1, 2 + iCurrentEffect += aDirection; + iCurrentEffect %= 3; + // if negative, loop back to 2 + if( iCurrentEffect < 0 ) + { + iCurrentEffect = 2; + } + } + +void T_CShwSlideshowEngine::SetEffectOrder( MShwEffectManager::TShwEffectOrder /*aOrder*/ ) + { + } + +MShwEffectManager::TShwEffectOrder T_CShwSlideshowEngine::EffectOrder() + { + return MShwEffectManager::EEffectOrderProgrammed; + } + +void T_CShwSlideshowEngine::SetProgrammedEffects( RArray< TShwEffectInfo >& /*aEffects*/ ) + { + } + +void T_CShwSlideshowEngine::SetDefaultEffectL(TShwEffectInfo /*aInfo*/) + { + } + +void T_CShwSlideshowEngine::GetActiveEffectsL( RPointerArray< MShwEffect >& /*aEffects*/ ) + { + } + +// << from MShwEffectManager +// flag for resetting the thumbnail context request count +TBool gResetThumbnailContextRequestCount = EFalse; +void T_CShwSlideshowEngine::NotifyL( MShwEvent* aEvent ) + { + // got event so add a copy of it to the list + TInt error = iEvents.Append( aEvent->CloneLC() ); + CleanupStack::Pop(); + // check that append succeeded + if( error != KErrNone ) + { + // critical error, not enough space to append events + User::Panic( _L("T_CShwSlideshowEngine::NotifyL"), __LINE__ ); + } + + // if we received init completed we might want to reset the + // thumbnail stub to tell that it has panding requests + if( gResetThumbnailContextRequestCount && + dynamic_cast( aEvent ) ) + { + gThumbnailContextRequestCount = 1; + } + + // if we have waited enough events and wait is active + iEventsReceived++; + if( iEventsReceived >= iEventsToWait && iSchedulerWait.IsStarted() ) + { + iSchedulerWait.AsyncStop(); + } + } + +TInt T_CShwSlideshowEngine::LoadThumbnailL( TAny* aThis ) + { + T_CShwSlideshowEngine* self = (T_CShwSlideshowEngine*)aThis; + // notify engine that thumbnail is ready for index, increase the index + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + self->iStubMedialist->NotifyAttributesAvailableL( self->iThumbnailLoadIndex++ ); + // set the thumbnail request to be not complete + gThumbnailContextRequestCount = 1; + return 1; + } + +void T_CShwSlideshowEngine::MusicOnL() + { + iMusicOn = ETrue; + } + + +void T_CShwSlideshowEngine::MusicOff() + { + iMusicOn = EFalse; + } + + +void T_CShwSlideshowEngine::MusicVolume(TInt aCurrentVolume, TInt aMaxVolume) + { + iCurrentVolume = aCurrentVolume; + iMaxVolume = aMaxVolume; + + if(iVolumeWait.IsStarted()) + { + iVolumeWait.AsyncStop(); + } + } + + +void T_CShwSlideshowEngine::ErrorWithTrackL(TInt /*aErrorCode*/) + { + } + + +// Test methods +void T_CShwSlideshowEngine::EmptyL() + { + } + +void T_CShwSlideshowEngine::SetupL() + { + // reset events received + iEventsReceived = 0; + // create thumbnail loader + iThumbnailLoader = CPeriodic::NewL( 0 ); // default priority + // create stub list + iStubMedialist = new( ELeave ) TMGlxMediaList_Stub( this ); + // reset the wait counter + iEventsToWait = 0; + iEffect1 = new( ELeave ) T_MShwTestEffect( 1 ); + iEffect2 = new( ELeave ) T_MShwTestEffect( 2 ); + iEffect3 = new( ELeave ) T_MShwTestEffect( 3 ); + // set the test suite as visual list observer + gVisualListObserver = this; + // set ourselves as effect manager + gEffectManager = this; + + // reset state flags + gObserverEngineStarted = EFalse; + gObserverEnginePaused = EFalse; + gObserverEngineResumed = EFalse; + gObserverEngineError = EFalse; + + gNShwEnginePanicCalled = EFalse; + gVisualListWasAllocated = EFalse; + gVisualListWasReleased = EFalse; + gVisualListManagerWasDeleted = EFalse; + gPlaybackFactoryWasDeleted = EFalse; + iCurrentEffect = 0; + + gIncludeMusicControl = EFalse; // by default no music + gSetRealSong = ETrue; // by default set real song + + gStrictEffectOrder = ETrue; // by default strict effect order + + // reserve space for the events + iVisualListCalls.ReserveL( 100 ); + iMediaListCalls.ReserveL( 100 ); + iEvents.ReserveL( 100 ); + + // add the test suite to event observers + gEventObservers.AppendL( this ); + + // tell the thumbnail stub that it has pending requests + // which then tells the thumbnail loader that the + // thumbnail was not yet loaded + gThumbnailContextRequestCount = 1; + // by default dont reset the request count in init + gResetThumbnailContextRequestCount = EFalse; + + iCShwSlideshowEngine = CShwSlideshowEngine::NewL( *this ); + } + + +void T_CShwSlideshowEngine::Teardown() + { + // delete the class under test + delete iCShwSlideshowEngine; + iCShwSlideshowEngine = NULL; + + // delete the thumbnail load simulator + delete iThumbnailLoader; + iThumbnailLoader = NULL; + + // release the events + iVisualListCalls.Close(); + iMediaListCalls.Close(); + for( TInt i=0; iiFocus = gVisualListInitialFocus; + + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // verify that engine did not start + EUNIT_ASSERT_EQUALS_DESC( 1, iEvents.Count(), "1 events sent" ); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 0 ] ), + "event is initialize" ); + // nothing was done + EUNIT_ASSERT_DESC( !gObserverEngineStarted, "observer engine started was not called" ); + EUNIT_ASSERT_DESC( !gObserverEnginePaused, "observer engine paused was not called" ); + + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for current index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + // start the wait loop to get the construction completed + iSchedulerWait.Start(); + + // check that the engine started + EUNIT_ASSERT_GREATER_DESC( iEvents.Count(), 2, "init complete event sent" ); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 1 ] ), + "event is ready to view" ); + + // test that memory is released properly if we exit after start + Teardown(); + EUNIT_ASSERT_DESC( gVisualListWasReleased, "visual list was released" ); + EUNIT_ASSERT_DESC( gVisualListManagerWasDeleted, "visual list manager was deleted" ); + EUNIT_ASSERT_DESC( gPlaybackFactoryWasDeleted, "playback factory was deleted" ); + + EUNIT_ASSERT_DESC( gObserverEngineStarted, "observer engine started was called" ); + EUNIT_ASSERT_DESC( !gObserverEnginePaused, "observer engine paused was not called" ); + } + +void T_CShwSlideshowEngine::T_StartLWithListReadyL() + { + // specify the focus for the lists + gVisualListInitialFocus = 2; + iStubMedialist->iFocus = gVisualListInitialFocus; + + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify that thumbnail is ready for first index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + // start the wait loop to get the construction completed and the notify + iSchedulerWait.Start(); + + // verify that engine did start + EUNIT_ASSERT_GREATER_DESC( iEvents.Count(), 2, "init complete events sent" ); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 0 ] ), + "event is initialize" ); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 1 ] ), + "first event is ready to view" ); + + // test that memory is released properly if we exit after start + Teardown(); + EUNIT_ASSERT_DESC( gVisualListWasReleased, "visual list was released" ); + EUNIT_ASSERT_DESC( gVisualListManagerWasDeleted, "visual list manager was deleted" ); + EUNIT_ASSERT_DESC( gPlaybackFactoryWasDeleted, "playback factory was deleted" ); + + EUNIT_ASSERT_DESC( gObserverEngineStarted, "observer engine started was called" ); + EUNIT_ASSERT_DESC( !gObserverEnginePaused, "observer engine paused was not called" ); + } + +void T_CShwSlideshowEngine::T_StartLTwiceL() + { + // specify the focus for the lists + gVisualListInitialFocus = 2; + iStubMedialist->iFocus = gVisualListInitialFocus; + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for first index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + // start the wait loop to get the construction completed and the notify + iSchedulerWait.Start(); + + // verify that engine did start + EUNIT_ASSERT_GREATER_DESC( iEvents.Count(), 2, "init complete event sent" ); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 0 ] ), + "event is initialize" ); + EUNIT_ASSERT_DESC( + dynamic_cast( iEvents[ 1 ] ), + "first event is ready to view" ); + EUNIT_ASSERT_DESC( gObserverEngineStarted, "observer engine started was called" ); + // and then start again + gObserverEngineStarted = EFalse; + // in real environment this is supposed to panic as its a programming error + // in the test we just leave + TRAPD(err, iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ) ); + EUNIT_ASSERT_DESC( err == NShwEngine::EEngineStartLCalledInWrongState, + "Engine start in wrong state panic"); + + EUNIT_ASSERT_DESC( !gObserverEngineStarted, "observer engine started was not called" ); + EUNIT_ASSERT_DESC( !gObserverEnginePaused, "observer engine paused was not called" ); + } + +void T_CShwSlideshowEngine::T_StartLAsynchL() + { + // specify the focus for the lists + gVisualListInitialFocus = 1; + iStubMedialist->iFocus = gVisualListInitialFocus; + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // start the thumbnail loader, it periodically informs that thumbnails are ready + iThumbnailLoadIndex = gVisualListInitialFocus; + iThumbnailLoader->Start( + KDefaultViewDuration * 1250, + KDefaultViewDuration * 1250, + TCallBack( LoadThumbnailL, this ) ); + + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // wait for a few event Notifys + iEventsToWait = 16; + // and start to wait + iSchedulerWait.Start(); + // cancel the thumbnail loader + iThumbnailLoader->Cancel(); + + // validate the events + TInt id=0; + EUNIT_ASSERT_EQUALS_DESC( iEvents.Count(), iEventsToWait, "16 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is initialize" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is startview" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to advance" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is timer" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start transition" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is transition ready" ); + + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is timer" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to advance" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start transition" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is transition ready" ); + + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start view" ); + + // test that memory is released properly if we exit after start + Teardown(); + EUNIT_ASSERT_DESC( gVisualListWasReleased, "visual list was released" ); + EUNIT_ASSERT_DESC( gVisualListManagerWasDeleted, "visual list manager was deleted" ); + EUNIT_ASSERT_DESC( gPlaybackFactoryWasDeleted, "playback factory was deleted" ); + + EUNIT_ASSERT_DESC( gObserverEngineStarted, "observer engine started was called" ); + EUNIT_ASSERT_DESC( !gObserverEnginePaused, "observer engine paused was not called" ); + } + +void T_CShwSlideshowEngine::T_StartLAsynchSlowImagesL() + { + // specify the focus for the lists + gVisualListInitialFocus = 1; + iStubMedialist->iFocus = gVisualListInitialFocus; + + // start the thumbnail loader, it periodically informs that thumbnails are ready + iThumbnailLoadIndex = gVisualListInitialFocus; + iThumbnailLoader->Start( + KDefaultViewDuration * 3 * 1000, + KDefaultViewDuration * 3 * 1000, + TCallBack( LoadThumbnailL, this ) ); + + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + gThumbnailContextRequestCount = KErrNone; + // set the thumbnail request to be not complete after init + gResetThumbnailContextRequestCount = ETrue; + + // wait for a few event notifys + iEventsToWait = 14; + // and start to wait + iSchedulerWait.Start(); + // cancel the thumbnail load generator + iThumbnailLoader->Cancel(); + + // validate the events + TInt id=0; + EUNIT_ASSERT_EQUALS_DESC( iEvents.Count(), iEventsToWait, "14 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is initialize" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "first event is start" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is startview" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is timer" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to advance" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start transition" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is transition ready" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is timer" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to advance" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start transition" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + + // test that memory is released properly if we exit after start + Teardown(); + EUNIT_ASSERT_DESC( gVisualListWasReleased, "visual list was released" ); + EUNIT_ASSERT_DESC( gVisualListManagerWasDeleted, "visual list manager was deleted" ); + EUNIT_ASSERT_DESC( gPlaybackFactoryWasDeleted, "playback factory was deleted" ); + + EUNIT_ASSERT_DESC( gObserverEngineStarted, "observer engine started was called" ); + EUNIT_ASSERT_DESC( !gObserverEnginePaused, "observer engine paused was not called" ); + } + +void T_CShwSlideshowEngine::T_PauseLL() + { + // pause without init or start + iCShwSlideshowEngine->PauseL(); + + EUNIT_ASSERT_DESC( !gObserverEngineStarted, "observer engine started was not called" ); + EUNIT_ASSERT_DESC( !gObserverEnginePaused, "observer engine paused was not called" ); + } + +void T_CShwSlideshowEngine::T_PauseL2L() + { + // specify the focus for the lists + gVisualListInitialFocus = 1; + iStubMedialist->iFocus = gVisualListInitialFocus; + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for focus index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + // start to wait to get engine fully constructed + iSchedulerWait.Start(); + EUNIT_ASSERT_DESC( gObserverEngineStarted, "observer engine started was called" ); + // pause engine + iCShwSlideshowEngine->PauseL(); + EUNIT_ASSERT_DESC( gObserverEnginePaused, "observer engine paused was called" ); + // validate the events + TInt id=0; + EUNIT_ASSERT_EQUALS_DESC( 6, iEvents.Count(), "6 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is initialize" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "first event is start" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is startview" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to advance" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is pause" ); + + // then resume straight away + iCShwSlideshowEngine->ResumeL(); + // check that engine was resumed + EUNIT_ASSERT_DESC( gObserverEngineResumed, "observer engine resumed was called" ); + EUNIT_ASSERT_EQUALS_DESC( 7, iEvents.Count(), "7 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is resume " ); + // pause again + iCShwSlideshowEngine->PauseL(); + EUNIT_ASSERT_EQUALS_DESC( 8, iEvents.Count(), "8 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is resume " ); + + // need to loosen the effect call order since user navigate jumps like: + // enter view -> exit view -> enter view + gStrictEffectOrder = EFalse; + + // set the thumbnail request not to be complete so that engine starts to wait for thumbnails + gThumbnailContextRequestCount = 1; + // then navigate to previous item + iCShwSlideshowEngine->PreviousItemL(); + EUNIT_ASSERT_EQUALS_DESC( 9, iEvents.Count(), "9 events received" ); + // check new events + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is previous" ); + + // set the thumbnail request to be complete now + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for index minus 1 + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus - 1 ); + + // start a wait as the callback for thumbnail gets called asyncronously + iSchedulerWait.Start(); + + // check that we got event + EUNIT_ASSERT_EQUALS_DESC( 12, iEvents.Count(), "12 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is startview" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to advance" ); + + // navigate to next item, this thumbnail is already loaded + iCShwSlideshowEngine->NextItemL(); + // check that we got events + EUNIT_ASSERT_EQUALS_DESC( 13, iEvents.Count(), "13 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is next image" ); + // start a wait as the callback for thumbnail gets called asyncronously + iSchedulerWait.Start(); + // now we should have the new events + EUNIT_ASSERT_EQUALS_DESC( 15, iEvents.Count(), "15 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is ready to view" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start view" ); + + // then resume + iCShwSlideshowEngine->ResumeL(); + // check that engine was resumed + EUNIT_ASSERT_DESC( gObserverEngineResumed, "observer engine resumed was called" ); + // check that we got events + EUNIT_ASSERT_EQUALS_DESC( 17, iEvents.Count(), "17 events received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is resume " ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvents[ id++ ] ), "event is start view"); + } + + +void T_CShwSlideshowEngine::T_StartWithMusicL() + { +/// @todo make this an alloc test once MPX is fixed + gIncludeMusicControl = ETrue; // have some music + // specify the focus for the lists + gVisualListInitialFocus = 2; + iStubMedialist->iFocus = gVisualListInitialFocus; + + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for first index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + iVolumeWait.Start(); + } + +void T_CShwSlideshowEngine::T_MusicVolumeUpL() + { + gIncludeMusicControl = ETrue; // have some music + // specify the focus for the lists + gVisualListInitialFocus = 2; + iStubMedialist->iFocus = gVisualListInitialFocus; + + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for first index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + // start scheduler wait + iVolumeWait.Start(); + + TInt volume = iCurrentVolume; + // and then pause + iCShwSlideshowEngine->VolumeUpL(); + // and start to wait + iVolumeWait.Start(); + + if (volume == KErrNotFound) // First time volume values were retrieved. + { + EUNIT_ASSERT_DESC( iCurrentVolume != KErrNotFound, "current volume is < 0" ); + // Retrieve the volume for the second time. + volume = iCurrentVolume; + iCShwSlideshowEngine->VolumeUpL(); + iVolumeWait.Start(); + } + + if (volume == iMaxVolume) + { + EUNIT_ASSERT_DESC( iCurrentVolume == iMaxVolume, "current volume is max volume" ); + } + else + { + EUNIT_ASSERT_GREATER_DESC( iCurrentVolume, volume, "volume was incremented" ); + } + } + +void T_CShwSlideshowEngine::T_MusicVolumeDownL() + { + gIncludeMusicControl = ETrue; // have some music + + // specify the focus for the lists + gVisualListInitialFocus = 2; + iStubMedialist->iFocus = gVisualListInitialFocus; + + // call start + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for first index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + iVolumeWait.Start(); + + TInt volume = iCurrentVolume; + // and then pause + iCShwSlideshowEngine->VolumeDownL(); + // and start to wait + iVolumeWait.Start(); + + if (volume == KErrNotFound) // First time volume values were retrieved. + { + EUNIT_ASSERT_DESC( iCurrentVolume != KErrNotFound, "current volume is < 0" ); + // Retrieve the volume for the second time. + volume = iCurrentVolume; + iCShwSlideshowEngine->VolumeDownL(); + iVolumeWait.Start(); + } + + if (volume == 0) + { + EUNIT_ASSERT_EQUALS_DESC( 0, iCurrentVolume, "current volume is 0" ); + } + else + { + EUNIT_ASSERT_GREATER_DESC( volume, iCurrentVolume, "volume was decremented" ); + } + } + +void T_CShwSlideshowEngine::T_MusicNoVolumeEventsL() + { + gIncludeMusicControl = ETrue; // have music control + gSetRealSong = EFalse; // but not the proper song + + // specify the focus for the lists + gVisualListInitialFocus = 2; + iStubMedialist->iFocus = gVisualListInitialFocus; + + // call start - no music control + iCShwSlideshowEngine->StartL( + *iHuiEnv, *iDisplay, *iStubMedialist, *this, TSize( 320, 240 ) ); + // set the thumbnail request to be complete + gThumbnailContextRequestCount = KErrNone; + // notify engine that thumbnail is ready for first index + iStubMedialist->NotifyAttributesAvailableL( gVisualListInitialFocus ); + + iCurrentVolume = KErrNotFound; + iMaxVolume = KErrNotFound; + + if (!iTimer) + { + iTimer = CPeriodic::NewL(EPriorityNormal); + } + // wait 10 seconds for a volume notification + const TInt KWaitPeriod = 10000000; // Microseconds + TCallBack callBack(StopWaiting, this); + iTimer->Start(KWaitPeriod, KWaitPeriod, callBack); + + // turn the volume down + iCShwSlideshowEngine->VolumeDownL(); + iVolumeWait.Start(); + + EUNIT_ASSERT_DESC( + (iCurrentVolume == KErrNotFound || iMaxVolume == KErrNotFound), + "music control exists" ); + + delete iTimer; + iTimer = NULL; + + // test that memory is released properly if we exit after start + Teardown(); + } + +TInt T_CShwSlideshowEngine::StopWaiting(TAny* aTestEngine) + { + T_CShwSlideshowEngine* self = reinterpret_cast(aTestEngine); + + if(self->iVolumeWait.IsStarted()) + { + self->iVolumeWait.AsyncStop(); + } + + return KErrNone; + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwSlideshowEngine, + "CShwSlideshowEngine test suite", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Construction test", + "CShwSlideshowEngine", + "CShwSlideshowEngine", + "FUNCTIONALITY", + EmptyL, T_ConstructL, Teardown ) // need to do teardown since alloc test + +EUNIT_ALLOC_TEST( + "StartL, no Image", + "CShwSlideshowEngine", + "StartL", + "FUNCTIONALITY", + SetupL, T_StartLWithListNotReadyL, Teardown ) + +EUNIT_ALLOC_TEST( + "StartL, Image loaded", + "CShwSlideshowEngine", + "StartL", + "FUNCTIONALITY", + SetupL, T_StartLWithListReadyL, Teardown ) + +EUNIT_ALLOC_TEST( + "StartL twice", + "CShwSlideshowEngine", + "StartL", + "FUNCTIONALITY", + SetupL, T_StartLTwiceL, Teardown ) + +EUNIT_ALLOC_TEST( + "StartL asynchronous", + "CShwSlideshowEngine", + "StartL", + "FUNCTIONALITY", + SetupL, T_StartLAsynchL, Teardown ) + +EUNIT_TEST( // cant be alloc test as it takes too long + "StartL slow images", + "CShwSlideshowEngine", + "StartL", + "FUNCTIONALITY", + SetupL, T_StartLAsynchSlowImagesL, Teardown ) + +EUNIT_ALLOC_TEST( + "PauseL without start", + "CShwSlideshowEngine", + "PauseL", + "FUNCTIONALITY", + SetupL, T_PauseLL, Teardown ) + +EUNIT_TEST( // ALLOC + "PauseL with start", + "CShwSlideshowEngine", + "PauseL", + "FUNCTIONALITY", + SetupL, T_PauseL2L, Teardown ) + +/// @todo make this an alloc test once MPX is fixed +EUNIT_TEST( + "Start with music", + "CShwSlideshowEngine", + "StartL", + "FUNCTIONALITY", + SetupL, T_StartWithMusicL, Teardown ) + +EUNIT_NOT_DECORATED_TEST( + "Turn music volume up", + "CShwSlideshowEngine", + "VolumeUpL", + "FUNCTIONALITY", + SetupL, T_MusicVolumeUpL, Teardown ) + +EUNIT_NOT_DECORATED_TEST( + "Turn music volume down", + "CShwSlideshowEngine", + "VolumeDownL", + "FUNCTIONALITY", + SetupL, T_MusicVolumeDownL, Teardown ) + +EUNIT_NOT_DECORATED_TEST( + "No volume events when not registered for volume events", + "CShwSlideshowEngine", + "VolumeDownL", + "FUNCTIONALITY", + SetupL, T_MusicNoVolumeEventsL, Teardown ) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwslideshowengine/t_cshwslideshowengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwslideshowengine/t_cshwslideshowengine.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2007-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: Test for slideshow engine + * +*/ + + + + +#ifndef __T_CSHWSLIDESHOWENGINE_H__ +#define __T_CSHWSLIDESHOWENGINE_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shwengineobserver.h" +#include "shweffectmanager.h" +#include "shweventobserver.h" +#include "shwmusicobserver.h" + +#include "tmglxmedialist_stub.h" +#include "tmglxvisuallist_adapter.h" + +// FORWARD DECLARATIONS +class CShwSlideshowEngine; +class CHuiEnv; +class CHuiDisplay; +class MShwEvent; +class T_MShwTestEffect; +class T_Scheduler; + +// CLASS DEFINITION +/** + * + */ +NONSHARABLE_CLASS( T_CShwSlideshowEngine ) + : public CEUnitTestSuiteClass, + public MShwEngineObserver, + public MGlxMediaList_Stub_Observer, + public MGlxVisualList_Observer, + public MShwEffectManager, + public MShwEventObserver, + public MShwMusicObserver + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwSlideshowEngine* NewL(); + static T_CShwSlideshowEngine* NewLC(); + /** + * Destructor + */ + ~T_CShwSlideshowEngine(); + + private: // Constructors and destructors + + T_CShwSlideshowEngine(); + void ConstructL(); + + public: // from MShwEngineObserver + + void EngineStartedL(); + void EnginePausedL(); + void EngineResumedL(); + void ErrorDuringSlideshowL(); + + public: // from MGlxMediaList_Stub_Observer and MGlxVisualList_Observer + + void MGlxMediaList_MethodCalled( TMGlxMediaListMethodId aMethodId ); + void MGlxVisualList_MethodCalled( TMGlxVisualListMethodId aMethodId ); + + public: // from MShwEffectManager + + void AddEffectL( MShwEffect* aEffects ); + MShwEffect* CurrentEffect(); + MShwEffect* Effect( TInt aDirection ); + void ProceedToEffect( TInt aDirection ); + void SetEffectOrder( MShwEffectManager::TShwEffectOrder aOrder ); + MShwEffectManager::TShwEffectOrder EffectOrder(); + void SetProgrammedEffects( RArray< TShwEffectInfo >& aEffects ); + void SetDefaultEffectL(TShwEffectInfo aInfo); + void GetActiveEffectsL( RPointerArray< MShwEffect >& aEffects ); + + public: // from MShwEventObserver + + void NotifyL( MShwEvent* aEvent ); + + public: // from MShwMusicObserver + + void MusicOnL(); + void MusicOff(); + void MusicVolume( TInt aCurrentVolume, TInt aMaxVolume ); + void ErrorWithTrackL( TInt aErrorCode ); + + public: + + static TInt LoadThumbnailL( TAny* aThis ); + static TInt StopWaiting(TAny* aTestEngine); + + private: // New methods + + void EmptyL(); + void SetupL(); + void Teardown(); + + void T_ConstructL(); + void T_StartLWithListNotReadyL(); + void T_StartLWithListReadyL(); + void T_StartLTwiceL(); + void T_StartLAsynchL(); + void T_StartLAsynchSlowImagesL(); + void T_PauseLL(); + void T_PauseL2L(); + void T_StartWithMusicL(); + void T_MusicVolumeUpL(); + void T_MusicVolumeDownL(); + void T_MusicNoVolumeEventsL(); + + private: // Data + + CActiveScheduler* iOldScheduler; + T_Scheduler* iScheduler; + + // own: class under test + CShwSlideshowEngine* iCShwSlideshowEngine; + + // own: the dependant objects + CHuiEnv* iHuiEnv; + CHuiDisplay* iDisplay; + TMGlxMediaList_Stub* iStubMedialist; + + // own: timer to simulate the loading of thumbnails + CPeriodic* iThumbnailLoader; + TInt iThumbnailLoadIndex; + + // own: the effects + TInt iCurrentEffect; + T_MShwTestEffect* iEffect1; + T_MShwTestEffect* iEffect2; + T_MShwTestEffect* iEffect3; + + // own: verification information + RArray iVisualListCalls; + RArray iMediaListCalls; + RArray iEvents; + // own: the amount of events received and to wait + TInt iEventsReceived; + TInt iEventsToWait; + // own: the asynch wait object + CActiveSchedulerWait iSchedulerWait; + + // own: The music state + TBool iMusicOn; + // own: The current and max music volume + TInt iCurrentVolume; + TInt iMaxVolume; + // own: the asynch wait object + CActiveSchedulerWait iVolumeWait; + // own: timeout for volume callback + CPeriodic* iTimer; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWSLIDESHOWENGINE_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwslideshowengine/t_cshwslideshowengine_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwslideshowengine/t_cshwslideshowengine_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007-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: Test for slideshow engine + * +*/ + + + + +// CLASS HEADER +#include "t_cshwslideshowengine.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwSlideshowEngine::NewL(); + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwtimercontrol/t_cshwtimercontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwtimercontrol/t_cshwtimercontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,274 @@ +/* +* Copyright (c) 2007-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: Test for timer control for the slideshow + * +*/ + + + +// CLASS HEADER +#include "t_cshwtimercontrol.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shwevent.h" +#include "shwautoptr.h" +#include "shwcallback.h" + +// CONSTRUCTION +T_CShwTimerControl* T_CShwTimerControl::NewL() + { + T_CShwTimerControl* self = T_CShwTimerControl::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwTimerControl* T_CShwTimerControl::NewLC() + { + T_CShwTimerControl* self = new( ELeave ) T_CShwTimerControl; + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwTimerControl::~T_CShwTimerControl() + { + } + +// Default constructor +T_CShwTimerControl::T_CShwTimerControl() + { + } + +// Second phase construct +void T_CShwTimerControl::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + +void T_CShwTimerControl::SendEventL( MShwEvent* aEvent ) + { + // need to clone the event since the caller goes out of scope + iEvent = aEvent->CloneLC(); + CleanupStack::Pop(); + + // stop the scheduler loop if its started + if( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + +TInt T_CShwTimerControl::TimerCallBack() + { + iStoppedForTimer = ETrue; + iWait.AsyncStop(); + return 0; + } + +void T_CShwTimerControl::SetupL() + { + iCShwTimerControl = CShwTimerControl::NewL(); + // set the event queue + iCShwTimerControl->SetEventQueue( this ); + } + +void T_CShwTimerControl::Teardown() + { + delete iCShwTimerControl; + iCShwTimerControl = NULL; + + delete iEvent; + iEvent = NULL; + } + +void T_CShwTimerControl::Empty() + { + } + +void T_CShwTimerControl::TestConstructL() + { + // create timer + iCShwTimerControl = CShwTimerControl::NewL(); + // set the event queue + iCShwTimerControl->SetEventQueue( this ); + // test that object exists + EUNIT_ASSERT_DESC( iCShwTimerControl, "object created" ); + // delete timer + delete iCShwTimerControl; + iCShwTimerControl = NULL; + // EUnit checks for memory leaks + } + +void T_CShwTimerControl::T_TimeTickLL() + { + // call timetick + iCShwTimerControl->SendTimerBeatL(); + // check that we got the event + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventTimerBeat* timer = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( timer, "event was TShwEventTimerBeat" ); + } + +void T_CShwTimerControl::T_NotifyLL() + { + // if should evaluate true: else if( eventStartView ) + TShwEventStartView start( 123 ); + iCShwTimerControl->NotifyL( &start ); + + // Need to let the scheduler loop + iWait.Start(); + + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventTimerBeat* timer = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( timer, "event was TShwEventTimerBeat" ); + } + +void T_CShwTimerControl::T_NotifyL2L() + { + // if should evaluate false: else if( eventStartView ) + MShwEvent* iParam1 = NULL; + iCShwTimerControl->NotifyL( iParam1 ); + + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwTimerControl::T_PauseL() + { + // should evaluate true: else if( eventStartView ) + // NOTE timer multiplies this with 1000 so this is milliseconds + TShwEventStartView start( 123 ); + iCShwTimerControl->NotifyL( &start ); + + // then send Pause + // should evaluate true: if ( eventPause ) + TShwEventPause pause; + iCShwTimerControl->NotifyL( &pause ); + // send pause again, its a no-op + iCShwTimerControl->NotifyL( &pause ); + + // create timer to give us callback + TShwAutoPtr< CPeriodic > timer = CPeriodic::NewL( CActive::EPriorityStandard ); + // start a timer to stop the asynch loop since we dont expect the + // iCShwTimerControl to send any event + // start asynch wait for 1 second + iStoppedForTimer = EFalse; + timer->Start( + 1 * 1000000, + 1 * 1000000, + TShwCallBack< T_CShwTimerControl, TimerCallBack >( this ) ); + + // Need to let the scheduler loop + iWait.Start(); + timer->Cancel(); + + EUNIT_ASSERT_DESC( iStoppedForTimer, "stopped in timer, SendEventL not called" ); + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + + // send resume + // should evaluate true: else if( eventResume ) + TShwEventResume resume; + iCShwTimerControl->NotifyL( &resume ); + + // start the timer again + iStoppedForTimer = EFalse; + timer->Start( + 1 * 1000000, + 1 * 1000000, + TShwCallBack< T_CShwTimerControl, TimerCallBack >( this ) ); + + // Need to let the scheduler loop + iWait.Start(); + timer->Cancel(); + + EUNIT_ASSERT_DESC( !iStoppedForTimer, "SendEventL was called" ); + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + EUNIT_ASSERT_DESC( dynamic_cast( iEvent ), "event was timer beat" ); + // release the event + delete iEvent; iEvent = NULL; + + // send resume again + // should evaluate true: else if( eventResume ) + TShwEventResume resume2; + iCShwTimerControl->NotifyL( &resume2 ); + // start the timer again + iStoppedForTimer = EFalse; + timer->Start( + 1 * 1000000, + 1 * 1000000, + TShwCallBack< T_CShwTimerControl, TimerCallBack >( this ) ); + // Need to let the scheduler loop + iWait.Start(); + timer->Cancel(); + EUNIT_ASSERT_DESC( iStoppedForTimer, "stopped in timer, SendEventL not called" ); + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwTimerControl, + "Test suite for CShwTimerControl", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Constructor test", + "CShwTimerControl", + "NewL", + "FUNCTIONALITY", + Empty, TestConstructL, Empty ) + +EUNIT_ALLOC_TEST( + "TimeTickL - test0", + "CShwTimerControl", + "TimeTickL", + "ERRORHANDLING", + SetupL, T_TimeTickLL, Teardown) + +// these cant be decorated as the EUnit +// scheduler does not implement Error method +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test0", + "CShwTimerControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyLL, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "NotifyL - test1", + "CShwTimerControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_NotifyL2L, Teardown) + +EUNIT_NOT_DECORATED_TEST( + "Pause test", + "CShwTimerControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, T_PauseL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwtimercontrol/t_cshwtimercontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwtimercontrol/t_cshwtimercontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2007-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: Test for timer control for the slideshow + * +*/ + + + + +#ifndef __T_CSHWTIMERCONTROL_H__ +#define __T_CSHWTIMERCONTROL_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES +#include "shweventqueue.h" +#include "shwtimercontrol.h" + +// FORWARD DECLARATIONS + +// CLASS DEFINITION +/** + * EUnit test suite for CShwTimerControl + */ +NONSHARABLE_CLASS( T_CShwTimerControl ) + : public CEUnitTestSuiteClass, + public MShwEventQueue + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwTimerControl* NewL(); + static T_CShwTimerControl* NewLC(); + /** + * Destructor + */ + ~T_CShwTimerControl(); + + private: // Constructors and destructors + + T_CShwTimerControl(); + void ConstructL(); + + public: // From MShwEventQueue + + void SendEventL( MShwEvent* aEvent ); + + // timer callback for test + TInt TimerCallBack(); + + private: // New methods + + void SetupL(); + void Teardown(); + void Empty(); + + void TestConstructL(); + void T_TimeTickLL(); + void T_NotifyLL(); + void T_NotifyL2L(); + void T_PauseL(); + + private: // Data + + /// Own: the class under test + CShwTimerControl* iCShwTimerControl; + /// Own: the event received from cut + MShwEvent* iEvent; + /// Own: scheduler wait object + CActiveSchedulerWait iWait; + /// Own: a flag to know where the scheduler was stopped + TBool iStoppedForTimer; + + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWTIMERCONTROL_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwtimercontrol/t_cshwtimercontrol_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwtimercontrol/t_cshwtimercontrol_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007-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: Test for timer control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "t_cshwtimercontrol.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwTimerControl::NewL(); + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwviewcontrol/t_cshwviewcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwviewcontrol/t_cshwviewcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,526 @@ +/* +* 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: Test for view control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "t_cshwviewcontrol.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shwviewcontrol.h" +#include "shwevent.h" +#include "shwslideshowenginepanic.h" + +TBool gPanicCalled; +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + gPanicCalled = ETrue; + // in test situation we just leave + User::Leave( aPanic ); + } + } + +// CONSTRUCTION +T_CShwViewControl* T_CShwViewControl::NewL() + { + T_CShwViewControl* self = T_CShwViewControl::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwViewControl* T_CShwViewControl::NewLC() + { + T_CShwViewControl* self = new( ELeave ) T_CShwViewControl(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwViewControl::~T_CShwViewControl() + { + Teardown(); + } + +// Default constructor +T_CShwViewControl::T_CShwViewControl() + { + } + +// Second phase construct +void T_CShwViewControl::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +void T_CShwViewControl::SendEventL( MShwEvent* aEvent ) + { + // need to clone the event since the caller goes out of scope + iEvent = aEvent->CloneLC(); + CleanupStack::Pop(); + } + +const TInt KTestTransitionDuration = 987; +const TInt KTestViewDuration = 678; + +// METHODS +TBool gMediaListCalled = EFalse; +void T_CShwViewControl::MGlxMediaList_MethodCalled( TMGlxMediaListMethodId /*aMethodId*/ ) + { + // media list was called + gMediaListCalled = ETrue; + } + +void T_CShwViewControl::SetupL() + { + iStubMediaList = new( ELeave ) TMGlxMediaList_Stub( this ); + + // create viewcontrol + iCShwViewControl = + CShwViewControl::NewL( + *iStubMediaList, KTestTransitionDuration, KTestViewDuration ); + // set the event queue + iCShwViewControl->SetEventQueue( this ); + + // reset flags + gPanicCalled = EFalse; + gMediaListCalled = EFalse; + } + +void T_CShwViewControl::Teardown() + { + // delete the object + delete iCShwViewControl; + iCShwViewControl = NULL; + + delete iStubMediaList; + iStubMediaList = NULL; + + // delete the event + delete iEvent; + iEvent = NULL; + } + +void T_CShwViewControl::TestNewlL() + { + } + +void T_CShwViewControl::TestNotifyL1L() + { + // Path + // true: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + TShwEventStart start; + // call notify + iCShwViewControl->NotifyL( &start ); + + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventStartView* startview = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( startview, "event was TShwEventStartView" ); + EUNIT_ASSERT_EQUALS_DESC( + startview->Parameter(), KTestViewDuration, "event had correct parameter" ); + } + +void T_CShwViewControl::TestNotifyL2L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: if( iTransitionReadyReceived || iUserNavigated ) + TShwEventReadyToView ready2view; + iCShwViewControl->NotifyL( &ready2view ); + + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL3L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // true: if( iTransitionReadyReceived || iUserNavigated ) + TShwEventTransitionReady trans; + iCShwViewControl->NotifyL( &trans ); + + TShwEventReadyToView ready2view; + iCShwViewControl->NotifyL( &ready2view ); + + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventStartView* startview = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( startview, "event was TShwEventStartView" ); + EUNIT_ASSERT_EQUALS_DESC( + startview->Parameter(), KTestViewDuration, "event had correct parameter" ); + } + +void T_CShwViewControl::TestNotifyL4L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // false: if( iReadyToViewReceived ) + TShwEventTransitionReady trans; + iCShwViewControl->NotifyL( &trans ); + + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL5L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // true: if( iReadyToViewReceived ) + TShwEventReadyToView ready2view; + iCShwViewControl->NotifyL( &ready2view ); + + TShwEventTransitionReady trans; + iCShwViewControl->NotifyL( &trans ); + + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventStartView* startview = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( startview, "event was TShwEventStartView" ); + EUNIT_ASSERT_EQUALS_DESC( + startview->Parameter(), KTestViewDuration, "event had correct parameter" ); + } + +void T_CShwViewControl::TestNotifyL6L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // true: if( iTimerReceived && iReadyToAdvanceReceived && (!iPaused) && (iList.Count() > 1) ) + // call notify first with view ready + TShwEventReadyToAdvance viewReady; + iCShwViewControl->NotifyL( &viewReady ); + // then send timer beat + TShwEventTimerBeat beat; + iCShwViewControl->NotifyL( &beat ); + // validate + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventStartTransition* startview = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( startview, "event was TShwEventStartTransition" ); + EUNIT_ASSERT_EQUALS_DESC( + startview->Parameter(), KTestTransitionDuration, "event had correct parameter" ); + } + +void T_CShwViewControl::TestNotifyL7L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // false: if( iTimerReceived && iReadyToAdvanceReceived && (!iPaused) && (iList.Count() > 1) ) + // send timer beat + TShwEventTimerBeat beat; + iCShwViewControl->NotifyL( &beat ); + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL8L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // false: if( iTimerReceived && iReadyToAdvanceReceived && (!iPaused) && (iList.Count() > 1) ) + // test iPaused + // call notify first with view ready + TShwEventReadyToAdvance viewReady; + iCShwViewControl->NotifyL( &viewReady ); + // send pause + TShwEventPause pause; + iCShwViewControl->NotifyL( &pause ); + // then send timer beat + TShwEventTimerBeat beat; + iCShwViewControl->NotifyL( &beat ); + // validate + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL9L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // false: if( iTimerReceived && iReadyToAdvanceReceived && (!iPaused) && (iList.Count() > 1) ) + // test iList.Count() + // call notify first with view ready + TShwEventReadyToAdvance viewReady; + iCShwViewControl->NotifyL( &viewReady ); + // set list count to be one + iStubMediaList->iCount = 1; + // then send timer beat + TShwEventTimerBeat beat; + iCShwViewControl->NotifyL( &beat ); + // validate + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL10L() + { + // Path + // all top level ifs are false + iCShwViewControl->NotifyL( NULL ); + + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL11L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventReadyToAdvance* >( aEvent ) ) + // true: if( iTimerReceived && iReadyToAdvanceReceived && (!iPaused) && (iList.Count() > 1) ) + // iTimerReceived value should be ETrue + // send timerbeat first + TShwEventTimerBeat beat; + iCShwViewControl->NotifyL( &beat ); + // then send the ready to advance + TShwEventReadyToAdvance view_ready; + iCShwViewControl->NotifyL( &view_ready ); + // validate + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventStartTransition* start = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( start, "event was TShwEventStartTransition" ); + EUNIT_ASSERT_EQUALS_DESC( + start->Parameter(), KTestTransitionDuration, "event had correct parameter" ); + } + +void T_CShwViewControl::TestNotifyL12L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventReadyToAdvance* >( aEvent ) ) + // true: if( iTimerReceived && iReadyToAdvanceReceived && (!iPaused) && (iList.Count() > 1) ) + // iTimerReceived value should be EFalse + // send the view ready + TShwEventReadyToAdvance view_ready; + iCShwViewControl->NotifyL( &view_ready ); + + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL13L() + { + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // true: else if( dynamic_cast< TShwEventReadyToAdvance* >( aEvent ) ) + // true: if( iTimerReceived && iReadyToAdvanceReceived && (!iPaused) && (iList.Count() > 1) ) + // iTimerReceived value should be ETrue, iPaused should be false + // send timerbeat first + TShwEventTimerBeat beat; + iCShwViewControl->NotifyL( &beat ); + // send pause + TShwEventPause pause; + iCShwViewControl->NotifyL( &pause ); + // send the view ready + TShwEventReadyToAdvance view_ready; + iCShwViewControl->NotifyL( &view_ready ); + + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + } + +void T_CShwViewControl::TestNotifyL14L() + { + // test pause - usernavigate - resume + // Path + // false: if( dynamic_cast< TShwEventStart* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToView* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTransitionReady* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventTimerBeat* >( aEvent ) ) + // false: else if( dynamic_cast< TShwEventReadyToAdvance* >( aEvent ) ) + // true: else if ( dynamic_cast< TShwEventNextImage* >( aEvent ) + + // send pause + TShwEventPause pause; + iCShwViewControl->NotifyL( &pause ); + + // send the previous image + TShwEventPreviousImage previous; + iCShwViewControl->NotifyL( &previous ); + + // validate that start view was not yet sent + EUNIT_ASSERT_DESC( !iEvent, "event was not received" ); + + // send ready to view + TShwEventReadyToView readyToView; + iCShwViewControl->NotifyL( &readyToView ); + + // validate that start view was sent + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + TShwEventStartView* startview = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( startview, "event was TShwEventStartView" ); + EUNIT_ASSERT_EQUALS_DESC( startview->Parameter(), + KTestViewDuration, "event had correct parameter" ); + // release event + delete iEvent; + iEvent = NULL; + + // send resume + TShwEventResume resume; + iCShwViewControl->NotifyL( &resume ); + + // validate that start view was sent again + EUNIT_ASSERT_DESC( iEvent, "event was received" ); + startview = dynamic_cast( iEvent ); + EUNIT_ASSERT_DESC( startview, "event was TShwEventStartView" ); + EUNIT_ASSERT_EQUALS_DESC( startview->Parameter(), + KTestViewDuration, "event had correct parameter" ); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwViewControl, + "CShwViewControl test suite", + "UNIT" ) + +EUNIT_ALLOC_TEST( + "Constructor test", + "CShwViewControl", + "NewL", + "FUNCTIONALITY", + SetupL, TestNewlL, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 1", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL1L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 2", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL2L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 3", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL3L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 4", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL4L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 5", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL5L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 6", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL6L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 7", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL7L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 8", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL8L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 9", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL9L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 10", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL10L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 11", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL11L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 12", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL12L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 13", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL13L, Teardown ) + +EUNIT_ALLOC_TEST( + "NotifyL - path 14", + "CShwViewControl", + "NotifyL", + "FUNCTIONALITY", + SetupL, TestNotifyL14L, Teardown ) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwviewcontrol/t_cshwviewcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwviewcontrol/t_cshwviewcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* 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: Test for view control for the slideshow + * +*/ + + + + +#ifndef __T_CSHWVIEWCONTROL_H__ +#define __T_CSHWVIEWCONTROL_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shwviewcontrol.h" +#include "shweventqueue.h" + +#include "tmglxmedialist_stub.h" + +// FORWARD DECLARATIONS + +// CLASS DEFINITION +/** + * Unit tests for the view control + */ +NONSHARABLE_CLASS( T_CShwViewControl ) + : public CEUnitTestSuiteClass, + public MGlxMediaList_Stub_Observer, + public MShwEventQueue + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwViewControl* NewL(); + static T_CShwViewControl* NewLC(); + /** + * Destructor + */ + ~T_CShwViewControl(); + + private: // Constructors and destructors + + T_CShwViewControl(); + void ConstructL(); + + public: // from MGlxMediaList_Stub_Observer, MShwEventQueue + + void MGlxMediaList_MethodCalled( TMGlxMediaListMethodId aMethodId ); + void SendEventL( MShwEvent* aEvent ); + + private: // New methods + + void SetupL(); + void Teardown(); + void TestNewlL(); + void TestNotifyL1L(); + void TestNotifyL2L(); + void TestNotifyL3L(); + void TestNotifyL4L(); + void TestNotifyL5L(); + void TestNotifyL6L(); + void TestNotifyL7L(); + void TestNotifyL8L(); + void TestNotifyL9L(); + void TestNotifyL10L(); + void TestNotifyL11L(); + void TestNotifyL12L(); + void TestNotifyL13L(); + void TestNotifyL14L(); + + private: // Data + + CShwViewControl* iCShwViewControl; + + TMGlxMediaList_Stub* iStubMediaList; + + MShwEvent* iEvent; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWVIEWCONTROL_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwviewcontrol/t_cshwviewcontrol_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwviewcontrol/t_cshwviewcontrol_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* 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: Test for view control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "T_CShwViewControl.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwViewControl::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwzoomandpaneffect/t_cshwzoomandpaneffect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwzoomandpaneffect/t_cshwzoomandpaneffect.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1079 @@ +/* +* Copyright (c) 2007-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: Test for zoom and pan effect in slideshow + * +*/ + + + +// CLASS HEADER +#include "t_cshwzoomandpaneffect.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "shwzoomandpaneffect.h" +#include "shwzoomandpanlayout.h" +#include "shwcrossfadelayout.h" +#include "shwcurvefactory.h" +#include "shwconstants.h" +#include "shwautoptr.h" +#include "shwcallback.h" +#include "shwslideshowenginepanic.h" +#include "shwgeometryutilities.h" + +using namespace NShwSlideshow; + +// ----------------------------------------------------------------------------- +// Stub for NShwEngine::Panic --> +// ----------------------------------------------------------------------------- +TBool gNShwEnginePanicCalled = EFalse; +namespace NShwEngine + { + extern void Panic( TShwEnginePanic aPanic ) + { + gNShwEnginePanicCalled = ETrue; + // in test situation just do a leave + User::Leave( aPanic ); + } + } +// ----------------------------------------------------------------------------- +// <-- Stub for NShwEngine::Panic +// ----------------------------------------------------------------------------- + +// LOCAL HELPERs +namespace + { + /** + * @param aSource the TReal32 to round + * @return a rounded TInt + */ + inline TInt TReal2TInt( TReal32 aSource ) + { + if( aSource < 0 ) + { + // just subst 0.5 and cast, -0.4 becomes -0.9 and typecast + // truncates it to 0, -0.6 becomes -1.1 and its truncated to -1 + return TInt( aSource - TReal32( 0.5 ) ); + } + else + { + // just add 0.5 and cast, 0.4 becomes 0.9 and typecast + // truncates it to 0, 0.6 becomes 1.1 and its truncated to 1 + return TInt( aSource + TReal32( 0.5 ) ); + } + } + } + +class CTestControl : public CHuiControl + { + public: + static CTestControl* NewL( CHuiEnv& aEnv ) + { + return new (ELeave) CTestControl( aEnv ); + } + CTestControl( CHuiEnv& aEnv ) + : CHuiControl( aEnv ) + { + } + }; + +// CONSTRUCTION +T_CShwZoomAndPanEffect* T_CShwZoomAndPanEffect::NewL() + { + T_CShwZoomAndPanEffect* self = T_CShwZoomAndPanEffect::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CShwZoomAndPanEffect* T_CShwZoomAndPanEffect::NewLC() + { + T_CShwZoomAndPanEffect* self = new( ELeave ) T_CShwZoomAndPanEffect(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CShwZoomAndPanEffect::~T_CShwZoomAndPanEffect() + { + } + +// Default constructor +T_CShwZoomAndPanEffect::T_CShwZoomAndPanEffect() + { + } + +// Second phase construct +void T_CShwZoomAndPanEffect::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS +// global constant for screensize +const TInt gScreenWidth = 100; +const TInt gScreenHeight = 100; +const TRect gScreenRect( 0, 0, gScreenWidth, gScreenHeight ); +void T_CShwZoomAndPanEffect::Empty() + { + } + +void T_CShwZoomAndPanEffect::SetupL() + { + // create env + iEnv = CHuiEnv::NewL(); + + // create Display + iCoeDisplay = CHuiDisplayCoeControl::NewL( *iEnv, gScreenRect ); + + // create control + iControl = CTestControl::NewL( *iEnv ); + + // create the visual, ownership goes to iControl + iVisual = CHuiImageVisual::AddNewL( *iControl ); + + // create class under test + CShwZoomAndPanEffect* tmp = CShwZoomAndPanEffect::NewLC(); + // take ownership + iCShwZoomAndPanEffect = tmp; + // remove the pointer from cleanup stack + CleanupStack::Pop( tmp ); + } + +void T_CShwZoomAndPanEffect::Teardown() + { + // delete class under test + delete iCShwZoomAndPanEffect; + iCShwZoomAndPanEffect = NULL; + + // delete control, it also deletes the visual + delete iControl; + iControl = NULL; + + // delete display + delete iCoeDisplay; + iCoeDisplay = NULL; + + // delete environment + delete iEnv; + iEnv = NULL; + } + +void T_CShwZoomAndPanEffect::T_TestGeometryAlgorithmsL() + { + // use the namespace for coord utilities + using namespace NShwGeometryUtilities; + + // test FitDimension + // fit width with same values + { + TInt width = 10; + TInt height = 10; + FitDimension( width, height, 10 ); + EUNIT_ASSERT_EQUALS_DESC( 10, width, "width is same" ); + EUNIT_ASSERT_EQUALS_DESC( 10, height, "height is same" ); + } + // fit width with width greater + { + TInt width = 20; + TInt height = 10; + FitDimension( width, height, 10 ); + EUNIT_ASSERT_EQUALS_DESC( 20, width, "width is same" ); + EUNIT_ASSERT_EQUALS_DESC( 10, height, "height is same" ); + } + // fit width with new height greater + { + TInt width = 20; + TInt height = 10; + FitDimension( width, height, 20 ); + EUNIT_ASSERT_EQUALS_DESC( 40, width, "width increased" ); + EUNIT_ASSERT_EQUALS_DESC( 20, height, "height increased" ); + } + // fit width with new height smaller + { + TInt width = 22; + TInt height = 11; + FitDimension( width, height, 5 ); + EUNIT_ASSERT_EQUALS_DESC( 10, width, "width decreased" ); + EUNIT_ASSERT_EQUALS_DESC( 5, height, "height decreased" ); + } + + // fit height with same values + { + TInt width = 99; + TInt height = 88; + FitDimension( height, width, 99 ); + EUNIT_ASSERT_EQUALS_DESC( 99, width, "width is same" ); + EUNIT_ASSERT_EQUALS_DESC( 88, height, "height is same" ); + } + // fit height with width greater + { + TInt width = 22; + TInt height = 11; + FitDimension( height, width, 22 ); + EUNIT_ASSERT_EQUALS_DESC( 22, width, "width is same" ); + EUNIT_ASSERT_EQUALS_DESC( 11, height, "height is same" ); + } + // fit height with new width greater + { + TInt width = 22; + TInt height = 11; + FitDimension( height, width, 33 ); + EUNIT_ASSERT_EQUALS_DESC( 33, width, "width increased" ); + EUNIT_ASSERT_EQUALS_DESC( 16, height, "height increased" ); + } + // fit height with new width smaller + { + TInt width = 99; + TInt height = 88; + FitDimension( height, width, 88 ); + EUNIT_ASSERT_EQUALS_DESC( 88, width, "width increased" ); + EUNIT_ASSERT_EQUALS_DESC( 78, height, "height increased" ); + } + + // test FitInsideBox + // fit with same width and height + { + TInt width = 99; + TInt height = 99; + FitInsideBox( width, height, 99, 99 ); + EUNIT_ASSERT_EQUALS_DESC( 99, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 99, height, "height is same as box" ); + } + // fit with smaller width and height + { + TInt width = 99; + TInt height = 99; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 99, width, "width did not change" ); + EUNIT_ASSERT_EQUALS_DESC( 99, height, "height did not change" ); + } + // fit with greater width and height + { + TInt width = 111; + TInt height = 111; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 100, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + // fit with greater and width closer to box + { + TInt width = 150; + TInt height = 200; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 75, width, "width is smaller" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + // fit with greater and height closer to box + { + TInt width = 150; + TInt height = 100; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 100, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 66, height, "height is smaller" ); + } + // fit with smaller and width closer to box + { + TInt width = 75; + TInt height = 40; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 75, width, "width did not change" ); + EUNIT_ASSERT_EQUALS_DESC( 40, height, "height did not change" ); + } + // fit with smaller and height closer to box + { + TInt width = 60; + TInt height = 90; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 60, width, "width did not change" ); + EUNIT_ASSERT_EQUALS_DESC( 90, height, "height did not change" ); + } + // fit with width greater and height smaller to box + { + TInt width = 110; + TInt height = 90; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 100, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 81, height, "height is smaller" ); + } + // fit with height greater and width smaller to box + { + TInt width = 90; + TInt height = 120; + FitInsideBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 90*100/120, width, "width is smaller" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + + // test FitToCoverBox + // fit with same width and height + { + TInt width = 99; + TInt height = 99; + FitToCoverBox( width, height, 99, 99 ); + EUNIT_ASSERT_EQUALS_DESC( 99, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 99, height, "height is same as box" ); + } + // fit with smaller width and height + { + TInt width = 99; + TInt height = 99; + FitToCoverBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 100, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + // fit with greater width and height + { + TInt width = 111; + TInt height = 111; + FitToCoverBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 100, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + // fit with greater and width closer to box + { + TInt width = 150; + TInt height = 200; + FitToCoverBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 100, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 133, height, "height is greater" ); + } + // fit with greater and height closer to box + { + TInt width = 150; + TInt height = 100; + FitToCoverBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 150, width, "width is greater than box" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + // fit with greater and height closer to box + { + TInt width = 300; + TInt height = 200; + FitToCoverBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 150, width, "width is greater than box" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + // fit with smaller and width closer to box + { + TInt width = 75; + TInt height = 40; + FitToCoverBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 187, width, "width is greater" ); + EUNIT_ASSERT_EQUALS_DESC( 100, height, "height is same as box" ); + } + // fit with smaller and height closer to box + { + TInt width = 60; + TInt height = 90; + FitToCoverBox( width, height, 100, 100 ); + EUNIT_ASSERT_EQUALS_DESC( 100, width, "width is same as box" ); + EUNIT_ASSERT_EQUALS_DESC( 150, height, "height is greater" ); + } + } + +void T_CShwZoomAndPanEffect::T_LayoutTestL() + { +// test zoom and pan + // create the layout + TEUnitFillMem< TShwZoomAndPanLayout > layout; + + // check that layout has correct init values + // need to upcast to get access to public functions + MGlxLayout& base = static_cast< MGlxLayout& >( layout ); + TGlxLayoutInfoResetter info; + info.iPosition.iX = -1; + info.iPosition.iY = -1; + info.iSize.iX = -1; + info.iSize.iY = -1; + + base.SetLayoutValues( info ); + // verify that the position was not set + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iX,"x position not changed" ); + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iY,"y position not changed" ); + // check size + EUNIT_ASSERT_NOT_EQUALS_DESC( + -1, (TInt)info.iSize.iX,"x size changed" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + -1, (TInt)info.iSize.iY,"y size changed" ); + + // set custom screen size and image size; image smaller than screen + layout.SetSizes( TSize( 99, 88 ), TSize( 44, 55 ), TSize( 500, 500 ) ); + // redo layout + base.SetLayoutValues( info ); + // verify that the position was not set + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iX,"x position not changed" ); + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iY,"y position not changed" ); + // check size + EUNIT_ASSERT_EQUALS_DESC( 99, TReal2TInt( info.iSize.iX ),"x size changed" ); + EUNIT_ASSERT_EQUALS_DESC( 124, TReal2TInt( info.iSize.iY ),"y size changed" ); + + // set custom screen size and image size; image larger than screen + layout.SetSizes( TSize( 99, 88 ), TSize( 144, 155 ), TSize( 500, 500 ) ); + // redo layout + base.SetLayoutValues( info ); + // verify that the position was not set + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iX,"x position not changed" ); + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iY,"y position not changed" ); + // check size + EUNIT_ASSERT_EQUALS_DESC( 99, TReal2TInt( info.iSize.iX ),"x size changed" ); + EUNIT_ASSERT_EQUALS_DESC( 107, TReal2TInt( info.iSize.iY ),"y size changed" ); + + // set custom screen size and image size; image partially larger than screen + layout.SetSizes( TSize( 99, 88 ), TSize( 100, 15 ), TSize( 500, 500 ) ); + // redo layout + base.SetLayoutValues( info ); + // verify that the position was not set + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iX,"x position not changed" ); + EUNIT_ASSERT_EQUALS_DESC( -1, (TInt)info.iPosition.iY,"y position not changed" ); + // check size + EUNIT_ASSERT_EQUALS_DESC( 587, TReal2TInt( info.iSize.iX ),"x size changed" ); + EUNIT_ASSERT_EQUALS_DESC( 88, TReal2TInt( info.iSize.iY ),"y size changed" ); + + // set big enough image so that it zooms + layout.SetSizes( TSize( 100, 100 ), TSize( 200, 150 ), TSize( 500, 500 ) ); + layout.StartZoom( TShwZoomAndPanLayout::EZoomIn, 0 ); + // redo layout + base.SetLayoutValues( info ); + // check that layout is changed + EUNIT_ASSERT_DESC( layout.Changed(), "layout is changed" ); + // clear changeflag + layout.ClearChanged(); + EUNIT_ASSERT_DESC( !layout.Changed(), "layout is not changed" ); + +// test crossfade + // create the crossfade layout + TEUnitFillMem< TShwCrossFadeLayout > cflayout; + // get base class pointer + MGlxLayout& base2 = static_cast< MGlxLayout& >( cflayout ); + // reset info opacity + info.iOpacity = -1; + // run the layout + base2.SetLayoutValues( info ); + // verify that opacity was set to minimum + EUNIT_ASSERT_EQUALS_DESC( + TInt( KMinOpacity ), TReal2TInt( info.iOpacity ),"opacity is minimum" ); + // check that layout is not changed + EUNIT_ASSERT_DESC( !cflayout.Changed(), "layout is not changed" ); + // set new value + cflayout.Set( 2.0, 0 ); + // reset info opacity + info.iOpacity = -1; + // run the layout + base2.SetLayoutValues( info ); + // check that layout is changed + EUNIT_ASSERT_DESC( cflayout.Changed(), "layout is changed" ); + // verify that opacity was set to maximum + EUNIT_ASSERT_EQUALS_DESC( + TInt( KMaxOpacity ), TReal2TInt( info.iOpacity ),"opacity is maximum" ); + // clear change flag + cflayout.ClearChanged(); + EUNIT_ASSERT_DESC( !cflayout.Changed(), "layout is not changed" ); + } + +void T_CShwZoomAndPanEffect::T_CurveTestL() + { + // create env, no need to delete or cleanupstack + TShwAutoPtr< CHuiEnv > env = CHuiEnv::NewL(); + + // create curve path with 200 length + TShwAutoPtr< CHuiCurvePath > ellipsis = + NShwCurveFactory::CreateEllipsisL( TSize( 100, 200 ), 200 ); + + // the ellipsis is clockwise around the box + // check ellipsis values, point 0 + TReal32 x_value = ellipsis->MapValue( 0, 0 ); + TReal32 y_value = ellipsis->MapValue( 0, 1 ); + EUNIT_ASSERT_EQUALS_DESC( 50, TReal2TInt( x_value ), "x coordinate"); + EUNIT_ASSERT_EQUALS_DESC( 0, TReal2TInt( y_value ), "y coordinate"); + + // point 50 + x_value = ellipsis->MapValue( 50, 0 ); + y_value = ellipsis->MapValue( 50, 1 ); + EUNIT_ASSERT_EQUALS_DESC( 0, TReal2TInt( x_value ), "x coordinate"); + EUNIT_ASSERT_EQUALS_DESC( 100, TReal2TInt( y_value ), "y coordinate"); + + // point 100 + x_value = ellipsis->MapValue( 100, 0 ); + y_value = ellipsis->MapValue( 100, 1 ); + EUNIT_ASSERT_EQUALS_DESC( -50, TReal2TInt( x_value ), "x coordinate"); + EUNIT_ASSERT_EQUALS_DESC( 0, TReal2TInt( y_value ), "y coordinate"); + + // point 150 + x_value = ellipsis->MapValue( 150, 0 ); + y_value = ellipsis->MapValue( 150, 1 ); + EUNIT_ASSERT_EQUALS_DESC( 0, TReal2TInt( x_value ), "x coordinate"); + EUNIT_ASSERT_EQUALS_DESC( -100, TReal2TInt( y_value ), "y coordinate"); + + // point 200 + x_value = ellipsis->MapValue( 200, 0 ); + y_value = ellipsis->MapValue( 200, 1 ); + EUNIT_ASSERT_EQUALS_DESC( 50, TReal2TInt( x_value ), "x coordinate"); + EUNIT_ASSERT_EQUALS_DESC( 0, TReal2TInt( y_value ), "y coordinate"); + } + +void T_CShwZoomAndPanEffect::T_ZoomAndPanTestL() + { + // create env, no need to delete or cleanupstack + TShwAutoPtr< CHuiEnv > env = CHuiEnv::NewL(); + + // size of screen + const TInt screenX = 320; + const TInt screenY = 200; + TSize screen( screenX, screenY ); + // size of image, smaller than screen x KMaxZoomAndPanFactor + // but larger than screen + const TInt originalImageX = ( screenX + screenX * KMaxZoomAndPanFactor ) / 2; + const TInt originalImageY = ( screenY + screenY * KMaxZoomAndPanFactor ) / 2; + TSize image( originalImageX, originalImageY ); + // create curve path with 100 length + TShwAutoPtr< CHuiCurvePath > ellipsis = + NShwCurveFactory::CreateEllipsisL( screen, 100 ); + + // create the layout + TEUnitFillMem< TShwZoomAndPanLayout > layout; + // set screen and image size and maximum size + layout.SetSizes( screen, image, + TSize( screenX * KMaxZoomAndPanFactor, screenY * KMaxZoomAndPanFactor ) ); + // set the panning curve + layout.SetPanningCurve( &ellipsis ); + + // check that layout has correct init values + // need to upcast to get access to public functions + MGlxLayout& base = static_cast< MGlxLayout& >( layout ); + TGlxLayoutInfoResetter info; + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + // run the layout + base.SetLayoutValues( info ); + // verify that the position was set properly, the initial size is minimum + // so pan gets scaled to 0 + TInt initialXonCurve = 160; + TInt initialYonCurve = 0; + EUNIT_ASSERT_EQUALS_DESC( + 0, TReal2TInt( info.iPosition.iX ),"x position set" ); + EUNIT_ASSERT_EQUALS_DESC( + 0, TReal2TInt( info.iPosition.iY ),"y position set" ); + // verify size + EUNIT_ASSERT_EQUALS_DESC( + screenX, TReal2TInt( info.iSize.iX ),"default x size is screen size" ); + EUNIT_ASSERT_EQUALS_DESC( + screenY, TReal2TInt( info.iSize.iY ),"default y size is screen size" ); + + // do zoom in in 1 second + layout.StartZoom( TShwZoomAndPanLayout::EZoomIn, 1 ); + + // create timer to give us callback + TShwAutoPtr< CPeriodic > timer = CPeriodic::NewL( CActive::EPriorityStandard ); + // wait for 1.5 seconds (to be sure the zoom completes) + timer->Start( + 1.5 * 1000000, + 1.5 * 1000000, + TShwCallBack< T_CShwZoomAndPanEffect, CancelAsyncL >( this ) ); + // start async wait + iAsyncWait.Start(); + + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + // run the layout + base.SetLayoutValues( info ); + // verify that the position was set; zoom in does one half of the curve + EUNIT_ASSERT_EQUALS_DESC( + -initialXonCurve, TReal2TInt( info.iPosition.iX ),"x position looped on the opposite side" ); + EUNIT_ASSERT_EQUALS_DESC( + initialYonCurve, TReal2TInt( info.iPosition.iY ),"y position looped back" ); + // verify size, after zoom in we are in 4x screen size + EUNIT_ASSERT_GREATER_DESC( + TReal2TInt( info.iSize.iX ), originalImageX,"x size is greater than original size" ); + EUNIT_ASSERT_GREATER_DESC( + TReal2TInt( info.iSize.iY ), originalImageY,"y size is greater than original size" ); + + // perform zoom out in one second + layout.StartZoom( TShwZoomAndPanLayout::EZoomOut, 1 ); + // cancel old timer + timer->Cancel(); + // wait for 1.5 seconds (to be sure the zoom completes) + timer->Start( + 1.5 * 1000000, + 1.5 * 1000000, + TShwCallBack< T_CShwZoomAndPanEffect, CancelAsyncL >( this ) ); + // start async wait + iAsyncWait.Start(); + + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + // run the layout + base.SetLayoutValues( info ); + // verify that the position was set to zero again as in minimum size the pan is 0 + EUNIT_ASSERT_EQUALS_DESC( + 0, TReal2TInt( info.iPosition.iX ), "x position looped " ); + EUNIT_ASSERT_EQUALS_DESC( + 0, TReal2TInt( info.iPosition.iY ), "y position looped back" ); + // verify size, after zoom in we are in 100% size + EUNIT_ASSERT_EQUALS_DESC( + screenX, TReal2TInt( info.iSize.iX ),"x size is back to minimum" ); + EUNIT_ASSERT_EQUALS_DESC( + screenY, TReal2TInt( info.iSize.iY ),"y size is back to minimum" ); + } + +void T_CShwZoomAndPanEffect::T_PauseTestL() + { + // display size is define by gScreenRect + // give the HUI env to the effect and the size + TSize screenSize = gScreenRect.Size(); + iCShwZoomAndPanEffect->InitializeL( + iEnv, + NULL, + NULL, + screenSize ); + + // prepare view with a max size image + TSize imageSize( screenSize.iWidth * KMaxThumbnailSize, screenSize.iHeight * KMaxThumbnailSize ); + TSize thumbSize = iCShwZoomAndPanEffect->PrepareViewL( iVisual, imageSize ); + // check thumbnail size + EUNIT_ASSERT_EQUALS_DESC( + imageSize.iHeight, thumbSize.iHeight, "thumbnail is image size" ); + EUNIT_ASSERT_EQUALS_DESC( + imageSize.iWidth, thumbSize.iWidth, "thumbnail is image size" ); + + // then enter view, fade in should last 250 millliseconds and view 500 + // get the layout chain + MGlxLayout* layout = + iCShwZoomAndPanEffect->EnterViewL( iVisual, 500, 250 ); + // get the initial layout values + TGlxLayoutInfoResetter info; + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + + // next pause the effect + iCShwZoomAndPanEffect->PauseL(); + // create timer to give us callback + TShwAutoPtr< CPeriodic > timer = CPeriodic::NewL( CActive::EPriorityStandard ); + // start asynch wait for 1.5 second + timer->Start( + 1.5 * 1000000, + 1.5 * 1000000, + TShwCallBack< T_CShwZoomAndPanEffect, CancelAsyncL >( this ) ); + // start async wait + iAsyncWait.Start(); + // cancel the timer + timer->Cancel(); + + // now verify that the layout chain is in same situation + // get new layout values + TGlxLayoutInfoResetter info2; + // reset info2 + info2.iPosition.iX = -1;info2.iPosition.iY = -1; + info2.iSize.iX = -1; info2.iSize.iY = -1; + info2.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info2 ); + // check that no changes + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info.iOpacity ), TReal2TInt( info2.iOpacity ), "opacity" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info.iPosition.iX ), TReal2TInt( info2.iPosition.iX ), "position x" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info.iPosition.iY ), TReal2TInt( info2.iPosition.iY ), "position y" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info.iSize.iX ), TReal2TInt( info2.iSize.iX ), "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info.iSize.iY ), TReal2TInt( info2.iSize.iY ), "size y" ); + + // resume the effect + iCShwZoomAndPanEffect->Resume(); + + // start timer for 1.5 seconds + timer->Start( + 1.5 * 1000000, + 1.5 * 1000000, + TShwCallBack< T_CShwZoomAndPanEffect, CancelAsyncL >( this ) ); + // start async wait + iAsyncWait.Start(); + // cancel the timer + timer->Cancel(); + + // now verify that the layout chain did change + // reset info2 + info2.iPosition.iX = -1;info2.iPosition.iY = -1; + info2.iSize.iX = -1; info2.iSize.iY = -1; + info2.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info2 ); + // check that values did not change + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iOpacity ), TReal2TInt( info2.iOpacity ), "opacity" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iSize.iX ), TReal2TInt( info2.iSize.iX ), "size x" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iSize.iY ), TReal2TInt( info2.iSize.iY ), "size y" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iPosition.iX ), TReal2TInt( info2.iPosition.iX ), "position x" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iPosition.iY ), TReal2TInt( info2.iPosition.iY ), "position y" ); + + // enter view again, fade in should last 250 millliseconds and view 500 + // get the layout chain + layout = iCShwZoomAndPanEffect->EnterViewL( iVisual, 500, 250 ); + // get the initial layout values + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // start timer for .1 seconds, to make sure opacity does not run too fast + timer->Start( + 0.1 * 1000000, + 0.1 * 1000000, + TShwCallBack< T_CShwZoomAndPanEffect, CancelAsyncL >( this ) ); + // start async wait + iAsyncWait.Start(); + // cancel the timer + timer->Cancel(); + + // reset info2 + info2.iPosition.iX = -1;info2.iPosition.iY = -1; + info2.iSize.iX = -1; info2.iSize.iY = -1; + info2.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info2 ); + // check that size and opacity changed, multiply with 10 to remove rounding errors + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iOpacity * 10 ), TReal2TInt( info2.iOpacity * 10 ), "opacity" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iSize.iX ), TReal2TInt( info2.iSize.iX ), "size x" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info.iSize.iY ), TReal2TInt( info2.iSize.iY ), "size y" ); + + // pause the effect + iCShwZoomAndPanEffect->PauseL(); + // run the layout to get values + layout->SetLayoutValues( info2 ); + // start timer for 1.0 seconds + timer->Start( + 1.0 * 1000000, + 1.0 * 1000000, + TShwCallBack< T_CShwZoomAndPanEffect, CancelAsyncL >( this ) ); + // start async wait + iAsyncWait.Start(); + // cancel the timer + timer->Cancel(); + TGlxLayoutInfoResetter info3; + // reset info3 + info3.iPosition.iX = -1;info3.iPosition.iY = -1; + info3.iSize.iX = -1; info3.iSize.iY = -1; + info3.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info3 ); + // check that no changes between info2 and info3, multiply opacity to remove rounding error + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info2.iOpacity * 10 ), TReal2TInt( info3.iOpacity * 10 ), "opacity" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info2.iSize.iX ), TReal2TInt( info3.iSize.iX ), "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info2.iSize.iY ), TReal2TInt( info3.iSize.iY ), "size y" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info2.iPosition.iX ), TReal2TInt( info3.iPosition.iX ), "position x" ); + EUNIT_ASSERT_EQUALS_DESC( + TReal2TInt( info2.iPosition.iY ), TReal2TInt( info3.iPosition.iY ), "position y" ); + + // now do the resume + iCShwZoomAndPanEffect->Resume(); + // start timer for 1.0 seconds + timer->Start( + 1.0 * 1000000, + 1.0 * 1000000, + TShwCallBack< T_CShwZoomAndPanEffect, CancelAsyncL >( this ) ); + // start async wait + iAsyncWait.Start(); + // cancel the timer + timer->Cancel(); + + // reset info3 + info3.iPosition.iX = -1;info3.iPosition.iY = -1; + info3.iSize.iX = -1; info3.iSize.iY = -1; + info3.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info3 ); + // check that values did change between info2 and info3, multiply opacity to remove rounding error + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info2.iOpacity * 10 ), TReal2TInt( info3.iOpacity * 10 ), "opacity" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info2.iSize.iX ), TReal2TInt( info3.iSize.iX ), "size x" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info2.iSize.iY ), TReal2TInt( info3.iSize.iY ), "size y" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info2.iPosition.iX ), TReal2TInt( info3.iPosition.iX ), "position x" ); + EUNIT_ASSERT_NOT_EQUALS_DESC( + TReal2TInt( info2.iPosition.iY ), TReal2TInt( info3.iPosition.iY ), "position y" ); + } + +void T_CShwZoomAndPanEffect::T_TestBoundariesL() + { + // get the screen size + TSize screenSize = gScreenRect.Size(); + // calculate the maximum width and height + TInt maximumImageWidth = screenSize.iWidth * KMaxThumbnailSize; + TInt maximumImageHeight = screenSize.iHeight * KMaxThumbnailSize; + + // display size is define by gScreenRect + // give the HUI env to the effect and the size + iCShwZoomAndPanEffect->InitializeL( + iEnv, + NULL, + NULL, + screenSize ); + + // prepare view with image twice as wide but half the height of maximum + TSize imageSize( + maximumImageWidth * 2, + maximumImageHeight / 2 ); + TSize thumbSize = iCShwZoomAndPanEffect->PrepareViewL( iVisual, imageSize ); + // check the thumbnail size + // note that the thumbnail may be wider than higher than the maximage but the area + // is the same + EUNIT_ASSERT_EQUALS_DESC( + maximumImageWidth * 2, thumbSize.iWidth, "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + maximumImageHeight / 2, thumbSize.iHeight, "size y" ); + + // then enter view, fade in should last 0 millliseconds and view 0 so that the new values + // are immediate + // get the layout chain + MGlxLayout* layout = + iCShwZoomAndPanEffect->EnterViewL( iVisual, 0, 0 ); + // get the initial layout values + TGlxLayoutInfoResetter info; + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // check that image width is maximum screen width times two and height is + // original by two (as original was twice as wide as fitted) + // note that the thumbnail may be wider than higher than the maximage but the area + // is the same + EUNIT_ASSERT_EQUALS_DESC( + maximumImageWidth * 2, TReal2TInt( info.iSize.iX ), "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + maximumImageHeight / 2, TReal2TInt( info.iSize.iY ), "size y" ); + + // prepare view with image max wide but twice the height of maximum + imageSize.SetSize( maximumImageWidth, maximumImageHeight * 2 ); + iCShwZoomAndPanEffect->PrepareViewL( iVisual, imageSize ); + // then enter view, fade in should last 0 millliseconds and view 0 so that the new values + // are immediate + // get the layout chain + layout = iCShwZoomAndPanEffect->EnterViewL( iVisual, 0, 0 ); + // get the initial layout values + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // check that image area is same as maximum image area + // note that the thumbnail may be wider than higher than the maximage but the area + // is the same + EUNIT_ASSERT_EQUALS_DESC( + maximumImageWidth * maximumImageHeight, + TReal2TInt( info.iSize.iX * info.iSize.iY ), "size x" ); + + // test image partially smaller than screen, should not zoom + // prepare view with image quarter of the screen wide but four times the height of screen + imageSize.SetSize( gScreenWidth / 4, gScreenHeight * 4 ); + iCShwZoomAndPanEffect->PrepareViewL( iVisual, imageSize ); + // then enter view, fade in should last 0 millliseconds and view 0 so that the new values + // are immediate + // get the layout chain + layout = iCShwZoomAndPanEffect->EnterViewL( iVisual, 0, 0 ); + // get the initial layout values + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // check that image size is the maximum screen width and height multiplied by 16 + EUNIT_ASSERT_EQUALS_DESC( + gScreenWidth, TReal2TInt( info.iSize.iX ), "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + gScreenHeight * 4 * 4, TReal2TInt( info.iSize.iY ), "size y" ); + + // test image partially smaller than screen, should zoom + // prepare view with image half of the screen wide but three times the height of screen + imageSize.SetSize( gScreenWidth - 10, gScreenHeight * 2 ); + iCShwZoomAndPanEffect->PrepareViewL( iVisual, imageSize ); + // then enter view, fade in should last 0 millliseconds and view 0 so that the new values + // are immediate + // get the layout chain + layout = iCShwZoomAndPanEffect->EnterViewL( iVisual, 0, 0 ); + // get the initial layout values + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // check image area, should be same as max size + EUNIT_ASSERT_EQUALS_DESC( + maximumImageWidth * maximumImageHeight, + TReal2TInt( info.iSize.iX * info.iSize.iY ), "size x" ); + + // test image that is screen size, should not zoom + // prepare view with image + imageSize.SetSize( gScreenWidth, gScreenHeight ); + iCShwZoomAndPanEffect->PrepareViewL( iVisual, imageSize ); + // then enter view, fade in should last 0 millliseconds and view 0 so that the new values + // are immediate + // get the layout chain + layout = iCShwZoomAndPanEffect->EnterViewL( iVisual, 0, 0 ); + // get the initial layout values + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // check that image size is screen size + EUNIT_ASSERT_EQUALS_DESC( + gScreenWidth, TReal2TInt( info.iSize.iX ), "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + gScreenHeight, TReal2TInt( info.iSize.iY ), "size y" ); + + // test image partially larger than screen, should zoom + // prepare view + imageSize.SetSize( gScreenWidth * 1.5, gScreenHeight * 1.5 ); + iCShwZoomAndPanEffect->PrepareViewL( iVisual, imageSize ); + // then enter view, fade in should last 0 millliseconds and view 0 so that the new values + // are immediate + // get the layout chain + layout = iCShwZoomAndPanEffect->EnterViewL( iVisual, 0, 0 ); + // get the initial layout values + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // check that image size is the screen multiplied by max zoom + EUNIT_ASSERT_EQUALS_DESC( + TInt(gScreenWidth * KMaxZoomAndPanFactor), TReal2TInt( info.iSize.iX ), "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + TInt(gScreenHeight * KMaxZoomAndPanFactor), TReal2TInt( info.iSize.iY ), "size y" ); + + // enter transition to increase the counter, duration zero + // ignore layout chain + iCShwZoomAndPanEffect->EnterTransitionL( iVisual, 0 ); + // enter the same effect again, this time we do zoom out (max to min size) + // get the layout chain + layout = iCShwZoomAndPanEffect->EnterViewL( iVisual, 0, 0 ); + // reset info + info.iPosition.iX = -1;info.iPosition.iY = -1; + info.iSize.iX = -1; info.iSize.iY = -1; + info.iOpacity = -1; + // run the layout to get values + layout->SetLayoutValues( info ); + // check that image size is the screen multiplied by max zoom + EUNIT_ASSERT_EQUALS_DESC( + gScreenWidth, TReal2TInt( info.iSize.iX ), "size x" ); + EUNIT_ASSERT_EQUALS_DESC( + gScreenHeight, TReal2TInt( info.iSize.iY ), "size y" ); + } + +TInt T_CShwZoomAndPanEffect::CancelAsyncL() + { + // stop async wait + iAsyncWait.AsyncStop(); + // return KErrNone to stop the timer + return KErrNone; + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CShwZoomAndPanEffect, + "Test suite for CShwZoomAndPanEffect and Layout", + "UNIT" ) + +EUNIT_TEST( + "Geometry utilities test", + "NShwGeometryUtilities", + "FitDimension,FitInsideBox,FitToCoverBox", + "FUNCTIONALITY", + Empty, T_TestGeometryAlgorithmsL, Empty ) + +EUNIT_TEST( + "Layout test", + "TShwZoomAndPanLayout", + "TShwZoomAndPanLayout", + "FUNCTIONALITY", + Empty, T_LayoutTestL, Empty ) + +EUNIT_TEST( + "Curve test", + "ShwCurveFactory", + "CreateEllipsisL", + "FUNCTIONALITY", + Empty, T_CurveTestL, Empty ) + +EUNIT_TEST( + "Zoom and pan test", + "TShwZoomAndPanLayout", + "DoSetLayoutValues", + "FUNCTIONALITY", + Empty, T_ZoomAndPanTestL, Empty ) + +EUNIT_TEST( + "Pause Zoom and pan", + "CShwZoomAndPanEffect", + "PauseL, Resume", + "FUNCTIONALITY", + SetupL, T_PauseTestL, Teardown ) + +EUNIT_TEST( + "Test boundaries", + "CShwZoomAndPanEffect", + "PrepareViewL", + "FUNCTIONALITY", + SetupL, T_TestBoundariesL, Teardown ) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwzoomandpaneffect/t_cshwzoomandpaneffect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwzoomandpaneffect/t_cshwzoomandpaneffect.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007-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: Test for zoom and pan effect in slideshow + * +*/ + + + + +#ifndef __T_CSHWZOOMANDPANEFFECT_H__ +#define __T_CSHWZOOMANDPANEFFECT_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS +class CHuiEnv; +class CHuiDisplayCoeControl; +class CHuiControl; +class CHuiImageVisual; +class CShwZoomAndPanEffect; + +// CLASS DEFINITION +/** + * EUnit test suite for Zoom and pan related classes + */ +NONSHARABLE_CLASS( T_CShwZoomAndPanEffect ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CShwZoomAndPanEffect* NewL(); + static T_CShwZoomAndPanEffect* NewLC(); + /** + * Destructor + */ + ~T_CShwZoomAndPanEffect(); + + // helper + TInt CancelAsyncL(); + + private: // Constructors and destructors + + T_CShwZoomAndPanEffect(); + void ConstructL(); + + private: // New methods + + void Empty(); + void SetupL(); + void Teardown(); + void T_LayoutTestL(); + void T_CurveTestL(); + void T_ZoomAndPanTestL(); + void T_PauseTestL(); + void T_TestGeometryAlgorithmsL(); + void T_TestBoundariesL(); + + private: // Data + + /// Own: HUI environment + CHuiEnv* iEnv; + + /// Own: HUI display + CHuiDisplayCoeControl* iCoeDisplay; + + /// Own: HUI control + CHuiControl* iControl; + + /// Own: HUI visual + CHuiImageVisual* iVisual; + + /// Own: asynch wait + CActiveSchedulerWait iAsyncWait; + + /// Own: class under test + CShwZoomAndPanEffect* iCShwZoomAndPanEffect; + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CSHWZOOMANDPANEFFECT_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/engine/tsrc/t_cshwzoomandpaneffect/t_cshwzoomandpaneffect_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/engine/tsrc/t_cshwzoomandpaneffect/t_cshwzoomandpaneffect_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007-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: Test for zoom and pan effect in slideshow + * +*/ + + + + +// CLASS HEADER +#include "t_cshwzoomandpaneffect.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CShwZoomAndPanEffect::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow build file + * +*/ + + + + +#include +// rom file +PRJ_EXPORTS +../rom/shwslideshow.iby CORE_APP_LAYER_IBY_EXPORT_PATH(shwslideshow.iby) +../rom/shwslideshow_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(shwslideshow_resources.iby) + + +// include the slideshow engine build +#include "../engine/group/bld.inf" + +// include the slideshow view plugin +#include "../view/group/bld.inf" + +// include the slideshow settings dialog plugin +#include "../settingsdialog/group/bld.inf" + + +PRJ_TESTMMPFILES + +#ifdef WINSCW +// on WINSCW copy the test DLLs to sys/bin +gnumakefile shw_move_tests_to_sys_bin.mk support +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/group/buildall.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/group/buildall.cmd Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: build commands. +rem + +call bldmake bldfiles + +REM build sources +call abld build winscw udeb +call abld build armv5 urel + +REM build tests +call abld test build winscw udeb +call abld test build armv5 urel diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/group/profile_with_ctc.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/group/profile_with_ctc.txt Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,17 @@ + +make sure that this is set: +CTC_COMPILER_DIR=C:\APPS\cw\Symbian_Tools\Command_Line_Tools + +// normal command line + +call ctc-abld-winscw -C "EXCLUDE+*\test\*\" -i d -- test build winscw udeb + +// for our tests sometimes this is required +call ctc-abld-winscw -C "EXCLUDE+*\test\*\" -C "EXCLUDE+shwcallback.h" -n test -i d -- test build winscw udeb +// and sometimes this is required next +call ctc-abld-winscw -C "EXCLUDE+*\test\*\" -C "EXCLUDE+shweffectcontrol.h" -n test -i d -- test build winscw udeb +// and sometimes this after that +call ctc-abld-winscw -C "EXCLUDE+*\test\*\" -no-templates -n test -i d -- test build winscw udeb + +// get the results +ctcpost test.dat test.sym | ctc2html diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/group/shw_move_tests_to_sys_bin.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/group/shw_move_tests_to_sys_bin.mk Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +# +# 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: Makefile +# + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : do_nothing + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : do_nothing + +FINAL : + echo Copying slideshow engine test DLLs to z\sys\bin + copy %epocroot%epoc32\release\winscw\udeb\t_cshw*.dll %epocroot%epoc32\release\winscw\udeb\z\sys\bin\ /y diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/rom/shwslideshow.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/rom/shwslideshow.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007-2008 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: (ROM) Image description file for Slideshow +* +*/ + + + + +#ifndef SHW_IBY +#define SHW_IBY + +data = \epoc32\data\Z\private\10202be9\200071d3.txt private\10202be9\200071d3.txt + +file=ABI_DIR\BUILD_DIR\shwslideshowengine.dll SHARED_LIB_DIR\shwslideshowengine.dll + +ECOM_PLUGIN( shwslideshowviewplugin.dll, shwslideshowviewplugin.rsc ) +ECOM_PLUGIN( shwsettingsplugin.dll, shwsettingsplugin.rsc ) + +#endif // SHW_IBY diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/rom/shwslideshow_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/rom/shwslideshow_resources.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2007-2008 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: (ROM) Image description file for Slideshow +* +*/ + + + + +#ifndef SHW_RESOURCES_IBY +#define SHW_RESOURCES_IBY + +data = \epoc32\data\Z\resource\apps\shwslideshowengine.rsc resource\apps\shwslideshowengine.rsc +data = \epoc32\data\Z\resource\apps\shwslideshowview.rsc resource\apps\shwslideshowview.rsc +data = \epoc32\data\Z\resource\apps\shwsettingsdialog.rsc resource\apps\shwsettingsdialog.rsc + +#endif // SHW_RESOURCES_IBY diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/data/shwsettingsdialog.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/data/shwsettingsdialog.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,532 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME SHWD + + +// EXTERNAL INCLUDES +#include +#include // for text_not_allowed, qtn_options_change +#include +#include +#include + +// INTERNAL INCLUDES +#include "shwslideshowsettings.hrh" // for control ids +#include // for localised strings +#include "shwconstants.hrh" // for constants + +// RESOURCE DEFINITIONS +RESOURCE RSS_SIGNATURE { } +RESOURCE TBUF {buf="SHWD";} + + +// ----------------------------------------------------------------------------- +// Slideshow settings track not exist note text +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_shw_qtn_lgal_note_slideshow_define + { buf = qtn_lgal_note_slideshow_track; } + +// ----------------------------------------------------------------------------- +// Slideshow settings track not defined note text +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_shw_qtn_lgal_note_track_define + { buf = qtn_lgal_note_track_define; } + +// ----------------------------------------------------------------------------- +// Select track (slideshow) fetcher label text string +// ----------------------------------------------------------------------------- +RESOURCE LBUF r_shw_qtn_popup_select_track + { txt = qtn_lgal_popup_select_track; } + + +// ----------------------------------------------------------------------------- +// Slideshow settings: empty text for music track +// ----------------------------------------------------------------------------- +RESOURCE LBUF r_shw_slideshow_settings_track_none + { txt = qtn_lgal_slideshow_settings_track_none; } + +// ----------------------------------------------------------------------------- +// Slideshow general settings title pane text +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_shw_settingslist_title_pane_txt + { buf = qtn_lgal_view_slideshow_settings_title_general; } + +// ----------------------------------------------------------------------------- +// Slideshow DRM error text +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_shw_settingslist_drm_txt + { buf = qtn_lgal_note_slideshow_drm; } + +//----------------------------------------------------------------------------- +// Slideshow no DRM meta data exist for file message text +//----------------------------------------------------------------------------- +RESOURCE TBUF r_shw_not_allowed_txt + { buf = text_not_allowed; } + +// ----------------------------------------------------------------------------- +// Slideshow settings dialog +// ----------------------------------------------------------------------------- +RESOURCE DIALOG r_shw_settings_dlg + { + buttons = r_shw_softkeys_options_change_back; + flags = EEikDialogFlagWait | EEikDialogFlagNoDrag + | EEikDialogFlagCbaButtons | EEikDialogFlagFillAppClientRect; + items = + { + DLG_LINE + { + type = EShwCtSettingListBox; + id = EShwControlIdSettingList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = AVKON_SETTING_ITEM_LIST + { + items = + { + AVKON_SETTING_ITEM + { + identifier = EPlayDirectionItem; + setting_page_resource = r_shw_settingslist_play_direction_setting_page; + name = qtn_lgal_slideshow_settings_order; + associated_resource = r_shw_settingslist_play_direction_popup_setting_texts; + }, + AVKON_SETTING_ITEM + { + identifier = EMusicEnabledItem; + setting_page_resource = r_shw_settingslist_music_setting_page; + name = qtn_lgal_slideshow_settings_music; + associated_resource = r_shw_settingslist_music_popup_setting_texts; + }, + AVKON_SETTING_ITEM + { + identifier = EFileNamePathItem; + setting_page_resource = r_shw_settingslist_filename_setting_page; + name = qtn_lgal_slideshow_settings_track; + empty_item_text = qtn_lgal_slideshow_settings_track_none; + }, + AVKON_SETTING_ITEM + { + identifier = ETransDelayItem; + setting_page_resource = r_shw_settingslist_delay_setting_page; + name = qtn_lgal_slideshow_settings_delay_slides; + }, + AVKON_SETTING_ITEM + { + identifier = ETransEffectItem; + setting_page_resource = r_shw_settingslist_effect_setting_page; + name = qtn_lgal_slideshow_settings_transition; + associated_resource = r_shw_settingslist_effect_popup_setting_texts; + }, + AVKON_SETTING_ITEM + { + identifier = ETransEffectListItem; + setting_page_resource = r_shw_settingslist_effect_setting_page; + name = qtn_lgal_slideshow_settings_transition; + associated_resource = r_shw_settingslist_effect_popup_setting_texts; + } + }; + }; + } + }; + } + + + +// -------------------------------------------------------------------------- +// SoftKey buttonos (Options [left] - Change [middle] - Back [right]) +// -------------------------------------------------------------------------- +// +RESOURCE CBA r_shw_softkeys_options_change_back + { + flags = 0; + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EAknSoftkeyChange; + txt= qtn_options_change; + } + }; + } + +// ----------------------------------------------------------------------------- +// Slideshow music settings page +// ----------------------------------------------------------------------------- +RESOURCE AVKON_SETTING_PAGE r_shw_settingslist_music_setting_page + { + label = qtn_lgal_slideshow_settings_music; + type = EAknCtPopupSettingList; + editor_resource_id = r_shw_settingslist_music_popup_setting_list; + } + +// ----------------------------------------------------------------------------- +// Slideshow play direction settings page +// ----------------------------------------------------------------------------- +RESOURCE AVKON_SETTING_PAGE r_shw_settingslist_play_direction_setting_page + { + label = qtn_lgal_slideshow_settings_play_direction; + type = EAknCtPopupSettingList; + editor_resource_id = r_shw_settingslist_play_direction_popup_setting_list; + } +// ----------------------------------------------------------------------------- +// Slideshow settings music editor resource +// ----------------------------------------------------------------------------- +RESOURCE POPUP_SETTING_LIST r_shw_settingslist_music_popup_setting_list + { + } +// ----------------------------------------------------------------------------- +// Slideshow settings play direction editor resource +// ----------------------------------------------------------------------------- +RESOURCE POPUP_SETTING_LIST r_shw_settingslist_play_direction_popup_setting_list + { + } +// ----------------------------------------------------------------------------- +// Slideshow settings music popup setting texts +// ----------------------------------------------------------------------------- +RESOURCE AVKON_POPUP_SETTING_TEXTS r_shw_settingslist_music_popup_setting_texts + { + setting_texts_resource = r_shw_settingslist_music_texts; + popped_up_texts_resource = r_shw_settingslist_music_popup_texts; + } +// ----------------------------------------------------------------------------- +// Slideshow settings play direction popup setting texts +// ----------------------------------------------------------------------------- +RESOURCE AVKON_POPUP_SETTING_TEXTS r_shw_settingslist_play_direction_popup_setting_texts + { + setting_texts_resource = r_shw_settingslist_play_direction_texts; + popped_up_texts_resource = r_shw_settingslist_play_direction_popup_texts; + } + +// ----------------------------------------------------------------------------- +// Slideshow settings music popup setting texts resource +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_music_texts + { + items = + { + AVKON_ENUMERATED_TEXT + { + value = 1; + text = qtn_lgal_slideshow_settings_music_on; + }, + AVKON_ENUMERATED_TEXT + { + value = 0; + text = qtn_lgal_slideshow_settings_music_off; + } + }; + } + +// ----------------------------------------------------------------------------- +// Slideshow music enabled page setting texts +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_music_popup_texts + { + items = + { + LBUF + { + txt = qtn_lgal_slideshow_settings_music_on; + }, + LBUF + { + txt = qtn_lgal_slideshow_settings_music_off; + } + }; + } +// ----------------------------------------------------------------------------- +// Slideshow settings play direction popup setting texts resource +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_play_direction_texts + { + items = + { + AVKON_ENUMERATED_TEXT + { + value = 1; + text = qtn_lgal_slideshow_settings_older_to_newer; + }, + AVKON_ENUMERATED_TEXT + { + value = 0; + text = qtn_lgal_slideshow_settings_newer_to_older; + } + }; + } + +// ----------------------------------------------------------------------------- +// Slideshow play direction enabled page setting texts +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_play_direction_popup_texts + { + items = + { + LBUF + { + txt = qtn_lgal_slideshow_settings_older_to_newer; + }, + LBUF + { + txt = qtn_lgal_slideshow_settings_newer_to_older; + } + }; + } +// ----------------------------------------------------------------------------- +// Slideshow settings music filename setting page +// ----------------------------------------------------------------------------- +RESOURCE AVKON_SETTING_PAGE r_shw_settingslist_filename_setting_page + { + label = qtn_lgal_slideshow_settings_track; + type = EEikCtEdwin; + editor_resource_id = r_shw_editor; + } + + +// ----------------------------------------------------------------------------- +// Slideshow music settings filename/filepath text editor +// ----------------------------------------------------------------------------- +RESOURCE EDWIN r_shw_editor + { + flags=0; + } + +// ----------------------------------------------------------------------------- +// Slideshow settings transition setting page +// ----------------------------------------------------------------------------- +RESOURCE AVKON_SETTING_PAGE r_shw_settingslist_transition_setting_page + { + label = qtn_lgal_slideshow_settings_transition; + type = EAknCtPopupSettingList; + editor_resource_id = r_shw_settingslist_transition_popup_setting_list; + } + + +// ----------------------------------------------------------------------------- +// Slideshow settings transition editor resource +// ----------------------------------------------------------------------------- +RESOURCE POPUP_SETTING_LIST r_shw_settingslist_transition_popup_setting_list + { + } + + + +// ----------------------------------------------------------------------------- +// Slideshow settings transition delay setting page +// ----------------------------------------------------------------------------- +RESOURCE AVKON_SETTING_PAGE r_shw_settingslist_delay_setting_page + { + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL; + label = qtn_lgal_slideshow_settings_delay_slides; + type = EAknCtSlider; + editor_resource_id = r_shw_settingslist_delay_slider; + } + + +// --------------------------------------------------------------------------- +// Delay transition slider. +// --------------------------------------------------------------------------- +RESOURCE SLIDER r_shw_settingslist_delay_slider + { + layout = EAknSettingsItemSliderLayout; + minvalue = KMinTransDelay; + maxvalue = KMaxTransDelay; + step = KTransDelayStep; + valuetype = EAknSliderValueNone; + minlabel = qtn_lgal_slideshow_settings_delay_slow; + maxlabel = qtn_lgal_slideshow_settings_delay_fast; + } + + + +// ----------------------------------------------------------------------------- +// Slideshow settings transition delay popup setting texts +// ----------------------------------------------------------------------------- +RESOURCE AVKON_POPUP_SETTING_TEXTS r_shw_settingslist_delay_popup_setting_texts + { + setting_texts_resource = r_shw_settingslist_delay_texts; + popped_up_texts_resource = r_shw_settingslist_delay_popup_texts; + } + + +// ----------------------------------------------------------------------------- +// Slideshow settings transition delay popup setting texts resource +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_delay_texts + { + } + +// ----------------------------------------------------------------------------- +// Slideshow settings transition delay setting page setting texts +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_delay_popup_texts + { + } + +// ----------------------------------------------------------------------------- +// Slideshow settings effects page +// ----------------------------------------------------------------------------- +RESOURCE AVKON_SETTING_PAGE r_shw_settingslist_effect_setting_page + { + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL; + label = qtn_lgal_slideshow_settings_transition; + type = EAknCtPopupSettingList; + editor_resource_id = r_shw_settingslist_effect_popup_setting_list; + } + +// ----------------------------------------------------------------------------- +// Slideshow settings effect resource +// ----------------------------------------------------------------------------- +RESOURCE POPUP_SETTING_LIST r_shw_settingslist_effect_popup_setting_list + { + } + +// ----------------------------------------------------------------------------- +// Slideshow music settings effect popup setting texts +// ----------------------------------------------------------------------------- +RESOURCE AVKON_POPUP_SETTING_TEXTS r_shw_settingslist_effect_popup_setting_texts + { + setting_texts_resource = r_shw_settingslist_effect_texts; + popped_up_texts_resource = r_swh_settingslist_effect_popup_texts; + } + +// ----------------------------------------------------------------------------- +// Slideshow settings effect popup setting texts resource +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_effect_texts + { + items = + { + }; + } + + +// ----------------------------------------------------------------------------- +// Slideshow settings effect setting page setting texts +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_swh_settingslist_effect_popup_texts + { + items = + { + LBUF + { + txt = qtn_lgal_slideshow_settings_music_on; + }, + LBUF + { + txt = qtn_lgal_slideshow_settings_music_off; + } + }; + } + +// ----------------------------------------------------------------------------- +// Slideshow music settings effect setting page setting texts +// ----------------------------------------------------------------------------- +RESOURCE ARRAY r_shw_settingslist_effect_popup_texts + { + items = + { + LBUF + { + txt = qtn_lgal_slideshow_settings_kenburns_on; + }, + LBUF + { + txt = qtn_lgal_slideshow_settings_kenburns_off; + } + }; + } + + + + +// ----------------------------------------------------------------------------- +// Slideshow settings dialog menu bar +// ----------------------------------------------------------------------------- +RESOURCE MENU_BAR r_shw_settingslist_menu_bar + { + titles= + { + MENU_TITLE + { + txt = ""; // the text is not used in Series 60 + menu_pane = r_shw_settingslist_menu_pane; + } + }; + } + +// ----------------------------------------------------------------------------- +// Slideshow music settings dialog menu pane +// ----------------------------------------------------------------------------- +RESOURCE MENU_PANE r_shw_settingslist_menu_pane + { + items = + { + MENU_ITEM + { + command = EShwCmdSettingsChange; + txt = qtn_options_change; + }, + MENU_ITEM + { + command = EShwCmdHelp; + txt = qtn_options_help; + }, + MENU_ITEM + { + command = EShwCmdExit; + txt = qtn_options_exit; + } + }; + } + + + +// ----------------------------------------------------------------------------- +// Slideshow confirmation query. +// ----------------------------------------------------------------------------- +RESOURCE DIALOG r_shw_confirmation_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EAknCtQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/data/shwsettingsplugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/data/shwsettingsplugin.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007-2008 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: Resource definitions for project photos +* +*/ + + + + + +// INCLUDES +#include +#include +#include +#include + + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// ?resource_name +// ?description +// +// ----------------------------------------------------------------------------- + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KShwSettingsDlgDllUid; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXViewPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KShwSettingsDlgImplementationUid; + version_no = 1; + display_name = "Slideshow Settings"; + default_data = ""; + opaque_data = "*.ts;.tp" + ""EMPXCollectionPluginGallery""; + } + }; + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow view plugin build information + * +*/ + + + + +#include + +PRJ_PLATFORMS +WINSCW ARMV5 + +PRJ_EXPORTS + + +PRJ_MMPFILES +shwsettingsdialog.mmp + +PRJ_TESTMMPFILES +// removed for the time beeing as not functional +//../tsrc/group/t_cshwslideshowsettingsdialog.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/group/shwsettingsdialog.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/group/shwsettingsdialog.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + + + +#include +#include +#include + +#include "../../../group/glxbuildcommon.mmh" +#include "../../../inc/glxcapabilities.hrh" +#include "../../../inc/glxalfhelper.mmh" + +#include "../../../../photos_plat/slideshow_ui_constants_api/inc/shwslideshowsettingsplugin_UID.hrh" //for KShwSettingsDlgDllUid + +TARGET shwsettingsplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D KShwSettingsDlgDllUid + + +CAPABILITY GLX_CAPABILITIES + +SOURCEPATH ../src +SOURCE shwslideshowsettingsplugin.cpp +SOURCE shwslideshowsettingslist.cpp +SOURCE shwslideshowsettingsdialog.cpp +SOURCE shwslideshowsettingspluginproxy.cpp + + +// settings dialog +START RESOURCE ../data/shwsettingsdialog.rss +HEADER +TARGETPATH resource/apps +LANGUAGE_IDS +END + +// settings dialog ecom plugin +START RESOURCE ../data/shwsettingsplugin.rss +TARGET shwsettingsplugin.rsc +END // RESOURCE + + +USERINCLUDE ../inc +USERINCLUDE ../src +USERINCLUDE ../../engine/inc // for constants +USERINCLUDE ../../utils // for Debug Utility + +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../viewframework/uiutilities/inc // for CGlxHuiUtility +SYSTEMINCLUDE ../../../common/inc // for CGlxResourceUtilities + + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../gallery/loc + + +// Project Libraries +LIBRARY shwslideshowengine.lib // for CShwSettingsModel +LIBRARY glxcommon.lib // for CResourceUtilities + +// System Libraries +LIBRARY euser.lib + +// UI Libraries +LIBRARY cone.lib // for ConeUtils +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib // for MEikMenuObserver +LIBRARY eikdlg.lib // for CEikDialog +LIBRARY avkon.lib // for CAknDialog +LIBRARY mpxviewplugin.lib // for CMPXAknDialogPlugin + +// Other Framework Libraries +LIBRARY hlplch.lib // for HlpLauncher +LIBRARY bafl.lib // for array & file system utilities +LIBRARY commonengine.lib // for StringLoader +LIBRARY mgfetch.lib // for MGFetch +LIBRARY centralrepository.lib // for Central Repository + +LIBRARY ecom.lib +LIBRARY caf.lib // for OMA DRM CAF Agent API +LIBRARY efsrv.lib // for TParse + + + +//EXPORTUNFROZEN + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/inc/shwslideshowsettings.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/inc/shwslideshowsettings.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + + +#ifndef __SHWSETTINGS_HRH__ +#define __SHWSETTINGS_HRH__ + +#include // for KAknCtLastControlId + + + +#define EShwControlIdSettingList KAknCtLastControlId + 1 +#define EShwCtSettingListBox KAknCtLastControlId + 2 + +#define EPlayDirectionItem 0 +#define EMusicEnabledItem 1 +#define EFileNamePathItem 2 +#define ETransDelayItem 3 +#define ETransEffectItem 4 +#define ETransEffectListItem 5 + + +#define EShwCmdSettingsChange 0x6000 +#define EShwCmdHelp 0x6001 +#define EShwCmdExit 0x6002 + + + +#endif // __SHWSETTINGS_HRH__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsdialog.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Slideshow Settings Dialog +* +*/ + + + + +// CLASS HEADER +#include "shwslideshowsettingsdialog.h" + +// EXTERNAL INCLUDES +#include // for HlpLauncher +#include // for CEikDialog +#include // for CAknAppUi +#include // for CAknTitlePane +#include // for StringLoader +#include // for BaflUtils +#include // for KDC_APP_RESOURCE_DIR +#include // for ConeUitls +#include // for Navi-scroll key events +#include + +// INTERNAL INCLUDES +#include +#include +#include // For Panics +#include +#include // for CGlxResourceUtilities +#include "shwslideshowsettings.hrh" +#include "shwslideshowengine.h" // for CShwSlideshowEngine +#include "shwslideshowsettings.hrh" // for Command Ids and Control Ids +#include "shwsettingsmodel.h" // for CShwSettingsModel +#include "shwslideshowsettingslist.h" // for CShwSlideshowSettingsList + +#define GetAppUi() (dynamic_cast(iEikonEnv->EikAppUi())) +//CONSTANTS +namespace + { + // uid and id from doc/help_parameters_for_photos.xls + const TInt KShwHelpUID = 0x2000A778; + _LIT( KSHW_HLP_SLIDESHOW_SETTINGS, "LGAL_HLP_SLIDESHOW_SETTINGS" ); + } + +//----------------------------------------------------------------------------- +// C++ default constructor. +//----------------------------------------------------------------------------- +inline CShwSlideshowSettingsDialog::CShwSlideshowSettingsDialog() + { + // No implementation required + } + +//----------------------------------------------------------------------------- +// Two-phased constructor. +//----------------------------------------------------------------------------- +CShwSlideshowSettingsDialog* CShwSlideshowSettingsDialog::NewL() + { + TRACER("CShwSlideshowSettingsDialog::NewL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::NewL"); + CShwSlideshowSettingsDialog* self=new(ELeave)CShwSlideshowSettingsDialog(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +CShwSlideshowSettingsDialog::~CShwSlideshowSettingsDialog() + { + TRACER("CShwSlideshowSettingsDialog::~CShwSlideshowSettingsDialog"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::~CShwSlideshowSettingsDialog"); + + // Draw the toolbar + SetSlShwToolbarVisibility(ETrue); + + delete iShwSettings; + // Delete resource file + if (iResourceOffset) + { + iEikonEnv->DeleteResourceFile( iResourceOffset ); + iResourceOffset = NULL; + } + // If the status pane was enabled , set it to not visbible. + // used in FS view + if (iStatusPaneChanged) + { + iStatusPane->MakeVisible(EFalse); + } + if (iPreviousTitle) + { + delete iPreviousTitle; + } + } + +//----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +//----------------------------------------------------------------------------- +void CShwSlideshowSettingsDialog::ConstructL() + { + TRACER("CShwSlideshowSettingsDialog::ConstructL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::ConstructL"); + + // hide toolbar. + SetSlShwToolbarVisibility(EFalse); + iStatusPaneChanged = EFalse; + iStatusPane = GetAppUi()->StatusPane(); + iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + // If Status pane not visible, then make it visible. + // Set the status pane flag as True, to be used in destructor, if + // status pane is made visible. + // This is used in Fullscreen. + if(!iStatusPane->IsVisible()) + { + iStatusPane->MakeVisible(ETrue); + iStatusPaneChanged = ETrue; + } + // Load the dialog resource file + _LIT(KShwSettingDlgResource,"shwsettingsdialog.rsc"); + TFileName resourceFile(KDC_APP_RESOURCE_DIR); + resourceFile.Append(KShwSettingDlgResource); + CGlxResourceUtilities::GetResourceFilenameL( resourceFile ); + iResourceOffset = iCoeEnv->AddResourceFileL( resourceFile ); + + iShwSettings = CShwSettingsModel::NewL(); + + // CAknDialog takes the menu resource as constructor parameter + CAknDialog::ConstructL( R_SHW_SETTINGSLIST_MENU_BAR ); + + // set the title to the dialog, Note that avkon dialogs do not support + // setting the title in the status pane so we need to do it the hard way + // get status pane + SetTitleL(); + } + +// --------------------------------------------------------------------------- +// SetSlShwToolbarVisibility() +// --------------------------------------------------------------------------- +void CShwSlideshowSettingsDialog::SetSlShwToolbarVisibility(TBool aVisible) + { + TRACER("CShwSlideshowSettingsDialog::SetSlShwToolbarVisibility"); + CAknAppUi* appUi = GetAppUi(); + __ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer)); + CAknToolbar* popupToolbar = appUi->PopupToolbar(); + if(popupToolbar) + { + popupToolbar->SetToolbarVisibility( !aVisible ); + popupToolbar->MakeVisible( !aVisible ); + if(!aVisible) + { + popupToolbar->DrawNow(); + } + } + + CAknToolbar* toolbar = appUi->CurrentFixedToolbar(); + if(toolbar) + { + toolbar->SetToolbarVisibility(aVisible); + toolbar->MakeVisible( aVisible ); + } + + CAknToolbar* currentPopupToolbar = appUi->CurrentPopupToolbar(); + if(currentPopupToolbar) + { + currentPopupToolbar->SetToolbarVisibility(aVisible); + currentPopupToolbar->MakeVisible( aVisible ); + } + } + +// --------------------------------------------------------------------------- +// SetTitleL() +// --------------------------------------------------------------------------- +void CShwSlideshowSettingsDialog::SetTitleL() + { + TRACER("CShwSlideshowSettingsDialog::SetTitleL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::SetTitleL"); + // Stores the previous Title + iPreviousTitle = iTitlePane->Text()->AllocL(); + HBufC* aTitleText = StringLoader::LoadLC( + R_SHW_SETTINGSLIST_TITLE_PANE_TXT, iEikonEnv ); + + iTitlePane->SetTextL( *aTitleText ); + CleanupStack::PopAndDestroy( aTitleText ); + } + +// ----------------------------------------------------------------------------- +// SetPreviousTitleL - Restores back the previous title, used in Slideshow Settings only +// ----------------------------------------------------------------------------- +// +void CShwSlideshowSettingsDialog::SetPreviousTitleL() + { + TRACER("CShwSlideshowSettingsDialog::SetPreviousTitleL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::SetPreviousTitleL"); + // Restore the Title back of the Calling View + iTitlePane->SetTextL( *iPreviousTitle ); + } + +//----------------------------------------------------------------------------- +// CShwSlideshowSettingsDialog::ProcessCommandL +//----------------------------------------------------------------------------- +void CShwSlideshowSettingsDialog::ProcessCommandL(TInt aCommandId) + { + TRACER("CShwSlideshowSettingsDialog::ProcessCommandL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::ProcessCommandL"); + switch (aCommandId) + { + case EShwCmdSettingsChange: + { + CAknDialog::ProcessCommandL(aCommandId); + iItemList->UpdateListBoxL(iItemList->ListBox()->CurrentItemIndex()); + break; + } + case EShwCmdHelp: + { + TCoeHelpContext helpContext; + helpContext.iMajor = TUid::Uid( KShwHelpUID ); + helpContext.iContext.Copy( KSHW_HLP_SLIDESHOW_SETTINGS ); + + const TInt KListSz = 1; + CArrayFix* contextList = + new (ELeave) CArrayFixFlat( KListSz ); + CleanupStack::PushL(contextList); + contextList->AppendL(helpContext); + + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), contextList ); + CleanupStack::Pop( contextList ); + break; + } + case EShwCmdExit: + { + TryExitL(EShwCmdExit); + break; + } + default: + { + CAknDialog::ProcessCommandL(aCommandId); + break; + } + }; + } + + +//----------------------------------------------------------------------------- +// CShwSlideshowSettingsDialog::CreateCustomControlL +//----------------------------------------------------------------------------- +SEikControlInfo CShwSlideshowSettingsDialog::CreateCustomControlL(TInt + aControlType) + { + TRACER("CShwSlideshowSettingsDialog::CreateCustomControlL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::CreateCustomControlL"); + // create control info, no flags or trailer text set + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + + if (aControlType == EShwCtSettingListBox) + { + iItemList = CShwSlideShowSettingsList::NewL(*iShwSettings); + controlInfo.iControl = iItemList; // giving ownership + } + return controlInfo; // returns ownership of ItemList + } + +//----------------------------------------------------------------------------- +// CShwSlideshowSettingsDialog::OkToExitL +//----------------------------------------------------------------------------- +TBool CShwSlideshowSettingsDialog::OkToExitL(TInt aKeycode) + { + TRACER("CShwSlideshowSettingsDialog::OkToExitL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::OkToExitL"); + TBool retVal = EFalse; + switch (aKeycode) + { + case EAknSoftkeyChange: + { + iItemList->UpdateListBoxL(iItemList->ListBox()->CurrentItemIndex(), ETrue); + break; + } + case EAknSoftkeyOptions: // display menu only + { + DisplayMenuL(); + break; + } + case EAknSoftkeyBack: // exit dialog + case EEikCmdExit: + case EAknCmdExit: + case EShwCmdExit: + { + SetPreviousTitleL(); + retVal = ETrue; + break; + } + } + return retVal; + } + +//----------------------------------------------------------------------------- +// CShwSlideshowSettingsDialog::SizeChanged +//----------------------------------------------------------------------------- +void CShwSlideshowSettingsDialog::SizeChanged() + { + TRACER("CShwSlideshowSettingsDialog::SizeChanged"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::SizeChanged"); + if(iItemList) + { + iItemList->ListBox()->SetRect(Rect()); + } + CAknDialog::SizeChanged(); + } + +//----------------------------------------------------------------------------- +// CShwSlideshowSettingsDialog::OfferKeyEventL +//----------------------------------------------------------------------------- +TKeyResponse CShwSlideshowSettingsDialog::OfferKeyEventL( + const TKeyEvent& aKeyEvent, TEventCode aType) + { + TRACER("CShwSlideshowSettingsDialog::OfferKeyEventL"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::OfferKeyEventL"); + // Fix for EEBD-79UL8Q - "No Naviscroll support in Slideshow settings + // options menu" + TKeyEvent localKeyEvent = aKeyEvent; + if ( aType == EEventKey ) + { + switch ( aKeyEvent.iCode ) + { + // Handle the previous and next navi-scroll events and modify the + // key code to the corresponding values used by the dialog + case EKeyPrevious: + localKeyEvent.iCode = EKeyUpArrow; + break; + case EKeyNext: + localKeyEvent.iCode = EKeyDownArrow; + break; + default: + // nothing to change + break; + } + } + + // pass the key event up to the parent to handle + return CAknDialog::OfferKeyEventL( localKeyEvent, aType ); + } +//----------------------------------------------------------------------------- +// CShwSlideshowSettingsDialog::FocusChanged +//----------------------------------------------------------------------------- +void CShwSlideshowSettingsDialog::FocusChanged(TDrawNow aDrawNow) + { + TRACER("CShwSlideshowSettingsDialog::FocusChanged"); + GLX_LOG_INFO("CShwSlideshowSettingsDialog::FocusChanged"); + // hide toolbar. + if(aDrawNow == EDrawNow ) + { + SetSlShwToolbarVisibility(EFalse); + } + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsdialog.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2007-2008 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: The slideshow settings dialog header file + * +*/ + + + + + +#ifndef SHWSLIDESHOWSETTINGSDLG_H +#define SHWSLIDESHOWSETTINGSDLG_H + +// EXTERNAL INCLUDES +#include // for CAknDialog + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CShwSlideShowSettingsList; +class CShwSettingsModel; +class CAknSettingItemArray; +class CEikStatusPane; +class CAknTitlePane; + +// CLASS DECLARATION + +/** + * Slideshow Setting Dialog allows the user adjust basic slide + * runtime settings + * class CShwSlideshowSettingsDialog + * @author Loughlin Spollen + * @internal reviewed 08/06/2007 by Kimmo Hoikka + */ + +NONSHARABLE_CLASS (CShwSlideshowSettingsDialog) : public CAknDialog + { + public: // Constructors and destructor + /** + * Two-phased constructor. + */ + static CShwSlideshowSettingsDialog* NewL(); + + /** + * Destructor. + */ + ~CShwSlideshowSettingsDialog(); + + private: + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CShwSlideshowSettingsDialog(); + + void SetTitleL(); + /** + * To Set the previous Title in the status pane , used in slideshow settings only + */ + void SetPreviousTitleL(); + void SetSlShwToolbarVisibility(TBool aVisible); + + public: // from MEikDialogPageObserver + /** + * @ref MEikDialogPageObserver::CreateCustomControlL + */ + SEikControlInfo CreateCustomControlL(TInt aControlType); + + public: // from CCoeControl + /** + * @ref CCoeControl::SizeChanged + */ + void SizeChanged(); + + /** + * @ref CCoeControl::OfferKeyEventL + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType); + /** + * @ref CCoeControl::FocusChanged + */ + void FocusChanged(TDrawNow aDrawNow); + + public: // from MEikCommandObserver + /** + * @ref MEikCommandObserver + */ + void ProcessCommandL(TInt aCommandId); + + protected: // Functions CEikDialog + /** + * @ref CEikDialog + */ + TBool OkToExitL(TInt aKeycode); + + + private: // Data + TInt iResourceOffset; + + // Not Owned: Akn control item list + CShwSlideShowSettingsList* iItemList; + + // Owned: Settings model + CShwSettingsModel* iShwSettings; + + // Status Pane instance + CEikStatusPane* iStatusPane; + // Title Pane instance + CAknTitlePane* iTitlePane; + + // Flag to be used at status pane enabling and disabling for FS view + TBool iStatusPaneChanged; + + // To Store the Previous Status Pane Title + HBufC* iPreviousTitle; + + }; + +#endif //SHWSLIDESHOWSETTINGSDLG_H diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/src/shwslideshowsettingslist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/src/shwslideshowsettingslist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1310 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Slideshow settings list implementation +* +*/ + + + + +//EXTERNAL INCLUDES +#include +#include +#include // for FeatureManager +#include +#include // for CAknInformationNote +#include // for CRepository +#include // for ConeUtils +#include // for KPlaybackRestrictedMimeTypes +#include // for ContentAccess::CContent +#include // for CRepository +#include // for querydialog + +#include +#include // for GLX_ASSERT_DEBUG +#include +#include +#include +#include + +//INTERNAL INCLUDES +#include +#include +#include "shwslideshowsettingslist.h" +#include "shwsettingsmodel.h" +#include "shwslideshowengine.h" +#include "shweffectinfo.h" +#include "shwslideshowsettings.hrh" +#include "shwconstants.h" +#include "shwconstants.hrh" + + _LIT(KResourceFile, "z:shwsettingsdialog.rsc"); + +// Add our own setting page +// EEBD-79UL8Q - "no naviscroll support in slideshow settings" +/** +* CShwSliderSettingPage +* CShwSliderSettingPage class for creating a slider setting page +*/ +NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwSliderSettingPage ) + : public CAknSliderSettingPage + { + public: + /** + * C++ Constructor. + * @param aSettingPageResourceId The setting page's resource ID + * @param aSliderValue The initial value of the slider + */ + CShwSliderSettingPage( TInt aSettingPageResourceId, TInt& aSliderValue ); + + /** + * C++ Constructor. + * @param aSettingTitleText The setting page's title + * @param aSettingNumber The setting page's number + * @param aControlType The setting page's control type + * @param aEditorResourceId The setting page's editor resource ID + * @param aSettingPageResourceId The setting page's resource ID + * @param aSliderValue The initial value of the slider + */ + CShwSliderSettingPage( const TDesC* aSettingTitleText, + TInt aSettingNumber, + TInt aControlType, + TInt aEditorResourceId, + TInt aSettingPageResourceId, + TInt& aSliderValue ); + /** + * Destructor. + */ + ~CShwSliderSettingPage(); + + public: // from CCoeControl + /** + * @ref CCoeControl::OfferKeyEventL + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + }; + +// Add our own setting item to fix +// EEBD-79UL8Q - "no naviscroll support in slideshow settings" +/** +* CShwSliderSettingItem +* CShwSliderSettingItem class for creating a slider setting item +*/ +NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwSliderSettingItem ) + : public CAknSliderSettingItem + { + public: + /** + * Default C++ Constructor. + * @param aIdentifier The resource ID + * @param aExternalSliderValue The initial value of the slider + */ + CShwSliderSettingItem( TInt aIdentifier, TInt& aExternalSliderValue ); + + /** + * Destructor. + */ + ~CShwSliderSettingItem(); + + protected: // from CAknSliderSettingItem + /** + * @ref CAknSliderSettingItem::CreateSettingPageL + */ + CAknSettingPage* CreateSettingPageL(); + }; + +/** +* CShwTransEffectEnumPopupSettingItem +* CShwTransEffectEnumPopupSettingItem class for creating a enum Popup SettingsItem +*/ +NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem ) + : public CAknEnumeratedTextPopupSettingItem + { + public: + + /** + * Default C++ Constructor. + * @param aIdentifier The resource ID + * @param aShwSettings The Slideshow settings model + * @param aEffects Array of Transition effects + */ + CShwTransEffectEnumPopupSettingItem(TInt aIdentifier, + CShwSettingsModel& aShwSettings, + RArray& aEffects); + /** + * Destructor. + */ + ~CShwTransEffectEnumPopupSettingItem(); + + /** + * Retrieve the currently selected transition effect + * @param [out] The selected effects ECOM Uid + * @param [out] The selected effects index within the ECOM library + */ + void SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex); + + public: // from CAknEnumeratedTextPopupSettingItem + + /** + * @ref CAknEnumeratedTextPopupSettingItem::LoadL + */ + void LoadL(); + + /** + * @ref CAknEnumeratedTextPopupSettingItem::StoreL + */ + void StoreL(); + + /** + * @ref CAknEnumeratedTextPopupSettingItem::CompleteConstructionL + */ + void CompleteConstructionL(); + + /** + * @ref CAknEnumeratedTextPopupSettingItem::ExternalValue + */ + inline TInt ExternalValue() + { + return CAknEnumeratedTextPopupSettingItem::ExternalValue(); + }; + + private: + + // Slideshow settings data + CShwSettingsModel& iShwSettings; + + // Array of Transition effects + RArray& iEffects; + + // The current index within the iEffects array + TInt iTransTypeIndex; + }; + + + + +/** +* CShwTransEffectBinaryPopupSettingItem +* CShwTransEffectBinaryPopupSettingItem class for creating a binary +* Popup SettingsItem +*/ +NONSHARABLE_CLASS( CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem ) + : public CAknBinaryPopupSettingItem + { + public: + + /** + * Default C++ Destructor. + * @param aIdentifier The resource ID + * @param aShwSettings The Slideshow settings model + * @param aEffects Array of Transition effects + */ + CShwTransEffectBinaryPopupSettingItem(TInt aIdentifier, + CShwSettingsModel& aShwSettings, + RArray& aEffects); + /** + * Destructor. + */ + ~CShwTransEffectBinaryPopupSettingItem(); + + /** + * Retrieve the currently selected transition effect + * @param [out] The selected effects ECOM Uid + * @param [out] The selected effects index within the ECOM library + */ + void SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex); + + public: // from CAknEnumeratedTextPopupSettingItem + + /** + * @ref CAknEnumeratedTextPopupSettingItem::LoadL + */ + void LoadL(); + + /** + * @ref CAknEnumeratedTextPopupSettingItem::StoreL + */ + void StoreL(); + + /** + * @ref CAknEnumeratedTextPopupSettingItem::CompleteConstructionL + */ + void CompleteConstructionL(); + + /** + * @ref CAknEnumeratedTextPopupSettingItem::SetExternalValue + */ + inline void SetExternalValue( TInt aNewValue ) + { + CAknBinaryPopupSettingItem::SetExternalValue( aNewValue ); + }; + + private: + + // Slideshow settings data + CShwSettingsModel& iShwSettings; + + // Array of Transition effects + RArray& iEffects; + + // The current index within the iEffects array + TInt iTransTypeIndex; + }; + + +//----------------------------------------------------------------------------- +// C++ constructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwSliderSettingPage + ::CShwSliderSettingPage( TInt aSettingPageResourceId, TInt& aSliderValue ) + : CAknSliderSettingPage( aSettingPageResourceId, aSliderValue ) + { + } + +//----------------------------------------------------------------------------- +// C++ constructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwSliderSettingPage + ::CShwSliderSettingPage( const TDesC* aSettingTitleText, + TInt aSettingNumber, + TInt aControlType, + TInt aEditorResourceId, + TInt aSettingPageResourceId, + TInt& aSliderValue ) + : CAknSliderSettingPage( aSettingTitleText, aSettingNumber, aControlType, + aEditorResourceId, aSettingPageResourceId, aSliderValue ) + { + } + +//----------------------------------------------------------------------------- +// C++ destructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwSliderSettingPage::~CShwSliderSettingPage() + { + } + +//----------------------------------------------------------------------------- +// CShwSliderSettingPage::OfferKeyEventL +//----------------------------------------------------------------------------- +TKeyResponse CShwSlideShowSettingsList::CShwSliderSettingPage:: + OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) + { + TRACER("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); + // Fix for EEBD-79UL8Q - "No Naviscroll support in Slideshow settings + // options menu" + TKeyEvent localKeyEvent = aKeyEvent; + if ( aType == EEventKey ) + { + switch ( aKeyEvent.iCode ) + { + // Handle the previous and next navi-scroll events and modify the + // key code to the corresponding values used by the dialog + case EKeyPrevious: + localKeyEvent.iCode = EKeyLeftArrow; + break; + case EKeyNext: + localKeyEvent.iCode = EKeyRightArrow; + break; + default: + // nothing to change + break; + } + } + + // pass the key event up to the parent to handle + return CAknSliderSettingPage::OfferKeyEventL( localKeyEvent, aType ); + } + + +//----------------------------------------------------------------------------- +// C++ default constructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwSliderSettingItem::CShwSliderSettingItem + ( TInt aIdentifier, TInt& aExternalSliderValue ) + : CAknSliderSettingItem( aIdentifier, aExternalSliderValue ) + { + } + +//----------------------------------------------------------------------------- +// C++ destructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwSliderSettingItem::~CShwSliderSettingItem() + { + } + +//----------------------------------------------------------------------------- +// CShwSliderSettingItem::CreateSettingPageL +//----------------------------------------------------------------------------- +CAknSettingPage* CShwSlideShowSettingsList::CShwSliderSettingItem:: + CreateSettingPageL() + { + TRACER("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::CShwSliderSettingPage::OfferKeyEventL"); + TPtrC text = SettingName(); + return new( ELeave ) CShwSlideShowSettingsList::CShwSliderSettingPage( + &text, SettingNumber(), EAknCtSlider, SettingEditorResourceId(), + SettingPageResourceId(), InternalSliderValue() ); + } + + +//----------------------------------------------------------------------------- +// C++ default constructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem + ::CShwTransEffectEnumPopupSettingItem( TInt aIdentifier, + CShwSettingsModel& aShwSettings, RArray& aEffects ) + : CAknEnumeratedTextPopupSettingItem(aIdentifier, iTransTypeIndex), + iShwSettings(aShwSettings), iEffects(aEffects) + { + } + +//----------------------------------------------------------------------------- +// C++ destructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem + ::~CShwTransEffectEnumPopupSettingItem() + { + } + + +//----------------------------------------------------------------------------- +// CShwTransEffectEnumPopupSettingItem::SelectedEffectL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem:: + SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex) + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::SelectedEffectL"); + GLX_LOG_INFO("CShwTransEffectEnumPopupSettingItem::SelectedEffectL"); + GLX_ASSERT_DEBUG( + ( 0 <= iTransTypeIndex )&&( iTransTypeIndex < iEffects.Count() ), + Panic( EGlxPanicIndexOutOfRange ), + "Slideshow effect index is out of range" ); + aEffectUid = iEffects[iTransTypeIndex].iId.iPluginUid; + aEffectIndex = iEffects[iTransTypeIndex].iId.iIndex; + } + + + +//----------------------------------------------------------------------------- +// CShwTransEffectEnumPopupSettingItem::CompleteConstructionL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem + ::CompleteConstructionL() + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::::CompleteConstructionL"); + GLX_LOG_INFO("CShwTransEffectEnumPopupSettingItem::CompleteConstructionL"); + CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); + + TUint max = iEffects.Count(); + + // Construct a new EnumeratedTextArray and an empty PopupText array + CArrayPtrFlat* enumeratedTextArray = + new (ELeave) CArrayPtrFlat(max); + CleanupStack::PushL(enumeratedTextArray); + + CArrayPtrFlat* poppedUpTextArray = + new (ELeave) CArrayPtrFlat(max); + CleanupStack::PushL(poppedUpTextArray); + + // transfers the ownership of the arrays + SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray); + HandleTextArrayUpdateL(); + CleanupStack::Pop(poppedUpTextArray); + CleanupStack::Pop(enumeratedTextArray); + } + + +//----------------------------------------------------------------------------- +// CShwTransEffectEnumPopupSettingItem::LoadL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::LoadL() + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::LoadL"); + GLX_LOG_INFO("CShwTransEffectEnumPopupSettingItem::LoadL"); + // Clear out old array contents + CArrayPtr* enumTxtArray = EnumeratedTextArray(); + enumTxtArray->ResetAndDestroy(); + + // Create new array of transition types + TUint max = iEffects.Count(); + CAknEnumeratedText* enumeratedTxt = NULL; + HBufC* transitionTxt = NULL; + + for (TInt ii = 0; ii < max; ++ii) + { + transitionTxt = iEffects[ii].iName.AllocLC(); + enumeratedTxt = new (ELeave) CAknEnumeratedText(ii, transitionTxt); + CleanupStack::Pop(transitionTxt); + CleanupStack::PushL(enumeratedTxt); + enumTxtArray->AppendL(enumeratedTxt); + CleanupStack::Pop(enumeratedTxt); + } + + // Get persisted default value + TUid effectUid = {0}; + TUint effectIndex = 0; + iTransTypeIndex = KErrNotFound; + iShwSettings.TransitionTypeL(effectUid, effectIndex); + + for (TInt ii = 0; ii < max; ++ii) + { + if (iEffects[ii].iId.iPluginUid == effectUid && + iEffects[ii].iId.iIndex == effectIndex) + { + iTransTypeIndex = ii; + continue; + } + } + + User::LeaveIfError(iTransTypeIndex); // should never be KErrNotFound + User::LeaveIfError(CAknEnumeratedTextSettingItem::IndexFromValue + (iTransTypeIndex)); + SetExternalValue(iTransTypeIndex); + CAknEnumeratedTextPopupSettingItem::LoadL(); + } + +//----------------------------------------------------------------------------- +// CShwTransEffectEnumPopupSettingItem::StoreL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::StoreL() + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::StoreL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::CShwTransEffectEnumPopupSettingItem::StoreL"); + CAknEnumeratedTextPopupSettingItem::StoreL(); + } + + + +//----------------------------------------------------------------------------- +// C++ default constructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem + ::CShwTransEffectBinaryPopupSettingItem(TInt aIdentifier, + CShwSettingsModel& aShwSettings, + RArray& aEffects) + : CAknBinaryPopupSettingItem(aIdentifier, iTransTypeIndex), + iShwSettings(aShwSettings), iEffects(aEffects) + { + } + +//----------------------------------------------------------------------------- +// C++ destructor +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem + ::~CShwTransEffectBinaryPopupSettingItem() + { + } + + + +//----------------------------------------------------------------------------- +// CShwTransEffectBinaryPopupSettingItem::SelectedEffectL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem:: + SelectedEffectL(TUid& aEffectUid, TUint& aEffectIndex) + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::SelectedEffectL"); + GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::SelectedEffectL"); + GLX_ASSERT_DEBUG( + ( 0 <= iTransTypeIndex )&&( iTransTypeIndex < iEffects.Count() ), + Panic( EGlxPanicIndexOutOfRange ), + "Slideshow effect index is out of range" ); + + aEffectUid = iEffects[iTransTypeIndex].iId.iPluginUid; + aEffectIndex = iEffects[iTransTypeIndex].iId.iIndex; + } + + + +//----------------------------------------------------------------------------- +// CShwTransEffectBinaryPopupSettingItem::CompleteConstructionL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem + ::CompleteConstructionL() + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::CompleteConstructionL"); + GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::CompleteConstructionL"); + + // Retrieve all available effects + TUint max = iEffects.Count(); + + // Construct a new EnumeratedTextArray and an empty PopupText array + CArrayPtrFlat* enumeratedTextArray = + new (ELeave) CArrayPtrFlat(max); + CleanupStack::PushL(enumeratedTextArray); + + CArrayPtrFlat* poppedUpTextArray = + new (ELeave) CArrayPtrFlat(max); + CleanupStack::PushL(poppedUpTextArray); + + // Transfers ownership + SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray); + HandleTextArrayUpdateL(); + CleanupStack::Pop(poppedUpTextArray); + CleanupStack::Pop(enumeratedTextArray); + } + + +//----------------------------------------------------------------------------- +// CShwTransEffectBinaryPopupSettingItem::LoadL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::LoadL() + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::LoadL"); + GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::LoadL"); + // Clear out old array contents + CArrayPtr* enumTxtArray = EnumeratedTextArray(); + enumTxtArray->ResetAndDestroy(); + + // Create new array of transition types + TUint max = iEffects.Count(); + CAknEnumeratedText* enumeratedTxt = NULL; + HBufC* transitionTxt = NULL; + + for (TInt ii = 0; ii < max; ++ii) + { + transitionTxt = iEffects[ii].iName.AllocLC(); + enumeratedTxt = new (ELeave) CAknEnumeratedText(ii, transitionTxt); + CleanupStack::Pop(transitionTxt); + CleanupStack::PushL(enumeratedTxt); + enumTxtArray->AppendL(enumeratedTxt); + CleanupStack::Pop(enumeratedTxt); + } + + // Get persisted default value + TUid effectUid = {0}; + TUint effectIndex = 0; + iTransTypeIndex = KErrNotFound; + iShwSettings.TransitionTypeL(effectUid, effectIndex); + + for (TInt ii = 0; ii < max; ++ii) + { + if (iEffects[ii].iId.iPluginUid == effectUid && + iEffects[ii].iId.iIndex == effectIndex) + { + iTransTypeIndex = ii; + continue; + } + } + + User::LeaveIfError(iTransTypeIndex); // should never be KErrNotFound + User::LeaveIfError(CAknEnumeratedTextSettingItem::IndexFromValue + (iTransTypeIndex)); + SetExternalValue(iTransTypeIndex); + + CAknBinaryPopupSettingItem::LoadL(); + } + +//----------------------------------------------------------------------------- +// CShwTransEffectBinaryPopupSettingItem::StoreL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::StoreL() + { + TRACER("CShwSlideShowSettingsList::CShwTransEffectBinaryPopupSettingItem::StoreL"); + GLX_LOG_INFO("CShwTransEffectBinaryPopupSettingItem::StoreL"); + CAknBinaryPopupSettingItem::StoreL(); + } + + +//----------------------------------------------------------------------------- +// CShwTransEffectEnumPopupSettingItem::NewL +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList* CShwSlideShowSettingsList::NewL(CShwSettingsModel& + aShwSettings) + { + TRACER("CShwSlideShowSettingsList::NewL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::NewL"); + CShwSlideShowSettingsList* self = new (ELeave) CShwSlideShowSettingsList + (aShwSettings); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + + +//----------------------------------------------------------------------------- +// destructor. +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::~CShwSlideShowSettingsList() + { + TRACER("CShwSlideShowSettingsList::~CShwSlideShowSettingsList"); + GLX_LOG_INFO("CShwSlideShowSettingsList::~CShwSlideShowSettingsList"); + delete iRepository; + iMusicNamePath.Close(); + iEffects.Close(); + } + +//----------------------------------------------------------------------------- +// C++ default constructor. +//----------------------------------------------------------------------------- +CShwSlideShowSettingsList::CShwSlideShowSettingsList( + CShwSettingsModel& aShwSettings ) + : iShwSettings( aShwSettings ) + { + TRACER("CShwSlideShowSettingsList::CShwSlideShowSettingsList"); + GLX_LOG_INFO("CShwSlideShowSettingsList::CShwSlideShowSettingsList"); + } + +//----------------------------------------------------------------------------- +// Second stage constructor. +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::ConstructL() + { + TRACER("CShwSlideShowSettingsList::ConstructL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::ConstructL"); + iMusicNamePath.CreateL(KMaxFileName); + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::CreateSettingItemL +//----------------------------------------------------------------------------- +CAknSettingItem* CShwSlideShowSettingsList::CreateSettingItemL(TInt + aResourceId) + { + TRACER("CShwSlideShowSettingsList::CreateSettingItemL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::CreateSettingItemL"); + CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack + switch(aResourceId) + { + case EPlayDirectionItem: + { + iPlayDirection = iShwSettings.PlayOrderL(); + settingItem = new (ELeave) CAknBinaryPopupSettingItem(aResourceId, + iPlayDirection); + + break; + } + case EMusicEnabledItem: + { + iMusicState = iShwSettings.MusicOnL(); + settingItem = new (ELeave) CAknBinaryPopupSettingItem(aResourceId, + iMusicState); + break; + } + case EFileNamePathItem: + { + // get the track from settings + iShwSettings.MusicNamePathL( iMusicNamePath ); + if(!ConeUtils::FileExists( iMusicNamePath ) ) + { + HBufC* noneTxt = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); + iMusicNamePath = *noneTxt; + iShwSettings.SaveMusicNamePathL( *noneTxt ); + delete noneTxt; + } + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iMusicNamePath ); + + // The music should be disabled when the file does not exist + // Note: this change is not persisted. Same check is performed + // each time the Settings Dialog is launched + if( FileNameExistsL() ) + { + // Ensure that the DRM is still valid. If it has become + // invalid while after being used in slideshow, the user + // should be informed now. + ValidateDRML(); + } + else + { + // file does not exist, set music off + SetMusicStateL( EFalse ); + } + + break; + } + case ETransDelayItem: + { + // need to reverse as slider is left to right, range is + // from minimum to maximum + iTransDelay = KMinTransDelay + KMaxTransDelay - iShwSettings.TransDelayL(); + // Use our own slider setting item to fix + // EEBD-79UL8Q - "no naviscroll support in slideshow settings" + settingItem = new (ELeave) CShwSliderSettingItem( aResourceId, + iTransDelay ); + break; + } + case ETransEffectItem: + { + // Retrieve all available effects + CShwSlideshowEngine::AvailableEffectsL(iEffects); + settingItem = new (ELeave) + CShwTransEffectBinaryPopupSettingItem(aResourceId, + iShwSettings, iEffects); + // As of now, Slideshow have only one effect. Thats why setting pan not + // require in setting dialog. + // Whenever other effect will be implemented, comment line No. 722 and + // 738 and uncomment line No. 723 to 727 and line No. 739 to 743 + settingItem->SetHidden(ETrue); + /*if (iEffectsCount > 2) // hide this item - the TransEffectListItem + { // is used instead + settingItem->SetHidden(ETrue); + HandleChangeInItemArrayOrVisibilityL(); + }*/ + + break; + } + case ETransEffectListItem: + { + CShwSlideshowEngine::AvailableEffectsL(iEffects); + iEffectsCount = iEffects.Count(); + settingItem = new (ELeave) CShwTransEffectEnumPopupSettingItem( + aResourceId, iShwSettings, iEffects); + + settingItem->SetHidden(ETrue); + /*if (iEffectsCount <= 2) // hide this item - used only with menu + { + settingItem->SetHidden(ETrue); + HandleChangeInItemArrayOrVisibilityL(); + }*/ + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return settingItem; // return ownership to framework + } + + + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::VerifySelectionL +//----------------------------------------------------------------------------- +TBool CShwSlideShowSettingsList::VerifySelectionL( + const MDesCArray* aSelectedFiles) + { + TRACER("CShwSlideShowSettingsList::VerifySelectionL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::VerifySelectionL"); + return (aSelectedFiles && aSelectedFiles->MdcaCount() > 0); + } + + + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::HandleListBoxEventL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::HandleListBoxEventL(CEikListBox* aListBox, + TListBoxEvent aEventType) + { + TRACER("CShwSlideShowSettingsList::HandleListBoxEventL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::HandleListBoxEventL"); + if ((aEventType == EEventEnterKeyPressed) || + (aEventType == EEventEditingStarted) || + (aEventType == EEventItemSingleClicked)) + { + TInt index = aListBox->CurrentItemIndex(); + GLX_ASSERT_DEBUG( + index < (*SettingItemArray()).Count(), + Panic( EGlxPanicIndexOutOfRange ), + "Slideshow listbox index is out of range" ); + + UpdateListBoxL(index); + } + } + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::UpdateListBoxL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::UpdateListBoxL( TInt aListBoxIndex, + TBool aKeyEvent ) + { + TRACER("CShwSlideShowSettingsList::UpdateListBoxL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateListBoxL"); + switch(aListBoxIndex) + { + case EPlayDirectionItem: + { + SetPlayDirectionL(!iPlayDirection); + break; + } + case EMusicEnabledItem: + { + UpdateMusicStateL(); + break; + } + case EFileNamePathItem: + { + UpdateMusicFileNamePathL(); + break; + } + case ETransDelayItem: + { + UpdateTransDelayL(); + break; + } + case ETransEffectItem: + case ETransEffectListItem: + { + UpdateTransEffectL(aKeyEvent); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + SettingItemArray()->RecalculateVisibleIndicesL(); + HandleChangeInItemArrayOrVisibilityL(); + } + + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::UpdateMusicStateL() +//----------------------------------------------------------------------------- + +void CShwSlideShowSettingsList::UpdateMusicStateL() + { + TRACER("CShwSlideShowSettingsList::UpdateMusicStateL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateMusicStateL"); + // if music was disabled (iMusicState member variable has not yet + // been updated) and a valid file does not exist + + + RBuf fileName; + User::LeaveIfError(fileName.Create(KMaxFileName)); + fileName.CleanupClosePushL(); + iShwSettings.MusicNamePathL(fileName); + + // if music was disabled (iMusicState member variable has not yet + // been updated) + + if (!iMusicState ) + { + HBufC* defVal = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); + CleanupStack::PushL(defVal); + // if file not defined (None) + if ( fileName.operator ==( *defVal ) ) + { + if (ConfirmationQueryL(R_SHW_QTN_LGAL_NOTE_TRACK_DEFINE)) + { + // only change the music state if the update of the music file name + // and path was successful + // The music state is updated inside this method if the Filename is + // valid + UpdateMusicFileNamePathL(); + } + } + else + { + // if file defined but not exists + if (!FileNameExistsL()) + { + // Display the information note + HBufC* noteBuf = StringLoader::LoadLC( R_SHW_QTN_LGAL_NOTE_SLIDESHOW_DEFINE ); + CAknInformationNote* note = new( ELeave ) CAknInformationNote; + CleanupStack::Pop( noteBuf ); + note->ExecuteLD( *noteBuf ); + } + else + { + SetMusicStateL( !iMusicState ); + } + } + CleanupStack::PopAndDestroy( defVal ); + } + else + { + SetMusicStateL( !iMusicState ); + } + CleanupStack::PopAndDestroy( &fileName ); + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::UpdateMusicFileNamePathL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::UpdateMusicFileNamePathL() + { + TRACER("CShwSlideShowSettingsList::UpdateMusicFileNamePathL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateMusicFileNamePathL"); + + CAknSettingItem* item = (*SettingItemArray())[EFileNamePathItem]; + + // Retrieve & persist the new file path + FetchFileNameFromUserL(); + + if( ConeUtils::FileExists( iMusicNamePath ) ) + { + if( ValidateDRML() ) + { + // persist new settings value + item->LoadL(); // externalise the new value to iMusicNamePath + iShwSettings.SaveMusicNamePathL( iMusicNamePath ); + // Redraw the control + ListBox()->DrawItem( EFileNamePathItem ); + // turn music [enabled] on + SetMusicStateL( ETrue ); + return; + } + } + else + { + ResetMusicDefaultsL(); + } + SetMusicStateL( EFalse ); + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::UpdateTransDelayL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::UpdateTransDelayL() + { + TRACER("CShwSlideShowSettingsList::UpdateTransDelayL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateTransDelayL"); + CAknSettingItem* item = (*SettingItemArray())[ETransDelayItem]; + + item->EditItemL(EFalse); + item->StoreL(); + + // The slider control has a fast (2) value drawn to the right and a + // slow value (30) drawn to the left. However, the slider only allows + // ascending values from left to right so the delay value has to be + // inverted. Range is from minimum to maximum + iShwSettings.SaveTransDelayL( KMinTransDelay + KMaxTransDelay - iTransDelay ); + + // Redraw the control + ListBox()->DrawItem(ETransDelayItem); + } + + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::UpdateTransEffectL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::UpdateTransEffectL(TBool aKeyEvent) + { + TRACER("CShwSlideShowSettingsList::UpdateTransEffectL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::UpdateTransEffectL"); + CAknSettingItem* effectItem = (*SettingItemArray())[ETransEffectItem]; + + TUint effectIndex = 0; + TUid effectUid = {0}; + const TUint KToggleEvents = 2; + + + // should always toggle if there are two entries + if (aKeyEvent && iEffectsCount <= KToggleEvents) + { + effectItem->EditItemL(EFalse); + effectItem->StoreL(); + static_cast(effectItem) + ->SelectedEffectL(effectUid, effectIndex); + } + else + { + // always display listbox when there are > 2 effects or when it's + // opened from the menu + CAknSettingItem* effectListItem = + (*SettingItemArray())[ETransEffectListItem]; + effectListItem->EditItemL(EFalse); + effectListItem->StoreL(); + static_cast(effectListItem) + ->SelectedEffectL(effectUid, effectIndex); + + static_cast(effectItem) + ->SetExternalValue(static_cast + (effectListItem)->ExternalValue()); + static_cast(effectItem)-> + CAknBinaryPopupSettingItem::LoadL(); + } + iShwSettings.SaveTransitionTypeL(effectUid, effectIndex); + + // Redraw the control + ListBox()->DrawItem(ETransEffectItem); + } + + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::FetchFileNameFromUserL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::FetchFileNameFromUserL() + { + TRACER("CShwSlideShowSettingsList::FetchFileNameFromUserL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::FetchFileNameFromUserL"); + CDesCArray* files = new (ELeave) CDesCArrayFlat(1); + CleanupStack::PushL(files); + + HBufC* title = ReadLBufStringL( R_SHW_QTN_POPUP_SELECT_TRACK ); + + CleanupStack::PushL( title ); + HBufC* noneTxt = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); + CleanupStack::PushL( noneTxt ); + + TBool fetchReturn = MGFetch::RunL(*files, EAudioFile, EFalse, KNullDesC(), *title, this); + + if(fetchReturn) + { + iMusicNamePath = (*files)[0]; + } + // Fix for Bug EJQZ-7EMCS7 - If user doesnt select a file from list, It shows the same file selected + else if (iMusicNamePath !=*noneTxt && !fetchReturn) + { + // Do Nothing , If the user doesnt select a file from the list, + // it shows the same file as before and thus do nothing. + } + else + { + // load "none" from resource + iMusicNamePath = *noneTxt; + } + CleanupStack::PopAndDestroy(noneTxt); + CleanupStack::PopAndDestroy( title ); + CleanupStack::PopAndDestroy( files ); + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::ResetMusicDefaultsL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::ResetMusicDefaultsL() + { + TRACER("CShwSlideShowSettingsList::ResetMusicDefaultsL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::ResetMusicDefaultsL"); + // load "none" from resource + HBufC* noneTxt = ReadLBufStringL( R_SHW_SLIDESHOW_SETTINGS_TRACK_NONE ); + CleanupStack::PushL( noneTxt ); + iMusicNamePath = *noneTxt; + (*SettingItemArray())[EFileNamePathItem]->LoadL(); + // save empty string to settings so that the dialog will pick up + // empty text from the resource to show + // this fixes error when the old localised "none" text + // was shown for track (MKER-7BJCE5) + iShwSettings.SaveMusicNamePathL( *noneTxt ); + CleanupStack::PopAndDestroy( noneTxt ); + + // turn music [enabled] off + SetMusicStateL( EFalse ); + ListBox()->DrawItem( EFileNamePathItem ); + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::ValidateDRML +//----------------------------------------------------------------------------- +TBool CShwSlideShowSettingsList::ValidateDRML() + { + TRACER("CShwSlideShowSettingsList::ValidateDRML"); + GLX_LOG_INFO("CShwSlideShowSettingsList::ValidateDRML"); + + // check that DRM exists + // create a CContent object. CAF will figure out the appropriate agent + ContentAccess::CContent* content = + ContentAccess::CContent::NewL(iMusicNamePath); + CleanupStack::PushL( content ); + + // create a CData object to read the content, while also + ContentAccess::CData* data = NULL; + // verifying that the intent is supported by the current rights + TRAPD( err, data = content->OpenContentL( ContentAccess::EPlay ); ); + delete data; + CleanupStack::PopAndDestroy( content ); + + if( KErrCA_LowerLimit <= err && err <= KErrCA_UpperLimit ) + { + // if there are no play rights for the file and we're only allowed + // play files that are DRM protected + if( err == KErrCANoRights && PlayOnlyDRMProtectedFilesL() ) + { + ShowErrorNoteL( R_SHW_NOT_ALLOWED_TXT ); + return EFalse; // can't play file (rights don't exist) + } + else + { + ShowErrorNoteL( R_SHW_SETTINGSLIST_DRM_TXT ); + return EFalse; // can't play file (rights are invalid) + } + } + else + { + User::LeaveIfError( err ); + } + return ETrue; + } + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::ShowErrorNoteL +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::ShowErrorNoteL(TInt aResourceId) const + { + TRACER("CShwSlideShowSettingsList::ShowErrorNoteL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::ShowErrorNoteL"); + HBufC* errText = StringLoader::LoadLC( aResourceId ); + CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse ); + note->ExecuteLD( *errText ); + CleanupStack::PopAndDestroy( errText ); + } + + + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::FileNameExistsL +//----------------------------------------------------------------------------- +TBool CShwSlideShowSettingsList::FileNameExistsL() + { + TRACER("CShwSlideShowSettingsList::FileNameExistsL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::FileNameExistsL"); + RBuf fileName; + User::LeaveIfError(fileName.Create(KMaxFileName)); + fileName.CleanupClosePushL(); + iShwSettings.MusicNamePathL(fileName); + TBool retVal = EFalse; + + if (fileName.Length() > 0) + { + retVal = ConeUtils::FileExists(fileName); + } + CleanupStack::PopAndDestroy(&fileName); + return retVal; + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::SetMusicStateL() +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::SetMusicStateL(TBool aNewMusicState) + { + TRACER("CShwSlideShowSettingsList::SetMusicStateL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::SetMusicStateL"); + if (aNewMusicState != iMusicState) + { + // retrieve music on/off setting + (*SettingItemArray())[EMusicEnabledItem]->EditItemL(EFalse); + // updates Music State + iMusicState = aNewMusicState; + // internalise new state to settings item + (*(SettingItemArray()))[EMusicEnabledItem]->StoreL(); + // persist music state + iShwSettings.SaveMusicStateL(iMusicState); + // redraw music on/off control + ListBox()->DrawItem(EMusicEnabledItem); + } + } +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::SetPlayDirectionL() +//----------------------------------------------------------------------------- +void CShwSlideShowSettingsList::SetPlayDirectionL(TBool aNewPlayDirection) + { + TRACER("CShwSlideShowSettingsList::SetPlayDirectionL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::SetMusicStateL"); + if (aNewPlayDirection != iPlayDirection) + { + // retrieve play direction setting + (*SettingItemArray())[EPlayDirectionItem]->EditItemL(EFalse); + // updates play direction + iPlayDirection = aNewPlayDirection; + // internalise new state to settings item + (*(SettingItemArray()))[EPlayDirectionItem]->StoreL(); + + // persist direction + iShwSettings.SavePlayOrderL(iPlayDirection); + //@TODO cenrep update + + // redraw music on/off control + ListBox()->DrawItem(EPlayDirectionItem); + } + } +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::ConfirmationQueryL +//----------------------------------------------------------------------------- +TBool CShwSlideShowSettingsList::ConfirmationQueryL(TInt aQueryStrId) + { + TRACER("CShwSlideShowSettingsList::ConfirmationQueryL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::ConfirmationQueryL"); + HBufC* titleText = StringLoader::LoadLC(aQueryStrId); + CAknQueryDialog* query = CAknQueryDialog::NewL(); + CleanupStack::PushL(query); + query->SetPromptL(*titleText); + CleanupStack::Pop(query); + TInt retVal = query->ExecuteLD(R_SHW_CONFIRMATION_QUERY); + CleanupStack::PopAndDestroy(); //titleText + return (retVal == EAknSoftkeyOk || retVal == EAknSoftkeyYes); + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::PlayOnlyDRMProtectedFiles +//----------------------------------------------------------------------------- +TBool CShwSlideShowSettingsList::PlayOnlyDRMProtectedFilesL() + { + TRACER("CShwSlideShowSettingsList::PlayOnlyDRMProtectedFilesL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::PlayOnlyDRMProtectedFilesL"); + TBool playOnlyDRMProtectedFiles = EFalse; + if (!iRepository) + { + iRepository = CRepository::NewL(KCRUidMusicPlayerFeatures); + } + // Check if DRM protected files are the only files that be played + TInt err = iRepository->Get(KRequireDRMInPlayback, + playOnlyDRMProtectedFiles); + if (err == KErrNotFound) // there maybe no KRequireDRMInPlayback entry + { + return EFalse; + } + else + { + User::LeaveIfError(err); + } + + return playOnlyDRMProtectedFiles; + } + +//----------------------------------------------------------------------------- +// CShwSlideShowSettingsList::ReadLBufStringL +//----------------------------------------------------------------------------- +HBufC* CShwSlideShowSettingsList::ReadLBufStringL( const TInt aResourceId ) + { + TRACER("CShwSlideShowSettingsList::ReadLBufStringL"); + GLX_LOG_INFO("CShwSlideShowSettingsList::ReadLBufStringL"); + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + TParse parse; + parse.Set( KResourceFile, &KDC_APP_RESOURCE_DIR, NULL ); + + TFileName resFile; + resFile.Copy( parse.FullName() ); + BaflUtils::NearestLanguageFile( fs, resFile ); + + RResourceFile rFile; + rFile.OpenL( fs, resFile ); + CleanupClosePushL( rFile ); + + // Set pointer to starting + rFile.ConfirmSignatureL( 0 ); + + HBufC8* buf = rFile.AllocReadLC( aResourceId ); + + TResourceReader resReader; + resReader.SetBuffer( buf ); + + // get the string from resource reader + HBufC* defVal = resReader.ReadHBufCL(); + + // pop and destroy stack data + CleanupStack::PopAndDestroy( buf ); + CleanupStack::PopAndDestroy( &rFile ); + CleanupStack::PopAndDestroy( &fs ); + + return defVal; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/src/shwslideshowsettingslist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/src/shwslideshowsettingslist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Slideshow settings dialog implementation +* +*/ + + + + + +#ifndef SHWSLIDESHWSETTINGSLIST_H +#define SHWSLIDESHWSETTINGSLIST_H + +// EXTERNAL INCLUDES +#include // for MEikListBoxObserver +#include // for CAknSettingItem +#include // for MMGFetchVerifier +#include // for ContentAccess::CContent +#include // for ContentAccess::CData + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CRepository; +class CShwSettingsModel; +class TShwEffectInfo; + +/** + * @author Loughlin Spollen + * The slide show settings list - contained with the settings dialog + * @lib shwslideshowengine.lib + * @internal reviewed 08/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS (CShwSlideShowSettingsList) : public CAknSettingItemList, + public MMGFetchVerifier + { + public: // Constructors and destructor + /** + * Symbian default constructor. + * @param aShwSettings setting values for music state, default path + * and track default effect ECOM plugin UID and effect index + * within the effect ECOM plugin + */ + static CShwSlideShowSettingsList* NewL(CShwSettingsModel& aShwSettings); + + /** + * Destructor + */ + ~CShwSlideShowSettingsList(); + + public: //from CAknSettingItemList + + // @ref CAknSettingItemList::CreateSettingItemL + CAknSettingItem* CreateSettingItemL(TInt aIdentifier); + + // @ref CAknSettingItemList::HandleListBoxEventL + void HandleListBoxEventL(CEikListBox* aListBox, + TListBoxEvent aEventType); + + public: + + /** + * Update the list box. + * @param The List box item index to be updated + * @param Whether the event originated from a key press or menu command + */ + void UpdateListBoxL(TInt aListBoxIndex, TInt aKeyEvent = EFalse); + + /** + * Update the music on/off control and the coupled + * music file name. + */ + void UpdateMusicStateL(); + + /** + * Update the music file name and path + */ + void UpdateMusicFileNamePathL(); + + /** + * Update the transition delay between images + */ + void UpdateTransDelayL(); + + /** + * Update the transition effect between images + */ + void UpdateTransEffectL(TBool aKeyEvent); + + + private: + /** + * C++ default constructor. + * @param aShwSettings setting values for music state, default path + * and track default effect ECOM plugin UID and effect index + * within the effect ECOM plugin + */ + CShwSlideShowSettingsList(CShwSettingsModel& aShwSettings); + + /** + * 2nd stage constructor + */ + void ConstructL(); + + + private: + + + /** + * Launch MGFetch for filename fetch + */ + void FetchFileNameFromUserL(); + + /** + * Remove the music settings and set the default setting + * values + */ + void ResetMusicDefaultsL(); + + + /** + * Validate the DRM rights for the music track file + * @return TBool ETrue if valid for track selection + */ + TBool ValidateDRML(); + + /** + * Show error note + * @param aResourceId resource id of text string + */ + void ShowErrorNoteL(TInt aResourceId) const; + + + /** + * Check if iFileName exists + * @return ETrue if exists + */ + TBool FileNameExistsL(); + + /** + * Change the state of the music enabled setting + */ + void SetMusicStateL(TBool aNewMusicState); + + /** + * Change the direction/order of slide show play + */ + void SetPlayDirectionL(TBool aNewPlayDirection); + + /** + * Ask for user confirmation of a given query using a dialog + * @param aQueryResourceId The query resource string ID + * @return True if the user confirmed the query, otherwise false + */ + TBool ConfirmationQueryL(TInt aQueryStrId); + + /** + * Check if the only files that can be played are DRM protected + * @return ETrue if the only file that can be played are DRM protected + * otherwise EFalse + */ + TBool PlayOnlyDRMProtectedFilesL(); + + /** + * Read the values present in rss file and do required conversion + * @param aResourceId resource string ID + * @return converted value + */ + HBufC* ReadLBufStringL(const TInt aResourceId); + + private: // from MMGFetchVerifier + + /** + * @ref MMGFetchVerifier::VerifySelectionL + */ + TBool VerifySelectionL(const MDesCArray* aSelectedFiles); + + private: //data + + class CShwTransEffectEnumPopupSettingItem; + class CShwTransEffectBinaryPopupSettingItem; + // Add our own setting page and item to fix + // EEBD-79UL8Q - "no naviscroll support in slideshow settings" + class CShwSliderSettingPage; + class CShwSliderSettingItem; + + // Music On/Off Setting + TBool iMusicState; + + //Play direction + TBool iPlayDirection; + + // Number of transition effects + TUint iEffectsCount; + + // Array of Transition effects + RArray iEffects; + + // Music filename Setting + RBuf iMusicNamePath; + + // The transition delay between images + TInt iTransDelay; + + // Not Owned: Slideshow settings + CShwSettingsModel& iShwSettings; + + // Owned: The Central Repository + CRepository* iRepository; + + }; + +#endif // SHWSLIDESHWSETTINGSLIST_H diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007-2008 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: The slideshow settings dialog ecom plugin + * +*/ + + + + +// CLASS HEADER +#include "shwslideshowsettingsplugin.h" + + +// EXTERNAL INCLUDES +#include // for CAknDialog +#include // for MMPXCustomCommandObserver +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include "shwslideshowsettingsdialog.h" + +#include + +// ----------------------------------------------------------------------------- +// C++ Constructor. +// ----------------------------------------------------------------------------- +inline CShwSlideshowSettingsPlugin::CShwSlideshowSettingsPlugin() + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwSlideshowSettingsPlugin* CShwSlideshowSettingsPlugin::NewL() + { + TRACER("CShwSlideshowSettingsPlugin::NewL"); + GLX_LOG_INFO("CShwSlideshowSettingsPlugin::NewL"); + CShwSlideshowSettingsPlugin* self = new(ELeave) CShwSlideshowSettingsPlugin; + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CShwSlideshowSettingsPlugin::~CShwSlideshowSettingsPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// From CMPXAknDialogPlugin +// Construct Avkon dialog. +// --------------------------------------------------------------------------- +CAknDialog* CShwSlideshowSettingsPlugin::ConstructDialogL() + { + TRACER("CShwSlideshowSettingsPlugin::ConstructDialogL"); + GLX_LOG_INFO("CShwSlideshowSettingsPlugin::ConstructDialogL"); + return CShwSlideshowSettingsDialog::NewL(); + } + +// --------------------------------------------------------------------------- +// From CMPXAknDialogPlugin +// Resource ID. +// --------------------------------------------------------------------------- +TInt CShwSlideshowSettingsPlugin::ResourceId() + { + TRACER("CShwSlideshowSettingsPlugin::ResourceId"); + GLX_LOG_INFO("CShwSlideshowSettingsPlugin::ResourceId"); + return R_SHW_SETTINGS_DLG; // Resource Id of settings dialog + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/src/shwslideshowsettingsplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow settings dialog implementation +* +*/ + + + + +#ifndef SHWSLIDESHOWSETTINGPLGIN_H +#define SHWSLIDESHOWSETTINGPLGIN_H + + +// INCLUDES +#include + + + +// CLASS DECLARATION + +/** + * Slideshow settings playback dialog plugin definition. + * + * @lib shwslideshowsettingsplugin.lib + * @since S60 v3.2 + * @internal reviewed 08/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS(CShwSlideshowSettingsPlugin) : public CMPXAknDialogPlugin + { + +public: + /** + * Two-phased constructor. + * @return Pointer to newly created object. + */ + static CShwSlideshowSettingsPlugin* NewL(); + + /** + * Destructor. + */ + ~CShwSlideshowSettingsPlugin(); + +private: + /** + * C++ default constructor. + */ + CShwSlideshowSettingsPlugin(); + +private: // from CMPXAknDialogPlugin + /** + * Construct Avkon dialog. + * @return Pointer to a newly created Avkon dialog. + */ + CAknDialog* ConstructDialogL(); + + // @ref CMPXAknDialogPlugin + TInt ResourceId(); + }; + + +#endif // SHWSLIDESHOWSETTINGPLGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/settingsdialog/src/shwslideshowsettingspluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/settingsdialog/src/shwslideshowsettingspluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The slideshow settings dialog ecom plugin + * +*/ + + + + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "shwslideshowsettingsplugin_UID.hrh" +#include "shwslideshowsettingsplugin.h" + + + +#if (!defined IMPLEMENTATION_PROXY_ENTRY) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid}, (TProxyNewLPtr)(aFuncPtr)} +#endif + + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +//----------------------------------------------------------------------------- +// ImplementationTable +// Define the interface UIDs +//----------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KShwSettingsDlgImplementationUid, + CShwSlideshowSettingsPlugin::NewL ) + }; + +//----------------------------------------------------------------------------- +// ImplementationGroupProxy +// The one and only exported function that is the ECom entry point +//----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy + (TInt& aTableCount) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/utils/shwautoptr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/utils/shwautoptr.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2007-2008 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: Thin callback wrapper + * +*/ + + + + +// include guard for the whole file content +#ifndef __SHWAUTOPTR_H__ +#define __SHWAUTOPTR_H__ + +/** + * TShwAutoPtr, implementation of auto_ptr + */ +template< class T > +class TShwAutoPtr + { + public: + + /** + * Default constructor + */ + TShwAutoPtr() + : iPtr( NULL ) + {} + + /** + * Constructor + * @param aPtr the pointer to own + */ + TShwAutoPtr( T* aPtr = 0 ) + : iPtr( aPtr ) + {} + + /** + * Copy constructor, transfers ownership + * @param aPtr the pointer to transfer + */ + TShwAutoPtr( TShwAutoPtr< T >& aPtr ) + : iPtr( aPtr.Release() ) + {} + + /** + * Destructor, releases the pointer + */ + ~TShwAutoPtr() + { + delete iPtr; + } + + /** + * Dereference + */ + T& operator*() const + { + return *iPtr; + } + + /** + * Take address of pointed class + */ + T* operator &() + { + return iPtr; + } + + /** + * Dereference + */ + T* operator->() const + { + return iPtr; + } + + /** + * Gives the pointer to the caller, ownership stays + * @return the pointer held, ownership does not transfer + */ + T* Pointer() const + { + return iPtr; + } + + /** + * Assignment from one pointer to another, ownership transfers + * @param the auto pointer to hold + * @return reference to this so that assignments can be chained + */ + TShwAutoPtr& operator=( TShwAutoPtr& aCopy ) + { + if( this != &aCopy ) + { + // transfer the pointer + SetPointer( aCopy.Release() ); + } + return *this; + } + + /** + * Sets the pointer, ownership is taken + * @param the pointer to hold + */ + void SetPointer( T* aPointer ) + { + // release the old (possible) pointer + delete iPtr; + iPtr = aPointer; + } + + /** + * Release, returns the ownership to the caller + * @return the pointer held, ownership transfers + */ + T* Release() + { + T* temp = iPtr; + iPtr = 0; + return temp; + } + + private: + + /// Own: the pointer to hold + T* iPtr; + + }; + +#endif // __SHWAUTOPTR_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/utils/shwcallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/utils/shwcallback.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2007-2008 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: Thin callback wrapper + * +*/ + + + + +// include guard for the whole file content +#ifndef __TSHWCALLBACK_H__ +#define __TSHWCALLBACK_H__ + +/** + * Helper class to construct a TCallBack from any + * public non static TInt (*method)() of a class + * Usage: + * TShwCallBack< %ClassName%, %MethodName% >( + * %ClassPointer% ) + * Example: + * TShwCallBack< CShwEngineImpl, DoStartL >( + * this ); + */ +template< class Object, TInt (Object::*Method)() > +NONSHARABLE_CLASS( TShwCallBack ) : public TCallBack + { + public: + /** + * Constructor. + * @param aInstance the object instance of the class + */ + inline TShwCallBack( Object* aInstance ) + : TCallBack( &DelegateL, aInstance ) + {} + + private: + /** + * The callback delegator. Inlined as we dont want + * extra method to be created, static so that base + * class can call it without pointer to this. + * @param aInstance the instance to call back + * @return the return value for the TCallBack + */ + inline static TInt DelegateL( TAny* aInstance ) + { + // Dispatch the call to the real objects method + return ( static_cast< Object* >( aInstance )->*Method )(); + } + }; + + +#endif // __TSHWCALLBACK_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/utils/shwcleanupwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/utils/shwcleanupwrapper.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2007-2008 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: Thin cleanup wrapper + * +*/ + + + + +// include guard for the whole file content +#ifndef __TSHWCLEANUPWRAPPER_H__ +#define __TSHWCLEANUPWRAPPER_H__ + +/** + * Helper class to construct a TCleanupItem from any + * public non static void (*method)() of a class + * Usage: + * TShwCleanupWrapper< %ClassName%, %MethodName% >( + * %ClassPointer% ) + * Example: + * RPointerArray< MInterface > array; + * CleanupStack::PushL( + * TShwCleanupWrapper< + * RPointerArray, + * RPointerArray::ResetAndDestroy >( array ) ); + */ +template< class Object, void (Object::*Method)()> +NONSHARABLE_CLASS( TShwCleanupWrapper ) : public TCleanupItem + { + public: + /** + * Constructor. + * @param aInstance the object instance of the class + */ + inline TShwCleanupWrapper( Object& aInstance ) + : TCleanupItem( &Cleanup, &aInstance ) + {} + + private: + /** + * The cleanup callback delegator. Inlined as we dont want + * extra method to be created, static so that base + * class can call it without pointer to this. + * @param aInstance the instance of TShwCallBack + * @return the return value for the TCallBack + */ + inline static void Cleanup( TAny* aInstance ) + { + ( static_cast< Object* >( aInstance )->*Method )(); + } + }; + +/** + * Helper function to create cleanup item without ugly template notations + * @param aObject the object to call ResetAndDestroy in case of leave + * + * Usage: + * ShwCleanupResetAndDestroyPushL( array ); + * Example: + * RPointerArray< MShwEffect > effects; + * // put the array in cleanupstack in case CreateEffectsL leaves + * ShwCleanupResetAndDestroyPushL( effects ); + */ +template< class T > +void ShwCleanupResetAndDestroyPushL( T& aObject ) + { + CleanupStack::PushL( + TShwCleanupWrapper< T, T::ResetAndDestroy >( aObject ) ); + } + +#endif // __TSHWCLEANUPWRAPPER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/utils/shwgeometryutilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/utils/shwgeometryutilities.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2007-2008 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: Thin callback wrapper + * +*/ + + + + +// include guard for the whole file content +#ifndef __SHWGEOMETRYUTILITIES_H__ +#define __SHWGEOMETRYUTILITIES_H__ + +namespace NShwGeometryUtilities + { + /** + * Utility to calculate the fitting for coordinates and maintaining the + * aspect ratio + * @param aFitted reference to second coordinate, this value gets + * multiplied with aNewAssigned / aAssigned + * @param aAssigned reference to first coordinate, this value gets + * assigned to aNewAssigned + * @param aNewAssigned new value for first coordinate + * + * Example: X coordinate needs to be assigned a new value X2 and you need + * to calculate new Y coordinate maintaining the aspect ratio: + * FitDimension( Y, X, X2 ); + * + * @author Kimmo Hoikka + */ + template< typename T> + void FitDimension( T& aFitted, T& aAssigned, T aNewAssigned ) + { + // formula is: + // aFitted = ( aFitted * aNewAssigned ) / aAssigned + // aAssigned = aNewAssigned + // calculate second coordinate + aFitted = + ( aFitted * aNewAssigned ) / + aAssigned; + // assign the first coordinate + aAssigned = aNewAssigned; + } + + /** + * Utility to fit width and height inside given box + * maintaining the aspect ratio. Fit inside means that the image + * does not fill the whole box and it is not stretched. + * @param aWidth reference to the width to fit + * @param aHeight reference to the height to fit + * @param aBoxWidth the bounding box width + * @param aBoxHeight the bounding box height + */ + template< typename T> + void FitInsideBox( T& aWidth, T& aHeight, T aBoxWidth, T aBoxHeight ) + { + // calculate width difference + T wdiff = aWidth - aBoxWidth; + // calculate height difference + T hdiff = aHeight - aBoxHeight; + // check if wdiff is larger and positive + if( ( wdiff > hdiff ) && wdiff > 0 ) + { + // width is larger and too big for box so need to fit height + FitDimension( aHeight, aWidth, aBoxWidth ); + } + else if( hdiff > 0 ) + { + // height is larger and too big for box so need to fit width + FitDimension( aWidth, aHeight, aBoxHeight ); + } + } + + /** + * Utility to set width and height to cover given box + * maintaining the aspect ratio. Fit cover means that the image + * fills the whole box and some part of it does not fit inside the box. + * @param aWidth reference to the width to fit + * @param aHeight reference to the height to fit + * @param aBoxWidth the bounding box width + * @param aBoxHeight the bounding box height + */ + template< typename T> + void FitToCoverBox( T& aWidth, T& aHeight, T aBoxWidth, T aBoxHeight ) + { + // try to fit with width first + T newWidth = aWidth; + T newHeight = aHeight; + // calculate new height according to the width change + FitDimension( newHeight, newWidth, aBoxWidth ); + // check if height is inside box + if( newHeight < aBoxHeight ) + { + // ok, it did not fill so fit according to height + FitDimension( aWidth, aHeight, aBoxHeight ); + } + else + { + // did fill the image so assign new values + aWidth = newWidth; + aHeight = newHeight; + } + } + } + + +#endif // __SHWGEOMETRYUTILITIES_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/data/2000719a.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/data/2000719a.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + + +// INCLUDES +#include +#include +#include + + + +// RESOURCE DEFINITIONS + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: uid of the supported Playback/Collection plugin. + * E.g. if the view plugin supports Local Playback plugin, the list of + * uids will be: 0x101FFC06 + * + * uid + * uid: plugin type uid. + * E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0 + * + * flags [optional] + * flags: sum of the required feature flags that listed in mpxviewplugin.hrh. + * E.g. if the view plugin needs to be pre-loaded and it's user-selectable, + * then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003. + * + * priority [optional] + * priority: a value of type TMPXViewPluginPriorities. This value determines + * which view plugin will be resolved when several plugins can support the + * same set of Uids. + * Default value of this field is EMPXViewPluginPriorityNormal. + */ + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2000719A; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXViewPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KShwSlideshowViewImplementationId; + version_no = 1; + display_name = "Slideshow view"; + default_data = ""; +/** @todo - check the opaque data values */ + opaque_data = "

0x20007199

" + "0x2000719A" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + } + }; + } +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/data/shwslideshowview.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/data/shwslideshowview.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2007-2008 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: Resource definitions +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME SHWV + +// INCLUDES +#include +#include +#include +#include + +#include "shwslideshowview.hrh" +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="SHWV"; } + +// ----------------------------------------------------------------------------- +// Slideshow settings track not exist note text +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_shw_qtn_lgal_note_slideshow_define + { buf = qtn_lgal_note_slideshow_track; } + +// Slideshow volume percentage +RESOURCE TBUF r_shw_volume_percentage + { + buf = qtn_lgal_slideshow_volume_percentage; + } + +// ----------------------------------------------------------------------------- +// +// r_shw_softkeys_end_pause +// Soft keys: End Pause +// +// ----------------------------------------------------------------------------- +// +RESOURCE CBA r_shw_softkeys_end_pause + { + //for transperency + flags = EEikCbaFlagTransparent; + buttons = + { + CBA_BUTTON { id = EShwSlideshowCmdPause; txt = text_softkey_pause; }, + CBA_BUTTON { id = EShwSlideshowCmdEnd; txt = qtn_lgal_slideshow_softkey_end; } + }; + } + +RESOURCE AVKON_VIEW r_shw_slideshow_play_view + { + // no menubar or cba in play view - is the resource still required? + } + +// ----------------------------------------------------------------------------- +// +// r_shw_softkeys_end_continue +// Soft keys: End Continue +// +// ----------------------------------------------------------------------------- +// +RESOURCE CBA r_shw_softkeys_end_continue + { + //for transperency + flags = EEikCbaFlagTransparent; + buttons = + { + CBA_BUTTON { id = EShwSlideshowCmdContinue; txt = qtn_lgal_slideshow_softkey_continue; }, + CBA_BUTTON { id = EShwSlideshowCmdEnd; txt = qtn_lgal_slideshow_softkey_end; } + }; + } + +RESOURCE AVKON_VIEW r_shw_slideshow_pause_view + { + cba = r_shw_softkeys_end_continue; + } + + +RESOURCE TBUF r_shw_softkey_left { buf = qtn_lgal_slideshow_softkey_continue; } +RESOURCE TBUF r_shw_softkey_right { buf = qtn_lgal_slideshow_softkey_end; } +RESOURCE TBUF r_shw_wait_dlg_opening { buf = qtn_gen_note_opening; } +RESOURCE TBUF r_shw_softkey_cancel { buf = text_softkey_cancel; } + +RESOURCE DIALOG r_shw_wait_note +{ + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EShwDlgWaitNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + singular_label = r_shw_wait_dlg_opening; + }; + } + }; +} + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow view plugin build information + * +*/ + + + +#include + +PRJ_PLATFORMS +WINSCW ARMV5 + +PRJ_EXPORTS + + +PRJ_MMPFILES +shwslideshowviewplugin.mmp + +PRJ_TESTMMPFILES +//../tsrc/group/t_cshwslideshowkeyhandler.mmp +//../tsrc/group/t_cshwslideshowview.mmp +//../tsrc/group/t_cshwslideshowpausehandler.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/group/shwslideshowviewplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/group/shwslideshowviewplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + + + +#include +#include +#include + +#include "../../../group/glxbuildcommon.mmh" +#include "../../../inc/glxcapabilities.hrh" +#include "../../../inc/glxalfhelper.mmh" + +TARGET shwslideshowviewplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2000719A + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY GLX_CAPABILITIES + +SOURCEPATH ../src +SOURCE shwslideshowviewpluginproxy.cpp +SOURCE shwslideshowviewplugin.cpp +SOURCE shwslideshowview.cpp +SOURCE shwslideshowvolumecontrol.cpp +SOURCE shwslideshowbacklighttimer.cpp +SOURCE shwslideshowkeyhandler.cpp +SOURCE shwslideshowtelephonehandler.cpp +SOURCE shwslideshowpausehandler.cpp +SOURCE shwgesturecontrol.cpp +SOURCE shwviewtimer.cpp +SOURCE shwmediakeyshandler.cpp +// view resource +START RESOURCE ../data/shwslideshowview.rss +HEADER +/** @todo go figure why APP_RESOURCE_DIR puts the .rsc file in the wrong place! */ +//TARGETPATH APP_RESOURCE_DIR +TARGETPATH resource/apps +LANGUAGE_IDS +END + +// plugin resource +START RESOURCE ../data/2000719a.rss +TARGET shwslideshowviewplugin.rsc +END // RESOURCE + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +USERINCLUDE ../../utils +USERINCLUDE ../../../viewframework/inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../viewframework/views/viewbase/inc +SYSTEMINCLUDE ../../../viewframework/medialists/inc +SYSTEMINCLUDE ../../../viewframework/visuallistmanager/inc +SYSTEMINCLUDE ../../../viewframework/uiutilities/inc +SYSTEMINCLUDE ../../../viewframework/texturemanager/inc +SYSTEMINCLUDE ../../../viewframework/commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../viewframework/commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../engine/inc // slideshow engine +SYSTEMINCLUDE ../../../common/inc // for filter factory +SYSTEMINCLUDE ../../../commonui/inc // for resolution utility +SYSTEMINCLUDE ../../../viewframework/inc +SYSTEMINCLUDE ../../../viewframework/tvout/inc + +// System includes from epoc32/include + + + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY bafl.lib +LIBRARY commonengine.lib +LIBRARY centralrepository.lib // for backlight timeout value + +LIBRARY shwslideshowengine.lib + +LIBRARY mpxviewplugin.lib +LIBRARY mpxcommon.lib +LIBRARY ecom.lib + +LIBRARY hitchcock.lib // HUI + +LIBRARY glxviewbase.lib +LIBRARY glxmedialists.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY glxlayouts.lib +LIBRARY glxuiutilities.lib +LIBRARY glxtexturemanager.lib // for CGlxTextureManager +LIBRARY glxcommoncommandhandlers.lib // for back command +LIBRARY glxcommon.lib // for CResourceUtilities, filter factory +LIBRARY glxcommonui.lib // for resolution utility + +LIBRARY aknskins.lib // MAknsSkinInstance +LIBRARY aknskinsrv.lib // MAknsSkinInstance +LIBRARY aknswallpaperutils.lib // MAknsSkinInstance +LIBRARY aknicon.lib // AknIconUtils + +LIBRARY etel3rdparty.lib // for CTelephony +LIBRARY alfclient.lib +LIBRARY gesturehelper.lib + +LIBRARY remconcoreapi.lib +LIBRARY remconinterfacebase.lib +//LIBRARY hgcontextutility.lib // For Teleport +LIBRARY glxtvout.lib +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/inc/shwgesturecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/inc/shwgesturecontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* 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: The settings model for the slideshow + * +*/ + + + + +#ifndef SHWGESTURECONTROL_H +#define SHWGESTURECONTROL_H + + +#include +#include +#include "shwgestureobserver.h" + +//namespace +using namespace GestureHelper; + +//Forward declaration +class CAlfEnv; +class CGestureHelper; +class MGestureObserver; +class CShwSlideshowEngine; + +/** +* CShwGestureControl is used to enable handling of gesture events in slide show +* Gesture support is necessary to handle swipes in "Manual Mode" +* @ MC Photos Slideshow UI spec DeSW R8 v. 1.0.doc +* Not exposed, for internal use of Slide show +* For documentation Gesture Helper Classes , +* see @ref MGestureObserver. +* see @ref CGestureControl +*/ + +NONSHARABLE_CLASS( CShwGestureControl ) : public CAlfControl, + public GestureHelper::MGestureObserver + { + +public: + + /** + * NewL + * static function for 2-phased object creation + * NewLC not provided as the CShwGestureControl is primarily intended to be a + * member variable + * @param aEngine, handle to the slide show engine + * @param aEnv, handle to CAlfEnv + * @param aDisplay, handle to CAlfDisplay + */ + static CShwGestureControl* NewL(CAlfEnv& aEnv,CAlfDisplay& aDisplay, + MShwGestureObserver& aObserver); + + /** + * HandleGestureL + * From MGestureObserver + * see @ref MGestureObserver + */ + void HandleGestureL( const GestureHelper::MGestureEvent& aEvent ); + + /** + * ~~CShwGestureControl + * standard C++ destructor + */ + ~CShwGestureControl(); + +private: + + /** + * CShwGestureControl + * C++ constructor + */ + CShwGestureControl(MShwGestureObserver& aObserver); + + /** + * ConstructL + * 2nd Phase constructor + */ + void ConstructL( CAlfEnv& aEnv,CAlfDisplay& aDisplay ); + +private: + + /* does not own **/ + MShwGestureObserver& iObserver; + }; + + +#endif //SHWGESTURECONTROL_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/inc/shwslideshowview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/inc/shwslideshowview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,406 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Slideshow view implementation +* +*/ + + + + + +#ifndef C_SHWSLIDESHOWVIEW_H +#define C_SHWSLIDESHOWVIEW_H + +// INCLUDES +#include +#include +#include +#include +#include +#include "shwengineobserver.h" +#include "shwmusicobserver.h" +#include "shwconstants.h" +#include "shwtickobserver.h" +#include "shwgestureobserver.h" +#include "gesturecontrol.h" + +// FORWARD DECLARATIONS +class CAlfEnv; +class CAlfDisplay; +class CAlfDisplayCoeControl; +class CAlfControlGroup; +class CAlfSoftKeyControl; +class CGlxUiUtility; +class CGlxMediaListManager; +class MGlxMediaList; +class CShwSlideshowEngine; +class CAknWaitDialog; +class CShwSlideshowVolumeControl; +class CShwSlideshowBackLightTimer; +class CShwSlideShowPauseHandler; +class CShwSlideShowKeyHandler; +class CShwTelephoneHandler; +class CMPXCollectionPath; +class CEikButtonGroupContainer; +// CLASS DECLARATION +class CShwGestureControl; +class CShwTicker; +class CShwMediaKeyUtility; +class CGestureControl; +//class CHgContextUtility; +class CGlxHdmiController; +/** + * Slideshow view. + * + * @internal reviewed 07/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS(CShwSlideshowView) : public CGlxViewBase, + public MGlxMediaListObserver, + public MShwEngineObserver, + public MShwMusicObserver, + public MProgressDialogCallback, + public MShwTickObserver, + public MShwGestureObserver + { + public: + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + static CShwSlideshowView* NewLC(); + + /** + * Destructor. + */ + ~CShwSlideshowView(); + + public: // Callback functions + /** + * Show the progress dialog + * this needs to be public as it is a callback. + * @return TInt, a non-zero value if it is intended to + * be called again, otherwise it should return zero. + */ + TInt ShowProgressDialogL(); + + + /** + * Start the engine + * this needs to be public as it is a callback. + * @return TInt, a non-zero value if it is intended to + * be called again, otherwise it should return zero. + */ + TInt StartEngineL(); + + /** + * Populate the media list + * this needs to be public as it is a callback. + * @return TInt, a non-zero value if it is intended to + * be called again, otherwise it should return zero. + */ + TInt PopulateListL(); + + private: + + /** + * C++ default constructor. + */ + CShwSlideshowView(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + private: // from base class CAknView + + /** + * @ref CAknView::Id + */ + TUid Id() const; + + /** + * @ref CAknView::HandleForegroundEventL + */ + void HandleForegroundEventL(TBool aForeground); + + public: // From CGlxViewBase + + /** + * @ref CGlxViewBase::DoViewActivateL + */ + void DoViewActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, const TDesC8& aCustomMessage ); + /** + * @ref CGlxViewBase::DoViewDeactivate + */ + void DoViewDeactivate(); + + private: // from MGlxMediaListObserver + + /// @ref MGlxMediaListObserver::HandleItemAddedL + void HandleItemAddedL( TInt aStartIndex, + TInt aEndIndex, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleMediaL + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleItemRemovedL + void HandleItemRemovedL( TInt aStartIndex, + TInt aEndIndex, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleItemModifiedL + void HandleItemModifiedL( const RArray& aItemIndexes, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleAttributesAvailableL + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleFocusChangedL + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, + TInt aOldIndex, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleItemSelectedL + void HandleItemSelectedL( TInt aIndex, + TBool aSelected, + MGlxMediaList* aList ); + /// @ref MGlxMediaListObserver::HandleMessageL + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + + /// @ref MGlxMediaListObserver::HandlePopulatedL + void HandlePopulatedL( MGlxMediaList* aList ); + + //form CAknView + void ProcessCommandL(TInt aCommandId); + private: // From MShwEngineObserver + + /** + * @ref MShwEngineObserver::EngineStartedL + */ + void EngineStartedL(); + + /** + * @ref MShwEngineObserver::EnginePausedL + */ + void EnginePausedL(); + + /** + * @ref MShwEngineObserver::EngineResumedL + */ + void EngineResumedL(); + + /** + * @ref MShwEngineObserver::EngineToggleUiStateL + */ + void EngineToggleUiStateL(); + /** + * @ref MShwEngineObserver::EngineLSKPressedL + */ + void EngineLSKPressedL(); + + /** + * @ref MShwEngineObserver::ErrorDuringSlideshowL + */ + void ErrorDuringSlideshowL(); + + private: // from MShwMusicObserver + + /** + * @ref MShwMusicObserver::MusicOn + */ + void MusicOnL(); + + /** + * @ref MShwMusicObserver::MusicOff + */ + void MusicOff(); + + /** + * @ref MShwMusicObserver::MusicOn + */ + void MusicVolumeL(TInt aCurrentVolume, TInt aMaxVolume); + + /** + * @ref MShwMusicObserver::ErrorWithTrackL + */ + void ErrorWithTrackL( TInt aErrorCode ); + + private: // from MProgressDialogCallback + + void DialogDismissedL( TInt aButtonId ); + + private: // Helper functions + + /** + * Setup the screen furniture + */ + void SetupScreenFurnitureL(); + + /** + * Method that creates a local, ordered copy of the media list + * @param aData from which to extract the play direction and the path + */ + void GetPathAndPlaybackDirectionL( const TDesC8& aData ); + + /** + * Helper function to set the focus in the filtered list, depending + * on the selection or focus of the original list. + */ + void SetListFocusL(); + + /** + * @ref MShwTickObserver::HandleTickL + */ + + void HandleTickL(); + /** + * @ref MShwTickObserver::HandleTickCancelled + */ + void HandleTickCancelled(); + + /** + * @ref MShwGestureObserver::HandleShwGestureEventL + */ + void HandleShwGestureEventL(MShwGestureObserver::TShwGestureEventType aType); + + /** + * Initializes the screen furniture for the slide show view + */ + void InitializeShwFurnitureL(); + /** + * Initializes the soft keys + */ + void InitializeCbaL(); + /** + * Hides the screen furniture + */ + void HideShwFurniture(); + /** + * Makes the screen furniture visible + */ + void ShowShwFurnitureL(); + /** + * Replaces an existing command set with a new one + *@ + */ + void ReplaceCommandSetL(TInt aNewComandId, TInt aOldCommandSet ); + /** + * returns the index of item for which texture can be removed for cleanup + * The index will be out the iterator offsets w.r.t focssed index. + */ + void SetImage(); + TInt GetIndexToBeRemoved(); + /** + * Remove the fullscreen texture. + */ + void RemoveTexture(); + public: + //to keep in track which of the command set is active/on top + enum TShwState + { + EShwPause = 1 , + EShwPlay, + EShwExiting + }; + private: // Data + + TInt iResourceOffset; + + /** + * HUIToolkit environment. + * not owned + */ + CAlfEnv* iEnv; + + CAlfDisplay* iDisplay; // not owned + + /** Slideshow Engine */ + CShwSlideshowEngine* iEngine; // owned + + CAlfControlGroup* iVolumeControlGroup; // owned + + // CGlxUiUtility* iUiUtility; // owned + + CAknWaitDialog* iWaitDialog; // owned + + /// Own: Pause handler + CShwSlideShowPauseHandler* iPauseHandler; + + /// Own: Key handler + CShwSlideShowKeyHandler* iKeyHandler; + + CShwSlideshowVolumeControl* iVolumeControl; // owned + + TInt iCurrentVolume;// owned + + CShwSlideshowBackLightTimer* iBackLightTimer; // owned + + // This flag is used to determine whether or not the slideshow + // should resume when it returns to the foreground + TBool iPauseOnForeground; // owned + + MGlxMediaList* iFilteredList; // owned + MGlxMediaList* iMediaList; // owned + /// Own: Flag to tell that input list is ready to be used + TBool iInputListReady; + /// Own: Flag to tell that play list is ready to be used + TBool iPlayListReady; + + /// Own: asynch callback needed for engine start + CAsyncCallBack* iAsyncCallBack; + + // handle interruptions from incoming telephone calls + CShwTelephoneHandler* iTelephoneHandler; + + CMPXCollectionPath* iCollectionPath; // owned + NShwSlideshow::TPlayDirection iPlayDirection; // owned + + TBool iEngineStartFailed; + + /// Own: asynch callback needed for media list population + CAsyncCallBack* iPopulateListCallBack; + CEikButtonGroupContainer* iShwCba; + + //Flag for event generated by MSK + TBool iMSKPressed; + + //Flag for event generated by LSK + TBool iLSKPressed; + + //to keep track of whether the furniture is visible or not + //and to toggle on tap + enum TShwFurniture + { + EFurnitureVisible = 1, + EFurnitureHidden + }; + + TShwState iShwState; + TShwFurniture iShwFurniture; + TInt iCurrentActiveCommandSet; + CShwGestureControl* iShwGestureControl; + GestureHelper::CGestureControl* iGestureControl; + CAlfControlGroup* iGestureControlGroup; + CShwTicker* iTicker; + CShwMediaKeyUtility* iMediaKeyHandler; +// CHgContextUtility* iContextUtility; + CGlxHdmiController* iHdmiController; + TBool iHdmiActive; + }; + +#endif // C_SHWSLIDESHOWVIEW_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/inc/shwslideshowview.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/inc/shwslideshowview.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007-2008 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: Resource headers +* +*/ + + + + +#ifndef SHWSLIDESHOWVIEW_HRH +#define SHWSLIDESHOWVIEW_HRH + +enum TShwSlideshowCommandIds + { + EShwSlideshowCmdEnd = 1, // available from soft key + EShwSlideshowCmdPause, // available from soft key + EShwSlideshowCmdContinue // available from soft key + }; + +enum TShwSlideshowDialogIds + { + EShwDlgWaitNote = 0x00002001 + }; + +#endif // SHWSLIDESHOWVIEW_HRH + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwgesturecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwgesturecontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2007-2008 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: The pause handling control for the slideshow + * +*/ + + + + +#include +#include +#include + +#include +#include +#include "shwslideshowengine.h" +#include "shwgesturecontrol.h" + +using namespace GestureHelper; + + + +// ----------------------------------------------------------------------------- +// NewL. +// ----------------------------------------------------------------------------- +// +CShwGestureControl* CShwGestureControl::NewL( CAlfEnv& aEnv,CAlfDisplay& aDisplay, + MShwGestureObserver& aObserver) + { + TRACER("CShwGestureControl::NewL"); + GLX_LOG_INFO( "CShwGestureControl::NewL" ); + CShwGestureControl* self = new(ELeave)CShwGestureControl(aObserver); + CleanupStack::PushL( self ); + self->ConstructL( aEnv,aDisplay); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// ConstructL. +// ----------------------------------------------------------------------------- +// +void CShwGestureControl::ConstructL( CAlfEnv& aEnv,CAlfDisplay& aDisplay ) + { + TRACER("CShwGestureControl::ConstructL"); + GLX_LOG_INFO( "CShwGestureControl::ConstructL" ); + //CGestureControl::ConstructL(*this,aEnv,aDisplay,KShwgestureEventControlGroup); + CAlfControl::ConstructL(aEnv); + BindDisplay(aDisplay); + } + +// ----------------------------------------------------------------------------- +// CShwGestureControl. +// ----------------------------------------------------------------------------- +// +CShwGestureControl::CShwGestureControl( MShwGestureObserver& aObserver): + iObserver(aObserver) + { + //no implementation + } + +// ----------------------------------------------------------------------------- +// ~CShwGestureControl. +// ----------------------------------------------------------------------------- +// +CShwGestureControl::~CShwGestureControl() + { + //no implementation + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +void CShwGestureControl::HandleGestureL( const GestureHelper::MGestureEvent& aEvent ) + { + TRACER("CShwGestureControl::HandleGestureL"); + GLX_LOG_INFO1( "CShwGestureControl::HandleGestureL(%d)", aEvent.Code( MGestureEvent::EAxisBoth )); + // we are interested in only + // swipe left(EGestureSwipeLeft) + // swipe right(EGestureSwipeRight) + // and tap events + + switch ( aEvent.Code( MGestureEvent::EAxisBoth ) ) + { + + case EGestureSwipeLeft: + { + //call back the view + iObserver.HandleShwGestureEventL(MShwGestureObserver::ESwipeLeft); + break; + } + case EGestureHoldLeft: + { + //skip for now + break; + } + case EGestureSwipeRight: + { + //callback + iObserver.HandleShwGestureEventL(MShwGestureObserver::ESwipeRight); + break; + } + case EGestureHoldRight: + { + //skip for now + break; + } + case EGestureTap: + { + iObserver.HandleShwGestureEventL(MShwGestureObserver::ETapEvent); + break; + } + //fall through + case EGestureSwipeUp: + case EGestureHoldUp: + case EGestureSwipeDown: + case EGestureHoldDown: + default: + { + break; + } + + } + } + +//end of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwgestureobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwgestureobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Slideshow view implementation +* +*/ + + + + + + +#ifndef SHWGESTUREOBSERVER_H +#define SHWGESTUREOBSERVER_H + + +class MShwGestureObserver + { + +public: + + enum TShwGestureEventType + { + ETapEvent = 1, + ESwipeLeft, + ESwipeRight, + EHoldEvent + }; +public: + + + /** + * Populate the media list + * this needs to be public as it is a callback. + * @return TInt, a non-zero value if it is intended to + * be called again, otherwise it should return zero. + */ + virtual void HandleShwGestureEventL(TShwGestureEventType aType) = 0; + }; + +#endif //SHWGESTUREOBSERVER_H + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwmediakeyshandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwmediakeyshandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,190 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Command object factory +* +*/ + + + + +#include +#include +#include +//#include // CViaPlayerMediaKeyObserver +#include +#include + +#include "shwmediakeyshandler.h" + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CShwMediaKeyUtility::CShwMediaKeyUtility() + { + TRACER("CShwMediaKeyUtility::CShwMediaKeyUtility"); + GLX_LOG_ENTRY_EXIT("CShwMediaKeyUtility::CShwMediaKeyUtility()"); + } + +// --------------------------------------------------------------------------- +// Destructor. Remove itself as a listner from the ViaPlayerMediaKeyObserver +// --------------------------------------------------------------------------- +// +CShwMediaKeyUtility::~CShwMediaKeyUtility() + { + TRACER("CShwMediaKeyUtility::~CShwMediaKeyUtility"); + GLX_LOG_ENTRY_EXIT("CShwMediaKeyUtility::~CShwMediaKeyUtility()"); + delete iInterfaceSelector; + + } + +// --------------------------------------------------------------------------- +// NewLC - Standard two phase constructor placing itself on the cleanup stack +// --------------------------------------------------------------------------- +// +CShwMediaKeyUtility* CShwMediaKeyUtility::NewLC() + { + TRACER("CShwMediaKeyUtility::NewLC"); + GLX_LOG_ENTRY_EXIT("CShwMediaKeyUtility::NewLC()"); + CShwMediaKeyUtility* self = new (ELeave) CShwMediaKeyUtility(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// NewL - Standard two phase constructor +// --------------------------------------------------------------------------- +// +CShwMediaKeyUtility* CShwMediaKeyUtility::NewL() + { + TRACER("CShwMediaKeyUtility::NewL"); + GLX_LOG_ENTRY_EXIT_LEAVE_L("CShwMediaKeyUtility::NewL()"); + CShwMediaKeyUtility* self = CShwMediaKeyUtility::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// ConstructL - Adds istself as a media key listener to the +// ViaPlayerMediaKeyObserver +// --------------------------------------------------------------------------- +// +void CShwMediaKeyUtility::ConstructL() + { + TRACER("CShwMediaKeyUtility::ConstructL"); + GLX_LOG_ENTRY_EXIT_LEAVE_L("CShwMediaKeyUtility::ConstructL()"); + iInterfaceSelector = CRemConInterfaceSelector::NewL(); + + iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *this); + iInterfaceSelector->OpenTargetL(); + } + +// ---------------------------------------------------------------------------- +// MrccatoCommand() +// Receives events (press/click/release) from the following buttons: +// 'Play/Pause', 'Volume Up', 'Volume Down', 'Stop', 'Rewind', 'Forward' +// ---------------------------------------------------------------------------- +// +void CShwMediaKeyUtility::MrccatoCommand(TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct) + { + TRACER("CShwMediaKeyUtility::MrccatoCommand"); + GLX_LOG_ENTRY_EXIT("CShwMediaKeyUtility::MediaKeyEventL()"); + TStdScanCode scanCode = TranslateKeyEvent(aOperationId); + DispatchKeyEvent(aButtonAct, scanCode); + } + + +// --------------------------------------------------------------------------- +// DoSimulateKeyEvent - Add key event to application queue +// --------------------------------------------------------------------------- +// +void CShwMediaKeyUtility::DoSimulateKeyEvent(TRawEvent::TType aKeyCode, + TStdScanCode aScanCode ) + { + TRACER("CShwMediaKeyUtility::DoSimulateKeyEvent"); + GLX_LOG_ENTRY_EXIT("CShwMediaKeyUtility::DoSimulateKeyEvent()"); + TRawEvent rawEvent; + rawEvent.Set(aKeyCode, aScanCode); + UserSvr::AddEvent(rawEvent); + } + +// --------------------------------------------------------------------------- +// TranslateKeyEvent - Translates RemCon keys into standard scan codes +// --------------------------------------------------------------------------- +// +TStdScanCode CShwMediaKeyUtility::TranslateKeyEvent(TRemConCoreApiOperationId aOperationId) + { + TRACER("CShwMediaKeyUtility::TranslateKeyEvent"); + GLX_LOG_ENTRY_EXIT("CShwMediaKeyUtility::TranslateKeyEvent()"); + + TStdScanCode scanCode = EStdKeyNull; + TRequestStatus status; + + switch (aOperationId) + { + case ERemConCoreApiVolumeUp: + scanCode = EStdKeyIncVolume; + break; + + case ERemConCoreApiVolumeDown: + scanCode = EStdKeyDecVolume; + break; + case ERemConCoreApiPausePlayFunction: + scanCode = EStdKeyDictaphonePlay; + iCoreTarget->PausePlayFunctionResponse(status, KErrNone); + User::WaitForRequest(status); + + break; + + default: + break; + } + + return scanCode; + } + +// --------------------------------------------------------------------------- +// DispatchKeyEvent - Interperets the button action and acts accordingly +// --------------------------------------------------------------------------- +// +void CShwMediaKeyUtility::DispatchKeyEvent(TRemConCoreApiButtonAction aButtonAct, + TStdScanCode aScanCode) + { + TRACER("CShwMediaKeyUtility::DispatchKeyEvent"); + GLX_LOG_ENTRY_EXIT("CShwMediaKeyUtility::DispatchKeyEvent()"); + + if (EStdKeyNull == aScanCode) + { + return; + } + + switch (aButtonAct) + { + case ERemConCoreApiButtonPress: + DoSimulateKeyEvent(TRawEvent::EKeyDown, aScanCode); + break; + + case ERemConCoreApiButtonRelease: + DoSimulateKeyEvent(TRawEvent::EKeyUp, aScanCode); + break; + + case ERemConCoreApiButtonClick: + DoSimulateKeyEvent(TRawEvent::EKeyDown, aScanCode); + DoSimulateKeyEvent(TRawEvent::EKeyUp, aScanCode); + break; + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwmediakeyshandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwmediakeyshandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Command object factory +* +*/ + + + + +#ifndef SHWMEDIAKEYUTILITY_H +#define SHWMEDIAKEYUTILITY_H + +#include // link against RemConCoreApi.lib +#include // and +#include // RemConInterfaceBase.lib + + +/** + * + * This is a utility class that simplifies the use of RemCon and the ViaPlayer when + * used together. A problem results when an application instantiates more than one + * Instance of RemCon. + * + * This class enables other components to use the same instance on RemCon that the + * ViaPlayer uses. + * It inherits from MViaPlayerMediaKeyListener and links with the ViaPlayerUtilities.lib + * It interperets the keys from RemCon via the MediaKeyEventL method and translates them + * to standard key which get added to the application event queue for normal processing + * (Via OfferKeyEventL). + * + * Note that TranslateKeyEvent and DispatchKeyEvent methods are virtual. + * So if different behaviour is required just create a Sub class and overide + * those metheds are needed. + * + */ + +class CShwMediaKeyUtility : public CBase, public MRemConCoreApiTargetObserver + { +public: + /** + * Standard NewLC class used for Instantiation + + * @return Instance of Itself, also on the cleanup stack + */ + static CShwMediaKeyUtility* NewLC(); + + /** + * Standard NewL class used for Instantiation + + * @return Instance of Itself + */ + static CShwMediaKeyUtility* NewL(); + + /** + * Destructor + */ + virtual ~CShwMediaKeyUtility(); + +protected: + /** + * Creates KeyEvent and places it on the application event queue. + * + * @param aKeyCode this is the action (up, down or click). + * @param aScanCode this is the TStdScanCode for the Key Event. + */ + void DoSimulateKeyEvent( TRawEvent::TType aKeyCode, TStdScanCode aScanCode ); + + /** + * Converts RemCon key types to standard key types + * + * @param aOperationId the RemCon key type + * + * @return the standard key type + */ + virtual TStdScanCode TranslateKeyEvent(TRemConCoreApiOperationId aOperationId); + + /** + * Places the Key Event in the applications quere acording to aButtonAct (up, down, click) + * + * @param aButtonAct (up, down or click) + * @param aScanCode the standard scan code for a key + */ + virtual void DispatchKeyEvent( TRemConCoreApiButtonAction aButtonAct, TStdScanCode aScanCode); + +private: + CShwMediaKeyUtility(); + void ConstructL(); + +public: // from MViaPlayerMediaKeyListener + + void MrccatoCommand(TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct); +private: + + CRemConInterfaceSelector* iInterfaceSelector; + CRemConCoreApiTarget* iCoreTarget; + }; + +#endif// + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowbacklighttimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowbacklighttimer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow backlight timer management.. +* +*/ + + + + +#include "shwslideshowbacklighttimer.h" +#include // for peripheral display timeout setting +#include // display timeout setting keys +#include +#include +#include "shwcallback.h" + +namespace + { + const TInt KMicroSecondsInASecond = 1000000; + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::CShwSlideshowBackLightTimer +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CShwSlideshowBackLightTimer::CShwSlideshowBackLightTimer() + { + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CShwSlideshowBackLightTimer* CShwSlideshowBackLightTimer::NewL() + { + TRACER("CShwSlideshowBackLightTimer::NewL"); + GLX_LOG_INFO("CShwSlideshowBackLightTimer::NewL"); + CShwSlideshowBackLightTimer* self = new( ELeave ) + CShwSlideshowBackLightTimer(); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CShwSlideshowBackLightTimer::~CShwSlideshowBackLightTimer() + { + TRACER("CShwSlideshowBackLightTimer::~CShwSlideshowBackLightTimer"); + GLX_LOG_INFO("CShwSlideshowBackLightTimer::~CShwSlideshowBackLightTimer"); + delete iPeriodic; + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CShwSlideshowBackLightTimer::ConstructL() + { + TRACER("CShwSlideshowBackLightTimer::ConstructL"); + GLX_LOG_ENTRY_EXIT("CShwSlideshowBackLightTimer::ConstructL"); + + CRepository* repository = CRepository::NewLC( KCRUidPeripheralSettings ); + // What's the timeout value (in seconds ) for the display light? + repository->Get( KSettingsDisplayLightsTimeout, iSettingsDelay ); + GLX_LOG_INFO1("CShwSlideshowBackLightTimer, lights timeout = %d", + iSettingsDelay ); + + // What's the screen saver's timeout value (in seconds)? + TInt screenSaverTimeout = 0; + repository->Get( KSettingsScreenSaverPeriod, screenSaverTimeout ); + GLX_LOG_INFO1("CShwSlideshowBackLightTimer, scr saver timeout = %d", + screenSaverTimeout ); + CleanupStack::PopAndDestroy( repository ); + + // Take the smaller of the two timeout values + iSettingsDelay = Min( iSettingsDelay, screenSaverTimeout ); + // Convert the value to microseconds + iSettingsDelay *= KMicroSecondsInASecond; + // Halve the value to ensure out timer kicks beforehand + iSettingsDelay /= 2; + + // Create a timer + iPeriodic = CPeriodic::NewL( CPeriodic::EPriorityStandard ); + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::Tick - handler code for the timer +// ----------------------------------------------------------------------------- +// +TInt CShwSlideshowBackLightTimer::Tick() + { + // Timer must be reset to prevent screen saver to appear in + // Aalto when the slide is closed. Should not cause any side effects. + User::ResetInactivityTime(); + iStartTime.HomeTime(); + + return 1; // continues always + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::StartL +// ----------------------------------------------------------------------------- +// +void CShwSlideshowBackLightTimer::StartL() + { + TRACER("CShwSlideshowBackLightTimer::StartL()"); + GLX_LOG_INFO("CShwSlideshowBackLightTimer::StartL" ); + iStartTime.HomeTime(); + User::ResetInactivityTime(); + iPeriodic->Cancel(); // in case it actually was running + iPeriodic->Start( iSettingsDelay, iSettingsDelay, + TShwCallBack< CShwSlideshowBackLightTimer, Tick >( this ) ); + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::Cancel +// ----------------------------------------------------------------------------- +// +void CShwSlideshowBackLightTimer::Cancel() + { + TRACER("CShwSlideshowBackLightTimer::Cancel()"); + GLX_LOG_INFO("CShwSlideshowBackLightTimer::Cancel" ); + User::ResetInactivityTime(); + iPeriodic->Cancel(); + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::IsRunning +// ----------------------------------------------------------------------------- +// +TBool CShwSlideshowBackLightTimer::IsRunning() + { + TRACER("CShwSlideshowBackLightTimer::IsRunning()"); + GLX_LOG_INFO("CShwSlideshowBackLightTimer::IsRunning" ); + return iPeriodic->IsActive(); + } + +// ----------------------------------------------------------------------------- +// CShwSlideshowBackLightTimer::Delay +// ----------------------------------------------------------------------------- +// +TInt CShwSlideshowBackLightTimer::Delay() + { + TRACER("CShwSlideshowBackLightTimer::Delay()"); + GLX_LOG_INFO("CShwSlideshowBackLightTimer::Delay" ); + return iSettingsDelay; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowbacklighttimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowbacklighttimer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow backlight timer management.. +* +*/ + + + + +#ifndef C_SHWSLIDESHOWBACKLIGHTTIMER_H +#define C_SHWSLIDESHOWBACKLIGHTTIMER_H + +#include +#include + +// FORWARD DECLARATION +class CRepository; + +// CLASS DECLARATION + +/** +* Media gallery backlight controlling timer (for slide show view) +* @internal reviewed 07/06/2007 by Kimmo Hoikka +*/ +NONSHARABLE_CLASS(CShwSlideshowBackLightTimer) : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CShwSlideshowBackLightTimer* NewL(); + + /** + * Destructor. + */ + virtual ~CShwSlideshowBackLightTimer(); + + public: // New functions + + /** + * Cancels the timer + */ + void Cancel(); + + /** + * Starts the timer + */ + void StartL(); + + /** + * Is timer active or not? + * @return ETrue is active, EFalse otherwise + */ + TBool IsRunning(); + + /** + * Delay value + * @return TInt + */ + TInt Delay(); + + /** + * Callback function for the timer to call + * @param aObject any given object + * @return TInt + */ + TInt Tick(); + + private: + + /** + * C++ default constructor. + */ + CShwSlideshowBackLightTimer(); + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + private: // Data + + TInt iSettingsDelay; + TTime iStartTime; + + CPeriodic* iPeriodic; // owned + }; + +#endif // C_SHWSLIDESHOWBACKLIGHTTIMER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowblackoutcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowblackoutcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2007-2008 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: Control to create a black background for the slideshow +* +*/ + + + +#include "shwslideshowblackoutcontrol.h" + +#include +#include +#include +#include + +#include "glxhuiutility.h" + +namespace + { + /** + * Time to complete blackout + */ + const TInt KShwBlackoutDelay = 0; + /** + * Opacity value - fully opaque + */ + const TInt KShwOpaque = 1; + /** + * Opacity value - transparent + */ + const TInt KShwTransparent = 0; + const TInt KShwScreenSizeMultiplier = 3; + const TInt KShwOrigin = 0; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CShwBlackoutControl* CShwBlackoutControl::NewL( CHuiEnv& aEnv, + CHuiDisplay& aDisplay ) + { + CShwBlackoutControl* self = new( ELeave ) + CShwBlackoutControl( aEnv, aDisplay ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CShwBlackoutControl::CShwBlackoutControl( CHuiEnv& aEnv, CHuiDisplay& aDisplay ) + : CHuiControl( aEnv ), iDisplay( aDisplay ) + { + BindDisplay( aDisplay ); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CShwBlackoutControl::ConstructL() + { + // Create the black background to fade out the rest of the screen + iBlackoutTexture = CHuiTexture::NewL(); + CGlxHuiUtility::UploadFlatColourToTextureL( KRgbBlack, iBlackoutTexture ); + + iBlackoutLayout = CHuiAnchorLayout::AddNewL( *this ); + iBlackoutLayout->SetClipping( EFalse ); + + iBlackoutImageVisual = CHuiImageVisual::AddNewL( *this, iBlackoutLayout ); + iBlackoutImageVisual->SetImage( THuiImage( *iBlackoutTexture ) ); + iBlackoutImageVisual->iOpacity.Set( KShwTransparent ); + + iBlackoutImageVisual->SetFlag( EHuiVisualFlagManualLayout ); + TSize displaySize = iDisplay.Size(); + iBlackoutImageVisual->SetSize( THuiRealSize( + displaySize.iWidth * KShwScreenSizeMultiplier, + displaySize.iHeight * KShwScreenSizeMultiplier )); + + iBlackoutImageVisual->SetPos( THuiRealPoint( KShwOrigin, KShwOrigin) ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CShwBlackoutControl::~CShwBlackoutControl() + { + delete iBlackoutTexture; + } + +// ----------------------------------------------------------------------------- +// ActivateL +// ----------------------------------------------------------------------------- +// +void CShwBlackoutControl::ActivateL() + { + if ( !iActivated ) + { + iBlackoutImageVisual->iOpacity.Set( KShwOpaque, KShwBlackoutDelay ); + iActivated = ETrue; + } + } + +// ----------------------------------------------------------------------------- +// Deactivate +// ----------------------------------------------------------------------------- +// +void CShwBlackoutControl::Deactivate() + { + if ( iActivated ) + { + iBlackoutImageVisual->iOpacity.Set( KShwTransparent, + KShwBlackoutDelay ); + iActivated = EFalse; + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowblackoutcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowblackoutcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2007-2008 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: Black out control class +* +*/ + + + + +#ifndef C_SHWBLACKOUTCONTROL_H +#define C_SHWBLACKOUTCONTROL_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CGlxHuiUtility; +class CHuiAnchorLayout; +class CShwSlideshowView; +class CHuiTexture; +class CHuiImageVisual; + +/** + * CShwBlackoutControl + * + * Black out control + * + * @lib shwslideshowviewplugin.lib + * @internal reviewed 07/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CShwBlackoutControl ) : public CHuiControl + { +public: + /** + * Factory function constructor + */ + static CShwBlackoutControl* NewL( CHuiEnv& aEnv, CHuiDisplay& aDisplay); + + /** + * Destructor + */ + ~CShwBlackoutControl(); + +public: + /** + * Activates the blackout control: + */ + void ActivateL(); + + /** + * Deactivates the blackout control. + */ + void Deactivate(); + +private: + CShwBlackoutControl(CHuiEnv& aEnv, CHuiDisplay& aDisplay); + void ConstructL(); + +private: + CHuiDisplay& iDisplay; // not owned + CHuiTexture* iBlackoutTexture; // owned + CHuiAnchorLayout* iBlackoutLayout; // not owned + CHuiImageVisual* iBlackoutImageVisual; // not owned + TBool iActivated; // owned + }; + + +#endif // C_SHWBLACKOUTCONTROL_H diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowkeyhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowkeyhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2007-2008 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: The view key handling control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "shwslideshowkeyhandler.h" + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include +#include +#include +#include "shwslideshowengine.h" +#include "shwslideshowpausehandler.h" +#include "shwslideshowview.h" +// ----------------------------------------------------------------------------- +// C++ Constructor. +// ----------------------------------------------------------------------------- +inline CShwSlideShowKeyHandler::CShwSlideShowKeyHandler( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler, + TInt& aState ) + : iEngine( aEngine ),iPauseHandler( aPauseHandler ), iState( aState ) + { + TRACER("CShwSlideShowKeyHandler::CShwSlideShowKeyHandler"); + GLX_LOG_INFO("CShwSlideShowKeyHandler::CShwSlideShowKeyHandler"); + // No implementation required + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CShwSlideShowKeyHandler::ConstructL() + { + TRACER("CShwSlideShowKeyHandler::ConstructL"); + GLX_LOG_INFO("CShwSlideShowKeyHandler::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL(); + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwSlideShowKeyHandler* CShwSlideShowKeyHandler::NewL( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler, + TInt& aState ) + { + TRACER("CShwSlideShowKeyHandler::NewL"); + GLX_LOG_INFO("CShwSlideShowKeyHandler::NewL"); + CShwSlideShowKeyHandler* self = + new( ELeave ) CShwSlideShowKeyHandler( aEngine, aPauseHandler, + aState ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwSlideShowKeyHandler::~CShwSlideShowKeyHandler() + { + TRACER("CShwSlideShowKeyHandler::~CShwSlideShowKeyHandler"); + GLX_LOG_INFO("CShwSlideShowKeyHandler::~CShwSlideShowKeyHandler"); + if ( iUiUtility ) + { + iUiUtility->Close(); + } + // No implementation required + } + +// ----------------------------------------------------------------------------- +// OfferKeyEventL. +// ----------------------------------------------------------------------------- +TKeyResponse CShwSlideShowKeyHandler::OfferKeyEventL( + const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TRACER("CShwSlideShowKeyHandler::OfferKeyEventL"); + GLX_LOG_INFO( "CShwSlideShowKeyHandler::OfferKeyEventL" ); + TKeyResponse retVal = EKeyWasNotConsumed; + + if( aType == EEventKeyDown ) + { + switch( aKeyEvent.iScanCode ) + { + case EStdKeyIncVolume : // volume up + { + iEngine.VolumeUpL(); + retVal = EKeyWasConsumed; + break; + } + case EStdKeyDecVolume : // volume down + { + iEngine.VolumeDownL(); + retVal = EKeyWasConsumed; + break; + } + case EStdKeyLeftArrow : // this gets rotated in landscape + { + // show previous image + iEngine.PreviousItemL(); + retVal = EKeyWasConsumed; + break; + } + case EStdKeyRightArrow : // this gets rotated in landscape + { + iEngine.NextItemL(); + retVal = EKeyWasConsumed; + break; + } + case EStdKeyDevice0 : // left soft key + { + iEngine.LSKPressedL(); + // key was consumed + retVal = EKeyWasConsumed; + break; + } + case EStdKeyDevice3 : // navi select + { + iPauseHandler.ToggleUiControlsVisibiltyL(); + // key was consumed + retVal = EKeyWasConsumed; + break; + } + case EStdKeyDevice1 : // right soft key + { + // Exiting so revert to showing the system skin + // Note: this has to be done here, not in the view deactivation + // as when we come to deactivate, the screen furniture will + // match the view id to the active view (e.g. the tile view) + //@todo-check + //iScreenFurniture.DisableSystemSkinL( iViewId.iUid, + // CGlxScreenFurniture::EGlxSfItemLeftSoftkey, EFalse ); + //iScreenFurniture.DisableSystemSkinL( iViewId.iUid, + // CGlxScreenFurniture::EGlxSfItemRightSoftkey, EFalse ); + // Note that in practice it doesn't matter whether we return + // EKeyWasConsumed or EKeyWasNotConsumed as the result is + // the same (we still get back to the last view). This is due to + // HUI's key handling. So, for safety's sake, if in future there + // are changes to HUI to cease processing the key events when + // EKeyWasConsumed is returned, then we return EKeyWasNotConsumed to + // ensure that the command is forwarded to the back command handler. + break; + } + default: + { + retVal = EKeyWasNotConsumed; + break; + } + }// end switch + }// end if + // if its a system generated exit event + // set the state + else if (aType == EEventKey && aKeyEvent.iScanCode == EStdKeyNo) + { + + // iState = CShwSlideshowView::EShwExiting; + iUiUtility->SetExitingState(ETrue); + } // end if else + + return retVal; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowkeyhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowkeyhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* 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: The view key handling control for the slideshow + * +*/ + + + + +#ifndef __CSHWSLIDESHOWKEYHANDLER_H__ +#define __CSHWSLIDESHOWKEYHANDLER_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CShwSlideshowEngine; +class CShwSlideShowPauseHandler; + +// CLASS DECLARATION + +/** + * CShwSlideShowKeyHandler + * @internal reviewed 07/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CShwSlideShowKeyHandler ) : public CCoeControl + { + public: // Constructors and destructor + + /** + * Constructor. + * @param reference to the slide show engine + * @param reference to the pause handler + * @param reference to the screen furniture + * @param the slideshow view's id + */ + static CShwSlideShowKeyHandler* NewL( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler, + TInt& aState ); + + /** + * Destructor. + */ + ~CShwSlideShowKeyHandler(); + + private: + + /** + * Constructor + * @ref CShwSlideShowKeyHandler::NewL + */ + CShwSlideShowKeyHandler( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler, + TInt& aState ); + /** + * ConstructL + * @ref CShwSlideShowKeyHandler::ConstructL + */ + void ConstructL(); + + public: // From CCoeControl + + /** + * @ref CCoeControl::OfferKeyEventL + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + private: // Implementation + + // Ref: The slideshow engine + CShwSlideshowEngine& iEngine; + + /// Ref: the slideshow pause handler + CShwSlideShowPauseHandler& iPauseHandler; + + CGlxUiUtility* iUiUtility; + + /// The slideshow view's id + TInt& iState ; + }; + +#endif // __CSHWSLIDESHOWKEYHANDLER_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowpausehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowpausehandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2007-2008 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: The pause handling control for the slideshow + * +*/ + + + + +// CLASS HEADER +#include "shwslideshowpausehandler.h" + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "shwslideshowengine.h" + +#include +#include + +// ----------------------------------------------------------------------------- +// C++ Constructor. inlined to save a few bits of ROM +// ----------------------------------------------------------------------------- +inline CShwSlideShowPauseHandler::CShwSlideShowPauseHandler( + CShwSlideshowEngine& aEngine ) + : iEngine( aEngine ), + iInCall( EFalse ), // set to false just to clarify + iUserPaused( EFalse ), // set to false to clarify + iOnForeground( ETrue ) // we are on foreground by default + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// NewL. Static construction +// ----------------------------------------------------------------------------- +CShwSlideShowPauseHandler* CShwSlideShowPauseHandler::NewL( + CShwSlideshowEngine& aEngine ) + { + TRACER("CShwSlideShowPauseHandler::OfferKeyEventL"); + GLX_LOG_INFO( "CShwSlideShowPauseHandler::NewL" ); + CShwSlideShowPauseHandler* self = + new( ELeave ) CShwSlideShowPauseHandler( aEngine ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +CShwSlideShowPauseHandler::~CShwSlideShowPauseHandler() + { + // No implementation required + } +// ----------------------------------------------------------------------------- +// UserToggledControlsVisibiltyL. +// ----------------------------------------------------------------------------- +void CShwSlideShowPauseHandler::ToggleUiControlsVisibiltyL() + { + iEngine.ToggleUiControlsVisibiltyL(); + } +// ----------------------------------------------------------------------------- +// UserToggledPauseL. +// ----------------------------------------------------------------------------- +void CShwSlideShowPauseHandler::UserToggledPauseL() + { + TRACER("CShwSlideShowPauseHandler::UserToggledPauseL"); + GLX_LOG_INFO( + "CShwSlideShowPauseHandler::UserToggledPauseL" ); + // get the engine state unless we are on background + if( iOnForeground ) + { + CShwSlideshowEngine::TShwState state = iEngine.State(); + if ( CShwSlideshowEngine::EShwStateRunning == state ) + { + // user paused us + iUserPaused = ETrue; + // Calling PauseL on the engine results in the view receiving an + // paused event from engine observer. + iEngine.PauseL(); + } + else if ( CShwSlideshowEngine::EShwStatePaused == state ) + { + // user resumed us + iUserPaused = EFalse; + // if engine is paused, resume + iEngine.ResumeL(); + } + } + } + +// ----------------------------------------------------------------------------- +// PhoneCallStartedL. +// ----------------------------------------------------------------------------- +void CShwSlideShowPauseHandler::PhoneCallStartedL() + { + TRACER("CShwSlideShowPauseHandler::PhoneCallStartedL"); + GLX_LOG_INFO( + "CShwSlideShowPauseHandler::PhoneCallStartedL" ); + // set state to in call + iInCall = ETrue; + // get the engine state + CShwSlideshowEngine::TShwState state = iEngine.State(); + // if engine is running + if ( CShwSlideshowEngine::EShwStateRunning == state ) + { + // Calling PauseL on the engine results in the view receiving an + // paused event from engine observer. + iEngine.PauseL(); + } + } + +// ----------------------------------------------------------------------------- +// PhoneCallEndedL. +// ----------------------------------------------------------------------------- +void CShwSlideShowPauseHandler::PhoneCallEndedL() + { + TRACER("CShwSlideShowPauseHandler::PhoneCallEndedL"); + GLX_LOG_INFO( + "CShwSlideShowPauseHandler::PhoneCallEndedL" ); + // set state to not in call + iInCall = EFalse; + // only resume when we are on foreground + if( iOnForeground ) + { + // get the engine state + CShwSlideshowEngine::TShwState state = iEngine.State(); + // if not paused by user and engine is paused, resume + if( ( !iUserPaused )&& + ( CShwSlideshowEngine::EShwStatePaused == state ) ) + { + iEngine.ResumeL(); + } + } + } + +// ----------------------------------------------------------------------------- +// SwitchToBackgroundL. +// ----------------------------------------------------------------------------- +void CShwSlideShowPauseHandler::SwitchToBackgroundL() + { + TRACER("CShwSlideShowPauseHandler::SwitchToBackgroundL"); + GLX_LOG_INFO( + "CShwSlideShowPauseHandler::SwitchToBackgroundL" ); + // we are now not on foreground + iOnForeground = EFalse; + // get the engine state + CShwSlideshowEngine::TShwState state = iEngine.State(); + // if engine is running + if ( CShwSlideshowEngine::EShwStateRunning == state ) + { + // Calling PauseL on the engine results in the view receiving an + // paused event from engine observer. + iEngine.PauseL(); + } + } + +// ----------------------------------------------------------------------------- +// SwitchToForegroundL. +// ----------------------------------------------------------------------------- +void CShwSlideShowPauseHandler::SwitchToForegroundL() + { + TRACER("CShwSlideShowPauseHandler::SwitchToForegroundL"); + GLX_LOG_INFO( + "CShwSlideShowPauseHandler::SwitchToForegroundL" ); + // we are now on foreground + iOnForeground = ETrue; + // get the engine state + CShwSlideshowEngine::TShwState state = iEngine.State(); + // if we are not paused by user, not in call and engine is paused, resume + if( ( !iUserPaused )&& + ( !iInCall )&& + ( CShwSlideshowEngine::EShwStatePaused == state ) ) + { + iEngine.ResumeL(); + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowpausehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowpausehandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +/* +* 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: The pause handling control for the slideshow + * +*/ + + + + +#ifndef __CSHWSLIDESHOWPAUSEHANDLER_H__ +#define __CSHWSLIDESHOWPAUSEHANDLER_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CShwSlideshowEngine; + +// CLASS DECLARATION + +/** + * CShwSlideShowPauseHandler + * This class handles the different pause related requirements of + * slide show: User pause, Phone call pause, Task away pausing. + * User pause/resume has the highest precedence, phone call is next + * and then task away (switch to background) + * So if the user pauses slideshow and then a phone call starts and + * ends, slide show stays paused. Similarly if slideshow is running + * and gets switched to background and a phone call starts, slide show + * does not continue when switched to foreground unless the phone call + * ends before that. + */ +NONSHARABLE_CLASS( CShwSlideShowPauseHandler ) + : public CBase + { + public: // Constructors and destructor + + /** + * Constructor. + * @param reference to the slide show engine + */ + static CShwSlideShowPauseHandler* NewL( CShwSlideshowEngine& aEngine ); + + /** + * Destructor. + */ + ~CShwSlideShowPauseHandler(); + + private: + + /** + * Constructor + * @param reference to the slide show engine + */ + CShwSlideShowPauseHandler( CShwSlideshowEngine& aEngine ); + + public: // The API + + /** + * Informs the pause handler that user paused slide show + * Engine will always be paused if it was running and + * vice versa, + */ + void UserToggledPauseL(); + + /** + * Informs the pause handler that a phone call has started. + * If engine is running when call starts, if will be paused + */ + void PhoneCallStartedL(); + + /** + * Informs the pause handler that a phone call has ended + * If engine was paused by telephone call we resume slide show + * when call ends + */ + void PhoneCallEndedL(); + + /** + * Informs the pause handler that slide show was switched to background. + * If engine is running when switch occurs, if will be paused + */ + void SwitchToBackgroundL(); + + /** + * Informs the pause handler that slide show was switched to foreground. + * If engine was paused when switch to background occurred, if will be resumed + * unless a phone call is ongoing. + */ + void SwitchToForegroundL(); + + /** + * Informs the pause handler that MSK Preesed when slide show is running. + */ + void ToggleUiControlsVisibiltyL(); + + private: // Implementation + + /// Ref: The slideshow engine + CShwSlideshowEngine& iEngine; + + /// Own: state flag to know if we are in a call + TBool iInCall; + + /// Own: state flag to know when user paused us + TBool iUserPaused; + + /// Own: state flag to know when we are on foreground + TBool iOnForeground; + + }; + +#endif // __CSHWSLIDESHOWPAUSEHANDLER_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowtelephonehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowtelephonehandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2007-2008 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: Telephone call handler +* +*/ + + + +#include "shwslideshowtelephonehandler.h" +#include "shwslideshowengine.h" +#include "shwslideshowpausehandler.h" + +#include +#include +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CShwTelephoneHandler* CShwTelephoneHandler::NewL( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler ) + { + TRACER("CShwTelephoneHandler::NewL"); + GLX_LOG_INFO( "CShwTelephoneHandler::NewL" ); + CShwTelephoneHandler* self = + new( ELeave) CShwTelephoneHandler( aEngine, aPauseHandler ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CShwTelephoneHandler::~CShwTelephoneHandler() + { + TRACER("CShwTelephoneHandler::~CShwTelephoneHandler"); + GLX_LOG_INFO( "CShwTelephoneHandler::~CShwTelephoneHandler" ); + Cancel(); + delete iTelephony; + } + +// ----------------------------------------------------------------------------- +// StartL +// ----------------------------------------------------------------------------- +// +void CShwTelephoneHandler::StartL() + { + TRACER("CShwTelephoneHandler::StartL"); + GLX_LOG_INFO( "CShwTelephoneHandler::StartL" ); + if ( !IsActive() ) + { + // request notification of change in status of the voice line + iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, + iLineStatusPckg ); + // get on with it + SetActive(); + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CShwTelephoneHandler::CShwTelephoneHandler( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler ) + : CActive( CActive::EPriorityStandard ), + iEngine( aEngine ), + iPauseHandler( aPauseHandler ), + iLineStatusPckg( iLineStatus ) + { + TRACER("CShwTelephoneHandler::CShwTelephoneHandler"); + GLX_LOG_INFO( "CShwTelephoneHandler::CShwTelephoneHandler" ); + CActiveScheduler::Add( this ); + // set initial line status + iLineStatus.iStatus = CTelephony::EStatusUnknown; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CShwTelephoneHandler::ConstructL() + { + TRACER("CShwTelephoneHandler::ConstructL"); + GLX_LOG_INFO( "CShwTelephoneHandler::ConstructL" ); + iTelephony = CTelephony::NewL(); + } + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +// +void CShwTelephoneHandler::RunL() + { + TRACER("CShwTelephoneHandler::RunL"); + GLX_LOG_INFO1( "CShwTelephoneHandler::RunL, status = %d", iStatus.Int() ); + + if( iStatus == KErrNone ) + { + // No error + GLX_LOG_INFO1( "Line status = %d", iLineStatus.iStatus ); + // Check the line's status + if ( iLineStatus.iStatus == CTelephony::EStatusAnswering || + iLineStatus.iStatus == CTelephony::EStatusConnecting || + iLineStatus.iStatus == CTelephony::EStatusConnected ) + { + iPauseHandler.PhoneCallStartedL(); + } + else if ( iLineStatus.iStatus == CTelephony::EStatusIdle ) + { + iPauseHandler.PhoneCallEndedL(); + } + + // reissue request for notification + iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, + iLineStatusPckg ); + SetActive(); + } + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CShwTelephoneHandler::DoCancel() + { + TRACER("CShwTelephoneHandler::DoCancel"); + GLX_LOG_INFO( "CShwTelephoneHandler::DoCancel" ); + // Cancel the voice line status requests + if ( iTelephony ) + { + // The return code is ignored as there's no way of reporting it. + iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel ); + } + } +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowtelephonehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowtelephonehandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007-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: Telephone call handler +* +*/ + + + + +#ifndef C_SHWTELEPHONEHANDLER_H +#define C_SHWTELEPHONEHANDLER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CShwSlideshowEngine; +class CShwSlideShowPauseHandler; + +/** + * CShwTelephoneHandler + * + * Telphone call handler + * + * @lib shwslideshowviewplugin.lib + */ +NONSHARABLE_CLASS( CShwTelephoneHandler ) : public CActive + { +public: + /** + * Factory function constructor + * @param aEngine to pause and resume the slideshow + */ + static CShwTelephoneHandler* NewL( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler ); + + /** + * Destructor + */ + ~CShwTelephoneHandler(); + +public: + /** + * Start the handler + */ + void StartL(); + +private: + /** + * Constructor + * @param aEngine to pause and resume the slideshow + */ + CShwTelephoneHandler( + CShwSlideshowEngine& aEngine, + CShwSlideShowPauseHandler& aPauseHandler ); + + /** + * 2nd phase construction + */ + void ConstructL(); + +private: + // from CActive + void RunL(); + void DoCancel(); + +private: + + /// Ref: slide show engine + CShwSlideshowEngine& iEngine; + /// Ref: slide show pause handler + CShwSlideShowPauseHandler& iPauseHandler; + + CTelephony* iTelephony; // owned + + // line status + CTelephony::TCallStatusV1 iLineStatus; // owned + CTelephony::TCallStatusV1Pckg iLineStatusPckg; // owned + }; + +#endif // C_SHWTELEPHONEHANDLER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1296 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Slideshow view +* +*/ + + + + + +// INCLUDE FILES +#include +#include "shwslideshowview.h" + +#include +#include // for access to CEikButtonGroupContainer (from Cba()) +#include // for CompleteWithAppPath +#include +#include + +#include +#include +#include +#include +#include + +//Hg +//#include +#include +#include // for CGlxResourceUtilities +#include // for CGlxResolutionUtility +#include // view's resource +#include // for resource directory path +#include +#include +#include // for CAknKeySoundSystem +#include // for R_AVKON_SILENT_SKEY_LIST +#include +#include +#include +#include "mpxcollectionutility.h" +#include "glxfilterfactory.h" // for TGlxFilterFactory +#include "mglxmedialist.h" +#include "glxuiutility.h" +#include "shwslideshowengine.h" +#include "shweffectinfo.h" +#include "shwslideshowvolumecontrol.h" +#include "shwslideshowbacklighttimer.h" +#include "shwslideshowview.hrh" // for EShwSlideshowCmdContinue +#include "shwslideshowkeyhandler.h" +#include "shwslideshowpausehandler.h" +#include "shwslideshowtelephonehandler.h" +#include "shwcallback.h" +#include "shwsettingsmodel.h" +#include "shwgesturecontrol.h" +#include "shwviewtimer.h" +#include "shwmediakeyshandler.h" +#include +namespace + { + _LIT(KShwSlideshowViewResource,"shwslideshowview.rsc"); + const TInt KShwDefaultDelayMicroSeconds = 5000000; // 5s + const TInt KVolumeControlGroupId = 1; + // Reuse the plug-in's uid + const TInt KViewId = 0x20007199; + //gontrol goup id has to be locally unique + const TInt KShwGestureControlGroupId = 2; + const TInt KGestureControlGroupId = 44; + //This constant is used to calculate the index of the item for which texture has to removed. + //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index); + const TInt KSlideShowIterator = 2; + //Constant which says maximum number of fullscreen textures that we have have at a time. + //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards)) + const TInt KSlideShowTextureOffset = 3; + } +//display screen furniture for KShowForSeconds +const TInt KShowForSeconds = 5; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Default constructor. Inlined to save a few bits of ROM +// --------------------------------------------------------------------------- +// +inline CShwSlideshowView::CShwSlideshowView() : + CGlxViewBase(ETrue) // workaround - force synchronous view activation + { + TRACER("CShwSlideshowView::CShwSlideshowView"); + GLX_LOG_INFO( "CShwSlideshowView::CShwSlideshowView" ); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CShwSlideshowView* CShwSlideshowView::NewLC() + { + TRACER("CShwSlideshowView::NewLC"); + GLX_LOG_INFO( "CShwSlideshowView::NewLC" ); + CShwSlideshowView* self = new ( ELeave ) CShwSlideshowView; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CShwSlideshowView::~CShwSlideshowView() + { + TRACER("CShwSlideshowView::~CShwSlideshowView"); + GLX_LOG_INFO( "CShwSlideshowView::~CShwSlideshowView()" ); + + // delete media list population call back + delete iPopulateListCallBack; + + // delete engine async starter + delete iAsyncCallBack; + + // Cleanup both the lists in case view was not deactivated + if ( iMediaList ) + { + iMediaList->Close(); + } + + if ( iFilteredList ) + { + iFilteredList->Close(); + } + + // Remove the back light timer + delete iBackLightTimer; + + // Delete the control groups + if ( iEnv ) + { + iEnv->DeleteControlGroup( KVolumeControlGroupId ); + iVolumeControlGroup = NULL; + if(iGestureControlGroup) + { + CAlfControl* gesture = (&(iGestureControlGroup->Control(1))); // CGestureControl is 1 + iGestureControlGroup->Remove(gesture); + } + iEnv->DeleteControlGroup( KShwGestureControlGroupId ); + iGestureControlGroup = NULL; + delete iGestureControl; + } + + // Turn back on the keypad tones + AppUi()->KeySounds()->PopContext(); + + // Delete resource file + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); + iResourceOffset = NULL; + } + } + +// ----------------------------------------------------------------------------- +// ShowProgressDialogL. +// ----------------------------------------------------------------------------- +TInt CShwSlideshowView::ShowProgressDialogL() + { + TRACER("CShwSlideshowView::ShowProgressDialogL"); + GLX_LOG_INFO( "CShwSlideshowView::ShowProgressDialogL" ); + + // Set to landscape orientation + // Note that the orientation switch is performed here rather than in the + // view activation to ensure the correct use of the screen furniture layout + iUiUtility->SetAppOrientationL( EGlxOrientationLandscape ); + // Set display background as a solid black colour + iDisplay->SetClearBackgroundL( CAlfDisplay::EClearWithColor ); + + // Setup the progress dialog + iWaitDialog = new ( ELeave ) CAknWaitDialog( + reinterpret_cast< CEikDialog** >( &iWaitDialog ), ETrue ); + iWaitDialog->PrepareLC( R_SHW_WAIT_NOTE ); + // Dialog is non-modal so request dismissal callbacks + iWaitDialog->SetCallback( this ); + // Load string for dialog + HBufC* title = StringLoader::LoadLC( R_SHW_WAIT_DLG_OPENING ); + iWaitDialog->SetTextL( *title ); + CleanupStack::PopAndDestroy( title ); + + // Show the dialog, we show it non blocking so no use for the return value + iWaitDialog->RunLD(); + // set the callback to be engine start + iAsyncCallBack->Set( + TShwCallBack< CShwSlideshowView, StartEngineL >( this ) ); + // if both lists are ready + if( iInputListReady && iPlayListReady ) + { + // make the async callback, this will end up calling StartEngineL() + // in CAsyncCallback::RunL once the scheduler next time runs. + iAsyncCallBack->CallBack(); + } + + // return value needed as this is a TCallBack + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// StartEngineL +// ----------------------------------------------------------------------------- +TInt CShwSlideshowView::StartEngineL() + { + TRACER("CShwSlideshowView::StartEngineL"); + GLX_LOG_INFO( "CShwSlideshowView::StartEngineL" ); + // Check that the list has some items + if( iFilteredList ) + { + TInt filteredCount = iFilteredList->Count(); + TInt inputlistCount = iMediaList->Count(); + if ( ( inputlistCount < 1 )|| + ( filteredCount < 1 ) ) + { + GLX_LOG_INFO2( + "CShwSlideshowView::PopulateListL error, counts: %d, %d", + inputlistCount, filteredCount ); + iEngineStartFailed = ETrue; + // need to dismiss the dialog if it's still there + if( iWaitDialog ) + { + iWaitDialog->ProcessFinishedL(); + } + } + else + { + // The list should now be populated, so set the focus + SetListFocusL(); + // Need to take latest screen size as layout has changed + TRect currentScreen; + TSize screenSize; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen,currentScreen); + screenSize = currentScreen.Size(); + iEngine->StartL( + *iEnv, *iDisplay, *iFilteredList, *this, screenSize ); + } + } + // return value needed as this is a TCallBack + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// PopulateListL +// ----------------------------------------------------------------------------- +TInt CShwSlideshowView::PopulateListL() + { + TRACER("CShwSlideshowView::PopulateListL"); + GLX_LOG_INFO( "CShwSlideshowView::PopulateListL" ); + // Setup a filter given the play direction and the path + CMPXFilter* filter = NULL; + + // take current filter and add the slideshow parameters in it + // If we play forwards, we dont revert the original order and if we + // play backwards we need to just revert the original order + // Note we dont know the original order and cant ask for it as its set by the + // plug-in and never returned to the client side. + + // we need the full path for the filter creation so that the selection can be + // extracted from there + CMPXCollectionPath* fullpath = iMediaList->PathLC(); + // create the filter + filter = TGlxFilterFactory::CreateSlideShowFilterFromExistingFilterL( + iMediaList->Filter(), fullpath, + iPlayDirection); + CleanupStack::PushL( filter ); + + // Use this DLL's uid as the hierarchy id + TGlxHierarchyId hierarchyId = TUid( NShwSlideshow::KEngineDllUid ).iUid; + iFilteredList = MGlxMediaList::InstanceL( *iCollectionPath, hierarchyId, filter ); + iFilteredList->AddMediaListObserverL( this ); + + CleanupStack::PopAndDestroy( filter ); + CleanupStack::PopAndDestroy( fullpath ); + + // return value needed as this is a TCallBack + return KErrNone; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::ConstructL() + { + TRACER("CShwSlideshowView::ConstructL"); + GLX_LOG_INFO( "CShwSlideshowView::ConstructL()" ); + + // Load the view's resources + TFileName resourceFile( KDC_APP_RESOURCE_DIR ); + resourceFile.Append( KShwSlideshowViewResource ); + CGlxResourceUtilities::GetResourceFilenameL( resourceFile ); + iResourceOffset = iCoeEnv->AddResourceFileL( resourceFile ); + + // AknView base construction + BaseConstructL( R_SHW_SLIDESHOW_PLAY_VIEW ); + + // Glx view base construction + ViewBaseConstructL(); + + // Create async engine starter with standard priority + iAsyncCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard ); + + // Create the back light timer + iBackLightTimer = CShwSlideshowBackLightTimer::NewL(); + + iEnv = iUiUtility->Env(); + iDisplay = iUiUtility->Display(); + + // Construct the volume control + iVolumeControl = CShwSlideshowVolumeControl:: + NewL( *iEnv, + *iUiUtility, + KShwDefaultDelayMicroSeconds ); + // Create a control group for the volume control + iVolumeControlGroup = &iEnv->NewControlGroupL( KVolumeControlGroupId ); + // doc says the following takes ownership, but reality is different! + iVolumeControlGroup->AppendL( iVolumeControl ); + + iGestureControlGroup = &iEnv->NewControlGroupL( KShwGestureControlGroupId ); + + // construct the gesture control group + iShwGestureControl = CShwGestureControl::NewL(*iEnv,*iDisplay,*this); + iGestureControlGroup->AppendL( iShwGestureControl ); + + iGestureControl = GestureHelper::CGestureControl::NewLC( + *iShwGestureControl, *iEnv, *iDisplay, KGestureControlGroupId ); + iGestureControlGroup->AppendL( iGestureControl ); + + // doc says the following takes ownership, but reality is different! + + CleanupStack::Pop( iGestureControl ); + // Need a mechanism to distinguish when we receive the MusicVolume + // callback for the first time + iCurrentVolume = -1; + iPopulateListCallBack = new( ELeave ) + CAsyncCallBack( CActive::EPriorityStandard ); + // set the callback for the media list population + iPopulateListCallBack->Set( + TShwCallBack< CShwSlideshowView, PopulateListL >( this ) ); + iMSKPressed = EFalse; + iLSKPressed = EFalse; + + //Get the HgContextUtility instance +// iContextUtility = iUiUtility->ContextUtility(); + + } + +// --------------------------------------------------------------------------- +// From CAknView +// Returns views id. +// --------------------------------------------------------------------------- +// +TUid CShwSlideshowView::Id() const + { + TRACER("CShwSlideshowView::Id()"); + GLX_LOG_INFO( "CShwSlideshowView::Id()" ); + return TUid::Uid( KViewId ); + } + +// --------------------------------------------------------------------------- +// From CAknView +// Foreground event handling function. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleForegroundEventL(TBool aForeground) + { + TRACER("CShwSlideshowView::HandleForegroundEventL"); + GLX_LOG_INFO( "CShwSlideshowView::HandleForegroundEventL()" ); + + if( aForeground ) + { + // we gained the foreground + iPauseHandler->SwitchToForegroundL(); + } + else + { + // Something else has gained the foreground + iPauseHandler->SwitchToBackgroundL(); + } + + CAknView::HandleForegroundEventL(aForeground); + } + +// ----------------------------------------------------------------------------- +// From CGlxViewBase +// DoViewActivateL. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::DoViewActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& aCustomMessage) + { + TRACER("CShwSlideshowView::DoViewActivateL"); + GLX_LOG_INFO( "CShwSlideshowView::DoViewActivateL()" ); + + // remove the status pane + AppUi()->StatusPane()->MakeVisible(EFalse); + + //make the softkeys invisible + AppUi()->Cba()->MakeVisible(EFalse); + + // Hide the application toolbar when slide show is started + if ( AppUi()->PopupToolbar() ) + { + AppUi()->PopupToolbar()->SetToolbarVisibility( EFalse ); + AppUi()->PopupToolbar()->MakeVisible(EFalse); + } + // reset failure flag + iEngineStartFailed = EFalse; + + iHdmiController = CGlxHdmiController::NewL(); + // Engine related construction + // Instantiate the slideshow engine, with this class as its observer + __ASSERT_DEBUG( !iEngine, Panic( EGlxPanicAlreadyInitialised ) ); + iEngine = CShwSlideshowEngine::NewL( *this ); + + // Instantiate the pause handler, it encapsulates the pause rules + __ASSERT_DEBUG( !iPauseHandler, Panic( EGlxPanicAlreadyInitialised ) ); + iPauseHandler = CShwSlideShowPauseHandler::NewL( *iEngine ); + + // Instantiate the key handler, encapsulates all key handling logic + __ASSERT_DEBUG( !iKeyHandler, Panic( EGlxPanicAlreadyInitialised ) ); + iKeyHandler = CShwSlideShowKeyHandler::NewL( *iEngine, *iPauseHandler, + reinterpret_cast(iShwState )); + AppUi()->AddToStackL( iKeyHandler, ECoeStackPriorityDefault, + ECoeStackFlagRefusesFocus ); + + // Create the telephone call handler + __ASSERT_DEBUG( !iTelephoneHandler, Panic( EGlxPanicAlreadyInitialised ) ); + iTelephoneHandler = CShwTelephoneHandler::NewL( *iEngine, *iPauseHandler ); + iTelephoneHandler->StartL(); + + // Extract the media list's path and the playback direction from + // the custom message data + GetPathAndPlaybackDirectionL( aCustomMessage ); + + // Ensure the back light stays on + iBackLightTimer->StartL(); + + // Request asynch callback that will end up in ShowProgressDialogL + // once the active scheduler runs + iAsyncCallBack->Set( + TShwCallBack< CShwSlideshowView, ShowProgressDialogL >( this ) ); + iAsyncCallBack->CallBack(); + + iDisplay->Roster().ShowL( *iGestureControlGroup,KAlfRosterShowAtTop ); + + iTicker = CShwTicker::NewL(*this); + + InitializeShwFurnitureL(); + iUiUtility->Display()->SetVisibleArea(TRect(TPoint(0,0),AlfUtil::ScreenSize())); + } + +// ----------------------------------------------------------------------------- +// From CGlxViewBase +// DoViewDeactivate. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::DoViewDeactivate() + { + TRACER("CShwSlideshowView::DoViewDeactivate"); + GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate()" ); + if (iHdmiController) + { + GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate() - delete hdmicontroller" ); + delete iHdmiController; + iHdmiController = NULL; + } + + //check if we have engine active object starting + if( iPopulateListCallBack->IsActive() ) + { + //cancel the engine start + iPopulateListCallBack->Cancel(); + } + + //check if we have engine active object starting + if( iAsyncCallBack->IsActive() ) + { + //cancel the engine start + iAsyncCallBack->Cancel(); + } + + //Hide the volume control group, iDisplay and iVolumeControlGroup + //are always valid so no need to test for != NULL + iDisplay->Roster().Hide( *iVolumeControlGroup ); + + + //Ensure we revert to a proper background + TRAP_IGNORE( + { + iDisplay->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground ); + } ); + + + //Ensure we don't get any more key events + AppUi()->RemoveFromStack( iKeyHandler ); + delete iKeyHandler; + iKeyHandler = NULL; + + //Stop handling telephone calls + delete iTelephoneHandler; + iTelephoneHandler = NULL; + + //delete the pause handler + //it is used by key and telephone handlers so do this last + delete iPauseHandler; + iPauseHandler = NULL; + + //Cancel the back light timer + iBackLightTimer->Cancel(); + + + //Stop the slideshow! + //NOTE! this needs to be done before the list is closed as the + //destructor removes the engine as medialist observer and also + //removes the contexts from the list + delete iEngine; + iEngine = NULL; + + delete iCollectionPath; + iCollectionPath = NULL; + + //Ensure we don't get any more list callbacks + if( iMediaList ) + { + iMediaList->RemoveMediaListObserver( this ); + //need to close the list + iMediaList->Close(); + //set to NULL to prevent double delete + iMediaList = NULL; + } + //Ensure we don't get any more list callbacks + if ( iFilteredList ) + { + iFilteredList->RemoveMediaListObserver( this ); + //need to also close the list + iFilteredList->Close(); + //set to NULL to prevent double delete + iFilteredList = NULL; + } + iDisplay->Roster().Hide( *iGestureControlGroup ); + + if(iTicker) + { + delete iTicker; + iTicker =NULL; + } + AppUi()->RemoveFromStack( iShwCba ); + delete iShwCba; + iShwCba =NULL; + if(iMediaKeyHandler) + { + delete iMediaKeyHandler; + iMediaKeyHandler = NULL; + } + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleItemAddedL( TInt /*aStartIndex*/, + TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/ ) + { + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleMediaL +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleMediaL( TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleItemRemoved +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleItemRemovedL( TInt /*aStartIndex*/, + TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/ ) + { + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleItemModifiedL. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/ ) + { + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleAttributesAvailableL. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleAttributesAvailableL( + TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, + MGlxMediaList*/* aList*/ ) + { + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleFocusChangedL. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, + TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER("CShwSlideshowView::HandleFocusChangedL()"); + if(iFilteredList) + { + if (iFilteredList->Count() && iHdmiActive) + { + if(iFilteredList->Count() > KSlideShowTextureOffset) + { + RemoveTexture(); + } + SetImage(); + } + } + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleItemSelected. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleItemSelectedL( TInt /*aIndex*/, + TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandleMessageL. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// From MGlxMediaListObserver +// HandlePopulated. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::HandlePopulatedL( MGlxMediaList* aList ) + { + TRACER("CShwSlideshowView::HandlePopulatedL"); + GLX_LOG_INFO( "CShwSlideshowView::HandlePopulatedL" ); + + if( iMediaList == aList ) + { + // input list is ready + iInputListReady = ETrue; + // read the selection and filter + // note that these cannot be read until the list has been populated + // make the async callback, this will end up calling PopulateListL() + // in CAsyncCallback::RunL once the scheduler next time runs. + iPopulateListCallBack->CallBack(); + } + else if( iFilteredList == aList ) + { + // playable list is ready + iPlayListReady = ETrue; + } + + // the filtered list has been populated so start the engine + if( iInputListReady && iPlayListReady ) + { + // make the async callback, this will end up calling StartEngineL() + // in CAsyncCallback::RunL once the scheduler next time runs. + // this is a no-op if the callback is already active + iAsyncCallBack->CallBack(); + } + } + +// --------------------------------------------------------------------------- +// From MShwEngineObserver +// Engine started callback. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::EngineStartedL() + { + TRACER("CShwSlideshowView::EngineStartedL"); + GLX_LOG_INFO( "CShwSlideshowView::EngineStartedL()" ); + + if ( iWaitDialog ) + { + // cancel the progress bar + iWaitDialog->ProcessFinishedL(); + } + iShwState = EShwPlay; + ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE); + ShowShwFurnitureL(); + } + +// --------------------------------------------------------------------------- +// From MShwEngineObserver +// Engine paused callback. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::EnginePausedL() + { + TRACER("CShwSlideshowView::EnginePausedL"); + GLX_LOG_INFO( "CShwSlideshowView::EnginePausedL()" ); + + // Cancel the backlight if it's on + if ( iBackLightTimer->IsRunning() ) + { + iBackLightTimer->Cancel(); + } + + if(!iUiUtility->IsExitingState()) + { + iShwState = EShwPause; + ReplaceCommandSetL(R_SHW_SOFTKEYS_END_CONTINUE,R_SHW_SOFTKEYS_END_PAUSE); + ShowShwFurnitureL(); + } + } + +// --------------------------------------------------------------------------- +// From MShwEngineObserver +// Engine resumed callback. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::EngineResumedL() + { + TRACER("CShwSlideshowView::EngineResumedL"); + GLX_LOG_INFO( "CShwSlideshowView::EngineResumedL" ); + // Re-enable the backlight if it's off + if ( !iBackLightTimer->IsRunning() ) + { + iBackLightTimer->StartL(); + } + iShwState = EShwPlay; + ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_CONTINUE); + ShowShwFurnitureL(); + } +// --------------------------------------------------------------------------- +// From MShwEngineObserver +// Engine LSK Pressed +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::EngineLSKPressedL() + { + TRACER("CShwSlideshowView::EngineLSKPressedL"); + GLX_LOG_INFO( "CShwSlideshowView::EngineLSKPressedL" ); + iLSKPressed = ETrue; + iPauseHandler->UserToggledPauseL(); + } +// --------------------------------------------------------------------------- +// From MShwEngineObserver +// Engine Toggle Ui callback.EngineLSKPressedL +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::EngineToggleUiStateL() + { + TRACER("CShwSlideshowView::EngineToggleUiStateL"); + GLX_LOG_INFO( "CShwSlideshowView::EngineToggleUiStateL" ); + iMSKPressed = ETrue; + if(iShwFurniture == EFurnitureVisible) + { + HideShwFurniture(); + } + else + { + ShowShwFurnitureL(); + } + } + +// --------------------------------------------------------------------------- +// From MShwEngineObserver +// Engine encountered an error and we need to exit. +// --------------------------------------------------------------------------- +void CShwSlideshowView::ErrorDuringSlideshowL() + { + TRACER("CShwSlideshowView::ErrorDuringSlideshowL"); + GLX_LOG_INFO( "CShwSlideshowView::ErrorDuringSlideshowL" ); + iEngineStartFailed = ETrue; + // need to dismiss the dialog if it's still there + if( iWaitDialog ) + { + iWaitDialog->ProcessFinishedL(); + } + else + { + ProcessCommandL( EAknSoftkeyBack ); + } + } + +// ----------------------------------------------------------------------------- +// From MShwMusicObserver +// MusicOn. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::MusicOnL() + { + TRACER("CShwSlideshowView::MusicOnL"); + GLX_LOG_INFO( "CShwSlideshowView::MusicOnL" ); + // Turn on the keypad tones + AppUi()->KeySounds()->PushContextL( R_AVKON_SILENT_SKEY_LIST ); + // if MusicOn leaves, MusicOff will get called + // initialize the medikey control only if music is on. + // delayed initialization intended + // since there is a conflict if slideshow is launched from full screen + iMediaKeyHandler = CShwMediaKeyUtility::NewL(); + } + +// ----------------------------------------------------------------------------- +// From MShwMusicObserver +// MusicOff. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::MusicOff() + { + TRACER("CShwSlideshowView::MusicOff"); + GLX_LOG_INFO( "CShwSlideshowView::MusicOff" ); + // + TInt resource_id = AppUi()->KeySounds()->TopContext(); + if( R_AVKON_SILENT_SKEY_LIST == resource_id ) + { + // Turn off the keypad tones + AppUi()->KeySounds()->PopContext(); + } + + // If it's visible, hide the volume control + iDisplay->Roster().Hide( *iVolumeControlGroup ); + //delete the media key handler + if(iMediaKeyHandler) + { + delete iMediaKeyHandler; + iMediaKeyHandler = NULL; + } + } + +// ----------------------------------------------------------------------------- +// From MShwMusicObserver +// MusicVolume. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::MusicVolumeL(TInt aCurrentVolume, TInt aMaxVolume) + { + TRACER("CShwSlideshowView::MusicVolume"); + GLX_LOG_INFO( "CShwSlideshowView::MusicVolume" ); + if (aCurrentVolume != iCurrentVolume) + { + // Store the changed value + iCurrentVolume = aCurrentVolume; + iVolumeControl->SetVolume(aCurrentVolume, aMaxVolume); + } + // Always show the control even if the volume hasn't changed, e.g. @ 100% + iVolumeControl->RefreshL(); + } + +// ----------------------------------------------------------------------------- +// From MShwMusicObserver +// ErrorWithTrackL. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::ErrorWithTrackL( TInt /*aErrorCode*/ ) + { + TRACER("CShwSlideshowView::ErrorWithTrackL"); + // we dont use the error code as any kind of error with track file + // means we cannot play it. + // set the music to off if there was an error in track (file missing etc) + // this way the user gets notification only once + // ER: EMSR-77PCSJ + CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); + CleanupStack::PushL( shwSettingsMdl ); + shwSettingsMdl->SaveMusicStateL( EFalse ); + CleanupStack::PopAndDestroy( shwSettingsMdl ); + + // Display the error note + HBufC* noteBuf = StringLoader::LoadLC( + R_SHW_QTN_LGAL_NOTE_SLIDESHOW_DEFINE ); + CAknInformationNote* note = new (ELeave) CAknInformationNote; + CleanupStack::Pop( noteBuf ); + note->ExecuteLD( *noteBuf ); + } + +// ----------------------------------------------------------------------------- +// From MProgressDialogCallback +// Gets called when a dialog is dismissed. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::DialogDismissedL( TInt aButtonId ) + { + TRACER("CShwSlideshowView::DialogDismissedL"); + GLX_LOG_INFO( "CShwSlideshowView::DialogDismissedL" ); + if ( iEngineStartFailed || aButtonId == EEikBidCancel ) + { + // Cancel the callback + iAsyncCallBack->Cancel(); + // Send the back command to return to the previous view + ProcessCommandL( EAknSoftkeyBack ); + } + } + +// ----------------------------------------------------------------------------- +// SetupScreenFurnitureL. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::SetupScreenFurnitureL() + { + TRACER("CShwSlideshowView::SetupScreenFurnitureL"); + GLX_LOG_INFO( "CShwSlideshowView::SetupScreenFurnitureL" ); + // Create the soft keys + // Left (bottom in landscape orientation) + HBufC* softKeyTextLeft = StringLoader::LoadLC( R_SHW_SOFTKEY_LEFT ); + // SetSoftKeyL takes ownership of softKeyText + //SetSoftkeyL( EGlxLeftSoftkey, EShwSlideshowCmdContinue, softKeyTextLeft ); + CleanupStack::Pop( softKeyTextLeft ); + // Right (top in landscape orientation) + HBufC* softKeyTextRight = StringLoader::LoadLC( R_SHW_SOFTKEY_RIGHT ); + // SetSoftKeyL takes ownership of softKeyText + //SetSoftkeyL( EGlxRightSoftkey, EAknSoftkeyBack, softKeyTextRight ); + CleanupStack::Pop( softKeyTextRight ); + + } + +// ----------------------------------------------------------------------------- +// GetPathAndPlaybackDirectionL +// ----------------------------------------------------------------------------- +void CShwSlideshowView::GetPathAndPlaybackDirectionL( const TDesC8& aData ) + { + TRACER("CShwSlideshowView::GetPathAndPlaybackDirectionL"); + GLX_LOG_INFO( "CShwSlideshowView::GetPathAndPlaybackDirectionL" ); + // reset state flags for list population + iInputListReady = iPlayListReady = EFalse; + + // Create a copy of the media list using the path and the play direction + RDesReadStream stream( aData ); + CleanupClosePushL( stream ); + stream.ReadInt32L(); + + + //Get the play direction. + + CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); + CleanupStack::PushL( shwSettingsMdl ); + iPlayDirection = static_cast< NShwSlideshow:: + TPlayDirection>(shwSettingsMdl->PlayOrderL()); + CleanupStack::PopAndDestroy( shwSettingsMdl ); + + + + // Retrieve the path + iCollectionPath = CMPXCollectionPath::NewL(); + iCollectionPath->InternalizeL( stream ); + // Create the media list from the path + iMediaList = MGlxMediaList::InstanceL( *iCollectionPath ); + // the list might be already populated + if( iMediaList->IsPopulated() ) + { + iInputListReady = ETrue; + // list is ready so read the selection and filter already now + // need to do this while on DoViewActivateL as the previous view + // may loose the selection while it is closing + PopulateListL(); + } + else + { + // add us as an observer for the input list as well + // we cannot read the path and filter before the list is populated + iMediaList->AddMediaListObserverL( this ); + } + + CleanupStack::PopAndDestroy( &stream ); + } + +// ----------------------------------------------------------------------------- +// SetListFocusL. +// ----------------------------------------------------------------------------- +void CShwSlideshowView::SetListFocusL() + { + TRACER("CShwSlideshowView::SetListFocusL"); + GLX_LOG_INFO( "CShwSlideshowView::SetListFocusL" ); + // Ensure that we start the slideshow from the correct image index: + // if there are any selected images we always start from the first one, + // otherwise we try to use the item with focus from the unfiltered list + // so long as it hasn't been filtered out, in which case we use the first image. + TInt selectionCount = iCollectionPath->Selection().Count(); + TInt focusIndex = 0; + if ( selectionCount == 0 ) + { + // nothing selected, so determine which item has focus in the original list + focusIndex = iMediaList->FocusIndex(); + const TGlxMedia& mediaItem = iMediaList->Item( focusIndex ); + // is this item in the filtered list? + TGlxIdSpaceId spaceId = iMediaList->IdSpaceId( focusIndex ); + focusIndex = iFilteredList->Index( spaceId, mediaItem.Id() ); + if ( focusIndex == KErrNotFound ) + { + // it's been filtered out so just use the first item + focusIndex = 0; + } + } + iFilteredList->SetFocusL( NGlxListDefs::EAbsolute, focusIndex ); + SetImage(); + iHdmiActive = ETrue; +// iContextUtility->PublishPhotoContextL(item.Uri()); + } + + +// ----------------------------------------------------------------------------- +// HandleTickL. +// act on timer expiry +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleTickL() + { + TRACER("CShwSlideshowView::HandleTickL"); + GLX_LOG_INFO( "CShwSlideshowView::HandleTickL" ); + if(iShwFurniture != EFurnitureVisible) + { + ShowShwFurnitureL(); + } + else + { + HideShwFurniture(); + } + } + +// ----------------------------------------------------------------------------- +// HandleTickCancelled. +// act on timer cancelled +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleTickCancelled() + { + + } + +// ----------------------------------------------------------------------------- +// HandleShwGestureEventL. +// act on gestures +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::HandleShwGestureEventL(MShwGestureObserver::TShwGestureEventType aType) + { + TRACER("CShwSlideshowView::HandleShwGestureEventL"); + GLX_LOG_INFO( "CShwSlideshowView::HandleShwGestureEventL" ); + iTicker->CancelTicking(); + switch(aType) + { + case ETapEvent: + { + if(iShwFurniture == EFurnitureVisible) + { + HideShwFurniture(); + } + else + { + ShowShwFurnitureL(); + } + break; + } + case ESwipeLeft: + { + iEngine->NextItemL(); + break; + } + case ESwipeRight: + { + iEngine->PreviousItemL(); + break; + } + default: + { + break; + } + } + } +// ----------------------------------------------------------------------------- +// InitializeShwFurnitureL. +// set sof keys and the volume slider +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::InitializeShwFurnitureL() + { + TRACER("CShwSlideshowView::InitializeShwFurnitureL"); + GLX_LOG_INFO( "CShwSlideshowView::InitializeShwFurnitureL" ); + // initialize softkeys + InitializeCbaL(); + } + +// ----------------------------------------------------------------------------- +// InitializeCbaL. +// set sof keys +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::InitializeCbaL() + { + TRACER("CShwSlideshowView::InitializeCbaL"); + GLX_LOG_INFO( "CShwSlideshowView::InitializeCbaL" ); + // initialize with the end-pause command set as that is the one + // we are supposed to show immediately on slideshow play + // orientation: set to Vertical as slide show is always intended to + // run in landscape mode + iShwCba = CEikButtonGroupContainer::NewL( + CEikButtonGroupContainer::ECba, + CEikButtonGroupContainer::EVertical, + this, R_SHW_SOFTKEYS_END_PAUSE ); + iShwCba->MakeVisible(EFalse); + //set the current active command set + ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE); + } + +// ----------------------------------------------------------------------------- +// ReplaceCommandSetL. +// replaces a commandset with a new one +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::ReplaceCommandSetL(TInt aNewComandId, TInt aOldCommandSet) + { + TRACER("CShwSlideshowView::ReplaceCommandSetL"); + GLX_LOG_INFO( "CShwSlideshowView::ReplaceCommandSetL" ); + //find and remove the command set + TInt pos = iShwCba->PositionById( aOldCommandSet ); + if( pos != KErrNotFound ) + { + iShwCba->RemoveCommandFromStack( pos, aOldCommandSet ); + } + // set the new command set + iShwCba->SetCommandSetL( aNewComandId ); + // keep the current active command set + iCurrentActiveCommandSet = aNewComandId; + } + + +// ----------------------------------------------------------------------------- +// HideShwFurnitureL. +// hide softkeys and the volume slider +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::HideShwFurniture() + { + TRACER("CShwSlideshowView::HideShwFurnitureL"); + GLX_LOG_INFO( "CShwSlideshowView::HideShwFurnitureL" ); + iTicker->CancelTicking(); + iShwCba->MakeVisible(EFalse); + iShwCba->DrawNow(); + if(iMediaKeyHandler) + { + iVolumeControl->Hide(); + } + iShwFurniture = EFurnitureHidden; + + } + +// ----------------------------------------------------------------------------- +// ShowShwFurnitureL. +// show softkeys and the volume slider +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::ShowShwFurnitureL() + { + TRACER("CShwSlideshowView::ShowShwFurnitureL"); + GLX_LOG_INFO( "CShwSlideshowView::ShowShwFurnitureL" ); + iTicker->CancelTicking(); + iShwCba->MakeVisible(ETrue); + iShwCba->DrawNow(); + if(iMediaKeyHandler) + { + iVolumeControl->ShowControlL(); + } + iShwFurniture = EFurnitureVisible; + //start the timer to keep the up the screen furniture for 5 seconds + iTicker->StartTicking(KShowForSeconds); + } + +// ----------------------------------------------------------------------------- +// ProcessCommandL. +// handle softkey events +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::ProcessCommandL(TInt aCommandId) + { + TRACER("CShwSlideshowView::ProcessCommandL"); + GLX_LOG_INFO( "CShwSlideshowView::ProcessCommandL" ); + switch(aCommandId) + { + case EShwSlideshowCmdEnd: + { + iShwState = EShwExiting; + aCommandId = EAknSoftkeyBack; + iDisplay->Roster().Hide( *iGestureControlGroup ); + break; + } + //When user presses MSK or LSK this cmd will Generated + case EShwSlideshowCmdPause: + case EShwSlideshowCmdContinue: + { + // If MSK preesed to toggle visibility of softekey + if(iMSKPressed) + { + iMSKPressed = EFalse; + } + else if(iLSKPressed) + { + iLSKPressed = EFalse;// Already Handlled + } + else + { + iPauseHandler->UserToggledPauseL(); + } + break; + } + + default: + { + break; + } + } + CGlxViewBase::ProcessCommandL(aCommandId); + } +// ----------------------------------------------------------------------------- +// SetImage. +// To set Image to external display if HDmi connected +// ----------------------------------------------------------------------------- +// +void CShwSlideshowView::SetImage() + { + TRACER("CShwSlideshowView::SetImage"); + TGlxMedia item = iFilteredList->Item( iFilteredList->FocusIndex() ); + TInt frameCount(0); + TSize orignalSize; + TBool aFramesPresent = item.GetFrameCount(frameCount); + TBool adimension = item.GetDimensions(orignalSize); + iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount); + } +// --------------------------------------------------------------------------- +// +// Gets the index of the item for which the texture has to be removed +// --------------------------------------------------------------------------- +// +TInt CShwSlideshowView::GetIndexToBeRemoved() + { + TRACER("CShwSlideshowView::GetIndexToBeRemoved"); + TInt indextoberemoved; + TInt count = iFilteredList->Count(); + TInt focusIndex = iFilteredList->FocusIndex(); + if(iPlayDirection == NShwSlideshow::EPlayForwards) + { + indextoberemoved = focusIndex-KSlideShowIterator; + if(indextoberemoved < 0) + { + indextoberemoved = count+indextoberemoved; + } + } + else + { + indextoberemoved = focusIndex+KSlideShowIterator; + if(indextoberemoved > count-1) + { + indextoberemoved = indextoberemoved-count; + } + } + GLX_LOG_INFO1("CShwSlideshowView::GetIndexToBeRemoved Index to be removed is %d",indextoberemoved); + return indextoberemoved; + } +// --------------------------------------------------------------------------- +// +// Remove the texture on every swipe while HDMI is connected. +// --------------------------------------------------------------------------- +// +void CShwSlideshowView::RemoveTexture() + { + TRACER("CShwSlideshowView::RemoveTexture"); + const TGlxMedia& item = iFilteredList->Item(GetIndexToBeRemoved()); + iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Full screen view plugin +* +*/ + + + + + +// INCLUDE FILES +#include "shwslideshowviewplugin.h" + +#include +#include +#include + +#include "shwslideshowview.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CShwSlideshowViewPlugin::CShwSlideshowViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CShwSlideshowViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CShwSlideshowViewPlugin* CShwSlideshowViewPlugin::NewL() + { + TRACER("CShwSlideshowViewPlugin::NewL"); + GLX_LOG_INFO("CShwSlideshowViewPlugin::NewL" ); + CShwSlideshowViewPlugin* self = new ( ELeave ) CShwSlideshowViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CShwSlideshowViewPlugin::~CShwSlideshowViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// From CMPXAknViewPlugin +// Construct Avkon view. +// --------------------------------------------------------------------------- +// +CAknView* CShwSlideshowViewPlugin::ConstructViewLC() + { + TRACER("CShwSlideshowViewPlugin::ConstructViewLC"); + GLX_LOG_INFO("CShwSlideshowViewPlugin::ConstructViewLC" ); + CShwSlideshowView* view = CShwSlideshowView::NewLC(); + + // add the back command handler to get us to previous view + view->AddCommandHandlerL( + CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL( ) ); + + return view; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow view plugin definition. +* +*/ + + + + + +#ifndef C_SHWSLIDESHOWVIEWPLUGIN_H +#define C_SHWSLIDESHOWVIEWPLUGIN_H + + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @internal reviewed 07/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CShwSlideshowViewPlugin ) : public CMPXAknViewPlugin + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 // @todo + * @return Pointer to newly created object. + */ + static CShwSlideshowViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CShwSlideshowViewPlugin(); + +private: + + /** + * From CMPXAknViewPlugin + * Construct Avkon view. + * + * @return Pointer to a newly created Avkon view. + */ + CAknView* ConstructViewLC(); + +private: + + /** + * C++ default constructor. + */ + CShwSlideshowViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_SHWSLIDESHOWVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowviewpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowviewpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007-2008 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: Standard proxy of the ECOM plugin +* +*/ + + + + + +// INCLUDE FILES +#include +#include +#include +#include +#include "shwslideshowviewplugin.h" + +#if ( !defined IMPLEMENTATION_PROXY_ENTRY ) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) } +#endif + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// The list of implementations +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( KShwSlideshowViewImplementationId, + CShwSlideshowViewPlugin::NewL ) + }; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + TRACER(" TImplementationProxy* ImplementationGroupProxy"); + GLX_LOG_INFO(" TImplementationProxy* ImplementationGroupProxy" ); + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowvolumecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowvolumecontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,461 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Volume control implementation +* +*/ + + + + +// INCLUDE FILES +#include "shwslideshowvolumecontrol.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include // skins +#include +#include +#include // for CGlxResourceUtilities + +#include +#include + +#include +#include +#include + +#include "glxuiutility.h" +#include "glxtexturemanager.h" +#include "shwcallback.h" + +// CONSTANTS +namespace + { + const TInt KShwVolumeControlXOffset = 0; + _LIT( KIconsFilename, "glxicons.mif" ); + const TInt KShwVolumeControlWidthScaleFactor = 2; + const TInt KShwVolumeMaxPercent = 100; + const TInt KShwVolumeTextMaxLineCount = 1; + const TReal KControlWidthMultiplier = 0.2; + const TReal KControlHeightMultiplier = 0.12; + const TReal KOpacityOpaque = 1.0; + const TReal KHalfOpacityOpaque = 0.4; + const TReal KOpacityTransperent = 0.0; + const TInt KValueGridCols = 2; + const TInt KValueGridRows = 1; + } + +//! NOTE : This implementation does not go with the current Slide Show UI Spec 1.1 +// UI specs need to be updated and a fine print needs to pe prepared about the +// LAF of this control +// In that case the visual positioning can be adjusted by paddin and giving weights + +// ======== MEMBER FUNCTIONS ======== +// --------------------------------------------------------------------------- +// CShwSlideshowVolumeControl() +// --------------------------------------------------------------------------- +inline CShwSlideshowVolumeControl::CShwSlideshowVolumeControl( CAlfEnv& aEnv, + CGlxUiUtility& aUtility, TTimeIntervalMicroSeconds32 aInterval) + : iUtility(aUtility), iInterval(aInterval),iAlfEnv(aEnv) + { + } + +// --------------------------------------------------------------------------- +// ~CShwSlideshowVolumeControl +// --------------------------------------------------------------------------- +CShwSlideshowVolumeControl::~CShwSlideshowVolumeControl() + { + TRACER("CShwSlideshowVolumeControl::~CShwSlideshowVolumeControl"); + GLX_LOG_INFO("CShwSlideshowVolumeControl::~CShwSlideshowVolumeControl" ); + // visuals + if (iMainVisual) + { + iMainVisual->RemoveAndDestroyAllD(); + iMainVisual = NULL; + } + // timer + if ( iTimer ) + { + iTimer->Cancel(); + } + delete iTimer; + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +CShwSlideshowVolumeControl* CShwSlideshowVolumeControl::NewL( + CAlfEnv& aEnv, + CGlxUiUtility& aUtility, + TTimeIntervalMicroSeconds32 aInterval) + { + TRACER("CShwSlideshowVolumeControl::NewL"); + GLX_LOG_INFO("CShwSlideshowVolumeControl::NewL" ); + CShwSlideshowVolumeControl* self = new( ELeave ) + CShwSlideshowVolumeControl( aEnv, aUtility, aInterval ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::ConstructL() + { + TRACER("CShwSlideshowVolumeControl::ConstructL"); + GLX_LOG_INFO("CShwSlideshowVolumeControl::ConstructL" ); + // Construct the base class. + CAlfControl::ConstructL(iAlfEnv); + + //----------------------- LAYOUT HIERARCHY ------------------------------- + // + // ->iBackgroundImageVisual + // | + // | ->iSpeakerImageVisual + // | | + // iMainVisual-->iVisualDeck ->iValueGridVisual-> + // | | + // | ->iPercentTextVisual + // | + // ->iMuteImageVisual + // + //------------------------------------------------------------------------- + + iMainVisual = CAlfAnchorLayout::AddNewL(*this); + + iVisualDeck = CAlfDeckLayout::AddNewL(*this,iMainVisual); + + iValueGridVisual = CAlfGridLayout::AddNewL(*this,KValueGridCols, + KValueGridRows,iVisualDeck); + + // The visual elements of the control + iBackgroundImageVisual = CAlfImageVisual::AddNewL(*this,iVisualDeck); + iMuteImageVisual = CAlfImageVisual::AddNewL(*this,iVisualDeck); + iSpeakerImageVisual = CAlfImageVisual::AddNewL(*this,iValueGridVisual); + iPercentTextVisual = CAlfTextVisual::AddNewL(*this,iValueGridVisual); + + // BackGround Visual + iBackgroundImageVisual->EnableBrushesL(); + iBackgroundImageVisual->SetOpacity( KHalfOpacityOpaque ); + + // Get the icon file + TFileName mifFile( KDC_APP_BITMAP_DIR ); + mifFile.Append( KIconsFilename ); + User::LeaveIfError( CompleteWithAppPath( mifFile ) ); + // Get the texture manager + CGlxTextureManager& textureMgr = iUtility.GlxTextureManager(); + // Load the background texture + + // Below given icon ID is to be changed once the Capped_element Icon + // is available in the build + CAlfTexture& backgroundTexture = textureMgr.CreateIconTextureL + ( EMbmGlxiconsQgn_graf_adapt_search_bg, mifFile ); + + // apply an image brush to the visual + iBrush = CAlfImageBrush::NewL(iAlfEnv, TAlfImage( backgroundTexture ) ); + iBackgroundImageVisual->Brushes()->AppendL( iBrush, EAlfHasOwnership ); + iBackgroundImageVisual->SetScaleMode( CAlfImageVisual::EScaleFitInside ); + // Muted visual + CAlfTexture& textureMuted = iUtility.GlxTextureManager().CreateIconTextureL + ( EMbmGlxiconsQgn_indi_mup_speaker_muted, mifFile ); + iMuteImageVisual->SetImage( textureMuted ); + iMuteImageVisual->SetScaleMode( CAlfImageVisual::EScaleFitInside ); + + // Speaker visual + CAlfTexture& textureSpkr = iUtility.GlxTextureManager().CreateIconTextureL + ( EMbmGlxiconsQgn_indi_mup_speaker, mifFile ); + iSpeakerImageVisual->SetImage( textureSpkr ); + iSpeakerImageVisual->SetScaleMode( CAlfImageVisual::EScaleFitInside ); + + //hide the volume level visualation by default + iMainVisual->SetOpacity(KOpacityTransperent); + + // Only create the timer if an interval's been specified - + // default is to not use one. + if ( iInterval.Int() != 0 ) + { + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + } + } + +// --------------------------------------------------------------------------- +// SetVolume +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::SetVolume(TInt aVolume, TInt aMaxVolume) + { + TRACER("CShwSlideshowVolumeControl::SetVolume"); + // Only allow positive values and + // ensure that aVolume never exceeds aMaxVolume + if ( aMaxVolume >= 0 && aVolume >= 0 && aVolume <= aMaxVolume ) + { + iVolume = aVolume; + iMaxVolume = aMaxVolume; + } + } + +// --------------------------------------------------------------------------- +// Refresh +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::RefreshL() + { + TRACER("CShwSlideshowVolumeControl::RefreshL"); + if( ShowControlL() ) + { + if ( iTimer ) + { + // Restart the timer + iTimer->Cancel(); + iTimer->Start( iInterval, iInterval, + TShwCallBack< CShwSlideshowVolumeControl, TimerCallback> + ( this ) ); + } + } + } + +// --------------------------------------------------------------------------- +// Hide +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::Hide() + { + TRACER("CShwSlideshowVolumeControl::Hide"); + // Hide our self + CAlfDisplay* display = iUtility.Display(); + CAlfControlGroup* group = ControlGroup(); + + if ( display && group ) + { + CAlfRoster& roster = display->Roster(); + roster.Hide( *group ); + } + } +// --------------------------------------------------------------------------- +// ShowControlL +// --------------------------------------------------------------------------- +TBool CShwSlideshowVolumeControl::ShowControlL() + { + TRACER("CShwSlideshowVolumeControl::Refresh"); + TBool retVal = EFalse; + // Hide and show our self + CAlfDisplay* display = iUtility.Display(); + CAlfControlGroup* group = ControlGroup(); + + if ( display && group ) + { + CAlfRoster& roster = display->Roster(); + roster.Hide( *group ); + roster.ShowL( *group, KAlfRosterShowAtTop ); + retVal = ETrue; + } + return retVal; + } + +// --------------------------------------------------------------------------- +// TimerCallback +// --------------------------------------------------------------------------- +TInt CShwSlideshowVolumeControl::TimerCallback() + { + TRACER("CShwSlideshowVolumeControl::TimerCallback"); + GLX_LOG_ENTRY_EXIT( "CShwSlideshowVolumeControl::TimerCallback" ); + // Timed out so hide ourself + Hide(); + if ( iTimer ) + { + // Cancel the timer + iTimer->Cancel(); + } + return 0; + } + +// --------------------------------------------------------------------------- +// NotifyControlVisibility +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::NotifyControlVisibility( TBool aIsVisible, + CAlfDisplay& aDisplay ) + { + TRACER("CShwSlideshowVolumeControl::NotifyControlVisibility"); + GLX_LOG_ENTRY_EXIT + ( "CShwSlideshowVolumeControl::NotifyControlVisibility" ); + GLX_LOG_INFO1 + ( "CShwSlideshowVolumeControl, is visible = %d", aIsVisible ); + if ( !aIsVisible ) + { + RemoveLayoutVisuals(); + RemoveControlVisuals(); + } + else + { + TRAP_IGNORE( SetAndLayoutVisualsL() ); + } + } + +// --------------------------------------------------------------------------- +// RemoveLayoutVisuals +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::RemoveLayoutVisuals() + { + TRACER("CShwSlideshowVolumeControl::RemoveLayoutVisuals"); + GLX_LOG_ENTRY_EXIT( "CShwSlideshowVolumeControl::RemoveLayoutVisuals" ); + //not required for now + } + +// --------------------------------------------------------------------------- +// RemoveControlVisuals +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::RemoveControlVisuals() + { + TRACER("CShwSlideshowVolumeControl::RemoveControlVisuals"); + GLX_LOG_ENTRY_EXIT( "CShwSlideshowVolumeControl::RemoveControlVisuals" ); + // Remove the visuals visibility + iMainVisual->SetOpacity(KOpacityTransperent); + } + +// --------------------------------------------------------------------------- +// SetAndLayoutVisualsL +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::SetAndLayoutVisualsL() + { + TRACER("CShwSlideshowVolumeControl::SetAndLayoutVisualsL"); + GLX_LOG_ENTRY_EXIT( "CShwSlideshowVolumeControl::SetAndLayoutVisualsL" ); + + iMainVisual->SetFlag(EAlfVisualFlagManualSize); + iMainVisual->SetFlag(EAlfVisualFlagManualPosition); + //calculate control size + iControlSize = iUtility.DisplaySize(); + iControlSize.iHeight *= KControlHeightMultiplier; + iControlSize.iWidth *= KControlWidthMultiplier; + //set the control size + iMainVisual->SetSize(iControlSize); + + //calculate the control position + TInt xPos = ( iUtility.DisplaySize().iWidth - iControlSize.iWidth ) + / KShwVolumeControlWidthScaleFactor; + TAlfRealPoint pos( xPos, KShwVolumeControlXOffset ); + iMainVisual->SetPos(pos); + + //set the anchors + User::LeaveIfError( iMainVisual->SetRelativeAnchorRect( + 0, EAlfAnchorOriginLeft, EAlfAnchorOriginTop, TAlfRealPoint(), + EAlfAnchorOriginRight, EAlfAnchorOriginBottom, TAlfRealPoint() ) ); + //update the child visuals + iMainVisual->UpdateChildrenLayout(); + iVisualDeck->UpdateChildrenLayout(); + iValueGridVisual->UpdateChildrenLayout(); + + // Other visuals' layout depends on the volume + TInt volume = CurrentVolumeAsPercentage(); + + if (volume == 0) + { + // volume = 0% + // show muted icon (no %age value) + SetMuteVisualVisibility(); + } + else + { + // 0 < volume <= 100% + // show speaker and %age + SetValueVisualVisibilityL( volume ); + } + } + +// --------------------------------------------------------------------------- +// SetMuteVisualVisibility +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::SetMuteVisualVisibility() + { + TRACER("CShwSlideshowVolumeControl::SetMuteVisualVisibilitys"); + GLX_LOG_ENTRY_EXIT( "CShwSlideshowVolumeControl::SetMuteVisualVisibility" ); + + // set the mute visual's visibility to 1 and the value visual to 0 + iValueGridVisual->SetOpacity(KOpacityTransperent); + iMuteImageVisual->SetOpacity(KOpacityOpaque); + iMainVisual->SetOpacity(KOpacityOpaque); + } + +// --------------------------------------------------------------------------- +// SetValueVisualVisibilityL +// --------------------------------------------------------------------------- +void CShwSlideshowVolumeControl::SetValueVisualVisibilityL(TInt aVolume) + { + TRACER("CShwSlideshowVolumeControl::SetValueVisualVisibilityL"); + GLX_LOG_ENTRY_EXIT( "CShwSlideshowVolumeControl::SetValueVisualVisibilityL" ); + + // update the percentage visual + iPercentTextVisual->SetStyle( EAlfTextStyleSmall, EAlfBackgroundTypeDark ); + iPercentTextVisual->SetMaxLineCount( KShwVolumeTextMaxLineCount ); + iPercentTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); + + // Load the localised string + HBufC* text = StringLoader::LoadLC( R_SHW_VOLUME_PERCENTAGE, aVolume ); + TPtr ptr = text->Des(); + AknTextUtils::LanguageSpecificNumberConversion( ptr ); + + iPercentTextVisual->SetTextL( *text ); + iPercentTextVisual->SetColor(KRgbBlack); + + CleanupStack::PopAndDestroy( text ); + + iPercentTextVisual->EnableShadow(EFalse); + iPercentTextVisual->MoveToFront(); + + // set the value grid visual's visibility to 1 and the mute visual to 0 + iMuteImageVisual->SetOpacity(KOpacityTransperent); + iValueGridVisual->SetOpacity(KOpacityOpaque); + // Text and speaker icon should come top on background + // so making first in layout's visual list. + iValueGridVisual->MoveToFront(); + iMainVisual->SetOpacity(KOpacityOpaque); + } + +// --------------------------------------------------------------------------- +// CurrentVolumeAsPercentage() +// --------------------------------------------------------------------------- +TInt CShwSlideshowVolumeControl::CurrentVolumeAsPercentage() + { + TRACER("CShwSlideshowVolumeControl::CurrentVolumeAsPercentage"); + GLX_LOG_ENTRY_EXIT("CShwSlideshowVolumeControl::CurrentVolumeAsPercentage"); + TInt retVal = iVolume; + + // guard against any undefined numbers + if ( iVolume > 0 && iMaxVolume > 0 ) + { + TReal numerator( iVolume ); + TReal denominator( iMaxVolume ); + TReal working = ( numerator / denominator ) * KShwVolumeMaxPercent; + retVal = TInt( working ); + } + else if ( iVolume == iMaxVolume ) + { + retVal = KShwVolumeMaxPercent; + } + return retVal; + } +// End of File + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwslideshowvolumecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwslideshowvolumecontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2007-2008 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: Slideshow view volume control. +* +*/ + + + + + +#ifndef C_SHWSLIDESHOWVOLUMECONTROL_H +#define C_SHWSLIDESHOWVOLUMECONTROL_H + + +// INCLUDES +#include + +// FORWARD DECLARATION +class CAlfImageVisual; +class CAlfTextVisual; +class CFbsBitmap; +class CGlxUiUtility; + +class CAlfAnchorLayout; +class CAlfBorderBrush; +class CAlfLineVisual; +class CAlfCurvePathLayout; +class CShwSlideshowVolumeControl; +class CAlfImageBrush; +class CAlfGridLayout; +class CAlfDeckLayout; +class CAlfAnchorLayout; + +// CLASS DECLARATION +/** + * Volume control declaration. + * @internal reviewed 07/06/2007 by Kimmo Hoikka + */ +// --------------------------------------------------------------------------- +// CShwSlideshowVolumeControl declaration +// --------------------------------------------------------------------------- +NONSHARABLE_CLASS( CShwSlideshowVolumeControl ) : public CAlfControl + { +public: + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + static CShwSlideshowVolumeControl* NewL( + CAlfEnv& aEnv, + CGlxUiUtility& aUtility, + TTimeIntervalMicroSeconds32 aInterval = 0); + + /** + * Destructor. + */ + virtual ~CShwSlideshowVolumeControl(); + + /** + * Called when the volume is changed. + * @param aVolume The new volume. + * @param aMaxVolume The maximum volume. + */ + void SetVolume(TInt aVolume, TInt aMaxVolume); + + /** + * Notifies the control that its visible has been changed on a display. + * This is the earliest time when the control knows the dimensions of + * the display it is being shown on. + * + * @param aIsVisible ETrue, if the control is now visible on the + * display. EFalse, if the control is about to the hidden + * on the display. + * @param aDisplay The display on which the control's visibility + * is changing. + * @see CHuiControl + */ + void NotifyControlVisibility(TBool aIsVisible, CAlfDisplay& aDisplay); + + /** + * Called when the control should be redrawn, + * e.g. after a change in volume. + */ + void RefreshL(); + + /** + * Called when the control should be hidden, + * e.g. after a change in volume. + */ + void Hide(); + + /** + * Called when the control should be shown. + * e.g. Key press and tap event + */ + TBool ShowControlL(); + + /** + * Method timer calls after time out. + */ + TInt TimerCallback(); + +private: + + /** + * C++ default constructor. + */ + CShwSlideshowVolumeControl( CAlfEnv& aEnv, + CGlxUiUtility& aUtility, + TTimeIntervalMicroSeconds32 aInterval); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( ); + + /** + * Helper function to retrieve and position the control's visuals + */ + void SetAndLayoutVisualsL(); + + /** + * Helper function to convert the current volume to a percentage + */ + TInt CurrentVolumeAsPercentage(); + + /** + * Helper function to setup the visuals when volume is muted + */ + void SetMuteVisualVisibility(); + + /** + * Helper function to setup the visuals when volume is + * neither muted nor maximum + */ + void SetValueVisualVisibilityL(TInt aVolume); + + /** + * Helper function to setup the visuals when volume is maximum + */ + void CreateFullVolumeVisualsL(TInt aVolume); + + /** + * Helper function to remove the visuals from the layout + */ + void RemoveLayoutVisuals(); + + /** + * Helper function to remove the visuals from the layout + */ + void RemoveControlVisuals(); + +private: + + CGlxUiUtility& iUtility; // not owned + + /** main parent layout*/ + CAlfAnchorLayout* iMainVisual; + + /* deck layout holds the backgroung visual, mute visual and the value grid */ + CAlfDeckLayout* iVisualDeck; + + /**holds the speaker icon and the percentage text*/ + CAlfGridLayout* iValueGridVisual; + + CAlfImageBrush* iBrush; // owned + + // The visual elements of the control + CAlfImageVisual* iBackgroundImageVisual; // owned + CAlfImageVisual* iMuteImageVisual; // owned + CAlfImageVisual* iSpeakerImageVisual; // owned + CAlfTextVisual* iPercentTextVisual; // owned + + TInt iVolume; // owned + TInt iMaxVolume; //owned + + CPeriodic* iTimer; // owned + TTimeIntervalMicroSeconds32 iInterval; // owned + + TSize iControlSize; // owned + CAlfEnv& iAlfEnv; //not owned + }; + +#endif // C_SHWSLIDESHOWVOLUMECONTROL_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwtickobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwtickobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* 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: The pause handling control for the slideshow + * +*/ + + + + +#ifndef SHWTICKOBSERVER_H +#define SHWTICKOBSERVER_H + + +#include + + +class MShwTickObserver + { + + public: + + virtual void HandleTickL() = 0; + virtual void HandleTickCancelled() = 0; + + }; + +#endif//SHWTICKOBSERVER_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwviewtimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwviewtimer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2007-2008 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: The pause handling control for the slideshow + * +*/ + + + +#include +#include +#include "shwviewtimer.h" +#include "shwtickobserver.h" + +//for converting values in second to microsecond +const TInt KMicroMultiplier = 1000000; + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +CShwTicker* CShwTicker::NewL(MShwTickObserver& aObserver) + { + TRACER("CShwTicker::NewL"); + GLX_LOG_INFO("CShwTicker::NewL"); + CShwTicker* self = new(ELeave) CShwTicker(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +void CShwTicker::StartTicking(TInt aAfter) + { + TRACER("CShwTicker::StartTicking"); + GLX_LOG_INFO("CShwTicker::StartTicking"); + Cancel(); + iTimer.After( iStatus,(aAfter * KMicroMultiplier) ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +void CShwTicker::CancelTicking() + { + TRACER("CShwTicker::CancelTicking"); + GLX_LOG_INFO("CShwTicker::CancelTicking"); + Cancel(); + iObserver.HandleTickCancelled(); + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +void CShwTicker::RunL() + { + TRACER("CShwTicker::RunL"); + GLX_LOG_INFO("CShwTicker::RunL"); + iObserver.HandleTickL(); + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +void CShwTicker::DoCancel() + { + TRACER("CShwTicker::DoCancel"); + GLX_LOG_INFO("CShwTicker::DoCancel"); + //Cancel the RTimer + iTimer.Cancel(); + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +void CShwTicker::ConstructL() + { + TRACER("CShwTicker::ConstructL"); + GLX_LOG_INFO("CShwTicker::ConstructL"); + iTimer.CreateLocal(); + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +CShwTicker::CShwTicker(MShwTickObserver& aObserver) : CActive(EPriorityStandard) , + iObserver(aObserver) + + { + TRACER("CShwTicker::CShwTicker"); + GLX_LOG_INFO("CShwTicker::CShwTicker"); + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// HandleGestureL. +// ----------------------------------------------------------------------------- +// +CShwTicker::~CShwTicker() + { + TRACER("CShwTicker::~CShwTicker"); + GLX_LOG_INFO("CShwTicker::~CShwTicker"); + Cancel(); + iTimer.Close(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/slideshow/view/src/shwviewtimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/slideshow/view/src/shwviewtimer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* 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: The pause handling control for the slideshow + * +*/ + + + + + +#ifndef SHWTICKER_H +#define SHWTICKER_H + + +#include +#include + + + +class MShwTickObserver; + +NONSHARABLE_CLASS(CShwTicker) : public CActive + { + +public: + + /** + * NewL + * 2phased constructor + * @param MShwTickObserver& + */ + static CShwTicker* NewL(MShwTickObserver& aObserver); + + /** + * StartTicking + * set the ticker + * @param interval in seconds + */ + void StartTicking(TInt aAfter); + + /** + * CancelTicking + * Cancel a tick + */ + void CancelTicking(); + + /** + * ~CShwTicker + * Standard c++ destructor + */ + ~CShwTicker(); + +private: + + /** + * CShwTicker + * C++ constructor + */ + CShwTicker(MShwTickObserver& aObserver); + + /** + * ConstructL + * 2nd Phase constructor + */ + void ConstructL(); + + /** + * RunL + * see @ref CActive + */ + void RunL(); + + /** + * DoCancel + * see @ref CActive + */ + void DoCancel(); + +private: + + /** */ + MShwTickObserver& iObserver; + + RTimer iTimer; + + + }; + +#endif//SHWTICKER_H + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/bwins/glxcommandhandlerbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/bwins/glxcommandhandlerbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,58 @@ +EXPORTS + ??0CGlxCommandHandler@@QAE@H@Z @ 1 NONAME ; CGlxCommandHandler::CGlxCommandHandler(int) + ??0CGlxMediaListCommandHandler@@QAE@PAVMGlxMediaListProvider@@H@Z @ 2 NONAME ; CGlxMediaListCommandHandler::CGlxMediaListCommandHandler(class MGlxMediaListProvider *, int) + ??0CGlxMpxCommandCommandHandler@@QAE@PAVMGlxMediaListProvider@@H@Z @ 3 NONAME ; CGlxMpxCommandCommandHandler::CGlxMpxCommandCommandHandler(class MGlxMediaListProvider *, int) + ??0TCommandInfo@CGlxMediaListCommandHandler@@QAE@H@Z @ 4 NONAME ; CGlxMediaListCommandHandler::TCommandInfo::TCommandInfo(int) + ??1CGlxCommandHandler@@UAE@XZ @ 5 NONAME ; CGlxCommandHandler::~CGlxCommandHandler(void) + ??1CGlxMediaListCommandHandler@@UAE@XZ @ 6 NONAME ; CGlxMediaListCommandHandler::~CGlxMediaListCommandHandler(void) + ??1CGlxMpxCommandCommandHandler@@UAE@XZ @ 7 NONAME ; CGlxMpxCommandCommandHandler::~CGlxMpxCommandCommandHandler(void) + ?ActivateL@CGlxCommandHandler@@QAEXH@Z @ 8 NONAME ; void CGlxCommandHandler::ActivateL(int) + ?AddCommandL@CGlxMediaListCommandHandler@@IAEXABUTCommandInfo@1@@Z @ 9 NONAME ; void CGlxMediaListCommandHandler::AddCommandL(struct CGlxMediaListCommandHandler::TCommandInfo const &) + ?BypassFiltersForExecute@CGlxMediaListCommandHandler@@MBEHXZ @ 10 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForExecute(void) const + ?BypassFiltersForMenu@CGlxMediaListCommandHandler@@MBEHXZ @ 11 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForMenu(void) const + ?CommandInfo@CGlxMediaListCommandHandler@@IAEAAUTCommandInfo@1@H@Z @ 12 NONAME ; struct CGlxMediaListCommandHandler::TCommandInfo & CGlxMediaListCommandHandler::CommandInfo(int) + ?CommandInfoIndex@CGlxMediaListCommandHandler@@ABEHH@Z @ 13 NONAME ; int CGlxMediaListCommandHandler::CommandInfoIndex(int) const + ?CompletionTextL@CGlxMpxCommandCommandHandler@@MBEPAVHBufC16@@XZ @ 14 NONAME ; class HBufC16 * CGlxMpxCommandCommandHandler::CompletionTextL(void) const + ?ConfirmationNoteL@CGlxMpxCommandCommandHandler@@EBEHHAAVMGlxMediaList@@@Z @ 15 NONAME ; int CGlxMpxCommandCommandHandler::ConfirmationNoteL(int, class MGlxMediaList &) const + ?ConfirmationNoteMultipleL@CGlxMpxCommandCommandHandler@@ABEHHAAVMGlxMediaList@@@Z @ 16 NONAME ; int CGlxMpxCommandCommandHandler::ConfirmationNoteMultipleL(int, class MGlxMediaList &) const + ?ConfirmationNoteSingleL@CGlxMpxCommandCommandHandler@@ABEHHAAVMGlxMediaList@@@Z @ 17 NONAME ; int CGlxMpxCommandCommandHandler::ConfirmationNoteSingleL(int, class MGlxMediaList &) const + ?ConfirmationTextL@CGlxMpxCommandCommandHandler@@MBEPAVHBufC16@@HH@Z @ 18 NONAME ; class HBufC16 * CGlxMpxCommandCommandHandler::ConfirmationTextL(int, int) const + ?Deactivate@CGlxMediaListCommandHandler@@UAEXXZ @ 19 NONAME ; void CGlxMediaListCommandHandler::Deactivate(void) + ?Deactivate@CGlxMpxCommandCommandHandler@@MAEXXZ @ 20 NONAME ; void CGlxMpxCommandCommandHandler::Deactivate(void) + ?DialogDismissedL@CGlxMpxCommandCommandHandler@@UAEXH@Z @ 21 NONAME ; void CGlxMpxCommandCommandHandler::DialogDismissedL(int) + ?DoActivateL@CGlxCommandHandler@@MAEXH@Z @ 22 NONAME ; void CGlxCommandHandler::DoActivateL(int) + ?DoActivateL@CGlxMediaListCommandHandler@@MAEXH@Z @ 23 NONAME ; void CGlxMediaListCommandHandler::DoActivateL(int) + ?DoActivateL@CGlxMpxCommandCommandHandler@@MAEXH@Z @ 24 NONAME ; void CGlxMpxCommandCommandHandler::DoActivateL(int) + ?DoDynInitMenuPaneL@CGlxMediaListCommandHandler@@MAEXHPAVCEikMenuPane@@@Z @ 25 NONAME ; void CGlxMediaListCommandHandler::DoDynInitMenuPaneL(int, class CEikMenuPane *) + ?DoExecuteL@CGlxMpxCommandCommandHandler@@EAEHHAAVMGlxMediaList@@@Z @ 26 NONAME ; int CGlxMpxCommandCommandHandler::DoExecuteL(int, class MGlxMediaList &) + ?DoGetRequiredAttributesL@CGlxMediaListCommandHandler@@MBEXAAV?$RArray@VTMPXAttribute@@@@H@Z @ 27 NONAME ; void CGlxMediaListCommandHandler::DoGetRequiredAttributesL(class RArray &, int) const + ?DoHandleCommandCompleteL@CGlxMpxCommandCommandHandler@@MAEXPAXPAVCMPXMedia@@HPAVMGlxMediaList@@@Z @ 28 NONAME ; void CGlxMpxCommandCommandHandler::DoHandleCommandCompleteL(void *, class CMPXMedia *, int, class MGlxMediaList *) + ?DoHandleItemAddedL@CGlxMpxCommandCommandHandler@@MAEXHHPAVMGlxMediaList@@@Z @ 29 NONAME ; void CGlxMpxCommandCommandHandler::DoHandleItemAddedL(int, int, class MGlxMediaList *) + ?DoHandleMessageL@CGlxMpxCommandCommandHandler@@MAEHABVCMPXMedia@@AAVMGlxMediaList@@@Z @ 30 NONAME ; int CGlxMpxCommandCommandHandler::DoHandleMessageL(class CMPXMedia const &, class MGlxMediaList &) + ?DoIsDisabled@CGlxMediaListCommandHandler@@MBEHHAAVMGlxMediaList@@@Z @ 31 NONAME ; int CGlxMediaListCommandHandler::DoIsDisabled(int, class MGlxMediaList &) const + ?DynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXHPAVCEikMenuPane@@@Z @ 32 NONAME ; void CGlxMediaListCommandHandler::DynInitMenuPaneL(int, class CEikMenuPane *) + ?ExecuteL@CGlxMediaListCommandHandler@@UAEHH@Z @ 33 NONAME ; int CGlxMediaListCommandHandler::ExecuteL(int) + ?GetRequiredAttributesL@CGlxMediaListCommandHandler@@UBEXAAV?$RArray@VTMPXAttribute@@@@HHH@Z @ 34 NONAME ; void CGlxMediaListCommandHandler::GetRequiredAttributesL(class RArray &, int, int, int) const + ?HandleAttributesAvailableL@CGlxMpxCommandCommandHandler@@MAEXHABV?$RArray@VTMPXAttribute@@@@PAVMGlxMediaList@@@Z @ 35 NONAME ; void CGlxMpxCommandCommandHandler::HandleAttributesAvailableL(int, class RArray const &, class MGlxMediaList *) + ?HandleCommandCompleteL@CGlxMpxCommandCommandHandler@@MAEXPAXPAVCMPXMedia@@HPAVMGlxMediaList@@@Z @ 36 NONAME ; void CGlxMpxCommandCommandHandler::HandleCommandCompleteL(void *, class CMPXMedia *, int, class MGlxMediaList *) + ?HandleErrorL@CGlxMpxCommandCommandHandler@@MAEXH@Z @ 37 NONAME ; void CGlxMpxCommandCommandHandler::HandleErrorL(int) + ?HandleFocusChangedL@CGlxMpxCommandCommandHandler@@MAEXW4TFocusChangeType@NGlxListDefs@@HHPAVMGlxMediaList@@@Z @ 38 NONAME ; void CGlxMpxCommandCommandHandler::HandleFocusChangedL(enum NGlxListDefs::TFocusChangeType, int, int, class MGlxMediaList *) + ?HandleItemAddedL@CGlxMpxCommandCommandHandler@@MAEXHHPAVMGlxMediaList@@@Z @ 39 NONAME ; void CGlxMpxCommandCommandHandler::HandleItemAddedL(int, int, class MGlxMediaList *) + ?HandleItemModifiedL@CGlxMpxCommandCommandHandler@@MAEXABV?$RArray@H@@PAVMGlxMediaList@@@Z @ 40 NONAME ; void CGlxMpxCommandCommandHandler::HandleItemModifiedL(class RArray const &, class MGlxMediaList *) + ?HandleItemRemovedL@CGlxMpxCommandCommandHandler@@MAEXHHPAVMGlxMediaList@@@Z @ 41 NONAME ; void CGlxMpxCommandCommandHandler::HandleItemRemovedL(int, int, class MGlxMediaList *) + ?HandleItemSelectedL@CGlxMpxCommandCommandHandler@@MAEXHHPAVMGlxMediaList@@@Z @ 42 NONAME ; void CGlxMpxCommandCommandHandler::HandleItemSelectedL(int, int, class MGlxMediaList *) + ?HandleMediaL@CGlxMpxCommandCommandHandler@@MAEXHPAVMGlxMediaList@@@Z @ 43 NONAME ; void CGlxMpxCommandCommandHandler::HandleMediaL(int, class MGlxMediaList *) + ?HandleMessageL@CGlxMpxCommandCommandHandler@@MAEXABVCMPXMedia@@PAVMGlxMediaList@@@Z @ 44 NONAME ; void CGlxMpxCommandCommandHandler::HandleMessageL(class CMPXMedia const &, class MGlxMediaList *) + ?IsDisabledL@CGlxMediaListCommandHandler@@IBEHHAAVMGlxMediaList@@@Z @ 45 NONAME ; int CGlxMediaListCommandHandler::IsDisabledL(int, class MGlxMediaList &) const + ?IsSupported@CGlxMediaListCommandHandler@@IBEHH@Z @ 46 NONAME ; int CGlxMediaListCommandHandler::IsSupported(int) const + ?MediaList@CGlxMediaListCommandHandler@@IAEAAVMGlxMediaList@@XZ @ 47 NONAME ; class MGlxMediaList & CGlxMediaListCommandHandler::MediaList(void) + ?MediaList@CGlxMediaListCommandHandler@@IBEABVMGlxMediaList@@XZ @ 48 NONAME ; class MGlxMediaList const & CGlxMediaListCommandHandler::MediaList(void) const + ?OfferKeyEventL@CGlxMediaListCommandHandler@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 49 NONAME ; enum TKeyResponse CGlxMediaListCommandHandler::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?OkToExit@CGlxMpxCommandCommandHandler@@MBEHXZ @ 50 NONAME ; int CGlxMpxCommandCommandHandler::OkToExit(void) const + ?PopulateToolbarL@CGlxCommandHandler@@MAEXXZ @ 51 NONAME ; void CGlxCommandHandler::PopulateToolbarL(void) + ?PreDynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXH@Z @ 52 NONAME ; void CGlxMediaListCommandHandler::PreDynInitMenuPaneL(int) + ?ProgressTextL@CGlxMpxCommandCommandHandler@@MBEPAVHBufC16@@H@Z @ 53 NONAME ; class HBufC16 * CGlxMpxCommandCommandHandler::ProgressTextL(int) const + ?SelectionLength@CGlxMediaListCommandHandler@@IBEHXZ @ 54 NONAME ; int CGlxMediaListCommandHandler::SelectionLength(void) const + ?TryExitL@CGlxMpxCommandCommandHandler@@IAEXH@Z @ 55 NONAME ; void CGlxMpxCommandCommandHandler::TryExitL(int) + ?ViewingState@CGlxMediaListCommandHandler@@IBE?AW4TViewingState@TCommandInfo@1@XZ @ 56 NONAME ; enum CGlxMediaListCommandHandler::TCommandInfo::TViewingState CGlxMediaListCommandHandler::ViewingState(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/eabi/glxcommandhandlerbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/eabi/glxcommandhandlerbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +EXPORTS + _ZN18CGlxCommandHandler11DoActivateLEi @ 1 NONAME + _ZN18CGlxCommandHandler16PopulateToolbarLEv @ 2 NONAME + _ZN18CGlxCommandHandler9ActivateLEi @ 3 NONAME + _ZN18CGlxCommandHandlerC2Ei @ 4 NONAME + _ZN18CGlxCommandHandlerD0Ev @ 5 NONAME + _ZN18CGlxCommandHandlerD1Ev @ 6 NONAME + _ZN18CGlxCommandHandlerD2Ev @ 7 NONAME + _ZN27CGlxMediaListCommandHandler10DeactivateEv @ 8 NONAME + _ZN27CGlxMediaListCommandHandler11AddCommandLERKNS_12TCommandInfoE @ 9 NONAME + _ZN27CGlxMediaListCommandHandler11CommandInfoEi @ 10 NONAME + _ZN27CGlxMediaListCommandHandler11DoActivateLEi @ 11 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC1Ei @ 12 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC2Ei @ 13 NONAME + _ZN27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 14 NONAME + _ZN27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 15 NONAME + _ZN27CGlxMediaListCommandHandler18DoDynInitMenuPaneLEiP12CEikMenuPane @ 16 NONAME + _ZN27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 17 NONAME + _ZN27CGlxMediaListCommandHandler8ExecuteLEi @ 18 NONAME + _ZN27CGlxMediaListCommandHandler9MediaListEv @ 19 NONAME + _ZN27CGlxMediaListCommandHandlerC2EP21MGlxMediaListProvideri @ 20 NONAME + _ZN27CGlxMediaListCommandHandlerD0Ev @ 21 NONAME + _ZN27CGlxMediaListCommandHandlerD1Ev @ 22 NONAME + _ZN27CGlxMediaListCommandHandlerD2Ev @ 23 NONAME + _ZN28CGlxMpxCommandCommandHandler10DeactivateEv @ 24 NONAME + _ZN28CGlxMpxCommandCommandHandler10DoExecuteLEiR13MGlxMediaList @ 25 NONAME + _ZN28CGlxMpxCommandCommandHandler11DoActivateLEi @ 26 NONAME + _ZN28CGlxMpxCommandCommandHandler12HandleErrorLEi @ 27 NONAME + _ZN28CGlxMpxCommandCommandHandler12HandleMediaLEiP13MGlxMediaList @ 28 NONAME + _ZN28CGlxMpxCommandCommandHandler14HandleMessageLERK9CMPXMediaP13MGlxMediaList @ 29 NONAME + _ZN28CGlxMpxCommandCommandHandler16DialogDismissedLEi @ 30 NONAME + _ZN28CGlxMpxCommandCommandHandler16DoHandleMessageLERK9CMPXMediaR13MGlxMediaList @ 31 NONAME + _ZN28CGlxMpxCommandCommandHandler16HandleItemAddedLEiiP13MGlxMediaList @ 32 NONAME + _ZN28CGlxMpxCommandCommandHandler18DoHandleItemAddedLEiiP13MGlxMediaList @ 33 NONAME + _ZN28CGlxMpxCommandCommandHandler18HandleItemRemovedLEiiP13MGlxMediaList @ 34 NONAME + _ZN28CGlxMpxCommandCommandHandler19HandleFocusChangedLEN12NGlxListDefs16TFocusChangeTypeEiiP13MGlxMediaList @ 35 NONAME + _ZN28CGlxMpxCommandCommandHandler19HandleItemModifiedLERK6RArrayIiEP13MGlxMediaList @ 36 NONAME + _ZN28CGlxMpxCommandCommandHandler19HandleItemSelectedLEiiP13MGlxMediaList @ 37 NONAME + _ZN28CGlxMpxCommandCommandHandler22HandleCommandCompleteLEPvP9CMPXMediaiP13MGlxMediaList @ 38 NONAME + _ZN28CGlxMpxCommandCommandHandler24DoHandleCommandCompleteLEPvP9CMPXMediaiP13MGlxMediaList @ 39 NONAME + _ZN28CGlxMpxCommandCommandHandler26HandleAttributesAvailableLEiRK6RArrayI13TMPXAttributeEP13MGlxMediaList @ 40 NONAME + _ZN28CGlxMpxCommandCommandHandler8TryExitLEi @ 41 NONAME + _ZN28CGlxMpxCommandCommandHandlerC2EP21MGlxMediaListProvideri @ 42 NONAME + _ZN28CGlxMpxCommandCommandHandlerD0Ev @ 43 NONAME + _ZN28CGlxMpxCommandCommandHandlerD1Ev @ 44 NONAME + _ZN28CGlxMpxCommandCommandHandlerD2Ev @ 45 NONAME + _ZNK27CGlxMediaListCommandHandler11IsDisabledLEiR13MGlxMediaList @ 46 NONAME + _ZNK27CGlxMediaListCommandHandler11IsSupportedEi @ 47 NONAME + _ZNK27CGlxMediaListCommandHandler12DoIsDisabledEiR13MGlxMediaList @ 48 NONAME + _ZNK27CGlxMediaListCommandHandler12ViewingStateEv @ 49 NONAME + _ZNK27CGlxMediaListCommandHandler15SelectionLengthEv @ 50 NONAME + _ZNK27CGlxMediaListCommandHandler16CommandInfoIndexEi @ 51 NONAME + _ZNK27CGlxMediaListCommandHandler20BypassFiltersForMenuEv @ 52 NONAME + _ZNK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 53 NONAME + _ZNK27CGlxMediaListCommandHandler23BypassFiltersForExecuteEv @ 54 NONAME + _ZNK27CGlxMediaListCommandHandler24DoGetRequiredAttributesLER6RArrayI13TMPXAttributeEi @ 55 NONAME + _ZNK27CGlxMediaListCommandHandler9MediaListEv @ 56 NONAME + _ZNK28CGlxMpxCommandCommandHandler13ProgressTextLEi @ 57 NONAME + _ZNK28CGlxMpxCommandCommandHandler15CompletionTextLEv @ 58 NONAME + _ZNK28CGlxMpxCommandCommandHandler17ConfirmationNoteLEiR13MGlxMediaList @ 59 NONAME + _ZNK28CGlxMpxCommandCommandHandler17ConfirmationTextLEii @ 60 NONAME + _ZNK28CGlxMpxCommandCommandHandler23ConfirmationNoteSingleLEiR13MGlxMediaList @ 61 NONAME + _ZNK28CGlxMpxCommandCommandHandler25ConfirmationNoteMultipleLEiR13MGlxMediaList @ 62 NONAME + _ZNK28CGlxMpxCommandCommandHandler8OkToExitEv @ 63 NONAME + _ZTI18CGlxCommandHandler @ 64 NONAME ; ## + _ZTI27CGlxMediaListCommandHandler @ 65 NONAME ; ## + _ZTI28CGlxMpxCommandCommandHandler @ 66 NONAME ; ## + _ZTV18CGlxCommandHandler @ 67 NONAME ; ## + _ZTV27CGlxMediaListCommandHandler @ 68 NONAME ; ## + _ZTV28CGlxMpxCommandCommandHandler @ 69 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler12HandleMediaLEiP13MGlxMediaList @ 70 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler14HandleMessageLERK9CMPXMediaP13MGlxMediaList @ 71 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler16HandleItemAddedLEiiP13MGlxMediaList @ 72 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler18HandleItemRemovedLEiiP13MGlxMediaList @ 73 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler19HandleFocusChangedLEN12NGlxListDefs16TFocusChangeTypeEiiP13MGlxMediaList @ 74 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler19HandleItemModifiedLERK6RArrayIiEP13MGlxMediaList @ 75 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler19HandleItemSelectedLEiiP13MGlxMediaList @ 76 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler22HandleCommandCompleteLEPvP9CMPXMediaiP13MGlxMediaList @ 77 NONAME ; ## + _ZThn48_N28CGlxMpxCommandCommandHandler26HandleAttributesAvailableLEiRK6RArrayI13TMPXAttributeEP13MGlxMediaList @ 78 NONAME ; ## + _ZThn52_N28CGlxMpxCommandCommandHandler16DialogDismissedLEi @ 79 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Build information file for project commandhandlers + * +*/ + + + + +PRJ_EXPORTS + +PRJ_EXPORTS + +PRJ_MMPFILES + +glxcommandhandlerbase.mmp + +PRJ_TESTMMPFILES +//../tsrc/group/ut_cglxmedialistcommandhandler.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/group/glxcommandhandlerbase.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/group/glxcommandhandlerbase.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include "../../../../group/glxbuildcommon.mmh" +#include + +TARGET glxcommandhandlerbase.dll +TARGETTYPE dll +UID 0x1000008d 0x2000A76D + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxmedialistcommandhandler.cpp +SOURCE glxmpxcommandcommandhandler.cpp +SOURCE glxcommandhandler.cpp + +//System Includes for epoc32 +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities + + +LIBRARY aknicon.lib +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknskins.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY cdlengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY glxcommon.lib // for CResourceUtilities + +LIBRARY hlplch.lib + +LIBRARY hitchcock.lib // HUI framework + +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib +LIBRARY ws32.lib +LIBRARY commonengine.lib + +LIBRARY libpthread.lib +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/group/ut_cglxmedialistcommandhandler.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/group/ut_cglxmedialistcommandhandler.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2008-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: Pkg file for Unit test cases of medialistcommandhandler +; + +; Supported languages +&en + +; Package header (one name for each supported language) +#{"ut_cglxmedialistcommandhandler"},(0x01700000),0,10,0 + +; Package signature + + +; Options line not supported currently + +; Conditions blocks not supported currently + +; Language independent files that are always installed +"ut_cglxmedialistcommandhandler.dll"-"!:\DigiaEUnit\Tests\ut_cglxmedialistcommandhandler.dll" + +; Language dependent files + + +; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) +(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/inc/glxcommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/inc/glxcommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Command Handler Base +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLER_H__ +#define __C_GLXCOMMANDHANDLER_H__ + +#include +#include +#include +#include + +class CEikMenuPane; + + +/** + * CGlxCommandHandler + * + * Command handler base + */ +class CGlxCommandHandler: public CBase + { +public: + + IMPORT_C CGlxCommandHandler( TBool aHasToolbarItem = EFalse ); + + /** + * Execute the command, if applicable + * @param aCommand The command to handle + * @return ETrue iff command was handled + */ + virtual TBool ExecuteL(TInt aCommand) = 0; + + /** + * Modify a menu before it is displayed. + * @param aResourceId The resource ID of the menu + * @param aMenuPane The in-memory representation of the menu pane + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) = 0; + + /** + * Called when the owning view is activated + * @param aViewId The ID of the view + */ + IMPORT_C void ActivateL(TInt aViewId); + + /** + * Called when the owning view is deactivated + */ + virtual void Deactivate() = 0; + + /** + * Offers key events to the command handler + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown + * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) = 0; + + /** + * Perform any actions needed before the options menu is displayed. + * The view calling this must first arrange a wait dialog to be displayed, as this operation may take + * a long time to complete + * @param aResourceId Menu resource id + */ + virtual void PreDynInitMenuPaneL( TInt aResourceId ) = 0; + + /** + * Deriving classes should append required attributes to aAttributes + * @param aAttributes array to append attributes to. + * @param aFilterUsingSelection If ETrue, the deriving class should only append + * attributes relevant to the current selection, If EFalse all attributes + * should be appended. + * @param aFilterUsingCommandId If ETrue, only attributes relevant + * to the command id specified by aCommandId will be appended + * @param aCommandId if aFilterUsingCommandId is ETrue, only + * attributes relevant to aCommandId will be appened. + */ + virtual void GetRequiredAttributesL(RArray< TMPXAttribute >& aAttributes, + TBool aFilterUsingSelection, + TBool aFilterUsingCommandId, + TInt aCommandId = 0) const = 0; + + /** + * Destructor + */ + IMPORT_C virtual ~CGlxCommandHandler(); + +protected: + IMPORT_C virtual void DoActivateL(TInt aViewId); + IMPORT_C virtual void PopulateToolbarL(); + +private: + /** Whether the command should be enabled as a toolbar command*/ + TBool iHasToolbarItem; + }; + + +#endif // __C_GLXCOMMANDHANDLER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/inc/glxmedialistcommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/inc/glxmedialistcommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,346 @@ +/* +* Copyright (c) 2008-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: Media List Command Handler +* +*/ + + + + +#ifndef __C_GLXMEDIALISTCOMMANDHANDLER_H +#define __C_GLXMEDIALISTCOMMANDHANDLER_H + +#include "glxcommandhandler.h" + +#include +#include +#include +#include + +class MGlxMediaList; +class CAknProgressDialog; +class MGlxMediaListProvider; +class CEikProgressInfo; +class UT_CGlxMediaListCommandHandler; +class t_cglxcommandhandlercopytohomenetwork; + +/** + * @class CGlxMediaListCommandHandler + * + * Command handler that acts on a media list. This class handles basic + * and most common command filtering, i.e., checking whether the + * command is active based on a selection + * + * @ingroup glx_group_command_handlers + * + * Filters: + * - Disable if selection contains only system items (see @ref glx_colifspec_medial) + * - This allows disabling commands that are not allowed for system items (such as favourites album) + * - Disable if selection size is too small or too large + * - This allows filtering out an empty view (except for marking commands) + * - This allows filtering out static items (except for marking commands) + * - This allows filtering when other than 1 item has been selected + * - Use case: rename item, and play video + * - Disable for static item + * - This can be achieved by setting minimum selection lenght to 1 (or more), since + * static items are not part of selection + * - Specific static item disabling should only be required when dealing with marking commands, + * since static items do not belong to the selection. There is a selection, + * all commands (except marking commands) act on the selected items. If nothing + * is selected, focus is treated as selection. If nothing is selected, and + * a static item is focused, selection size will be 0. + * Hence, it is faster and simpler to use selection size min and max to filter out + * static items. + * - Disabling when view is empty can be achieved via min and max selection length, except + * for marking commands, which need to if view is empty: + * - (Mark all and Mark multiple need to be available also when there is no selection + * zero and focus is on a static item, but not if the view is empty, hence a + * separate check for empty view is needed for marking.) + * - Disable if system item + * - Disable by item type: Image/video/static item/album/tag + * - Use case: Filter out static items for marking command handler + * + * @lib glxviewbase.lib + */ +class CGlxMediaListCommandHandler : public CGlxCommandHandler + { +public: + /** + * Command info. Represents one command id. + * Command is enabled by default, unless member variables are modified + */ + struct TCommandInfo + { + /** + * Constructor that sets all filters not to apply, so + * command is enabled by default + */ + IMPORT_C TCommandInfo(TInt aCommandId); + + /// Supported command id + TInt iCommandId; + + /// Stop GIF animation before execution + TBool iStopAnimationForExecution; + + /// Disable command if only system items in selection + TBool iDisallowSystemItems; + + /// Disable command if only DRM-protected items in selection + TBool iDisallowDRM; + + /// Disable command if selection smaller than. Default 0. + TInt iMinSelectionLength; + /// Disable command if selection larger than. Default KMaxTInt. + TInt iMaxSelectionLength; + + /// Enable only if selected container(s) contains this or more items + TInt iMinSlideshowPlayableContainedItemCount; + + /// Filter out animated GIFs + TBool iDisallowAnimatedGIFs; + + /// Disable if focused item is / is not of the category + /// See @ref CGlxMediaListCommandHandler::iCategoryRule + /// Default is EMPXNoCategory + TMPXGeneralCategory iCategoryFilter; + + /// If ETrue, + /// If EFalse, disables command if all items ARE of category + /// Default + /// See @ref CGlxMediaListCommandHandler::iCategoryFilter + enum TCategoryRule + { + EIgnore, // Ignore category + ERequireAll, // disables command if all items are NOT of category + EForbidAll // disables command if all items ARE of category + }; + TCategoryRule iCategoryRule; + + /// Viewing Statws. Used to filter what commands are on display + /// relative to Browsing or Viewing + /// These are bitwise to enable a command to declare more than + /// one state at a time. + enum TViewingState + { + EViewingStateUndefined = 0xFFFFFFFF, + EViewingStateBrowse = 0x01, // Tile View + EViewingStateView = 0x02 // Full Screen view + }; + + // Records the current viewing state + TViewingState iViewingState; + }; + +public: + /** + * Destructor + */ + IMPORT_C virtual ~CGlxMediaListCommandHandler(); + + /** + * Constructor + * @param aMediaListProvider The owner of the media list to use + */ + IMPORT_C CGlxMediaListCommandHandler( MGlxMediaListProvider* aMediaListProvider, + TBool aIsToolbarCommand = EFalse ); + +public: // From MGlxCommandHandler + /// See @ref MGlxCommandHandler::ExecuteL */ + IMPORT_C virtual TBool ExecuteL(TInt aCommand); + + /// See @ref MGlxCommandHandler::DynInitMenuPaneL */ + IMPORT_C virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + /** + * See @ref MGlxCommandHandler::Deactivate + * Default implementation does nothing + */ + IMPORT_C virtual void Deactivate(); + + /** + * See @ref MGlxCommandHandler::OfferKeyEventL + * Default implementation does nothing + */ + IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** + * See @ref MGlxCommandHandler::PreDynInitMenuPaneL + * Default implementation does nothing + * @param aResourceId Menu resource id. + */ + IMPORT_C virtual void PreDynInitMenuPaneL( TInt aResourceId ); + + /** + * See @ref MGlxCommandHandler::GetRequiredAttributesL + */ + IMPORT_C void GetRequiredAttributesL(RArray< TMPXAttribute >& aAttributes, + TBool aFilterUsingSelection, + TBool aFilterUsingCommandId, + TInt aCommandId = 0) const; + +protected: + /** + * Execute the command, if applicable. Called after basic filtering + * @param aCommand The command to handle + * @return ETrue iff command was handled + * @see BypassFiltersForExecute + */ + virtual TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList) = 0; + + /** + * See @ref CGlxCommandHandler::DoActivateL + * Default implementation does nothing + */ + IMPORT_C virtual void DoActivateL( TInt aViewId ); + + /** + * Check if command is disabled. Allows deriving class to provide + * more elaborate filtering that supported by this class. + * Default implementation returns EFalse. + * @return ETrue if command is disabled + */ + IMPORT_C virtual TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + + /** + * Allow deriving classes to make any further alterations to the menu pane. + * Only called on classes with at least on enabled command present in menu + * @param aResourceId The resource ID of the menu + * @param aMenuPane The in-memory representation of the menu pane + * @see BypassFiltersForMenu + */ + IMPORT_C virtual void DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + /** + * If deriving class returns true for this, ALL commands will be sent to DoExecuteL + * @return Whether to bypass filters for command execution + */ + IMPORT_C virtual TBool BypassFiltersForExecute() const; + + /** + * If deriving class returns true for this, ALL menus will be passed to DoDynInitMenuPaneL + * @return Whether to bypass filters for menu initialization + */ + IMPORT_C virtual TBool BypassFiltersForMenu() const; + + /** + * Optionally implemented by deriving classes to specify attributes that should be retrieved + * @param aAttributes array to append attributes to. + * @param aFilterUsingSelection If ETrue, the deriving class should only append + * attributes relevant to the current selection, If EFalse all attributes + * should be appended. + */ + IMPORT_C virtual void DoGetRequiredAttributesL( RArray& aAttributes, TBool aFilterUsingSelection) const; + +protected: + /** + * Returns a reference to the current media list + * @return reference to the current media list + */ + IMPORT_C MGlxMediaList& MediaList(); + + /** + * Returns a const reference to the current media list + * @return const reference to the current media list + */ + IMPORT_C const MGlxMediaList& MediaList() const; + /** + * AddCommandL + */ + IMPORT_C void AddCommandL(const TCommandInfo& aCommand); + + /** + * Check if the command handler is currently disabled + */ + IMPORT_C TBool IsDisabledL(TInt aCommandId, MGlxMediaList& aList) const; + + /** + * @return ETrue if command is handled by this command handler + */ + IMPORT_C TBool IsSupported(TInt aCommandId) const; + + /** + * @return the length of selection + * If static item is focused, length is 0 + * If list is empty, lenght is 0 + * If no items are selected, but a non-static item is focused length is 1 + */ + IMPORT_C TInt SelectionLength() const; + + /** + * @return command info by index + */ + IMPORT_C TCommandInfo& CommandInfo(TInt aIndex); + + /** + * @return the current viewing state. + */ + + IMPORT_C TCommandInfo::TViewingState ViewingState() const; + + /** + * @return command info by index + */ + const TCommandInfo& CommandInfo(TInt aIndex) const; + +private: + /** + * @return index of command in command info array or KErrNotFound + */ + TInt CommandInfoIndex(TInt aCommandId) const; + + /** + * Check if a given command (menu option) is viewable in the current view + * @param aInfo The command in question. + * @return ETrue if viewable, EFalse if not. + */ + + TBool IsViewable(const TCommandInfo& aInfo) const; + + /** + * Checks to see if the command handler is disabled + * based on the selection and IsViewable(). Other + * conditions may also disable the command handler. + * @param aInfo The command in question. + * @return ETrue, if the command handler is disabled + * EFalse if the command handler may not be disabled. + */ + TBool IsDisabled(const TCommandInfo& aInfo) const; + + /** + * Append required attributes to aAttributes + * @param aAttributes array to append attributes to. + * @param aFilterUsingSelection If ETrue, the deriving class should only append + * attributes relevant to the current selection, If EFalse all attributes + * should be appended. + */ + void GetRequiredAttributesL(RArray< TMPXAttribute >& aAttributes, + TBool aFilterUsingSelection) const; + +private: + + /** Provider of media list */ + MGlxMediaListProvider* iMediaListProvider; + + /** Command info array */ + RArray iCommandInfoArray; + + /** Current viewing state */ + TCommandInfo::TViewingState iCurrentViewingState; + + friend class UT_CGlxMediaListCommandHandler; + friend class t_cglxcommandhandlercopytohomenetwork; + }; + +#endif // __C_GLXMEDIALISTCOMMANDHANDLER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/inc/glxmpxcommandcommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/inc/glxmpxcommandcommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,286 @@ +/* +* Copyright (c) 2008-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: MPX Command generating Command Handler +* +*/ + + + + +#ifndef __C_GLXMPXCOMMANDCOMMANDHANDLER_H__ +#define __C_GLXMPXCOMMANDCOMMANDHANDLER_H__ + +#include +#include +#include +#include +#include "glxmedialistcommandhandler.h" + +class MGlxMediaList; +class MGlxMediaListProvider; +class CAknAppUi; + +/** + * @class CGlxMpxCommandCommandHandler + * + * Command handler that creates and issues an MPXCommand + * + * @ingroup glx_group_command_handlers + * + * @lib glxviewbase.lib + */ +class CGlxMpxCommandCommandHandler : public CGlxMediaListCommandHandler, + public MGlxMediaListObserver, public MProgressDialogCallback + { +public: + /** + * Constructor + * @param aMediaListProvider The owner of the media list to use + */ + IMPORT_C CGlxMpxCommandCommandHandler(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem = EFalse ); + + /** + * Destructor + */ + IMPORT_C virtual ~CGlxMpxCommandCommandHandler(); + +protected: // API for deriving classes + /** + * Attempts to "exit" the command handler + * (Exit means closing the progress note and allowing user to do something.) + * The command handler will exit if + * - progress is complete and deriving class returns ETrue from OkToExit + * - aErrorCode is not KErrNone + * + * Usually deriving classes never need to call this. This is called + * automatically after receiving a collection message. Only call if the + * completion can happen (= the result of OkToExit() call changes) based + * on another event than collection message. + * + * @param aErrorCode Error code. Shows an error note if other than KErrNone + */ + IMPORT_C void TryExitL(TInt aErrorCode); + + /** + * See @ref CGlxCommandHandler::DoActivateL + * Default implementation does nothing + */ + IMPORT_C virtual void DoActivateL( TInt aViewId ); + + /** + * Called when the owning view is deactivated + */ + IMPORT_C virtual void Deactivate(); + + /** + * Handles error + * Default implementation shows an error note + */ + IMPORT_C virtual void HandleErrorL(TInt aErrorCode); + + /** + * Creates a command object, and decides whether to consume the command. + * @param aList Media list to which the command will be issued. + * @param aConsume Set this to false, if the command + * id should not be consumed. Default value is true. + * @return command object If NULL returned, no MPX command will be issued, + * but the command id may still be consumed, depending + * on the value of aDoNotConsume + * Caller gets ownership of the command object. + */ + virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const = 0; + + /** + * Handles a message other than progress message. + * Deriving classes can override this to receive and handle messages + * from media list (i.e., from MPX server) + * The default implementation does not do anything. + * @return Error code. If other than KErrNone, the command handler + * closes the progress note and shows an error note. + */ + IMPORT_C virtual TInt DoHandleMessageL(const CMPXMessage& aMessage, + MGlxMediaList& aList); + + /** + * Called by HandleCommandCompleteL() to allow derived classes + * to perform processing specific to individual command handlers. + * The defalut implementation does not do anything. + * + */ + IMPORT_C virtual void DoHandleCommandCompleteL(TAny* aSessionId, + CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); + + /** + * Called by HandleCommandCompleteL() to allow derived classes + * to perform processing specific to individual command handlers. + * The defalut implementation does not do anything. + * + */ + IMPORT_C virtual void DoHandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /** + * Called to check if the deriving class is ready and progress note + * can be closed. The deriving class may be expecting a message (etc) after + * the last progress notification is received, and by overriding + * this class, they can wait for that info. + * Default implementation returns ETrue. + * @return ETrue if command handler is ready exit + */ + IMPORT_C virtual TBool OkToExit() const; + + /** + * Creates and returns confirmation note text + * Deriving class can override this to get a confirmation note shown + * before execution + * @param aCommandId Id of the command that is about to be executed + * @param aMultiSelection ETrue when more than one item is selected + * @return New descriptor with confirmation note + * If single selection, the descriptor must contain %U, which + * will be populated with the title of the selected/focused item + * If multiselection, the descriptor must contain %N, which + * will be populated with the number of selected items + * Or return NULL, in which case no note will be shown and the command + * is simply executed. + * Caller gets ownership of the descriptor. + * Default implementation returns NULL. + */ + IMPORT_C virtual HBufC* ConfirmationTextL(TInt aCommandId, TBool aMultiSelection) const; + + /** + * Creates and returns progress note text + * Deriving class can override this to customise the progress note + * @return New descriptor with progress text + * Or return NULL, in which case default progress text will be + * used + * Default implementation returns default progress note + * Caller gets ownership of the descriptor. + */ + IMPORT_C virtual HBufC* ProgressTextL(TInt aCommandId) const; + + /** + * Creates and returns completion note text + * Deriving class can override this to show a completion note + * @return New descriptor with completion text + * Or return NULL, in which case the note will not be shown + * Default implementation returns NULL + * Caller gets ownership of the descriptor. + */ + IMPORT_C virtual HBufC* CompletionTextL() const; + +private: + /** See @ref CGlxMediaListCommandHandler::DoExecuteL */ + virtual TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + /** + * Launch a confirmation note (single or multiple depending on media list selection) + * Declared as virtual to allow deriving class to show non-media list dependent + * confirmation note, etc. + * @return ETrue if the user confirms, EFalse if user cancels + */ + IMPORT_C virtual TBool ConfirmationNoteL(TInt aCommandId, MGlxMediaList& aMediaList) const; + + /** + * Launch a confirmation note (single) + * @return ETrue if the user confirms + */ + TBool ConfirmationNoteSingleL(TInt aCommandId, MGlxMediaList& aMediaList) const; + + /** + * Launch a confirmation note (multiple) + * @return ETrue if the user confirms + */ + TBool ConfirmationNoteMultipleL(TInt aCommandId, MGlxMediaList& aMediaList) const; + + /** + * Launch a progress note + */ + void ProgressNoteL(TInt aCommandId); + + /** + * Update progress based on message + * @param aMessage message with progress info + * @param aError extracts an error code from message and returns in this argument + * @param ETrue if progress complete. EFalse if note + */ + TBool UpdateProgressL(const CMPXMessage& aMessage, TInt& aError); + + /** + * Dismiss the active progress note + */ + void DismissProgressNoteL(); + + /** + * Show a completion note + */ + void CompletionNoteL() const; + + /** + * Remove medialist observer + */ + void RemoveMediaListObserver(); + +protected: // From MGlxMediaListObserver + /// See @ref MGlxMediaListObserver::HandleItemAddedL + IMPORT_C void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMediaL + IMPORT_C void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemRemovedL + IMPORT_C void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemModifiedL + IMPORT_C void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL + IMPORT_C void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleFocusChangedL + IMPORT_C void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemSelectedL + IMPORT_C void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMessageL + IMPORT_C void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleCommandCompleteL + IMPORT_C void HandleCommandCompleteL(TAny* aSessionId, CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); + +public: // from MProgressDialogCallback + IMPORT_C void DialogDismissedL(TInt aButtonId); + +private: + /// Progress dialog + CAknProgressDialog* iProgressDialog; + + // Progress info for the progress dialog + CEikProgressInfo* iProgressInfo; + + // CEikProgressInfo does not store whether progress is complete, so store here + TBool iProgressComplete; + + // Resource offset + mutable TInt iResourceOffset; + + /// Whether the GIF animation is currently halted + TBool iAnimationStopped; + + /// The AppUI. Not owned + CAknAppUi* iAppUi; + }; + +#endif // __C_GLXMPXCOMMANDCOMMANDHANDLER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxcommandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxcommandhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2008-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: Command Handler base +* +*/ + + + + + +#include "glxcommandhandler.h" + +EXPORT_C CGlxCommandHandler::CGlxCommandHandler( TBool aHasToolbarItem ) +{ + iHasToolbarItem = aHasToolbarItem; +} + +EXPORT_C void CGlxCommandHandler::ActivateL( TInt aViewId ) +{ + DoActivateL(aViewId); + + if( iHasToolbarItem ) + { + PopulateToolbarL(); + } +} + +// ----------------------------------------------------------------------------- +// DoActivateL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxCommandHandler::DoActivateL(TInt /*aViewId*/) +{ + /* Requiring derived classes should Implement */ +} + +// ----------------------------------------------------------------------------- +// PopulateToolbar +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxCommandHandler::PopulateToolbarL() +{ + // Implement code to set toolbar items in the required derived classes. +} + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandler::~CGlxCommandHandler() + { + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxmedialistcommandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxmedialistcommandhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,659 @@ +/* +* Copyright (c) 2008-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: Media List Command Handler +* +*/ + + + + +#include + +#include "glxmedialistcommandhandler.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mglxmedialistprovider.h" + +// ----------------------------------------------------------------------------- +// Constructor for command info +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListCommandHandler::TCommandInfo::TCommandInfo(TInt aCommandId) + { + // Set command id + iCommandId = aCommandId; + + // Do not stop animation before execution + iStopAnimationForExecution = EFalse; + + // Disable for system items + iDisallowSystemItems = EFalse; + + // Disable for DRM protected items + iDisallowDRM = EFalse; + + // Set selection length requirement so that it does not filter + iMinSelectionLength = 0; + iMaxSelectionLength = KMaxTInt; + + // default minimum item count + iMinSlideshowPlayableContainedItemCount = 0; + + // Disable for animated GIFs + iDisallowAnimatedGIFs = EFalse; + + // Default item category is "none" + iCategoryFilter = EMPXNoCategory; + + // Don't apply category filter + iCategoryRule = EIgnore; + + // Set the default viewing state + iViewingState = EViewingStateUndefined; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListCommandHandler::CGlxMediaListCommandHandler( + MGlxMediaListProvider* aMediaListProvider, + TBool aHasToolbarItem):CGlxCommandHandler(aHasToolbarItem) + { + iMediaListProvider = aMediaListProvider; + iCurrentViewingState = TCommandInfo::EViewingStateUndefined; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListCommandHandler::~CGlxMediaListCommandHandler() + { + iCommandInfoArray.Reset(); + } + +// ----------------------------------------------------------------------------- +// ExecuteL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMediaListCommandHandler::ExecuteL(TInt aCommandId) + { + TBool consume = EFalse; + + switch (aCommandId) + { + case EGlxCmdStateBrowse: + iCurrentViewingState = TCommandInfo::EViewingStateBrowse; + break; + + case EGlxCmdStateView: + iCurrentViewingState = TCommandInfo::EViewingStateView; + break; + + default: // Do nothing + break; + } + /// @todo Consume the state command. This requires changing derived classes so that they do not + /// receive the state commands, but use the TCommandInfo filtering for state. Too risky change + /// to do for inc6.1. + + if ( BypassFiltersForExecute() ) + { + MGlxMediaList& list = MediaList(); + + consume = DoExecuteL(aCommandId, list); + } + else + { + // Is this command handled by this command handler + if ( IsSupported( aCommandId ) ) + { + MGlxMediaList& list = MediaList(); + + // Do not consume if the command is disabled + if ( !IsDisabledL(aCommandId, list) ) + { + // Ask deriving class to execute + consume = DoExecuteL(aCommandId, list); + } + } + } + + return consume; + } + +// ----------------------------------------------------------------------------- +// DynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler::DynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane) + { + if ( aMenuPane ) + { + if ( BypassFiltersForMenu() ) + { + DoDynInitMenuPaneL(aResourceId, aMenuPane); + } + else + { + TInt num_items = aMenuPane->NumberOfItemsInPane(); + TBool atLeastOneEnabledSupportedItem = EFalse; + + //CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + //CleanupClosePushL(*uiUtility); + + // Iterate through menu pane + for ( TInt i = 0; i < num_items; i++) + { + CEikMenuPaneItem::SData& item = aMenuPane->ItemDataByIndexL(i); + + // Check if the menu command is know to this command handler + if ( IsSupported( item.iCommandId ) ) + { + TBool isDisabled = IsDisabledL(item.iCommandId, MediaList()); + + if( !isDisabled && + iCurrentViewingState == TCommandInfo::EViewingStateView ) + { + //isDisabled = sf.IsActivePaletteItemVisible( item.iCommandId ); + } + // Check visibility of the menu item + aMenuPane->SetItemDimmed( item.iCommandId, isDisabled); + + atLeastOneEnabledSupportedItem = atLeastOneEnabledSupportedItem || (!isDisabled); + } + } + + // CleanupStack::PopAndDestroy(uiUtility); + + if ( atLeastOneEnabledSupportedItem ) + { + DoDynInitMenuPaneL(aResourceId, aMenuPane); + } + } + } + } + +// --------------------------------------------------------------------------- +// ActivateL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler::DoActivateL(TInt /*aViewId*/) + { + + } + +// --------------------------------------------------------------------------- +// Default implementation does nothing +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler::Deactivate() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// OfferKeyEventL +// --------------------------------------------------------------------------- +// +EXPORT_C TKeyResponse CGlxMediaListCommandHandler::OfferKeyEventL( + const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// --------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler::PreDynInitMenuPaneL( TInt /*aResourceId*/ ) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// CGlxMediaListCommandHandler::GetRequiredAttributesL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler::GetRequiredAttributesL( + RArray< TMPXAttribute >& aAttributes, + TBool aFilterUsingSelection, + TBool aFilterUsingCommandId, + TInt aCommandId) const + { + if (!aFilterUsingCommandId || IsSupported(aCommandId)) + { + GetRequiredAttributesL(aAttributes, aFilterUsingSelection); + } + } + +// ----------------------------------------------------------------------------- +// Check if command is currently disabled +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMediaListCommandHandler::IsDisabledL(TInt aCommandId, + MGlxMediaList& aMediaList) const + { + __ASSERT_DEBUG(IsSupported(aCommandId), Panic(EGlxPanicIllegalArgument)); + const TCommandInfo& info = CommandInfo(aCommandId); + + // Perform expensive checks only if necessary + TBool isDisabled = IsDisabled(info); + + if (!isDisabled) + { + /** + * The disabling check must be done so that we go through the selection + * and check each item separately against all filter rules. + * + * There can for example be a filter that does not allow system items, + * anim gifs or videos. Now if the selection contains 10 items and 3 of + * them are system items, 4 are anim gifs and 3 are videos we need to disable the + * command. If that selection contained 1 "normal" image we must enable + * the command accordingly. + */ + // assume this item is not disabled + + + // Check through all selected items, if no selection then the focused item + TGlxSelectionIterator iterator; + iterator.SetToFirst( &aMediaList ); + // Loop until iterator does not give any more indexes + TInt index = KErrNotFound; + while ( KErrNotFound != (index = iterator++ ) ) + { + // get the media item + const TGlxMedia& item = aMediaList.Item( index ); + + // check category rule first + TMPXGeneralCategory cat = item.Category(); + if( ( TCommandInfo::EIgnore != info.iCategoryRule )&& + ( cat != EMPXNoCategory ) ) + { + // get category attribute + // did we want to deny all items of this type + if( TCommandInfo::EForbidAll == info.iCategoryRule ) + { + // disable if the category was same + isDisabled = (info.iCategoryFilter == cat); + } + else + { + // assign the value + isDisabled = info.iCategoryFilter != cat; + // disable if the category was not same + if( isDisabled ) + { + // we found first that is not same so end the loop + break; + } + } + } + // Check system item if not yet disabled by previous rules + TBool isSystemItem = EFalse; + if( ( !isDisabled )&&( info.iDisallowSystemItems )&& + ( item.GetSystemItem(isSystemItem) ) ) + { + // disable if this was system item + isDisabled = isSystemItem; + } + // Check DRM if not yet disabled by previous rules + if( (!isDisabled )&&( info.iDisallowDRM ) ) + { + // disable if DRM protected + isDisabled = item.IsDrmProtected(); + } + // Check animated GIF if not yet disabled by previous rules + TInt frameCount(0); + if( ( !isDisabled )&&( info.iDisallowAnimatedGIFs )&& + ( item.GetFrameCount(frameCount) ) ) + { + // disable if framecount is greater than one + isDisabled = ( 1 < frameCount ); + } + // Check minimum item count if not yet disabled by previous rules + TInt count(0); + if( ( !isDisabled )&&( info.iMinSlideshowPlayableContainedItemCount )&& + ( item.GetSlideshowPlayableContainedItemCount(count) ) ) + { + // disable if less than required amount of items in container (ignore non-containers, i.e. -1) + if( count != -1 ) + { + isDisabled = ( count < info.iMinSlideshowPlayableContainedItemCount ); + } + } + // when we find the first item for which the command is not disabled + // we can end the loop unless the category rule states we need to check them all + if( ( !isDisabled )&&( TCommandInfo::ERequireAll != info.iCategoryRule ) ) + { + // this is the exit of the loop in case there is an item to enable for + break; + } + } + + // Check deriving class if we are still not disabled + if ( !isDisabled ) + { + isDisabled = DoIsDisabled( aCommandId, aMediaList ); + } + } + return isDisabled; + } + +// ----------------------------------------------------------------------------- +// MediaList +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxMediaList& CGlxMediaListCommandHandler::MediaList() + { + return iMediaListProvider->MediaList(); + } + +// ----------------------------------------------------------------------------- +// MediaList +// ----------------------------------------------------------------------------- +// +EXPORT_C const MGlxMediaList& CGlxMediaListCommandHandler::MediaList() const + { + return const_cast(this)->MediaList(); + //return iMediaListProvider->MediaList(); + } + +// ----------------------------------------------------------------------------- +// Default implementation of elaborate filtering returns EFalse for "not disabled" +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMediaListCommandHandler::DoIsDisabled(TInt /*aCommandId*/, + MGlxMediaList& /*aList*/) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Return selection length. Length is zero if static item is focused +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxMediaListCommandHandler::SelectionLength() const + { + const MGlxMediaList& ml = MediaList(); + + TInt selectionLength = ml.SelectionCount(); + + // If there is no selection, treat the focused item as selected, unless + // it is a static item + if ( 0 == selectionLength ) + { + if (ml.Count() > 0) + { + // see if item is a static item + // get focussed item + const TGlxMedia& item = ml.Item(ml.FocusIndex()); + if(!item.IsStatic()) + { + // not static item - set selection length to 1 + selectionLength = 1; + } + } + } + + return selectionLength; + } + +// ----------------------------------------------------------------------------- +// Add the command to command array +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler::AddCommandL( + const CGlxMediaListCommandHandler::TCommandInfo& aCommand) + { + // Make sure command not already added + __ASSERT_DEBUG(!IsSupported(aCommand.iCommandId), Panic(EGlxPanicAlreadyAdded)); + + // This function is rarely called, so copying the object should be ok + iCommandInfoArray.AppendL(aCommand); + } + +// ----------------------------------------------------------------------------- +// Return index of command info by command id +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxMediaListCommandHandler::CommandInfoIndex(TInt aCommandId) const + { + // Find the index of the command + TInt index = KErrNotFound; + TInt count = iCommandInfoArray.Count(); + for (TInt i = 0; i < count; i++) + { + if (iCommandInfoArray[i].iCommandId == aCommandId) + { + index = i; + break; + } + } + + return index; + } + + +// ----------------------------------------------------------------------------- +// DoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler::DoDynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/) + { + // No implementation by default + } + + +// ----------------------------------------------------------------------------- +// Return command info by id +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListCommandHandler::TCommandInfo& + CGlxMediaListCommandHandler::CommandInfo(TInt aCommandId) + { + // Assuming the deriving class knows the command ids it supports + __ASSERT_DEBUG(IsSupported(aCommandId), Panic(EGlxPanicIllegalArgument)); + return iCommandInfoArray[CommandInfoIndex(aCommandId)]; + } + +// ----------------------------------------------------------------------------- +// Return command info by id +// ----------------------------------------------------------------------------- +// +const CGlxMediaListCommandHandler::TCommandInfo& + CGlxMediaListCommandHandler::CommandInfo(TInt aCommandId) const + { + // Assuming the deriving class knows the command ids it supports + __ASSERT_DEBUG(IsSupported(aCommandId), Panic(EGlxPanicIllegalArgument)); + return iCommandInfoArray[CommandInfoIndex(aCommandId)]; + } + +// ----------------------------------------------------------------------------- +// return ETrue if command is handled by this command handler +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMediaListCommandHandler::IsSupported(TInt aCommandId) const + { + return CommandInfoIndex(aCommandId) != KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// BypassFiltersForExecute +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMediaListCommandHandler::BypassFiltersForExecute() const + { + // Return false by default: should only return true in special circumstances + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListCommandHandler::DoGetRequiredAttributesL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListCommandHandler:: + DoGetRequiredAttributesL( RArray& /*aAttributes*/, TBool /*aFilterUsingSelection*/) const + { + // No implementation required + } + +// ----------------------------------------------------------------------------- +// BypassFiltersForMenu +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMediaListCommandHandler::BypassFiltersForMenu() const + { + // Return false by default: should only return true in special circumstances + return EFalse; + } + +// ----------------------------------------------------------------------------- +// ViewingState +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListCommandHandler::TCommandInfo::TViewingState + CGlxMediaListCommandHandler::ViewingState() const + { + return iCurrentViewingState; + } + +// ----------------------------------------------------------------------------- +// IsViewable +// ----------------------------------------------------------------------------- +// +TBool CGlxMediaListCommandHandler::IsViewable(const TCommandInfo& aInfo) const + { + return aInfo.iViewingState & iCurrentViewingState; + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListCommandHandler::IsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxMediaListCommandHandler::IsDisabled(const TCommandInfo& aInfo) const + { + // Check selection length validitity first, because it is a very fast check, + // and covers so many situations + TInt selectionLength = SelectionLength(); + return (selectionLength < aInfo.iMinSelectionLength || + selectionLength > aInfo.iMaxSelectionLength) || + !IsViewable(aInfo); + + } + +// --------------------------------------------------------------------------- +// CGlxMediaListCommandHandler::GetRequiredAttributesL +// --------------------------------------------------------------------------- +// +void CGlxMediaListCommandHandler::GetRequiredAttributesL( + RArray< TMPXAttribute >& aAttributes, + TBool aFilterUsingSelection) const + { + // Check selection length validitity first, because it is a very fast check, + // and covers so many situations + + + TInt commandCount = iCommandInfoArray.Count(); + + TBool requireMediaGeneralCategory = EFalse; + TBool requireMediaDrmProtected = EFalse; + TBool requireMediaGeneralSystemItem = EFalse; + TBool requireMediaGeneralFramecount = EFalse; + TBool requireMediaGeneralSlideshowableContent = EFalse; + + for (TInt i = 0; i < commandCount; i++) + { + + if (aFilterUsingSelection && IsDisabled(iCommandInfoArray[i])) + { + continue; // No need to add attributes if we already know that the command handler is disabled. + } + + // request category if matters + if (TCommandInfo::EIgnore != iCommandInfoArray[i].iCategoryRule) + { + requireMediaGeneralCategory = ETrue; + } + + // request drm info if matters + if (iCommandInfoArray[i].iDisallowDRM) + { + requireMediaDrmProtected = ETrue; + } + + // request system item info if matters + if (iCommandInfoArray[i].iDisallowSystemItems) + { + requireMediaGeneralSystemItem = ETrue; + } + + // request animated GIFs if matters + if (iCommandInfoArray[i].iDisallowAnimatedGIFs ) + { + requireMediaGeneralFramecount = ETrue; + } + + // request item count if this filter is specified + if (iCommandInfoArray[i].iMinSlideshowPlayableContainedItemCount ) + { + requireMediaGeneralSlideshowableContent = ETrue; + } + } + + if (requireMediaGeneralCategory) + { + aAttributes.AppendL(KMPXMediaGeneralCategory); + } + + if (requireMediaDrmProtected) + { + aAttributes.AppendL(KMPXMediaDrmProtected); + } + + if (requireMediaGeneralSystemItem) + { + aAttributes.AppendL(KGlxMediaGeneralSystemItem); + } + + if (requireMediaGeneralFramecount) + { + aAttributes.AppendL(KGlxMediaGeneralFramecount); + } + + if (requireMediaGeneralSlideshowableContent) + { + aAttributes.AppendL(KGlxMediaGeneralSlideshowableContent); + } + + DoGetRequiredAttributesL(aAttributes, aFilterUsingSelection); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxmpxcommandcommandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/src/glxmpxcommandcommandhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,666 @@ +/* +* Copyright (c) 2008-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: Media List Command Handler +* +*/ + + + + +#include + +#include "glxmpxcommandcommandhandler.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities + +/// @todo Move elsewhere +const TInt KGlxMaxNoteLength = 256; + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMpxCommandCommandHandler:: + CGlxMpxCommandCommandHandler(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + : CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem) + { + iAppUi = static_cast< CAknAppUi* >( CCoeEnv::Static()->AppUi() ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMpxCommandCommandHandler::~CGlxMpxCommandCommandHandler() + { + // cancel command if running + if (iProgressComplete) + { +// MediaList().Cancel(); + } + + delete iProgressDialog; + + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + } + +// ----------------------------------------------------------------------------- +// DoExecuteL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMpxCommandCommandHandler::DoExecuteL(TInt aCommandId, + MGlxMediaList& aList) + { + // reset progress complete flag + iProgressComplete = EFalse; + + // deriving class consumes command by default + TBool consume = ETrue; + TInt selectionCount = aList.SelectionCount(); + const TGlxMedia& focusedMedia = aList.Item(aList.FocusIndex()); + // show confirmation note + consume = ConfirmationNoteL(aCommandId, aList); + + // Check if the selected / focused file(s)s have been deleted from + // another application while the confirmation note is displayed + if (((selectionCount > 0) && (aList.SelectionCount() == 0)) || + ((selectionCount == 0) && + (focusedMedia.Id() != aList.Item(aList.FocusIndex()).Id()))) + { + // All the selected / focused item(s) have been deleted, + // do not allow the command to execute. + consume = EFalse; + } + + if ( consume ) + { + // get a command object from the deriving class. + // Allow deriving class modify the consume value, even without + // creating a commmand (in case it wants to filter out a command) + CMPXCommand* command = CreateCommandL(aCommandId, aList, consume); + + if (command) + { + CleanupStack::PushL(command); + + if ( CommandInfo(aCommandId).iStopAnimationForExecution ) + { + // Stop GIF animation + iAppUi->ProcessCommandL(EGlxCmdDisableAnimations); + iAnimationStopped = ETrue; + } + + // Add the pointer of this command handler as session id into the message + // This can be used to ensure that this object is the intended recipient + // of a message + command->SetTObjectValueL(KMPXCommandGeneralSessionId, + static_cast(this)); + + aList.AddMediaListObserverL(this); + + // @todo TRAP this? + aList.CommandL(*command); + + // raise progress note. Note will be closed when complete message received + ProgressNoteL(aCommandId); + + CleanupStack::PopAndDestroy(command); + } + } + + return consume; + } + +// ----------------------------------------------------------------------------- +// TryExitL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::TryExitL(TInt aErrorCode) + { + // any error will abort the command execution + if ( KErrNone != aErrorCode ) + { + // error received. Close progress note + DismissProgressNoteL(); + + // Remove medialist observer + RemoveMediaListObserver(); + + // handle error + HandleErrorL(aErrorCode); + } + else if (iProgressComplete) + { + // ask deriving class if it is ready to exit (i.e., to close progress note). + // (It may be waiting for another message, etc.) + if (OkToExit()) + { + // close progress note + DismissProgressNoteL(); + + // Remove medialist observer + RemoveMediaListObserver(); + + // show completion note + CompletionNoteL(); + } + } + } + + +// ----------------------------------------------------------------------------- +// Default implementation shows an error note +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleErrorL(TInt aErrorCode) + { + // show error note + GlxGeneralUiUtilities::ShowErrorNoteL(aErrorCode); + } + +// ----------------------------------------------------------------------------- +// Update progress +// ----------------------------------------------------------------------------- +// +TBool CGlxMpxCommandCommandHandler::UpdateProgressL(const CMPXMessage& aMessage, + TInt& aError) + { + TBool isComplete = EFalse; + + // should not receive any progress messages after progress is completed + __ASSERT_DEBUG(!iProgressComplete, Panic(EGlxPanicIllegalState)); + + /// @todo remove progress update error handling + TMPXAttribute currentCountAttr(KMPXMessageContentIdProgress, EMPXMessageProgressCurrentCount); + TMPXAttribute totalCountAttr(KMPXMessageContentIdProgress, EMPXMessageProgressTotalCount); + if ( ( KErrNone == aError ) && (aMessage.IsSupported(currentCountAttr)) + && (aMessage.IsSupported(totalCountAttr) ) ) + { + // get current and total count from the message + TInt currentValue = aMessage.ValueTObjectL(currentCountAttr); + TInt total= aMessage.ValueTObjectL(totalCountAttr); + + // update progress bar if not complete yet, otherwise remember completion + if ( currentValue < total ) + { + // Progress info construction may have failed, but command was issued before + if (iProgressInfo) + { + iProgressInfo->SetFinalValue(total); + iProgressInfo->SetAndDraw(currentValue); + } + } + else + { + isComplete = ETrue; + + if ( iAnimationStopped ) + { + // Restart animation + iAppUi->ProcessCommandL(EGlxCmdEnableAnimations); + iAnimationStopped = EFalse; + } + } + } + + return isComplete; + } + +// ----------------------------------------------------------------------------- +// Default implementation of advanced command handling does nothing +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::DoHandleCommandCompleteL(TAny* /*aSessionId*/, + CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/) + { + } + + +// ----------------------------------------------------------------------------- +// Default implementation of advanced message handling does nothing +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxMpxCommandCommandHandler::DoHandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList& /*aList*/) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Default implementation DoHandleItemAddedL does not do anything +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::DoHandleItemAddedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + } + +// ----------------------------------------------------------------------------- +// Default implementation is always ready to exit +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMpxCommandCommandHandler::OkToExit() const + { + return ETrue; + } + +// ----------------------------------------------------------------------------- +// Show confirmation note +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteL(TInt aCommandId, + MGlxMediaList& aMediaList) const + { + TInt selectionCount = aMediaList.SelectionCount(); + + // If media list is not empty, treat focused item as selected + // At this point can assume that the command was disabled + // if static items were not supported + if ( selectionCount == 0 && aMediaList.Count() > 0 ) + { + selectionCount = 1; + } + + // Show confirmation note + TBool confirmed = EFalse; + if ( selectionCount == 1 ) + { + confirmed = ConfirmationNoteSingleL(aCommandId, aMediaList); + } + else + { + confirmed = ConfirmationNoteMultipleL(aCommandId, aMediaList); + } + + return confirmed; + } + +// ----------------------------------------------------------------------------- +// So confirmation note if a single item is selected +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteSingleL(TInt aCommandId, + MGlxMediaList& aMediaList) const + { + // if no confirmation note shown, assume command is confirmed + TBool confirmed = ETrue; + + // get confirmation note text for single selection + HBufC* noteText = ConfirmationTextL(aCommandId, EFalse); // EFalse for single selection + if ( noteText ) + { + CleanupStack::PushL(noteText); + + // Retrieve title string for selected item from the collection plugin + + // create fetch context + TGlxSelectionIterator iterator; + iterator.SetRange(1); + CGlxAttributeContext* attributeContext = new(ELeave) CGlxAttributeContext(&iterator); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(KMPXMediaGeneralTitle); + + // add context to media list + aMediaList.AddContextL(attributeContext, KGlxFetchContextPriorityLow); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover(attributeContext, aMediaList); + // put to cleanupstack as cleanupstack is emptied before stack objects + // are deleted + CleanupClosePushL( contextRemover); + // retrieve title attribute + TInt err = GlxAttributeRetriever::RetrieveL(*attributeContext, aMediaList, EFalse); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + if ( err == KErrNone ) + { + // use iterator to get the index of the right item + iterator.SetToFirst(&aMediaList); + const CGlxMedia* media = aMediaList.Item(iterator++).Properties(); + + // noteText has a place for a title string in it + const TDesC& itemName = media->ValueText(KMPXMediaGeneralTitle); + + TBuf text; + StringLoader::Format(text, *noteText, -1, itemName); + + // show popup + confirmed = GlxGeneralUiUtilities::ConfirmQueryL(R_GLX_QUERY_YES_NO, text); + } + // (else) If error, assume confirmed anyway + + CleanupStack::PopAndDestroy(attributeContext); + CleanupStack::PopAndDestroy(noteText); + } + return confirmed; + } + +// ----------------------------------------------------------------------------- +// Confirmation note if multiple items are selected +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMpxCommandCommandHandler::ConfirmationNoteMultipleL(TInt aCommandId, + MGlxMediaList& aMediaList) const + { + // if no confirmation note shown, assume command is confirmed + TBool confirmed = ETrue; + + // get confirmation note text for multiselection + HBufC* noteText = ConfirmationTextL(aCommandId, ETrue); // ETrue for Multiselection + if ( noteText ) + { + CleanupStack::PushL(noteText); + + // string has a place for number in it, and that number should be populated with selected + // item count + TInt count = aMediaList.SelectionCount(); + + TBuf text; + GlxGeneralUiUtilities::FormatString(text, *noteText, -1, count, ETrue); + + // show popup + confirmed = GlxGeneralUiUtilities::ConfirmQueryL(R_GLX_QUERY_YES_NO, text); + + CleanupStack::PopAndDestroy(noteText); + } + return confirmed; + } + +// ----------------------------------------------------------------------------- +// Default implementation returns null, and no confirmation note will be shown +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC* CGlxMpxCommandCommandHandler::ConfirmationTextL(TInt /*aCommandId*/, + TBool /*aMultiSelection*/) const + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// Return default progress string +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC* CGlxMpxCommandCommandHandler::ProgressTextL(TInt /*aCommandId*/) const + { + // Lazy construction for resource file + if (iResourceOffset == 0) + { + // Load resource file + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + + // Store resource offset as member variable, so don't have to trap the + // leaving calls here + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + } + + // get progress note string + return StringLoader::LoadL( R_GLX_PROGRESS_GENERAL ); + } + +// ----------------------------------------------------------------------------- +// Default implementation returns null, and no completion note will be shown +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC* CGlxMpxCommandCommandHandler::CompletionTextL() const + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// ProgressNoteL +// ----------------------------------------------------------------------------- +// +void CGlxMpxCommandCommandHandler::ProgressNoteL(TInt aCommandId) + { + //MGlxMediaList& mediaList = MediaList(); + + // get progress note + HBufC* progressText = ProgressTextL(aCommandId); + __ASSERT_DEBUG(progressText, Panic(EGlxPanicNullDescriptor)); + CleanupStack::PushL(progressText); + // construct progress dialog + iProgressDialog = new(ELeave)CAknProgressDialog( + (REINTERPRET_CAST(CEikDialog**,&iProgressDialog))); + iProgressDialog->PrepareLC(R_GLX_PROGRESS_NOTE); + iProgressDialog->SetTextL(*progressText); + iProgressDialog->SetCallback(this); + + // pick up progress info so that progress notification can be later updated + iProgressInfo = iProgressDialog->GetProgressInfoL(); + + // launch the note + iProgressDialog->RunLD(); + CleanupStack::PopAndDestroy(progressText); + } + +// ----------------------------------------------------------------------------- +// DismissProgressNoteL +// ----------------------------------------------------------------------------- +// +void CGlxMpxCommandCommandHandler::DismissProgressNoteL() + { + // Close the progress note, if displayed + if (iProgressDialog) + { + iProgressDialog->ProcessFinishedL(); + iProgressDialog = NULL; + iProgressInfo = NULL; + } + } + +// ----------------------------------------------------------------------------- +// Remove MediaList Observer +// ----------------------------------------------------------------------------- +// +void CGlxMpxCommandCommandHandler::RemoveMediaListObserver() + { + MGlxMediaList& mediaList = MediaList(); + mediaList.RemoveMediaListObserver(this); + } + +// ----------------------------------------------------------------------------- +// Show a completion note +// ----------------------------------------------------------------------------- +// +void CGlxMpxCommandCommandHandler::CompletionNoteL() const + { + // Get completion note text + HBufC* noteText = CompletionTextL(); + if ( noteText ) + { + CleanupStack::PushL(noteText); + GlxGeneralUiUtilities::ShowConfirmationNoteL(*noteText, ETrue); + CleanupStack::PopAndDestroy(noteText); + } + } + +// ----------------------------------------------------------------------------- +// HandleItemAddedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleMediaL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleItemRemovedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleItemModifiedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleItemModifiedL(const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleAttributesAvailableL(TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleItemSelectedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleMessageL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleMessageL(const CMPXMessage& aMessage, + MGlxMediaList* aList) + { + if ((aMessage.IsSupported(KMPXMessageGeneralId) && + (aMessage.IsSupported(KMPXCommandGeneralSessionId)))) + { + TInt msgId = aMessage.ValueTObjectL(KMPXMessageGeneralId); + TAny* sessionId = aMessage.ValueTObjectL(KMPXCommandGeneralSessionId); + + TInt error = KErrNone; + // Check if this is a progress message and intended for this object + if ( KMPXMessageContentIdProgress == msgId && static_cast(this) == sessionId ) + { + // Update progress note + iProgressComplete = UpdateProgressL(aMessage, error); + } + else + { + // This is not a progress message - let deriving class handle + error = DoHandleMessageL(aMessage, *aList); + } + + // Check if ready to exit, i.e., to close progress note, and allow user + // to select another menu option + TryExitL(error); + } + } + +// ----------------------------------------------------------------------------- +// HandleMessageL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::HandleCommandCompleteL(TAny* aSessionId, + CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList) + { + // Unmark all medialist items. Exit Multiple marking mode upon command completion + iAppUi->ProcessCommandL(EGlxCmdEndMultipleMarking); + + ///@todo Enforce a single command request at a time on the media list. + DoHandleCommandCompleteL(aSessionId, aCommandResult, aError, aList); + iProgressComplete = ETrue; + TryExitL(aError); + } + +// ----------------------------------------------------------------------------- +// DialogDismissedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::DialogDismissedL(TInt /*aButtonId*/) + { + if (!iProgressComplete) + { + // Remove as media list observer + MGlxMediaList& mediaList = MediaList(); + mediaList.CancelCommand(); + mediaList.RemoveMediaListObserver(this); + } + } + +//----------------------------------------------------------------------------- +// DoActivateL +//----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::DoActivateL(TInt /*aViewId*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// Deactivate - Deactivate this command handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMpxCommandCommandHandler::Deactivate() + { + // Close the progress note, if displayed + if (iProgressDialog) + { + TRAP_IGNORE(DismissProgressNoteL()); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/BMARM/ut_cglxmedialistcommandhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/BMARM/ut_cglxmedialistcommandhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + CreateTestSuiteL__Fv @ 1 NONAME R3UNUSED ; CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/BWINS/ut_cglxmedialistcommandhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/BWINS/ut_cglxmedialistcommandhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/eabi/ut_cglxmedialistcommandhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/eabi/ut_cglxmedialistcommandhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2008-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: Build information file for project commandhandlers + * +*/ + + + + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +#include "../ut_cglxmedialistcommandhandler/group/bld.inf" + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/bwins/ut_cglxmedialistcommandhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/bwins/ut_cglxmedialistcommandhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +EXPORTS + ?MediaList@CGlxMediaListCommandHandler@@IBEABVMGlxMediaList@@XZ @ 1 NONAME ; class MGlxMediaList const & CGlxMediaListCommandHandler::MediaList(void) const + ??1CGlxMediaListCommandHandler@@UAE@XZ @ 2 NONAME ; CGlxMediaListCommandHandler::~CGlxMediaListCommandHandler(void) + ?IsSupported@CGlxMediaListCommandHandler@@IBEHH@Z @ 3 NONAME ; int CGlxMediaListCommandHandler::IsSupported(int) const + ?GetRequiredAttributesL@CGlxMediaListCommandHandler@@UBEXAAV?$RArray@VTMPXAttribute@@@@HHH@Z @ 4 NONAME ; void CGlxMediaListCommandHandler::GetRequiredAttributesL(class RArray &, int, int, int) const + ?SelectionLength@CGlxMediaListCommandHandler@@IBEHXZ @ 5 NONAME ; int CGlxMediaListCommandHandler::SelectionLength(void) const + ?CommandInfo@CGlxMediaListCommandHandler@@IAEAAUTCommandInfo@1@H@Z @ 6 NONAME ; struct CGlxMediaListCommandHandler::TCommandInfo & CGlxMediaListCommandHandler::CommandInfo(int) + ?DoActivateL@CGlxMediaListCommandHandler@@MAEXH@Z @ 7 NONAME ; void CGlxMediaListCommandHandler::DoActivateL(int) + ?Deactivate@CGlxMediaListCommandHandler@@UAEXXZ @ 8 NONAME ; void CGlxMediaListCommandHandler::Deactivate(void) + ?PreDynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXH@Z @ 9 NONAME ; void CGlxMediaListCommandHandler::PreDynInitMenuPaneL(int) + ?DynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXHPAVCEikMenuPane@@@Z @ 10 NONAME ; void CGlxMediaListCommandHandler::DynInitMenuPaneL(int, class CEikMenuPane *) + ?DoGetRequiredAttributesL@CGlxMediaListCommandHandler@@MBEXAAV?$RArray@VTMPXAttribute@@@@H@Z @ 11 NONAME ; void CGlxMediaListCommandHandler::DoGetRequiredAttributesL(class RArray &, int) const + ?BypassFiltersForMenu@CGlxMediaListCommandHandler@@MBEHXZ @ 12 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForMenu(void) const + ?ViewingState@CGlxMediaListCommandHandler@@IBE?AW4TViewingState@TCommandInfo@1@XZ @ 13 NONAME ; enum CGlxMediaListCommandHandler::TCommandInfo::TViewingState CGlxMediaListCommandHandler::ViewingState(void) const + ?CommandInfoIndex@CGlxMediaListCommandHandler@@ABEHH@Z @ 14 NONAME ; int CGlxMediaListCommandHandler::CommandInfoIndex(int) const + ??0TCommandInfo@CGlxMediaListCommandHandler@@QAE@H@Z @ 15 NONAME ; CGlxMediaListCommandHandler::TCommandInfo::TCommandInfo(int) + ?BypassFiltersForExecute@CGlxMediaListCommandHandler@@MBEHXZ @ 16 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForExecute(void) const + ?DoIsDisabled@CGlxMediaListCommandHandler@@MBEHHAAVMGlxMediaList@@@Z @ 17 NONAME ; int CGlxMediaListCommandHandler::DoIsDisabled(int, class MGlxMediaList &) const + ?OfferKeyEventL@CGlxMediaListCommandHandler@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 18 NONAME ; enum TKeyResponse CGlxMediaListCommandHandler::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?AddCommandL@CGlxMediaListCommandHandler@@IAEXABUTCommandInfo@1@@Z @ 19 NONAME ; void CGlxMediaListCommandHandler::AddCommandL(struct CGlxMediaListCommandHandler::TCommandInfo const &) + ?MediaList@CGlxMediaListCommandHandler@@IAEAAVMGlxMediaList@@XZ @ 20 NONAME ; class MGlxMediaList & CGlxMediaListCommandHandler::MediaList(void) + ??0CGlxMediaListCommandHandler@@QAE@PAVMGlxMediaListProvider@@H@Z @ 21 NONAME ; CGlxMediaListCommandHandler::CGlxMediaListCommandHandler(class MGlxMediaListProvider *, int) + ?IsDisabledL@CGlxMediaListCommandHandler@@IBEHHAAVMGlxMediaList@@@Z @ 22 NONAME ; int CGlxMediaListCommandHandler::IsDisabledL(int, class MGlxMediaList &) const + ?DoDynInitMenuPaneL@CGlxMediaListCommandHandler@@MAEXHPAVCEikMenuPane@@@Z @ 23 NONAME ; void CGlxMediaListCommandHandler::DoDynInitMenuPaneL(int, class CEikMenuPane *) + ?ExecuteL@CGlxMediaListCommandHandler@@UAEHH@Z @ 24 NONAME ; int CGlxMediaListCommandHandler::ExecuteL(int) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Build information file for command handlers. +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +//ut_cglxmedialistcommandhandler.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/group/ut_cglxmedialistcommandhandler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/group/ut_cglxmedialistcommandhandler.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: ut_cglxmedialistcommandhandler project definition +* +*/ + + + +#include +//#include "../../../../../../group/glxbuildcommon.mmh" + +TARGET ut_cglxmedialistcommandhandler.dll +TARGETTYPE dll +TARGETPATH /DigiaEUnit/Tests +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB -DRM + + +// Sources needed by the test +SOURCEPATH ../../../src +SOURCE glxmedialistcommandhandler.cpp + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../../../inc +SYSTEMINCLUDE ../../../../../medialists/inc +SYSTEMINCLUDE ../../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../inc + + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../commandhandlers/inc +SYSTEMINCLUDE ../../../../viewframework/inc + + +LIBRARY aknicon.lib +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknskins.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY cdlengine.lib +LIBRARY CommonEngine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY estor.lib +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY hlplch.lib + +// HUI +LIBRARY hitchcock.lib + +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib +LIBRARY ws32.lib +LIBRARY glxcommandhandlerbase.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/inc/ut_cglxmedialistcommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/inc/ut_cglxmedialistcommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2004 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: CGlxMediaListCommandHandler unit test cases +* +*/ + + + + +#ifndef __UT_CGLXMEDIALISTCOMMANDHANDLER_H__ +#define __UT_CGLXMEDIALISTCOMMANDHANDLER_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxMediaListCommandHandler; +class _CGlxTestMediaList; + +#include +#ifndef NONSHARABLE_CLASS + #define NONSHARABLE_CLASS(x) class x +#endif + +// CLASS DEFINITION +/** + * + * EUnitWizard generated test class. + * + */ +NONSHARABLE_CLASS( UT_CGlxMediaListCommandHandler ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static UT_CGlxMediaListCommandHandler* NewL(); + static UT_CGlxMediaListCommandHandler* NewLC(); + /** + * Destructor + */ + ~UT_CGlxMediaListCommandHandler(); + + private: // Constructors and destructors + + UT_CGlxMediaListCommandHandler(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void Test_SelectionLengthL(); + void Test_IsDisabledL(); + + private: // Data + + EUNIT_DECLARE_TEST_TABLE; + + _CGlxTestMediaList* iML; + }; + +#endif // __UT_CGLXMEDIALISTCOMMANDHANDLER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/src/ut_cglxmedialistcommandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/src/ut_cglxmedialistcommandhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,666 @@ +/* +* Copyright (c) 2004 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: CGlxMediaListCommandHandler unit test cases +* +*/ + + + + +// CLASS HEADER +#include "UT_CGlxMediaListCommandHandler.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + +// ----------------------------------------------------------------------------- +// Set the value for a specific attribute +// ----------------------------------------------------------------------------- +// +// +CGlxMedia::CGlxMedia(const TGlxMediaId& aId) + : iId(aId) + { + } + +CGlxMedia::~CGlxMedia() + { + iUsers.Close(); + + Reset(); + iValues.Close(); + iAttributes.Close(); + } + +class _CGlxTestMediaList: public CBase, public MGlxMediaList + { +public: + ~_CGlxTestMediaList() + { + iItems.Close(); + iMedia.ResetAndDestroy(); + iSelectedItems.Close(); + } + + virtual void Close() + { + }; + virtual TGlxMediaListId Id() const + { + return KGlxIdNone; + } + + virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const + { + return iItems.Count(); + } + + virtual TInt FocusIndex() const + { + return iFocusIndex; + } + + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) + { + iFocusIndex = aValue; + } + + virtual const TGlxMedia& Item(TInt aIndex) const + { + return iItems[aIndex]; + } + + virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& aId) const + { + TInt count = iItems.Count(); + for (TInt i = 0; i < count; i++) + { + if (iItems[i].Id() == aId) + { + return i; + } + } + return KErrNotFound; + } + + virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) + { + } + + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) + { + } + + virtual MMPXCollection& Collection() const + { + // we know that this method is not called in our tests, this is just to make the code compile + MMPXCollection* empty = NULL; + return *empty; + } + + virtual TBool IsSelected(TInt aIndex) const + { + return iSelectedItems.Find(aIndex); + } + + virtual void SetSelectedL(TInt aIndex, TBool aSelected) + { + if (aSelected) + { + iSelectedItems.InsertInOrder(aIndex); + } + else + { + iSelectedItems.Remove(iSelectedItems.Find(aIndex)); + } + } + + virtual const TArray Selection() const + { + return iSelectedItems.Array(); + } + + virtual void CommandL(CMPXCommand& /*aCommand*/) + { + } + + virtual void CancelCommand() + { + } + + virtual void SetFilterL(CMPXFilter* /*aFilter*/) + { + } + + virtual CMPXFilter* Filter() const + { + return NULL; + } + + virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const + { + return KGlxIdNone; + } + + void AppendL(TInt aId, TBool aCreateMedia) + { + if (aCreateMedia) + { + CGlxMedia* media = new (ELeave) CGlxMedia(TGlxMediaId(aId)); + CleanupStack::PushL(media); + iMedia.AppendL(media); + CleanupStack::Pop(media); + iItems.AppendL(TGlxMedia(TGlxMediaId(aId), media)); + } + else + { + iItems.AppendL(TGlxMedia(TGlxMediaId(aId))); + } + } + + CGlxMedia* MediaObj(TInt aIndex) const + { + return const_cast(static_cast(iItems[aIndex].Properties())); + } + + CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const + { + return NULL; + } + + TInt SelectionCount() const + { + return iSelectedItems.Count(); + } + + TInt SelectedItemIndex(TInt aSelectionIndex) const + { + TInt idx = KErrNotFound; + if(aSelectionIndex iItems; + RPointerArray iMedia; + RArray iSelectedItems; + TInt iFocusIndex; + TBool iStaticItemsEnabled; + }; + +// INTERNAL INCLUDES +#include "glxmedialistcommandhandler.h" + +// CONSTRUCTION +UT_CGlxMediaListCommandHandler* UT_CGlxMediaListCommandHandler::NewL() + { + UT_CGlxMediaListCommandHandler* self = UT_CGlxMediaListCommandHandler::NewLC(); + CleanupStack::Pop(); + + return self; + } + +UT_CGlxMediaListCommandHandler* UT_CGlxMediaListCommandHandler::NewLC() + { + UT_CGlxMediaListCommandHandler* self = new( ELeave ) UT_CGlxMediaListCommandHandler(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +UT_CGlxMediaListCommandHandler::~UT_CGlxMediaListCommandHandler() + { + delete iML; + } + +// Default constructor +UT_CGlxMediaListCommandHandler::UT_CGlxMediaListCommandHandler() + { + } + +// Second phase construct +void UT_CGlxMediaListCommandHandler::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + + +void UT_CGlxMediaListCommandHandler::SetupL( ) + { + } + +void UT_CGlxMediaListCommandHandler::Teardown( ) + { + delete iML; + iML = NULL; + } + + +struct CTestHandler : public CGlxMediaListCommandHandler, public MGlxMediaListProvider + { + CTestHandler(MGlxMediaList* aList) : CGlxMediaListCommandHandler(this) + { + iList = aList; + } + + virtual TBool DoExecuteL(TInt /*aCommandId*/, MGlxMediaList& /*aList*/) + { + return ETrue; + } + + virtual MGlxMediaList& MediaList() + { + return *iList; + } + + virtual TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& /*aMediaList*/) const + { + EUNIT_ASSERT( aCommandId == iCommandId ); + return iDisabled; + } + + TBool iDisabled; + TInt iCommandId; + MGlxMediaList* iList; + }; + +// ----------------------------------------------------------------------------- +// Test: static TInt SelectionLength(MGlxMediaList& aMediaList); +// ----------------------------------------------------------------------------- +// +void UT_CGlxMediaListCommandHandler::Test_SelectionLengthL( ) + { +#if 1 // This unit test needs to be re-wirtten after changes to SelectionLength() method. + iML = new (ELeave) _CGlxTestMediaList; + + CTestHandler* ch = new (ELeave) CTestHandler(iML); + CleanupStack::PushL(ch); + + EUNIT_ASSERT( ch->SelectionLength() == 0); + + iML->AppendL(1, ETrue); + iML->AppendL(2, ETrue); + iML->AppendL(3, ETrue); + iML->iFocusIndex = 0; + + EUNIT_ASSERT( ch->SelectionLength() == 1); + iML->iFocusIndex = 1; + EUNIT_ASSERT( ch->SelectionLength() == 1); + + iML->SetSelectedL(0, ETrue); + EUNIT_ASSERT( ch->SelectionLength() == 1); + iML->SetSelectedL(1, ETrue); + EUNIT_ASSERT( ch->SelectionLength() == 2); + iML->SetSelectedL(2, ETrue); + EUNIT_ASSERT( ch->SelectionLength() == 3); + + CleanupStack::PopAndDestroy(ch); + delete iML; + iML = NULL; +#endif + } + +// ----------------------------------------------------------------------------- +// Test: IMPORT_C virtual TBool IsDisabled(TInt aCommandId, MGlxMediaList& aList) const; +// ----------------------------------------------------------------------------- +// +void UT_CGlxMediaListCommandHandler::Test_IsDisabledL() + { + iML = new (ELeave) _CGlxTestMediaList; + iML->iFocusIndex = -1; + + CTestHandler* ch = new (ELeave) CTestHandler(iML); + CleanupStack::PushL(ch); + ch->iCommandId = 1; + CGlxMediaListCommandHandler::TCommandInfo info(1); + ch->AddCommandL(info); + + ////////////////////////////////////////////////////// + // NO FILTERING + // Empty view, no filtering + EUNIT_ASSERT_DESC( !ch->IsDisabledL(1, *iML), + "in empty view with no filtering command is not disabled" ); + ch->CommandInfo(1).iMinSelectionLength = 1; + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + ch->CommandInfo(1).iMinSelectionLength = 0; + + // Add items + iML->AppendL(1, ETrue); + iML->AppendL(2, ETrue); + iML->AppendL(3, ETrue); + iML->AppendL(4, ETrue); + iML->iFocusIndex = 0; + + // Empty view, no filtering + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + + // Selection 0-1 + iML->SetSelectedL(0, ETrue); + iML->SetSelectedL(1, ETrue); + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + + ////////////////////////////////////////////////////// + // Filter size + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + // Selection 0-1 + ch->CommandInfo(1).iMinSelectionLength = 1; + ch->CommandInfo(1).iMaxSelectionLength = 2; + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + iML->SetSelectedL(2, ETrue); + // Selection 0-1-2 + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + iML->SetSelectedL(2, EFalse); + // Selection 0-1 + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + iML->SetSelectedL(1, EFalse); + // Selection 0 + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + iML->SetSelectedL(0, EFalse); + // Selection none (not empty view( + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + + ////////////////////////////////////////////////////// + // Filter category + { + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + ch->CommandInfo(1).iMinSelectionLength = 0; + ch->CommandInfo(1).iMaxSelectionLength = KMaxTInt; + iML->MediaObj(0)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + iML->MediaObj(1)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + iML->MediaObj(2)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + iML->MediaObj(3)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + // Require all images + ch->CommandInfo(1).iCategoryFilter = EMPXImage; + ch->CommandInfo(1).iCategoryRule = CGlxMediaListCommandHandler::TCommandInfo::ERequireAll; + + // No selection, focus on 0 + iML->iFocusIndex = 0; + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + // No selection, focus on 2 + iML->iFocusIndex = 2; + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + + // Selection 0,1 + iML->SetSelectedL(0, ETrue); + iML->SetSelectedL(1, ETrue); + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + // Selection 0,1,2 + iML->SetSelectedL(2, ETrue); + EUNIT_ASSERT_DESC( ch->IsDisabledL(1, *iML), "no all are images so IsDisabled" ); + // Selection 0,1,2,3 + iML->SetSelectedL(3, ETrue); + EUNIT_ASSERT_DESC( ch->IsDisabledL(1, *iML), "no all are images so IsDisabled" ); + + // Disable if all are not images + ch->CommandInfo(1).iCategoryRule = CGlxMediaListCommandHandler::TCommandInfo::EForbidAll; + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + iML->SetSelectedL(2, EFalse); + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + + // Cleanup for next test + ch->CommandInfo(1).iCategoryRule = CGlxMediaListCommandHandler::TCommandInfo::EIgnore; + iML->SetSelectedL(0, EFalse); + iML->SetSelectedL(1, EFalse); + iML->SetSelectedL(3, EFalse); + } + + ////////////////////////////////////////////////////// + // Filter drm + { + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + iML->MediaObj(0)->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + iML->MediaObj(1)->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + iML->MediaObj(2)->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + iML->MediaObj(3)->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + // dont allow DRM + ch->CommandInfo(1).iDisallowDRM = ETrue; + + // No selection, focus on 0 + iML->iFocusIndex = 0; + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + // No selection, focus on 2 + iML->iFocusIndex = 2; + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + + // Selection 1,2 + iML->SetSelectedL(0, ETrue); + iML->SetSelectedL(1, ETrue); + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + // Selection 1,2,3 + iML->SetSelectedL(2, ETrue); + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + + // Cleanup for next test + ch->CommandInfo(1).iDisallowDRM = EFalse; + iML->SetSelectedL(0, EFalse); + iML->SetSelectedL(1, EFalse); + iML->SetSelectedL(2, EFalse); + } + + ////////////////////////////////////////////////////// + // Filter system items + { + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + iML->MediaObj(0)->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + iML->MediaObj(1)->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + iML->MediaObj(2)->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + iML->MediaObj(3)->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + + // Dont allow system items + ch->CommandInfo(1).iDisallowSystemItems = ETrue; + + // No selection, focus on 0 + iML->iFocusIndex = 0; + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + // No selection, focus on 2 + iML->iFocusIndex = 2; + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + + // Selection 1,2 + iML->SetSelectedL(0, ETrue); + iML->SetSelectedL(1, ETrue); + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + // Selection 1,2,3 + iML->SetSelectedL(2, ETrue); + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + } + + ////////////////////////////////////////////////////// + // Filter deriving class + { + EUNIT_ASSERT( !ch->IsDisabledL(1, *iML) ); + ch->iDisabled = ETrue; + EUNIT_ASSERT( ch->IsDisabledL(1, *iML) ); + ch->iDisabled = EFalse; + } + + + ////////////////////////////////////////////////////// + // Combined Filter + { + // create a few more items + iML->AppendL(5, ETrue); + iML->AppendL(6, ETrue); + iML->AppendL(7, ETrue); + + // set attributes + // item 0 is a DRM protected video + iML->MediaObj(0)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + iML->MediaObj(0)->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + iML->MediaObj(0)->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + iML->MediaObj(0)->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + iML->MediaObj(0)->SetTObjectValueL(KMPXMediaGeneralCount, 1); + // item 1 is a Animated GIF, non DRM protected + iML->MediaObj(1)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + iML->MediaObj(1)->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + iML->MediaObj(1)->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + iML->MediaObj(1)->SetTObjectValueL(KGlxMediaGeneralFramecount, 10); + iML->MediaObj(1)->SetTObjectValueL(KMPXMediaGeneralCount, 1); + // item 2 is an Album with 5 items, also a system item + iML->MediaObj(2)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXAlbum); + iML->MediaObj(2)->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + iML->MediaObj(2)->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + iML->MediaObj(2)->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + iML->MediaObj(2)->SetTObjectValueL(KMPXMediaGeneralCount, 5); + // item 3 is a DRM protected image + iML->MediaObj(3)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + iML->MediaObj(3)->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + iML->MediaObj(3)->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + iML->MediaObj(3)->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + iML->MediaObj(3)->SetTObjectValueL(KMPXMediaGeneralCount, 1); + // item 4 is a non DRM protected image, but a system item + iML->MediaObj(4)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + iML->MediaObj(4)->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + iML->MediaObj(4)->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + iML->MediaObj(4)->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + iML->MediaObj(4)->SetTObjectValueL(KMPXMediaGeneralCount, 1); + // item 5 is a non DRM protected video + iML->MediaObj(5)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + iML->MediaObj(5)->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + iML->MediaObj(5)->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + iML->MediaObj(5)->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + iML->MediaObj(5)->SetTObjectValueL(KMPXMediaGeneralCount, 1); + // item 6 is an Album with 0 items + iML->MediaObj(6)->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXAlbum); + iML->MediaObj(6)->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + iML->MediaObj(6)->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + iML->MediaObj(6)->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); + iML->MediaObj(6)->SetTObjectValueL(KMPXMediaGeneralCount, 0); + + // set selection + ch->CommandInfo(1).iMinSelectionLength = 0; + ch->CommandInfo(1).iMaxSelectionLength = 7; + // Drop all videos + ch->CommandInfo(1).iCategoryFilter = EMPXVideo; + ch->CommandInfo(1).iCategoryRule = CGlxMediaListCommandHandler::TCommandInfo::EForbidAll; + // Dont allow system items + ch->CommandInfo(1).iDisallowSystemItems = ETrue; + // dont allow DRM + ch->CommandInfo(1).iDisallowDRM = ETrue; + // dont allow animated gif + ch->CommandInfo(1).iDisallowAnimatedGIFs = ETrue; + // allow only containers with 1 or more items + ch->CommandInfo(1).iMinSlideshowPlayableContainedItemCount = 1; + + // Set selection, select all + iML->SetSelectedL(0, ETrue); + iML->SetSelectedL(1, ETrue); + iML->SetSelectedL(2, ETrue); + iML->SetSelectedL(3, ETrue); + iML->SetSelectedL(4, ETrue); + iML->SetSelectedL(5, ETrue); + iML->SetSelectedL(6, ETrue); + EUNIT_ASSERT_DESC( ch->IsDisabledL(1, *iML), "no valid items to show so IsDisabled" ); + // Allow system items + ch->CommandInfo(1).iDisallowSystemItems = EFalse; + EUNIT_ASSERT_DESC( !ch->IsDisabledL(1, *iML), "valid items to show so not disabled" ); + // unselect item 4 + iML->SetSelectedL(4, EFalse); + EUNIT_ASSERT_DESC( !ch->IsDisabledL(1, *iML), "valid items to show so not disabled" ); + // unselect item 2 + iML->SetSelectedL(2, EFalse); + EUNIT_ASSERT_DESC( ch->IsDisabledL(1, *iML), "no valid items to show so IsDisabled" ); + // re-select item 4 + iML->SetSelectedL(4, ETrue); + EUNIT_ASSERT_DESC( !ch->IsDisabledL(1, *iML), "valid items to show so not disabled" ); + // unselect item 4 + iML->SetSelectedL(4, EFalse); + EUNIT_ASSERT_DESC( ch->IsDisabledL(1, *iML), "no valid items to show so IsDisabled" ); + // Allow DRM + ch->CommandInfo(1).iDisallowDRM = EFalse; + EUNIT_ASSERT_DESC( !ch->IsDisabledL(1, *iML), "valid items to show so not disabled" ); + // unselect item 3 + iML->SetSelectedL(3, EFalse); + EUNIT_ASSERT_DESC( ch->IsDisabledL(1, *iML), "no valid items to show so IsDisabled" ); + } + + + CleanupStack::PopAndDestroy(ch); + + delete iML; + iML = NULL; + } + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + UT_CGlxMediaListCommandHandler, + "Medialist command handler", + "UNIT" ) + +EUNIT_TEST( + "SelectionLength", + "CGlxMediaListCommandHandler", + "SelectionLength", + "FUNCTIONALITY", + SetupL, Test_SelectionLengthL, Teardown) + +/*EUNIT_TEST( + "IsDisabledL", + "CGlxMediaListCommandHandler", + "IsDisabledL", + "FUNCTIONALITY", + SetupL, Test_IsDisabledL, Teardown)*/ + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/src/ut_cglxmedialistcommandhandlerdllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerbase/tsrc/ut_cglxmedialistcommandhandler/src/ut_cglxmedialistcommandhandlerdllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2004 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: CGlxMediaListCommandHandler unit test application +* +*/ + + + + +// CLASS HEADER +#include "UT_CGlxMediaListCommandHandler.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return UT_CGlxMediaListCommandHandler::NewL(); + } + + + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/bwins/glxcommandhandlerdrmu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/bwins/glxcommandhandlerdrmu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ??1CGlxCommandHandlerDrm@@UAE@XZ @ 1 NONAME ; CGlxCommandHandlerDrm::~CGlxCommandHandlerDrm(void) + ?NewL@CGlxCommandHandlerDrm@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 2 NONAME ; class CGlxCommandHandlerDrm * CGlxCommandHandlerDrm::NewL(class MGlxMediaListProvider *, int) + ??1CGlxDrmIconManager@@UAE@XZ @ 3 NONAME ; CGlxDrmIconManager::~CGlxDrmIconManager(void) + ?NewL@CGlxDrmIconManager@@SAPAV1@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 4 NONAME ; class CGlxDrmIconManager * CGlxDrmIconManager::NewL(class MGlxMediaList &, class MGlxVisualList &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/eabi/glxcommandhandlerdrmu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/eabi/glxcommandhandlerdrmu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,10 @@ +EXPORTS + _ZN18CGlxDrmIconManager4NewLER13MGlxMediaListR14MGlxVisualList @ 1 NONAME + _ZN18CGlxDrmIconManagerD0Ev @ 2 NONAME + _ZN18CGlxDrmIconManagerD1Ev @ 3 NONAME + _ZN18CGlxDrmIconManagerD2Ev @ 4 NONAME + _ZN21CGlxCommandHandlerDrm4NewLEP21MGlxMediaListProvideri @ 5 NONAME + _ZN21CGlxCommandHandlerDrmD0Ev @ 6 NONAME + _ZN21CGlxCommandHandlerDrmD1Ev @ 7 NONAME + _ZN21CGlxCommandHandlerDrmD2Ev @ 8 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Build information file for DRM command handler + * +*/ + + + + +#include +PRJ_EXPORTS +../rom/glxcommandhandlerdrm.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxcommandhandlerdrm.iby) + +PRJ_MMPFILES +glxcommandhandlerdrm.mmp + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/group/glxcommandhandlerdrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/group/glxcommandhandlerdrm.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2008-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: DRM command handler mmp file +* +*/ + + + + +#include "../../../../group/glxbuildcommon.mmh" +#include + +TARGET glxcommandhandlerdrm.dll +TARGETTYPE DLL +UID 0x1000008d 0x2000A7B5 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src + +SOURCE glxcommandhandlerdrm.cpp +SOURCE glxdrmiconmanager.cpp + +USERINCLUDE ../inc + + +//System Includes +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../drmutility/inc +SYSTEMINCLUDE ../../../texturemanager/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc + +LIBRARY euser.lib +LIBRARY flogger.lib // For Logging Tracer + +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxdrmutility.lib +LIBRARY glxmedialists.lib +LIBRARY glxtexturemanager.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib + +// HUI +LIBRARY hitchcock.lib +LIBRARY mpxcommon.lib + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/inc/glxcommandhandlerdrm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/inc/glxcommandhandlerdrm.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2008-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: DRM rights handler +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + +#ifndef C_GLXCOMMANDHANDLERDRM_H +#define C_GLXCOMMANDHANDLERDRM_H + +// INCLUDES +#include +#include + +#include +#include + +// FORWARD DECLARATIONS +class CGlxDRMUtility; +class CGlxDrmIconManager; +class CGlxDefaultAttributeContext; +class MGlxVisualList; +class CGlxMedia; +class CGlxUiUtility; +class CGlxVisualListManager; +// CLASS DECLARATION + +//class + +/** + * CGlxDRMCommandHandler class + * Handler for DRM related commands + * @glxdrmcommandhandler.lib + * @author M Byrne + */ +NONSHARABLE_CLASS( CGlxCommandHandlerDrm ) : public CGlxMediaListCommandHandler, + public MGlxMediaListObserver, + public MGlxVisualListObserver + { +public : //constructor and desctructor + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aIsContainerList + */ +IMPORT_C static CGlxCommandHandlerDrm* NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aIsContainerList); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerDrm(); + + /** See @ref CGlxCommandHandler::DoActivateL */ + void DoActivateL(TInt aViewId); + + /** See @ref MGlxCommandHandler::Deactivate */ + void Deactivate(); + +public: // From MGlxMediaListObserver + /// See @ref MGlxMediaListObserver::HandleItemAddedL + virtual void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMediaL + virtual void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemRemovedL + virtual void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemModifiedL + virtual void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL + virtual void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleFocusChangedL + virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemSelectedL + virtual void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMessageL + virtual void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +public: // from MGlxVisualListObserver + /** @see MGlxVisualListObserver::HandleFocusChangedL */ + void HandleFocusChangedL( TInt aFocusIndex, TReal32 aItemsPerSecond, MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType ); + /** @see MGlxVisualListObserver::HandleSizeChanged */ + void HandleSizeChanged( const TSize& aSize, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualRemoved */ + void HandleVisualRemoved( const CAlfVisual* aVisual, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualAddedL */ + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + +protected: + /** see CGlxMediaListCommandHandler::DoExecuteL */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + /** @see CGlxMediaListCommandHandler::DoIsDisabled */ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + /** Second phase constructor */ + void ConstructL(TBool aIsContainerList); + + /** Constructor */ + CGlxCommandHandlerDrm(MGlxMediaListProvider* aMediaListProvider); + + /** + * Determine if DRM rights need to be consuned based on thumbnail + * or visual size + * @param aItemIndex index of item in media list + * @param aImageSize size of image + * @param aBitmapSize bitmap size + * @return ETrue if rights are to be consumed + */ + TBool ConsumeRightsBasedOnSize(TInt aItemIndex, TSize aImageSize, + TSize aBitmapSize); + + /** + * Consume DRM rights if required + */ + void ConsumeDRMRightsL(); + + /** + * Get size of thumbnail (assuming largest used if DRM rights + * are valid). + * @param aMedia CGlxMedia item for current item + * @return TSize of thumbnail + */ + TSize ThumbnailSize(const CGlxMedia* aMedia); + +private: + /// Resource file offset + TInt iResourceOffset; + // Does the list contain containers or items + TInt iIsContainerList; + + /** Poniter to instance of DRM utility (owned) */ + CGlxDRMUtility* iDrmUtility; + + /** DRM icon manager - owned */ + CGlxDrmIconManager* iDrmIconManager; + + /** Fetch context to retrieve DRM releated attributes (owned) */ + CGlxDefaultAttributeContext* iFetchContext; + + /** Visual list manager (owned) */ + CGlxVisualListManager* iVisualListManager; + + /** Visual list used by DRM command handler (owned) */ + MGlxVisualList* iVisualList; + + /** URI for media list item (owned) */ + mutable HBufC* iUrl; + + /** flag to indicate whether full-screen view active + based on dummy view-state commands */ + TBool iInFullScreen; + + /** HUI utility class (owned) */ + CGlxUiUtility* iUiUtility; + + /** have we already checked rights for current item */ + TBool iDrmRightsChecked; + }; + +#endif // C_GLXDRMCOMMANDHANDLER_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/inc/glxdrmiconmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/inc/glxdrmiconmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2008-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: Icon manager for DRM rights icons +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + +#ifndef C_GLXDRMICONMANAGER_H +#define C_GLXDRMICONMANAGER_H + +#include + +#include "glxiconmanager.h" + +/** + * CGlxDRMIconManager + * + * Icon manager for visuals + * Handles adding default or broken icon if required. + * If thumbnail not present look for icon attribute + * @author M Byrne + * @lib glxvisuallistmanager + */ +struct TIconInfo; +class CAlfVisual; +class CGlxDRMUtility; +class TGlxMediaId; +class CAlfTexture; + +NONSHARABLE_CLASS( CGlxDrmIconManager ) : public CGlxIconManager + { +public: + /** + * Static constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + * @return pointer to CGlxVisualIconManager instance + */ + IMPORT_C static CGlxDrmIconManager* NewL(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + + /** + * Destructor + */ + IMPORT_C ~CGlxDrmIconManager(); + + /** + * Remove overlay icon (when enter full-screen) + * @param aIndex list index of item + * @param aInvalidIcon ETrue if DRM invalid icon present + */ + void RemoveOverlayIcon(TInt aIndex, TBool aInvalidIcon); + + /** + * Remove overlay icons (when exit full-screen) + */ + void AddOverlayIconsL(); + +private: // From MGlxMediaListObserver + /// See @ref MGlxMediaListObserver::HandleItemAddedL + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMediaL + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemRemovedL + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemModifiedL + void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleFocusChangedL + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemSelectedL + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMessageL + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: // from MGlxVisualListObserver + /** @see MGlxVisualListObserver::HandleFocusChangedL */ + void HandleFocusChangedL( TInt aFocusIndex, TReal32 aItemsPerSecond, MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType ); + /** @see MGlxVisualListObserver::HandleSizeChanged */ + void HandleSizeChanged( const TSize& aSize, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualRemoved */ + void HandleVisualRemoved( const CAlfVisual* aVisual, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualAddedL */ + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + +private: + /** + * Identifiers for DRM icons + */ + enum TGlxVisualIcon + { + EDRMRightsValidIcon, + EDRMRightsInvalidIcon + }; + +private: + /** + * Constructor + * @param aMediaList pointer to media list + * @param aVisualList reference to associated visual list + */ + CGlxDrmIconManager(MGlxMediaList& aMediaList, MGlxVisualList& aVisualList); + + /** + * 2nd phase construction + */ + void ConstructL(); + + /** + * Check if thumbnail icon has already been generated + * @param aIconInfo TIconInfo struct for icon + * @return position of icon in iThumbnailIcons, + * KErrNotFound if icon not present + */ + TInt ThumbnailIconArrayPos(TIconInfo& aIconInfo); + + + /** + * Check if thumbnail attribute is present for specifed vis. + * If not add icon if present or add default icon + * @param pointer to visual may be NULL + * @param aIndex index of item is media list + * @param aForceIcon force icon to be draw + */ + void CheckDRMRightsL(CAlfVisual* aVisual, + TInt aIndex, TBool aForceIcon = ETrue); + + /** + * Add item to array of items with valid DRM icons + * @param aId id of item + */ + void AddValidIconL(TGlxMediaId& aId); + + /** + * Add item to array of items with invalid DRM icons + * @param aId id of item + */ + void AddInvalidIconL(TGlxMediaId& aId); + + /** + * Check if item should have DRM icon of specified type + * @param aId id of item + * @param icon type (valid or invalid) + * @return ETrue if should have icon + */ + TBool ShouldHaveIcon(TGlxMediaId& aId, TGlxVisualIcon& aType); + +private: + /** Maintain count of number of icons handled by manager */ + TInt iIconCount; + + // array of thumbnail icons added via icon attribute + RArray iThumbnailIcons; + + /** Pointer to DRM utulity class owned */ + CGlxDRMUtility* iDRMUtility; + + /** Array of items with valid DRM status */ + RArray iValidDRMItems; + + /** Array of items with invalid DRM status */ + RArray iInvalidDRMItems; + + CAlfTexture* iDRMSendForbidTexture; + + CAlfTexture* iDRMRightsExpiredTexture; + }; + +#endif // C_GLXDRMICONMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/rom/glxcommandhandlerdrm.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/rom/glxcommandhandlerdrm.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Photos / DRM commandhandler's iby file. +* +*/ + + + + +#ifndef __GLXCOMMANDHANDLERDRM_IBY__ +#define __GLXCOMMANDHANDLERDRM_IBY__ + + +file=ABI_DIR\BUILD_DIR\glxcommandhandlerdrm.dll SHARED_LIB_DIR\glxcommandhandlerdrm.dll + +#endif // __GLXCOMMANDHANDLERDRM_IBY__ + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/src/glxcommandhandlerdrm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/src/glxcommandhandlerdrm.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,574 @@ +/* +* Copyright (c) 2008-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: provide synchronized access to file systema and metadata source +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + +#include "glxcommandhandlerdrm.h" + +#include +#include +#include +#include + +#include +#include +#include "glxdrmiconmanager.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerDrm* CGlxCommandHandlerDrm::NewL( + MGlxMediaListProvider* aMediaListProvider, + TBool aContainerList) + { + CGlxCommandHandlerDrm* self = new ( ELeave ) + CGlxCommandHandlerDrm(aMediaListProvider); + CleanupStack::PushL( self ); + self->ConstructL(aContainerList); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerDrm::CGlxCommandHandlerDrm(MGlxMediaListProvider* + aMediaListProvider) + : CGlxMediaListCommandHandler(aMediaListProvider) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::ConstructL(TBool aIsContainerList) + { + TRACER("CGlxCommandHandlerDrm::ConstructL"); + iIsContainerList = aIsContainerList; + + iDrmUtility = CGlxDRMUtility::InstanceL(); + + + // Add supported commands + + TCommandInfo info( EGlxCmdDRMOpen ); + // Filter out static items + info.iMinSelectionLength = 1; + info.iDisallowSystemItems = aIsContainerList; + AddCommandL(info); + + // Add view state dummy commands + TCommandInfo view( EGlxCmdStateView ); + AddCommandL( view ); + TCommandInfo browse( EGlxCmdStateBrowse ); + AddCommandL( browse ); + + // create fetch context + iFetchContext = CGlxDefaultAttributeContext::NewL(); + iFetchContext->AddAttributeL( KMPXMediaDrmProtected ); + iFetchContext->AddAttributeL( KMPXMediaGeneralCategory ); + iFetchContext->AddAttributeL( KMPXMediaGeneralUri ); + iFetchContext->AddAttributeL( KGlxMediaGeneralDimensions ); + + iInFullScreen = EFalse; + + // get pointer to HUI utility + iUiUtility = CGlxUiUtility::UtilityL(); + + // get pointer to visual list manager + iVisualListManager = CGlxVisualListManager::ManagerL(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerDrm::~CGlxCommandHandlerDrm() + { + iDrmUtility->Close(); + + if ( iUiUtility ) + { + iUiUtility->Close(); + } + + if(iVisualListManager) + { + iVisualListManager->Close(); + } + + delete iFetchContext; + delete iUrl; + } + +// --------------------------------------------------------------------------- +// ActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::DoActivateL(TInt /*aViewId*/) + { + TRACER("CGlxCommandHandlerDrm::DoActivateL"); + MGlxMediaList& mediaList = MediaList(); + mediaList.AddContextL(iFetchContext, KGlxFetchContextPriorityNormal ); + + mediaList.AddMediaListObserverL(this); + + // get handle to visual list + iVisualList = iVisualListManager->ListL(mediaList, + *iUiUtility->Env(), *iUiUtility->Display()); + + iVisualList->AddObserverL(this); + + // create DRM icon manager + iDrmIconManager = CGlxDrmIconManager::NewL(mediaList, *iVisualList); + } + + +// --------------------------------------------------------------------------- +// Deactivate +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::Deactivate() + { + if( iDrmIconManager ) + { + delete iDrmIconManager; + iDrmIconManager = NULL; + } + + if( iVisualList ) + { + iVisualList->RemoveObserver(this); + iVisualListManager->ReleaseList(iVisualList); + iVisualList = NULL; + } + + MGlxMediaList& mediaList = MediaList(); + mediaList.RemoveContext(iFetchContext); + mediaList.RemoveMediaListObserver(this); + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleItemAddedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleItemModifiedL(const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/) + { + // if in full-screen consume rights if necessary + // only if we have received a newer thumbnail + // do not consume rights if already consumed + if(iInFullScreen && aItemIndex == MediaList().FocusIndex()) + { + if(!iDrmRightsChecked) + { + ConsumeDRMRightsL(); + } + } + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, + MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // No implementation + } + + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleFocusChangedL( TInt /*aFocusIndex*/, + TReal32 /*aItemsPerSecond*/, MGlxVisualList* /*aList*/, + NGlxListDefs::TFocusChangeType /*aType*/ ) + { + // if in full-screen consume rights if necessary + if(iInFullScreen) + { + // reset rights consumed flag as we're moving to + // newer item + iDrmRightsChecked = EFalse; + ConsumeDRMRightsL(); + } + } + + +// --------------------------------------------------------------------------- +// ConsumeDRMRightsL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::ConsumeDRMRightsL() + { + TRACER("CGlxCommandHandlerDrm::ConsumeDRMRightsL"); + + MGlxMediaList& mediaList = MediaList(); + + GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL have mlist"); + + TInt index = mediaList.FocusIndex(); + User::LeaveIfError(index); // FocusIndex() can return KErrNotFound + + const TGlxMedia& item = mediaList.Item(index); + const CGlxMedia* media = item.Properties(); + + if(media) + { + if(item.IsDrmProtected()) + { + GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL drm item"); + + TMPXGeneralCategory cat = item.Category(); + const TDesC& uri = item.Uri(); + if( cat != EMPXNoCategory && uri.Length() > 0 ) + { + GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL check rights"); + + // check if rights have expired + TBool expired = !iDrmUtility->CheckOpenRightsL(uri, (cat == EMPXImage)); + + if(expired) + { + GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeDRMRightsL show expiry note"); + + if( iDrmIconManager ) + { + iDrmIconManager->RemoveOverlayIcon( index, ETrue ); + } + + // check if rights have expired + // show expiry note + iDrmUtility->ShowRightsInfoL(uri); + return; + } + + if( iDrmIconManager ) + { + iDrmIconManager->RemoveOverlayIcon( index, EFalse ); + } + + TSize size; + if(EMPXImage == cat && item.GetDimensions(size)) + { + + // check size + TSize bmpSize = ThumbnailSize(media); + + if(ConsumeRightsBasedOnSize(index, size, bmpSize)) + { + // pass URI to DRM utility + iDrmUtility->ConsumeRightsL(uri); + iDrmRightsChecked = ETrue; + } + } + } + } + else + { + // not an DRM'd item no need to check again + iDrmRightsChecked = ETrue; + } + } + } + +// --------------------------------------------------------------------------- +// HandleSizeChanged +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleSizeChanged( const TSize& /*aSize*/, MGlxVisualList* /*aList*/ ) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleVisualRemoved +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleVisualRemoved( const CAlfVisual* /*aVisual*/, MGlxVisualList* /*aList*/ ) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleVisualAddedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDrm::HandleVisualAddedL( CAlfVisual* /*aVisual*/, TInt /*aIndex*/, MGlxVisualList* /*aList*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerDrm::DoExecuteL(TInt aCommandId, + MGlxMediaList& /*aList*/) + { + TRACER("CGlxCommandHandlerDrm::DoExecuteL"); + TBool handledCommand = ETrue; + + switch (aCommandId) + { + case EGlxCmdDRMOpen: + // newly opened item + // reset rights consumed flag + iDrmRightsChecked = EFalse; + + // do not re-consume rights on return from UMP view + // only consume if navigation has been forwards + if ( iUiUtility->ViewNavigationDirection() + == EGlxNavigationForwards ) + { + ConsumeDRMRightsL(); + } + + break; + + case EGlxCmdStateView: + iInFullScreen = ETrue; + handledCommand = EFalse; + break; + + case EGlxCmdStateBrowse: + iInFullScreen = EFalse; + handledCommand = EFalse; + if(iDrmIconManager) + { + iDrmIconManager->AddOverlayIconsL(); + } + break; + default: + { + handledCommand = EFalse; + break; + } + } + + return handledCommand; + } + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerDrm::DoIsDisabled(TInt /*aCommandId*/, + MGlxMediaList& /*aList*/) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// ConsumeRightsBasedOnSize - check if DRM rights should be consumed +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize(TInt aItemIndex, + TSize aImageSize, TSize aBitmapSize) + { + TRACER("CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize"); + + // minimum size (120 x 90) + TInt minSize = KGlxThumbnailDrmWidth * KGlxThumbnailDrmHeight; + + // size of actual image + TInt imgSize = aImageSize.iWidth * aImageSize.iHeight; + + // bitmap size + TInt bmpSize = aBitmapSize.iWidth * aBitmapSize.iHeight; + + // size of HUI display + TSize dispSize = iUiUtility->DisplaySize(); + + // Get size of visual based on aspect ratio of image + TSize visImgSize; + if(iVisualList) + { + CAlfVisual* vis = iVisualList->Visual(aItemIndex); + if(vis) + { + if(dispSize.iWidth>0 && dispSize.iHeight>0) + { + TReal widthRatio = (TReal)aImageSize.iWidth/(TReal)dispSize.iWidth; + TReal heightRatio = (TReal)aImageSize.iHeight/(TReal)dispSize.iHeight; + + if(widthRatio > heightRatio) + { + dispSize.iHeight = aImageSize.iHeight / widthRatio; + } + else + { + if(heightRatio>0) + { + dispSize.iWidth = aImageSize.iWidth / heightRatio; + } + } + } + + } + } + + TInt visSize2 = dispSize.iWidth * dispSize.iHeight; + + // if thumbnail is smaller than visual use this for comparison + if(bmpSize < visSize2) + { + visSize2 = bmpSize; + } + + // is bmp smaller than 1/4 of image size + if(imgSize/4 < minSize) + { + minSize = imgSize/4; + } + + // + if(visSize2 >= minSize) + { + GLX_LOG_INFO("CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize true"); + iDrmRightsChecked = ETrue; + } + + return iDrmRightsChecked; + } + +// ----------------------------------------------------------------------------- +// ThumbnailSizeAndQuality - search for largest available thumbnail +// ----------------------------------------------------------------------------- +// +TSize CGlxCommandHandlerDrm::ThumbnailSize(const CGlxMedia* aMedia) + { + TRACER("CGlxCommandHandlerDrm::ThumbnailSize"); + TSize bmpSize(0,0); + + TArray attr = aMedia->Attributes(); + + TInt selectedHeight = 0; + TInt selectedWidth = 0; + + TInt count = attr.Count(); + for(TInt i=0; i + (aMedia->ValueCObject( attr[i])); + + if(thumbAtt) + { + + selectedHeight = thumbAtt->iDimensions.iHeight; + selectedWidth = thumbAtt->iDimensions.iWidth; + + if((selectedHeight * selectedWidth) > + (bmpSize.iHeight * bmpSize.iWidth)) + { + bmpSize.iWidth = selectedWidth; + bmpSize.iHeight = selectedHeight; + } + } + } + } + return bmpSize; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerdrm/src/glxdrmiconmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerdrm/src/glxdrmiconmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,514 @@ +/* +* Copyright (c) 2008-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: Manager of visual lists +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + +#include "glxdrmiconmanager.h" + +#include +#include +#include +#include // icons +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const TInt KGlxDrmIconSize = 16; +const TInt KGlxDrmIconBorder = 0; + +// --------------------------------------------------------------------------- +// 1st phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxDrmIconManager* CGlxDrmIconManager::NewL( MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList) + { + CGlxDrmIconManager* self = + new(ELeave)CGlxDrmIconManager(aMediaList, aVisualList); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxDrmIconManager::~CGlxDrmIconManager() + { + iMediaList.RemoveMediaListObserver(this); + iVisualList.RemoveObserver(this); + + iThumbnailIcons.Close(); + + if(iDRMUtility) + { + iDRMUtility->Close(); + } + + iValidDRMItems.Close(); + iInvalidDRMItems.Close(); + } + +// --------------------------------------------------------------------------- +// RemoveOverlayIcon +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::RemoveOverlayIcon(TInt aIndex, + TBool aInvalidIcon) + { + if(aInvalidIcon) + { + iVisualList.SetIconVisibility( aIndex, + *iDRMRightsExpiredTexture, EFalse ); + } + else + { + iVisualList.SetIconVisibility( aIndex, + *iDRMSendForbidTexture, EFalse ); + } + + } + +// --------------------------------------------------------------------------- +// AddOverlayIconL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::AddOverlayIconsL() + { + TRACER("CGlxDrmIconManager::AddOverlayIconsL"); + TInt itemCount = iMediaList.Count(); + for(TInt i = 0; i < itemCount; i++) + { + CAlfVisual* vis = iVisualList.Visual(i); + if(vis) + { + // recheck rights as status may have changed + CheckDRMRightsL(vis, i); + } + } + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleItemAddedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// void CGlxDrmIconManager::HandleItemRemovedL(TInt /*aStartIndex*/, + +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/) + { + TIdentityRelation match(&TMPXAttribute::Match); + if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound) + { + // check if we have DRM attributes + CAlfVisual* vis = iVisualList.Visual(aItemIndex); + if(vis) + { + CheckDRMRightsL(vis, aItemIndex, EFalse); + } + } + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // No implementation + } + + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleFocusChangedL( TInt /*aFocusIndex*/, + TReal32 /*aItemsPerSecond*/, MGlxVisualList* /*aList*/, + NGlxListDefs::TFocusChangeType /*aType*/ ) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleSizeChanged +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleSizeChanged( const TSize& /*aSize*/, + MGlxVisualList* /*aList*/ ) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleVisualRemoved +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleVisualRemoved( + const CAlfVisual* /*aVisual*/, MGlxVisualList* /*aList*/ ) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// HandleVisualAddedL +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::HandleVisualAddedL( CAlfVisual* aVisual, + TInt aIndex, MGlxVisualList* /*aList*/ ) + { + if(aIndex >= 0 && aIndex < iMediaList.Count() ) + { + CheckDRMRightsL(aVisual, aIndex); + } + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxDrmIconManager::CGlxDrmIconManager(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList) + : CGlxIconManager(aMediaList, aVisualList) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// 2nd phase construction +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::ConstructL() + { + TRACER("CGlxDrmIconManager::ConstructL"); + BaseConstructL(); + + TFileName mifFile( KDC_APP_BITMAP_DIR ); + mifFile.Append( KGlxIconsFilename ); + + GLX_LOG_INFO("CGlxDrmIconManager::ConstructL create valid icon"); + // ask texture manager to create DRM valid icon + iDRMSendForbidTexture = &(iUiUtility->GlxTextureManager(). + CreateIconTextureL( EMbmGlxiconsQgn_prop_drm_rights_valid_super, + mifFile, TSize( KGlxDrmIconSize, KGlxDrmIconSize ) ) ); + GLX_LOG_INFO("CGlxDrmIconManager::ConstructL create invalid icon"); + + // ask texture manager to create DRM invalid icon + iDRMRightsExpiredTexture = &(iUiUtility->GlxTextureManager(). + CreateIconTextureL( EMbmGlxiconsQgn_prop_drm_rights_exp_super, + mifFile, TSize( KGlxDrmIconSize, KGlxDrmIconSize ) ) ); + + + + // add as observers + iMediaList.AddMediaListObserverL(this); + iVisualList.AddObserverL(this); + + GLX_LOG_INFO("CGlxDrmIconManager::ConstructL create DRM utility"); + iDRMUtility = CGlxDRMUtility::InstanceL(); + + // check for any visual already present in list + TInt itemCount = iMediaList.Count(); + for(TInt i = 0; i < itemCount; i++) + { + CAlfVisual* vis = iVisualList.Visual( i ); + if(vis) + { + CheckDRMRightsL(vis, i); + } + } + + } + +// --------------------------------------------------------------------------- +// IconAlreadyAdded +// --------------------------------------------------------------------------- +// +TInt CGlxDrmIconManager::ThumbnailIconArrayPos(TIconInfo& aIconInfo) + { + // check if icon already generated + TInt pos = KErrNotFound; + TInt count = iThumbnailIcons.Count(); + for(TInt i=0; i 0) + { + TGlxVisualIcon iconType; + if(iDRMUtility->IsForwardLockedL(uri)) + { + GLX_LOG_INFO("CGlxDrmIconManager::CheckDRMRightsL forward locked"); + if(aForceIcon || !ShouldHaveIcon(id, iconType)) + { + GLX_LOG_INFO("CGlxDrmIconManager::CheckDRMRightsL forward locked add icon"); + AddValidIconL(id); + iVisualList.AddIconL( aIndex, *iDRMSendForbidTexture, + NGlxIconMgrDefs::EGlxIconBottomRight, ETrue, EFalse, KGlxDrmIconBorder ); + + iVisualList.SetIconVisibility( aIndex, *iDRMSendForbidTexture, ETrue ); + } + + } + else + { + + TMPXGeneralCategory cat = item.Category(); + + TBool checkViewRights = (cat==EMPXImage); + + if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights)) + { + GLX_LOG_INFO("CGlxDrmIconManager::CheckDRMRightsL valid rights"); + if(aForceIcon ||!ShouldHaveIcon(id, iconType)) + { + GLX_LOG_INFO("CGlxDrmIconManager::CheckDRMRightsL valid rights add icon"); + AddValidIconL(id); + iVisualList.AddIconL( aIndex, *iDRMSendForbidTexture, + NGlxIconMgrDefs::EGlxIconBottomRight, + ETrue, EFalse, KGlxDrmIconBorder ); + + iVisualList.SetIconVisibility( aIndex, *iDRMSendForbidTexture, ETrue ); + } + } + else + { + GLX_LOG_INFO("CGlxDrmIconManager::CheckDRMRightsL invalid rights"); + + if(aForceIcon ||!ShouldHaveIcon(id, iconType)) + { + iVisualList.RemoveIcon( aIndex, *iDRMSendForbidTexture ); + GLX_LOG_INFO("CGlxDrmIconManager::CheckDRMRightsL add invalid icon"); + AddInvalidIconL(id); + iVisualList.AddIconL( aIndex, *iDRMRightsExpiredTexture, + NGlxIconMgrDefs::EGlxIconBottomRight, + ETrue, EFalse, KGlxDrmIconBorder ); + + iVisualList.SetIconVisibility( aIndex, *iDRMRightsExpiredTexture, ETrue ); + } + } + } + } + } + } + +// --------------------------------------------------------------------------- +// AddValidIcon +// --------------------------------------------------------------------------- +// +void CGlxDrmIconManager::AddValidIconL(TGlxMediaId& aId) + { + TInt count = iValidDRMItems.Count(); + TBool present = EFalse; + for(TInt i=0; i +#include +#include +#include +#include + +#include + +#include + +NAME GLAA // 4 letter ID + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="GLMK"; } + +// mark label +RESOURCE TBUF r_glx_marking_mark + { buf=qtn_msk_mark; } + +// unmark label +RESOURCE TBUF r_glx_marking_unmark + { buf=qtn_msk_unmark; } + +// done label +RESOURCE TBUF r_glx_marking_done + { buf=qtn_lgal_softkey_done; } + +// single item marked resource buf +RESOURCE TBUF r_glx_marking_multi_single + { buf=qtn_lgal_view_title_mark_multiple_single; } + +// single item marked resource buf +RESOURCE TBUF r_glx_marking_multi_multi + { buf=qtn_lgal_view_title_mark_multiple_multi; } + +RESOURCE TBUF r_glx_softkey_cancel { buf = text_softkey_cancel; } + +RESOURCE TBUF r_glx_softkey_back { buf = text_softkey_back; } + +RESOURCE TBUF r_glx_softkey_open { buf = qtn_msk_open; } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/eabi/glxcommandhandlermarkingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/eabi/glxcommandhandlermarkingu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + _ZN25CGlxCommandHandlerMarking4NewLEP21MGlxMediaListProvideri @ 1 NONAME + _ZN25CGlxCommandHandlerMarkingD0Ev @ 2 NONAME + _ZN25CGlxCommandHandlerMarkingD1Ev @ 3 NONAME + _ZN25CGlxCommandHandlerMarkingD2Ev @ 4 NONAME + _ZTI21CGlxMarkedIconManager @ 5 NONAME ; ## + _ZTV21CGlxMarkedIconManager @ 6 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcommandhandlermarking.dll + * +*/ + + + + +PRJ_EXPORTS +//../rom/glxcommandhandlermarking.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxcommandhandlermarking.iby) + + +PRJ_MMPFILES + +glxcommandhandlermarking.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/group/glxcommandhandlermarking.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/group/glxcommandhandlermarking.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2008-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: commandhandler marking +* +*/ + + + + +/** + * @internal reviewed 12/06/2007 by Alex Birkett + */ + +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +TARGET glxcommandhandlermarking.dll +TARGETTYPE dll +UID 0x1000008d 0x25000000 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxcommandhandlermarking.cpp +SOURCE glxmarkediconmanager.cpp + +SOURCEPATH ../data + +START RESOURCE glxcommandhandlermarking.rss +HEADER +TARGETPATH /resource/apps +LANGUAGE_IDS +END // RESOURCE + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../texturemanager/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc +SYSTEMINCLUDE ../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../gallery/loc + +LIBRARY aknicon.lib +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknskins.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY cdlengine.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxmedialists.lib +LIBRARY glxtexturemanager.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY glxcommon.lib // for CResourceUtilities + +LIBRARY hitchcock.lib // HUI +LIBRARY hlplch.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY ws32.lib +LIBRARY libpthread.lib +LIBRARY flogger.lib // For Logging Tracer + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/inc/glxcommandhandlermarking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/inc/glxcommandhandlermarking.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2008-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: Marking command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERMARKING_H +#define C_GLXCOMMANDHANDLERMARKING_H + +#include +#include +#include + +class MGlxMediaListProvider; + +class MGlxVisualList; +class CGlxMarkedIconManager; +class MGlxSoftkeyHandler; +class CGlxUiUtility; +class CGlxVisualListManager; +class CGlxScreenFurniture; + + +/** + * CGlxCommandHandlerMarking + * + * Marking command handler implementation + * + * @lib glxcommandhandlermarking + * @author M Byrne + * @internal reviewed 11/06/2007 by Alex Birkett + * @internal reviewed 19/09/2007 by Aki Vanhatalo + */ +NONSHARABLE_CLASS (CGlxCommandHandlerMarking) : public CGlxMediaListCommandHandler, + public MGlxMediaListObserver + { +public: + /** + * Static construction function + * @param aMediaListProvider pointer to media list owner + * @param aKeyHandler pointer to MGlxSoftkeyHandler interface + * @param aUpdateMiddleSoftkey Should this command handler update + * the middle softkey when not in multiple marking mode. + * @return pointer to CGlxCommandHandlerMarking object + */ + IMPORT_C static CGlxCommandHandlerMarking* NewL( + MGlxMediaListProvider* aMediaListProvider, + TBool aHasToolbarItem/*, + TBool aUpdateMiddleSoftkey = EFalse */); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerMarking(); + +public: // From CGlxCommandHandler + void DoActivateL(TInt aViewId); + void Deactivate(); + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); +public: // From MGlxMediaListObserver + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + void HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* aList); + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +protected: // From CGlxCommandHandler + void PopulateToolbarL(); + +protected: // From CGlxMediaListCommandHandler + TBool DoExecuteL(TInt aCommand, MGlxMediaList& aList); + void DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + /** Current marking mode marking or unmarking */ + enum TGlxMarkingMode + { + EMarking, + EUnmarking + }; + + /** status of left softkey (in mupltiple marking mode) */ + enum TGlxLeftSoftKeyStatus + { + EGlxLSKUndefined, + EGlxLSKBlank, // static item + EGlxLSKMark, + EGlxLSKUnmark + }; + + /** + * 2nd phase construction + */ + void ConstructL(); + + /** + * Constructor + * @param aMediaListProvider pointer to media list owner + * @param aKeyHandler pointer to MGlxSoftkeyHandler interface + * @param aUpdateMiddleSoftkey Should this command handler update + * the middle softkey when not in multiple marking mode. + */ + CGlxCommandHandlerMarking( MGlxMediaListProvider* aMediaListProvider, + TBool aHasToolbarItem/* , TBool aUpdateMiddleSoftkey */); + + /** + * Select/unselect all items + * @param aSelect select if ETrue unselect otherwise + */ + void SelectAllL( TBool aSelect ); + + /** + * Enter multiple marking mode + */ + void EnterMultipleMarkingModeL(); + + /** + * Exit multiple marking mode + */ + void ExitMultipleMarkingModeL(); + + /** + * Update mark status of selected item + * and update marked item count + * @param aList media list + * @param aIndex index of item in media list + */ + void SetSelectedL(MGlxMediaList* aList, TInt aIndex); + +private: + /** Resource offset */ + TInt iResourceOffset; + + /** Flag if basic marking in operation */ + TBool iBasicMarking; + + /** multiple marking mode enabled */ + TBool iMultipleMarking; + + /** Current marking mode (marking or unmarking) */ + TGlxMarkingMode iMarkingMode; + + /** visual list passed through to marking icon manager */ + MGlxVisualList* iVisualList; + + /** ID of view activating command handler */ + TInt iViewId; + + // add current lsk status + TGlxLeftSoftKeyStatus iLeftSoftKeyStatus; + + /** Whether to update the MSK when not in multiple marking mode */ + TBool iUpdateMiddleSoftkey; + + /** Whether context menu is currently enabled */ + TBool iOkOptionsMenuEnabled; + + /** Current middle softkey text resource */ + TInt iMskTextResourceId; + + /** Instance of Ui utility class */ + CGlxUiUtility* iUiUtility; + + /** Instance of Screenfurniture */ + CGlxScreenFurniture* iScreenFurniture ; + + /** Flag to indicate whether full-screen is active or not */ + TBool iInFullScreen; + + HBufC* iRskTextCancel; + HBufC* iRskTextBack; + HBufC* iMskTextMark; + HBufC* iMskTextUnMark; + HBufC* iMskTextOpen; + + }; + +#endif // C_GLXCOMMANDHANDLERMARKING_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/inc/glxmarkediconmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/inc/glxmarkediconmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2008-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: Manages icons for basic marking +* +*/ + + + + +#ifndef C_GLXMARKEDICONMANAGER_H +#define C_GLXMARKEDICONMANAGER_H + +#include + +#include + +/** + * CGlxMarkedIconManager + * + * Marking Icon manager + * + * @lib glxcommandhandlermarking + * @author M Byrne + * @internal reviewed 12/06/2007 by Alex Birkett + */ +class CGlxMarkedIconManager : public CGlxIconManager + { +public: + /** + * static construction + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + * @return pointer to CGlxMarkedIconManager instance + */ + static CGlxMarkedIconManager* NewL(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + + /** destructor */ + ~CGlxMarkedIconManager(); + + /** + * cause the marked and unmarked items to be shown with the required overlays. + * @param aMultipleModeEnabled set whether multiple marking mode is + * enabled or disabled. + */ + void SetMultipleMarkingModeIndicatorsL(TBool aMultipleModeEnabled); + +private: // From MGlxMediaListObserver + /// See @ref MGlxMediaListObserver::HandleItemAddedL + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMediaL + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemRemovedL + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemModifiedL + void HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleFocusChangedL + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, + MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemSelectedL + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMessageL + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: // from MGlxVisualListObserver + /** @see MGlxVisualListObserver::HandleFocusChangedL */ + void HandleFocusChangedL( TInt aFocusIndex, TReal32 aItemsPerSecond, + MGlxVisualList* aList, + NGlxListDefs::TFocusChangeType aType ); + /** @see MGlxVisualListObserver::HandleSizeChanged */ + void HandleSizeChanged( const TSize& aSize, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualRemoved */ + void HandleVisualRemoved( const CAlfVisual* aVisual, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualAddedL */ + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + +private: + /** + * Identifiers for marking icons + */ + //enum TGlxMarkIcon + // { + //EMarkIcon, + //EUnmarkOverlay // semi-transparent overlay for multi.mark mode + // }; + + +private: + /** + * Constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + */ + CGlxMarkedIconManager(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + +private: + // texture for marking tick, not owned + CAlfTexture* iMarkTexture; + + // texture for semi-transparent overlay in multiple marking mode, owned + CAlfTexture* iBlackTexture; + + // flag whether multiple marking is active + TBool iMultipleMarkingEnabled; + }; + +#endif // C_GLXMARKEDICONMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/rom/glxcommandhandlermarking.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/rom/glxcommandhandlermarking.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Photos / DRM commandhandler's iby file. +* +*/ + + + + +#ifndef __GLXCOMMANDHANDLERMARKING_IBY__ +#define __GLXCOMMANDHANDLERMARKING_IBY__ + + +file=ABI_DIR\BUILD_DIR\glxcommandhandlermarking.dll SHARED_LIB_DIR\glxcommandhandlermarking.dll + +#endif // __GLXCOMMANDHANDLERMARKING_IBY__ + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/src/glxcommandhandlermarking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/src/glxcommandhandlermarking.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,791 @@ +/* +* Copyright (c) 2008-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: Marking command handler +* +*/ + + + + +/** + * @internal reviewed 12/06/2007 by Alex Birkett + */ + +#include "glxcommandhandlermarking.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include + +#include + +#include "glxcommandhandlers.hrh" +#include "glxmarkediconmanager.h" +#include + + +_LIT(KGlxMarkingCmdHandlerRes,"glxcommandhandlermarking.rsc"); +_LIT(KGlxBlankString," "); + + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerMarking::CGlxCommandHandlerMarking( + MGlxMediaListProvider* aMediaListProvider, + TBool aHasToolbarItem /*,TBool aUpdateMiddleSoftkey*/ ) + : CGlxMediaListCommandHandler( aMediaListProvider, aHasToolbarItem )/*, + iKeyHandler( aKeyHandler ), iUpdateMiddleSoftkey( aUpdateMiddleSoftkey )*/ + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::ConstructL() + { + TRACER("CGlxCommandHandlerMarking::ConstructL"); + // Load the view's resources + TFileName resourceFile(KDC_APP_RESOURCE_DIR); + resourceFile.Append(KGlxMarkingCmdHandlerRes); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + // Add supported commands + // mark + TCommandInfo markCmd( EAknCmdMark ); + // Filter out static items + markCmd.iMinSelectionLength = 1; + AddCommandL( markCmd ); + + // unmark + TCommandInfo unMarkCmd( EAknCmdUnmark ); + // Filter out static items + unMarkCmd.iMinSelectionLength = 1; + AddCommandL( unMarkCmd ); + + // mark all + AddCommandL( TCommandInfo( EAknMarkAll ) ); + + // unmark all + TCommandInfo unMarkAllCmd( EAknUnmarkAll ); + // Filter out static items + unMarkAllCmd.iMinSelectionLength = 1; + AddCommandL( unMarkAllCmd ); + + // marking sub-menu + AddCommandL( TCommandInfo( EGlxCmdMarkingSubmenu ) ); + + // start multiple marking + AddCommandL( TCommandInfo( EGlxCmdStartMultipleMarking ) ); + + // end multiple marking + AddCommandL( TCommandInfo( EGlxCmdEndMultipleMarking ) ); + + // Add view state dummy commands + AddCommandL( TCommandInfo( EGlxCmdStateView ) ); + AddCommandL( TCommandInfo( EGlxCmdStateBrowse ) ); + + iLeftSoftKeyStatus = EGlxLSKUndefined; + + // get pointer to screen furniture + iUiUtility = CGlxUiUtility::UtilityL(); + if(!iUiUtility->IsPenSupported()) + { + iScreenFurniture = iUiUtility->ScreenFurniture(); + iRskTextCancel = StringLoader::LoadL( R_GLX_SOFTKEY_CANCEL ); + iRskTextBack = StringLoader::LoadL( R_GLX_SOFTKEY_BACK ); + iMskTextMark = StringLoader::LoadL( R_GLX_MARKING_MARK ); + iMskTextUnMark = StringLoader::LoadL( R_GLX_MARKING_UNMARK ); + iMskTextOpen = StringLoader::LoadL( R_GLX_SOFTKEY_OPEN ); + } + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerMarking* CGlxCommandHandlerMarking::NewL( + MGlxMediaListProvider* aMediaListProvider, + TBool aHasToolbarItem/*, + TBool aUpdateMiddleSoftkey */) + { + CGlxCommandHandlerMarking* self = + new (ELeave) CGlxCommandHandlerMarking( aMediaListProvider, aHasToolbarItem + /*, aUpdateMiddleSoftkey */); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerMarking::~CGlxCommandHandlerMarking() + { + /// if (but do test this assumption!) + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + if(!iUiUtility->IsPenSupported()) + { + delete iRskTextCancel; + delete iRskTextBack; + delete iMskTextMark; + delete iMskTextUnMark; + delete iMskTextOpen; + } + + if(iUiUtility) + { + iUiUtility->Close(); + } + } + +// --------------------------------------------------------------------------- +// DoExecuteL +// --------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerMarking::DoExecuteL(TInt aCommand, + MGlxMediaList& aList) + { + TRACER("CGlxCommandHandlerMarking::DoExecuteL"); + TBool consumed = ETrue; + switch( aCommand) + { + case EAknCmdMark: + { + //This is Checking Marking Mode is On or Not + if(iMultipleMarking) + { + if(!aList.Item(aList.FocusIndex()).IsStatic()) + { + aList.SetSelectedL(aList.FocusIndex(), ETrue); + } + } + else + { + EnterMultipleMarkingModeL(); + } + //@ fix for EIZU-7RE43S && ELWU-7RA7NX + consumed = EFalse; // This Command Should goto View For Further Processing + break; + } + case EAknCmdUnmark: + { + if(!aList.Item(aList.FocusIndex()).IsStatic()) + { + aList.SetSelectedL(aList.FocusIndex(), EFalse); + if(!iUiUtility->IsPenSupported()) + { + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, EAknCmdMark, 0, *iMskTextMark); + } + /*commented out this coz, while select/unselect on a perticular item + * some events were getting lost. -- sourav + */ + /*if(aList.SelectionCount() <= 0) + { + iMultipleMarking = EFalse; + }*/ + //@ fix for EIZU-7RE43S && ELWU-7RA7NX + consumed = EFalse; // This Command Should goto View For Further Processing + } + break; + } + case EAknMarkAll: + { + if(iMultipleMarking) + { + SelectAllL( ETrue ); + } + else + { + EnterMultipleMarkingModeL(); + } + //@ fix for EIZU-7RE43S + consumed = EFalse; // This Command Should goto View For Further Processing + break; + } + case EAknUnmarkAll: + { + SelectAllL( EFalse ); + ExitMultipleMarkingModeL(); + consumed = EFalse; + break; + } + // Its For Handling Commands from ToolBar + case EGlxCmdStartMultipleMarking: + { + if(!iMultipleMarking) + { + EnterMultipleMarkingModeL(); + } + consumed = EFalse; + break; + } + case EGlxCmdEndMultipleMarking: + { + if(iMultipleMarking) + { + SelectAllL( EFalse); + } + ExitMultipleMarkingModeL(); + consumed = EFalse; + break; + } + /* + case EGlxCmdStateView: + { + iInFullScreen = ETrue; + consumed = EFalse; + } + break; + + case EGlxCmdStateBrowse: + { + iInFullScreen = EFalse; + iMskTextResourceId = 0; + UpdateMiddleSoftkeyContentsL(); + UpdateMiddleSoftkeyStatus(); + consumed = EFalse; + } + break;*/ + + default: + { + consumed = EFalse; + break; + } + } + return consumed; + } + +// --------------------------------------------------------------------------- +// DoIsDisabled +// --------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerMarking::DoIsDisabled(TInt aCommandId, + MGlxMediaList& aList) const + { + TBool disabled = EFalse; + if( ViewingState() == TCommandInfo::EViewingStateView ) + { + return ETrue; + } + switch (aCommandId) + { + case EAknCmdMark: + { + // Base class has checked for min selection, so no need to check + /// for Count() > 0 + disabled = ( aList.Item( aList.FocusIndex() ).IsStatic() ) || + aList.IsSelected( aList.FocusIndex() ); + break; + } + case EAknCmdUnmark: + { + // disable if current item is not selected + disabled = !( aList.IsSelected(aList.FocusIndex() ) ); + break; + } + case EAknMarkAll: + { + // disable if all items are marked + TInt count = aList.Count( NGlxListDefs::ECountNonStatic ); + TInt selCount = aList.SelectionCount(); + disabled = ( selCount >= count ); + break; + } + case EAknUnmarkAll: + { + // set disabled if no items selected + disabled = ( aList.SelectionCount() == 0 ); + break; + } + case EGlxCmdStartMultipleMarking: + { + // set disabled if no static items present + disabled = ( aList.Count( NGlxListDefs::ECountNonStatic ) == 0 ); + break; + } + case EGlxCmdMarkingSubmenu: + { + // set disabled if no static items present + disabled = ( aList.Count( NGlxListDefs::ECountNonStatic ) == 0 ); + break; + } + default: + break; + } + + return disabled; + } + +// --------------------------------------------------------------------------- +// DoDynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::DoDynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* /*aMenuPane*/) + { + } + + + +// --------------------------------------------------------------------------- +// DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::DoActivateL(TInt aViewId) + { + // store view id + iViewId = aViewId; + + + // get media list from provider + MGlxMediaList& mlist = MediaList(); + mlist.AddMediaListObserverL( this ); + } + +// --------------------------------------------------------------------------- +// Deactivate +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::Deactivate() + { + + MediaList().RemoveMediaListObserver( this ); + if(iMultipleMarking) + { + iMultipleMarking = EFalse; + } + // set selection to unmarked + TRAP_IGNORE( SelectAllL( EFalse ) ); + } + +// --------------------------------------------------------------------------- +// OfferKeyEventL +// --------------------------------------------------------------------------- +// +TKeyResponse CGlxCommandHandlerMarking::OfferKeyEventL(const TKeyEvent& + aKeyEvent, TEventCode aType) + { + + // Consume zoom key events in multiple marking mode + // to prevent entering full screen view + if ( iMultipleMarking && ( EStdKeyIncVolume == aKeyEvent.iScanCode + || EStdKeyDecVolume == aKeyEvent.iScanCode) ) + { + return EKeyWasConsumed; + } + + TBool shiftKeyPressed = ( aKeyEvent.iModifiers & EModifierShift ); + + // marking not available in full-screen mode + if( !iInFullScreen ) + { + // get media list from provider + MGlxMediaList& mediaList = MediaList(); + if ( shiftKeyPressed && aType == EEventKeyDown ) + { + if ( !iBasicMarking ) + { + iBasicMarking = ETrue; + // toggle marking mode based on current marked state + if ( mediaList.IsSelected( mediaList.FocusIndex() ) ) + { + iMarkingMode=EUnmarking; + } + else + { + iMarkingMode=EMarking; + } + } + } + else if( shiftKeyPressed && aType == EEventKey ) + { + // handle navi-key select + if( aKeyEvent.iScanCode==EStdKeyDevice3 ) + { + TInt focIdx = mediaList.FocusIndex(); + + /// is already in DoExecuteL: + /// Call ExecuteL with EAknCmdMark or EAknCmdUnmark to avoid duplication. + /// Replace with following code with + /// (void) ExecuteL( mlist.IsSelected( mlist.FocusIndex() ) ? + /// EAknCmdUnmark : EAknCmdMark ); + if( focIdx != KErrNotFound ) + { + if ( mediaList.IsSelected( focIdx ) ) + { + // item is marked so unmark + mediaList.SetSelectedL(focIdx, EFalse); + } + else + { + // if not static item set selected + if( !mediaList.Item(focIdx).IsStatic() ) + { + mediaList.SetSelectedL( focIdx, ETrue ); + } + } + } + + return EKeyWasConsumed; + } + } + else if( !shiftKeyPressed && aType == EEventKeyUp ) + { + // if in basic marking mode exit basic marking mode + if(iBasicMarking) + { + iBasicMarking = EFalse; + if(!iUiUtility->IsPenSupported()) + { + // Change RSK + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::ERightSoftkeyPosition, + EAknSoftkeyCancel, 0, *iRskTextCancel); + + // Change MSK + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdMark, 0, *iMskTextMark); + } + } + } + else + { + } + } + + return EKeyWasNotConsumed; + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleItemAddedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // No Implementation + } + + +// --------------------------------------------------------------------------- +// HandleMediaL +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + + } + +// --------------------------------------------------------------------------- +// HandleItemRemoved +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + //UpdateMiddleSoftkeyStatus(); + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleItemModifiedL(const RArray& + /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& /*aAttributes*/, MGlxMediaList* aList) + { + TRACER("CGlxCommandHandlerMarking::HandleAttributesAvailableL"); + + if(!iUiUtility->IsPenSupported()) + { + if( aItemIndex == aList->FocusIndex() && iMultipleMarking) + { + if(aList->Item(aItemIndex).IsStatic()) + { + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEmpty, 0, KGlxBlankString); + } + else + { + if (aList->IsSelected(aItemIndex)) + { + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdUnmark, 0, *iMskTextUnMark); + } + else + { + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdMark, 0, *iMskTextMark); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList) + { + TRACER("CGlxCommandHandlerMarking::HandleFocusChangedL"); + if( iBasicMarking ) + { + TInt startIdx = 0; + TInt endIdx = 0; + + TInt count = aList->Count(); + + switch (aType) + { + case NGlxListDefs::EForward: + { + startIdx = aOldIndex; + endIdx = aNewIndex; + + // if need to go off end of list add count to end index + // so we can iterate sequentally through items + if( aNewIndex < aOldIndex ) + { + endIdx += count; + } + } + break; + case NGlxListDefs::EBackward: + { + startIdx = aNewIndex; + endIdx = aOldIndex; + + // if need to go off end of list add count to end index + // so we can iterate sequentally through items + if( aOldIndex < aNewIndex ) + { + endIdx += count; + + } + } + break; + // do nothing if focus type is unknown + case NGlxListDefs::EUnknown: + // fallthrough + default: + break; + } + + // set items in range to selected + if( startIdx != endIdx ) + { + TInt iterator = startIdx; + + while( iterator <= endIdx ) + { + // use modulus of count to take account + // of iterator range going off end of list + TInt listIndex = iterator % count; + SetSelectedL(aList, listIndex); + iterator++; + } + } + } + else + { + if(!iUiUtility->IsPenSupported()) + { + if (aNewIndex >=0) + { + // if in multiple marking mode update softkey for current + // focussed item + // Update MSK + if(aList->Item(aNewIndex).IsStatic()) + { + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEmpty, 0, KGlxBlankString); + } + else + { + if (aList->IsSelected(aNewIndex)) + { + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdUnmark, 0, *iMskTextUnMark); + } + else + { + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdMark, 0, *iMskTextMark); + if(!iMultipleMarking && (0 == aList->SelectionCount())) + { + ExitMultipleMarkingModeL(); + } + } + } + } + } + } + } + +// --------------------------------------------------------------------------- +// HandleItemSelected +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleItemSelectedL(TInt aIndex, + TBool /*aSelected*/, MGlxMediaList* aList) + { + TRACER("CGlxCommandHandlerMarking::HandleItemSelectedL"); + /** + If in the multiple marking mode, and the item selected is the focussed + item, HandleItemSelected causes the left softkey to be updated to + correspond to the marked state of the focussed item. If the item is + marked the softkey is changed to "Unmark" and vice versa. + */ + + if(!iUiUtility->IsPenSupported()) + { + if( aIndex == aList->FocusIndex() ) + { + // Update MSK + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, EAknCmdUnmark, 0, *iMskTextUnMark); + + } + } + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +void CGlxCommandHandlerMarking::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// ClearSelectionL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::SelectAllL( TBool aSelect) + { + TRACER("CGlxCommandHandlerMarking::SelectAllL"); + MGlxMediaList& mlist = MediaList(); + TInt mcount = mlist.Count(); + for ( TInt i=0; i< mcount; i++ ) + { + mlist.SetSelectedL( i, aSelect ); + } + } + +// --------------------------------------------------------------------------- +// EnterMultipleMarkingModeL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::EnterMultipleMarkingModeL() + { + TRACER("CGlxCommandHandlerMarking::EnterMultipleMarkingModeL"); + + iMultipleMarking = ETrue; + + if(!iUiUtility->IsPenSupported()) + { + // change softkeys + // Change RSK + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::ERightSoftkeyPosition, + EAknSoftkeyCancel, 0, *iRskTextCancel); + + // Change MSK + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, EAknCmdMark, 0, *iMskTextMark); + } + } + +// --------------------------------------------------------------------------- +// ExitMultipleMarkingModeL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::ExitMultipleMarkingModeL() + { + TRACER("CGlxCommandHandlerMarking::ExitMultipleMarkingModeL"); + + iMultipleMarking = EFalse; + + if(!iUiUtility->IsPenSupported()) + { + // rsetore softkeys + // Change RSK + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::ERightSoftkeyPosition, + EAknSoftkeyBack, 0, *iRskTextBack); + + iScreenFurniture->ModifySoftkeyIdL( + CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, 0, *iMskTextOpen); + } + // set basic marking flag to false + iBasicMarking = EFalse; + } + +// --------------------------------------------------------------------------- +// UpdateMarkedSelection +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::SetSelectedL(MGlxMediaList* aList, + TInt aIndex) + { + TRACER("CGlxCommandHandlerMarking::UpdateMarkedSelection"); + + TBool mark = (iMarkingMode==EMarking); + aList->SetSelectedL( aIndex, mark ); + } + +// --------------------------------------------------------------------------- +// PopulateToolbar +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMarking::PopulateToolbarL() + { + TRACER("CGlxCommandHandlerMarking::PopulateToolbar"); + + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermarking/src/glxmarkediconmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermarking/src/glxmarkediconmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,311 @@ +/* +* Copyright (c) 2008-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: Manager of visual lists +* +*/ + + + + +/** + * @internal reviewed 12/06/2007 by Alex Birkett + */ + +#include "glxmarkediconmanager.h" + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + + +const TInt KGlxMarkedIconSize = 13; +const TInt KGlxMarkedIconBorder = 2; + +const TInt KGlxMarkingOpaque = 127; + +// --------------------------------------------------------------------------- +// 1st phase constructor +// --------------------------------------------------------------------------- +// +CGlxMarkedIconManager* CGlxMarkedIconManager::NewL(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList) + { + CGlxMarkedIconManager* self = + new(ELeave)CGlxMarkedIconManager(aMediaList, aVisualList); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMarkedIconManager::~CGlxMarkedIconManager() + { + iMediaList.RemoveMediaListObserver(this); + iVisualList.RemoveObserver(this); + if( iBlackTexture ) + { + // call texture manager to remove the texture + // Ui Utility is owned by base + if(iUiUtility) + { + iUiUtility->GlxTextureManager().RemoveTexture( *iBlackTexture ); + } + } + } + +// --------------------------------------------------------------------------- +// SetMultipleMarkingModeIndicatorsL +// --------------------------------------------------------------------------- +// +void CGlxMarkedIconManager::SetMultipleMarkingModeIndicatorsL(TBool + aMultipleModeEnabled) + { + TRACER("CGlxMarkedIconManager::SetMultipleMarkingModeIndicatorsL"); + iMultipleMarkingEnabled = aMultipleModeEnabled; + + // set/remove opaque overlay on visible unmarked items + TInt count = iMediaList.Count(); + for(TInt i = 0; i& + /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleAttributesAvailableL(TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleItemSelectedL(TInt aIndex, TBool aSelected, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxMarkedIconManager::HandleItemSelectedL"); + // if selected add tick icon else remove tick item + // (assuming item is already marked) + if(aSelected) + { + iVisualList.AddIconL( aIndex, *iMarkTexture, + NGlxIconMgrDefs::EGlxIconTopRight, + ETrue, EFalse, KGlxMarkedIconBorder ); + + if(iMultipleMarkingEnabled) + { + // attempt to remove overlay + iVisualList.RemoveIcon( aIndex, *iBlackTexture ); + } + + } + else + { + // only 1 icon to choose from + iVisualList.RemoveIcon( aIndex, *iMarkTexture ); + + + if(iMultipleMarkingEnabled) + { + // attempt to add overlay icon to unmarked item + iVisualList.AddIconL( aIndex, *iBlackTexture, + NGlxIconMgrDefs::EGlxIconTopLeft, ETrue, ETrue, 0 ); + + } + } + + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleFocusChangedL( TInt /*aFocusIndex*/, + TReal32 /*aItemsPerSecond*/, MGlxVisualList* /*aList*/, + NGlxListDefs::TFocusChangeType /*aType*/ ) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// HandleSizeChanged +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleSizeChanged( const TSize& /*aSize*/, + MGlxVisualList* /*aList*/ ) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// HandleVisualRemoved +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleVisualRemoved( const CAlfVisual* /*aVisual*/, + MGlxVisualList* /*aList*/ ) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +void CGlxMarkedIconManager::HandleVisualAddedL( CAlfVisual* /*aVisual*/, + TInt aIndex, MGlxVisualList* /*aList*/ ) + { + TRACER("CGlxMarkedIconManager::HandleVisualAddedL"); + // add brushes to any new visuals if required + // aIndex should be index to media list + if(iMediaList.IsSelected(aIndex)) + { + iVisualList.AddIconL( aIndex, *iMarkTexture, + NGlxIconMgrDefs::EGlxIconTopRight, + ETrue, EFalse, KGlxMarkedIconBorder ); + } + else + { + // if in multiple marking mode + // ensure non-selected items have overlay + if(iMultipleMarkingEnabled) + { + iVisualList.AddIconL( aIndex, *iBlackTexture, + NGlxIconMgrDefs::EGlxIconTopLeft, ETrue, ETrue, 0 ); + } + } + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxMarkedIconManager::CGlxMarkedIconManager(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList) + : CGlxIconManager(aMediaList, aVisualList) + { + // No implementation required + } + +// --------------------------------------------------------------------------- +// 2nd phase construction +// --------------------------------------------------------------------------- +// +void CGlxMarkedIconManager::ConstructL() + { + TRACER("CGlxMarkedIconManager::ConstructL"); + BaseConstructL(); + + // create 'tick' icon + TFileName resFile(KAvkonBitmapFile); + + // get texture manager from UI utility (owned by base class) + CGlxTextureManager& tm = iUiUtility->GlxTextureManager(); + // get mark texture frim texture manager + iMarkTexture = &(tm.CreateIconTextureL( EMbmAvkonQgn_indi_marked_grid_add, + resFile, TSize( KGlxMarkedIconSize, KGlxMarkedIconSize) ) ); + + + TRgb overlayColour( KRgbBlack ); + overlayColour.SetAlpha( KGlxMarkingOpaque ); + + iBlackTexture = &( tm.CreateFlatColourTextureL( overlayColour ) ); + + // add as observers + iMediaList.AddMediaListObserverL(this); + iVisualList.AddObserverL(this); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/bwins/glxcommandhandlermoreinfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/bwins/glxcommandhandlermoreinfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + ??1CGlxCommandHandlerMoreInfo@@UAE@XZ @ 1 NONAME ; CGlxCommandHandlerMoreInfo::~CGlxCommandHandlerMoreInfo(void) + ?NewL@CGlxCommandHandlerMoreInfo@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 2 NONAME ; class CGlxCommandHandlerMoreInfo * CGlxCommandHandlerMoreInfo::NewL(class MGlxMediaListProvider *, int) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/eabi/glxcommandhandlermoreinfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/eabi/glxcommandhandlermoreinfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + _ZN26CGlxCommandHandlerMoreInfo4NewLEP21MGlxMediaListProvideri @ 1 NONAME + _ZN26CGlxCommandHandlerMoreInfoD0Ev @ 2 NONAME + _ZN26CGlxCommandHandlerMoreInfoD1Ev @ 3 NONAME + _ZN26CGlxCommandHandlerMoreInfoD2Ev @ 4 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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: Build information file for DRM more info command handler + * +*/ + + + + +#include + +PRJ_EXPORTS +../rom/glxcommandhandlermoreinfo.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxcommandhandlermoreinfo.iby) + +PRJ_MMPFILES +glxcommandhandlermoreinfo.mmp + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/group/glxcommandhandlermoreinfo.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/group/glxcommandhandlermoreinfo.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-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: DRM command handler mmp file +* +*/ + + + + +#include "../../../../group/glxbuildcommon.mmh" +#include + +TARGET glxcommandhandlermoreinfo.dll +TARGETTYPE DLL +UID 0x1000008d 0x2000A7B6 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src + +SOURCE glxcommandhandlermoreinfo.cpp + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../drmutility/inc +SYSTEMINCLUDE ../../../uiutilities/inc + +LIBRARY euser.lib + +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxdrmutility.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY mpxcommon.lib diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/inc/glxcommandhandlermoreinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/inc/glxcommandhandlermoreinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2008-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: CommandHandlerMoreInfo - Handler for DRM related commands. +* +*/ + + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + +#ifndef C_GLXCOMMANDHANDLERMOREINFO_H +#define C_GLXCOMMANDHANDLERMOREINFO_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CGlxDRMUtility; +class CGlxDefaultAttributeContext; +// CLASS DECLARATION + +//class + +/** + * CGlxCommandHandlerMoreInfo class + * Handler for DRM related commands + * @glxdrmcommandhandler.lib + * @author M Byrne + */ +NONSHARABLE_CLASS( CGlxCommandHandlerMoreInfo ): public CGlxMediaListCommandHandler + { +public : //constructor and desctructor + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aIsContainerList + */ +IMPORT_C static CGlxCommandHandlerMoreInfo* NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aIsContainerList); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerMoreInfo(); + + /** Activate command handler + * @param aViewId id of view activating cmd handler + */ + void DoActivateL(TInt aViewId); + + /** + * Deactivate command handler + */ + void Deactivate(); + +protected: + /** see @ref CGlxMediaListCommandHandler::DoExecuteL */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + /** see @ref CGlxMediaListCommandHandler::DoIsDisabled */ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + /** Second phase constructor */ + void ConstructL(TBool aIsContainerList); + + /** Constructor */ + CGlxCommandHandlerMoreInfo(MGlxMediaListProvider* aMediaListProvider); + + /** + * Check if 'more info' option is supported + * (i.e. URL for information can be returned) + * @param aList reference to media list + * @return ETrue if 'more info' URL is available + */ + TBool CanGetInfoURLL(MGlxMediaList& aList) const; + +private: + + // Does the list contain containers or items + TInt iIsContainerList; + + /** Pointer to DRM utility class (owned) */ + CGlxDRMUtility* iDrmUtility; + + /** Fetch context for required attributes (owned) */ + CGlxDefaultAttributeContext* iFetchContext; + + /** URI for current media items (owned) */ + mutable HBufC* iUrl; + }; + +#endif // C_GLXCOMMANDHANDLERMOREINFO_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/rom/glxcommandhandlermoreinfo.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/rom/glxcommandhandlermoreinfo.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-2000 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: Photos / DRM commandhandler's iby file. +* +*/ + + + + +#ifndef __GLXCOMMANDHANDLERMOREINFO_IBY__ +#define __GLXCOMMANDHANDLERMOREINFO_IBY__ + + +file=ABI_DIR\BUILD_DIR\glxcommandhandlermoreinfo.dll SHARED_LIB_DIR\glxcommandhandlermoreinfo.dll + +#endif // __GLXCOMMANDHANDLERMOREINFO_IBY__ + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/src/glxcommandhandlermoreinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlermoreinfo/src/glxcommandhandlermoreinfo.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2008-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: commandhandler more info online +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + +#include "glxcommandhandlermoreinfo.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerMoreInfo* CGlxCommandHandlerMoreInfo::NewL( + MGlxMediaListProvider* aMediaListProvider, + TBool aContainerList) + { + CGlxCommandHandlerMoreInfo* self = new ( ELeave ) + CGlxCommandHandlerMoreInfo(aMediaListProvider); + CleanupStack::PushL( self ); + self->ConstructL(aContainerList); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerMoreInfo::CGlxCommandHandlerMoreInfo(MGlxMediaListProvider* + aMediaListProvider) + : CGlxMediaListCommandHandler(aMediaListProvider) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMoreInfo::ConstructL( TBool aIsContainerList ) + { + iIsContainerList = aIsContainerList; + + + iDrmUtility = CGlxDRMUtility::InstanceL(); + // Add supported commands + + TCommandInfo info( EGlxCmdDrmMoreInfoOnline ); + // Filter out static items + info.iMinSelectionLength = 1; + info.iDisallowSystemItems = aIsContainerList; + info.iCategoryFilter = EMPXCommand; + info.iCategoryRule = TCommandInfo::EForbidAll; + AddCommandL( info ); + + // create fetch context + iFetchContext = CGlxDefaultAttributeContext::NewL(); + iFetchContext->AddAttributeL( KMPXMediaDrmProtected ); + iFetchContext->AddAttributeL( KMPXMediaGeneralCategory ); + iFetchContext->AddAttributeL( KMPXMediaGeneralUri ); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerMoreInfo::~CGlxCommandHandlerMoreInfo() + { + if(iDrmUtility) + { + iDrmUtility->Close(); + } + + delete iFetchContext; + delete iUrl; + } + +// --------------------------------------------------------------------------- +// DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMoreInfo::DoActivateL(TInt /*aViewId*/) + { + MGlxMediaList& mlist = MediaList(); + mlist.AddContextL(iFetchContext, KGlxFetchContextPriorityNormal); + } + +// --------------------------------------------------------------------------- +// Deactivate +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerMoreInfo::Deactivate() + { + MGlxMediaList& mlist = MediaList(); + mlist.RemoveContext(iFetchContext); + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerMoreInfo::DoExecuteL(TInt aCommandId, + MGlxMediaList& /*aList*/) + { + TBool handledCommand = ETrue; + + switch (aCommandId) + { + case EGlxCmdDrmMoreInfoOnline: + { + // assume we have a valid URI otherwise + // this command will be disabled + if(iUrl && iDrmUtility) + { + iDrmUtility->ShowInfoOnlineL(*iUrl); + } + break; + } + default: + { + handledCommand = EFalse; + break; + } + } + + return handledCommand; + } + + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerMoreInfo::DoIsDisabled(TInt aCommandId, + MGlxMediaList& aList) const + { + TBool hasInfoURL = EFalse; + + if(EGlxCmdDrmMoreInfoOnline==aCommandId && 0 != aList.Count() ) + { + TRAP_IGNORE(hasInfoURL = CanGetInfoURLL(aList)); + } + + return !hasInfoURL; + } + +// ----------------------------------------------------------------------------- +// CanGetInfoURLL - Is info URL available +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerMoreInfo::CanGetInfoURLL(MGlxMediaList& aList) const + { + TBool hasInfoURL = EFalse; + + TInt index = aList.FocusIndex(); + if ( index > KErrNotFound ) + { + const TGlxMedia& item = aList.Item( index ); + TBool isDRMProtected = EFalse; + if( item.GetDrmProtected( isDRMProtected ) && isDRMProtected ) + { + TMPXGeneralCategory cat = item.Category(); + const TDesC& uri = item.Uri(); + if( EMPXImage == cat && uri.Length() > 0 ) + { + delete iUrl; + iUrl = NULL; + iUrl = uri.AllocL(); + + // pass URI to DRM utility + hasInfoURL = iDrmUtility->CanShowInfoOnlineL( *iUrl ); + } + } + } + return hasInfoURL; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/bwins/glxupnpcommandhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/bwins/glxupnpcommandhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + ?StopShowingL@GlxUpnpRenderer@@SAXXZ @ 1 NONAME ; void GlxUpnpRenderer::StopShowingL(void) + ?NewL@CGlxCommandHandlerShowViaUpnp@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 2 NONAME ; class CGlxCommandHandlerShowViaUpnp * CGlxCommandHandlerShowViaUpnp::NewL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerCopyToHomeNetwork@@UAE@XZ @ 3 NONAME ; CGlxCommandHandlerCopyToHomeNetwork::~CGlxCommandHandlerCopyToHomeNetwork(void) + ?Status@GlxUpnpRenderer@@SA?AW4TStatus@NGlxUpnpRenderer@@XZ @ 4 NONAME ; enum NGlxUpnpRenderer::TStatus GlxUpnpRenderer::Status(void) + ?NewL@CGlxCommandHandlerCopyToHomeNetwork@@SAPAV1@AAVMGlxMediaListProvider@@@Z @ 5 NONAME ; class CGlxCommandHandlerCopyToHomeNetwork * CGlxCommandHandlerCopyToHomeNetwork::NewL(class MGlxMediaListProvider &) + ??1CGlxCommandHandlerShowViaUpnp@@UAE@XZ @ 6 NONAME ; CGlxCommandHandlerShowViaUpnp::~CGlxCommandHandlerShowViaUpnp(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/eabi/glxupnpcommandhandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/eabi/glxupnpcommandhandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + _ZN15GlxUpnpRenderer12StopShowingLEv @ 1 NONAME + _ZN15GlxUpnpRenderer6StatusEv @ 2 NONAME + _ZN29CGlxCommandHandlerShowViaUpnp4NewLEP21MGlxMediaListProvideri @ 3 NONAME + _ZN35CGlxCommandHandlerCopyToHomeNetwork4NewLER21MGlxMediaListProvider @ 4 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Build information file for command handlers. +* +*/ + + + + + +PRJ_MMPFILES +glxupnpcommandhandlers.mmp + +PRJ_TESTMMPFILES +//../tsrc/t_cglxcommandhandlershowviaupnp/t_cglxcommandhandlershowviaupnp.mmp +//../tsrc/t_glxupnprenderer/t_glxupnprenderer.mmp +//../tsrc/t_cglxupnprendererimpl/t_cglxupnprendererimpl.mmp +//../tsrc/t_cglxthumbnailsaver/t_cglxthumbnailsaver.mmp +//../tsrc/t_glxcommandhandlercopytohomenetwork/t_glxcommandhandlercopytohomenetwork.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/group/glxupnpcommandhandlers.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/group/glxupnpcommandhandlers.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Upnp Command Handler +* +*/ + + + + +#include "../../../../group/glxbuildcommon.mmh" +#include + +TARGET glxupnpcommandhandler.dll +TARGETTYPE dll + +UID 0x1000008d 0x200071B4 + +CAPABILITY CAP_GENERAL_DLL + +//Global data +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE glxcommandhandlershowviaupnp.cpp +SOURCE glxcommandhandlercopytohomenetwork.cpp +SOURCE glxupnprenderer.cpp +SOURCE glxupnpthumbnailsaver.cpp +SOURCE glxupnprendererimpl.cpp + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../inc //CommandHandlers Identifier +SYSTEMINCLUDE ../../commandhandlerbase/inc //MediaListCommandHandler +SYSTEMINCLUDE ../../../inc //MGlxCommandHandler +SYSTEMINCLUDE ../../../../inc //Gallery Includes +SYSTEMINCLUDE ../../../medialists/inc //MGlxMediaListObserver +SYSTEMINCLUDE ../../../../viewframework/uiutilities/inc //MGlxActiveMediaListChangeObserver +SYSTEMINCLUDE ../../../../common/inc //CGlxResourceUtilities +SYSTEMINCLUDE ../../../../commonui/inc + +deffile glxupnpcommandhandler.def + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY aknicon.lib //AknIconUtils +LIBRARY avkon.lib +LIBRARY bafl.lib //BaflUtils +LIBRARY bitgdi.lib //CFbsBitGc,CFbsBitmapDevice +LIBRARY centralrepository.lib //Central repository +LIBRARY cone.lib +LIBRARY ecom.lib //REcomSession +LIBRARY efsrv.lib //Rfs +LIBRARY euser.lib +LIBRARY fbscli.lib //CFbsBitmap +LIBRARY imageconversion.lib //CImageEncoder +LIBRARY mpxcommon.lib //mpx +//Upnpcommand.dll is always included in image +//This means media app always can link to upnpcommand lib and check upnp availability via upnpcommand api. +LIBRARY upnpcommand.lib //CUpnpCommandAPI + +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib //CResourceUtilities, Filters +LIBRARY glxmedialists.lib //medialist +LIBRARY glxuiutilities.lib //MGlxMediaListResolver +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY flogger.lib // For Logging Tracer diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxcommandhandlercopytohomenetwork.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxcommandhandlercopytohomenetwork.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2008-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: Upnp CommandHandler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERCOPYTOHOMENETWORK_H__ +#define C_GLXCOMMANDHANDLERCOPYTOHOMENETWORK_H__ + + +//Includes +#include +#include + +class t_cglxcommandhandlercopytohomenetwork; + +// CLASS DECLARATION + /** + * CommandHandler which handles copying media to the home network + * + * @lib glxupnpcommandhandler.lib + * @internal reviewed 1/02/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CGlxCommandHandlerCopyToHomeNetwork ) : public CGlxMediaListCommandHandler + { +public: + //Constructors and Destructor + /** + * NewL - Two-phase construction + * @param aMediaListProvider object that provides the media list. + */ + + IMPORT_C static CGlxCommandHandlerCopyToHomeNetwork* + NewL(MGlxMediaListProvider& aMediaListProvider); + /** + * Destructor + */ + IMPORT_C ~CGlxCommandHandlerCopyToHomeNetwork(); + +private: + // From CGlxMediaListCommandHandler + + /** + * See @ref CGlxMediaListCommandHandler::DoExecuteL + */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + /** + * See @ref CGlxMediaListCommandHandler::DoIsDisabled + */ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + /** + * First Phase Constructor + * @param aMediaListProvider object that provides the media list. + */ + CGlxCommandHandlerCopyToHomeNetwork(MGlxMediaListProvider& aMediaListProvider); + + /** + * Second-phase constructor + */ + void ConstructL(); + + /** + * Add the copy to home network command to the command array. + */ + void AddCopyToHomeNetworkCommandL(); + + friend class t_cglxcommandhandlercopytohomenetwork; + }; + +#endif // C_GLXCOMMANDHANDLERCOPYTOHOMENETWORK_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxcommandhandlershowviaupnp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxcommandhandlershowviaupnp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2008-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: Upnp CommandHandler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERSHOWVIAUPNP_H__ +#define C_GLXCOMMANDHANDLERSHOWVIAUPNP_H__ + + +//Includes +#include +#include + +class CGlxUpnpRenderer; + +// CLASS DECLARATION + /** + * CommandHandler which handles the commands for Show/Stop of the Image/Video + * + * @lib glxupnpcommandhandler.lib + * @internal reviewed 1/02/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS( CGlxCommandHandlerShowViaUpnp ) : public CGlxMediaListCommandHandler + { +public: + + //Constructors and Destructor + /** + * NewL - Two-phase construction + * @param aMediaListProvider object that provides the media list. + * @param aUseHomeNetworkCascadeMenu enable the home network sub menu + */ + IMPORT_C static CGlxCommandHandlerShowViaUpnp* + NewL(MGlxMediaListProvider* aMediaListProvider, TBool aUseHomeNetworkCascadeMenu); + /** + * Destructor + */ + IMPORT_C ~CGlxCommandHandlerShowViaUpnp(); + +public: //From CGlxMediaListCommandHandler + + /** + * See @ref CGlxMediaListCommandHandler::DoExecuteL + */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + /** + * See @ref CGlxMediaListCommandHandler::DoIsDisabled + */ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + /** + * First Phase Constructor + * @param aMediaListProvider object that provides the media list. + * @param aUseHomeNetworkCascadeMenu enable the home network sub menu + */ + CGlxCommandHandlerShowViaUpnp(MGlxMediaListProvider* aMediaListProvider, + TBool aUseHomeNetworkCascadeMenu); + + /** + * Second-phase constructor + */ + void ConstructL(); + + /** + * Add Command Handlers + * @param aCommandId + */ + void AddUpnpCommandL(); + +private: + /** + * If gallery is in the viewing state, as opposed to the + * browsing state iFullScreen will be set to ETrue + */ + TBool iFullScreen; + + /** + * Set on construction, If ETrue then + * the home network cascade menu (sub menu) + * will be enabled. + */ + TBool iUseHomeNetworkCascadeMenu; + }; + +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnprenderer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnprenderer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008-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: Interface class +* +*/ + + + + +#ifndef GLXUPNPRENDERER_H__ +#define GLXUPNPRENDERER_H__ + +#include "glxupnprendererdefs.h" + +// INCLUDES +#include +#include + +#include + +// CLASS DECLARATION + +/** +* Renderer a fully static class, acts as an interface class +* +* @lib glxupnpcommandhandler.lib +*/ + +NONSHARABLE_CLASS( GlxUpnpRenderer ) + { + +public: + + /** + * Show Video Via UPNP + */ + static void ShowVideoL(); + + /** + * Start Showing the Image/Video + */ + static void StartShowingL(); + + /** + * Stop Showing the Image/Video + */ + IMPORT_C static void StopShowingL(); + /** + * Stop Showing the Image/Video + */ + static void ShowStopL(); + + /** + * Check the Status of the Renderer + * @return the renderer status + */ + IMPORT_C static NGlxUpnpRenderer::TStatus Status(); + /** + * Inform the clients that the UPnP State has changed + */ + static void ChangeCommandStateL(); + + }; + +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnprendererdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnprendererdefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Renderer Status +* +*/ + + + + + +#ifndef __GLXUPNPTDEFS_H__ +#define __GLXUPNPTDEFS_H__ + +#include + +/** +* Status of the Renderer +*/ + +namespace NGlxUpnpRenderer + { + //UPnP availabilty Status + enum TStatus + { + ENotAvailable, //The access point is not defined + EActive, //The UPnP show is active + EAvailableNotActive //The access point is defined and show is not active + }; + //UPnP Show Error status + enum TErrorStatus + { + EUpnpKErrNone, + EUpnpKErrDisconnected + }; + } + +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnprendererimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnprendererimpl.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2008-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: Implements rendering of the Image/Video +* +*/ + + + + +#ifndef C_GLXUPNPRENDERERIMPL_H__ +#define C_GLXUPNPRENDERERIMPL_H__ + +#include "glxupnprendererdefs.h" +#include "glxupnpthumbnailsaver.h" + +//External Includes +#include +#include +#include + +//for upnp show command +#include +#include + + +#include +#include //for medialist + +//Forward Declarations +class MGlxMediaList; +class CGlxDefaultAttributeContext; +class CGlxDefaultThumbnailContext; +class TGlxMediaId; +class CImageEncoder; +class MGlxThumbnailSaveComplete; +class CGlxThumbnailSaver; + +/** +* Implements the renderering of the image/video +* +* @lib glxupnpcommandhandler.lib +*/ + +NONSHARABLE_CLASS( CGlxUpnpRendererImpl ):public CBase, + public MGlxActiveMediaListChangeObserver, + public MGlxMediaListObserver, + public MUpnpCommandObserver, + public MGlxThumbnailSaveComplete + { +public: + + /** + * Two-phased constructor. + * + * @return Pointer + */ + static CGlxUpnpRendererImpl* NewL(); + + /** + * Destructor + */ + ~CGlxUpnpRendererImpl(); + +private: + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * Default Constructor + */ + CGlxUpnpRendererImpl(); + +public: + + /** + * Show the video file on the UPnP device + */ + void UpnpShowVideoL(); + + /** + * Access point is set or not + * @return ETrue access point is defined + */ + static TBool IsSupported(); + + /** + * Error Status when Show Image/Video + * @return TErrorStatus - UPnP Status + */ + NGlxUpnpRenderer::TErrorStatus UpnpErrorStatus(); + //From MGLxMediaListObserver + + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex,MGlxMediaList* aList); + + + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex,MGlxMediaList* aList); + + + void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList) ; + + + void HandleAttributesAvailableL(TInt aItemIndex,const RArray& aAttributes, + MGlxMediaList* aList); + + + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, + MGlxMediaList* aList); + + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + + void HandleError(TInt aError) { (void)aError; }; + + //From MGlxActiveMediaListChangeObserver + + void HandleActiveMediaListChanged(); + + //From MUpnpCommandObserver + + void CommandComplete( TInt aStatusCode ); + + //MGlxThumbnailSaveComplete + + void HandleFileSaveCompleteL(const TDesC& aPath); + + // Callback function + static TInt DoFocusChanged( TAny* aPtr ); + +private: + /** + * Creates the contextfor the medailist + * @return none + */ + void CreateContextL(); + + /** + * Access the active media list of the view + */ + void PrepareMediaListL(); + + /** + * Access the active media list of the view + */ + void SendFocusedItemL(TInt aNewIndex); + + /** + * Access the active media list of the view + */ + void SendFocusedItemL(TInt aNewIndex,const RArray& aAttributes); + + /** + * Get the image attribute + */ + void GetImageL(const TGlxMedia& aMedia); + + /** + * Get the video attribute + */ + void GetVideoL(const TGlxMedia& aMedia,TMPXAttribute& aAttrThumbnail); + + /** + * Show Command has been completed. + */ + void CommandCompleteL( TInt aStatusCode ); + + /** + * Display the Image after the Video play is Complete + */ + void ShowImageAfterVideoL(); + + /** + * Used by the callback function to provide asynchronous focus change + */ + void DoFocusChangedL(); + +private: + + ///used to resolve the medialist from the views + MGlxActiveMediaListResolver* iActiveMediaListResolver; + + ///activemedialist obj , ref from the tile or full screen view + MGlxMediaList* iActiveMediaList; + + /// attribute context (owned) + ///@ used for retrieving the uri attribute of the focused item(image/video) + CGlxDefaultAttributeContext* iAttributeContext; + + ///upnpshow command + ///@owns CGlxUpnpRendererImpl + CUpnpShowCommand* iUpnpShowCommand; + + //Check the previouusly focussed item + TGlxMediaId iPreviouslySentMediaId; + + ///thumbnail context (owned) + /// used for retrieving the thumbnail of the focused video from the tile views + CGlxDefaultThumbnailContext* iThumbnailContext; + + ///Thumbnail saver class object(owned) + ///@ used for saving the blited thumbnail image + CGlxThumbnailSaver* iThumbnailSaver; + ///Flag to decide if video is to be shown on the rendering device + //TRUE implies video is being shown on UPnP + //FALSE implies image is being shown on UPnP + TBool iIsVideoShow; + + //Store the path of the thumbnail video icon + TBuf<35> iVideoThumbnail; + //The UPnP Error Status when show is complete + NGlxUpnpRenderer::TErrorStatus iUpnpErrorStatus; + + // Handle a change in focus asynchronously, owned + CAsyncCallBack* iHandleFocusChangeCallback; +public: + //flag to check if upnp is supported + TBool iUpnpSupported; + }; + +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnpthumbnailsaver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/inc/glxupnpthumbnailsaver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2008-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: Saves the thumbnail +* +*/ + + + +#ifndef C_GLXTHUMBNAILSAVER_H__ +#define C_GLXTHUMBNAILSAVER_H__ + +#include +#include +#include + +class CFbsBitmap; +class CGlxDefaultThumbnailContext; +class CImageEncoder; +class CFbsBitGc; + + + + +// CLASS DEFINITION + +/** + * Observer for the thumbnail save activity + */ +class MGlxThumbnailSaveComplete + { +public: + /** + * Informs the completion of file save + * @param a aPath contains the file path + * @return none + */ + virtual void HandleFileSaveCompleteL(const TDesC& aPath) = 0; + }; + +// CLASS DEFINITION +/** + * Thumbnail saver class + */ +NONSHARABLE_CLASS( CGlxThumbnailSaver ):public CActive + { + +public: + + /** + * Two-phased constructor. + */ + static CGlxThumbnailSaver* NewL(MGlxThumbnailSaveComplete* aObserver); + + /** + * Destructor. + */ + ~CGlxThumbnailSaver(); + + /** + * Creates the video overlay icon + * @return none + */ + void CreateVideoIconL(CFbsBitmap* aThumbnail); + + /** + * Creates the default video overlay icon + * @return none + */ + void CreateDefaultVideoIconL(); + + /** + * Creates the default image overlay icon + * @return none + */ + void CreateDefaultImageIconL(); + +private: + + /** + * Constructor + * @return none + */ + CGlxThumbnailSaver(MGlxThumbnailSaveComplete* aObserver); + + /** + * Symbian 2-phase constructor + * @return none + */ + void ConstructL(); + + /** + * Creates the video strip icon + * @return none + */ + void CreateVideoStripIconL(); + + /** + * Active objects request completion event + */ + void RunL(); + + /** + * Cancellation of a request + */ + void DoCancel(); + +private: + + //File server session instance + RFs iFs; + + //videostrip ,This will be overlayed on the video thumbnail + CFbsBitmap* iVideoStrip; + + //video strip mask ,used to create the video strip icon from the mif file + CFbsBitmap* iVideoStripMask; + + //image encoder,used for the video overlay icon saving + CImageEncoder* iImageEncoder; + + //temporay bitmap + //used to blit the overlay icon and the thumnail of the video + CFbsBitmap* iTempBitmap; + + // Observer which informs the renderer class about the completion of the thumbnail save + MGlxThumbnailSaveComplete* iObserver; + }; +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/rom/glxcommandhandlerupnp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/rom/glxcommandhandlerupnp.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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: Photos / glxcommandhandlerupnp's iby file. +* +*/ + + + + +#ifndef __GLXCOMMANDHANDLERUPNP_IBY__ +#define __GLXCOMMANDHANDLERUPNP_IBY__ + +file=ABI_DIR\BUILD_DIR\glxupnpcommandhandler.dll SHARED_LIB_DIR\glxupnpcommandhandler.dll + +#endif // __GLXCOMMANDHANDLERUPNP_IBY__ + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxcommandhandlercopytohomenetwork.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxcommandhandlercopytohomenetwork.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,216 @@ +/* +* Copyright (c) 2008-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: Upnp Command Handlers. +* +*/ + + + + +#include "glxcommandhandlercopytohomenetwork.h" + +//Includes +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + + /** + * Retrieves the required attributes from the collection + * to execute the command. They are: + * KMPXMediaGeneralUri and KMPXMediaDrmProtected + * The attributes are retrieved for the selected items + * in the media list. If no items are selected, the attributes + * are retrieved for the focused item. + * + * @param aList media list with selected or focused item. + */ + void RetrieveAttributesL(MGlxMediaList& aList); + + /** + * Builds an array of URIs (files names) of the selected + * items in a media list that are not DRM protected. + * If no items are selected the uri of the focused item + * will be added to the array (provided that it is not DRM + * protected) + * + * The URI and DRM protected attributes must be retrieved + * before calling this method. + * See @ref CGlxCommandHandlerCopyToHomeNetwork::RetrieveAttributesL + * + * @param aList media list from which an array of URIs should + * be built. + * + * @return an array of URIs (files names) of the selected + * items in a media list. + * + */ + CDesCArrayFlat* BuildSelectionArrayLC(MGlxMediaList& aList); + +//----------------------------------------------------------------------------------------- +// Two phased Constructor +//----------------------------------------------------------------------------------------- + +EXPORT_C CGlxCommandHandlerCopyToHomeNetwork* CGlxCommandHandlerCopyToHomeNetwork:: + NewL(MGlxMediaListProvider& aMediaListProvider) + { + TRACER( "CGlxCommandHandlerCopyToHomeNetwork::NewL"); + CGlxCommandHandlerCopyToHomeNetwork* self =new(ELeave) + CGlxCommandHandlerCopyToHomeNetwork(aMediaListProvider); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------------------- +CGlxCommandHandlerCopyToHomeNetwork::~CGlxCommandHandlerCopyToHomeNetwork() + { + } + +//----------------------------------------------------------------------------------------- +// Executing the command handler +//----------------------------------------------------------------------------------------- +TBool CGlxCommandHandlerCopyToHomeNetwork::DoExecuteL(TInt aCommandId, MGlxMediaList& aList) + { + + TRACER( "CGlxCommandHandlerCopyToHomeNetwork::DoExecuteL"); + + if (aCommandId == EGlxCopyToHomeNetwork) + { + RetrieveAttributesL(aList); + CUpnpCopyCommand * copyCommand = CUpnpCopyCommand::NewL(); + CleanupStack::PushL(copyCommand); + CDesCArrayFlat* selectionArray = BuildSelectionArrayLC(aList); + copyCommand->CopyFilesL(selectionArray); + CleanupStack::PopAndDestroy(selectionArray); + CleanupStack::PopAndDestroy(copyCommand); + return ETrue; + } + else + { + return EFalse; + } + } + +//----------------------------------------------------------------------------------------- +// Disable the command handler +//----------------------------------------------------------------------------------------- +TBool CGlxCommandHandlerCopyToHomeNetwork::DoIsDisabled(TInt aCommandId, MGlxMediaList& /*aList*/) const + { + TRACER("CGlxCommandHandlerCopyToHomeNetwork::DoIsDisabled"); + + TBool isDisabled = ETrue; + + if (aCommandId == EGlxCopyToHomeNetwork) + { + // If a leave occurs then isDisabled will remain false. + TRAP_IGNORE(isDisabled = !CUpnpCopyCommand::IsAvailableL()); + } + return isDisabled; + } + +//----------------------------------------------------------------------------------------- +// CGlxCommandHandlerCopyToHomeNetwork::CGlxCommandHandlerCopyToHomeNetwork +//----------------------------------------------------------------------------------------- +CGlxCommandHandlerCopyToHomeNetwork::CGlxCommandHandlerCopyToHomeNetwork( +MGlxMediaListProvider& aMediaListProvider) + : CGlxMediaListCommandHandler(&aMediaListProvider) + { + TRACER(" CGlxCommandHandlerCopyToHomeNetwork::CGlxCommandHandlerCopyToHomeNetwork"); + } + +//----------------------------------------------------------------------------------------- +// CGlxCommandHandlerCopyToHomeNetwork::ConstructL +//----------------------------------------------------------------------------------------- +void CGlxCommandHandlerCopyToHomeNetwork::ConstructL() + { + TRACER(" CGlxCommandHandlerCopyToHomeNetwork::ConstructL"); + AddCopyToHomeNetworkCommandL(); + } + +//----------------------------------------------------------------------------------------- +// Executing the command handler +//----------------------------------------------------------------------------------------- +void CGlxCommandHandlerCopyToHomeNetwork::AddCopyToHomeNetworkCommandL() + { + // Add the copy to home Network Command + TCommandInfo commandInfo(EGlxCopyToHomeNetwork); + commandInfo.iMinSelectionLength = 1; + commandInfo.iDisallowDRM = ETrue; + AddCommandL(commandInfo); + } + +//----------------------------------------------------------------------------------------- +// BuildSelectionArrayLC +//----------------------------------------------------------------------------------------- +CDesCArrayFlat* BuildSelectionArrayLC(MGlxMediaList& aList) + { + TInt selectionCount = aList.SelectionCount(); + + TInt granularity = selectionCount > 0 ? selectionCount : 1; + CDesCArrayFlat* desArray = new(ELeave) CDesCArrayFlat(granularity); + CleanupStack::PushL(desArray); + + if (aList.Count()) + { + if (selectionCount > 0) + { + for (TInt i = 0; i < selectionCount; i++) + { + const TGlxMedia& item = aList.Item(aList.SelectedItemIndex(i)); + if (!item.IsDrmProtected()) + { + desArray->AppendL(item.Uri()); + } + } + } + else + { + const TGlxMedia& item = aList.Item(aList.FocusIndex()); + if (!item.IsDrmProtected()) + { + desArray->AppendL(item.Uri()); + } + } + } + + return desArray; + } + +//----------------------------------------------------------------------------------------- +// RetrieveAttributesL +//----------------------------------------------------------------------------------------- +void RetrieveAttributesL(MGlxMediaList& aList) + { + TGlxSelectionIterator iterator; + iterator.SetRange(KMaxTInt); + CGlxAttributeContext* attributeContext = new(ELeave) CGlxAttributeContext(&iterator); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(KMPXMediaGeneralUri); + attributeContext->AddAttributeL(KMPXMediaDrmProtected); + + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext, aList ,EFalse)); + CleanupStack::PopAndDestroy(attributeContext); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxcommandhandlershowviaupnp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxcommandhandlershowviaupnp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2008-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: Upnp Command Handlers. +* +*/ + + + + +#include "glxcommandhandlershowviaupnp.h" + +//Includes +#include +#include +#include +#include + +#include "glxupnprenderer.h" +#include "glxupnprendererdefs.h" + +//----------------------------------------------------------------------------------------- +// Two phased Constructor +//----------------------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerShowViaUpnp* CGlxCommandHandlerShowViaUpnp:: + NewL(MGlxMediaListProvider* aMediaListProvider, TBool aUseHomeNetworkCascadeMenu) + { + TRACER( "CGlxCommandHandlerShowViaUpnp::NewL"); + CGlxCommandHandlerShowViaUpnp* self =new(ELeave) + CGlxCommandHandlerShowViaUpnp(aMediaListProvider, aUseHomeNetworkCascadeMenu); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------------------- +// First Phase Constructor +//----------------------------------------------------------------------------------------- +CGlxCommandHandlerShowViaUpnp::CGlxCommandHandlerShowViaUpnp + (MGlxMediaListProvider* aMediaListProvider, TBool aUseHomeNetworkCascadeMenu) +: CGlxMediaListCommandHandler(aMediaListProvider), iUseHomeNetworkCascadeMenu(aUseHomeNetworkCascadeMenu) + { + TRACER(" CGlxCommandHandlerShowViaUpnp::CGlxCommandHandlerShowViaUpnp"); + } + +//----------------------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------------------- +CGlxCommandHandlerShowViaUpnp::~CGlxCommandHandlerShowViaUpnp() + { + //Do Nothing + } + +//----------------------------------------------------------------------------------------- +// ConstructL +//----------------------------------------------------------------------------------------- + +void CGlxCommandHandlerShowViaUpnp::ConstructL() + { + TRACER(" CGlxCommandHandlerShowViaUpnp::ConstructL"); + AddUpnpCommandL(); + } + +//----------------------------------------------------------------------------------------- +// Add the UPnP commands to the CommandInfo +//----------------------------------------------------------------------------------------- +void CGlxCommandHandlerShowViaUpnp::AddUpnpCommandL() + { + // Add the Show on Home Network Command + TCommandInfo infoStartShowing(EGlxShowViaUpnp); + infoStartShowing.iMinSelectionLength = 1; + infoStartShowing.iMaxSelectionLength = 1; + // Fix for ABAI-7C3J5K, the menu item should be enabled for DRM items + infoStartShowing.iDisallowDRM = EFalse; + AddCommandL(infoStartShowing) ; + + // We need two versions of the start and stop showing command if iUseHomeNetworkCascadeMenu is true + if (iUseHomeNetworkCascadeMenu) + { + //Add the home network cascaded menu (sub-menu) + TCommandInfo infoHomeNetworkSubmenu(EGlxHomeNetworkSubmenu); + infoHomeNetworkSubmenu.iMinSelectionLength = 1; + infoHomeNetworkSubmenu.iMaxSelectionLength = KMaxTInt; + // Show in Grid View + infoHomeNetworkSubmenu.iViewingState = TCommandInfo::EViewingStateBrowse; + AddCommandL(infoHomeNetworkSubmenu); + + // Add the Show on Home Network Command (submenu version) + TCommandInfo infoStartShowingSubmenuVersion(EGlxShowViaUpnpSubmenuVersion); + infoStartShowingSubmenuVersion.iMinSelectionLength = 1; + infoStartShowingSubmenuVersion.iMaxSelectionLength = 1; + infoStartShowingSubmenuVersion.iDisallowDRM = ETrue; + AddCommandL(infoStartShowingSubmenuVersion); + + //Add the Stop Showing Command (submenu version) + TCommandInfo infoStopShowingSubmenuVersion(EGlxStopShowingSubmenuVersion); + AddCommandL(infoStopShowingSubmenuVersion); + } + + //Add the Stop Showing Command + TCommandInfo infoStopShowing(EGlxStopShowing); + //By default the MinSelectionLength and MaxSelectionLength will be + //set to zero and KMaxTInt respectively + AddCommandL(infoStopShowing); + + // Get notified when we switch to 'browsing' + TCommandInfo browseInfo(EGlxCmdStateBrowse); + browseInfo.iMinSelectionLength = 0; + browseInfo.iMaxSelectionLength = KMaxTInt; + // Filter out static items + AddCommandL(browseInfo); + + // Get notified when we switch to 'viewing' (fullscreen) + TCommandInfo viewInfo(EGlxCmdStateView); + viewInfo.iMinSelectionLength = 0; + viewInfo.iMaxSelectionLength = KMaxTInt; + // Filter out static items + AddCommandL(viewInfo); + + //Add the Play command here as we need to add some filters + TCommandInfo infoplay(EGlxCmdPlay); + // filter out everything except videos + infoplay.iCategoryFilter = EMPXVideo; + infoplay.iCategoryRule = TCommandInfo::ERequireAll; + infoplay.iMinSelectionLength = 1; + infoplay.iMaxSelectionLength = 1; + AddCommandL(infoplay); + } + +//----------------------------------------------------------------------------------------- +// Executing the command handler +//----------------------------------------------------------------------------------------- + +TBool CGlxCommandHandlerShowViaUpnp::DoExecuteL(TInt aCommandId, MGlxMediaList& /*aList*/) + { + TRACER( "CGlxCommandHandlerShowViaUpnp::DoExecuteL"); + + TBool consumed = ETrue; + + switch(aCommandId) + { + case EGlxShowViaUpnpSubmenuVersion: // fallthrough + case EGlxShowViaUpnp: + { + GLX_LOG_INFO("DoExecuteL -ShowViaUPNP"); + + GlxUpnpRenderer:: StartShowingL(); + } + break; + case EGlxStopShowingSubmenuVersion: // fallthrough + case EGlxStopShowing: + { + GLX_LOG_INFO("DoExecuteL -StopShowing"); + GlxUpnpRenderer::ShowStopL(); + GlxUpnpRenderer::StopShowingL(); + } + break; + + case EGlxCmdPlay: + { + GLX_LOG_INFO("DoExecuteL -UPnpPlay"); + //@ Fix for EVTY-7M87LF + if ( NGlxUpnpRenderer::EActive == GlxUpnpRenderer::Status() ) + { + GlxUpnpRenderer::ShowVideoL(); + } + else + { + consumed = EFalse; + } + } + break; + case EGlxCmdStateBrowse: + case EGlxCmdStateView: + { + GLX_LOG_INFO("DoExecuteL -CmdStateBrowse / CmdStateView"); + iFullScreen = (aCommandId == EGlxCmdStateView); + consumed = EFalse; + } + break; + default: + { + consumed = EFalse; //Command is not Executed + } + break; + } + return consumed; + } + +//----------------------------------------------------------------------------------------- +// Disable the command handler +//----------------------------------------------------------------------------------------- +TBool CGlxCommandHandlerShowViaUpnp::DoIsDisabled(TInt aCommandId, MGlxMediaList& /*aList*/) const + { + TRACER("CGlxCommandHandlerShowViaUpnp::DoIsDisabled"); + + TBool disabled = ETrue; + NGlxUpnpRenderer::TStatus rendererStatus = GlxUpnpRenderer::Status(); + + switch(aCommandId) + { + case EGlxShowViaUpnpSubmenuVersion: + { + GLX_LOG_INFO("DoIsDisabled -ShowViaUpnpSubmenuVersion"); + + disabled = !(rendererStatus == NGlxUpnpRenderer::EAvailableNotActive && iUseHomeNetworkCascadeMenu); + } + break; + case EGlxShowViaUpnp: + { + GLX_LOG_INFO("DoIsDisabled -ShowViaUpnp"); + + //If the access point is set and renderer is not active and we are in full screen or we are not using the cascaded menu + disabled = !(rendererStatus == NGlxUpnpRenderer::EAvailableNotActive && (iFullScreen || !iUseHomeNetworkCascadeMenu)); + } + break; + case EGlxStopShowingSubmenuVersion: + { + GLX_LOG_INFO("DoIsDisabled - StopShowingSubmenuVersion"); + //If the renderer device is showing the image/video + disabled = !(rendererStatus == NGlxUpnpRenderer::EActive); + } + break; + case EGlxStopShowing: + { + GLX_LOG_INFO("DoIsDisabled -StopShowing"); + + disabled = !(rendererStatus == NGlxUpnpRenderer::EActive && + (!iUseHomeNetworkCascadeMenu || iFullScreen || (!iFullScreen && SelectionLength() == 0))); + } + break; + case EGlxCmdPlay: + { + GLX_LOG_INFO("DoIsDisabled -UPNPPlay"); + //@ Fix for EVTY-7M87LF + // If the focussed item is video file, + // Play command should be visible to play either in device or renderer if active. + disabled = EFalse; + } + break; + case EGlxHomeNetworkSubmenu: + { + GLX_LOG_INFO("DoIsDisabled - HomeNetworkSubmenu"); + + disabled = (rendererStatus == NGlxUpnpRenderer::ENotAvailable && !iFullScreen); + } + break; + case EGlxCmdStateBrowse: + case EGlxCmdStateView: + { + GLX_LOG_INFO("DoIsDisabled - CmdStateBrowse / CmdStateView"); + disabled = EFalse; + } + default: + { + GLX_LOG_WARNING("DoIsDisabled -UnknownCommandHandler"); + } + break; + } + return disabled; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxupnprenderer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxupnprenderer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2008-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: Interface class +* +*/ + + + + +//Includes + +#include "glxupnprenderer.h" + +#include +#include +#include +#include +#include +#include "glxupnprendererimpl.h" + + +/// Smart pointer that stores the renderer pointer. +/// Static data, so the object is destroyed when dll is unloaded. +/// The UPnP renderer needs to be stored as static data, to allow the state of the rendering +/// to be stored across multiple view switches + +TGlxPointer gUpnpRendererImpl; + +//----------------------------------------------------------------------------------------- +// Start Showing the Image/Video +//----------------------------------------------------------------------------------------- + +void GlxUpnpRenderer::StartShowingL() + { + TRACER("CGlxUpnpRenderer::StartShowingL()"); + + GLX_ASSERT_DEBUG ( !gUpnpRendererImpl.Ptr(), Panic( EGlxPanicIllegalState), "Start showing called when showing was already started" ); + gUpnpRendererImpl = CGlxUpnpRendererImpl::NewL(); // Smart pointer deletes existing instance if any + + // Send state changed command + ChangeCommandStateL(); + } + +//----------------------------------------------------------------------------------------- +// Stop Showing the Image/Video +//----------------------------------------------------------------------------------------- + +EXPORT_C void GlxUpnpRenderer:: StopShowingL() + { + TRACER("CGlxUpnpRenderer::StopShowingL()"); + if(gUpnpRendererImpl.Ptr()) + { + ChangeCommandStateL(); + } + } +//----------------------------------------------------------------------------------------- +// Inform the clients that the UPnP State has changed +//----------------------------------------------------------------------------------------- + + void GlxUpnpRenderer::ChangeCommandStateL() + { + TRACER("void GlxUpnpRenderer::ChangeCommandStateL()"); + // Send state changed command + // This class does not have access to a CEikonEnv and hence + // pls ignore the code scanner warning - Using CEikonEnv::Static + MEikCommandObserver* commandObserver = CEikonEnv::Static()->EikAppUi(); + commandObserver->ProcessCommandL( EGlxCmdShowViaUpnpStateChanged ); + } + +//----------------------------------------------------------------------------------------- +// Get the Status of the UPNP +//----------------------------------------------------------------------------------------- + +EXPORT_C NGlxUpnpRenderer::TStatus GlxUpnpRenderer::Status() + { + TRACER("CGlxUpnpRenderer::TStatus CGlxUpnpRenderer::UpnpStatus() "); + + NGlxUpnpRenderer::TStatus status =NGlxUpnpRenderer::ENotAvailable; + + if(gUpnpRendererImpl.Ptr()) + { + //renderer object is created, so it is active + status = NGlxUpnpRenderer::EActive; + NGlxUpnpRenderer::TErrorStatus upnpStatus = gUpnpRendererImpl->UpnpErrorStatus(); + + if(upnpStatus == NGlxUpnpRenderer::EUpnpKErrDisconnected) + { + GLX_LOG_INFO("WLan disconnected"); + status = NGlxUpnpRenderer::EAvailableNotActive; + gUpnpRendererImpl = NULL; + } + } + else + { + // renderer is either not available or available and not active + // renderer is available but not active if it is supported + // in the current device + if ( CGlxUpnpRendererImpl::IsSupported() ) + { + status = NGlxUpnpRenderer::EAvailableNotActive; + } + // else the renderer is not available + } + return status; + } + +//----------------------------------------------------------------------------------------- +// Show Video via UPNP +//----------------------------------------------------------------------------------------- + +void GlxUpnpRenderer::ShowVideoL() + { + TRACER("CGlxUpnpRenderer::ShowVideoL()"); + //If the focussed item is video + gUpnpRendererImpl->UpnpShowVideoL(); + } +//----------------------------------------------------------------------------------------- +// Stop the Show via UPNP +//----------------------------------------------------------------------------------------- + +void GlxUpnpRenderer::ShowStopL() +{ +TRACER("CGlxUpnpRenderer::ShowVideoL()"); +if(gUpnpRendererImpl.Ptr()) + { + gUpnpRendererImpl = NULL; + } +} + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxupnprendererimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxupnprendererimpl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,557 @@ +/* +* Copyright (c) 2008-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: Implements rendering of the Image/Video +* +*/ + + + + +#include "glxupnprendererimpl.h" + +#include // CGlxAttributeContext +#include // CGlxAttributeRetriever +#include // CGlxUiUtility +#include +#include // GLX_LOG +#include // CGlxMediaList +#include // KGlxMediaIdThumbnail +#include // CGlxThumbnailContext +#include // Fetch context priority def'ns +#include // GlxErrorManager +#include // TGlxMedia +#include "glxupnprenderer.h" +// CONSTANTS +const TInt KVideoIconThumbnailWidth = 640; +const TInt KVideoIconThumbnailHeight = 480; + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +CGlxUpnpRendererImpl* CGlxUpnpRendererImpl::NewL() + { + TRACER("CGlxUpnpRendererImpl::NewL()"); + + CGlxUpnpRendererImpl* self = new(ELeave) CGlxUpnpRendererImpl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//--------------------------------------------------------------------------------- +// Defalut Constructor +//--------------------------------------------------------------------------------- +CGlxUpnpRendererImpl::CGlxUpnpRendererImpl() + { + //Do Nothing + } + +//--------------------------------------------------------------------------------- +// 2nd phase Constructor +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::ConstructL() + { + TRACER("CGlxUpnpRendererImpl::ConstructL()"); + + // Create the asynchronous callback for focus changes + iHandleFocusChangeCallback = new ( ELeave ) + CAsyncCallBack( TCallBack( DoFocusChanged, this ), + CActive::EPriorityStandard ); + + //Create the showcommand to query the upnpframework + iUpnpShowCommand = CUpnpShowCommand::NewL(this); + + + if(iUpnpShowCommand) + { + iUpnpSupported = ETrue; + } + //Allocate the UPNP resources to show the Image/Video + if(iUpnpSupported) + { + iUpnpShowCommand->StartShowingL(); + } + + iUpnpErrorStatus = NGlxUpnpRenderer::EUpnpKErrNone; + PrepareMediaListL(); + + } + +//--------------------------------------------------------------------------------- +// Destructor +//--------------------------------------------------------------------------------- +CGlxUpnpRendererImpl::~CGlxUpnpRendererImpl() + { + TRACER("CGlxUpnpRendererImpl::~CGlxUpnpRendererImpl()"); + + // delete also cancels the callback + delete iHandleFocusChangeCallback; + + if ( iActiveMediaList ) //cleanup the current list + { + iActiveMediaList->RemoveMediaListObserver(this); + iActiveMediaList->RemoveContext( iAttributeContext ); + iActiveMediaList->RemoveContext( iThumbnailContext ); + } + if (iActiveMediaListResolver) + { + iActiveMediaListResolver->Close( this ); + } + delete iAttributeContext; + + delete iThumbnailContext; + + delete iThumbnailSaver; + + if( iUpnpShowCommand ) + { + //To check if we can delete the showcommand without StopShowing + TRAP_IGNORE(iUpnpShowCommand->StopShowingL ( ) ); + delete iUpnpShowCommand; + } + } + + +//--------------------------------------------------------------------------------- +// If the access point is defined +//--------------------------------------------------------------------------------- +TBool CGlxUpnpRendererImpl::IsSupported() + { + TRACER("CGlxUpnpRendererImpl::IsSupported()"); + + TInt isSupported = EFalse; + //need to trap as we cannot leave + + TRAP_IGNORE( isSupported = CUpnpShowCommand::IsAvailableL ( ) ); + + return isSupported; + } +//--------------------------------------------------------------------------------- +// Error Status when Show Image/Video +//--------------------------------------------------------------------------------- +NGlxUpnpRenderer::TErrorStatus CGlxUpnpRendererImpl::UpnpErrorStatus() + { + TRACER("CGlxUpnpRendererImpl::UpnpErrorStatus()"); + + //The UPnP Show Image/Video error status after the Show request to UPnP Framework + return iUpnpErrorStatus; + } + +//--------------------------------------------------------------------------------- +// Show the Video after a user action +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::UpnpShowVideoL() + { + TRACER("CGlxUpnpRendererImpl::UpnpShowVideoL"); + User::LeaveIfError( GlxAttributeRetriever::RetrieveL ( *iAttributeContext,*iActiveMediaList ) ); + + if(iUpnpSupported) + { + const TDesC& videoUri = iActiveMediaList->Item( iActiveMediaList->FocusIndex() ).Uri(); + iUpnpShowCommand->ShowVideoL( videoUri ); + } + + iIsVideoShow = ETrue; + //Hiding the HUI display,so that the UPnPFw will take the + //view control and update the view for a video + CGlxUiUtility::HideAlfDisplayL(); + } + +//--------------------------------------------------------------------------------- +// Preare the media list +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::PrepareMediaListL() + { + TRACER("CGlxUpnpRendererImpl::PrepareMediaListL"); + + if ( !iActiveMediaListResolver ) //get the singleton instance for the resolver + { + iActiveMediaListResolver= MGlxActiveMediaListResolver::InstanceL( this ); + } + iActiveMediaList= iActiveMediaListResolver->ActiveMediaList(); //get the currently active medialist + + if ( iActiveMediaList ) + { + CreateContextL(); + iActiveMediaList->AddContextL( iAttributeContext, + KGlxFetchContextPriorityNormal ); + iActiveMediaList->AddContextL( iThumbnailContext, + KGlxFetchContextPriorityNormal ); + iActiveMediaList->AddMediaListObserverL(this); + } + } + + +//--------------------------------------------------------------------------------- +// Create the context for the medialist +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::CreateContextL() + { + TRACER("CGlxUpnpRendererImpl::CreateContextL"); + + iAttributeContext = CGlxDefaultAttributeContext::NewL( ); + iAttributeContext->AddAttributeL( KMPXMediaGeneralUri ); + + iThumbnailContext = CGlxDefaultThumbnailContext::NewL( ); // set the thumbnail context + iThumbnailContext->SetDefaultSpec( KVideoIconThumbnailWidth, KVideoIconThumbnailHeight ); // 640 pixels wide and 480 pixel height-VGA. + } + +//--------------------------------------------------------------------------------- +// media object item added +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/,MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleItemAddedL"); + } + +//--------------------------------------------------------------------------------- +// media object is now available for an item +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleItemAddedL"); + } + +//--------------------------------------------------------------------------------- +// media item was removed from the list +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/,MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleItemAddedL"); + } + +//--------------------------------------------------------------------------------- +// Media item was changed +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::HandleItemModifiedL(const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleItemAddedL"); + } + +//--------------------------------------------------------------------------------- +// Attribute is available +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::HandleAttributesAvailableL(TInt aItemIndex,const RArray& aAttributes, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleAttributesAvailableL"); + + if ( aItemIndex == iActiveMediaList->FocusIndex() ) + { + SendFocusedItemL(aItemIndex,aAttributes); + } + } + +//--------------------------------------------------------------------------------- +// Focus has moved +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, + TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleFocusChangedL"); + // fix for ERBS-7CFCJE, make focus change handling asynchronous to prevent + // UPnP from blocking our garbage collection if the UPnP framework + // displays a dialog (e.g. when showing a DRM-protected item). + if ( iHandleFocusChangeCallback->IsActive() ) + { + iHandleFocusChangeCallback->Cancel(); + } + iHandleFocusChangeCallback->CallBack(); + } + +//--------------------------------------------------------------------------------- +// Item has been selected +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleItemAddedL"); + } + +//--------------------------------------------------------------------------------- +// Notification from the collection +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::HandleMessageL(const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxUpnpRendererImpl::HandleItemAddedL"); + } + + +//From MGlxActiveMediaListChangeObserver +//--------------------------------------------------------------------------------- +// Active media list pointer has changed. +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::HandleActiveMediaListChanged() + { + TRACER("CGlxUpnpRendererImpl::HandleActiveMediaListChanged()"); + + if ( iActiveMediaList ) //cleanup the current list + { + iActiveMediaList->RemoveMediaListObserver( this ); + iActiveMediaList->RemoveContext( iAttributeContext ); + iActiveMediaList->RemoveContext( iThumbnailContext ); + } + TRAP_IGNORE(PrepareMediaListL()); // will give a new list + } + + +//From MUpnpCommandObserver +//--------------------------------------------------------------------------------- +// Show Command has been completed. +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::CommandComplete( TInt aStatusCode ) + { + TRACER("CGlxUpnpRendererImpl::CommandComplete"); + + TRAP_IGNORE( CommandCompleteL(aStatusCode) ); + } + + +//--------------------------------------------------------------------------------- +// Show Command has been completed. +//--------------------------------------------------------------------------------- +// +void CGlxUpnpRendererImpl::CommandCompleteL( TInt aStatusCode ) + { + TRACER("CGlxUpnpRendererImpl::CommandCompleteL"); + + if( KErrNone == aStatusCode ) + { + GLX_LOG_INFO("Error code is KErrNone"); + iUpnpErrorStatus = NGlxUpnpRenderer::EUpnpKErrNone; + } + + else if( KErrDisconnected == aStatusCode ) + { + GLX_LOG_INFO("Error code is KErrDisconnected"); + iUpnpErrorStatus = NGlxUpnpRenderer::EUpnpKErrDisconnected; + + iIsVideoShow = EFalse; + + //Show the HUI display + CGlxUiUtility::ShowAlfDisplayL(); + + // Send state changed command + GlxUpnpRenderer::ChangeCommandStateL(); + } + + if(iUpnpSupported) + { + if( KUpnpCommandStatusStartPlayVideo == aStatusCode ) + { + GLX_LOG_INFO("KUpnpCommandStatusStartPlayVideo"); + // Photos hiding their UI + CGlxUiUtility::HideAlfDisplayL(); + } + } + + //Check if the show on the rendering device was a video + else if( ( iIsVideoShow ) && ( GlxUpnpRenderer::Status() == NGlxUpnpRenderer::EActive ) ) + { + GLX_LOG_INFO("Video play is complete"); + //Need to trap as we cannot leave + ShowImageAfterVideoL(); + } + } + +//--------------------------------------------------------------------------------- +// Display the Image after the Video play is Complete +//--------------------------------------------------------------------------------- + void CGlxUpnpRendererImpl::ShowImageAfterVideoL() + { + TRACER("CGlxUpnpRendererImpl::ShowVideoComplete"); + + //Show the HUI display once the video play is completed + CGlxUiUtility::ShowAlfDisplayL(); + + if(iUpnpSupported) + { + iUpnpShowCommand->ShowImageL( iVideoThumbnail ); + } + + iIsVideoShow = EFalse; + } + + +//From MGlxThumbnailSaveComplete +//--------------------------------------------------------------------------------- +// Call back for thumbnail save completion +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::HandleFileSaveCompleteL(const TDesC& aPath) + { + TRACER("CGlxUpnpRendererImpl::HandleFileSaveCompleteL"); + + iVideoThumbnail.Copy( aPath ); + + if(iUpnpSupported) + { + iUpnpShowCommand->ShowImageL( iVideoThumbnail ); + } + } + +//--------------------------------------------------------------------------------- +// Send the focussed item to the device +//--------------------------------------------------------------------------------- + +void CGlxUpnpRendererImpl::SendFocusedItemL(TInt aNewIndex) + { + TRACER("CGlxUpnpRendererImpl::SendFocusedItemL"); + + if(KErrNotFound!=aNewIndex) + { + const TGlxMedia& item = iActiveMediaList->Item(aNewIndex); + TMPXAttribute attrThumb(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId(ETrue, KVideoIconThumbnailWidth, KVideoIconThumbnailHeight)); + if ( (iActiveMediaList) && (!item.IsStatic()) ) + { + if( item.Uri().Length() > 0) + { + GetImageL(item); + GetVideoL(item,attrThumb); + } + } + } + } + +//--------------------------------------------------------------------------------- +// Send the focussed item to the device +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::SendFocusedItemL(TInt aNewIndex,const RArray& aAttributes) + { + TRACER("CGlxUpnpRendererImpl::SendFocusedItemL"); + + if( KErrNotFound != aNewIndex ) + { + const TGlxMedia& item = iActiveMediaList->Item(aNewIndex); + TMPXAttribute attrThumb(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId(ETrue, KVideoIconThumbnailWidth, KVideoIconThumbnailHeight)); + + // Loop untill it checks for all the avialable attributes + for ( TInt i = aAttributes.Count() - 1; i >= 0 ; i-- ) + { + if ( (iActiveMediaList) && (!item.IsStatic()) ) + { + if( item.Uri().Length() > 0) + { + //retrive the attribute for showing image + if( EMPXImage == item.Category()) + { + GetImageL(item); + } + //retrive the attribute for showing Video + else if ( EMPXVideo == item.Category() ) + { + GetVideoL(item,attrThumb); + } + } + } + } + } + } + +//--------------------------------------------------------------------------------- +// Get the image attribute +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::GetImageL(const TGlxMedia& aMedia) + { + TRACER("CGlxUpnpRendererImpl::GetImageL"); + //retrive the attribute for showing image + const CGlxMedia* item = aMedia.Properties(); + if(EMPXImage == aMedia.Category()) + { + if (!iThumbnailSaver) + { + iThumbnailSaver=CGlxThumbnailSaver::NewL( this ); + } + if((GlxErrorManager::HasAttributeErrorL(item, KGlxMediaIdThumbnail) != KErrNone)) + { + iThumbnailSaver->CreateDefaultImageIconL(); + } + if ((iPreviouslySentMediaId != aMedia.Id( ) ) ) + { + iPreviouslySentMediaId=aMedia.Id(); + //show the image Via upnp device + if(iUpnpSupported) + { + const TDesC& imageUri = aMedia.Uri(); + iUpnpShowCommand->ShowImageL( imageUri ); + } + } + } + } + +//--------------------------------------------------------------------------------- +// Get the video attribute +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::GetVideoL(const TGlxMedia& aMedia,TMPXAttribute& aAttrThumbnail) + { + TRACER("CGlxUpnpRendererImpl::GetVideoL"); + const CGlxMedia* item = aMedia.Properties(); + if(EMPXVideo == aMedia.Category()) + { + if (!iThumbnailSaver) + { + iThumbnailSaver=CGlxThumbnailSaver::NewL( this ); + } + + if ( ( aMedia.ThumbnailAttribute( aAttrThumbnail ) ) + && ( iPreviouslySentMediaId!=aMedia.Id( )) ) + { + iPreviouslySentMediaId=aMedia.Id(); + //get the thumbnail image + const CGlxThumbnailAttribute* value = aMedia.ThumbnailAttribute( aAttrThumbnail ); + iThumbnailSaver->CreateVideoIconL( value->iBitmap ); + } + else if ((GlxErrorManager::HasAttributeErrorL(item, KGlxMediaIdThumbnail) != KErrNone)) + { + // send the default thumbnail + iThumbnailSaver->CreateDefaultVideoIconL(); + } + } + } + +//--------------------------------------------------------------------------------- +// DoFocusChanged callback +//--------------------------------------------------------------------------------- +TInt CGlxUpnpRendererImpl::DoFocusChanged( TAny* aPtr ) + { + TRACER("CGlxUpnpRendererImpl::DoFocusChanged"); + + CGlxUpnpRendererImpl* self + = reinterpret_cast< CGlxUpnpRendererImpl* >( aPtr ); + TRAP_IGNORE( self->DoFocusChangedL() ); + + return 0; + } + +//--------------------------------------------------------------------------------- +// DoFocusChangedL +//--------------------------------------------------------------------------------- +void CGlxUpnpRendererImpl::DoFocusChangedL() + { + // SendFocusedItemL validates the index so no need to do it here too + TInt index = iActiveMediaList->FocusIndex(); + SendFocusedItemL( index ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxupnpthumbnailsaver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/src/glxupnpthumbnailsaver.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,347 @@ +/* +* Copyright (c) 2008-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: Saves the thumbnail +* +*/ + + + + +#include "glxupnpthumbnailsaver.h" + +#include //AknIconUtils +#include +#include //BaflUtils +#include +#include //CImageEncoder +#include //MGlxActiveMediaListResolver +#include //MGlxMediaList + +#include //CGlxResourceUtilities +#include //mgallery icon +#include //Logs +#include + +// CONSTANTS +const TInt KVideoIconThumbnailWidth = 640; +const TInt KVideoIconThumbnailHeight = 480; +const TInt KIconWeight=100; +const TInt KIconHeight=80; + +_LIT(KFilepath ,"C:\\Data\\upnp\\VideoThumb.jpg"); //jpeg +_LIT(KFolder,"C:\\Data\\upnp\\"); +_LIT(KIconsResName, "glxicons.mif"); //For icons +_LIT8(KGlxMimeJpeg, "image/jpeg"); + +//----------------------------------------------------------------------------------------- +// Two phased Constructor +//----------------------------------------------------------------------------------------- +CGlxThumbnailSaver* CGlxThumbnailSaver:: NewL(MGlxThumbnailSaveComplete* aObserver) + { + TRACER("CGlxThumbnailSaver::NewL()"); + + CGlxThumbnailSaver* self = new (ELeave) CGlxThumbnailSaver( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------------------- +// Constructor +//----------------------------------------------------------------------------------------- + +CGlxThumbnailSaver::CGlxThumbnailSaver (MGlxThumbnailSaveComplete* aObserver): CActive(EPriorityStandard) + { + TRACER("CGlxThumbnailSaver::CGlxThumbnailSaver "); + iObserver = aObserver; + } + +//----------------------------------------------------------------------------------------- +// 2nd phase Constructor +//----------------------------------------------------------------------------------------- + +void CGlxThumbnailSaver::ConstructL() + { + TRACER("CGlxThumbnailSaver::ConstructL()"); + + User::LeaveIfError (iFs.Connect()); + CActiveScheduler::Add(this); + if ( !BaflUtils::FolderExists( iFs, KFolder ) ) + { + User::LeaveIfError( iFs.MkDir( KFolder ) ); //create the folder upnp + // set the folder as hidden to prevent MDS from harvesting its contents + User::LeaveIfError( iFs.SetAtt( KFolder, KEntryAttHidden, + KEntryAttNormal ) ); + } + } + +//----------------------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------------------- + +CGlxThumbnailSaver::~CGlxThumbnailSaver() + { + TRACER("CGlxThumbnailSaver::~CGlxThumbnailSaver()"); + + Cancel(); + + iFs.Delete( KFilepath ); // return value ignored + iFs.RmDir( KFolder ); // return value ignored + + delete iImageEncoder; + + delete iTempBitmap; + + delete iVideoStrip; + + delete iVideoStripMask; + + iObserver = NULL; + + iFs.Close(); + } + + +//----------------------------------------------------------------------------------------- +// Creates the video strip icon +//----------------------------------------------------------------------------------------- + +void CGlxThumbnailSaver::CreateVideoStripIconL() + { + TRACER("CGlxThumbnailSaver::CreateVideoStripIconL()"); + + TFileName mifFile(KDC_APP_BITMAP_DIR); + mifFile.Append(KIconsResName); + CGlxResourceUtilities::GetResourceFilenameL(mifFile); + + AknIconUtils::CreateIconL(iVideoStrip, iVideoStripMask, mifFile, + EMbmGlxiconsQgn_indi_media_thumbnail,EMbmGlxiconsQgn_indi_media_thumbnail_mask); + AknIconUtils::SetSize(iVideoStrip, TSize(KIconWeight,KIconHeight),EAspectRatioNotPreserved); + } + +//----------------------------------------------------------------------------------------- +// Creates the default video icon ,this default icon will be sent in case, the +// thumbnail conversion fails +//----------------------------------------------------------------------------------------- +void CGlxThumbnailSaver::CreateDefaultVideoIconL() + { + TRACER("CGlxThumbnailSaver::CreateDefaultVideoIconL"); + //create a temporary bitmap + if(!iVideoStrip) + { + CreateVideoStripIconL(); + } + + CFbsBitmap* defaultBitmap=NULL; + CFbsBitmap* defaultBitmapMask= NULL; + + TFileName mifFile(KDC_APP_BITMAP_DIR); + mifFile.Append(KIconsResName); + User::LeaveIfError(CompleteWithAppPath(mifFile)); + + //creating default video icon + AknIconUtils::CreateIconLC(defaultBitmap, defaultBitmapMask, mifFile, + EMbmGlxiconsQgn_prop_image_notcreated, EMbmGlxiconsQgn_prop_image_notcreated_mask); + AknIconUtils::SetSize(defaultBitmap, TSize(KVideoIconThumbnailWidth,KVideoIconThumbnailHeight),EAspectRatioNotPreserved); + AknIconUtils::SetSize(defaultBitmapMask, TSize(KVideoIconThumbnailWidth,KVideoIconThumbnailHeight),EAspectRatioNotPreserved); + + //creates a temp bitmap + delete iTempBitmap; + iTempBitmap=NULL; + + iTempBitmap = new (ELeave) CFbsBitmap(); + User::LeaveIfError(iTempBitmap->Create(TSize(KVideoIconThumbnailWidth,KVideoIconThumbnailHeight), KGlxThumbnailDisplayMode)); + + //create a graphic device + CFbsBitmapDevice* graphicsDevice = CFbsBitmapDevice::NewL(iTempBitmap); + CleanupStack::PushL(graphicsDevice); + + //bitmap context + CFbsBitGc* bitmapContext=NULL; + User::LeaveIfError(graphicsDevice->CreateContext(bitmapContext)); + bitmapContext->Activate(graphicsDevice); + CleanupStack::PushL(bitmapContext); + TRect rectSize; + rectSize.SetWidth(KVideoIconThumbnailWidth); + rectSize.SetHeight(KVideoIconThumbnailHeight); + TPoint centerPosition = rectSize.Center(); + centerPosition.iX = centerPosition.iX - (KIconWeight/2); + centerPosition.iY = centerPosition.iY - (KIconHeight/2); + //blit the thumbnail in to the temporary bitmap + bitmapContext->BitBlt(TPoint(0,0),defaultBitmap); + + //blit the overlay icon + bitmapContext->BitBltMasked(centerPosition,iVideoStrip,TRect(TPoint(0,0), iVideoStrip->SizeInPixels()), iVideoStripMask,EFalse); + + //create the encoder -jpeg + delete iImageEncoder; + iImageEncoder=NULL; + + iImageEncoder = CImageEncoder::FileNewL(iFs,KFilepath,KGlxMimeJpeg); + + //convert to jpeg + // Fix for ESAU-7CVF8R: "UPNP:MC photos Crashes When user focus the DRM video on the rendering device" + // Ensure we don't try to activate ourself when already active + if ( IsActive() ) + { + Cancel(); + } + iImageEncoder->Convert(&iStatus ,*iTempBitmap); + SetActive(); + + CleanupStack::PopAndDestroy(bitmapContext); + CleanupStack::PopAndDestroy(graphicsDevice); + CleanupStack::PopAndDestroy(defaultBitmapMask); + CleanupStack::PopAndDestroy(defaultBitmap); + } + +//--------------------------------------------------------------------------------- +// creates the video overlayicon +//--------------------------------------------------------------------------------- + +void CGlxThumbnailSaver::CreateVideoIconL(CFbsBitmap* aThumbnail) + { + TRACER("CGlxThumbnailSaver::CreateVideoIconL"); + + //create a temperory bitmap + if(!iVideoStrip) + { + CreateVideoStripIconL(); + } + + delete iTempBitmap; + iTempBitmap=NULL; + iTempBitmap = new (ELeave) CFbsBitmap(); + User::LeaveIfError(iTempBitmap->Create(TSize(KVideoIconThumbnailWidth,KVideoIconThumbnailHeight), KGlxThumbnailDisplayMode)); + + //create a graphic device + CFbsBitmapDevice* graphicsDevice = CFbsBitmapDevice::NewL(iTempBitmap); + CleanupStack::PushL(graphicsDevice); + + //bitmap context + CFbsBitGc* bitmapContext=NULL; + User::LeaveIfError(graphicsDevice->CreateContext(bitmapContext)); + bitmapContext->Activate(graphicsDevice); + CleanupStack::PushL(bitmapContext); + TRect rectSize; + rectSize.SetWidth(KVideoIconThumbnailWidth); + rectSize.SetHeight(KVideoIconThumbnailHeight); + TPoint centerPosition = rectSize.Center(); + centerPosition.iX = centerPosition.iX - (KIconWeight/2); + centerPosition.iY = centerPosition.iY - (KIconHeight/2); + + //blit the thumbnail in to the temporary bitmap + bitmapContext->BitBlt(TPoint(0,0),aThumbnail); + + //blit the overlay icon + bitmapContext->BitBltMasked(centerPosition,iVideoStrip,TRect(TPoint(0,0), iVideoStrip->SizeInPixels()), iVideoStripMask,EFalse); + + //create the encoder + delete iImageEncoder; + iImageEncoder= NULL; + + iImageEncoder = CImageEncoder::FileNewL(iFs,KFilepath,KGlxMimeJpeg); + iImageEncoder->Convert(&iStatus ,*iTempBitmap); + + SetActive(); + + CleanupStack::PopAndDestroy(bitmapContext); + CleanupStack::PopAndDestroy(graphicsDevice); + } + +//----------------------------------------------------------------------------------------- +// void CGlxThumbnailSaver::CreateDefaultImageIconL() +//----------------------------------------------------------------------------------------- + void CGlxThumbnailSaver::CreateDefaultImageIconL() + { + TRACER("CGlxThumbnailSaver::CreateDefaultVideoIconL"); + //create a temporary bitmap + CFbsBitmap* defaultBitmap=NULL; + CFbsBitmap* defaultBitmapMask= NULL; + + TFileName mifFile(KDC_APP_BITMAP_DIR); + mifFile.Append(KIconsResName); + User::LeaveIfError(CompleteWithAppPath(mifFile)); + + //creating default video icon + AknIconUtils::CreateIconLC(defaultBitmap, defaultBitmapMask, mifFile, + EMbmGlxiconsQgn_prop_image_notcreated, EMbmGlxiconsQgn_prop_image_notcreated_mask); + AknIconUtils::SetSize(defaultBitmap, TSize(KVideoIconThumbnailWidth,KVideoIconThumbnailHeight),EAspectRatioNotPreserved); + AknIconUtils::SetSize(defaultBitmapMask, TSize(KVideoIconThumbnailWidth,KVideoIconThumbnailHeight),EAspectRatioNotPreserved); + + //creates a temp bitmap + delete iTempBitmap; + iTempBitmap=NULL; + + iTempBitmap = new (ELeave) CFbsBitmap(); + User::LeaveIfError(iTempBitmap->Create(TSize(KVideoIconThumbnailWidth,KVideoIconThumbnailHeight), KGlxThumbnailDisplayMode)); + + //create a graphic device + CFbsBitmapDevice* graphicsDevice = CFbsBitmapDevice::NewL(iTempBitmap); + CleanupStack::PushL(graphicsDevice); + + //bitmap context + CFbsBitGc* bitmapContext=NULL; + User::LeaveIfError(graphicsDevice->CreateContext(bitmapContext)); + bitmapContext->Activate(graphicsDevice); + CleanupStack::PushL(bitmapContext); + + //blit the thumbnail in to the temporary bitmap + bitmapContext->BitBlt(TPoint(0,0),defaultBitmap); + + //create the encoder -jpeg + delete iImageEncoder; + iImageEncoder=NULL; + + iImageEncoder = CImageEncoder::FileNewL(iFs,KFilepath,KGlxMimeJpeg); + + if ( IsActive() ) + { + Cancel(); + } + iImageEncoder->Convert(&iStatus ,*iTempBitmap); + SetActive(); + + CleanupStack::PopAndDestroy(bitmapContext); + CleanupStack::PopAndDestroy(graphicsDevice); + CleanupStack::PopAndDestroy(defaultBitmapMask); + CleanupStack::PopAndDestroy(defaultBitmap); + } +//----------------------------------------------------------------------------------------- +// CActive::RunL +//----------------------------------------------------------------------------------------- + +void CGlxThumbnailSaver::RunL() + { + TRACER("CGlxUpnpRenderer::RunL"); + + if (iStatus == KErrNone) + { + TRACER("CGlxUpnpRenderer::RunL::KErrNone"); + iObserver->HandleFileSaveCompleteL(KFilepath); + } + } + +//----------------------------------------------------------------------------------------- +// CActive::DoCancel() +//----------------------------------------------------------------------------------------- + +void CGlxThumbnailSaver::DoCancel() + { + TRACER("CGlxUpnpRenderer::DoCancel"); + + iImageEncoder->Cancel(); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpcommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpcommand.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* 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: Upnp Command State information +* +*/ + + + +#ifndef __C_GLXUPNPCOMMAND_H__ +#define __C_GLXUPNPCOMMAND_H__ + + +#include + + +namespace UpnpCommand + { + enum TUpnpCommandState + { + EUndefinedState = 100, + EUpnpCommandIdle, // Upnp Fw resources not allocated + EUpnpCommandAllocated, // Upnp Fw resources allocated + EUpnpCommandExecuting // Upnp command execution ongoing + }; + } + + +class CUpnpCommand : public CBase + { + public: + static CUpnpCommand* NewL(); + + virtual UpnpCommand::TUpnpCommandState State() = 0; + + }; + + +inline CUpnpCommand* CUpnpCommand::NewL() + { + CUpnpCommand* command = NULL ; + return command; + } + +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpcommandobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpcommandobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +/* +* 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: UpnpCommand Observer +* +*/ + + + +#ifndef UPNP_COMMAND_OBSERVER_H +#define UPNP_COMMAND_OBSERVER_H + +// CONSTANTS +const TInt KUpnpCommandStatusStartPlayVideo = 6; // video is ready to be played. +/** +* UpnpCommand Observer interface class definition. +* +* @since S60 3.2 +*/ +class MUpnpCommandObserver + { + + public: + + /** + * Indicates that the command has been completed. + * + * If the WLAN connection or the target device is lost, + * KErrDisconnected will be returned. + * + * @since S60 3.2 + * @param aStatusCode (TInt) status code + */ + virtual void CommandComplete( TInt aStatusCode ) = 0; + + }; + +#endif // UPNP_COMMAND_OBSERVER_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpcopycommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpcopycommand.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +/* +* 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: Upnp copy to home network command stub +* +*/ + + +#ifndef __C_GLXUPNPCOPYCOMMAND_H__ +#define __C_GLXUPNPCOPYCOMMAND_H__ + + +/*Class declaration +* The UPNP Framwork Stub +*/ + + +// CLASS DEFINITION +class CUpnpCopyCommand: public CBase + { + +public: // Construction/destruction methods + + inline static CUpnpCopyCommand* NewL() + { + CUpnpCopyCommand* self = new (ELeave) CUpnpCopyCommand(); + return self; + } + + inline ~CUpnpCopyCommand() + { + + } + + public: // Business logic methods + + inline static TBool IsAvailableL() + { + return gUpnpCopyCommandEnabled; + } + + inline void CopyFilesL( CDesCArrayFlat* /*aFiles*/ ) + { + + } + +public: + static TBool gUpnpCopyCommandEnabled; + }; + + + +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpshowcommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpshowcommand.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* 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: Upnp Show Via upnp stub +* +*/ + + + + #ifndef __C_GLXUPNPSHOWCOMMAND_H__ + #include + #endif + + #include + +#include +#include + + +TBool CUpnpShowCommand::iIsAvailableValue; + +UpnpCommand::TUpnpCommandState CUpnpShowCommand::iUpnpCommandState; + + + + + CUpnpShowCommand* CUpnpShowCommand::NewL(MUpnpCommandObserver* /*aObserver*/ ) + { + + CUpnpShowCommand* command = new(ELeave) + CUpnpShowCommand(); + // Return the instance + return command; + } + + + UpnpCommand::TUpnpCommandState CUpnpShowCommand:: State() + { + EUNIT_PRINT(_L("Before return state")); + return iUpnpCommandState; + } + + +TBool CUpnpShowCommand::IsAvailableL() + { + return iIsAvailableValue; + } + + void CUpnpShowCommand::SetUpIsAvailable(TBool aValue) + { + CUpnpShowCommand::iIsAvailableValue = aValue; + } + + void CUpnpShowCommand::ShowImageL(const TDesC& /*aFilename*/) + { + + } + + + void CUpnpShowCommand::ShowVideoL(const TDesC& /*aFilename*/) + { + + } + + + void CUpnpShowCommand::StopShowingL() + { + + } + + void CUpnpShowCommand::StartShowingL() + { + + } + + + + +void CUpnpShowCommand::SetStatus(UpnpCommand::TUpnpCommandState aCommandState) + { + EUNIT_PRINT(_L("Start Setstatus")); + iUpnpCommandState = aCommandState; + EUNIT_PRINT(_L("End Setstatus")); + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpshowcommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/Stub/upnpshowcommand.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,72 @@ +/* +* 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: Upnp ShowVia command Stub +* +*/ + + + +#ifndef __C_GLXUPNPSHOWCOMMAND_H__ +#define __C_GLXUPNPSHOWCOMMAND_H__ + +#ifndef __C_GLXUPNPCOMMAND_H__ +#include +#endif + +#include +class MUpnpCommandObserver; + +/*Class declaration +* The UPNP Framwork Stub +*/ + +class CUpnpShowCommand: public CUpnpCommand +{ +public: + + static TBool IsAvailableL(); + + static CUpnpShowCommand* NewL( MUpnpCommandObserver* aObserver ); + + UpnpCommand::TUpnpCommandState State(); + + void StartShowingL(); + + void StopShowingL(); + + void ShowImageL( const TDesC& aFilename ); + + void ShowVideoL( const TDesC& aFilename ); + + static void SetUpIsAvailable(TBool aValue); + +public: + + static TBool iIsAvailableValue; + + void SetStatus(UpnpCommand::TUpnpCommandState aCommandState); + + static UpnpCommand::TUpnpCommandState iUpnpCommandState; + +}; + + + + + + + + + +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2008-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: Build information file for command handlers. +* +*/ + + + +PRJ_TESTMMPFILES +#include "../t_cglxcommandhandlershowviaupnp/group/bld.inf" +//#include "../t_glxupnprenderer/group/bld.inf" +#include "../t_cglxupnprendererimpl/group/bld.inf" +#include "../t_cglxthumbnailsaver/group/bld.inf" +#include "../t_glxcommandhandlercopytohomenetwork/group/bld.inf" diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/bwins/t_cglxcommandhandlershowviaupnpu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/bwins/t_cglxcommandhandlershowviaupnpu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?NewL@CGlxCommandHandlerShowViaUpnp@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 2 NONAME ; class CGlxCommandHandlerShowViaUpnp * CGlxCommandHandlerShowViaUpnp::NewL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerShowViaUpnp@@UAE@XZ @ 3 NONAME ; CGlxCommandHandlerShowViaUpnp::~CGlxCommandHandlerShowViaUpnp(void) + ?StopShowingL@GlxUpnpRenderer@@SAXXZ @ 4 NONAME ; void GlxUpnpRenderer::StopShowingL(void) + ?Status@GlxUpnpRenderer@@SA?AW4TStatus@NGlxUpnpRenderer@@XZ @ 5 NONAME ; enum NGlxUpnpRenderer::TStatus GlxUpnpRenderer::Status(void) + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/eabi/t_cglxcommandhandlershowviaupnpu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/eabi/t_cglxcommandhandlershowviaupnpu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN15GlxUpnpRenderer12StopShowingLEv @ 2 NONAME + _ZN15GlxUpnpRenderer6StatusEv @ 3 NONAME + _ZN29CGlxCommandHandlerShowViaUpnp4NewLEP21MGlxMediaListProvideri @ 4 NONAME + _ZTI16CUpnpShowCommand @ 5 NONAME ; ## + _ZTV16CUpnpShowCommand @ 6 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: CommandHandlerShowViaUPnP build information +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_cglxcommandhandlershowviaupnp.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/group/t_cglxcommandhandlershowviaupnp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/group/t_cglxcommandhandlershowviaupnp.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008-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: CommandHandlerShowViaUPnP +* +*/ + + +#include + +TARGET t_cglxcommandhandlershowviaupnp.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +SOURCEPATH ../src +SOURCE t_cglxcommandhandlershowviaupnp.cpp + +// Sources required by the test suite +SOURCEPATH ../src +SOURCE t_cglxcommandhandlershowviaupnp_DllMain.cpp + +USERINCLUDE ../src + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +//Test Code +SOURCEPATH ../../../src + +SOURCE glxupnprenderer.cpp +SOURCE glxupnprendererimpl.cpp +SOURCE glxupnpthumbnailsaver.cpp +SOURCE glxcommandhandlershowviaupnp.cpp + + +USERINCLUDE ../inc + + +//UPNP Stub +SYSTEMINCLUDE ../../Stub +SOURCEPATH ../../Stub +SOURCE upnpshowcommand.cpp + + +SYSTEMINCLUDE ../../../../commandhandlerbase/inc +//SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../inc //CommandHandlers Include +SYSTEMINCLUDE ../../../../inc //ViewFramework +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../../../inc //Gallery Includes +SYSTEMINCLUDE ../../../../../medialists/inc +SYSTEMINCLUDE ../../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../../../commonui/inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY centralrepository.lib //Central repository +LIBRARY cone.lib +LIBRARY fbscli.lib //CFbsBitmap +LIBRARY bitgdi.lib //CFbsBitGc,CFbsBitmapDevice +LIBRARY imageconversion.lib //CImageEncoder +LIBRARY aknicon.lib //aknutils +LIBRARY Avkon.lib //aknutils +LIBRARY efsrv.lib //Rfs +LIBRARY bafl.lib //BaflUtils + +LIBRARY glxmedialists.lib //medialist +LIBRARY mpxcommon.lib //mpx +#ifdef FF_UPNP_FRAMEWORK_2_0 +LIBRARY upnpcommand.lib //CUpnpCommandAPI +#endif +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib // for CResourceUtilities, Filters +LIBRARY glxuiutilities.lib +LIBRARY glxlogging.lib + + +EXPORTUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/inc/t_cglxcommandhandlershowviaupnp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/inc/t_cglxcommandhandlershowviaupnp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerShowViaUPnP unit test cases +* +*/ + + + + +#ifndef __t_cglxcommandhandlershowviaupnp_H__ +#define __t_cglxcommandhandlershowviaupnp_H__ + +// EXTERNAL INCLUDES +#include +#include +#include + + +#include "glxcommandhandlershowviaupnp.h" +//#include + +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxUpnpRenderer; +class MGlxMediaList; +class _CGlxTestMediaList; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_cglxcommandhandlershowviaupnp ) + : public CEUnitTestSuiteClass ,public MGlxMediaListProvider//public MGlxMediaListOwner + { + + + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_cglxcommandhandlershowviaupnp* NewL(); + static t_cglxcommandhandlershowviaupnp* NewLC(); + /** + * Destructor + */ + ~t_cglxcommandhandlershowviaupnp(); + + private: // Constructors and destructors + + t_cglxcommandhandlershowviaupnp(); + void ConstructL(); + + public: + + MGlxMediaList& MediaList(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_CGlxCommandHandlerShowViaUpnpL(); + + void SetupL1(); + + //Test Add upnp command + + void T_AddUPnPCommandL_start(); + + void T_AddUPnPCommandL_stop(); + + void T_AddUPnPCommandL_NULL(); + + void T_AddUPnPCommandL_Invalid(); + + //Test DoIsDisabled - Home Network Not Available + + void T_DoIsDisabled_Show(); + + void T_DoIsDisabled_Stop(); + + void T_DoIsDisabled_NULL(); + + void T_DoIsDisabled_Invalid(); + + //Test DoIsDisabled - Home Network + + void T_DoIsDisabled_Show_Available(); + + void T_DoIsDisabled_Invalid_Available(); + + void T_DoIsDisabled_NULL_Available(); + + void T_DoIsDisabled_Stop_Available(); + + //Test DoExecuteL + + void T_DoExecuteL_Show(); + + void T_DoExecuteL_Stop(); + + void T_DoExecuteL_NULL(); + + void T_DoExecuteL_Invalid(); + + + private: // Data + + + EUNIT_DECLARE_TEST_TABLE; + + private: + CGlxCommandHandlerShowViaUpnp* iCommandShowUpnp; + + + _CGlxTestMediaList* iList; + + }; + +#endif // __t_cglxcommandhandlershowviaupnp_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/src/t_cglxcommandhandlershowviaupnp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/src/t_cglxcommandhandlershowviaupnp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,585 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerShowViaUPnP unit test cases +* +*/ + + + + +// CLASS HEADER +#include "t_cglxcommandhandlershowviaupnp.h" + +// EXTERNAL INCLUDES +#include +#include + +#include +#include +#include + +// INTERNAL INCLUDES +#include "glxupnprenderer.h" + +class _CGlxTestMediaList: public CBase, public MGlxMediaList + { +public: + ~_CGlxTestMediaList() + { + iItems.Close(); + iMedia.ResetAndDestroy(); + iSelectedItems.Close(); + } + + virtual void Close() + { + }; + virtual TGlxMediaListId Id() const + { + return KGlxIdNone; + } + + virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const + { + return iItems.Count(); + } + + virtual TInt FocusIndex() const + { + return iFocusIndex; + } + + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) + { + iFocusIndex = aValue; + } + + virtual const TGlxMedia& Item(TInt aIndex) const + { + return iItems[aIndex]; + } + + virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& aId) const + { + TInt count = iItems.Count(); + for (TInt i = 0; i < count; i++) + { + if (iItems[i].Id() == aId) + { + return i; + } + } + return KErrNotFound; + } + + virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) + { + } + + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) + { + } + + virtual MMPXCollection& Collection() const + { + // we know that this method is not called in our tests, this is just to make the code compile + MMPXCollection* empty = NULL; + return *empty; + } + + virtual TBool IsSelected(TInt aIndex) const + { + TInt idx = iSelectedItems.Find(aIndex); + return (idx != KErrNotFound); + } + + virtual void SetSelectedL(TInt aIndex, TBool aSelected) + { + if (aSelected) + { + iSelectedItems.InsertInOrder(aIndex); + } + else + { + iSelectedItems.Remove(iSelectedItems.Find(aIndex)); + } + } + + virtual const TArray Selection() const + { + return iSelectedItems.Array(); + } + + virtual void CommandL(CMPXCommand& /*aCommand*/) + { + } + + virtual void CancelCommand() + { + } + + virtual void SetFilterL(CMPXFilter* /*aFilter*/) + { + } + + virtual CMPXFilter* Filter() const + { + return NULL; + } + + virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const + { + return KGlxIdNone; + } + + void AppendL(TInt aId, TBool aCreateMedia) + { + if (aCreateMedia) + { + CGlxMedia* media = new (ELeave) CGlxMedia(TGlxMediaId(aId)); + CleanupStack::PushL(media); + iMedia.AppendL(media); + CleanupStack::Pop(media); + iItems.AppendL(TGlxMedia(TGlxMediaId(aId), media)); + } + else + { + iItems.AppendL(TGlxMedia(TGlxMediaId(aId))); + } + } + + CGlxMedia* MediaObj(TInt aIndex) const + { + return const_cast(static_cast(iItems[aIndex].Properties())); + } + + CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const + { + return NULL; + } + + TInt SelectionCount() const + { + return iSelectedItems.Count(); + } + + TInt SelectedItemIndex(TInt /*aSelectionIndex*/) const + { + return 0; + } + + TBool IsPopulated() const + { + return ETrue; + } + + void AddStaticItemL( CGlxMedia* /*aStaticItem*/, + NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}; + + void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}; + + void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }; + + TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }; + + void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition){}; + + void ResetFocus(){}; + + void SetVisibleWindowIndexL( TInt aIndex ){}; + TInt VisibleWindowIndex() const {}; + virtual void CancelPreviousRequests() {}; + RArray iItems; + RPointerArray iMedia; + RArray iSelectedItems; + TInt iFocusIndex; + TBool iStaticItemsEnabled; + }; +// CONSTRUCTION +t_cglxcommandhandlershowviaupnp* t_cglxcommandhandlershowviaupnp::NewL() + { + t_cglxcommandhandlershowviaupnp* self = t_cglxcommandhandlershowviaupnp::NewLC(); + CleanupStack::Pop(); + return self; + } + +t_cglxcommandhandlershowviaupnp* t_cglxcommandhandlershowviaupnp::NewLC() + { + t_cglxcommandhandlershowviaupnp* self = new( ELeave ) t_cglxcommandhandlershowviaupnp(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// Destructor (virtual by CBase) +t_cglxcommandhandlershowviaupnp::~t_cglxcommandhandlershowviaupnp() + { + } + +// Default constructor +t_cglxcommandhandlershowviaupnp::t_cglxcommandhandlershowviaupnp() + { + } + +// Second phase construct +void t_cglxcommandhandlershowviaupnp::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + + +//Create the media List + +MGlxMediaList& t_cglxcommandhandlershowviaupnp::MediaList() + { +#if 0 + EUNIT_PRINT(_L("Entering MediaList")); + CMPXCollectionPath* path = CMPXCollectionPath :: NewL(); + CleanupStack::PushL(path); + EUNIT_PRINT(_L("MediaList :: MPXCollectionPath created")); + iList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(NULL),NULL); + EUNIT_PRINT(_L("Exiting MediaList")); + CleanupStack::PopAndDestroy(path); + return *iList; +#endif + } + + + +// METHODS +//Test the NewL() without medialist +void t_cglxcommandhandlershowviaupnp::SetupL( ) + { + iCommandShowUpnp = CGlxCommandHandlerShowViaUpnp :: NewL(NULL, EFalse); + } + +// Medialist created +void t_cglxcommandhandlershowviaupnp::SetupL1( ) + { + //create the medialist + // MediaList(); + iList = new (ELeave) _CGlxTestMediaList; + EUNIT_PRINT(_L("SetupL1 :: created Medialist")); + iCommandShowUpnp = CGlxCommandHandlerShowViaUpnp :: NewL(this, EFalse); + EUNIT_PRINT(_L("Exiting SetupL1")); + } + + + +//Test DoIsDisabled + +//Command Id ShowViaUpnp +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_Show() + { + TBool result = ETrue; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(EGlxShowViaUpnp,*iList))); + } + +//Command Id StopShowing +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_Stop() + { + TBool result = ETrue; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(EGlxStopShowing,*iList))); + } + + +//Command Id Null +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_NULL() + { + TBool result = ETrue; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(NULL,*iList))); + } + +//Command Id Invalid +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_Invalid() + { + TBool result = ETrue; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(100,*iList))); + } + +//Show Command Available + +//Command Id ShowViaUpnp +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_Show_Available() + { + EUNIT_PRINT(_L("Entering T_DoIsDisabled_Show_Available")); + TBool result = ETrue; + CUpnpShowCommand::SetUpIsAvailable(ETrue); + + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(EGlxShowViaUpnp,*iList))); + } + +//Command Id StopShowing +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_Stop_Available() + { + TBool result = EFalse; + CUpnpShowCommand::SetUpIsAvailable(ETrue); + GlxUpnpRenderer::StartShowingL(); + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(EGlxStopShowing,*iList))); + GlxUpnpRenderer::StopShowingL(); + } + + +//Command Id Null +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_NULL_Available() + { + TBool result = ETrue; + CUpnpShowCommand::SetUpIsAvailable(ETrue); + + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(NULL,*iList))); + } + +//Command Id Invalid +void t_cglxcommandhandlershowviaupnp::T_DoIsDisabled_Invalid_Available() + { + TBool result = ETrue; + CUpnpShowCommand::SetUpIsAvailable(ETrue); + + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoIsDisabled(100,*iList))); + } + + + + +//Test DoExecuteL + +//Command Id start +void t_cglxcommandhandlershowviaupnp::T_DoExecuteL_Show() + { + TBool result = ETrue; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoExecuteL(EGlxShowViaUpnp,*iList))); + GlxUpnpRenderer::StopShowingL(); + } + + +//Command Id Stop +void t_cglxcommandhandlershowviaupnp::T_DoExecuteL_Stop() + { + GlxUpnpRenderer::StartShowingL(); + TBool result = ETrue; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoExecuteL(EGlxStopShowing,*iList))); + } + +//Command Id NUll - return EFalse command should not be handled +void t_cglxcommandhandlershowviaupnp::T_DoExecuteL_NULL() + { + TBool result = EFalse; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoExecuteL(NULL,*iList))); + } + +//Command Id Invalid -return EFalse command should not be handled +void t_cglxcommandhandlershowviaupnp::T_DoExecuteL_Invalid() + { + TBool result = EFalse; + EUNIT_ASSERT_EQUALS(result,(iCommandShowUpnp->DoExecuteL(100,*iList))); + } + + +//Tear down +void t_cglxcommandhandlershowviaupnp::Teardown( ) + { + EUNIT_PRINT(_L("before teardown")); + + if(iCommandShowUpnp) + { + delete iCommandShowUpnp; + } + + if(iList) + { + EUNIT_PRINT(_L("before closing list")); + delete iList; + iList = NULL; + } + EUNIT_PRINT(_L("After teardown")); + } + + +//Check the creation +void t_cglxcommandhandlershowviaupnp::T_CGlxCommandHandlerShowViaUpnpL( ) + { + EUNIT_ASSERT_DESC( iCommandShowUpnp, "Creation Failed"); + } + + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_cglxcommandhandlershowviaupnp, + "Add test suite description here.", + "UNIT" ) + + +//Set up function without Media List + +EUNIT_TEST( + "Create-nomedialist", + "CGlxCommandHandlerShowViaUpnp", + "NewL", + "UNIT", + SetupL, T_CGlxCommandHandlerShowViaUpnpL, Teardown) + + +//Set up function without Media List + +EUNIT_TEST( + "Create-medialist", + "CGlxCommandHandlerShowViaUpnp", + "NewL-medialist", + "UNIT", + SetupL1, T_CGlxCommandHandlerShowViaUpnpL, Teardown) + + +//DoIsDisable the command handler with UpnpShowCommand Not available + +EUNIT_TEST( + "Create1", + "CGlxCommandHandlerShowViaUpnp", + "Disable_show_NotAvailable", + "UNIT", + SetupL, T_DoIsDisabled_Show, Teardown) + +EUNIT_TEST( + "Create2", + "CGlxCommandHandlerShowViaUpnp", + "Disable_stop_NotAvailable", + "UNIT", + SetupL, T_DoIsDisabled_Stop, Teardown) + +EUNIT_TEST( + "Create3", + "CGlxCommandHandlerShowViaUpnp", + "Disable_Null_NotAvailable", + "UNIT", + SetupL, T_DoIsDisabled_NULL, Teardown) + + +EUNIT_TEST( + "Create4", + "CGlxCommandHandlerShowViaUpnp", + "Disable_Invalid_NotAvailable", + "UNIT", + SetupL, T_DoIsDisabled_Invalid, Teardown) + +//Disabling the command handler with UpnpShowCommand Available + +/*EUNIT_TEST( + "Create5", + "CGlxCommandHandlerShowViaUpnp", + "Disable_stop_Available", + "UNIT", + SetupL1, T_DoIsDisabled_Show_Available, Teardown)*/ + +EUNIT_TEST( + "Create6", + "CGlxCommandHandlerShowViaUpnp", + "Disable_Null_Available", + "UNIT", + SetupL1, T_DoIsDisabled_NULL_Available, Teardown) + + +EUNIT_TEST( + "Create7", + "CGlxCommandHandlerShowViaUpnp", + "Disable_Invalid_Available", + "UNIT", + SetupL1, T_DoIsDisabled_Invalid_Available, Teardown) + + +/*EUNIT_TEST( + "Create8", + "CGlxCommandHandlerShowViaUpnp", + "Disable_show_NotAvailable", + "UNIT", + SetupL1, T_DoIsDisabled_Stop_Available, Teardown) + + +//DoExecuteL with with UpnpShowCommand Not available + +EUNIT_TEST( + "Create9", + "CGlxCommandHandlerShowViaUpnp", + "Execute_Show", + "UNIT", + SetupL1, T_DoExecuteL_Show, Teardown) + +EUNIT_TEST( + "Create10", + "CGlxCommandHandlerShowViaUpnp", + "Execute_stop", + "FUNCTIONALITY", + SetupL1, T_DoExecuteL_Stop, Teardown) */ + +EUNIT_TEST( + "Create11", + "CGlxCommandHandlerShowViaUpnp", + "Execute_Null", + "UNIT", + SetupL1, T_DoExecuteL_NULL, Teardown) + +EUNIT_TEST( + "Create12", + "CGlxCommandHandlerShowViaUpnp", + "Execute_Invalid", + "UNIT", + SetupL1, T_DoExecuteL_Invalid, Teardown) + +//DoExecuteL without medialist +/*/ + +EUNIT_TEST( + "Create", + "CGlxCommandHandlerShowViaUpnp", + "Execute_stop", + "UNIT", + SetupL, T_DoExecuteL_Stop, Teardown) + +EUNIT_TEST( + "Create", + "CGlxCommandHandlerShowViaUpnp", + "Execute_Null", + "FUNCTIONALITY", + SetupL, T_DoExecuteL_NULL, Teardown) + +EUNIT_TEST( + "Create", + "CGlxCommandHandlerShowViaUpnp", + "Execute_Invalid", + "UNIT", + SetupL, T_DoExecuteL_Invalid, Teardown) + + +EUNIT_TEST( + "Create", + "CGlxCommandHandlerShowViaUpnp", + "Execute_Invalid", + "UNIT", + SetupL, T_DoExecuteL_Show, Teardown) */ + + +EUNIT_END_TEST_TABLE + +// END OF FILE + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/src/t_cglxcommandhandlershowviaupnp_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxcommandhandlershowviaupnp/src/t_cglxcommandhandlershowviaupnp_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerShowViaUPnP unit test application +* +*/ + + + + +// CLASS HEADER +#include "t_cglxcommandhandlershowviaupnp.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_cglxcommandhandlershowviaupnp::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/bwins/t_cglxthumbnailsaveru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/bwins/t_cglxthumbnailsaveru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?StopShowingL@GlxUpnpRenderer@@SAXXZ @ 2 NONAME ; void GlxUpnpRenderer::StopShowingL(void) + ?Status@GlxUpnpRenderer@@SA?AW4TStatus@NGlxUpnpRenderer@@XZ @ 3 NONAME ; enum NGlxUpnpRenderer::TStatus GlxUpnpRenderer::Status(void) + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/eabi/t_cglxthumbnailsaveru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/eabi/t_cglxthumbnailsaveru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN15GlxUpnpRenderer12StopShowingLEv @ 2 NONAME + _ZN15GlxUpnpRenderer6StatusEv @ 3 NONAME + _ZTI16CUpnpShowCommand @ 4 NONAME ; ## + _ZTV16CUpnpShowCommand @ 5 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: t_cglxthumbnailsaver build information +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_cglxthumbnailsaver.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/group/t_cglxthumbnailsaver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/group/t_cglxthumbnailsaver.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: t_cglxthumbnailsaver +* +*/ + + + +#include + +TARGET t_cglxthumbnailsaver.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +SOURCEPATH ../Src +SOURCE t_cglxthumbnailsaver.cpp + +// Sources required by the test suite +SOURCEPATH ../Src +SOURCE t_cglxthumbnailsaver_DllMain.cpp + +USERINCLUDE ../Src + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +//Test Code +SOURCEPATH ../../../src + +SOURCE glxupnprendererimpl.cpp +SOURCE glxupnpthumbnailsaver.cpp +SOURCE glxupnprenderer.cpp + +USERINCLUDE ../inc + +//UPNP Stub +SYSTEMINCLUDE ../../Stub +SOURCEPATH ../../Stub +SOURCE upnpshowcommand.cpp + + +SYSTEMINCLUDE ../../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../inc //CommandHandlers Include +SYSTEMINCLUDE ../../../../inc //ViewFramework +SYSTEMINCLUDE ../../../../../inc //Gallery Includes +SYSTEMINCLUDE ../../../../../../inc +SYSTEMINCLUDE ../../../../../medialists/inc +SYSTEMINCLUDE ../../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../../../commonui/inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY centralrepository.lib //Central repository +LIBRARY fbscli.lib //CFbsBitmap +LIBRARY bitgdi.lib //CFbsBitGc,CFbsBitmapDevice +LIBRARY gdi.lib +LIBRARY imageconversion.lib //CImageEncoder +LIBRARY aknicon.lib //aknutils +LIBRARY Avkon.lib //aknutils +LIBRARY efsrv.lib //Rfs +LIBRARY bafl.lib //BaflUtils +LIBRARY cone.lib +LIBRARY eikcore.lib + +LIBRARY glxmedialists.lib //medialist +LIBRARY mpxcommon.lib //mpx +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib // for CResourceUtilities, Filters +LIBRARY glxuiutilities.lib +LIBRARY glxlogging.lib +//EXPORTSUNFROZEN +// End of file + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/inc/t_cglxthumbnailsaver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/inc/t_cglxthumbnailsaver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Thumbnail saver for CommandHandler UPnP unit test case +* +*/ + + + + +#ifndef __T_CGLXTHUMBNAILSAVER_H__ +#define __T_CGLXTHUMBNAILSAVER_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxupnpthumbnailsaver.h" + +// FORWARD DECLARATIONS +class CGlxThumbnailSaver; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_cglxthumbnailsaver ) + : public CEUnitTestSuiteClass,public MGlxThumbnailSaveComplete + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_cglxthumbnailsaver* NewL(); + static t_cglxthumbnailsaver* NewLC(); + /** + * Destructor + */ + ~t_cglxthumbnailsaver(); + + private: // Constructors and destructors + + t_cglxthumbnailsaver(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_TestL(); + + void T_CreateVideoIconL(); + void T_CreateVideoIconL_Cancel(); + + void T_CreateDefaultVideoIconL(); + + void SetupL_FillMemory(); + + + //From MGlxThumbnailSaveComplete + + void HandleFileSaveCompleteL(const TDesC& aPath); + + + private: // Data + + + EUNIT_DECLARE_TEST_TABLE; + + CGlxThumbnailSaver* iThumbnailSaver; + + CFbsBitmap* iThumbnail; + + + }; + +#endif // __T_CGLXTHUMBNAILSAVER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/src/t_cglxthumbnailsaver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/src/t_cglxthumbnailsaver.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Thumbnail saver for CommandHandler UPnP unit test +* +*/ + + + + +// CLASS HEADER +#include "t_cglxthumbnailsaver.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES + + +// CONSTRUCTION +t_cglxthumbnailsaver* t_cglxthumbnailsaver::NewL() + { + t_cglxthumbnailsaver* self = t_cglxthumbnailsaver::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_cglxthumbnailsaver* t_cglxthumbnailsaver::NewLC() + { + t_cglxthumbnailsaver* self = new( ELeave ) t_cglxthumbnailsaver(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +t_cglxthumbnailsaver::~t_cglxthumbnailsaver() + { + } + +// Default constructor +t_cglxthumbnailsaver::t_cglxthumbnailsaver() + { + } + +// Second phase construct +void t_cglxthumbnailsaver::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void t_cglxthumbnailsaver::SetupL( ) + { + EUNIT_PRINT(_L("Entering t_cglxthumbnailsaver::SetupL")); + if(!RFbsSession::GetSession()) + { + EUNIT_PRINT(_L("t_cglxthumbnailsaver::GetSession")); + User::LeaveIfError(RFbsSession::Connect()); + EUNIT_PRINT(_L("t_cglxthumbnailsaver::FbsSession:: Connected")); + // iData->iFbsCreated = ETrue; + } + iThumbnail = NULL; + iThumbnailSaver = NULL; + iThumbnailSaver = CGlxThumbnailSaver::NewL(this); + + EUNIT_PRINT(_L("Exiting t_cglxthumbnailsaver::SetupL")); + } + + +void t_cglxthumbnailsaver::Teardown( ) + { + EUNIT_PRINT(_L("t_cglxthumbnailsaver::Teardown")); + // if (iData && iData->iFbsCreated) // just not to close session owned by ccoeenv / application + RFbsSession::Disconnect(); + + if(iThumbnail) + { + EUNIT_PRINT(_L("t_cglxthumbnailsaver::iThumbnail")); + delete iThumbnail; + } + if(iThumbnailSaver) + { + EUNIT_PRINT(_L("t_cglxthumbnailsaver::iThumbnailSaver")); + delete iThumbnailSaver; + } + EUNIT_PRINT(_L("Exiting t_cglxthumbnailsaver::Teardown")); + } + + +void t_cglxthumbnailsaver::T_TestL( ) + { + EUNIT_ASSERT_DESC( iThumbnailSaver, "ThumbnailSaver Creation Failed"); + } + +void t_cglxthumbnailsaver::T_CreateVideoIconL() + { + EUNIT_PRINT(_L("Entering t_cglxthumbnailsaver::T_CreateVideoIconL")); + iThumbnail = new (ELeave) CFbsBitmap; + EUNIT_PRINT(_L("T_CreateVideoIconL::iThumbnail instance created")); + User::LeaveIfError(iThumbnail->Create(TSize(), EColor64K)); + EUNIT_PRINT(_L("T_CreateVideoIconL::iThumbnail create Succeeded")); + + iThumbnailSaver->CreateVideoIconL(iThumbnail); + EUNIT_PRINT(_L("T_CreateVideoIconL::Aftr CreateVideoIconL")); + CActiveScheduler::Start(); + EUNIT_PRINT(_L("Exiting t_cglxthumbnailsaver::T_CreateVideoIconL")); + } +//Cancel the request +void t_cglxthumbnailsaver::T_CreateVideoIconL_Cancel( ) + { + EUNIT_PRINT(_L("Entering t_cglxthumbnailsaver::T_CreateVideoIconL_Cancel")); + iThumbnail = new (ELeave) CFbsBitmap; + EUNIT_PRINT(_L("T_CreateVideoIconL_Cancel::iThumbnail instance created")); + User::LeaveIfError(iThumbnail->Create(TSize(), EColor64K)); + EUNIT_PRINT(_L("T_CreateVideoIconL_Cancel::iThumbnail create failed")); + + iThumbnailSaver->CreateVideoIconL(iThumbnail); + + iThumbnailSaver->Cancel(); + + // We can at least test that DoCancel cancels the outstanding asynchronous + // request, and that Cancel behaves in an orderly way. + + EUNIT_ASSERT( iThumbnailSaver->iStatus == KErrCancel || iThumbnailSaver->iStatus == KErrNone ); + EUNIT_ASSERT( !iThumbnailSaver->IsActive() ); + EUNIT_PRINT(_L("Exiting t_cglxthumbnailsaver::T_CreateVideoIconL_Cancel")); + } + +void t_cglxthumbnailsaver::T_CreateDefaultVideoIconL() + { + EUNIT_PRINT(_L("Entering t_cglxthumbnailsaver::T_CreateDefaultVideoIconL")); + //iThumbnailSaver->CreateDefaultVideoIconL(); + } + +//From MGlxThumbnailSaveComplete +void t_cglxthumbnailsaver::HandleFileSaveCompleteL(const TDesC& /*aPath*/) + { + + CActiveScheduler::Stop(); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_cglxthumbnailsaver, + "Thumbnail Saver", + "UNIT" ) + +EUNIT_TEST( + "Craetion of Thumbnial", + "NewL", + "CGlxThumbnailSaver", + "UNIT", + SetupL, T_TestL, Teardown) + +/*EUNIT_TEST( + "Video", + "CreateVideoIconL", + "CGlxThumbnailSaver", + "UNIT", + SetupL, T_CreateVideoIconL, Teardown) + +EUNIT_TEST( + "Video", + "CreateVideoIconL_Cancel", + "CGlxThumbnailSaver", + "UNIT", + SetupL, T_CreateVideoIconL_Cancel, Teardown)*/ + +EUNIT_TEST( + "Video", + "CreateDefaultVideoIconL", + "CGlxThumbnailSaver", + "UNIT", + SetupL, T_CreateDefaultVideoIconL, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/src/t_cglxthumbnailsaver_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxthumbnailsaver/src/t_cglxthumbnailsaver_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Thumbnail saver for CommandHandler UPnP +* +*/ + + + + +// CLASS HEADER +#include "t_cglxthumbnailsaver.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_cglxthumbnailsaver::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/bwins/t_cglxupnprendererimplu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/bwins/t_cglxupnprendererimplu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?StopShowingL@GlxUpnpRenderer@@SAXXZ @ 2 NONAME ; void GlxUpnpRenderer::StopShowingL(void) + ?Status@GlxUpnpRenderer@@SA?AW4TStatus@NGlxUpnpRenderer@@XZ @ 3 NONAME ; enum NGlxUpnpRenderer::TStatus GlxUpnpRenderer::Status(void) + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/eabi/t_cglxupnprendererimplu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/eabi/t_cglxupnprendererimplu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN15GlxUpnpRenderer12StopShowingLEv @ 2 NONAME + _ZN15GlxUpnpRenderer6StatusEv @ 3 NONAME + _ZTI16CUpnpShowCommand @ 4 NONAME ; ## + _ZTV16CUpnpShowCommand @ 5 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: CommandHandlerUPnP build information +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_cglxupnprendererimpl.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/group/t_cglxupnprendererimpl.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/group/t_cglxupnprendererimpl.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-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: CommandHandlerUPnP MMP +* +*/ + + +#include + +TARGET t_cglxupnprendererimpl.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +SOURCEPATH ../Src +SOURCE t_cglxupnprendererimpl.cpp + +// Sources required by the test suite +SOURCEPATH ../Src +SOURCE t_cglxupnprendererimpl_DllMain.cpp + +USERINCLUDE ../Src + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +//Test Code +SOURCEPATH ../../../src + +SOURCE glxupnprenderer.cpp +SOURCE glxupnprendererimpl.cpp +SOURCE glxupnpthumbnailsaver.cpp + +USERINCLUDE ../inc + +//UPNP Stub +SYSTEMINCLUDE ../../Stub +SOURCEPATH ../../Stub +SOURCE upnpshowcommand.cpp + + +SYSTEMINCLUDE ../../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../inc //CommandHandlers Include +SYSTEMINCLUDE ../../../../inc //ViewFramework +SYSTEMINCLUDE ../../../../../inc //Gallery Includes +SYSTEMINCLUDE ../../../../../../inc +SYSTEMINCLUDE ../../../../../medialists/inc +SYSTEMINCLUDE ../../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../../../commonui/inc +//Using the media list stub for testing + +SYSTEMINCLUDE ../../../../../medialists/tsrc/inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY cone.lib +LIBRARY centralrepository.lib //Central repository +LIBRARY fbscli.lib //CFbsBitmap +LIBRARY bitgdi.lib //CFbsBitGc,CFbsBitmapDevice +LIBRARY imageconversion.lib //CImageEncoder +LIBRARY aknicon.lib //aknutils +LIBRARY Avkon.lib //aknutils +LIBRARY efsrv.lib //Rfs +LIBRARY bafl.lib //BaflUtils + +LIBRARY glxmedialists.lib //medialist +LIBRARY mpxcommon.lib //mpx +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib // for CResourceUtilities, Filters +LIBRARY glxuiutilities.lib +LIBRARY glxlogging.lib + +//EXPORTSUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/inc/t_cglxupnprendererimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/inc/t_cglxupnprendererimpl.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerUPnP RENDERER unit test case +* +*/ + + + + +#ifndef __T_CGLXUPNPRENDERERIMPL_H__ +#define __T_CGLXUPNPRENDERERIMPL_H__ + +// EXTERNAL INCLUDES +#include +#include + +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxUpnpRendererImpl; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_cglxupnprendererimpl ) + : public CEUnitTestSuiteClass , + public MGlxMediaList_Stub_Observer + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_cglxupnprendererimpl* NewL(); + static t_cglxupnprendererimpl* NewLC(); + /** + * Destructor + */ + ~t_cglxupnprendererimpl(); + + private: // Constructors and destructors + + t_cglxupnprendererimpl(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_TestL(); + + void T_TestL1(); + + void T_IsSupported_Available(); + + void T_IsSupported_NotAvailable(); + + void T_HandleAttributesAvailable(); + //From the media list stub + void MGlxMediaList_MethodCalled(MGlxMediaList_Stub_Observer::TMGlxMediaListMethodId aMethodId); + + private: // Data + + + EUNIT_DECLARE_TEST_TABLE; + + CGlxUpnpRendererImpl* iUpnpRendererImpl; + TMGlxMediaList_Stub* iMediaListStub; + + }; + +#endif // __T_CGLXUPNPRENDERERIMPL_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/src/t_cglxupnprendererimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/src/t_cglxupnprendererimpl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerUPnP RENDERER unit test case +* +*/ + + + + +// CLASS HEADER +#include "t_cglxupnprendererimpl.h" + +// EXTERNAL INCLUDES +#include +#include +#ifdef FF_UPNP_FRAMEWORK_2_0 +#include +#include +#endif + + +// INTERNAL INCLUDES +#include "glxupnprendererimpl.h" + +// CONSTRUCTION +t_cglxupnprendererimpl* t_cglxupnprendererimpl::NewL() + { + t_cglxupnprendererimpl* self = t_cglxupnprendererimpl::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_cglxupnprendererimpl* t_cglxupnprendererimpl::NewLC() + { + t_cglxupnprendererimpl* self = new( ELeave ) t_cglxupnprendererimpl(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +t_cglxupnprendererimpl::~t_cglxupnprendererimpl() + { + } + +// Default constructor +t_cglxupnprendererimpl::t_cglxupnprendererimpl() + { + } + +// Second phase construct +void t_cglxupnprendererimpl::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void t_cglxupnprendererimpl::SetupL( ) + { + iUpnpRendererImpl = CGlxUpnpRendererImpl:: NewL(); + } + + +void t_cglxupnprendererimpl::Teardown( ) + { + delete iUpnpRendererImpl; + iUpnpRendererImpl = NULL; + } + + +void t_cglxupnprendererimpl::T_TestL( ) + { + EUNIT_ASSERT_DESC( iUpnpRendererImpl, "Failed to create"); + } + +void t_cglxupnprendererimpl::T_IsSupported_Available( ) + { + #ifdef FF_UPNP_FRAMEWORK_2_0 + //Set the upnpShowcommand as available + CUpnpShowCommand::SetUpIsAvailable(ETrue); + #endif + EUNIT_ASSERT_EQUALS(ETrue,CGlxUpnpRendererImpl::IsSupported()); + } + +void t_cglxupnprendererimpl::T_IsSupported_NotAvailable( ) + { + #ifdef FF_UPNP_FRAMEWORK_2_0 + //Set the upnpShowcommand as not available + CUpnpShowCommand::SetUpIsAvailable(EFalse); + #endif + EUNIT_ASSERT_EQUALS(EFalse,CGlxUpnpRendererImpl::IsSupported()); + } + +void t_cglxupnprendererimpl::T_TestL1( ) + { + + } + +void t_cglxupnprendererimpl::T_HandleAttributesAvailable() + { + iMediaListStub = new(ELeave) TMGlxMediaList_Stub( this ); + + //iMediaListStub->AddMediaListObserverL(this); iUpnpRendererImpl + iMediaListStub->AddMediaListObserverL(iUpnpRendererImpl); + + iMediaListStub->iCount = 10; + iMediaListStub->iFocus = 1; + + iMediaListStub->NotifyAttributesAvailableL(iMediaListStub->iFocus); + } + + +void t_cglxupnprendererimpl::MGlxMediaList_MethodCalled(TMGlxMediaListMethodId /*aMethodId*/) + { + //Do Nothing + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_cglxupnprendererimpl, + "Add test suite description here.", + "UNIT" ) + +EUNIT_TEST( + "Creation of Impl", + "CGlxUpnpRendererImpl", + "NewL", + "UNIT", + SetupL, T_TestL, Teardown) + +EUNIT_TEST( + "Available", + "CGlxUpnpRendererImpl", + "IsSupported", + "UNIT", + T_IsSupported_Available, T_TestL1, T_TestL1) + +EUNIT_TEST( + "Not-Available", + "CGlxUpnpRendererImpl", + "IsSupported", + "UNIT", + T_IsSupported_NotAvailable, T_TestL1,T_TestL1) + +/*EUNIT_TEST( + "HandleAttributes Available", + "CGlxUpnpRendererImpl", + "HandleAttributesAvailable", + "UNIT", + SetupL,T_HandleAttributesAvailable , Teardown)*/ +EUNIT_END_TEST_TABLE + +// END OF FILE + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/src/t_cglxupnprendererimpl_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_cglxupnprendererimpl/src/t_cglxupnprendererimpl_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerUPnP RENDERER unit test application +* +*/ + + + + +// CLASS HEADER +#include "t_cglxupnprendererimpl.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_cglxupnprendererimpl::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/bwins/t_glxcommandhandlercopytohomenetworku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/bwins/t_glxcommandhandlercopytohomenetworku.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??1CGlxCommandHandlerCopyToHomeNetwork@@UAE@XZ @ 2 NONAME ; CGlxCommandHandlerCopyToHomeNetwork::~CGlxCommandHandlerCopyToHomeNetwork(void) + ?RetrieveL@GlxAttributeRetriever@@SAHABVMGlxFetchContext@@AAVMGlxMediaList@@H@Z @ 3 NONAME ; int GlxAttributeRetriever::RetrieveL(class MGlxFetchContext const &, class MGlxMediaList &, int) + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/eabi/t_glxcommandhandlercopytohomenetworku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/eabi/t_glxcommandhandlercopytohomenetworku.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Upnp Command Handlers. +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_glxcommandhandlercopytohomenetwork.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/group/t_glxcommandhandlercopytohomenetwork.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/group/t_glxcommandhandlercopytohomenetwork.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: Upnp Command Handlers. +* +*/ + + + +#include + + +TARGET t_glxcommandhandlercopytohomenetwork.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +SOURCEPATH ../Src +SOURCE t_glxcmdhndlrcopytohomentwk.cpp + +// Sources required by the test suite +SOURCEPATH ../Src +SOURCE t_glxcmdhndlrcopytohomenw_DllMain.cpp + +USERINCLUDE ../Src + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +//Test Code +SOURCEPATH ../../../src + +SOURCE glxcommandhandlercopytohomenetwork.cpp + + +USERINCLUDE ../inc + + +//UPNP Stub +SYSTEMINCLUDE ../../Stub + + +SYSTEMINCLUDE ../../../../commandhandlerbase/inc +//SYSTEMINCLUDE ../../../commandhandlerupnp/inc //Command Handler Upnp +SYSTEMINCLUDE ../../../inc //CommandHandlers Include +SYSTEMINCLUDE ../../../../inc //ViewFramework +SYSTEMINCLUDE ../../../../../inc //Gallery Includes +SYSTEMINCLUDE ../../../../../../inc +SYSTEMINCLUDE ../../../../../medialists/inc +SYSTEMINCLUDE ../../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../../../commonui/inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY Avkon.lib //aknutils +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY aknicon.lib //aknutils +LIBRARY bafl.lib //BaflUtils +LIBRARY bitgdi.lib //CFbsBitGc,CFbsBitmapDevice +LIBRARY centralrepository.lib //Central repository +LIBRARY cone.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib //Rfs +LIBRARY euser.lib +LIBRARY fbscli.lib //CFbsBitmap +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib // for CResourceUtilities, Filters +LIBRARY glxlogging.lib +LIBRARY glxmedialists.lib //medialist +LIBRARY imageconversion.lib //CImageEncoder +LIBRARY mpxcommon.lib //mpx +LIBRARY glxupnpcommandhandler.lib // For Upnp Command Handler + +EXPORTUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/inc/t_glxcommandhandlercopytohomenetwork.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/inc/t_glxcommandhandlercopytohomenetwork.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,84 @@ +/* +* 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: Upnp Command Handlers. +* +*/ + + + + +#ifndef __T_CGLXCOMMANDHANDLERCOPYTOHOMENETWORK +#define __T_CGLXCOMMANDHANDLERCOPYTOHOMENETWORK + +// EXTERNAL INCLUDES +#include +#include + +#include "glxcommandhandlercopytohomenetwork.h" + +#include +#include + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CGlxCommandHandlerCopyToHomeNetwork; + +// CLASS DEFINITION +NONSHARABLE_CLASS( t_cglxcommandhandlercopytohomenetwork ) + : public CEUnitTestSuiteClass ,public MGlxMediaListProvider//public MGlxMediaListOwner + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_cglxcommandhandlercopytohomenetwork* NewL(); + static t_cglxcommandhandlercopytohomenetwork* NewLC(); + /** + * Destructor + */ + ~t_cglxcommandhandlercopytohomenetwork(); + + private: // Constructors and destructors + t_cglxcommandhandlercopytohomenetwork(); + + void ConstructL(); + + public: + MGlxMediaList& MediaList(); + + private: // New methods + + void Teardown(); + + void SetupL(); + + void T_AddCopyToHomeNetworkCommandL_L(); + + void T_DoExecuteL_L(); + + void T_DoIsDisabled_L(); + + private: // Data + EUNIT_DECLARE_TEST_TABLE; + + private: + CGlxCommandHandlerCopyToHomeNetwork* iCommandHandlerCopyToHomeNetwork; + MGlxMediaList* iList; + + }; + +#endif // __T_CGLXCOMMANDHANDLERCOPYTOHOMENETWORK + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/src/t_glxcmdhndlrcopytohomentwk.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/src/t_glxcmdhndlrcopytohomentwk.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,369 @@ +/* +* 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: Upnp Command Handlers. +* +*/ + + + + +// CLASS HEADER +#include "t_glxcommandhandlercopytohomenetwork.h" + +// EXTERNAL INCLUDES +#include +#include + +#include +#include +#include + +// INTERNAL INCLUDES +#include "glxupnprenderer.h" +#include +#include + +TInt GlxAttributeRetriever::RetrieveL(const MGlxFetchContext& /*aContext*/, + MGlxMediaList& /*aList*/, TBool /*aShowDialog*/) + { + return KErrNone; + } + +TBool CUpnpCopyCommand::gUpnpCopyCommandEnabled = EFalse; + +class _CGlxTestMediaList: public CBase, public MGlxMediaList + { +public: + ~_CGlxTestMediaList() + { + iItems.Close(); + iMedia.ResetAndDestroy(); + iSelectedItems.Close(); + } + + virtual void Close() + { + }; + virtual TGlxMediaListId Id() const + { + return KGlxIdNone; + } + + virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const + { + return iItems.Count(); + } + + virtual TInt FocusIndex() const + { + return iFocusIndex; + } + + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) + { + iFocusIndex = aValue; + } + + virtual const TGlxMedia& Item(TInt aIndex) const + { + return iItems[aIndex]; + } + + virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& aId) const + { + TInt count = iItems.Count(); + for (TInt i = 0; i < count; i++) + { + if (iItems[i].Id() == aId) + { + return i; + } + } + return KErrNotFound; + } + + virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) + { + } + + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) + { + } + + virtual MMPXCollection& Collection() const + { + // we know that this method is not called in our tests, this is just to make the code compile + MMPXCollection* empty = NULL; + return *empty; + } + + virtual TBool IsSelected(TInt aIndex) const + { + TInt idx = iSelectedItems.Find(aIndex); + return (idx != KErrNotFound); + } + + virtual void SetSelectedL(TInt aIndex, TBool aSelected) + { + if (aSelected) + { + iSelectedItems.InsertInOrder(aIndex); + } + else + { + iSelectedItems.Remove(iSelectedItems.Find(aIndex)); + } + } + + virtual const TArray Selection() const + { + return iSelectedItems.Array(); + } + + virtual void CommandL(CMPXCommand& /*aCommand*/) + { + } + + virtual void CancelCommand() + { + } + + virtual void SetFilterL(CMPXFilter* /*aFilter*/) + { + } + + virtual CMPXFilter* Filter() const + { + return NULL; + } + + virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const + { + return KGlxIdNone; + } + + void AppendL(TInt aId, TBool aCreateMedia) + { + if (aCreateMedia) + { + CGlxMedia* media = new (ELeave) CGlxMedia(TGlxMediaId(aId)); + CleanupStack::PushL(media); + iMedia.AppendL(media); + CleanupStack::Pop(media); + iItems.AppendL(TGlxMedia(TGlxMediaId(aId), media)); + } + else + { + iItems.AppendL(TGlxMedia(TGlxMediaId(aId))); + } + } + + CGlxMedia* MediaObj(TInt aIndex) const + { + return const_cast(static_cast(iItems[aIndex].Properties())); + } + + CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const + { + return NULL; + } + + TInt SelectionCount() const + { + return iSelectedItems.Count(); + } + + TInt SelectedItemIndex(TInt /*aSelectionIndex*/) const + { + return 0; + } + + TBool IsPopulated() const + { + return ETrue; + } + + void AddStaticItemL( CGlxMedia* /*aStaticItem*/, + NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}; + + void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}; + + void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }; + + TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }; + + void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition){}; + + void ResetFocus(){}; + + void SetVisibleWindowIndexL( TInt aIndex ){}; + TInt VisibleWindowIndex() const {}; + void CancelPreviousRequests() {}; + RArray iItems; + RPointerArray iMedia; + RArray iSelectedItems; + TInt iFocusIndex; + TBool iStaticItemsEnabled; + }; + +// CONSTRUCTION +t_cglxcommandhandlercopytohomenetwork* t_cglxcommandhandlercopytohomenetwork::NewL() + { + t_cglxcommandhandlercopytohomenetwork* self = t_cglxcommandhandlercopytohomenetwork::NewLC(); + CleanupStack::Pop(); + return self; + } + +t_cglxcommandhandlercopytohomenetwork* t_cglxcommandhandlercopytohomenetwork::NewLC() + { + t_cglxcommandhandlercopytohomenetwork* self = new( ELeave ) t_cglxcommandhandlercopytohomenetwork(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// Destructor (virtual by CBase) +t_cglxcommandhandlercopytohomenetwork::~t_cglxcommandhandlercopytohomenetwork() + { + } + +// Default constructor +t_cglxcommandhandlercopytohomenetwork::t_cglxcommandhandlercopytohomenetwork() + { + } + +// Second phase construct +void t_cglxcommandhandlercopytohomenetwork::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + + +//Create the media List + +MGlxMediaList& t_cglxcommandhandlercopytohomenetwork::MediaList() + { + CMPXCollectionPath* path = CMPXCollectionPath :: NewL(); + CleanupStack::PushL(path); + + iList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(NULL),NULL); + CleanupStack::PopAndDestroy(path); + + return *iList; + } + +// Medialist created +void t_cglxcommandhandlercopytohomenetwork::SetupL( ) + { + iList = NULL; + iCommandHandlerCopyToHomeNetwork = NULL; + //create the medialist + // MediaList(); + // iCommandHandlerCopyToHomeNetwork = CGlxCommandHandlerCopyToHomeNetwork :: NewL(*this); + iList = new (ELeave) _CGlxTestMediaList; + iCommandHandlerCopyToHomeNetwork = new (ELeave) CGlxCommandHandlerCopyToHomeNetwork(*this); + } + +//Tear down +void t_cglxcommandhandlercopytohomenetwork::Teardown( ) + { + EUNIT_PRINT(_L("before teardown")); + + delete iCommandHandlerCopyToHomeNetwork; + + if(iList) + { + delete iList; + } + EUNIT_PRINT(_L("After teardown")); + } + + +void t_cglxcommandhandlercopytohomenetwork::T_AddCopyToHomeNetworkCommandL_L() + { +/// @bug:minor:kihoikka:release5.5: 1/02/2008: you could have a different setup if you dont always want the instance created + delete iCommandHandlerCopyToHomeNetwork; // we don't want to use the iCommandHandlerCopyToHomeNetwork instance created by SetupL because ConstructL will have been called + iCommandHandlerCopyToHomeNetwork = NULL; + iCommandHandlerCopyToHomeNetwork = new (ELeave) CGlxCommandHandlerCopyToHomeNetwork(*this); // We don't want to call ConstructL() + EUNIT_ASSERT_EQUALS_DESC(iCommandHandlerCopyToHomeNetwork->iCommandInfoArray.Count(), 0, "command info array count it not zero prior to calling AddCopyToHomeNetworkCommandL"); + iCommandHandlerCopyToHomeNetwork->AddCopyToHomeNetworkCommandL(); + EUNIT_ASSERT_EQUALS_DESC(iCommandHandlerCopyToHomeNetwork->iCommandInfoArray.Count(), 1, "command info array count it not 1 after calling AddCopyToHomeNetworkCommandL"); + CGlxMediaListCommandHandler::TCommandInfo& commandInfo = iCommandHandlerCopyToHomeNetwork->iCommandInfoArray[0]; + + EUNIT_ASSERT_EQUALS_DESC(commandInfo.iCommandId, EGlxCopyToHomeNetwork, "command id is not EGlxCopyToHomeNetwork"); + EUNIT_ASSERT_EQUALS_DESC(commandInfo.iMinSelectionLength, 1, "command min selection length is not 1"); + EUNIT_ASSERT_EQUALS_DESC(commandInfo.iDisallowDRM, ETrue, "Disalow DRM is not true"); + } + + +void t_cglxcommandhandlercopytohomenetwork::T_DoExecuteL_L() + { + EUNIT_ASSERT_EQUALS_DESC(ETrue, iCommandHandlerCopyToHomeNetwork->DoExecuteL(EGlxCopyToHomeNetwork, *iList), "EGlxCopyToHomeNetwork was not consumed"); + EUNIT_ASSERT_EQUALS_DESC(EFalse, iCommandHandlerCopyToHomeNetwork->DoExecuteL(0, *iList), "unknown command was consumed"); + } + +void t_cglxcommandhandlercopytohomenetwork::T_DoIsDisabled_L() + { + CUpnpCopyCommand::gUpnpCopyCommandEnabled = ETrue; + EUNIT_ASSERT_EQUALS_DESC(ETrue, iCommandHandlerCopyToHomeNetwork->DoIsDisabled(0, *iList), "unknown command is enabled") + EUNIT_ASSERT_EQUALS_DESC(EFalse, iCommandHandlerCopyToHomeNetwork->DoIsDisabled(EGlxCopyToHomeNetwork, *iList), "EGlxCopyToHomeNetwork command is disabled"); + CUpnpCopyCommand::gUpnpCopyCommandEnabled = EFalse; + EUNIT_ASSERT_EQUALS_DESC(ETrue, iCommandHandlerCopyToHomeNetwork->DoIsDisabled(0, *iList), "unknown command is enabled") + EUNIT_ASSERT_EQUALS_DESC(ETrue, iCommandHandlerCopyToHomeNetwork->DoIsDisabled(EGlxCopyToHomeNetwork, *iList), "EGlxCopyToHomeNetwork command is enabled"); + } + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_cglxcommandhandlercopytohomenetwork, + "Unit tests for CGlxCommandHandlerCopyToHomeNetwork", + "UNIT" ) + +EUNIT_TEST( + "AddCopyToHomeNetworkCommandL", + "CGlxCommandHandlerCopyToHomeNetwork", + "T_AddCopyToHomeNetworkCommandL_L", + "UNIT", + SetupL, T_AddCopyToHomeNetworkCommandL_L, Teardown) + + +EUNIT_TEST( + "DoExecuteL", + "CGlxCommandHandlerCopyToHomeNetwork", + "T_DoExecuteL_L", + "UNIT", + SetupL, T_DoExecuteL_L, Teardown) + +EUNIT_TEST( + "DoIsDisabled", + "CGlxCommandHandlerCopyToHomeNetwork", + "T_DoIsDisabled_L", + "UNIT", + SetupL, T_DoIsDisabled_L, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/src/t_glxcmdhndlrcopytohomenw_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxcommandhandlercopytohomenetwork/src/t_glxcmdhndlrcopytohomenw_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* 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: Upnp Command Handlers. +* +*/ + + + + + +// CLASS HEADER +#include "t_glxcommandhandlercopytohomenetwork.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_cglxcommandhandlercopytohomenetwork::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/bwins/t_glxupnprendereru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/bwins/t_glxupnprendereru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?StopShowingL@GlxUpnpRenderer@@SAXXZ @ 2 NONAME ; void GlxUpnpRenderer::StopShowingL(void) + ?Status@GlxUpnpRenderer@@SA?AW4TStatus@NGlxUpnpRenderer@@XZ @ 3 NONAME ; enum NGlxUpnpRenderer::TStatus GlxUpnpRenderer::Status(void) + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: CommandHandlerUpNP unit test cases from upnp renderer build information +* +* Description: inf file +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_glxupnprenderer.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/group/t_glxupnprenderer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/group/t_glxupnprenderer.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-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: CommandHandlerUpNP unit test cases from upnp renderer +* +*/ + + + +#include + + +TARGET t_glxupnprenderer.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +SOURCEPATH ../src +SOURCE t_glxupnprenderer.cpp + +// Sources required by the test suite +SOURCEPATH ../src +SOURCE t_glxupnprenderer_DllMain.cpp + +USERINCLUDE ../src + +//Test Code +SOURCEPATH ../../../src +//SOURCE glxcommandhandlershowviaupnp.cpp +SOURCE glxupnprenderer.cpp +SOURCE glxupnprendererimpl.cpp +SOURCE glxupnpthumbnailsaver.cpp + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +USERINCLUDE ../inc + +//UPNP Stub +SYSTEMINCLUDE ../../Stub +SOURCEPATH ../../Stub +SOURCE upnpshowcommand.cpp + + +SYSTEMINCLUDE ../../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../inc //CommandHandlers Include +SYSTEMINCLUDE ../../../../inc //ViewFramework +SYSTEMINCLUDE ../../../../../inc //Gallery Includes +SYSTEMINCLUDE ../../../../../../inc +SYSTEMINCLUDE ../../../../../medialists/inc +SYSTEMINCLUDE ../../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../../../commonui/inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY centralrepository.lib //Central repository +LIBRARY cone.lib +LIBRARY fbscli.lib //CFbsBitmap +LIBRARY bitgdi.lib //CFbsBitGc,CFbsBitmapDevice +LIBRARY imageconversion.lib //CImageEncoder +LIBRARY aknicon.lib //aknutils +LIBRARY Avkon.lib //aknutils +LIBRARY efsrv.lib //Rfs +LIBRARY bafl.lib //BaflUtils + +LIBRARY glxmedialists.lib //medialist +LIBRARY mpxcommon.lib //mpx +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib // for CResourceUtilities, Filters +LIBRARY glxuiutilities.lib +LIBRARY glxlogging.lib + +//EXPORTSUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/inc/t_glxupnprenderer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/inc/t_glxupnprenderer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerUpNP unit test cases for upnp renderer +* +*/ + + + + +#ifndef __T_GLXUPNPRENDERER_H__ +#define __T_GLXUPNPRENDERER_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS + + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_glxupnprenderer ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_glxupnprenderer* NewL(); + static t_glxupnprenderer* NewLC(); + /** + * Destructor + */ + ~t_glxupnprenderer(); + + private: // Constructors and destructors + + t_glxupnprenderer(); + void ConstructL(); + + private: // New methods + + void T_StartShowingL(); + + void T_StopShowingL(); + + + + void T_TestL(); + + void T_ShowVideoL(); + + void TearDown(); + + //Status of the rendere + + void T_Status_Active(); + + //UPnpShowCommand is Available and the impl pointer is not created + void T_Status_AvailableNotActive(); + + void T_Status_NotAvailable(); + + //UPnpShowCommand is Available and the impl pointer is created + void T_Status_Active_Renderer(); + + + private: // Data + + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_GLXUPNPRENDERER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/src/t_glxupnprenderer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/src/t_glxupnprenderer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerUpNP unit test cases for upnp renderer +* +*/ + + + + +// CLASS HEADER +#include "t_glxupnprenderer.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxupnprenderer.h" +#include + +// CONSTRUCTION +t_glxupnprenderer* t_glxupnprenderer::NewL() + { + t_glxupnprenderer* self = t_glxupnprenderer::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_glxupnprenderer* t_glxupnprenderer::NewLC() + { + t_glxupnprenderer* self = new( ELeave ) t_glxupnprenderer(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +t_glxupnprenderer::~t_glxupnprenderer() + { + } + +// Default constructor +t_glxupnprenderer::t_glxupnprenderer() + { + } + +// Second phase construct +void t_glxupnprenderer::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void t_glxupnprenderer::T_StartShowingL( ) + { + GlxUpnpRenderer::StartShowingL(); + } + + +void t_glxupnprenderer::T_StopShowingL( ) + { + GlxUpnpRenderer::StopShowingL(); + } + + +void t_glxupnprenderer::T_TestL( ) + { + + } + +void t_glxupnprenderer::T_Status_Active( ) + { + //The pointer is created so it is active + T_StartShowingL(); + EUNIT_ASSERT_EQUALS(NGlxUpnpRenderer::EActive,GlxUpnpRenderer::Status()) + T_StopShowingL(); + } + + void t_glxupnprenderer::T_Status_Active_Renderer( ) + { + //UPNPShowComamndAvailable as Available + T_StartShowingL(); + CUpnpShowCommand::SetUpIsAvailable(ETrue); + //If it is available and the pointer is created then EActive + EUNIT_ASSERT_EQUALS(NGlxUpnpRenderer::EActive,GlxUpnpRenderer::Status()) + T_StopShowingL(); + } + + + void t_glxupnprenderer::T_Status_AvailableNotActive( ) + { + //UPNPShowComamndAvailable as Available + CUpnpShowCommand::SetUpIsAvailable(ETrue); + //If it is available and the pointer is not created then EAvailableNotActive + EUNIT_ASSERT_EQUALS(NGlxUpnpRenderer::EAvailableNotActive,GlxUpnpRenderer::Status()) + } + + +void t_glxupnprenderer::T_Status_NotAvailable( ) + { + //UPNPShowComamndAvailable not available + CUpnpShowCommand::SetUpIsAvailable(EFalse); + EUNIT_ASSERT_EQUALS(NGlxUpnpRenderer::ENotAvailable,GlxUpnpRenderer::Status()) + } + + +void t_glxupnprenderer::T_ShowVideoL( ) + { + GlxUpnpRenderer::ShowVideoL(); + } + + +void t_glxupnprenderer::TearDown( ) + { + + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_glxupnprenderer, + "Testing the GlxUpnpRenderer.", + "UNIT" ) + +EUNIT_TEST( + "Creation of Impl", + "GlxUpnpRenderer", + "StartShowingL", + "UNIT", + T_StartShowingL, T_TestL, T_StopShowingL) + +EUNIT_TEST( + "Status-Active", + "GlxUpnpRenderer", + "Status", + "UNIT", + T_Status_Active, T_TestL, TearDown) + +EUNIT_TEST( + "Status-Active-Renderer", + "GlxUpnpRenderer", + "Status", + "UNIT", + T_Status_Active_Renderer, T_TestL, TearDown) + +EUNIT_TEST( + "Status-AvailableNotActive", + "GlxUpnpRenderer", + "Status", + "UNIT", + T_Status_AvailableNotActive, T_TestL, TearDown) + +EUNIT_TEST( + "Status-NotAvailable", + "GlxUpnpRenderer", + "Status", + "UNIT", + T_Status_NotAvailable, T_TestL, TearDown) + + +EUNIT_TEST( + "ShowVideo", + "GlxUpnpRenderer", + "ShowVideoL", + "UNIT", + T_ShowVideoL,T_TestL,TearDown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/src/t_glxupnprenderer_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commandhandlerupnp/tsrc/t_glxupnprenderer/src/t_glxupnprenderer_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerUpNP unit test cases for upnp renderer +* +*/ + + + + +// CLASS HEADER +#include "t_glxupnprenderer.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_glxupnprenderer::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/bwins/glxcommoncommandhandlersu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/bwins/glxcommoncommandhandlersu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,68 @@ +EXPORTS + ??1CGlxCommandHandlerFilterImagesOrVideos@@UAE@XZ @ 1 NONAME ; CGlxCommandHandlerFilterImagesOrVideos::~CGlxCommandHandlerFilterImagesOrVideos(void) + ?OfferKeyEventL@CGlxSingleGraphicPopupMenuStyleListBox@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 2 NONAME ; enum TKeyResponse CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ??0CGlxMediaListAdaptor@@QAE@PBVMGlxMediaList@@H@Z @ 3 NONAME ; CGlxMediaListAdaptor::CGlxMediaListAdaptor(class MGlxMediaList const *, int) + ?NewL@CGlxCommandHandlerRename@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 4 NONAME ; class CGlxCommandHandlerRename * CGlxCommandHandlerRename::NewL(class MGlxMediaListProvider *, int) + ?NewL@CGlxCommandHandlerSend@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 5 NONAME ; class CGlxCommandHandlerSend * CGlxCommandHandlerSend::NewL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerNewMedia@@UAE@XZ @ 6 NONAME ; CGlxCommandHandlerNewMedia::~CGlxCommandHandlerNewMedia(void) + ??1CGlxCommandHandlerSave@@UAE@XZ @ 7 NONAME ; CGlxCommandHandlerSave::~CGlxCommandHandlerSave(void) + ?NewL@CGlxCommandHandlerDelete@@SAPAV1@PAVMGlxMediaListProvider@@HH@Z @ 8 NONAME ; class CGlxCommandHandlerDelete * CGlxCommandHandlerDelete::NewL(class MGlxMediaListProvider *, int, int) + ?NewL@CGlxCommandHandlerRotate@@SAPAV1@PAVMGlxMediaListProvider@@PAVMGlxLayoutOwner@@H@Z @ 9 NONAME ; class CGlxCommandHandlerRotate * CGlxCommandHandlerRotate::NewL(class MGlxMediaListProvider *, class MGlxLayoutOwner *, int) + ?ExecuteLD@CGlxMediaSelectionPopup@@QAEPAVCMPXCollectionPath@@AAV2@AAHHHPAVCMPXMedia@@@Z @ 10 NONAME ; class CMPXCollectionPath * CGlxMediaSelectionPopup::ExecuteLD(class CMPXCollectionPath &, int &, int, int, class CMPXMedia *) + ?OkToExit@CGlxCommandHandlerNewMedia@@UBEHXZ @ 11 NONAME ; int CGlxCommandHandlerNewMedia::OkToExit(void) const + ??1CGlxCommandHandlerBack@@UAE@XZ @ 12 NONAME ; CGlxCommandHandlerBack::~CGlxCommandHandlerBack(void) + ?NewPreviousViewCommandHandlerL@CGlxCommandHandlerBack@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 13 NONAME ; class CGlxCommandHandlerBack * CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL(class MGlxMediaListProvider *) + ?NewL@CGlxCommandHandlerVideoPlayback@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 14 NONAME ; class CGlxCommandHandlerVideoPlayback * CGlxCommandHandlerVideoPlayback::NewL(class MGlxMediaListProvider *) + ??0TGlxHelpContext@@QAE@XZ @ 15 NONAME ; TGlxHelpContext::TGlxHelpContext(void) + ??1CGlxCommandHandlerSortOrder@@UAE@XZ @ 16 NONAME ; CGlxCommandHandlerSortOrder::~CGlxCommandHandlerSortOrder(void) + ??1CGlxCommandHandlerRemoveFrom@@UAE@XZ @ 17 NONAME ; CGlxCommandHandlerRemoveFrom::~CGlxCommandHandlerRemoveFrom(void) + ?ImageUri@CGlxImageViewerManager@@QAEPAVHBufC16@@XZ @ 18 NONAME ; class HBufC16 * CGlxImageViewerManager::ImageUri(void) + ?NewL@CGlxCommandHandlerOpen@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 19 NONAME ; class CGlxCommandHandlerOpen * CGlxCommandHandlerOpen::NewL(class MGlxMediaListProvider *) + ??1CGlxCommandHandlerDelete@@UAE@XZ @ 20 NONAME ; CGlxCommandHandlerDelete::~CGlxCommandHandlerDelete(void) + ??1CGlxCommandHandlerDownload@@UAE@XZ @ 21 NONAME ; CGlxCommandHandlerDownload::~CGlxCommandHandlerDownload(void) + ??1CGlxCommandHandlerOpen@@UAE@XZ @ 22 NONAME ; CGlxCommandHandlerOpen::~CGlxCommandHandlerOpen(void) + ?NewL@CGlxCommandHandlerSlideshow@@SAPAV1@PAVMGlxMediaListProvider@@HH@Z @ 23 NONAME ; class CGlxCommandHandlerSlideshow * CGlxCommandHandlerSlideshow::NewL(class MGlxMediaListProvider *, int, int) + ?IsPrivate@CGlxImageViewerManager@@QAEHXZ @ 24 NONAME ; int CGlxImageViewerManager::IsPrivate(void) + ?NewL@CGlxCommandHandlerAiwShareOnOvi@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 25 NONAME ; class CGlxCommandHandlerAiwShareOnOvi * CGlxCommandHandlerAiwShareOnOvi::NewL(class MGlxMediaListProvider *, int) + ?NewAddToAlbumCommandHandlerL@CGlxCommandHandlerAddToContainer@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 26 NONAME ; class CGlxCommandHandlerAddToContainer * CGlxCommandHandlerAddToContainer::NewAddToAlbumCommandHandlerL(class MGlxMediaListProvider *, int) + ?MdcaPoint@CGlxMediaListAdaptor@@UBE?AVTPtrC16@@H@Z @ 27 NONAME ; class TPtrC16 CGlxMediaListAdaptor::MdcaPoint(int) const + ?NewL@CGlxCommandHandlerDownload@@SAPAV1@XZ @ 28 NONAME ; class CGlxCommandHandlerDownload * CGlxCommandHandlerDownload::NewL(void) + ??1CGlxCommandHandlerHelp@@UAE@XZ @ 29 NONAME ; CGlxCommandHandlerHelp::~CGlxCommandHandlerHelp(void) + ?BypassFiltersForExecute@CGlxCommandHandlerNewMedia@@UBEHXZ @ 30 NONAME ; int CGlxCommandHandlerNewMedia::BypassFiltersForExecute(void) const + ?NewL@CGlxCommandHandlerDetails@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 31 NONAME ; class CGlxCommandHandlerDetails * CGlxCommandHandlerDetails::NewL(class MGlxMediaListProvider *) + ?NewL@CGlxCommandHandlerAiwEdit@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 32 NONAME ; class CGlxCommandHandlerAiwEdit * CGlxCommandHandlerAiwEdit::NewL(class MGlxMediaListProvider *, int) + ?NewL@CGlxCommandHandlerHelp@@SAPAV1@VTGlxHelpContext@@@Z @ 33 NONAME ; class CGlxCommandHandlerHelp * CGlxCommandHandlerHelp::NewL(class TGlxHelpContext) + ?ExecuteLD@CGlxCommandHandlerNewMedia@@QAEHAAVTGlxMediaId@@@Z @ 34 NONAME ; int CGlxCommandHandlerNewMedia::ExecuteLD(class TGlxMediaId &) + ?HandleItemAddedL@CGlxCommandHandlerNewMedia@@MAEXHHPAVMGlxMediaList@@@Z @ 35 NONAME ; void CGlxCommandHandlerNewMedia::HandleItemAddedL(int, int, class MGlxMediaList *) + ?IncrementRefCount@CGlxImageViewerManager@@QAEXXZ @ 36 NONAME ; void CGlxImageViewerManager::IncrementRefCount(void) + ?NewRemFromFavCommandHandlerL@CGlxCommandHandlerRemoveFrom@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 37 NONAME ; class CGlxCommandHandlerRemoveFrom * CGlxCommandHandlerRemoveFrom::NewRemFromFavCommandHandlerL(class MGlxMediaListProvider *) + ?NewL@CGlxCommandHandlerUpload@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 38 NONAME ; class CGlxCommandHandlerUpload * CGlxCommandHandlerUpload::NewL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerUpload@@UAE@XZ @ 39 NONAME ; CGlxCommandHandlerUpload::~CGlxCommandHandlerUpload(void) + ??1CGlxCommandHandlerSlideshow@@UAE@XZ @ 40 NONAME ; CGlxCommandHandlerSlideshow::~CGlxCommandHandlerSlideshow(void) + ?NewL@CGlxCommandHandlerAiwShowMap@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 41 NONAME ; class CGlxCommandHandlerAiwShowMap * CGlxCommandHandlerAiwShowMap::NewL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerAddToContainer@@UAE@XZ @ 42 NONAME ; CGlxCommandHandlerAddToContainer::~CGlxCommandHandlerAddToContainer(void) + ??0CGlxMediaSelectionPopup@@QAE@XZ @ 43 NONAME ; CGlxMediaSelectionPopup::CGlxMediaSelectionPopup(void) + ?NewL@CGlxCommandHandlerNewMedia@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 44 NONAME ; class CGlxCommandHandlerNewMedia * CGlxCommandHandlerNewMedia::NewL(class MGlxMediaListProvider *) + ?NewL@CGlxCommandHandlerRemoveFrom@@SAPAV1@PAVMGlxMediaListProvider@@W4TMPXGeneralCategory@@H@Z @ 45 NONAME ; class CGlxCommandHandlerRemoveFrom * CGlxCommandHandlerRemoveFrom::NewL(class MGlxMediaListProvider *, enum TMPXGeneralCategory, int) + ?NewL@CGlxCommandHandlerCopyAndMove@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 46 NONAME ; class CGlxCommandHandlerCopyAndMove * CGlxCommandHandlerCopyAndMove::NewL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerCopyAndMove@@UAE@XZ @ 47 NONAME ; CGlxCommandHandlerCopyAndMove::~CGlxCommandHandlerCopyAndMove(void) + ?SetContainerId@CGlxCommandHandlerRemoveFrom@@QAEXVTGlxMediaId@@@Z @ 48 NONAME ; void CGlxCommandHandlerRemoveFrom::SetContainerId(class TGlxMediaId) + ?MdcaCount@CGlxMediaListAdaptor@@UBEHXZ @ 49 NONAME ; int CGlxMediaListAdaptor::MdcaCount(void) const + ?NewL@CGlxCommandHandlerFilterImagesOrVideos@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 50 NONAME ; class CGlxCommandHandlerFilterImagesOrVideos * CGlxCommandHandlerFilterImagesOrVideos::NewL(class MGlxMediaListProvider *) + ?NewL@CGlxCommandHandlerAiwShowMapHardKey@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 51 NONAME ; class CGlxCommandHandlerAiwShowMapHardKey * CGlxCommandHandlerAiwShowMapHardKey::NewL(class MGlxMediaListProvider *, int) + ?NewL@CGlxCommandHandlerHideUi@@SAPAV1@XZ @ 52 NONAME ; class CGlxCommandHandlerHideUi * CGlxCommandHandlerHideUi::NewL(void) + ??1CGlxCommandHandlerSend@@UAE@XZ @ 53 NONAME ; CGlxCommandHandlerSend::~CGlxCommandHandlerSend(void) + ?NewL@CGlxCommandHandlerAiwAssign@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 54 NONAME ; class CGlxCommandHandlerAiwAssign * CGlxCommandHandlerAiwAssign::NewL(class MGlxMediaListProvider *, int) + ?NewAddToTagCommandHandlerL@CGlxCommandHandlerAddToContainer@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 55 NONAME ; class CGlxCommandHandlerAddToContainer * CGlxCommandHandlerAddToContainer::NewAddToTagCommandHandlerL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerDetails@@UAE@XZ @ 56 NONAME ; CGlxCommandHandlerDetails::~CGlxCommandHandlerDetails(void) + ?NewL@CGlxCommandHandlerSave@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 57 NONAME ; class CGlxCommandHandlerSave * CGlxCommandHandlerSave::NewL(class MGlxMediaListProvider *, int) + ??1CGlxCommandHandlerVideoPlayback@@UAE@XZ @ 58 NONAME ; CGlxCommandHandlerVideoPlayback::~CGlxCommandHandlerVideoPlayback(void) + ??1CGlxCommandHandlerRename@@UAE@XZ @ 59 NONAME ; CGlxCommandHandlerRename::~CGlxCommandHandlerRename(void) + ?NewL@CGlxCommandHandlerAddToContainer@@SAPAV1@PAVMGlxMediaListProvider@@HH@Z @ 60 NONAME ; class CGlxCommandHandlerAddToContainer * CGlxCommandHandlerAddToContainer::NewL(class MGlxMediaListProvider *, int, int) + ?ImageFileHandle@CGlxImageViewerManager@@QBEAAVRFile64@@XZ @ 61 NONAME ; class RFile64 & CGlxImageViewerManager::ImageFileHandle(void) const + ?NewL@CGlxCommandHandlerAiwPrintPreview@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 62 NONAME ; class CGlxCommandHandlerAiwPrintPreview * CGlxCommandHandlerAiwPrintPreview::NewL(class MGlxMediaListProvider *, int) + ?NewL@CGlxCommandHandlerSortOrder@@SAPAV1@PAVMGlxMediaListProvider@@K@Z @ 63 NONAME ; class CGlxCommandHandlerSortOrder * CGlxCommandHandlerSortOrder::NewL(class MGlxMediaListProvider *, unsigned long) + ?NewBackCommandHandlerL@CGlxCommandHandlerBack@@SAPAV1@XZ @ 64 NONAME ; class CGlxCommandHandlerBack * CGlxCommandHandlerBack::NewBackCommandHandlerL(void) + ?NewAddToFavCommandHandlerL@CGlxCommandHandlerAddToContainer@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 65 NONAME ; class CGlxCommandHandlerAddToContainer * CGlxCommandHandlerAddToContainer::NewAddToFavCommandHandlerL(class MGlxMediaListProvider *, int) + ?NewContainerPreviousViewCommandHandlerL@CGlxCommandHandlerBack@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 66 NONAME ; class CGlxCommandHandlerBack * CGlxCommandHandlerBack::NewContainerPreviousViewCommandHandlerL(class MGlxMediaListProvider *, int) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/data/glxcommoncommandhandlers.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/data/glxcommoncommandhandlers.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008-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: Resource definitions +* +*/ + + + + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include "glxutilities.hrh" +#include + +NAME GLXD // 4 letter ID + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="GLXD"; } + +#define glx_icon_file "Z:"APP_BITMAP_DIR"\\glxicons.mif" + +// ----------------------------------------------------------------------------- +// +// r_glx_album_selection_icons +// Icons for album popup +// +// ----------------------------------------------------------------------------- +RESOURCE AKN_ICON_ARRAY r_glx_album_selection_icons + { + type = EAknIconArraySimple; + bmpfile = glx_icon_file; + icons = + { + AKN_ICON + { + iconId = EMbmGlxiconsQgn_prop_album_photo_small; + maskId = EMbmGlxiconsQgn_prop_album_photo_small_mask; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_softkeys_ok_cancel_select +// softkeys for media selection popup +// +// ----------------------------------------------------------------------------- +RESOURCE CBA r_glx_softkeys_ok_cancel +{ + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOk; txt=text_softkey_ok;}, + CBA_BUTTON {id=EAknSoftkeyCancel; txt= text_softkey_cancel;}, + CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty;} + }; +} + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/eabi/glxcommoncommandhandlersu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/eabi/glxcommoncommandhandlersu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,108 @@ +EXPORTS + _ZN15TGlxHelpContextC1Ev @ 1 NONAME + _ZN15TGlxHelpContextC2Ev @ 2 NONAME + _ZN20CGlxMediaListAdaptorC1EPK13MGlxMediaListi @ 3 NONAME + _ZN20CGlxMediaListAdaptorC2EPK13MGlxMediaListi @ 4 NONAME + _ZN22CGlxCommandHandlerBack22NewBackCommandHandlerLEv @ 5 NONAME + _ZN22CGlxCommandHandlerBack30NewPreviousViewCommandHandlerLEP21MGlxMediaListProvider @ 6 NONAME + _ZN22CGlxCommandHandlerBack39NewContainerPreviousViewCommandHandlerLEP21MGlxMediaListProvideri @ 7 NONAME + _ZN22CGlxCommandHandlerBackD0Ev @ 8 NONAME + _ZN22CGlxCommandHandlerBackD1Ev @ 9 NONAME + _ZN22CGlxCommandHandlerBackD2Ev @ 10 NONAME + _ZN22CGlxCommandHandlerHelp4NewLE15TGlxHelpContext @ 11 NONAME + _ZN22CGlxCommandHandlerHelpD0Ev @ 12 NONAME + _ZN22CGlxCommandHandlerHelpD1Ev @ 13 NONAME + _ZN22CGlxCommandHandlerHelpD2Ev @ 14 NONAME + _ZN22CGlxCommandHandlerOpen4NewLEP21MGlxMediaListProvider @ 15 NONAME + _ZN22CGlxCommandHandlerOpenD0Ev @ 16 NONAME + _ZN22CGlxCommandHandlerOpenD1Ev @ 17 NONAME + _ZN22CGlxCommandHandlerOpenD2Ev @ 18 NONAME + _ZN22CGlxCommandHandlerSave4NewLEP21MGlxMediaListProvideri @ 19 NONAME + _ZN22CGlxCommandHandlerSaveD0Ev @ 20 NONAME + _ZN22CGlxCommandHandlerSaveD1Ev @ 21 NONAME + _ZN22CGlxCommandHandlerSaveD2Ev @ 22 NONAME + _ZN22CGlxCommandHandlerSend4NewLEP21MGlxMediaListProvideri @ 23 NONAME + _ZN22CGlxCommandHandlerSendD0Ev @ 24 NONAME + _ZN22CGlxCommandHandlerSendD1Ev @ 25 NONAME + _ZN22CGlxCommandHandlerSendD2Ev @ 26 NONAME + _ZN22CGlxImageViewerManager8ImageUriEv @ 27 NONAME + _ZN22CGlxImageViewerManager9IsPrivateEv @ 28 NONAME + _ZN23CGlxMediaSelectionPopup9ExecuteLDER18CMPXCollectionPathRiiiP9CMPXMedia @ 29 NONAME + _ZN23CGlxMediaSelectionPopupC1Ev @ 30 NONAME + _ZN23CGlxMediaSelectionPopupC2Ev @ 31 NONAME + _ZN24CGlxCommandHandlerDelete4NewLEP21MGlxMediaListProviderii @ 32 NONAME + _ZN24CGlxCommandHandlerDeleteD0Ev @ 33 NONAME + _ZN24CGlxCommandHandlerDeleteD1Ev @ 34 NONAME + _ZN24CGlxCommandHandlerDeleteD2Ev @ 35 NONAME + _ZN24CGlxCommandHandlerHideUi4NewLEv @ 36 NONAME + _ZN24CGlxCommandHandlerRename4NewLEP21MGlxMediaListProvideri @ 37 NONAME + _ZN24CGlxCommandHandlerRenameD0Ev @ 38 NONAME + _ZN24CGlxCommandHandlerRenameD1Ev @ 39 NONAME + _ZN24CGlxCommandHandlerRenameD2Ev @ 40 NONAME + _ZN24CGlxCommandHandlerRotate4NewLEP21MGlxMediaListProviderP15MGlxLayoutOwneri @ 41 NONAME + _ZN24CGlxCommandHandlerUpload4NewLEP21MGlxMediaListProvideri @ 42 NONAME + _ZN24CGlxCommandHandlerUploadD0Ev @ 43 NONAME + _ZN24CGlxCommandHandlerUploadD1Ev @ 44 NONAME + _ZN24CGlxCommandHandlerUploadD2Ev @ 45 NONAME + _ZN25CGlxCommandHandlerAiwEdit4NewLEP21MGlxMediaListProvideri @ 46 NONAME + _ZN25CGlxCommandHandlerDetails4NewLEP21MGlxMediaListProvider @ 47 NONAME + _ZN25CGlxCommandHandlerDetailsD0Ev @ 48 NONAME + _ZN25CGlxCommandHandlerDetailsD1Ev @ 49 NONAME + _ZN25CGlxCommandHandlerDetailsD2Ev @ 50 NONAME + _ZN26CGlxCommandHandlerDownload4NewLEv @ 51 NONAME + _ZN26CGlxCommandHandlerDownloadD0Ev @ 52 NONAME + _ZN26CGlxCommandHandlerDownloadD1Ev @ 53 NONAME + _ZN26CGlxCommandHandlerDownloadD2Ev @ 54 NONAME + _ZN26CGlxCommandHandlerNewMedia16HandleItemAddedLEiiP13MGlxMediaList @ 55 NONAME + _ZN26CGlxCommandHandlerNewMedia4NewLEP21MGlxMediaListProvider @ 56 NONAME + _ZN26CGlxCommandHandlerNewMedia9ExecuteLDER11TGlxMediaId @ 57 NONAME + _ZN26CGlxCommandHandlerNewMediaD0Ev @ 58 NONAME + _ZN26CGlxCommandHandlerNewMediaD1Ev @ 59 NONAME + _ZN26CGlxCommandHandlerNewMediaD2Ev @ 60 NONAME + _ZN27CGlxCommandHandlerAiwAssign4NewLEP21MGlxMediaListProvideri @ 61 NONAME + _ZN27CGlxCommandHandlerSlideshow4NewLEP21MGlxMediaListProviderii @ 62 NONAME + _ZN27CGlxCommandHandlerSlideshowD0Ev @ 63 NONAME + _ZN27CGlxCommandHandlerSlideshowD1Ev @ 64 NONAME + _ZN27CGlxCommandHandlerSlideshowD2Ev @ 65 NONAME + _ZN27CGlxCommandHandlerSortOrder4NewLEP21MGlxMediaListProviderm @ 66 NONAME + _ZN27CGlxCommandHandlerSortOrderD0Ev @ 67 NONAME + _ZN27CGlxCommandHandlerSortOrderD1Ev @ 68 NONAME + _ZN27CGlxCommandHandlerSortOrderD2Ev @ 69 NONAME + _ZN28CGlxCommandHandlerAiwShowMap4NewLEP21MGlxMediaListProvideri @ 70 NONAME + _ZN28CGlxCommandHandlerRemoveFrom14SetContainerIdE11TGlxMediaId @ 71 NONAME + _ZN28CGlxCommandHandlerRemoveFrom28NewRemFromFavCommandHandlerLEP21MGlxMediaListProvider @ 72 NONAME + _ZN28CGlxCommandHandlerRemoveFrom4NewLEP21MGlxMediaListProvider19TMPXGeneralCategoryi @ 73 NONAME + _ZN28CGlxCommandHandlerRemoveFromD0Ev @ 74 NONAME + _ZN28CGlxCommandHandlerRemoveFromD1Ev @ 75 NONAME + _ZN28CGlxCommandHandlerRemoveFromD2Ev @ 76 NONAME + _ZN29CGlxCommandHandlerCopyAndMove4NewLEP21MGlxMediaListProvideri @ 77 NONAME + _ZN29CGlxCommandHandlerCopyAndMoveD0Ev @ 78 NONAME + _ZN29CGlxCommandHandlerCopyAndMoveD1Ev @ 79 NONAME + _ZN29CGlxCommandHandlerCopyAndMoveD2Ev @ 80 NONAME + _ZN31CGlxCommandHandlerAiwShareOnOvi4NewLEP21MGlxMediaListProvideri @ 81 NONAME + _ZN31CGlxCommandHandlerVideoPlayback4NewLEP21MGlxMediaListProvider @ 82 NONAME + _ZN31CGlxCommandHandlerVideoPlaybackD0Ev @ 83 NONAME + _ZN31CGlxCommandHandlerVideoPlaybackD1Ev @ 84 NONAME + _ZN31CGlxCommandHandlerVideoPlaybackD2Ev @ 85 NONAME + _ZN32CGlxCommandHandlerAddToContainer26NewAddToFavCommandHandlerLEP21MGlxMediaListProvideri @ 86 NONAME + _ZN32CGlxCommandHandlerAddToContainer26NewAddToTagCommandHandlerLEP21MGlxMediaListProvideri @ 87 NONAME + _ZN32CGlxCommandHandlerAddToContainer28NewAddToAlbumCommandHandlerLEP21MGlxMediaListProvideri @ 88 NONAME + _ZN32CGlxCommandHandlerAddToContainer4NewLEP21MGlxMediaListProviderii @ 89 NONAME + _ZN32CGlxCommandHandlerAddToContainerD0Ev @ 90 NONAME + _ZN32CGlxCommandHandlerAddToContainerD1Ev @ 91 NONAME + _ZN32CGlxCommandHandlerAddToContainerD2Ev @ 92 NONAME + _ZN33CGlxCommandHandlerAiwPrintPreview4NewLEP21MGlxMediaListProvideri @ 93 NONAME + _ZN35CGlxCommandHandlerAiwShowMapHardKey4NewLEP21MGlxMediaListProvideri @ 94 NONAME + _ZN38CGlxCommandHandlerFilterImagesOrVideos4NewLEP21MGlxMediaListProvider @ 95 NONAME + _ZN38CGlxCommandHandlerFilterImagesOrVideosD0Ev @ 96 NONAME + _ZN38CGlxCommandHandlerFilterImagesOrVideosD1Ev @ 97 NONAME + _ZN38CGlxCommandHandlerFilterImagesOrVideosD2Ev @ 98 NONAME + _ZN38CGlxSingleGraphicPopupMenuStyleListBox14OfferKeyEventLERK9TKeyEvent10TEventCode @ 99 NONAME + _ZNK20CGlxMediaListAdaptor9MdcaCountEv @ 100 NONAME + _ZNK20CGlxMediaListAdaptor9MdcaPointEi @ 101 NONAME + _ZNK26CGlxCommandHandlerNewMedia23BypassFiltersForExecuteEv @ 102 NONAME + _ZNK26CGlxCommandHandlerNewMedia8OkToExitEv @ 103 NONAME + _ZThn48_N26CGlxCommandHandlerNewMedia16HandleItemAddedLEiiP13MGlxMediaList @ 104 NONAME + _ZThn4_NK20CGlxMediaListAdaptor9MdcaCountEv @ 105 NONAME + _ZThn4_NK20CGlxMediaListAdaptor9MdcaPointEi @ 106 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: Common command handlers +* +*/ + + + +#include +#include + +PRJ_EXPORTS +../rom/glxcommoncommandhandlers.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxcommoncommandhandlers.iby) +../rom/glxcommoncommandhandlers_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(glxcommoncommandhandlers_resources.iby) + +PRJ_MMPFILES +glxcommoncommandhandlers.mmp + +PRJ_TESTMMPFILES +//../tsrc/ut_cglxcommandhandlersortorder/ut_cglxcommandhandlersortorder.mmp +//../tsrc/t_glxcommandhandlerback/t_cglxcommandhandlerback.mmp + +// only include the test if the feature is enabled +#ifdef GLX_TILE_VIEW_IMAGES_OR_VIDEOS_ONLY_FILTERING +//../tsrc/t_glxcommandhandlerfilterimagesorvideos/t_cglxcommandhandlerfilterimagesorvideos.mmp +#endif \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/group/glxcommoncommandhandlers.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/group/glxcommoncommandhandlers.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2008-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: Common command handlers +* +*/ + + + + +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxcommoncommandhandlers.dll +TARGETTYPE dll +UID 0x1000008d 0x2000719F + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../data +START RESOURCE glxcommoncommandhandlers.rss +HEADER +TARGETPATH /resource/apps +LANGUAGE_IDS +END // RESOURCE + +SOURCEPATH ../src +SOURCE glxcommandhandleraddtocontainer.cpp +SOURCE glxcommandhandleraiwassign.cpp +SOURCE glxcommandhandleraiwbase.cpp +SOURCE glxcommandhandleraiwedit.cpp +SOURCE glxcommandhandleraiwprintpreview.cpp +SOURCE glxcommandhandleraiwshowmap.cpp +SOURCE glxcommandhandleraiwshareonovi.cpp +SOURCE glxcommandhandlerback.cpp +SOURCE glxcommandhandlercopyandmove.cpp +SOURCE glxcommandhandlerdelete.cpp +SOURCE glxcommandhandlersave.cpp +SOURCE glxcommandhandlerdownload.cpp +SOURCE glxcommandhandlerhelp.cpp +SOURCE glxcommandhandlerhideui.cpp +SOURCE glxcommandhandlernewmedia.cpp +SOURCE glxcommandhandlerdetails.cpp +SOURCE glxcommandhandlerremovefrom.cpp +SOURCE glxcommandhandlerrename.cpp +SOURCE glxcommandhandlerrotate.cpp +SOURCE glxcommandhandlersend.cpp +SOURCE glxcommandhandlerslideshow.cpp +SOURCE glxcommandhandlersortorder.cpp +SOURCE glxcommandhandlerupload.cpp +SOURCE glxcommandhandlervideoplayback.cpp +SOURCE glxmediaselectionpopup.cpp +SOURCE glxaiwservicehandler.cpp +SOURCE glxaiwmedia.cpp +SOURCE glxcommandhandlerfilterimagesorvideos.cpp +SOURCE glxcommandhandleropen.cpp +SOURCE glxcommandhandleraiwshowonmaphardkey.cpp + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../gallery/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../layouts/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc +SYSTEMINCLUDE ../../commandhandlerbase/inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../commandhandlerupnp/inc +SYSTEMINCLUDE ../../../../slideshow/view/inc +SYSTEMINCLUDE ../../../../slideshow/settingsdialog/inc +SYSTEMINCLUDE ../../../views/metadatadialog/inc //for Details dialog +SYSTEMINCLUDE ../../../texturemanager/inc + +APP_LAYER_SYSTEMINCLUDE + + + +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY browserlauncher.lib +LIBRARY centralrepository.lib //for CRepository +LIBRARY charconv.lib // for CnvUtfConverter::ConvertFromUnicodeToUtf8L +LIBRARY commondialogs.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY estor.lib // for RBufWriteStream +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxupnpcommandhandler.lib // for CGlxUpnpRenderer +LIBRARY glxcommon.lib // for CResourceUtilities +LIBRARY glxlayouts.lib +LIBRARY glxcommonui.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY hitchcock.lib // HUI framework +LIBRARY hlplch.lib // Help Launcher +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib // for MPXViewUtility +LIBRARY sendui.lib // for CSendUi +LIBRARY servicehandler.lib +LIBRARY eposlandmarks.lib // for show on map +LIBRARY eposlmsearchlib.lib // for show on map +LIBRARY lbs.lib // for show on map +LIBRARY glxmetadatadialog.lib +LIBRARY flogger.lib // For Logging Tracer +LIBRARY apmime.lib +LIBRARY commonui.lib // CDocumentHandler +LIBRARY alfclient.lib // MAlfWidgetFactory +LIBRARY alfwidgetmodel.lib +LIBRARY exiflib.lib +LIBRARY glxtexturemanager.lib +LIBRARY glximageviewermanager.lib +LIBRARY mpxplaybackutility.lib // MPX playback utility +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxaiwmedia.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxaiwmedia.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: Photos AIW Media Contains AIW (InParam) information +* +*/ + + + + +#ifndef _GLXAIWMEDIA_H +#define _GLXAIWMEDIA_H + +/** + * CGlxAiwMedia + * Class to store AIW parameters for a given TGlxMediaId + * + * @author Rowland Cook + */ + +#include +#include "glxmediaid.h" + + +/** + * Forward references + */ + +class TAiwGenericParam; +class TGlxMediaId; + +/** + * CGlxAiwMedia class + * This class contains an array AIW parameters for a given media item. + */ +NONSHARABLE_CLASS(CGlxAiwMedia) : public CBase + { +public: + /** + * Constructor + * @param TGlxMediaId of the Media Item + */ + CGlxAiwMedia(const TGlxMediaId& aId); + + /** + * Destructor + */ + virtual ~CGlxAiwMedia(); + + /** + * AddParamL + * @param TAiwGenericParam& The AIW parameter that needs to be added to the + * array. This is only added if the paramter does not already exist. + * @return ETrue if added, EFalse if already exists + */ + TBool AddParamL(const TAiwGenericParam& aParam); + + /** + * Id + * @return a reference to the TGlxMediaId of the item + */ + const TGlxMediaId& Id() const; + + /** + * Appends all the parameters in the iParamArray to aInParams. + * @param aInParams reference to the InParams that is added too. + */ + void AppendToInParamsL(CAiwGenericParamList& aInParams); + +private: + + // The TGlxMediaId of the item associated with this class. + TGlxMediaId iId; + + // The array of TAiwGenericParam that is associated with the TGlxMediaId (iId). + RArray iParamArray; + }; + +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxaiwservicehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxaiwservicehandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2008-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: Photos AIW Service handler Proxy class for the CAiwServiceHandler +* +*/ + + + + +#ifndef _GLXAIWSERVICEHANDLER_H +#define _GLXAIWSERVICEHANDLER_H + +/** + * CGlxAiwServiceHandler + * Proxy class for the CAiwServiceHandler + * + * @author Rowland Cook + * @internal reviewed Aki Vanhatalo 20/08/2007 + */ + +#include +#include + +class TAiwGenericParam; +class CAiwServiceHandler; +class CAiwGenericParamList; +class MAiwNotifyCallback; +class CGlxAiwMedia; +class TGlxMediaId; +class t_CGlxAiwServiceHandler; + +/** + * CGlxAiwServiceHandler class + * This class is a proxy for the CAiwServiceHandler. + * It is Singleton. + */ +NONSHARABLE_CLASS(CGlxAiwServiceHandler) : public CBase + { + friend class t_CGlxAiwServiceHandler; +public: + /** + * Obtain the instance of the Singleton + */ + static CGlxAiwServiceHandler* InstanceL(); + + /** + * Close + */ + void Close(); + + /** + * Destructor + */ + ~CGlxAiwServiceHandler(); + + /** + * Adds a TAiwGenericParam to the InParams + * @param aParam The parameter to append to this list. This object takes + * an own copy of the data in aParam. + */ + void AddParamL(const TGlxMediaId& aId, const TAiwGenericParam& aParam ); + + /** + * Initialises the Meu Pane + * @param aMenuPane Handle of the menu pane to initialise. + * @param aMenuResourceId The menu to be attached. + * @param aBaseMenuCmdId Base ID for the Service Handler to generate + * menu IDs for placeholders. + * @leave KErrNotSupported CCoeEnv is not accessible. + * @leave KErrOverflow Consumer application has too many AIW placeholders in its menu. + * Currently, maximum 16 is supported. + * + */ + void InitializeMenuPaneL(CEikMenuPane& aMenuPane, TInt aResourceId, TInt aBaseMenuCmdId); + + /** + * Attach menu related criteria items to the given menu. + * If a provider leaves during initialization, it is trapped by the Service Handler. + * + * @param aMenuResourceId Menu to be attached. + * @param aInterestResourceId Resource id for the interest list. + * @leave KErrNotSupported CCoeEnv is not accessible. + */ + void AttachMenuL(TInt aMenuResource, TInt aAiwInterestResource); + + /** + * Identifies is a menu command Id belongs to an Aiw Menu + * @param aCommand The command to handle + * @param aAiwCommandId The AIW command. + * @return ETrue if they are the same, otherwise EFalse. + */ + TBool IsSameCommand(TInt aCommandId, TInt aAiwCommandId); + + /** + * Executes a menu command. + * Not supported if calling outside UI framework. + * + * @param aMenuCmdId The menu command to be executed. + * @param aCmdOptions Options for the command, see TAiwServiceCmdOptions in AiwCommon.hrh. + * @param aCallback Callback for asynchronous command handling, parameter checking, etc. + * @leave KErrArgument Callback is missing when required. + * @leave KErrNotSupported No cmd matches given menu command or CCoeEnv is not accessible. + */ + void ExecuteMenuCmdL(TInt aMenuCmdId, TUint aCmdOptions = 0, MAiwNotifyCallback* aCallback = NULL); + + /** + * Handles AIW submenus. This method should be called from consumer application's + * DynInitMenuPaneL. + * + * @param aPane Menu pane to be handled. + * @return ETrue if aPane was an AIW submenu and it was handled. + * Consumer's DynInitMenuPaneL pane may now return. + * EFalse if aPane was not an AIW submenu and DynInitMenuPaneL should + * continue normally. + */ + TBool HandleSubmenuL(CEikMenuPane& aPane); + + /** + * Returns boolean value indicating whether the given menu contains + * currently attached placeholders. + * + * @param aMenuResourceId Resource id of the menu to be queried. + * @return ETrue if aMenuResource contains currently attached placeholders. + * EFalse otherwise. + */ + TBool IsAiwMenu(TInt aMenuResourceId); + + /** + * Iterates through the Id Array and appends any AIW parameters + * associated with that Id to the InParams list. + */ + void AppendInParamsL(); + + /** + * Reset menu initialisation flag + */ + void ResetMenuInitialisedFlag(); + +private: + /** + * Instantiate the class. + * This must be private. + * To obtain an Instance on this class call the static method InstanceL(). + * @return pointer to the CGlxAiwServiceHandler + */ + static CGlxAiwServiceHandler* NewL(); + + /** + * Constructor + */ + CGlxAiwServiceHandler(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Finds the Index for a given Id + * @param TGlxMediaId of the index to find. + * @return index of aId or KErrNotFound. + */ + TInt FindId(const TGlxMediaId& aId); + + /** + * Function for comparing two CGlxAiwMedia classes + * Used from ordering iAiwMediaArray by media id + * @param aAiwMedia1 The CGlxAiwMedia to compare against aAiwMedia2 + * @param aAiwMedia2 The second item to compare + * @return -1 if aAiwMedia1.Id() < aAiwMedia2.Id(); 1 if aAiwMedia1.Id() > aAiwMedia2.Id(); 0 if aAiwMedia1.Id() == aAiwMedia2.Id() + */ + static TInt AiwMediaOrderById( const CGlxAiwMedia& aAiwMedia1, const CGlxAiwMedia& aAiwMedia2 ); + + /** + * Function for comparing a TGlxMediaId with a CGlxAiwMedia class + * Used from ordering iAiwMediaArray by media id + * @param aMediaId The TGlxMediaId to compare against aAiwMedia2 + * @param aAiwMedia2 The second item to compare + * @return -1 if aMediaId < aAiwMedia2.Id(); 1 if aMediaId > aAiwMedia2.Id(); 0 if aMediaId == aAiwMedia2.Id() + */ + static TInt AiwMediaOrderByMediaId( const TGlxMediaId* aMediaId, const CGlxAiwMedia& aAiwMedia ); + + /** + * Gets the InParameters. This method is for testing only + * @return a reference to the CAiwGenericParamList pointer to by iInParams + */ + CAiwGenericParamList& GetInParams(); + +private: + // Pointer to the real AiwServiceHandler (Owned). + CAiwServiceHandler* iAiwServiceHandler; + + //Enum for menu state + enum TMenuState + { + ENotInitialised, + ESubMenuInitialised, + EMainMenuInitialised + }; + // Keeps track of the menu being initialised and inParams being + // deleted by the AiwServiceHandler + TMenuState iInitialisedMenu; + + // The inParams generated to initialise the menu with + CAiwGenericParamList* iInParams; + + // Array of CGlxAiwMedia + RPointerArray iAiwMediaArray; + }; + +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraddtocontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraddtocontainer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2008-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: Add to container commmand handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERADDTOCONTAINER_H__ +#define __C_GLXCOMMANDHANDLERADDTOCONTAINER_H__ + +#include +#include + +class MGlxMediaListProvider; + +class CEikAppUi; + +/** + * Command handler for adding to a container. + * @author Alex Birkett, Aki Vanhatalo + * @internal reviewed 05/06/2007 by Dave Schofield + */ +NONSHARABLE_CLASS( CGlxCommandHandlerAddToContainer ) + : public CGlxMpxCommandCommandHandler + { +public: + /** + * Create add to album command handler + * @param aMediaListProvider object that provides the media list. + */ + IMPORT_C static CGlxCommandHandlerAddToContainer* NewAddToAlbumCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem); + + /** + * Create add (to) tags command handler + * @param aMediaListProvider object that provides the media list. + */ + IMPORT_C static CGlxCommandHandlerAddToContainer* NewAddToTagCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem); + + /** + * Create add (to) Favourites command handler + * @param aMediaListProvider object that provides the media list. + */ + IMPORT_C static CGlxCommandHandlerAddToContainer* NewAddToFavCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem); + + /** + * Two-phase constructor: + * Prefer NewAddToAlbumCommandHandlerL or NewAddToTagsCommandHandlerL + * @param aMediaListProvider object that provides the media list. + * @param aCommand The command to handle. + */ + IMPORT_C static CGlxCommandHandlerAddToContainer* NewL(MGlxMediaListProvider* aMediaListProvider, + TInt aCommandId, TBool aHasToolbarItem ); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerAddToContainer(); + +protected: // From CGlxMediaListCommandHandler + + /** See @ref CGlxMpxCommandCommandHandler::CreateCommandL */ + virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const; + + /** See @ref CGlxMpxCommandCommandHandler::CompletionTextL */ + virtual HBufC* CompletionTextL() const; + + /** See @ref CGlxMpxCommandCommandHandler::DoHandleCommandCompleteL */ + virtual void DoHandleCommandCompleteL(TAny* aSessionId, + CMPXCommand* aCommandResult, TInt aError, MGlxMediaList* aList); + + /** See @ref CGlxCommandHandler::DoActivateL */ + void DoActivateL(TInt aViewId); + + /** See @ref CGlxCommandHandler::PopulateToolbar*/ + void PopulateToolbarL(); + +private: + /** + * Second phase constructor + * @param aCommand The command to handle. + */ + void ConstructL(TInt aCommandId); + + + /** + * First phase constructor + * @aMediaListProvider object that provides the media list. + */ + CGlxCommandHandlerAddToContainer(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem ); + +private: + // Resource offset + TInt iResourceOffset; + + // Container Command Id + TInt iCommandId; + + // Target containers selection count + static TInt iSelectionCount; + + // Popup Completion Status Flag + mutable TBool iIsProcessOngoing; + + }; + +#endif // __C_GLXCOMMANDHANDLERADDTOCONTAINER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwassign.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwassign.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2008-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: AIW assign command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERAIWASSIGN_H +#define C_GLXCOMMANDHANDLERAIWASSIGN_H + +#include "glxcommandhandleraiwbase.h" + +class CGlxAttributeContext; +class CAiwGenericParamList; +class CGlxMedia; +class MGlxMediaListProvider; + + +/** + * CGlxCommandHandlerAiwAssign + * + * Assign AIW command handler + * + * @lib glxcommoncommandhandlers.lib + */ +NONSHARABLE_CLASS (CGlxCommandHandlerAiwAssign) + : public CGlxCommandHandlerAiwBase + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aMenuResource The menu resource that the AIW command will be + * implented in + * @return Fully constructed command handler + * @warning ConstructL of base class is called. If ConstructL is + * implemented in this class, then care must be taken to call + * CGlxCommandHandlerAiwBase::ConstructL + */ + IMPORT_C static CGlxCommandHandlerAiwAssign* NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource); + +protected: // From CGlxMediaListCommandHandler + /** + * See @ref CGlxMediaListCommandHandler::DoGetRequiredAttributesL + */ + virtual void DoGetRequiredAttributesL(RArray& aAttributes, TBool aFilterUsingSelection) const; + +protected: // From CGlxCommandHandlerAiwBase + TBool AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler); + TInt CommandId() const; + TInt AiwCommandId() const; + TInt AiwInterestResource() const; + void AiwDoDynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane); + TInt CommandSpace() const; + +private: + /** + * Constructor + */ + CGlxCommandHandlerAiwAssign(MGlxMediaListProvider* aMediaListProvider, + TInt aMenuResource); + }; + +#endif // C_GLXCOMMANDHANDLERAIWASSIGN_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2008-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: AIW command handler base class +* +*/ + + + +#ifndef C_GLXCOMMANDHANDLERAIWBASE_H +#define C_GLXCOMMANDHANDLERAIWBASE_H + +#include +#include +#include + +class CGlxAttributeContext; +class CGlxAiwServiceHandler; +class CGlxMedia; +class TGlxMedia; +class MGlxMediaList; +class CGlxAttributeRetriever; +class CAknAppUi; + +/** + * CGlxCommandHandlerAiwBase + * + * Base class for AIW command handlers + * + * @lib glxcommoncommandhandlers.lib + */ +NONSHARABLE_CLASS (CGlxCommandHandlerAiwBase) + : public CGlxMediaListCommandHandler, + public MAiwNotifyCallback + { +public: + /** Destructor */ + virtual ~CGlxCommandHandlerAiwBase(); + +public: // From MAiwNotifyCallback + virtual TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CAiwGenericParamList& aEventParamList, + const CAiwGenericParamList& aInParamList); + +protected: // From CGlxMediaListCommandHandler + virtual TBool BypassFiltersForExecute() const; + virtual TBool BypassFiltersForMenu() const; + virtual TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + virtual void DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + virtual void PreDynInitMenuPaneL( TInt aResourceId ); + virtual void DoActivateL(TInt aViewId); + virtual void Deactivate(); + +protected: // New functions + /** + * Constructor + * @param aMediaListProvider The media list owner, used by + * CGlxMediaListCommandHandler + * @param aMenuResource The menu resource that the AIW command will be + * implented in + */ + CGlxCommandHandlerAiwBase(MGlxMediaListProvider* aMediaListProvider, + TInt aMenuResource); + + /** Second phase constructor */ + void ConstructL(); + + /** + * This appends a Uri and/or a mimetype parameter to the InParams list (see Aiw Service Handler) + * @param aItem - The data source. Used to extract the Uri/mimetype + * @param aAiwServiceHandler - Reference to the CGlxAiwServiceHandler + * @param aAddUri - ETrue to add the Uri, EFalse if not. + * @param aAddMimeType - Etrue to add the mimetype, EFalse if not. + */ + TBool AppendDefaultAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler, + TBool aAddUri, + TBool aAddMimeType); + + +protected: // New functions to be overridden by implementing class + /** + * Appends one or more parameters to aParamList, to represent aItem. + * aParamList will eventually be passed to Aiw, so the format of these + * parameters should be agreed with AIW. + * @param aItem Item to examine + * @param aParamList The parameter list to append the new parameter(s) to + * @return True iff the parameter could be appended; False otherwise + */ + virtual TBool AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler) = 0; + + /** + * @return The command ID in the menu that AIW will replace + */ + virtual TInt CommandId() const = 0; + + /** + * @return The AIW command implemented + */ + virtual TInt AiwCommandId() const = 0; + + /** + * @return The AIW interest resource for the subclass + */ + virtual TInt AiwInterestResource() const = 0; + + /** + * @return The maximum number of selected items supported + */ + virtual TInt MaxSelectedItems() const; + + /** + * Allow the concrete implementation to do some work on the menu before + * passing it to the AIW service handler + * @param aResourceId The resource ID of the menu + * @param aMenuPane The in-memory representation of the menu pane + * @see CGlxMediaListCommandHandler::DoDynInitMenuPaneL + */ + virtual void AiwDoDynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane); + + /** + * @return The command space to use for the command + */ + virtual TInt CommandSpace() const = 0; + + /** + * @param aMenuItemText itemText for menu Item + * @param aMenuPane menuPane in which itemText to be searched + * @return The AIW commandId for menuItemText + */ + TInt AiwMenuCmdIdL( const TDesC& aMenuItemText, CEikMenuPane* aMenuPane ); + +private: + /** + * Collates all Aiw parameters needed by iterating through the selected + * items. adding them to an internal array in the aAiwServiceHandler + * @param aAiwServiceHandler a reference to the AiwServiceHandler + * @return True iff all parameters were available, False otherwise + * @see AppendAiwParameterL + */ + TBool GatherAiwParametersL(CGlxAiwServiceHandler& aAiwServiceHandler); + + /** + * Collates all Aiw parameters needed by iterating through the selected + * items adding them directly to the AIW InParams + * @param aAiwServiceHandler a reference to the AiwServiceHandler + * @return True iff all parameters were available, False otherwise + * @see AppendAiwParameterL + */ + TBool RegatherAiwParametersL(CGlxAiwServiceHandler& aAiwServiceHandler); + + /** + * Check whether the AIW item is enabled + * @return Whether the AIW item is enabled + */ + TBool AiwItemEnabledL(); + + TBool AppendTextParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler, + const TDesC& aText, + TGenericParamIdValue aGenericParamIdValue); + + /* + TBool AppendTextParameterL(CGlxAiwServiceHandler& aAiwServiceHandler, + const TDesC& aText, + TGenericParamIdValue aGenericParamIdValue); + */ + +private: + /// Menu resource containing iCommandId + TInt iMenuResource; + + /// The AppUI, not owned. + CAknAppUi* iAppUi; + + /// Pointer to the AiwServiceHandler. This is the real CGlxAiwServiceHandler, of which there can only be one instance, Hence the need to wrap + /// in this singleton class. + CGlxAiwServiceHandler* iAiwServiceHandler; + TInt iResourceOffset; + }; + +#endif // C_GLXCOMMANDHANDLERAIWBASE_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwedit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwedit.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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: Image Editor command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERAIWEDIT_H +#define C_GLXCOMMANDHANDLERAIWEDIT_H + +#include "glxcommandhandleraiwbase.h" + +class CGlxAttributeContext; +class CAiwGenericParamList; +class CGlxMedia; +class MGlxMediaListProvider; + + +/** + * CGlxCommandHandlerAiwEdit + * + * Edit AIW command handler + * + * @lib glxcommoncommandhandlers.lib + */ +NONSHARABLE_CLASS (CGlxCommandHandlerAiwEdit) + : public CGlxCommandHandlerAiwBase + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aMenuResource The menu resource that the AIW command will be + * implented in + * @return Fully constructed command handler + * @warning ConstructL of base class is called. If ConstructL is + * implemented in this class, then care must be taken to call + * CGlxCommandHandlerAiwBase::ConstructL + */ + IMPORT_C static CGlxCommandHandlerAiwEdit* NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource); + +protected: // From CGlxMediaListCommandHandler + /** + * See @ref CGlxMediaListCommandHandler::DoGetRequiredAttributesL + */ + virtual void DoGetRequiredAttributesL(RArray& aAttributes, TBool aFilterUsingSelection) const; + +protected: // From CGlxCommandHandlerAiwBase + virtual TBool AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler); + virtual TInt CommandId() const; + virtual TInt AiwCommandId() const ; + virtual TInt AiwInterestResource() const ; + virtual TInt CommandSpace() const ; + //single clk chng-hide edit for 0 or >1 items + void AiwDoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); +private: + /** + * Constructor + */ + CGlxCommandHandlerAiwEdit(MGlxMediaListProvider* aMediaListProvider, + TInt aMenuResource); + }; + +#endif // C_GLXCOMMANDHANDLERAIWEDIT_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwprintpreview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwprintpreview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2008-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: AIW print preview command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERAIWPRINTPREVIEW_H +#define C_GLXCOMMANDHANDLERAIWPRINTPREVIEW_H + +#include "glxcommandhandleraiwbase.h" + +class CGlxAttributeContext; +class CAiwGenericParamList; +class CGlxMedia; +class MGlxMediaListProvider; + +/** + * CGlxCommandHandlerAiwPrintPreview + * + * Print preview AIW command handler + * + * @lib glxcommoncommandhandlers.lib + */ +NONSHARABLE_CLASS (CGlxCommandHandlerAiwPrintPreview) + : public CGlxCommandHandlerAiwBase + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aMenuResource The menu resource that the AIW command will be + * implented in + * @return Fully constructed command handler + * @warning ConstructL of base class is called. If ConstructL is + * implemented in this class, then care must be taken to call + * CGlxCommandHandlerAiwBase::ConstructL + */ + IMPORT_C static CGlxCommandHandlerAiwPrintPreview* NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource); + void PreDynInitMenuPaneL(TInt aResourceId); + +protected: // From CGlxMediaListCommandHandler + /** + * See @ref CGlxMediaListCommandHandler::DoGetRequiredAttributesL + */ + virtual void DoGetRequiredAttributesL(RArray& aAttributes, TBool aFilterUsingSelection) const; + /** + * Overridden from CGlxCommandHandlerAiwBase. + */ + void AiwDoDynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane); +protected: // From CGlxCommandHandlerAiwBase + virtual TBool AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler); + virtual TInt CommandId() const ; + virtual TInt AiwCommandId() const ; + virtual TInt AiwInterestResource() const ; + virtual TInt CommandSpace() const ; + +private: + /** + * Constructor + */ + CGlxCommandHandlerAiwPrintPreview(MGlxMediaListProvider* aMediaListProvider, + TInt aMenuResource); + + }; + +#endif // C_GLXCOMMANDHANDLERAIWPRINTPREVIEW_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwshareonovi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwshareonovi.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: AIW Share On Ovi command handler ( Works only with ShareOnline application version 4.3 and above ) +* +*/ + + +#ifndef GLXCOMMANDHANDLERAIWSHAREONOVI_H_ +#define GLXCOMMANDHANDLERAIWSHAREONOVI_H_ + +// INTERNAL INCLUDES +#include "glxcommandhandleraiwbase.h" + +// FORWARD REFERENCES +class MGlxMediaListProvider; + +/** + * CGlxCommandHandlerAiwShareOnOvi + * + * Share on Ovi AIW command handler + * + * @lib glxcommoncommandhandlers.lib + */ +NONSHARABLE_CLASS (CGlxCommandHandlerAiwShareOnOvi) + : public CGlxCommandHandlerAiwBase + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aMenuResource The menu resource that the AIW command will be + * implented in + * @return Fully constructed command handler + * @warning ConstructL of base class is called. If ConstructL is + * implemented in this class, then care must be taken to call + * CGlxCommandHandlerAiwBase::ConstructL + */ + IMPORT_C static CGlxCommandHandlerAiwShareOnOvi* NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource); + +protected: // From CGlxMediaListCommandHandler + /** + * See @ref CGlxMediaListCommandHandler::DoGetRequiredAttributesL + */ + virtual void DoGetRequiredAttributesL(RArray& aAttributes, TBool aFilterUsingSelection) const; + +protected: // From CGlxCommandHandlerAiwBase + virtual TBool AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler); + virtual TInt CommandId() const; + virtual TInt AiwCommandId() const ; + virtual TInt AiwInterestResource() const ; + virtual TInt CommandSpace() const ; + +private: + /** + * Constructor + */ + CGlxCommandHandlerAiwShareOnOvi(MGlxMediaListProvider* aMediaListProvider, + TInt aMenuResource); + }; + + +#endif /*GLXCOMMANDHANDLERAIWSHAREONOVI_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwshowmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwshowmap.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2008-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: Show on map command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERAIWSHOWMAP_H +#define C_GLXCOMMANDHANDLERAIWSHOWMAP_H + +#include "glxcommandhandleraiwbase.h" + +class CGlxAttributeContext; +class CAiwGenericParamList; +class CGlxMedia; +class MGlxMediaListProvider; +class TCoordinate; + +/** + * CGlxCommandHandlerAiwShowMap + * + * Show map AIW command handler + * + * @author Rhodri Byles + * @lib glxcommoncommandhandlers.lib + */ +NONSHARABLE_CLASS (CGlxCommandHandlerAiwShowMap) + : public CGlxCommandHandlerAiwBase + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aMenuResource The menu resource that the AIW command will be + * implented in + * @return Fully constructed command handler + * @warning ConstructL of base class is called. If ConstructL is + * implemented in this class, then care must be taken to call + * CGlxCommandHandlerAiwBase::ConstructL + */ + IMPORT_C static CGlxCommandHandlerAiwShowMap* NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource); + + /** + * Perform any actions needed before the options menu is displayed. + * The view calling this must first arrange a wait dialog to be displayed, as this operation may take + * a long time to complete + */ + void PreDynInitMenuPaneL(TInt aResourceId); + + /** + * Destructor + */ + ~CGlxCommandHandlerAiwShowMap(); + +protected: // From CGlxMediaListCommandHandler + /** + * See @ref CGlxMediaListCommandHandler::DoGetRequiredAttributesL + */ + virtual void DoGetRequiredAttributesL(RArray& aAttributes, TBool aFilterUsingSelection) const; + +protected: // From CGlxCommandHandlerAiwBase + TBool AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler); + TInt CommandId() const; + TInt AiwCommandId() const ; + TInt AiwInterestResource() const ; + TInt CommandSpace() const ; + void AiwDoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + + +private: + /** + * Constructor + * @param aMediaListProvider object that provides the media list + * @param aMenuResource The menu resource that the AIW command will be + * implented in + */ + CGlxCommandHandlerAiwShowMap(MGlxMediaListProvider* aMediaListProvider, + TInt aMenuResource); + + /** + * Check if a selected item in a media list has location information. + * @param MediaList to check + * @return ETrue if location information is there. EFalse if not + */ + TBool IsItemWithLocationInfoSelected(MGlxMediaList& aList); + +private: + RPointerArray iBufferArray; // owned + }; + +#endif // C_GLXCOMMANDHANDLERAIWSHOWMAP_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwshowonmaphardkey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleraiwshowonmaphardkey.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Application's adapter class to Map and Navigation use cases +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERAIWSHOWMAPHARDKEY_H +#define C_GLXCOMMANDHANDLERAIWSHOWMAPHARDKEY_H + +// INCLUDES +#include +#include +// EXTERNAL INCLUDES +#include "AiwServiceHandler.h" // AIW service handler + +// INTERNAL INCLUDES +#include "glxmedialistcommandhandler.h" // for MediaListCommandHandler + +class CAiwServiceHandler; +class TCoordinate; + +/** +* The class CGlxCommandHandlerAiwShowMapHardKey contains the implemenation +* for only show on map Functionality: +* To check map service providers +* To show location on map +* To navigate to the location +*/ + +NONSHARABLE_CLASS( CGlxCommandHandlerAiwShowMapHardKey ) + : public CGlxMediaListCommandHandler + { + +public: // Constructors and destructor + /** + * Symbian 1st phase static constructor. + * + */ + IMPORT_C static CGlxCommandHandlerAiwShowMapHardKey* NewL(MGlxMediaListProvider* + aMediaListProvider, + TBool aHasToolbarItem); + + /** + * Destructor. + */ + ~CGlxCommandHandlerAiwShowMapHardKey(); + +private: // From CGlxMediaListCommandHandler + /** + * Execute the command, if applicable. + * @param aCommand The command to handle + * @param aList List of media items + * @return ETrue if command was handled, EFalse otherwise + * @ref CGlxMediaListCommandHandler + */ + TBool DoExecuteL (TInt aCommandId, MGlxMediaList& aList); + + /** + * Called when the owning view is activated + * @param aViewId The ID of the view + * @ref CGlxMediaListCommandHandler + */ + void DoActivateL (TInt aViewId); + + /** + * Called when the owning view is deactivated + */ + void Deactivate(); +// Below methods are commented as they hold implemenatation of dofferent commandhandler +// To check map service providers +// To navigate to the location +//public: // New methods + + /** + * It will return total map service providers. + * @since S60 v9.1 + * @ret total number of map service providers + */ +// TInt MapServiceProvidersL(); + + /** + * It will show location on map + * @since S60 v9.1 + */ +// IMPORT_C void ShowOnMapL( const TCoordinate& aCoordinate ); + + /** + * It will navigate to location + * @since S60 v9.1 + */ +// void NavigateToPlaceL( const TCoordinate& aCoordinate ); + +private: + /** + * C++ default constructor. + */ + CGlxCommandHandlerAiwShowMapHardKey(MGlxMediaListProvider* + aMediaListProvider, + TBool aHasToolbarItem); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + +private: // Data + + // ID of owning view + TInt iViewId; + + // Owns : Pointer to AIW service handler to send service commands + CAiwServiceHandler* iAiwServiceHandler; + + // Owns : Generic parameter input list + CAiwGenericParamList* iInList; + + // Owns : Generic parameter output list + CAiwGenericParamList* iOutList; + }; + +#endif //C_GLXCOMMANDHANDLERAIWSHOWMAPHARDKEY_H + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerback.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2008-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: Back command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERBACK_H +#define C_GLXCOMMANDHANDLERBACK_H + +// INCLUDES +#include +#include + + +// FORWARD DECLARATION +class MGlxMediaListProvider; +class MMPXCollectionUtility; +class MMPXViewUtility; +class CGlxNavigationalState; + + +class CGlxBackServiceWrapper; + +class CAknAppUi; +/** + * @class CGlxCommandHandlerBack + * + * Command handler that either takes you back to the previously + * active view or one step back in the UI hierarchy + * + */ +NONSHARABLE_CLASS (CGlxCommandHandlerBack) + : public CGlxCommandHandler + { +private: + + enum TGlxBackCommandId + { + EGlxCmdBack, + EGlxCmdPreviousView, + EGlxCmdContainerPreviousView, + }; + +public: + + /** + * Create Command handler for going back one step within the + * UI Hierarchy + * + * @param aMediaListProvider media list owner + */ + IMPORT_C static CGlxCommandHandlerBack* NewBackCommandHandlerL(); + + /** + * Create Command handler for going back one view when the + * current view is outside UI Hierarchy + * + * @param aMediaListProvider media list owner + */ + IMPORT_C static CGlxCommandHandlerBack* NewPreviousViewCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider = NULL); + + /** + * Create Command handler for checkig whether to go back one view or two view + * when the current view is outside UI Hierarchy + * + * @param aMediaListProvider media list owner + * @param aPrevViewId previous view id + */ + IMPORT_C static CGlxCommandHandlerBack* NewContainerPreviousViewCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider = NULL, + TInt aPrevViewId = 0 ); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerBack(); + +private: + + /** + * Two-phase constructor + * + * @param aCommandId Command id for command handler + * @param aMediaListProvider media list owner + * @param aPrevViewId previous view id + */ + static CGlxCommandHandlerBack* NewL( + TInt aCommandId, + MGlxMediaListProvider* aMediaListProvider, + TInt aPrevViewId ); + + /** Second phase constructor */ + void ConstructL(TBool aIsContainerList); + + /** Constructor */ + CGlxCommandHandlerBack(MGlxMediaListProvider* aMediaListProvider, + TInt aPrevViewId ); + + // This API to be removed after testing with migration is over + /** + * check if deletion of container need to be checked + */ + // TBool CheckContainerDeletion() const; + +public: // From MGlxCommandHandler + + /** + * Execute the command, if applicable + * @param aCommand The command to handle + * @return ETrue iff command was handled + */ + TBool ExecuteL( TInt aCommandId); + + /** + * Modify a menu before it is displayed. + * @param aResourceId The resource ID of the menu + * @param aMenuPane The in-memory representation of the menu pane + */ + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + /** + * Called when the owning view is activated + * @param aViewId The ID of the view + */ + void DoActivateL(TInt aViewId); + + /** + * Called when the owning view is deactivated + */ + void Deactivate(); + + /** + * Offers key events to the command handler + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown + * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** + * Perform any actions needed before the options menu is displayed. + * The view calling this must first arrange a wait dialog to be displayed, as this operation may take + * a long time to complete + */ + void PreDynInitMenuPaneL( TInt aResourceId ); + + /** + * See @ref MGlxCommandHandler::GetRequiredAttributesL + * No implementation required + */ + void GetRequiredAttributesL(RArray< TMPXAttribute >& /*aAttributes*/, + TBool /*aFilterUsingSelection*/, + TBool /*aFilterUsingCommandId*/, + TInt /*aCommandId*/) const {} + + +private: // data + + /** Provider of media list */ + MGlxMediaListProvider* iMediaListProvider; + + /** Back functionality that command handler need to execute */ + TInt iCurrentCommandId; + + //Previous view id to be checked + TInt iPrevViewId; + + // Navigational state is stored here + CGlxNavigationalState* iNavigationalState; + + CGlxBackServiceWrapper* iBSWrapper; + + //MMPXCollectionUtility* iCollectionUtility; + + /** + * Check for the view activation and avoid previous view activation + * till the view activation is called on back + */ + TBool iIsViewActivated; + + + /// The AppUI. Not owned + CAknAppUi* iAppUi; + }; + +#endif // C_GLXCOMMANDHANDLERBACK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlercopyandmove.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlercopyandmove.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2008-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: Move and Copy commmand handler +* +*/ + + + + +#ifndef GLXCOMMANDHANDLERCOPYANDMOVE_H_ +#define GLXCOMMANDHANDLERCOPYANDMOVE_H_ + +#include +#include +#include + +/** + * CGlxCommandHandlerCopyAndMove + * + * Copy and Move command handler. + * + * @lib glxcommoncommandhandlers.lib + * + * @internal reviewed 07/06/2007 by M. Byrne + */ +NONSHARABLE_CLASS( CGlxCommandHandlerCopyAndMove ) +: public CGlxMpxCommandCommandHandler + { + +public: + /** + * Two-phase constructor: + */ + IMPORT_C static CGlxCommandHandlerCopyAndMove* NewL(MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerCopyAndMove(); + +public: // from CGlxMpCommandCommandHandler + /** See @ref CGlxMpxCommandCommandHandler::CreateCommandL */ + virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const; + +public: // from CGlxMediaListCommandHandler + /** See @ref CGlxMediaListCommandHandler::DoDynInitMenuPaneL */ + void DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + +private: + /** Second phase constructor */ + void ConstructL(); + + /** First phase constructor */ + CGlxCommandHandlerCopyAndMove(MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource); + + /** + * Appends a drive letter to a descriptor for a given drive number. + * @param aDriveNumber a drive number that is required to be represented as a descriptor. + * @param aDriveLetter descriptor to which the drive letter (including ':\') should be appended + */ + static void DriveLetterFromNumber(TDriveNumber aDriveNumber, TDes& aDriveLetter); + +private: + /** ETrue if the command is visible + * in the menu else EFalse*/ + mutable TBool iVisible; + + /// Menu resource containing iCommandId + TInt iMenuResource; + + /// Resource file offset + TInt iResourceOffset; + }; + + +#endif /*GLXCOMMANDHANDLERCOPYANDMOVE_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerdelete.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerdelete.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERDELETE_H__ +#define __C_GLXCOMMANDHANDLERDELETE_H__ + +#include +#include + +class MGlxMediaListProvider; +class CGlxUiUtility; + +/** + * @class CGlxCommandHandlerDelete + * + * Command handler that deletes selected items from a media list. + * @author Aki Vanhatalo, Alex Birkett + * + */ + +NONSHARABLE_CLASS( CGlxCommandHandlerDelete) + : public CGlxMpxCommandCommandHandler + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aIsContainerList If ETrue, shows "delete container" + * confirmation notes and does not allow + * deleting system items + * If EFalse, shows "delete item" + * confirmation notes and does not check + * for system items + */ + IMPORT_C static CGlxCommandHandlerDelete* NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aIsContainerList, TBool aHasToolbarItem); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerDelete(); + +public: // From CGlxMpxCommandCommandHandler + /** See @ref CGlxMpxCommandCommandHandler::CreateCommandL */ + virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const; + + /** See CGlxMpxCommandCommandHandler::ProgressTextL */ + virtual HBufC* ProgressTextL(TInt aCommandId) const; + + /** See CGlxMpxCommandCommandHandler::ConfirmationTextL */ + virtual HBufC* ConfirmationTextL(TInt aCommandId, TBool aMultiSelection) const; + +public: // From CGlxCommandHandler + /** See @ref CGlxCommandHandler::DoActivateL */ + void DoActivateL(TInt aViewId); + + /** See @ref CGlxCommandHandler::OfferKeyEventL */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + +protected: + /** See @ref CGlxCommandHandler::PopulateToolbar*/ + void PopulateToolbarL(); + +private: + /** Second phase constructor */ + void ConstructL(TBool aIsContainerList); + + /** Constructor */ + CGlxCommandHandlerDelete(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem); + + /*single clk chngs-to update delete option*/ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; +private: + /// Resource file offset + TInt iResourceOffset; + // Does the list contain containers or items + + TInt iIsContainerList; + + CGlxUiUtility* iUiUtility; + }; + +#endif // __C_GLXCOMMANDHANDLERDELETE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerdetails.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerdetails.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2008-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: Details commmand handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERDETAILS_H__ +#define __C_GLXCOMMANDHANDLERDETAILS_H__ + +#include +#include + +class MGlxMediaListProvider; + +class CGlxUiUtility; + +/** + * Command handler for viewing Details + */ +NONSHARABLE_CLASS (CGlxCommandHandlerDetails) + : public CGlxMediaListCommandHandler + { + public: + /** + * Create command handler for launcing Metadata view or Tag manager + * use above method for creating command handler + * + * @param aCommandId Command id for command handler + * @param aMediaListProvider media list owner + */ + IMPORT_C static CGlxCommandHandlerDetails* NewL( + MGlxMediaListProvider* aMediaListProvider ); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerDetails(); + + private: + + /** Second phase constructor + * + * @param aCommandId Command id for command handler + */ + void ConstructL(); + + /** + * Constructor + * @param aMediaListProvider The owner of the media list to use + */ + CGlxCommandHandlerDetails( MGlxMediaListProvider* aMediaListProvider ); + + private: // From CGlxMediaListCommandHandler + + /** See CGlxCommandHandler::DoActivateL */ + virtual void DoActivateL(TInt aViewId); + + /** + * Execute the command, if applicable. Called after basic filtering + * @param aCommand The command to handle + * @return ETrue if command was handled + */ + virtual TBool DoExecuteL( TInt aCommandId , MGlxMediaList& aList); + + /** @see CGlxMediaListCommandHandler::DoIsDisabled */ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + + private: // implementation + + void LaunchViewL(TUid aViewPluginId,const TDesC& aURI); + + private: //data + + // Resource file offset + TInt iResourceOffset; + + /// Ref: HUI utility + CGlxUiUtility* iUiUtility; + }; + +#endif // __C_GLXCOMMANDHANDLERDETAILS_H__ + +//End of file + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerdownload.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerdownload.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2008-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: Download commmand handler +* +*/ + + + + +#ifndef __GLXCOMMANDHANDLERDOWNLOAD_H__ +#define __GLXCOMMANDHANDLERDOWNLOAD_H__ + + + +// INTERNAL INCLUDES +#include "glxcommandhandler.h" + + +// CLASS DECLARATION + +/** + * @class CGlxCommandHandlerDownload + * + * Command handler that opens a browser to allow downloading of images + * or videos + * @author David Holland + * @internal reviewed 26/06/2007 by Rowland Cook + * + */ +NONSHARABLE_CLASS(CGlxCommandHandlerDownload) : + public CGlxCommandHandler + { +public: // Constructors and destructor + /** + * Two-phased constructor. + * @return pointer to CGlxCommandHandlerDownload object + */ + IMPORT_C static CGlxCommandHandlerDownload* NewL(); + + + /** + * Destructor. + */ + IMPORT_C ~CGlxCommandHandlerDownload(); + + +private: + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CGlxCommandHandlerDownload(); + + +private: // From MGlxCommandHandler + /** + * Execute the command, if applicable + * @param aCommand The command to handle + * @return ETrue iff command was handled + * see @ref MGlxCommandHandler::ExecuteL + */ + TBool ExecuteL(TInt aCommand); + + /** + * Modify a menu before it is displayed. + * Null implementation + * @param aResourceId The resource ID of the menu + * @param aMenuPane The in-memory representation of the menu pane + * see @ref MGlxCommandHandler::DynInitMenuPaneL + */ + void DynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/) {}; + + /** + * Called when the owning view is activated + * Null implementation + * @param aViewId The ID of the view + * see @ref CGlxCommandHandler::DoActivateL + */ + void DoActivateL(TInt /*aViewId*/) {}; + + /** + * Called when the owning view is deactivated + * Null implementation + * see @ref MGlxCommandHandler::Deactivate + */ + void Deactivate() {}; + + /** + * Offers key events to the command handler + * Null implementation + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown + * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed + * see @ref MGlxCommandHandler::OfferKeyEventL + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, + TEventCode /*aType*/) {return EKeyWasNotConsumed;}; + + /** + * Perform any actions needed before the options menu is displayed. + * The view calling this must first arrange a wait dialog to be displayed, as this operation may take + * a long time to complete + * Null implementation + * see @ref MGlxCommandHandler::PreDynInitMenuPaneL + */ + void PreDynInitMenuPaneL( TInt /*aResourceId*/ ) {}; + + /** + * See @ref MGlxCommandHandler::GetRequiredAttributesL + * No implementation required + */ + void GetRequiredAttributesL(RArray< TMPXAttribute >& /*aAttributes*/, + TBool /*aFilterUsingSelection*/, + TBool /*aFilterUsingCommandId*/, + TInt /*aCommandId*/) const {} + +private: // data + + // Not owned + }; + +#endif //__GLXCOMMANDHANDLERDOWNLOAD_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerfilterimagesorvideos.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerfilterimagesorvideos.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008-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: Show items command handler +* +*/ + + + + +#ifndef C_glxcommandhandlerfilterimagesorvideos_H +#define C_glxcommandhandlerfilterimagesorvideos_H + +// EXTERNAL INCLUDES +#include + +// INTERAL INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MGlxMediaListProvider; +class CGlxUiUtility; + +/** + * @class CGlxCommandHandlerFilterImagesOrVideos + * + * Command handler providing the options "Show All", "Show Images" and "Show Videos". + * Only 2 of the 3 will ever be shown at one time + * @author Rowland Cook + * @author Kimmo Hoikka (Release 5.5 backport) + * @internal reviewed 25/10/2007 by David Holland + * @internal reviewed 08/02/2008 by Rhodri Byles + */ +NONSHARABLE_CLASS( CGlxCommandHandlerFilterImagesOrVideos ) + : public CGlxMediaListCommandHandler + { + public: + + /** + * Two-phase constructor + * + * @param aMediaListProvider media list owner + */ + IMPORT_C static CGlxCommandHandlerFilterImagesOrVideos* NewL( + MGlxMediaListProvider* aMediaListProvider ); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerFilterImagesOrVideos(); + + private: + + /** Constructor */ + CGlxCommandHandlerFilterImagesOrVideos( + MGlxMediaListProvider* aMediaListProvider, + CGlxUiUtility& aUiUtility ); + /** 2nd phase Constructor */ + void ConstructL(); + + private: // From CGlxMediaListCommandHandler + + /// @ref CGlxMediaListCommandHandler + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /// @ref CGlxMediaListCommandHandler + void DoActivateL( TInt aViewId ); + + /// @ref CGlxMediaListCommandHandler + TBool DoExecuteL( TInt aCommandId, MGlxMediaList& aList ); + + private: + + /** + * Sets the item type in the media list must use + * @param the new item type + */ + void SetItemTypeInMediaListL( TGlxFilterItemType aItemType ); + + private: // data + + /// Ref: HuiUtility + CGlxUiUtility& iUiUtility; + + // boolean to record what screen mode is used. + TBool iInFullScreen; + + }; + +#endif // C_glxcommandhandlerfilterimagesorvideos_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerhelp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerhelp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2008-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: Help command handler +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by David Holland + */ + +#ifndef C_GLXCOMMANDHANDLERMOREHELP_H +#define C_GLXCOMMANDHANDLERMOREHELP_H + +// INCLUDES +#include +#include + +// temp help ids files +#include + +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +// class + +/** + * TGlxHelpContext + * Help contexts for views + * @author M Byrne + */ +NONSHARABLE_CLASS (TGlxHelpContext) + { +public: + IMPORT_C TGlxHelpContext(); + +public: + TUid iMajor; + /** Help context for browsing */ + TCoeContextName iBrowseContext; + + /** Help context for viewing if applicable */ + TCoeContextName iViewContext; + }; + +//class + +/** + * CGlxCommandHandlerHelp class + * Help command handler + * @glxdrmcommandhandler.lib + * @author M Byrne + */ +NONSHARABLE_CLASS (CGlxCommandHandlerHelp) + : public CGlxCommandHandler + { +public : //constructor and desctructor + /** + * Two-phase constructor + * @param aHelpContext help context for view + * @param aMediaListOwner object that provides the media list + */ + IMPORT_C static CGlxCommandHandlerHelp* NewL(TGlxHelpContext aHelpContext); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerHelp(); + + /** Activate command handler + * @param aViewId id of view activating cmd handler + */ + void DoActivateL(TInt aViewId); + + /** + * Deactivate command handler + */ + void Deactivate(); + +protected: + /** see @ref MGlxCommandHandler::ExecuteL */ + TBool ExecuteL(TInt aCommandId); + + /** see @ref MGlxCommandHandler::DynInitMenuPaneL */ + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + /** see @ref MGlxCommandHandler::OfferKeyEventL */ + TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, + TEventCode /*aType*/); + + /** see @ref MGlxCommandHandler::PreDynInitMenuPaneL */ + virtual void PreDynInitMenuPaneL( TInt aResourceId ); + + /** + * See @ref MGlxCommandHandler::GetRequiredAttributesL + * No implementation required + */ + void GetRequiredAttributesL(RArray< TMPXAttribute >& /*aAttributes*/, + TBool /*aFilterUsingSelection*/, + TBool /*aFilterUsingCommandId*/, + TInt /*aCommandId*/) const {} + +private: + /** Constructor */ + CGlxCommandHandlerHelp(TGlxHelpContext aHelpContext); + + /** + * Launch help application + */ + void LaunchHelpL(); + +private: + /** Help contexts for the plugin */ + TGlxHelpContext iHelpContext; + + /** flag to indicate whether full-screen view active + based on dummy view-state commands */ + TBool iInFullScreen; + }; + +#endif // C_GLXCOMMANDHANDLERMOREHELP_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerhideui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerhideui.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2008-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: Hide Ui command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERHIDEUI_H +#define C_GLXCOMMANDHANDLERHIDEUI_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS +class CGlxUiUtility; + +// CLASS DECLARATION + +/** + * Command to hide and show the screen furniture. + * + * @ingroup glx_group_command_handlers + */ +NONSHARABLE_CLASS (CGlxCommandHandlerHideUi) : + public CGlxCommandHandler + { +public: + /** + * Two-phased constructor. + */ + IMPORT_C static CGlxCommandHandlerHideUi* NewL(); + + /** + * Destructor. + */ + ~CGlxCommandHandlerHideUi(); + +public: // From CGlxCommandHandler + virtual TBool ExecuteL(TInt aCommand); + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + virtual void DoActivateL(TInt aViewId); + virtual void Deactivate(); + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + virtual void PreDynInitMenuPaneL( TInt aResourceId ); + /** + * See @ref MGlxCommandHandler::GetRequiredAttributesL + * No implementation required + */ + void GetRequiredAttributesL(RArray< TMPXAttribute >& /*aAttributes*/, + TBool /*aFilterUsingSelection*/, + TBool /*aFilterUsingCommandId*/, + TInt /*aCommandId*/) const {} +private: + /** + * C++ default constructor. + */ + CGlxCommandHandlerHideUi(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: // Data + /// ID of owning view + TInt iViewId; + + /// Hui utility + CGlxUiUtility* iUiUtility; + + /// Whether the command is available (only in full-screen) + TBool iCommandAvailable; + }; + +#endif // C_GLXCOMMANDHANDLERHIDEUI_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlernewmedia.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlernewmedia.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2008-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: Add to container commmand handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERNEWMEDIA_H__ +#define __C_GLXCOMMANDHANDLERNEWMEDIA_H__ + +#include +#include +#include + +class CEikAppUi; + +class MGlxMediaListProvider; + +/** + * Command handler for adding new media (new containers) + * @author Alex Birkett + * + * @internal reviewed 06/06/2007 by Dave Schofield + */ +NONSHARABLE_CLASS(CGlxCommandHandlerNewMedia) : public CGlxMpxCommandCommandHandler + { +public: + /** + * Two-phase constructor: + * @param aMediaListProvider object that provides the media list. + */ + IMPORT_C static CGlxCommandHandlerNewMedia* NewL(MGlxMediaListProvider* aMediaListProvider); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerNewMedia(); + + /** + * Execute the dialog. + * @param aNewMediaId + * The ID of the media that is created + * @return system wide error code. + * (KErrCancel if the dialog is cancelled). + */ + IMPORT_C TInt ExecuteLD(TGlxMediaId& aNewMediaId); + +public: // from CGlxMpxCommandCommandHandler + + /** See @ref CGlxMpxCommandCommandHandler::DoHandleCommandCompleteL */ + void DoHandleCommandCompleteL(TAny* aSessionId, CMPXCommand* aCommandResult, + TInt aError, MGlxMediaList* aList); + + /** See @ref CGlxMpxCommandCommandHandler::OkToExit */ + TBool OkToExit() const; + + /** See @ref CGlxMpxCommandCommandHandler::CreateCommandL */ + virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const; + + /** See @ref CGlxMpxCommandCommandHandler::HandleErrorL */ + void HandleErrorL(TInt aError); + +public: // from CGlxMediaListCommandHandler + /** See @ref CGlxMediaListCommandHandler::BypassFiltersForExecute */ + IMPORT_C TBool BypassFiltersForExecute() const; + +private: + /** Second phase constructor */ + void ConstructL(); + + /** + * First phase constructor + * @param aMediaListOwner object that provides the media list. + */ + + CGlxCommandHandlerNewMedia(MGlxMediaListProvider* aMediaListProvider); + + /** + * Fetches the 'media popup title' and 'default new media item title' + * from the collection. + * @param aCollectionId Collection plugin id from which to fetch titles. + * @param aDefaultNewMediaItemTitle On return contains the default new media item title. + */ + void TitlesL(const TGlxMediaId aCollectionId, TDes& aDefaultNewMediaItemTitle) const; + + /** + * Generates a unique new media item title based on the titles of items that already exist. + * @param aDefaultNewMediaItemTitle the default new media item title (e.g.) "New Tag" + * @param aList a media list containing the existing media e.g. "New Tag", "New Tag (1)" + * @return The new media item title e.g. "New Tag (2)" + */ + HBufC* GenerateNewMediaItemTitleL(const TDesC& aDefaultNewMediaItemTitle, MGlxMediaList& aList) const; + + /** + * Sets the media list focus + * and tries to exit the dialog. + * @param aIndex. Index of the item in the media list to focus. + */ + void SetFocusL(TInt aIndex); + +protected: // From MGlxMediaListObserver + /// See @ref MGlxMediaListObserver::HandleItemAddedL + IMPORT_C void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + +private: + /** + * CGlxAsyncFocuser + * Used by CGlxCommandHandlerNewMedia to perform focusing operations + * asynchronously. + */ + NONSHARABLE_CLASS(CGlxAsyncFocuser) + : public CActive + { + public: + /** + * Constructor + * @param aGlxCommandHandlerNewMedia object on which to call SetFocusL + */ + CGlxAsyncFocuser(CGlxCommandHandlerNewMedia* aGlxCommandHandlerNewMedia); + + /** + * Destructor + */ + ~CGlxAsyncFocuser(); + + public: + /** + * Calls CGlxCommandHandlerNewMedia::SetFocusL asynchronously + * i.e from CGlxAsyncFocuser::RunL() + * @param aIndex index to pass to + */ + void SetFocus(TInt aIndex); + + public: // from CActive + /** See @ref CActive::RunL */ + void RunL(); + + /** See @ref CActive::DoCancel */ + void DoCancel(); + + private: + /** + * Object on which to call SetFocusL (not owned) + */ + CGlxCommandHandlerNewMedia* iGlxCommandHandlerNewMedia; + + /** + * Index of the item to be focused. + */ + TInt iFocusIndex; + }; + +private: + /** + * Resource offset + */ + TInt iResourceOffset; + + /** + * Id of new media + */ + TGlxMediaId iNewMediaId; + + /** + * Active scheduler wait object. (Owned) + */ + CActiveSchedulerWait* iSchedulerWait; + + /** + * Error set by DoHandleCommandCompleteL() + */ + mutable TInt iNewMediaCreationError; + + /** + * Ok to exit. ETrue if OK to exit else EFalse. + */ + mutable TBool iOkToExit; + + /** + * Object used to call SetFocusL asynchronously (owned) + */ + CGlxAsyncFocuser* iAsyncFocuser; + + /** + * The title of the new media item. + */ + mutable HBufC* iNewMediaItemTitle; + + /** + * ETrue if a file with the same name already exists, else EFalse + */ + mutable TBool iFileNameAlreadyExists ; + }; + +#endif // __C_GLXCOMMANDHANDLERNEWMEDIA_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleropen.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandleropen.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2007-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: Rename command handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERREOPEN_H__ +#define __C_GLXCOMMANDHANDLERREOPEN_H__ + +#include +#include +#include + +class MGlxMediaListProvider; + +/** + * @class CGlxCommandHandlerOpen + * Command handler for Open Option. + */ +NONSHARABLE_CLASS(CGlxCommandHandlerOpen) :public CGlxMediaListCommandHandler + { +public: + /** + * Two-phase constructor + */ + IMPORT_C static CGlxCommandHandlerOpen* NewL(MGlxMediaListProvider* aMediaListProvider); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerOpen(); + + +private: + /** Second phase constructor */ + void ConstructL(); + /** + * Constructor + * @param aMediaListProvider object that provides the media list + */ + CGlxCommandHandlerOpen( MGlxMediaListProvider* aMediaListProvider); + +private: + virtual void DoActivateL(TInt aViewId); + + virtual TBool DoExecuteL( TInt aCommandId , MGlxMediaList& aList); + + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + CGlxUiUtility* iUiUtility; + }; + +#endif // __C_GLXCOMMANDHANDLEROPEN_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerremovefrom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerremovefrom.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERREMOVEFROM_H__ +#define __C_GLXCOMMANDHANDLERREMOVEFROM_H__ + +#include +#include +#include +#include + +class MGlxMediaListProvider; + +/** + * @class CGlxCommandHandlerRemoveFrom + * + * Command handler that removes relationships between media objects. + * + */ + +NONSHARABLE_CLASS( CGlxCommandHandlerRemoveFrom ) + : public CGlxMpxCommandCommandHandler + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aContainerType specifies the container type. (Used to determine + * the correct confirmation note.) Only confirmation notes for EMPXAlbum + * and EMPXTag are supported. A confirmation note will not be displayed for + * unsupported types. + */ + IMPORT_C static CGlxCommandHandlerRemoveFrom* NewL( + MGlxMediaListProvider* aMediaListProvider, + TMPXGeneralCategory aContainerType, TInt aCommandId = NULL); + + /** + * Create remove (from) Favourites command handler + * @param aMediaListProvider object that provides the media list. + */ + IMPORT_C static CGlxCommandHandlerRemoveFrom* NewRemFromFavCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider); + + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerRemoveFrom(); + + /** + * Set the container from which the items will be removed. + * If this is not set, the items will be removed from their container (their + * parent) on the path owned by the media list passed as a parameter to + * CreateCommandL(). + * @param aContainerId. The container from which the items will be removed. + */ + IMPORT_C void SetContainerId(TGlxMediaId aContainerId); + +protected: // From CGlxMpxCommandCommandHandler + /** See @ref CGlxMpxCommandCommandHandler::CreateCommandL */ + virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const; + + /** See CGlxMpxCommandCommandHandler::ConfirmationTextL */ + virtual HBufC* ConfirmationTextL(TInt aCommandId, TBool aMultiSelection) const; + + virtual HBufC* CompletionTextL() const; + +protected: // from CGlxCommandHandler + /** See @ref CGlxCommandHandler::DoActivateL */ + void DoActivateL(TInt /*aViewId*/); + +private: + /** Second phase constructor */ + void ConstructL(TInt aCommandId); + + /** Constructor */ + CGlxCommandHandlerRemoveFrom(MGlxMediaListProvider* aMediaListProvider, TMPXGeneralCategory aContainerType); + +private: + /// Resource file offset + TInt iResourceOffset; + TGlxMediaId iRemoveFromContainerId; + TMPXGeneralCategory iContainerType; + TInt iCommandId; + }; + +#endif // __C_GLXCOMMANDHANDLERREMOVEFROM_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerrename.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerrename.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: Rename command handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERRENAME_H__ +#define __C_GLXCOMMANDHANDLERRENAME_H__ + +#include +#include + +class MGlxMediaListProvider; + +/** + * @class CGlxCommandHandlerRename + * + * Command handler that renames a container item except if multiple items are + * marked, or the selected item is a static or system item + * or if the view is empty. + * @author Rhodri Byles + * @internal reviewed 21/06/2007 by Loughlin + * + */ +NONSHARABLE_CLASS(CGlxCommandHandlerRename) : + public CGlxMpxCommandCommandHandler + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) + */ + IMPORT_C static CGlxCommandHandlerRename* NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem ); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerRename(); + +protected: + /* + * + */ + void PopulateToolbarL(); + +private: // From CGlxMpxCommandCommandHandler + + /** @ref CGlxMpxCommandCommandHandler::CreateCommandL */ + CMPXCommand* CreateCommandL( TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume ) const; + + /** @ref CGlxMpxCommandCommandHandler::HandleErrorL */ + void HandleErrorL( TInt aErrorCode ); + +private: + /** + * Callback functions to handle an error + */ + static TBool HandleErrorL(TAny* aPtr); + inline void HandleErrorL(); + +private: + /** Second phase constructor */ + void ConstructL(); + + /** + * Constructor + * @param aMediaListProvider object that provides the media list + */ + CGlxCommandHandlerRename( MGlxMediaListProvider* aMediaListProvider, + TBool aHasToolbarItem ); + + /** + * Helper function to retrieve the title of the currently selected item. + * If none is selected, the title of the item with focus is returned. + * @param aTitle the title of the selected item + * @param aList the media list containing the item + */ + void GetTitleL( TDes& aTitle, MGlxMediaList& aList ) const; + +private: + /// Owned, the resource file offset + TInt iResourceOffset; + // Owned, new name + HBufC* iRenameText; + /// Owned, error value from HandleErrorL + TInt iError; + /// Owned, callback object for HandleErrorL + CAsyncCallBack* iErrorCallback; + }; + +#endif // __C_GLXCOMMANDHANDLERRENAME_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerrotate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerrotate.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2008-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: Rotate command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERROTATE_H +#define C_GLXCOMMANDHANDLERROTATE_H + +// INCLUDES + +#include +#include +#include + +#include +#include +// FORWARD DECLARATIONS + +class CGlxDefaultAttributeContext; +class CGlxDefaultThumbnailContext; +class CGlxUiUtility; +class CGlxVisualListManager; +class MGlxLayoutOwner; + +// CLASS DECLARATION + +// CLASS DECLARATION + +/** + * Command to rotate the thumbnail in full screen view to better fit the aspect + * ratio of the screen. + * + * @ingroup glx_group_command_handlers + */ +NONSHARABLE_CLASS (CGlxCommandHandlerRotate) + : public CGlxMediaListCommandHandler, public MGlxMediaListObserver + { +public: + /** + * Two-phased constructor. + * @param aMediaListProvider Source of media list + * @param aLayoutOwner Owner of Layout to append rotate layout to + * @param aLayoutIndex Index of layout to append rotate layout to + */ + IMPORT_C static CGlxCommandHandlerRotate* NewL( + MGlxMediaListProvider* aMediaListProvider, + MGlxLayoutOwner* aLayoutOwner = NULL, + TInt aLayoutIndex = 0); + + /** + * Destructor. + */ + ~CGlxCommandHandlerRotate(); + +private: // From CGlxMediaListCommandHandler + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + void DoActivateL(TInt aViewId); + void Deactivate(); + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: // From MGlxMediaListObserver + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + void HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* aList); + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: + /** + * C++ default constructor. + * @param aMediaListProvider Source of media list + * @param aLayoutOwner Owner of Layout to append rotate layout to + * @param aLayoutIndex Index of layout to append rotate layout to + */ + CGlxCommandHandlerRotate(MGlxMediaListProvider* aMediaListProvider, + MGlxLayoutOwner* aLayoutOwner, TInt aLayoutIndex); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Rotate the Image Using antriksh animation. + */ + void DoRotateL(MGlxMediaList& aList, TInt aAngle); + /** + * Calculate and Update the image's Exif data with final orientation. + */ + void DoPreserveOrientationL(); + /** + * Calculate the final orientation from the previous orientation and the final rotation angle. + */ + TInt DoCalculateOrientationL(TInt aInitialOrientation); + /** + * Initializes class variables required for rotation + */ + void DoInitializeRotationParametersL(); + /** + * Cleans up all class variables used for rotation + */ + void DoCleanupRotationParametersL(); +private: // Data + /** ID of owning view */ + TInt iViewId; + /** Visual list manager */ + CGlxVisualListManager* iVisualListManager; + /** HUI utility */ + CGlxUiUtility* iUiUtility; + /** Attribute context */ + CGlxDefaultAttributeContext* iAttributeContext; + /** Thumbnail context for portrait thumbnails */ + CGlxDefaultThumbnailContext* iPortraitThumbnailContext; + /** Visual list containing the rotated visual */ + MGlxVisualList* iVisualList; + /** Visual to which the rotation is applied (not owned) */ + CAlfVisual* iVisual; + + /** Layout to split layout chain to focused item */ + TGlxLayoutSplitter iSplitter; + /** Layout to rotate the focused item */ + TGlxRotationLayout iLayout; + /** Whether the command is shown in the active palette */ + TBool iShowInToolbar; + /** Whether the command is available in the current view state */ + TBool iRotationAvailable; + /** Whether we have rotated the visual */ + TBool iRotationApplied; + /** Which tooltip to show */ + TBool iViewPortrait; + + /// The layout owner + MGlxLayoutOwner* iLayoutOwner; + /// The index of the layout to request from the owner + TInt iLayoutIndex; + /// The layout to append the rotate layout to + MGlxLayout* iLayoutToFollow; + MGlxMediaList* iMediaList; //not owned do not delete + TInt iRotationAngle; + TFileName iFileToBeRotated; + TFileName iTempFile; + RFs iFs; + TUint16 iInitialOrientation; + RFile iFileHandle; + HBufC8* iExifData; + CExifModify* iExifWriter; + TBool iDoAttemptToSaveFile; + const TGlxMedia* iGlxItem; + TBool iAddedObserver; + + }; + +#endif // C_GLXCOMMANDHANDLERROTATE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlersave.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlersave.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +#ifndef __C_GLXCOMMANDHANDLERSAVE_H__ +#define __C_GLXCOMMANDHANDLERSAVE_H__ + +#include +#include +#include + +class MGlxMediaListProvider; +class CGlxUiUtility; + +/** + * @class CGlxCommandHandlerSave + * + * Command handler that deletes selected items from a media list. + * + */ + +NONSHARABLE_CLASS( CGlxCommandHandlerSave) + : public CGlxMpxCommandCommandHandler + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) + * @return pointer to CGlxCommandHandlerSave object + */ + IMPORT_C static CGlxCommandHandlerSave* NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerSave(); + +public: // From CGlxMpxCommandCommandHandler + /** See @ref CGlxMpxCommandCommandHandler::CreateCommandL */ + virtual CMPXCommand* CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const; + +public: // From CGlxCommandHandler + /** See @ref CGlxCommandHandler::DoActivateL */ + void DoActivateL(TInt aViewId); + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + /** See @ref CGlxCommandHandler::OfferKeyEventL */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + +protected: + /** See @ref CGlxCommandHandler::PopulateToolbar*/ + void PopulateToolbarL(); + +private: + /** Second phase constructor */ + void ConstructL(); + + /** Constructor */ + CGlxCommandHandlerSave(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem); + + +private: + /// Resource file offset + TInt iResourceOffset; + + + CGlxUiUtility* iUiUtility; + // Not own + CGlxImageViewerManager* iImageViewerInstance; + }; + + +#endif // __C_GLXCOMMANDHANDLERSAVE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlersend.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlersend.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2008-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: Send commmand handler +* +*/ + + + + +#ifndef __GLXCOMMANDHANDLERUPLSEND_H__ +#define __GLXCOMMANDHANDLERUPLSEND_H__ + + +// EXTERNAL INCLUDES + +#include + +// INTERNAL INCLUDES +#include "glxmedialistcommandhandler.h" + + +// FORWARD DECLARATIONS +class MGlxMediaListProvider; +class CGlxUiUtility; +class CGlxDefaultAttributeContext; +class CMessageData; +class CGlxMedia; +class CSendUi; + + +// CLASS DECLARATION +/** + * Command handler that enables the send plugin + * class CGlxCommandHandlerSend + * @author Loughlin Spollen + * @internal reviewed 07/06/2007 by Alex Birkett + */ + +NONSHARABLE_CLASS (CGlxCommandHandlerSend) : public CGlxMediaListCommandHandler, + public MGlxMediaListObserver + { +public: // Constructors and destructor + /** + * Two-phased constructor. + * @param aMediaListProvider pointer to media list owner + * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) + * @return pointer to CGlxCommandHandlerSend object + */ + IMPORT_C static CGlxCommandHandlerSend* NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem ); + + /** + * Destructor. + */ + IMPORT_C ~CGlxCommandHandlerSend(); + +protected: + /* + * + */ + void PopulateToolbarL(); + +private: + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * C++ default constructor. + * @param aMediaListProvider pointer to media list owner + * @ref CGlxMediaListCommandHandler + */ + CGlxCommandHandlerSend(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem ); + + +private: // From CGlxMediaListCommandHandler + /** + * Execute the command, if applicable. + * @param aCommand The command to handle + * @param aList List of media items + * @return ETrue if command was handled, EFalse otherwise + * @ref CGlxMediaListCommandHandler::DoExecuteL + */ + TBool DoExecuteL (TInt aCommandId, MGlxMediaList& aList); + + /** + * Called when the owning view is activated + * @param aViewId The ID of the view + * @ref CGlxMediaListCommandHandler::ActivateL + */ + void DoActivateL (TInt aViewId); + + /** + * Called when the owning view is deactivated + */ + void Deactivate(); + + /** + * @ref CGlxMediaListCommandHandler::OfferKeyEventL + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + +private: // From MGlxMediaListObserver + + /** + * not implemented + * @ref MGlxMediaListObserver::HandleItemAddedL + */ + void HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/){}; + /** + * not implemented + * @ref MGlxMediaListObserver::HandleMediaL + */ + void HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/){}; + + /** + * not implemented + * @ref MGlxMediaListObserver::HandleItemRemovedL + */ + void HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/){}; + + /** + * not implemented + * @ref MGlxMediaListObserver::HandleItemModifiedL + */ + void HandleItemModifiedL(const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/){}; + + /** + * not implemented + * @ref MGlxMediaListObserver::HandleAttributesAvailableL + */ + void HandleAttributesAvailableL(TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, + MGlxMediaList* /*aList*/){}; + + /** + * is implemented - used to trigger an update of the visible state send + * active palette item + * @ref MGlxMediaListObserver::HandleFocusChangedL + */ + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList); + + /** + * not implemented + * @ref MGlxMediaListObserver::HandleItemSelectedL + */ + void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, + MGlxMediaList* /*aList*/){}; + + /** + * not implemented + * @ref MGlxMediaListObserver::HandleMessageL + */ + void HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/){}; + +private: // methods local to class + /** + * Retrieve the currently selected items file name and path + * @return The currently selected items filename and path + */ + CMessageData* SelectedFilesLC(); + + /** + * Determine if the media item is of a valid type (ie video or image) + * @return ETrue if a valid type otherwise EFalse + */ + TBool IsValidTypeL(const CGlxMedia& aMedia); + + + /** + * Read the selected items uri and use it to send the items + */ + void SendSelectedItemsL(); + + /** + * Load the resource file + */ + void LoadRscFileL(); + + /** + * Return the static capabilities for sending a media item + */ + TSendingCapabilities Capabilities(); + +private: // data + + // Not owned - Provider of media list + MGlxMediaListProvider* iMediaListProvider; + + // ID of owning view + TInt iViewId; + + // Not owned - HUI utility + CGlxUiUtility* iUiUtility; + + // Not owned - Attribute context + CGlxDefaultAttributeContext* iAttributeContext; + + // Owned - the Send pop-up list, message creation and sending services + CSendUi* iSendUi; + + // Array of Send Plugins uids that should not be used + TBool iFilterOutPlugin; + + // The resource file offset + TInt iResourceOffset; + + }; + +#endif //__GLXCOMMANDHANDLERUPLSEND_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerslideshow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerslideshow.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2008-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: Slideshow command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERSLIDESHOW_H +#define C_GLXCOMMANDHANDLERSLIDESHOW_H + +#include +#include // for playback direction +#include +#include // for media list observer + +// Forward Declarations +class CGlxDefaultAttributeContext; +class MGlxMediaListProvider; +class TGlxMedia; +class CGlxUiUtility; + +/** + * @class CGlxCommandHandlerSlideshow + * + * Command handler that either launches slideshow with the selected items + * from a media list or launches the slideshow settings. + * @internal reviewed 07/06/2007 by Kimmo Hoikka + */ +NONSHARABLE_CLASS (CGlxCommandHandlerSlideshow) : + public CGlxMediaListCommandHandler, + public MGlxMediaListObserver + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aStepBack EFalse if the command handler should not change + * the path's level. E.g. this may depend on whether the view's media + * list contains media items or if it is a "list of lists" + * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) + */ + IMPORT_C static CGlxCommandHandlerSlideshow* NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aStepBack, TBool aHasToolbarItem ); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerSlideshow(); + +protected: + + /** @ref CGlxMediaListCommandHandler::ActivateL */ + void DoActivateL(TInt aViewId); + /** @ref CGlxMediaListCommandHandler::DoExecuteL */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + /// @ref CGlxMediaListCommandHandler::DoIsDisabled + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + /// @ref CGlxMediaListCommandHandler::BypassFiltersForExecute + TBool BypassFiltersForExecute() const; + /// @ref CGlxCommandHandler::PopulateToolbar + void PopulateToolbarL(); +private: // From MGlxMediaListObserver + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + void HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* aList); + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: + /** Second phase constructor */ + void ConstructL(); + + /** Constructor */ + CGlxCommandHandlerSlideshow(MGlxMediaListProvider* aMediaListProvider, + TBool aStepBack, TBool aHasToolbarItem ); + + /** + * Helper function to activate the view with the relevant playback + * direction + */ + void ActivateViewL( NShwSlideshow::TPlayDirection aPlaybackDirection ); + + /** + * Called when the owning view is deactivated + */ + void Deactivate(); + + /** + * To check whether the focused container contains any slideshow playable item. + * @param aCommandId The Command id + * @param aList MediaList reference + * @return TBool ETrue if container is not slideshow playable + */ + TBool IsSlideshowNotPlayableOnFocusedContainer(TInt aCommandId, MGlxMediaList& aList); + + /** + * To update the floating toolbar in case of non-touch + */ + void UpdateToolbar(); + +private: + // ID of owning view + TInt iViewId; + // Not owned - HUI utility + CGlxUiUtility* iUiUtility; + /// Resource file offset + TInt iResourceOffset; + // Flag to control where in the list we should be + TBool iStepBack; + // Buffer used by the stream + CBufFlat* iBufFlat; + // Storage buffer to pass the path to the view + HBufC* iBuffer; + /** Whether the command is shown in the active palette */ + TBool iShowInToolbar; + }; + +#endif // C_GLXCOMMANDHANDLERSLIDESHOW_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlersortorder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlersortorder.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2008-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: SortOrder command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERSORTORDER_H +#define C_GLXCOMMANDHANDLERSORTORDER_H + +// INCLUDES +#include +#include +#include // For TGlxFilterFactory + + +//FORWARD DECLARATION +class MGlxMediaListProvider; + +/** + * @class CGlxCommandHandlerSortOrder + * + * Command handler that changes the sorting criteria of the MediaList + * + */ +NONSHARABLE_CLASS (CGlxCommandHandlerSortOrder) + : public CGlxMediaListCommandHandler + { + + friend class ut_cglxcommandhandlersortorder; +public: + + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * @param aCRKey The settings key which used by the commandhandler + * set/get the sort order setting + */ + IMPORT_C static CGlxCommandHandlerSortOrder* NewL( + MGlxMediaListProvider* aMediaListProvider, + const TUint32 aCRKey); + + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerSortOrder(); + +protected: + + /** see CGlxMediaListCommandHandler::DoExcecuteL */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + /** see CGlxMediaListCommandHandler::DoIsDisabled */ + TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; + +private: + + /** Second phase constructor */ + void ConstructL(); + + /** + * Constructor + * @param aMediaListProvider object that provides the media list + * @param aCRKey The settings key which used by the commandhandler + * set/get the sort order setting + */ + CGlxCommandHandlerSortOrder(MGlxMediaListProvider* aMediaListProvider, + const TUint32 aCRKey); + + /** + * Finds out the current sort order applied to the media list + * @param aList reference to a media list + * @returns The current sort order + */ + TGlxFilterSortOrder CurrentSortOrder(MGlxMediaList& aList) const; + +private: // Data + + /** Holds the id of the cenrep key which needs to be queried/changed */ + TUint32 iKey; + + }; + +#endif // C_GLXCOMMANDHANDLERSORTORDER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerupload.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlerupload.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2008-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: Upload commmand handler +* +*/ + +#ifndef __GLXCOMMANDHANDLERUPLOAD_H__ +#define __GLXCOMMANDHANDLERUPLOAD_H__ + + +// EXTERNAL INCLUDES +#include "AiwServiceHandler.h" // AIW service handler + +// INTERNAL INCLUDES +#include "glxmedialistcommandhandler.h" // for MediaListCommandHandler +#include // for UiUtility + +// FORWARD DECLARATIONS +class MGlxMediaListProvider; +class CGlxDefaultAttributeContext; + +/** + * Command handler that launches Upload AIW ShareOnline + * @class CGlxCommandHandlerUpload + * @author Abhijit S + */ + +// CLASS DECLARATION + +NONSHARABLE_CLASS (CGlxCommandHandlerUpload) : public CGlxMediaListCommandHandler + { +public: // Constructors and destructor + /** + * Two-phased constructor. + * @param aMediaListProvider pointer to media list owner + * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) + * @return pointer to CGlxCommandHandlerUpload object + */ + IMPORT_C static CGlxCommandHandlerUpload* NewL(MGlxMediaListProvider* + aMediaListProvider, TBool aHasToolbarItem); + + /** + * Destructor. + */ + IMPORT_C ~CGlxCommandHandlerUpload(); + + /** + * To set the Help Text for Upload button on toolbar + */ + void SetToolTipL(); + +protected: + //@ref From CGlxCommandHandler + void PopulateToolbarL(); + +private: + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * C++ default constructor. + * @param aMediaListProvider pointer to media list owner + * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) + * @ref CGlxMediaListCommandHandler + */ + CGlxCommandHandlerUpload(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem); + + /** + * Gets the tooltip text or the Help Text from AIWServiceHandler + */ + void GetToolTipL(HBufC*& aToolTipText); + +private: // From CGlxMediaListCommandHandler + /** + * Execute the command, if applicable. + * @param aCommand The command to handle + * @param aList List of media items + * @return ETrue if command was handled, EFalse otherwise + * @ref CGlxMediaListCommandHandler + */ + TBool DoExecuteL (TInt aCommandId, MGlxMediaList& aList); + + /** + * Called when the owning view is activated + * @param aViewId The ID of the view + * @ref CGlxMediaListCommandHandler + */ + void DoActivateL (TInt aViewId); + + /** + * Called when the owning view is deactivated + */ + void Deactivate(); + +private: + /** + * Retrieve the currently selected items file name and path + * @return The currently selected items filename and path + */ + + void AppendSelectedFilesL(CAiwGenericParamList& aInputParams); + + /** + * To check whether OneClickUpload is supported by the Shareonline + * application. + * NOTE: OneClickUpload is a feature of ShareOnline 4.3 and above. Hence this function + * ensures that the upload command works only if this version of ShareOnline is + * available in the build. Else, Upload will not work! + */ + void CheckVersionL(); + + /** + * To attach the aiw share interest resource to the servicehandler + */ + void InitializeOneClickUploadL(); + +private: // data + + // ID of owning view + TInt iViewId; + + // True if ShareOnline versioned 4.3 and above is present in the build + TBool iUploadSupported; + + // Not owned - Provider of media list + MGlxMediaListProvider* iMediaListProvider; + + // Not owned - UI utility + CGlxUiUtility* iUiUtility; + + // Owned - AIW Service Handler + CAiwServiceHandler* iServiceHandler; + }; + +#endif //__GLXCOMMANDHANDLERUPLOAD_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlervideoplayback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxcommandhandlervideoplayback.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2008-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: Video Playback command handler +* +*/ + + + + +#ifndef C_GLXCOMMANDHANDLERVIDEOPLAYBACK_H +#define C_GLXCOMMANDHANDLERVIDEOPLAYBACK_H + +#include +#include // for playback direction +#include "glxmedialistcommandhandler.h" + +#include +#include +#include + +class MGlxMediaListProvider; +class CGlxUiUtility; +class CGlxDefaultAttributeContext; + +/** + * @class CGlxCommandHandlerVideoPlayback + * + * Command handler that either launches videoplayback with the selected items + * from a media list or launches the videoplayback settings. + * Author: Rowland Cook + * @internal reviewed 11/06/2007 by Alex Birkett + */ +NONSHARABLE_CLASS(CGlxCommandHandlerVideoPlayback) : + public CGlxMediaListCommandHandler, + public MGlxMediaListObserver, + public MMPXPlaybackObserver + { +public: + /** + * Two-phase constructor + * @param aMediaListProvider object that provides the media list + * + * @param aIsContainerList If ETrue, shows "videoplayback container" + * confirmation notes and does not allow + * deleting system items + + * If EFalse, shows "videoplayback item" + * confirmation notes and does not check + * for system items + + */ + IMPORT_C static CGlxCommandHandlerVideoPlayback* NewL( + MGlxMediaListProvider* aMediaListProvider); + + /** Destructor */ + IMPORT_C ~CGlxCommandHandlerVideoPlayback(); + +protected: + /** see CGlxMediaListCommandHandler::DoExcecuteL */ + virtual TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + /** see CGlxMediaListCommandHandler::DoIsDisabled */ + virtual void DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + +private: // From MGlxMediaListObserver + // See @ref MGlxMediaListObserver::HandleItemAddedL + void HandleItemAddedL(TInt /* aStartIndex */, TInt /* aEndIndex */,MGlxMediaList* /* aList */) { }; + + // See @ref MGlxMediaListObserver::HandleMediaL + void HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) { }; + + // See @ref MGlxMediaListObserver::HandleItemRemovedL + void HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) { }; + + // See @ref MGlxMediaListObserver::HandleItemModifiedL + void HandleItemModifiedL(const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) { }; + + // See @ref MGlxMediaListObserver::HandleAttributesAvailableL + void HandleAttributesAvailableL(TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList); + + // See @ref MGlxMediaListObserver::HandleFocusChangedL + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + + // See @ref MGlxMediaListObserver::HandleItemSelectedL + void HandleItemSelectedL(TInt /* aIndex */, TBool /* aSelected */, MGlxMediaList* /* aList */) { }; + + // See @ref MGlxMediaListObserver::HandleMessageL + void HandleMessageL(const CMPXMessage& /* aMessage */, MGlxMediaList* /* aList */) { }; + +private:// From MMPXPlaybackObserver + + void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ); + +private: + /** Second phase constructor */ + void ConstructL(); + + /** + * Constructor + * @param aMediaListProvider The owner of the media list to use + */ + CGlxCommandHandlerVideoPlayback(MGlxMediaListProvider* aMediaListProvider); + + /** Helper function to activate the view with the relevant playback + * direction + */ + void ActivateViewL(); + + /** Deactivate this command handler */ + void Deactivate(); + + /** Activate this command handler */ + void DoActivateL(TInt aViewId); + + /** Sets the ToolBar to the correct state */ + void SetToolBar(); + + void DoHandlePlaybackMessageL( const CMPXMessage& aMessage ); + + void HandlePlaybackPlayerChangedL(); + +private: + // Pointer to the CGlxHuiUtility (reference counted). + CGlxUiUtility* iUiUtility; + + // Pointer to an attribute context. We own this. + CGlxDefaultAttributeContext* iAttributeContext; + + // Remembers the ViewId passed in ActivateL. + TInt iViewId; + + // This is current state of the Icon displayed in the toolbar + // Initially set to EUndefined, this forces the first update + // After that we only update the toolbar if a change is necessary + enum TIconDisplayState { EUndefined, EVisible, EHidden }; + TIconDisplayState iIconDisplayState; + + MMPXPlaybackUtility* iPlaybackUtility; + MMPXViewUtility* iViewUtility; + }; + +#endif // C_GLXCOMMANDHANDLERVIDEOPLAYBACK_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxmediaselectionpopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/inc/glxmediaselectionpopup.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,380 @@ +/* +* Copyright (c) 2008-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: Selection popup +* +*/ + + + + +#ifndef __GLXMEDIASELECTIONPOPUP_H__ +#define __GLXMEDIASELECTIONPOPUP_H__ + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATION +class CAknPopupList; +class CAknSinglePopupMenuStyleListBox; +class CGlxAttributeContext; +class CGlxMediaSelectionItem; +class CGlxNewMediaPopup; +class CGlxStaticMediaList; + +const TInt KMaxTitleStringLength = 80; + +/** + * CGlxMediaListAdaptor + * + * Allows the titles in a media list + * to be accessed via the MDesCArray interface. + * The array elements are formatted for use by + * a CAknSingleGraphicPopupMenuStyleListBox. + * i.e. "\t Camera Album" where is the index of + * an icon in the icon array. + * + * @internal reviewed 06/06/2007 by Dave Schofield + */ +NONSHARABLE_CLASS( CGlxMediaListAdaptor ) + : public CBase, public MDesCArray + { +public: + /** + * Constructor + * @param aMediaList a static media list + * @param aMultiSelection set multi selection icon indices. + */ + IMPORT_C CGlxMediaListAdaptor(const MGlxMediaList* aMediaList, TBool aMultiSelection); + + /** + * Enabled / Disable the CGlxMediaListAdaptor + * if the adaptor is disabled, MdcaCount() will return 0 + * even if there are items in the media list. + * @param aEnabled ETrue to enable EFalse to disable. + **/ + void SetEnabled(TBool aEnabled); + + /** + * Returns a pointer to the media list. + */ + const MGlxMediaList* MediaList(); + + /** + * Returns ETrue if multi selection is + * enabled else EFalse. + */ + TBool MultiSelectionEnabled(); + +public: // from MDesCArray + /** See @ref MDesCArray::MdcaCount */ + IMPORT_C TInt MdcaCount() const; + /** See @ref MDesCArray::MdcaPoint */ + IMPORT_C TPtrC MdcaPoint(TInt aIndex) const; + +private: + const MGlxMediaList* iMediaList; // not owned + + /** + * A temporary buffer to store the current title string + */ + mutable TBuf iCurrentTitleString; + + /** + * ETrue if multi selection is enabled else EFalse + */ + TBool iMultiSelection; + + /** + * If ETrue, MdcaCount() returns the number of items in + * the media list (iMediaList). If EFasle MdcaCount() + * returns 0. + */ + TBool iEnabled; + }; + +/** + * CGlxSingleGraphicPopupMenuStyleListBox + * + * Adds behaviour to CAknSingleGraphicPopupMenuStyleListBox: + * If the currently selected item has a TMPXGeneralCateroy + * equal to EMPXCommand, item selection will be disabled; Pressing + * the OK key will result in the item being actioned. + * + * This is achieved by disabling multiple selection if the OK is + * pressed when the currently selected item has TMPXGeneralCateroy equal + * to EMPXCommand. + * + * @internal reviewed 06/06/2007 by Dave Schofield + */ +NONSHARABLE_CLASS( CGlxSingleGraphicPopupMenuStyleListBox ) + : public CAknSingleGraphicPopupMenuStyleListBox, + public MEikListBoxObserver + { +public: // new + /** + * Determines if a particular item is visible. + * @param aItemIndex index of the item + * @return ETrue if the item is visible, else EFalse + */ + TBool IsVisible(TInt aItemIndex); + + /** + * Populates iPopupList with the parameter passed. + * @param aPopupList Pointer to CAknPopupList object + */ + void SetPopupList(CAknPopupList* aPopupList); + +public: // from CCoeControl + /** See @ref CCoeControl::OfferKeyEventL */ + IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + //From MEikListBoxObserver + void HandleListBoxEventL (CEikListBox *aListBox, TListBoxEvent aEventType) ; + void HandlePointerEventL(const TPointerEvent& aPointerEvent) ; + +private: + + /** + * The popup list. (Owned) + */ + CAknPopupList* iPopupList; + + }; + +/** + * CGlxMediaSelectionPopup + * + * Generic Selection popup class definition. Shows a popup from user + * can select a media object, or to create a new one. Retrieves + * popup title and "new item" text from collection plugin, + * to avoid need for client to configure the class. + * + * @image html glx_command_media_selection_popup_class_diagram.png + * @image rtf glx_command_media_selection_popup_class_diagram.png + * + * The media selection popup uses CGlxCommandHandlerNewMedia to create + * a new media object + * + * @image html glx_command_select_media_sequence_diagram.png + * @image rtf glx_command_select_media_sequence_diagram.png + * + * @lib glxcommoncommandhandlers.lib + * + * @internal reviewed 06/06/2007 by Dave Schofield + */ +NONSHARABLE_CLASS(CGlxMediaSelectionPopup) + : public CActive , + public MGlxMediaListObserver, + public MListBoxItemChangeObserver, + public MGlxMediaListProvider + { +public: + IMPORT_C CGlxMediaSelectionPopup(); + + /** + * Execute the popup. + * The L in the method name indicates the function might leave. + * The D in the method name indicates that the method will destroy the object it is called on. i.e + * delete the this pointer. + * @param aPath a path containing the UID of the collection to select items from. + * @param aAccepted will be set to ETrue if OK was pressed on the dialog else EFalse. + * @param aMultiSelection Create a multi selection dialog. + * @param aEnableContainerCreation Enable container creation. + * @param aFilter Filter items displayed by the popup. + * @return if aAccepted is ETrue: A CMPXCollectionPath containing the selection + * (the caller takes ownership of this object). + * if aAccepted is EFalse: NULL + **/ + IMPORT_C CMPXCollectionPath* ExecuteLD(CMPXCollectionPath& aPath, + TBool& aAccepted, + TBool aMultiSelection, + TBool aEnableContainerCreation, + CMPXFilter* aFilter = NULL); +private: + /** + * Destructor + */ + ~CGlxMediaSelectionPopup(); + +public: // from CActive + /** See @ref CActive::RunL */ + void RunL(); + /** See @ref CActive::DoCancel */ + void DoCancel(); + +private: // from MListBoxItemChangeObserver + /** see @ref MListBoxItemChangeObserverL::ListBoxItemsChanged **/ + void ListBoxItemsChanged(CEikListBox* aListBox); + +private: // from MGlxMediaListObserver + /** see @ref MGlxMediaListObserver::HandleItemAddedL **/ + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleMediaL **/ + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleItemRemovedL **/ + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleItemModifiedL **/ + void HandleItemModifiedL( const RArray& aItemIndexes, + MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleAttributesAvailableL **/ + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleFocusChangedL **/ + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleItemSelectedL **/ + void HandleItemSelectedL( TInt aIndex, TBool aSelected, + MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleMessageL **/ + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + + /** see @ref MGlxMediaListObserver::HandleError **/ + void HandleError( TInt aError ); + +private: // from MGlxMediaListProvider + /** see @ref MGlxMediaList::MediaList **/ + MGlxMediaList& MediaList(); + +private: + /** + * Adds the glxcommoncommandhandlers resource file. + */ + void AddResourceFileL(); + + /** + * Instantiates the attirbute context and adds it to the + * static media list. + */ + void SetupAttributeContextL(); + + /** + * Initialises the icon array. + */ + void InitIconsL(); + + /** + * Adds the static item(s) to the static + * media list. The static item represent + * the creation of a new container (album + * or tag) + */ + void AddNewMediaCreationItemL(); + + /** + * Complete the active object. + * Invokes an asynchronous call to RunL() + */ + void CompleteSelf(); + + /** + * Fetches the 'New Media Item Title' and the 'Media Popup Title'. + */ + void FetchTitlesL(); + + /** + * Instantiates the CAknPopupList and + * CGlxSingleGraphicPopupMenuStyleListBox + * @param aMultiSelection Create a multi selection dialog. + */ + void ConstructPopupListL(TBool aMultiSelection); + +private: + /** + * The list of selected items. (Owned) + */ + CGlxMediaListAdaptor* iMediaListAdaptor; + + /** + * The list box used by popup. (Owned) + */ + CGlxSingleGraphicPopupMenuStyleListBox* iListBox; + + /** + * The popup list. (Owned) + */ + CAknPopupList* iPopupList; + + /** + * Resource offset + */ + TInt iResourceOffset; + + /** + * Media list. (Owned) + */ + MGlxMediaList* iMediaList; + + /** + * Attribute context. (Owned) + */ + CGlxAttributeContext* iAttributeContext; + + /** + * Sequential iterator. + */ + TGlxSequentialIterator iIterator; + + /** + * Enable container creation. + * ETrue if container creation is enabled. + */ + TBool iEnableContainerCreation; + + /** + * Media popup title. (Owned) + */ + HBufC* iSelectMediaPopupTitle; + + /** + * New media item title. (Owned) + */ + HBufC* iNewMediaItemTitle; + + /** + * The ID of the collection used to retrieve collection + * specific attributes. + */ + TGlxMediaId iCollectionId; + + /** + * A call to HandleItemAdditionL on the list box + * is required when title attributes become available. + */ + TBool iHandleItemAdditionRequired; + }; + +#endif // __GLXMEDIASELECTIONPOPUP_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/rom/glxcommoncommandhandlers.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/rom/glxcommoncommandhandlers.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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: Photos / glxcommandhanlder's iby file. +* +*/ + + + + +#ifndef __GLXCOMMONCOMMANDHANDLERS_IBY__ +#define __GLXCOMMONCOMMANDHANDLERS_IBY__ + +file=ABI_DIR\BUILD_DIR\glxcommoncommandhandlers.dll SHARED_LIB_DIR\glxcommoncommandhandlers.dll + +#endif // __GLXCOMMONCOMMANDHANDLERS_IBY__ + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/rom/glxcommoncommandhandlers_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/rom/glxcommoncommandhandlers_resources.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Photos / glxcommandhanlder's iby file. +* +*/ + + + + +#ifndef __GLXCOMMONCOMMANDHANDLERS_RESOURCES_IBY__ +#define __GLXCOMMONCOMMANDHANDLERS_RESOURCES_IBY__ + +data=DATAZ_\APP_RESOURCE_DIR\glxcommoncommandhandlers.rsc APP_RESOURCE_DIR\glxcommoncommandhandlers.rsc + +#endif // __GLXCOMMONCOMMANDHANDLERS_RESOURCES_IBY__ + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxaiwmedia.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxaiwmedia.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008-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: Photos AIW Media Contains AIW (InParam) information +* +*/ + + + + +#include +#include "glxaiwmedia.h" +#include // for GLX_ASSERT_DEBUG + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxAiwMedia::CGlxAiwMedia(const TGlxMediaId& aId) +: iId(aId) + { + + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxAiwMedia::~CGlxAiwMedia() + { + iParamArray.Close(); + } + + +// ----------------------------------------------------------------------------- +// AddParamL +// ----------------------------------------------------------------------------- +// +TBool CGlxAiwMedia::AddParamL(const TAiwGenericParam& aParam) + { + if (KErrNotFound == iParamArray.Find(aParam)) + { +/* +#ifdef __WINSCW__ + // Big hack! replace "video/MP4V-ES" with "video/mp4" + // Hack to be removed when TSW error: VKAN-77D92E is released + TAiwGenericParam MimeType1( EGenericParamMIMEType, TAiwVariant( _L("video/MP4V-ES") )); + TAiwGenericParam MimeType2( EGenericParamMIMEType, TAiwVariant( _L("video/mp4") )); + + if (aParam == MimeType1) + { + iParamArray.AppendL(MimeType2); + } + else + { + iParamArray.AppendL(aParam); + } +#else + iParamArray.AppendL(aParam); +#endif +*/ + iParamArray.AppendL(aParam); + return ETrue; + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// AppendToInParamsL +// ----------------------------------------------------------------------------- +// +void CGlxAiwMedia::AppendToInParamsL(CAiwGenericParamList& aInParams) + { + for (TInt index = 0; index < iParamArray.Count() ; index++ ) + { + TAiwGenericParam& param = iParamArray[index]; + aInParams.AppendL(param); + } + iParamArray.Reset(); + } + +// ----------------------------------------------------------------------------- +// Id +// ----------------------------------------------------------------------------- +// +const TGlxMediaId& CGlxAiwMedia::Id() const + { + return iId; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxaiwservicehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxaiwservicehandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,310 @@ +/* +* Copyright (c) 2008-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: Photos command handler base class +* +*/ + + + + +#include + +#include "glxaiwservicehandler.h" +#include "glxaiwmedia.h" +#include "AiwServiceHandler.h" + +// ----------------------------------------------------------------------------- +// InstanceL +// ----------------------------------------------------------------------------- +// +CGlxAiwServiceHandler* CGlxAiwServiceHandler::InstanceL() + { + return CGlxSingletonStore::InstanceL(&NewL); + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::Close() + { + CGlxSingletonStore::Close( this ); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxAiwServiceHandler* CGlxAiwServiceHandler::NewL() + { + CGlxAiwServiceHandler* self = new (ELeave) CGlxAiwServiceHandler(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxAiwServiceHandler::CGlxAiwServiceHandler() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxAiwServiceHandler::~CGlxAiwServiceHandler() + { + iAiwMediaArray.ResetAndDestroy(); + iAiwMediaArray.Close(); + delete iAiwServiceHandler; + } + +// ----------------------------------------------------------------------------- +// 2nd phase constructor +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::ConstructL() + { + iAiwServiceHandler = CAiwServiceHandler::NewL(); + } + +// ----------------------------------------------------------------------------- +// AddParamL +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::AddParamL(const TGlxMediaId& aId, const TAiwGenericParam& aParam ) + { + // This method is called to add parameters to the iInParams. + // This should be called by each command handler before InitializeMenuPaneL is called at all. + // This ensures that the entire list on InParams is built for all command handlers before + // initializing the menu. + // When InitializeMenuPaneL is called it destroys the inParams making it necessary to + // aquire and append to the iInParams again should this be necessary. + + if ( ENotInitialised != iInitialisedMenu ) + { + // This is either the very first time or the first time since calling InitializeMenuPaneL + iInitialisedMenu = ENotInitialised; + // Set iInParams to Null. This will force a call to the service Handler to aquire + // the pointer to the new set of InParams (yet to be appended too). + iInParams = NULL; + } + + if (!iInParams) + { + // Must aquire a pointer to the new set of InParams + iInParams = &iAiwServiceHandler->InParamListL(); + } + + // Get the Index of the TGlxMediaId in the array + TInt index = FindId(aId); + CGlxAiwMedia* media = NULL; + + if (KErrNotFound == index) + { + // The TGlxMediaId was not found. so create a new entry + media = new (ELeave) CGlxAiwMedia(aId); + CleanupStack::PushL(media); + TLinearOrder orderer (&AiwMediaOrderById); + iAiwMediaArray.InsertInOrderL(media, orderer); + CleanupStack::Pop(media); + } + else + { + // The TGlxMediaId was found so use the current entry + media = iAiwMediaArray[index]; + } + + // Add the parameter (method checks for duplicates. + media->AddParamL(aParam); + + } + +// ----------------------------------------------------------------------------- +// FindId +// ----------------------------------------------------------------------------- +// +TInt CGlxAiwServiceHandler::FindId(const TGlxMediaId& aId) + { + // Now we can find the CGlxAiwMedia in the list with an Id equal to aId + TInt index = iAiwMediaArray.FindInOrder(aId, (&AiwMediaOrderByMediaId)); + + return index; + + } + +// ----------------------------------------------------------------------------- +// AiwMediaOrderByMediaId (static method) +// ----------------------------------------------------------------------------- +// +TInt CGlxAiwServiceHandler::AiwMediaOrderByMediaId( const TGlxMediaId* aMediaId, const CGlxAiwMedia& aAiwMedia ) + { + const TGlxMediaId& Id = aAiwMedia.Id(); + + if (*aMediaId < Id) + { + return -1; + } + if (*aMediaId > Id) + { + return 1; + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// AiwMediaOrderById (static method) +// ----------------------------------------------------------------------------- +// +TInt CGlxAiwServiceHandler::AiwMediaOrderById( const CGlxAiwMedia& aAiwMedia1, const CGlxAiwMedia& aAiwMedia2 ) + { + const TGlxMediaId& mediaId = aAiwMedia1.Id(); + + return AiwMediaOrderByMediaId(&mediaId, aAiwMedia2); + } + +// ----------------------------------------------------------------------------- +// AppendInParamsL +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::AppendInParamsL() + { + // Iterate through array backwards because removing the last tem causes + // little effort. + + TInt count = 0; + + while ((count = iAiwMediaArray.Count()) > 0) + { + // get the last element + CGlxAiwMedia* media = iAiwMediaArray[count - 1]; + + // Now get all the parameters associated with the element + media->AppendToInParamsL(*iInParams); + + // Remove it from array + iAiwMediaArray.Remove(count - 1); + // Destroy the CGlxAiwMedia + delete media; + } + // Tidy up the array + iAiwMediaArray.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// ResetMenuInitialisedFlag +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::ResetMenuInitialisedFlag() + { + iInitialisedMenu = ENotInitialised; + // Also set params list to NULL before creating new params list + iInParams = NULL; + } + +// ----------------------------------------------------------------------------- +// InitializeMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::InitializeMenuPaneL(CEikMenuPane& aMenuPane, TInt aResourceId, TInt aBaseMenuCmdId) + { + // All the parameters for all command handlers should now be appended in iInParams + // Calling InitializeMenuPaneL will destroy the values in iInParams. Hence the need to + // record when this is done by using iIsMenuInitialized. + + if ( ENotInitialised == iInitialisedMenu ) + { + AppendInParamsL(); + + if(iInParams) + { + iAiwServiceHandler->InitializeMenuPaneL(aMenuPane, aResourceId, aBaseMenuCmdId, *iInParams); + } + + iInitialisedMenu = EMainMenuInitialised; + } + } + +// ----------------------------------------------------------------------------- +// AttachMenuL +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::AttachMenuL(TInt aMenuResource, TInt aAiwInterestResource) + { + iAiwServiceHandler->AttachMenuL( aMenuResource, aAiwInterestResource ); + } + +// ----------------------------------------------------------------------------- +// IsSameCommand +// ----------------------------------------------------------------------------- +// +TBool CGlxAiwServiceHandler::IsSameCommand(TInt aCommandId, TInt aAiwCommandId) + { + return ( iAiwServiceHandler->ServiceCmdByMenuCmd( aCommandId ) == aAiwCommandId ); + } + +// ----------------------------------------------------------------------------- +// ExecuteMenuCmdL +// ----------------------------------------------------------------------------- +// +void CGlxAiwServiceHandler::ExecuteMenuCmdL(TInt aMenuCmdId, TUint aCmdOptions, MAiwNotifyCallback* aCallback) + { + CAiwGenericParamList& outParams = iAiwServiceHandler->OutParamListL(); + + iAiwServiceHandler->ExecuteMenuCmdL(aMenuCmdId, *iInParams, outParams, aCmdOptions, aCallback); + } + +// ----------------------------------------------------------------------------- +// HandleSubmenuL +// ----------------------------------------------------------------------------- +// + +TBool CGlxAiwServiceHandler::HandleSubmenuL(CEikMenuPane& aPane) + { + // If main menu is initialize then only check for submenu + if ( EMainMenuInitialised == iInitialisedMenu ) + { + if ( iAiwServiceHandler->HandleSubmenuL(aPane) ) + { + iInitialisedMenu = ESubMenuInitialised; + } + } + return ( ESubMenuInitialised == iInitialisedMenu ); + } + +// ----------------------------------------------------------------------------- +// IsAiwMenu +// ----------------------------------------------------------------------------- +// +TBool CGlxAiwServiceHandler::IsAiwMenu(TInt aMenuResourceId) + { + return iAiwServiceHandler->IsAiwMenu(aMenuResourceId); + } + +// ----------------------------------------------------------------------------- +// GetInParams (for testing only) +// ----------------------------------------------------------------------------- +// +CAiwGenericParamList& CGlxAiwServiceHandler::GetInParams() + { + return *iInParams; + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraddtocontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraddtocontainer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2008-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: Add to container command handler +* +*/ + + + + +/** + * @internal reviewed 05/06/2007 by Dave Schofield + */ + +#include "glxcommandhandleraddtocontainer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "glxmediaselectionpopup.h" +#include + +TInt CGlxCommandHandlerAddToContainer::iSelectionCount = 0; + +// --------------------------------------------------------------------------- +// Return add to album command handler +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAddToContainer* + CGlxCommandHandlerAddToContainer::NewAddToAlbumCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + { + return CGlxCommandHandlerAddToContainer::NewL (aMediaListProvider, + EGlxCmdAddToAlbum, aHasToolbarItem); + } + +// --------------------------------------------------------------------------- +// Return add (to) tags command handler +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAddToContainer* + CGlxCommandHandlerAddToContainer::NewAddToTagCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + { + return CGlxCommandHandlerAddToContainer::NewL(aMediaListProvider, + EGlxCmdAddTag, aHasToolbarItem); + } + +// --------------------------------------------------------------------------- +// Return add (to) Favourites command handler +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAddToContainer* + CGlxCommandHandlerAddToContainer::NewAddToFavCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + { + return CGlxCommandHandlerAddToContainer::NewL(aMediaListProvider, + EGlxCmdAddToFavourites, aHasToolbarItem); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAddToContainer* CGlxCommandHandlerAddToContainer::NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aCommandId, TBool aHasToolbarItem) + { + CGlxCommandHandlerAddToContainer* self = + new ( ELeave ) CGlxCommandHandlerAddToContainer( aMediaListProvider, aHasToolbarItem ); + CleanupStack::PushL( self ); + self->ConstructL( aCommandId ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerAddToContainer::CGlxCommandHandlerAddToContainer( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + : CGlxMpxCommandCommandHandler( aMediaListProvider, aHasToolbarItem ) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerAddToContainer::ConstructL(TInt aCommandId) + { + // Load resource + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + // Reset the Flag inorder to allow for a new selection pop-up to be created. + iIsProcessOngoing = EFalse; + // Add supported command + TCommandInfo info(aCommandId); + + // Filter out static items - user must have selected at least one item to + // enable the command handler + const TInt KGlxCommandHandlerMinSelectionAllowSingle = 1; + info.iMinSelectionLength = KGlxCommandHandlerMinSelectionAllowSingle; + + AddCommandL(info); + iCommandId = aCommandId; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAddToContainer::~CGlxCommandHandlerAddToContainer() + { + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + // Reset the Flag inorder to allow for a new selection pop-up to be created. + iIsProcessOngoing = EFalse; + } + +// --------------------------------------------------------------------------- +// Create an add to container command +// --------------------------------------------------------------------------- +// +CMPXCommand* CGlxCommandHandlerAddToContainer::CreateCommandL(TInt aCommandId, + MGlxMediaList& aMediaList, TBool& /*aConsume*/) const + { + // Ignore the current command in case the previous command has still not been completed + if(iIsProcessOngoing) + { + return NULL; + } + iSelectionCount = 0; + // Set the Flag inorder to block any new subsequent selection pop-ups from getting created. + iIsProcessOngoing = ETrue; + CMPXCollectionPath* targetCollection = CMPXCollectionPath::NewL(); + CleanupStack::PushL(targetCollection); + TBool enableMultipleSelection = EFalse; + TBool enablePopup = EFalse; + CMPXFilter* filter = NULL; + switch(aCommandId) + { + case EGlxCmdAddToFavourites: + { + targetCollection->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + // The target collection has also to be appeneded with the the relation id. + // appending another level into the albums to get favourites and 1 is the relation id of albums + targetCollection->AppendL( TMPXItemId(1) ); + targetCollection->Set( 0 ); + break; + } + case EGlxCmdAddToAlbum: + { + enablePopup = ETrue; + targetCollection->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + filter = TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(); + CleanupStack::PushL(filter); + break; + } + case EGlxCmdAddTag: + { + enableMultipleSelection = ETrue; + enablePopup = ETrue; + targetCollection->AppendL(KGlxTagCollectionPluginImplementationUid); + filter = TGlxFilterFactory::CreateIncludeEmptyContainersFilterL(); + CleanupStack::PushL(filter); + break; + } + } + + CMPXCollectionPath* sourceItems = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); + CMPXCommand* command = NULL; + if (enablePopup ) + { + CGlxMediaSelectionPopup* popup = new (ELeave) CGlxMediaSelectionPopup; + + TBool accepted = EFalse; + CMPXCollectionPath* targetContainers = + popup->ExecuteLD(*targetCollection, accepted, enableMultipleSelection, ETrue, filter); + + if (accepted) + { + // Set the container selection count to give correct completion text + TArray selection = targetContainers->Selection(); + iSelectionCount = selection.Count(); + + CleanupStack::PushL(targetContainers); + command = TGlxCommandFactory::AddToContainerCommandLC( + *sourceItems, *targetContainers); + CleanupStack::Pop(command); + CleanupStack::PopAndDestroy(targetContainers); + } + else + { + // Reset the Flag inorder to allow any new selection pop-up to be created. + iIsProcessOngoing = EFalse; + } + } + else + { + command = TGlxCommandFactory::AddToContainerCommandLC( + *sourceItems, *targetCollection); + CleanupStack::Pop(command); + } + CleanupStack::PopAndDestroy(sourceItems); + if (filter) + { + CleanupStack::PopAndDestroy(filter); + } + CleanupStack::PopAndDestroy(targetCollection); + return command; + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAddToContainer::CompletionTextL +// ----------------------------------------------------------------------------- +// +HBufC* CGlxCommandHandlerAddToContainer::CompletionTextL() const + { + if (iCommandId == EGlxCmdAddToAlbum) + { + if (iSelectionCount > 1) + { + return StringLoader::LoadL(R_GLX_COMPLETION_ADD_TO_CONTAINER_MULTI_ITEM_ALBUM); + } + return StringLoader::LoadL(R_GLX_COMPLETION_ADD_TO_CONTAINER_ONE_ITEM_ALBUM); + } + else if (iCommandId == EGlxCmdAddTag) + { + if (iSelectionCount > 1) + { + return StringLoader::LoadL(R_GLX_COMPLETION_ADD_TO_CONTAINER_MULTI_ITEM_TAG); + } + return StringLoader::LoadL(R_GLX_COMPLETION_ADD_TO_CONTAINER_ONE_ITEM_TAG); + } + else // considered as favourites + { + return StringLoader::LoadL(R_GLX_COMPLETION_ADD_TO_FAVOURITES); + } + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAddToContainer::DoHandleCommandCompleteL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAddToContainer::DoHandleCommandCompleteL(TAny* /*aSessionId*/, + CMPXCommand* /*aCommandResult*/, TInt /*aError*/, MGlxMediaList* /*aList*/) + { + // Reset the Flag inorder to allow any new selection pop-up to be created. + iIsProcessOngoing = EFalse; + } + +// --------------------------------------------------------------------------- +// CGlxCommandHandlerAddToContainer::DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerAddToContainer::DoActivateL(TInt /*aViewId*/) + { + + } + +void CGlxCommandHandlerAddToContainer::PopulateToolbarL() + { + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwassign.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwassign.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2008-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: AIW assign command handler +* +*/ + + + + +#include "glxcommandhandleraiwassign.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "glxaiwservicehandler.h" + +const TInt KGlxAiwAssignCommandSpace = 0x00000100; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAiwAssign* CGlxCommandHandlerAiwAssign::NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) + { + TRACER("CGlxCommandHandlerAiwAssign* CGlxCommandHandlerAiwAssign::NewL"); + CGlxCommandHandlerAiwAssign* self = new ( ELeave ) + CGlxCommandHandlerAiwAssign(aMediaListProvider, aMenuResource); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwAssign::CGlxCommandHandlerAiwAssign( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) +: CGlxCommandHandlerAiwBase(aMediaListProvider, aMenuResource) + { + TRACER("CGlxCommandHandlerAiwAssign::CGlxCommandHandlerAiwAssign"); + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwAssign::DoGetRequiredAttributesL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwAssign::DoGetRequiredAttributesL + (RArray& aAttributes, TBool aFilterUsingSelection) const + { + TRACER("void CGlxCommandHandlerAiwAssign::DoGetRequiredAttributesL"); + // Add MIME type and filename attributes + if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems()) + { + aAttributes.AppendL(KMPXMediaGeneralMimeType); + aAttributes.AppendL(KMPXMediaGeneralUri); + aAttributes.AppendL(KMPXMediaGeneralCategory); + } + } + +// ----------------------------------------------------------------------------- +// CommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwAssign::CommandId() const + { + TRACER("TInt CGlxCommandHandlerAiwAssign::CommandId() const"); + return EGlxCmdAiwAssign; + } + +// ----------------------------------------------------------------------------- +// AiwCommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwAssign::AiwCommandId() const + { + TRACER("TInt CGlxCommandHandlerAiwAssign::AiwCommandId() const"); + return KAiwCmdAssign; + } + +// ----------------------------------------------------------------------------- +// AiwInterestResource +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwAssign::AiwInterestResource() const + { + return R_GLX_AIW_ASSIGN_TO_CONTACT_INTEREST; + } + +// ----------------------------------------------------------------------------- +// AppendAiwParameterL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwAssign::AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler) + { + return AppendDefaultAiwParameterL( aItem, + aAiwServiceHandler, + ETrue, // Add the Uri + ETrue); // Add the Mime Type + } + +// ----------------------------------------------------------------------------- +// AiwDoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwAssign::AiwDoDynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* aMenuPane) + { + TRACER("void CGlxCommandHandlerAiwAssign::AiwDoDynInitMenuPaneL"); + TBool fullscreenViewingMode = EFalse; + CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); + CMPXCollectionPath* naviState = aNavigationalState->StateLC(); + + if ( naviState->Levels() >= 1) + { + if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) + { + // For image viewer collection, goto view mode + if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + { + //it means we are in img viewer. + fullscreenViewingMode = ETrue; + } + else + { + //it means we are in grid view. + fullscreenViewingMode = EFalse; + } + } + else + { + //it means we are in Fullscreen. + fullscreenViewingMode = ETrue; + } + } + CleanupStack::PopAndDestroy( naviState ); + aNavigationalState->Close(); + + HBufC* currentTitle = StringLoader::LoadLC( R_QTN_LGAL_OPTIONS_USE_ITEMS ); + // get commandId for the current menupane item title + TInt cmdId = AiwMenuCmdIdL( *currentTitle,aMenuPane ) ; + + CleanupStack::PopAndDestroy(currentTitle); + + if( KErrNotFound != cmdId ) + { + MGlxMediaList& mediaList = MediaList(); + + if (mediaList.SelectionCount() == 1 || fullscreenViewingMode ) + { + TGlxSelectionIterator iterator; + + iterator.SetToFirst(&mediaList); + + TInt index = iterator++; + if ( index != KErrNotFound ) + { + TMPXGeneralCategory cat = mediaList.Item(index).Category(); + TInt resId(0); + + if ( cat == EMPXImage ) + { + resId = R_QTN_LGAL_OPTIONS_USE_IMAGE_AS; + } + else if ( cat == EMPXVideo ) + { + resId = R_QTN_LGAL_OPTIONS_USE_VIDEO_AS; + } + + if ( resId ) + { + HBufC* menuTitle = StringLoader::LoadLC( resId ); + if ( menuTitle ) + { + aMenuPane->SetItemTextL(cmdId, + *menuTitle); + } + CleanupStack::PopAndDestroy(menuTitle); + } + } + } + // In case there are Multiple Media Items Marked + else + { + // Setting the " Use Items " Main Menu Option to Invisible + aMenuPane->SetItemDimmed(cmdId,ETrue); + } + } + } + +// ----------------------------------------------------------------------------- +// CommandSpace +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwAssign::CommandSpace() const + { + return KGlxAiwAssignCommandSpace; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,429 @@ +/* +* Copyright (c) 2008-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: AIW command handler base class +* +*/ + + + + +#include "glxcommandhandleraiwbase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxaiwservicehandler.h" + +#include // for CGlxResourceUtilities +#include + +const TInt KGlxAiwDefaultMaxSelectedItems = 200; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwBase::CGlxCommandHandlerAiwBase( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource ) + : CGlxMediaListCommandHandler( aMediaListProvider ), + iMenuResource( aMenuResource ) + { + iAppUi = static_cast< CAknAppUi* >( CCoeEnv::Static()->AppUi() ); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwBase::ConstructL() + { + + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + iAiwServiceHandler = CGlxAiwServiceHandler::InstanceL(); + + iAiwServiceHandler->AttachMenuL( iMenuResource, AiwInterestResource() ); + + // Add supported command + TCommandInfo info(CommandId()); + // Filter out static items + info.iMinSelectionLength = 1; + info.iMaxSelectionLength = MaxSelectedItems(); + info.iStopAnimationForExecution = ETrue; + info.iCategoryFilter = EMPXCommand; + info.iCategoryRule = TCommandInfo::EForbidAll; + AddCommandL(info); + + + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwBase::~CGlxCommandHandlerAiwBase() + { + if (iAiwServiceHandler) + { + iAiwServiceHandler->Close(); + } + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + } + +// ----------------------------------------------------------------------------- +// DoActivateL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwBase::DoActivateL(TInt /*aViewId*/) + { + } + +// ----------------------------------------------------------------------------- +// Deactivate +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwBase::Deactivate() + { + } + + +// ----------------------------------------------------------------------------- +// DoExecuteL +// ----------------------------------------------------------------------------- +// + + +TBool CGlxCommandHandlerAiwBase::DoExecuteL(TInt aCommandId, + MGlxMediaList& /* aList */) + { + TBool consumed = EFalse; + + // Check whether we can handle this command. + // Because BypassFiltersForExecute is enabled, we receive all command IDs. + if (iAiwServiceHandler->IsSameCommand( aCommandId, AiwCommandId() ) + && AiwItemEnabledL() ) + { + // Stop animations + iAppUi->ProcessCommandL( EGlxCmdDisableAnimations ); + + // Now gather the AIW parameters only for this service + // The InParam list at this point is empty (and must be empty). + GatherAiwParametersL(*iAiwServiceHandler); + iAiwServiceHandler->AppendInParamsL(); + + TRAPD( err, iAiwServiceHandler->ExecuteMenuCmdL( aCommandId, 0, this ) ); + + // If there is an error we must restart animations. then we can leave + if (KErrNone != err) + { + // Restart animations + iAppUi->ProcessCommandL( EGlxCmdEnableAnimations ); + + User::Leave( err ); + } + // After executing aiw command reset params list and menuInitialized flag + // so that next iptions menu initialization takes new params list + iAiwServiceHandler->ResetMenuInitialisedFlag(); + consumed = ETrue; + } + + return consumed; + } + +// ----------------------------------------------------------------------------- +// DoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwBase::DoDynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane) + { + if (aMenuPane) + { + if (iAiwServiceHandler->HandleSubmenuL( *aMenuPane )) + { + // AIW handles AIW sub-menus so do nothing else here + return; + } + + TInt err = KErrNone; + TInt itemPos = 0; + if (aMenuPane->MenuItemExists(CommandId(), itemPos)) + { + if (!AiwItemEnabledL()) + { + err = KErrGeneral; + } + } + if (err == KErrNone && iAiwServiceHandler->IsAiwMenu(aResourceId) ) + { + AiwDoDynInitMenuPaneL(aResourceId, aMenuPane); + + // Initialize menu pane + TRAP(err, iAiwServiceHandler->InitializeMenuPaneL( + *aMenuPane, aResourceId, EGlxCmdAiwBase)); + } + + if (err != KErrNone) + { + // If there's been any error (e.g. incomplete attributes due to + // user cancellation), then remove command from menu + TInt pos; + if (aMenuPane->MenuItemExists(CommandId(), pos)) + { + aMenuPane->SetItemDimmed(CommandId(), ETrue); + } + } + } + } + +// ----------------------------------------------------------------------------- +// AppendDefaultAiwParameterL +// ----------------------------------------------------------------------------- +// +/// parameter should also be of format aParameter, so glxAiwServiceHandler => aAiwServiceHandler +TBool CGlxCommandHandlerAiwBase::AppendDefaultAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler, + TBool aAddUri, + TBool aAddMimeType) + { + TBool successUri = ETrue; + TBool successMimeType = ETrue; + + // First check to see if we need to add the Uri + if (aAddUri) + { + successUri = AppendTextParameterL(aItem, aAiwServiceHandler, aItem.Uri(), EGenericParamFile); + } + + // Then check to see if we need the mime type + if (aAddMimeType) + { + successMimeType = AppendTextParameterL(aItem, aAiwServiceHandler, aItem.MimeType(), EGenericParamMIMEType); + } + + return successUri && successMimeType; + } + +// ----------------------------------------------------------------------------- +// AppendTextParameterL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwBase::AppendTextParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler, + const TDesC& aText, + TGenericParamIdValue aGenericParamIdValue) + { + TBool success = EFalse; + + if (aText != KNullDesC) + { + aAiwServiceHandler.AddParamL(aItem.Id(), TAiwGenericParam( aGenericParamIdValue, TAiwVariant( aText ) ) ); + + success = ETrue; + } + + return success; + } + +// ----------------------------------------------------------------------------- +// BypassFiltersForExecute +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwBase::BypassFiltersForExecute() const + { + // We need to bypass the MediaListCommandHandler filters for execution. + // Because Aiw assigns its own IDs for items added to the menu, we don't + // know which command IDs we actually support. + // By returning true, we receive all commands in DoExecuteL. + return ETrue; + } + +// ----------------------------------------------------------------------------- +// BypassFiltersForExecute +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwBase::BypassFiltersForMenu() const + { + // We need to bypass the MediaListCommandHandler filters for menu init. + // Due to the AIW commands appearing in a submenu, we need to make sure + // they are not automatically filtered out because they aren't + // listed in our "Supported" command set + // (We don't know which command values will be assigned by AIW) + return ETrue; + } + +// ----------------------------------------------------------------------------- +// GatherAiwParametersL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwBase::GatherAiwParametersL(CGlxAiwServiceHandler& aAiwServiceHandler) + { + + TRACER("CGlxCommandHandlerAiwBase::GatherAiwParametersL()"); + TInt allFound = ETrue; + + MGlxMediaList& mediaList = MediaList(); + + // Iterate through selected items to gather the parameters for AIW + + TGlxSelectionIterator iterator; + iterator.SetToFirst(&mediaList); + TInt index = KErrNotFound; + + while (KErrNotFound != (index = iterator++) && allFound) + { + allFound = AppendAiwParameterL(mediaList.Item(index), aAiwServiceHandler); + } + + return allFound; + } + + +// ----------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwBase::PreDynInitMenuPaneL( TInt aResourceId ) + { + if( AiwItemEnabledL() && iAiwServiceHandler->IsAiwMenu( aResourceId ) ) + { + GatherAiwParametersL(*iAiwServiceHandler); + } + } + +// ----------------------------------------------------------------------------- +// MaxSelectedItems +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwBase::MaxSelectedItems() const + { + return KGlxAiwDefaultMaxSelectedItems; + } + +// ----------------------------------------------------------------------------- +// HandleNotifyL +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwBase::HandleNotifyL( + TInt /*aCmdId*/, + TInt aEventId, + CAiwGenericParamList& /*aEventParamList*/, + const CAiwGenericParamList& /*aInParamList*/) + { + switch ( aEventId ) + { + case KAiwEventCompleted: + case KAiwEventCanceled: + case KAiwEventError: + case KAiwEventStopped: + { + // Restart animations + iAppUi->ProcessCommandL(EGlxCmdEnableAnimations); + } + break; + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// AiwDoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwBase::AiwDoDynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* /*aMenuPane*/) + { + // Do nothing by default, may be overridden + } + + +// ----------------------------------------------------------------------------- +// AiwItemEnabledL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwBase::AiwItemEnabledL() + { + TBool enabled = EFalse; + + MGlxMediaList& mediaList = MediaList(); + if (mediaList.Count() == 0) + { + return EFalse; + } + if ( mediaList.SelectionCount() == 0 ) + { + // No items in selection list. Check if focus item is static + TInt focusIndex = mediaList.FocusIndex(); + if(focusIndex != KErrNotFound) + { + if (!mediaList.Item(focusIndex).IsStatic()) + { + // Not static - so enable + enabled = ETrue; + } + } + } + else if ( mediaList.SelectionCount() <= MaxSelectedItems() ) + { + // Count of selected items within range, so enable + enabled = ETrue; + } + + return enabled; + } + +// ----------------------------------------------------------------------------- +// AiwMenuCmdIdL +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwBase::AiwMenuCmdIdL( const TDesC& aMenuItemText, + CEikMenuPane* aMenuPane ) + { + TInt index = 0; + TInt cmdId = KErrNotFound; + TInt count = aMenuPane->NumberOfItemsInPane(); + + // Traverse through menupane until menu text required is found + // or there are no more items in menupane + while( index < count && aMenuItemText.CompareC( aMenuPane-> + ItemDataByIndexL( index ).iText ) ) + { + index++; + } + // if count less than count then required item text is found, so get commandId for it + if( index < count ) + { + cmdId = aMenuPane->ItemDataByIndexL( index ).iCommandId ; + } + + return cmdId; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwedit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwedit.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +#include "glxcommandhandleraiwedit.h" + +#include + +#include +#include +#include + +#include "glxaiwservicehandler.h" +#include +#include +#include +#include +const TInt KGlxAiwEditCommandSpace = 0x00000200; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) + { + CGlxCommandHandlerAiwEdit* self = new ( ELeave ) + CGlxCommandHandlerAiwEdit(aMediaListProvider, aMenuResource); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwEdit::DoGetRequiredAttributesL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwEdit::DoGetRequiredAttributesL + (RArray& aAttributes, TBool aFilterUsingSelection) const + { + if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems()) + { + // Add filename attribute to fetch context + aAttributes.AppendL(KMPXMediaGeneralUri); + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) +: CGlxCommandHandlerAiwBase(aMediaListProvider, aMenuResource) + { + } + +// ----------------------------------------------------------------------------- +// CommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwEdit::CommandId() const + { + return EGlxCmdAiwEdit; + } + +// ----------------------------------------------------------------------------- +// AiwCommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwEdit::AiwCommandId() const + { + return KAiwCmdEdit; + } + +// ----------------------------------------------------------------------------- +// AiwInterestResource +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwEdit::AiwInterestResource() const + { + return R_GLX_AIW_EDIT_INTEREST; + } + +// ----------------------------------------------------------------------------- +// AppendAiwParameterL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwEdit::AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler) + { + return AppendDefaultAiwParameterL( aItem, + aAiwServiceHandler, + ETrue, // Add the Uri + EFalse); // Don't add the Mime Type + } + +// ----------------------------------------------------------------------------- +// CommandSpace +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwEdit::CommandSpace() const + { + return KGlxAiwEditCommandSpace; + } + +// ----------------------------------------------------------------------------- +// AiwDoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwEdit::AiwDoDynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* aMenuPane) + { + TRACER("CGlxCommandHandlerAiwEdit::AiwDoDynInitMenuPaneL()"); + HBufC* currentTitle = StringLoader::LoadLC( R_QTN_LGAL_OPTIONS_EDIT ); + TInt cmdId = AiwMenuCmdIdL( *currentTitle,aMenuPane ) ; + CleanupStack::PopAndDestroy(currentTitle); + if( KErrNotFound != cmdId ) + { + if ((MediaList().SelectionCount() > 1)) + { + aMenuPane->SetItemDimmed(cmdId,ETrue); + } + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwprintpreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwprintpreview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2008-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: AIW print preview command handler +* +*/ + + + + +#include "glxcommandhandleraiwprintpreview.h" +#include "glxaiwservicehandler.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const TInt KGlxAiwPrintPreviewCommandSpace = 0x00000300; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAiwPrintPreview* + CGlxCommandHandlerAiwPrintPreview::NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) + { + CGlxCommandHandlerAiwPrintPreview* self = new ( ELeave ) + CGlxCommandHandlerAiwPrintPreview(aMediaListProvider, aMenuResource); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwPrintPreview::DoGetRequiredAttributesL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwPrintPreview::DoGetRequiredAttributesL + (RArray& aAttributes, TBool aFilterUsingSelection) const + { + if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems()) + { + // Add MIME type and fileaname attributes + aAttributes.AppendL(KMPXMediaGeneralMimeType); + aAttributes.AppendL(KMPXMediaGeneralUri); + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwPrintPreview::CGlxCommandHandlerAiwPrintPreview( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) +: CGlxCommandHandlerAiwBase(aMediaListProvider, aMenuResource) + { + } + +// ----------------------------------------------------------------------------- +// CommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwPrintPreview::CommandId() const + { + return EGlxCmdAiwPrint; + } + +// ----------------------------------------------------------------------------- +// AiwCommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwPrintPreview::AiwCommandId() const + { + return KAiwCmdPrint; + } + +// ----------------------------------------------------------------------------- +// AiwInterestResource +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwPrintPreview::AiwInterestResource() const + { + return R_GLX_AIW_PRINT_INTEREST; + } + +// ----------------------------------------------------------------------------- +// AppendAiwParameterL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwPrintPreview::AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler) + { + return AppendDefaultAiwParameterL( aItem, + aAiwServiceHandler, + ETrue, // Add the Uri + ETrue); // Add the MineType + } + + +// ----------------------------------------------------------------------------- +// CommandSpace +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwPrintPreview::CommandSpace() const + { + return KGlxAiwPrintPreviewCommandSpace; + } + +// ----------------------------------------------------------------------------- +// AiwDoDynInitMenuPaneL for PrintPreview +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwPrintPreview::PreDynInitMenuPaneL(TInt aResourceId) + { + CGlxCommandHandlerAiwBase::PreDynInitMenuPaneL(aResourceId); + } +// ----------------------------------------------------------------------------- +// AiwDoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwPrintPreview::AiwDoDynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane) + { + TBool fullscreenViewingMode = EFalse; + CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); + CMPXCollectionPath* naviState = aNavigationalState->StateLC(); + + if ( naviState->Levels() >= 1) + { + if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) + { + if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + { + fullscreenViewingMode = ETrue; + } + else + { + fullscreenViewingMode = EFalse; + } + } + else + { + fullscreenViewingMode = ETrue; + } + } + CleanupStack::PopAndDestroy( naviState ); + aNavigationalState->Close(); + + HBufC* currentTitle = StringLoader::LoadLC( R_QTN_LGAL_OPTIONS_PRINT_MENU ); + TInt cmdId = AiwMenuCmdIdL( *currentTitle,aMenuPane ) ; + CleanupStack::PopAndDestroy(currentTitle); + if( KErrNotFound != cmdId ) + { + if ((MediaList().SelectionCount() == 0) && !fullscreenViewingMode) + { + aMenuPane->SetItemDimmed(cmdId,ETrue); + } + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwshareonovi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwshareonovi.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2008-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: AIW Share On Ovi command handler ( Works only with ShareOnline application version 4.3 and above ) +* +*/ + + +// INTERNAL INCLUDES +#include "glxcommandhandleraiwshareonovi.h" +#include "glxaiwservicehandler.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// CONSTANTS AND FORWARD DECLARATIONS +const TInt KGlxAiwShareOnOviCommandSpace = 0x00000500; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAiwShareOnOvi* CGlxCommandHandlerAiwShareOnOvi::NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) + { + CGlxCommandHandlerAiwShareOnOvi* self = new ( ELeave ) + CGlxCommandHandlerAiwShareOnOvi(aMediaListProvider, aMenuResource); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShareOnOvi::DoGetRequiredAttributesL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwShareOnOvi::DoGetRequiredAttributesL + (RArray& aAttributes, TBool aFilterUsingSelection) const + { + if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems()) + { + // Add filename attribute to fetch context + aAttributes.AppendL(KMPXMediaGeneralUri); + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwShareOnOvi::CGlxCommandHandlerAiwShareOnOvi( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) +: CGlxCommandHandlerAiwBase(aMediaListProvider, aMenuResource) + { + } + +// ----------------------------------------------------------------------------- +// CommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShareOnOvi::CommandId() const + { + return EGlxCmdAiwShareOnOvi; + } + +// ----------------------------------------------------------------------------- +// AiwCommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShareOnOvi::AiwCommandId() const + { + return KAiwCmdUpload; + } + +// ----------------------------------------------------------------------------- +// AiwInterestResource +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShareOnOvi::AiwInterestResource() const + { + return R_AIW_SHARE_INTEREST; + } + +// ----------------------------------------------------------------------------- +// AppendAiwParameterL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwShareOnOvi::AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler) + { + return AppendDefaultAiwParameterL( aItem, + aAiwServiceHandler, + ETrue, // Add the Uri + EFalse); // Don't add the Mime Type + } + +// ----------------------------------------------------------------------------- +// CommandSpace +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShareOnOvi::CommandSpace() const + { + return KGlxAiwShareOnOviCommandSpace; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwshowmap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwshowmap.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2008-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: Show on map command handler +* +*/ + + + + +#include "glxcommandhandleraiwshowmap.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +// For LocationFW +#include +#include +#include + +#include "glxaiwservicehandler.h" + +const TInt KGlxAiwShowMapCommandSpace = 0x00000400; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerAiwShowMap* CGlxCommandHandlerAiwShowMap::NewL( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource ) + { + TRACER("CGlxCommandHandlerAiwShowMap::NewL"); + CGlxCommandHandlerAiwShowMap* self = new ( ELeave ) + CGlxCommandHandlerAiwShowMap( aMediaListProvider, aMenuResource ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwShowMap::~CGlxCommandHandlerAiwShowMap() + { + iBufferArray.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerAiwShowMap::CGlxCommandHandlerAiwShowMap( + MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource ) + : CGlxCommandHandlerAiwBase( aMediaListProvider, aMenuResource ) + { + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShowMap::DoGetRequiredAttributesL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwShowMap::DoGetRequiredAttributesL + (RArray& aAttributes, TBool aFilterUsingSelection) const + { + if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems()) + { + aAttributes.AppendL(KGlxMediaGeneralLocation); + } + } + +// ----------------------------------------------------------------------------- +// AiwDoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwShowMap::AiwDoDynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* aMenuPane) + { + TInt num_items = aMenuPane->NumberOfItemsInPane(); + + // Iterate through menu pane + TInt i = 0; + while (i < num_items) + { + CEikMenuPaneItem::SData& item = aMenuPane->ItemDataByIndexL(i); + + // "Show on map" cannot be dimmed as AIW resets the flags to not dimmed + // Have to delete the menu item in this case. + if (EGlxCmdAiwShowMap == item.iCommandId) + { + // Check visibility of the menu item + TBool isDisabled = IsItemWithLocationInfoSelected(MediaList()); + + // Should it be disabled + if ((isDisabled) || (MediaList().SelectionCount() > 1)) + { + // if so delete it. + aMenuPane->DeleteMenuItem(EGlxCmdAiwShowMap); + } + break; + } + ++i; + } + } + +// ----------------------------------------------------------------------------- +// CommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShowMap::CommandId() const + { + TRACER("CGlxCommandHandlerAiwShowMap::CommandId"); + return EGlxCmdAiwShowMap; + } + +// ----------------------------------------------------------------------------- +// AiwCommandId +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShowMap::AiwCommandId() const + { + TRACER("CGlxCommandHandlerAiwShowMap::AiwCommandId"); + return KAiwCmdMnShowMap; + } + +// ----------------------------------------------------------------------------- +// AiwInterestResource +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShowMap::AiwInterestResource() const + { + TRACER("CGlxCommandHandlerAiwShowMap::AiwInterestResource"); + return R_GLX_AIW_SHOWMAP_INTEREST; + } + +// ----------------------------------------------------------------------------- +// AppendAiwParameterL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerAiwShowMap::AppendAiwParameterL(const TGlxMedia& aItem, + CGlxAiwServiceHandler& aAiwServiceHandler) + { + TRACER("CGlxCommandHandlerAiwShowMap::AppendAiwParameterL"); + TBool success = EFalse; + + // Cleanup before execution + iBufferArray.ResetAndDestroy(); + + TCoordinate coordinate; + if (aItem.GetCoordinate(coordinate)) + { + // Create a landmark from the coordinate + CPosLandmark* landmark = CPosLandmark::NewLC(); + TRealX noNumber; + noNumber.SetNaN(); // Not a Number + + TLocality locality( coordinate, noNumber ); + + // locality must have valid (ie not NaN) values + landmark->SetPositionL( locality ); + + // Serialize buffer to landmark and append it to AIW parameter + const HBufC8* landmarkBuf = + PosLandmarkSerialization::PackL( *landmark ); + // we have ownership of landmarkBuf so add to array + // for cleanup on our destruction + iBufferArray.AppendL( landmarkBuf ); + + // Append location parameter to the AIW param list + TAiwVariant landmarkVariant( *landmarkBuf ); + TAiwGenericParam landmarkParam( EGenericParamLandmark, landmarkVariant ); + aAiwServiceHandler.AddParamL(aItem.Id(), landmarkParam ); + + success = ETrue; + CleanupStack::PopAndDestroy( landmark ); + } + + return success; + } + +// ----------------------------------------------------------------------------- +// CommandSpace +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShowMap::CommandSpace() const + { + TRACER("CGlxCommandHandlerAiwShowMap::CommandSpace"); + return KGlxAiwShowMapCommandSpace; + } + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +// +TBool CGlxCommandHandlerAiwShowMap::IsItemWithLocationInfoSelected(MGlxMediaList& aList ) + { + TRACER("CGlxCommandHandlerAiwShowMap::DoIsDisabled"); + // Disable the "Show on map" menu item if the selection (marked list, + // or focused item if none marked) does not contain any items + // that have location data + TBool isSupported = EFalse; + + // Check through all, if any, selected items, otherwise the focused item + TGlxSelectionIterator iterator; + iterator.SetToFirst( &aList ); + + // Loop until a supported item is found or until there are no + // more indexes to process + TInt index = KErrNotFound; + while ( KErrNotFound != (index = iterator++ ) && !isSupported ) + { + // get the media item + const TGlxMedia& media = aList.Item( index ); + + // Test to see if the coordinate is present + TCoordinate coordinate; + isSupported = media.GetCoordinate(coordinate); + } + + // Don't disable the menu item if the property's supported + return !isSupported; + } + +// ----------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerAiwShowMap::PreDynInitMenuPaneL(TInt aResourceId) + { + CGlxCommandHandlerAiwBase::PreDynInitMenuPaneL(aResourceId); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwshowonmaphardkey.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwshowonmaphardkey.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,273 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Applications interface class to map and navigation use cases +* +*/ + + + + +// INCLUDE FILES +#include "glxcommandhandleraiwshowonmaphardkey.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for accessing the media items + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShowMapHardKey() +// ----------------------------------------------------------------------------- +CGlxCommandHandlerAiwShowMapHardKey::CGlxCommandHandlerAiwShowMapHardKey(MGlxMediaListProvider* + aMediaListProvider, TBool aHasToolbarItem) + :CGlxMediaListCommandHandler(aMediaListProvider,aHasToolbarItem) + { + TRACER("CGlxCommandHandlerAiwShowMapHardKey::CGlxCommandHandlerAiwShowMapHardKey()"); + // No Implementation + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShowMapHardKey::ConstructL +// ----------------------------------------------------------------------------- +void CGlxCommandHandlerAiwShowMapHardKey::ConstructL() + { + TRACER("CGlxCommandHandlerAiwShowMapHardKey::ConstructL()"); + iAiwServiceHandler = CAiwServiceHandler::NewL(); + iAiwServiceHandler->AttachL( R_GLX_AIW_SHOWMAP_INTEREST_HARDKEY ); + + iInList = CAiwGenericParamList::NewL(); + iOutList = CAiwGenericParamList::NewL(); + + // Add the upload command + TCommandInfo info(KGlxCmdMnShowMap); + AddCommandL(info); + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShowMapHardKey::NewL +// ----------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerAiwShowMapHardKey* CGlxCommandHandlerAiwShowMapHardKey:: + NewL(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + { + TRACER("CGlxCommandHandlerAiwShowMapHardKey::NewL()"); + CGlxCommandHandlerAiwShowMapHardKey* self = new (ELeave) CGlxCommandHandlerAiwShowMapHardKey( + aMediaListProvider,aHasToolbarItem); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// ~CGlxCommandHandlerAiwShowMapHardKey +// C++ Destructor +// ----------------------------------------------------------------------------- + CGlxCommandHandlerAiwShowMapHardKey::~CGlxCommandHandlerAiwShowMapHardKey() + { + TRACER("CGlxCommandHandlerAiwShowMapHardKey::~CGlxCommandHandlerAiwShowMapHardKey"); + if (iAiwServiceHandler) + { + delete iAiwServiceHandler; + iAiwServiceHandler = NULL; + } + if (iInList) + { + delete iInList; + iInList = NULL; + } + if (iOutList) + { + delete iOutList; + iOutList = NULL; + } + } + +// ---------------------------------------------------------------------------- +// DoExecuteL +// ---------------------------------------------------------------------------- +TBool CGlxCommandHandlerAiwShowMapHardKey::DoExecuteL (TInt /*aCommandId*/, MGlxMediaList& aList) + { + TRACER("CGlxCommandHandlerAiwShowMapHardKey::DoExecuteL"); + TBool handled = EFalse; + TCoordinate coordinate; + TInt focusIndex = aList.FocusIndex(); + const TGlxMedia& item = aList.Item(focusIndex); + + if(item.GetCoordinate(coordinate)) + { + CPosLandmark* lmk = CPosLandmark::NewLC(); + TLocality locality; + HBufC8* lmBuf; + + //set location + locality.SetCoordinate( coordinate.Latitude(), coordinate.Longitude(), + coordinate.Altitude() ); + + lmk->SetPositionL(locality); + + //set in parameters + iInList->Reset(); + lmBuf =PosLandmarkSerialization::PackL( *lmk ); + CleanupStack::PushL( lmBuf ); + TAiwGenericParam param( EGenericParamLandmark, TAiwVariant( *lmBuf ) ); + iInList->AppendL( param ); + TMnAiwCommonOptionsParam options; + options.iRunChained = EFalse; + TPckg optionsPack( options ); + TAiwGenericParam optParam( EGenericParamMnCommonOptions, TAiwVariant( optionsPack ) ); + iInList->AppendL( optParam ); + + iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdMnShowMap, *iInList, *iOutList, 0); + + CleanupStack::PopAndDestroy( lmBuf); + CleanupStack::PopAndDestroy( lmk); + handled = ETrue; + } + else + { + // if location info not present then display note to put on camera settings + HBufC* popupText = StringLoader::LoadLC( + R_GLX_POPUP_NO_LOCATION_INFO); + GlxGeneralUiUtilities::ShowInfoNoteL( popupText->Des(), EFalse ); + CleanupStack::PopAndDestroy( popupText ); + } + return handled; + } + +// ---------------------------------------------------------------------------- +// DoActivateL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerAiwShowMapHardKey::DoActivateL(TInt aViewId) + { + TRACER("CGlxCommandHandlerAiwShowMapHardKey::DoActivateL"); + iViewId = aViewId; + + } + +// ---------------------------------------------------------------------------- +// Deactivate +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerAiwShowMapHardKey::Deactivate() + { + TRACER("CGlxCommandHandlerAiwShowMapHardKey::Deactivate"); + + } + +// The below code is commented out as this implementation is for Future commandhandler +// To check map service providers +// To navigate to the location + +/* +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShowMapHardKey::NavigateToPlaceL +// It will navigate to location +// ----------------------------------------------------------------------------- +void CGlxCommandHandlerAiwShowMapHardKey::NavigateToPlaceL( const TCoordinate& aCoordinate ) + { + CPosLandmark* lmk = CPosLandmark::NewLC(); + TLocality locality; + HBufC8* lmBuf; + + //set location + locality.SetCoordinate( aCoordinate.Latitude(), aCoordinate.Longitude(), aCoordinate.Altitude() ); + lmk->SetPositionL(locality); + + //set in parameters + iInList->Reset(); + lmBuf =PosLandmarkSerialization::PackL( *lmk ); + CleanupStack::PushL( lmBuf ); + TAiwGenericParam param( EGenericParamLandmark, TAiwVariant( *lmBuf ) ); + iInList->AppendL( param ); + TMnAiwCommonOptionsParam options; + options.iRunChained = EFalse; + TPckg optionsPack( options ); + TAiwGenericParam optParam( EGenericParamMnCommonOptions, TAiwVariant( optionsPack ) ); + iInList->AppendL( optParam ); + + //navigate to location + // iAiwServiceHandler->AttachL( R_EVTMGMTUI_AIW_INTEREST_NAVIGATETO ); + iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdMnNavigateTo, *iInList, *iOutList, 0, this ); + + CleanupStack::PopAndDestroy( 2 ); //lmbuf, lmk + } + + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShowMapHardKey::MapServiceProvidersL +// It will return total map service providers. +// @ret total number of map service providers +// ----------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerAiwShowMapHardKey::MapServiceProvidersL() + { +#if 0 + RPointerArray providers; + // get all providers + MnProviderFinder::FindProvidersL( providers ); + TInt total = providers.Count(); + providers.ResetAndDestroy(); + providers.Close(); + // Debug(_L("Total map service providers = %d"), total); + return total; +#endif + return 0; + } +*/ +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAiwShowMapHardKey::HandleNotifyL +// Derived from MAiwNotifyCallback +// ----------------------------------------------------------------------------- +//TInt CGlxCommandHandlerAiwShowMapHardKey::HandleNotifyL( TInt aCmdId, +// TInt aEventId, +// CAiwGenericParamList& aEventParamList, +// const CAiwGenericParamList& aInParamList ) +// { +// if ( iOutList->Count() ) //if location is selected on map +// { +// const TAiwGenericParam& param = ( *iOutList )[0]; +// if ( EGenericParamLandmark == param.SemanticId() ) +// { +// TPtrC8 landmarkData( param.Value().AsData() ); +// CPosLandmark* lm = PosLandmarkSerialization::UnpackL( landmarkData ); +// CleanupStack::PushL( lm ); +// +// SetPlaceFromLandmarkL( *lm ); +// CleanupStack::PopAndDestroy( lm ); +// iOutList->Reset(); +// iObserver->HandleMapAndNavigationResponseL( KErrNone, *iPlace, iTriggerLocation ); +// } +// else +// { +// iOutList->Reset(); +// iObserver->HandleMapAndNavigationResponseL( KErrCancel, *iPlace, iTriggerLocation ); +// } +// } +// else //if map application is cancelled +// iObserver->HandleMapAndNavigationResponseL( KErrCancel, *iPlace, iTriggerLocation ); +// return KErrNone; +// } + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerback.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2008-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: Back commmand handler +* +*/ + + + + +#include "glxcommandhandlerback.h" + +#include +#include + + +#include + + +#include +#include +#include // For MMPXViewUtility + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxmediaselectionpopup.h" +//constants + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerBack* + CGlxCommandHandlerBack::NewBackCommandHandlerL() + { + return CGlxCommandHandlerBack::NewL(EGlxCmdBack,NULL,0); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerBack* + CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider ) + { + return CGlxCommandHandlerBack::NewL(EGlxCmdPreviousView,aMediaListProvider,0); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerBack* + CGlxCommandHandlerBack::NewContainerPreviousViewCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider, TInt aPrevViewId ) + { + return CGlxCommandHandlerBack::NewL(EGlxCmdContainerPreviousView, + aMediaListProvider,aPrevViewId); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerBack* + CGlxCommandHandlerBack::NewL( + TInt aCommandId, MGlxMediaListProvider* aMediaListProvider, + TInt aPrevViewId ) + { + CGlxCommandHandlerBack* self = new (ELeave) + CGlxCommandHandlerBack(aMediaListProvider,aPrevViewId); + CleanupStack::PushL(self); + self->ConstructL(aCommandId); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerBack::CGlxCommandHandlerBack( MGlxMediaListProvider* + aMediaListProvider, TInt aPrevViewId ) + { + iMediaListProvider = aMediaListProvider; + iPrevViewId = aPrevViewId; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerBack::ConstructL( TInt aCommandId ) + { + TRACER( "CGlxCommandHandlerBack::ConstructL" ); + + GLX_LOG_INFO1( "CGlxCommandHandlerBack::ConstructL::Command Id (%d)", + aCommandId ); + iCurrentCommandId = aCommandId; + iNavigationalState = CGlxNavigationalState::InstanceL(); + iIsViewActivated = EFalse; + + iBSWrapper = CGlxBackServiceWrapper::NewL( TUid::Uid( KGlxGalleryApplicationUid ) ); + iAppUi = static_cast< CAknAppUi* >( CCoeEnv::Static()->AppUi() ); + + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerBack::~CGlxCommandHandlerBack() + { + TRACER( "CGlxCommandHandlerBack::~CGlxCommandHandlerBack" ); + + iNavigationalState->Close(); + + if( iBSWrapper ) + { + delete iBSWrapper; + } + + } + +// ----------------------------------------------------------------------------- +// ExecuteL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerBack::ExecuteL( TInt aCommandId ) + { + TRACER("CGlxCommandHandlerBack::ExecuteL"); + _LIT8( KPhotosSuiteNavigation, "SuiteNavigation" ); + TBool consume(EFalse); + + GLX_LOG_INFO1( "CGlxCommandHandlerBack::ExecuteL::Command Id (%d)", + aCommandId ); + + if ( aCommandId == EAknSoftkeyBack ) + { + switch( iCurrentCommandId ) + { + case EGlxCmdBack: + { + GLX_LOG_INFO("CGlxCommandHandlerBack::ExecuteL::One step \ + back in UI hierarchy"); + MMPXCollectionUtility* collectionUtility = MMPXCollectionUtility::NewL(NULL, KMcModeDefault); + CleanupClosePushL(*collectionUtility); + CMPXCollectionPath* navigationalState = collectionUtility->Collection().PathL(); + CleanupStack::PopAndDestroy(collectionUtility); + CleanupStack::PushL(navigationalState); + + // let Back Stepping Service handle the event + if(2 == navigationalState->Levels()&& iNavigationalState->BackExitStatus()) + { + iBSWrapper->HandleBackCommandL( KPhotosSuiteNavigation ); + if(iAppUi) + { + iAppUi->ProcessCommandL(EAknSoftkeyExit); + } + } + else if (!(iNavigationalState->BackExitStatus())) + { + if(iAppUi) + { + iAppUi->ProcessCommandL(EAknSoftkeyExit); + } + } + else if( iIsViewActivated ) + { + iIsViewActivated = EFalse; + iNavigationalState->NavigateToParentL(); + } + CleanupStack::PopAndDestroy(navigationalState); + consume = ETrue; + break; + } + case EGlxCmdPreviousView: + { + GLX_LOG_INFO("CGlxCommandHandlerBack::ExecuteL::Go back \ + to the previous view"); + if (!(iNavigationalState->BackExitStatus())) + { + if(iAppUi) + { + iAppUi->ProcessCommandL(EAknSoftkeyExit); + } + } + if( iIsViewActivated ) + { + iIsViewActivated = EFalse; + iNavigationalState->ActivatePreviousViewL(); + + } + consume = ETrue; + break; + } + + case EGlxCmdContainerPreviousView: + { + GLX_LOG_INFO("CGlxCommandHandlerBack::ExecuteL::Go back \ + to the previous view when continer is still there else go two views back"); + // The code commented is to be removed after testing with migrated code is over + // below code is no longer expected to be required as the + // "deletion of tags" from tag manager test case dont exist in rel 8.0 + // the private API CheckContainerDeletion()can also to be removed + + /* // check if special case of container deletion need to be checked + // this must be done before the previous view is activated as the check + // is based on the view id + TBool containerDeleted = CheckContainerDeletion(); + + //go back one view + + if ( iViewUtility->ViewHistoryDepth() > 1 ) + { + iViewUtility->ActivatePreviousViewL(); + } + + if( containerDeleted ) + { + //path to get list of containers + CMPXCollectionPath* containerPath = iMediaListProvider->MediaList().PathLC(); + //current navigational state + CMPXCollectionPath* navigationalState = iCollectionUtility->Collection().PathL(); + CleanupStack::PushL(navigationalState); + + //current node id in UI Hierarchy + TMPXItemId currentNodeId = navigationalState->Id(navigationalState->Levels() - 2); + + //check if current node is present in containers list + if(KErrNotFound == containerPath->IndexOfId(currentNodeId)) + { + iCollectionUtility->Collection().BackL(); + } + CleanupStack::PopAndDestroy(navigationalState); + CleanupStack::PopAndDestroy(containerPath); + }*/ + consume = ETrue; + break; + } + default: + User::Leave( KErrNotFound ); + break; + } + } + + return consume; + } + +//The below commented code to be removed +// ----------------------------------------------------------------------------- +// CheckContainerDeletion +// ----------------------------------------------------------------------------- +// +/*TBool CGlxCommandHandlerBack::CheckContainerDeletion() const + { + return((iViewUtility->PreviousViewType().operator != (TUid::Uid(0))) && + (iViewUtility->PreviousViewType().operator ==(TUid::Uid(iPrevViewId)))); + }*/ +// ----------------------------------------------------------------------------- +// DynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerBack::DynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* /*aMenuPane*/) + { + // Do Nothing + } + +// ----------------------------------------------------------------------------- +// DoActivateL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerBack::DoActivateL(TInt /*aViewId*/) + { + iIsViewActivated = ETrue; + } + +// ----------------------------------------------------------------------------- +// Deactivate +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerBack::Deactivate() + { + iIsViewActivated = EFalse; + } + +// ----------------------------------------------------------------------------- +// OfferKeyEventL +// ----------------------------------------------------------------------------- +// +TKeyResponse CGlxCommandHandlerBack::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, + TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// ----------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerBack::PreDynInitMenuPaneL( TInt /*aResourceId*/ ) + { + // Do Nothing + } + + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlercopyandmove.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlercopyandmove.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2008-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: Add to container commmand handler +* +*/ + + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "glxcommandhandlercopyandmove.h" + +_LIT(KColonBackslash, ":\\"); + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerCopyAndMove* CGlxCommandHandlerCopyAndMove::NewL(MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) + { + CGlxCommandHandlerCopyAndMove* self = new (ELeave) CGlxCommandHandlerCopyAndMove(aMediaListProvider, aMenuResource); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerCopyAndMove::~CGlxCommandHandlerCopyAndMove() + { + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + } + +// --------------------------------------------------------------------------- +// CGlxCommandHandlerCopyAndMove::CreateCommandL() +// --------------------------------------------------------------------------- +// +CMPXCommand* CGlxCommandHandlerCopyAndMove::CreateCommandL(TInt aCommandId, MGlxMediaList& aList, + TBool& aConsume) const + { + CMPXCommand* command = NULL; + switch (aCommandId) + { + case EGlxCmdCopy: + case EGlxCmdMove: + { + TCommonDialogType type = + aCommandId == EGlxCmdMove ? ECFDDialogTypeMove : ECFDDialogTypeCopy; + + CAknMemorySelectionDialogMultiDrive* dialog = + CAknMemorySelectionDialogMultiDrive::NewL + ( type, NULL, EFalse, AknCommonDialogsDynMem::EMemoryTypePhone| + AknCommonDialogsDynMem::EMemoryTypeMMC| + AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage| + AknCommonDialogsDynMem::EMemoryTypeMMCExternal ); + + CleanupStack::PushL(dialog); + TDriveNumber driveNumber = EDriveC; + + if (dialog->ExecuteL(driveNumber)) + { + TBuf rootPath; + DriveLetterFromNumber(driveNumber, rootPath); + + CMPXCollectionPath* path = aList.PathLC( NGlxListDefs::EPathFocusOrSelection ); + if (aCommandId == EGlxCmdMove) + { + command = TGlxCommandFactory::MoveCommandLC(rootPath, *path); + } + else + { + command = TGlxCommandFactory::CopyCommandLC(rootPath, *path); + } + + CleanupStack::Pop(command); + CleanupStack::PopAndDestroy(path); + } + CleanupStack::PopAndDestroy(dialog); + } + break; + case EGlxCmdStateBrowse: + case EGlxCmdStateView: + { + iVisible = (aCommandId == EGlxCmdStateBrowse); + aConsume = EFalse; + } + break; + case EGlxCmdCopyMoveSubmenu: + // nothing to do here + break; + default: + break; + } + + return command; + + } + +// --------------------------------------------------------------------------- +// CGlxCommandHandlerCopyAndMove::DoDynInitMenuPaneL() +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerCopyAndMove::DoDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + if (aResourceId == iMenuResource && aMenuPane) + { + aMenuPane->SetItemDimmed(EGlxCmdCopyMoveSubmenu, !iVisible); + } + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerCopyAndMove::ConstructL() + { + // Load resource file + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + // Add supported command + TCommandInfo copyInfo(EGlxCmdCopy); + copyInfo.iMinSelectionLength = 1; + copyInfo.iMaxSelectionLength = KMaxTInt; + // Filter out static items + AddCommandL(copyInfo); + + TCommandInfo moveInfo(EGlxCmdMove); + moveInfo.iMinSelectionLength = 1; + moveInfo.iMaxSelectionLength = KMaxTInt; + // Filter out static items + AddCommandL(moveInfo); + + TCommandInfo copyAndMoveSubmenuInfo(EGlxCmdCopyMoveSubmenu); + copyAndMoveSubmenuInfo.iMinSelectionLength = 1; + copyAndMoveSubmenuInfo.iMaxSelectionLength = KMaxTInt; + // Show in Grid View + copyAndMoveSubmenuInfo.iViewingState = TCommandInfo::EViewingStateBrowse; + // Filter out static items + // (The whole sub menu should be filtered out if a static item is selected) + AddCommandL(copyAndMoveSubmenuInfo); + + TCommandInfo browseInfo(EGlxCmdStateBrowse); + browseInfo.iMinSelectionLength = 0; + browseInfo.iMaxSelectionLength = KMaxTInt; + // Filter out static items + AddCommandL(browseInfo); + + TCommandInfo viewInfo(EGlxCmdStateView); + viewInfo.iMinSelectionLength = 0; + viewInfo.iMaxSelectionLength = KMaxTInt; + // Filter out static items + AddCommandL(viewInfo); + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerCopyAndMove::CGlxCommandHandlerCopyAndMove(MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) +: CGlxMpxCommandCommandHandler(aMediaListProvider), iVisible(ETrue), iMenuResource(aMenuResource) + { + } + +// --------------------------------------------------------------------------- +// CGlxCommandHandlerCopyAndMove::DriveLetterFromNumber() +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerCopyAndMove::DriveLetterFromNumber(TDriveNumber aDriveNumber, TDes& aDriveLetter) + { + aDriveLetter.SetLength(aDriveLetter.Length() + 1); + aDriveLetter[aDriveLetter.Length() - 1] = 'A' + aDriveNumber; + aDriveLetter.Append(KColonBackslash); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdelete.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdelete.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,252 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +#include "glxcommandhandlerdelete.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include + +#include +#include +#include +#include +#include +#include "glxcommandfactory.h" + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerDelete* CGlxCommandHandlerDelete::NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aContainerList, TBool aHasToolbarItem) + { + /// @todo Minor: Rowland Cook 06/06/07 no use of glx logging + CGlxCommandHandlerDelete* self = new (ELeave) CGlxCommandHandlerDelete(aMediaListProvider, aHasToolbarItem); + CleanupStack::PushL( self ); + self->ConstructL(aContainerList); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerDelete::CGlxCommandHandlerDelete(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + : CGlxMpxCommandCommandHandler( aMediaListProvider, aHasToolbarItem ) + { + // Don't do anything. + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDelete::ConstructL(TBool aIsContainerList) + { + iIsContainerList = aIsContainerList; + iUiUtility = CGlxUiUtility::UtilityL(); + + // Load resource file + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + // Add supported command + TCommandInfo info( EGlxCmdDelete ); + // Filter out static items + info.iMinSelectionLength = 1; + info.iDisallowSystemItems = aIsContainerList; + AddCommandL(info); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerDelete::~CGlxCommandHandlerDelete() + { + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + if(iUiUtility) + { + iUiUtility->Close(); + } + } + +// --------------------------------------------------------------------------- +// Create an add to container command +// --------------------------------------------------------------------------- +// +CMPXCommand* CGlxCommandHandlerDelete::CreateCommandL(TInt /*aCommandId*/, + MGlxMediaList& aMediaList, TBool& /*aConsume*/) const + { + CMPXCollectionPath* path = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); + CMPXCommand* command = TGlxCommandFactory::DeleteCommandLC(*path); + CleanupStack::Pop(command); + CleanupStack::PopAndDestroy(path); + return command; + } + +// ----------------------------------------------------------------------------- +// Return default progress string +// ----------------------------------------------------------------------------- +// +HBufC* CGlxCommandHandlerDelete::ProgressTextL(TInt /*aCommandId*/) const + { + return StringLoader::LoadL(R_QTN_FLDR_DELETING_WAIT_NOTE); + } + +// ----------------------------------------------------------------------------- +// Return confirmation string +// ----------------------------------------------------------------------------- +// +HBufC* CGlxCommandHandlerDelete::ConfirmationTextL(TInt /*aCommandId*/, + TBool aMultiSelection) const + { + // Return appropriate confirmation note + HBufC* text = NULL; + if (aMultiSelection) + { + if (iIsContainerList) + { + // Delete multiple containers string + text = StringLoader::LoadL(R_GLX_CONFIRMATION_DELETE_CONTAINER_MULTIPLE); + } + else + { + // Delete multiple items string + text = StringLoader::LoadL(R_GLX_CONFIRMATION_DELETE_MULTIPLE); + } + } + else + { + if (iIsContainerList) + { + // Delete one container string + text = StringLoader::LoadL(R_GLX_CONFIRMATION_DELETE_CONTAINER_SINGLE); + } + else + { + // Delete one item string + text = StringLoader::LoadL(R_GLX_CONFIRMATION_DELETE_SINGLE); + } + } + return text; + } + +// ---------------------------------------------------------------------------- +// DoActivateL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerDelete::DoActivateL(TInt /*aViewId*/) + { + + } + +// ---------------------------------------------------------------------------- +// OfferKeyEventL +// ---------------------------------------------------------------------------- +TKeyResponse CGlxCommandHandlerDelete::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) + { + TKeyResponse response = EKeyWasNotConsumed; + // Is the key event from the Cancel (Backspace) key + if (aKeyEvent.iCode == EKeyBackspace && aType == EEventKey) + { + // try to execute the delete command + if(ExecuteL( EGlxCmdDelete )) + { + response = EKeyWasConsumed; + } + } + return response; + } + +// ---------------------------------------------------------------------------- +// PopulateToolbar +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerDelete::PopulateToolbarL() + { + TRACER( "CGlxCommandHandlerRename::PopulateToolbar" ); + + iUiUtility->ScreenFurniture()->SetTooltipL( EGlxCmdDelete, CAknButton::EPositionLeft ); + } + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerDelete::DoIsDisabled(TInt aCommandId, + MGlxMediaList& aList) const + { + TRACER( "CGlxCommandHandlerDelete::DoIsDisabled" ); + TBool fullscreenViewingMode = EFalse; + CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); + CMPXCollectionPath* naviState = aNavigationalState->StateLC(); + + if ( naviState->Levels() >= 1) + { + if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) + { + // For image viewer collection, goto view mode + if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + { + //it means we are in img viewer. + fullscreenViewingMode = ETrue; + } + else + { + //it means we are in grid view. + fullscreenViewingMode = EFalse; + } + } + else + { + //it means we are in Fullscreen. + fullscreenViewingMode = ETrue; + } + } + CleanupStack::PopAndDestroy( naviState ); + aNavigationalState->Close(); + if(EGlxCmdDelete==aCommandId && (0 == aList.Count() ) && !fullscreenViewingMode) + { + return ETrue; + } + return EFalse; + } +//end of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdetails.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdetails.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,323 @@ +/* +* Copyright (c) 2008-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: Details commmand handler +* +*/ + + + + +#include "glxcommandhandlerdetails.h" + +#include +#include + +#include + +#include //for gallery related constatns +#include //for command id + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include // for TMPXAttribute +#include // for CGlxAttributeRetriever +#include // for CGlxDefaultAttributeContext +#include // for CGlxResourceUtilities +#include // for TGlxFetchContextRemover + +#include //for view plugin implmentation id +#include +#include +#include //for metadata dialog +#include +#include +#include +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerDetails* + CGlxCommandHandlerDetails::NewL( + MGlxMediaListProvider* aMediaListProvider ) + { + CGlxCommandHandlerDetails* self = new (ELeave) CGlxCommandHandlerDetails(aMediaListProvider); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerDetails::CGlxCommandHandlerDetails(MGlxMediaListProvider* aMediaListProvider ) + :CGlxMediaListCommandHandler(aMediaListProvider) + { + //Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerDetails::ConstructL() + { + // Load resource file + GLX_FUNC("GLX_Property::ConstructL"); + + // register property command in command handler + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + // register property command in command handler + TCommandInfo infoProp(EGlxCmdDetails); + // Filter out static items and only allows one item to select + infoProp.iMinSelectionLength = 1; + infoProp.iMaxSelectionLength = 1; + //Allow DRM + infoProp.iDisallowDRM = EFalse; + //Allow system items + infoProp.iDisallowSystemItems= EFalse; + //Allow animation + infoProp.iStopAnimationForExecution = EFalse; + //no category filter + infoProp.iCategoryFilter = EMPXNoCategory; + AddCommandL(infoProp); + + TCommandInfo infoSubMenu(EGlxCmdDetailsOption); + infoSubMenu.iViewingState = TCommandInfo::EViewingStateBrowse; + //AddCommandL(infoSubMenu); + + // register for the reset view command so that we can + // dismiss the dialog if it is being shown when we are activated + // from SpaceUI + TCommandInfo resetViewCmd( EGlxCmdResetView ); + AddCommandL( resetViewCmd ); + + // get pointer to HUI utility + iUiUtility = CGlxUiUtility::UtilityL(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerDetails::~CGlxCommandHandlerDetails() + { + TRACER("GLX_Property::~CGlxCommandHandlerDetails"); + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + if ( iUiUtility ) + { + iUiUtility->Close(); + } + } + +// ----------------------------------------------------------------------------- +// DoExecuteL +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerDetails::DoExecuteL( TInt aCommandId, MGlxMediaList& aList ) + { + TBool consume(EFalse); + TRACER("GLX_Property::DoExecuteL"); + GLX_LOG_INFO1("GLX_Property::DoExecuteL::DoExecuteL %d",aCommandId); + switch(aCommandId) + { + case EGlxCmdDetails: + { + GLX_LOG_INFO("GLX_Property::DoExecuteL::Launch UMP"); + + CGlxDefaultAttributeContext* attrContext = CGlxDefaultAttributeContext::NewL(); + CleanupStack::PushL(attrContext); + + attrContext->AddAttributeL(KMPXMediaGeneralUri); + + aList.AddContextL(attrContext, KGlxFetchContextPriorityBlocking); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover (attrContext, aList); + + CleanupClosePushL( contextRemover); + + TInt err = GlxAttributeRetriever::RetrieveL(*attrContext,aList,ETrue); + + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + if ( err == KErrNone ) + { + TInt focusIndex = aList.FocusIndex(); + TGlxMedia item = aList.Item(focusIndex); + const CGlxMedia* media = item.Properties(); + + TBool isDrm = aList.Item(focusIndex).IsDrmProtected(); + TBool isVideo = EFalse; + + TMPXGeneralCategory type = MediaList().Item( focusIndex ).Category(); + if(type == EMPXVideo) + { + isVideo = ETrue; + } + + + //check media support uri attribute + if(media && media->IsSupported(KMPXMediaGeneralUri)) + { + const TDesC& uri = media->ValueText(KMPXMediaGeneralUri); + + HBufC* uriBuf = HBufC::NewLC(uri.Length()+2); + + TPtr uriPtr (uriBuf->Des()); + uriPtr = uri; + uriPtr.Append( isDrm ); + uriPtr.Append( isVideo ); + + GLX_DEBUG2("GLX_Property::DoExecuteL::URI:%S:",&uri); + + iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); + if (aList.Collection().UidL().iUid == KGlxCollectionPluginImageViewerImplementationUid) + { + CGlxImgVwrMetadataDialog* dialog = CGlxImgVwrMetadataDialog::NewL( uri); + dialog->ExecuteLD(); + } + else + { + CGlxMetadataDialog* dialog = CGlxMetadataDialog::NewL( uri ); + dialog->ExecuteLD(); + } + + + CleanupStack::PopAndDestroy(uriBuf); + } + } + CleanupStack::PopAndDestroy( attrContext ); + consume = ETrue; + break; + }// contextRemover goes out of scope and removes the context from media list + default: + { + break; + } + } + + return consume; + } +// ----------------------------------------------------------------------------- +// LaunchViewL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerDetails::LaunchViewL(TUid aViewPluginId,const TDesC& aURI) + { + TRACER("GLX_UMP::CGlxCommandHandlerDetails:LaunchViewL"); + + MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL(); + CleanupClosePushL(*viewUtility); + + if( aURI.Length() > 0 ) + { + //following is to preserve unicode format of filename + //Convert aURI 16 bit descriptor to 8 bit descriptor + TPtrC8 ptr8((TUint8*)aURI.Ptr(),aURI.Length()); + GLX_LOG_INFO1("GLX_UMP::CGlxCommandHandlerDetails:ActivateViewL::ptr8:%S:",&ptr8); + + //convert back to 16 bit descriptor + TPtrC16 ptr16((TUint16*)ptr8.Ptr(),ptr8.Length()); + GLX_LOG_INFO1("GLX_UMP::CGlxCommandHandlerDetails:ActivateViewL::ptr16:%S:",&ptr16); + + viewUtility->ActivateViewL(aViewPluginId,&ptr16); + } + else + { + viewUtility->ActivateViewL(aViewPluginId,&KNullDesC); + } + + CleanupStack::PopAndDestroy(viewUtility); + } +// ----------------------------------------------------------------------------- +// DoActivateL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerDetails::DoActivateL( TInt /*aViewId*/ ) + { + + } + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerDetails::DoIsDisabled(TInt aCommandId, + MGlxMediaList& aList) const + { + TBool fullscreenViewingMode = EFalse; + CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); + CMPXCollectionPath* naviState = aNavigationalState->StateLC(); + + if ( naviState->Levels() >= 1) + { + if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) + { + // For image viewer collection, goto view mode + if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + { + //it means we are in img viewer.so details will be available + fullscreenViewingMode = ETrue; + } + else + { + //it means we are in grid view.so details will be not beavailable + fullscreenViewingMode = EFalse; + } + } + else + { + //it means we are in Fullscreen.so details will be available + fullscreenViewingMode = ETrue; + } + } + CleanupStack::PopAndDestroy( naviState ); + aNavigationalState->Close(); + + if(EGlxCmdDetails==aCommandId && (0 == aList.Count() || 1 != aList.SelectionCount())&& !fullscreenViewingMode ) + { + return ETrue; + } + return EFalse; + } + + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdownload.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerdownload.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2008-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: Download commmand handler +* +*/ + + + + + +/** + * @internal reviewed 26/06/2007 by Rowland Cook + */ + +// CLASS HEADER +#include "glxcommandhandlerdownload.h" + + +// EXTERNAL INCLUDES +#include // for favourites context IDs +#include + +// INTERNAL INCLUDES +#include // for EGlxCmdDownloadImages, + // and EGlxCmdDownloadVideos +#include // for debug logging + + + +// LOCAL FUNCTIONS AND CONSTANTS + + + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerDownload* CGlxCommandHandlerDownload::NewL() + { + CGlxCommandHandlerDownload* self = + new (ELeave) CGlxCommandHandlerDownload(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// C++ default constructor +// ---------------------------------------------------------------------------- +CGlxCommandHandlerDownload::CGlxCommandHandlerDownload():CGlxCommandHandler() + { + // nothing to do + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerDownload::ConstructL() + { + // No implemenation required + } + + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerDownload::~CGlxCommandHandlerDownload() + { + // No implemenation required + } + + + +// ---------------------------------------------------------------------------- +// ExecuteL +// ---------------------------------------------------------------------------- +TBool CGlxCommandHandlerDownload::ExecuteL(TInt aCommandId) + { + GLX_FUNC("CGlxCommandHandlerDownload::ExecuteL"); + TInt contextId = KFavouritesNullContextId; + if(aCommandId == EGlxCmdDownloadImages) + { + contextId = KFavouritesImageContextId; + } + else if(aCommandId == EGlxCmdDownloadVideos) + { + contextId = KFavouritesVideoContextId; + } + + if(contextId != KFavouritesNullContextId) + { + + // Launches the browser with specific context id + CBrowserLauncher* browserLauncher = CBrowserLauncher::NewLC(); + browserLauncher->LaunchBrowserSyncEmbeddedL( contextId ) ; + CleanupStack::PopAndDestroy(browserLauncher); // browserLauncher; + + return ETrue; + } + + return EFalse; + } + + + + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerfilterimagesorvideos.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerfilterimagesorvideos.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,336 @@ +/* +* Copyright (c) 2008-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: Show commmand handler +* +*/ + + + + +#include "glxcommandhandlerfilterimagesorvideos.h" + +#include + +#include +#include +#include +#include +#include +#include +#include // for feature flags + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +// --------------------------------------------------------------------------- +// C++ default constructor. Inlined to save a bit of rom, note that for inline +// it needs to be before its use in NewL +// --------------------------------------------------------------------------- +inline +CGlxCommandHandlerFilterImagesOrVideos::CGlxCommandHandlerFilterImagesOrVideos( + MGlxMediaListProvider* aMediaListProvider, + CGlxUiUtility& aUiUtility ) + : CGlxMediaListCommandHandler( aMediaListProvider ), + iUiUtility( aUiUtility ) + { + // No implentation + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerFilterImagesOrVideos* + CGlxCommandHandlerFilterImagesOrVideos::NewL( + MGlxMediaListProvider* aMediaListProvider ) + { + // get Hui utility, if it fails we leave the whole construction + CGlxUiUtility* utility = CGlxUiUtility::UtilityL(); + // put utility to cleanupstack in case allocating self fails + CleanupClosePushL( *utility ); + // we have HUI utility so create the class next, give the + // dereferenced hui utility for it so self takes ownership + CGlxCommandHandlerFilterImagesOrVideos* self = + new( ELeave ) CGlxCommandHandlerFilterImagesOrVideos( + aMediaListProvider, + *utility ); + // take utility out of stack as ownership transferred to this class + CleanupStack::PopAndDestroy( utility ); + // perform 2nd phase + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerFilterImagesOrVideos::~CGlxCommandHandlerFilterImagesOrVideos() + { + TRACER("CGlxCommandHandlerFilterImagesOrVideos::~CGlxCommandHandlerFilterImagesOrVideos"); + // remember to close the instance of huiutility + iUiUtility.Close(); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxCommandHandlerFilterImagesOrVideos::ConstructL() + { + // create the commands + TCommandInfo info( EGlxCmdShowAll ); + // show only in Grid view + info.iViewingState = TCommandInfo::EViewingStateBrowse; + // Enable for any item count + info.iMinSelectionLength = 0; + AddCommandL( info ); + + info.iCommandId = EGlxCmdShowImages; + AddCommandL( info ); + + info.iCommandId = EGlxCmdShowVideos; + AddCommandL( info ); + + info.iCommandId = EGlxCmdShow; + AddCommandL( info ); + } + +// ----------------------------------------------------------------------------- +// DynInitMenuPaneL +// ----------------------------------------------------------------------------- +void CGlxCommandHandlerFilterImagesOrVideos::DynInitMenuPaneL( + TInt /*aResourceId*/, CEikMenuPane* aMenuPane ) + { + if( iInFullScreen ) + { + // We are is Full screen so dim/hide the "Show" menu + // this dims/hides the cascade as well + if( aMenuPane ) + { + TInt pos; + if ( aMenuPane->MenuItemExists( EGlxCmdShow, pos ) ) + { + aMenuPane->SetItemDimmed( EGlxCmdShow, ETrue ); + } + } + } + else + { + // We are in the Grid View so Filter out the menu options accordingly + + // Get the orginal filter used by the media list + CMPXFilter* orgFilter = MediaList().Filter(); + TGlxFilterItemType currentItemType = EGlxFilterVideoAndImages; + + // If a filter is used get the current itemtype + // If no filter is used the everything is displayed which is the same + // as EGlxFilterVideoAndImages + if( orgFilter ) + { + if( orgFilter->IsSupported( KGlxFilterGeneralItemType ) ) + { + currentItemType = *(orgFilter->Value( + KGlxFilterGeneralItemType ) ); + } + } + // This will contain the Id of the command to dim/hide + TInt commandIdToDim = 0; + switch( currentItemType ) + { + case EGlxFilterVideoAndImages: + { + // As the current filter type is EGlxFilterVideoAndImages we + // should remove the "All" option from the menu + commandIdToDim = EGlxCmdShowAll; + break; + } + case EGlxFilterImage: + { + // As the current filter type is EGlxFilterImage we + // should remove the "Images" option from the menu + commandIdToDim = EGlxCmdShowImages; + break; + } + case EGlxFilterVideo: + { + // As the current filter type is EGlxFilterVideo we + // should remove the "Videos" option from the menu + commandIdToDim = EGlxCmdShowVideos; + break; + } + default: + { + // This case does not happen in real life. + // If it does then all three options get displayed on the menu + break; + } + } + + // Now dim/hide the required menu option + if (commandIdToDim && aMenuPane) + { + TInt pos; + if ( aMenuPane->MenuItemExists(commandIdToDim, pos) ) + { + aMenuPane->SetItemDimmed(commandIdToDim, ETrue); + } + } + } + } + +// ----------------------------------------------------------------------------- +// DoActivateL +// ----------------------------------------------------------------------------- +void CGlxCommandHandlerFilterImagesOrVideos::DoActivateL( TInt /*aViewId*/ ) + { + // If the Direction is forwards then we have come from the list view + // In which case we make sure the filter is displaying both Images and Videos + TGlxNavigationDirection navDir = iUiUtility.ViewNavigationDirection(); + if( EGlxNavigationForwards == navDir ) + { + SetItemTypeInMediaListL( EGlxFilterVideoAndImages ); + } + } + +// ----------------------------------------------------------------------------- +// ExecuteL +// ----------------------------------------------------------------------------- +TBool CGlxCommandHandlerFilterImagesOrVideos::DoExecuteL( + TInt aCommandId, MGlxMediaList& /*aList*/ ) + { + TRACER("CGlxCommandHandlerFilterImagesOrVideos::ExecuteL"); + + TBool consume = EFalse; + // Create an Item Type and set it to something invalid (within this context) + TGlxFilterItemType itemType = EGlxFilterMediaTypeSuppliedInFilter; + + switch( aCommandId ) + { + case EGlxCmdShowAll: + { + // Set ItemType to Display All + itemType = EGlxFilterVideoAndImages; + consume = ETrue; + break; + } + case EGlxCmdShowImages: + { + // Set ItemType to Display Images + itemType = EGlxFilterImage; + consume = ETrue; + break; + } + case EGlxCmdShowVideos: + { + // Set ItemType to Display Videos + itemType = EGlxFilterVideo; + consume = ETrue; + break; + } + case EGlxCmdStateView: + { + // We are now in Full Screen mode + iInFullScreen = ETrue; + consume = ETrue; + break; + } + case EGlxCmdStateBrowse: + { + // We are now in the Grid view + iInFullScreen = EFalse; + consume = ETrue; + break; + } + default: // No need to do anything + { + break; + } + } + + // Has the item type been set + if( EGlxFilterMediaTypeSuppliedInFilter != itemType ) + { + // Inform media list of ItemType change + SetItemTypeInMediaListL( itemType ); + } + + return consume; + } + +// ----------------------------------------------------------------------------- +// SetItemTypeInMediaListL +// ----------------------------------------------------------------------------- +void CGlxCommandHandlerFilterImagesOrVideos::SetItemTypeInMediaListL( + TGlxFilterItemType aItemType) + { + CMPXFilter* currentFilter = MediaList().Filter(); + if( currentFilter ) + { + // Examine the item type used + if( currentFilter->IsSupported( KGlxFilterGeneralItemType ) ) + { + TGlxFilterItemType itemType = EGlxFilterVideoAndImages; + itemType = *(currentFilter->Value( + KGlxFilterGeneralItemType)); + + // Is the itemType already set to what we want. + if( aItemType != itemType ) + { + // No it's not so change it. + // Create a TGlxFilterProperties with the correct itemType + TGlxFilterProperties filterProperties; + filterProperties.iItemType = aItemType; + + // Create a Filter based on the current filter but with the + // new itemType + CMPXFilter* newFilter = TGlxFilterFactory::CreateCombinedFilterL( + filterProperties, + currentFilter, + ETrue); + CleanupStack::PushL(newFilter); + + // Set this filter in the media list + MediaList().SetFilterL( newFilter ); + CleanupStack::PopAndDestroy( newFilter ); + } + } + } + else + { + // There is no filter set. So everything is displayed + // Check if this is what we want. + // If no filter is set and we need to display everything then there is + // no need to do anything. + if( EGlxFilterVideoAndImages != aItemType ) + { + // We do not want all so change it. + // Create a TGlxFilterProperties with the correct itemType + TGlxFilterProperties filterProperties; + filterProperties.iItemType = aItemType; + + // Create a Filter with the new itemType + CMPXFilter* newFilter = + TGlxFilterFactory::CreateCombinedFilterL( filterProperties ); + CleanupStack::PushL( newFilter ); + + // Set this filter in the media list + MediaList().SetFilterL( newFilter ); + CleanupStack::PopAndDestroy( newFilter ); + } + } + } + + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerhelp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerhelp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2008-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: Launch help application with appropriate help context +* +*/ + + + + + +/** + * @internal reviewed 03/07/2007 by David Holland + */ + + + +#include "glxcommandhandlerhelp.h" +#include + +#include + +#include +#include + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C TGlxHelpContext::TGlxHelpContext() + { + iMajor = TUid::Uid( KGlxGalleryApplicationUid ); + iBrowseContext = KNullDesC; + iViewContext = KNullDesC; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerHelp* + CGlxCommandHandlerHelp::NewL(TGlxHelpContext aHelpContext) + { + CGlxCommandHandlerHelp* self = new ( ELeave ) + CGlxCommandHandlerHelp(aHelpContext); + + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerHelp::CGlxCommandHandlerHelp(TGlxHelpContext aHelpContext) +:CGlxCommandHandler(), iHelpContext(aHelpContext) + { + // Do nothing + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerHelp::~CGlxCommandHandlerHelp() + { + // No implementation + } + +// --------------------------------------------------------------------------- +// DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::DoActivateL(TInt /*aViewId*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// Deactivate +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::Deactivate() + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerHelp::ExecuteL(TInt aCommandId) + { + TBool handledCommand = ETrue; + + switch (aCommandId) + { + case EAknCmdHelp: + { + LaunchHelpL(); + break; + } + case EGlxCmdStateView: + iInFullScreen = ETrue; + handledCommand = EFalse; + break; + + case EGlxCmdStateBrowse: + iInFullScreen = EFalse; + handledCommand = EFalse; + break; + default: + { + handledCommand = EFalse; + break; + } + } + + return handledCommand; + } + +// --------------------------------------------------------------------------- +// DynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::DynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* /*aMenuPane*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// OfferKeyEventL +// --------------------------------------------------------------------------- +// +TKeyResponse CGlxCommandHandlerHelp:: + OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// --------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::PreDynInitMenuPaneL( TInt /*aResourceId*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// LaunchHelpL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::LaunchHelpL() + { + TCoeHelpContext helpContext; + + helpContext.iMajor = iHelpContext.iMajor; + + if(iInFullScreen) + { + helpContext.iContext = iHelpContext.iViewContext; + } + else + { + helpContext.iContext = iHelpContext.iBrowseContext; + } + + + // Create the context array and append the single context item + CArrayFix* contextArray = + new ( ELeave ) CArrayFixFlat ( 1 ); + + CleanupStack::PushL( contextArray ); + contextArray->AppendL( helpContext ); + CleanupStack::Pop( contextArray ); + + //Launch help - takes ownership of context array + RWsSession& wsSession = CCoeEnv::Static()->WsSession(); + HlpLauncher::LaunchHelpApplicationL( wsSession, + contextArray ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerhideui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerhideui.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2008-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: Rotate command implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxcommandhandlerhideui.h" + +#include +#include +#include + +#include "glxcommandhandlers.hrh" + + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerHideUi* CGlxCommandHandlerHideUi::NewL() + { + CGlxCommandHandlerHideUi* self + = new (ELeave) CGlxCommandHandlerHideUi(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerHideUi::CGlxCommandHandlerHideUi():CGlxCommandHandler() + { + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHideUi::ConstructL() + { + iUiUtility = CGlxUiUtility::UtilityL(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerHideUi::~CGlxCommandHandlerHideUi() + { + if ( iUiUtility ) + { + iUiUtility->Close(); + } + } + +// --------------------------------------------------------------------------- +// ExecuteL +// --------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerHideUi::ExecuteL(TInt aCommand) + { + GLX_LOG_INFO("CGlxCommandHandlerHideUi::ExecuteL"); + TBool handled = EFalse; + + switch ( aCommand ) + { + case EGlxCmdStateView: + // Moved to full screen + iCommandAvailable = ETrue; + break; + + case EGlxCmdStateBrowse: + // Moved back to Grid view + iCommandAvailable = EFalse; + break; + + case EGlxCmdHideUI: + { + handled = ETrue; + } + break; + + default: + break; + } + + return handled; + } + +// --------------------------------------------------------------------------- +// DynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHideUi::DynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* aMenuPane) + { + if ( !iCommandAvailable && aMenuPane ) + { + TInt pos; + if ( aMenuPane->MenuItemExists(EGlxCmdHideUI, pos) ) + { + aMenuPane->SetItemDimmed(EGlxCmdHideUI, ETrue); + } + } + } + +// --------------------------------------------------------------------------- +// DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHideUi::DoActivateL(TInt aViewId) + { + iViewId = aViewId; + } + +// --------------------------------------------------------------------------- +// Deactivate +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHideUi::Deactivate() + { + // No implementation + } + +// --------------------------------------------------------------------------- +// OfferKeyEventL +// --------------------------------------------------------------------------- +// +TKeyResponse CGlxCommandHandlerHideUi::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// --------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHideUi::PreDynInitMenuPaneL( TInt /*aResourceId*/ ) + { + // No implementation + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlernewmedia.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlernewmedia.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,496 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +/** + * @internal reviewed 06/06/2007 by Dave Schofield + */ + +#include "glxcommandhandlernewmedia.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +const TInt KMaxMediaPopupTitleLength = 0x28; // Accepts only 40 characters +const TInt KMaxNewMediaItemTitleLength = 0x28; // Accepts only 40 characters +const TInt KMaxNumberLength = 10; + +_LIT(KOpenBracket, "("); +_LIT(KCloseBracket, ")"); +_LIT(KFileNameFormatString, "(%+02u)"); +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerNewMedia* CGlxCommandHandlerNewMedia::NewL(MGlxMediaListProvider* aMediaListProvider) + { + CGlxCommandHandlerNewMedia* self = new (ELeave) CGlxCommandHandlerNewMedia(aMediaListProvider); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerNewMedia::CGlxCommandHandlerNewMedia(MGlxMediaListProvider* aMediaListProvider) + : CGlxMpxCommandCommandHandler(aMediaListProvider) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerNewMedia::DoHandleCommandCompleteL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerNewMedia::DoHandleCommandCompleteL(TAny* /*aSessionId*/, CMPXCommand* aCommandResult, + TInt aError, MGlxMediaList* /*aList*/) + { + if (aError == KErrNone && aCommandResult && aCommandResult->IsSupported(KMPXMediaGeneralId)) + { + iNewMediaId = TGlxMediaId(aCommandResult->ValueTObjectL(KMPXMediaGeneralId)); + iOkToExit = EFalse; // wait for media id to be added to the list + // (unless we are using iSchedulerWait) + } + + if (iSchedulerWait && aError != KErrAlreadyExists ) + { + // if iSchedulerWait exists then we know the command is being executed from + // the ExecuteLD() method. + iNewMediaCreationError = aError; + iSchedulerWait->AsyncStop(); + } + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerNewMedia::OkToExit +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxCommandHandlerNewMedia::OkToExit() const + { + return iOkToExit; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerNewMedia::ConstructL() + { + iFileNameAlreadyExists = EFalse ; + // Load resource file + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + iAsyncFocuser = new (ELeave) CGlxAsyncFocuser(this); + // Add supported command + TCommandInfo info(EGlxCmdAddMedia); + // Filter out static items + AddCommandL(info); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerNewMedia::~CGlxCommandHandlerNewMedia() + { + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + delete iSchedulerWait; + delete iAsyncFocuser; + delete iNewMediaItemTitle; + } + +// --------------------------------------------------------------------------- +// CGlxCommandHandlerNewMedia::ExecuteLD() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxCommandHandlerNewMedia::ExecuteLD(TGlxMediaId& aNewMediaId) + { + CleanupStack::PushL(this); + iSchedulerWait = new (ELeave) CActiveSchedulerWait(); + + CGlxMpxCommandCommandHandler::ExecuteL( EGlxCmdAddMedia ); + if (iNewMediaCreationError == KErrNone) + { + // The user pressed OK on the dialog. We need to wait for DoHandleCommandComplete() + iSchedulerWait->Start(); + + if (iNewMediaCreationError == KErrNone) + { + aNewMediaId = iNewMediaId; + } + } + + TInt error = iNewMediaCreationError; + CleanupStack::PopAndDestroy(this); + return error; + } + +// --------------------------------------------------------------------------- +// Create an add to container command +// --------------------------------------------------------------------------- +// +CMPXCommand* CGlxCommandHandlerNewMedia::CreateCommandL(TInt /*aCommandId*/, + MGlxMediaList& aMediaList, TBool& /*aConsume*/) const + { + iOkToExit = ETrue; + + CMPXCollectionPath* path = aMediaList.PathLC( NGlxListDefs::EPathParent ); + CMPXCommand* command = NULL; + + TBuf defaultNewMediaItemTitle; + + TitlesL(TGlxMediaId(path->Id(0)), defaultNewMediaItemTitle); + + HBufC* mediaPopupTitle = StringLoader::LoadLC(R_GLX_PROMPT_NAME); + if(iFileNameAlreadyExists) + { + iFileNameAlreadyExists = EFalse ; + } + else + { + delete iNewMediaItemTitle; + iNewMediaItemTitle = NULL; + iNewMediaItemTitle = GenerateNewMediaItemTitleL(defaultNewMediaItemTitle, aMediaList); + } + TPtr newMediaItemTitleDes = iNewMediaItemTitle->Des(); + + CGlxTextEntryPopup* dialog = CGlxTextEntryPopup::NewL(*mediaPopupTitle, newMediaItemTitleDes); + + + if(dialog->ExecuteLD() == EEikBidOk) + { + command = TGlxCommandFactory::AddContainerCommandLC(*iNewMediaItemTitle, path->Id(0)); + CleanupStack::Pop(command); + } + else + { + iNewMediaCreationError = KErrCancel; + } + + CleanupStack::PopAndDestroy(mediaPopupTitle); + CleanupStack::PopAndDestroy(path); + return command; + } + + +// --------------------------------------------------------------------------- +// CGlxCommandHandlerNewMedia::HandleErrorL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerNewMedia::HandleErrorL(TInt aError) + { + if (aError == KErrAlreadyExists && iNewMediaItemTitle) + { + HBufC* info = StringLoader::LoadLC(R_GLX_NAME_ALREADY_USED, *iNewMediaItemTitle); + GlxGeneralUiUtilities::ShowInfoNoteL(*info, ETrue); + CleanupStack::PopAndDestroy(info); + iFileNameAlreadyExists = ETrue ; + // As the new Item name already existing , re-execute the command to show entry pop-up + CGlxMpxCommandCommandHandler::ExecuteL( EGlxCmdAddMedia ); + if (iSchedulerWait && iNewMediaCreationError == KErrCancel ) + { + // if iSchedulerWait exists then we know the command is being executed from + // the ExecuteLD() method. + // Stop the schedulerwait loop if dialog is cancelled after starting the schedulerwait loop + iSchedulerWait->AsyncStop(); + } + } + else + { + // Use default error handler + CGlxMpxCommandCommandHandler::HandleErrorL(aError); + } + } + +// ----------------------------------------------------------------------------- +// BypassFiltersForExecute +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxCommandHandlerNewMedia::BypassFiltersForExecute() const + { + // if iSchedulerWait exists then we know the command is being executed from + // the ExecuteLD() method and filtering is not required. + return iSchedulerWait != NULL; + } + +// --------------------------------------------------------------------------- +// TitlesL fetches the 'media popup title' and 'default new media item title' +// from the collection. +// --------------------------------------------------------------------------- +// + +void CGlxCommandHandlerNewMedia::TitlesL(const TGlxMediaId aCollectionId, TDes& aDefaultNewMediaItemTitle) const + { + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + MGlxMediaList* rootList = MGlxMediaList::InstanceL(*path); + CleanupClosePushL(*rootList); + + TGlxSpecificIdIterator iter(KGlxIdSpaceIdRoot, aCollectionId); + CGlxAttributeContext* attributeContext = new (ELeave) CGlxAttributeContext(&iter); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(KGlxMediaCollectionPluginSpecificDefaultMediaTitle); + rootList->AddContextL(attributeContext, KGlxFetchContextPriorityBlocking); + + TGlxFetchContextRemover contextRemover(attributeContext, *rootList); + // put to cleanupstack as cleanupstack is emptied before stack objects + // are deleted + CleanupClosePushL( contextRemover ); + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext, *rootList, ETrue)); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + TInt index = rootList->Index(KGlxIdSpaceIdRoot, aCollectionId); + + __ASSERT_DEBUG(index != KErrNotFound, Panic(EGlxPanicRequiredItemNotFound)); + + TGlxMedia item = rootList->Item(index); + + const CGlxMedia* media = item.Properties(); + if (media) + { + aDefaultNewMediaItemTitle.Copy(media->ValueText(KGlxMediaCollectionPluginSpecificDefaultMediaTitle).Left(KMaxMediaPopupTitleLength)); + } + + CleanupStack::PopAndDestroy(attributeContext); + CleanupStack::PopAndDestroy(rootList); + CleanupStack::PopAndDestroy(path); + } + +// --------------------------------------------------------------------------- +// TitlesL fetches the 'media popup title' and 'default new media item title' +// from the collection. +// --------------------------------------------------------------------------- +// +HBufC* CGlxCommandHandlerNewMedia::GenerateNewMediaItemTitleL + (const TDesC& aDefaultNewMediaItemTitle, MGlxMediaList& aList) const + { + TGlxSequentialIterator iter; + CGlxAttributeContext* attributeContext = new (ELeave) CGlxAttributeContext(&iter); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(KMPXMediaGeneralTitle); + aList.AddContextL(attributeContext, KGlxFetchContextPriorityBlocking); + TGlxFetchContextRemover contextRemover(attributeContext, aList); + // put to cleanupstack as cleanupstack is emptied before stack objects + // are deleted + CleanupClosePushL( contextRemover ); + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext, aList, ETrue)); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + CleanupStack::PopAndDestroy(attributeContext); + + RArray numbers; + CleanupClosePushL(numbers); + + TInt count = aList.Count(); + for (TInt i = 0; i < count; i++) + { + TGlxMedia item = aList.Item(i); + const CGlxMedia* media = item.Properties(); + if (media) + { + const TDesC& title = media->ValueText(KMPXMediaGeneralTitle); + + TInt length = aDefaultNewMediaItemTitle.Length(); + if (title.Left(length).Compare(aDefaultNewMediaItemTitle) == 0) + { + if (length == title.Length()) + { + numbers.InsertInOrder(0); // special case + } + else if(title.Length() > length + KOpenBracket().Length() + KCloseBracket().Length()) + { + TInt pos = length; + length = KOpenBracket().Length(); + + if (title.Mid(pos, length).Compare(KOpenBracket) == 0 && + title.Right(KCloseBracket().Length()).Compare(KCloseBracket) == 0) + { + pos += length; + length = title.Length() - pos - KCloseBracket().Length(); + if (length > 0) + { + TLex lex = title.Mid(pos, length); + TInt val = 0; + if (lex.Val(val) == KErrNone) + { + numbers.InsertInOrder(val); + } + } + } + } + + } + } + } + + TInt nextNumber = 0; + count = numbers.Count(); + for (TInt i = 0; i < count; i++) + { + if (numbers[i] == nextNumber) + { + nextNumber++; + } + else + { + break; + } + } + + CleanupStack::PopAndDestroy(&numbers); + + TInt defaultTitleLength = aDefaultNewMediaItemTitle.Length() + KFileNameFormatString().Length() + KCloseBracket().Length() + KMaxNumberLength; + // If the default title length is bigger than KMaxMediaPopupTitleLength, make sure we allocate enough space for it. + TInt titleLength = defaultTitleLength > KMaxMediaPopupTitleLength ? defaultTitleLength : KMaxMediaPopupTitleLength; + HBufC* newMediaItemTitle = HBufC::NewL(titleLength); + TPtr newMediaItemTitleDes = newMediaItemTitle->Des(); + newMediaItemTitleDes.Append(aDefaultNewMediaItemTitle); + + if (nextNumber > 0) + { + newMediaItemTitleDes.AppendFormat(KFileNameFormatString,nextNumber); + } + else + { + // 0 is a special case, return "New Media", not "New Media (0)" + } + + return newMediaItemTitle; + } + +// ----------------------------------------------------------------------------- +// SetFocusL() +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerNewMedia::SetFocusL(TInt aIndex) + { + iOkToExit = ETrue; + MediaList().SetFocusL(NGlxListDefs::EAbsolute, aIndex); + TryExitL(KErrNone); + } + +// ----------------------------------------------------------------------------- +// HandleItemAddedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxCommandHandlerNewMedia::HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList) + { + if(aList == &MediaList() && iNewMediaId != KGlxCollectionRootId) + { + for (TInt i = aStartIndex; i <= aEndIndex; i++) + { + if (aList->Item(i).Id() == iNewMediaId) + { + iAsyncFocuser->SetFocus(i); // calls CGlxCommandHandlerNewMedia::SetFocusL asynchronously + break; + } + } + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerNewMedia::CGlxAsyncFocuser:: + CGlxAsyncFocuser(CGlxCommandHandlerNewMedia* aGlxCommandHandlerNewMedia) + : CActive(KMaxTInt), iGlxCommandHandlerNewMedia(aGlxCommandHandlerNewMedia) + // The active object has the maximum possible priority to prevent other active objects + // running before it. (Unless they too are scheduled to run and have the maximum + // possible priority + { + __ASSERT_DEBUG(aGlxCommandHandlerNewMedia, Panic(EGlxPanicNullPointer)); + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxCommandHandlerNewMedia::CGlxAsyncFocuser:: + ~CGlxAsyncFocuser() + { + Cancel(); + } + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerNewMedia::CGlxAsyncFocuser::RunL() + { + iGlxCommandHandlerNewMedia->SetFocusL(iFocusIndex); + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerNewMedia::CGlxAsyncFocuser::DoCancel() + { + // No need to do anything + // CActive::Cancel() will wait for the request to complete + } + +// ----------------------------------------------------------------------------- +// SetFocusL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerNewMedia::CGlxAsyncFocuser::SetFocus(TInt aIndex) + { + iFocusIndex = aIndex; + TRequestStatus* requestStatus = &iStatus; + User::RequestComplete(requestStatus,KErrNone); + SetActive(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleropen.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleropen.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2008-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: Launch help application with appropriate help context +* +*/ + + + + +#include "glxcommandhandleropen.h" +#include +#include + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerOpen* CGlxCommandHandlerOpen::NewL(MGlxMediaListProvider* aMediaListProvider) + { + CGlxCommandHandlerOpen* self = new ( ELeave ) CGlxCommandHandlerOpen(aMediaListProvider); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerOpen::CGlxCommandHandlerOpen(MGlxMediaListProvider* aMediaListProvider) + : CGlxMediaListCommandHandler(aMediaListProvider) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerOpen::ConstructL() + { + + iUiUtility = CGlxUiUtility::UtilityL(); + + // Add supported command + TCommandInfo info(EAknCmdOpen); + info.iCategoryFilter = EMPXVideo; + info.iCategoryRule = TCommandInfo::EForbidAll; + info.iDisallowSystemItems = EFalse; + AddCommandL( info ); + } + + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerOpen::~CGlxCommandHandlerOpen() + { + if(iUiUtility) + { + iUiUtility->Close(); + } + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerOpen::DoExecuteL(TInt /*aCommandId*/,MGlxMediaList& /*aList*/) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// DoActivateL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerOpen::DoActivateL( TInt /*aViewId*/ ) + { + // No Imp. + } + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerOpen::DoIsDisabled(TInt /*aCommandId*/, + MGlxMediaList& aList) const + { + // Disable if device supports touch or + // If there are no items in the medialist or + // If there are items that are marked. + + return ( iUiUtility->IsPenSupported() || + aList.Count() == 0 || aList.SelectionCount()>0 ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerremovefrom.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerremovefrom.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +#include "glxcommandhandlerremovefrom.h" + +#include +#include + +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include +#include + +#include "glxcommandfactory.h" + +// --------------------------------------------------------------------------- +// Return add (to) tags command handler +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerRemoveFrom* + CGlxCommandHandlerRemoveFrom::NewRemFromFavCommandHandlerL( + MGlxMediaListProvider* aMediaListProvider) + { + return CGlxCommandHandlerRemoveFrom::NewL(aMediaListProvider, + EMPXAlbum, EGlxCmdRemoveFromFavourites); + } + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerRemoveFrom* CGlxCommandHandlerRemoveFrom::NewL( + MGlxMediaListProvider* aMediaListProvider, TMPXGeneralCategory aContainerType, + TInt aCommandId) + { + CGlxCommandHandlerRemoveFrom* self = new (ELeave) CGlxCommandHandlerRemoveFrom( + aMediaListProvider, aContainerType); + CleanupStack::PushL(self); + self->ConstructL(aCommandId); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerRemoveFrom::CGlxCommandHandlerRemoveFrom(MGlxMediaListProvider* + aMediaListProvider, TMPXGeneralCategory aContainerType): + CGlxMpxCommandCommandHandler(aMediaListProvider), iContainerType(aContainerType) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRemoveFrom::ConstructL(TInt aCommandId) + { + // Load resource file + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + // Add supported command + TCommandInfo info(EGlxCmdRemoveFrom); + // Filter out static items + info.iMinSelectionLength = 1; + info.iMaxSelectionLength = KMaxTInt; + AddCommandL(info); + + // Add Remove From Favourites Command + TCommandInfo removeFav(EGlxCmdRemoveFromFavourites); + removeFav.iMinSelectionLength = 1; + removeFav.iMaxSelectionLength = 1; + AddCommandL(removeFav); + + // Store this value to show the correct Text + iCommandId = aCommandId; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerRemoveFrom::~CGlxCommandHandlerRemoveFrom() + { + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + } + +// --------------------------------------------------------------------------- +// SetContainerId +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxCommandHandlerRemoveFrom::SetContainerId(TGlxMediaId aContainerId) + { + iRemoveFromContainerId = aContainerId; + } + +// --------------------------------------------------------------------------- +// Create an add to container command +// --------------------------------------------------------------------------- +// +CMPXCommand* CGlxCommandHandlerRemoveFrom::CreateCommandL(TInt aCommandId, + MGlxMediaList& aMediaList, TBool& /*aConsume*/) const + { + CMPXCollectionPath* path = aMediaList.PathLC(); + CMPXCommand* command = NULL; + if (aCommandId == EGlxCmdRemoveFromFavourites) + { + // Hardcoding this to the favourites + TGlxMediaId favId(1); + + command = TGlxCommandFactory::RemoveFromContainerCommandLC(favId, *path); + } + else + { + if (iRemoveFromContainerId == KGlxIdNone) + { + command = TGlxCommandFactory::RemoveFromContainerCommandLC(*path); + } + else + { + command = TGlxCommandFactory::RemoveFromContainerCommandLC(iRemoveFromContainerId, *path); + } + } + CleanupStack::Pop(command); + CleanupStack::PopAndDestroy(path); + return command; + } + +// ----------------------------------------------------------------------------- +// CGlxCommandHandlerAddToFavourites::CompletionTextL +// ----------------------------------------------------------------------------- +// +HBufC* CGlxCommandHandlerRemoveFrom::CompletionTextL() const + { + HBufC* text = NULL; + if (iCommandId == EGlxCmdRemoveFromFavourites) + { + text = StringLoader::LoadL(R_GLX_COMPLETION_REM_FROM_FAVOURITES); + } + return text; + } + + +// ----------------------------------------------------------------------------- +// Return confirmation string +// ----------------------------------------------------------------------------- +// +HBufC* CGlxCommandHandlerRemoveFrom::ConfirmationTextL(TInt aCommandId, + TBool aMultiSelection) const + { + HBufC* text = NULL; + if (EGlxCmdRemoveFromFavourites != aCommandId) + { + switch (iContainerType) + { + case EMPXAlbum: + if (aMultiSelection) + { + text = StringLoader::LoadL(R_GLX_CONFIRMATION_REMOVE_ITEMS_ALBUM); + } + else + { + text = StringLoader::LoadL(R_GLX_CONFIRMATION_REMOVE_NAME_ALBUM); + } + break; + case EMPXTag: + if (aMultiSelection) + { + text = StringLoader::LoadL(R_GLX_CONFIRMATION_REMOVE_ITEMS_TAG); + } + else + { + text = StringLoader::LoadL(R_GLX_CONFIRMATION_REMOVE_NAME_TAG); + } + break; + default: break; // return NULL + } + } + return text; + } + +// --------------------------------------------------------------------------- +// CGlxCommandHandlerRemoveFrom::DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRemoveFrom::DoActivateL(TInt /*aViewId*/) + { + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerrename.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerrename.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,313 @@ +/* +* Copyright (c) 2008-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: Rename command handler +* +*/ + + + + +#include "glxcommandhandlerrename.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include + +#include "glxcommandfactory.h" + +namespace + { + const TInt KNameMaxLength = 128; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerRename* CGlxCommandHandlerRename::NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem ) + { + CGlxCommandHandlerRename* self = new ( ELeave ) CGlxCommandHandlerRename + ( aMediaListProvider, aHasToolbarItem ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerRename::CGlxCommandHandlerRename( MGlxMediaListProvider* + aMediaListProvider, TBool aHasToolbarItem ) + : CGlxMpxCommandCommandHandler( aMediaListProvider, aHasToolbarItem ) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRename::ConstructL() + { + iRenameText = HBufC::NewL( KNameMaxLength ); + + // Load resource file + TParse parse; + parse.Set( KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL ); + TFileName resourceFile; + resourceFile.Append( parse.FullName() ); + CGlxResourceUtilities::GetResourceFilenameL( resourceFile ); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile ); + + // Add supported command + TCommandInfo info( EGlxCmdRename ); + // This setup disables the command if a static item is focused, + // if the view is empty or if more than one item is selected. + info.iMinSelectionLength = 1; + info.iMaxSelectionLength = 1; + // Filter out system items + info.iDisallowSystemItems = ETrue; + // Allow animated GIFs to be renamed + info.iStopAnimationForExecution = ETrue; + + AddCommandL( info ); + + iErrorCallback = new (ELeave) CAsyncCallBack( TCallBack( HandleErrorL, this ), + CActive::EPriorityStandard ); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerRename::~CGlxCommandHandlerRename() + { + delete iRenameText; + + iErrorCallback->Cancel(); + delete iErrorCallback; + + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); + } + } + +// --------------------------------------------------------------------------- +// Create a rename command +// --------------------------------------------------------------------------- +// +CMPXCommand* CGlxCommandHandlerRename::CreateCommandL(TInt /*aCommandId*/, + MGlxMediaList& aMediaList, TBool& /*aConsume*/) const + { + TRACER( "CGlxCommandHandlerRename::CreateCommandL" ); + + // Return value + CMPXCommand* command = NULL; + + // Prompt the user for the new name + // + // Show popup with the item's current title + TPtr textPtr = iRenameText->Des(); + GetTitleL( textPtr, aMediaList ); + // store the current name. + TBuf currentName; + currentName.Copy(textPtr); + + // Load the title for the popup + HBufC* title = StringLoader::LoadLC( R_GLX_POPUP_RENAME_TITLE ); + CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *title, + textPtr ); + + + + if ( popup->ExecuteLD() == EEikBidOk && currentName != *iRenameText) + { + // Text entry was successful + // There can be no selection when renaming, so assume that path contains focused item + CMPXCollectionPath* path = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); + // Create the rename command with the relevant text + command = TGlxCommandFactory::RenameCommandLC( *iRenameText, *path ); + CleanupStack::Pop( command ); + CleanupStack::PopAndDestroy( path) ; + } + + CleanupStack::PopAndDestroy( title ); + + return command; + } + +// ----------------------------------------------------------------------------- +// Handle an error +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerRename::HandleErrorL(TInt aErrorCode) + { + TRACER( "CGlxCommandHandlerRename::HandleErrorL" ); + + // Callback is required because the code to handle the error is blocking + // There is only ever one command issued, store the error to handle later + iError = aErrorCode; + + __ASSERT_DEBUG( !iErrorCallback->IsActive(), Panic( EGlxPanicLogicError ) ); + iErrorCallback->CallBack(); + } + +// ----------------------------------------------------------------------------- +// Callback to handle an error +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerRename::HandleErrorL(TAny* aPtr) + { + TRACER( "CGlxCommandHandlerRename::HandleErrorL" ); + + static_cast( aPtr )->HandleErrorL(); + return 0; + } + +// ----------------------------------------------------------------------------- +// Handle an error - e.g. if user inputs a name that already exists. +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerRename::HandleErrorL() + { + TRACER( "CGlxCommandHandlerRename::HandleErrorL" ); + + // If name already exists, Show rename query and allow the user to try again + // See EMYP-7A2E6J + if ( iError == KErrAlreadyExists ) + { + HBufC* text = StringLoader::LoadLC( R_GLX_RENAME_QUERY, *iRenameText ); + + TBool confirmed = GlxGeneralUiUtilities::ConfirmQueryL( R_GLX_QUERY_OK_CANCEL, *text ); + if ( confirmed ) + { + // Let user have another try at entering the new name + ExecuteL( EGlxCmdRename ); + } + + CleanupStack::PopAndDestroy( text ); + } + else + { + // Call the base class' implementation + CGlxMpxCommandCommandHandler::HandleErrorL( iError ); + } + } + +// ----------------------------------------------------------------------------- +// Retrieve the current item's title string +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerRename::GetTitleL( TDes& aTitle, + MGlxMediaList& aList ) const + { + TRACER( "CGlxCommandHandlerRename::GetTitleL" ); + + // Set the title to a blank name by default + aTitle = KNullDesC; + + // Create an iterator to retrieve the relevant attribute + TGlxSelectionIterator iterator; + // only want the title of one item + iterator.SetRange( 1 ); + CGlxAttributeContext* context = new( ELeave ) + CGlxAttributeContext( &iterator ); + CleanupStack::PushL( context ); + + // Want to read the title attribute + // Configure the context + context->AddAttributeL( KMPXMediaGeneralTitle ); + + // Add the context to the media list + aList.AddContextL( context, KGlxFetchContextPriorityBlocking ); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover( context, aList ); + // put to cleanupstack as cleanupstack is emptied before stack objects + // are deleted + CleanupClosePushL( contextRemover ); + // Yuck - a leave and a return code! + // EFalse => don't show a progress dialog + TInt err = GlxAttributeRetriever::RetrieveL( *context, aList, EFalse ); + // Using a distinct error value as "LeaveIfError( FuncL() );" looks bad + User::LeaveIfError( err ); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + // Now get the title of the relevant item: if *an* item is selected use its + // title, otherwise use the item with focus + // Get the index of the item to rename + TInt index = KErrNotFound; + // first see if there's a selected item... + if ( aList.SelectionCount() == 1 ) + { + // Find the index of the selected item + index = aList.Count(); + do + { + --index; + } + while ( !aList.IsSelected( index ) && index > 0 ); + } + else + { + // Use the index of the item with focus + index = aList.FocusIndex(); + } + + if ( index != KErrNotFound ) + { + // use iterator to get the right item + iterator.SetToFirst( &aList ); + const CGlxMedia* media = aList.Item( iterator++ ).Properties(); + if( media ) + { + // found the item's media properties, extract the title + aTitle = media->ValueText( KMPXMediaGeneralTitle ) ; + } + } + CleanupStack::PopAndDestroy( context ); + } + +//----------------------------------------------------------------------------- +// PopulateToolbar +//----------------------------------------------------------------------------- +// +void CGlxCommandHandlerRename::PopulateToolbarL() + { + TRACER( "CGlxCommandHandlerRename::PopulateToolbar" ); + } + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerrotate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerrotate.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,558 @@ +/* +* Copyright (c) 2008-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: Temporary rotate command implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxcommandhandlerrotate.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include // Content ID identifying general category of content provided +#include + +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerRotate* + CGlxCommandHandlerRotate::NewL( + MGlxMediaListProvider* aMediaListProvider, + MGlxLayoutOwner* aLayoutOwner, + TInt aLayoutIndex) + { + TRACER("CGlxCommandHandlerRotate* CGlxCommandHandlerRotate::NewL()"); + CGlxCommandHandlerRotate* self + = new (ELeave) CGlxCommandHandlerRotate(aMediaListProvider, + aLayoutOwner, aLayoutIndex); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerRotate::~CGlxCommandHandlerRotate() + { + TRACER("CGlxCommandHandlerRotate::~CGlxCommandHandlerRotate"); + if ( iVisualListManager ) + { + iVisualListManager->Close(); + } + + if ( iUiUtility ) + { + iUiUtility->Close(); + } + iFs.Close(); + + if(iExifData != NULL) + { + delete iExifData; + iExifData = NULL; + } + if(iExifWriter != NULL) + { + delete iExifWriter; + iExifWriter = NULL; + } + } + +// --------------------------------------------------------------------------- +// DoExecuteL +// --------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerRotate::DoExecuteL(TInt aCommandId, + MGlxMediaList& aList) + { + TRACER("CGlxCommandHandlerRotate::DoExecuteL"); + TBool handled = EFalse; + TInt rotationAngle ; + iMediaList = &aList; + switch ( aCommandId ) + { + case EGlxCmdRotateLeft: + rotationAngle = -90; + break; + case EGlxCmdRotateRight: + rotationAngle = 90; + break; + default: + return handled; + } + DoRotateL(aList, rotationAngle); + + return handled; + } + +// --------------------------------------------------------------------------- +// DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::DoActivateL(TInt aViewId) + { + TRACER("CGlxCommandHandlerRotate::DoActivateL"); + iViewId = aViewId; + } + +// --------------------------------------------------------------------------- +// Deactivate +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::Deactivate() + { + TRACER("CGlxCommandHandlerRotate::Deactivate"); + + iViewId = 0; + } + + + + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleItemAddedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleAttributesAvailableL( + TInt /*aItemIndex*/, const RArray& /*aAttributes*/, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxCommandHandlerRotate::HandleAttributesAvailableL"); + + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, + TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxCommandHandlerRotate::HandleFocusChangedL"); + //Not required as we are doing this after each rotation DoPreserveOrientationL(); + DoCleanupRotationParametersL(); + + iMediaList = NULL; + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::HandleMessageL( + const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code that might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerRotate::CGlxCommandHandlerRotate( + MGlxMediaListProvider* aMediaListProvider, + MGlxLayoutOwner* aLayoutOwner, + TInt aLayoutIndex) : + CGlxMediaListCommandHandler(aMediaListProvider), + iLayoutOwner(aLayoutOwner), + iLayoutIndex(aLayoutIndex) + { + TRACER("CGlxCommandHandlerRotate::CGlxCommandHandlerRotate"); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::ConstructL() + { + TRACER("CGlxCommandHandlerRotate::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL(); + + // Add rotate command for images only + TCommandInfo rotate(EGlxCmdRotate); + rotate.iCategoryFilter = EMPXImage; + rotate.iCategoryRule = TCommandInfo::ERequireAll; + AddCommandL(rotate); + TCommandInfo rotateLeft(EGlxCmdRotateLeft); + rotateLeft.iCategoryFilter = EMPXImage; + rotateLeft.iCategoryRule = TCommandInfo::ERequireAll; + AddCommandL(rotateLeft); + TCommandInfo rotateRight(EGlxCmdRotateRight); + rotateLeft.iCategoryFilter = EMPXImage; + rotateLeft.iCategoryRule = TCommandInfo::ERequireAll; + AddCommandL(rotateRight); + + // Add view state dummy commands + TCommandInfo view(EGlxCmdStateView); + AddCommandL(view); + TCommandInfo browse(EGlxCmdStateBrowse); + AddCommandL(browse); + + //File system + User::LeaveIfError(iFs.Connect()); + iAddedObserver=EFalse; + } + + +// --------------------------------------------------------------------------- +// DoIsDisabled +// --------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerRotate::DoIsDisabled(TInt aCommandId, + MGlxMediaList& aList) const + { + TRACER("CGlxCommandHandlerRotate::DoIsDisabled"); + TBool disabled = EFalse; + /**/ + if( ViewingState() == TCommandInfo::EViewingStateView ) + { + return ETrue; + } + switch (aCommandId) + { + case EGlxCmdRotate: + case EGlxCmdRotateLeft: + case EGlxCmdRotateRight: + { + if((aList.Count()<=0) || aList.Item(aList.FocusIndex()).IsStatic()) + { + disabled = ETrue; + } + break; + } + + default: + break; + } + + return disabled; + } +// --------------------------------------------------------------------------- +// DoRotateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::DoRotateL(MGlxMediaList& /*aList*/, TInt aAngle) + { + TRACER("CGlxCommandHandlerRotate::DoRotateL"); + const TGlxMedia& item = MediaList().Item( MediaList().FocusIndex() ); + iGlxItem = &item; + GLX_LOG_INFO("CGlxCommandHandlerRotate::DoRotateL1"); + TSize imageSize(0,0); + item.GetDimensions(imageSize); + iRotationAngle += aAngle; + if(aAngle<0) + { + if (iRotationAngle < 0) + { + iRotationAngle = 270; + } + } + else + { + if (iRotationAngle > 270) + { + iRotationAngle = 0; + } + } + iFileToBeRotated.Copy(item.Uri()); + DoInitializeRotationParametersL(); + if(iInitialOrientation > 4) + { + imageSize.SetSize(imageSize.iHeight,imageSize.iWidth); + } + iUiUtility->SetRotatedImageSize(imageSize); + //Perform Rotation Here itself rather than Calling it each time + DoPreserveOrientationL(); + } + +// --------------------------------------------------------------------------- +// DoCalculateOrientationL +// --------------------------------------------------------------------------- +// +TInt CGlxCommandHandlerRotate::DoCalculateOrientationL(TInt aInitialOrientation) + { + TRACER("CGlxCommandHandlerRotate::DoCalculateOrientationL"); + /* + * possible orientation state with angles for rotation + * Possible Angles 0 - 90 - 180 - 270 + * Possible states 1 - 6 - 3 - 8 without a Flip + * Possible states 2 - 5 - 4 - 7 when Flip is on + */ + GLX_LOG_INFO("CGlxCommandHandlerRotate::DoCalculateOrientationL"); + TInt finalOrientation = aInitialOrientation; + if(aInitialOrientation >8 || aInitialOrientation <0 ) + { + return finalOrientation; + } + + //Nitz subst code + TInt rotOffset = iRotationAngle/90; + TInt isOrientationOdd = aInitialOrientation % 2; + TInt initStateIndex = 0; + TInt finalStateIndex = 0; + //Setting the orientation states for the initial unflipped orientation combinations + TInt orientationStateArray[] = {1,6,3,8}; + //Seting the index for current orientation + if(aInitialOrientation < 3) + { + initStateIndex = 0; + } + else if(aInitialOrientation >= 3 && aInitialOrientation < 5) + { + initStateIndex = 2; + } + else if(aInitialOrientation >= 5 && aInitialOrientation < 7) + { + initStateIndex = 1; + } + else if(aInitialOrientation >= 7 && aInitialOrientation <= 8) + { + initStateIndex = 3; + } + //Calculating the final orientation using the cyclic orientationStateArray. + //folding final index so that it behaves like a cyclic machine + finalStateIndex = (initStateIndex+rotOffset)%4; + finalOrientation = orientationStateArray[finalStateIndex]; + //Checking if a Flip was present + if(aInitialOrientation>4 && isOrientationOdd ) + { + finalOrientation -= 1; + } + if(aInitialOrientation<5 && !isOrientationOdd) + { + finalOrientation += 1; + } + GLX_LOG_INFO1("CGlxCommandHandlerRotate::DoCalculateOrientationL finalOrientation=%d",finalOrientation); + return finalOrientation; + } + + +// --------------------------------------------------------------------------- +// DoPreserveOrientationL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::DoPreserveOrientationL() + { + TRACER("CGlxCommandHandlerRotate::DoPreserveOrientationL"); + TUint16 finalOrientation = DoCalculateOrientationL(iInitialOrientation); + if(finalOrientation != iInitialOrientation && iDoAttemptToSaveFile) + { + iExifWriter->SetOrientationL(finalOrientation); + HBufC8* ModifiedexifData=NULL; + //need only first KGlxMaxExifSize bytes of data as exif cannot bypass this size + TRAPD(err,ModifiedexifData = iExifWriter->WriteDataL(iExifData->Des())); + //Nitz To-do Write only first KGlxMaxExifSize bytes to the file + //It currently fails in cases of JPEG files without Exif so removing it. + //TPtrC8 exifPtr = ModifiedexifData->Mid(0,KGlxMaxExifSize); + if(err == KErrNone) + { + iFileHandle.Write(0,ModifiedexifData->Des()); + delete ModifiedexifData; + } + else + { + iDoAttemptToSaveFile = EFalse; + } + + //Reinitializing some class variables + iInitialOrientation = finalOrientation; + iRotationAngle = 0; + + } + iFileHandle.Close(); + iInitialOrientation = 9; + iRotationAngle = 0; + iRotationApplied = EFalse; + if(iExifData != NULL) + { + delete iExifData; + iExifData = NULL; + } + if(iExifWriter != NULL) + { + delete iExifWriter; + iExifWriter = NULL; + } + //This will be called when there would be a change in Media list focus. + //So removing the call from here + //DoCleanupRotationParameters(); + } +// --------------------------------------------------------------------------- +// DoInitializeRotationParameters +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::DoInitializeRotationParametersL() + { + TRACER("CGlxCommandHandlerRotate::DoInitializeRotationParametersL"); + if((!iDoAttemptToSaveFile)&& (!iAddedObserver)) + { + iAddedObserver=ETrue; + iMediaList->AddMediaListObserverL(this); + } + if(!iRotationApplied) + { + + iTempFile.Copy(_L("c:\\data\\temp.ext")); + User::LeaveIfError(iFileHandle.Open(iFs, + iFileToBeRotated, EFileWrite)); + iRotationApplied = ETrue; + TInt filesize; + User::LeaveIfError(iFileHandle.Size(filesize)); + iExifData = HBufC8::NewL(filesize); + TPtr8 ptr(iExifData->Des()); + User::LeaveIfError(iFileHandle.Read(ptr)); + const CExifRead* exifReader = NULL; + TRAPD(Exiferr,iExifWriter = CExifModify::NewL(*iExifData,CExifModify::EModify,CExifModify::ENoJpegParsing)); + if(Exiferr == KErrNone) + { + iDoAttemptToSaveFile = ETrue; + exifReader = iExifWriter->Reader(); + TInt err = exifReader->GetOrientation(iInitialOrientation); + if(err != KErrNone) + { + iInitialOrientation = 9; + } + } + else + { + iDoAttemptToSaveFile = EFalse; + } + } + } +// --------------------------------------------------------------------------- +// DoCleanupRotationParameters +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerRotate::DoCleanupRotationParametersL() + { + TRACER("CGlxCommandHandlerRotate::DoCleanupRotationParametersL()"); + if(iDoAttemptToSaveFile) + { + //This is done just to get an MDS callback + BaflUtils::CopyFile(iFs,iFileToBeRotated,iTempFile); + BaflUtils::CopyFile(iFs,iTempFile,iFileToBeRotated); + BaflUtils::DeleteFile(iFs,iTempFile); + iDoAttemptToSaveFile = EFalse; + } + + iTempFile.Zero(); + iInitialOrientation = 9; + iRotationAngle = 0; + //Cleanup the thumbnail DB using Cleanup command as MDS takes a Long time for a callback. + CMPXCommand* command = TGlxCommandFactory::ThumbnailCleanupCommandLC(); + command->SetTObjectValueL(KMPXCommandGeneralSessionId, static_cast(this)); + + //Nitz To Do Initialize cleanup command Just for the respective Media Items + //TGlxMediaId itemId= iGlxItem->Id(); + // command->SetTObjectValueL(KMPXMediaGeneralId,itemId.Value()); + iMediaList->CommandL(*command); + CleanupStack::PopAndDestroy(command); + iMediaList->RemoveMediaListObserver(this); + iAddedObserver=EFalse; + //CGlxTextureManager& tm = iUiUtility->GlxTextureManager(); + //tm.UpdateThumbnailTexture(*iGlxItem); + iMediaList = NULL; + iGlxItem = NULL; + + iRotationApplied = EFalse; + if(iExifData != NULL) + { + delete iExifData; + iExifData = NULL; + } + if(iExifWriter != NULL) + { + delete iExifWriter; + iExifWriter = NULL; + } + } +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersave.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersave.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 2008-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: Delete command handler +* +*/ + + + + +#include "glxcommandhandlersave.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "glxcommandfactory.h" + + + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerSave* CGlxCommandHandlerSave::NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + { + TRACER("CGlxCommandHandlerSave::NewL"); + CGlxCommandHandlerSave* self = new (ELeave) CGlxCommandHandlerSave(aMediaListProvider, aHasToolbarItem); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerSave::CGlxCommandHandlerSave(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + : CGlxMpxCommandCommandHandler( aMediaListProvider, aHasToolbarItem ) + { + // Don't do anything. + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSave::ConstructL() + { + TRACER("CGlxCommandHandlerSave::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL(); + iImageViewerInstance = CGlxImageViewerManager::InstanceL(); + // Load resource file + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + // Add supported command + TCommandInfo saveInfo( EGlxCmdSave ); + // Filter out static items + saveInfo.iMinSelectionLength = 1; + AddCommandL(saveInfo); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerSave::~CGlxCommandHandlerSave() + { + TRACER("CGlxCommandHandlerSave::~CGlxCommandHandlerSave"); + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + if(iUiUtility) + { + iUiUtility->Close(); + } + if ( NULL != iImageViewerInstance) + { + iImageViewerInstance->DeleteInstance(); + } + } + +// --------------------------------------------------------------------------- +// Create an add to container command +// --------------------------------------------------------------------------- +// +CMPXCommand* CGlxCommandHandlerSave::CreateCommandL(TInt /*aCommandId*/, + MGlxMediaList& /*aMediaList*/, TBool& /*aConsume*/) const + { + TRACER("CGlxCommandHandlerSave::CreateCommandL"); + CMPXCommand* command = NULL; + TDataType nullType; + CDocumentHandler* handler = CDocumentHandler::NewLC( NULL ); + HBufC* imagePath = iImageViewerInstance->ImageUri(); + TInt err = handler->CopyL( *imagePath, *imagePath, nullType, NULL ); + CleanupStack::PopAndDestroy(handler); + return command; + } +// --------------------------------------------------------------------------- +// DynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSave::DynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* aMenuPane) + { + TRACER("CGlxCommandHandlerSave::DynInitMenuPaneL"); + if ( aMenuPane ) + { + TInt pos; + if ( aMenuPane->MenuItemExists(EGlxCmdSave, pos) ) + { + if(!iImageViewerInstance->IsPrivate()) + { + aMenuPane->DeleteMenuItem(EGlxCmdSave); + } + } + } + } + +// ---------------------------------------------------------------------------- +// DoActivateL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSave::DoActivateL(TInt /*aViewId*/) + { + + } + +// ---------------------------------------------------------------------------- +// OfferKeyEventL +// ---------------------------------------------------------------------------- +TKeyResponse CGlxCommandHandlerSave::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) + { + TKeyResponse response = EKeyWasNotConsumed; + // Is the key event from the Cancel (Backspace) key + if (aKeyEvent.iCode == EKeyBackspace && aType == EEventKey) + { + // try to execute the delete command + if(ExecuteL( EGlxCmdSave )) + { + response = EKeyWasConsumed; + } + } + return response; + } + +// ---------------------------------------------------------------------------- +// PopulateToolbar +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerSave::PopulateToolbarL() + { + TRACER( "CGlxCommandHandlerRename::PopulateToolbar" ); + + iUiUtility->ScreenFurniture()->SetTooltipL( EGlxCmdSave, CAknButton::EPositionLeft ); + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersend.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersend.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,396 @@ +/* +* Copyright (c) 2008-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: Send commmand handler +* +*/ + + + + +// CLASS HEADER +#include "glxcommandhandlersend.h" + + +// EXTERNAL INCLUDES +#include // for CnvUtfConverter +#include // for CSendui +#include // for CSendui resources +#include // for CSendui plugin type constants +#include // for CMessageData +#include // for CCoeEnv +#include // for CStringLoader +#include // for BaflUtils +#include // for directory and file names + +// INTERNAL INCLUDES +#include // for EGlxCmdUpload +#include +#include +#include // for ScreenFurniture toolbar +#include // for KGlxUiUtilitiesResource +#include // for HuiUtility +#include // for debug logging +#include // for CGlxDefaultAttributeContext +#include // for GlxAttributeRetriever +#include // for R_GLX_TOOLTIP_SEND +#include // for TGlxFetchContextRemover +#include // for CGlxResourceUtilities +#include + +// LOCAL FUNCTIONS AND CONSTANTS +namespace + { + const TInt KSendMsgBodySz = 0; + const TInt KSendMsgOverallSz = 1024; // KMaxStringLength from SendUi.h + // defined locally in the original code... @todo find a definition + const TUid KSendAsPostcardUID = { 0x101FF961 }; + } + + + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerSend* CGlxCommandHandlerSend::NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) + { + GLX_FUNC("CGlxCommandHandlerSend::NewL"); + CGlxCommandHandlerSend* self = + new (ELeave) CGlxCommandHandlerSend(aMediaListProvider, aHasToolbarItem); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// ---------------------------------------------------------------------------- +// C++ default constructor +// ---------------------------------------------------------------------------- +CGlxCommandHandlerSend::CGlxCommandHandlerSend(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem ) + :CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem) + { + // nothing to do + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSend::ConstructL() + { + GLX_FUNC("CGlxCommandHandlerSend::ConstructL"); + + iUiUtility = CGlxUiUtility::UtilityL(); + iSendUi = CSendUi::NewL(); + + LoadRscFileL(); + + // add the Send command + TCommandInfo info(EGlxCmdSend); + info.iMinSelectionLength = 1; + info.iMaxSelectionLength = KMaxTInt; + AddCommandL(info); + } + + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerSend::~CGlxCommandHandlerSend() + { + GLX_FUNC("CGlxCommandHandlerSend::~CGlxCommandHandlerSend"); + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + if (iUiUtility) + { + iUiUtility->Close(); + } + delete iSendUi; + } + + + +// ---------------------------------------------------------------------------- +// ExecuteL +// ---------------------------------------------------------------------------- +TBool CGlxCommandHandlerSend::DoExecuteL(TInt aCommandId, + MGlxMediaList& /*aList*/) + { + GLX_FUNC("CGlxCommandHandlerSend::DoExecuteL"); + + if (aCommandId == EGlxCmdSend) + { + SendSelectedItemsL(); + return ETrue; + } + return EFalse; + } + + + +// ---------------------------------------------------------------------------- +// DoActivateL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSend::DoActivateL(TInt aViewId) + { + GLX_FUNC("CGlxCommandHandlerSend::DoActivateL"); + + iViewId = aViewId; + MGlxMediaList& mediaList = MediaList(); + + // TAP2GenericPluginParams::EGenericStdIconSend, + // TAP2GenericPluginParams::EGenericStdIconSendMask); + + // need to check the category attribute for image or video + iAttributeContext = CGlxDefaultAttributeContext::NewL(); + iAttributeContext->AddAttributeL(TMPXAttribute(KMPXMediaGeneralCategory)); + iAttributeContext->AddAttributeL(TMPXAttribute(KMPXMediaGeneralUri)); + mediaList.AddContextL( iAttributeContext, KGlxFetchContextPriorityLow ); + + mediaList.AddMediaListObserverL(this); + } + + + + +// ---------------------------------------------------------------------------- +// Deactivate +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSend::Deactivate() + { + GLX_FUNC("CGlxCommandHandlerSend::Deactivate"); + if (iAttributeContext) + { + MediaList().RemoveContext(iAttributeContext); + delete iAttributeContext; + iAttributeContext = NULL; + } + + MediaList().RemoveMediaListObserver(this); + } + + + +// ---------------------------------------------------------------------------- +// OfferKeyEventL +// ---------------------------------------------------------------------------- +TKeyResponse CGlxCommandHandlerSend::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) + { + // Handle the send key + if (aKeyEvent.iCode == EKeyYes && aType == EEventKey) + { + SendSelectedItemsL(); + return EKeyWasConsumed; + } + return EKeyWasNotConsumed; + } + + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSend::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt aNewIndex, TInt /*aOldIndex*/, MGlxMediaList* aList) + { + GLX_FUNC("CGlxCommandHandlerSend::HandleFocusChangedL"); + if ( aList && aNewIndex >= 0 ) + { + const CGlxMedia* media = aList->Item(aNewIndex).Properties(); + if (media) + {// show the active palette send item + // iUiUtility->ScreenFurniture().ShowActivePaletteItemL(iViewId, + // EGlxCmdSend, IsValidTypeL(*media)); + } + } + } + + + + +// ---------------------------------------------------------------------------- +// SelectedFilesLC +// ---------------------------------------------------------------------------- +CMessageData* CGlxCommandHandlerSend::SelectedFilesLC() + { + GLX_FUNC("CGlxCommandHandlerSend::SelectedFilesLC"); + + // get the focused item from the media list + MGlxMediaList& mediaList = MediaList(); + + CMessageData* messageData = CMessageData::NewLC(); + + // retrieve the file name and path + CGlxDefaultAttributeContext* attributeContext = + CGlxDefaultAttributeContext::NewL(); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(TMPXAttribute(KMPXMediaGeneralUri)); + mediaList.AddContextL(attributeContext, KGlxFetchContextPriorityBlocking); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover (attributeContext, mediaList); + CleanupClosePushL( contextRemover ); + + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext, + mediaList, ETrue)); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + // if there are multiple media items, filter the postcard plugin + iFilterOutPlugin = (mediaList.SelectionCount() > 1); + + // extract the filename from selected items in the media list and add it + // to the messageData to be returned + TGlxSelectionIterator iterator; + iterator.SetToFirst(&mediaList); + TInt index = KErrNotFound; + + while ((index = iterator++) != KErrNotFound) + { + // does not return ownership. + const CGlxMedia* media = mediaList.Item(index).Properties(); + if(media) + { + if(media->IsSupported(KMPXMediaGeneralUri) && IsValidTypeL(*media)) + { + messageData->AppendAttachmentL( + media->ValueText(KMPXMediaGeneralUri)); + } + } + else + { + User::Leave(KErrNotReady); + } + } + + CleanupStack::PopAndDestroy(attributeContext); + return messageData; + }// contextRemover goes out of scope and removes the context from media list + + +// ---------------------------------------------------------------------------- +// IsValidTypeL +// ---------------------------------------------------------------------------- +TBool CGlxCommandHandlerSend::IsValidTypeL(const CGlxMedia& aMedia) + { + GLX_FUNC("CGlxCommandHandlerSend::IsValidTypeL"); + // ensure the category attribute is supported by the current media item + if (aMedia.IsSupported(KMPXMediaGeneralCategory)) + { + switch(aMedia.ValueTObject(KMPXMediaGeneralCategory)) + { + case EMPXVideo: + { + // don't use the postcard plugin to send video + iFilterOutPlugin = ETrue; + return ETrue; + } + case EMPXImage: + { + return ETrue; + } + default: + { + return EFalse; + } + } + } + return EFalse; + } + + +// ---------------------------------------------------------------------------- +// SendSelectedItemsL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSend::SendSelectedItemsL() + { + GLX_FUNC("CGlxCommandHandlerSend::SendSelectedItemsL"); + // retrieve the current files name and location + CMessageData* msgData = SelectedFilesLC(); + HBufC* title = StringLoader::LoadLC(R_QTN_LGAL_POPUP_SEND); + + // filterOutPlugins is a list of component uids that should NOT be used to + // send the media file. if a video file was selected or multiple files + // were selected, filter out the option to send as a postcard + CArrayFix* filterOutPlugins =new (ELeave) CArrayFixFlat(1); + CleanupStack::PushL(filterOutPlugins); + + if(iFilterOutPlugin) + { + filterOutPlugins->AppendL(KSendAsPostcardUID); + } + + // If Device supports text-entry mode only in portrait, + // then the orientation has to be forced to EGlxOrientationTextEntry + // before launching the Send pop-up. + + if(iUiUtility->IsPenSupported()) + { + iUiUtility->SetAppOrientationL( EGlxOrientationDefault ); + } + // Trap the send call to ensure the orientation is reverted + TRAP_IGNORE( iSendUi->ShowQueryAndSendL( msgData, Capabilities(), + filterOutPlugins, KNullUid, ETrue, *title ) ); + + CleanupStack::PopAndDestroy(filterOutPlugins); + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(msgData); + } + + + +// ---------------------------------------------------------------------------- +// LoadRscFileL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSend::LoadRscFileL() + { + GLX_FUNC("CGlxCommandHandlerSend::LoadRscFileL"); + + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + CCoeEnv* env = CCoeEnv::Static(); + iResourceOffset = env->AddResourceFileL(resourceFile); + } + + +// ---------------------------------------------------------------------------- +// Capabilities +// ---------------------------------------------------------------------------- +TSendingCapabilities CGlxCommandHandlerSend::Capabilities() + { + GLX_FUNC("CGlxCommandHandlerSend::Capabilities"); + return TSendingCapabilities (KSendMsgBodySz, KSendMsgOverallSz, + TSendingCapabilities::ESupportsAttachments); + } + + +// ---------------------------------------------------------------------------- +// PopulateToolbar +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerSend::PopulateToolbarL() + { + GLX_FUNC("CGlxCommandHandlerSend::PopulateToolbar"); + + iUiUtility->ScreenFurniture()->SetTooltipL( EGlxCmdSend, CAknButton::EPositionLeft ); + } +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerslideshow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerslideshow.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,527 @@ +/* +* Copyright (c) 2008-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: Slideshow command handler +* +*/ + + + + +#include "glxcommandhandlerslideshow.h" + +#include +#include +#include // for KMPXMediaDrmProtected +#include +#include + +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include // for CGlxAttributeContext +#include // for TGlxMedia +#include // for stringloader +#include + +#include "shwslideshowviewplugin.hrh" // for the slideshow view's UID +#include "shwslideshowsettingsplugin_UID.hrh"// for slideshow setting dlg UID +#include "glxuiutility.h" +#include "glxscreenfurniture.h" +#include +#include // set PCFW app state +#include +#include // get UPnP state +#include +namespace + { + const TInt KShwDefaultBufferSize = 128; + } + +// This class does not have access to a CEikonEnv and hence +// pls ignore the code scanner warning - Using CEikonEnv::Static +#define GetAppUi() (dynamic_cast(CEikonEnv::Static()->EikAppUi())) + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerSlideshow* CGlxCommandHandlerSlideshow::NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aStepBack, TBool aHasToolbarItem ) + { + GLX_LOG_INFO( "CGlxCommandHandlerSlideshow::NewL" ); + CGlxCommandHandlerSlideshow* self = new ( ELeave ) + CGlxCommandHandlerSlideshow(aMediaListProvider, aStepBack, aHasToolbarItem); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerSlideshow::CGlxCommandHandlerSlideshow( MGlxMediaListProvider* + aMediaListProvider, TBool aStepBack, TBool aHasToolbarItem ) + : CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem), iStepBack(aStepBack) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::ConstructL() + { + GLX_LOG_INFO( "CGlxCommandHandlerSlideshow::ConstructL" ); + + // Get a handle + iUiUtility = CGlxUiUtility::UtilityL(); + + // Load resource file + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile ); + + // CGlxSettingsModel* model = CGlxSettingsModel::InstanceL(); + iShowInToolbar = ETrue; //model->ShowSlideshowInToolbar(); + // model->Close(); + + // Add supported commands with filter fields + // Play slideshow forwards + TCommandInfo info( EGlxCmdSlideshowPlay ); + // Disable for static items and dont enable empty slideshow + info.iMinSelectionLength = 1; + // Enable only for albums that have more than one item + info.iMinSlideshowPlayableContainedItemCount = 1; + // Disable for animated GIFs + info.iDisallowAnimatedGIFs = ETrue; + // Disable DRM protected content + info.iDisallowDRM = ETrue; + // Note! cannot just require all to be images as user can also start + // slideshow for a whole album from list view and in that case + // selection contains a container + // Disable all videos + TMPXGeneralCategory categoryFilter = EMPXVideo; + // Disable the command for videos + TCommandInfo::TCategoryRule categoryRule = TCommandInfo::EForbidAll; + info.iCategoryFilter = categoryFilter; + info.iCategoryRule = categoryRule; + AddCommandL( info ); + + // Play slideshow backwards: only the id changes + //info.iCommandId = EGlxCmdSlideshowPlayBackwards; + //AddCommandL( info ); + + // new info to get the default filters + TCommandInfo info_show_always( EGlxCmdSlideshowSettings ); + // Disable for empty views and views with only static items + info_show_always.iMinSelectionLength = 1; + // slideshow settings + AddCommandL( info_show_always ); + + // Menu + info_show_always.iCommandId = EGlxCmdSlideshow; + AddCommandL( info_show_always ); + + // Dummy command to get UPnP state + TCommandInfo infoUpnpState( EGlxCmdShowViaUpnpStateChanged ); + AddCommandL( infoUpnpState ); + + // Buffer + iBufFlat = CBufFlat::NewL( KShwDefaultBufferSize ); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerSlideshow::~CGlxCommandHandlerSlideshow() + { + GLX_LOG_INFO( "CGlxCommandHandlerSlideshow::~CGlxCommandHandlerSlideshow" ); + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + if (iUiUtility) + { + iUiUtility->Close(); + } + + delete iBufFlat; + delete iBuffer; + } + +// --------------------------------------------------------------------------- +// DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::DoActivateL(TInt aViewId) + { + GLX_LOG_INFO( "CGlxCommandHandlerSlideshow::DoActivateL" ); + iViewId = aViewId; + + // for media list item "focus changed" notification + MGlxMediaList& mediaList( MediaList() ); + mediaList.AddMediaListObserverL( this ); + } + + +// ---------------------------------------------------------------------------- +// Deactivate +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSlideshow::Deactivate() + { + GLX_LOG_INFO( "CGlxCommandHandlerSlideshow::Deactivate" ); + + MGlxMediaList& mediaList( MediaList() ); + mediaList.RemoveMediaListObserver( this ); + } + +// ---------------------------------------------------------------------------- +// IsSlideshowPlayableOnFocusedContainer +// ---------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerSlideshow::IsSlideshowNotPlayableOnFocusedContainer + (TInt aCommandId, MGlxMediaList& aList) + { + TBool slideshowDisabled = EFalse; + + // get the media item + const TGlxMedia& item = aList.Item( aList.FocusIndex() ); + const TCommandInfo& info = CommandInfo(aCommandId); + + // Check minimum item count if not yet disabled by previous rules + TInt count(0); + + if( (info.iMinSlideshowPlayableContainedItemCount )&& + ( item.GetSlideshowPlayableContainedItemCount(count) ) ) + { + // disable if less than required amount of items in container + // (ignore non-containers, i.e. -1) + if( count != -1 ) + { + slideshowDisabled = ( count < info.iMinSlideshowPlayableContainedItemCount ); + } + } + return slideshowDisabled; + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerSlideshow::DoExecuteL(TInt aCommandId, + MGlxMediaList& aList ) + { + GLX_LOG_INFO( "CGlxCommandHandlerSlideshow::DoExecuteL" ); + TBool handledCommand = ETrue; + + switch (aCommandId) + { + case EGlxCmdSlideshowPlay: + { + // This check has to be done again here since Slideshow can be + // activated from toolbar even when there are non-slideshow playable + // items in a container and when that container is focused. + if( IsSlideshowNotPlayableOnFocusedContainer( aCommandId, aList ) ) + { + HBufC* popupText = NULL; + + //Load the "No Images to Play Slideshow" string from the resource file + popupText = StringLoader::LoadLC( R_GLX_NO_IMAGES_TO_PLAY_SLIDESHOW ); + + // Show the Info Note. + GlxGeneralUiUtilities::ShowInfoNoteL( popupText->Des(), EFalse ); + + // LoadLC will push text on to cleanupstack, + // hence it should be poped and destroyed + CleanupStack::PopAndDestroy( popupText ); + } + else + { + // Activate the slideshow view to play forwards + ActivateViewL( NShwSlideshow::EPlayForwards ); + + // set PCFW app state + GlxSetAppState::SetState(EGlxInSlideshowView); + } + break; + } + /* case EGlxCmdSlideshowPlayBackwards: + { + // Activate the slideshow view to play backwards + ActivateViewL( NShwSlideshow::EPlayBackwards ); + + // set PCFW app state + GlxSetAppState::SetState(EGlxInSlideshowView); + + break; + } */ + case EGlxCmdSlideshowSettings: + { + // In order for the Settings Dialogs Akn StatusPane to become + // visible the the Hui display should be deactivated & activated + // before & after the Settings Dialog (which is uses the Akn + // framework) is activated & deactivated respectively. + // Activating and deactivating the HUI within the Settings + // Dialog class will cause a Cone 8 panic. + + // hide HUI display + CGlxUiUtility::HideAlfDisplayL(); + { + MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL(); + CleanupClosePushL(*viewUtility); + + // Activate the slideshow settings dialog + viewUtility->ActivateViewL( + TUid::Uid(KShwSettingsDlgImplementationUid)); + + CleanupStack::PopAndDestroy(viewUtility); + } + // show HUI display + CGlxUiUtility::ShowAlfDisplayL(); + GetAppUi()->ProcessCommandL(EGlxCmdResetView); + break; + } + case EGlxCmdShowViaUpnpStateChanged: + { + handledCommand = EFalse; + break; + } + default: + { + handledCommand = EFalse; + break; + } + } + + return handledCommand; + } + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerSlideshow::DoIsDisabled( + TInt /*aCommandId*/, MGlxMediaList& /*aList*/) const + { + // Disable if UPnP is active + return ( GlxUpnpRenderer::Status() == NGlxUpnpRenderer::EActive ); + } + +// ----------------------------------------------------------------------------- +// BypassFiltersForExecute +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerSlideshow::BypassFiltersForExecute() const + { + // Always bypass filters to minimise the time spent by the base class + // when it initialises the slideshow menu item. + return ETrue; + } + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerSlideshow::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) + { + GLX_FUNC("CGlxCommandHandlerSlideshow::HandleFocusChangedL"); + + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::HandleItemAddedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::HandleMediaL(TInt /*aListIndex*/, + MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::HandleAttributesAvailableL( + TInt aItemIndex, const RArray& aAttributes, + MGlxMediaList* /*aList*/ ) + { + if ( iShowInToolbar && MediaList().FocusIndex() == aItemIndex ) + { + TIdentityRelation match( TMPXAttribute::MatchContentId ); + + if ( aAttributes.Find( KMPXMediaGeneralCategory, match ) >= 0 + || aAttributes.Find( KMPXMediaDrmProtected, match ) >= 0 + || aAttributes.Find( KGlxMediaGeneralFramecount, match ) >= 0 ) + { + UpdateToolbar(); + } + } + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::HandleMessageL( + const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) + { + } + +// ----------------------------------------------------------------------------- +// ActivateViewL - launch the view +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::ActivateViewL( NShwSlideshow::TPlayDirection + aPlaybackDirection ) + { + GLX_LOG_INFO( "CGlxCommandHandlerSlideshow::ActivateViewL" ); + + // Determine the path from the media list + CMPXCollectionPath* path = MediaList().PathLC(); + // Ensure the path's at the correct level for the view + if ( iStepBack && path->Levels() > 0 ) + { + path->Back(); + } + // Stream the data buffer + RBufWriteStream stream; + stream.Open( *iBufFlat ); + CleanupClosePushL( stream ); + // Write out the playback direction + stream.WriteInt32L( aPlaybackDirection ); + stream.CommitL(); + // Externalize the path to the stream + path->ExternalizeL( stream ); + + // ActivateViewL takes a TDesC*, rather than a TDesC8 + // so copy the data accordingly + if ( iBuffer ) + { + delete iBuffer; + iBuffer = NULL; + } + + TInt length = iBufFlat->Size(); + iBuffer = HBufC::NewL( length ); + TPtr bufferPtr = iBuffer->Des(); + TPtr8 ptr = iBufFlat->Ptr( 0 ); + bufferPtr.Copy( ptr ); + + // Get the view utility + MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL(); + CleanupClosePushL( *viewUtility ); + + viewUtility->ActivateViewL( TUid::Uid(KShwSlideshowViewImplementationId), + iBuffer ); + + // set the view navigation direction so that previous view keeps its + // media list and focus + iUiUtility->SetViewNavigationDirection( EGlxNavigationForwards ); + + CleanupStack::PopAndDestroy( 3, path ); // viewUtility, stream and path + } + +// --------------------------------------------------------------------------- +// UpdateToolbarL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::UpdateToolbar() + { + TBool visible = EFalse; + + if ( GlxUpnpRenderer::Status() != NGlxUpnpRenderer::EActive ) + { + TInt focus = MediaList().FocusIndex(); + + if ( focus >= 0 ) + { + const TGlxMedia& media = MediaList().Item( focus ); + + TInt frameCount = 0; + // get count, ignore return value + (void)media.GetFrameCount( frameCount ); + + // medialistcommandhandler has added these attributes to a low + // priority fetch context when command was loaded so the values + // should be loaded + visible = ( EMPXImage == media.Category() + && !media.IsDrmProtected() + && 1 == frameCount ); + } + } + + iUiUtility->ScreenFurniture()->SetToolbarItemVisibility( + EGlxCmdSlideshowPlay, visible ); + } + + +// --------------------------------------------------------------------------- +// PopulateToolbar +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSlideshow::PopulateToolbarL() + { + + iUiUtility->ScreenFurniture()->SetTooltipL( EGlxCmdSlideshowPlay, CAknButton::EPositionLeft ); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersortorder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersortorder.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2008-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: SortOrder command handler +* +*/ + + + + +#include "glxcommandhandlersortorder.h" + +#include +#include +#include +#include +#include +#include // For CRepository +#include // For MGlxMediaList +#include // For cenrep setting + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerSortOrder* CGlxCommandHandlerSortOrder::NewL( + MGlxMediaListProvider* aMediaListProvider, + const TUint32 aCRKey) + { + CGlxCommandHandlerSortOrder* self = new ( ELeave ) + CGlxCommandHandlerSortOrder(aMediaListProvider, aCRKey); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerSortOrder::CGlxCommandHandlerSortOrder( + MGlxMediaListProvider* aMediaListProvider, + const TUint32 aCRKey) + : CGlxMediaListCommandHandler(aMediaListProvider), iKey(aCRKey) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerSortOrder::ConstructL() + { + TRACER("CGlxCommandHandlerSortOrder::ConstructL"); + + // Add supported commands + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::ConstructL::Add alphabetical sort order command handler"); + TCommandInfo info( EGlxCmdSortByAlphabetical ); + info.iMinSelectionLength = 1; + info.iMaxSelectionLength = KMaxTInt; + AddCommandL(info); + + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::ConstructL::Add frequency sort order command handler"); + TCommandInfo info2( EGlxCmdSortByCount ); + info2.iMinSelectionLength = 1; + info2.iMaxSelectionLength = KMaxTInt; + AddCommandL(info2); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerSortOrder::~CGlxCommandHandlerSortOrder() + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerSortOrder::DoExecuteL(TInt aCommandId, + MGlxMediaList& aList) + { + TRACER("CGlxCommandHandlerSortOrder::DoExecuteL"); + + __ASSERT_DEBUG( NULL != &aList, Panic(EGlxPanicIllegalArgument) ); + + GLX_LOG_INFO1("CGlxCommandHandlerSortOrder::DoExecuteL::Command Id (%d)",aCommandId); + TGlxFilterSortOrder newSortOrder = EGlxFilterSortOrderNotUsed; + TGlxFilterSortDirection newSortDirection = EGlxFilterSortDirectionNotUsed; + TBool handledCommand = EFalse; + + switch (aCommandId) + { + case EGlxCmdSortByAlphabetical: + { + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::DoExecuteL::Sort Alphabetically"); + + newSortOrder = EGlxFilterSortOrderAlphabetical; + newSortDirection = EGlxFilterSortDirectionAscending; + handledCommand = ETrue; + break; + } + case EGlxCmdSortByCount: + { + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::DoExecuteL::Sort by count"); + + newSortOrder = EGlxFilterSortOrderItemCount; + newSortDirection = EGlxFilterSortDirectionDescending; + handledCommand = ETrue; + break; + } + default: + { + break; + } + } + + // Check if the existing and the new sort order are different, the change the filter in MediaList + if( newSortOrder != EGlxFilterSortOrderNotUsed ) + { + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::DoExecuteL::Create a new sort order"); + + TGlxFilterProperties filterProperties; + filterProperties.iSortOrder = newSortOrder; + filterProperties.iSortDirection = newSortDirection; + + CMPXFilter* newFilter = TGlxFilterFactory::CreateCombinedFilterL(filterProperties, + aList.Filter()); + CleanupStack::PushL(newFilter); + + aList.SetFilterL(newFilter); + // Update central repository with new sort order + CGlxSettingsModel::SetValueL(iKey,newSortOrder); + CleanupStack::PopAndDestroy(newFilter); + } + + return handledCommand; + } + +// ----------------------------------------------------------------------------- +// DoIsDisabled +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerSortOrder::DoIsDisabled(TInt aCommandId, + MGlxMediaList& aList) const + { + TRACER("CGlxCommandHandlerSortOrder::DoIsDisabled"); + + __ASSERT_DEBUG( NULL != &aList, Panic(EGlxPanicIllegalArgument) ); + + // Get the existing filter & try to find out what is the current sort order + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::DoIsDisabled::Get the existing filter"); + TGlxFilterSortOrder currentSortOrder = CurrentSortOrder(aList); + + GLX_LOG_INFO1("CGlxCommandHandlerSortOrder::DoIsDisabled::Command Id (%d)",aCommandId); + TBool disabled = EFalse; + + TInt count(aList.Count()); + switch( aCommandId) + { + case EGlxCmdSortByAlphabetical: + { + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::DoIsDisabled::Sort Alphabetically"); + + // If the filter is already Alphabetical sort then hide the menu + if( count ) + { + disabled = ( currentSortOrder == EGlxFilterSortOrderAlphabetical); + } + else + { + disabled = ETrue; // Menu options should appear only if the list count is non-zero + } + + break; + } + case EGlxCmdSortByCount: + { + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::DoIsDisabled::Sort by count"); + + // If the filter is already Frequency sort then hide the menu + if( count ) + { + disabled = ( currentSortOrder == EGlxFilterSortOrderItemCount); + } + else + { + disabled = ETrue; // Menu options should appear only if the list count is non-zero + } + break; + } + default: + { + break; + } + } + + return disabled; + } + +// ----------------------------------------------------------------------------- +// GetSortOrder +// ----------------------------------------------------------------------------- +// +TGlxFilterSortOrder CGlxCommandHandlerSortOrder::CurrentSortOrder(MGlxMediaList& aList) const + { + TRACER("CGlxCommandHandlerSortOrder::CurrentSortOrder"); + + __ASSERT_DEBUG( NULL != &aList, Panic(EGlxPanicIllegalArgument) ); + + TGlxFilterSortOrder currentSortOrder = EGlxFilterSortOrderNotUsed; + + CMPXFilter* filter = aList.Filter(); + if ( filter ) + { + GLX_LOG_INFO("CGlxCommandHandlerSortOrder::DoIsDisabled::Find the existing sort order"); + currentSortOrder = filter->ValueTObjectL(KGlxFilterGeneralSortType); + } + + return currentSortOrder; + } + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerupload.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerupload.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,417 @@ +/* +* Copyright (c) 2008-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: Upload commmand handler +* +*/ + +// CLASS HEADER +#include "glxcommandhandlerupload.h" + +// EXTERNAL INCLUDES +#include // for passing data between applications +#include // for getting the button state +#include // for accessing currently active toolbar +#include // for checking the ShareOnline version +#include // for directory and file names +#include // for CnvUtfConverter + + +// INTERNAL INCLUDES +#include // for creating medialist context +#include // for retrieving the attributes +#include // for EGlxCmdUpload +#include // for TGlxFetchContextRemover +#include // for TRACER logs +#include // for Share AIW interest resource +#include // for accessing the media items + +// CONSTANTS AND DEFINITIONS +namespace + { + // ShareOnline application UID + const TUid KShareOnlineUid = { 0x2000BB53 }; + // Shareonline Application version + const TUint32 KShareApplicationVersion = 0x01010020; + // Buffer to maintain the ShareOnline version number in use + const TInt KPhotosShareOnlineVersionBufLen = 12; + // Minimum version required for OneClickUpload to work + const TVersion KShareOnlineMinimumVersion( 4, 3, 0 ); + // OneClickUpload command + const TUid KOpenModeOneClick = { 2 }; + // Command to request for the tooltip + const TUid KCmdGetOneClickToolTip = { 15 }; + } + +// Get the AppUi instance +// This class does not have access to a CEikonEnv and hence +// pls ignore the code scanner warning - Using CEikonEnv::Static +#define GetAppUi() (dynamic_cast(CEikonEnv::Static()->EikAppUi())) + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerUpload* CGlxCommandHandlerUpload::NewL( + MGlxMediaListProvider* aMediaListProvider, + TBool aHasToolbarItem) + { + TRACER("CGlxCommandHandlerUpload::NewL"); + CGlxCommandHandlerUpload* self = + new (ELeave) CGlxCommandHandlerUpload(aMediaListProvider,aHasToolbarItem); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// C++ default constructor +// ---------------------------------------------------------------------------- +CGlxCommandHandlerUpload::CGlxCommandHandlerUpload(MGlxMediaListProvider* + aMediaListProvider, + TBool aHasToolbarItem) + :CGlxMediaListCommandHandler(aMediaListProvider,aHasToolbarItem) + { + TRACER("CGlxCommandHandlerUpload::CGlxCommandHandlerUpload"); + + // nothing to do + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerUpload::ConstructL() + { + TRACER("CGlxCommandHandlerUpload::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL(); + + // iUploadSupported is zeroed by CBase constructor. + // If a leave occurs here, it is left as EFalse. + // If InitializeOneClickUploadL() succeeds, it is set to ETrue. + TRAP_IGNORE( + { + CheckVersionL(); + InitializeOneClickUploadL(); + iUploadSupported = ETrue; + } ); + + + // Add the upload command + TCommandInfo info(EGlxCmdUpload); + AddCommandL(info); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +EXPORT_C CGlxCommandHandlerUpload::~CGlxCommandHandlerUpload() + { + TRACER("CGlxCommandHandlerUpload::~CGlxCommandHandlerUpload"); + + if (iUiUtility) + { + iUiUtility->Close(); + } + delete iServiceHandler; + } + +// InitializeAIWForShareOnlineL +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerUpload::InitializeOneClickUploadL() + { + TRACER("CGlxCommandHandlerUpload::InitializeOneClickUploadL"); + + iServiceHandler = CAiwServiceHandler::NewL(); + + // Attach the AIW Resource defined in uiutilities.rss + iServiceHandler->AttachL( R_AIW_SHARE_BASE_INTEREST ); + } + +// Check Share Online version +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerUpload::CheckVersionL() + { + TRACER("CGlxCommandHandlerUpload::CheckVersionL"); + + CRepository* rep = CRepository::NewLC( KShareOnlineUid ); + // + TBuf versionBuf; + // Query the ShareOnline version in the build + User::LeaveIfError( rep->Get( KShareApplicationVersion, versionBuf ) ); + + // Initialize version to zero + TVersion version( 0, 0, 0 ); + TLex lex( versionBuf ); + User::LeaveIfError( lex.Val( version.iMajor ) ); + if ( lex.Get() != TChar('.') ) + { + User::Leave( KErrCorrupt ); + } + User::LeaveIfError( lex.Val( version.iMinor ) ); + if ( lex.Get() != TChar('.') ) + { + User::Leave( KErrCorrupt ); + } + User::LeaveIfError( lex.Val( version.iBuild ) ); + + // Compare version number and leave if the detected + // version is less than KShareOnlineMinimumVersion. + if ( version.iMajor < KShareOnlineMinimumVersion.iMajor ) + { + User::LeaveIfError( KErrNotSupported ); + } + else if ( version.iMajor == KShareOnlineMinimumVersion.iMajor ) + { + if ( version.iMinor < KShareOnlineMinimumVersion.iMinor ) + { + User::LeaveIfError( KErrNotSupported ); + } + else if ( version.iMinor == KShareOnlineMinimumVersion.iMinor ) + { + if ( version.iBuild < KShareOnlineMinimumVersion.iBuild ) + { + User::LeaveIfError( KErrNotSupported ); + } + else + { + // Version is supported, fall through + } + } + else + { + // Version is supported, fall through + } + } + else + { + // Version is supported, fall through + } + CleanupStack::PopAndDestroy( rep ); + + } + +// ---------------------------------------------------------------------------- +// DoExecuteL +// ---------------------------------------------------------------------------- +TBool CGlxCommandHandlerUpload::DoExecuteL(TInt aCommandId, + MGlxMediaList& /*aList*/) + { + TRACER("CGlxCommandHandlerUpload::DoExecuteL"); + + TBool handled = EFalse; + // handle the upload command + if (iUploadSupported && ( EGlxCmdUpload == aCommandId )) + { + + CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); + + TAiwVariant variant( KOpenModeOneClick ); //For one click photo upload + TAiwGenericParam param( EGenericParamModeActivation, variant ); + inputParams.AppendL( param ); + + // Append all the files that are selected to iServiceHandler->InParamListL() + AppendSelectedFilesL(inputParams); + + // Execute the KAiwCmdUpload command + iServiceHandler->ExecuteServiceCmdL( KAiwCmdUpload, + inputParams, iServiceHandler->OutParamListL() ); + + handled = ETrue; + } + return handled; + } + +// ---------------------------------------------------------------------------- +// DoActivateL +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerUpload::DoActivateL(TInt aViewId) + { + TRACER("CGlxCommandHandlerUpload::DoActivateL"); + iViewId = aViewId; + + } + +// ---------------------------------------------------------------------------- +// Deactivate +// ---------------------------------------------------------------------------- +void CGlxCommandHandlerUpload::Deactivate() + { + TRACER("CGlxCommandHandlerUpload::Deactivate"); + + } + +// ---------------------------------------------------------------------------- +// AppendSelectedFilesL() +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerUpload::AppendSelectedFilesL(CAiwGenericParamList& aInputParams) + { + TRACER("CGlxCommandHandlerUpload::AppendSelectedFilesL"); + + HBufC* fileName = HBufC::NewLC(KMaxFileName); + + // get the media list reference + MGlxMediaList& mediaList = MediaList(); + + //retrieve the file name and path using selection-based fetch contexts + CGlxDefaultAttributeContext* attributeContext = + CGlxDefaultAttributeContext::NewL(); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(KMPXMediaGeneralUri); + mediaList.AddContextL(attributeContext, KGlxFetchContextPriorityBlocking); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover (attributeContext, mediaList); + CleanupClosePushL( contextRemover ); + + // Leaving method returns an err code + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext, + mediaList, ETrue)); + + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + // Extract the filename/s from selected item/s in the media list and append + // it to AIW InParamList + TGlxSelectionIterator iterator; + iterator.SetToFirst(&mediaList); + TInt index = KErrNotFound; + + while ( (index = iterator++) != KErrNotFound ) + { + // does not return ownership. + const CGlxMedia* media = mediaList.Item(index).Properties(); + if(media) + { + if(media->IsSupported(KMPXMediaGeneralUri)) + { + // Retrieve the file URI + fileName->Des() = media->ValueText(KMPXMediaGeneralUri); + __ASSERT_DEBUG(fileName->Length() <= KMaxFileName, + Panic(EGlxPanicRequiredItemNotFound)); + TAiwVariant fileVariant( fileName ); + TAiwGenericParam fileParam( EGenericParamFile, fileVariant ); + aInputParams.AppendL( fileParam ); + } + } + else + { + User::Leave(KErrNotReady); + } + } + + CleanupStack::PopAndDestroy(attributeContext); + CleanupStack::PopAndDestroy(fileName); + }// contextRemover goes out of scope and removes the context from media list + +// ---------------------------------------------------------------------------- +// PopulateToolbar +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerUpload::PopulateToolbarL() + { + TRACER( "CGlxCommandHandlerUpload::PopulateToolbarL" ); + + if( iUploadSupported ) + { + SetToolTipL(); + } + } + +// ---------------------------------------------------------------------------- +// GetToolTipL +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerUpload::GetToolTipL( HBufC*& aToolTipText ) + { + TRACER("CGlxCommandHandlerUpload::GetToolTipL"); + + CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); + + // Insert Command parameter that tells provider that tooltip is required + TAiwVariant variant(KCmdGetOneClickToolTip); + TAiwGenericParam param(EGenericParamModeActivation, variant); + inputParams.AppendL(param); + + //Get a reference to output parameter list + CAiwGenericParamList& outputParams = iServiceHandler->OutParamListL(); + iServiceHandler->ExecuteServiceCmdL(KAiwCmdUpload, inputParams, outputParams); + + //Tooltip is returned as a parameter in output list + for( TInt i = 0 ; i < outputParams.Count(); i++ ) + { + const TAiwGenericParam& param = outputParams[i]; + if(EGenericParamNoteItem == param.SemanticId()) + { + TAiwVariant value = param.Value(); + TPtrC toolTipToBeReturned = value.AsDes(); + aToolTipText = toolTipToBeReturned.AllocLC(); + } + } + } + +// ---------------------------------------------------------------------------- +// SetToolTipL +// ---------------------------------------------------------------------------- +// +void CGlxCommandHandlerUpload::SetToolTipL() + { + TRACER("CGlxCommandHandlerUpload::SetToolTipL"); + + CAknToolbar* toolbar = GetAppUi()->CurrentFixedToolbar(); + + if(toolbar) + { + CAknButton* uploadButton = static_cast + (toolbar->ControlOrNull( EGlxCmdUpload )); + + if(uploadButton && iUploadSupported) + { + // Get the tooltip text from AIW ShareOnline application + HBufC* toolTipText = NULL; + + // GetToolTipL might allocate memory. Hence toolTipText should + // be popped and destroyed if present. + GetToolTipL(toolTipText); + + if( toolTipText ) + { + // Get current button state and set the help text(tool tip) + CAknButtonState* currentState = uploadButton->State(); + + TBool dimmed = uploadButton->IsDimmed(); + if(dimmed) + { + uploadButton->SetDimmed(EFalse); + currentState->SetHelpTextL( toolTipText->Des()); + uploadButton->SetDimmed(ETrue); + } + else + { + currentState->SetHelpTextL( toolTipText->Des()); + } + CleanupStack::PopAndDestroy(toolTipText); + } + else + { + User::Leave(KErrArgument); + } + } + } + } + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlervideoplayback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlervideoplayback.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,459 @@ +/* +* Copyright (c) 2008-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: Video Playback command handler +* +*/ + + + + +#include "glxcommandhandlervideoplayback.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/** + * @internal reviewed 11/06/2007 by Alex Birkett + */ + +const TUid KVideoHelixPlaybackPluginUid = { 0x10282551 }; + +#include "glxcommandfactory.h" + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerVideoPlayback* CGlxCommandHandlerVideoPlayback::NewL( + MGlxMediaListProvider* aMediaListProvider) + { + CGlxCommandHandlerVideoPlayback* self = new ( ELeave ) + CGlxCommandHandlerVideoPlayback(aMediaListProvider); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerVideoPlayback::CGlxCommandHandlerVideoPlayback(MGlxMediaListProvider* + aMediaListProvider) + : CGlxMediaListCommandHandler(aMediaListProvider), iIconDisplayState(EUndefined) + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::ConstructL() + { + iUiUtility = CGlxUiUtility::UtilityL(); + + const TUid playbackMode = { 0x200009EE }; // photos UID + iPlaybackUtility = MMPXPlaybackUtility::UtilityL( playbackMode ); + MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); + manager.SelectPlayerL( KVideoHelixPlaybackPluginUid ); + iPlaybackUtility->AddObserverL( *this ); + + iViewUtility = MMPXViewUtility::UtilityL(); + + // Add supported commands + + // Play videoplayback + TCommandInfo info(EGlxCmdPlay); + // filter out everything except videos + info.iCategoryFilter = EMPXVideo; + info.iCategoryRule = TCommandInfo::ERequireAll; + info.iMinSelectionLength = 1; + info.iMaxSelectionLength = 1; + AddCommandL(info); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerVideoPlayback::~CGlxCommandHandlerVideoPlayback() + { + if (iUiUtility) + { + iUiUtility->Close(); + } + + if ( iViewUtility ) + { + iViewUtility->Close(); + } + + if ( iPlaybackUtility ) + { + TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) ); + TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); + iPlaybackUtility->Close(); + } + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerVideoPlayback::DoExecuteL(TInt aCommandId, + MGlxMediaList& /*aList*/) + { + TRACER("CGlxCommandHandlerVideoPlayback::DoExecuteL()"); + TBool handledCommand = ETrue; + + switch (aCommandId) + { + case EGlxCmdPlay: + { + //Setting the navigational Status to Forwards when Play is activated + //and is set backwards in ActivatePreviousViewL + iUiUtility->SetViewNavigationDirection( EGlxNavigationForwards ); + // Activate the videoplayback view + ActivateViewL(); + break; + } + default: + { + handledCommand = EFalse; + break; + } + } + return handledCommand; + } + +// ----------------------------------------------------------------------------- +// DoDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::DoDynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* aMenuPane) + { + TInt pos = 0; + + // If the menu contains Play command and if the device supports touch interface, + // hide the Play command in the menu. (Since the user can Play by just tapping on the video + // thumbnail in case of grid view and play icon in case of fullscreen view) + if(iUiUtility->IsPenSupported() && aMenuPane->MenuItemExists(EGlxCmdPlay,pos)) + { + aMenuPane->SetItemDimmed( EGlxCmdPlay, ETrue); + } + } +// ----------------------------------------------------------------------------- +// ActivateViewL - launch the ViaPlayer view +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::ActivateViewL() + { + TRACER("CGlxCommandHandlerVideoPlayback::ActivateViewL()"); + + // get the focused item from the media list + MGlxMediaList& mediaList = MediaList(); + + CGlxDefaultAttributeContext* attributeContext = CGlxDefaultAttributeContext::NewL(); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(KMPXMediaGeneralUri); + attributeContext->AddAttributeL(KMPXMediaGeneralTitle); + attributeContext->AddAttributeL(KMPXMediaGeneralCategory); + mediaList.AddContextL(attributeContext, KGlxFetchContextPriorityBlocking); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover (attributeContext, mediaList); + CleanupClosePushL( contextRemover ); + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext, mediaList)); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + TInt index = mediaList.FocusIndex(); + TGlxMedia item = mediaList.Item(index); + const CGlxMedia* media = item.Properties(); + if(media) + { + if(media->IsSupported(KMPXMediaGeneralUri)) + { + // MPX playbackutility instead of VIA Player + const TDesC& filename = media->ValueText(KMPXMediaGeneralUri); + // Causes callback to HandlePlaybackMessage() + iPlaybackUtility->InitL(filename); + } + } + CleanupStack::PopAndDestroy(attributeContext); + } +// ----------------------------------------------------------------------------- +// DoActivateL - Activate this command handler +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::DoActivateL(TInt aViewId) + { + TRACER("CGlxCommandHandlerVideoPlayback::DoActivateL()"); + iViewId = aViewId; + + MGlxMediaList& mediaList = MediaList(); + + mediaList.AddMediaListObserverL(this); + + iIconDisplayState = EVisible; + + iAttributeContext = CGlxDefaultAttributeContext::NewL(); + iAttributeContext->SetRangeOffsets(1, 1); + iAttributeContext->AddAttributeL(KMPXMediaGeneralCategory); + mediaList.AddContextL( iAttributeContext, KGlxFetchContextPriorityLow ); + + SetToolBar(); + } +// ----------------------------------------------------------------------------- +// Deactivate - Deactivate this command handler +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::Deactivate() + { + TRACER("CGlxCommandHandlerVideoPlayback::Deactivate()"); + + MGlxMediaList& mediaList = MediaList(); + + if (iAttributeContext) + { + mediaList.RemoveContext(iAttributeContext); + delete iAttributeContext; + iAttributeContext = NULL; + } + + mediaList.RemoveMediaListObserver(this); + } + +// ----------------------------------------------------------------------------- +// HandleAttributesAvailableL - Sets the toolbar according to the attributes +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::HandleAttributesAvailableL(TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* /* aList */) + { + TRACER("CGlxCommandHandlerVideoPlayback::HandleAttributesAvailableL()"); + if (MediaList().FocusIndex() == aItemIndex ) + { + TIdentityRelation match(TMPXAttribute::Match); + if (KErrNotFound != aAttributes.Find(KMPXMediaGeneralCategory, match)) + { + SetToolBar(); + } + } + } + + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL - Handles a Focus change in the media list +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::HandleFocusChangedL(NGlxListDefs::TFocusChangeType + /* aType */, TInt /* aNewIndex */, TInt /* aOldIndex */, MGlxMediaList* /* aList */) + { + TRACER("CGlxCommandHandlerVideoPlayback::HandleFocusChangedL()"); + SetToolBar(); + } + +// ----------------------------------------------------------------------------- +// SetToolBarL - Set the toolbar to the correct state. +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::SetToolBar() + { + TRACER("CGlxCommandHandlerVideoPlayback::SetToolBar()"); + TInt focus = MediaList().FocusIndex(); + if ( focus >= 0 ) + { + // Only show the icon if video is in focus + TMPXGeneralCategory category = MediaList().Item(focus).Category(); + TBool visible = (EMPXVideo == category); + + // Decide if we need to update the toolbar + TBool UpdateToolBar = EFalse; + + if (visible) + { + if (iIconDisplayState != EVisible) + { + UpdateToolBar = ETrue; + } + } + else + { + if (iIconDisplayState != EHidden) + { + UpdateToolBar = ETrue; + } + } + + // Update the toolbar if need be. + if (UpdateToolBar) + { + iUiUtility->ScreenFurniture()->SetToolbarItemVisibility( EGlxCmdPlay, visible ); + iIconDisplayState = (visible ? EVisible : EHidden); + } + } + } + +// ----------------------------------------------------------------------------- +// HandlePlaybackMessage +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ) + { + TRACER("CGlxCommandHandlerVideoPlayback::HandlePlaybackMessage()"); + + if ( aError == KErrNone && aMessage ) + { + TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) ); + } + } + +// ----------------------------------------------------------------------------- +// DoHandlePlaybackMessageL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL( const CMPXMessage& aMessage ) + { + TRACER("CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL()"); + + TMPXMessageId id( *aMessage.Value< TMPXMessageId >( KMPXMessageGeneralId ) ); + + GLX_LOG_INFO1( "CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL TMPXMessageId =0x%08x",id); + + if ( KMPXMessageGeneral == id ) + { + switch ( *aMessage.Value( KMPXMessageGeneralEvent ) ) + { + case TMPXPlaybackMessage::EPlayerChanged: + { + // Need to call MMPXPlaybackUtility::CurrentPlayer() to get new features + GLX_LOG_INFO( "CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL: EPlayerChanged" ); + HandlePlaybackPlayerChangedL(); + break; + } + case TMPXPlaybackMessage::EInitializeComplete: + { + GLX_LOG_INFO( "CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL: EInitializeComplete" ); + break; + } + case TMPXPlaybackMessage::EPlayerUnavailable: + { + GLX_LOG_INFO( "CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL: EPlayerUnavailable" ); + break; + } + case TMPXPlaybackMessage::EPropertyChanged: + { + GLX_LOG_INFO( "CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL: EPropertyChanged" ); + break; + } + case TMPXPlaybackMessage::EError: + { + GLX_LOG_INFO1( "CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL error = %d", + *aMessage.Value( KMPXMessageGeneralData ) ); + break; + } + + case TMPXPlaybackMessage::EStateChanged: + { + break; + } + case TMPXPlaybackMessage::ECommandReceived: // iType=TMPXPlaybackCommand + case TMPXPlaybackMessage::ECommandComplete: // iType=TMPXPlaybackCommand + case TMPXPlaybackMessage::ESongCorrupt: + case TMPXPlaybackMessage::ESongContainerChanged: // Need to call MMPXMedia::CollectionPathL() to get new path + case TMPXPlaybackMessage::ESongChanged: // iData=new index; need to query to get new properties (e.g. duration: title etc.) + case TMPXPlaybackMessage::EActivePlayerChanged: // iData=active/inactive (ETrue/EFalse); iType (ETrue:rebind to ActivePlayerMode) + case TMPXPlaybackMessage::ESubPlayersChanged: // Need to query to get new list of sub players + case TMPXPlaybackMessage::EPlayerSelectionChanged: // Need to query MMPXPlayerManager::GetSelectionL() + case TMPXPlaybackMessage::EDownloadStarted: // iData=total expected bytes + case TMPXPlaybackMessage::EDownloadUpdated: // iData=total bytes so far + case TMPXPlaybackMessage::EDownloadComplete: // iData=total bytes downloaded + case TMPXPlaybackMessage::EDownloadPositionChanged: // iData=total bytes so far + case TMPXPlaybackMessage::EDownloadStateChanged: // iData=TMPXPlaybackPdDownloadState + case TMPXPlaybackMessage::EDownloadCmdPauseDownload: // iData=transaction ID + case TMPXPlaybackMessage::EDownloadCmdResumeDownload: // iData=transaction ID + case TMPXPlaybackMessage::EDownloadCmdCancelDownload: // iData=transaction ID + case TMPXPlaybackMessage::EAccessoryChanged: // iType=TAccessoryMode + case TMPXPlaybackMessage::EMediaChanged: // When the song/playlist hasn't: but data may become available + case TMPXPlaybackMessage::ESkipping: //skipping event, iData=+1, skipping forward, -1, skipping backward + case TMPXPlaybackMessage::ESkipEnd: //skipping end + case TMPXPlaybackMessage::EPlaylistUpdated: // playlist updated + case TMPXPlaybackMessage::EReachedEndOfPlaylist: // playback or skipping forward has reached end of playlist + { + GLX_LOG_INFO1( "CGlxCommandHandlerVideoPlayback::DoHandlePlaybackMessageL KMPXMessageGeneralEvent = %d", + *aMessage.Value( KMPXMessageGeneralEvent ) ); + break; + } + default: + { + break; + } + } + } + } + +// ----------------------------------------------------------------------------- +// HandlePlaybackPlayerChangedL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerVideoPlayback::HandlePlaybackPlayerChangedL() + { + TRACER("CGlxCommandHandlerVideoPlayback::HandlePlaybackPlayerChangedL()"); + + MMPXPlayer* player = iPlaybackUtility->PlayerManager().CurrentPlayer(); + + TUid pluginUid( KNullUid ); + RArray array; + CleanupClosePushL( array ); + + if ( player ) + { + pluginUid = player->UidL(); + array.AppendL( pluginUid ); + } + // Causes view switch to playback view + iViewUtility->ActivateViewL( array ); + CleanupStack::PopAndDestroy( &array ); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxmediaselectionpopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxmediaselectionpopup.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,786 @@ +/* +* Copyright (c) 2008-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: Generic selection popup class +* +*/ + + + + +/** + * @internal reviewed 06/06/2007 by Dave Schofield + * @internal reviewed 13/07/2007 by Aki Vanhatalo + */ +// INCLUDE FILES + +#include "glxmediaselectionpopup.h" + +#include // for KDC_APP_RESOURCE_DIR + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include +#include + +#include "glxcommandhandlernewmedia.h" + + +_LIT(KUnselectedIconIndex, "1\t"); +_LIT(KAlbumIconIndex, "2\t"); +_LIT(KBlankIconIndex, "3\t"); // No icon + +_LIT(KGlxCommonCommandHandlerResource, "glxcommoncommandhandlers.rsc"); + +const TInt KMediaSelectionPopupMediaListHierarchyId = 0x2000A77A; +const TInt KIconArrayGranularity = 2; +const TInt KNewItemId = 12345; + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListAdaptor::CGlxMediaListAdaptor(const MGlxMediaList* aMediaList, TBool aMultiSelection) + : iMediaList(aMediaList), iMultiSelection(aMultiSelection) + { + } + +// --------------------------------------------------------------------------- +// CGlxMediaListAdaptor::SetEnabled() +// --------------------------------------------------------------------------- +// +void CGlxMediaListAdaptor::SetEnabled(TBool aEnabled) + { + iEnabled = aEnabled; + } + +// --------------------------------------------------------------------------- +// CGlxMediaListAdaptor::MediaList() +// --------------------------------------------------------------------------- +// +const MGlxMediaList* CGlxMediaListAdaptor::MediaList() + { + return iMediaList; + } + +// --------------------------------------------------------------------------- +// CGlxMediaListAdaptor::MultiSelectionEnabled() +// --------------------------------------------------------------------------- +// +TBool CGlxMediaListAdaptor::MultiSelectionEnabled() + { + return iMultiSelection; + } + +// --------------------------------------------------------------------------- +// CGlxMediaListAdaptor::MdcaCount() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxMediaListAdaptor::MdcaCount() const + { + __ASSERT_DEBUG(iMediaList, Panic(EGlxPanicNullPointer)); + if (iEnabled) + { + return iMediaList->Count(); + } + else + { + return 0; + } + } + +// --------------------------------------------------------------------------- +// CGlxMediaListAdaptor::MdcaPoint() +// --------------------------------------------------------------------------- +// +EXPORT_C TPtrC CGlxMediaListAdaptor::MdcaPoint(TInt aIndex) const + { + const TGlxMedia& item = iMediaList->Item(aIndex); + + TPtrC title = item.Title(); + if ( item.IsStatic() || title.Length() == 0 ) + { + // The item is a static item or the item's title length is 0 + iCurrentTitleString = KBlankIconIndex; + } + else + { + if (iMultiSelection) + { + iCurrentTitleString = KUnselectedIconIndex; + } + else + { + iCurrentTitleString = KAlbumIconIndex; + } + } + + // iCurrentTitleString contains a tab character + iCurrentTitleString.Append(title.Left(KMaxTitleStringLength - iCurrentTitleString.Length())); + + return TPtrC(iCurrentTitleString); + } + +// --------------------------------------------------------------------------- +// CGlxSingleGraphicPopupMenuStyleListBox::IsVisible +// --------------------------------------------------------------------------- +// +TBool CGlxSingleGraphicPopupMenuStyleListBox::IsVisible(TInt aItemIndex) + { + return (TopItemIndex() <= aItemIndex && aItemIndex <= BottomItemIndex()); + } + +// --------------------------------------------------------------------------- +// CGlxSingleGraphicPopupMenuStyleListBox::OfferKeyEventL() +// --------------------------------------------------------------------------- +// +EXPORT_C TKeyResponse CGlxSingleGraphicPopupMenuStyleListBox:: + OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) + { + __ASSERT_DEBUG(dynamic_cast< CGlxMediaListAdaptor* >(Model()->ItemTextArray()), Panic(EGlxPanicCastFailed)); + + if (aKeyEvent.iCode == EKeyOK && iView) + { + CGlxMediaListAdaptor* mediaListAdaptor = static_cast (Model()->ItemTextArray()); + + if (mediaListAdaptor->MultiSelectionEnabled() && View()->CurrentItemIndex() >= 0 ) + { + const TGlxMedia& item = mediaListAdaptor->MediaList()->Item(View()->CurrentItemIndex()); + // Reset the observer to populist + SetListBoxObserver(iPopupList) ; + if ( item.IsStatic() ) + { + iListBoxFlags &= (~EMultipleSelection); // turn off multiple selection + } + else + { + iListBoxFlags |= EMultipleSelection; // turn on multiple selection + } + } + } + + return CAknSingleGraphicPopupMenuStyleListBox::OfferKeyEventL(aKeyEvent, aType); + } + +// --------------------------------------------------------------------------- +// CGlxSingleGraphicPopupMenuStyleListBox::HandleListBoxEventL() +// --------------------------------------------------------------------------- +// +void CGlxSingleGraphicPopupMenuStyleListBox::HandleListBoxEventL (CEikListBox *aListBox, TListBoxEvent aEventType) + { + switch(aEventType) + { + case EEventItemClicked : + { + CGlxMediaListAdaptor* mediaListAdaptor = static_cast (Model()->ItemTextArray()); + if (mediaListAdaptor->MultiSelectionEnabled() && View()->CurrentItemIndex() >= 0 ) + { + const TGlxMedia& item = mediaListAdaptor->MediaList()->Item(View()->CurrentItemIndex()); + if ( item.IsStatic() ) + { + // when the user marks a non-static item and then clicks on + // a static item without moving highlight, the control comes here. + iListBoxFlags &= (~EMultipleSelection); // turn off multiple selection + } + else + { + iListBoxFlags |= EMultipleSelection; // turn on multiple selection + + TBool isMarked = View()->ItemIsSelected(View()->CurrentItemIndex()) ; + (isMarked == (TBool) ETrue) ? ( View()->DeselectItem(View()->CurrentItemIndex()) ) + : ( View()->SelectItemL(View()->CurrentItemIndex()) ) ; + } + } + aListBox->DrawDeferred(); + break ; + } + default : + break ; + } + } + +// --------------------------------------------------------------------------- +// CGlxSingleGraphicPopupMenuStyleListBox::HandlePointerEventL() +// --------------------------------------------------------------------------- +// +void CGlxSingleGraphicPopupMenuStyleListBox::HandlePointerEventL(const TPointerEvent& aPointerEvent) + { + CGlxMediaListAdaptor* mediaListAdaptor = static_cast (Model()->ItemTextArray()); + if (mediaListAdaptor->MultiSelectionEnabled()) + { + // Need to handle the case when the highlight is on one item + // and the user clicks on another media item. The notification + // of changed item index is received very late. In order to + // handle this, checking if the index has changed. + TInt changedItemIndex = -1; + TInt itemIndex = View()->CurrentItemIndex(); + TBool isItemChanged = View()->XYPosToItemIndex(aPointerEvent.iPosition, changedItemIndex); + if (isItemChanged) + { + itemIndex = changedItemIndex; + } + const TGlxMedia& item = mediaListAdaptor->MediaList()->Item(itemIndex); + if (item.IsStatic()) + { + // A static item is not markable. Turn off multiple selection + // Set the listbox observer to default that is CAknPopupList + // object, which will process it further. + iListBoxFlags &= (~EMultipleSelection); + SetListBoxObserver(iPopupList) ; + } + else + { + // Markable object. The event is handled in HandleListBoxEventL() + // Set the listbox observer to the current object. + SetListBoxObserver(this) ; + } + } + CAknSingleGraphicPopupMenuStyleListBox::HandlePointerEventL(aPointerEvent) ; + } + +// --------------------------------------------------------------------------- +// CGlxSingleGraphicPopupMenuStyleListBox::SetPopupList() +// --------------------------------------------------------------------------- +// +void CGlxSingleGraphicPopupMenuStyleListBox::SetPopupList(CAknPopupList* aPopupList) + { + iPopupList = aPopupList; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaSelectionPopup::CGlxMediaSelectionPopup() + : CActive(EPriorityStandard) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::RunL() +// --------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::RunL() + { + // The media list adaptor is enabled after the popup list is invoked + // to ensure that the popup list is laid out correctly. + iMediaListAdaptor->SetEnabled(ETrue); + AddNewMediaCreationItemL(); + } + +// --------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::DoCancel() +// --------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::DoCancel() + { + // no implementation required + } + +// --------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::ExecuteLD() +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath* CGlxMediaSelectionPopup::ExecuteLD(CMPXCollectionPath& aPath, + TBool& aAccepted, + TBool aMultiSelection, + TBool aEnableContainerCreation, + CMPXFilter* aFilter) + { + CleanupStack::PushL(this); // if something leaves delete 'this' object + + iEnableContainerCreation = aEnableContainerCreation; + + iCollectionId = TGlxMediaId(aPath.Id(0)); + + FetchTitlesL(); + + iMediaList = MGlxMediaList::InstanceL(aPath, KMediaSelectionPopupMediaListHierarchyId, aFilter); + + iMediaList->AddMediaListObserverL(this); + + iMediaListAdaptor = new(ELeave) CGlxMediaListAdaptor(iMediaList, aMultiSelection); + + + SetupAttributeContextL(); + + AddResourceFileL(); + ConstructPopupListL(aMultiSelection); + InitIconsL(); + + CompleteSelf(); // This will cause RunL() to be called by the active scheduler. + + // Invoke the dialog. + // The media list adaptor MdcaCount() method must return 0 at this point in order + // for the popup to be displayed correctly. If MdcaCount() returns 1 then the popup will contain only + // a single row. + // iPopupList->ExecuteLD() starts a nested active scheduler so acvtive objects will be executed before + // iPopupList->ExecuteLD() completes. + aAccepted = iPopupList->ExecuteLD(); + + if (iListBox->CurrentItemIndex() < 0) + { + // There is no current item therefore there is nothing to select + // Fix for error ID: ERBS-7BSKFV Application crashes if user attempts to add a tag when in full screen view. + aAccepted = EFalse; + } + + iMediaList->RemoveMediaListObserver(this); // We no longer require any callbacks from the media list + + + CMPXCollectionPath* path = NULL; + if (aAccepted) + { + + if(iMediaList->Item(iListBox->CurrentItemIndex()).IsStatic()) + { + + CGlxCommandHandlerNewMedia* commandHandlerNewMedia = CGlxCommandHandlerNewMedia::NewL(this); + TGlxMediaId newMediaId; + TInt error = commandHandlerNewMedia->ExecuteLD(newMediaId); + if (error == KErrNone) + { + path = CMPXCollectionPath::NewL(aPath); + CleanupStack::PopAndDestroy(this); + CleanupStack::PushL(path); + path->AppendL(newMediaId.Value()); + CleanupStack::Pop(path); + } + else if (error == KErrCancel) + { + // The user has cancelled the popup list + aAccepted = EFalse; + CleanupStack::PopAndDestroy(this); + } + else + { + // The error is neither KErrNone or KErrCancel, leave. + User::Leave(error); + } + + } + else + { + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iListBox->CurrentItemIndex()); + + const CListBoxView::CSelectionIndexArray* selectionIndices = + iListBox->SelectionIndexes(); + + TInt count = selectionIndices->Count(); + for (TInt i = 0; i < count; i++) + { + iMediaList->SetSelectedL(selectionIndices->At(i), ETrue); + } + + path = iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); + CleanupStack::Pop(path); + CleanupStack::PopAndDestroy(this); + } + } + else + { + CleanupStack::PopAndDestroy(this); + } + + return path; + } + +// --------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::ListBoxItemsChanged() +// --------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::ListBoxItemsChanged( CEikListBox* /*aListBox*/ ) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxMediaSelectionPopup::~CGlxMediaSelectionPopup() + { + Cancel(); + + delete iMediaListAdaptor; + delete iListBox; + + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + if (iMediaList) + { + if (iAttributeContext) + { + iMediaList->RemoveContext(iAttributeContext); + } + iMediaList->RemoveMediaListObserver(this); // This is required in case ExecuteLD() left. + + iMediaList->Close(); + } + + delete iAttributeContext; + delete iSelectMediaPopupTitle; + delete iNewMediaItemTitle; + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleItemAddedL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleItemAddedL( TInt aStartIndex, + TInt aEndIndex, MGlxMediaList* aList ) + { + // The call to HandleItemAdditionL() should be deferred if all of the new items + // don't have title attributes as unnecessary calls to HandleItemAdditionL will + // cause the dialog to flicker. + if (iListBox) + { + TBool handleItemAdditionRequired = EFalse; + for (TInt i = aStartIndex; i <= aEndIndex; i++) + { + TGlxMedia item = aList->Item(i); + if (item.Title().Length() > 0) + // The title length is greater than 0, i.e. there is a title. + { + handleItemAdditionRequired = ETrue; + break; + } + } + + if (handleItemAdditionRequired) + { + iListBox->HandleItemAdditionL(); + } + else + { + iHandleItemAdditionRequired = ETrue; // defer the call until we have title attributes + } + } + + CEikButtonGroupContainer* cbaContainer = iPopupList->ButtonGroupContainer(); + cbaContainer->SetCommandSetL(R_GLX_SOFTKEYS_OK_CANCEL); + cbaContainer->DrawDeferred(); + + ///@todo if required: update the existing selection when items are added + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleMediaL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleMediaL( TInt /*aListIndex*/, + MGlxMediaList* /*aList*/ ) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleItemRemovedL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleItemRemovedL( TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + if (iListBox) + { + iListBox->HandleItemRemovalL(); + } + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleItemModifiedL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleItemModifiedL( + const RArray& aItemIndexes, MGlxMediaList* /*aList*/ ) + { + if (iListBox) + { + for (TInt i = 0; i < aItemIndexes.Count(); i++) + { + if (iListBox->IsVisible(aItemIndexes[i])) + { + iListBox->RedrawItem(aItemIndexes[i]); + } + } + } + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleAttributesAvailableL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleAttributesAvailableL( TInt aItemIndex, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/ ) + { + if (iListBox) + { + if (iHandleItemAdditionRequired) + { + iListBox->HandleItemAdditionL(); + iHandleItemAdditionRequired = EFalse; + } + if(iListBox->IsVisible(aItemIndex)) + { + iListBox->RedrawItem(aItemIndex); + } + } + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleFocusChangedL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, + TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleItemSelectedL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleItemSelectedL( TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleMessageL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + // Don't do anything. + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::HandleError() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::HandleError( TInt /*aError*/ ) + { + ///@todo implement + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::MediaList() +// ----------------------------------------------------------------------------- +// +MGlxMediaList& CGlxMediaSelectionPopup::MediaList() + { + // Provides a media list to CGlxCommandHandlerNewMedia + return *iMediaList; + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::AddResourceFileL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::AddResourceFileL() + { + // Load resource + TParse parse; + parse.Set(KGlxCommonCommandHandlerResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::SetupAttributeContextL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::SetupAttributeContextL() + { + iAttributeContext = new (ELeave) CGlxAttributeContext(&iIterator); + iAttributeContext->AddAttributeL(KMPXMediaGeneralTitle); + iMediaList->AddContextL( iAttributeContext, KGlxFetchContextPriorityLow ); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::SetupAttributeContextL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::InitIconsL() + { + CAknIconArray* iconArray = new (ELeave) CAknIconArray(KIconArrayGranularity); + CleanupStack::PushL(iconArray); + + // Sets graphics as ListBox icon. + iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray); + + CleanupStack::Pop(iconArray); // iconArray + + ///@todo use mgallery icons when available + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + CGulIcon* icon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnPropCheckboxOn, + KAvkonBitmapFile, + EMbmAvkonQgn_prop_checkbox_on, + EMbmAvkonQgn_prop_checkbox_on_mask ); + CleanupStack::PushL(icon); + iconArray->AppendL(icon); + CleanupStack::Pop(icon); + + icon = AknsUtils::CreateGulIconL( + skin, + KAknsIIDQgnPropCheckboxOff, + KAvkonBitmapFile, + EMbmAvkonQgn_prop_checkbox_off, + EMbmAvkonQgn_prop_checkbox_off_mask ); + CleanupStack::PushL(icon); + iconArray->AppendL(icon); + CleanupStack::Pop(icon); + + iconArray->AppendFromResourceL(R_GLX_ALBUM_SELECTION_ICONS); + + ///@todo Find a more elegant way of not painting an icon. + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + icon = CGulIcon::NewL(bitmap); + CleanupStack::Pop(bitmap); + CleanupStack::PushL(icon); + iconArray->AppendL(icon); + CleanupStack::Pop(icon); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::AddNewMediaCreationItemL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::AddNewMediaCreationItemL() + { + if (iEnableContainerCreation) + { + CGlxMedia* newMediaCreationStaticItem = new (ELeave) CGlxMedia(TGlxMediaId(KNewItemId)); + CleanupStack::PushL(newMediaCreationStaticItem); + __ASSERT_DEBUG(iNewMediaItemTitle, Panic(EGlxPanicNullPointer)); + newMediaCreationStaticItem->SetTextValueL(KMPXMediaGeneralTitle, *iNewMediaItemTitle); + iMediaList->AddStaticItemL(newMediaCreationStaticItem, NGlxListDefs::EInsertFirst); + CleanupStack::Pop(newMediaCreationStaticItem); + } + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::CompleteSelf() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::CompleteSelf() + { + TRequestStatus* status=&iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::FetchTitlesL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::FetchTitlesL() + { + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + + MGlxMediaList* rootList = MGlxMediaList::InstanceL(*path); + CleanupClosePushL(*rootList); + + TGlxSpecificIdIterator iter(KGlxIdSpaceIdRoot, iCollectionId); + CGlxAttributeContext* attributeContext = new (ELeave) CGlxAttributeContext(&iter); + CleanupStack::PushL(attributeContext); + attributeContext->AddAttributeL(KGlxMediaCollectionPluginSpecificNewMediaItemTitle); + attributeContext->AddAttributeL(KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle); + rootList->AddContextL(attributeContext, KGlxFetchContextPriorityBlocking); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover(attributeContext, *rootList); + CleanupClosePushL( contextRemover ); + User::LeaveIfError(GlxAttributeRetriever::RetrieveL(*attributeContext, *rootList, EFalse)); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + + TInt index = rootList->Index(KGlxIdSpaceIdRoot, iCollectionId); + + __ASSERT_DEBUG(index > KErrNotFound, Panic(EGlxPanicRequiredItemNotFound)); + TGlxMedia item = rootList->Item(index); + + const CGlxMedia* media = item.Properties(); + if (media) + { + iNewMediaItemTitle = media->ValueText(KGlxMediaCollectionPluginSpecificNewMediaItemTitle).AllocL(); + iSelectMediaPopupTitle = media->ValueText(KGlxMediaCollectionPluginSpecificSelectMediaPopupTitle).AllocL(); + } + + + CleanupStack::PopAndDestroy(attributeContext); + CleanupStack::PopAndDestroy(rootList); + CleanupStack::PopAndDestroy(path); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaSelectionPopup::ConstructPopupListL() +// ----------------------------------------------------------------------------- +// +void CGlxMediaSelectionPopup::ConstructPopupListL(TBool aMultiSelection) + { + // create the list box + iListBox = new (ELeave) CGlxSingleGraphicPopupMenuStyleListBox; + + // create the popup list + iPopupList = CAknPopupList::NewL(iListBox, R_AVKON_SOFTKEYS_CANCEL); + + // set the title of the popup + __ASSERT_DEBUG(iSelectMediaPopupTitle, Panic(EGlxPanicNullPointer)); + + iPopupList->SetTitleL(*iSelectMediaPopupTitle); + + iListBox ->ConstructL(iPopupList, aMultiSelection ? EAknListBoxMultiselectionList : EAknListBoxMenuList); + iListBox->CreateScrollBarFrameL(); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + // create the listbox model + iListBox->Model()->SetItemTextArray(iMediaListAdaptor); + iListBox->View()->CalcBottomItemIndex(); + iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); + + // Store the pointer of AknPopupList + iListBox->SetPopupList(iPopupList); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/Group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-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: Project build file +* +*/ + + + + + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +#include "../ut_cglxcommandhandlersortorder/group/bld.inf" +//#include "../t_glxcommandhandlerback/group/bld.inf" +//#include "../ut_propertycommandhandlers/group/bld.inf" +//#include "../t_cglxaiwservicehandler/group/bld.inf" + +// only include the test if the feature is enabled +#ifdef GLX_TILE_VIEW_IMAGES_OR_VIDEOS_ONLY_FILTERING +../t_glxcommandhandlerfilterimagesorvideos/group/t_cglxcommandhandlerfilterimagesorvideos.mmp +#endif + + + +//End of files + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/t_cglxaiwservicehandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/t_cglxaiwservicehandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/t_cglxcommandhandlerbacku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/t_cglxcommandhandlerbacku.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void) + ??1CGlxCommandHandlerBack@@UAE@XZ @ 2 NONAME ; CGlxCommandHandlerBack::~CGlxCommandHandlerBack(void) + ?NewBackCommandHandlerL@CGlxCommandHandlerBack@@SAPAV1@XZ @ 3 NONAME ; class CGlxCommandHandlerBack * CGlxCommandHandlerBack::NewBackCommandHandlerL(void) + ?NewContainerPreviousViewCommandHandlerL@CGlxCommandHandlerBack@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 4 NONAME ; class CGlxCommandHandlerBack * CGlxCommandHandlerBack::NewContainerPreviousViewCommandHandlerL(class MGlxMediaListProvider *, int) + ?NewPreviousViewCommandHandlerL@CGlxCommandHandlerBack@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 5 NONAME ; class CGlxCommandHandlerBack * CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL(class MGlxMediaListProvider *) + ?NewPreviousNaviViewCommandHandlerL@CGlxCommandHandlerBack@@SAPAV1@PAVMGlxMediaListProvider@@@Z @ 6 NONAME ; class CGlxCommandHandlerBack * CGlxCommandHandlerBack::NewPreviousNaviViewCommandHandlerL(class MGlxMediaListProvider *) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/t_cglxcommandhandlerfilterimagesorvideosu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/t_cglxcommandhandlerfilterimagesorvideosu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/ut_cglxcommandhandlersortorderu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/bwins/ut_cglxcommandhandlersortorderu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ??1CGlxCommandHandlerSortOrder@@UAE@XZ @ 1 NONAME ; CGlxCommandHandlerSortOrder::~CGlxCommandHandlerSortOrder(void) + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 2 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?NewL@CGlxCommandHandlerSortOrder@@SAPAV1@PAVMGlxMediaListProvider@@K@Z @ 3 NONAME ; class CGlxCommandHandlerSortOrder * CGlxCommandHandlerSortOrder::NewL(class MGlxMediaListProvider *, unsigned long) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/t_cglxaiwservicehandleru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/t_cglxaiwservicehandleru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/t_cglxcommandhandlerbacku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/t_cglxcommandhandlerbacku.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,12 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN22CGlxCommandHandlerBack22NewBackCommandHandlerLEv @ 2 NONAME + _ZN22CGlxCommandHandlerBack30NewPreviousViewCommandHandlerLEP21MGlxMediaListProvider @ 3 NONAME + _ZN22CGlxCommandHandlerBack39NewContainerPreviousViewCommandHandlerLEP21MGlxMediaListProvideri @ 4 NONAME + _ZN22CGlxCommandHandlerBackD0Ev @ 5 NONAME + _ZN22CGlxCommandHandlerBackD1Ev @ 6 NONAME + _ZN22CGlxCommandHandlerBackD2Ev @ 7 NONAME + _ZThn4_N22CGlxCommandHandlerBackD0Ev @ 8 NONAME ; ## + _ZThn4_N22CGlxCommandHandlerBackD1Ev @ 9 NONAME ; ## + _ZN22CGlxCommandHandlerBack34NewPreviousNaviViewCommandHandlerLEP21MGlxMediaListProvider @ 10 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/t_cglxcommandhandlerfilterimagesorvideosu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/t_cglxcommandhandlerfilterimagesorvideosu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/ut_cglxcommandhandlersortorderu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/eabi/ut_cglxcommandhandlersortorderu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN27CGlxCommandHandlerSortOrder4NewLEP21MGlxMediaListProviderm @ 2 NONAME + _ZN27CGlxCommandHandlerSortOrderD0Ev @ 3 NONAME + _ZN27CGlxCommandHandlerSortOrderD1Ev @ 4 NONAME + _ZN27CGlxCommandHandlerSortOrderD2Ev @ 5 NONAME + _ZThn4_N27CGlxCommandHandlerSortOrderD0Ev @ 6 NONAME ; ## + _ZThn4_N27CGlxCommandHandlerSortOrderD1Ev @ 7 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: AIW commandhandlers build information +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_cglxaiwservicehandler.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/group/t_cglxaiwservicehandler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/group/t_cglxaiwservicehandler.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: AIW CommandHandlers +* +*/ + + + + +#include "../../../../../group/glxbuildcommon.mmh" + +TARGET t_cglxaiwservicehandler.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH Src +SOURCE t_cglxaiwservicehandler.cpp +SOURCE t_caiwservicehandlerstub.cpp + +// Sources required by the test suite +SOURCEPATH Src +SOURCE t_cglxaiwservicehandler_DllMain.cpp + +// Sources of the test code +SOURCEPATH ../../src +SOURCE glxaiwservicehandler.cpp +SOURCE glxaiwmedia.cpp + +USERINCLUDE Src +USERINCLUDE ../../inc + + +SYSTEMINCLUDE ../../../../../common/inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../layouts/inc +SYSTEMINCLUDE ../../../../medialists/inc +SYSTEMINCLUDE ../../../../plugins/videoviewplugin/inc +SYSTEMINCLUDE ../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../views/viewbase/inc +SYSTEMINCLUDE ../../../../visuallistmanager/inc +SYSTEMINCLUDE ../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../inc + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib + +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY charconv.lib // for CnvUtfConverter::ConvertFromUnicodeToUtf8L +LIBRARY commondialogs.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY estor.lib // for RBufWriteStream +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib +LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY hitchcock.lib // HUI framework +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib // for MPXViewUtility +LIBRARY servicehandler.lib +LIBRARY sendui.lib // for CSendUi +LIBRARY browserlauncher.lib +LIBRARY apparc.lib + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/inc/t_caiwservicehandlerstub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/inc/t_caiwservicehandlerstub.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* 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: AIW Service Handler stub implementation. +* +*/ + + + +#ifndef _T_CAIWSERVICEHANDLERSTUB_H_ +#define _T_CAIWSERVICEHANDLERSTUB_H_ + + + +NONSHARABLE_CLASS(CAiwServiceHandlerImpl) : public CBase + { +public: + static CAiwServiceHandlerImpl* NewL(); + ~CAiwServiceHandlerImpl(); + + CAiwGenericParamList& InParamListL(); + CAiwGenericParamList& OutParamListL(); + void ResetInParams(); + +private: + CAiwServiceHandlerImpl(); + void ConstructL(); + +private: + CAiwGenericParamList* iInParams; + CAiwGenericParamList* iOutParams; + }; + +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/inc/t_cglxaiwservicehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/inc/t_cglxaiwservicehandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AIW Service Handler stub implementation. +* +*/ + + + + +#ifndef __t_CGlxAiwServiceHandler_H__ +#define __t_CGlxAiwServiceHandler_H__ + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxAiwServiceHandler; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_CGlxAiwServiceHandler ) + : public CEUnitTestSuiteClass, public MEikMenuObserver + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_CGlxAiwServiceHandler* NewL(); + static t_CGlxAiwServiceHandler* NewLC(); + /** + * Destructor + */ + ~t_CGlxAiwServiceHandler(); + + private: // Constructors and destructors + + t_CGlxAiwServiceHandler(); + void ConstructL(); + + private: // From MEikMenuObserver + void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); + void ProcessCommandL(TInt aCommandId); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void TestConstructionL( ); + + void OneImageUniqueParamsL(); + + void OneImageDuplicateParamsL(); + + void TwoItemsUniqueParamsL(); + + void TwoItemsDuplicateParamsL(); + + private: // Data + + CGlxAiwServiceHandler* iAiwServiceHandler; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __t_CGlxAiwServiceHandler_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_caiwservicehandlerstub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_caiwservicehandlerstub.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,146 @@ +/* +* 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: AIW Service Handler stub implementation. +* +*/ + + +#include + +#include "t_caiwservicehandlerstub.h" + +CAiwServiceHandler* CAiwServiceHandler::NewL() + { + CAiwServiceHandler* self = new (ELeave) CAiwServiceHandler(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +CAiwServiceHandler::CAiwServiceHandler() + { + + } + +CAiwServiceHandler::~CAiwServiceHandler() + { + delete iImpl; + } + +void CAiwServiceHandler::ConstructL() + { + iImpl = CAiwServiceHandlerImpl::NewL(); + } + +CAiwGenericParamList& CAiwServiceHandler::InParamListL() + { + return iImpl->InParamListL(); + } + +CAiwGenericParamList& CAiwServiceHandler::OutParamListL() + { + return iImpl->OutParamListL(); + } + +void CAiwServiceHandler::InitializeMenuPaneL( + CEikMenuPane& /* aMenuPane */, + TInt /* aMenuResourceId */, + TInt /* aBaseMenuCmdId */, + const CAiwGenericParamList& /* aInParamList */) + { + iImpl->ResetInParams(); + } + +void CAiwServiceHandler::AttachMenuL(TInt /* aMenuResourceId */, TInt /* aInterestResourceId */) + { + + } + +TInt CAiwServiceHandler::ServiceCmdByMenuCmd(TInt /* aMenuCmdId */) const + { + return 0; + } + +void CAiwServiceHandler::ExecuteMenuCmdL( + TInt /* aMenuCmdId */, + const CAiwGenericParamList& /* aInParamList */, + CAiwGenericParamList& /* aOutParamList */, + TUint /* aCmdOptions */, + MAiwNotifyCallback* /* aCallback */) + { + + } + +TBool CAiwServiceHandler::HandleSubmenuL(CEikMenuPane& /* aPane */) + { + return ETrue; + } + +TBool CAiwServiceHandler::IsAiwMenu(TInt /* aMenuResourceId */) + { + return ETrue; + } + +/////////////////////////////////////////////////////////////////////////////// + +CAiwServiceHandlerImpl* CAiwServiceHandlerImpl::NewL() + { + CAiwServiceHandlerImpl* self = new (ELeave) CAiwServiceHandlerImpl(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +CAiwServiceHandlerImpl::CAiwServiceHandlerImpl() + { + + } + +CAiwServiceHandlerImpl::~CAiwServiceHandlerImpl() + { + delete iInParams; + delete iOutParams; + } + +void CAiwServiceHandlerImpl::ConstructL() + { + } + +CAiwGenericParamList& CAiwServiceHandlerImpl::InParamListL() + { + if (!iInParams) + { + iInParams = CAiwGenericParamList::NewL(); + } + return *iInParams; + } + +CAiwGenericParamList& CAiwServiceHandlerImpl::OutParamListL() + { + if (!iOutParams) + { + iOutParams = CAiwGenericParamList::NewL(); + } + return *iOutParams; + } + +void CAiwServiceHandlerImpl::ResetInParams() + { + delete iInParams; + iInParams = 0; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_caiwservicehandlerstub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_caiwservicehandlerstub.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* 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: AIW Service Handler stub implementation. +* +*/ + + + +#ifndef _T_CAIWSERVICEHANDLERSTUB_H_ +#define _T_CAIWSERVICEHANDLERSTUB_H_ + + + +NONSHARABLE_CLASS(CAiwServiceHandlerImpl) : public CBase + { +public: + static CAiwServiceHandlerImpl* NewL(); + ~CAiwServiceHandlerImpl(); + + CAiwGenericParamList& InParamListL(); + CAiwGenericParamList& OutParamListL(); + void ResetInParams(); + +private: + CAiwServiceHandlerImpl(); + void ConstructL(); + +private: + CAiwGenericParamList* iInParams; + CAiwGenericParamList* iOutParams; + }; + +#endif diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,374 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AIW Service Handler stub implementation. +* +*/ + + + + +// CLASS HEADER +#include "t_CGlxAiwServiceHandler.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include // For Attribute constants +#include +#include +#include +#include +#include +// INTERNAL INCLUDES +#include "glxaiwservicehandler.h" + +// CONSTRUCTION +t_CGlxAiwServiceHandler* t_CGlxAiwServiceHandler::NewL() + { + t_CGlxAiwServiceHandler* self = t_CGlxAiwServiceHandler::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_CGlxAiwServiceHandler* t_CGlxAiwServiceHandler::NewLC() + { + t_CGlxAiwServiceHandler* self = new( ELeave ) t_CGlxAiwServiceHandler(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +t_CGlxAiwServiceHandler::~t_CGlxAiwServiceHandler() + { + } + +// Default constructor +t_CGlxAiwServiceHandler::t_CGlxAiwServiceHandler() + { + } + +// Second phase construct +void t_CGlxAiwServiceHandler::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + + +// METHODS +void t_CGlxAiwServiceHandler::SetupL( ) + { + iAiwServiceHandler = CGlxAiwServiceHandler::InstanceL(); + } + + +void t_CGlxAiwServiceHandler::Teardown( ) + { + iAiwServiceHandler->Close(); + } + +void t_CGlxAiwServiceHandler::TestConstructionL( ) + { + // Only testing for leaks during setup/teardown here + EUNIT_ASSERT(ETrue); + } + +void t_CGlxAiwServiceHandler::OneImageUniqueParamsL() + { + _LIT(KImageUri ,"c:\\Data\\Images\\Image01.jpg"); + _LIT(KImageMimeType, "image/jpeg"); + + // First Create a Dummy Menu pane (for use later) + CEikMenuPane* dummyMenuPane = new (ELeave) CEikMenuPane(this); + CleanupStack::PushL(dummyMenuPane); + + // Create a Media Id + TGlxMedia Image(TGlxMediaId(1)); + + // Add the Uri and MimeType parameters to internal array + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + + // Now transfer the parameters from our array to the InParams + iAiwServiceHandler->HandleSubmenuL(*dummyMenuPane); + + CleanupStack::PopAndDestroy(dummyMenuPane); + + // Now get the InParams to see if it contains what it should + CAiwGenericParamList& InParams = iAiwServiceHandler->GetInParams(); + + // Check the count is 2 + TInt paramCount = InParams.Count(); + EUNIT_ASSERT( paramCount == 2); + + // Check the Uri is correct + TPtrC uri; + InParams[0].Value().Get(uri); + EUNIT_ASSERT(0 == uri.Compare(KImageUri)); + + // Check the MimeType is correct + TPtrC mimeType; + InParams[1].Value().Get(mimeType); + EUNIT_ASSERT(0 == mimeType.Compare(KImageMimeType)); + } + +void t_CGlxAiwServiceHandler::OneImageDuplicateParamsL() + { + _LIT(KImageUri ,"c:\\Data\\Images\\Image01.jpg"); + _LIT(KImageMimeType, "image/jpeg"); + + // First Create a Dummy Menu pane (for use later) + CEikMenuPane* dummyMenuPane = new (ELeave) CEikMenuPane(this); + CleanupStack::PushL(dummyMenuPane); + + // Create a Media Id + TGlxMedia Image(TGlxMediaId(1)); + + // Add the Uri and MimeType parameters to internal array + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + + // Now add duplicate parameters (lots of them) + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + + // Now transfer the parameters from our array to the InParams + iAiwServiceHandler->HandleSubmenuL(*dummyMenuPane); + + CleanupStack::PopAndDestroy(dummyMenuPane); + + // Now get the InParams to see if it contains what it should + CAiwGenericParamList& InParams = iAiwServiceHandler->GetInParams(); + + // Check the count is 2 + TInt paramCount = InParams.Count(); + EUNIT_ASSERT( paramCount == 2); + + // Check the Uri is correct + TPtrC uri; + InParams[0].Value().Get(uri); + EUNIT_ASSERT(0 == uri.Compare(KImageUri)); + + // Check the MimeType is correct + TPtrC mimeType; + InParams[1].Value().Get(mimeType); + EUNIT_ASSERT(0 == mimeType.Compare(KImageMimeType)); + } + +void t_CGlxAiwServiceHandler::TwoItemsUniqueParamsL() + { + _LIT(KImageUri ,"c:\\Data\\Images\\Image01.jpg"); + _LIT(KImageMimeType, "image/jpeg"); + _LIT(KVideoUri ,"c:\\Data\\Videos\\Fireworks.mp4"); + _LIT(KVideoMimeType, "video/mp4v-es"); + + // First Create a Dummy Menu pane (for use later) + CEikMenuPane* dummyMenuPane = new (ELeave) CEikMenuPane(this); + CleanupStack::PushL(dummyMenuPane); + + // Create a Media Id + TGlxMedia Image(TGlxMediaId(1)); + TGlxMedia Video(TGlxMediaId(2)); + + // Add the Uri and MimeType parameters to internal array + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + + // Now transfer the parameters from our array to the InParams + iAiwServiceHandler->HandleSubmenuL(*dummyMenuPane); + + CleanupStack::PopAndDestroy(dummyMenuPane); + + // Now get the InParams to see if it contains what it should + CAiwGenericParamList& InParams = iAiwServiceHandler->GetInParams(); + + // Check the count is correct + TInt paramCount = InParams.Count(); + EUNIT_ASSERT( paramCount == 4); + + // Check the Uri is correct + TPtrC uri; + TPtrC mimeType; + + InParams[0].Value().Get(uri); + EUNIT_ASSERT(0 == uri.Compare(KVideoUri)); + + // Check the MimeType is correct + InParams[1].Value().Get(mimeType); + EUNIT_ASSERT(0 == mimeType.Compare(KVideoMimeType)); + + InParams[2].Value().Get(uri); + EUNIT_ASSERT(0 == uri.Compare(KImageUri)); + + // Check the MimeType is correct + InParams[3].Value().Get(mimeType); + EUNIT_ASSERT(0 == mimeType.Compare(KImageMimeType)); + } + +void t_CGlxAiwServiceHandler::TwoItemsDuplicateParamsL() + { + _LIT(KImageUri ,"c:\\Data\\Images\\Image01.jpg"); + _LIT(KImageMimeType, "image/jpeg"); + _LIT(KVideoUri ,"c:\\Data\\Videos\\Fireworks.mp4"); + _LIT(KVideoMimeType, "video/mp4v-es"); + + // First Create a Dummy Menu pane (for use later) + CEikMenuPane* dummyMenuPane = new (ELeave) CEikMenuPane(this); + CleanupStack::PushL(dummyMenuPane); + + // Create a Media Id + TGlxMedia Image(TGlxMediaId(1)); + TGlxMedia Video(TGlxMediaId(2)); + + // Add the Uri and MimeType parameters to internal array + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + + // Now add duplicate parameters (lots of them) + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KImageUri ) )); + iAiwServiceHandler->AddParamL(Image.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KImageMimeType ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamFile, TAiwVariant( KVideoUri ) )); + iAiwServiceHandler->AddParamL(Video.Id(), TAiwGenericParam( EGenericParamMIMEType, TAiwVariant( KVideoMimeType ) )); + + // Now transfer the parameters from our array to the InParams + iAiwServiceHandler->HandleSubmenuL(*dummyMenuPane); + + CleanupStack::PopAndDestroy(dummyMenuPane); + + // Now get the InParams to see if it contains what it should + CAiwGenericParamList& InParams = iAiwServiceHandler->GetInParams(); + + // Check the count is correct + TInt paramCount = InParams.Count(); + EUNIT_ASSERT( paramCount == 4); + + // Check the Uri is correct + TPtrC uri; + TPtrC mimeType; + + InParams[0].Value().Get(uri); + EUNIT_ASSERT(0 == uri.Compare(KVideoUri)); + + // Check the MimeType is correct + InParams[1].Value().Get(mimeType); + EUNIT_ASSERT(0 == mimeType.Compare(KVideoMimeType)); + + InParams[2].Value().Get(uri); + EUNIT_ASSERT(0 == uri.Compare(KImageUri)); + + // Check the MimeType is correct + InParams[3].Value().Get(mimeType); + EUNIT_ASSERT(0 == mimeType.Compare(KImageMimeType)); + } + + // From MEikMenuObserver +void t_CGlxAiwServiceHandler::SetEmphasis(CCoeControl* /* aMenuControl */,TBool /* aEmphasis */) + { + + } + // From MEikMenuObserver +void t_CGlxAiwServiceHandler::ProcessCommandL(TInt /* aCommandId */) + { + + } + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_CGlxAiwServiceHandler, + "Unit test suite for CGlxAiwServiceHandler", + "UNIT" ) + +EUNIT_TEST( + "Test Construction", + "CGlxAiwServiceHandler", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestConstructionL, Teardown) + +EUNIT_TEST( + "1 Item Unique Params", + "CGlxAiwServiceHandler", + "InstanceL", + "FUNCTIONALITY", + SetupL, OneImageUniqueParamsL, Teardown) + +EUNIT_TEST( + "1 Item Duplicate Params", + "CGlxAiwServiceHandler", + "InstanceL", + "FUNCTIONALITY", + SetupL, OneImageDuplicateParamsL, Teardown) + +EUNIT_TEST( + "2 Items Unique Ps", + "CGlxAiwServiceHandler", + "InstanceL", + "FUNCTIONALITY", + SetupL, TwoItemsUniqueParamsL, Teardown) + +EUNIT_TEST( + "2 Items Duplicate Ps", + "CGlxAiwServiceHandler", + "InstanceL", + "FUNCTIONALITY", + SetupL, TwoItemsDuplicateParamsL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AIW Service Handler stub implementation. +* +*/ + + + + +#ifndef __t_CGlxAiwServiceHandler_H__ +#define __t_CGlxAiwServiceHandler_H__ + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxAiwServiceHandler; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_CGlxAiwServiceHandler ) + : public CEUnitTestSuiteClass, public MEikMenuObserver + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_CGlxAiwServiceHandler* NewL(); + static t_CGlxAiwServiceHandler* NewLC(); + /** + * Destructor + */ + ~t_CGlxAiwServiceHandler(); + + private: // Constructors and destructors + + t_CGlxAiwServiceHandler(); + void ConstructL(); + + private: // From MEikMenuObserver + void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); + void ProcessCommandL(TInt aCommandId); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void TestConstructionL( ); + + void OneImageUniqueParamsL(); + + void OneImageDuplicateParamsL(); + + void TwoItemsUniqueParamsL(); + + void TwoItemsDuplicateParamsL(); + + private: // Data + + CGlxAiwServiceHandler* iAiwServiceHandler; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __t_CGlxAiwServiceHandler_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: AIW Service Handler stub application. +* +*/ + + + + +// CLASS HEADER +#include "t_CGlxAiwServiceHandler.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_CGlxAiwServiceHandler::NewL(); + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler_UID_.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_cglxaiwservicehandler/src/t_cglxaiwservicehandler_UID_.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,23 @@ +/* +* 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: AIW CommandHandlers UID information for unit testing +* +*/ + + +// Makmake-generated uid source file +#include +#pragma data_seg(".SYMBIAN") +__EMULATOR_IMAGE_HEADER2(0x10000079,0x1000af5a,0x01700000,EPriorityForeground,0x000ffffeu,0x00000000u,0x01700000,0x101fb657,0x00010000,0) +#pragma data_seg() diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/group/t_cglxcmdhandlerfilteritems.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/group/t_cglxcmdhandlerfilteritems.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-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: Show commmand handler unit test +* +*/ + + + + +#include "../../../../../group/glxbuildcommon.mmh" + +TARGET t_cglxcommandhandlerfilterimagesorvideos.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH src +SOURCE t_glxcmdhandlerfilteritems.cpp +SOURCE t_glxcmdhndlrfilter_dllmain.cpp +SOURCE t_huiutilitystub.cpp + +// Sources required by the test suite + +// Sources of the test code +SOURCEPATH ../../src +SOURCE glxcommandhandlerfilterimagesorvideos.cpp + +USERINCLUDE src +USERINCLUDE ../../inc + + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../../../common/inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../layouts/inc +SYSTEMINCLUDE ../../../../medialists/inc +SYSTEMINCLUDE ../../../../medialists/test/inc +SYSTEMINCLUDE ../../../../plugins/videoviewplugin/inc +SYSTEMINCLUDE ../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../views/viewbase/inc +SYSTEMINCLUDE ../../../../visuallistmanager/inc +SYSTEMINCLUDE ../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../inc + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib + +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +//LIBRARY charconv.lib // for CnvUtfConverter::ConvertFromUnicodeToUtf8L +LIBRARY commondialogs.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY estor.lib // for RBufWriteStream +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib +LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY hitchcock.lib // HUI framework +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib // for MPXViewUtility +LIBRARY servicehandler.lib +LIBRARY sendui.lib // for CSendUi +LIBRARY browserlauncher.lib +LIBRARY apparc.lib + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/inc/glxhuiutility_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/inc/glxhuiutility_stub.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Show commmand handler unit test +* +*/ + + + + +#include + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ +extern TGlxNavigationDirection g_NavigationDirection; \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/inc/t_glxcmdhandlerfilteritems.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/inc/t_glxcmdhandlerfilteritems.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Show commmand handler unit test +* +*/ + + + + +#ifndef __T_CGlxCommandHandlerFilterImagesOrVideos_H__ +#define __T_CGlxCommandHandlerFilterImagesOrVideos_H__ + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxCommandHandlerFilterImagesOrVideos; + +// CLASS DEFINITION +/** + * EUnit test suite for CGlxCommandHandlerFilterImagesOrVideos + * + */ +NONSHARABLE_CLASS( T_CGlxCommandHandlerFilterImagesOrVideos ) + : public CEUnitTestSuiteClass, + public MEikMenuObserver, + public MGlxMediaList_Stub_Observer, + public MGlxMediaListProvider + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CGlxCommandHandlerFilterImagesOrVideos* NewL(); + static T_CGlxCommandHandlerFilterImagesOrVideos* NewLC(); + /** + * Destructor + */ + ~T_CGlxCommandHandlerFilterImagesOrVideos(); + + private: // From MGlxMediaList_Stub_Observer + void MGlxMediaList_MethodCalled( TMGlxMediaListMethodId aMethodId ); + + private: // From MGlxMediaListProvider + + MGlxMediaList& MediaList(); + + private: // Constructors and destructors + + T_CGlxCommandHandlerFilterImagesOrVideos(); + void ConstructL(); + + private: // From MEikMenuObserver + void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); + void ProcessCommandL(TInt aCommandId); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void TestConstructionL( ); + + // helper methods to check the filter + void TestForImages(); + void TestForVideos(); + void TestForAll(); + + + private: // Test methods + + void TestSetAllFromNoneL(); + void TestSetImagesFromNoneL(); + void TestSetVideosFromNoneL(); + void TestSetAllFromImagesL(); + void TestSetVideosFromImagesL(); + void TestSetAllFromVideosL(); + void TestSetImagesFromVideosL(); + void TestSetVideosFromAllL(); + void TestSetImagesFromAllL(); + void TestNavigateForwards(); + void TestNavigateBackwards(); + + private: // Data + + CGlxCommandHandlerFilterImagesOrVideos* iCommandHandlerShowItems; + + TMGlxMediaList_Stub* iStubMediaList; + + TMGlxMediaListMethodId iMethodId; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CGlxCommandHandlerFilterImagesOrVideos_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/src/t_glxcmdhandlerfilteritems.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/src/t_glxcmdhandlerfilteritems.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,364 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Show commmand handler unit test +* +*/ + + + + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +// CLASS HEADER +#include "t_glxcmdhandlerfilteritems.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include // For Attribute constants +#include +#include +// INTERNAL INCLUDES +#include "glxcommandhandlerfilterimagesorvideos.h" +#include "glxhuiutility_stub.h" + +// CONSTRUCTION +T_CGlxCommandHandlerFilterImagesOrVideos* T_CGlxCommandHandlerFilterImagesOrVideos::NewL() + { + T_CGlxCommandHandlerFilterImagesOrVideos* self = T_CGlxCommandHandlerFilterImagesOrVideos::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CGlxCommandHandlerFilterImagesOrVideos* T_CGlxCommandHandlerFilterImagesOrVideos::NewLC() + { + T_CGlxCommandHandlerFilterImagesOrVideos* self = new( ELeave ) T_CGlxCommandHandlerFilterImagesOrVideos(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CGlxCommandHandlerFilterImagesOrVideos::~T_CGlxCommandHandlerFilterImagesOrVideos() + { + } + +// Default constructor +T_CGlxCommandHandlerFilterImagesOrVideos::T_CGlxCommandHandlerFilterImagesOrVideos() + { + } + +// Second phase construct +void T_CGlxCommandHandlerFilterImagesOrVideos::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::MGlxMediaList_MethodCalled(TMGlxMediaListMethodId aMethodId) + { + iMethodId = aMethodId; + } + +MGlxMediaList& T_CGlxCommandHandlerFilterImagesOrVideos::MediaList() + { + return *iStubMediaList; + } + + +// METHODS +void T_CGlxCommandHandlerFilterImagesOrVideos::SetupL( ) + { + iStubMediaList = new (ELeave)TMGlxMediaList_Stub(this); + iCommandHandlerShowItems = CGlxCommandHandlerFilterImagesOrVideos::NewL( this ); + } + + +void T_CGlxCommandHandlerFilterImagesOrVideos::Teardown( ) + { + delete iCommandHandlerShowItems; + iCommandHandlerShowItems = NULL: + delete iStubMediaList; + iStubMediaList = NULL; + } + + // From MEikMenuObserver +void T_CGlxCommandHandlerFilterImagesOrVideos::SetEmphasis( + CCoeControl* /* aMenuControl */,TBool /* aEmphasis */) + { + + } + // From MEikMenuObserver +void T_CGlxCommandHandlerFilterImagesOrVideos::ProcessCommandL( + TInt /* aCommandId */) + { + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestConstructionL( ) + { + // Only testing for leaks during setup/teardown here + EUNIT_ASSERT(ETrue); + } + +// +void T_CGlxCommandHandlerFilterImagesOrVideos::TestForImages() + { + // Test for images + CMPXFilter* filter = iStubMediaList->Filter(); + EUNIT_ASSERT_DESC( filter, "Filter is added to the medialist" ); + EUNIT_ASSERT_DESC( filter->IsSupported( KGlxFilterGeneralItemType ), "filter is KGlxFilterGeneralItemType" ); + TGlxFilterItemType itemType = *(filter->Value(KGlxFilterGeneralItemType)); + EUNIT_ASSERT_DESC( itemType == EGlxFilterImage, "Filter is EGlxFilterImage" ); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestForVideos() + { + // Test for videos + CMPXFilter* filter = iStubMediaList->Filter(); + EUNIT_ASSERT(filter); + EUNIT_ASSERT(filter->IsSupported(KGlxFilterGeneralItemType)); + TGlxFilterItemType itemType = *(filter->Value(KGlxFilterGeneralItemType)); + EUNIT_ASSERT(itemType == EGlxFilterVideo); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestForAll() + { + // Test for videos + CMPXFilter* filter = iStubMediaList->Filter(); + EUNIT_ASSERT(filter); + EUNIT_ASSERT(filter->IsSupported(KGlxFilterGeneralItemType)); + TGlxFilterItemType itemType = *(filter->Value(KGlxFilterGeneralItemType)); + EUNIT_ASSERT(itemType == EGlxFilterVideoAndImages); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetAllFromNoneL( ) + { + CMPXFilter* filter = NULL; + iStubMediaList->RemoveFilter(); + + // Test for All when no filter is currently set + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowAll); + filter = iStubMediaList->Filter(); + // As no filter was set previously and EGlxCmdShowAll was requested no filter should be set now. + EUNIT_ASSERT( !filter ); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetImagesFromNoneL( ) + { + iStubMediaList->RemoveFilter(); + + // Test for All when no filter is currently set + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + TestForImages(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetVideosFromNoneL( ) + { + iStubMediaList->RemoveFilter(); + + // Test for Videos when no filter is currently set + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowVideos); + TestForVideos(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetAllFromImagesL( ) + { + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowAll); + TestForAll(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetVideosFromImagesL( ) + { + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowVideos); + TestForVideos(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetAllFromVideosL( ) + { + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowVideos); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowAll); + TestForAll(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetImagesFromVideosL( ) + { + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowVideos); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + TestForImages(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetVideosFromAllL( ) + { + // The only way to have an All Filter set is to set ALL with + // either an Images or Videos filter set. + // Set one create an Image filter + // Then set the All Filter + // Then set the Videos filter + + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowAll); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowVideos); + TestForVideos(); + } + +void T_CGlxCommandHandlerFilterImagesOrVideos::TestSetImagesFromAllL( ) + { + // The only way to have an All Filter set is to set ALL with + // either an Images or Videos filter set. + // Set one create an Video filter + // Then set the All Filter + // Then set the images filter + + CMPXFilter* filter = NULL; + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowVideos); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowAll); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + TestForImages(); + } + + void T_CGlxCommandHandlerFilterImagesOrVideos::TestNavigateForwards( ) + { + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + TestForImages(); + // Navigating forwards should reset filter to All + g_NavigationDirection = EGlxNavigationForwards; + // upcast to get the public ActivateL + static_cast( + iCommandHandlerShowItems )->DoActivateL( 1 ); // Dummy view id + TestForAll(); + } + + void T_CGlxCommandHandlerFilterImagesOrVideos::TestNavigateBackwards() + { + iStubMediaList->RemoveFilter(); + iCommandHandlerShowItems->ExecuteL(EGlxCmdShowImages); + TestForImages(); + // Navigating backwards should not change the filter + g_NavigationDirection = EGlxNavigationBackwards; + // upcast to get the public ActivateL + static_cast( + iCommandHandlerShowItems )->DoActivateL( 1 ); // Dummy view id + TestForImages(); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CGlxCommandHandlerFilterImagesOrVideos, + "Unit test suite for CGlxCommandHandlerFilterImagesOrVideos", + "UNIT" ) + +EUNIT_TEST( + "Test Construction", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestConstructionL, Teardown) + +EUNIT_TEST( + "Set All from none", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetAllFromNoneL, Teardown) + +EUNIT_TEST( + "Set Images from none", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetImagesFromNoneL, Teardown) + +EUNIT_TEST( + "Set Videos from none", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetVideosFromNoneL, Teardown) + +EUNIT_TEST( + "Set All from Images", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetAllFromImagesL, Teardown) + +EUNIT_TEST( + "Set Video from Images", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetVideosFromImagesL, Teardown) + +EUNIT_TEST( + "Set All from Videos", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetAllFromVideosL, Teardown) + +EUNIT_TEST( + "Set Images from Videos", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetImagesFromVideosL, Teardown) + +EUNIT_TEST( + "Set Videos from All", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetVideosFromAllL, Teardown) + +EUNIT_TEST( + "Set Images from All", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestSetImagesFromAllL, Teardown) + +EUNIT_TEST( + "Navigate Forwards", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestNavigateForwards, Teardown) + +EUNIT_TEST( + "Navigate Backwards", + "CGlxCommandHandlerFilterImagesOrVideos", + "InstanceL", + "FUNCTIONALITY", + SetupL, TestNavigateBackwards, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/src/t_glxcmdhndlrfilter_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/src/t_glxcmdhndlrfilter_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Show commmand handler unit test +* +*/ + + + + +// CLASS HEADER +#include "t_glxcmdhandlerfilteritems.h" + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CGlxCommandHandlerFilterImagesOrVideos::NewL(); + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/src/t_huiutilitystub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcmdhndlrfilteritems/src/t_huiutilitystub.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Show commmand handler unit test +* +*/ + + + + +// Stub for the HuiUtility. This is necessary as the real HuiUtility +// causes resource leaks + +#include +#include "glxhuiutility_stub.h" + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +TGlxNavigationDirection g_NavigationDirection = EGlxNavigationForwards; + +CGlxHuiUtility* CGlxHuiUtility::UtilityL() + { + // In this test case and this case only, return NULL is safe + // because nothing dereferences the "this" pointer + return NULL; + } + +void CGlxHuiUtility::Close() + { + + } + +TGlxNavigationDirection CGlxHuiUtility::ViewNavigationDirection() + { + return g_NavigationDirection; + } \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/Src/t_cglxcommandhandlerback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/Src/t_cglxcommandhandlerback.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,305 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerBack Unit test cases. +* +*/ + + + + +// CLASS HEADER +#include "t_cglxcommandhandlerback.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include // For Attribute constants +#include +#include +// INTERNAL INCLUDES +#include "glxcommandhandlerback.h" // For CGlxCommandHandlerBack + +// CONSTRUCTION +t_cglxcommandhandlerback* t_cglxcommandhandlerback::NewL() + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::NewL()")); + t_cglxcommandhandlerback* self = t_cglxcommandhandlerback::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_cglxcommandhandlerback* t_cglxcommandhandlerback::NewLC() + { + EUNIT_PRINT(_L("ut_cglxcommandhandlerback::NewLC()")); + t_cglxcommandhandlerback* self = new( ELeave ) t_cglxcommandhandlerback(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +t_cglxcommandhandlerback::~t_cglxcommandhandlerback() + { + } + +// Default constructor +t_cglxcommandhandlerback::t_cglxcommandhandlerback() + { + } + +// Second phase construct +void t_cglxcommandhandlerback::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + EUNIT_PRINT(_L("ut_cglxcommandhandlerback::ConstructL()")); + CEUnitTestSuiteClass::ConstructL(); + } + +void t_cglxcommandhandlerback::CreateMediaListL() + { + // Create a path + EUNIT_PRINT(_L("ut_cglxcommandhandlerback::CreateMediaListL()")); + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL(0x200071AE); // Tag collection implementation Uid + + // Create static media list + iMediaList = MGlxMediaList::InstanceL(*path); + if(iMediaList) + { + + // Attribute to be used + TMPXAttribute attrTitle(KMPXMediaGeneralTitle); + //TMPXAttribute attrCount(KMPXMediaGeneralCount); + + // add a static items + TGlxMediaId testId(12345); + CGlxMedia* newMedia1 = new (ELeave) CGlxMedia(testId); + CleanupStack::PushL(newMedia1); + newMedia1->SetTextValueL(attrTitle, _L("Picasso")); + iMediaList->AddStaticItemL(newMedia1, NGlxListDefs::EInsertFirst); + CleanupStack::Pop(newMedia1); + + + TGlxMediaId testId2(12346); + CGlxMedia* newMedia2 = new (ELeave) CGlxMedia(testId2); + CleanupStack::PushL(newMedia2); + newMedia2->SetTextValueL(attrTitle, _L("Portugal")); + iMediaList->AddStaticItemL(newMedia2, NGlxListDefs::EInsertLast); + CleanupStack::Pop(newMedia2); + } + + CleanupStack::PopAndDestroy(); // path + } + +MGlxMediaList& t_cglxcommandhandlerback::MediaList() + { + EUNIT_PRINT(_L("ut_cglxcommandhandlerback::MediaList()")); + return *iMediaList; + } + +// METHODS +void t_cglxcommandhandlerback::SetupBackChL( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::SetupBackChL( )")); + iCommand = CGlxCommandHandlerBack::NewBackCommandHandlerL(); + } + +void t_cglxcommandhandlerback::SetupPreviousViewChWithoutMlL( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::SetupPreviousViewChWithoutMlL( )")); + iCommand = CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL(); + } + +void t_cglxcommandhandlerback::SetupPreviousViewChWithMlL( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::SetupPreviousViewChWithMlL( )")); + CreateMediaListL(); + + iCommand = CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL(this); + } + +void t_cglxcommandhandlerback::SetupPreviousNaviViewChWithoutMlL( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::SetupPreviousNaviViewChWithoutMlL( )")); + // iCommand = CGlxCommandHandlerBack::NewPreviousNaviViewCommandHandlerL(); + } + +void t_cglxcommandhandlerback::SetupPreviousNaviViewChWithMlL( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::SetupPreviousNaviViewChWithMlL( )")); + CreateMediaListL(); + + // iCommand = CGlxCommandHandlerBack::NewPreviousNaviViewCommandHandlerL(this); + } + +void t_cglxcommandhandlerback::SetupContainerPreviousViewChWithoutViewId( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::SetupContainerPreviousViewChWithoutViewId( )")); + CreateMediaListL(); + iCommand = CGlxCommandHandlerBack::NewContainerPreviousViewCommandHandlerL(this); + } + +void t_cglxcommandhandlerback::SetupContainerPreviousViewChWithViewId( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::SetupContainerPreviousViewChWithViewId( )")); + CreateMediaListL(); + + iCommand = CGlxCommandHandlerBack::NewContainerPreviousViewCommandHandlerL(this,12345); + } + +void t_cglxcommandhandlerback::Teardown( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::Teardown( )")); + if( iCommand ) + { + delete iCommand; + iCommand = NULL; + } + + if( iMediaList ) + { + iMediaList->Close(); + iMediaList = NULL; + } + } + + +void t_cglxcommandhandlerback::T_TestConstructionL( ) + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::T_TestConstructionL( )")); + EUNIT_ASSERT_DESC( iCommand, "Command handler not created properly"); + } + +void t_cglxcommandhandlerback::T_TestExecutionL() + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::T_TestExecutionL()")); + EUNIT_ASSERT_DESC( ETrue == iCommand->ExecuteL(EAknSoftkeyBack), + "Unable to handle the command"); + } + +void t_cglxcommandhandlerback::T_TestInvalidExecutionL() + { + EUNIT_PRINT(_L("t_cglxcommandhandlerback::T_TestInvalidExecutionL()")); + EUNIT_ASSERT_DESC( EFalse == iCommand->ExecuteL(EGlxCmdRename), + "Wrong command being handled"); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_cglxcommandhandlerback, + "Unit test suite for CGlxCommandHandlerBack", + "UNIT" ) + +EUNIT_TEST( + "Create Back CH", + "CGlxCommandHandlerBack", + "NewBackCommandHandlerL", + "FUNCTIONALITY", + SetupBackChL, T_TestConstructionL, Teardown) + +EUNIT_TEST( + "Create PreviousView CH without Medialist Owner", + "CGlxCommandHandlerBack", + "NewPreviousViewCommandHandlerL", + "FUNCTIONALITY", + SetupPreviousViewChWithoutMlL, T_TestConstructionL, Teardown) + +EUNIT_TEST( + "Create PreviousView CH with Medialist Owner", + "CGlxCommandHandlerBack", + "NewPreviousViewCommandHandlerL", + "FUNCTIONALITY", + SetupPreviousViewChWithMlL, T_TestConstructionL, Teardown) + + +/*EUNIT_TEST( + "Create PreviousView CH without Medialist Owner", + "CGlxCommandHandlerBack", + "NewPreviousNaviViewCommandHandlerL", + "FUNCTIONALITY", + SetupPreviousNaviViewChWithoutMlL, T_TestConstructionL, Teardown) + + +EUNIT_TEST( + "Create PreviousView CH with Medialist Owner", + "CGlxCommandHandlerBack", + "NewPreviousNaviViewCommandHandlerL", + "FUNCTIONALITY", + SetupPreviousNaviViewChWithMlL, T_TestConstructionL, Teardown)*/ + +EUNIT_TEST( + "Create Container PreviousView CH without Previous viewId", + "CGlxCommandHandlerBack", + "NewContainerPreviousViewCommandHandlerL", + "FUNCTIONALITY", + SetupContainerPreviousViewChWithoutViewId, T_TestConstructionL, Teardown) + +EUNIT_TEST( + "Create Container PreviousView CH with Previous viewId", + "CGlxCommandHandlerBack", + "NewContainerPreviousViewCommandHandlerL", + "FUNCTIONALITY", + SetupContainerPreviousViewChWithViewId, T_TestConstructionL, Teardown) + +EUNIT_TEST( + "Execute Back command", + "CGlxCommandHandlerBack", + "ExecuteL", + "FUNCTIONALITY", + SetupBackChL, T_TestExecutionL, Teardown) + +EUNIT_TEST( + "Execute Previous command", + "CGlxCommandHandlerBack", + "ExecuteL", + "FUNCTIONALITY", + SetupPreviousViewChWithoutMlL, T_TestExecutionL, Teardown) + +EUNIT_TEST( + "Execute Previous command with ML", + "CGlxCommandHandlerBack", + "ExecuteL", + "FUNCTIONALITY", + SetupPreviousViewChWithMlL, T_TestExecutionL, Teardown) + +EUNIT_TEST( + "Execute Container PreviousView CH without Previous viewId", + "CGlxCommandHandlerBack", + "ExecuteL", + "FUNCTIONALITY", + SetupContainerPreviousViewChWithoutViewId, T_TestExecutionL, Teardown) + +EUNIT_TEST( + "Execute Container PreviousView CH with Previous viewId", + "CGlxCommandHandlerBack", + "ExecuteL", + "FUNCTIONALITY", + SetupContainerPreviousViewChWithViewId, T_TestExecutionL, Teardown) + +EUNIT_TEST( + "Execute Rename command", + "CGlxCommandHandlerBack", + "ExecuteL", + "FUNCTIONALITY", + SetupPreviousViewChWithoutMlL, T_TestInvalidExecutionL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/Src/t_cglxcommandhandlerback_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/Src/t_cglxcommandhandlerback_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerBack Unit test application +* +*/ + + + + +// CLASS HEADER +#include "t_cglxcommandhandlerback.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_cglxcommandhandlerback::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: CommandHandlerBack unit test application build information +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_cglxcommandhandlerback.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/group/t_cglxcommandhandlerback.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/group/t_cglxcommandhandlerback.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: CommandHandlerBack unit test build information +* +*/ + + +#include +#include "../../../../../group/glxbuildcommon.mmh" + +TARGET t_cglxcommandhandlerback.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH Src +SOURCE t_cglxcommandhandlerback.cpp + +// Sources required by the test suite +SOURCEPATH Src +SOURCE t_cglxcommandhandlerback_DllMain.cpp + +// Sources of the test code +SOURCEPATH ../../src +SOURCE glxcommandhandlerback.cpp + +USERINCLUDE Src +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../../common/inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../layouts/inc +SYSTEMINCLUDE ../../../../medialists/inc +SYSTEMINCLUDE ../../../../plugins/videoviewplugin/inc +SYSTEMINCLUDE ../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../views/viewbase/inc +SYSTEMINCLUDE ../../../../visuallistmanager/inc +SYSTEMINCLUDE ../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../../commonui/inc + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib + +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY charconv.lib // for CnvUtfConverter::ConvertFromUnicodeToUtf8L +LIBRARY commondialogs.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY estor.lib // for RBufWriteStream +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib +LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY hitchcock.lib // HUI framework +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib // for MPXViewUtility +LIBRARY servicehandler.lib +LIBRARY sendui.lib // for CSendUi +LIBRARY browserlauncher.lib +LIBRARY apparc.lib +LIBRARY glxcommonui.lib //for CommonUI-CGlxNavigationalState + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/inc/t_cglxcommandhandlerback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/t_glxcommandhandlerback/inc/t_cglxcommandhandlerback.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerBack Unit test cases +* +*/ + + + + +#ifndef __T_CGLXCOMMANDHANDLERBACK_H__ +#define __T_CGLXCOMMANDHANDLERBACK_H__ + +// EXTERNAL INCLUDES +#include +#include +#include + + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CGlxCommandHandlerBack; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_cglxcommandhandlerback ) + : public CEUnitTestSuiteClass, public MGlxMediaListProvider + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_cglxcommandhandlerback* NewL(); + static t_cglxcommandhandlerback* NewLC(); + /** + * Destructor + */ + ~t_cglxcommandhandlerback(); + + private: // Constructors and destructors + + t_cglxcommandhandlerback(); + void ConstructL(); + + public: // From MGlxMediaListOwner + + MGlxMediaList& MediaList(); + + private: // New methods + + void CreateMediaListL(); + + void SetupBackChL(); + + void SetupPreviousViewChWithoutMlL( ); + + void SetupPreviousViewChWithMlL( ); + + void SetupPreviousNaviViewChWithoutMlL( ); + + void SetupPreviousNaviViewChWithMlL( ); + + void SetupContainerPreviousViewChWithoutViewId( ); + + void SetupContainerPreviousViewChWithViewId( ); + + void Teardown(); + + void T_TestConstructionL(); + + void T_TestExecutionL(); + + void T_TestInvalidExecutionL(); + + private: // Data + + CGlxCommandHandlerBack* iCommand; + MGlxMediaList* iMediaList; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CGLXCOMMANDHANDLERBACK_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/bwins/ut_cglxcommandhandlersortorderu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/bwins/ut_cglxcommandhandlersortorderu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?NewL@CGlxCommandHandlerSortOrder@@SAPAV1@PAVMGlxMediaListProvider@@K@Z @ 2 NONAME ; class CGlxCommandHandlerSortOrder * CGlxCommandHandlerSortOrder::NewL(class MGlxMediaListProvider *, unsigned long) + ??1CGlxCommandHandlerSortOrder@@UAE@XZ @ 3 NONAME ; CGlxCommandHandlerSortOrder::~CGlxCommandHandlerSortOrder(void) + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/eabi/ut_cglxcommandhandlersortorderu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/eabi/ut_cglxcommandhandlersortorderu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN27CGlxCommandHandlerSortOrder4NewLEP21MGlxMediaListProviderm @ 2 NONAME + _ZN27CGlxCommandHandlerSortOrderD0Ev @ 3 NONAME + _ZN27CGlxCommandHandlerSortOrderD1Ev @ 4 NONAME + _ZN27CGlxCommandHandlerSortOrderD2Ev @ 5 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Build information file for unit test commandhandler sort order. +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +ut_cglxcommandhandlersortorder.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/group/ut_cglxcommandhandlersortorder.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/group/ut_cglxcommandhandlersortorder.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008-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: Build information file for command handler sort order unit test cases. +* +*/ + + + +#include +#include "../../../../../../group/glxbuildcommon.mmh" + +TARGET ut_cglxcommandhandlersortorder.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../Src +SOURCE ut_cglxcommandhandlersortorder.cpp + +// Sources required by the test suite +SOURCEPATH ../Src +SOURCE ut_cglxcmdhandlersortorder_DllMain.cpp + +// Sources of the test code +SOURCEPATH ../../../src +SOURCE glxcommandhandlersortorder.cpp + +USERINCLUDE ../Src +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../../../common/inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../../../inc +//SYSTEMINCLUDE ../../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../inc +//SYSTEMINCLUDE ../../../../layouts/inc +SYSTEMINCLUDE ../../../../../medialists/inc +SYSTEMINCLUDE ../../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../../views/viewbase/inc +SYSTEMINCLUDE ../../../../../visuallistmanager/inc +SYSTEMINCLUDE ../../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../inc + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib + +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY charconv.lib // for CnvUtfConverter::ConvertFromUnicodeToUtf8L +LIBRARY commondialogs.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY estor.lib // for RBufWriteStream +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommon.lib +LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY hitchcock.lib // HUI framework +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib // for MPXViewUtility +LIBRARY servicehandler.lib +LIBRARY sendui.lib // for CSendUi +LIBRARY browserlauncher.lib +LIBRARY apparc.lib +LIBRARY centralrepository.lib //for CRepository + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/inc/ut_cglxcommandhandlersortorder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/inc/ut_cglxcommandhandlersortorder.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerSortOrder unit test cases +* +*/ + + + + +#ifndef __UT_CGLXCOMMANDHANDLERSORTORDER_H__ +#define __UT_CGLXCOMMANDHANDLERSORTORDER_H__ +#include + +// EXTERNAL INCLUDES +#include +#include + +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CGlxCommandHandlerSortOrder; + + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( ut_cglxcommandhandlersortorder ) + : public CEUnitTestSuiteClass, public MGlxMediaListProvider + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static ut_cglxcommandhandlersortorder* NewL(); + static ut_cglxcommandhandlersortorder* NewLC(); + /** + * Destructor + */ + ~ut_cglxcommandhandlersortorder(); + + private: // Constructors and destructors + + ut_cglxcommandhandlersortorder(); + void ConstructL(); + + public: // From MGlxMediaListProvider + + MGlxMediaList& MediaList(); + + private: // New methods + + // With medialist owner (filters applied) & valid setting key + void SetupMethod1L(); + + // With medialist owner (without filters) & valid setting key + void SetupMethod2L(); + + // With medialist owner as NULL & valid setting key + void SetupMethod3L(); + + // With medialist owner (filters applied) & invalid setting key + void SetupMethod4L(); + + // Clean up code + void Teardown(); + + // Test command handler creation + void T_TestCreationL(); + + // Test alphabetical sort + void T_TestAlphaSortL(); + + // Test alphabetical sort where the Medialist is NULL + void T_TestAlphaSortWithNullListL(); + + // Test Frequency sort + void T_TestFrequencySortL(); + + // Test Frequency sort where the Medialist is NULL + void T_TestFrequencySortWithNullListL(); + + // Test an invalid command with the command handler + void T_TestInvalidSortL(); + + // Test disable of alphabetical sort menu option + void T_TestDisableAlphaL(); + + // Test disable of alphabetical sort menu option where the Medialist is NULL + void T_TestDisableAlphaWithNullListL(); + + // Test disable of frequency sort menu option + void T_TestDisableFrequencyL(); + + // Test disable of frequency sort menu option where the Medialist is NULL + void T_TestDisableFrequencyWithNullListL(); + + // Test menu disable with invalid command id + void T_TestDisableInvalidCommandL(); + + private: // Data + + CGlxCommandHandlerSortOrder* iCommand; + MGlxMediaList* iMediaList; + TBool iFilterFlag; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __UT_CGLXCOMMANDHANDLERSORTORDER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/src/ut_cglxcmdhandlersortorder_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/src/ut_cglxcmdhandlersortorder_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerSortOrder unit test cases. +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxcommandhandlersortorder.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return ut_cglxcommandhandlersortorder::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/src/ut_cglxcommandhandlersortorder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_cglxcommandhandlersortorder/src/ut_cglxcommandhandlersortorder.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,395 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerSortOrder unit test cases +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxcommandhandlersortorder.h" + +// EXTERNAL INCLUDES +#include +#include +#include // For Attribute constants +#include +#include +#include +#include // For cenrep setting + +// INTERNAL INCLUDES +#include "glxcommandhandlersortorder.h" // For CGlxCommandHandlerSortOrder + +// CONSTRUCTION +ut_cglxcommandhandlersortorder* ut_cglxcommandhandlersortorder::NewL() + { + ut_cglxcommandhandlersortorder* self = ut_cglxcommandhandlersortorder::NewLC(); + CleanupStack::Pop(self); + + return self; + } + +ut_cglxcommandhandlersortorder* ut_cglxcommandhandlersortorder::NewLC() + { + ut_cglxcommandhandlersortorder* self = new( ELeave ) ut_cglxcommandhandlersortorder(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +ut_cglxcommandhandlersortorder::~ut_cglxcommandhandlersortorder() + { + } + +// Default constructor +ut_cglxcommandhandlersortorder::ut_cglxcommandhandlersortorder() + { + iFilterFlag = ETrue; + } + +// Second phase construct +void ut_cglxcommandhandlersortorder::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +MGlxMediaList& ut_cglxcommandhandlersortorder::MediaList() + { + return *iMediaList; + } + + +// METHODS +// With medialist owner (filters applied) & valid setting key +void ut_cglxcommandhandlersortorder::SetupMethod1L() + { + // Create a path + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL(0x200071AE); // Tag collection implementation Uid + + // Create a filter + CMPXFilter* filter = TGlxFilterFactory::CreateAlphabeticSortFilterL(); + CleanupStack::PushL(filter); + + iMediaList = MGlxMediaList::InstanceL(*path, + TGlxHierarchyId(0x200071AE), + filter); + + CleanupStack::PopAndDestroy(filter); // filter + CleanupStack::PopAndDestroy(path); // path + + iCommand = CGlxCommandHandlerSortOrder::NewL(this, KGlxSortOrderTagManager); + } + +// With medialist owner (without filters) & valid setting key +void ut_cglxcommandhandlersortorder::SetupMethod2L() + { + // Create a path + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL(0x200071AE); // Tag collection implementation Uid + + iMediaList = MGlxMediaList::InstanceL(*path, + TGlxHierarchyId(0x200071AE)); + + CleanupStack::PopAndDestroy(path); // path + + iCommand = CGlxCommandHandlerSortOrder::NewL(this, KGlxSortOrderTagManager); + } + +// With medialist owner as NULL & valid setting key +void ut_cglxcommandhandlersortorder::SetupMethod3L() + { + iCommand = CGlxCommandHandlerSortOrder::NewL(NULL, KGlxSortOrderTagBrowser); + } + +// With medialist owner (filters applied) & invalid setting key +void ut_cglxcommandhandlersortorder::SetupMethod4L() + { + // Create a path + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL(0x200071AE); // Tag collection implementation Uid + + // Create a filter + CMPXFilter* filter = TGlxFilterFactory::CreateAlphabeticSortFilterL(); + CleanupStack::PushL(filter); + + iMediaList = MGlxMediaList::InstanceL(*path, + TGlxHierarchyId(0x200071AE), + filter); + + CleanupStack::PopAndDestroy(filter); // filter + CleanupStack::PopAndDestroy(path); // path + + iCommand = CGlxCommandHandlerSortOrder::NewL(this, 0x00000000); + } + +// Clean up code +void ut_cglxcommandhandlersortorder::Teardown() + { + iFilterFlag = EFalse; + if( iCommand ) + { + delete iCommand; + } + if( iMediaList ) + { + iMediaList->Close(); + iMediaList = NULL; + } + } + +// Test command handler creation +void ut_cglxcommandhandlersortorder::T_TestCreationL() + { + EUNIT_ASSERT_DESC( iCommand, "Command creation failed"); + } + +// Test alphabetical sort +void ut_cglxcommandhandlersortorder::T_TestAlphaSortL() + { + EUNIT_ASSERT_DESC( iCommand->DoExecuteL(EGlxCmdSortByAlphabetical, MediaList()), + "Alphabetical sorting failed"); + } + +// Test alphabetical sort where the Medialist is NULL +void ut_cglxcommandhandlersortorder::T_TestAlphaSortWithNullListL() + { + EUNIT_ASSERT_PANIC_DESC( iCommand->DoExecuteL(EGlxCmdSortByAlphabetical, MediaList()), + "Images & videos", + EGlxPanicIllegalArgument, + "Alphabetical sorting failed"); + } + +// Test Frequency sort +void ut_cglxcommandhandlersortorder::T_TestFrequencySortL() + { + EUNIT_ASSERT_DESC( !iCommand->DoExecuteL(EGlxFilterSortOrderItemCount, MediaList()), + "Frequency sorting failed"); + } + +// Test Frequency sort where the Medialist is NULL +void ut_cglxcommandhandlersortorder::T_TestFrequencySortWithNullListL() + { + EUNIT_ASSERT_PANIC_DESC( !iCommand->DoExecuteL(EGlxFilterSortOrderItemCount, MediaList()), + "Images & videos", + EGlxPanicIllegalArgument, + "Frequency sorting failed"); + } + +// Test an invalid command with the command handler +void ut_cglxcommandhandlersortorder::T_TestInvalidSortL() + { + EUNIT_ASSERT_DESC( !iCommand->DoExecuteL(1000, MediaList()), + "Invalid command is also working"); + } + +// Test disable of alphabetical sort menu option +void ut_cglxcommandhandlersortorder::T_TestDisableAlphaL() + { + EUNIT_ASSERT_DESC( iCommand->DoIsDisabled(EGlxCmdSortByAlphabetical, MediaList()), + "Menu disable failed"); + } + +// Test disable of alphabetical sort menu option where the Medialist is NULL +void ut_cglxcommandhandlersortorder::T_TestDisableAlphaWithNullListL() + { + EUNIT_ASSERT_PANIC_DESC( iCommand->DoIsDisabled(EGlxCmdSortByAlphabetical, MediaList()), + "Images & videos", + EGlxPanicIllegalArgument, + "Menu disable failed"); + } + +// Test disable of frequency sort menu option +void ut_cglxcommandhandlersortorder::T_TestDisableFrequencyL() + { + EUNIT_ASSERT_DESC( !iCommand->DoIsDisabled(EGlxFilterSortOrderItemCount, MediaList()), + "Menu disable failed"); + } + +// Test disable of frequency sort menu option where the Medialist is NULL +void ut_cglxcommandhandlersortorder::T_TestDisableFrequencyWithNullListL() + { + EUNIT_ASSERT_PANIC_DESC( !iCommand->DoIsDisabled(EGlxFilterSortOrderItemCount, MediaList()), + "Images & videos", + EGlxPanicIllegalArgument, + "Menu disable failed"); + } + +// Test menu disable with invalid command id +void ut_cglxcommandhandlersortorder::T_TestDisableInvalidCommandL() + { + EUNIT_ASSERT_DESC( !iCommand->DoIsDisabled(1000, MediaList()), + "Unrelated Menu disabled - Test case failed"); + } + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + ut_cglxcommandhandlersortorder, + "Unit test suite for CGlxCommandHandlerSortOrder", + "UNIT" ) + +EUNIT_TEST( + "Create with filters", + "CGlxCommandHandlerSortOrder", + "NewL", + "FUNCTIONALITY", + SetupMethod1L, T_TestCreationL, Teardown) + +EUNIT_TEST( + "Create without filters", + "CGlxCommandHandlerSortOrder", + "NewL", + "FUNCTIONALITY", + SetupMethod2L, T_TestCreationL, Teardown) + +EUNIT_TEST( + "Create with NULL", + "CGlxCommandHandlerSortOrder", + "NewL", + "FUNCTIONALITY", + SetupMethod3L, T_TestCreationL, Teardown) + +EUNIT_TEST( + "Create with Invalid Key", + "CGlxCommandHandlerSortOrder", + "NewL", + "FUNCTIONALITY", + SetupMethod4L, T_TestCreationL, Teardown) + +EUNIT_TEST( + "Alpha sort with filters", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod1L, T_TestAlphaSortL, Teardown) + +EUNIT_TEST( + "Aplpha sort without filters", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod2L, T_TestAlphaSortL, Teardown) + +EUNIT_TEST( + "Aplpha sort with NULL", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod3L, T_TestAlphaSortWithNullListL, Teardown) + +EUNIT_TEST( + "Aplpha sort with Invalid Key", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod4L, T_TestAlphaSortL, Teardown) + +EUNIT_TEST( + "Freq sort with filters", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod1L, T_TestFrequencySortL, Teardown) + +EUNIT_TEST( + "Freq sort without filters", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod2L, T_TestFrequencySortL, Teardown) + +EUNIT_TEST( + "Freq sort with NULL", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod3L, T_TestFrequencySortWithNullListL, Teardown) + +EUNIT_TEST( + "Freq sort with Invalid Key", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod4L, T_TestFrequencySortL, Teardown) + +EUNIT_TEST( + "Sort with invalid command id", + "CGlxCommandHandlerSortOrder", + "DoExecuteL", + "FUNCTIONALITY", + SetupMethod1L, T_TestInvalidSortL, Teardown) + +EUNIT_TEST( + "Disable Alpha sort with filters", + "CGlxCommandHandlerSortOrder", + "DoIsDisabled", + "FUNCTIONALITY", + SetupMethod1L, T_TestDisableAlphaL, Teardown) + +EUNIT_TEST( + "Disable Aplpha sort without filters", + "CGlxCommandHandlerSortOrder", + "DoIsDisabled", + "FUNCTIONALITY", + SetupMethod2L, T_TestDisableAlphaL, Teardown) + +EUNIT_TEST( + "Disable Aplpha sort with NULL", + "CGlxCommandHandlerSortOrder", + "DoIsDisabled", + "FUNCTIONALITY", + SetupMethod3L, T_TestDisableAlphaWithNullListL, Teardown) + +EUNIT_TEST( + "Disable Freq sort with filters", + "CGlxCommandHandlerSortOrder", + "DoIsDisabled", + "FUNCTIONALITY", + SetupMethod1L, T_TestDisableFrequencyL, Teardown) + +EUNIT_TEST( + "Disable Freq sort without filters", + "CGlxCommandHandlerSortOrder", + "DoIsDisabled", + "FUNCTIONALITY", + SetupMethod2L, T_TestDisableFrequencyL, Teardown) + +EUNIT_TEST( + "Disable Freq sort with NULL", + "CGlxCommandHandlerSortOrder", + "DoIsDisabled", + "FUNCTIONALITY", + SetupMethod3L, T_TestDisableFrequencyWithNullListL, Teardown) + +EUNIT_TEST( + "Disable menu with invalid command id", + "CGlxCommandHandlerSortOrder", + "DoIsDisabled", + "FUNCTIONALITY", + SetupMethod1L, T_TestDisableInvalidCommandL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/group/ut_propertycommandhandlers.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/group/ut_propertycommandhandlers.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-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: CommandHandlerDetails +* +*/ + + + + +#include "../../../../../../group/glxbuildcommon.mmh" + +TARGET ut_propertycommandhandlers.dll +TARGETTYPE dll +TARGETPATH /DigiaEUnit/Tests +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../ut_propertycommandhandlers +SOURCE ut_propertycommandhandlersDllMain.cpp +SOURCE ut_propertycommandhandlers.cpp + +USERINCLUDE ../ut_propertycommandhandlers + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../views/viewbase/inc +SYSTEMINCLUDE ../../../../medialists/inc +SYSTEMINCLUDE ../../../../../inc + + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY glxcommoncommandhandlers.lib +LIBRARY glxmedialists.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/inc/ut_propertycommandhandlers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/inc/ut_propertycommandhandlers.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2004 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: CommandHandlerDetails unit test cases +* +*/ + + + + +#ifndef __UT_PROPERTYCOMMANDHANDLERS_H__ +#define __UT_PROPERTYCOMMANDHANDLERS_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class _CGlxTestMediaList; + +#include +#ifndef NONSHARABLE_CLASS + #define NONSHARABLE_CLASS(x) class x +#endif + + +class CGlxCommandHandlerProperties; +// CLASS DEFINITION +/** + * + * EUnitWizard generated test class. + * + */ +NONSHARABLE_CLASS( UT_propertycommandhandlers ) + : public CEUnitTestSuiteClass , public MGlxMediaListProvider + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static UT_propertycommandhandlers* NewL(); + static UT_propertycommandhandlers* NewLC(); + /** + * Destructor + */ + ~UT_propertycommandhandlers(); + + private: // Constructors and destructors + + UT_propertycommandhandlers(); + void ConstructL(); + + public: // From observer interface + + virtual MGlxMediaList& MediaList() ; + + private: // New methods + + void SetupL(); + + void Teardown(); + + void PropertyCommandHandlerNewL(); + + void PropertyCommandHandlerExecuteL(); + + private: // Data + + EUNIT_DECLARE_TEST_TABLE; + _CGlxTestMediaList* iMediaList; + CGlxCommandHandlerProperties* iMetadataCommand; + CGlxCommandHandlerProperties* iTagManagerCommand; + + }; + +#endif // __T_PROPERTYCOMMANDHANDLERS_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/src/ut_propertycommandhandlers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/src/ut_propertycommandhandlers.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2004 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: CommandHandlerDetails unit test cases +* +*/ + + + + +// CLASS HEADER +#include "UT_propertycommandhandlers.h" + +//#include +#include +#include +#include + +#include +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES + +template +inline void CGlxMedia::SetTObjectValueL(const TMPXAttribute& aAttribute, T aValue) + { + TAny* ptr = User::AllocL(sizeof(T)); + memcpy(ptr, &aValue, sizeof(T)); + + TInt i = Index(aAttribute); + if (KErrNotFound != i) + { + // Replace the existing value + TValue& value = iValues[i]; + // COMMENTED OUT SINCE NOT EXPORTED + //Delete(value); + + value.iValue = ptr; // Takes ownership + value.iType = EMPXTypeTObject; + } + else + { + TInt err = iValues.Append(TValue(ptr, EMPXTypeTObject)); + + // If appended value ok, try to append the attribute. + if (KErrNone == err) + { + err = iAttributes.Append(aAttribute); + if (err != KErrNone) + { + // Failed, undo the append + iValues.Remove(iValues.Count() - 1); + } + } + + if (KErrNone != err) + { + User::Free(ptr); + User::Leave(err); + } + } + } + +// +CGlxMedia::CGlxMedia(const TGlxMediaId& aId) + : iId(aId), iUsedByLists(2) // On average, two list as users assumed + { + } + +CGlxMedia::~CGlxMedia() + { + iUsedByLists.Close(); + + Reset(); + iValues.Close(); + iAttributes.Close(); + } + + + +struct _CGlxTestMediaList: public CBase, public MGlxMediaList + { + ~_CGlxTestMediaList() + { + iItems.Close(); + iMedia.ResetAndDestroy(); + iSelectedItems.Close(); + } + + virtual void Close() + { + }; + virtual TGlxMediaListId Id() const + { + return KGlxIdNone; + } + + virtual TInt Count(TCountType aType = ECountAll) const + //virtual TInt Count() const + { + return iItems.Count(); + } + + virtual TInt FocusIndex() const + { + return iFocusIndex; + } + + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) + { + iFocusIndex = aValue; + } + + virtual const TGlxMedia& Item(TInt aIndex) const + { + return iItems[aIndex]; + } + + virtual TInt Index(const TGlxMediaId& aId) const + { + TInt count = iItems.Count(); + for (TInt i = 0; i < count; i++) + { + if (iItems[i].Id() == aId) + { + return i; + } + } + return KErrNotFound; + } + + virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) + { + } + + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) + { + } + + virtual MMPXCollection& Collection() const + { + return *(MMPXCollection*)NULL; + } + + virtual const TBool IsSelected(TInt aIndex) const + { + TInt idx = iSelectedItems.Find(aIndex); + return (idx != KErrNotFound); + } + + virtual void SetSelectedL(TInt aIndex, TBool aSelected) + { + if (aSelected) + { + iSelectedItems.InsertInOrder(aIndex); + } + else + { + iSelectedItems.Remove(iSelectedItems.Find(aIndex)); + } + } + + virtual const TArray Selection() const + { + return iSelectedItems.Array(); + } + + virtual void CommandL(CMPXCommand& /*aCommand*/) + { + } + + virtual void CancelCommand() + { + } + + virtual void SetFilterL(CMPXFilter* /*aFilter*/) + { + } + + virtual CMPXFilter* Filter() const + { + return NULL; + } + + virtual TGlxIdSpaceId IdSpaceId() const + { + return KGlxIdNone; + } + + void AppendL(TInt aId, TBool aCreateMedia) + { + if (aCreateMedia) + { + CGlxMedia* media = new (ELeave) CGlxMedia(TGlxMediaId(aId)); + CleanupStack::PushL(media); + iMedia.AppendL(media); + TMPXAttribute uriAttr(KMPXMediaGeneralUri); + media->SetTextValueL (uriAttr,_L("testing")); + CleanupStack::Pop(media); + iItems.AppendL(TGlxMedia(TGlxMediaId(aId), media)); + } + else + { + iItems.AppendL(TGlxMedia(TGlxMediaId(aId))); + } + } + + CGlxMedia* MediaObj(TInt aIndex) const + { + return const_cast(static_cast(iItems[aIndex].Properties())); + } + + CMPXCollectionPath* PathLC() const + { + return NULL; + } + + TInt SelectionCount() const + { + return iSelectedItems.Count(); + } + + TInt SelectedItemIndex(TInt aSelectionIndex) const + { + return 0; + } + + virtual TBool IsPopulated() const + { + return ETrue; + } + + RArray iItems; + RPointerArray iMedia; + RArray iSelectedItems; + TInt iFocusIndex; + }; + +// CONSTRUCTION + +MGlxMediaList& UT_propertycommandhandlers::MediaList() + { + return *iMediaList; + } + +UT_propertycommandhandlers* UT_propertycommandhandlers::NewL() + { + UT_propertycommandhandlers* self = UT_propertycommandhandlers::NewLC(); + CleanupStack::Pop(); + + return self; + } + +UT_propertycommandhandlers* UT_propertycommandhandlers::NewLC() + { + UT_propertycommandhandlers* self = new( ELeave ) UT_propertycommandhandlers(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + + +// Destructor (virtual by CBase) +UT_propertycommandhandlers::~UT_propertycommandhandlers() + { + } + +// Default constructor +UT_propertycommandhandlers::UT_propertycommandhandlers() + { + } + +// Second phase construct +void UT_propertycommandhandlers::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + + +void UT_propertycommandhandlers::SetupL( ) + { + //MMPXCollectionUtility* collectionUtility = MMPXCollectionUtility::NewL(NULL, KMcModeDefault); + //CMPXCollectionPath* path ;//= collectionUtility->Collection().PathL(); + //iML = MGlxMediaList::InstanceL(*path,NULL); + iMediaList = new (ELeave) _CGlxTestMediaList; + iMediaList->AppendL(0, ETrue); + iMediaList->AppendL(1, ETrue); + iMediaList->AppendL(2, ETrue); + iMediaList->AppendL(3, ETrue); + iMediaList->AppendL(4, ETrue); + iMediaList->iFocusIndex = 0; + + iTagManagerCommand = CGlxCommandHandlerProperties::NewTagManagerCommandHandlerL(this); + iMetadataCommand = CGlxCommandHandlerProperties::NewMetadataViewCommandHandlerL(this); + } + +void UT_propertycommandhandlers::Teardown( ) + { + + delete iTagManagerCommand; + delete iMetadataCommand; + + delete iMediaList; + } + +void UT_propertycommandhandlers::PropertyCommandHandlerNewL( ) + { + EUNIT_ASSERT( NULL != iTagManagerCommand ); + EUNIT_ASSERT( NULL != iMetadataCommand ); + } + +void UT_propertycommandhandlers::PropertyCommandHandlerExecuteL( ) + { + //check that metadata command is consumend + EUNIT_ASSERT( iMetadataCommand->ExecuteL(EGlxCmdProperties) ); + //check that tag manager command is not consumend + EUNIT_ASSERT( !iMetadataCommand->ExecuteL(EGlxCmdTagManager) ); + + //check that tag manager command is consumend + EUNIT_ASSERT( iTagManagerCommand->ExecuteL(EGlxCmdTagManager) ); + //check that metadata command is not consumend + EUNIT_ASSERT( !iTagManagerCommand->ExecuteL(EGlxCmdProperties) ); + } + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + UT_propertycommandhandlers, + "Property command handler unit testing.", + "Property Command handler" ) + +EUNIT_TEST( + "NewL ", + "CGlxCommandHandlerProperties", + "NewL", + "FUNCTIONALITY", + SetupL, PropertyCommandHandlerNewL, Teardown) + +EUNIT_TEST( + "ExecuteL ", + "CGlxCommandHandlerProperties", + "ExecuteL", + "FUNCTIONALITY", + SetupL, PropertyCommandHandlerExecuteL, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/src/ut_propertycommandhandlersdllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/tsrc/ut_propertycommandhandlers/src/ut_propertycommandhandlersdllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2004 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: CommandHandlerDetails unit test application +* +*/ + + + + +// CLASS HEADER +#include "ut_propertycommandhandlers.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return UT_propertycommandhandlers::NewL(); + } + +#ifndef __SECURE_API__ +/** + * Standard Symbian DLL entry point function. + */ +GLDEF_C TInt E32Dll(TDllReason) + { + return KErrNone; + } +#endif + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Build information file for command handlers unit test applications. +* +*/ + + + + +// Command Handlers +#include "../commandhandlerbase/group/bld.inf" +#include "../commandhandlermarking/group/bld.inf" +#include "../commandhandlerupnp/group/bld.inf" // NEED to be becore common as common depends on upnp +#include "../commoncommandhandlers/group/bld.inf" +#include "../commandhandlerdrm/group/bld.inf" +#include "../commandhandlermoreinfo/group/bld.inf" + +PRJ_TESTMMPFILES +//../tsrc/ut__commandhandlermarking/t_glxcommandhandlermarking.mmp +//../tsrc/group/t_glxcommandhandlerdrm.mmp +//../tsrc/group/t_glxcommandhandlermoreinfo.mmp + +PRJ_MMPFILES +//../commoncommandhandlers/tsrc/t_cglxaiwservicehandler/group/t_cglxaiwservicehandler.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/inc/glxcommandhandlers.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/inc/glxcommandhandlers.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008-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: Command ids +* +*/ + + + + +#ifndef __GLXCOMMANDHANDLERS_HRH__ +#define __GLXCOMMANDHANDLERS_HRH__ + + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +// CONSTANTS + +enum TGlxCommandId + { + EGlxCmdAddToAlbum = 0x5500, + EGlxCmdOptions, + EGlxCmdDelete, + EGlxCmdAddTag, + EGlxCmdStateView, + EGlxCmdStateBrowse, + EGlxCmdDetails, + EGlxCmdUpload, + EGlxCmdRotate, + EGlxCmdRotateLeft, + EGlxCmdRotateRight, + EGlxCmdSlideshowPlay, + EGlxCmdSlideshowSettings, + EGlxCmdDrmMoreInfoOnline, + EGlxCmdDrmGetPreview, + EGlxCmdDrmPlayPreview, + EGlxCmdStartMultipleMarking, + EGlxCmdEndMultipleMarking, + EGlxCmdMarkingSubmenu, + EGlxCmdAddMedia, + EGlxCmdRemoveFrom, + EGlxCmdSlideshow, + EGlxCmdRename, + EGlxCmdPlay, + EGlxCmdDRMOpen, + EGlxCmdShowOnlineInfo, + EGlxCmdDownloadImages, + EGlxCmdDownloadVideos, + EGlxCmdCopy, + EGlxCmdMove, + EGlxCmdCopyMoveSubmenu, + EGlxCmdSend, + EGlxShowViaUpnp, + EGlxStopShowing, + EGlxShowViaUpnpSubmenuVersion, + EGlxStopShowingSubmenuVersion, + EGlxHomeNetworkSubmenu, + EGlxCopyToHomeNetwork, + EGlxCmdHideUI, + EGlxCmdSortByAlphabetical, + EGlxCmdSortByCount, + EGlxCmdDisableAnimations, + EGlxCmdEnableAnimations, + EGlxCmdDetailsOption, + EGlxCmdAiwPrint, + EGlxCmdAiwAssign, + EGlxCmdAiwEdit, + EGlxCmdAiwShowMap, + EGlxCmdAiwShareOnOvi, + EGlxCmdSelectMarked, + EGlxCmdFullScreenBack, + EGlxCmdShowViaUpnpStateChanged, + EGlxCmdResetView, + EGlxCmdActivateStateView, + EGlxCmdShow, + EGlxCmdShowAll, + EGlxCmdShowImages, + EGlxCmdShowVideos, + EGlxCmdAddToFavourites, + EGlxCmdRemoveFromFavourites, + KGlxCmdMnShowMap, + EGlxCmdSave, + EGlxCmdAiwBase = 0x6000 + }; + + +#endif // __GLXCOMMANDHANDLERS_HRH__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/bwins/T_GlxCommandHandlerDRMu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/bwins/T_GlxCommandHandlerDRMu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,86 @@ +EXPORTS + ??0CGlxIconManager@@IAE@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 1 NONAME ; CGlxIconManager::CGlxIconManager(class MGlxMediaList &, class MGlxVisualList &) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 2 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??0CGlxMediaListCommandHandler@@QAE@PAVMGlxMediaListProvider@@@Z @ 3 NONAME ; CGlxMediaListCommandHandler::CGlxMediaListCommandHandler(class MGlxMediaListProvider *) + ??0TCommandInfo@CGlxMediaListCommandHandler@@QAE@H@Z @ 4 NONAME ; CGlxMediaListCommandHandler::TCommandInfo::TCommandInfo(int) + ??0TGlxIconManagerParams@@QAE@MMMMM@Z @ 5 NONAME ; TGlxIconManagerParams::TGlxIconManagerParams(float, float, float, float, float) + ??1CGlxCommandHandlerDrm@@UAE@XZ @ 6 NONAME ; CGlxCommandHandlerDrm::~CGlxCommandHandlerDrm(void) + ??1CGlxIconManager@@UAE@XZ @ 7 NONAME ; CGlxIconManager::~CGlxIconManager(void) + ??1CGlxMedia@@UAE@XZ @ 8 NONAME ; CGlxMedia::~CGlxMedia(void) + ??1CGlxMediaListCommandHandler@@UAE@XZ @ 9 NONAME ; CGlxMediaListCommandHandler::~CGlxMediaListCommandHandler(void) + ?ActivateL@CGlxMediaListCommandHandler@@UAEXH@Z @ 10 NONAME ; void CGlxMediaListCommandHandler::ActivateL(int) + ?AddCommandL@CGlxMediaListCommandHandler@@IAEXABUTCommandInfo@1@@Z @ 11 NONAME ; void CGlxMediaListCommandHandler::AddCommandL(struct CGlxMediaListCommandHandler::TCommandInfo const &) + ?AddIconToItemL@CGlxIconManager@@UAEXHH@Z @ 12 NONAME ; void CGlxIconManager::AddIconToItemL(int, int) + ?AddIconToItemL@CGlxIconManager@@UAEXPAVCHuiVisual@@H@Z @ 13 NONAME ; void CGlxIconManager::AddIconToItemL(class CHuiVisual *, int) + ?AllocListL@CGlxVisualListManager@@QAEPAVMGlxVisualList@@PAVMGlxMediaList@@AAVCHuiEnv@@AAVCHuiDisplay@@W4TScaleMode@CHuiImageVisual@@@Z @ 14 NONAME ; class MGlxVisualList * CGlxVisualListManager::AllocListL(class MGlxMediaList *, class CHuiEnv &, class CHuiDisplay &, enum CHuiImageVisual::TScaleMode) + ?BaseConstructL@CGlxIconManager@@QAEXXZ @ 15 NONAME ; void CGlxIconManager::BaseConstructL(void) + ?BrushPositionInVisual@CGlxIconManager@@UAEHHH@Z @ 16 NONAME ; int CGlxIconManager::BrushPositionInVisual(int, int) + ?BrushPositionInVisual@CGlxIconManager@@UAEHPAVCHuiVisual@@H@Z @ 17 NONAME ; int CGlxIconManager::BrushPositionInVisual(class CHuiVisual *, int) + ?BypassFiltersForExecute@CGlxMediaListCommandHandler@@MBEHXZ @ 18 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForExecute(void) const + ?BypassFiltersForMenu@CGlxMediaListCommandHandler@@MBEHXZ @ 19 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForMenu(void) const + ?CanShowInfoOnlineL@CGlxDRMUtility@@QAEHAAVTDesC16@@@Z @ 20 NONAME ; int CGlxDRMUtility::CanShowInfoOnlineL(class TDesC16 &) + ?CheckOpenRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 21 NONAME ; int CGlxDRMUtility::CheckOpenRightsL(class TDesC16 const &, int) + ?Close@CGlxDRMUtility@@QAEXXZ @ 22 NONAME ; void CGlxDRMUtility::Close(void) + ?Close@CGlxHuiUtility@@QAEXXZ @ 23 NONAME ; void CGlxHuiUtility::Close(void) + ?Close@CGlxVisualListManager@@QAEXXZ @ 24 NONAME ; void CGlxVisualListManager::Close(void) + ?CommandInfo@CGlxMediaListCommandHandler@@IAEAAUTCommandInfo@1@H@Z @ 25 NONAME ; struct CGlxMediaListCommandHandler::TCommandInfo & CGlxMediaListCommandHandler::CommandInfo(int) + ?CommandInfoIndex@CGlxMediaListCommandHandler@@ABEHH@Z @ 26 NONAME ; int CGlxMediaListCommandHandler::CommandInfoIndex(int) const + ?ConsumeRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 27 NONAME ; int CGlxDRMUtility::ConsumeRightsL(class TDesC16 const &) + ?CreateAnimatedGifTextureL@CGlxTextureManager@@QAEPAVCHuiGifAnimationTexture@@ABVTDesC16@@@Z @ 28 NONAME ; class CHuiGifAnimationTexture * CGlxTextureManager::CreateAnimatedGifTextureL(class TDesC16 const &) + ?CreateAvkonIconTextureL@CGlxTextureManager@@QAEAAVCHuiTexture@@ABVTAknsItemID@@HVTSize@@@Z @ 29 NONAME ; class CHuiTexture & CGlxTextureManager::CreateAvkonIconTextureL(class TAknsItemID const &, int, class TSize) + ?CreateIconTextureL@CGlxTextureManager@@QAEAAVCHuiTexture@@HAAVTDesC16@@VTSize@@@Z @ 30 NONAME ; class CHuiTexture & CGlxTextureManager::CreateIconTextureL(int, class TDesC16 &, class TSize) + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 31 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?CreateThumbnailTextureL@@YAAAVCHuiTexture@@VTGlxMediaId@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTSize@@PAVMGlxTextureObserver@@AAH@Z @ 32 NONAME ; class CHuiTexture & CreateThumbnailTextureL(class TGlxMediaId, class TGlxId, class TSize const &, class MGlxTextureObserver *, int &) + ?CreateVisualFromIconL@CGlxIconManager@@UAEXHAAVTDesC16@@@Z @ 33 NONAME ; void CGlxIconManager::CreateVisualFromIconL(int, class TDesC16 &) + ?CreateVisualFromIconL@CGlxIconManager@@UAEXHAAVTDesC16@@AAVTGlxIconManagerParams@@@Z @ 34 NONAME ; void CGlxIconManager::CreateVisualFromIconL(int, class TDesC16 &, class TGlxIconManagerParams &) + ?CreateVisualFromTextureL@CGlxIconManager@@UAEXPAVCHuiTexture@@@Z @ 35 NONAME ; void CGlxIconManager::CreateVisualFromTextureL(class CHuiTexture *) + ?CreateVisualFromTextureL@CGlxIconManager@@UAEXPAVCHuiTexture@@AAVTGlxIconManagerParams@@@Z @ 36 NONAME ; void CGlxIconManager::CreateVisualFromTextureL(class CHuiTexture *, class TGlxIconManagerParams &) + ?CreateZoomedTextureL@@YAAAVCHuiTexture@@ABVTGlxMedia@@ABVTMPXAttribute@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@AAH@Z @ 37 NONAME ; class CHuiTexture & CreateZoomedTextureL(class TGlxMedia const &, class TMPXAttribute const &, class TGlxId, int &) + ?DRMThumbnailSize@CGlxDRMUtility@@QAE?AVTSize@@AAV2@@Z @ 38 NONAME ; class TSize CGlxDRMUtility::DRMThumbnailSize(class TSize &) + ?Deactivate@CGlxMediaListCommandHandler@@UAEXXZ @ 39 NONAME ; void CGlxMediaListCommandHandler::Deactivate(void) + ?Display@CGlxHuiUtility@@QBEPAVCHuiDisplay@@XZ @ 40 NONAME ; class CHuiDisplay * CGlxHuiUtility::Display(void) const + ?DisplaySize@CGlxHuiUtility@@QBE?AVTSize@@XZ @ 41 NONAME ; class TSize CGlxHuiUtility::DisplaySize(void) const + ?DoDynInitMenuPaneL@CGlxMediaListCommandHandler@@MAEXHPAVCEikMenuPane@@@Z @ 42 NONAME ; void CGlxMediaListCommandHandler::DoDynInitMenuPaneL(int, class CEikMenuPane *) + ?DoGetRequiredAttributesL@CGlxMediaListCommandHandler@@MBEXAAV?$RArray@VTMPXAttribute@@@@H@Z @ 43 NONAME ; void CGlxMediaListCommandHandler::DoGetRequiredAttributesL(class RArray &, int) const + ?DoIsDisabled@CGlxMediaListCommandHandler@@MBEHHAAVMGlxMediaList@@@Z @ 44 NONAME ; int CGlxMediaListCommandHandler::DoIsDisabled(int, class MGlxMediaList &) const + ?DynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXHPAVCEikMenuPane@@@Z @ 45 NONAME ; void CGlxMediaListCommandHandler::DynInitMenuPaneL(int, class CEikMenuPane *) + ?Env@CGlxHuiUtility@@QBEPAVCHuiEnv@@XZ @ 46 NONAME ; class CHuiEnv * CGlxHuiUtility::Env(void) const + ?ExecuteL@CGlxMediaListCommandHandler@@UAEHH@Z @ 47 NONAME ; int CGlxMediaListCommandHandler::ExecuteL(int) + ?GetRequiredAttributesL@CGlxMediaListCommandHandler@@UBEXAAV?$RArray@VTMPXAttribute@@@@HHH@Z @ 48 NONAME ; void CGlxMediaListCommandHandler::GetRequiredAttributesL(class RArray &, int, int, int) const + ?GlxTextureManager@CGlxHuiUtility@@QAEAAVCGlxTextureManager@@XZ @ 49 NONAME ; class CGlxTextureManager & CGlxHuiUtility::GlxTextureManager(void) + ?HandleAttributesAvailableL@CGlxTextureManager@@QAEHABV?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTGlxMediaId@@ABV?$RArray@VTMPXAttribute@@@@PBVCGlxMedia@@@Z @ 50 NONAME ; int CGlxTextureManager::HandleAttributesAvailableL(class TGlxId const &, class TGlxMediaId const &, class RArray const &, class CGlxMedia const *) + ?HandleTvStatusChangedL@CGlxHuiUtility@@UAEXW4TTvChangeType@@@Z @ 51 NONAME ; void CGlxHuiUtility::HandleTvStatusChangedL(enum TTvChangeType) + ?HideHuiDisplayL@CGlxHuiUtility@@SAXXZ @ 52 NONAME ; void CGlxHuiUtility::HideHuiDisplayL(void) + ?InstanceL@CGlxDRMUtility@@SAPAV1@XZ @ 53 NONAME ; class CGlxDRMUtility * CGlxDRMUtility::InstanceL(void) + ?IsActivePaletteItemVisible@CGlxScreenFurniture@@QAEHH@Z @ 54 NONAME ; int CGlxScreenFurniture::IsActivePaletteItemVisible(int) + ?IsDisabledL@CGlxMediaListCommandHandler@@IBEHHAAVMGlxMediaList@@@Z @ 55 NONAME ; int CGlxMediaListCommandHandler::IsDisabledL(int, class MGlxMediaList &) const + ?IsForwardLockedL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 56 NONAME ; int CGlxDRMUtility::IsForwardLockedL(class TDesC16 const &) + ?IsSupported@CGlxMediaListCommandHandler@@IBEHH@Z @ 57 NONAME ; int CGlxMediaListCommandHandler::IsSupported(int) const + ?ListL@CGlxVisualListManager@@QAEPAVMGlxVisualList@@PAVMGlxMediaList@@AAVCHuiEnv@@AAVCHuiDisplay@@W4TScaleMode@CHuiImageVisual@@@Z @ 58 NONAME ; class MGlxVisualList * CGlxVisualListManager::ListL(class MGlxMediaList *, class CHuiEnv &, class CHuiDisplay &, enum CHuiImageVisual::TScaleMode) + ?ManagerL@CGlxVisualListManager@@SAPAV1@XZ @ 59 NONAME ; class CGlxVisualListManager * CGlxVisualListManager::ManagerL(void) + ?MediaList@CGlxMediaListCommandHandler@@IAEAAVMGlxMediaList@@XZ @ 60 NONAME ; class MGlxMediaList & CGlxMediaListCommandHandler::MediaList(void) + ?MediaList@CGlxMediaListCommandHandler@@IBEABVMGlxMediaList@@XZ @ 61 NONAME ; class MGlxMediaList const & CGlxMediaListCommandHandler::MediaList(void) const + ?NewL@CGlxCommandHandlerDrm@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 62 NONAME ; class CGlxCommandHandlerDrm * CGlxCommandHandlerDrm::NewL(class MGlxMediaListProvider *, int) + ?NewL@CGlxTextureManager@@SAPAV1@AAVCHuiTextureManager@@@Z @ 63 NONAME ; class CGlxTextureManager * CGlxTextureManager::NewL(class CHuiTextureManager &) + ?NewLC@CGlxTextureManager@@SAPAV1@AAVCHuiTextureManager@@@Z @ 64 NONAME ; class CGlxTextureManager * CGlxTextureManager::NewLC(class CHuiTextureManager &) + ?NotifyDisplayRefreshStarted@CGlxHuiUtility@@UAEXAAVCHuiDisplay@@@Z @ 65 NONAME ; void CGlxHuiUtility::NotifyDisplayRefreshStarted(class CHuiDisplay &) + ?OfferKeyEventL@CGlxMediaListCommandHandler@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 66 NONAME ; enum TKeyResponse CGlxMediaListCommandHandler::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?PreDynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXH@Z @ 67 NONAME ; void CGlxMediaListCommandHandler::PreDynInitMenuPaneL(int) + ?ReleaseList@CGlxVisualListManager@@QAEXPAVMGlxVisualList@@@Z @ 68 NONAME ; void CGlxVisualListManager::ReleaseList(class MGlxVisualList *) + ?RemoveFromItem@CGlxIconManager@@UAEXHH@Z @ 69 NONAME ; void CGlxIconManager::RemoveFromItem(int, int) + ?RemoveFromItem@CGlxIconManager@@UAEXPAVCHuiVisual@@H@Z @ 70 NONAME ; void CGlxIconManager::RemoveFromItem(class CHuiVisual *, int) + ?RemoveTexture@CGlxTextureManager@@QAEXH@Z @ 71 NONAME ; void CGlxTextureManager::RemoveTexture(int) + ?RetrieveL@GlxAttributeRetriever@@SAHABVMGlxFetchContext@@AAVMGlxMediaList@@H@Z @ 72 NONAME ; int GlxAttributeRetriever::RetrieveL(class MGlxFetchContext const &, class MGlxMediaList &, int) + ?ScreenFurniture@CGlxHuiUtility@@QAEPAVCGlxScreenFurniture@@XZ @ 73 NONAME ; class CGlxScreenFurniture * CGlxHuiUtility::ScreenFurniture(void) + ?SelectionLength@CGlxMediaListCommandHandler@@IBEHXZ @ 74 NONAME ; int CGlxMediaListCommandHandler::SelectionLength(void) const + ?SetPreferredTextureSizeL@CGlxTextureManager@@QAEHABVMHuiSegmentedTexture@@AAVTSize@@@Z @ 75 NONAME ; int CGlxTextureManager::SetPreferredTextureSizeL(class MHuiSegmentedTexture const &, class TSize &) + ?SetViewNavigationDirection@CGlxHuiUtility@@QAEXW4TGlxNavigationDirection@@@Z @ 76 NONAME ; void CGlxHuiUtility::SetViewNavigationDirection(enum TGlxNavigationDirection) + ?ShowHuiDisplayL@CGlxHuiUtility@@SAXXZ @ 77 NONAME ; void CGlxHuiUtility::ShowHuiDisplayL(void) + ?ShowInfoOnlineL@CGlxDRMUtility@@QAEXAAVTDesC16@@@Z @ 78 NONAME ; void CGlxDRMUtility::ShowInfoOnlineL(class TDesC16 &) + ?ShowRightsInfoL@CGlxDRMUtility@@QAEXABVTDesC16@@@Z @ 79 NONAME ; void CGlxDRMUtility::ShowRightsInfoL(class TDesC16 const &) + ?TextStyleIdL@CGlxHuiUtility@@QAEHHH@Z @ 80 NONAME ; int CGlxHuiUtility::TextStyleIdL(int, int) + ?UploadFlatColourToTextureL@CGlxHuiUtility@@SAXVTRgb@@PAVCHuiTexture@@@Z @ 81 NONAME ; void CGlxHuiUtility::UploadFlatColourToTextureL(class TRgb, class CHuiTexture *) + ?UtilityL@CGlxHuiUtility@@SAPAV1@XZ @ 82 NONAME ; class CGlxHuiUtility * CGlxHuiUtility::UtilityL(void) + ?ViewNavigationDirection@CGlxHuiUtility@@QAE?AW4TGlxNavigationDirection@@XZ @ 83 NONAME ; enum TGlxNavigationDirection CGlxHuiUtility::ViewNavigationDirection(void) + ?ViewingState@CGlxMediaListCommandHandler@@IBE?AW4TViewingState@TCommandInfo@1@XZ @ 84 NONAME ; enum CGlxMediaListCommandHandler::TCommandInfo::TViewingState CGlxMediaListCommandHandler::ViewingState(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/bwins/t_glxcommandhandlermarkingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/bwins/t_glxcommandhandlermarkingu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/bwins/t_glxcommandhandlermoreinfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/bwins/t_glxcommandhandlermoreinfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/eabi/T_GlxCommandHandlerDRMu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/eabi/T_GlxCommandHandlerDRMu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _Z20CreateZoomedTextureLRK9TGlxMediaRK13TMPXAttribute6TGlxIdI17TGlxIdSpaceIdBaseERi @ 2 NONAME + _Z23CreateThumbnailTextureL11TGlxMediaId6TGlxIdI17TGlxIdSpaceIdBaseERK5TSizeP19MGlxTextureObserverRi @ 3 NONAME + _ZN14CGlxHuiUtility12TextStyleIdLEii @ 4 NONAME + _ZN14CGlxHuiUtility15HideHuiDisplayLEv @ 5 NONAME + _ZN14CGlxHuiUtility15ScreenFurnitureEv @ 6 NONAME + _ZN14CGlxHuiUtility15ShowHuiDisplayLEv @ 7 NONAME + _ZN14CGlxHuiUtility17GlxTextureManagerEv @ 8 NONAME + _ZN14CGlxHuiUtility22HandleTvStatusChangedLE13TTvChangeType @ 9 NONAME + _ZN14CGlxHuiUtility23ViewNavigationDirectionEv @ 10 NONAME + _ZN14CGlxHuiUtility26SetViewNavigationDirectionE23TGlxNavigationDirection @ 11 NONAME + _ZN14CGlxHuiUtility26UploadFlatColourToTextureLE4TRgbP11CHuiTexture @ 12 NONAME + _ZN14CGlxHuiUtility27NotifyDisplayRefreshStartedER11CHuiDisplay @ 13 NONAME + _ZN14CGlxHuiUtility5CloseEv @ 14 NONAME + _ZN14CGlxHuiUtility8UtilityLEv @ 15 NONAME + _ZN15CGlxIconManager14AddIconToItemLEP10CHuiVisuali @ 16 NONAME + _ZN15CGlxIconManager14AddIconToItemLEii @ 17 NONAME + _ZN15CGlxIconManager14BaseConstructLEv @ 18 NONAME + _ZN15CGlxIconManager14RemoveFromItemEP10CHuiVisuali @ 19 NONAME + _ZN15CGlxIconManager14RemoveFromItemEii @ 20 NONAME + _ZN15CGlxIconManager21BrushPositionInVisualEP10CHuiVisuali @ 21 NONAME + _ZN15CGlxIconManager21BrushPositionInVisualEii @ 22 NONAME + _ZN15CGlxIconManager21CreateVisualFromIconLEiR7TDesC16 @ 23 NONAME + _ZN15CGlxIconManager21CreateVisualFromIconLEiR7TDesC16R21TGlxIconManagerParams @ 24 NONAME + _ZN15CGlxIconManager24CreateVisualFromTextureLEP11CHuiTexture @ 25 NONAME + _ZN15CGlxIconManager24CreateVisualFromTextureLEP11CHuiTextureR21TGlxIconManagerParams @ 26 NONAME + _ZN15CGlxIconManagerC1ER13MGlxMediaListR14MGlxVisualList @ 27 NONAME + _ZN15CGlxIconManagerC2ER13MGlxMediaListR14MGlxVisualList @ 28 NONAME + _ZN15CGlxIconManagerD0Ev @ 29 NONAME + _ZN15CGlxIconManagerD1Ev @ 30 NONAME + _ZN15CGlxIconManagerD2Ev @ 31 NONAME + _ZN18CGlxTextureManager13RemoveTextureEi @ 32 NONAME + _ZN18CGlxTextureManager18CreateIconTextureLEiR7TDesC165TSize @ 33 NONAME + _ZN18CGlxTextureManager23CreateAvkonIconTextureLERK11TAknsItemIDi5TSize @ 34 NONAME + _ZN18CGlxTextureManager24SetPreferredTextureSizeLERK20MHuiSegmentedTextureR5TSize @ 35 NONAME + _ZN18CGlxTextureManager25CreateAnimatedGifTextureLERK7TDesC16 @ 36 NONAME + _ZN18CGlxTextureManager26HandleAttributesAvailableLERK6TGlxIdI17TGlxIdSpaceIdBaseERK11TGlxMediaIdRK6RArrayI13TMPXAttributeEPK9CGlxMedia @ 37 NONAME + _ZN18CGlxTextureManager4NewLER18CHuiTextureManager @ 38 NONAME + _ZN18CGlxTextureManager5NewLCER18CHuiTextureManager @ 39 NONAME + _ZN19CGlxScreenFurniture26IsActivePaletteItemVisibleEi @ 40 NONAME + _ZN21CGlxCommandHandlerDrm4NewLEP21MGlxMediaListProvideri @ 41 NONAME + _ZN21CGlxCommandHandlerDrmD0Ev @ 42 NONAME + _ZN21CGlxCommandHandlerDrmD1Ev @ 43 NONAME + _ZN21CGlxCommandHandlerDrmD2Ev @ 44 NONAME + _ZN21CGlxVisualListManager10AllocListLEP13MGlxMediaListR7CHuiEnvR11CHuiDisplayN15CHuiImageVisual10TScaleModeE @ 45 NONAME + _ZN21CGlxVisualListManager11ReleaseListEP14MGlxVisualList @ 46 NONAME + _ZN21CGlxVisualListManager5CloseEv @ 47 NONAME + _ZN21CGlxVisualListManager5ListLEP13MGlxMediaListR7CHuiEnvR11CHuiDisplayN15CHuiImageVisual10TScaleModeE @ 48 NONAME + _ZN21CGlxVisualListManager8ManagerLEv @ 49 NONAME + _ZN21TGlxIconManagerParamsC1Efffff @ 50 NONAME + _ZN21TGlxIconManagerParamsC2Efffff @ 51 NONAME + _ZN27CGlxMediaListCommandHandler10DeactivateEv @ 52 NONAME + _ZN27CGlxMediaListCommandHandler11AddCommandLERKNS_12TCommandInfoE @ 53 NONAME + _ZN27CGlxMediaListCommandHandler11CommandInfoEi @ 54 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC1Ei @ 55 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC2Ei @ 56 NONAME + _ZN27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 57 NONAME + _ZN27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 58 NONAME + _ZN27CGlxMediaListCommandHandler18DoDynInitMenuPaneLEiP12CEikMenuPane @ 59 NONAME + _ZN27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 60 NONAME + _ZN27CGlxMediaListCommandHandler8ExecuteLEi @ 61 NONAME + _ZN27CGlxMediaListCommandHandler9ActivateLEi @ 62 NONAME + _ZN27CGlxMediaListCommandHandler9MediaListEv @ 63 NONAME + _ZN27CGlxMediaListCommandHandlerC2EP21MGlxMediaListProvider @ 64 NONAME + _ZN27CGlxMediaListCommandHandlerD0Ev @ 65 NONAME + _ZN27CGlxMediaListCommandHandlerD1Ev @ 66 NONAME + _ZN27CGlxMediaListCommandHandlerD2Ev @ 67 NONAME + _ZNK14CGlxHuiUtility11DisplaySizeEv @ 68 NONAME + _ZNK14CGlxHuiUtility3EnvEv @ 69 NONAME + _ZNK14CGlxHuiUtility7DisplayEv @ 70 NONAME + _ZNK27CGlxMediaListCommandHandler11IsDisabledLEiR13MGlxMediaList @ 71 NONAME + _ZNK27CGlxMediaListCommandHandler11IsSupportedEi @ 72 NONAME + _ZNK27CGlxMediaListCommandHandler12DoIsDisabledEiR13MGlxMediaList @ 73 NONAME + _ZNK27CGlxMediaListCommandHandler12ViewingStateEv @ 74 NONAME + _ZNK27CGlxMediaListCommandHandler15SelectionLengthEv @ 75 NONAME + _ZNK27CGlxMediaListCommandHandler16CommandInfoIndexEi @ 76 NONAME + _ZNK27CGlxMediaListCommandHandler20BypassFiltersForMenuEv @ 77 NONAME + _ZNK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 78 NONAME + _ZNK27CGlxMediaListCommandHandler23BypassFiltersForExecuteEv @ 79 NONAME + _ZNK27CGlxMediaListCommandHandler24DoGetRequiredAttributesLER6RArrayI13TMPXAttributeEi @ 80 NONAME + _ZNK27CGlxMediaListCommandHandler9MediaListEv @ 81 NONAME + _ZTI14CGlxHuiUtility @ 82 NONAME ; ## + _ZTI15CGlxIconManager @ 83 NONAME ; ## + _ZTI27CGlxMediaListCommandHandler @ 84 NONAME ; ## + _ZTV14CGlxHuiUtility @ 85 NONAME ; ## + _ZTV15CGlxIconManager @ 86 NONAME ; ## + _ZTV27CGlxMediaListCommandHandler @ 87 NONAME ; ## + _ZThn4_N14CGlxHuiUtility22HandleTvStatusChangedLE13TTvChangeType @ 88 NONAME ; ## + _ZThn4_N21CGlxCommandHandlerDrmD0Ev @ 89 NONAME ; ## + _ZThn4_N21CGlxCommandHandlerDrmD1Ev @ 90 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler10DeactivateEv @ 91 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 92 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 93 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 94 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler8ExecuteLEi @ 95 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler9ActivateLEi @ 96 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandlerD0Ev @ 97 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandlerD1Ev @ 98 NONAME ; ## + _ZThn4_NK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 99 NONAME ; ## + _ZThn8_N14CGlxHuiUtility27NotifyDisplayRefreshStartedER11CHuiDisplay @ 100 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/eabi/t_glxcommandhandlermarkingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/eabi/t_glxcommandhandlermarkingu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _Z20CreateZoomedTextureLRK9TGlxMediaRK13TMPXAttribute6TGlxIdI17TGlxIdSpaceIdBaseERi @ 2 NONAME + _Z23CreateThumbnailTextureL11TGlxMediaId6TGlxIdI17TGlxIdSpaceIdBaseERK5TSizeP19MGlxTextureObserverRi @ 3 NONAME + _ZN14CGlxHuiUtility12TextStyleIdLEii @ 4 NONAME + _ZN14CGlxHuiUtility15HideHuiDisplayLEv @ 5 NONAME + _ZN14CGlxHuiUtility15ScreenFurnitureEv @ 6 NONAME + _ZN14CGlxHuiUtility15ShowHuiDisplayLEv @ 7 NONAME + _ZN14CGlxHuiUtility17GlxTextureManagerEv @ 8 NONAME + _ZN14CGlxHuiUtility22HandleTvStatusChangedLE13TTvChangeType @ 9 NONAME + _ZN14CGlxHuiUtility23ViewNavigationDirectionEv @ 10 NONAME + _ZN14CGlxHuiUtility26SetViewNavigationDirectionE23TGlxNavigationDirection @ 11 NONAME + _ZN14CGlxHuiUtility26UploadFlatColourToTextureLE4TRgbP11CHuiTexture @ 12 NONAME + _ZN14CGlxHuiUtility27NotifyDisplayRefreshStartedER11CHuiDisplay @ 13 NONAME + _ZN14CGlxHuiUtility5CloseEv @ 14 NONAME + _ZN14CGlxHuiUtility8UtilityLEv @ 15 NONAME + _ZN18CGlxTextureManager13RemoveTextureEi @ 16 NONAME + _ZN18CGlxTextureManager18CreateIconTextureLEiR7TDesC165TSize @ 17 NONAME + _ZN18CGlxTextureManager23CreateAvkonIconTextureLERK11TAknsItemIDi5TSize @ 18 NONAME + _ZN18CGlxTextureManager24SetPreferredTextureSizeLERK20MHuiSegmentedTextureR5TSize @ 19 NONAME + _ZN18CGlxTextureManager25CreateAnimatedGifTextureLERK7TDesC16 @ 20 NONAME + _ZN18CGlxTextureManager26HandleAttributesAvailableLERK6TGlxIdI17TGlxIdSpaceIdBaseERK11TGlxMediaIdRK6RArrayI13TMPXAttributeEPK9CGlxMedia @ 21 NONAME + _ZN18CGlxTextureManager4NewLER18CHuiTextureManager @ 22 NONAME + _ZN18CGlxTextureManager5NewLCER18CHuiTextureManager @ 23 NONAME + _ZN19CGlxScreenFurniture10EnableItemEiNS_10TGlxSfItemEi @ 24 NONAME + _ZN19CGlxScreenFurniture26IsActivePaletteItemVisibleEi @ 25 NONAME + _ZN19CGlxScreenFurniture8SetTextLEiNS_10TGlxSfItemERK7TDesC16i @ 26 NONAME + _ZN25CGlxCommandHandlerMarking4NewLEP21MGlxMediaListProviderR18MGlxSoftkeyHandleri @ 27 NONAME + _ZN25CGlxCommandHandlerMarkingD0Ev @ 28 NONAME + _ZN25CGlxCommandHandlerMarkingD1Ev @ 29 NONAME + _ZN25CGlxCommandHandlerMarkingD2Ev @ 30 NONAME + _ZN27CGlxMediaListCommandHandler10DeactivateEv @ 31 NONAME + _ZN27CGlxMediaListCommandHandler11AddCommandLERKNS_12TCommandInfoE @ 32 NONAME + _ZN27CGlxMediaListCommandHandler11CommandInfoEi @ 33 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC1Ei @ 34 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC2Ei @ 35 NONAME + _ZN27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 36 NONAME + _ZN27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 37 NONAME + _ZN27CGlxMediaListCommandHandler18DoDynInitMenuPaneLEiP12CEikMenuPane @ 38 NONAME + _ZN27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 39 NONAME + _ZN27CGlxMediaListCommandHandler8ExecuteLEi @ 40 NONAME + _ZN27CGlxMediaListCommandHandler9ActivateLEi @ 41 NONAME + _ZN27CGlxMediaListCommandHandler9MediaListEv @ 42 NONAME + _ZN27CGlxMediaListCommandHandlerC2EP21MGlxMediaListProvider @ 43 NONAME + _ZN27CGlxMediaListCommandHandlerD0Ev @ 44 NONAME + _ZN27CGlxMediaListCommandHandlerD1Ev @ 45 NONAME + _ZN27CGlxMediaListCommandHandlerD2Ev @ 46 NONAME + _ZNK14CGlxHuiUtility11DisplaySizeEv @ 47 NONAME + _ZNK14CGlxHuiUtility3EnvEv @ 48 NONAME + _ZNK14CGlxHuiUtility7DisplayEv @ 49 NONAME + _ZNK27CGlxMediaListCommandHandler11IsDisabledLEiR13MGlxMediaList @ 50 NONAME + _ZNK27CGlxMediaListCommandHandler11IsSupportedEi @ 51 NONAME + _ZNK27CGlxMediaListCommandHandler12DoIsDisabledEiR13MGlxMediaList @ 52 NONAME + _ZNK27CGlxMediaListCommandHandler12ViewingStateEv @ 53 NONAME + _ZNK27CGlxMediaListCommandHandler15SelectionLengthEv @ 54 NONAME + _ZNK27CGlxMediaListCommandHandler16CommandInfoIndexEi @ 55 NONAME + _ZNK27CGlxMediaListCommandHandler20BypassFiltersForMenuEv @ 56 NONAME + _ZNK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 57 NONAME + _ZNK27CGlxMediaListCommandHandler23BypassFiltersForExecuteEv @ 58 NONAME + _ZNK27CGlxMediaListCommandHandler24DoGetRequiredAttributesLER6RArrayI13TMPXAttributeEi @ 59 NONAME + _ZNK27CGlxMediaListCommandHandler9MediaListEv @ 60 NONAME + _ZTI14CGlxHuiUtility @ 61 NONAME ; ## + _ZTI21CGlxMarkedIconManager @ 62 NONAME ; ## + _ZTI27CGlxMediaListCommandHandler @ 63 NONAME ; ## + _ZTI31CGlxMarkingCommandHandlerTester @ 64 NONAME ; ## + _ZTV14CGlxHuiUtility @ 65 NONAME ; ## + _ZTV21CGlxMarkedIconManager @ 66 NONAME ; ## + _ZTV27CGlxMediaListCommandHandler @ 67 NONAME ; ## + _ZTV31CGlxMarkingCommandHandlerTester @ 68 NONAME ; ## + _ZThn4_N14CGlxHuiUtility22HandleTvStatusChangedLE13TTvChangeType @ 69 NONAME ; ## + _ZThn4_N25CGlxCommandHandlerMarkingD0Ev @ 70 NONAME ; ## + _ZThn4_N25CGlxCommandHandlerMarkingD1Ev @ 71 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler10DeactivateEv @ 72 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 73 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 74 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 75 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler8ExecuteLEi @ 76 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler9ActivateLEi @ 77 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandlerD0Ev @ 78 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandlerD1Ev @ 79 NONAME ; ## + _ZThn4_NK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 80 NONAME ; ## + _ZThn8_N14CGlxHuiUtility27NotifyDisplayRefreshStartedER11CHuiDisplay @ 81 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/eabi/t_glxcommandhandlermoreinfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/eabi/t_glxcommandhandlermoreinfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _Z20CreateZoomedTextureLRK9TGlxMediaRK13TMPXAttribute6TGlxIdI17TGlxIdSpaceIdBaseERi @ 2 NONAME + _Z23CreateThumbnailTextureL11TGlxMediaId6TGlxIdI17TGlxIdSpaceIdBaseERK5TSizeP19MGlxTextureObserverRi @ 3 NONAME + _ZN14CGlxHuiUtility12TextStyleIdLEii @ 4 NONAME + _ZN14CGlxHuiUtility15HideHuiDisplayLEv @ 5 NONAME + _ZN14CGlxHuiUtility15ScreenFurnitureEv @ 6 NONAME + _ZN14CGlxHuiUtility15ShowHuiDisplayLEv @ 7 NONAME + _ZN14CGlxHuiUtility17GlxTextureManagerEv @ 8 NONAME + _ZN14CGlxHuiUtility22HandleTvStatusChangedLE13TTvChangeType @ 9 NONAME + _ZN14CGlxHuiUtility23ViewNavigationDirectionEv @ 10 NONAME + _ZN14CGlxHuiUtility26SetViewNavigationDirectionE23TGlxNavigationDirection @ 11 NONAME + _ZN14CGlxHuiUtility26UploadFlatColourToTextureLE4TRgbP11CHuiTexture @ 12 NONAME + _ZN14CGlxHuiUtility27NotifyDisplayRefreshStartedER11CHuiDisplay @ 13 NONAME + _ZN14CGlxHuiUtility5CloseEv @ 14 NONAME + _ZN14CGlxHuiUtility8UtilityLEv @ 15 NONAME + _ZN18CGlxTextureManager13RemoveTextureEi @ 16 NONAME + _ZN18CGlxTextureManager18CreateIconTextureLEiR7TDesC165TSize @ 17 NONAME + _ZN18CGlxTextureManager23CreateAvkonIconTextureLERK11TAknsItemIDi5TSize @ 18 NONAME + _ZN18CGlxTextureManager24SetPreferredTextureSizeLERK20MHuiSegmentedTextureR5TSize @ 19 NONAME + _ZN18CGlxTextureManager25CreateAnimatedGifTextureLERK7TDesC16 @ 20 NONAME + _ZN18CGlxTextureManager26HandleAttributesAvailableLERK6TGlxIdI17TGlxIdSpaceIdBaseERK11TGlxMediaIdRK6RArrayI13TMPXAttributeEPK9CGlxMedia @ 21 NONAME + _ZN18CGlxTextureManager4NewLER18CHuiTextureManager @ 22 NONAME + _ZN18CGlxTextureManager5NewLCER18CHuiTextureManager @ 23 NONAME + _ZN19CGlxScreenFurniture26IsActivePaletteItemVisibleEi @ 24 NONAME + _ZN26CGlxCommandHandlerMoreInfo4NewLEP21MGlxMediaListProvideri @ 25 NONAME + _ZN26CGlxCommandHandlerMoreInfoD0Ev @ 26 NONAME + _ZN26CGlxCommandHandlerMoreInfoD1Ev @ 27 NONAME + _ZN26CGlxCommandHandlerMoreInfoD2Ev @ 28 NONAME + _ZN27CGlxMediaListCommandHandler10DeactivateEv @ 29 NONAME + _ZN27CGlxMediaListCommandHandler11AddCommandLERKNS_12TCommandInfoE @ 30 NONAME + _ZN27CGlxMediaListCommandHandler11CommandInfoEi @ 31 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC1Ei @ 32 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC2Ei @ 33 NONAME + _ZN27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 34 NONAME + _ZN27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 35 NONAME + _ZN27CGlxMediaListCommandHandler18DoDynInitMenuPaneLEiP12CEikMenuPane @ 36 NONAME + _ZN27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 37 NONAME + _ZN27CGlxMediaListCommandHandler8ExecuteLEi @ 38 NONAME + _ZN27CGlxMediaListCommandHandler9ActivateLEi @ 39 NONAME + _ZN27CGlxMediaListCommandHandler9MediaListEv @ 40 NONAME + _ZN27CGlxMediaListCommandHandlerC2EP21MGlxMediaListProvider @ 41 NONAME + _ZN27CGlxMediaListCommandHandlerD0Ev @ 42 NONAME + _ZN27CGlxMediaListCommandHandlerD1Ev @ 43 NONAME + _ZN27CGlxMediaListCommandHandlerD2Ev @ 44 NONAME + _ZNK14CGlxHuiUtility11DisplaySizeEv @ 45 NONAME + _ZNK14CGlxHuiUtility3EnvEv @ 46 NONAME + _ZNK14CGlxHuiUtility7DisplayEv @ 47 NONAME + _ZNK27CGlxMediaListCommandHandler11IsDisabledLEiR13MGlxMediaList @ 48 NONAME + _ZNK27CGlxMediaListCommandHandler11IsSupportedEi @ 49 NONAME + _ZNK27CGlxMediaListCommandHandler12DoIsDisabledEiR13MGlxMediaList @ 50 NONAME + _ZNK27CGlxMediaListCommandHandler12ViewingStateEv @ 51 NONAME + _ZNK27CGlxMediaListCommandHandler15SelectionLengthEv @ 52 NONAME + _ZNK27CGlxMediaListCommandHandler16CommandInfoIndexEi @ 53 NONAME + _ZNK27CGlxMediaListCommandHandler20BypassFiltersForMenuEv @ 54 NONAME + _ZNK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 55 NONAME + _ZNK27CGlxMediaListCommandHandler23BypassFiltersForExecuteEv @ 56 NONAME + _ZNK27CGlxMediaListCommandHandler24DoGetRequiredAttributesLER6RArrayI13TMPXAttributeEi @ 57 NONAME + _ZNK27CGlxMediaListCommandHandler9MediaListEv @ 58 NONAME + _ZTI14CGlxHuiUtility @ 59 NONAME ; ## + _ZTI27CGlxMediaListCommandHandler @ 60 NONAME ; ## + _ZTV14CGlxHuiUtility @ 61 NONAME ; ## + _ZTV27CGlxMediaListCommandHandler @ 62 NONAME ; ## + _ZThn4_N14CGlxHuiUtility22HandleTvStatusChangedLE13TTvChangeType @ 63 NONAME ; ## + _ZThn4_N26CGlxCommandHandlerMoreInfoD0Ev @ 64 NONAME ; ## + _ZThn4_N26CGlxCommandHandlerMoreInfoD1Ev @ 65 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler10DeactivateEv @ 66 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 67 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 68 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 69 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler8ExecuteLEi @ 70 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandler9ActivateLEi @ 71 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandlerD0Ev @ 72 NONAME ; ## + _ZThn4_N27CGlxMediaListCommandHandlerD1Ev @ 73 NONAME ; ## + _ZThn4_NK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 74 NONAME ; ## + _ZThn8_N14CGlxHuiUtility27NotifyDisplayRefreshStartedER11CHuiDisplay @ 75 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Build information for CommandHandlers test cases +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +//../ut__commandhandlermarking/group/t_glxcommandhandlermarking.mmp +//../ut_commandhandlerdrm/group/t_glxcommandhandlerdrm.mmp +../ut_commandhandlermoreinfo/group/t_glxcommandhandlermoreinfo.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/bwins/t_glxcommandhandlermarkingu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/bwins/t_glxcommandhandlermarkingu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?MediaList@CGlxMediaListCommandHandler@@IBEABVMGlxMediaList@@XZ @ 2 NONAME ; class MGlxMediaList const & CGlxMediaListCommandHandler::MediaList(void) const + ?ViewNavigationDirection@CGlxUiUtility@@QAE?AW4TGlxNavigationDirection@@XZ @ 3 NONAME ; enum TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection(void) + ?CreateIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@HAAVTDesC16@@VTSize@@@Z @ 4 NONAME ; class CAlfTexture & CGlxTextureManager::CreateIconTextureL(int, class TDesC16 &, class TSize) + ??1CGlxMediaListCommandHandler@@UAE@XZ @ 5 NONAME ; CGlxMediaListCommandHandler::~CGlxMediaListCommandHandler(void) + ?SelectionLength@CGlxMediaListCommandHandler@@IBEHXZ @ 6 NONAME ; int CGlxMediaListCommandHandler::SelectionLength(void) const + ?CreateThumbnailTextureL@@YAAAVCAlfTexture@@VTGlxMediaId@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTSize@@PAVMGlxTextureObserver@@AAH@Z @ 7 NONAME ; class CAlfTexture & CreateThumbnailTextureL(class TGlxMediaId, class TGlxId, class TSize const &, class MGlxTextureObserver *, int &) + ?CommandInfo@CGlxMediaListCommandHandler@@IAEAAUTCommandInfo@1@H@Z @ 8 NONAME ; struct CGlxMediaListCommandHandler::TCommandInfo & CGlxMediaListCommandHandler::CommandInfo(int) + ?GlxTextureManager@CGlxUiUtility@@QAEAAVCGlxTextureManager@@XZ @ 9 NONAME ; class CGlxTextureManager & CGlxUiUtility::GlxTextureManager(void) + ?Deactivate@CGlxMediaListCommandHandler@@UAEXXZ @ 10 NONAME ; void CGlxMediaListCommandHandler::Deactivate(void) + ?DynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXHPAVCEikMenuPane@@@Z @ 11 NONAME ; void CGlxMediaListCommandHandler::DynInitMenuPaneL(int, class CEikMenuPane *) + ?ShowAlfDisplayL@CGlxUiUtility@@SAXXZ @ 12 NONAME ; void CGlxUiUtility::ShowAlfDisplayL(void) + ?HandleActionL@CGlxUiUtility@@UAEXABVTAlfActionCommand@@@Z @ 13 NONAME ; void CGlxUiUtility::HandleActionL(class TAlfActionCommand const &) + ??0TCommandInfo@CGlxMediaListCommandHandler@@QAE@H@Z @ 14 NONAME ; CGlxMediaListCommandHandler::TCommandInfo::TCommandInfo(int) + ?BypassFiltersForExecute@CGlxMediaListCommandHandler@@MBEHXZ @ 15 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForExecute(void) const + ?DoIsDisabled@CGlxMediaListCommandHandler@@MBEHHAAVMGlxMediaList@@@Z @ 16 NONAME ; int CGlxMediaListCommandHandler::DoIsDisabled(int, class MGlxMediaList &) const + ?CreateAvkonIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTAknsItemID@@HVTSize@@@Z @ 17 NONAME ; class CAlfTexture & CGlxTextureManager::CreateAvkonIconTextureL(class TAknsItemID const &, int, class TSize) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 18 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ?HandleTvStatusChangedL@CGlxUiUtility@@UAEXW4TTvChangeType@@@Z @ 19 NONAME ; void CGlxUiUtility::HandleTvStatusChangedL(enum TTvChangeType) + ?AddCommandL@CGlxMediaListCommandHandler@@IAEXABUTCommandInfo@1@@Z @ 20 NONAME ; void CGlxMediaListCommandHandler::AddCommandL(struct CGlxMediaListCommandHandler::TCommandInfo const &) + ?MediaList@CGlxMediaListCommandHandler@@IAEAAVMGlxMediaList@@XZ @ 21 NONAME ; class MGlxMediaList & CGlxMediaListCommandHandler::MediaList(void) + ?Close@CGlxUiUtility@@QAEXXZ @ 22 NONAME ; void CGlxUiUtility::Close(void) + ?NewL@CGlxTextureManager@@SAPAV1@AAVCAlfTextureManager@@@Z @ 23 NONAME ; class CGlxTextureManager * CGlxTextureManager::NewL(class CAlfTextureManager &) + ?IsDisabledL@CGlxMediaListCommandHandler@@IBEHHAAVMGlxMediaList@@@Z @ 24 NONAME ; int CGlxMediaListCommandHandler::IsDisabledL(int, class MGlxMediaList &) const + ??1CGlxMedia@@UAE@XZ @ 25 NONAME ; CGlxMedia::~CGlxMedia(void) + ?CreateZoomedTextureL@@YAAAVCAlfTexture@@ABVTGlxMedia@@ABVTMPXAttribute@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@AAH@Z @ 26 NONAME ; class CAlfTexture & CreateZoomedTextureL(class TGlxMedia const &, class TMPXAttribute const &, class TGlxId, int &) + ?HandleSkinChanged@CGlxTextureManager@@UAEXXZ @ 27 NONAME ; void CGlxTextureManager::HandleSkinChanged(void) + ??1CGlxCommandHandlerMarking@@UAE@XZ @ 28 NONAME ; CGlxCommandHandlerMarking::~CGlxCommandHandlerMarking(void) + ?UtilityL@CGlxUiUtility@@SAPAV1@XZ @ 29 NONAME ; class CGlxUiUtility * CGlxUiUtility::UtilityL(void) + ?HideAlfDisplayL@CGlxUiUtility@@SAXXZ @ 30 NONAME ; void CGlxUiUtility::HideAlfDisplayL(void) + ?ExecuteL@CGlxMediaListCommandHandler@@UAEHH@Z @ 31 NONAME ; int CGlxMediaListCommandHandler::ExecuteL(int) + ?DisplaySize@CGlxUiUtility@@QBE?AVTSize@@XZ @ 32 NONAME ; class TSize CGlxUiUtility::DisplaySize(void) const + ?GetRequiredAttributesL@CGlxMediaListCommandHandler@@UBEXAAV?$RArray@VTMPXAttribute@@@@HHH@Z @ 33 NONAME ; void CGlxMediaListCommandHandler::GetRequiredAttributesL(class RArray &, int, int, int) const + ?IsSupported@CGlxMediaListCommandHandler@@IBEHH@Z @ 34 NONAME ; int CGlxMediaListCommandHandler::IsSupported(int) const + ?DoActivateL@CGlxMediaListCommandHandler@@MAEXH@Z @ 35 NONAME ; void CGlxMediaListCommandHandler::DoActivateL(int) + ?RemoveTexture@CGlxTextureManager@@QAEXABVCAlfTexture@@@Z @ 36 NONAME ; void CGlxTextureManager::RemoveTexture(class CAlfTexture const &) + ?PreDynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXH@Z @ 37 NONAME ; void CGlxMediaListCommandHandler::PreDynInitMenuPaneL(int) + ?RetrieveL@GlxAttributeRetriever@@SAHABVMGlxFetchContext@@AAVMGlxMediaList@@H@Z @ 38 NONAME ; int GlxAttributeRetriever::RetrieveL(class MGlxFetchContext const &, class MGlxMediaList &, int) + ?DoGetRequiredAttributesL@CGlxMediaListCommandHandler@@MBEXAAV?$RArray@VTMPXAttribute@@@@H@Z @ 39 NONAME ; void CGlxMediaListCommandHandler::DoGetRequiredAttributesL(class RArray &, int) const + ?TextStyleIdL@CGlxUiUtility@@QAEHHH@Z @ 40 NONAME ; int CGlxUiUtility::TextStyleIdL(int, int) + ?BypassFiltersForMenu@CGlxMediaListCommandHandler@@MBEHXZ @ 41 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForMenu(void) const + ?ViewingState@CGlxMediaListCommandHandler@@IBE?AW4TViewingState@TCommandInfo@1@XZ @ 42 NONAME ; enum CGlxMediaListCommandHandler::TCommandInfo::TViewingState CGlxMediaListCommandHandler::ViewingState(void) const + ?CommandInfoIndex@CGlxMediaListCommandHandler@@ABEHH@Z @ 43 NONAME ; int CGlxMediaListCommandHandler::CommandInfoIndex(int) const + ?OfferKeyEventL@CGlxMediaListCommandHandler@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 44 NONAME ; enum TKeyResponse CGlxMediaListCommandHandler::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?Display@CGlxUiUtility@@QBEPAVCAlfDisplay@@XZ @ 45 NONAME ; class CAlfDisplay * CGlxUiUtility::Display(void) const + ??0CGlxMediaListCommandHandler@@QAE@PAVMGlxMediaListProvider@@H@Z @ 46 NONAME ; CGlxMediaListCommandHandler::CGlxMediaListCommandHandler(class MGlxMediaListProvider *, int) + ?NewL@CGlxCommandHandlerMarking@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 47 NONAME ; class CGlxCommandHandlerMarking * CGlxCommandHandlerMarking::NewL(class MGlxMediaListProvider *, int) + ?Env@CGlxUiUtility@@QBEPAVCAlfEnv@@XZ @ 48 NONAME ; class CAlfEnv * CGlxUiUtility::Env(void) const + ?DoDynInitMenuPaneL@CGlxMediaListCommandHandler@@MAEXHPAVCEikMenuPane@@@Z @ 49 NONAME ; void CGlxMediaListCommandHandler::DoDynInitMenuPaneL(int, class CEikMenuPane *) + ?SetViewNavigationDirection@CGlxUiUtility@@QAEXW4TGlxNavigationDirection@@@Z @ 50 NONAME ; void CGlxUiUtility::SetViewNavigationDirection(enum TGlxNavigationDirection) + ?ScreenFurniture@CGlxUiUtility@@QAEPAVCGlxScreenFurniture@@XZ @ 51 NONAME ; class CGlxScreenFurniture * CGlxUiUtility::ScreenFurniture(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Build information file for command handlers. +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_glxcommandhandlermarking.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/group/t_glxcommandhandlermarking.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/group/t_glxcommandhandlermarking.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + +#include +#include "../../../../../group/glxbuildcommon.mmh" + +TARGET t_glxcommandhandlermarking.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +// Sources required by the test suite +SOURCEPATH ../src +SOURCE t_glxcommandhandlermarking.cpp + +// Sources required by the test suite +SOURCEPATH ../src +SOURCE t_glxcommandhandlermarking_DllMain.cpp + + +SOURCEPATH ../../../commandhandlermarking/src +SOURCE glxcommandhandlermarking.cpp +SOURCE glxmarkediconmanager.cpp + +SOURCEPATH ../../../commandhandlerbase/src +SOURCE glxmedialistcommandhandler.cpp + +SOURCEPATH ../../ut_commandhandlerdrm/src +SOURCE t_glxdummyhuiutility.cpp + +USERINCLUDE ../../../commandhandlermarking/inc +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../viewframework/inc +SYSTEMINCLUDE ../../../../medialists/inc +SYSTEMINCLUDE ../../../../views/viewbase/inc +SYSTEMINCLUDE ../../../../texturemanager/inc +SYSTEMINCLUDE ../../../../uiutilities/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../../visuallistmanager/inc + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../../../common/inc + +LIBRARY EUnit.lib +LIBRARY euser.lib + +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY eikcoctl.lib +LIBRARY gdi.lib + +LIBRARY glxmedialists.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY glxviewbase.lib +LIBRARY glxcommon.lib // for CResourceUtilities +LIBRARY hitchcock.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY glxuiutilities.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY alfwidgetmodel.lib +LIBRARY glxtexturemanager.lib +LIBRARY alfclient.lib +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknskins.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY cdlengine.lib +LIBRARY centralrepository.lib // For CGlxSettingsModel +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY eikdlg.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY featmgr.lib // For FeatureManager::FeatureSupported +LIBRARY gdi.lib +LIBRARY glxcommon.lib // for CGlxResolutionManager +LIBRARY glxcommonui.lib // for +LIBRARY glxtexturemanager.lib +LIBRARY alfclient.lib // For Alfred Hitchcock framework +LIBRARY hlplch.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY ws32.lib +LIBRARY glxtvout.lib // for TV out notificaions +LIBRARY libpthread.lib +// Uiaccelerator related libraries +LIBRARY osncore.lib +LIBRARY alfwidgetmodel.lib +// MUL related libraries +LIBRARY mulmodelutility.lib //For Visual Item and Filter action item +//for handling the Ustring memory leak +LIBRARY libc.lib +LIBRARY libglib.lib +LIBRARY libstdcpp.lib +LIBRARY flogger.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/inc/t_glxcommandhandlermarking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/inc/t_glxcommandhandlermarking.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerMarking unit test cases +* +*/ + + + + +#ifndef __T_GLXCOMMANDHANDLERMARKING_H__ +#define __T_GLXCOMMANDHANDLERMARKING_H__ + +// EXTERNAL INCLUDES +#include +#include + +#include "glxcommandhandlermarking.h" +#include +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class _CGlxTestMediaList; + +// CLASS DEFINITION + +class CGlxMarkingCommandHandlerTester: public CBase, + public MGlxMediaListProvider, + public MGlxSoftkeyHandler + { +public: + static CGlxMarkingCommandHandlerTester* NewL(); + ~CGlxMarkingCommandHandlerTester(); + + TBool ExecuteL(TInt aCommand); + + TBool OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex); + +public: // From MGlxMediaListProvider + virtual MGlxMediaList& MediaList(); + +public: // From MGlxSoftkeyHandler + void StoreCurrentSoftKeysL() {}; + + void ChangeSoftkeyL(TGlxSoftkey , TInt , + const TDesC& ) {}; + + void RestoreSoftKeysAndTitleL() {}; + + void EnableSoftkey( TBool, TGlxSoftkey ) {}; + +private: + CGlxMarkingCommandHandlerTester(); + void ConstructL(); + +private: + CGlxCommandHandlerMarking* iMarker; + + _CGlxTestMediaList* iMediaList; + + RPointerArray iCommandHandlerList; + }; + +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( ut__commandhandlermarking ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static ut__commandhandlermarking* NewL(); + static ut__commandhandlermarking* NewLC(); + /** + * Destructor + */ + ~ut__commandhandlermarking(); + + private: // Constructors and destructors + + ut__commandhandlermarking(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_TestCreateL(); + + void T_TestExecuteNoItemsL(); + + void T_TestExecuteItemsL(); + + void T_TestOfferKeyL(); + + + private: // Data + CGlxMarkingCommandHandlerTester* iTester; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_GLXCOMMANDHANDLERMARKING_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/src/t_glxcommandhandlermarking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/src/t_glxcommandhandlermarking.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,563 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerMarking unit test cases +* +*/ + + + + +// CLASS HEADER +#include "t_glxcommandhandlermarking.h" + +// EXTERNAL INCLUDES +#include +#include + +#include + +#include +#include +#include + +// INTERNAL INCLUDES + +// +CGlxMedia::CGlxMedia(const TGlxMediaId& aId) + : iId(aId) + { + } + +CGlxMedia::~CGlxMedia() + { + Reset(); + iValues.Close(); + iAttributes.Close(); + } + +class _CGlxTestMediaList: public CBase, public MGlxMediaList + { +public: + ~_CGlxTestMediaList() + { + iItems.Close(); + iMedia.ResetAndDestroy(); + iSelectedItems.Close(); + } + + virtual void Close() + { + }; + virtual TGlxMediaListId Id() const + { + return KGlxIdNone; + } + + virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const + { + return iItems.Count(); + } + + virtual TInt FocusIndex() const + { + return iFocusIndex; + } + + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) + { + iFocusIndex = aValue; + } + + virtual const TGlxMedia& Item(TInt aIndex) const + { + return iItems[aIndex]; + } + + virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& aId) const + { + TInt count = iItems.Count(); + for (TInt i = 0; i < count; i++) + { + if (iItems[i].Id() == aId) + { + return i; + } + } + return KErrNotFound; + } + + virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) + { + } + + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) + { + } + + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) + { + } + + virtual MMPXCollection& Collection() const + { + // we know that this method is not called in our tests, this is just to make the code compile + MMPXCollection* empty = NULL; + return *empty; + } + + virtual TBool IsSelected(TInt aIndex) const + { + TInt idx = iSelectedItems.Find(aIndex); + return (idx != KErrNotFound); + } + + virtual void SetSelectedL(TInt aIndex, TBool aSelected) + { + if (aSelected) + { + iSelectedItems.InsertInOrder(aIndex); + } + else + { + iSelectedItems.Remove(iSelectedItems.Find(aIndex)); + } + } + + virtual const TArray Selection() const + { + return iSelectedItems.Array(); + } + + virtual void CommandL(CMPXCommand& /*aCommand*/) + { + } + + virtual void CancelCommand() + { + } + + virtual void SetFilterL(CMPXFilter* /*aFilter*/) + { + } + + virtual CMPXFilter* Filter() const + { + return NULL; + } + + virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const + { + return KGlxIdNone; + } + + void AppendL(TInt aId, TBool aCreateMedia) + { + if (aCreateMedia) + { + CGlxMedia* media = new (ELeave) CGlxMedia(TGlxMediaId(aId)); + CleanupStack::PushL(media); + iMedia.AppendL(media); + CleanupStack::Pop(media); + iItems.AppendL(TGlxMedia(TGlxMediaId(aId), media)); + } + else + { + iItems.AppendL(TGlxMedia(TGlxMediaId(aId))); + } + } + + CGlxMedia* MediaObj(TInt aIndex) const + { + return const_cast(static_cast(iItems[aIndex].Properties())); + } + + CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const + { + return NULL; + } + + TInt SelectionCount() const + { + return iSelectedItems.Count(); + } + + TInt SelectedItemIndex(TInt /*aSelectionIndex*/) const + { + return 0; + } + + TBool IsPopulated() const + { + return ETrue; + } + + void AddStaticItemL( CGlxMedia* /*aStaticItem*/, + NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}; + + void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}; + + void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }; + + TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }; + + void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition){}; + + void ResetFocus(){}; + + void SetVisibleWindowIndexL( TInt aIndex ){}; + TInt VisibleWindowIndex() const {}; + + RArray iItems; + RPointerArray iMedia; + RArray iSelectedItems; + TInt iFocusIndex; + TBool iStaticItemsEnabled; + }; + + +TInt GlxAttributeRetriever::RetrieveL(const MGlxFetchContext&, MGlxMediaList&, TBool) + { + return KErrNone; + } + + + +CGlxMarkingCommandHandlerTester* CGlxMarkingCommandHandlerTester::NewL() + { + CGlxMarkingCommandHandlerTester* me = new(ELeave)CGlxMarkingCommandHandlerTester(); + CleanupStack::PushL(me); + me->ConstructL(); + CleanupStack::Pop(); + return me; + } + +CGlxMarkingCommandHandlerTester::~CGlxMarkingCommandHandlerTester() + { + iMarker->Deactivate(); + + iCommandHandlerList.ResetAndDestroy(); + iCommandHandlerList.Close(); + + delete iMediaList; + } + + +CGlxMarkingCommandHandlerTester::CGlxMarkingCommandHandlerTester() + { + + } + +void CGlxMarkingCommandHandlerTester::ConstructL() + { + EUNIT_PRINT(_L("CGlxMarkingCommandHandlerTester::ConstructL")); + + iMediaList = new (ELeave) _CGlxTestMediaList; + + EUNIT_PRINT(_L("Construct command handler")); + iMarker = CGlxCommandHandlerMarking::NewL(this,ETrue); + + iCommandHandlerList.AppendL(iMarker); + + iMarker->ActivateL(0); + + EUNIT_PRINT(_L("CGlxMarkingCommandHandlerTester::ConstructL complete")); + } + +MGlxMediaList& CGlxMarkingCommandHandlerTester::MediaList() + { + return *iMediaList; + } + +TBool CGlxMarkingCommandHandlerTester::ExecuteL(TInt aCommand) + { + return iCommandHandlerList[0]->ExecuteL( aCommand ); + } + +TBool CGlxMarkingCommandHandlerTester::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + TKeyResponse resp = iMarker->OfferKeyEventL(aKeyEvent, aType); + return (resp == EKeyWasConsumed); + } + +void CGlxMarkingCommandHandlerTester::HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex) + { + iMarker->HandleFocusChangedL(aType, aNewIndex, aOldIndex, iMediaList); + } + +// CONSTRUCTION +ut__commandhandlermarking* ut__commandhandlermarking::NewL() + { + ut__commandhandlermarking* self = ut__commandhandlermarking::NewLC(); + CleanupStack::Pop(); + + return self; + } + +ut__commandhandlermarking* ut__commandhandlermarking::NewLC() + { + ut__commandhandlermarking* self = new( ELeave ) ut__commandhandlermarking(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +ut__commandhandlermarking::~ut__commandhandlermarking() + { + } + +// Default constructor +ut__commandhandlermarking::ut__commandhandlermarking() + { + } + +// Second phase construct +void ut__commandhandlermarking::ConstructL() + { + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void ut__commandhandlermarking::SetupL( ) + { + EUNIT_PRINT(_L("ut__commandhandlermarking::SetupL")); + iTester = CGlxMarkingCommandHandlerTester::NewL(); + } + + +void ut__commandhandlermarking::Teardown( ) + { + delete iTester; + iTester = NULL; + } + + +void ut__commandhandlermarking::T_TestCreateL( ) + { + } + +void ut__commandhandlermarking::T_TestExecuteNoItemsL() + { + EUNIT_PRINT(_L("ut__commandhandlermarking::T_TestExecuteNoItemsL")); + TBool exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Mark unsupported "); + + exe = iTester->ExecuteL(EAknCmdUnmark); + EUNIT_ASSERT_DESC( exe == EFalse, "Unmark unsupported"); + + exe = iTester->ExecuteL(EAknMarkAll); + EUNIT_ASSERT_DESC( exe == EFalse, "Mark all unsupported"); + + exe = iTester->ExecuteL(EAknUnmarkAll); + EUNIT_ASSERT_DESC( exe == EFalse, "Unmark all unsupported"); + + exe = iTester->ExecuteL(-1); + EUNIT_ASSERT_DESC( exe == EFalse, "unknown command -1"); + + exe = iTester->ExecuteL(1024); + EUNIT_ASSERT_DESC( exe == EFalse, "unknown command 1024"); + } + + + +void ut__commandhandlermarking::T_TestExecuteItemsL() + { + EUNIT_PRINT(_L("ut__commandhandlermarking::T_TestExecuteItemsL")); + + _CGlxTestMediaList* ml = dynamic_cast<_CGlxTestMediaList*>(&iTester->MediaList()); + + ml->AppendL(0, ETrue); + ml->AppendL(1, ETrue); + ml->AppendL(2, ETrue); + ml->AppendL(3, ETrue); + ml->AppendL(4, ETrue); + ml->iFocusIndex = 0; + + TBool exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe, "Mark supported"); + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Already marked"); + + exe = iTester->ExecuteL(EAknCmdUnmark); + EUNIT_ASSERT_DESC( exe, "Unmark supported"); + + exe = iTester->ExecuteL(EAknCmdUnmark); + EUNIT_ASSERT_DESC( exe == EFalse, "Unmark not supported"); + + exe = iTester->ExecuteL(EAknMarkAll); + EUNIT_ASSERT_DESC( exe, "Mark all"); + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Cannot mark"); + + exe = iTester->ExecuteL(EAknMarkAll); + EUNIT_ASSERT_DESC( exe == EFalse, "Mark all not supported"); + + exe = iTester->ExecuteL(EAknUnmarkAll); + EUNIT_ASSERT_DESC( exe, "Unmark all"); + + exe = iTester->ExecuteL(EAknUnmarkAll); + EUNIT_ASSERT_DESC( exe==EFalse, "Unmark all not supported"); + + exe = iTester->ExecuteL(EAknCmdUnmark); + EUNIT_ASSERT_DESC( exe == EFalse, "Unmark not supported"); + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe, "Mark supported"); + + EUNIT_PRINT(_L("ut__commandhandlermarking::T_TestExecuteItemsL change focus pos")); + + ml->iFocusIndex = 1; + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe, "Mark supported"); + + exe = iTester->ExecuteL(EAknCmdUnmark); + EUNIT_ASSERT_DESC( exe, "Unmark supported"); + + ml->iFocusIndex = 0; + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Already marked"); + + ml->iFocusIndex = 1; + exe = iTester->ExecuteL(EAknCmdUnmark); + EUNIT_ASSERT_DESC( exe == EFalse, "not marked"); + } + +void ut__commandhandlermarking::T_TestOfferKeyL() + { + _CGlxTestMediaList* ml = dynamic_cast<_CGlxTestMediaList*>(&iTester->MediaList()); + + ml->AppendL(0, ETrue); + ml->AppendL(1, ETrue); + ml->AppendL(2, ETrue); + ml->AppendL(3, ETrue); + ml->AppendL(4, ETrue); + ml->iFocusIndex = 0; + + TKeyEvent kev = { 0 }; + kev.iModifiers |= EModifierShift; + + // shift key pressed + iTester->OfferKeyEventL(kev, EEventKeyDown); + + // change focus + iTester->HandleFocusChangedL( NGlxListDefs::EForward, 4,0); + + // all items should now be marked + TBool exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Cannot mark"); + + exe = iTester->ExecuteL(EAknMarkAll); + EUNIT_ASSERT_DESC( exe == EFalse, "All already marked"); + + // shift key disabled + kev.iModifiers = 0; + iTester->OfferKeyEventL(kev, EEventKeyUp); + + iTester->OfferKeyEventL(kev, EEventKeyDown); + + // changing focus has no effect + iTester->HandleFocusChangedL( NGlxListDefs::EBackward, 0,4); + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Cannot mark"); + + exe = iTester->ExecuteL(EAknMarkAll); + EUNIT_ASSERT_DESC( exe == EFalse, "All already marked"); + + kev.iModifiers |= EModifierShift; + + // shift key down + iTester->OfferKeyEventL(kev, EEventKeyDown); + + iTester->HandleFocusChangedL( NGlxListDefs::EForward, 4,0); + + // all items have been unmarked + exe = iTester->ExecuteL(EAknUnmarkAll); + EUNIT_ASSERT_DESC( exe == EFalse, "None marked"); + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe, "Can mark"); + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Already marked"); + + // select with shift down + kev.iScanCode=EStdKeyDevice3; + TBool resp = iTester->OfferKeyEventL(kev, EEventKey); + EUNIT_ASSERT_DESC( resp, "Event consumed"); + + // item has been unmarked + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe, "Can mark"); + + // shift key up + // select should have no effect on marking + kev.iScanCode=EStdKeyDevice3; + kev.iModifiers = 0; + resp = iTester->OfferKeyEventL(kev, EEventKeyDown); + EUNIT_ASSERT_DESC( resp == EFalse, "Event notconsumed"); + + exe = iTester->ExecuteL(EAknCmdMark); + EUNIT_ASSERT_DESC( exe == EFalse, "Already marked"); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + ut__commandhandlermarking, + "Add test suite description here.", + "MODULE" ) + +EUNIT_TEST( + "Test0", + "Create marking command handler", + "Test0", + "FUNCTIONALITY", + SetupL, T_TestCreateL, Teardown) + +EUNIT_TEST( + "Test1", + "Test execute no items", + "Test1", + "FUNCTIONALITY", + SetupL, T_TestExecuteNoItemsL, Teardown) + +EUNIT_TEST( + "Test2", + "Test execute items", + "Test2", + "FUNCTIONALITY", + SetupL, T_TestExecuteItemsL, Teardown) + + EUNIT_TEST( + "Test3", + "Test offer key events", + "Test3", + "FUNCTIONALITY", + SetupL, T_TestOfferKeyL, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/src/t_glxcommandhandlermarking_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut__commandhandlermarking/src/t_glxcommandhandlermarking_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CommandHandlerMarking unit test application +* +*/ + + + + +// CLASS HEADER +#include "t_glxcommandhandlermarking.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return ut__commandhandlermarking::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/bwins/t_glxcommandhandlerdrmu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/bwins/t_glxcommandhandlerdrmu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?NewL@CGlxCommandHandlerDrm@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 2 NONAME ; class CGlxCommandHandlerDrm * CGlxCommandHandlerDrm::NewL(class MGlxMediaListProvider *, int) + ?ViewNavigationDirection@CGlxUiUtility@@QAE?AW4TGlxNavigationDirection@@XZ @ 3 NONAME ; enum TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection(void) + ?RemoveFromItem@CGlxIconManager@@UAEXPAVCAlfVisual@@H@Z @ 4 NONAME ; void CGlxIconManager::RemoveFromItem(class CAlfVisual *, int) + ?InstanceL@CGlxDRMUtility@@SAPAV1@XZ @ 5 NONAME ; class CGlxDRMUtility * CGlxDRMUtility::InstanceL(void) + ?CanShowInfoOnlineL@CGlxDRMUtility@@QAEHAAVTDesC16@@@Z @ 6 NONAME ; int CGlxDRMUtility::CanShowInfoOnlineL(class TDesC16 &) + ??1CGlxMediaListCommandHandler@@UAE@XZ @ 7 NONAME ; CGlxMediaListCommandHandler::~CGlxMediaListCommandHandler(void) + ?CreateVisualFromIconL@CGlxIconManager@@UAEXHAAVTDesC16@@AAVTGlxIconManagerParams@@@Z @ 8 NONAME ; void CGlxIconManager::CreateVisualFromIconL(int, class TDesC16 &, class TGlxIconManagerParams &) + ?Deactivate@CGlxMediaListCommandHandler@@UAEXXZ @ 9 NONAME ; void CGlxMediaListCommandHandler::Deactivate(void) + ?BrushPositionInVisual@CGlxIconManager@@UAEHPAVCAlfVisual@@H@Z @ 10 NONAME ; int CGlxIconManager::BrushPositionInVisual(class CAlfVisual *, int) + ?ShowAlfDisplayL@CGlxUiUtility@@SAXXZ @ 11 NONAME ; void CGlxUiUtility::ShowAlfDisplayL(void) + ??0TCommandInfo@CGlxMediaListCommandHandler@@QAE@H@Z @ 12 NONAME ; CGlxMediaListCommandHandler::TCommandInfo::TCommandInfo(int) + ?BypassFiltersForExecute@CGlxMediaListCommandHandler@@MBEHXZ @ 13 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForExecute(void) const + ?NewL@CGlxTextureManager@@SAPAV1@AAVCAlfTextureManager@@@Z @ 14 NONAME ; class CGlxTextureManager * CGlxTextureManager::NewL(class CAlfTextureManager &) + ?ManagerL@CGlxVisualListManager@@SAPAV1@XZ @ 15 NONAME ; class CGlxVisualListManager * CGlxVisualListManager::ManagerL(void) + ?CreateZoomedTextureL@@YAAAVCAlfTexture@@ABVTGlxMedia@@ABVTMPXAttribute@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@AAH@Z @ 16 NONAME ; class CAlfTexture & CreateZoomedTextureL(class TGlxMedia const &, class TMPXAttribute const &, class TGlxId, int &) + ??1CGlxIconManager@@UAE@XZ @ 17 NONAME ; CGlxIconManager::~CGlxIconManager(void) + ?UtilityL@CGlxUiUtility@@SAPAV1@XZ @ 18 NONAME ; class CGlxUiUtility * CGlxUiUtility::UtilityL(void) + ?CreateVisualFromTextureL@CGlxIconManager@@UAEXAAVCAlfTexture@@AAVTGlxIconManagerParams@@@Z @ 19 NONAME ; void CGlxIconManager::CreateVisualFromTextureL(class CAlfTexture &, class TGlxIconManagerParams &) + ?HideAlfDisplayL@CGlxUiUtility@@SAXXZ @ 20 NONAME ; void CGlxUiUtility::HideAlfDisplayL(void) + ?ExecuteL@CGlxMediaListCommandHandler@@UAEHH@Z @ 21 NONAME ; int CGlxMediaListCommandHandler::ExecuteL(int) + ?IsSupported@CGlxMediaListCommandHandler@@IBEHH@Z @ 22 NONAME ; int CGlxMediaListCommandHandler::IsSupported(int) const + ?RemoveTexture@CGlxTextureManager@@QAEXABVCAlfTexture@@@Z @ 23 NONAME ; void CGlxTextureManager::RemoveTexture(class CAlfTexture const &) + ?PreDynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXH@Z @ 24 NONAME ; void CGlxMediaListCommandHandler::PreDynInitMenuPaneL(int) + ?DoGetRequiredAttributesL@CGlxMediaListCommandHandler@@MBEXAAV?$RArray@VTMPXAttribute@@@@H@Z @ 25 NONAME ; void CGlxMediaListCommandHandler::DoGetRequiredAttributesL(class RArray &, int) const + ??1CGlxCommandHandlerDrm@@UAE@XZ @ 26 NONAME ; CGlxCommandHandlerDrm::~CGlxCommandHandlerDrm(void) + ?CommandInfoIndex@CGlxMediaListCommandHandler@@ABEHH@Z @ 27 NONAME ; int CGlxMediaListCommandHandler::CommandInfoIndex(int) const + ?IsForwardLockedL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 28 NONAME ; int CGlxDRMUtility::IsForwardLockedL(class TDesC16 const &) + ?OfferKeyEventL@CGlxMediaListCommandHandler@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 29 NONAME ; enum TKeyResponse CGlxMediaListCommandHandler::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?Display@CGlxUiUtility@@QBEPAVCAlfDisplay@@XZ @ 30 NONAME ; class CAlfDisplay * CGlxUiUtility::Display(void) const + ??0CGlxMediaListCommandHandler@@QAE@PAVMGlxMediaListProvider@@H@Z @ 31 NONAME ; CGlxMediaListCommandHandler::CGlxMediaListCommandHandler(class MGlxMediaListProvider *, int) + ?SetViewNavigationDirection@CGlxUiUtility@@QAEXW4TGlxNavigationDirection@@@Z @ 32 NONAME ; void CGlxUiUtility::SetViewNavigationDirection(enum TGlxNavigationDirection) + ?ReleaseList@CGlxVisualListManager@@QAEXPAVMGlxVisualList@@@Z @ 33 NONAME ; void CGlxVisualListManager::ReleaseList(class MGlxVisualList *) + ?MediaList@CGlxMediaListCommandHandler@@IBEABVMGlxMediaList@@XZ @ 34 NONAME ; class MGlxMediaList const & CGlxMediaListCommandHandler::MediaList(void) const + ??0CGlxIconManager@@IAE@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 35 NONAME ; CGlxIconManager::CGlxIconManager(class MGlxMediaList &, class MGlxVisualList &) + ??0TGlxIconManagerParams@@QAE@MMMMM@Z @ 36 NONAME ; TGlxIconManagerParams::TGlxIconManagerParams(float, float, float, float, float) + ?CreateIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@HAAVTDesC16@@VTSize@@@Z @ 37 NONAME ; class CAlfTexture & CGlxTextureManager::CreateIconTextureL(int, class TDesC16 &, class TSize) + ?DRMThumbnailSize@CGlxDRMUtility@@QAE?AVTSize@@AAV2@@Z @ 38 NONAME ; class TSize CGlxDRMUtility::DRMThumbnailSize(class TSize &) + ?SelectionLength@CGlxMediaListCommandHandler@@IBEHXZ @ 39 NONAME ; int CGlxMediaListCommandHandler::SelectionLength(void) const + ?CommandInfo@CGlxMediaListCommandHandler@@IAEAAUTCommandInfo@1@H@Z @ 40 NONAME ; struct CGlxMediaListCommandHandler::TCommandInfo & CGlxMediaListCommandHandler::CommandInfo(int) + ?CreateThumbnailTextureL@@YAAAVCAlfTexture@@VTGlxMediaId@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTSize@@PAVMGlxTextureObserver@@AAH@Z @ 41 NONAME ; class CAlfTexture & CreateThumbnailTextureL(class TGlxMediaId, class TGlxId, class TSize const &, class MGlxTextureObserver *, int &) + ?GlxTextureManager@CGlxUiUtility@@QAEAAVCGlxTextureManager@@XZ @ 42 NONAME ; class CGlxTextureManager & CGlxUiUtility::GlxTextureManager(void) + ?BaseConstructL@CGlxIconManager@@QAEXXZ @ 43 NONAME ; void CGlxIconManager::BaseConstructL(void) + ?DynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXHPAVCEikMenuPane@@@Z @ 44 NONAME ; void CGlxMediaListCommandHandler::DynInitMenuPaneL(int, class CEikMenuPane *) + ?NewL@CGlxDrmIconManager@@SAPAV1@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 45 NONAME ; class CGlxDrmIconManager * CGlxDrmIconManager::NewL(class MGlxMediaList &, class MGlxVisualList &) + ??1CGlxDrmIconManager@@UAE@XZ @ 46 NONAME ; CGlxDrmIconManager::~CGlxDrmIconManager(void) + ?Close@CGlxDRMUtility@@QAEXXZ @ 47 NONAME ; void CGlxDRMUtility::Close(void) + ?HandleActionL@CGlxUiUtility@@UAEXABVTAlfActionCommand@@@Z @ 48 NONAME ; void CGlxUiUtility::HandleActionL(class TAlfActionCommand const &) + ?ConsumeRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 49 NONAME ; int CGlxDRMUtility::ConsumeRightsL(class TDesC16 const &) + ?AddIconToItemL@CGlxIconManager@@UAEXHH@Z @ 50 NONAME ; void CGlxIconManager::AddIconToItemL(int, int) + ?CreateAvkonIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTAknsItemID@@HVTSize@@@Z @ 51 NONAME ; class CAlfTexture & CGlxTextureManager::CreateAvkonIconTextureL(class TAknsItemID const &, int, class TSize) + ?DoIsDisabled@CGlxMediaListCommandHandler@@MBEHHAAVMGlxMediaList@@@Z @ 52 NONAME ; int CGlxMediaListCommandHandler::DoIsDisabled(int, class MGlxMediaList &) const + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 53 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ?AddCommandL@CGlxMediaListCommandHandler@@IAEXABUTCommandInfo@1@@Z @ 54 NONAME ; void CGlxMediaListCommandHandler::AddCommandL(struct CGlxMediaListCommandHandler::TCommandInfo const &) + ?HandleTvStatusChangedL@CGlxUiUtility@@UAEXW4TTvChangeType@@@Z @ 55 NONAME ; void CGlxUiUtility::HandleTvStatusChangedL(enum TTvChangeType) + ?Close@CGlxUiUtility@@QAEXXZ @ 56 NONAME ; void CGlxUiUtility::Close(void) + ?MediaList@CGlxMediaListCommandHandler@@IAEAAVMGlxMediaList@@XZ @ 57 NONAME ; class MGlxMediaList & CGlxMediaListCommandHandler::MediaList(void) + ?CreateVisualFromIconL@CGlxIconManager@@UAEXHAAVTDesC16@@@Z @ 58 NONAME ; void CGlxIconManager::CreateVisualFromIconL(int, class TDesC16 &) + ?IsDisabledL@CGlxMediaListCommandHandler@@IBEHHAAVMGlxMediaList@@@Z @ 59 NONAME ; int CGlxMediaListCommandHandler::IsDisabledL(int, class MGlxMediaList &) const + ??1CGlxMedia@@UAE@XZ @ 60 NONAME ; CGlxMedia::~CGlxMedia(void) + ?HandleSkinChanged@CGlxTextureManager@@UAEXXZ @ 61 NONAME ; void CGlxTextureManager::HandleSkinChanged(void) + ?DisplaySize@CGlxUiUtility@@QBE?AVTSize@@XZ @ 62 NONAME ; class TSize CGlxUiUtility::DisplaySize(void) const + ?ShowRightsInfoL@CGlxDRMUtility@@QAEXABVTDesC16@@@Z @ 63 NONAME ; void CGlxDRMUtility::ShowRightsInfoL(class TDesC16 const &) + ?GetRequiredAttributesL@CGlxMediaListCommandHandler@@UBEXAAV?$RArray@VTMPXAttribute@@@@HHH@Z @ 64 NONAME ; void CGlxMediaListCommandHandler::GetRequiredAttributesL(class RArray &, int, int, int) const + ?ListL@CGlxVisualListManager@@QAEPAVMGlxVisualList@@AAVMGlxMediaList@@AAVCAlfEnv@@AAVCAlfDisplay@@W4TScaleMode@CAlfImageVisual@@@Z @ 65 NONAME ; class MGlxVisualList * CGlxVisualListManager::ListL(class MGlxMediaList &, class CAlfEnv &, class CAlfDisplay &, enum CAlfImageVisual::TScaleMode) + ?DoActivateL@CGlxMediaListCommandHandler@@MAEXH@Z @ 66 NONAME ; void CGlxMediaListCommandHandler::DoActivateL(int) + ?RetrieveL@GlxAttributeRetriever@@SAHABVMGlxFetchContext@@AAVMGlxMediaList@@H@Z @ 67 NONAME ; int GlxAttributeRetriever::RetrieveL(class MGlxFetchContext const &, class MGlxMediaList &, int) + ?TextStyleIdL@CGlxUiUtility@@QAEHHH@Z @ 68 NONAME ; int CGlxUiUtility::TextStyleIdL(int, int) + ?BypassFiltersForMenu@CGlxMediaListCommandHandler@@MBEHXZ @ 69 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForMenu(void) const + ?ViewingState@CGlxMediaListCommandHandler@@IBE?AW4TViewingState@TCommandInfo@1@XZ @ 70 NONAME ; enum CGlxMediaListCommandHandler::TCommandInfo::TViewingState CGlxMediaListCommandHandler::ViewingState(void) const + ?ShowInfoOnlineL@CGlxDRMUtility@@QAEXAAVTDesC16@@@Z @ 71 NONAME ; void CGlxDRMUtility::ShowInfoOnlineL(class TDesC16 &) + ?Close@CGlxVisualListManager@@QAEXXZ @ 72 NONAME ; void CGlxVisualListManager::Close(void) + ?AddIconToItemL@CGlxIconManager@@UAEXPAVCAlfVisual@@H@Z @ 73 NONAME ; void CGlxIconManager::AddIconToItemL(class CAlfVisual *, int) + ?AllocListL@CGlxVisualListManager@@QAEPAVMGlxVisualList@@AAVMGlxMediaList@@AAVCAlfEnv@@AAVCAlfDisplay@@W4TScaleMode@CAlfImageVisual@@@Z @ 74 NONAME ; class MGlxVisualList * CGlxVisualListManager::AllocListL(class MGlxMediaList &, class CAlfEnv &, class CAlfDisplay &, enum CAlfImageVisual::TScaleMode) + ?RemoveFromItem@CGlxIconManager@@UAEXHH@Z @ 75 NONAME ; void CGlxIconManager::RemoveFromItem(int, int) + ?BrushPositionInVisual@CGlxIconManager@@UAEHHH@Z @ 76 NONAME ; int CGlxIconManager::BrushPositionInVisual(int, int) + ?Env@CGlxUiUtility@@QBEPAVCAlfEnv@@XZ @ 77 NONAME ; class CAlfEnv * CGlxUiUtility::Env(void) const + ?DoDynInitMenuPaneL@CGlxMediaListCommandHandler@@MAEXHPAVCEikMenuPane@@@Z @ 78 NONAME ; void CGlxMediaListCommandHandler::DoDynInitMenuPaneL(int, class CEikMenuPane *) + ?CheckOpenRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 79 NONAME ; int CGlxDRMUtility::CheckOpenRightsL(class TDesC16 const &, int) + ?ScreenFurniture@CGlxUiUtility@@QAEPAVCGlxScreenFurniture@@XZ @ 80 NONAME ; class CGlxScreenFurniture * CGlxUiUtility::ScreenFurniture(void) + ?CreateVisualFromTextureL@CGlxIconManager@@UAEXAAVCAlfTexture@@@Z @ 81 NONAME ; void CGlxIconManager::CreateVisualFromTextureL(class CAlfTexture &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Build information file for command handlers. +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_glxcommandhandlerdrm.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/group/t_glxcommandhandlerdrm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/group/t_glxcommandhandlerdrm.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2008-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: CommandHandlerDRM build information +* +*/ + + + +#include +#include "../../../../../group/glxbuildcommon.mmh" + +TARGET t_glxcommandhandlerdrm.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../src +SOURCE t_glxcommandhandlerdrm.cpp +SOURCE t_glxdummydrmutility.cpp +SOURCE t_glxdummyhuiutility.cpp + +// Sources required by the test suite +SOURCEPATH ../src +SOURCE t_glxcommandhandlerdrm_DllMain.cpp + +SOURCEPATH ../../../commandhandlerdrm/src +SOURCE glxcommandhandlerdrm.cpp +SOURCE glxdrmiconmanager.cpp + +SOURCEPATH ../../../../visuallistmanager/src +SOURCE glxiconmanager.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../commandhandlerdrm/inc + +SOURCEPATH ../../../commandhandlerbase/src +SOURCE glxmedialistcommandhandler.cpp + + +APP_LAYER_SYSTEMINCLUDE + + +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../../../common/inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../../medialists/inc +SYSTEMINCLUDE ../../../../drmutility/inc +SYSTEMINCLUDE ../../../../texturemanager/inc +SYSTEMINCLUDE ../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../visuallistmanager/inc +SYSTEMINCLUDE ../../viewframework/inc + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib + +LIBRARY bafl.lib +LIBRARY ecom.lib +LIBRARY eikcoctl.lib +LIBRARY euser.lib +LIBRARY glxcommon.lib +LIBRARY glxmedialists.lib +LIBRARY hitchcock.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY alfwidgetmodel.lib +LIBRARY glxtexturemanager.lib +LIBRARY alfclient.lib +LIBRARY glxcommandhandlerbase.lib + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/inc/glxdummyvlm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/inc/glxdummyvlm.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: List control unit test +* +*/ + + + + +// INTERNAL INCLUDES + +#include +#include + + +#include +#include + +#include + +// test control +class CTestControl : public CAlfControl + { + public: + static CTestControl* NewL( CAlfEnv& aEnv ) + { + return new (ELeave) CTestControl( aEnv ); + } + CTestControl( CAlfEnv& aEnv ) + // : CAlfControl( aEnv ) + { + } + }; + +// --------------------------------------------------------------------------- + +class CGlxDummyVisualList : public MGlxVisualList + { +public: + + static CGlxDummyVisualList* NewL(); + ~CGlxDummyVisualList(); + +private: // From MGlxVisualList + void ConstructL(); + + TGlxVisualListId Id() const { return TGlxVisualListId(1); } + CAlfVisual* Visual(TInt aListIndex) + { + if( aListIndex == 0 ) + { + return NULL; + } + else + { + return iVisual; + } + } + CGlxVisualObject* Item(TInt /*aListIndex*/) { return NULL; } + TInt ItemCount(NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll) const { return 0; } + TInt FocusIndex() const { return 0; } + CAlfControlGroup* ControlGroup() const { return NULL; } + void AddObserverL(MGlxVisualListObserver* /*aObserver*/) { } + void RemoveObserver(MGlxVisualListObserver* /*aObserver*/) { } + void AddLayoutL(MGlxLayout* /*aLayout*/) { } + void RemoveLayout(const MGlxLayout* /*aLayout*/) { } + TGlxViewContextId AddContextL(TInt /*aFrontVisibleRangeOffset*/, + TInt /*aRearVisibleRangeOffset*/) { return TGlxViewContextId(1); } + void RemoveContext(const TGlxViewContextId& /*aContextId*/) { } + void NavigateL(TInt /*aIndexCount*/) { } + TSize Size() const { return TSize(); } + void BringVisualsToFront() { } + void EnableAnimationL(TBool /*aAnimate*/, TInt /*aIndex*/) { } + /// @ref MGlxVisualList::SetDefaultIconBehaviour + void SetDefaultIconBehaviourL( TBool /*aEnable*/ ) { } + + void AddIconL( TInt , const CAlfTexture& , + NGlxIconMgrDefs::TGlxIconPosition , + TBool , TBool , TInt, TReal32, TReal32 ) { } + + TBool RemoveIcon( TInt , const CAlfTexture& ) { return ETrue; } + + void SetIconVisibility( TInt , const CAlfTexture&, TBool ) { } + +private: + CGlxUiUtility* iUiUtility; + CTestControl* iTestControl; + CAlfImageVisual* iVisual; + }; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxDummyVisualList* CGlxDummyVisualList::NewL() + { + CGlxDummyVisualList* self = new(ELeave)CGlxDummyVisualList(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxDummyVisualList::~CGlxDummyVisualList() + { + delete iTestControl; + + if ( iUiUtility ) + { + iUiUtility->Close(); + } + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxDummyVisualList::ConstructL() + { + iUiUtility = CGlxUiUtility::UtilityL(); + + iTestControl = CTestControl::NewL( *iUiUtility->Env() ); + + // create the visual, ownership goes to iControl + iVisual = CAlfImageVisual::AddNewL( *iTestControl ); + } + + +// ----------------------------------------------------------------------------- +// ManagerL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxVisualListManager* CGlxVisualListManager::ManagerL() + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxVisualListManager::Close() + { + } + +// ----------------------------------------------------------------------------- +// AllocListL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxVisualList* CGlxVisualListManager::AllocListL( + MGlxMediaList& /*aMediaList*/, CAlfEnv& /*aEnv*/, + CAlfDisplay& /*aDisplay*/, + CAlfImageVisual::TScaleMode /*aThumbnailScaleMode*/ ) + { + return CGlxDummyVisualList::NewL(); + } + +// ----------------------------------------------------------------------------- +// ListL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxVisualList* CGlxVisualListManager::ListL( + MGlxMediaList& /*aMediaList*/, CAlfEnv& /*aEnv*/, + CAlfDisplay& /*aDisplay*/, + CAlfImageVisual::TScaleMode /*aThumbnailScaleMode*/ ) + { + return CGlxDummyVisualList::NewL(); + } + +// ----------------------------------------------------------------------------- +// Removes a reference to the list, an deletes it if no more references remain +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxVisualListManager::ReleaseList(MGlxVisualList* aList) + { + delete static_cast(aList); + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/inc/t_glxcommandhandlerdrm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/inc/t_glxcommandhandlerdrm.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCommandHandlerDRM unit test cases +* +*/ + + + + +#ifndef __T_GLXCOMMANDHANDLERDRM_H__ +#define __T_GLXCOMMANDHANDLERDRM_H__ + +// EXTERNAL INCLUDES +#include +#include + +#include +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxCommandHandlerDrm; +class _CGlxTestMediaList; +class CGlxMedia; +class CGlxUiUtility; +NONSHARABLE_CLASS( CGlxCommandHandlerDRMTester): public CBase, + public MGlxMediaListProvider + { +public: + static CGlxCommandHandlerDRMTester* NewL(); + ~CGlxCommandHandlerDRMTester(); + + TBool ExecuteL(TInt aCommand); + + void AddNonProtectedItemL(); + + void AddProtectedItemL(TInt aId, CGlxMedia* aMedia); + + void ForceFocusChangeEventL( TInt aFocus ); + + void ForceHandleAttributeL( TInt aFocus ); + +public: // From MGlxMediaListProvider + virtual MGlxMediaList& MediaList(); + +private: + CGlxCommandHandlerDRMTester(); + void ConstructL(); + +private: + CGlxCommandHandlerDrm* iDRMHandler; + + _CGlxTestMediaList* iMediaList; + + RPointerArray iCommandHandlerList; + + CGlxUiUtility* iDummyUiUtility; + }; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_GlxCommandHandlerDRM ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_GlxCommandHandlerDRM* NewL(); + static T_GlxCommandHandlerDRM* NewLC(); + /** + * Destructor + */ + ~T_GlxCommandHandlerDRM(); + + private: // Constructors and destructors + + T_GlxCommandHandlerDRM(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_CreateL(); + + void T_TestEmptyMediaListL(); + + void T_TestHandleCommandsL(); + + void T_TestHandleFocusChangedL(); + + void T_TestHandleAttributeL(); + + + private: // Data + CGlxCommandHandlerDRMTester* iDRMHandlerTester; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_GLXCOMMANDHANDLERDRM_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/inc/ut_glxdummymedialist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/inc/ut_glxdummymedialist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMediaList unit tests +* +*/ + + + + +// CLASS HEADER +#include + +// +CGlxMedia::CGlxMedia(const TGlxMediaId& aId) + : iId(aId) + { + } + +CGlxMedia::~CGlxMedia() + { + Reset(); + iValues.Close(); + iAttributes.Close(); + + } + +class _CGlxTestMediaList: public CBase, public MGlxMediaList + { +public: + ~_CGlxTestMediaList() + { + iItems.Close(); + iMedia.ResetAndDestroy(); + iSelectedItems.Close(); + iItemListObservers.Close(); + } + + virtual void Close() + { + }; + virtual TGlxMediaListId Id() const + { + return KGlxIdNone; + } + + virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const + { + return iItems.Count(); + } + + virtual TInt FocusIndex() const + { + return iFocusIndex; + } + + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) + { + iFocusIndex = aValue; + } + + virtual const TGlxMedia& Item(TInt aIndex) const + { + return iItems[aIndex]; + } + + virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& aId) const + { + TInt count = iItems.Count(); + for (TInt i = 0; i < count; i++) + { + if (iItems[i].Id() == aId) + { + return i; + } + } + return KErrNotFound; + } + + virtual void AddMediaListObserverL(MGlxMediaListObserver* aObserver) + { + iItemListObservers.AppendL(aObserver); + } + + virtual void RemoveMediaListObserver(MGlxMediaListObserver* aObserver) + { + TInt index = iItemListObservers.Find(aObserver); + + if (index != KErrNotFound) + { + iItemListObservers.Remove(index); + } + } + + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) + { + } + + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) + { + } + + virtual MMPXCollection& Collection() const + { + // we know that this method is not called in our tests, this is just to make the code compile + MMPXCollection* empty = NULL; + return *empty; + } + + virtual TBool IsSelected(TInt aIndex) const + { + TInt idx = iSelectedItems.Find(aIndex); + return (idx != KErrNotFound); + } + + virtual void SetSelectedL(TInt aIndex, TBool aSelected) + { + if (aSelected) + { + iSelectedItems.InsertInOrder(aIndex); + } + else + { + iSelectedItems.Remove(iSelectedItems.Find(aIndex)); + } + } + + virtual const TArray Selection() const + { + return iSelectedItems.Array(); + } + + virtual void CommandL(CMPXCommand& /*aCommand*/) + { + } + + virtual void CancelCommand() + { + } + + virtual void SetFilterL(CMPXFilter* /*aFilter*/) + { + } + + virtual CMPXFilter* Filter() const + { + return NULL; + } + + virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const + { + return KGlxIdNone; + } + + void AppendL(TInt aId, TBool aCreateMedia) + { + if (aCreateMedia) + { + CGlxMedia* media = new (ELeave) CGlxMedia(TGlxMediaId(aId)); + CleanupStack::PushL(media); + iMedia.AppendL(media); + CleanupStack::Pop(media); + iItems.AppendL(TGlxMedia(TGlxMediaId(aId), media)); + } + else + { + iItems.AppendL(TGlxMedia(TGlxMediaId(aId))); + } + + TInt pos = iItems.Count() -1; + + TInt obCount = iItemListObservers.Count(); + for(TInt i = 0; i < obCount; i++) + { + iItemListObservers[i]->HandleItemAddedL(pos, pos, this ); + } + } + + void AppendL(TInt aId, CGlxMedia* aMedia) + { + iMedia.AppendL(aMedia); + iItems.AppendL(TGlxMedia(TGlxMediaId(aId), aMedia)); + + TInt pos = iItems.Count() -1; + + TInt obCount = iItemListObservers.Count(); + for(TInt i = 0; i < obCount; i++) + { + iItemListObservers[i]->HandleItemAddedL(pos, pos, this ); + } + } + + void HandleAttributesAvailableL() + { + RArray attrArray; + TInt obCount = iItemListObservers.Count(); + for(TInt i = 0; i < obCount; i++) + { + iItemListObservers[i]->HandleAttributesAvailableL(0, attrArray, this ); + } + attrArray.Close(); + } + + CGlxMedia* MediaObj(TInt aIndex) const + { + return const_cast(static_cast(iItems[aIndex].Properties())); + } + + CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const + { + return NULL; + } + + TInt SelectionCount() const + { + return iSelectedItems.Count(); + } + + TInt SelectedItemIndex(TInt /*aSelectionIndex*/) const + { + return 0; + } + + TBool IsPopulated() const + { + return ETrue; + } + + void AddStaticItemL( CGlxMedia* /*aStaticItem*/, + NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}; + + void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}; + + void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }; + + TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }; + + void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition){}; + + void ResetFocus(){}; + + void SetVisibleWindowIndexL( TInt aIndex ){}; + TInt VisibleWindowIndex() const {}; + virtual void CancelPreviousRequests() {}; + RArray iItems; + RPointerArray iMedia; + RArray iSelectedItems; + TInt iFocusIndex; + + RPointerArray iItemListObservers; + TBool iStaticItemsEnabled; + }; + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxcommandhandlerdrm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxcommandhandlerdrm.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,430 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCommandHandlerDRM unit test cases +* +*/ + + + + +// CLASS HEADER +#include "t_glxcommandhandlerdrm.h" + +// EXTERNAL INCLUDES +#include +#include + +#include "glxcommandhandlerdrm.h" +#include "ut_glxdummymedialist.h" + +#include + +#include +#include +#include + +#include "glxdummyvlm.h" + +#include + +// INTERNAL INCLUDES + +CGlxCommandHandlerDRMTester* CGlxCommandHandlerDRMTester::NewL() + { + CGlxCommandHandlerDRMTester* self = new(ELeave)CGlxCommandHandlerDRMTester(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CGlxCommandHandlerDRMTester::~CGlxCommandHandlerDRMTester() + { + iDRMHandler->Deactivate(); + + iCommandHandlerList.ResetAndDestroy(); + iCommandHandlerList.Close(); + + delete iMediaList; + } + +TBool CGlxCommandHandlerDRMTester::ExecuteL(TInt aCommand) + { + return iCommandHandlerList[0]->ExecuteL( aCommand ); + } + + +MGlxMediaList& CGlxCommandHandlerDRMTester::MediaList() + { + return *iMediaList; + } + +void CGlxCommandHandlerDRMTester::AddNonProtectedItemL() + { + TGlxMediaId testId(KGlxIdNone); + CGlxMedia* newMedia = new (ELeave) CGlxMedia (testId); + CleanupStack::PushL(newMedia); + iMediaList->AppendL(0, newMedia); + CleanupStack::Pop(newMedia); + } + +void CGlxCommandHandlerDRMTester::AddProtectedItemL(TInt aId, CGlxMedia* aMedia) + { + iMediaList->AppendL(aId, aMedia); + } + +void CGlxCommandHandlerDRMTester::ForceFocusChangeEventL( TInt aFocus ) + { + iMediaList->SetFocusL( NGlxListDefs::EAbsolute, aFocus ); + + // issue focus change event to command handler + iDRMHandler->HandleFocusChangedL( aFocus, 0.0, NULL, + NGlxListDefs::EUnknown); + } + +void CGlxCommandHandlerDRMTester::ForceHandleAttributeL( TInt aFocus ) + { + iMediaList->SetFocusL( NGlxListDefs::EAbsolute, aFocus ); + + iMediaList->HandleAttributesAvailableL(); + } + +CGlxCommandHandlerDRMTester::CGlxCommandHandlerDRMTester() + { + + } + +void CGlxCommandHandlerDRMTester::ConstructL() + { + EUNIT_PRINT(_L("CGlxCommandHandlerDRMTester::ConstructL")); + // create 'dummy' media list + iMediaList = new (ELeave) _CGlxTestMediaList; + + // create our command handler + iDRMHandler = CGlxCommandHandlerDrm::NewL( this, EFalse ); + + iCommandHandlerList.AppendL(iDRMHandler); + + iDRMHandler->ActivateL(0); + } + + +// CONSTRUCTION +T_GlxCommandHandlerDRM* T_GlxCommandHandlerDRM::NewL() + { + T_GlxCommandHandlerDRM* self = T_GlxCommandHandlerDRM::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_GlxCommandHandlerDRM* T_GlxCommandHandlerDRM::NewLC() + { + T_GlxCommandHandlerDRM* self = new( ELeave ) T_GlxCommandHandlerDRM(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_GlxCommandHandlerDRM::~T_GlxCommandHandlerDRM() + { + } + +// Default constructor +T_GlxCommandHandlerDRM::T_GlxCommandHandlerDRM() + { + } + +// Second phase construct +void T_GlxCommandHandlerDRM::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + + REComSession::FinalClose(); + } + +// METHODS + + +void T_GlxCommandHandlerDRM::SetupL( ) + { + EUNIT_PRINT(_L("T_GlxCommandHandlerDRM::SetupL")); + iDRMHandlerTester = CGlxCommandHandlerDRMTester::NewL(); + } + + +void T_GlxCommandHandlerDRM::Teardown( ) + { + delete iDRMHandlerTester; + + REComSession::FinalClose(); + } + + +void T_GlxCommandHandlerDRM::T_CreateL( ) + { + // no implementation + } + +void T_GlxCommandHandlerDRM::T_TestEmptyMediaListL() + { + TBool exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == EFalse, "No items in list not executed "); + } + +void T_GlxCommandHandlerDRM::T_TestHandleCommandsL() + { + MGlxMediaList& mlist = iDRMHandlerTester->MediaList(); + + // test with item, no DRM attribute + iDRMHandlerTester->AddNonProtectedItemL(); + + TBool exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "No DRM attribute "); + + // test with item, DRM attribute set to false + TGlxMediaId testId(0); + CGlxMedia* newMedia = new (ELeave) CGlxMedia(testId); + CleanupStack::PushL(newMedia); + + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + + iDRMHandlerTester->AddProtectedItemL(0, newMedia); + + CleanupStack::Pop(newMedia); + + mlist.SetFocusL(NGlxListDefs::EAbsolute, 1); + + exe = iDRMHandlerTester->ExecuteL( EGlxCmdDRMOpen ); + EUNIT_ASSERT_DESC( exe == ETrue, "DRM attribute false "); + + // test with item, DRM attribute set to true no URI + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "No URI attribute "); + + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + // test with item, DRM attribute set to true no category + exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "No category attribute"); + + // test with video item, DRM attribute set to true + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + newMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "Video"); + + // test with iamge item, DRM attribute set to true no size attr + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "Image"); + + + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + newMedia->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(100,100)); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "Size"); + + newMedia->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(1000,1000)); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "Size"); + + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia->SetTextValueL(KMPXMediaGeneralUri, _L("DRM invalid")); + + newMedia->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(100,100)); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "Size"); + + // test non supported commands + exe = iDRMHandlerTester->ExecuteL(EGlxCmdStateBrowse); + + EUNIT_ASSERT_DESC( exe == EFalse, "Execute fullscreen - command not consumed"); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdStateView); + + EUNIT_ASSERT_DESC( exe == EFalse, "Execute fullscreen - command not consumed"); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdSlideshowPlay); + + EUNIT_ASSERT_DESC( exe == EFalse, "Execute non supported command - command not consumed"); + } + +void T_GlxCommandHandlerDRM::T_TestHandleFocusChangedL() + { + TGlxMediaId testId(12346); + CGlxMedia* newMedia = new (ELeave) CGlxMedia(testId); + CleanupStack::PushL(newMedia); + + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + newMedia->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(100,100)); + + iDRMHandlerTester->AddProtectedItemL(123456, newMedia); + + CleanupStack::Pop(newMedia); + + TGlxMediaId testId2(12347); + CGlxMedia* newMedia2 = new (ELeave) CGlxMedia(testId2); + CleanupStack::PushL(newMedia2); + + newMedia2->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia2->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia2->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + newMedia2->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(100,100)); + + iDRMHandlerTester->AddProtectedItemL(123457, newMedia2); + + CleanupStack::Pop(newMedia2); + + TBool exe = iDRMHandlerTester->ExecuteL(EGlxCmdDRMOpen); + EUNIT_ASSERT_DESC( exe == ETrue, "Execute DRM open"); + + iDRMHandlerTester->ForceFocusChangeEventL(1); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdStateView); + + EUNIT_ASSERT_DESC( exe == EFalse, "Execute fullscreen - command not consumed"); + iDRMHandlerTester->ForceFocusChangeEventL(1); + + exe = iDRMHandlerTester->ExecuteL(EGlxCmdStateBrowse); + + EUNIT_ASSERT_DESC( exe == EFalse, "Execute not fullscreen - command not consumed"); + iDRMHandlerTester->ForceFocusChangeEventL(1); + } + +void T_GlxCommandHandlerDRM::T_TestHandleAttributeL() + { + TGlxMediaId testId(12346); + CGlxMedia* newMedia = new (ELeave) CGlxMedia(testId); + CleanupStack::PushL(newMedia); + + newMedia->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + newMedia->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(100,100)); + + iDRMHandlerTester->AddProtectedItemL(123456, newMedia); + + CleanupStack::Pop(newMedia); + + TGlxMediaId testId2(12347); + CGlxMedia* newMedia2 = new (ELeave) CGlxMedia(testId2); + CleanupStack::PushL(newMedia2); + + newMedia2->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia2->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia2->SetTextValueL(KMPXMediaGeneralUri, _L("DRM valid")); + + newMedia2->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(100,100)); + + iDRMHandlerTester->AddProtectedItemL(123457, newMedia2); + + CleanupStack::Pop(newMedia2); + + iDRMHandlerTester->ForceHandleAttributeL( 1 ); + + TBool exe = iDRMHandlerTester->ExecuteL(EGlxCmdStateView); + + EUNIT_ASSERT_DESC( exe == EFalse, "Execute fullscreen"); + + iDRMHandlerTester->ForceHandleAttributeL( 1 ); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_GlxCommandHandlerDRM, + "Add test suite description here.", + "UNIT" ) + +EUNIT_TEST( + "T_CreateL", + "Create DRM command handler", + "T_CreateL", + "FUNCTIONALITY", + SetupL, T_CreateL, Teardown) + +EUNIT_TEST( + "T_Test1L", + "Test with empty media list", + "T_Test1L", + "FUNCTIONALITY", + SetupL, T_TestEmptyMediaListL, Teardown) + +EUNIT_TEST( + "T_Test2", + "Test command functionality", + "T_Test2L", + "FUNCTIONALITY", + SetupL, T_TestHandleCommandsL, Teardown) + +EUNIT_TEST( + "T_Test3", + "Test response to HandleFocusChangedL", + "T_Test3L", + "FUNCTIONALITY", + SetupL, T_TestHandleFocusChangedL, Teardown) + +EUNIT_TEST( + "T_Test4", + "Test response to HandleAttributesAvailableL", + "T_Test4L", + "FUNCTIONALITY", + SetupL, T_TestHandleAttributeL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxcommandhandlerdrm_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxcommandhandlerdrm_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCommandHandlerDRM unit test application +* +*/ + + + + +// CLASS HEADER +#include "T_GlxCommandHandlerDRM.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_GlxCommandHandlerDRM::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxdummydrmutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxdummydrmutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMediaList unit tests +* +*/ + + + + +// CLASS HEADER +#include +#include + + +_LIT( KGlxDRMValid, "DRM valid"); +_LIT( KGlxDRMHasOnlineInfo, "DRM has info" ); + +void CGlxDRMUtility::Close() + { + delete this; + } + +TBool CGlxDRMUtility::CheckOpenRightsL( const TDesC& aUri, TBool ) + { + TBool rightsInvalid = ETrue; + + if( aUri.Compare( KGlxDRMValid ) == 0 ) + { + rightsInvalid = EFalse; + } + + return rightsInvalid; + } + +TBool CGlxDRMUtility::ConsumeRightsL(const TDesC&) + { + return ETrue; + } + +TBool CGlxDRMUtility::CanShowInfoOnlineL(TDesC& aUri) + { + TBool hasInfo = EFalse; + + if( aUri.Compare( KGlxDRMHasOnlineInfo ) == 0 ) + { + hasInfo = ETrue; + } + + return hasInfo; + } + +void CGlxDRMUtility::ShowInfoOnlineL(TDesC& /*aUri*/) + { + + } + +void CGlxDRMUtility::ShowRightsInfoL(const TDesC&) + { + + } + +TBool CGlxDRMUtility::IsForwardLockedL(const TDesC&) + { + return ETrue; + } + +CGlxDRMUtility* CGlxDRMUtility::InstanceL() + { + CGlxDRMUtility* drm = new(ELeave)CGlxDRMUtility(); + return drm; + } + +TSize CGlxDRMUtility::DRMThumbnailSize(TSize& aSize) + { + return aSize; + } + +CGlxDRMUtility::CGlxDRMUtility() + { + + } + +CGlxDRMUtility::~CGlxDRMUtility() + { + + } + +TInt GlxAttributeRetriever::RetrieveL(const MGlxFetchContext&, MGlxMediaList&, TBool ) + { + return KErrNone; + } + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxdummyhuiutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlerdrm/src/t_glxdummyhuiutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,305 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: HUITK utilities +* +*/ + + + + + +// INCLUDE FILES +#include +//#include +#include +#include +//#include +#include +#include +#include +#include +#include "glxtexturemanager.h" +#include + +#include "glxpanic.h" +#include "glxuiutility.h" +#include "glxuiutilitycoecontrol.h" +#include "glxscreenfurniture.h" + +#include +#include +#include + +// ----------------------------------------------------------------------------- +// UtilityL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxUiUtility* CGlxUiUtility::UtilityL() + { + return CGlxSingletonStore::InstanceL(&NewL); + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::Close() + { + CGlxSingletonStore::Close(this); + //delete this; + } + +// ----------------------------------------------------------------------------- +// 2-phase constructor +// ----------------------------------------------------------------------------- +// +CGlxUiUtility* CGlxUiUtility::NewL() + { + EUNIT_PRINT(_L("CGlxUiUtility::NewL")); + CGlxUiUtility* obj = new (ELeave) CGlxUiUtility(); + CleanupStack::PushL(obj); + obj->ConstructL(); + CleanupStack::Pop(obj); + return obj; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxUiUtility::CGlxUiUtility() +: iNavigationDirection(EGlxNavigationForwards) + { + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxUiUtility::ConstructL() + { + EUNIT_PRINT(_L("Entering CGlxUiUtility::ConstructL")); + iEnv = CAlfEnv::NewL(); + EUNIT_PRINT(_L("CGlxUiUtility::iEnv Created")); + iGlxTextureManager = CGlxTextureManager::NewL(iEnv->TextureManager()); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxUiUtility::~CGlxUiUtility() + { + delete iGlxTextureManager; + + delete iEnv; + iEnv = NULL; + } + +// ----------------------------------------------------------------------------- +// Env +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfEnv* CGlxUiUtility::Env() const + { + return iEnv; + } + +// ----------------------------------------------------------------------------- +// Display +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfDisplay* CGlxUiUtility::Display() const + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// ShowHuiDisplay +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxUiUtility::ShowAlfDisplayL() + { + } + +// ----------------------------------------------------------------------------- +// HideHuiDisplay +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxUiUtility::HideAlfDisplayL() + { + } + +// ----------------------------------------------------------------------------- +// ScreenFurniture +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxScreenFurniture* CGlxUiUtility::ScreenFurniture() + { + return NULL; + } + + +// ----------------------------------------------------------------------------- +// GlxTextureManager +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxTextureManager& CGlxUiUtility::GlxTextureManager() + { + __ASSERT_ALWAYS(iGlxTextureManager, Panic(EGlxPanicLogicError)); + return *iGlxTextureManager; + } + + +// ----------------------------------------------------------------------------- +// ViewNavigationDirection +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection() + { + return iNavigationDirection; + } + + +// ----------------------------------------------------------------------------- +// SetViewNavigationDirection +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::SetViewNavigationDirection(TGlxNavigationDirection /*aDirection*/) + { + } + + + +// ----------------------------------------------------------------------------- +// DisplaySize +// ----------------------------------------------------------------------------- +// +EXPORT_C TSize CGlxUiUtility::DisplaySize() const + { + return TSize(); + } + + +// ----------------------------------------------------------------------------- +// TextStyleIdL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxUiUtility::TextStyleIdL(TInt /*aFontId*/, TInt /*aSizeInPixels*/) + { + TInt id = 0; + return id; + } + +EXPORT_C void CGlxUiUtility::HandleTvStatusChangedL( TTvChangeType /*aChangeType*/ ) + { + + } + +EXPORT_C void CGlxUiUtility:: HandleActionL (const TAlfActionCommand &aActionCommand) + { + + } + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxTextureManager::~CGlxTextureManager() + { + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxTextureManager* CGlxTextureManager::NewL( + CAlfTextureManager& aAlfTextureManager) + { + CGlxTextureManager* self = new (ELeave) CGlxTextureManager(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CreateAvkonIconTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateAvkonIconTextureL( + const TAknsItemID &/*aID*/, + TInt /*aBitmapId*/, + TSize /*aRequestedSize*/) + { + + CAlfTexture* texture = NULL; + return *texture; + } + +// ----------------------------------------------------------------------------- +// CreateIconTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateIconTextureL( + TInt /*aIconResourceId*/, + TDesC& /*aFilename*/, + TSize /*aRequestedSize*/) + { + + CAlfTexture* texture = NULL; //CAlfTexture::NewL(iEnv,0); + return *texture; + } + +// ----------------------------------------------------------------------------- +// CreateThumbnailTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CreateThumbnailTextureL( + TGlxMediaId aMediaId, TGlxIdSpaceId aIdSpaceId, + const TSize& aRequiredSize, MGlxTextureObserver* aObserver, + TInt& aTextureId ) + + { + // Create empty texture (not owned) + CAlfTexture* texture = NULL; //CAlfTexture::NewL(); + return *texture; + } + +// ----------------------------------------------------------------------------- +// CreateZoomedTextureL +// ----------------------------------------------------------------------------- +// + +EXPORT_C CAlfTexture& CreateZoomedTextureL(const TGlxMedia& aMedia, + const TMPXAttribute& aAttribute, + TGlxIdSpaceId aIdSpaceId, + TInt& aTextureId ) + { + // Create empty texture + CAlfTexture* texture = NULL; //CAlfTexture::NewL(); + return *texture; + } + + +// ----------------------------------------------------------------------------- +// RemoveTexture +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxTextureManager::RemoveTexture( + const CAlfTexture& aTexture) + { + } + +EXPORT_C void CGlxTextureManager:: HandleSkinChanged() + { + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/bwins/t_glxcommandhandlermoreinfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/bwins/t_glxcommandhandlermoreinfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,62 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ?MediaList@CGlxMediaListCommandHandler@@IBEABVMGlxMediaList@@XZ @ 2 NONAME ; class MGlxMediaList const & CGlxMediaListCommandHandler::MediaList(void) const + ?ViewNavigationDirection@CGlxUiUtility@@QAE?AW4TGlxNavigationDirection@@XZ @ 3 NONAME ; enum TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection(void) + ?InstanceL@CGlxDRMUtility@@SAPAV1@XZ @ 4 NONAME ; class CGlxDRMUtility * CGlxDRMUtility::InstanceL(void) + ?CanShowInfoOnlineL@CGlxDRMUtility@@QAEHAAVTDesC16@@@Z @ 5 NONAME ; int CGlxDRMUtility::CanShowInfoOnlineL(class TDesC16 &) + ??1CGlxCommandHandlerMoreInfo@@UAE@XZ @ 6 NONAME ; CGlxCommandHandlerMoreInfo::~CGlxCommandHandlerMoreInfo(void) + ?CreateIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@HAAVTDesC16@@VTSize@@@Z @ 7 NONAME ; class CAlfTexture & CGlxTextureManager::CreateIconTextureL(int, class TDesC16 &, class TSize) + ??1CGlxMediaListCommandHandler@@UAE@XZ @ 8 NONAME ; CGlxMediaListCommandHandler::~CGlxMediaListCommandHandler(void) + ?DRMThumbnailSize@CGlxDRMUtility@@QAE?AVTSize@@AAV2@@Z @ 9 NONAME ; class TSize CGlxDRMUtility::DRMThumbnailSize(class TSize &) + ?SelectionLength@CGlxMediaListCommandHandler@@IBEHXZ @ 10 NONAME ; int CGlxMediaListCommandHandler::SelectionLength(void) const + ?CreateThumbnailTextureL@@YAAAVCAlfTexture@@VTGlxMediaId@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTSize@@PAVMGlxTextureObserver@@AAH@Z @ 11 NONAME ; class CAlfTexture & CreateThumbnailTextureL(class TGlxMediaId, class TGlxId, class TSize const &, class MGlxTextureObserver *, int &) + ?CommandInfo@CGlxMediaListCommandHandler@@IAEAAUTCommandInfo@1@H@Z @ 12 NONAME ; struct CGlxMediaListCommandHandler::TCommandInfo & CGlxMediaListCommandHandler::CommandInfo(int) + ?GlxTextureManager@CGlxUiUtility@@QAEAAVCGlxTextureManager@@XZ @ 13 NONAME ; class CGlxTextureManager & CGlxUiUtility::GlxTextureManager(void) + ?Deactivate@CGlxMediaListCommandHandler@@UAEXXZ @ 14 NONAME ; void CGlxMediaListCommandHandler::Deactivate(void) + ?DynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXHPAVCEikMenuPane@@@Z @ 15 NONAME ; void CGlxMediaListCommandHandler::DynInitMenuPaneL(int, class CEikMenuPane *) + ?Close@CGlxDRMUtility@@QAEXXZ @ 16 NONAME ; void CGlxDRMUtility::Close(void) + ?ShowAlfDisplayL@CGlxUiUtility@@SAXXZ @ 17 NONAME ; void CGlxUiUtility::ShowAlfDisplayL(void) + ?HandleActionL@CGlxUiUtility@@UAEXABVTAlfActionCommand@@@Z @ 18 NONAME ; void CGlxUiUtility::HandleActionL(class TAlfActionCommand const &) + ??0TCommandInfo@CGlxMediaListCommandHandler@@QAE@H@Z @ 19 NONAME ; CGlxMediaListCommandHandler::TCommandInfo::TCommandInfo(int) + ?BypassFiltersForExecute@CGlxMediaListCommandHandler@@MBEHXZ @ 20 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForExecute(void) const + ?ConsumeRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 21 NONAME ; int CGlxDRMUtility::ConsumeRightsL(class TDesC16 const &) + ?DoIsDisabled@CGlxMediaListCommandHandler@@MBEHHAAVMGlxMediaList@@@Z @ 22 NONAME ; int CGlxMediaListCommandHandler::DoIsDisabled(int, class MGlxMediaList &) const + ?CreateAvkonIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTAknsItemID@@HVTSize@@@Z @ 23 NONAME ; class CAlfTexture & CGlxTextureManager::CreateAvkonIconTextureL(class TAknsItemID const &, int, class TSize) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 24 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ?HandleTvStatusChangedL@CGlxUiUtility@@UAEXW4TTvChangeType@@@Z @ 25 NONAME ; void CGlxUiUtility::HandleTvStatusChangedL(enum TTvChangeType) + ?AddCommandL@CGlxMediaListCommandHandler@@IAEXABUTCommandInfo@1@@Z @ 26 NONAME ; void CGlxMediaListCommandHandler::AddCommandL(struct CGlxMediaListCommandHandler::TCommandInfo const &) + ?MediaList@CGlxMediaListCommandHandler@@IAEAAVMGlxMediaList@@XZ @ 27 NONAME ; class MGlxMediaList & CGlxMediaListCommandHandler::MediaList(void) + ?Close@CGlxUiUtility@@QAEXXZ @ 28 NONAME ; void CGlxUiUtility::Close(void) + ?NewL@CGlxTextureManager@@SAPAV1@AAVCAlfTextureManager@@@Z @ 29 NONAME ; class CGlxTextureManager * CGlxTextureManager::NewL(class CAlfTextureManager &) + ?IsDisabledL@CGlxMediaListCommandHandler@@IBEHHAAVMGlxMediaList@@@Z @ 30 NONAME ; int CGlxMediaListCommandHandler::IsDisabledL(int, class MGlxMediaList &) const + ?CreateZoomedTextureL@@YAAAVCAlfTexture@@ABVTGlxMedia@@ABVTMPXAttribute@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@AAH@Z @ 31 NONAME ; class CAlfTexture & CreateZoomedTextureL(class TGlxMedia const &, class TMPXAttribute const &, class TGlxId, int &) + ??1CGlxMedia@@UAE@XZ @ 32 NONAME ; CGlxMedia::~CGlxMedia(void) + ?NewL@CGlxCommandHandlerMoreInfo@@SAPAV1@PAVMGlxMediaListProvider@@H@Z @ 33 NONAME ; class CGlxCommandHandlerMoreInfo * CGlxCommandHandlerMoreInfo::NewL(class MGlxMediaListProvider *, int) + ?HandleSkinChanged@CGlxTextureManager@@UAEXXZ @ 34 NONAME ; void CGlxTextureManager::HandleSkinChanged(void) + ?UtilityL@CGlxUiUtility@@SAPAV1@XZ @ 35 NONAME ; class CGlxUiUtility * CGlxUiUtility::UtilityL(void) + ?HideAlfDisplayL@CGlxUiUtility@@SAXXZ @ 36 NONAME ; void CGlxUiUtility::HideAlfDisplayL(void) + ?ExecuteL@CGlxMediaListCommandHandler@@UAEHH@Z @ 37 NONAME ; int CGlxMediaListCommandHandler::ExecuteL(int) + ?DisplaySize@CGlxUiUtility@@QBE?AVTSize@@XZ @ 38 NONAME ; class TSize CGlxUiUtility::DisplaySize(void) const + ?ShowRightsInfoL@CGlxDRMUtility@@QAEXABVTDesC16@@@Z @ 39 NONAME ; void CGlxDRMUtility::ShowRightsInfoL(class TDesC16 const &) + ?IsSupported@CGlxMediaListCommandHandler@@IBEHH@Z @ 40 NONAME ; int CGlxMediaListCommandHandler::IsSupported(int) const + ?GetRequiredAttributesL@CGlxMediaListCommandHandler@@UBEXAAV?$RArray@VTMPXAttribute@@@@HHH@Z @ 41 NONAME ; void CGlxMediaListCommandHandler::GetRequiredAttributesL(class RArray &, int, int, int) const + ?DoActivateL@CGlxMediaListCommandHandler@@MAEXH@Z @ 42 NONAME ; void CGlxMediaListCommandHandler::DoActivateL(int) + ?RemoveTexture@CGlxTextureManager@@QAEXABVCAlfTexture@@@Z @ 43 NONAME ; void CGlxTextureManager::RemoveTexture(class CAlfTexture const &) + ?PreDynInitMenuPaneL@CGlxMediaListCommandHandler@@UAEXH@Z @ 44 NONAME ; void CGlxMediaListCommandHandler::PreDynInitMenuPaneL(int) + ?RetrieveL@GlxAttributeRetriever@@SAHABVMGlxFetchContext@@AAVMGlxMediaList@@H@Z @ 45 NONAME ; int GlxAttributeRetriever::RetrieveL(class MGlxFetchContext const &, class MGlxMediaList &, int) + ?DoGetRequiredAttributesL@CGlxMediaListCommandHandler@@MBEXAAV?$RArray@VTMPXAttribute@@@@H@Z @ 46 NONAME ; void CGlxMediaListCommandHandler::DoGetRequiredAttributesL(class RArray &, int) const + ?TextStyleIdL@CGlxUiUtility@@QAEHHH@Z @ 47 NONAME ; int CGlxUiUtility::TextStyleIdL(int, int) + ?BypassFiltersForMenu@CGlxMediaListCommandHandler@@MBEHXZ @ 48 NONAME ; int CGlxMediaListCommandHandler::BypassFiltersForMenu(void) const + ?ViewingState@CGlxMediaListCommandHandler@@IBE?AW4TViewingState@TCommandInfo@1@XZ @ 49 NONAME ; enum CGlxMediaListCommandHandler::TCommandInfo::TViewingState CGlxMediaListCommandHandler::ViewingState(void) const + ?ShowInfoOnlineL@CGlxDRMUtility@@QAEXAAVTDesC16@@@Z @ 50 NONAME ; void CGlxDRMUtility::ShowInfoOnlineL(class TDesC16 &) + ?CommandInfoIndex@CGlxMediaListCommandHandler@@ABEHH@Z @ 51 NONAME ; int CGlxMediaListCommandHandler::CommandInfoIndex(int) const + ?IsForwardLockedL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 52 NONAME ; int CGlxDRMUtility::IsForwardLockedL(class TDesC16 const &) + ?OfferKeyEventL@CGlxMediaListCommandHandler@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 53 NONAME ; enum TKeyResponse CGlxMediaListCommandHandler::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) + ?Display@CGlxUiUtility@@QBEPAVCAlfDisplay@@XZ @ 54 NONAME ; class CAlfDisplay * CGlxUiUtility::Display(void) const + ??0CGlxMediaListCommandHandler@@QAE@PAVMGlxMediaListProvider@@H@Z @ 55 NONAME ; CGlxMediaListCommandHandler::CGlxMediaListCommandHandler(class MGlxMediaListProvider *, int) + ?Env@CGlxUiUtility@@QBEPAVCAlfEnv@@XZ @ 56 NONAME ; class CAlfEnv * CGlxUiUtility::Env(void) const + ?DoDynInitMenuPaneL@CGlxMediaListCommandHandler@@MAEXHPAVCEikMenuPane@@@Z @ 57 NONAME ; void CGlxMediaListCommandHandler::DoDynInitMenuPaneL(int, class CEikMenuPane *) + ?SetViewNavigationDirection@CGlxUiUtility@@QAEXW4TGlxNavigationDirection@@@Z @ 58 NONAME ; void CGlxUiUtility::SetViewNavigationDirection(enum TGlxNavigationDirection) + ?CheckOpenRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 59 NONAME ; int CGlxDRMUtility::CheckOpenRightsL(class TDesC16 const &, int) + ?ScreenFurniture@CGlxUiUtility@@QAEPAVCGlxScreenFurniture@@XZ @ 60 NONAME ; class CGlxScreenFurniture * CGlxUiUtility::ScreenFurniture(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/eabi/t_glxcommandhandlermoreinfou.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/eabi/t_glxcommandhandlermoreinfou.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,62 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _Z20CreateZoomedTextureLRK9TGlxMediaRK13TMPXAttribute6TGlxIdI17TGlxIdSpaceIdBaseERi @ 2 NONAME + _Z23CreateThumbnailTextureL11TGlxMediaId6TGlxIdI17TGlxIdSpaceIdBaseERK5TSizeP19MGlxTextureObserverRi @ 3 NONAME + _ZN13CGlxUiUtility12TextStyleIdLEii @ 4 NONAME + _ZN13CGlxUiUtility13HandleActionLERK17TAlfActionCommand @ 5 NONAME + _ZN13CGlxUiUtility15HideAlfDisplayLEv @ 6 NONAME + _ZN13CGlxUiUtility15ScreenFurnitureEv @ 7 NONAME + _ZN13CGlxUiUtility15ShowAlfDisplayLEv @ 8 NONAME + _ZN13CGlxUiUtility17GlxTextureManagerEv @ 9 NONAME + _ZN13CGlxUiUtility22HandleTvStatusChangedLE13TTvChangeType @ 10 NONAME + _ZN13CGlxUiUtility23ViewNavigationDirectionEv @ 11 NONAME + _ZN13CGlxUiUtility26SetViewNavigationDirectionE23TGlxNavigationDirection @ 12 NONAME + _ZN13CGlxUiUtility5CloseEv @ 13 NONAME + _ZN13CGlxUiUtility8UtilityLEv @ 14 NONAME + _ZN18CGlxTextureManager13RemoveTextureERK11CAlfTexture @ 15 NONAME + _ZN18CGlxTextureManager17HandleSkinChangedEv @ 16 NONAME + _ZN18CGlxTextureManager18CreateIconTextureLEiR7TDesC165TSize @ 17 NONAME + _ZN18CGlxTextureManager23CreateAvkonIconTextureLERK11TAknsItemIDi5TSize @ 18 NONAME + _ZN18CGlxTextureManager4NewLER18CAlfTextureManager @ 19 NONAME + _ZN26CGlxCommandHandlerMoreInfo4NewLEP21MGlxMediaListProvideri @ 20 NONAME + _ZN26CGlxCommandHandlerMoreInfoD0Ev @ 21 NONAME + _ZN26CGlxCommandHandlerMoreInfoD1Ev @ 22 NONAME + _ZN26CGlxCommandHandlerMoreInfoD2Ev @ 23 NONAME + _ZN27CGlxMediaListCommandHandler10DeactivateEv @ 24 NONAME + _ZN27CGlxMediaListCommandHandler11AddCommandLERKNS_12TCommandInfoE @ 25 NONAME + _ZN27CGlxMediaListCommandHandler11CommandInfoEi @ 26 NONAME + _ZN27CGlxMediaListCommandHandler11DoActivateLEi @ 27 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC1Ei @ 28 NONAME + _ZN27CGlxMediaListCommandHandler12TCommandInfoC2Ei @ 29 NONAME + _ZN27CGlxMediaListCommandHandler14OfferKeyEventLERK9TKeyEvent10TEventCode @ 30 NONAME + _ZN27CGlxMediaListCommandHandler16DynInitMenuPaneLEiP12CEikMenuPane @ 31 NONAME + _ZN27CGlxMediaListCommandHandler18DoDynInitMenuPaneLEiP12CEikMenuPane @ 32 NONAME + _ZN27CGlxMediaListCommandHandler19PreDynInitMenuPaneLEi @ 33 NONAME + _ZN27CGlxMediaListCommandHandler8ExecuteLEi @ 34 NONAME + _ZN27CGlxMediaListCommandHandler9MediaListEv @ 35 NONAME + _ZN27CGlxMediaListCommandHandlerC2EP21MGlxMediaListProvideri @ 36 NONAME + _ZN27CGlxMediaListCommandHandlerD0Ev @ 37 NONAME + _ZN27CGlxMediaListCommandHandlerD1Ev @ 38 NONAME + _ZN27CGlxMediaListCommandHandlerD2Ev @ 39 NONAME + _ZNK13CGlxUiUtility11DisplaySizeEv @ 40 NONAME + _ZNK13CGlxUiUtility3EnvEv @ 41 NONAME + _ZNK13CGlxUiUtility7DisplayEv @ 42 NONAME + _ZNK27CGlxMediaListCommandHandler11IsDisabledLEiR13MGlxMediaList @ 43 NONAME + _ZNK27CGlxMediaListCommandHandler11IsSupportedEi @ 44 NONAME + _ZNK27CGlxMediaListCommandHandler12DoIsDisabledEiR13MGlxMediaList @ 45 NONAME + _ZNK27CGlxMediaListCommandHandler12ViewingStateEv @ 46 NONAME + _ZNK27CGlxMediaListCommandHandler15SelectionLengthEv @ 47 NONAME + _ZNK27CGlxMediaListCommandHandler16CommandInfoIndexEi @ 48 NONAME + _ZNK27CGlxMediaListCommandHandler20BypassFiltersForMenuEv @ 49 NONAME + _ZNK27CGlxMediaListCommandHandler22GetRequiredAttributesLER6RArrayI13TMPXAttributeEiii @ 50 NONAME + _ZNK27CGlxMediaListCommandHandler23BypassFiltersForExecuteEv @ 51 NONAME + _ZNK27CGlxMediaListCommandHandler24DoGetRequiredAttributesLER6RArrayI13TMPXAttributeEi @ 52 NONAME + _ZNK27CGlxMediaListCommandHandler9MediaListEv @ 53 NONAME + _ZTI13CGlxUiUtility @ 54 NONAME ; ## + _ZTI27CGlxMediaListCommandHandler @ 55 NONAME ; ## + _ZTV13CGlxUiUtility @ 56 NONAME ; ## + _ZTV27CGlxMediaListCommandHandler @ 57 NONAME ; ## + _ZThn4_N13CGlxUiUtility22HandleTvStatusChangedLE13TTvChangeType @ 58 NONAME ; ## + _ZThn4_N18CGlxTextureManager17HandleSkinChangedEv @ 59 NONAME ; ## + _ZThn8_N13CGlxUiUtility13HandleActionLERK17TAlfActionCommand @ 60 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Build information file for commandhandlermoreinfo +* +*/ + + + + +PRJ_PLATFORMS + ARMV5 GCCE WINSCW + +PRJ_EXPORTS + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +t_glxcommandhandlermoreinfo.mmp + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/group/t_glxcommandhandlermoreinfo.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/group/t_glxcommandhandlermoreinfo.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2008-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: CommandHandlermoreinfo build information +* +*/ + + + +#include +#include "../../../../../group/glxbuildcommon.mmh" + +TARGET t_glxcommandhandlermoreinfo.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../src +SOURCE t_glxcommandhandlermoreinfo.cpp + +// Sources required by the test suite +SOURCEPATH ../src +SOURCE t_glxcommandhandlermoreinfo_DllMain.cpp + +SOURCEPATH ../../ut_commandhandlerdrm/src +SOURCE t_glxdummydrmutility.cpp + +SOURCEPATH ../../../commandhandlermoreinfo/src +SOURCE glxcommandhandlermoreinfo.cpp + +SOURCEPATH ../../ut_commandhandlerdrm/src +SOURCE t_glxdummyhuiutility.cpp + +SOURCEPATH ../../../commandhandlerbase/src +SOURCE glxmedialistcommandhandler.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../commandhandlermoreinfo/inc +USERINCLUDE ../../ut_commandhandlerdrm/inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../../inc +SYSTEMINCLUDE ../../../inc + +SYSTEMINCLUDE ../../../commandhandlerbase/inc +SYSTEMINCLUDE ../../../../medialists/inc +SYSTEMINCLUDE ../../../../drmutility/inc +SYSTEMINCLUDE ../../../../texturemanager/inc +SYSTEMINCLUDE ../../../../uiutilities/inc +SYSTEMINCLUDE ../../../../../common/inc + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib + +LIBRARY eikcoctl.lib +LIBRARY euser.lib +LIBRARY glxcommon.lib +LIBRARY glxmedialists.lib +LIBRARY hitchcock.lib +LIBRARY mpxcommon.lib +LIBRARY glxuiutilities.lib +LIBRARY glxdrmutility.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY alfwidgetmodel.lib +LIBRARY glxtexturemanager.lib +LIBRARY alfclient.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/inc/t_glxcommandhandlermoreinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/inc/t_glxcommandhandlermoreinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCommandHandlerMoreInfo unit test cases +* +*/ + + + + +#ifndef __T_GLXCOMMANDHANDLERMOREINFO_H__ +#define __T_GLXCOMMANDHANDLERMOREINFO_H__ + +// EXTERNAL INCLUDES +#include +#include + +#include +#include +#include +#include + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxCommandHandlerMoreInfo; +class _CGlxTestMediaList; +class CGlxMedia; +NONSHARABLE_CLASS( CGlxCommandHandlerMoreInfoTester): public CBase, + public MGlxMediaListProvider + { +public: + static CGlxCommandHandlerMoreInfoTester* NewL(); + ~CGlxCommandHandlerMoreInfoTester(); + + TBool ExecuteL(TInt aCommand); + + void AddItemL(TInt aId, CGlxMedia* aMedia); + + +public: // From MGlxMediaListProvider + virtual MGlxMediaList& MediaList(); + +private: + CGlxCommandHandlerMoreInfoTester(); + void ConstructL(); + +private: + CGlxCommandHandlerMoreInfo* iMoreInfoHandler; + + _CGlxTestMediaList* iMediaList; + + RPointerArray iCommandHandlerList; + }; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_glxcommandhandlermoreinfo ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_glxcommandhandlermoreinfo* NewL(); + static t_glxcommandhandlermoreinfo* NewLC(); + /** + * Destructor + */ + ~t_glxcommandhandlermoreinfo(); + + private: // Constructors and destructors + + t_glxcommandhandlermoreinfo(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_TestL(); + + void T_TestExecutionL(); + + + private: // Data + CGlxCommandHandlerMoreInfoTester* iTester; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_GLXCOMMANDHANDLERMOREINFO_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/src/t_glxcommandhandlermoreinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/src/t_glxcommandhandlermoreinfo.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCommandHandlerMoreInfo unit test cases +* +*/ + + + + +// CLASS HEADER +#include "t_glxcommandhandlermoreinfo.h" +#include "glxcommandhandlermoreinfo.h" +#include "ut_glxdummymedialist.h" + +#include +#include +#include + +// EXTERNAL INCLUDES +#include +#include + + +CGlxCommandHandlerMoreInfoTester* CGlxCommandHandlerMoreInfoTester::NewL() + { + CGlxCommandHandlerMoreInfoTester* self = new(ELeave)CGlxCommandHandlerMoreInfoTester(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CGlxCommandHandlerMoreInfoTester::~CGlxCommandHandlerMoreInfoTester() + { + iMoreInfoHandler->Deactivate(); + + iCommandHandlerList.ResetAndDestroy(); + iCommandHandlerList.Close(); + + delete iMediaList; + } + +TBool CGlxCommandHandlerMoreInfoTester::ExecuteL(TInt aCommand) + { + return iCommandHandlerList[0]->ExecuteL( aCommand ); + } + +void CGlxCommandHandlerMoreInfoTester::AddItemL(TInt aId, CGlxMedia* aMedia) + { + iMediaList->AppendL(aId, aMedia); + } + + +MGlxMediaList& CGlxCommandHandlerMoreInfoTester::MediaList() + { + return *iMediaList; + } + + +CGlxCommandHandlerMoreInfoTester::CGlxCommandHandlerMoreInfoTester() + { + + } + +void CGlxCommandHandlerMoreInfoTester::ConstructL() + { + EUNIT_PRINT(_L("CGlxCommandHandlerMoreInfoTester::ConstructL")); + // create 'dummy' media list + iMediaList = new (ELeave) _CGlxTestMediaList; + + // create our command handler + iMoreInfoHandler = CGlxCommandHandlerMoreInfo::NewL( this, EFalse ); + + iCommandHandlerList.AppendL( iMoreInfoHandler ); + + iMoreInfoHandler->ActivateL(0); + } + + +// CONSTRUCTION +t_glxcommandhandlermoreinfo* t_glxcommandhandlermoreinfo::NewL() + { + t_glxcommandhandlermoreinfo* self = t_glxcommandhandlermoreinfo::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_glxcommandhandlermoreinfo* t_glxcommandhandlermoreinfo::NewLC() + { + t_glxcommandhandlermoreinfo* self = new( ELeave ) t_glxcommandhandlermoreinfo(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +t_glxcommandhandlermoreinfo::~t_glxcommandhandlermoreinfo() + { + } + +// Default constructor +t_glxcommandhandlermoreinfo::t_glxcommandhandlermoreinfo() + { + } + +// Second phase construct +void t_glxcommandhandlermoreinfo::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void t_glxcommandhandlermoreinfo::SetupL( ) + { + iTester = CGlxCommandHandlerMoreInfoTester::NewL(); + } + + +void t_glxcommandhandlermoreinfo::Teardown( ) + { + delete iTester; + iTester = NULL; + } + + +void t_glxcommandhandlermoreinfo::T_TestL( ) + { + + } + +void t_glxcommandhandlermoreinfo::T_TestExecutionL() + { + MGlxMediaList& mlist = iTester->MediaList(); + + // try to exe on empty list + TBool exe = iTester->ExecuteL(EGlxCmdDrmMoreInfoOnline); + EUNIT_ASSERT_DESC( exe == EFalse, "No items present, option should be disabled"); + + // create a couple of media items + TGlxMediaId testId(12346); + CGlxMedia* newMedia = new (ELeave) CGlxMedia(testId); + CleanupStack::PushL(newMedia); + + + iTester->AddItemL(123456, newMedia); + + CleanupStack::Pop(newMedia); + + TGlxMediaId testId2(12347); + CGlxMedia* newMedia2 = new (ELeave) CGlxMedia(testId2); + CleanupStack::PushL(newMedia2); + + newMedia2->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + newMedia2->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + newMedia2->SetTextValueL(KMPXMediaGeneralUri, _L("DRM has info")); + + iTester->AddItemL(123457, newMedia2); + + CleanupStack::Pop(newMedia2); + + mlist.SetFocusL(NGlxListDefs::EAbsolute, 0); + + exe = iTester->ExecuteL(EGlxCmdDrmMoreInfoOnline); + EUNIT_ASSERT_DESC( exe == EFalse, "Non DRM item, option should be disabled"); + + mlist.SetFocusL(NGlxListDefs::EAbsolute, 1); + + exe = iTester->ExecuteL(EGlxCmdDrmMoreInfoOnline); + EUNIT_ASSERT_DESC( exe == ETrue, "Valid item"); + + newMedia2->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + exe = iTester->ExecuteL(EGlxCmdDrmMoreInfoOnline); + EUNIT_ASSERT_DESC( exe == EFalse, "Non DRM item, option should be disabled"); + + newMedia2->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + newMedia2->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + + exe = iTester->ExecuteL(EGlxCmdDrmMoreInfoOnline); + EUNIT_ASSERT_DESC( exe == EFalse, "Video, option should be disabled"); + + newMedia2->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + newMedia2->SetTextValueL(KMPXMediaGeneralUri, _L("No info!")); + + EUNIT_ASSERT_DESC( exe == EFalse, "No info"); + + exe = iTester->ExecuteL(EGlxCmdUpload); + EUNIT_ASSERT_DESC( exe == EFalse, "Unsupported command"); + } + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_glxcommandhandlermoreinfo, + "Add test suite description here.", + "UNIT" ) + +EUNIT_TEST( + "Test0", + "Test command handler construction, activation, deactivation", + "Test0", + "FUNCTIONALITY", + SetupL, T_TestL, Teardown) + +EUNIT_TEST( + "Test1", + "Test command execution", + "Test1", + "FUNCTIONALITY", + SetupL, T_TestExecutionL, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/src/t_glxcommandhandlermoreinfo_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/tsrc/ut_commandhandlermoreinfo/src/t_glxcommandhandlermoreinfo_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCommandHandlerMoreInfo unit test application +* +*/ + + + + +// CLASS HEADER +#include "t_glxcommandhandlermoreinfo.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_glxcommandhandlermoreinfo::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/bwins/glxdataprovideru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/bwins/glxdataprovideru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +EXPORTS + ??0TGlxMulBindingSetFactory@@IAE@XZ @ 1 NONAME ; TGlxMulBindingSetFactory::TGlxMulBindingSetFactory(void) + ??1CGlxDetailsMulModelProvider@@UAE@XZ @ 2 NONAME ; CGlxDetailsMulModelProvider::~CGlxDetailsMulModelProvider(void) + ??1CGlxMediaListMulModelProvider@@UAE@XZ @ 3 NONAME ; CGlxMediaListMulModelProvider::~CGlxMediaListMulModelProvider(void) + ??1TGlxMulBindingSetFactory@@MAE@XZ @ 4 NONAME ; TGlxMulBindingSetFactory::~TGlxMulBindingSetFactory(void) + ?AddCommandBindingL@TGlxMulBindingSetFactory@@IBEXPAVMGlxBoundCommand@@@Z @ 5 NONAME ; void TGlxMulBindingSetFactory::AddCommandBindingL(class MGlxBoundCommand *) const + ?AddContainerListBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@ABVCMPXCollectionPath@@@Z @ 6 NONAME ; void TGlxMulBindingSetFactory::AddContainerListBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class CMPXCollectionPath const &) const + ?AddEntryL@CGlxDetailsMulModelProvider@@QAEXABVTGlxMulBindingSetFactory@@@Z @ 7 NONAME ; void CGlxDetailsMulModelProvider::AddEntryL(class TGlxMulBindingSetFactory const &) + ?AddFullScreenThumbnailBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@@Z @ 8 NONAME ; void TGlxMulBindingSetFactory::AddFullScreenThumbnailBindingL(enum Alf::mulvisualitem::TVisualAttribute const &) const + ?AddIconBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@PBVCGlxMulIconProvider@@ABVTSize@@@Z @ 9 NONAME ; void TGlxMulBindingSetFactory::AddIconBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class CGlxMulIconProvider const *, class TSize const &) const + ?AddMpxAttributeBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@ABVTMPXAttribute@@H@Z @ 10 NONAME ; void TGlxMulBindingSetFactory::AddMpxAttributeBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class TMPXAttribute const &, int) const + ?AddPreviewThumbnailBindingL@TGlxMulBindingSetFactory@@IBEXXZ @ 11 NONAME ; void TGlxMulBindingSetFactory::AddPreviewThumbnailBindingL(void) const + ?AddStringBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@H@Z @ 12 NONAME ; void TGlxMulBindingSetFactory::AddStringBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, int) const + ?AddTemplateBindingL@TGlxMulBindingSetFactory@@IBEXW4TLogicalTemplate@mulwidget@Alf@@0@Z @ 13 NONAME ; void TGlxMulBindingSetFactory::AddTemplateBindingL(enum Alf::mulwidget::TLogicalTemplate, enum Alf::mulwidget::TLogicalTemplate) const + ?AddThumbnailBindingL@TGlxMulBindingSetFactory@@IBEXABW4TVisualAttribute@mulvisualitem@Alf@@ABVTSize@@@Z @ 14 NONAME ; void TGlxMulBindingSetFactory::AddThumbnailBindingL(enum Alf::mulvisualitem::TVisualAttribute const &, class TSize const &) const + ?EnableMskL@CGlxDetailsMulModelProvider@@QAEXXZ @ 15 NONAME ; void CGlxDetailsMulModelProvider::EnableMskL(void) + ?HideLocationMenuItem@CGlxDetailsMulModelProvider@@QAEXAAVCEikMenuPane@@@Z @ 16 NONAME ; void CGlxDetailsMulModelProvider::HideLocationMenuItem(class CEikMenuPane &) + ?InitMenuL@CGlxDetailsMulModelProvider@@QAEXAAVCEikMenuPane@@@Z @ 17 NONAME ; void CGlxDetailsMulModelProvider::InitMenuL(class CEikMenuPane &) + ?NewL@CGlxAlbumsBoundCommand@@SAPAV1@XZ @ 18 NONAME ; class CGlxAlbumsBoundCommand * CGlxAlbumsBoundCommand::NewL(void) + ?NewL@CGlxAttributeRequirements@@SAPAV1@AAVMGlxMediaList@@@Z @ 19 NONAME ; class CGlxAttributeRequirements * CGlxAttributeRequirements::NewL(class MGlxMediaList &) + ?NewL@CGlxDateAndTimeBoundCommand@@SAPAV1@XZ @ 20 NONAME ; class CGlxDateAndTimeBoundCommand * CGlxDateAndTimeBoundCommand::NewL(void) + ?NewL@CGlxDescriptionBoundCommand@@SAPAV1@XZ @ 21 NONAME ; class CGlxDescriptionBoundCommand * CGlxDescriptionBoundCommand::NewL(void) + ?NewL@CGlxDetailsMulModelProvider@@SAPAV1@AAVCAlfEnv@@AAVIMulWidget@Alf@@AAVMGlxMediaList@@W4TLogicalTemplate@mulwidget@4@H@Z @ 22 NONAME ; class CGlxDetailsMulModelProvider * CGlxDetailsMulModelProvider::NewL(class CAlfEnv &, class Alf::IMulWidget &, class MGlxMediaList &, enum Alf::mulwidget::TLogicalTemplate, int) + ?NewL@CGlxDurationBoundCommand@@SAPAV1@XZ @ 23 NONAME ; class CGlxDurationBoundCommand * CGlxDurationBoundCommand::NewL(void) + ?NewL@CGlxFileSizeBoundCommand@@SAPAV1@XZ @ 24 NONAME ; class CGlxFileSizeBoundCommand * CGlxFileSizeBoundCommand::NewL(void) + ?NewL@CGlxLocationBoundCommand@@SAPAV1@XZ @ 25 NONAME ; class CGlxLocationBoundCommand * CGlxLocationBoundCommand::NewL(void) + ?NewL@CGlxMediaListMulModelProvider@@SAPAV1@AAVCAlfEnv@@AAVIMulWidget@Alf@@AAVMGlxMediaList@@ABVTGlxMulBindingSetFactory@@W4TLogicalTemplate@mulwidget@4@H@Z @ 26 NONAME ; class CGlxMediaListMulModelProvider * CGlxMediaListMulModelProvider::NewL(class CAlfEnv &, class Alf::IMulWidget &, class MGlxMediaList &, class TGlxMulBindingSetFactory const &, enum Alf::mulwidget::TLogicalTemplate, int) + ?NewL@CGlxMulDRMIconProvider@@SAPAV1@XZ @ 27 NONAME ; class CGlxMulDRMIconProvider * CGlxMulDRMIconProvider::NewL(void) + ?NewL@CGlxMulDriveIconProvider@@SAPAV1@XZ @ 28 NONAME ; class CGlxMulDriveIconProvider * CGlxMulDriveIconProvider::NewL(void) + ?NewL@CGlxMulLocationIconProvider@@SAPAV1@XZ @ 29 NONAME ; class CGlxMulLocationIconProvider * CGlxMulLocationIconProvider::NewL(void) + ?NewL@CGlxMulStaticIconProvider@@SAPAV1@H@Z @ 30 NONAME ; class CGlxMulStaticIconProvider * CGlxMulStaticIconProvider::NewL(int) + ?NewL@CGlxMulVideoIconProvider@@SAPAV1@H@Z @ 31 NONAME ; class CGlxMulVideoIconProvider * CGlxMulVideoIconProvider::NewL(int) + ?NewL@CGlxResolutionBoundCommand@@SAPAV1@XZ @ 32 NONAME ; class CGlxResolutionBoundCommand * CGlxResolutionBoundCommand::NewL(void) + ?NewL@CGlxTagsBoundCommand@@SAPAV1@XZ @ 33 NONAME ; class CGlxTagsBoundCommand * CGlxTagsBoundCommand::NewL(void) + ?NewL@CGlxTitleBoundCommand@@SAPAV1@XZ @ 34 NONAME ; class CGlxTitleBoundCommand * CGlxTitleBoundCommand::NewL(void) + ?NewL@CGlxUsageRightsBoundCommand@@SAPAV1@XZ @ 35 NONAME ; class CGlxUsageRightsBoundCommand * CGlxUsageRightsBoundCommand::NewL(void) + ?OfferCommandL@CGlxDetailsMulModelProvider@@QAEHH@Z @ 36 NONAME ; int CGlxDetailsMulModelProvider::OfferCommandL(int) + ?SetDetailsDailogObserver@CGlxDetailsMulModelProvider@@QAEXAAVMGlxMetadataDialogObserver@@@Z @ 37 NONAME ; void CGlxDetailsMulModelProvider::SetDetailsDailogObserver(class MGlxMetadataDialogObserver &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/eabi/glxdataprovideru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/eabi/glxdataprovideru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +EXPORTS + _ZN20CGlxTagsBoundCommand4NewLEv @ 1 NONAME + _ZN21CGlxTitleBoundCommand4NewLEv @ 2 NONAME + _ZN22CGlxAlbumsBoundCommand4NewLEv @ 3 NONAME + _ZN22CGlxMulDRMIconProvider4NewLEv @ 4 NONAME + _ZN24CGlxDurationBoundCommand4NewLEv @ 5 NONAME + _ZN24CGlxFileSizeBoundCommand4NewLEv @ 6 NONAME + _ZN24CGlxLocationBoundCommand4NewLEv @ 7 NONAME + _ZN24CGlxMulDriveIconProvider4NewLEv @ 8 NONAME + _ZN24CGlxMulVideoIconProvider4NewLEi @ 9 NONAME + _ZN24TGlxMulBindingSetFactoryC2Ev @ 10 NONAME + _ZN24TGlxMulBindingSetFactoryD0Ev @ 11 NONAME + _ZN24TGlxMulBindingSetFactoryD1Ev @ 12 NONAME + _ZN24TGlxMulBindingSetFactoryD2Ev @ 13 NONAME + _ZN25CGlxAttributeRequirements4NewLER13MGlxMediaList @ 14 NONAME + _ZN25CGlxMulStaticIconProvider4NewLEi @ 15 NONAME + _ZN26CGlxResolutionBoundCommand4NewLEv @ 16 NONAME + _ZN27CGlxDateAndTimeBoundCommand4NewLEv @ 17 NONAME + _ZN27CGlxDescriptionBoundCommand4NewLEv @ 18 NONAME + _ZN27CGlxDetailsMulModelProvider10EnableMskLEv @ 19 NONAME + _ZN27CGlxDetailsMulModelProvider13OfferCommandLEi @ 20 NONAME + _ZN27CGlxDetailsMulModelProvider20HideLocationMenuItemER12CEikMenuPane @ 21 NONAME + _ZN27CGlxDetailsMulModelProvider24SetDetailsDailogObserverER26MGlxMetadataDialogObserver @ 22 NONAME + _ZN27CGlxDetailsMulModelProvider4NewLER7CAlfEnvRN3Alf10IMulWidgetER13MGlxMediaListNS2_9mulwidget16TLogicalTemplateEi @ 23 NONAME + _ZN27CGlxDetailsMulModelProvider9AddEntryLERK24TGlxMulBindingSetFactory @ 24 NONAME + _ZN27CGlxDetailsMulModelProvider9InitMenuLER12CEikMenuPane @ 25 NONAME + _ZN27CGlxDetailsMulModelProviderD0Ev @ 26 NONAME + _ZN27CGlxDetailsMulModelProviderD1Ev @ 27 NONAME + _ZN27CGlxDetailsMulModelProviderD2Ev @ 28 NONAME + _ZN27CGlxMulLocationIconProvider4NewLEv @ 29 NONAME + _ZN27CGlxUsageRightsBoundCommand4NewLEv @ 30 NONAME + _ZN29CGlxMediaListMulModelProvider4NewLER7CAlfEnvRN3Alf10IMulWidgetER13MGlxMediaListRK24TGlxMulBindingSetFactoryNS2_9mulwidget16TLogicalTemplateEi @ 31 NONAME + _ZNK24TGlxMulBindingSetFactory15AddIconBindingLERKN3Alf13mulvisualitem16TVisualAttributeEPK19CGlxMulIconProviderRK5TSize @ 32 NONAME + _ZNK24TGlxMulBindingSetFactory17AddStringBindingLERKN3Alf13mulvisualitem16TVisualAttributeEi @ 33 NONAME + _ZNK24TGlxMulBindingSetFactory18AddCommandBindingLEP16MGlxBoundCommand @ 34 NONAME + _ZNK24TGlxMulBindingSetFactory19AddTemplateBindingLEN3Alf9mulwidget16TLogicalTemplateES2_ @ 35 NONAME + _ZNK24TGlxMulBindingSetFactory20AddThumbnailBindingLERKN3Alf13mulvisualitem16TVisualAttributeERK5TSize @ 36 NONAME + _ZNK24TGlxMulBindingSetFactory23AddMpxAttributeBindingLERKN3Alf13mulvisualitem16TVisualAttributeERK13TMPXAttributei @ 37 NONAME + _ZNK24TGlxMulBindingSetFactory24AddContainerListBindingLERKN3Alf13mulvisualitem16TVisualAttributeERK18CMPXCollectionPath @ 38 NONAME + _ZNK24TGlxMulBindingSetFactory27AddPreviewThumbnailBindingLEv @ 39 NONAME + _ZNK24TGlxMulBindingSetFactory30AddFullScreenThumbnailBindingLERKN3Alf13mulvisualitem16TVisualAttributeE @ 40 NONAME + _ZTI24TGlxMulBindingSetFactory @ 41 NONAME ; ## + _ZTI25CGlxAttributeRequirements @ 42 NONAME ; ## + _ZTV24TGlxMulBindingSetFactory @ 43 NONAME ; ## + _ZTV25CGlxAttributeRequirements @ 44 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Build info file for glxdataprovider.dll + * +*/ + + + +PRJ_MMPFILES +dataprovider.mmp + +PRJ_TESTMMPFILES +// Medialist stub +//../tsrc/medialists/group/testglxmedialists.mmp +//../tsrc/ui_commandbinding/group/ui_commandbinding.mmp + +PRJ_EXPORTS + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/group/dataprovider.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/group/dataprovider.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxdataprovider.dll + * +*/ + + + + +#include +#include +#include "../../../inc/glxalfhelper.mmh" + + +TARGET glxdataprovider.dll +TARGETTYPE DLL +UID 0x1000008d 0x200104DA + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src + +SOURCE glxbinding.cpp +SOURCE glxbindingset.cpp +SOURCE glxdetailsmulmodelprovider.cpp +SOURCE glxdetailsmulmodelproviderimpl.cpp +SOURCE glxmedialistmulmodelprovider.cpp +SOURCE glxmedialistmulmodelproviderimpl.cpp +SOURCE glxmulbindingsetfactory.cpp +SOURCE glxmulmodelproviderbase.cpp +SOURCE glxthumbnailvarianttype.cpp +SOURCE glxmuliconprovider.cpp +SOURCE glxdetailsboundcommand.cpp +SOURCE glxcommandbindingutility.cpp +SOURCE glxattributerequirement.cpp +SOURCE glxpreviewthumbnailbinding.cpp +SOURCE glxcontainerlistbinding.cpp + + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../uiutilities/inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../texturemanager/inc +SYSTEMINCLUDE ../../drmutility/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../medialists/inc +SYSTEMINCLUDE ../../../commonui/inc +SYSTEMINCLUDE ../../../common/inc +SYSTEMINCLUDE ../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../commandhandlers/inc +SYSTEMINCLUDE ../../views/metadatadialog/inc // Error Id EMPY-7MKDHP + + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY alfclient.lib // MAlfWidgetFactory +LIBRARY alfwidgetutils.lib +LIBRARY alfwidgetmodel.lib // AlfWidgetEnvExtension +LIBRARY commonengine.lib // String Loader +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY eikcoctl.lib // CEikMenuPane +LIBRARY efsrv.lib // RFs +LIBRARY lbs.lib // TCoordinate +LIBRARY mpxcommon.lib // CMPXCollectionPath +LIBRARY mulmodelutility.lib // For Usting converter +LIBRARY osncore.lib // CAlfString +LIBRARY glxmedialists.lib // MGlxMediaList +LIBRARY platformenv.lib +LIBRARY glxtexturemanager.lib // CGlxTextureManager +LIBRARY glxuiutilities.lib // CGlxUiUtility::TextureManager +LIBRARY libstdcpp.lib +LIBRARY glxlogging.lib +LIBRARY glxdrmutility.lib //for Drm Utility +LIBRARY glxcommoncommandhandlers.lib +LIBRARY glxcommonui.lib //For CGlxCommandHandlerAddToContainer +LIBRARY glxcommon.lib +LIBRARY flogger.lib +LIBRARY exiflib.lib //For CExifModify +LIBRARY avkon.lib eikcore.lib // For AknUtils.h +// End of File + \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxattributerequirement.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxattributerequirement.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: set the required attribute to the medialist +* +*/ + + + + +#ifndef _GLXATTRIBUTEREQUIREMENT_H__ +#define _GLXATTRIBUTEREQUIREMENT_H__ + +#include // Fetch context to retrieve thumbnails +#include // Fetch context to retrieve thumbnails +#include // for Fetch contexts n the list in a non-sequential order + +#include // Interface for reading lists of media items + +/** + * CGlxAttributeRequirements + * This class will set the required attribute to the medialist + */ +class CGlxAttributeRequirements: public CBase + { + +private: + void ConstructL(); +public: + + /** + * NewL + * @param aMediaList the list to which attributes will be set + */ + IMPORT_C static CGlxAttributeRequirements* NewL( MGlxMediaList& aMediaList ) ; + + /** + * NewLC + * @param aMediaList the list to which attributes will be set + */ + static CGlxAttributeRequirements*NewLC( MGlxMediaList& aMediaList ) ; + + /** + * Default constructor + * @param aMediaList the list to which attributes will be set + */ + CGlxAttributeRequirements( MGlxMediaList& aMediaList ); + + /** + * Destructor + */ + ~CGlxAttributeRequirements(); + + /** + * AddAttributeL + * @param aAttribute + */ + void AddAttributeL( const TMPXAttribute& aAttribute ); + + /** + * AddThumbnailL + * @todo + */ + void AddThumbnailL( const TSize& aSize ); + + /** + * SetIteratorIndex + * @todo + */ + void SetIteratorIndex( TInt aIndex ); + + +private: + + // medialist to which attribute is set + MGlxMediaList& iMediaList; + + TGlxFromFocusOutwardIterator iFromFocusOutwardIterator; + TGlxFromManualIndexBlockyIterator iBlockyIterator; + //RArray iArributeContext; + RPointerArray iArributeContext; + RPointerArray iThumbnailContext; + + TGlxFromFocusOutwardIterator iFsFromFocusOutwardIterator; + + //Context variable to keep track of Fullscreenthumbnail requests + //When the context is already created, upon orientation change, only the Default spec + //will be changed, rather than adding a new context + //This is done to prioritize fetching of current orientation thumbnail + CGlxThumbnailContext* iFsThumbnailContext; + }; + + +#endif //_GLXATTRIBUTEREQUIREMENT_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxbinding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxbinding.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,530 @@ +/* +* Copyright (c) 2008-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: bindings required to populate the visual item +* +*/ + + + + +#ifndef _GLXBINDING_H_ +#define _GLXBINDING_H_ + +#include "glxattributerequirement.h" // class will set the required attribute to the medialist +#include // Fetch context to retrieve thumbnails +#include // Fetch context to retrieve thumbnails +#include // Interface for going through items in the list +#include // lib mpxcommon.lib +#include // Observes for changes in media list +#include // which attributes should be fetched +#include "glxuiutility.h" // lib glxalfutils.lib +#include // Client need to use this class to add data in data model +#include +// Forward Declaration +class CMPXCollectionPath; // Encapsulates a 'bookmark' to a specific collection entry +class CGlxMulIconProvider; // Icon details +class MGlxMediaList; // lib glxmedialists.lib +class MGlxBindingObserver; // Notifies that binding has changed +class MGlxBoundCommand; // Handles user commands +class TGlxMedia; // media item in the item pool + +namespace Alf + { + class IAlfVariantType; // lib alfwidgetmodel.lib + class MulVisualItem; // Client need to use this class to add data in data model + } + +namespace osncore + { + class UString; // encapsulates utf-8 encoded string + } + +/** +* CGlxBinding +* The binding is created by the binding set factory. +* This class holds the bindings required to populate the visual item. +*/ +NONSHARABLE_CLASS( CGlxBinding ) : public CBase + { +public: + /** + * Virtual Destructor + */ + virtual ~CGlxBinding(); + + /** + * PopulateT populates the visual item with the data from the media item + * @param aItem Visual item to be populated + * @param aMedia Media item + * @param aIsFocused the item is focused or not + */ + /// T for "throws" (instead of L for "leaves") + virtual void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const = 0; + + /** + * HasRelevantAttributes Checks whether the attribute is relevent to the context + * @param aAttrbutes MPX attributes + */ + virtual TBool HasRelevantAttributes( const RArray< TMPXAttribute >& aAttributes ) const; + + enum TResponse + { + ENoUpdateNeeded , + EUpdateRequested + }; + + /** + * HandleFocusChanged handles the focus change events + * @param aIsGained + * @param aPath + */ + virtual TResponse HandleFocusChanged( TBool aIsGained ); + + + virtual void HandleItemChangedL(const CMPXCollectionPath& aPath ); + + + + /** + * SetObserver setting the binding observer + * @param aObserver Binding observer + */ + // only to be called by CGlxBindingSet + void SetObserver( MGlxBindingObserver& aObserver ); + + /** + * adding fetch context to medialist + * @param aAttributeRequirement + */ + virtual void AddRequestL( CGlxAttributeRequirements& + aAttributeRequirement,TSize aSize); + +protected: + /** + * Update informs the observer that binding has changed + */ + void Update(); + +private: + /// From Binding observer + MGlxBindingObserver* iObserver; + }; + +/** + * CGlxTemplateBinding + * The binding is created by the binding set factory. + * This class holds the template information when there is editable + * template and changing the template when the focus moves away + */ +NONSHARABLE_CLASS( CGlxTemplateBinding ): public CGlxBinding + { + +public: + + /** + * Two phase constructor + * @param aTemplate + * @param aFocusedTemplate + */ + static CGlxTemplateBinding* NewL( + Alf::mulwidget::TLogicalTemplate aTemplate, + Alf::mulwidget::TLogicalTemplate aTemplateWhenFocused); + + /** + * Two phase constructor + * @param aTemplate + * @param aFocusedTemplate + */ + static CGlxTemplateBinding* NewLC( + Alf::mulwidget::TLogicalTemplate aTemplate, + Alf::mulwidget::TLogicalTemplate aTemplateWhenFocused); + + /** + * Destructor + */ + ~CGlxTemplateBinding(); + +private: + + // From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + + /** + * @todo + */ + TResponse HandleFocusChanged( TBool aIsGained ); + + void HandleItemChangedL(const CMPXCollectionPath& aPath ); + +private: + Alf::mulwidget::TLogicalTemplate iTemplate; + Alf::mulwidget::TLogicalTemplate iFocusedTemplate; + }; + +// ---------------------------------------------------------------------------- + +/** + * CGlxSingleTagBinding + * Base class for bindings that provide the value for a single mul tag + */ +NONSHARABLE_CLASS( CGlxSingleTagBinding ) : public CGlxBinding + { +public: + /** + * Constructor + */ + CGlxSingleTagBinding(); + + /** + * Destructor + */ + ~CGlxSingleTagBinding(); + +protected: + /** + * Constructs single tag binding + * @param aMulTag The mul field that MPX attribute is mapped to + */ + void BaseConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/ ); + + /** + * Returns the MUL field + */ + //const osncore::UString& MulTag() const; + Alf::mulvisualitem::TVisualAttribute MulTag() const; + +private: + /// Stores the MUL field + //osncore::UString* iMulTag; + Alf::mulvisualitem::TVisualAttribute iMulTag; + }; + +// ---------------------------------------------------------------------------- + +/** + * CGlxStringBinding + * This class holds all string bindings required to populate the visual item + */ +NONSHARABLE_CLASS( CGlxStringBinding ) : public CGlxSingleTagBinding + { +public: + + /** + * Two phase Construction + * @param aMulTag The mul field that MPX attribute is mapped to + * @param aStringId The MPX attribute + */ + static CGlxStringBinding* NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, + TInt aStringId ); + /** + * Two phase Construction + * @param aMulTag The mul field that MPX attribute is mapped to + * @param aStringId + */ + static CGlxStringBinding* NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + TInt aStringId ); + + /** + * Two phase Construction + * @param aMulTag The mul field that MPX attribute is mapped to + * @param aString + */ + static CGlxStringBinding* NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, + const char* const aString ); + + /** + * Two phase Construction + * @param aMulTag The mul field that MPX attribute is mapped to + * @param aString + */ + static CGlxStringBinding* NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, + const char* const aString ); + + /** + * Destructor + */ + ~CGlxStringBinding(); + + /** + * Destructor + */ + CGlxStringBinding(); + +protected: + + /** + * Two phase Construction + * Converts the symbian types to Ustring + */ + void ConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, TInt aStringId ); + + /** + * Two phase Construction + */ + void ConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, const char* const aString ); + +private: + /// From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + +private: + /// Holds MPX data + HBufC* iStringBuffer; + }; + +// ---------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxMpxAttributeBinding ) : public CGlxSingleTagBinding + { +public: + + /** + * Two phase Construction + * @param aMulTag The mul field that MPX attribute is mapped to + * @param aAttribute MPX attribute name + */ + static CGlxMpxAttributeBinding* NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, + const TMPXAttribute& aAttribute, TInt aFormatStringId ); + + /** + * Two phase Construction + * @param aMulTag The mul field that MPX attribute is mapped to + * @param aAttribute MPX attribute name + */ + static CGlxMpxAttributeBinding* NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, + const TMPXAttribute& aAttribute, TInt aFormatStringId ); + + // From CGlxBinding + void AddRequestL( CGlxAttributeRequirements& aAttributeRequirement ,TSize aSize); + +protected: + + /** + * Two phase Construction + */ + void ConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/ ); + +private: + + /** + * Constructor + * @param aAttribute MPX attribute name + */ + CGlxMpxAttributeBinding( const TMPXAttribute& aAttribute, TInt aFormatStringId ); + // From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + + /** + * HasRelevantAttributes + * @param aAttribute MPX attribute name + */ + TBool HasRelevantAttributes( const RArray< TMPXAttribute >& aAttributes ) const; + + /** + * HandleFocusChanged + * @param aIsGained holds the focus change status + * @param aPath source path to the collection + */ + TResponse HandleFocusChanged( TBool aIsGained ); + + void HandleItemChangedL(const CMPXCollectionPath& aPath ); + +private: + /// stores the MPX attribute + const TMPXAttribute iAttribute; + TInt iFormatStringId; + + }; + +// ---------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxThumbnailBinding ) : public CGlxSingleTagBinding + { +public: + + /** + * Two phase construction + * @param aMulTag The mul field that MPX attribute is mapped to + */ + static CGlxThumbnailBinding* NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TSize& aSize ); + + /** + * Two phase construction + * @param aMulTag The mul field that MPX attribute is mapped to + */ + static CGlxThumbnailBinding* NewLC(const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TSize& aSize ); + + /** + * Destructor + */ + ~CGlxThumbnailBinding(); + + /** + * Constructor + */ + CGlxThumbnailBinding( const TSize& aSize ); + + // From CGlxBinding + void AddRequestL(CGlxAttributeRequirements& aAttributeRequirement,TSize aSize); + + TResponse HandleFocusChanged( TBool aIsGained ); + +private: // From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + + /** + * HasRelevantAttributes + * @param aAttribute MPX attribute name + */ + TBool HasRelevantAttributes( const RArray< TMPXAttribute >& aAttributes ) const; + +private: + TSize iThumbnailSize; + }; + + // ---------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxFullScreenThumbnailBinding ) : public CGlxSingleTagBinding + { +public: + + /** + * Two phase construction + * @param aMulTag The mul field that MPX attribute is mapped to + */ + static CGlxFullScreenThumbnailBinding* NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/); + + /** + * Two phase construction + * @param aMulTag The mul field that MPX attribute is mapped to + */ + static CGlxFullScreenThumbnailBinding* NewLC(const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/ ); + + /** + * Destructor + */ + ~CGlxFullScreenThumbnailBinding(); + + /** + * Constructor + */ + CGlxFullScreenThumbnailBinding( ); + + // From CGlxBinding + void AddRequestL(CGlxAttributeRequirements& aAttributeRequirement,TSize aSize); + + TResponse HandleFocusChanged( TBool aIsGained ); + +private: // From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + + /** + * HasRelevantAttributes + * @param aAttribute MPX attribute name + */ + TBool HasRelevantAttributes( const RArray< TMPXAttribute >& aAttributes ) const; + +private: + // The size of the thumbnails in fullscreen + TSize iFullScreenThumbnailSize; + }; + +// ---------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxIconBinding ) : public CGlxSingleTagBinding + { +public: + + /** + * Constructor + * @param aAttribute MPX attribute name + */ + CGlxIconBinding( const CGlxMulIconProvider* aIconProvider , const TSize& aSize); + + /** + * Two phase construction + * @param aMulTag The mul field that icon from resource file is mapped to + */ + static CGlxIconBinding* NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CGlxMulIconProvider* aIconProvider, const TSize& aSize ); + + /** + * Two phase construction + * @param aMulTag The mul field that icon from resource file is mapped to + */ + static CGlxIconBinding* NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CGlxMulIconProvider* aIconProvider, const TSize& aSize ); + + /** + * Destructor + */ + ~CGlxIconBinding(); + +private: // From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + +private: + const CGlxMulIconProvider* iIconProvider; + + TSize iIconSize; + }; + +// ---------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxCommandBinding ) : public CGlxSingleTagBinding + { +public: + + /** + * Two phase construction + * @param aCommand MGlxBoundCommand is mapped to + * aCommand must be topmost in cleanup stack. This function will pop it. + */ + static CGlxCommandBinding* NewL ( MGlxBoundCommand* aCommand ); + + /** + * Two phase construction + * @param aCommand MGlxBoundCommand is mapped to + */ + static CGlxCommandBinding* NewLC( MGlxBoundCommand* aCommand ); // takes ownership + + /** + * Constructor + */ + CGlxCommandBinding(); + + /** + * Destructor + */ + ~CGlxCommandBinding(); + +private: +// From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + +private: + MGlxBoundCommand* iCommand; + }; +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxbindingset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxbindingset.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2008-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: bindings required to populate the visual item +* +*/ + + + + +#ifndef _GLXBINDINGSET_H_ +#define _GLXBINDINGSET_H_ + +#include // Container Base Class +#include "glxbinding.h" // holds the bindings required to populate the visual item +#include "mglxbindingobserver.h" // Notifies that binding has changed + +class TGlxMedia; // media item in the item pool + +namespace Alf + { + class MulVisualItem; // Client need to use this class to add data in data model + } + +class CGlxAttributeRequirements; // class will set the required attribute to the medialist + +/** + * CGlxBindingSet + * The binding set is created by the binding set factory. + * This basically holds the bindings required to populate the visual item. + */ +NONSHARABLE_CLASS( CGlxBindingSet ) : public CGlxBinding, public MGlxBindingObserver + { +public: + /** + * Two phase construction + * @param aObserver Observes binding + */ + static CGlxBindingSet* NewLC( MGlxBindingObserver& aObserver ); + + /** + *Destructor + */ + ~CGlxBindingSet(); + + /** + * Adds the bindings to the binding set + * @param aBinding The binding to be added to the binding set : owned + */ + void AddBindingL( CGlxBinding* aBinding ); + + // From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + TBool HasRelevantAttributes( const RArray< TMPXAttribute >& aAttributes ) const; + + TResponse HandleFocusChanged( TBool aIsGained ); + + void HandleItemChangedL(const CMPXCollectionPath& aPath ); + /** + * Adds the fetch context to medialist + * @param aAttributeRequirement The object that sets the attribute to medialist + */ + void AddRequirementsL( CGlxAttributeRequirements& aAttributeRequirement,TSize aSize); + +private: + /** + * Constructor + * @param aObserver Observes binding + */ + CGlxBindingSet( MGlxBindingObserver& aObserver ); + + // From MGlxBindingObserver + void HandleBindingChanged( const CGlxBinding& aBinding ); + +private: + // Binding Observer + MGlxBindingObserver& iObserver; + + // Array of Binding-Bindingset + RPointerArray< CGlxBinding > iBindings; + + }; + +#endif // _GLXBINDINGSET_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxcommandbindingutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxcommandbindingutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2008-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: collect binding handling here +* +*/ + + + + +#ifndef _GLXCOMMANDVARIANTTYPE_H_ +#define _GLXCOMMANDVARIANTTYPE_H_ + +#include // Container Base Class +#include // create data for data model + +//Forward declaration +class MGlxBoundCommand; // Handles user commands + +namespace Alf + { + class MulVisualItem; // Client need to use this class to add data in data model + } + +/** + * CommandVariantType + */ +NONSHARABLE_CLASS( CommandVariantType ) : public Alf::MulVariantType + { +public: + + /** + * Constructor + */ + CommandVariantType( MGlxBoundCommand& aCommand ); + + /** + * Command + * @return MGlxBoundCommand the command binded + */ + MGlxBoundCommand& Command() const; + + /** + * Destructor + */ + ~CommandVariantType(); + +private: + // From MulVariantType + /** Should not be called, but in case of misbehaving model code */ + int integer() const; + + TMulType Type() const; + + std::auto_ptr< IMulVariantType > Clone(); + +private: + MGlxBoundCommand& iCommand; + }; + +/** + * GlxCommandBindingUtility + * collect binding handling here, so that nasty command attribute (tag) name usage remains in one class + */ +NONSHARABLE_CLASS( GlxCommandBindingUtility ) + { +public: + + /** + * SetT + * set the binding for the visual item + * @param MulVisualItem the visual item + * @param aCommand MGlxBoundCommand to set for visual item + */ + static void SetT( Alf::MulVisualItem& aItem, MGlxBoundCommand& aCommand ); + + /** + * Get + * Get BoundCommand for a visual item + * @param MulVisualItem the visual item + * @return MGlxBoundCommand + * returns NULL if command value was not added + */ + static MGlxBoundCommand* Get( const Alf::MulVisualItem& aItem ); + }; + +#endif // _GLXCOMMANDVARIANTTYPE_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxcontainerlistbinding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxcontainerlistbinding.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2008-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: CGlxContainerListBinding This class holds the list of +* tags/albums associated with a media item +* +*/ + + + + +#ifndef _GLXCONTAINERLISTBINDING_H_ +#define _GLXCONTAINERLISTBINDING_H_ + +#include // Container Base Class +#include // lib mpxcommon.lib +#include // Observes for changes in media list +#include "glxattributecontext.h" // Fetch context to retrieve thumbnails +#include "glxbinding.h" // holds the bindings required to populate the visual item +#include "glxustringconverter.h" // class that converts the symbian types to UString type + +class CMPXCollectionPath; // mpxcommon.lib +class CGlxAttributeContext; // Fetch context to retrieve thumbnails +class MGlxMediaList; // lib glxmedialists.lib +class TGlxMedia; // media item in the item pool + +namespace Alf + { + class IAlfVariantType; // lib alfwidgetmodel.lib + class MulVisualItem; // Client need to use this class to add data in data model + } + +namespace osncore + { + class UString; // encapsulates utf-8 encoded string + } + +/** + * CGlxContainerListBinding This class holds the list of tags/albums associated with a media item + */ +NONSHARABLE_CLASS( CGlxContainerListBinding ) : public CGlxSingleTagBinding, + public MGlxMediaListObserver + { +public: + + /** + * NewL Two phase construction + */ + static CGlxContainerListBinding* NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CMPXCollectionPath& aPath ); + + /** + * NewLC Two phase construction + */ + static CGlxContainerListBinding* NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CMPXCollectionPath& aPath ); + + /** + * Destructor + */ + ~CGlxContainerListBinding(); + +private: + + /** + * ConstructL Two phase construction + */ + void ConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, const CMPXCollectionPath& aPath ); + + // From MGlxMediaListObserver + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ) ; + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ) ; + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ) ; + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + + // From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + + /** + * Create media list + * @ param aMediaId media id for creating filtered media list + */ + void CreateMediaListL(TGlxMediaId aMedia) const; + + /** + * Close media list + */ + void CloseMediaList(); + + /** + * HandleFocusChanged + * @param aIsGained holds the focus change status + * @param aPath source path to the collection + */ + TResponse HandleFocusChanged( TBool aIsGained ); + +private: + + //Medialist that holds the list of tags/albums + mutable MGlxMediaList* iContainerList; + + //Fetch context to get the attributes + CGlxDefaultAttributeContext* iFetchContext; + + // collection path from which to fetch the attribute + CMPXCollectionPath* iContainerPath; + + TGlxSequentialIterator iIterator; + + }; + +#endif //_GLXCONTAINERLISTBINDING_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxdetailsboundcommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxdetailsboundcommand.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,533 @@ +/* +* Copyright (c) 2008-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: Command Binding Class +* +*/ + + + + +#ifndef _GLXDETAILSBOUNDCOMMAND_H_ +#define _GLXDETAILSBOUNDCOMMAND_H_ + +#include // helper class for extending CEikMenuPaneItem without breaking binary +#include // Interface to allow a class that owns a media list to share access to it + +class CGlxCommandHandlerAddToContainer; // Command handler for adding to a container +class CAknAppUi; +/** Error Id EMPY-7MKDHP **/ +class MGlxMetadataDialogObserver ; // call back to details dailog + +/** + * MGlxBoundCommand + */ +class MGlxBoundCommand + { +public: + /** + * Destructor + */ + virtual ~MGlxBoundCommand() {}; + + /** + * OfferCommandL + * Handles user commands + * @param aCommandId the command need to handle + */ + virtual TBool OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist) = 0; + + /** + * InitMenuL + * Initialises a menu pane + * @param aMenu representation of the menu pane + */ + virtual void InitMenuL( CEikMenuPane& aMenu ) const = 0; + + /** + * HideLocationMenuItem + * Hides Location Menu option + * @param aMenu representation of the menu pane + */ + virtual void HideLocationMenuItem( CEikMenuPane& aMenu ) const = 0; + + + /** + * Close the MGlxBoundCommand object. + */ + virtual void Close() = 0; + + /** + * Changes the Middle softkey command. + */ + virtual void ChangeMskL() = 0; + + /** + * Sets the Dailogs Observer + */ + /** Error Id EMPY-7MKDHP **/ + virtual void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ) = 0; + + }; + +/** + * CGlxTitleBoundCommand + */ +NONSHARABLE_CLASS( CGlxTitleBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + + /** + * Two phase construction + */ + IMPORT_C static CGlxTitleBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxTitleBoundCommand* NewLC(); + + /** + * Destructor + */ + ~CGlxTitleBoundCommand(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId ,MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); + /** + * ModifyTitleL + * @param aData new title to be modified + */ + void ModifyTitleL(const TDesC& aData ); + +private://data + + MGlxMediaList* iMedialist; + + }; + +/** + * CGlxTagsBoundCommand + */ +NONSHARABLE_CLASS( CGlxTagsBoundCommand ) : public CBase, public MGlxBoundCommand, public MGlxMediaListProvider + { +public: + + /** + * Two phase construction + */ + IMPORT_C static CGlxTagsBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxTagsBoundCommand* NewLC(); + + /** + *ConstructL + */ + void ConstructL(); + + /** + * Destructor + */ + ~CGlxTagsBoundCommand(); + + /** + *SetMediaList + *@param aMedialist medialist + */ + void SetMediaList(MGlxMediaList* aMedialist); + + //From MGlxMediaListProvider + MGlxMediaList& MediaList(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId, MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); +private: + CGlxCommandHandlerAddToContainer* iAddToTag; //own + MGlxMediaList* iMedialist; + }; + +/** + * CGlxDescriptionBoundCommand + */ +NONSHARABLE_CLASS( CGlxDescriptionBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + + /** + * Two phase construction + */ + IMPORT_C static CGlxDescriptionBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxDescriptionBoundCommand* NewLC(); + + /** + * Destructor + */ + ~CGlxDescriptionBoundCommand(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); + /** + * ModifyDescriptionL + * @param aData new description to be modified + */ + void ModifyDescriptionL(const TDesC& aData ); + +private: + MGlxMediaList* iMedialist; + + }; + +/** + * CGlxLocationBoundCommand + */ +NONSHARABLE_CLASS( CGlxLocationBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + + /** + * Two phase construction + */ + IMPORT_C static CGlxLocationBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxLocationBoundCommand* NewLC(); + + /** + * Destructor + */ + ~CGlxLocationBoundCommand(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + + /** + * RemoveLocationL + * removes location information of an image + */ + void RemoveLocationL(); + + /** + * SetDetailsDailogObserver + * Sets detail dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver(MGlxMetadataDialogObserver& aObserver) ; + +private: + MGlxMediaList* iMedialist; + + /// The AppUI. Not owned + CAknAppUi* iAppUi; + + TBool iOnNaviKeySelect; + + MGlxMetadataDialogObserver* iDialogObserver ; + }; + + +/** + * CGlxAlbumsBoundCommand + */ +NONSHARABLE_CLASS( CGlxAlbumsBoundCommand ) : public CBase, public MGlxBoundCommand, public MGlxMediaListProvider + { +public: + + /** + * Two phase construction + */ + IMPORT_C static CGlxAlbumsBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxAlbumsBoundCommand* NewLC(); + + /** + *ConstructL + */ + void ConstructL(); + + /** + * Destructor + */ + ~CGlxAlbumsBoundCommand(); + + /** + *SetMediaList + *@param aMedialist medialist + */ + void SetMediaList(MGlxMediaList* aMedialist); + + //From MGlxMediaListProvider + MGlxMediaList& MediaList(); + +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId, MGlxMediaList& aMedialist ); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); +private: + CGlxCommandHandlerAddToContainer* iAddToAlbum; //own + MGlxMediaList* iMedialist; + + }; + + +/** + * CGlxResolutionBoundCommand + */ +NONSHARABLE_CLASS( CGlxResolutionBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + /** + * Two phase construction + */ + IMPORT_C static CGlxResolutionBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxResolutionBoundCommand* NewLC(); + + /** + * Destructor + */ + ~CGlxResolutionBoundCommand(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt /*aCommandId*/ , MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& /*aMenu*/ ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); + }; + +/** + * CGlxUsageRightsBoundCommand + */ +NONSHARABLE_CLASS( CGlxDurationBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + /** + * Two phase construction + */ + IMPORT_C static CGlxDurationBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxDurationBoundCommand* NewLC(); + /** + * Destructor + */ + ~CGlxDurationBoundCommand(); + +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt /*aCommandId*/ , MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& /*aMenu*/ ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); + }; + + +/** + * CGlxUsageRightsBoundCommand + */ +NONSHARABLE_CLASS( CGlxUsageRightsBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + /** + * Two phase construction + */ + IMPORT_C static CGlxUsageRightsBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxUsageRightsBoundCommand* NewLC(); + + /** + * SetMediaList + * @param aMedialist medialist + */ + void SetMediaList(MGlxMediaList* aMedialist); + + /** + * MediaList + * @return MGlxMediaList main medialist + */ + MGlxMediaList& MediaList(); + + /** + * Destructor + */ + ~CGlxUsageRightsBoundCommand(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); + /** + * Launches the DRM view associated with the media. + */ + void LaunchDRMViewL(); + +private: + MGlxMediaList* iMedialist; + + }; + +/** + * CGlxDateAndTimeBoundCommand + */ +NONSHARABLE_CLASS( CGlxDateAndTimeBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + /** + * Two phase construction + */ + IMPORT_C static CGlxDateAndTimeBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxDateAndTimeBoundCommand* NewLC(); + + /** + * Destructor + */ + ~CGlxDateAndTimeBoundCommand(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); + }; + +/** + * CGlxFileSizeBoundCommand + */ +NONSHARABLE_CLASS( CGlxFileSizeBoundCommand ) : public CBase, public MGlxBoundCommand + { +public: + /** + * Two phase construction + */ + IMPORT_C static CGlxFileSizeBoundCommand* NewL(); + + /** + * Two phase construction + */ + static CGlxFileSizeBoundCommand* NewLC(); + + /** + * Destructor + */ + ~CGlxFileSizeBoundCommand(); +private: + // From MGlxBoundCommand + TBool OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist); + void InitMenuL( CEikMenuPane& aMenu ) const; + void HideLocationMenuItem( CEikMenuPane& aMenu ) const; + void Close(); + void ChangeMskL(); + /** + * SetDetailsDailogObserver + * @param aObserver details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ); + }; + +#endif // _GLXDETAILSBOUNDCOMMAND_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxdetailsboundcommand.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxdetailsboundcommand.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-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: Command Id's +* +*/ + + + + +#ifndef _GLXBINDING_HRH_ +#define _GLXBINDING_HRH_ + + +enum TProviderMenuCommandIds + { + KGlxEditBoundMenuCommandId = 300000, // need a big number to avoid clash + KGlxDeleteBoundMenuCommandId, + KGlxViewBoundMenuCommandId, + KGlxShowOnMapMenuCommandId, + KGlxHelpBoundMenuCommandId, + KGlxNullBoundMenuCommandId + }; + +#define EMetaControlIdSettingList KAknCtLastControlId + 1 +#define EMetaDataDialogListBox KAknCtLastControlId + 2 + +#define ENameItem 0 +#define EDescriptionItem 1 +#define EAlbumsItem 2 +#define ETagsItem 3 +#define EDateAndTimeItem 4 +#define ELocationItem 5 +#define ESizeItem 6 +#define EResolutionItem 7 +#define EDurationItem 8 +#define ElicenseItem 9 + + +#define EImgVwrNameItem 0 +#define EImgVwrDescriptionItem 1 +#define EImgVwrDateAndTimeItem 2 +#define EImgVwrSizeItem 3 +#define EImgVwrResolutionItem 4 +#define EImgVwrlicenseItem 5 + +#define EShwCmdSettingsChange 0x6000 +#define EShwCmdHelp 0x6001 +#define EShwCmdExit 0x6002 +#define KMaxTransDelay 15 +#define KMinTransDelay 2 +#define KTransDelayStep 1 + + +#endif // _GLXBINDING_HRH_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxdetailsmulmodelprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxdetailsmulmodelprovider.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2008-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: Abstraction for details data provider +* +*/ + + + + +#ifndef _GLXDETAILSMULMODELPROVIDER_H_ +#define _GLXDETAILSMULMODELPROVIDER_H_ + +#include // Container Base Class +#include "mglxmedialist.h" // lib glxmedialists.lib +#include + +// Forward declarations +class CAlfEnv; // This is the UI Accelerator Toolkit environment object +class CEikMenuPane; // Menu panes are opened by activating the menu title +class CGlxDetailsMulModelProviderImpl; // mplementation class of details data provider +class TGlxMulBindingSetFactory; // Binding set Factory object +/** Error Id EMPY-7MKDHP **/ +class MGlxMetadataDialogObserver ; // call back to details dailog + +namespace Alf + { + class IMulWidget; // An interface for all Multimedia widgets + } + +/** + * CGlxDetailsMulModelProvider + * This class provides the necessary abstraction of the details provider + * the implementation is provided by CGlxDetailsMulModelProviderImpl class + */ +NONSHARABLE_CLASS( CGlxDetailsMulModelProvider ) : public CBase + { +public: + + /** + * Constructor + * @param aEnv Env variable of ALF + * @param aWidget Alf Widget type + * @param aMediaList medialist from which attributes to be fetched + * @param aDefaultTemplate Template that will be set to model + */ + IMPORT_C static CGlxDetailsMulModelProvider* NewL( CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ); + + /** ConstructL + * @param aEnv Env variable of ALF + * @param aWidget Alf Widget type + * @param aMediaList medialist from which attributes to be fetched + * @param aDefaultTemplate Template that will be set to model + */ + void ConstructL( + CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize); + + /** + * Destructor + */ + IMPORT_C ~CGlxDetailsMulModelProvider(); + + /** + * This Api is called from client with the required factory instance + * This will be called as many number of times as the number of items present in details view + * @param aFactory factory instance + */ + IMPORT_C void AddEntryL( const TGlxMulBindingSetFactory& aFactory ); + + /** + * OfferCommandL + * This will be called from view whenever there is an event (for example: navi key pressed ) + * @param aCommandId Id of the command that is about to be executed + */ + IMPORT_C TBool OfferCommandL( TInt aCommandId ); + + /** + * InitMenuL + * This will determine what options to be present in menu pane + * @param aMenu The menu pane to edit + */ + IMPORT_C void InitMenuL( CEikMenuPane& aMenu ); + + /** + * HideLocationMenuItem + * @param aMenu The menu pane to edit + */ + IMPORT_C void HideLocationMenuItem( CEikMenuPane& aMenu ); + + /** + * EnableMskL + * This will determine which Middle softkey has to be displayed + */ + IMPORT_C void EnableMskL(); + + /** + * Set Details Dailog Observer + * @param aMenu The menu pane to edit + */ + /** Error Id EMPY-7MKDHP **/ + IMPORT_C void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ) ; + +private: + + // Implemented class instance: owns + CGlxDetailsMulModelProviderImpl* iImpl; + }; + +#endif // _GLXDETAILSMULMODELPROVIDER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxdetailsmulmodelproviderimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxdetailsmulmodelproviderimpl.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation class for details data provider +* +*/ + + + + +#ifndef _GLXDETAILSMULMODELPROVIDERIMPL_H_ +#define _GLXDETAILSMULMODELPROVIDERIMPL_H_ + +#include "glxmulmodelproviderbase.h" // Dataprovider base +#include "mglxbindingobserver.h" // Notifies that binding has changed + +// Forward declarations +class TGlxMulBindingSetFactory; // Create binding set +class CGlxAttributeRequirements; // This class will set the required attribute to the medialist +class CAlfEnv; // This is the UI Accelerator Toolkit environment object +class CEikMenuPane; // Menu panes are opened by activating the menu title +class CGlxBinding; // This class holds the bindings required to populate the visual item +/** Error Id EMPY-7MKDHP **/ +class MGlxMetadataDialogObserver ; // call back to details dailog + +namespace Alf + { + class IMulWidget; // An interface for all Multimedia widgets + } + +/** + * CGlxDetailsMulModelProviderImpl + * This is the implementation class of details data provider + */ +NONSHARABLE_CLASS( CGlxDetailsMulModelProviderImpl ) : public CGlxMulModelProviderBase, + public MGlxBindingObserver + { +public: + + /** Constructor + * @param aEnv Env variable of ALF + * @param aWidget Alf Widget type + * @param aMediaList medialist from which attributes to be fetched + * @param aDefaultTemplate Template that will be set to model + */ + static CGlxDetailsMulModelProviderImpl* NewL( + CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ); + + /** + * ConstructL + * @param aEnv Alf environment + * @param aDefaultTemplate The default template of the widget + */ + void ConstructL( + CAlfEnv& aEnv, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ); + + /** + * Destructor + */ + ~CGlxDetailsMulModelProviderImpl(); + + /** + * This Api uses the binding set factory to create the binding set + * @param aFactory factory instance + */ + void AddEntryL( const TGlxMulBindingSetFactory& aFactory ); + + /// the ModelProvider will be calling this , change the comments + /** + * OfferCommandL + * This will be called from details provider whenever there is an event (for example: navi key pressed ) + * @param aCommandId Id of the command that is about to be executed + */ + TBool OfferCommandL( TInt aCommandId ); + + /** + * InitMenuL + * This will determine what options to be present in menu pane + * @param aMenu The menu pane to edit + */ + void InitMenuL( CEikMenuPane& aMenu ); + + /** + * HideLocationMenuItem + * @param aMenu The menu pane to edit + */ + void HideLocationMenuItem( CEikMenuPane& aMenu ); + + /** + * EnableMskL + * This will change the middle softkey as per the focussed item + */ + void EnableMskL(); + + /** + * SetDetailsDailogObserver + * This will set the details dailog observer + */ + /** Error Id EMPY-7MKDHP **/ + void SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ) ; + +private: + + /** + * Constructor + * @param aWidget Alf Widget type + */ + CGlxDetailsMulModelProviderImpl( + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize); + + // From MGlxBindingObserver + void HandleBindingChanged( const CGlxBinding& aBinding ); + + + // From CGlxMulModelProviderBase + void HandleFocusChanged( TInt aNewFocus, TInt aPreviousFocus ); + + // From MGlxMediaListObserver + void HandleAttributesAvailableL( TInt aIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + void HandleError( TInt aError ); + + void HandleCommandCompleteL( TAny* aSessionId, CMPXCommand* aCommandResult, + TInt aError, MGlxMediaList* aList ); + // From IMulModelProvider + void ProvideData (int aIndex, int aCount, Alf::MulDataPath aPath); + + /** + * HasCommandL + * This will check weather command is present in menu pane + * @param aMenuPane The menu pane + * @param aCommandId the command in menu pane + */ + TBool HasCommandL( CEikMenuPane& aMenuPane, const TInt aCommandId ); + + /** + * Helper function used be HandleError + * @param aError the error code to handle. + */ + void DoHandleErrorL( TInt /*aError*/ ); +private: + + // medialist not owned + MGlxMediaList& iMediaList; + + //Array of Bindings owned + RPointerArray< CGlxBinding > iEntries; + + //Fetch context + CGlxAttributeRequirements* iAttributeRequirements; + }; + +#endif // _GLXDETAILSMULMODELPROVIDERIMPL_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxmedialistmulmodelprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxmedialistmulmodelprovider.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation class for Medialist Access for Data +* +*/ + + + + +#ifndef _GLXMEDIALISTMULMODELPROVIDER_H_ +#define _GLXMEDIALISTMULMODELPROVIDER_H_ + +#include // Container Base Class +#include + +// Forward declarations +class CAlfEnv; // This is the UI Accelerator Toolkit environment object +class MGlxMediaList; // Interface for reading lists of media items +class TGlxMulBindingSetFactory; // Create binding set +class CGlxMediaListMulModelProviderImpl; // Actual implemntation for providign the data to the clients is done here + +/** +* CGlxMediaListMulModelProvider is the provider class which provides data for +* list view, grid view. +* This doesnt have any implementaiton. +* This actual implementaion is provided in CGlxMediaListMulModelProviderImpl +*/ +NONSHARABLE_CLASS( CGlxMediaListMulModelProvider ) : public CBase + { +public: + /** + * The client uses this API to create the provider + * @param aEnv The Alf Environment + * @param aWidget The widget being used by client for which the model has to be set + * @param aMediaList The instance of medialist which provides data for the model + * @param aFactory The instance of the bindingset factory + * @param aDefaultTemplate The template that is being used for the widget. + */ + IMPORT_C static CGlxMediaListMulModelProvider* NewL( CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ); + /** + * Destructor + */ + IMPORT_C ~CGlxMediaListMulModelProvider(); + +private: + CGlxMediaListMulModelProvider(); + + /** ConstructL + * @param aEnv Env variable of ALF + * @param aWidget Alf Widget type + * @param aMediaList medialist from which attributes to be fetched + * @param aDefaultTemplate Template that will be set to model + */ + void ConstructL(CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ); + + // The implementaion APIs of CGlxMediaListMulModelProviderImpl + // have to be called: owns + CGlxMediaListMulModelProviderImpl* iImpl; + }; + +#endif // _GLXMEDIALISTMULMODELPROVIDER_H_ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxmedialistmulmodelproviderimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxmedialistmulmodelproviderimpl.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation class for Media data provider. +* providign the data to the clients +* +*/ + + + + +#ifndef _GLXMEDIALISTMULMODELPROVIDERIMPL_H_ +#define _GLXMEDIALISTMULMODELPROVIDERIMPL_H_ + +#include // Container Base Class +#include "glxmulmodelproviderbase.h" // DataProvider Base +#include "mglxbindingobserver.h" // Notifies that binding has changed + +namespace Alf + { + class IMulWidget; // An interface for all Multimedia widgets + } + +// Forward declarations +class TGlxMulBindingSetFactory; // Create binding set +class CGlxAttributeRequirements; // This class will set the required attribute to the medialist +class CAlfEnv; // This is the UI Accelerator Toolkit environment object +class MGlxMediaList; // Interface for reading lists of media items +class CGlxBindingSet; // basically holds the bindings required to populate the visual item. +class CGlxResolutionUtility; // Singleton containing resolution utility methods +class CGlxUiUtility; // lib glxalfutils.lib ; Alf utils + +/** +* CGlxMediaListMulModelProviderImpl +* The actual implemntation for providign the data to the clients is done here +*/ +NONSHARABLE_CLASS( CGlxMediaListMulModelProviderImpl ) : public CGlxMulModelProviderBase, + public MGlxBindingObserver + { + +public: + /** + * The medialist data provider uses this API to create the provider impl + * @param aEnv The Alf Environment + * @param aWidget The widget being used by client for which the model has to be set + * @param aMediaList The instance of medialist which provides data for the model + * @param aFactory The instance of the bindingset factory + * @param aDefaultTemplate The template that is being used for the widget. + */ + static CGlxMediaListMulModelProviderImpl* NewL( CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ); + + /** + * Destructor + */ + ~CGlxMediaListMulModelProviderImpl(); + +private: + /** + * Constructor + * @param aWidget The widget being used by client for which the model has to be set + * @param aMediaList The instance of medialist which provides data for the model + */ + CGlxMediaListMulModelProviderImpl( Alf::IMulWidget& aWidget, MGlxMediaList& aMediaList ); + + /** + * ConstructL + * @param aEnv The Alf Environment + * @param aFactory The instance of the bindingset factory + * @param aDefaultTemplate The template that is being used for the widget. + */ + void ConstructL( CAlfEnv& aEnv, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ); + + /** + * Helper function used be HandleError + * @param aError the error code to handle. + */ + void DoHandleErrorL( TInt aError ); + + // From MGlxBindingObserver + void HandleBindingChanged( const CGlxBinding& aBinding ); + + void HandleOrientationChanged(); + // From CGlxMulModelProviderBase + void HandleFocusChanged(TInt aNewFocusIndex, TInt aPreviousFocusIndex); + // From MGlxMediaListObserver + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleError( TInt aError ); + //Bug fix for PKAA-7NRBYZ + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + + // From IMulModelProvider + void ProvideData (int aIndex, int aCount, Alf::MulDataPath aPath); +private: + + MGlxMediaList& iMediaList; + CGlxBindingSet* iBindingSet; // own + TBool iIsReleventAttribute; + CGlxAttributeRequirements* iAttributeRequirements; // own + CGlxResolutionUtility* iResolutionUtility; + Alf::IMulWidget& iWidget; + CGlxUiUtility* iUiUtility; + + }; + +#endif // _GLXMEDIALISTMULMODELPROVIDERIMPL_H_ + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxmulbindingsetfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxmulbindingsetfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2008-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: Binding Set Factory ;Base for all Binding Set +* +*/ + + + + +#ifndef _GLXBINDINGSETFACTORY_H_ +#define _GLXBINDINGSETFACTORY_H_ + +#include // Container Base Class +#include // MPX Attribute data type class +#include +#include // Client need to use this class to add data in data model +class CGlxBindingSet; // basically holds the bindings required to populate the visual item. +class CMPXCollectionPath; // Encapsulates a 'bookmark' to a specific collection entry +class MGlxBindingObserver; // Observer for Bindings +class MGlxBoundCommand; // Handles user commands +class TMPXAttribute; // TMPXAttribute data type class. +class CGlxMulIconProvider; // Icon details + +class TGlxMulBindingSetFactory + { +public: + /** + * CreateBindingSetL creates instance of Binding set + * @param aObserver Binding observer + */ + CGlxBindingSet* CreateBindingSetL( MGlxBindingObserver& aObserver ) const; + +protected: + /** + * Constructor + */ + IMPORT_C TGlxMulBindingSetFactory(); + + /** + * Destructor + */ + IMPORT_C virtual ~TGlxMulBindingSetFactory(); + + /** + * Creates String binding and adds it to binding set + * @param aMulTag Template attribute of widget + * @param aString MPX constant string + */ + IMPORT_C void AddStringBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + TInt aStringId ) const; + + /** + * Creates MPX Attribute binding and adds it to binding set + * @param aMulTag Template attribute of widget + * @param aAttribute MPX attribute + */ + IMPORT_C void AddMpxAttributeBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TMPXAttribute& aAttribute, TInt aFormatStringId = NULL ) const; + + /** + * Creates Thumbnail binding and adds it to binding set + * @param aMulTag Template attribute of widget + */ + IMPORT_C void AddThumbnailBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TSize& aSize ) const; + + /** + * Creates FullScreenThumbnail binding and adds it to binding set + * @param aMulTag Template attribute of widget + */ + IMPORT_C void AddFullScreenThumbnailBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/ )const; + + /** + * Creates icon binding and adds it to binding set + * @param aMulTag Template attribute of widget + */ + IMPORT_C void AddIconBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CGlxMulIconProvider* aMulIcon, const TSize& aSize )const; + + /** + * Creates Container list binding and adds it to binding set + * @param aMulTag Template attribute of widget + * @param aPath MPX collection path which will be used to fetch the attributes for media item + */ + IMPORT_C void AddContainerListBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CMPXCollectionPath& aPath ) const; + + /** + * Creates command binding and adds it to binding set + * @param aCommand command associated with option menu item/items + */ + /** takes ownership of aCommand */ + IMPORT_C void AddCommandBindingL( MGlxBoundCommand* aCommand ) const; + + /** @param aTemplateWhenFocused template to be used when item is focused. + * if not defined, uses aTemplate also for the focused item */ + IMPORT_C void AddTemplateBindingL( + Alf::mulwidget::TLogicalTemplate aTemplate, + Alf::mulwidget::TLogicalTemplate aTemplateWhenFocused = Alf::mulwidget::KTemplateUnknown) const; + + /** + * Creates preview thumbnail binding and adds it to binding set + */ + IMPORT_C void AddPreviewThumbnailBindingL() const; + +private: + virtual void AddBindingsL() const = 0; + +private: + mutable CGlxBindingSet* iBindingSet; // not own + }; + +#endif // _GLXBINDINGSETFACTORY_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxmuliconprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxmuliconprovider.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,231 @@ +/* +* Copyright (c) 2008-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: Provide Icon File Considering Requirement +* +*/ + + + + +#ifndef GLXMULICONPROVIDER_H_ +#define GLXMULICONPROVIDER_H_ + +#include // Container Base Class +#include "glxmedia.h" // Reference to a media item in the item pool. +#include "mpxmediageneraldefs.h" // Content ID identifying general category of content provided + +class TGlxMedia; // Reference to a media item in the item pool. +class CGlxDRMUtility; // DRM utility class to provide DRM-related functionality used in many places + +NONSHARABLE_CLASS( CGlxMulIconProvider ) : public CBase +{ +public: + /** + * Virtual Destructor + */ + virtual ~CGlxMulIconProvider() {}; + + /** + * IconIdL Returns the icon id + * @param aMedia Media item + */ + virtual TInt IconIdL( const TGlxMedia& aMedia ) const = 0; + + /** + * TwoPhaseConstruction + */ + void ConstructL( ); + + /** + * ResourceFileName returns the filename of the resource + */ + virtual const TDesC& ResourceFileName() const ; +private: + // Stores the resource filename + TFileName iResFileName; +}; + +// ------------------------------------------------------------------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxMulLocationIconProvider ) : public CGlxMulIconProvider +{ +public: + /** + * TwoPhaseConstruction + */ + IMPORT_C static CGlxMulLocationIconProvider* NewL( ); + + /** + * Destructor + */ + ~CGlxMulLocationIconProvider(); + + /** + * IconIdL Returns the icon id + * @param aMedia Media item + */ + TInt IconIdL( const TGlxMedia& aMedia ) const; +}; + +// ------------------------------------------------------------------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxMulDriveIconProvider ) : public CGlxMulIconProvider +{ +public: + /** + * TwoPhaseConstruction + */ + IMPORT_C static CGlxMulDriveIconProvider* NewL( ); + + /** + * Destructor + */ + ~CGlxMulDriveIconProvider(); + + /** + * IconIdL Returns the icon id + * @param aMedia Media item + */ + TInt IconIdL( const TGlxMedia& aMedia ) const; +}; + +//----------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxMulStaticIconProvider ) : public CGlxMulIconProvider +{ +public: + + /** + * TwoPhaseConstruction + */ + IMPORT_C static CGlxMulStaticIconProvider* NewL( TInt aResourceIconId ); + + /** + * Destructor + */ + CGlxMulStaticIconProvider( TInt aResourceIconId ); + + /** + * IconIdL Returns the icon id + * @param aMedia Media item + */ + TInt IconIdL( const TGlxMedia& aMedia ) const; + +private: + // Stores the resource id + TInt iIconId; + +}; + +//----------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxMulDRMIconProvider ) : public CGlxMulIconProvider +{ +public: + + /** + * TwoPhaseConstruction + */ + IMPORT_C static CGlxMulDRMIconProvider* NewL( ); + + /** + * Contructor + */ + CGlxMulDRMIconProvider( ); + + /** + * Destructor + */ + ~CGlxMulDRMIconProvider(); // Memory Leak Fix + + /** + * IconIdL Returns the icon id + * @param aMedia Media item + */ + TInt IconIdL( const TGlxMedia& aMedia ) const; + + /** + * TwoPhaseConstruction + */ + void ConstructL( ); + + + /** + * ResourceFileName + */ + const TDesC& ResourceFileName() const; + + +private: + // Stores the resource id + TInt iIconId; + + // The Resource file name from which icon to be read + TFileName iMifFileName; + + // Provides DRM related functionality + CGlxDRMUtility* iDRMUtility; +}; + +//----------------------------------------------------------------------------- + +NONSHARABLE_CLASS( CGlxMulVideoIconProvider ) : public CGlxMulIconProvider +{ +public: + + /** + * TwoPhaseConstruction + */ + IMPORT_C static CGlxMulVideoIconProvider* NewL(TBool aIsFullscreen=EFalse); + + /** + * Contructor + */ + CGlxMulVideoIconProvider(TBool aIsFullscreen); + + /** + * Destructor + */ + ~CGlxMulVideoIconProvider(); + + /** + * IconIdL Returns the icon id + * @param aMedia Media item + */ + TInt IconIdL( const TGlxMedia& aMedia ) const; + + /** + * TwoPhaseConstruction + */ + void ConstructL( ); + + + /** + * ResourceFileName + */ + const TDesC& ResourceFileName() const; + + +private: + // Stores the resource id + TInt iIconId; + + // Flag to identify fullscreen icon + TBool iIsFullscreen; + + // The Resource file name from which icon to be read + TFileName iMifFileName; +}; + +#endif //GLXMULICONPROVIDER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxmulmodelproviderbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxmulmodelproviderbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2008-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: Interface to Alf Objects +* +*/ + + + + +#ifndef _GLXMULMODELPROVIDERBASE_H_ +#define _GLXMULMODELPROVIDERBASE_H_ + +#include // Container Base Class +#include // The interface for event handlers used by widget controls +#include // Observes for changes in media list +#include // An interface for the data model +#include // An interface for requesting the data provider for data +#include +//constants +static const TInt LAST_INDEX = -1; + +class CAlfEnv; // This is the UI Accelerator Toolkit environment object +class CGlxBinding; // The binding is created by the binding set factory +class MGlxBoundCommand; // Handles user commands +class TGlxMedia; // Reference to a media item in the item pool +class CGlxNavigationalState; // Class that stores the navigational state of the application + +namespace Alf + { + class IMulModel; // An interface for the data model + class IMulWidget; // An interface for all Multimedia widgets + class MulVisualItem; // Client need to use this class to add data in data model + } + + NONSHARABLE_CLASS( CGlxMulModelProviderBase ) : public CBase, public Alf::IAlfWidgetEventHandler, + public MGlxMediaListObserver, public Alf::IMulModelProvider + { +protected: + + /** + * Constructor + * @param aWidget The widget to which the model is to be set + */ + CGlxMulModelProviderBase( Alf::IMulWidget& aWidget ); + + /** + * BaseConstructL + * @param aEnv Alf environment + * @param aDefaultTemplate The default template of the widget + */ + void BaseConstructL( CAlfEnv& aEnv, Alf::mulwidget::TLogicalTemplate aDefaultTemplate, TInt aDataWindowSize ); + + /** + * Destructor + */ + ~CGlxMulModelProviderBase(); + /** + * CreateModelL + */ + void CreateModelL(); + /** + * InsertItemsL + * @param aIndex Start index + * @param aCount Number of items to insert + * @param aMediaListFocusIndex Focus Index to set in Model + */ + void InsertItemsL( TInt aIndex, TInt aCount, TInt aMediaListFocusIndex = NULL ); + + /** + * RemoveItem + * @param aAtIndex media list index + */ + void RemoveItems( TInt aIndex, TInt aCount ); + + /** + * UpdateItemL + * @param aBinding Binding used to update the item + * @param aMedia media item which has the updated data + * @param aAtIndex media list index + */ + void SetDataT( const CGlxBinding& aBinding, const TGlxMedia& aMedia, + TInt aAtIndex ); + + /// @todo docs + void UpdateItems( TInt aIndex, TInt aCount ); + + /** + * FocusIndex + */ + TInt FocusIndex() const; + + /** + * BoundCommand + *@param aVisualItemIndex index of visual item + *@return MGlxBoundCommand for that visual item + */ + MGlxBoundCommand* BoundCommand( TInt aVisualItemIndex ) const; + + // @todo docs + void SetFocusIndex( TInt aIndex ); + + void AddWidgetEventHandler(); + /** + * HandleOrientationChanged + * Icon Size change notification to be implemented dependent on Orientation + */ + virtual void HandleOrientationChanged(); + +private: + + /** + * CreateItemT + * @param aBinding Binding used to update the item + * @param aMedia media item which has the updated data + * @param aIsFocused + */ + std::auto_ptr CGlxMulModelProviderBase::CreateItemT( const CGlxBinding& aBinding, + const TGlxMedia& aMedia, TBool aIsFocused ); + /** + * IsFocused + * @param aIndex Media list index + */ + TBool IsFocused( TInt aIndex ) const; + + // From MGlxMediaListObserver + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + void HandleError( TInt aError ); + void HandleCommandCompleteL( TAny* /*aSessionId*/, CMPXCommand* aCommandResult, TInt aError, + MGlxMediaList* aList ); + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + + // From IAlfWidgetEventHandler + bool accept( Alf::CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + Alf::AlfEventStatus offerEvent( Alf::CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + void setActiveStates( unsigned int /*aStates*/ ); + void setEventHandlerData( const Alf::AlfWidgetEventHandlerInitData& /*aData*/ ); + Alf::AlfWidgetEventHandlerInitData* eventHandlerData(); + Alf::IAlfInterfaceBase* makeInterface(const Alf::IfId& /*aType */); + AlfEventHandlerType eventHandlerType() ; + AlfEventHandlerExecutionPhase eventExecutionPhase() ; + + /** + * HandleFocusChanged + * Focus change notification to implemented class + */ + virtual void HandleFocusChanged( TInt aNewFocusIndex, TInt aPreviousFocusIndex ); + + /** + * Item + *@param aIndex index of visual item + *@return MulVisualItem the visual item at that index + */ + const Alf::MulVisualItem& Item( TInt aIndex ) const; + +private: + //The widget to which the model will be set + /// Never expose this widget to any other class so that the osn-symbian interface + /// is minimised to here. (i.e., try/catch vs. trap/leave) + Alf::IMulWidget& iWidget; + + //Owned: Model + /// Never expose this model to any other class so that the osn-symbian interface + /// is minimised to here. (i.e., try/catch vs. trap/leave) + Alf::IMulModel* iModel; + + TBool iWithinFocusChangeCall; + + //previous focus index + TInt iPreviousFocusIndex; + + CAlfEnv* iEnv; + + Alf::mulwidget::TLogicalTemplate iDefaultTemplate; + + TInt iDataWindowSize; + + // Create navigational state + CGlxNavigationalState* iNavigationalState; + }; + +#endif // _GLXMULMODELPROVIDERBASE_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxmulthumbnailvarianttype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxmulthumbnailvarianttype.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2008-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: Makes the Decision to Create Thumbnail Texture or Icon Texture +* Considering Drm Validity and Thumbnail Availabilty +* +*/ + + + + +#ifndef _GLXTHUMBNAILVARIANTTYPE_H_ +#define _GLXTHUMBNAILVARIANTTYPE_H_ + +#include // Container Base Class +#include // Observer interface used to be notified when texture content changes +#include "mglxtextureobserver.h" // Observer interface used to be notified when texture content changes + +class TGlxMedia; // Reference to a media item in the item pool. +class CGlxUiUtility; // Alf utils ; lib glxalfutils.lib +class TSize; // Stores a two-dimensional size as a width and a height value +class CGlxDRMUtility; +class CGlxMedia; +/** + * + */ +NONSHARABLE_CLASS( GlxThumbnailVariantType ) : public CBase, public + Alf::MulVariantType, public MGlxTextureObserver + { +public: + + static GlxThumbnailVariantType* NewL( const TGlxMedia& aMedia, const TSize& aSize, + TBool aIsFocused = EFalse ); + + static GlxThumbnailVariantType* NewLC( const TGlxMedia& aMedia, const TSize& aSize, + TBool aIsFocused = EFalse ); + + void ConstructL( const TGlxMedia& aMedia, const TSize& aSize, TBool + aIsFocused = EFalse ); + + /** constructor + * Create via new (EMM) ... */ + GlxThumbnailVariantType( const TGlxMedia& aMedia, const TSize& aSize, + TBool aIsFocused = EFalse ); + /** destructor */ + ~GlxThumbnailVariantType(); + + void TextureContentChangedL( TBool aHasContent, CAlfTexture* aNewTexture ); + + Alf::IMulVariantType::TMulType Type() const ; + int integer() const ; + +private: + + void ConsumeDRMRightsL( const TGlxMedia& aMedia ); + + TSize ThumbnailSize(const CGlxMedia* aMedia); + + /** + * Determine if DRM rights need to be consuned based on thumbnail + * or visual size + * @param aImageSize size of image + * @param aBitmapSize bitmap size + * @return ETrue if rights are to be consumed + */ + TBool ConsumeRightsBasedOnSize( TSize aImageSize, + TSize aBitmapSize); + + /** + * Determine if the relevant thumbnail is available. + * @param aMedia The media item. + * @param aSize Size of the Thumbnail. + * @return ETrue if the requested size thumbnail present. + */ + TBool HasRelevantThumbnail(const TGlxMedia& aMedia, + const TSize& aSize); + +private: + int mTextureId; + CGlxUiUtility* iUiUtility; + /** Poniter to instance of DRM utility (owned) */ + CGlxDRMUtility* iDrmUtility; + }; + +/** + * + */ +NONSHARABLE_CLASS( GlxIconVariantType ) : public CBase, public Alf::MulVariantType + { +public: + + static GlxIconVariantType* NewL( TInt aIconId, TFileName aFileName, const TSize& aSize ); + + static GlxIconVariantType* NewLC( TInt aIconId, TFileName aFileName, const TSize& aSize ); + + void ConstructL( TInt aIconId, TFileName aFileName, const TSize& aSize ); + + /** constructor + * Create via new (EMM) ... */ + GlxIconVariantType( TInt aIconId, TFileName aFileName, const TSize& aSize ); + /** destructor */ + ~GlxIconVariantType(); + Alf::IMulVariantType::TMulType Type() const ; + int integer() const ; + +private: + int mIconId; + CGlxUiUtility* iUiUtility; + }; +#endif // _GLXTHUMBNAILVARIANTTYPE_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/glxpreviewthumbnailbinding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/glxpreviewthumbnailbinding.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of preview thumbnail binding for the +* list view +* +*/ + + + + +#ifndef _GLXPREVIEWTHUMBNAILBINDING_H_ +#define _GLXPREVIEWTHUMBNAILBINDING_H_ + + +#include "glxbinding.h" // The binding is created by the binding set factory. +#include "glxmedialistiterator.h" // Interface for going through items in the list in a non-sequential order +#include "mglxmedialistobserver.h" // Observes for changes in media list +#include + + +class GlxThumbnailVariantType; +class CGlxUiUtility; +class CGlxThumbnailContext; // Fetch context to retrieve thumbnails + +// CLASS DECLARATION +/** + * Implementation of preview thumbnail binding for the + * list view. + * + */ + + NONSHARABLE_CLASS(CGlxPreviewThumbnailBinding) : public CGlxSingleTagBinding, + public MGlxMediaListObserver + { + public: + + /** + * Two phase construction + * @param aMulTag Mul field that the binding corresponds to + */ + static CGlxPreviewThumbnailBinding* NewL (); + + /** + * Two phase construction + */ + static CGlxPreviewThumbnailBinding* NewLC( ); // takes ownership + + + /** + * Destructor + */ + ~CGlxPreviewThumbnailBinding(); + + /** + * HasFirstThumbnail + */ + TBool HasFirstThumbnail( const RArray< TMPXAttribute >& aAttributes ); + +private: + + /** + * Constructor + */ + CGlxPreviewThumbnailBinding(); + + /** + * Two phase construction + */ + void ConstructL(); + + +public: + //From CGlxBinding + void PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused ) const; + CGlxBinding::TResponse HandleFocusChanged( TBool aIsGained ); + void HandleItemChangedL(const CMPXCollectionPath& aPath ); + + // From MGlxMediaListObserver + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + void HandleError( TInt aError ); + void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, + MGlxMediaList* aList ); + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + + +private: + + /** + * CreateThumbnail + */ + + std::auto_ptr< GlxThumbnailVariantType > CreateThumbnailL( TInt aIndex )const; + + /** + * MediaIndexBySlotIndex + */ + TInt MediaIndexBySlotIndex( TInt aProgressIndex, TInt aSlotIndex ) const; + + /** + * IsTime + */ + static TInt IsTime( TAny* aSelf ); + + /** + * TimerTicked + */ + void TimerTicked(); + + /** + * Sets initial thumbnail to visual item depending upon slot + */ + void SetInitialThumbnailAttributeL(Alf::MulVisualItem& aItem, TInt aSlot ) const; + + /** + * Sets initial thumbnail to visual item simultaneously + */ + void SetThumbnailAttributeL(Alf::MulVisualItem& aItem ) const; + + /** + * changes the next slot that has to be filled + */ + void PreviewSlotIndex( TInt aSlot, TInt aSlotIndex ) const; + +private: + + // Timer that checks for the time expiration + CPeriodic* iTimer; + + //Medialist that holds the thumbnail information + MGlxMediaList* iMediaList; + + // Thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + // for thumbnail context + TGlxSequentialIterator iThumbnailIterator; + + // Preview thumbnail index + TInt iProgressIndex; + + // keeps track of which index to fill with thumbnail + mutable TInt iSlotIndex; + + // Flag that has information whether thumbnail is available + TBool iStartedShowingThumbnails; + + // flag that says whether timer has expired + TBool iTimerTicked; + + // whether current orientation is landscape or potrait + TBool iCurrentOrientationLandscape; + + //it holds the initial number of thumbnail to be displayed + RArray iPreviewItemCount; + + // holds how many thumbnail to be shown initially + TInt iSlots; + + CGlxUiUtility* iUiUtility; + +}; + + +#endif //_GLXPREVIEWTHUMBNAILBINDING_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/inc/mglxbindingobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/inc/mglxbindingobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008-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: Binding Change Observer +* +*/ + + + + +#ifndef _MGLXBINDINGOBSERVER_H_ +#define _MGLXBINDINGOBSERVER_H_ + +#include // Container Base Class + +class CGlxBinding; // The binding is created by the binding set factory + +class MGlxBindingObserver + { +public: + /** + * Notifies that binding has changed + * @param aBinding The binding that is observed + */ + + virtual void HandleBindingChanged( const CGlxBinding& aBinding ) = 0; + }; + +#endif // _MGLXBINDINGOBSERVER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxattributerequirement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxattributerequirement.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2008-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: set the required attribute to the medialist +* +*/ + + + + +#include "glxattributerequirement.h" // This class will set the required attribute to the medialist +#include // MPX Attribute data type class +#include // attribute/thumbnail fetch context priority definitions +#include // Logging +#include +#include +#include +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxAttributeRequirements* CGlxAttributeRequirements::NewL( + MGlxMediaList& aMediaList ) + { + TRACER("CGlxAttributeRequirements::NewL"); + CGlxAttributeRequirements* self = CGlxAttributeRequirements::NewLC( + aMediaList ); + CleanupStack::Pop( self ); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxAttributeRequirements* CGlxAttributeRequirements::NewLC( MGlxMediaList& + aMediaList ) + { + TRACER("CGlxAttributeRequirements::NewLC"); + CGlxAttributeRequirements* self = new ( ELeave ) CGlxAttributeRequirements( + aMediaList ); + CleanupStack::PushL( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Deafult constructor +// ---------------------------------------------------------------------------- +// +CGlxAttributeRequirements::CGlxAttributeRequirements( MGlxMediaList& aMediaList): + iMediaList( aMediaList ) + { + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxAttributeRequirements::ConstructL() + { + + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxAttributeRequirements::~CGlxAttributeRequirements() + { + TRACER("CGlxAttributeRequirements::~CGlxAttributeRequirements"); + for( TInt i = 0;i <=iArributeContext.Count()-1; i++ ) + { + iMediaList.RemoveContext(iArributeContext[i]); + } + iArributeContext.ResetAndDestroy(); + + //remove the context and delete the same + iMediaList.RemoveContext(iFsThumbnailContext); + delete iFsThumbnailContext; + + for( TInt i = 0;i <=iThumbnailContext.Count()-1; i++ ) + { + iMediaList.RemoveContext(iThumbnailContext[i]); + } + iThumbnailContext.ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// Creating the attribute context and setting it to the medialist +// ---------------------------------------------------------------------------- +// +void CGlxAttributeRequirements::AddAttributeL( const TMPXAttribute& aAttribute ) + { + TRACER("CGlxAttributeRequirements::AddAttributeL"); + iArributeContext.AppendL(CGlxDefaultAttributeContext::NewL() ); + iArributeContext[iArributeContext.Count()-1]->SetRangeOffsets(10,10); + iArributeContext[iArributeContext.Count()-1]->AddAttributeL( aAttribute ); + iMediaList.AddContextL( iArributeContext[iArributeContext.Count()-1], KMaxTInt ); + } + +// ---------------------------------------------------------------------------- +// Creating the thumbnail context and setting it to the medialist +// ---------------------------------------------------------------------------- +// +void CGlxAttributeRequirements::AddThumbnailL( const TSize& aSize ) + { + TRACER("CGlxAttributeRequirements::AddThumbnailL"); + if( aSize.iHeight > 200 ) + { + iFromFocusOutwardIterator.SetRangeOffsets( 2,2 ); + //check if Fullscreen thumbnail context is initialized + if(!iFsThumbnailContext) + { + //created new context, set the priority higher than grid thumbnail requests and set the default spec based on the + //current orientation + iFsThumbnailContext = CGlxThumbnailContext::NewL(&iFromFocusOutwardIterator); + iFsThumbnailContext->SetDefaultSpec(aSize.iWidth, aSize.iHeight); + iMediaList.AddContextL(iFsThumbnailContext, KGlxFetchContextPriorityGridViewFullscreenVisibleThumbnail); + } + else + { + //Fullscreen context already created, hence, modify the default spec, to take care of orientation change + iFsThumbnailContext->SetDefaultSpec(aSize.iWidth, aSize.iHeight); + } + } + else + { + if (AknLayoutUtils::PenEnabled()) + { + iThumbnailContext.AppendL(CGlxThumbnailContext::NewL(&iBlockyIterator)); + } + else + { + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL(*uiUtility); + TInt visItems = uiUtility->VisibleItemsInPageGranularityL(); + CleanupStack::PopAndDestroy(uiUtility); + + //we are fetching visible items on priority, + //5 pages would be good to have as it uses FromFocusOutwardIterator + iFromFocusOutwardIterator.SetRangeOffsets(3*visItems , 2*visItems ); + iThumbnailContext.AppendL(CGlxThumbnailContext::NewL(&iFromFocusOutwardIterator)); + } + iThumbnailContext[iThumbnailContext.Count()-1]->SetDefaultSpec (aSize.iWidth, aSize.iHeight ); + iMediaList.AddContextL( iThumbnailContext[iThumbnailContext.Count()-1], KGlxFetchContextPriorityNormal ); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxbinding.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxbinding.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,852 @@ +/* +* Copyright (c) 2008-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: bindings required to populate the visual item +* +*/ + + + + +#include "glxbinding.h" // The binding is created by the binding set factory. +#include "glxmuliconprovider.h" // Icon details +#include // Class provides methods to load and format resource strings +#include // Client need to use this class to add data in data model +#include +#include // Thumbnail attribute content ID +#include // Encapsulates a 'bookmark' to a specific collection entry +#include // Logging +#include +#include "glxcommandbindingutility.h" // collect binding handling here +#include "glxmulthumbnailvarianttype.h" +#include "mglxbindingobserver.h" // Notifies that binding has changed +#include "glxustringconverter.h" // converts the symbian types to UString type +#include "glxattributerequirement.h" // class will set the required attribute to the medialist +#include "glxuiutility.h" +#include "glxdetailsboundcommand.h" // Handles user commands + +using namespace Alf; + +// ---------------------------------------------------------------------------- +// Sets the attribute to the visual item +// ---------------------------------------------------------------------------- +// +static void SetAttributeT( Alf::MulVisualItem& aItem, const Alf::mulvisualitem::TVisualAttribute& aTag/*const UString& aTag*/, + std::auto_ptr aValue ) + { + TRACER("SetAttributeT"); + aItem.SetAttribute( aTag, aValue.get() ); + aValue.release(); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxBinding::~CGlxBinding() + { + + } + +// ---------------------------------------------------------------------------- +// Checks whether the attributes are relevant, returns EFalse always +// ---------------------------------------------------------------------------- +// +TBool CGlxBinding::HasRelevantAttributes( + const RArray< TMPXAttribute >& /*aAttributes*/ ) const + { + TRACER("CGlxBinding::HasRelevantAttributes"); + return EFalse; + } + +// ---------------------------------------------------------------------------- +// Notification whether any updation is required for the focus changed +// ---------------------------------------------------------------------------- +// +CGlxBinding::TResponse CGlxBinding::HandleFocusChanged( TBool /*aIsGained*/ ) + { + TRACER("CGlxBinding::HandleFocusChanged"); + return ENoUpdateNeeded; + } +void CGlxBinding::HandleItemChangedL(const CMPXCollectionPath& /*aPath*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// Set the binding observer +// ---------------------------------------------------------------------------- +// +void CGlxBinding::SetObserver( MGlxBindingObserver& aObserver ) + { + TRACER("CGlxBinding::SetObserver"); + iObserver = &aObserver; + } + +// ---------------------------------------------------------------------------- +// Initiates the update process when the binding changed +// ---------------------------------------------------------------------------- +// +void CGlxBinding::Update() + { + TRACER("CGlxBinding::Update"); + __ASSERT_DEBUG( iObserver, User::Invariant() ); + iObserver->HandleBindingChanged( *this ); + } + +// ---------------------------------------------------------------------------- +// AddRequestL +// ---------------------------------------------------------------------------- +// + void CGlxBinding::AddRequestL( CGlxAttributeRequirements& + /*aAttributeRequirement*/, TSize /*aSize*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// Template Binding +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxTemplateBinding::~CGlxTemplateBinding() + { + + } + +// ---------------------------------------------------------------------------- +// Two phase constructor +// ---------------------------------------------------------------------------- +// +CGlxTemplateBinding* CGlxTemplateBinding::NewL( + Alf::mulwidget::TLogicalTemplate aTemplate, + Alf::mulwidget::TLogicalTemplate aTemplateWhenFocused) + { + TRACER("CGlxTemplateBinding::NewL"); + CGlxTemplateBinding* self = CGlxTemplateBinding::NewLC( aTemplate, aTemplateWhenFocused ); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// Two phase constructor +// ---------------------------------------------------------------------------- +// +CGlxTemplateBinding* CGlxTemplateBinding::NewLC( + Alf::mulwidget::TLogicalTemplate aTemplate, + Alf::mulwidget::TLogicalTemplate aTemplateWhenFocused) + { + TRACER("CGlxTemplateBinding::NewLC"); + CGlxTemplateBinding* self = new ( ELeave ) CGlxTemplateBinding(); + CleanupStack::PushL( self ); + self->iTemplate = aTemplate; + self->iFocusedTemplate = aTemplateWhenFocused; + return self; + } + +// ---------------------------------------------------------------------------- +// PopulateT +// ---------------------------------------------------------------------------- +// +void CGlxTemplateBinding::PopulateT( Alf::MulVisualItem& aItem, + const TGlxMedia& /*aMedia*/, TBool aIsFocused ) const + { + TRACER("CGlxTemplateBinding::PopulateT"); + // need to get the MUL field for the editable template from Akash + + aItem.SetAttribute( Alf::mulvisualitem::KAttributeTemplate , + ( aIsFocused && iFocusedTemplate ) ? iFocusedTemplate : iTemplate ); + + } + +// ---------------------------------------------------------------------------- +// HandleFocusChanged +// ---------------------------------------------------------------------------- +// +CGlxBinding::TResponse CGlxTemplateBinding::HandleFocusChanged( TBool /*aIsGained*/ ) + { + TRACER("CGlxTemplateBinding::HandleFocusChanged"); + //Need further implementation + return iFocusedTemplate ? EUpdateRequested: ENoUpdateNeeded; + } + +void CGlxTemplateBinding::HandleItemChangedL(const CMPXCollectionPath& /*aPath*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// Single Tag Binding +//----------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxSingleTagBinding::CGlxSingleTagBinding() + { + + } +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxSingleTagBinding::~CGlxSingleTagBinding() + { + TRACER("CGlxSingleTagBinding::~CGlxSingleTagBinding"); + //delete iMulTag; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +void CGlxSingleTagBinding::BaseConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/ ) + { + TRACER("CGlxSingleTagBinding::BaseConstructL"); + //iMulTag = new ( ELeave ) UString( aMulTag ); + iMulTag = aMulTag ; + } + +// ---------------------------------------------------------------------------- +// Returns the MUL field +// ---------------------------------------------------------------------------- +// +Alf::mulvisualitem::TVisualAttribute CGlxSingleTagBinding::MulTag() const + { + TRACER("CGlxSingleTagBinding::MulTag"); + return iMulTag; + } + + +// ---------------------------------------------------------------------------- +// String Binding +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxStringBinding* CGlxStringBinding::NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + TInt aStringId ) + { + TRACER("CGlxStringBinding::NewL"); + CGlxStringBinding* self = CGlxStringBinding::NewLC( aMulTag, aStringId ); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxStringBinding* CGlxStringBinding::NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + TInt aStringId ) + { + TRACER("CGlxStringBinding::NewLC"); + CGlxStringBinding* self = new ( ELeave ) CGlxStringBinding(); + CleanupStack::PushL( self ); + self->ConstructL( aMulTag, aStringId ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxStringBinding* CGlxStringBinding::NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const char* const aString ) + { + TRACER("CGlxStringBinding::NewL"); + CGlxStringBinding* self = CGlxStringBinding::NewLC( aMulTag, aString ); + CleanupStack::Pop( self ); + return self; + } +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxStringBinding* CGlxStringBinding::NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const char* const aString ) + { + TRACER("CGlxStringBinding::NewLC"); + CGlxStringBinding* self = new ( ELeave ) CGlxStringBinding(); + CleanupStack::PushL( self ); + self->ConstructL( aMulTag, aString ); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxStringBinding::CGlxStringBinding() + { + + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxStringBinding::~CGlxStringBinding() + { + TRACER("CGlxStringBinding::~CGlxStringBinding"); + delete iStringBuffer; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +void CGlxStringBinding::ConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + TInt aStringId ) + { + TRACER("CGlxStringBinding::ConstructL"); + BaseConstructL( aMulTag ); + iStringBuffer = StringLoader::LoadL( aStringId ); + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +void CGlxStringBinding::ConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/, + const char* const /*aString*/ ) + { + TRACER("CGlxStringBinding::ConstructL"); + BaseConstructL( aMulTag ); + //iString = new ( ELeave ) UString( aString ); + } + +// ---------------------------------------------------------------------------- +// populate visual item +// ---------------------------------------------------------------------------- +// +void CGlxStringBinding::PopulateT( MulVisualItem& aItem, const TGlxMedia& /*aMedia*/, + TBool /*aIsFocused*/ ) const + { + TRACER("CGlxStringBinding::PopulateT"); + aItem.SetAttribute( MulTag(), *iStringBuffer ); + } + + +// ---------------------------------------------------------------------------- +// MPX attribute Binding +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxMpxAttributeBinding* CGlxMpxAttributeBinding::NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const + aMulTag*/, const TMPXAttribute& aAttribute, TInt aFormatStringId ) + { + TRACER("CGlxMpxAttributeBinding::NewL"); + CGlxMpxAttributeBinding* self = CGlxMpxAttributeBinding::NewLC + ( aMulTag, aAttribute, aFormatStringId ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxMpxAttributeBinding* CGlxMpxAttributeBinding::NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TMPXAttribute& aAttribute, TInt aFormatStringId ) + { + TRACER("CGlxMpxAttributeBinding::NewLC"); + CGlxMpxAttributeBinding* self = new ( ELeave ) CGlxMpxAttributeBinding( + aAttribute, aFormatStringId); + CleanupStack::PushL( self ); + self->ConstructL( aMulTag ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +void CGlxMpxAttributeBinding::ConstructL(const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/ ) + { + TRACER("CGlxMpxAttributeBinding::ConstructL"); + BaseConstructL( aMulTag ); + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxMpxAttributeBinding::CGlxMpxAttributeBinding( const TMPXAttribute& + aAttribute, TInt aFormatStringId ) : iAttribute( aAttribute ), + iFormatStringId( aFormatStringId ) + { + } + +// ---------------------------------------------------------------------------- +// populate visual item +// ---------------------------------------------------------------------------- +// +void CGlxMpxAttributeBinding::PopulateT( MulVisualItem& aItem/**/, const + TGlxMedia& aMedia, TBool /*aIsFocused*/ ) const + { + TRACER("CGlxMpxAttributeBinding::PopulateT"); + //T is used for throws as per C++ standard.Hence used instead of "L" + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. + CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); + CleanupStack::PushL(stringConverter ); + HBufC* string = NULL; + stringConverter->AsStringL( aMedia, iAttribute, iFormatStringId, string ); + if ( string ) + { + aItem.SetAttribute( MulTag(), *string ); + delete string; + string = NULL; + } + CleanupStack::PopAndDestroy(stringConverter ); + } + +// ---------------------------------------------------------------------------- +// checks whether the attributes are relevant, returns EFalse always +// ---------------------------------------------------------------------------- +// +TBool CGlxMpxAttributeBinding::HasRelevantAttributes( + const RArray< TMPXAttribute >& aAttributes ) const + { + TRACER("CGlxMpxAttributeBinding::HasRelevantAttributes"); + // only the member attribute is relevant; check if it is in the list + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + return ( KErrNotFound != aAttributes.Find( iAttribute, match ) ); + } + +// ---------------------------------------------------------------------------- +// checks whether the focus has changed, returns the response status +// ---------------------------------------------------------------------------- +// +CGlxBinding::TResponse CGlxMpxAttributeBinding::HandleFocusChanged( + TBool aIsGained ) + { + TRACER("CGlxMpxAttributeBinding::HandleFocusChanged"); + //Need further implementation + return aIsGained ? EUpdateRequested : ENoUpdateNeeded ; + } + +void CGlxMpxAttributeBinding::HandleItemChangedL(const CMPXCollectionPath& /*aPath*/ ) + { + + } +// ---------------------------------------------------------------------------- +// sends the attribute that is to be set to the medialist +// ---------------------------------------------------------------------------- +// + void CGlxMpxAttributeBinding::AddRequestL( CGlxAttributeRequirements& + aAttributeRequirement,TSize /*aSize*/ ) + { + TRACER("CGlxMpxAttributeBinding::AddRequestL"); + aAttributeRequirement.AddAttributeL(iAttribute); + } + +// ---------------------------------------------------------------------------- +// Thumbnail Binding +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxThumbnailBinding* CGlxThumbnailBinding::NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TSize& aSize ) + { + TRACER("CGlxThumbnailBinding::NewL"); + CGlxThumbnailBinding* self = CGlxThumbnailBinding::NewLC( aMulTag, aSize ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxThumbnailBinding* CGlxThumbnailBinding::NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TSize& aSize ) + { + TRACER("CGlxThumbnailBinding::NewLC"); + CGlxThumbnailBinding* self = new ( ELeave ) CGlxThumbnailBinding( aSize ); + CleanupStack::PushL( self ); + self->BaseConstructL( aMulTag ); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxThumbnailBinding::CGlxThumbnailBinding( const TSize& aSize ) : + iThumbnailSize( aSize ) + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxThumbnailBinding::~CGlxThumbnailBinding() + { + } + +// ---------------------------------------------------------------------------- +// populate visual item +// ---------------------------------------------------------------------------- +// +void CGlxThumbnailBinding::PopulateT( MulVisualItem& aItem, const TGlxMedia& + aMedia, TBool aIsFocused ) const + { + TRACER("CGlxThumbnailBinding::PopulateT"); + //T is used for throws as per C++ standard.Hence used instead of "L" + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. + SetAttributeT( aItem, MulTag(), + std::auto_ptr< GlxThumbnailVariantType >( + GlxThumbnailVariantType::NewL( aMedia, iThumbnailSize, + aIsFocused ) ) ); + //@todo + } + +// ---------------------------------------------------------------------------- +// checks whether the attributes are relevant, returns EFalse always +// ---------------------------------------------------------------------------- +// +TBool CGlxThumbnailBinding::HasRelevantAttributes( + const RArray< TMPXAttribute >& aAttributes ) const + { + + TRACER("CGlxThumbnailBinding::HasRelevantAttributes"); + TMPXAttribute tnAttribQuality(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iThumbnailSize.iWidth, + iThumbnailSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + if (KErrNotFound != aAttributes.Find( tnAttribQuality, match ) ) + { + GLX_DEBUG1("CGlxThumbnailBinding::HasRelevantAttributes (tnAttribQuality) - ETrue"); + return ETrue; + } + else + { + TMPXAttribute tnAttribSpeed(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( EFalse, iThumbnailSize.iWidth, + iThumbnailSize.iHeight ) ); + + if ( KErrNotFound != aAttributes.Find( tnAttribSpeed, match ) ) + { + GLX_DEBUG1("CGlxThumbnailBinding::HasRelevantAttributes (tnAttribSpeed) - ETrue"); + return ETrue; + } + } + GLX_DEBUG1("CGlxThumbnailBinding::HasRelevantAttributes - EFalse"); + return EFalse; + } + +// ---------------------------------------------------------------------------- +// invokes the necessary api that sets the thumbnail attribute to the medialist +// ---------------------------------------------------------------------------- +// +void CGlxThumbnailBinding::AddRequestL( CGlxAttributeRequirements& + aAttributeRequirement,TSize /*aSize*/ ) + { + TRACER("CGlxThumbnailBinding::AddRequestL"); + aAttributeRequirement.AddThumbnailL( iThumbnailSize ); + } + + +// ---------------------------------------------------------------------------- +// sends response whether update required or not depending on the focus gained +// ---------------------------------------------------------------------------- +// +CGlxBinding::TResponse CGlxThumbnailBinding::HandleFocusChanged( TBool aIsGained ) + { + TRACER("CGlxThumbnailBinding::HandleFocusChanged"); + if(aIsGained) + { + + return EUpdateRequested; + } + + return ENoUpdateNeeded; + } +// ---------------------------------------------------------------------------- +// FullScreenThumbnail Binding +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxFullScreenThumbnailBinding* CGlxFullScreenThumbnailBinding::NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/ ) + { + TRACER("CGlxFullScreenThumbnailBinding::NewL"); + CGlxFullScreenThumbnailBinding* self = CGlxFullScreenThumbnailBinding::NewLC( aMulTag ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxFullScreenThumbnailBinding* CGlxFullScreenThumbnailBinding::NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag/*const char* const aMulTag*/ + ) + { + TRACER("CGlxFullScreenThumbnailBinding::NewLC"); + CGlxFullScreenThumbnailBinding* self = new ( ELeave ) CGlxFullScreenThumbnailBinding(); + CleanupStack::PushL( self ); + self->BaseConstructL( aMulTag ); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxFullScreenThumbnailBinding::CGlxFullScreenThumbnailBinding( ) + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxFullScreenThumbnailBinding::~CGlxFullScreenThumbnailBinding() + { + } + +// ---------------------------------------------------------------------------- +// populate visual item +// ---------------------------------------------------------------------------- +// +void CGlxFullScreenThumbnailBinding::PopulateT( MulVisualItem& aItem, const TGlxMedia& + aMedia, TBool aIsFocused ) const + { + TRACER("CGlxFullScreenThumbnailBinding::PopulateT"); + //T is used for throws as per C++ standard.Hence used instead of "L" + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. + SetAttributeT( aItem, MulTag(), + std::auto_ptr< GlxThumbnailVariantType >( + GlxThumbnailVariantType::NewL( aMedia, iFullScreenThumbnailSize, + aIsFocused ) ) ); + + } + +// ---------------------------------------------------------------------------- +// checks whether the attributes are relevant, returns EFalse always +// ---------------------------------------------------------------------------- +// +TBool CGlxFullScreenThumbnailBinding::HasRelevantAttributes( + const RArray< TMPXAttribute >& aAttributes ) const + { + + TRACER("CGlxFullScreenThumbnailBinding::HasRelevantAttributes"); + TMPXAttribute tnAttribQuality(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iFullScreenThumbnailSize.iWidth, + iFullScreenThumbnailSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + if ( KErrNotFound != aAttributes.Find( tnAttribQuality, match ) ) + { + GLX_DEBUG1("CGlxFullScreenThumbnailBinding::HasRelevantAttributes (tnAttribQuality) - ETrue"); + return ETrue; + } + else + { + TMPXAttribute tnAttribSpeed(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( EFalse, iFullScreenThumbnailSize.iWidth, + iFullScreenThumbnailSize.iHeight ) ); + if ( KErrNotFound != aAttributes.Find( tnAttribSpeed, match ) ) + { + GLX_DEBUG1("CGlxFullScreenThumbnailBinding::HasRelevantAttributes (tnAttribSpeed) - ETrue"); + return ETrue; + } + } + + GLX_DEBUG1("CGlxFullScreenThumbnailBinding::HasRelevantAttributes - EFalse"); + return EFalse; + } + +// ---------------------------------------------------------------------------- +// invokes the necessary api that sets the thumbnail attribute to the medialist +// ---------------------------------------------------------------------------- +// +void CGlxFullScreenThumbnailBinding::AddRequestL( CGlxAttributeRequirements& aAttributeRequirement,TSize aSize) + { + TRACER("CGlxFullScreenThumbnailBinding::AddRequestL"); + iFullScreenThumbnailSize = aSize; + aAttributeRequirement.AddThumbnailL( iFullScreenThumbnailSize ); + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupStack::PushL( uiUtility ); + aAttributeRequirement.AddThumbnailL( uiUtility->GetGridIconSize() ); + uiUtility->Close(); + CleanupStack::Pop( uiUtility ); + } + + +// ---------------------------------------------------------------------------- +// sends response whether update required or not depending on the focus gained +// ---------------------------------------------------------------------------- +// +CGlxBinding::TResponse CGlxFullScreenThumbnailBinding::HandleFocusChanged( TBool aIsGained ) + { + TRACER("CGlxFullScreenThumbnailBinding::HandleFocusChanged"); + if(aIsGained) + { + + return EUpdateRequested; + } + + return ENoUpdateNeeded; + } + +// ---------------------------------------------------------------------------- +// Icon Binding +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxIconBinding* CGlxIconBinding::NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CGlxMulIconProvider* aMulIcon, const TSize& aSize) + { + TRACER("CGlxIconBinding::NewL"); + CGlxIconBinding* self = CGlxIconBinding::NewLC( aMulTag, aMulIcon, aSize ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxIconBinding* CGlxIconBinding::NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CGlxMulIconProvider* aMulIcon, const TSize& aSize) + { + TRACER("CGlxIconBinding::NewLC"); + CGlxIconBinding* self = new ( ELeave ) CGlxIconBinding( aMulIcon, aSize ); + CleanupStack::PushL( self ); + self->BaseConstructL( aMulTag ); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxIconBinding::~CGlxIconBinding() + { + delete iIconProvider; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxIconBinding::CGlxIconBinding( const CGlxMulIconProvider* aIconProvider, + const TSize& aSize ) : iIconProvider( aIconProvider ), iIconSize(aSize) + { + + } + +// ---------------------------------------------------------------------------- +// populate visual item +// ---------------------------------------------------------------------------- +// +void CGlxIconBinding::PopulateT( MulVisualItem& aItem, + const TGlxMedia& aMedia, TBool /*aIsFocused*/ ) const + { + + TRACER("CGlxIconBinding::PopulateT"); + if(iIconProvider) + { + SetAttributeT( aItem, MulTag(), + std::auto_ptr< GlxIconVariantType >( + GlxIconVariantType::NewL( iIconProvider->IconIdL(aMedia), + iIconProvider->ResourceFileName(), iIconSize ) ) ); + } + + } + +// ---------------------------------------------------------------------------- +// Command Binding +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxCommandBinding* CGlxCommandBinding::NewL( MGlxBoundCommand* aCommand ) + { + TRACER("CGlxCommandBinding::NewL"); + CGlxCommandBinding* self = CGlxCommandBinding::NewLC( aCommand ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two phase construction +// ---------------------------------------------------------------------------- +// +CGlxCommandBinding* CGlxCommandBinding::NewLC( MGlxBoundCommand* aCommand ) + { + TRACER("CGlxCommandBinding::NewLC"); + __ASSERT_DEBUG( aCommand ,User::Invariant()); + CGlxCommandBinding* self = new ( ELeave ) CGlxCommandBinding(); + self->iCommand = aCommand; + // cannot pass aCommand since abstract MGlxCommand pointer is a few bytes off + // from the concrete derived class pointer + CleanupStack::PushL( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxCommandBinding::CGlxCommandBinding() + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxCommandBinding::~CGlxCommandBinding() + { + if(iCommand) + { + iCommand->Close(); + } + } + +// ---------------------------------------------------------------------------- +// populate visual item +// ---------------------------------------------------------------------------- +// +void CGlxCommandBinding::PopulateT( Alf::MulVisualItem& aItem, const TGlxMedia& /*aMedia*/, + TBool /*aIsFocused*/ ) const + { + TRACER("CGlxCommandBinding::PopulateT"); + GlxCommandBindingUtility::SetT( aItem, *iCommand ); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxbindingset.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxbindingset.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2008-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: Implemention of bindings required to populate the visual item +* +*/ + + + + +#include "glxbindingset.h" // holds the bindings required to populate the visual item +#include // Logging +#include +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +CGlxBindingSet* CGlxBindingSet::NewLC( MGlxBindingObserver& aObserver ) + { + TRACER("CGlxBindingSet::NewLC"); + CGlxBindingSet* set = new ( ELeave ) CGlxBindingSet( aObserver ); + CleanupStack::PushL( set ); + return set; + } + +// ---------------------------------------------------------------------------- +// constructor +// ---------------------------------------------------------------------------- +// +CGlxBindingSet::CGlxBindingSet( MGlxBindingObserver& aObserver ) + : iObserver( aObserver ) + { + } + +// ---------------------------------------------------------------------------- +// destructor +// ---------------------------------------------------------------------------- +// +CGlxBindingSet::~CGlxBindingSet() + { + TRACER("CGlxBindingSet::~CGlxBindingSet"); + iBindings.ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// AddBindingL +// ---------------------------------------------------------------------------- +// +void CGlxBindingSet::AddBindingL( CGlxBinding* aBinding ) + { + TRACER("CGlxBindingSet::AddBindingL"); + __ASSERT_DEBUG( aBinding, User::Invariant() ); // null binding not accepted + iBindings.AppendL( aBinding ); + //CleanupStack ::Pop( aBinding ); + aBinding->SetObserver( *this ); + } + +// ---------------------------------------------------------------------------- +// PopulateT +// ---------------------------------------------------------------------------- +// +void CGlxBindingSet::PopulateT( Alf::MulVisualItem& aItem, + const TGlxMedia& aMedia, TBool aIsFocused ) const + { + TRACER("CGlxBindingSet::PopulateT"); + const TInt count = iBindings.Count(); + for ( TInt i = 0; i < count; i++ ) + { + iBindings[i]->PopulateT( aItem, aMedia, aIsFocused ); + } + } + +// ---------------------------------------------------------------------------- +// HasRelevantAttributes +// ---------------------------------------------------------------------------- +// +TBool CGlxBindingSet::HasRelevantAttributes( const RArray< TMPXAttribute >& + aAttributes ) const + { + TRACER("CGlxBindingSet::HasRelevantAttributes"); + TBool isRelevant = EFalse; + TInt count = iBindings.Count(); + TInt i = -1; + while( ++i < count && !isRelevant ) + { + isRelevant = iBindings[i]->HasRelevantAttributes( aAttributes ); + } + GLX_LOG_INFO1("HasRelevantAttributes::isRelevant %d", isRelevant); + return isRelevant; + } + +// ---------------------------------------------------------------------------- +// HandleFocusChanged +// ---------------------------------------------------------------------------- +// +CGlxBinding::TResponse CGlxBindingSet::HandleFocusChanged( TBool aIsGained) + { + TRACER("CGlxBindingSet::HandleFocusChanged"); + TResponse response = ENoUpdateNeeded; + TInt count = iBindings.Count(); + TInt i = -1; + while( ++i < count ) + { + TResponse singleResponse = iBindings[i]->HandleFocusChanged( aIsGained ); + if ( ENoUpdateNeeded != singleResponse ) + { + response = singleResponse; + } + } + return response; + } + + // ---------------------------------------------------------------------------- +// HandleItemChanged +// ---------------------------------------------------------------------------- +// +void CGlxBindingSet::HandleItemChangedL(const CMPXCollectionPath& aPath ) + { + TRACER("CGlxBindingSet::HandleItemChangedL"); + TInt count = iBindings.Count(); + TInt i = -1; + while( ++i < count ) + { + + iBindings[i]->HandleItemChangedL(aPath); + } + } +// ---------------------------------------------------------------------------- +// HandleBindingChanged +// ---------------------------------------------------------------------------- +// +void CGlxBindingSet::HandleBindingChanged( const CGlxBinding& /*aBinding*/ ) + { + TRACER("CGlxBindingSet::HandleBindingChanged"); + iObserver.HandleBindingChanged( *this ); + } + +// ---------------------------------------------------------------------------- +// AddRequirementsL +// ---------------------------------------------------------------------------- +// +void CGlxBindingSet::AddRequirementsL( CGlxAttributeRequirements& + aAttributeRequirement,TSize aSize ) + { + TRACER("CGlxBindingSet::AddRequirementsL"); + for(TInt i = 0; i < iBindings.Count(); i++ ) + { + iBindings.operator[](i)->AddRequestL( aAttributeRequirement,aSize); + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxcommandbindingutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxcommandbindingutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2008-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: collect binding handling here +* +*/ + + + + +#include "glxcommandbindingutility.h" // collect binding handling here +#include // Logging +#include +#include // Client need to use this class to add data in data model +#include +#include // Client need to use this class to add data in data model + +//const char* const KCommandTagName = "cmd"; +const int KCommandTagName = 200; + +// ---------------------------------------------------------------------------- +// CommandVariantType Default Constructor +// ---------------------------------------------------------------------------- +// +CommandVariantType::CommandVariantType( MGlxBoundCommand& aCommand ) + : iCommand( aCommand ) + { + } + +// ---------------------------------------------------------------------------- +// CommandVariantType destructor +// ---------------------------------------------------------------------------- +// +CommandVariantType::~CommandVariantType() + { + //no implementation + } +// ---------------------------------------------------------------------------- +// CommandVariantType::Command +// ---------------------------------------------------------------------------- +// +MGlxBoundCommand& CommandVariantType::Command() const + { + TRACER("CommandVariantType::Command"); + return iCommand; + } + +// ---------------------------------------------------------------------------- +// CommandVariantType::integer +// ---------------------------------------------------------------------------- +// +int CommandVariantType::integer() const + { + TRACER("CommandVariantType::integer"); + return 0; + } + +// ---------------------------------------------------------------------------- +// CommandVariantType::Type +// ---------------------------------------------------------------------------- +// +Alf::MulVariantType::TMulType CommandVariantType::Type() const + { + TRACER("CommandVariantType::Type"); + return MulVariantType::ECustomData; + } + +// ---------------------------------------------------------------------------- +// CommandVariantType::Clone +// ---------------------------------------------------------------------------- +// + std::auto_ptr< Alf::MulVariantType::IMulVariantType > CommandVariantType::Clone() + { + TRACER("CommandVariantType::Clone"); + std::auto_ptr clone( new (EMM) CommandVariantType(iCommand)); + return clone; + } + +// ---------------------------------------------------------------------------- +// GlxCommandBindingUtility::SetT +// ------------------------------------------------------------`---------------- +// +void GlxCommandBindingUtility::SetT( Alf::MulVisualItem& aItem, MGlxBoundCommand& aCommand ) + { + TRACER("GlxCommandBindingUtility::SetT"); + std::auto_ptr< Alf::IMulVariantType > value( new ( EMM ) CommandVariantType( aCommand ) ); + aItem.SetAttribute( (Alf::mulvisualitem::TVisualAttribute)( KCommandTagName ), value.get() ); + value.release(); + } + +// ---------------------------------------------------------------------------- +// GlxCommandBindingUtility::Get +// ---------------------------------------------------------------------------- +// +MGlxBoundCommand* GlxCommandBindingUtility::Get( const Alf::MulVisualItem& aItem ) + { + TRACER("GlxCommandBindingUtility::Get"); + Alf::IMulVariantType* attr = + const_cast< Alf::MulVisualItem& >( aItem ).Attribute( + (Alf::mulvisualitem::TVisualAttribute)( KCommandTagName ) ); + if ( attr ) + { + // If this crashes, it means that the model has tried to copy CommandVariantType object (and hence converted it to AlfVariantType) + // this is a bug in the mul model + __ASSERT_DEBUG( dynamic_cast< CommandVariantType* >(attr), User::Invariant() ); /// @todo panic instead + return &static_cast< CommandVariantType* >( attr )->Command(); + } + return NULL; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxcontainerlistbinding.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxcontainerlistbinding.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,303 @@ +/* +* Copyright (c) 2008-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: CGlxContainerListBinding This class holds the list of +* tags/albums associated with a media item +* +*/ + + + + +#include "glxcontainerlistbinding.h" // his class holds the list of tags/albums associated with a media item + +#include // for TGlxFilterFactory +#include // for attribute priority +#include // Client need to use this class to add data in data model + +using namespace Alf; + +//CONSTANTS +const TInt KTagMediaListId = 0x2000D248; +const TInt KRangeOffset = 50; + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +CGlxContainerListBinding* CGlxContainerListBinding::NewL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const + aMulTag*/, const CMPXCollectionPath& aPath ) + { + CGlxContainerListBinding* self = CGlxContainerListBinding::NewLC( aMulTag, aPath); + CleanupStack::Pop( self ); + return self; + } + + +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +CGlxContainerListBinding* CGlxContainerListBinding::NewLC( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const + aMulTag*/, const CMPXCollectionPath& aPath ) + { + CGlxContainerListBinding* self = new ( ELeave ) CGlxContainerListBinding(); + CleanupStack::PushL( self ); + self->ConstructL( aMulTag, aPath ); + return self; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxContainerListBinding::ConstructL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CMPXCollectionPath& aPath ) + { + CGlxSingleTagBinding::BaseConstructL( aMulTag ); + iContainerPath = CMPXCollectionPath::NewL( aPath ); + + // attributes for Title of tags and albums + iFetchContext = CGlxDefaultAttributeContext::NewL(); + iFetchContext->AddAttributeL( KMPXMediaGeneralTitle ); + iFetchContext->SetRangeOffsets(KRangeOffset,KRangeOffset); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxContainerListBinding::~CGlxContainerListBinding() + { + CloseMediaList(); + } + +// --------------------------------------------------------------------------- +// PopulateT +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::PopulateT( Alf::MulVisualItem& aItem, + const TGlxMedia& aMedia, TBool /*aIsFocused*/ ) const + { + const TInt KCommaLength = 2; + _LIT(KComma,","); + + //T is used for throws as per C++ standard.Hence used instead of "L" + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. + + if(!iContainerList) + { + CreateMediaListL( aMedia.Id() ); + } + + if( iContainerList ) + { + CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); + CleanupStack::PushL(stringConverter ); + + TInt tagListcount = iContainerList->Count(); + //if tags count is grater than 1 then display tags saperated by comma + if( tagListcount > 0 ) + { + HBufC* stringBuffer = NULL; + + for(TInt i=0; i < tagListcount; i++ ) + { + HBufC* string = NULL; + stringConverter->AsStringL( iContainerList->Item(i), + KMPXMediaGeneralTitle, NULL, string ); + if( string ) + { + if( stringBuffer ) + { + stringBuffer = stringBuffer->ReAlloc( stringBuffer->Length() + string->Length() ); + stringBuffer->Des().Append ( string->Des() ); + } + + if( !stringBuffer ) + { + stringBuffer = string->Alloc(); + } + + delete string; + string = NULL; + } + if( i < tagListcount -1 ) + { + if( stringBuffer ) + { + stringBuffer = stringBuffer->ReAlloc( stringBuffer->Length() + KCommaLength ); + stringBuffer->Des().Append( KComma ); + } + } + } + + if( stringBuffer ) + { + aItem.SetAttribute( MulTag(), *stringBuffer ); + delete stringBuffer; + stringBuffer = NULL; + } + } + else + { + aItem.SetAttribute( MulTag(), _L("") ); + } + CleanupStack::PopAndDestroy(stringConverter ); + } + +} +// --------------------------------------------------------------------------- +// CreateMediaListL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::CreateMediaListL(TGlxMediaId aMediaId) const + { + //create filter that excludes all containers that do not contain the specified item + CMPXFilter* itemFilter = TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL( aMediaId ); + CleanupStack::PushL(itemFilter); + + TGlxFilterProperties filterProperty; + filterProperty.iSortOrder = EGlxFilterSortOrderAlphabetical; + filterProperty.iSortDirection = EGlxFilterSortDirectionAscending; + //creates a combined filter, items will be sorted by the filters specified + CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL( filterProperty, + itemFilter, EFalse); + CleanupStack::PushL(filter); + //create media list + iContainerList = MGlxMediaList::InstanceL( *iContainerPath, TGlxHierarchyId(KTagMediaListId), filter ); + iContainerList->AddContextL( iFetchContext, KGlxFetchContextPriorityNormal ); + iContainerList->AddMediaListObserverL( const_cast(this)); + CleanupStack::PopAndDestroy(filter); + CleanupStack::PopAndDestroy(itemFilter); + } +// --------------------------------------------------------------------------- +// CloseMediaListL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::CloseMediaList() + { + if(iContainerList) + { + iContainerList->RemoveMediaListObserver( this ); + if (iFetchContext) + { + iContainerList->RemoveContext( iFetchContext ); + delete iFetchContext; + iFetchContext = NULL; + } + iContainerList->Close(); + } + if (iContainerPath) + { + delete iContainerPath; + iContainerPath= NULL; + } + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/ ) + { + //No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleItemRemovedL( TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + //No implementation + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleAttributesAvailableL( TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, MGlxMediaList* aList ) + { + if( aList == iContainerList ) + { + Update(); + } + } + +// ---------------------------------------------------------------------------- +// HandleFocusChanged +// checks whether the focus has changed,returns the response status +// ---------------------------------------------------------------------------- +// +CGlxBinding::TResponse CGlxContainerListBinding::HandleFocusChanged( + TBool /*aIsGained*/ ) + { + //@todo - Need further implementation + //return aIsGained ? EUpdateRequested : ENoUpdateNeeded ; + //need to remove once bug ESPK-7G6GJX is fixed + return ENoUpdateNeeded ; + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) + { + //No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + //No implementation + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + //No implementation + } + +// --------------------------------------------------------------------------- +// HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleMediaL( TInt /*aListIndex*/, + MGlxMediaList* /*aList*/ ) + { + //No implementation + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxContainerListBinding::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + //No implementation + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxdetailsboundcommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxdetailsboundcommand.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1385 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Command Binding Class's +* +*/ + + + + +#include // Base class for all classes to be instantiated on the heap +#include //For CExifModify +#include "glxdetailsboundcommand.hrh" +#include "glxdetailsboundcommand.h" // Handles user commands +#include +#include +#include +#include // For CGlxCommandHandlerAddToContainer +#include // for command handler id +#include //For launching DRM details pane +#include // Interface for reading lists of media items +#include //for command factory +#include // Content ID identifying general category of content provided +#include //for testing +#include // General utilties class definition +#include // Class provides methods to load and format resource strings +#include // Logging +#include +#include +#include "glxuiutility.h" +#include +/** Error Id EMPY-7MKDHP **/ +#include "mglxmetadatadialogobserver.h" //for call back to dailog + + +//CONSTANTS +const TInt KMaxMediaPopupTitleLength = 0x100; + +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxTitleBoundCommand* CGlxTitleBoundCommand::NewL() + { + TRACER("CGlxTitleBoundCommand::NewL"); + CGlxTitleBoundCommand* self = CGlxTitleBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxTitleBoundCommand* CGlxTitleBoundCommand::NewLC() + { + TRACER("CGlxTitleBoundCommand::NewLC"); + CGlxTitleBoundCommand* self = new ( ELeave ) CGlxTitleBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxTitleBoundCommand::~CGlxTitleBoundCommand() + { + + } +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxTitleBoundCommand::OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist ) + { + TRACER("CGlxTitleBoundCommand::OfferCommandL"); + TBool consumed = EFalse; + iMedialist = &aMedialist; + const CGlxMedia* media = iMedialist->Item(0).Properties(); + if( media ) + { + if ( aCommandId == KGlxEditBoundMenuCommandId && media->IsSupported( KMPXMediaGeneralTitle)) + { + ///@todo - remove popup when editable template is avaliable + //Popup for testing + HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength ); + (textBuf->Des()).Copy((media->ValueText(KMPXMediaGeneralTitle))); + TPtr textPtr = textBuf->Des(); + /// bug fix - EMPY-7MCKD6 + TBuf titleText(*textBuf); + /// bug fix - EMPY-7MCKD6 + ///@todo - remove literal for popup title when resource string is avaliable + HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES); + CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr ); + CleanupStack::PopAndDestroy(buf); + if ( popup->ExecuteLD() == EEikBidOk ) + { + // Text entry was successful + /// bug fix - EMPY-7MCKD6 + //Compare if there is any change in the entry + if(0 != (titleText.Compare(*textBuf))) + /// bug fix - EMPY-7MCKD6 + ModifyTitleL( *textBuf ); + } + CleanupStack::PopAndDestroy( textBuf ); + consumed = ETrue; + } + } + return consumed; + } + +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxTitleBoundCommand::InitMenuL( CEikMenuPane& aMenu ) const + { + TRACER("CGlxTitleBoundCommand::InitMenuL"); + aMenu.SetItemTextL( KGlxEditBoundMenuCommandId, R_GLX_METADATA_VIEW_OPTIONS_EDIT ); + aMenu.SetItemDimmed( KGlxEditBoundMenuCommandId, EFalse ); + } + +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxTitleBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxTitleBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ----------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::ModifyTitleL +// ----------------------------------------------------------------------------- +// +void CGlxTitleBoundCommand::ModifyTitleL(const TDesC& aData ) + { + TRACER("CGlxTitleBoundCommand::ModifyTitleL"); + + if( iMedialist->Count() > 0 ) + { + iMedialist->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item + CMPXCollectionPath* path = iMedialist->PathLC(); + CMPXCommand* command = TGlxCommandFactory::RenameCommandLC(aData,*path); + + command->SetTObjectValueL(KMPXCommandGeneralSessionId, static_cast(this)); + + iMedialist->CommandL(*command); + + CleanupStack::PopAndDestroy(command); + CleanupStack::PopAndDestroy(path); + } + } + +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxTitleBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxTitleBoundCommand::ChangeMskL() + { + TRACER("CGlxTitleBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeySelect,R_GLX_METADATA_MSK_EDIT); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxTitleBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxTitleBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxTagsBoundCommand* CGlxTagsBoundCommand::NewL() + { + TRACER("CGlxTagsBoundCommand::NewL"); + CGlxTagsBoundCommand* self = CGlxTagsBoundCommand::NewLC(); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxTagsBoundCommand* CGlxTagsBoundCommand::NewLC() + { + TRACER("CGlxTagsBoundCommand::NewLC"); + CGlxTagsBoundCommand* self = new ( ELeave ) CGlxTagsBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxTagsBoundCommand::ConstructL() + { + TRACER("CGlxTagsBoundCommand::ConstructL"); + //create command handler + iAddToTag = CGlxCommandHandlerAddToContainer::NewL(this, EGlxCmdAddTag, EFalse); + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::~CGlxTagsBoundCommand +// ---------------------------------------------------------------------------- +// +CGlxTagsBoundCommand::~CGlxTagsBoundCommand() + { + if(iAddToTag) + { + delete iAddToTag; + } + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxTagsBoundCommand::OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist) + { + TRACER("CGlxTagsBoundCommand::OfferCommandL"); + SetMediaList(&aMedialist); + TBool consumed = EFalse; + if ( aCommandId == KGlxEditBoundMenuCommandId ) + { + iAddToTag->ExecuteL(EGlxCmdAddTag); + consumed = ETrue; + } + return consumed; + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxTagsBoundCommand::InitMenuL( CEikMenuPane& aMenu ) const + { + TRACER("CGlxTagsBoundCommand::InitMenuL"); + aMenu.SetItemTextL( KGlxEditBoundMenuCommandId, R_GLX_METADATA_VIEW_OPTIONS_EDIT ); + aMenu.SetItemDimmed( KGlxEditBoundMenuCommandId, EFalse ); + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxTagsBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxTagsBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxTagsBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxTagsBoundCommand::ChangeMskL() + { + TRACER("CGlxTagsBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeySelect,R_GLX_METADATA_MSK_ADD); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxTagsBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::SetMediaList +// ---------------------------------------------------------------------------- +// +void CGlxTagsBoundCommand::SetMediaList(MGlxMediaList* aMedialist) + { + TRACER("CGlxTagsBoundCommand::SetMediaList"); + iMedialist = aMedialist; + } + +// ---------------------------------------------------------------------------- +// CGlxTagsBoundCommand::MediaList +// ---------------------------------------------------------------------------- +// + MGlxMediaList& CGlxTagsBoundCommand::MediaList() + { + TRACER("CGlxTagsBoundCommand::MediaList"); + return *iMedialist; + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxDescriptionBoundCommand* CGlxDescriptionBoundCommand::NewL() + { + TRACER("CGlxDescriptionBoundCommand::NewL"); + CGlxDescriptionBoundCommand* self = CGlxDescriptionBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxDescriptionBoundCommand* CGlxDescriptionBoundCommand::NewLC() + { + TRACER("CGlxDescriptionBoundCommand::NewLC"); + CGlxDescriptionBoundCommand* self = new ( ELeave ) CGlxDescriptionBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxDescriptionBoundCommand::~CGlxDescriptionBoundCommand() + { + + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxDescriptionBoundCommand::OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist ) + { + TRACER("CGlxDescriptionBoundCommand::OfferCommandL"); + TBool consumed = EFalse; + iMedialist = &aMedialist; + const CGlxMedia* media = iMedialist->Item(0).Properties(); + if ( aCommandId == KGlxEditBoundMenuCommandId ) + { + ///@todo - remove popup when editable template is avaliable + //Popup for testing + HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength ); + (textBuf->Des()).Copy((media->ValueText(KMPXMediaGeneralComment))); + TPtr textPtr = textBuf->Des(); + /// bug fix - EMPY-7MCKD6 + TBuf descText(*textBuf); + /// bug fix - EMPY-7MCKD6 + ///@todo - remove literal for popup title when resource string is avaliable + + HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES); + CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr ); + CleanupStack::PopAndDestroy(buf); + + + if ( popup->ExecuteLD() == EEikBidOk ) + { + // Text entry was successful + /// bug fix - EMPY-7MCKD6 + //Compare if there is any change in the entry + if(0 != (descText.Compare(*textBuf))) + /// bug fix - EMPY-7MCKD6 + ModifyDescriptionL( *textBuf ); + } + CleanupStack::PopAndDestroy( textBuf ); + consumed = ETrue; + } + return consumed; + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxDescriptionBoundCommand::InitMenuL( CEikMenuPane& aMenu ) const + { + TRACER("CGlxDescriptionBoundCommand::InitMenuL"); + aMenu.SetItemTextL( KGlxEditBoundMenuCommandId, R_GLX_METADATA_VIEW_OPTIONS_EDIT ); + aMenu.SetItemDimmed( KGlxEditBoundMenuCommandId, EFalse ); + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxDescriptionBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxDescriptionBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxDescriptionBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxDescriptionBoundCommand::ChangeMskL() + { + TRACER("CGlxDescriptionBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeySelect,R_GLX_METADATA_MSK_EDIT); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxDescriptionBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + + +// ----------------------------------------------------------------------------- +// CGlxDescriptionBoundCommand::ModifyDescriptionL +// ----------------------------------------------------------------------------- +// +void CGlxDescriptionBoundCommand::ModifyDescriptionL(const TDesC& aData ) + { + TRACER("CGlxDescriptionBoundCommand::ModifyDescriptionL"); + if( iMedialist->Count() > 0 ) + { + iMedialist->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item + CMPXCollectionPath* path = iMedialist->PathLC(); + CMPXCommand* command = TGlxCommandFactory::SetDescriptionCommandLC(aData,*path); + command->SetTObjectValueL(KMPXCommandGeneralSessionId, static_cast(this)); + + iMedialist->CommandL(*command); + CleanupStack::PopAndDestroy(command); + CleanupStack::PopAndDestroy(path); + } + } + +// ---------------------------------------------------------------------------- +// CGlxLocationBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxLocationBoundCommand* CGlxLocationBoundCommand::NewL() + { + TRACER("CGlxLocationBoundCommand::NewL"); + CGlxLocationBoundCommand* self = CGlxLocationBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxLocationBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxLocationBoundCommand* CGlxLocationBoundCommand::NewLC() + { + TRACER("CGlxLocationBoundCommand::NewLC"); + CGlxLocationBoundCommand* self = new ( ELeave ) CGlxLocationBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxLocationBoundCommand::~CGlxLocationBoundCommand() + { + iDialogObserver = NULL ; + } + +// ---------------------------------------------------------------------------- +// CGlxLocationBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxLocationBoundCommand::OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist ) + { + TRACER("CGlxLocationBoundCommand::OfferCommandL"); + iMedialist = &aMedialist; + TBool consumed = EFalse; + //iAppUi = static_cast< CAknAppUi* >( CCoeEnv::Static()->AppUi() ); + if ( aCommandId == KGlxEditBoundMenuCommandId ) + { + iOnNaviKeySelect = ETrue; + //iAppUi->ProcessCommandL( EGlxCmdOptions ); + //iOnNaviKeySelect = EFalse; + + /** Error Id ESWG-7LSE3W **/ + //get the media item + const TGlxMedia& media = iMedialist->Item( 0 ); + // Test to see if the coordinate is present + TCoordinate coordinate; + TBool isSupported = media.GetCoordinate(coordinate); + if(!isSupported) + { + HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION); + GlxGeneralUiUtilities::ShowInfoNoteL(*buf,ETrue); + CleanupStack::PopAndDestroy(buf); + consumed = ETrue; + } + else + { + /** Error Id EMPY-7MKDHP **/ + /** Show menu pane options **/ + if(iDialogObserver) + { + TRAP_IGNORE(iDialogObserver->OnLocationEditL()); + } + } + } + else + { + iOnNaviKeySelect = EFalse; + } + if ( aCommandId == KGlxDeleteBoundMenuCommandId ) + { + RemoveLocationL(); + consumed = ETrue; + } + return consumed; + } + +// ---------------------------------------------------------------------------- +// CGlxLocationBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxLocationBoundCommand::InitMenuL( CEikMenuPane& aMenu ) const + { + TRACER("CGlxLocationBoundCommand::InitMenuL"); + aMenu.SetItemTextL( EGlxCmdAiwShowMap, R_GLX_METADATA_SHOW_ON_MAP_OPTIONS_VIEW ); + aMenu.SetItemDimmed( EGlxCmdAiwShowMap, EFalse ); + aMenu.SetItemTextL( KGlxDeleteBoundMenuCommandId, R_GLX_METADATA_VIEW_OPTIONS_DELETE ); + aMenu.SetItemDimmed( KGlxDeleteBoundMenuCommandId, EFalse ); + if( iOnNaviKeySelect ) + { + aMenu.SetItemDimmed( EAknCmdHelp, ETrue ); + } + } + +// ---------------------------------------------------------------------------- +// CGlxLocationBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxLocationBoundCommand::HideLocationMenuItem(CEikMenuPane& /*aMenu*/) const + { + TRACER("CGlxLocationBoundCommand::HideLocationMenuItem"); + } + +// ---------------------------------------------------------------------------- +// CGlxLocationBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxLocationBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxLocationBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxLocationBoundCommand::ChangeMskL() + { + TRACER("CGlxLocationBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeySelect,R_GLX_METADATA_MSK_BLANK); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ----------------------------------------------------------------------------- +// CGlxLocationBoundCommand::RemoveLocationL +// ----------------------------------------------------------------------------- +// +void CGlxLocationBoundCommand::RemoveLocationL() + { + TRACER("CGlxLocationBoundCommand::RemoveLocationL"); + + // get the media item + const TGlxMedia& media = iMedialist->Item( 0 ); + + // Test to see if the coordinate is present + TCoordinate coordinate; + TBool isSupported = media.GetCoordinate(coordinate); + + if( !isSupported ) + { + HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION); + GlxGeneralUiUtilities::ShowInfoNoteL(*buf,ETrue); + CleanupStack::PopAndDestroy(buf); + } + else + { + HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_DELETE_LOCATION); + TBool response = GlxGeneralUiUtilities::ConfirmQueryL(R_GLX_QUERY_YES_NO,*buf); + CleanupStack::PopAndDestroy(buf); + + if( response ) + { + //user selected yes, so delete location + //send command for delete location after successfull removal of command remove this pane + if( iMedialist->Count() > 0 ) + { + iMedialist->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item + + // Deleting location information from image file + + RFs rFs; + User::LeaveIfError( rFs.Connect() ); + CleanupClosePushL( rFs ); + RFile rFile; + + User::LeaveIfError( rFile.Open(rFs,iMedialist->Item(0).Uri(),EFileWrite )); + CleanupClosePushL( rFile ); + + TInt imageFileSize = 0; // Image File Size + User::LeaveIfError( rFile.Size( imageFileSize ) ); + HBufC8* imageData = HBufC8::NewL( imageFileSize ); //Actual Image Data + CleanupStack::PushL( imageData ); + + TPtr8 myImagePtr = imageData->Des(); + TInt readError = rFile.Read( myImagePtr ); + if ( readError != KErrNone ) + { + User::Leave( KErrGeneral ); + } + + //CExifModify Interface class for modifying existing Exif v2.2 (or prior) + //file format or creating Exif v2.2 file format using valid Jpeg image + CExifModify* exifWriter = CExifModify::NewL( imageData->Des(), CExifModify::EModify, CExifModify::ENoJpegParsing ); + CleanupStack::PushL( exifWriter ); + //Removes the specified IFD structure and all its tags from the Exif data + exifWriter->DeleteIfd ( EIfdGps ); + + HBufC8* modifiedExif = exifWriter->WriteDataL( imageData->Des() ); //Modified Image Data + CleanupStack::PushL( modifiedExif ); + + const TUint32 fileSize = modifiedExif->Des().Length(); //Size of Modified File + TInt oldSize; + rFile.Size( oldSize ); + // set position to begin of file & write the Modified data (Without Location Information) + TInt pos = 0; + User::LeaveIfError( rFile.Seek( ESeekStart, pos ) ); + User::LeaveIfError( rFile.Write( modifiedExif->Des(), fileSize ) ); + + TTime lastModified; + lastModified.UniversalTime(); + + User::LeaveIfError( rFile.SetModified( lastModified ) ); //Change the Modified Time + + CleanupStack::PopAndDestroy( modifiedExif); + CleanupStack::PopAndDestroy( exifWriter); + CleanupStack::PopAndDestroy( imageData ); + CleanupStack::PopAndDestroy( &rFile ); + CleanupStack::PopAndDestroy( &rFs ); + + // Deleting location information from MDS database + + CMPXCollectionPath* path = iMedialist->PathLC(); + CMPXCommand* command = TGlxCommandFactory::DeleteLocationCommandLC(*path); + + command->SetTObjectValueL(KMPXCommandGeneralSessionId, static_cast(this)); + + iMedialist->CommandL(*command); + + CleanupStack::PopAndDestroy(command); + CleanupStack::PopAndDestroy(path); + } + } + } + } + +// ----------------------------------------------------------------------------- +// CGlxLocationBoundCommand::SetDetailsDailogObserver +// ----------------------------------------------------------------------------- +// +void CGlxLocationBoundCommand::SetDetailsDailogObserver(MGlxMetadataDialogObserver& aObserver) + { + /** Error Id EMPY-7MKDHP **/ + iDialogObserver = &aObserver ; + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxAlbumsBoundCommand* CGlxAlbumsBoundCommand::NewL() + { + TRACER("CGlxAlbumsBoundCommand::NewL"); + CGlxAlbumsBoundCommand* self = CGlxAlbumsBoundCommand::NewLC(); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxAlbumsBoundCommand* CGlxAlbumsBoundCommand::NewLC() + { + TRACER("CGlxAlbumsBoundCommand::NewLC"); + CGlxAlbumsBoundCommand* self = new ( ELeave ) CGlxAlbumsBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxAlbumsBoundCommand::ConstructL() + { + TRACER("CGlxAlbumsBoundCommand::ConstructL"); + //create command handler + iAddToAlbum= CGlxCommandHandlerAddToContainer::NewL(this, EGlxCmdAddToAlbum, EFalse ); + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::~CGlxAlbumsBoundCommand +// ---------------------------------------------------------------------------- +// +CGlxAlbumsBoundCommand::~CGlxAlbumsBoundCommand() + { + if(iAddToAlbum) + { + delete iAddToAlbum; + } + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxAlbumsBoundCommand::OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist) + { + TRACER("CGlxAlbumsBoundCommand::OfferCommandL"); + SetMediaList(&aMedialist); + TBool consumed = EFalse; + if ( aCommandId == KGlxEditBoundMenuCommandId ) + { + iAddToAlbum->ExecuteL(EGlxCmdAddToAlbum); + consumed = ETrue; + } + return consumed; + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxAlbumsBoundCommand::InitMenuL( CEikMenuPane& aMenu ) const + { + TRACER("CGlxAlbumsBoundCommand::InitMenuL"); + aMenu.SetItemTextL( KGlxEditBoundMenuCommandId, R_GLX_METADATA_VIEW_OPTIONS_EDIT ); + aMenu.SetItemDimmed( KGlxEditBoundMenuCommandId, EFalse ); + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxAlbumsBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxAlbumsBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxAlbumsBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxAlbumsBoundCommand::ChangeMskL() + { + TRACER("CGlxAlbumsBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeySelect,R_GLX_METADATA_MSK_ADD); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxAlbumsBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::SetMediaList +// ---------------------------------------------------------------------------- +// +void CGlxAlbumsBoundCommand::SetMediaList(MGlxMediaList* aMedialist) + { + TRACER("CGlxAlbumsBoundCommand::SetMediaList"); + iMedialist = aMedialist; + } + +// ---------------------------------------------------------------------------- +// CGlxAlbumsBoundCommand::MediaList +// ---------------------------------------------------------------------------- +// + MGlxMediaList& CGlxAlbumsBoundCommand::MediaList() + { + TRACER("CGlxAlbumsBoundCommand::MediaList"); + return *iMedialist; + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxResolutionBoundCommand* CGlxResolutionBoundCommand::NewL() + { + TRACER("CGlxResolutionBoundCommand::NewL"); + CGlxResolutionBoundCommand* self = CGlxResolutionBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxResolutionBoundCommand* CGlxResolutionBoundCommand::NewLC() + { + TRACER("CGlxResolutionBoundCommand::NewLC"); + CGlxResolutionBoundCommand* self = new ( ELeave ) CGlxResolutionBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxResolutionBoundCommand::~CGlxResolutionBoundCommand() + { + + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxResolutionBoundCommand::OfferCommandL( TInt /*aCommandId*/ , MGlxMediaList& /*aMedialist*/ ) + { + TRACER("CGlxResolutionBoundCommand::OfferCommandL"); + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxResolutionBoundCommand::InitMenuL( CEikMenuPane& /*aMenu*/ ) const + { + // no implementation + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxResolutionBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxResolutionBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxResolutionBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxResolutionBoundCommand::ChangeMskL() + { + TRACER("CGlxResolutionBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEmpty,R_GLX_METADATA_MSK_BLANK); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxResolutionBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxResolutionBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::NewL( +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxUsageRightsBoundCommand* CGlxUsageRightsBoundCommand::NewL() + { + TRACER("CGlxUsageRightsBoundCommand::NewL"); + CGlxUsageRightsBoundCommand* self = CGlxUsageRightsBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxUsageRightsBoundCommand* CGlxUsageRightsBoundCommand::NewLC() + { + TRACER("CGlxUsageRightsBoundCommand::NewLC"); + CGlxUsageRightsBoundCommand* self = new ( ELeave ) CGlxUsageRightsBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxUsageRightsBoundCommand::~CGlxUsageRightsBoundCommand() + { + + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxUsageRightsBoundCommand::OfferCommandL( TInt aCommandId , MGlxMediaList& aMedialist) + { + TRACER("CGlxUsageRightsBoundCommand::OfferCommandL"); + SetMediaList(&aMedialist); + TBool consumed = EFalse; + if ( aCommandId == KGlxViewBoundMenuCommandId || aCommandId == KGlxEditBoundMenuCommandId ) + { + LaunchDRMViewL(); + consumed = ETrue; + } + return consumed; + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxUsageRightsBoundCommand::InitMenuL( CEikMenuPane& aMenu ) const + { + TRACER("CGlxUsageRightsBoundCommand::InitMenuL"); + aMenu.SetItemTextL( KGlxViewBoundMenuCommandId, R_GLX_METADATA_VIEW_OPTIONS_VIEW ); + aMenu.SetItemDimmed( KGlxViewBoundMenuCommandId, EFalse ); + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxUsageRightsBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxUsageRightsBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxUsageRightsBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxUsageRightsBoundCommand::ChangeMskL() + { + TRACER("CGlxUsageRightsBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeySelect,R_GLX_METADATA_MSK_BLANK); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxUsageRightsBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::SetMediaList +// ---------------------------------------------------------------------------- +// +void CGlxUsageRightsBoundCommand::SetMediaList(MGlxMediaList* aMedialist) + { + TRACER("CGlxUsageRightsBoundCommand::SetMediaList"); + iMedialist = aMedialist; + } + +// ---------------------------------------------------------------------------- +// CGlxUsageRightsBoundCommand::MediaList +// ---------------------------------------------------------------------------- +// + MGlxMediaList& CGlxUsageRightsBoundCommand::MediaList() + { + return *iMedialist; + } + +// ----------------------------------------------------------------------------- +// LaunchDRMViewL +// ----------------------------------------------------------------------------- +// +void CGlxUsageRightsBoundCommand::LaunchDRMViewL() + { + TRACER("CGlxUsageRightsBoundCommand::LaunchDRMViewL"); + CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); + CleanupClosePushL(*drmUtility); + TInt count = MediaList().Count(); + if( count > 0) + { + const CGlxMedia* media = MediaList().Item(0).Properties(); + const TDesC& uri = media->ValueText(KMPXMediaGeneralUri); + drmUtility->ShowDRMDetailsPaneL(uri); + } + CleanupStack::PopAndDestroy(drmUtility); + } + +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxDurationBoundCommand* CGlxDurationBoundCommand::NewL() + { + TRACER("CGlxDurationBoundCommand::NewL"); + CGlxDurationBoundCommand* self = CGlxDurationBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxDurationBoundCommand* CGlxDurationBoundCommand::NewLC() + { + TRACER("CGlxDurationBoundCommand::NewLC"); + CGlxDurationBoundCommand* self = new ( ELeave ) CGlxDurationBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxDurationBoundCommand::~CGlxDurationBoundCommand() + { + + } +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxDurationBoundCommand::OfferCommandL( TInt /*aCommandId*/ , MGlxMediaList& /*aMedialist*/ ) + { + TRACER("CGlxDurationBoundCommand::OfferCommandL"); + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxDurationBoundCommand::InitMenuL( CEikMenuPane& /*aMenu*/ ) const + { + // no implementation + } + +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxDurationBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxDurationBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxDurationBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxDurationBoundCommand::ChangeMskL() + { + TRACER("CGlxDurationBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEmpty,R_GLX_METADATA_MSK_BLANK); + + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDurationBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxDurationBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + + +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxDateAndTimeBoundCommand* CGlxDateAndTimeBoundCommand::NewL() + { + TRACER("CGlxDateAndTimeBoundCommand::NewL"); + CGlxDateAndTimeBoundCommand* self = CGlxDateAndTimeBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxDateAndTimeBoundCommand* CGlxDateAndTimeBoundCommand::NewLC() + { + TRACER("CGlxDateAndTimeBoundCommand::NewLC"); + CGlxDateAndTimeBoundCommand* self = new ( ELeave ) CGlxDateAndTimeBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxDateAndTimeBoundCommand::~CGlxDateAndTimeBoundCommand() + { + + } +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxDateAndTimeBoundCommand::OfferCommandL( TInt /*aCommandId*/ , MGlxMediaList& /*aMedialist*/ ) + { + TRACER("CGlxDateAndTimeBoundCommand::OfferCommandL"); + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxDateAndTimeBoundCommand::InitMenuL( CEikMenuPane& /*aMenu*/ ) const + { + // no implementation + } + +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxDateAndTimeBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxDateAndTimeBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxDateAndTimeBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxDateAndTimeBoundCommand::ChangeMskL() + { + TRACER("CGlxDateAndTimeBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEmpty,R_GLX_METADATA_MSK_BLANK); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxDateAndTimeBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxDateAndTimeBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxFileSizeBoundCommand* CGlxFileSizeBoundCommand::NewL() + { + TRACER("CGlxFileSizeBoundCommand::NewL"); + CGlxFileSizeBoundCommand* self = CGlxFileSizeBoundCommand::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::NewLC +// ---------------------------------------------------------------------------- +// +CGlxFileSizeBoundCommand* CGlxFileSizeBoundCommand::NewLC() + { + TRACER("CGlxFileSizeBoundCommand::NewLC"); + CGlxFileSizeBoundCommand* self = new ( ELeave ) CGlxFileSizeBoundCommand; + CleanupStack::PushL( self ); + return self; + } + +CGlxFileSizeBoundCommand::~CGlxFileSizeBoundCommand() + { + + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxFileSizeBoundCommand::OfferCommandL( TInt /*aCommandId*/ , MGlxMediaList& /*aMedialist*/ ) + { + TRACER("CGlxFileSizeBoundCommand::OfferCommandL"); + return ETrue; + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxFileSizeBoundCommand::InitMenuL( CEikMenuPane& /*aMenu*/ ) const + { + // no implementation + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxFileSizeBoundCommand::HideLocationMenuItem( CEikMenuPane& aMenu ) const + { + TRACER("CGlxFileSizeBoundCommand::HideLocationMenuItem"); + aMenu.SetItemDimmed( EGlxCmdAiwBase, ETrue ); + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::Close +// ---------------------------------------------------------------------------- +// +void CGlxFileSizeBoundCommand::Close() + { + delete this; + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxFileSizeBoundCommand::ChangeMskL() + { + TRACER("CGlxFileSizeBoundCommand::ChangeMskL"); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEmpty,R_GLX_METADATA_MSK_BLANK); + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// ---------------------------------------------------------------------------- +// CGlxFileSizeBoundCommand::SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxFileSizeBoundCommand::SetDetailsDailogObserver( MGlxMetadataDialogObserver& /*aObserver*/ ) + { + + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxdetailsmulmodelprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxdetailsmulmodelprovider.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-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: This class provides the necessary abstraction of the +* implemented class +* +*/ + + + +#include // Logging +#include +#include "glxdetailsmulmodelprovider.h" // This class provides the necessary abstraction of the details provider +#include "glxdetailsmulmodelproviderimpl.h" // This is the implementation class of details data provider +/** Error Id EMPY-7MKDHP **/ +#include "mglxmetadatadialogobserver.h" //for call back to dailog +using namespace Alf; + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxDetailsMulModelProvider* CGlxDetailsMulModelProvider::NewL( + CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ) + { + TRACER("CGlxDetailsMulModelProvider::NewL"); + CGlxDetailsMulModelProvider* self = new( ELeave ) CGlxDetailsMulModelProvider(); + CleanupStack::PushL( self ); + self->ConstructL( aEnv, aWidget, aMediaList, aDefaultTemplate, aDataWindowSize ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProvider::ConstructL( + CAlfEnv& aEnv, Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize) + { + TRACER("CGlxDetailsMulModelProvider::ConstructL"); + iImpl = CGlxDetailsMulModelProviderImpl::NewL( aEnv, aWidget, aMediaList, aDefaultTemplate, aDataWindowSize ); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxDetailsMulModelProvider::~CGlxDetailsMulModelProvider() + { + TRACER("CGlxDetailsMulModelProvider::~CGlxDetailsMulModelProvider"); + delete iImpl; + } + +// ---------------------------------------------------------------------------- +// AddEntryL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDetailsMulModelProvider::AddEntryL( const TGlxMulBindingSetFactory& aFactory ) + { + TRACER("CGlxDetailsMulModelProvider::AddEntryL"); + iImpl->AddEntryL( aFactory ); + } + +// ---------------------------------------------------------------------------- +// OfferCommandL +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxDetailsMulModelProvider::OfferCommandL( TInt aCommandId ) + { + TRACER("CGlxDetailsMulModelProvider::OfferCommandL"); + return iImpl->OfferCommandL(aCommandId); + } + +// ---------------------------------------------------------------------------- +// InitMenuL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDetailsMulModelProvider::InitMenuL( CEikMenuPane& aMenu ) + { + TRACER("CGlxDetailsMulModelProvider::InitMenuL"); + iImpl->InitMenuL(aMenu); + } +// ---------------------------------------------------------------------------- +// HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDetailsMulModelProvider::HideLocationMenuItem( CEikMenuPane& aMenu ) + { + iImpl->HideLocationMenuItem(aMenu); + } + +// ---------------------------------------------------------------------------- +// EnableMskL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDetailsMulModelProvider::EnableMskL() + { + TRACER("CGlxDetailsMulModelProviderImpl::EnableMskL"); + iImpl->EnableMskL(); + } + + +// ---------------------------------------------------------------------------- +// SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDetailsMulModelProvider::SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver) + { + TRACER("CGlxDetailsMulModelProviderImpl::SetDetailsDailogObserver"); + /** Error Id EMPY-7MKDHP **/ + iImpl->SetDetailsDailogObserver( aObserver ) ; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxdetailsmulmodelproviderimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxdetailsmulmodelproviderimpl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,400 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation class for details data provider +* +*/ + + + + +#include "glxdetailsmulmodelproviderimpl.h" // This is the implementation class of details data provider +#include "glxattributerequirement.h" // This class will set the required attribute to the medialist +#include "glxbindingset.h" // This basically holds the bindings required to populate the visual item +#include "glxbinding.h" // This class holds the bindings required to populate the visual item +#include "glxmulbindingsetfactory.h" // CreateBindingSetL creates instance of Binding set +#include // Interface for reading lists of media items +#include // Logging +#include +#include // A helper class for extending CEikMenuPaneItem without breaking binary +#include // attribute/thumbnail fetch context priority definitions +#include "glxdetailsboundcommand.h" // Handles user commands +#include "glxerrormanager.h" // for handling the error attribute that may be attached to items +#include "glxthumbnailattributeinfo.h" +#include "glxdetailsboundcommand.hrh" +/** Error Id EMPY-7MKDHP **/ +#include "mglxmetadatadialogobserver.h" //for call back to dailog +#include +using namespace Alf; + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +CGlxDetailsMulModelProviderImpl* CGlxDetailsMulModelProviderImpl::NewL( + CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ) + { + TRACER("CGlxDetailsMulModelProviderImpl::NewL"); + CGlxDetailsMulModelProviderImpl* self = new ( ELeave )CGlxDetailsMulModelProviderImpl( aWidget, aMediaList, aDefaultTemplate, aDataWindowSize); + CleanupStack::PushL( self ); + self->ConstructL( aEnv, aDefaultTemplate, aDataWindowSize ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::ConstructL( + CAlfEnv& aEnv, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ) + { + TRACER("CGlxDetailsMulModelProviderImpl::ConstructL"); + BaseConstructL( aEnv, aDefaultTemplate, aDataWindowSize ); + iMediaList.AddMediaListObserverL(this); + iAttributeRequirements = CGlxAttributeRequirements::NewL( iMediaList ); + AddWidgetEventHandler(); + } +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxDetailsMulModelProviderImpl::~CGlxDetailsMulModelProviderImpl() + { + TRACER("CGlxDetailsMulModelProviderImpl::~CGlxDetailsMulModelProviderImpl"); + iEntries.ResetAndDestroy(); + iEntries.Close(); + iMediaList.RemoveMediaListObserver( this ); + delete iAttributeRequirements; + } + +// ---------------------------------------------------------------------------- +// AddEntryL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::AddEntryL( const TGlxMulBindingSetFactory& aFactory ) + { + TRACER("CGlxDetailsMulModelProviderImpl::AddEntryL"); + CGlxBindingSet* bindingSet = aFactory.CreateBindingSetL( *this ); + CleanupStack::PushL( bindingSet); + iEntries.Append( bindingSet ); + CleanupStack::Pop( bindingSet ); + TSize Size; + bindingSet->AddRequirementsL(*iAttributeRequirements,Size); + InsertItemsL( iEntries.Count() - 1, 1 ); + } + +// ---------------------------------------------------------------------------- +// OfferCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxDetailsMulModelProviderImpl::OfferCommandL( TInt aCommandId ) + { + TRACER("CGlxDetailsMulModelProviderImpl::OfferCommandL"); + MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + return command->OfferCommandL( aCommandId , iMediaList ); + } + return EFalse; + } + +// ---------------------------------------------------------------------------- +// HasCommandL +// ---------------------------------------------------------------------------- +// +TBool CGlxDetailsMulModelProviderImpl::HasCommandL( CEikMenuPane& aMenuPane, const TInt aCommandId ) + { + TRACER("CGlxDetailsMulModelProviderImpl::HasCommandL"); + TInt count = aMenuPane.NumberOfItemsInPane(); + TInt i = -1; + while ( ++i < count ) + { + if ( aCommandId == aMenuPane.ItemDataByIndexL( i ).iCommandId ) + { + return ETrue; + } + } + return EFalse; + } +// ---------------------------------------------------------------------------- +// InitMenuL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::InitMenuL( CEikMenuPane& aMenu ) + { + TRACER("CGlxDetailsMulModelProviderImpl::InitMenuL"); + //CEikMenuPane::SetItemDimmed will panic if the menu item does not exist + if ( HasCommandL( aMenu, KGlxEditBoundMenuCommandId ) ) + { + // Disable by default, bound command will enable if needed + aMenu.SetItemDimmed( KGlxEditBoundMenuCommandId, ETrue ); + const MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + command->InitMenuL( aMenu ); + } + } + else + { + // no implementation + } + + + if ( HasCommandL( aMenu, KGlxDeleteBoundMenuCommandId ) ) + { + // Disable by default, bound command will enable if needed + aMenu.SetItemDimmed( KGlxDeleteBoundMenuCommandId, ETrue ); + const MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + command->InitMenuL( aMenu ); + } + } + else + { + // no implementation + } + + if ( HasCommandL( aMenu, KGlxViewBoundMenuCommandId ) ) + { + // Disable by default, bound command will enable if needed + aMenu.SetItemDimmed( KGlxViewBoundMenuCommandId, ETrue ); + const MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + command->InitMenuL( aMenu ); + } + } + else + { + // no implementation + } + if ( HasCommandL( aMenu, EGlxCmdAiwShowMap ) ) + { + // Disable by default, bound command will enable if needed + aMenu.SetItemDimmed( EGlxCmdAiwShowMap, ETrue ); + const MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + command->InitMenuL( aMenu ); + } + } + else + { + // no implementation + } +} + +// ---------------------------------------------------------------------------- +// CGlxDetailsMulModelProviderImpl +// ---------------------------------------------------------------------------- +// +CGlxDetailsMulModelProviderImpl::CGlxDetailsMulModelProviderImpl( + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + Alf::mulwidget::TLogicalTemplate /*aDefaultTemplate*/, + TInt /*aDataWindowSize*/ ): + CGlxMulModelProviderBase(aWidget), iMediaList( aMediaList ) + { + } + +// ---------------------------------------------------------------------------- +// HandleBindingChanged +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::HandleBindingChanged( const CGlxBinding& /*aBinding*/ ) + { + for(TInt i = 0; i < iEntries.Count(); i++) + { + UpdateItems( i, 1 ); + } + } + +// ---------------------------------------------------------------------------- +// HandleFocusChanged +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::HandleFocusChanged( TInt aNewFocus, TInt aPreviousFocus ) + { + TRACER("CGlxDetailsMulModelProviderImpl::HandleFocusChanged"); + if ( aPreviousFocus != -1 ) + { + if ( CGlxBinding::EUpdateRequested == + iEntries[ aPreviousFocus ]->HandleFocusChanged( EFalse ) ) + { + UpdateItems( aPreviousFocus, 1 ); + //UpdateItemL( *iEntries[ aPreviousFocus ], media, aPreviousFocus ); + } + } + + if ( aNewFocus != -1 ) + { + if ( CGlxBinding::EUpdateRequested == + iEntries[ aNewFocus ]->HandleFocusChanged( ETrue ) ) + { + UpdateItems( aNewFocus, 1 ); + //UpdateItemL( *iEntries[ aNewFocus ], media, aNewFocus ); + } + } + } + +// ---------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::HandleAttributesAvailableL( TInt aIndex, + const RArray& aAttributes, MGlxMediaList* aList ) + { + TRACER("CGlxDetailsMulModelProviderImpl::HandleAttributesAvailableL"); + if ( aList->FocusIndex() == aIndex ) + { + for(TInt i = 0; i < iEntries.Count(); i++) + { + if(iEntries[i]->HasRelevantAttributes(aAttributes) ) + { + UpdateItems( i, 1 ); + } + } + } + } + +// ---------------------------------------------------------------------------- +// ProvideData +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::ProvideData (int aIndex, int aCount, + MulDataPath /*aPath*/) + { + TRACER("CGlxDetailsMulModelProviderImpl::ProvideData"); + for( int i = aIndex;i < aIndex + aCount ; i++) + { + if( KErrNotFound != iMediaList.FocusIndex()) + { + SetDataT( *iEntries[ i ], iMediaList.Item(iMediaList.FocusIndex()), i ) ; + } + } + } + +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxDetailsMulModelProviderImpl::HandleItemAddedL"); + TInt count = iEntries.Count(); + for(int i = 0; i < count; i++) + { + UpdateItems( i , 1 ); + } + } +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::HandleError( TInt aError ) + { + TRACER("CGlxDetailsMulModelProviderImpl::HandleError"); + TRAP_IGNORE( DoHandleErrorL( aError ) ); + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::DoHandleErrorL( TInt /*aError*/ ) + { + TRACER("CGlxDetailsMulModelProviderImpl::DoHandleErrorL"); + // Check for items for which fetching a thumbnail has failed, and replace + // the default icon with broken icon + TInt count = iMediaList.Count(); + for ( TInt i = 0; i < count; i++ ) + { + const TGlxMedia& item = iMediaList.Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + if( thumbnailError ) + { + UpdateItems( i , 1 ); + } + } + } +// ---------------------------------------------------------------------------- +// HideLocationMenuItem +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::HideLocationMenuItem( CEikMenuPane& aMenu ) + { + if ( HasCommandL( aMenu, EGlxCmdAiwBase ) ) + { + const MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + command->HideLocationMenuItem( aMenu ); + } + } + } + +// ---------------------------------------------------------------------------- +// EnableMskL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::EnableMskL() + { + TRACER("CGlxDetailsMulModelProviderImpl::EnableMskL"); + MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + command->ChangeMskL(); + } + } + +// ---------------------------------------------------------------------------- +// SetDetailsDailogObserver +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::SetDetailsDailogObserver( MGlxMetadataDialogObserver& aObserver ) + { + TRACER("CGlxDetailsMulModelProviderImpl::SetDetailsDailogObserver"); + /** Error Id EMPY-7MKDHP **/ + MGlxBoundCommand* command = BoundCommand( FocusIndex() ); + if ( command ) + { + command->SetDetailsDailogObserver( aObserver ) ; + } + } + + +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxDetailsMulModelProviderImpl::HandleCommandCompleteL(TAny* /*aSessionId*/, + CMPXCommand* /*aCommandResult*/, TInt aError, MGlxMediaList* /*aList*/) + { + TRACER("CGlxDetailsMulModelProviderImpl::HandleCommandCompleteL"); + TGlxMedia media = iMediaList.Item(iMediaList.FocusIndex()) ; + media.DeleteLocationAttribute(); + if ( aError == KErrNone ) + { + UpdateItems( FocusIndex(), 1 ); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxmedialistmulmodelprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxmedialistmulmodelprovider.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: This class provides the necessary abstraction of the implemented class +* +*/ + + + + +#include // Logging +#include +#include "glxmedialistmulmodelprovider.h" // CGlxMediaListMulModelProvider is the provider class which provides data for list view, grid view +#include "glxmedialistmulmodelproviderimpl.h" // The actual implemntation for providign the data to the clients is done here + +using namespace Alf; + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListMulModelProvider* CGlxMediaListMulModelProvider::NewL( CAlfEnv& aEnv, + IMulWidget& aWidget, + MGlxMediaList& aMediaList, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ) + { + TRACER("CGlxMediaListMulModelProvider::NewL"); + CGlxMediaListMulModelProvider* self = new ( ELeave) CGlxMediaListMulModelProvider(); + CleanupStack::PushL( self ); + self->ConstructL( aEnv, aWidget, aMediaList, aFactory, aDefaultTemplate, aDataWindowSize ); + CleanupStack::Pop( self ); + return self; + } + +CGlxMediaListMulModelProvider::CGlxMediaListMulModelProvider() + { + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProvider::ConstructL(CAlfEnv& aEnv, + Alf::IMulWidget& aWidget, + MGlxMediaList& aMediaList, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, TInt aDataWindowSize ) + { + TRACER("CGlxMediaListMulModelProvider::ConstructL"); + iImpl = CGlxMediaListMulModelProviderImpl::NewL( aEnv, aWidget, aMediaList, + aFactory, aDefaultTemplate, aDataWindowSize ); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxMediaListMulModelProvider::~CGlxMediaListMulModelProvider() + { + TRACER("CGlxMediaListMulModelProvider::~CGlxMediaListMulModelProvider"); + delete iImpl; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxmedialistmulmodelproviderimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxmedialistmulmodelproviderimpl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,310 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation class for Medialist Access for Data +* +*/ + + + + +#include "glxmedialistmulmodelproviderimpl.h" // The actual implemntation for providign the data to the clients is done here +#include "glxbindingset.h" // This basically holds the bindings required to populate the visual item +#include // Interface for reading lists of media items +#include "glxthumbnailinfo.h" +#include "glxattributerequirement.h" // This class will set the required attribute to the medialist +#include "glxerrormanager.h" // for handling the error attribute that may be attached to items +#include "glxthumbnailattributeinfo.h" +#include "glxmulbindingsetfactory.h" // CreateBindingSetL creates instance of Binding set +#include // An interface for Multimedia coverflow Widget +#include // Singleton containing resolution utility methods +#include +#include // Logging +#include // Alf utils lib glxalfutils.lib +#include "glxtexturemanager.h" + + +static const char* const KListWidget = "ListWidget"; +static const char* const KCoverFlowWidget = "CoverflowWidget"; + +using namespace Alf; + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +CGlxMediaListMulModelProviderImpl* CGlxMediaListMulModelProviderImpl::NewL( + CAlfEnv& aEnv, + IMulWidget& aWidget, + MGlxMediaList& aMediaList, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ) + { + TRACER("CGlxMediaListMulModelProviderImpl::NewL"); + CGlxMediaListMulModelProviderImpl* self = + new ( ELeave) CGlxMediaListMulModelProviderImpl( aWidget, aMediaList ); + CleanupStack::PushL( self ); + self->ConstructL( aEnv, aFactory, aDefaultTemplate, aDataWindowSize ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxMediaListMulModelProviderImpl::CGlxMediaListMulModelProviderImpl( + IMulWidget& aWidget, MGlxMediaList& aMediaList ) + : CGlxMulModelProviderBase( aWidget ), iMediaList( aMediaList ),iWidget(aWidget) + { + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::ConstructL( CAlfEnv& aEnv, + const TGlxMulBindingSetFactory& aFactory, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, TInt aDataWindowSize ) + { + TRACER("CGlxMediaListMulModelProviderImpl::ConstructL"); + BaseConstructL( aEnv, aDefaultTemplate, aDataWindowSize ); + iMediaList.AddMediaListObserverL(this); + iUiUtility = CGlxUiUtility::UtilityL(); + iAttributeRequirements = CGlxAttributeRequirements::NewL( iMediaList); + iBindingSet = aFactory.CreateBindingSetL( *this ); + + TInt height; + TInt width; + iWidget.GetIconSize(aDefaultTemplate,Alf::mulvisualitem::KMulIcon1,height,width); + TSize thumbnailSize(width,height); + + iBindingSet->AddRequirementsL( *iAttributeRequirements ,thumbnailSize ); + if( iMediaList.Count() > 0 ) + { + HandleItemAddedL( 0, iMediaList.Count() - 1, &iMediaList ); + if(!iUiUtility->IsPenSupported()) + { + CMPXCollectionPath* path = iMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); + iBindingSet->HandleItemChangedL( *path ); + CleanupStack::PopAndDestroy( path ); + } + } + + if(UString( KListWidget ) == UString(iWidget.widgetName() ) || UString( KCoverFlowWidget ) == UString(iWidget.widgetName() ) ) + { + AddWidgetEventHandler(); + } + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxMediaListMulModelProviderImpl::~CGlxMediaListMulModelProviderImpl() + { + TRACER("CGlxMediaListMulModelProviderImpl::~CGlxMediaListMulModelProviderImpl"); + delete iBindingSet; + delete iAttributeRequirements; + iMediaList.RemoveMediaListObserver( this ); + if (iUiUtility) + { + iUiUtility->Close(); + } + + } + +// ---------------------------------------------------------------------------- +// HandleBindingChanged +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleBindingChanged( + const CGlxBinding& aBinding ) + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleBindingChanged"); + SetDataT( aBinding, iMediaList.Item(iMediaList.FocusIndex()), + iMediaList.FocusIndex() ); + + } + +// ---------------------------------------------------------------------------- +// HandleFocusChanged +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleFocusChanged( TInt + /*aNewFocusIndex*/, TInt /*aPreviousFocusIndex*/ ) + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleFocusChanged"); + if (CGlxBinding::EUpdateRequested == iBindingSet->HandleFocusChanged( ETrue ) ) + { + UpdateItems( iMediaList.FocusIndex(), 1 ); + } + } + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ) + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleFocusChangedL"); + CMPXCollectionPath* path = iMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); + if ( aNewIndex != FocusIndex() ) + { + // focus was changed not by the widget, but by some other reason (e.g., item insertion) + //Aki changes - todo + SetFocusIndex( aNewIndex ); + } + iBindingSet->HandleItemChangedL( *path ); // Item changed is handled first before Updating the List - see line 168 moved from here + if( aList->FocusIndex() >=0 && aOldIndex <= aList->Count() -1 && aOldIndex!=-1 ) + { + UpdateItems( aOldIndex, 1 ); + UpdateItems( aNewIndex, 1 ); + } + + CleanupStack::PopAndDestroy( path ); + } + +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleItemAddedL( TInt aStartIndex, + TInt aEndIndex, MGlxMediaList* aList ) + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleItemAddedL"); + GLX_LOG_INFO1("HandleItemAddedL::aStartIndex %d", aStartIndex); + GLX_LOG_INFO1("HandleItemAddedL::aEndIndex %d", aEndIndex); + + InsertItemsL( aStartIndex, aEndIndex - aStartIndex + 1, aList->FocusIndex() ); + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleItemRemovedL( TInt aStartIndex, + TInt aEndIndex, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleItemRemovedL"); + // hack of making the flag iIsReleventAttribute to Etrue will be removed + // once the bug ESPK-7G6GJX + //iIsReleventAttribute = ETrue; + RemoveItems( aStartIndex, aEndIndex - aStartIndex + 1 ); + } + +// ---------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleAttributesAvailableL( TInt aIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleAttributesAvailableL"); + GLX_LOG_INFO1("HandleAttributesAvailableL::Index %d", aIndex); + + if(iBindingSet->HasRelevantAttributes( aAttributes ) ) + { + UpdateItems( aIndex, 1 ); + } + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleError( TInt aError ) + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleError"); + TRAP_IGNORE( DoHandleErrorL( aError ) ); + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::DoHandleErrorL( TInt /*aError*/ ) + { + TRACER("CGlxMediaListMulModelProviderImpl::DoHandleErrorL"); + // Check for items for which fetching a thumbnail has failed, and replace + // the default icon with broken icon + TInt count = iMediaList.Count(); + for ( TInt i = 0; i < count; i++ ) + { + const TGlxMedia& item = iMediaList.Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + if( thumbnailError ) + { + UpdateItems( i , 1 ); + } + } + } + +// ---------------------------------------------------------------------------- +// ProvideData +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::ProvideData (int aIndex, int aCount, + MulDataPath /*aPath*/) + { + TRACER("CGlxMediaListMulModelProviderImpl::ProvideData"); + GLX_LOG_INFO1("ProvideData::aCount %d", aCount); + + if( KErrNotFound != iMediaList.FocusIndex() ) + { + for(int i = aIndex; i < aIndex + aCount ; i++) + { + SetDataT( *iBindingSet, iMediaList.Item(i), i ); + } + } + else + return; + + } + +void CGlxMediaListMulModelProviderImpl::HandleOrientationChanged() + { + TRACER("CGlxMediaListMulModelProviderImpl::HandleOrientationChanged"); + //Fix for ESLM-7VGCS8 + //Since iBindingSet->AddRequirementsL() will change the iFsThumbnailContext's + //thumbnail size due to which thumbnail fetched for old context is getting + //deleted in clean-up. But actually S60 TNM provides same thumbnail for both + //the configurations requests,So it is unneccesary to delete the existing + //thumbnail and request for the same. To avoid this ,iBindingSet->AddRequirementsL() + //and UpdateItems() is removed so that the context will not be changed + //and the thumbnail deletion will not happen. + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxMediaListMulModelProviderImpl::HandleItemModifiedL( const RArray& aItemIndexes, + MGlxMediaList* aList ) + { + //Bug fix for PKAA-7NRBYZ + //First remove all the textures from the list in the texture manager + //otherwise it would not create a new texture for the modified image. + for(TInt index = 0;indexItem(aItemIndexes[index]); + + iUiUtility->GlxTextureManager().RemoveTexture(media.Id(),ETrue); + } + //Now update the items, this would create the new textures and update the view. + for(TInt index = 0;index // Logging +#include +#include "glxmulbindingsetfactory.h" // CreateBindingSetL creates instance of Binding set +#include "glxbindingset.h" // This basically holds the bindings required to populate the visual item +#include "glxpreviewthumbnailbinding.h" // Implementation of preview thumbnail binding for the list view +#include "glxcontainerlistbinding.h" // This class holds the list of tags/albums associated with a media item + +/** + * Constructor + */ +EXPORT_C TGlxMulBindingSetFactory::TGlxMulBindingSetFactory() + : iBindingSet( NULL ) + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulBindingSetFactory::~TGlxMulBindingSetFactory() + { + } + +/** + * CreateBindingSetL + */ +CGlxBindingSet* TGlxMulBindingSetFactory::CreateBindingSetL( + MGlxBindingObserver& aObserver ) const + { + TRACER("TGlxMulBindingSetFactory::CreateBindingSetL"); + CGlxBindingSet* set = CGlxBindingSet::NewLC( aObserver ); + iBindingSet = set; // does not take ownershop + // allow deriving class to add the bindings to the set + AddBindingsL(); + iBindingSet = NULL; // not necessary, but clear for maintenance safety + CleanupStack::Pop( set ); + return set; + } + +/** + * AddStringBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddStringBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + TInt aStringId ) const + { + TRACER("TGlxMulBindingSetFactory::AddStringBindingL"); + iBindingSet->AddBindingL( CGlxStringBinding::NewL( aMulTag, aStringId ) ); + } + +/** + * AddMpxAttributeBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddMpxAttributeBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TMPXAttribute& aAttribute, TInt aFormatStringId ) const + { + TRACER("TGlxMulBindingSetFactory::AddMpxAttributeBindingL"); + iBindingSet->AddBindingL( CGlxMpxAttributeBinding::NewL( aMulTag, aAttribute, aFormatStringId ) ); + } + +/** + * AddThumbnailBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddThumbnailBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const TSize& aSize ) const + { + TRACER("TGlxMulBindingSetFactory::AddThumbnailBindingL"); + iBindingSet->AddBindingL( CGlxThumbnailBinding::NewL( aMulTag, aSize ) ); + } +/** + * AddFullScreenThumbnailBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddFullScreenThumbnailBindingL(const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/)const + { + TRACER("TGlxMulBindingSetFactory::AddFullScreenThumbnailBindingL"); + iBindingSet->AddBindingL( CGlxFullScreenThumbnailBinding::NewL( aMulTag ) ); + } +/** + * AddIconBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddIconBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CGlxMulIconProvider* aMulIcon, const TSize& aSize ) const + { + TRACER("TGlxMulBindingSetFactory::AddIconBindingL"); + iBindingSet->AddBindingL( CGlxIconBinding::NewL( aMulTag, aMulIcon, aSize ) ); + } +/** + * AddContainerListBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddContainerListBindingL( const Alf::mulvisualitem::TVisualAttribute& aMulTag /*const char* const aMulTag*/, + const CMPXCollectionPath& aPath ) const + { + TRACER("TGlxMulBindingSetFactory::AddContainerListBindingL"); + iBindingSet->AddBindingL( CGlxContainerListBinding::NewL( aMulTag, aPath ) ); + } + +/** + * AddCommandBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddCommandBindingL( MGlxBoundCommand* aCommand ) const + { + TRACER("TGlxMulBindingSetFactory::AddCommandBindingL"); + iBindingSet->AddBindingL( CGlxCommandBinding::NewL( aCommand ) ); + } + +/** + * AddTemplateBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddTemplateBindingL( + Alf::mulwidget::TLogicalTemplate aTemplate, + Alf::mulwidget::TLogicalTemplate aTemplateWhenFocused) const + { + TRACER("TGlxMulBindingSetFactory::AddTemplateBindingL"); + iBindingSet->AddBindingL( CGlxTemplateBinding::NewL( aTemplate, aTemplateWhenFocused ) ); + } + + /** + * AddPreviewThumbnailBindingL + */ +EXPORT_C void TGlxMulBindingSetFactory::AddPreviewThumbnailBindingL() const + { + TRACER("TGlxMulBindingSetFactory::AddPreviewThumbnailBindingL"); + iBindingSet->AddBindingL( CGlxPreviewThumbnailBinding::NewL() );//@todo + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxmuliconprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxmuliconprovider.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,377 @@ +/* +* Copyright (c) 2008-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: Provide Icon File Considering Requirement +* +*/ + + + + +#include "glxmuliconprovider.h" // Icon details +#include +#include // A collection of mathematical functions +#include +#include "glxdrmutility.h" // DRM utility class to provide DRM-related functionality +#include "glxmedia.h" // Reference to a media item in the item pool +#include // Logging +#include // TCoordinate +#include +#include // Added for DriveInfo class +#include +#include +#include +#include + +_LIT(KGlxIconsFilename, "glxicons.mif"); + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxMulIconProvider::ConstructL() + { + TRACER("CGlxMulIconProvider::ConstructL"); + iResFileName.Copy(KDC_APP_BITMAP_DIR); + iResFileName.Append(KGlxIconsFilename); + //iResFileName.Copy(resFile); + } + +// ---------------------------------------------------------------------------- +// ResourceFileName +// ---------------------------------------------------------------------------- +// +const TDesC& CGlxMulIconProvider::ResourceFileName() const + { + TRACER("CGlxMulIconProvider::ResourceFileName"); + return iResFileName; + } + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxMulLocationIconProvider* CGlxMulLocationIconProvider::NewL( ) + { + TRACER("CGlxMulLocationIconProvider::NewL"); + CGlxMulLocationIconProvider* self = new (ELeave) CGlxMulLocationIconProvider(); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxMulLocationIconProvider::~CGlxMulLocationIconProvider() + { + + } + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxMulDriveIconProvider* CGlxMulDriveIconProvider::NewL( ) + { + TRACER("CGlxMulDriveIconProvider::NewL"); + CGlxMulDriveIconProvider* self = new (ELeave) CGlxMulDriveIconProvider(); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + return self; + } +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxMulDriveIconProvider::~CGlxMulDriveIconProvider() + { + + } + +// ---------------------------------------------------------------------------- +// IconIdL +// ---------------------------------------------------------------------------- +// +TInt CGlxMulLocationIconProvider::IconIdL( const TGlxMedia& aMedia ) const + { + TRACER("CGlxMulLocationIconProvider::IconIdL"); + const CGlxMedia* media = aMedia.Properties(); + if( media->IsSupported( KGlxMediaGeneralLocation ) ) + { + TCoordinate cordinate = media->ValueTObject(KGlxMediaGeneralLocation); + //Check for valid co-ordinates + if( (!Math::IsNaN(cordinate.Latitude())) && (!Math::IsNaN(cordinate.Longitude())) ) + { + return EMbmGlxiconsQgn_indi_cam4_geotag_on; + } + } + return EMbmAvkonQgn_note_empty; + } + +// ---------------------------------------------------------------------------- +// IconIdL +// ---------------------------------------------------------------------------- +// +TInt CGlxMulDriveIconProvider::IconIdL( const TGlxMedia& aMedia ) const + { + + TRACER("CGlxMulDriveIconProvider::IconIdL"); + // by default set icon for internal mass storage + const CGlxMedia* media = aMedia.Properties(); + TInt iconId= EMbmGlxiconsQgn_indi_fmgr_ms_add; + if( media->IsSupported( KMPXMediaGeneralDrive ) ) + { + const TDesC& drive = media->ValueText(KMPXMediaGeneralDrive); + if(0 == drive.CompareF( + PathInfo::PhoneMemoryRootPath().Left( KMaxDriveName ))) + { + // in phone memory + iconId = EMbmGlxiconsQgn_indi_phone_add; + } + else + { + RFs fsSession; + User::LeaveIfError(fsSession.Connect()); + TUint drvStatus( 0 ); + TDriveUnit driveNumber(drive); + User::LeaveIfError(DriveInfo::GetDriveStatus + ( fsSession, driveNumber, drvStatus ) ); + // To get the entire status of the Drive as "drvStatus" + fsSession.Close(); + if(drvStatus & DriveInfo::EDriveRemovable) + // Do a AND operation to check that the status of the drive is "Removable" or not + { + // in mmc memory + iconId = EMbmGlxiconsQgn_indi_mmc_add; + } + } + } + return iconId; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxMulStaticIconProvider::CGlxMulStaticIconProvider(TInt aResourceIconId) + { + TRACER("CGlxMulStaticIconProvider::CGlxMulStaticIconProvider"); + iIconId = aResourceIconId; + + } + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxMulStaticIconProvider* CGlxMulStaticIconProvider::NewL(TInt aResourceIconId ) + { + TRACER("CGlxMulStaticIconProvider::NewL"); + CGlxMulStaticIconProvider* self = new (ELeave) CGlxMulStaticIconProvider(aResourceIconId); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// IconIdL +// ---------------------------------------------------------------------------- +// +TInt CGlxMulStaticIconProvider::IconIdL(const TGlxMedia& /*aMedia*/ ) const + { + TRACER("CGlxMulStaticIconProvider::IconIdL"); + return iIconId; + } + +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxMulDRMIconProvider::CGlxMulDRMIconProvider() + { + + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxMulDRMIconProvider::~CGlxMulDRMIconProvider() + { + TRACER("CGlxMulDRMIconProvider::~CGlxMulDRMIconProvider"); + if(iDRMUtility) + { + iDRMUtility->Close(); // Memory Leak Fix + } + } + + + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxMulDRMIconProvider* CGlxMulDRMIconProvider::NewL( ) + { + TRACER("CGlxMulDRMIconProvider::NewL"); + CGlxMulDRMIconProvider* self = new (ELeave) CGlxMulDRMIconProvider; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxMulDRMIconProvider::ConstructL() + { + TRACER("CGlxMulDRMIconProvider::ConstructL"); + iDRMUtility = CGlxDRMUtility::InstanceL(); + iIconId = EMbmAvkonQgn_note_empty; + iMifFileName.Copy( KDC_APP_BITMAP_DIR ); + iMifFileName.Append( KGlxIconsFilename ); + } + +// ---------------------------------------------------------------------------- +// IconIdL +// ---------------------------------------------------------------------------- +// +TInt CGlxMulDRMIconProvider::IconIdL(const TGlxMedia& aMedia/**/ ) const + { + TRACER("CGlxMulDRMIconProvider::IconIdL"); + if( aMedia.IsDrmProtected() ) + { + const TDesC& uri = aMedia.Uri(); + if( uri.Length() > 0) + { + if(iDRMUtility->IsForwardLockedL(uri)) + { + return EMbmGlxiconsQgn_prop_drm_rights_valid_super; + } + else + { + TMPXGeneralCategory cat = aMedia.Category(); + TBool checkViewRights = (cat==EMPXImage); + + if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights)) + { + return EMbmGlxiconsQgn_prop_drm_rights_valid_super; + } + else + { + return EMbmGlxiconsQgn_prop_drm_rights_exp_super; + } + } + } + } + + return iIconId; + } + +// ---------------------------------------------------------------------------- +// ResourceFileName +// ---------------------------------------------------------------------------- +// +const TDesC& CGlxMulDRMIconProvider::ResourceFileName() const + { + TRACER("CGlxMulDRMIconProvider::ResourceFileName"); + return iMifFileName; + } + + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxMulVideoIconProvider::CGlxMulVideoIconProvider(TBool aIsFullscreen) + : iIsFullscreen(aIsFullscreen) + { + + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxMulVideoIconProvider::~CGlxMulVideoIconProvider() + { + TRACER("CGlxMulVideoIconProvider::~CGlxMulVideoIconProviderr"); + } + + + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CGlxMulVideoIconProvider* CGlxMulVideoIconProvider::NewL(TBool aIsFullscreen) + { + TRACER("CGlxMulVideoIconProvider::NewL"); + CGlxMulVideoIconProvider* self = new (ELeave) CGlxMulVideoIconProvider(aIsFullscreen); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxMulVideoIconProvider::ConstructL() + { + TRACER("CGlxMulVideoIconProvider::ConstructL"); + iIconId = EMbmAvkonQgn_note_empty; + iMifFileName.Copy( KDC_APP_BITMAP_DIR ); + iMifFileName.Append( KGlxIconsFilename ); + } + +// ---------------------------------------------------------------------------- +// IconIdL +// ---------------------------------------------------------------------------- +// +TInt CGlxMulVideoIconProvider::IconIdL(const TGlxMedia& aMedia) const + { + TRACER("CGlxMulVideoIconProvider::IconIdL"); + + if((aMedia.Category() == EMPXVideo) && (GlxErrorManager::HasAttributeErrorL(aMedia.Properties(), KGlxMediaIdThumbnail ) == KErrNone)) + { + if (iIsFullscreen) + { + return EMbmGlxiconsQgn_indi_media_fullscreen_play; + } + return EMbmGlxiconsQgn_indi_media_thumbnail; + } + return iIconId; + } + +// ---------------------------------------------------------------------------- +// ResourceFileName +// ---------------------------------------------------------------------------- +// +const TDesC& CGlxMulVideoIconProvider::ResourceFileName() const + { + TRACER("CGlxMulVideoIconProvider::ResourceFileName"); + return iMifFileName; + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,570 @@ +/* +* Copyright (c) 2008-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: Interface to Alf Objects +* +*/ + + + + +#include "glxmulmodelproviderbase.h" + +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include //Logging +#include +#include "glxbinding.h" +#include "glxcommandbindingutility.h" +#include +#include + +#include // for KDC_APP_RESOURCE_DIR +#include +#include +#include +#include +#include +#include // An interface for Multimedia coverflow Widget + +using namespace Alf; + +static const char* const KListWidget = "ListWidget"; +static const char* const KGridWidget = "GridWidget"; +static const char* const KCoverFlowWidget = "CoverflowWidget"; + +//@todo to be uncommented when using command binding +//#include "glxboundcommand.h" + +// ---------------------------------------------------------------------------- +// BaseConstructL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::BaseConstructL( + CAlfEnv& aEnv, + Alf::mulwidget::TLogicalTemplate aDefaultTemplate, + TInt aDataWindowSize ) + { + TRACER("CGlxMulModelProviderBase::BaseConstructL"); + + // Create navigational state + iNavigationalState = CGlxNavigationalState::InstanceL(); + + iEnv = &aEnv; + + iDefaultTemplate = aDefaultTemplate; + + iDataWindowSize = aDataWindowSize; + + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxMulModelProviderBase::CGlxMulModelProviderBase( IMulWidget& aWidget ) + : iWidget( aWidget ),iPreviousFocusIndex(-1) + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxMulModelProviderBase::~CGlxMulModelProviderBase() + { + TRACER("CGlxMulModelProviderBase::~CGlxMulModelProviderBase"); + // remove event handler + iWidget.RemoveEventHandler( *this ); + if ( iNavigationalState ) + { + iNavigationalState->Close(); + } + } + +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleItemAddedL( TInt /*aStartIndex*/, TInt + /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleItemRemovedL( TInt /*aStartIndex*/, TInt + /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleAttributesAvailableL( TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleFocusChangedL( NGlxListDefs:: + TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleItemSelected +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleItemSelectedL(TInt aIndex, + TBool aSelected, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMulModelProviderBase::HandleItemSelectedL"); + std::vector itemIndex; + itemIndex.push_back( aIndex); + // changed code ---statr + if(aSelected) + { + iModel->SetMarkedIndices(MulWidgetDef::EMulMark,itemIndex); + } + else + { + iModel->SetMarkedIndices(MulWidgetDef::EMulUnmark,itemIndex); + } + } + +// ---------------------------------------------------------------------------- +// accept +// ---------------------------------------------------------------------------- +// +bool CGlxMulModelProviderBase::accept( Alf::CAlfWidgetControl& /*aControl*/, const + TAlfEvent& /*aEvent*/ ) const + { + TRACER("CGlxMulModelProviderBase::accept"); + //Need implementation + return NULL; + } + +// ---------------------------------------------------------------------------- +// offerEvent +// ---------------------------------------------------------------------------- +// +AlfEventStatus CGlxMulModelProviderBase::offerEvent( Alf::CAlfWidgetControl& + /*aControl*/, const TAlfEvent& aEvent ) + { + TRACER("CGlxMulModelProviderBase::offerEvent"); + AlfEventStatus response = EEventNotHandled; + if ( aEvent.IsCustomEvent() ) + { + switch ( aEvent.CustomParameter() ) + { + case KAlfActionIdDeviceLayoutChanged: + { + HandleOrientationChanged(); + response = EEventNotHandled; + } + break; + case Alf::ETypeHighlight: + { + if ( !iWithinFocusChangeCall ) + { + // iWithinFocusChangeCall = ETrue; + HandleFocusChanged( FocusIndex(), iPreviousFocusIndex ); + //iPreviousFocusIndex = FocusIndex(); + //iWithinFocusChangeCall = EFalse; + } + response = EEventHandled; + } + break; + default: + break; + } + } + return response; + } + +// ---------------------------------------------------------------------------- +// setActiveStates +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::setActiveStates( unsigned int /*aStates*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// setEventHandlerData +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::setEventHandlerData( const Alf::AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// eventHandlerData +// ---------------------------------------------------------------------------- +// +Alf::AlfWidgetEventHandlerInitData* CGlxMulModelProviderBase::eventHandlerData() + { + TRACER("CGlxMulModelProviderBase::eventHandlerData"); + return NULL; + } + +// ---------------------------------------------------------------------------- +// makeInterface +// ---------------------------------------------------------------------------- +// +Alf::IAlfInterfaceBase* CGlxMulModelProviderBase::makeInterface(const Alf::IfId& /*aType */) + { + TRACER("CGlxMulModelProviderBase::makeInterface"); + return this; + } + +// ---------------------------------------------------------------------------- +// eventHandlerType +// ---------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType CGlxMulModelProviderBase:: + eventHandlerType() + { + TRACER("CGlxMulModelProviderBase::eventHandlerType"); + // To Avoid Compiler warning + return IAlfWidgetEventHandler::ELogicalEventHandler; + } + +// ---------------------------------------------------------------------------- +// eventExecutionPhase +// ---------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase + CGlxMulModelProviderBase::eventExecutionPhase() + { + TRACER("CGlxMulModelProviderBase::eventExecutionPhase"); + return EBubblingPhaseEventHandler; + } + +// ---------------------------------------------------------------------------- +// UpdateItemL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::UpdateItems( TInt aIndex, TInt aCount ) + { + TRACER("CGlxMulModelProviderBase::UpdateItems"); + try + { + iModel->Update( aIndex, aCount ); + } + catch (...) + { + throw std::bad_alloc(); + } + } + +// ---------------------------------------------------------------------------- +// SetDataT +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::SetDataT( const CGlxBinding& aBinding, + const TGlxMedia& aMedia, TInt aAtIndex ) + { + TRACER("CGlxMulModelProviderBase::SetDataT"); + iModel->SetData( aAtIndex, CreateItemT( aBinding, aMedia, + IsFocused( aAtIndex ) ) ); + } + +// ---------------------------------------------------------------------------- +// CreateItemT +// ---------------------------------------------------------------------------- +// +auto_ptr CGlxMulModelProviderBase::CreateItemT( + const CGlxBinding& aBinding, const TGlxMedia& aMedia, TBool aIsFocused ) + { + TRACER("CGlxMulModelProviderBase::CreateItemT"); + auto_ptr item( new ( EMM ) MulVisualItem() ); + aBinding.PopulateT( *item, aMedia, aIsFocused ); + return item; + } +// ---------------------------------------------------------------------------- +// CreateModelL +// ---------------------------------------------------------------------------- +// + +void CGlxMulModelProviderBase::CreateModelL() + { + + const char* KLoadNameModel( "mulmodel" ); + try + { + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); + + std::auto_ptr< Alf::IMulModel > model( + widgetFactory.createModel< IMulModel >( KLoadNameModel ) ); + iModel = model.release(); + if( iDataWindowSize > 0 ) + { + iModel->SetDataWindow(iDataWindowSize); + } + iModel->SetDataProvider( *this ); + iModel->SetTemplate( iDefaultTemplate ); + } + catch (...) + { + User::Leave( KErrNoMemory ); + } + } +// ---------------------------------------------------------------------------- +// InsertItemsL +// ---------------------------------------------------------------------------- +// + +void CGlxMulModelProviderBase::InsertItemsL( TInt aIndex, TInt aCount, TInt aMediaListFocusIndex ) + { + TRACER("CGlxMulModelProviderBase::InsertItemsL"); + // The order of calling should be Model->Insert(..), + // Model->SetHighlight(..) and Widget.SetModel(..) + // Change the order once bug EPBA-7JRDXV ( SetModel Crashes if highlight + // index is set >0 before setting model. )is fixed. + if(!iWidget.model()) + { + CreateModelL(); + } + + if(iWidget.model()) + { + iModel->SetTemplate( iDefaultTemplate ); + } + + iModel->Insert( aIndex, aCount ); + + if( aMediaListFocusIndex >= 0 ) + { + SetFocusIndex( aMediaListFocusIndex ); + } + + if(!iWidget.model()) + { + iWidget.SetModel( iModel->Accessor() ); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *uiUtility ); + TSize defaultIconSize = uiUtility->GetGridIconSize(); + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + TInt defaultTextureId = uiUtility-> + GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_notcreated, resFile, + defaultIconSize ).Id(); + + static_cast(iWidget).SetDefaultImage( defaultTextureId ) ; + CleanupStack::PopAndDestroy( uiUtility ); + } + + } + +// ---------------------------------------------------------------------------- +// RemoveItem +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::RemoveItems( TInt aIndex, TInt aCount ) + { + TRACER("CGlxMulModelProviderBase::RemoveItems"); + // RemoveItems does not throw according to model documentation + iModel->Remove( aIndex, aCount ); + } + +// ---------------------------------------------------------------------------- +// SetFocusIndex +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::SetFocusIndex( TInt aIndex ) + { + TRACER("CGlxMulModelProviderBase::SetFocusIndex"); + iModel->SetHighlight( aIndex ); + } +// ---------------------------------------------------------------------------- +// IsFocused +// ---------------------------------------------------------------------------- +// + +TBool CGlxMulModelProviderBase::IsFocused( TInt aIndex ) const + { + TRACER("CGlxMulModelProviderBase::IsFocused"); + return aIndex == FocusIndex() && aIndex != LAST_INDEX; + } + + + +// ---------------------------------------------------------------------------- +// FocusIndex +// ---------------------------------------------------------------------------- +// + +TInt CGlxMulModelProviderBase::FocusIndex() const + { + TRACER("CGlxMulModelProviderBase::FocusIndex"); + TInt index = 0; + /// @todo use multiline widget instead of this widget hack. Currently model does not have interface for highlight. + + // We are comparing depending on teh widget name which we are setting during the + // widget creation, but for that we had to do dynamic_cast which fails on hardware + // and is not the preffered way of doing, so as of now we have to check using widget name + + if(UString(KListWidget) == UString(iWidget.widgetName() ) ) + { + index = iModel->Highlight(); + } + else if ( UString(KGridWidget) == UString(iWidget.widgetName() ) ) + { + index = iModel->Highlight(); + } + else if (UString(KCoverFlowWidget) == UString(iWidget.widgetName() ) ) + { + index = iModel->Highlight(); + // Check if Model count is zero in FS view, activate back grid view. + if (iModel->Count() ==0) + { + TRAP_IGNORE( iNavigationalState->ActivatePreviousViewL() ); + } + } + else + { + return KErrGeneral; + } + + return index; + } + +// ---------------------------------------------------------------------------- +// HandleMessageL +// ---------------------------------------------------------------------------- +// + void CGlxMulModelProviderBase::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleError( TInt /*aError*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleCommandCompleteL( TAny* /*aSessionId*/, CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleMediaL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleFocusChanged +// ---------------------------------------------------------------------------- +// +//@todo: Implementation to be done later depending on the scenario +void CGlxMulModelProviderBase::HandleFocusChanged( TInt /*aNewFocusIndex*/, + TInt /*aPreviousFocusIndex*/ ) + { + // default implementation empty + } + + + +// ---------------------------------------------------------------------------- +// BoundCommand +// ---------------------------------------------------------------------------- +// +MGlxBoundCommand* CGlxMulModelProviderBase::BoundCommand( TInt aVisualItemIndex ) const + { + TRACER("CGlxMulModelProviderBase::BoundCommand"); + if ( iModel->Count() > 0 ) + { + return GlxCommandBindingUtility::Get( Item( aVisualItemIndex ) ); + } + return NULL; + } + +// ---------------------------------------------------------------------------- +// Item +// ---------------------------------------------------------------------------- +// +const Alf::MulVisualItem& CGlxMulModelProviderBase::Item( TInt aIndex ) const + { + TRACER("CGlxMulModelProviderBase::Item"); + ASSERT( aIndex >= 0 && aIndex < iModel->Count() ); + return *(iModel->Data( aIndex )); + } + +//----------------------------------------------------------------------------- +// HandleResolutionChanged +//----------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::HandleOrientationChanged() + { + + } + +//----------------------------------------------------------------------------- +// HandleResolutionChanged +//----------------------------------------------------------------------------- +// +void CGlxMulModelProviderBase::AddWidgetEventHandler() + { + iWidget.AddEventHandler( *this ); + } + +//EOF diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxpreviewthumbnailbinding.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxpreviewthumbnailbinding.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,569 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description:Implementation of preview thumbnail binding for the +* list view +* +*/ + + + + +#include +#include +#include +#include // For TGlxFilterFactory +#include +#include "glxpreviewthumbnailbinding.h" +#include "glxuiutility.h" +#include "glxmulthumbnailvarianttype.h" +#include "glxgeneraluiutilities.h" + +#include +#include + +#include // Fetch context priority def'ns + +const TInt KThumbnailStartTimeDelay(2000000); +const TInt KThumbnailIntervalTimeDelay(2000000); +const TInt KPreviewThumbnailProgressiveCount(14); // iterates from -1 to < 14 thumbnail +const TInt KPreviewThumbnailFetchCount(15); // const that is used to fetch fifteen thumbnail + // attributes +const TInt KPotraitSlot(1); +const TInt KLandscapeSlot(3); + +using namespace Alf; + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding* CGlxPreviewThumbnailBinding::NewL() + { + TRACER("CGlxPreviewThumbnailBinding::NewL"); + CGlxPreviewThumbnailBinding* self = CGlxPreviewThumbnailBinding::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding* CGlxPreviewThumbnailBinding::NewLC() + { + TRACER("CGlxPreviewThumbnailBinding::NewLC"); + CGlxPreviewThumbnailBinding* self = new(ELeave)CGlxPreviewThumbnailBinding; + self->ConstructL(); + CleanupStack::PushL(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding::CGlxPreviewThumbnailBinding() + { + + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::ConstructL() + { + TRACER("CGlxPreviewThumbnailBinding::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL(); + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + } + + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding::~CGlxPreviewThumbnailBinding() + { + TRACER("CGlxPreviewThumbnailBinding::~CGlxPreviewThumbnailBinding"); + // close any medialist that exist + if( iMediaList ) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + delete iThumbnailContext; + iMediaList->Close(); + iMediaList = NULL; + } + if ( iUiUtility) + { + iUiUtility->Close (); + } + // cancel any outstanding request of the timer + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } + delete iTimer; + iTimer = NULL; + iPreviewItemCount.Close(); + + } + + +// ---------------------------------------------------------------------------- +// CreateThumbnail +// ---------------------------------------------------------------------------- +// +std::auto_ptr< GlxThumbnailVariantType > CGlxPreviewThumbnailBinding::CreateThumbnailL( TInt aIndex )const + { + TRACER("CGlxPreviewThumbnailBinding::CreateThumbnailL"); + const TGlxMedia& media = iMediaList->Item( aIndex ); + return auto_ptr< GlxThumbnailVariantType >( GlxThumbnailVariantType::NewL( media, + iUiUtility->GetGridIconSize() ) ); + } + +// ---------------------------------------------------------------------------- +// PopulateT +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::PopulateT(Alf::MulVisualItem& aItem, const TGlxMedia& aMedia, + TBool aIsFocused )const + { + TRACER("CGlxPreviewThumbnailBinding::PopulateT"); + //T is used for throws as per C++ standard.Hence used instead of "L" + //Ignoring this for code scanner warnings - Leaving functions called in non-leaving functions. + if ( aMedia.Properties() && aIsFocused && iStartedShowingThumbnails && iProgressIndex != KErrNotFound ) + { + if( !iCurrentOrientationLandscape ) + { + + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon1, + CreateThumbnailL( MediaIndexBySlotIndex( iProgressIndex, 0 ) ).release() ); + } + + // if orientation is landscape + else + { + // shows thumbnials with an interval of 2 sec at different slot + if( iMediaList->Count() > iSlots && iPreviewItemCount.Count() >= iSlots && iTimerTicked ) + { + GLX_LOG_INFO("inside if( iTimerTicked && iMediaList->Count() > KLandscapeSlot)"); + SetThumbnailAttributeL(aItem); + } + else + { + // shows thumbnail simultaneously + GLX_LOG_INFO("inside else"); + SetInitialThumbnailAttributeL(aItem, iSlots ); + } + + } // end of else + + + } // end of if + + } + +// ---------------------------------------------------------------------------- +// SetInitialThumbnailAttribute: setting initial thumbnails to slot to show +// simutaneously +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::SetInitialThumbnailAttributeL(Alf::MulVisualItem& aItem, + TInt aSlots ) const + { + TRACER("CGlxPreviewThumbnailBinding::SetInitialThumbnailAttribute"); + aSlots = Min( iPreviewItemCount.Count(),aSlots ); + switch( aSlots ) + { + case 1: + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon1, + CreateThumbnailL( iPreviewItemCount[0] ).release() ); + break; + + case 2: + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon2, + CreateThumbnailL( iPreviewItemCount[0] ).release() ); + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon1, + CreateThumbnailL( iPreviewItemCount[1] ).release() ); + break; + + case 3: + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon3, + CreateThumbnailL( iPreviewItemCount[0] ).release() ); + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon2, + CreateThumbnailL( iPreviewItemCount[1] ).release() ); + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon1, + CreateThumbnailL( iPreviewItemCount[2] ).release() ); + break; + } + } + + +// function that sets the thumbnail to different slots +// ---------------------------------------------------------------------------- +// SetThumbnailAttribute: setting thumbnial to visual item at appropriate slot +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::SetThumbnailAttributeL(Alf::MulVisualItem& aItem ) const + { + TRACER("CGlxPreviewThumbnailBinding::SetThumbnailAttribute"); + switch( iSlotIndex ) + { + case 0: + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon3, + CreateThumbnailL( MediaIndexBySlotIndex( iProgressIndex, iSlotIndex ) ).release() ); + + PreviewSlotIndex( iSlots, iSlotIndex ); + break; + + case 1: + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon2, + CreateThumbnailL( MediaIndexBySlotIndex( iProgressIndex, iSlotIndex ) ).release() ); + + PreviewSlotIndex( iSlots, iSlotIndex ); + break; + + case 2: + aItem.SetAttribute( Alf::mulvisualitem::KMulIcon1, + CreateThumbnailL( MediaIndexBySlotIndex( iProgressIndex, iSlotIndex ) ).release() ); + + PreviewSlotIndex( iSlots, iSlotIndex ); + break; + } + } + +// ---------------------------------------------------------------------------- +// PreviewSlotIndex: returns the next index where thumbails to be shown +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::PreviewSlotIndex( TInt aSlot, TInt aSlotIndex ) const + { + TRACER("CGlxPreviewThumbnailBinding::PreviewSlotIndex"); + if(aSlot > aSlotIndex + 1) + { + iSlotIndex++; + } + else + { + iSlotIndex = 0; + } + } + +// ---------------------------------------------------------------------------- +// MediaIndexBySlotIndex: returns the index for which to retrieve thumbnail +// ---------------------------------------------------------------------------- +// +TInt CGlxPreviewThumbnailBinding::MediaIndexBySlotIndex(TInt aProgressIndex, + TInt /*aSlotIndex*/ ) const + { + TRACER("CGlxPreviewThumbnailBinding::MediaIndexBySlotIndex"); + + return aProgressIndex; + } + + +// ---------------------------------------------------------------------------- +// TimerTicked: we need to update only when required i.e, when the thumbnail count +// has not reached till the max limit to be shown +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::TimerTicked() + { + //iTimerTicked = ETrue; + TRACER("CGlxPreviewThumbnailBinding::TimerTicked"); + iCurrentOrientationLandscape = GlxGeneralUiUtilities::IsLandscape(); + + if(iMediaList) + { + iSlots = Min( iMediaList->Count(), + iCurrentOrientationLandscape ? KLandscapeSlot : KPotraitSlot ); + if( iPreviewItemCount.Count() >= iSlots && iProgressIndex < KPreviewThumbnailProgressiveCount + && iProgressIndex < iMediaList->Count()-1) + { + iTimerTicked = ETrue; + iProgressIndex++; + Update(); + //iTimerTicked = EFalse; + } + else + { + iProgressIndex = KErrNotFound; + //iStartedShowingThumbnails = EFalse; + } + } + + } + + +// ---------------------------------------------------------------------------- +// IsTime callback function invoked when timer expires +// ---------------------------------------------------------------------------- +// +TInt CGlxPreviewThumbnailBinding::IsTime( TAny* aSelf ) + { + TRACER("CGlxPreviewThumbnailBinding::IsTime"); + if (aSelf) + { + TRACER("CGlxPreviewThumbnailBinding::IsTime"); + CGlxPreviewThumbnailBinding* self = static_cast(aSelf); + if(self) + { + self->TimerTicked(); + } + + + } + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// HandleFocusChanged +// This function resets any existing timer and starts a new timer tick +// ---------------------------------------------------------------------------- +// + +CGlxBinding::TResponse CGlxPreviewThumbnailBinding::HandleFocusChanged( TBool aIsGained ) + { + TRACER("CGlxPreviewThumbnailBinding::HandleFocusChanged"); + if(aIsGained) + { + if(iTimer) + { + iTimer->Cancel(); + } + + if(!iTimer->IsActive() ) + { + iTimer->Start(KThumbnailStartTimeDelay, KThumbnailIntervalTimeDelay, + TCallBack(IsTime,this)); + + } + } + //return EUpdateRequested; + return ENoUpdateNeeded; + } + + +// ---------------------------------------------------------------------------- +// HandleItemChangedL +// This function basically closes the old medialist if any for ex. Tags, +// Captured.. and then opens a new medialist with teh required filter. +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemChangedL(const CMPXCollectionPath& aPath ) + { + TRACER("CGlxPreviewThumbnailBinding::HandleItemChangedL"); + iStartedShowingThumbnails = EFalse; + iTimerTicked = EFalse; + iProgressIndex = KErrNotFound; + iPreviewItemCount.Close(); + // remove and close old medialist + if( iMediaList ) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + delete iThumbnailContext; + iMediaList->Close(); + iMediaList = NULL; + } + + // Filter that filters out any GIF, corrupted images + CMPXFilter* filter = NULL; + filter = TGlxFilterFactory::CreatePreviewFilterL(); + CleanupStack::PushL( filter ); + // create new medialist with the required filter which filters out all DRM, GIFS and corrupt + // thumbnial + iMediaList = MGlxMediaList::InstanceL( aPath ,KGlxIdNone, filter); + iThumbnailContext = CGlxThumbnailContext::NewL( &iThumbnailIterator ); // set the thumbnail context + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); // request for fifiteen thumbnails + iThumbnailContext->SetDefaultSpec( iUiUtility->GetGridIconSize().iWidth,iUiUtility->GetGridIconSize().iHeight ); + iMediaList->AddContextL(iThumbnailContext ,KGlxFetchContextPriorityNormal ); + // adding the medialist to observ any changes or updates done + iMediaList->AddMediaListObserverL(this); + CleanupStack::PopAndDestroy( filter ); + } + + +// ---------------------------------------------------------------------------- +// HasFirstThumbnail +// ---------------------------------------------------------------------------- +// + TBool CGlxPreviewThumbnailBinding::HasFirstThumbnail( const RArray< TMPXAttribute >& aAttributes ) + { + TRACER("CGlxPreviewThumbnailBinding::HasFirstThumbnail"); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, + iUiUtility->GetGridIconSize().iWidth,iUiUtility->GetGridIconSize().iHeight) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + return ( KErrNotFound != aAttributes.Find( thumbnailAttribute, match ) ); + } +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemAddedL( TInt aStartIndex, TInt + aEndIndex, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxPreviewThumbnailBinding::HandleItemAddedL"); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iUiUtility->GetGridIconSize().iWidth, iUiUtility->GetGridIconSize().iHeight ) ); + for(TInt i = aStartIndex; i <= aEndIndex; i++) + { + const TGlxMedia& item = iMediaList->Item( i ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); + if (value) + { + iPreviewItemCount.AppendL( i ); + iStartedShowingThumbnails = ETrue; + iProgressIndex = 0; + } + } + if(!iTimer->IsActive() && iMediaList && iMediaList->Count()) + { + GLX_LOG_INFO("CGlxPreviewThumbnailBinding::HandleItemAddedL start timer"); + iTimer->Start(KErrNone, KThumbnailIntervalTimeDelay, TCallBack(IsTime,this)); + } + + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemRemovedL( TInt /*aStartIndex*/, TInt + /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleAttributesAvailableL +// Inside this function we are going to append the index for which we have valid +// thumbnails and when the number of available thumbnails become equal to the +// number of slots where thumbnail to be shown we go for updating them to visual +// item. +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxPreviewThumbnailBinding::HandleAttributesAvailableL"); + GLX_LOG_INFO1("CGlxPreviewThumbnailBinding::HandleAttributesAvailableL aItemIndex %d ", aItemIndex); + TInt count = aAttributes.Count(); + // whether orientation is landscape or portrait + iCurrentOrientationLandscape = GlxGeneralUiUtilities::IsLandscape(); + // islots has number as to how many slots need to be filled + iSlots = Min( iMediaList->Count(), + iCurrentOrientationLandscape ? KLandscapeSlot : KPotraitSlot ); + + for(TInt i = 0; i< count; i++) + { + TMPXAttribute attribute = aAttributes[i]; + } + if( !iStartedShowingThumbnails ) + { + GLX_LOG_INFO(" inside if( !iStartedShowingThumbnails )"); + iStartedShowingThumbnails = HasFirstThumbnail(aAttributes); + if( iStartedShowingThumbnails ) + { + //if relevent thumbnial then add the index to an array + GLX_LOG_INFO("inside if( iStartedShowingThumbnails"); + iStartedShowingThumbnails = EFalse; + iPreviewItemCount.AppendL( aItemIndex ); + iProgressIndex++; + // checks if the number of thumbnials are ready to display + if(iPreviewItemCount.Count() == iSlots ) + { + GLX_LOG_INFO("inside if(iPreviewItemCount.Count() >= iSlots && iTimerTicked )"); + // update the thumbnails and set the flag iStartShowingThumbnails which willbe + // checked at the time of populating teh visual item. + iStartedShowingThumbnails = ETrue; + Update(); + + }// end of if(iPreviewItemCount.Count() == iSlots ) + }// end of if(iStartedShowingThumbnails) + } + } + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleFocusChangedL( NGlxListDefs:: + TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) + { + // HandleFocusChanged(ETrue); + TRACER("CGlxPreviewThumbnailBinding::HandleFocusChangedL"); + } + +// ---------- ------------------------------------------------------------------ +// HandleItemSelected +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleMessageL +// ---------------------------------------------------------------------------- +// + void CGlxPreviewThumbnailBinding::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleError( TInt /*aError*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleMediaL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxthumbnailvarianttype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxthumbnailvarianttype.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,536 @@ +/* +* Copyright (c) 2008-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: Makes the Decision to Create Thumbnail Texture or Icon Texture +* Considering Drm Validity and Thumbnail Availabilty +* +*/ + + + + +#include "glxmulthumbnailvarianttype.h" +#include +#include +#include "glxuiutility.h" +#include "glxtexturemanager.h" +#include +#include +#include +#include +#include // Logging +#include +#include +#include +_LIT(KGlxIconsFilename, "glxicons.mif"); + + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +GlxThumbnailVariantType* GlxThumbnailVariantType::NewL( const TGlxMedia& aMedia, const TSize& aSize, + TBool aIsFocused ) + { + TRACER("GlxThumbnailVariantType::NewL"); + GlxThumbnailVariantType* self = GlxThumbnailVariantType::NewLC( aMedia, + aSize, aIsFocused ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +GlxThumbnailVariantType* GlxThumbnailVariantType::NewLC( const TGlxMedia& aMedia, const TSize& aSize, + TBool aIsFocused ) + { + TRACER("GlxThumbnailVariantType::NewLC"); + + GlxThumbnailVariantType* self = new ( EMM ) GlxThumbnailVariantType( + aMedia, aSize, aIsFocused ); + CleanupStack::PushL( self ); + self->ConstructL( aMedia, aSize, aIsFocused ); + return self; + } + +// ---------------------------------------------------------------------------- +// constructor +// ---------------------------------------------------------------------------- +// +GlxThumbnailVariantType::GlxThumbnailVariantType( const TGlxMedia& /*aMedia*/, + const TSize& /*aSize*/, TBool /*aIsFocused*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void GlxThumbnailVariantType::ConstructL( const TGlxMedia& aMedia, const TSize& aSize, + TBool aIsFocused ) + { + + TRACER("GlxThumbnailVariantType::ConstructL"); + GLX_DEBUG2("GlxThumbnailVariantType::ConstructL Media Id=%d", aMedia.Id().Value()); + iUiUtility = CGlxUiUtility::UtilityL(); + + TBool drm = EFalse; + TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown; + + if(aMedia.GetDrmProtected(drm)) + { + GLX_DEBUG1("GlxThumbnailVariantType::ConstructL CGlxDRMUtility::InstanceL"); + iDrmUtility = CGlxDRMUtility::InstanceL(); + aMedia.GetDrmValidity(isValid); + } + + TBool fsTnmAvailable = HasRelevantThumbnail(aMedia,aSize); + + TIconInfo icon; + + TSize defaultSize = iUiUtility->GetGridIconSize(); + + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + + TInt frameCount = 0; + aMedia.GetFrameCount(frameCount); + + const TDesC& uri = aMedia.Uri(); + GLX_DEBUG2("GlxThumbnailVariantType::ConstructL() uri.Length()=%d", uri.Length()); + + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + aMedia.Properties(), KGlxMediaIdThumbnail ); + + TInt err = KErrNone; + TBool expired = EFalse; + + if ( aIsFocused && frameCount > 1 && (fsTnmAvailable) ) + { + GLX_DEBUG1("GlxThumbnailVariantType::CreateAnimatedGifTextureL"); + TRAP( err, mTextureId = iUiUtility->GlxTextureManager(). + CreateAnimatedGifTextureL( uri, aSize ).Id() ); + } + //URI length could be zero for Media Id based Thumbnail fetch + else if ( fsTnmAvailable ) + { + GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL"); + TMPXGeneralCategory cat = aMedia.Category(); + if(drm) + { + expired = iDrmUtility->CheckOpenRightsL(uri, (cat == EMPXImage)); + if( expired ) + { + // 200 is to Consume rights only while opening DRM items + // in Cover Flow Widget + if ( aSize.iWidth > 200 && aIsFocused) + { + ConsumeDRMRightsL( aMedia ); + } + if ( isValid ) + { + // Fix for EABI-7RL9DD + // Replaced defaultSize with aSize + TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( + aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); + } + } + else + { + TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize ).Id() ); + // check if rights have expired + // show expiry note + if( aSize.iWidth > 200 && aIsFocused ) + { + iDrmUtility->ShowRightsInfoL(uri); + } + } + } + else + { + TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( + aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); + } + } + else if ( aMedia.GetIconInfo(icon) ) + { + GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL"); + TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( + icon.bitmapId, resFile, defaultSize ).Id() ); + } + else if ( KErrNone == thumbnailError || KErrArgument == thumbnailError || ( drm && isValid == EGlxDrmRightsInvalid ) ) + + { + //Try and see if we can scale and show the grid tnm else show the default + TBool isGridTnmShown = EFalse; + if(HasRelevantThumbnail(aMedia,defaultSize)) + { + TSize origSize; + if(aMedia.GetDimensions(origSize)) + { + //Currently scaling the grid TNM's only if their original size > grid size. + //Have to relook at this. + if(origSize.iWidth > defaultSize.iWidth && origSize.iHeight > defaultSize.iHeight) + { + GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL::ScaledTnm"); + TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( + aMedia, aMedia.IdSpaceId(), aSize, this, ETrue ).Id() ); + if(err == KErrNone) + { + isGridTnmShown = ETrue; + } + } + } + } + if(!isGridTnmShown) + { + GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL::Default"); + TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize ).Id() ); + } + } + else + { + GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL::Corrupt"); + TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_corrupted, resFile, defaultSize ).Id() ); + } + + if ( KErrNone != err ) + { + GLX_DEBUG2("GlxThumbnailVariantType::ConstructL() ERROR err=%d", err); + throw std::bad_alloc(); + } + } + +void GlxThumbnailVariantType::ConsumeDRMRightsL( const TGlxMedia& aMedia ) + { + TRACER("GlxThumbnailVariantType::ConsumeDRMRightsL"); + + const CGlxMedia* media = aMedia.Properties(); + + if(media) + { + if(aMedia.IsDrmProtected()) + { + + TMPXGeneralCategory cat = aMedia.Category(); + const TDesC& uri = aMedia.Uri(); + if( cat != EMPXNoCategory && uri.Length() > 0 ) + { + + // check if rights have expired + TBool expired = !iDrmUtility->CheckOpenRightsL(uri, (cat == EMPXImage)); + + if(expired) + { + return; + } + + TSize size; + if(EMPXImage == cat && aMedia.GetDimensions(size)) + { + // check size + TSize bmpSize = ThumbnailSize(media); + + if(ConsumeRightsBasedOnSize(size, bmpSize)) + { + // pass URI to DRM utility + iDrmUtility->ConsumeRightsL(uri); + } + } + } + } + else + { + // not an DRM'd item no need to check again + } + } + + } + +// ----------------------------------------------------------------------------- +// ConsumeRightsBasedOnSize - check if DRM rights should be consumed +// ----------------------------------------------------------------------------- +// +TBool GlxThumbnailVariantType::ConsumeRightsBasedOnSize( + TSize aImageSize, TSize aBitmapSize) + { + TRACER("CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize"); + + TBool drmRightsChecked = EFalse; + // minimum size (111 x 83) + TInt minSize = KGlxThumbnailDrmWidth * KGlxThumbnailDrmHeight; + //TInt minSize = 111*83 ; + // size of actual image + TInt imgSize = aImageSize.iWidth * aImageSize.iHeight; + + // bitmap size + TInt bmpSize = aBitmapSize.iWidth * aBitmapSize.iHeight; + + // size of HUI display + TSize dispSize = iUiUtility->DisplaySize(); + + + if(dispSize.iWidth>0 && dispSize.iHeight>0) + { + TReal widthRatio = (TReal)aImageSize.iWidth/(TReal)dispSize.iWidth; + TReal heightRatio = (TReal)aImageSize.iHeight/(TReal)dispSize.iHeight; + + if(widthRatio > heightRatio) + { + dispSize.iHeight = aImageSize.iHeight / widthRatio; + } + else + { + if(heightRatio>0) + { + dispSize.iWidth = aImageSize.iWidth / heightRatio; + } + } + } + + TInt visSize2 = dispSize.iWidth * dispSize.iHeight; + + // if thumbnail is smaller than visual use this for comparison + if(bmpSize < visSize2) + { + visSize2 = bmpSize; + } + + // is bmp smaller than 1/4 of image size + if(imgSize/4 < minSize) + { + minSize = imgSize/4; + } + + if(visSize2 >= minSize) + { + drmRightsChecked = ETrue; + } + + return drmRightsChecked; + } + +// ----------------------------------------------------------------------------- +// ThumbnailSizeAndQuality - search for largest available thumbnail +// ----------------------------------------------------------------------------- +// +TSize GlxThumbnailVariantType::ThumbnailSize(const CGlxMedia* aMedia) + { + TRACER("CGlxCommandHandlerDrm::ThumbnailSize"); + TSize bmpSize(0,0); + + TArray attr = aMedia->Attributes(); + + TInt selectedHeight = 0; + TInt selectedWidth = 0; + + TInt count = attr.Count(); + for(TInt i=0; i + (aMedia->ValueCObject( attr[i])); + + if(thumbAtt) + { + + selectedHeight = thumbAtt->iDimensions.iHeight; + selectedWidth = thumbAtt->iDimensions.iWidth; + + if((selectedHeight * selectedWidth) > + (bmpSize.iHeight * bmpSize.iWidth)) + { + bmpSize.iWidth = selectedWidth; + bmpSize.iHeight = selectedHeight; + } + } + } + } + return bmpSize; + } +// ---------------------------------------------------------------------------- +// destructor +// ---------------------------------------------------------------------------- +// +GlxThumbnailVariantType::~GlxThumbnailVariantType() + { + TRACER("GlxThumbnailVariantType::~GlxThumbnailVariantType"); + if( iDrmUtility ) + { + iDrmUtility->Close(); + } + + if ( iUiUtility) + { +// iUiUtility->GlxTextureManager().RemoveTexture( mTextureId ); + iUiUtility->Close (); + } + } + + +void GlxThumbnailVariantType::TextureContentChangedL( TBool /*aHasContent*/ , CAlfTexture* /*aNewTexture*/) + { + + } +// ---------------------------------------------------------------------------- +// integer +// ---------------------------------------------------------------------------- +// +int GlxThumbnailVariantType::integer() const + { + TRACER("GlxThumbnailVariantType::integer"); + return mTextureId; + } + +// ---------------------------------------------------------------------------- +// HasRelevantThumbnail +// ---------------------------------------------------------------------------- +// +TBool GlxThumbnailVariantType::HasRelevantThumbnail(const TGlxMedia& aMedia, + const TSize& aSize) + { + TRACER("GlxThumbnailVariantType::HasRelevantThumbnail()"); + + TMPXAttribute tnAttribQuality(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, + aSize.iWidth, aSize.iHeight ) ); + + TMPXAttribute tnAttribSpeed(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( EFalse, + aSize.iWidth, aSize.iHeight ) ); + + const CGlxThumbnailAttribute* qualityTn = aMedia.ThumbnailAttribute( + tnAttribQuality ); + const CGlxThumbnailAttribute* speedTn = aMedia.ThumbnailAttribute( + tnAttribSpeed ); + if ( qualityTn || speedTn ) + { + GLX_LOG_INFO("GlxThumbnailVariantType::HasRelevantThumbnail() - TN avail"); + return ETrue; + } + return EFalse; + } + +// ---------------------------------------------------------------------------- +// type +// ---------------------------------------------------------------------------- +// +Alf::IMulVariantType::TMulType GlxThumbnailVariantType::Type() const + { + TRACER("GlxThumbnailVariantType::type"); + return EInt; + } + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +GlxIconVariantType* GlxIconVariantType::NewL(TInt aIconId, TFileName aFileName, + const TSize& aSize) + { + TRACER("GlxIconVariantType::NewL"); + GlxIconVariantType* self = GlxIconVariantType::NewLC( aIconId, + aFileName, aSize ); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +GlxIconVariantType* GlxIconVariantType::NewLC( TInt aIconId, TFileName aFileName, const TSize& aSize ) + { + TRACER("GlxIconVariantType::NewLC"); + GlxIconVariantType* self = new ( EMM ) GlxIconVariantType( aIconId, + aFileName, aSize ); + CleanupStack::PushL( self ); + self->ConstructL( aIconId, aFileName, aSize ); + return self; + + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void GlxIconVariantType::ConstructL( TInt aIconId, TFileName aFileName, + const TSize& aSize ) + { + TRACER("GlxIconVariantType::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL(); + + TRAPD( err, mIconId = iUiUtility->GlxTextureManager().CreateIconTextureL( + aIconId, aFileName, aSize).Id() ); + + if ( KErrNone != err ) + { + throw std::bad_alloc(); + } + } + +// ---------------------------------------------------------------------------- +// constructor +// ---------------------------------------------------------------------------- +// +GlxIconVariantType::GlxIconVariantType( TInt /*aIconId*/, TFileName /*aFileName*/, + const TSize& /*aSize*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// destructor +// ---------------------------------------------------------------------------- +// +GlxIconVariantType::~GlxIconVariantType() + { + + TRACER("GlxIconVariantType::~GlxIconVariantType"); + if ( iUiUtility) + { +// iUiUtility->GlxTextureManager().RemoveTexture( mTextureId ); + iUiUtility->Close (); + } + } + +// ---------------------------------------------------------------------------- +// integer +// ---------------------------------------------------------------------------- +// +int GlxIconVariantType::integer() const + { + TRACER("GlxIconVariantType::integer"); + return mIconId; + } + +// ---------------------------------------------------------------------------- +// type +// ---------------------------------------------------------------------------- +// +Alf::IMulVariantType::TMulType GlxIconVariantType::Type() const + { + TRACER("GlxIconVariantType::type"); + return EInt; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/dataprovider/src/glxvarianttypebase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/dataprovider/src/glxvarianttypebase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2008-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: base class of Alf data types +* +*/ + + + + +#include "glxvarianttypebase.h" + +#include // Exception class used with invalid data exceptions +#include // Logging + +using namespace Alf; +using namespace osncore; + +// ---------------------------------------------------------------------------- +// set +// ---------------------------------------------------------------------------- +// +void IGlxVariantTypeBase::set( IAlfVariantType& /*aValue*/ ) + { + // this interface is not possible to implement + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +bool IGlxVariantTypeBase::boolean() const + { + TRACER("IGlxVariantTypeBase::boolean"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +int IGlxVariantTypeBase::integer() const + { + TRACER("IGlxVariantTypeBase::integer"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +uint IGlxVariantTypeBase::uinteger() const + { + TRACER("IGlxVariantTypeBase::uinteger"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +double IGlxVariantTypeBase::real() const + { + TRACER("IGlxVariantTypeBase::real"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +const UString& IGlxVariantTypeBase::string() const + { + TRACER("IGlxVariantTypeBase::string"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +IAlfContainer* IGlxVariantTypeBase::container() + { + TRACER("IGlxVariantTypeBase::container"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +IAlfMap* IGlxVariantTypeBase::map() + { + TRACER("IGlxVariantTypeBase::map"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +IAlfBranch* IGlxVariantTypeBase::branch() + { + TRACER("IGlxVariantTypeBase::branch"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// expected to be overridden by base class if a valid type +// ---------------------------------------------------------------------------- +// +IAlfModelBase* IGlxVariantTypeBase::customData() + { + TRACER("IGlxVariantTypeBase::customData"); + ALF_THROW( AlfDataException, EInvalidVariantDataType, "GlxVariantTypeBase" ); + } + +// ---------------------------------------------------------------------------- +// type +// ---------------------------------------------------------------------------- +// +IAlfVariantType::Type IGlxStringVariantTypeBase::type() const + { + TRACER("IGlxStringVariantTypeBase::type"); + return EString; + } + +// ---------------------------------------------------------------------------- +// type +// ---------------------------------------------------------------------------- +// +IAlfVariantType::Type IGlxIntVariantTypeBase::type() const + { + TRACER("IGlxIntVariantTypeBase::type"); + return EInt; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/drmutility/bwins/glxdrmutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/drmutility/bwins/glxdrmutilityu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,15 @@ +EXPORTS + ?CanSetAsAutomatedL@CGlxDRMUtility@@QAEHABVTDesC16@@W4TGlxDrmAutomatedType@@@Z @ 1 NONAME ; int CGlxDRMUtility::CanSetAsAutomatedL(class TDesC16 const &, enum TGlxDrmAutomatedType) + ?CanShowInfoOnlineL@CGlxDRMUtility@@QAEHAAVTDesC16@@@Z @ 2 NONAME ; int CGlxDRMUtility::CanShowInfoOnlineL(class TDesC16 &) + ?CheckDisplayRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 3 NONAME ; int CGlxDRMUtility::CheckDisplayRightsL(class TDesC16 const &, int) + ?CheckOpenRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 4 NONAME ; int CGlxDRMUtility::CheckOpenRightsL(class TDesC16 const &, int) + ?Close@CGlxDRMUtility@@QAEXXZ @ 5 NONAME ; void CGlxDRMUtility::Close(void) + ?ConsumeRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 6 NONAME ; int CGlxDRMUtility::ConsumeRightsL(class TDesC16 const &) + ?DRMThumbnailSize@CGlxDRMUtility@@QAE?AVTSize@@AAV2@@Z @ 7 NONAME ; class TSize CGlxDRMUtility::DRMThumbnailSize(class TSize &) + ?InstanceL@CGlxDRMUtility@@SAPAV1@XZ @ 8 NONAME ; class CGlxDRMUtility * CGlxDRMUtility::InstanceL(void) + ?IsForwardLockedL@CGlxDRMUtility@@QAEHABVTDesC16@@@Z @ 9 NONAME ; int CGlxDRMUtility::IsForwardLockedL(class TDesC16 const &) + ?SetAsAutomatedL@CGlxDRMUtility@@QAEXABVTDesC16@@W4TGlxDrmAutomatedType@@@Z @ 10 NONAME ; void CGlxDRMUtility::SetAsAutomatedL(class TDesC16 const &, enum TGlxDrmAutomatedType) + ?ShowDRMDetailsPaneL@CGlxDRMUtility@@QAEXABVTDesC16@@@Z @ 11 NONAME ; void CGlxDRMUtility::ShowDRMDetailsPaneL(class TDesC16 const &) + ?ShowInfoOnlineL@CGlxDRMUtility@@QAEXAAVTDesC16@@@Z @ 12 NONAME ; void CGlxDRMUtility::ShowInfoOnlineL(class TDesC16 &) + ?ShowRightsInfoL@CGlxDRMUtility@@QAEXABVTDesC16@@@Z @ 13 NONAME ; void CGlxDRMUtility::ShowRightsInfoL(class TDesC16 const &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/drmutility/eabi/glxdrmutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/drmutility/eabi/glxdrmutilityu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,15 @@ +EXPORTS + _ZN14CGlxDRMUtility14ConsumeRightsLERK7TDesC16 @ 1 NONAME + _ZN14CGlxDRMUtility15SetAsAutomatedLERK7TDesC1620TGlxDrmAutomatedType @ 2 NONAME + _ZN14CGlxDRMUtility15ShowInfoOnlineLER7TDesC16 @ 3 NONAME + _ZN14CGlxDRMUtility15ShowRightsInfoLERK7TDesC16 @ 4 NONAME + _ZN14CGlxDRMUtility16CheckOpenRightsLERK7TDesC16i @ 5 NONAME + _ZN14CGlxDRMUtility16DRMThumbnailSizeER5TSize @ 6 NONAME + _ZN14CGlxDRMUtility16IsForwardLockedLERK7TDesC16 @ 7 NONAME + _ZN14CGlxDRMUtility18CanSetAsAutomatedLERK7TDesC1620TGlxDrmAutomatedType @ 8 NONAME + _ZN14CGlxDRMUtility18CanShowInfoOnlineLER7TDesC16 @ 9 NONAME + _ZN14CGlxDRMUtility19CheckDisplayRightsLERK7TDesC16i @ 10 NONAME + _ZN14CGlxDRMUtility19ShowDRMDetailsPaneLERK7TDesC16 @ 11 NONAME + _ZN14CGlxDRMUtility5CloseEv @ 12 NONAME + _ZN14CGlxDRMUtility9InstanceLEv @ 13 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/drmutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/drmutility/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxdrmutility.dll + * +*/ + + + + +#include + +PRJ_EXPORTS +../rom/glxdrmutility.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxdrmutility.iby) + +PRJ_MMPFILES +glxdrmutility.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/drmutility/group/glxdrmutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/drmutility/group/glxdrmutility.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include + +#include "../../../group/glxbuildcommon.mmh" + +TARGET glxdrmutility.dll +TARGETTYPE dll +UID 0x1000008d 0x2000A7B4 + +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxdrmutility.cpp + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../inc + +// System includes from epoc32/include +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY drmhelper.lib +LIBRARY caf.lib +LIBRARY cafutils.lib + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/drmutility/inc/glxdrmutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/drmutility/inc/glxdrmutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2008-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: DRM utility implementation +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + + +#ifndef C_GLXDRMUTILITY_H +#define C_GLXDRMUTILITY_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS + +class CDRMHelper; + +namespace ContentAccess + { + class CContent; + class CData; + class CManager; + } +// DATA TYPES + +/** + * Specifies a type of automated content. + * + * @ingroup drm_utility + */ +enum TGlxDrmAutomatedType + { + EGlxDrmAutomatedTypeWallpaper /**< Set image as wallpaper */ + }; + +// CLASS DECLARATION + +/** + * DRM utility class to provide DRM-related functionality used in many places. + * + * @ingroup drm_utility + * @author M Byrne + */ +NONSHARABLE_CLASS( CGlxDRMUtility ) : public CBase + { +public: + /** + * Get the instance of the DRM utility, and increase its reference count. + * + * @return Pointer to singleton object. + */ + IMPORT_C static CGlxDRMUtility* InstanceL(); + + /** + * Release the instance of the DRM utility by decreasing its reference + * count. If the count becomes zero, the utility is deleted. + */ + IMPORT_C void Close(); + + /** + * Destructor. + */ + ~CGlxDRMUtility(); + + /** + * Check whether DRM rights are valid for specified item + * + * @param aUri URI of the media item. + * @param aCheckViewRights, check view rights if true, play if false + * @return ETrue if valid rights exist for the media item. + */ + IMPORT_C TBool CheckOpenRightsL(const TDesC& aUri, TBool aCheckViewRights); + + /** + * Check whether DRM rights are valid for specified item + * If the rights were just consumed, then allow to display + * Otherwise, obtain current rights + * + * @param aUri URI of the media item. + * @param aCheckViewRights, check view rights if true, play if false + * @return ETrue if valid rights exist for the media item. + */ + IMPORT_C TBool CheckDisplayRightsL(const TDesC& aUri, TBool aCheckViewRights); + + /** + * Consume rights for specified item + * Caches item so that a client has right to display the item + * + * @param aUri URI for item + * @return ETrue to no error in rights consumption + */ + IMPORT_C TBool ConsumeRightsL(const TDesC& aUri); + + + + /** + * Test whether a media item is OMA DRM 2.0 protected and has an associated + * info URL. + * @param aUri URI of the media item. + * @return ETrue if it does. + */ + IMPORT_C TBool CanShowInfoOnlineL(TDesC& aUri); + + /** + * Open the associated info URL for a media item in the browser. + * @param aUri URI of the media item. + */ + IMPORT_C void ShowInfoOnlineL(TDesC& aUri); + + /** + * Test whether a media item can be set as automated content. * + * @param aUri URI of the media item. + * @param aType Automated content type, eg. wallpaper. + * @return ETrue if it can. + */ + IMPORT_C TBool CanSetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType); + + /** + * Set a media item as automated content. + * @param aUri URI of the media item. + * @param aType Automated content type, eg. wallpaper. + */ + IMPORT_C void SetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType); + + /** + * Show DRM details for specified item. + * @param aUri URI of the media item. + */ + IMPORT_C void ShowDRMDetailsPaneL(const TDesC& aUri); + + /** + * Ask DRM manager if file is forward locked + */ + IMPORT_C TBool IsForwardLockedL(const TDesC& aUri); + + /** + * Show rights info + * @param aUri URI of the media item. + */ + IMPORT_C void ShowRightsInfoL(const TDesC& aUri); + + /** + * Get size of thumbnail to be requested for DRM invalid item + * @param aSize size of image + * @return suggested thumbnail size (1/4 of original size) + */ + IMPORT_C TSize DRMThumbnailSize(TSize& aSize); + + +private: + /** + * C++ default constructor. + */ + CGlxDRMUtility(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + /** Single instance of CGlxDRMUtility */ + static CGlxDRMUtility* iDrmUtility; + + /** Reference count for DRM utility */ + TInt iRefCount; + + /** Content access manager */ + ContentAccess::CManager* iCManager; + + /** DRM helper used by the utility owned */ + CDRMHelper* iDrmHelper; + + /** Last consumed item URI */ + HBufC* iLastConsumedItemUri; + }; + +#endif // C_GLXDRMUTILITY_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/drmutility/rom/glxdrmutility.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/drmutility/rom/glxdrmutility.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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: Photos / DRM utility iby file. +* +*/ + + + + +#ifndef __GLXCOMMANDDRMUTILITY_IBY__ +#define __GLXCOMMANDDRMUTILITY_IBY__ + + +file=ABI_DIR\BUILD_DIR\glxdrmutility.dll SHARED_LIB_DIR\glxdrmutility.dll + +#endif // __GLXCOMMANDDRMUTILITY_IBY__ + +// End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/drmutility/src/glxdrmutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/drmutility/src/glxdrmutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,339 @@ +/* +* Copyright (c) 2008-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: DRM utility implementation +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by Rowland Cook + */ + +// INCLUDES + +#include "glxdrmutility.h" + +#include + +#include +#include + +#include +#include +#include +#include + +const TInt KGlxDRMThumbnailHeight = 120; +const TInt KGlxDRMThumbnailWidth = 90; + +// ======== MEMBER FUNCTIONS ======== + +/** + * CGlxDrmTls + * + * Global object stored in TLS. + * Owns the only instance of a CGlxDRMUtility + */ +struct CGlxDrmTls + { + CGlxDrmTls(CGlxDRMUtility* aUtility) + { + iDrmUtility = aUtility; + iRefCount = 0; + } + + CGlxDRMUtility* iDrmUtility; + TInt iRefCount; + }; + +//============================================================================ +// InstanceL +//============================================================================ +EXPORT_C CGlxDRMUtility* CGlxDRMUtility::InstanceL() + { + CGlxDrmTls* tls = reinterpret_cast(Dll::Tls()); + + if(tls==NULL) + { + CGlxDRMUtility* drmutil = new(ELeave)CGlxDRMUtility(); + CleanupStack::PushL(drmutil); + drmutil->ConstructL(); + + tls = new (ELeave) CGlxDrmTls(drmutil); + + CleanupStack::Pop(drmutil); + + Dll::SetTls( reinterpret_cast(tls)); + } + + tls->iRefCount++; + + return tls->iDrmUtility; + } + +//============================================================================ +// Close +//============================================================================ +EXPORT_C void CGlxDRMUtility::Close() + { + CGlxDrmTls* tls = reinterpret_cast(Dll::Tls()); + + if (tls != NULL) + { + tls->iRefCount--; + + // Delete the tls pointer and list manager instance if this was the + // last reference + if (tls->iRefCount == 0) + { + delete tls->iDrmUtility; + delete tls; + Dll::SetTls(NULL); + } + } + } + +//============================================================================ +// Destructor +//============================================================================ +CGlxDRMUtility::~CGlxDRMUtility() + { + delete iCManager; + delete iDrmHelper; + delete iLastConsumedItemUri; + } + +//============================================================================ +// CheckOpenRightsL +//============================================================================ +EXPORT_C TBool CGlxDRMUtility::CheckOpenRightsL( const TDesC& aUri, + TBool aCheckViewRights ) + { + // When checking current rights for a URI, clear stored URI + TPtr ptr = iLastConsumedItemUri->Des(); + ptr.Zero(); + iLastConsumedItemUri = iLastConsumedItemUri->ReAllocL( 0 ); + + TBool rightsValid = EFalse; + TVirtualPathPtr path( aUri, KDefaultContentObject() ); + + ContentAccess::TAttribute attr = + aCheckViewRights ? ContentAccess::ECanView : ContentAccess::ECanPlay; + + // rightsValid is not updated if an error occurs + iCManager->GetAttribute( attr, rightsValid, path ); + + return rightsValid; + } + +//============================================================================ +// CheckDisplayRightsL +//============================================================================ +EXPORT_C TBool CGlxDRMUtility::CheckDisplayRightsL( const TDesC& aUri, + TBool aCheckViewRights ) + { + // Allow to display if rights for a URI was just consumed (i.e. same as stored URI) + if ( iLastConsumedItemUri->Length() > 0 ) + { + if ( aUri.CompareF( *iLastConsumedItemUri ) == 0 ) + { + return ETrue; + } + } + + // Otherwise, check current rights for the URI + return CheckOpenRightsL( aUri, aCheckViewRights ); + } + +//============================================================================ +// ConsumeRightsL +//============================================================================ +EXPORT_C TBool CGlxDRMUtility::ConsumeRightsL(const TDesC& aUri) + { + TVirtualPathPtr path( aUri, KDefaultContentObject() ); + + // Create a CData object to read the content + // Tell the agent we are planning to display the content + CData* data = CData::NewLC(path, ContentAccess::EView, EContentShareReadOnly); + + // When consuming rights for a URI, clear stored URI + TPtr oldPtr = iLastConsumedItemUri->Des(); + oldPtr.Zero(); + iLastConsumedItemUri = iLastConsumedItemUri->ReAllocL( aUri.Length() ); + + // Execute the intent, tell the agent that we plan to display the content + // It is at this point that any stateful rights will be decremented + TInt err = data->ExecuteIntent(ContentAccess::EView); + if ( err == KErrNone ) + { + // Update stored URI + TPtr newPtr = iLastConsumedItemUri->Des(); + newPtr.Copy( aUri ); + } + + CleanupStack::PopAndDestroy(data); + + return (err == KErrNone); + } + +//============================================================================ +// Test whether a media item is OMA DRM 2.0 protected and has an associated +// info URL. +//============================================================================ +EXPORT_C TBool CGlxDRMUtility::CanShowInfoOnlineL(TDesC& aUri) + { + TBool canShowInfoOnline = EFalse; + + HBufC8* urlBuf = NULL; + canShowInfoOnline = iDrmHelper->HasInfoUrlL(aUri, urlBuf); + + // discard buf we don't need it + delete urlBuf; + + return canShowInfoOnline; + } + +//============================================================================ +// Open the associated info URL for a media item in the browser. +//============================================================================ +EXPORT_C void CGlxDRMUtility::ShowInfoOnlineL(TDesC& aUri) + { + iDrmHelper->OpenInfoUrlL(aUri); + } + +//============================================================================ +// Test whether a media item can be set as automated content. +//============================================================================ +EXPORT_C TBool CGlxDRMUtility::CanSetAsAutomatedL(const TDesC& aUri, + TGlxDrmAutomatedType aType) + { + TBool canSetAutomated = EFalse; + switch(aType) + { + case EGlxDrmAutomatedTypeWallpaper: + { + User::LeaveIfError(iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper)); + User::LeaveIfError(iDrmHelper->CanSetAutomated(aUri, canSetAutomated)); + break; + } + default: + break; + }; + return canSetAutomated; + } + +//============================================================================ +// SetAsAutomatedL +//============================================================================ +EXPORT_C void CGlxDRMUtility::SetAsAutomatedL(const TDesC& aUri, + TGlxDrmAutomatedType aType) + { + switch(aType) + { + case EGlxDrmAutomatedTypeWallpaper: + { + TInt error = iDrmHelper->SetAutomatedType(CDRMHelper::EAutomatedTypeWallpaper); + if(KErrNone==error) + { + error= iDrmHelper->SetAutomatedPassive(aUri); + if(KErrNone!=error) + { + iDrmHelper->HandleErrorL(error, aUri); + } + } + + break; + } + default: + break; + }; + } + +//============================================================================ +// ShowDRMDetailsPane +//============================================================================ +EXPORT_C void CGlxDRMUtility::ShowDRMDetailsPaneL( const TDesC& aUri ) + { + TRAPD( err, iDrmHelper->LaunchDetailsViewEmbeddedL( aUri ) ); + // if no rights ask user to re-activate? + if( err == KErrCANoRights ) + { + HBufC* buf = aUri.AllocLC(); + iDrmHelper->ActivateContentL( *buf ); + CleanupStack::PopAndDestroy( buf ); + } + + } + +//============================================================================ +// IsForwardLockedL +//============================================================================ +EXPORT_C TBool CGlxDRMUtility::IsForwardLockedL(const TDesC& aUri) + { + TBool forwardLocked = EFalse; + TVirtualPathPtr path( aUri, KDefaultContentObject() ); + + // forwardLocked is not updated if an error occurs + iCManager->GetAttribute( ContentAccess::EIsForwardable, forwardLocked, path ); + + return forwardLocked; + } + +//============================================================================ +// ShowRightsInfoL +//============================================================================ +EXPORT_C void CGlxDRMUtility::ShowRightsInfoL(const TDesC& aUri) + { + iDrmHelper->CheckRightsAmountL( aUri ); + } + +//============================================================================ +// Return size for DRM thumbnail request. +//============================================================================ +EXPORT_C TSize CGlxDRMUtility::DRMThumbnailSize(TSize& aSize) + { + TSize thumbnailSize(KGlxDRMThumbnailWidth, KGlxDRMThumbnailHeight); + + if((aSize.iWidth*aSize.iHeight)/4 < + KGlxDRMThumbnailWidth * KGlxDRMThumbnailHeight) + { + thumbnailSize.iWidth = aSize.iWidth/2; + thumbnailSize.iHeight = aSize.iHeight/2; + } + + return thumbnailSize; + } + +/** + * C++ default constructor. + */ +CGlxDRMUtility::CGlxDRMUtility() + { + + } + +/** + * By default Symbian 2nd phase constructor is private. + */ +void CGlxDRMUtility::ConstructL() + { + iCManager = ContentAccess::CManager::NewL(); + iDrmHelper = CDRMHelper::NewL(); + iLastConsumedItemUri = HBufC::NewL(0); + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Build information for subsystem ViewFramework. +* +*/ + + + + +#include "../drmutility/group/bld.inf" +#include "../medialists/group/bld.inf" +#include "../layouts/group/bld.inf" +#include "../texturemanager/group/bld.inf" +#include "../tvout/group/bld.inf" +#include "../uiutilities/group/bld.inf" +#include "../dataprovider/group/bld.inf" +#include "../visuallistmanager/group/bld.inf" +#include "../commandhandlers/group/bld.inf" +#include "../views/group/bld.inf" +#include "../plugins/group/bld.inf" diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/inc/glxtvconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/inc/glxtvconstants.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2008-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: Definition of TV Out constants +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + + +#ifndef __GLXTVCONSTANTS_H__ +#define __GLXTVCONSTANTS_H__ + +/** The TV change type notifications */ +enum TTvChangeType + { + ETvConnectionChanged = 0, + ETvDisplayIsVisible, + ETvDisplayNotVisible + }; + +/** TV size constants */ +namespace glxTvOut + { + // Constants TV Size Values + const TInt KGlxTvAspectNormal = 0; + const TInt KGlxTvAspectWide = 1; + + //For tv display buffer + const TInt KGlxTvOutWidth = 640; + const TInt KGlxTvOutHeight = 480; + const TInt KGlxTvOutWidthWide = 640; + const TInt KGlxTvOutHeightWide = 360; + } + +#endif //__GLXTVCONSTANTS_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/inc/glxuistd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/inc/glxuistd.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2008-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: Viewer app general definitions +* +*/ + + + + +#ifndef GLXUISTD_H +#define GLXUISTD_H + +enum TGlxHuiCustomCommands + { + EGlxHuiCustomEventBackToZeroSpeed = 200, + EGlxHuiCustomEventBackToSharpPath + }; + +_LIT(KGlxUiUtilitiesResource, "glxuiutilities.rsc"); + +_LIT(KGlxIconsFilename, "glxicons.mif"); + +/** View activation parameters */ +_LIT8(KGlxActivationFullScreen, "fullscreen"); + + +/** attribute/thumbnail fetch context priority definitions */ + +const TInt KGlxFetchContextPriorityLow = 0; +const TInt KGlxFetchContextPriorityNormal = 1; + +// cloud view fetch context priorities +const TInt KGlxFetchContextPriorityCloudView = 4; +const TInt KGlxFetchContextPriorityCloudViewInfoBubble = 3; + +// UMP view fetch context priorities +const TInt KGlxFetchContextPriorityUMPViewAlbumPane = 2; +const TInt KGlxFetchContextPriorityUMPViewTagPane = 3; + +// tile view fetch context priorities +const TInt KGlxFetchContextPriorityGridViewVisibleThumbnail = 6; +const TInt KGlxFetchContextPriorityGridViewDetails = 0; +const TInt KGlxFetchContextPriorityGridViewDetailsFirstLast = 0; +const TInt KGlxFetchContextPriorityGridViewNonVisibleThumbnail = 0; +const TInt KGlxFetchContextPriorityGridViewFullscreenPrefetchNonVisibleThumbnail = 0; +const TInt KGlxFetchContextPriorityGridViewFullscreenVisibleThumbnail = 5; + +const TInt KGlxFetchContextPriorityCommandHandlerOpening = 7; +const TInt KGlxFetchContextPriorityCommandHandlerPrefetch = 0; + +const TInt KGlxFetchContextPriorityListViewTitles = 9; +const TInt KGlxFetchContextPriorityListViewFocusedSubtitle = 8; +const TInt KGlxFetchContextPriorityListViewSubtitles = 0; + + +// tile fetcher +const TInt KGlxFetchContextPriorityTitleFetcher = 10; + +// video playback view UID +const TInt KGlxVideoPlaybackviewPlugin = 0x2000A7B3; + + +#endif // GLXUISTD_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/inc/glxviewpluginuids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/inc/glxviewpluginuids.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008-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: View plugin UID definitions +* +*/ + + + + +#ifndef GLXVIEWPLUGINUIDS_HRH +#define GLXVIEWPLUGINUIDS_HRH + +#define KGlxDepthOne 0x200071CC +#define KGlxDepthTwo 0x2000A775 +#define KGlxDepthThree 0x2000A776 +#define KGlxDepthFour 0x200104DB + +#define KGlxViewPluginTypeMetadata 0x200071B0 //metadata view plugin implementation uid +#define KGlxViewPluginTypeTagManager 0x200071B9 //Tags manager view plugin implementation uid +#define KGlxViewPluginTypeVideoPlayback 0x2000A77C //Video playback view plugin implementation uid + +#define KGlxViewingModeBrowse 0x200104DC +#define KGlxViewingModeView 0x200104DD + + +#endif // GLXVIEWPLUGINUIDS_HRH diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/inc/mglxcommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/inc/mglxcommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: Command Handler interface +* +*/ + + + + +#ifndef M_GLXCOMMANDHANDLER_H +#define M_GLXCOMMANDHANDLER_H + +#include +#include +#include +#include + +class CEikMenuPane; + + +/** + * MGlxCommandHandler + * + * Command handler interface + */ +class MGlxCommandHandler + { +public: + /** + * Execute the command, if applicable + * @param aCommand The command to handle + * @return ETrue iff command was handled + */ + virtual TBool ExecuteL(TInt aCommand) = 0; + + /** + * Modify a menu before it is displayed. + * @param aResourceId The resource ID of the menu + * @param aMenuPane The in-memory representation of the menu pane + */ + virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) = 0; + + /** + * Called when the owning view is activated + * @param aViewId The ID of the view + */ + virtual void ActivateL(TInt aViewId) = 0; + + /** + * Called when the owning view is deactivated + */ + virtual void Deactivate() = 0; + + /** + * Offers key events to the command handler + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown + * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) = 0; + + /** + * Perform any actions needed before the options menu is displayed. + * The view calling this must first arrange a wait dialog to be displayed, as this operation may take + * a long time to complete + * @param aResourceId Menu resource id + */ + virtual void PreDynInitMenuPaneL( TInt aResourceId ) = 0; + + /** + * Deriving classes should append required attributes to aAttributes + * @param aAttributes array to append attributes to. + * @param aFilterUsingSelection If ETrue, the deriving class should only append + * attributes relevant to the current selection, If EFalse all attributes + * should be appended. + * @param aFilterUsingCommandId If ETrue, only attributes relevant + * to the command id specified by aCommandId will be appended + * @param aCommandId if aFilterUsingCommandId is ETrue, only + * attributes relevant to aCommandId will be appened. + */ + virtual void GetRequiredAttributesL(RArray< TMPXAttribute >& aAttributes, + TBool aFilterUsingSelection, + TBool aFilterUsingCommandId, + TInt aCommandId = 0) const = 0; + + /** + * Destructor + */ + virtual ~MGlxCommandHandler() {}; + }; + + +#endif // M_GLXCOMMANDHANDLER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/inc/mglxmedialistprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/inc/mglxmedialistprovider.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2008-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: To Get a medialist Pointer +* +*/ + + + + +#ifndef M_GLXMEDIALISTPROVIDER_H +#define M_GLXMEDIALISTPROVIDER_H + +class MGlxMediaList; + +/** + * Interface to allow a class that owns a media list to share access to it + */ +class MGlxMediaListProvider + { +public: + /** + * Returns a pointer to the owned media list. Ownership is not tranferred. + */ + virtual MGlxMediaList& MediaList() = 0; + }; + +#endif // M_GLXMediaListProvider_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/inc/mglxtvobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/inc/mglxtvobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008-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: TV Out observer +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +#ifndef M_GLXTVOBSERVER_H +#define M_GLXTVOBSERVER_H + +#include // for TTvChangeType +/** + * Class that observes the TV out state change + */ +NONSHARABLE_CLASS( MGlxTvObserver ) + { +public: + /* + * Handle notification of a change in the TV out state + * @param The change type - Connection/activation + */ + virtual void HandleTvStatusChangedL ( TTvChangeType aChangeType ) = 0; + }; + + + +#endif // M_GLXTVOBSERVER_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/inc/mglxuicommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/inc/mglxuicommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007-2008 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: Command Handler abstract class +* +*/ + + + + +#ifndef M_MGLXUICOMMANDHANDLER_H +#define M_MGLXUICOMMANDHANDLER_H + +class CAlfControl; + +/** + * MGlxUiCommandHandler + * + * Command Handler interface class. + * + */ +class MGlxUiCommandHandler + { +public: + /** + * HandleCommandL + */ + virtual void HandleCommandL(TInt aCommandId, CAlfControl* aControl) = 0; + }; + +#endif // M_MGLXUICOMMANDHANDLER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/bwins/glxlayoutsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/bwins/glxlayoutsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +EXPORTS + ??0CGlxLayout@@QAE@XZ @ 1 NONAME ; CGlxLayout::CGlxLayout(void) + ??0TGlxFollowFocusLayout@@QAE@XZ @ 2 NONAME ; TGlxFollowFocusLayout::TGlxFollowFocusLayout(void) + ??0TGlxLayout@@QAE@XZ @ 3 NONAME ; TGlxLayout::TGlxLayout(void) + ??0TGlxLayoutHelper@@QAE@AAVCAlfVisual@@@Z @ 4 NONAME ; TGlxLayoutHelper::TGlxLayoutHelper(class CAlfVisual &) + ??0TGlxLayoutInfoResetter@@QAE@PAVCAlfVisual@@@Z @ 5 NONAME ; TGlxLayoutInfoResetter::TGlxLayoutInfoResetter(class CAlfVisual *) + ??0TGlxLayoutInfoResetter@@QAE@XZ @ 6 NONAME ; TGlxLayoutInfoResetter::TGlxLayoutInfoResetter(void) + ??0TGlxLayoutSplitter@@QAE@XZ @ 7 NONAME ; TGlxLayoutSplitter::TGlxLayoutSplitter(void) + ??0TGlxRotationLayout@@QAE@XZ @ 8 NONAME ; TGlxRotationLayout::TGlxRotationLayout(void) + ??0TGlxSetValueLayout@@QAE@XZ @ 9 NONAME ; TGlxSetValueLayout::TGlxSetValueLayout(void) + ??1CGlxLayout@@UAE@XZ @ 10 NONAME ; CGlxLayout::~CGlxLayout(void) + ??1TGlxFollowFocusLayout@@UAE@XZ @ 11 NONAME ; TGlxFollowFocusLayout::~TGlxFollowFocusLayout(void) + ??1TGlxLayout@@UAE@XZ @ 12 NONAME ; TGlxLayout::~TGlxLayout(void) + ??1TGlxLayoutHelper@@QAE@XZ @ 13 NONAME ; TGlxLayoutHelper::~TGlxLayoutHelper(void) + ??1TGlxLayoutSplitter@@UAE@XZ @ 14 NONAME ; TGlxLayoutSplitter::~TGlxLayoutSplitter(void) + ??1TGlxRotationLayout@@UAE@XZ @ 15 NONAME ; TGlxRotationLayout::~TGlxRotationLayout(void) + ??1TGlxSetValueLayout@@UAE@XZ @ 16 NONAME ; TGlxSetValueLayout::~TGlxSetValueLayout(void) + ?DoSetLayoutValues@CGlxLayout@@MAEXAAVTGlxLayoutInfo@@@Z @ 17 NONAME ; void CGlxLayout::DoSetLayoutValues(class TGlxLayoutInfo &) + ?DoSetLayoutValues@TGlxLayout@@MAEXAAVTGlxLayoutInfo@@@Z @ 18 NONAME ; void TGlxLayout::DoSetLayoutValues(class TGlxLayoutInfo &) + ?GetUpdatedLayoutInfo@TGlxLayoutHelper@@QAEAAVTGlxLayoutInfo@@XZ @ 19 NONAME ; class TGlxLayoutInfo & TGlxLayoutHelper::GetUpdatedLayoutInfo(void) + ?GetUpdatedVisualSize@TGlxLayoutHelper@@QAE?AVTSize@@XZ @ 20 NONAME ; class TSize TGlxLayoutHelper::GetUpdatedVisualSize(void) + ?LayoutPanVisual@TGlxLayoutHelper@@QAEXHVTSize@@@Z @ 21 NONAME ; void TGlxLayoutHelper::LayoutPanVisual(int, class TSize) + ?LayoutVisual@TGlxLayoutHelper@@QAEXHVTSize@@@Z @ 22 NONAME ; void TGlxLayoutHelper::LayoutVisual(int, class TSize) + ?Next@CGlxLayout@@UBEPAVMGlxLayout@@XZ @ 23 NONAME ; class MGlxLayout * CGlxLayout::Next(void) const + ?Next@TGlxLayout@@UBEPAVMGlxLayout@@XZ @ 24 NONAME ; class MGlxLayout * TGlxLayout::Next(void) const + ?RemoveLayout@TGlxLayoutSplitter@@QAEXPBVCAlfVisual@@@Z @ 25 NONAME ; void TGlxLayoutSplitter::RemoveLayout(class CAlfVisual const *) + ?Reset@TGlxLayoutInfoResetter@@QAEXH@Z @ 26 NONAME ; void TGlxLayoutInfoResetter::Reset(int) + ?Reset@TGlxLayoutSplitter@@QAEXXZ @ 27 NONAME ; void TGlxLayoutSplitter::Reset(void) + ?SetDefaultLayout@TGlxLayoutSplitter@@QAEXPAVMGlxLayout@@@Z @ 28 NONAME ; void TGlxLayoutSplitter::SetDefaultLayout(class MGlxLayout *) + ?SetLayout@TGlxLayoutHelper@@QAEXPAVMGlxLayout@@@Z @ 29 NONAME ; void TGlxLayoutHelper::SetLayout(class MGlxLayout *) + ?SetLayoutL@TGlxLayoutSplitter@@QAEXPAVMGlxLayout@@PBVCAlfVisual@@@Z @ 30 NONAME ; void TGlxLayoutSplitter::SetLayoutL(class MGlxLayout *, class CAlfVisual const *) + ?SetLayoutValues@CGlxLayout@@UAEXAAVTGlxLayoutInfo@@@Z @ 31 NONAME ; void CGlxLayout::SetLayoutValues(class TGlxLayoutInfo &) + ?SetLayoutValues@TGlxLayout@@UAEXAAVTGlxLayoutInfo@@@Z @ 32 NONAME ; void TGlxLayout::SetLayoutValues(class TGlxLayoutInfo &) + ?SetNext@CGlxLayout@@UAEXPAVMGlxLayout@@@Z @ 33 NONAME ; void CGlxLayout::SetNext(class MGlxLayout *) + ?SetNext@TGlxLayout@@UAEXPAVMGlxLayout@@@Z @ 34 NONAME ; void TGlxLayout::SetNext(class MGlxLayout *) + ?SetOpacity@TGlxSetValueLayout@@QAEXMH@Z @ 35 NONAME ; void TGlxSetValueLayout::SetOpacity(float, int) + ?SetPosition@TGlxSetValueLayout@@QAEXMMH@Z @ 36 NONAME ; void TGlxSetValueLayout::SetPosition(float, float, int) + ?SetRotation@TGlxRotationLayout@@QAEXMH@Z @ 37 NONAME ; void TGlxRotationLayout::SetRotation(float, int) + ?SetScreenSize@TGlxLayoutInfoResetter@@QAEXVTSize@@@Z @ 38 NONAME ; void TGlxLayoutInfoResetter::SetScreenSize(class TSize) + ?SetSize@TGlxSetValueLayout@@QAEXMMH@Z @ 39 NONAME ; void TGlxSetValueLayout::SetSize(float, float, int) + ?SetVisual@TGlxLayoutInfoResetter@@QAEXPAVCAlfVisual@@@Z @ 40 NONAME ; void TGlxLayoutInfoResetter::SetVisual(class CAlfVisual *) + ?SetVisualListL@TGlxFollowFocusLayout@@QAEXPAVMGlxVisualList@@@Z @ 41 NONAME ; void TGlxFollowFocusLayout::SetVisualListL(class MGlxVisualList *) + ?SetVisualListL@TGlxLayoutSplitter@@QAEXPAVMGlxVisualList@@@Z @ 42 NONAME ; void TGlxLayoutSplitter::SetVisualListL(class MGlxVisualList *) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/eabi/glxlayoutsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/eabi/glxlayoutsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +EXPORTS + _ZN10CGlxLayout15SetLayoutValuesER14TGlxLayoutInfo @ 1 NONAME + _ZN10CGlxLayout17DoSetLayoutValuesER14TGlxLayoutInfo @ 2 NONAME + _ZN10CGlxLayout7SetNextEP10MGlxLayout @ 3 NONAME + _ZN10CGlxLayoutC1Ev @ 4 NONAME + _ZN10CGlxLayoutC2Ev @ 5 NONAME + _ZN10CGlxLayoutD0Ev @ 6 NONAME + _ZN10CGlxLayoutD1Ev @ 7 NONAME + _ZN10CGlxLayoutD2Ev @ 8 NONAME + _ZN10TGlxLayout15SetLayoutValuesER14TGlxLayoutInfo @ 9 NONAME + _ZN10TGlxLayout17DoSetLayoutValuesER14TGlxLayoutInfo @ 10 NONAME + _ZN10TGlxLayout7SetNextEP10MGlxLayout @ 11 NONAME + _ZN10TGlxLayoutC1Ev @ 12 NONAME + _ZN10TGlxLayoutC2Ev @ 13 NONAME + _ZN10TGlxLayoutD0Ev @ 14 NONAME + _ZN10TGlxLayoutD1Ev @ 15 NONAME + _ZN10TGlxLayoutD2Ev @ 16 NONAME + _ZN16TGlxLayoutHelper12LayoutVisualEi5TSize @ 17 NONAME + _ZN16TGlxLayoutHelper15LayoutPanVisualEi5TSize @ 18 NONAME + _ZN16TGlxLayoutHelper20GetUpdatedLayoutInfoEv @ 19 NONAME + _ZN16TGlxLayoutHelper20GetUpdatedVisualSizeEv @ 20 NONAME + _ZN16TGlxLayoutHelper9SetLayoutEP10MGlxLayout @ 21 NONAME + _ZN16TGlxLayoutHelperC1ER10CAlfVisual @ 22 NONAME + _ZN16TGlxLayoutHelperC2ER10CAlfVisual @ 23 NONAME + _ZN16TGlxLayoutHelperD1Ev @ 24 NONAME + _ZN16TGlxLayoutHelperD2Ev @ 25 NONAME + _ZN18TGlxLayoutSplitter10SetLayoutLEP10MGlxLayoutPK10CAlfVisual @ 26 NONAME + _ZN18TGlxLayoutSplitter12RemoveLayoutEPK10CAlfVisual @ 27 NONAME + _ZN18TGlxLayoutSplitter14SetVisualListLEP14MGlxVisualList @ 28 NONAME + _ZN18TGlxLayoutSplitter16SetDefaultLayoutEP10MGlxLayout @ 29 NONAME + _ZN18TGlxLayoutSplitter5ResetEv @ 30 NONAME + _ZN18TGlxLayoutSplitterC1Ev @ 31 NONAME + _ZN18TGlxLayoutSplitterC2Ev @ 32 NONAME + _ZN18TGlxLayoutSplitterD0Ev @ 33 NONAME + _ZN18TGlxLayoutSplitterD1Ev @ 34 NONAME + _ZN18TGlxLayoutSplitterD2Ev @ 35 NONAME + _ZN18TGlxRotationLayout11SetRotationEfi @ 36 NONAME + _ZN18TGlxRotationLayoutC1Ev @ 37 NONAME + _ZN18TGlxRotationLayoutC2Ev @ 38 NONAME + _ZN18TGlxRotationLayoutD0Ev @ 39 NONAME + _ZN18TGlxRotationLayoutD1Ev @ 40 NONAME + _ZN18TGlxRotationLayoutD2Ev @ 41 NONAME + _ZN18TGlxSetValueLayout10SetOpacityEfi @ 42 NONAME + _ZN18TGlxSetValueLayout11SetPositionEffi @ 43 NONAME + _ZN18TGlxSetValueLayout7SetSizeEffi @ 44 NONAME + _ZN18TGlxSetValueLayoutC1Ev @ 45 NONAME + _ZN18TGlxSetValueLayoutC2Ev @ 46 NONAME + _ZN18TGlxSetValueLayoutD0Ev @ 47 NONAME + _ZN18TGlxSetValueLayoutD1Ev @ 48 NONAME + _ZN18TGlxSetValueLayoutD2Ev @ 49 NONAME + _ZN21TGlxFollowFocusLayout14SetVisualListLEP14MGlxVisualList @ 50 NONAME + _ZN21TGlxFollowFocusLayoutC2Ev @ 51 NONAME + _ZN21TGlxFollowFocusLayoutD0Ev @ 52 NONAME + _ZN21TGlxFollowFocusLayoutD1Ev @ 53 NONAME + _ZN21TGlxFollowFocusLayoutD2Ev @ 54 NONAME + _ZN22TGlxLayoutInfoResetter13SetScreenSizeE5TSize @ 55 NONAME + _ZN22TGlxLayoutInfoResetter5ResetEi @ 56 NONAME + _ZN22TGlxLayoutInfoResetter9SetVisualEP10CAlfVisual @ 57 NONAME + _ZN22TGlxLayoutInfoResetterC1EP10CAlfVisual @ 58 NONAME + _ZN22TGlxLayoutInfoResetterC1Ev @ 59 NONAME + _ZN22TGlxLayoutInfoResetterC2EP10CAlfVisual @ 60 NONAME + _ZN22TGlxLayoutInfoResetterC2Ev @ 61 NONAME + _ZNK10CGlxLayout4NextEv @ 62 NONAME + _ZNK10TGlxLayout4NextEv @ 63 NONAME + _ZTI10CGlxLayout @ 64 NONAME ; ## + _ZTI10TGlxLayout @ 65 NONAME ; ## + _ZTI18TGlxLayoutSplitter @ 66 NONAME ; ## + _ZTI18TGlxRotationLayout @ 67 NONAME ; ## + _ZTI18TGlxSetValueLayout @ 68 NONAME ; ## + _ZTI21TGlxFollowFocusLayout @ 69 NONAME ; ## + _ZTV10CGlxLayout @ 70 NONAME ; ## + _ZTV10TGlxLayout @ 71 NONAME ; ## + _ZTV18TGlxLayoutSplitter @ 72 NONAME ; ## + _ZTV18TGlxRotationLayout @ 73 NONAME ; ## + _ZTV18TGlxSetValueLayout @ 74 NONAME ; ## + _ZTV21TGlxFollowFocusLayout @ 75 NONAME ; ## + _ZThn4_N10CGlxLayout15SetLayoutValuesER14TGlxLayoutInfo @ 76 NONAME ; ## + _ZThn4_N10CGlxLayout7SetNextEP10MGlxLayout @ 77 NONAME ; ## + _ZThn4_NK10CGlxLayout4NextEv @ 78 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Build information for Layouts component. +* +*/ + + + + +PRJ_MMPFILES + +glxlayouts.mmp + +PRJ_TESTMMPFILES + +//../tsrc/group/t_tglxblendlayout.mmp +//../tsrc/group/t_tglxlayoutmapping.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/group/glxlayouts.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/group/glxlayouts.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include + +#include "../../../group/glxbuildcommon.mmh" + +TARGET glxlayouts.dll +TARGETTYPE dll +UID 0x1000008d 0x2000A7B7 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxlayoutinfo.cpp +SOURCE glxlayout.cpp +SOURCE glxlayouthelper.cpp +SOURCE glxlayoutsplitter.cpp +SOURCE glxfollowfocuslayout.cpp +SOURCE glxrotationlayout.cpp +SOURCE glxsetvaluelayout.cpp + + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../medialists/inc // TEMP +SYSTEMINCLUDE ../../visuallistmanager/inc +SYSTEMINCLUDE ../../uiutilities/inc + +// System includes from epoc32/include + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY ws32.lib + +LIBRARY alfclient.lib // For Alfred Hitchcock framework + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxblendlayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxblendlayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2008-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: Layout blender +* +*/ + + + + +#ifndef C_GLXBLENDLAYOUTBLEND_H +#define C_GLXBLENDLAYOUTBLEND_H + +#include + +/** + * TGlxBlendLayout + * + * Blender of multiple MGlxLayouts based on coefficients + * + * @lib glxlayouts.lib + */ + +//@TODO : Class wont be used - To be removed +class TGlxBlendLayout : public TGlxLayout + { + public: + + /** + * Constructor, reset the values + */ + IMPORT_C TGlxBlendLayout(); + + /** + * Destructor + */ + IMPORT_C ~TGlxBlendLayout(); + + /** + * Add a layout to be blended + * @param aLayout the layout to add, cannot be NULL + */ + IMPORT_C void AddLayoutL( MGlxLayout* aLayout ); + + /** + * Remove an existing layout + * @param aLayout the layout to remove + */ + IMPORT_C void RemoveLayout( const MGlxLayout* aLayout ); + + /** + * Remove all existing layouts + */ + IMPORT_C void RemoveAllLayouts(); + + protected: // From TGlxLayout + + /// @ref TGlxLayout::DoSetLayoutValues + void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + /// @ref TGlxLayout::DoChanged + TBool DoChanged() const; + /// @ref TGlxLayout::DoClearChanged + void DoClearChanged(); + + private: + + /** + * Helper struct to store the layout and layout info + */ + struct TLayout + { + /// Ref: the layout + MGlxLayout* iLayout; + /// Own: the layoutinfo for the layout + TGlxLayoutInfoResetter iLayoutInfo; + /** + * Helper to tell whether two TLayout structs match + */ + static TBool Match( const TLayout& aLhs, const TLayout& aRhs ); + }; + /// Own: array of cached layout infos + RArray< TLayout > iLayouts; + + /** + * Changed flag to remember whether any layouts have been added or removed + * since the las call to DoClearChanged + */ + TBool iChanged; + }; + +#endif // C_GLXBLENDLAYOUTBLEND_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxfollowfocuslayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxfollowfocuslayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2008-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: Layout mapping index to distance from focus +* +*/ + + + + +#ifndef T_GLXFOLLOWFOCUSLAYOUT_H +#define T_GLXFOLLOWFOCUSLAYOUT_H + +// INCLUDES + +#include +#include + +// CLASS DECLARATION + +/** + * TGlxFollowFocusLayout + * + * Layout mapping index to distance from focus + * + * @lib glxlayouts.lib + */ +class TGlxFollowFocusLayout : public TGlxLayout, public MGlxVisualListObserver + { + public: + + /** + * Constructor, resets the state + */ + IMPORT_C TGlxFollowFocusLayout(); + + /** + * Destructor + */ + IMPORT_C virtual ~TGlxFollowFocusLayout(); + + /** + * Set visual list to which the layout is applied. + */ + IMPORT_C void SetVisualListL( MGlxVisualList* aVisualList ); + + protected: // From TGlxLayout + + /// @ref TGlxLayout::DoSetLayoutValues + void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + + private: + + /** Visual list to which the layout is applied (not owned) */ + MGlxVisualList* iVisualList; + + }; + +#endif // T_GLXFOLLOWFOCUSLAYOUT_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxlayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxlayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2008-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: Layout base classes +* +*/ + + + + +#ifndef __GLXLAYOUT_H__ +#define __GLXLAYOUT_H__ + +#include +#include + +/** + * MGlxLayout + * + * Layout base class. Layouts are objects that specify the + * renderable values, such as position, size or opacity for the visuals + * They can be chained to form processing chains, and the chains + * can also split into several chains (different chain for different + * visuals) and combine several chains into one. This allows building + * complex visual effects by using simple layouts as building blocks. + */ +class MGlxLayout + { + protected: + + /** + * Destructor. Dont allow deletion through this interface. + */ + ~MGlxLayout() { } + + public: + + /** + * This method can specify the layout of given visual by setting + * the corresponding fields in the layout info struct. + * @param aInfo the layout information to specify + */ + virtual void SetLayoutValues( TGlxLayoutInfo& aInfo ) = 0; + + /** + * Sets the next layout in the chain. + */ + virtual void SetNext( MGlxLayout* aLayout ) = 0; + + /** + * Returns the next layout in the chain. + */ + virtual MGlxLayout* Next() const = 0; + + }; + +/** + * TGlxLayout + * + * Implements the MGlxLayout interface and provides common layout chain functionality. + * + * @lib glxlayouts.lib + */ +class TGlxLayout : public MGlxLayout + { + public: + + /** + * Constructor, resets the object. + */ + IMPORT_C TGlxLayout(); + + /** + * Destructor. + */ + IMPORT_C virtual ~TGlxLayout(); + + /** + * Sets the next layout in the chain. + */ + IMPORT_C void SetNext( MGlxLayout* aLayout ); + + /** + * Returns the next layout in the chain. + */ + IMPORT_C MGlxLayout* Next() const; + + public: // From MGlxLayout + + /// @ref MGlxLayout::SetLayoutValues + IMPORT_C void SetLayoutValues( TGlxLayoutInfo& aInfo ); + + protected: // New API, template method pattern + + /** + * This method can specify the layout of given visual by setting the corresponding fields + * in the layout info struct. + * @param aInfo the layout information to specify + */ + virtual void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + + private: + + /// Ref: The next layout in chain + MGlxLayout* iNextLayout; + + public: + + __DEBUG_ONLY( TBuf<50> _iName ); + + }; + +/** + * CGlxLayout + * + * Implements the MGlxLayout interface and provides common layout chain functionality. + * This class is provided as a base class for CBase deriving layout classes. + * + * @lib glxlayouts.lib + */ +class CGlxLayout : public CBase, public MGlxLayout + { + public: + + /** + * Constructor, resets the object. + */ + IMPORT_C CGlxLayout(); + + /** + * Destructor. Virtual by CBase and MGlxLayout + */ + IMPORT_C ~CGlxLayout(); + + /** + * Sets the next layout in the chain. + */ + IMPORT_C void SetNext( MGlxLayout* aLayout ); + + /** + * Returns the next layout in the chain. + */ + IMPORT_C MGlxLayout* Next() const; + + public: // From MGlxLayout + + /// @ref MGlxLayout::SetLayoutValues + IMPORT_C void SetLayoutValues( TGlxLayoutInfo& aInfo ); + + protected: // New API, template method pattern + + /** + * This method can specify the layout of given visual by setting the corresponding fields + * in the layout info struct. + * @param aInfo the layout information to specify + */ + virtual void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + + private: + + /// Own: the layout implementation + TGlxLayout iLayoutImpl; + + public: + + __DEBUG_ONLY( TBuf<50> _iName ); + + }; + +#endif // __GLXLAYOUT_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxlayouthelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxlayouthelper.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-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: Layout to mapping function adapter class +* +*/ + + + + +#ifndef T_GLXLAYOUTHELPER_H +#define T_GLXLAYOUTHELPER_H + +// INCLUDE DEPENDENCIES +#include +#include // TGlxLayoutInfoResetter + +// FORWARD DECLARES +class MGlxLayout; + +/** + * TGlxLayoutHelper + * + * Sets the layout values from MGlxLayout and TGlxLayoutInfo + * to a CHuiVisual. + * + * @lib glxlayouts.lib + */ +class TGlxLayoutHelper + { + public: + + /** + * Constructor + * @param aVisual the visual to layout + */ + IMPORT_C TGlxLayoutHelper( CAlfVisual& aVisual ); + + /** + * Destructor. + */ + IMPORT_C ~TGlxLayoutHelper(); + + /** + * This method should be called when the layout needs to be updated + * @param aIndex the current index for the visual this helper is mapped + * @param aScreenSize the screen size, passed on to the layout + */ + IMPORT_C void LayoutVisual( TInt aIndex, TSize aScreenSize ); + /** + * This method should be called when the Panning (Drag)layout needs to be updated + * @param aIndex the current index for the visual this helper is mapped + * @param aScreenSize the screen size, passed on to the layout + */ + IMPORT_C void LayoutPanVisual( TInt aIndex, TSize aScreenSize ); + + /** + * Sets the layout chain to this adapter. + * @param aLayout layout to use + */ + IMPORT_C void SetLayout( MGlxLayout* aLayout ); + /** + * Gets the layout updated Size. + */ + IMPORT_C TSize GetUpdatedVisualSize( ); + /** + * Gets the layout information. + */ + IMPORT_C TGlxLayoutInfo& GetUpdatedLayoutInfo( ); + + private: + + /// Own: The layout info + TGlxLayoutInfoResetter iLayoutInfo; + /// Ref: The visual + CAlfVisual& iVisual; + /// Ref: The layout + MGlxLayout* iLayout; + + }; + +#endif // T_GLXLAYOUTHELPER_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxlayoutinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxlayoutinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2008-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: Layout base classes +* +*/ + + + + +#ifndef __GLXLAYOUTINFO_H__ +#define __GLXLAYOUTINFO_H__ + +#include +#include +// FORWARD DECLARATIONS +class CAlfVisual; +class TAlfTimedValue ; +/** + * TGlxScreenInfo + * This class contains information about the screen, the layout may utilize these when laying out the visuals + */ + //@TODO : This class has to removed. + //The views get the screen info from - iScreenSize, TGlxLayoutInfo +NONSHARABLE_CLASS( TGlxScreenInfo ) + { + public: + + /** + * Contructor, resets the variables + */ + IMPORT_C TGlxScreenInfo(); + + public: + + /** + * Width of the display + */ + TInt iWidth; + + /** + * Height of the display + */ + TInt iHeight; + + /** + * Orientation of the display + */ + enum TOrientation { EPortrait, ELandscape } iOrientation; + + }; + +/** + * TGlxLayoutInfo. + * This class contains the fields that the layouts can modify in order to + * get the visuals drawn the way they want. + */ +NONSHARABLE_CLASS( TGlxLayoutInfo ) + { + + public: + + /** + * Mapped index, use this to get the index relative to focus + */ + TReal32 iMappedIndex; + /** + * Display size + */ + TSize iScreenSize; + /** + * Visual size + */ + TSize iVisualSize; + /** + * Index of the visual + */ + inline TInt Index() const; + /** + * The visual that the layout is targeted to + */ + inline CAlfVisual& Visual(); + + protected: + + /** + * Constructor, resets the state + * @param the visual + */ + TGlxLayoutInfo( CAlfVisual* aVisual ); + + /// Own: the index + TInt iIndex; + + /// Ref: the visual + CAlfVisual* iVisual; + + }; + +/** + * TGlxLayoutInfoResetter + * Modifiable version of the layout info + * get the visuals drawn the way they want. + */ +NONSHARABLE_CLASS( TGlxLayoutInfoResetter ) : public TGlxLayoutInfo + { + public: + + /** + * Constructor, resets the state + * This one sets the visual as NULL, use SetVisual to + * update the visual + */ + IMPORT_C TGlxLayoutInfoResetter(); + + /** + * Constructor, resets the state + * @param the target visual + */ + IMPORT_C TGlxLayoutInfoResetter( CAlfVisual* aVisual ); + + /** + * Set the visual + * @param the target visual + */ + IMPORT_C void SetVisual( CAlfVisual* aVisual ); + + /** + * Set the screen size + * @param the screen size + */ + IMPORT_C void SetScreenSize( TSize aSize ); + /* Reset, Sets the index and cleas all values. + * iIndex and iMappedIndex are set to aIndex, + * other values are set to 0, except iTextureBottomRight + * which is set to (1,1) + * @param aIndex, the index for this item + */ + IMPORT_C void Reset( TInt aIndex ); + + }; + +#include "glxlayoutinfo.inl" + +#endif // __GLXLAYOUTINFO_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxlayoutinfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxlayoutinfo.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-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: Layout base classes +* +*/ + + + + +#ifndef __GLXLAYOUTINFO_INL__ +#define __GLXLAYOUTINFO_INL__ + +#include // Panic codes + +class CAlfVisual; +inline TInt TGlxLayoutInfo::Index() const + { + return iIndex; + } + +inline CAlfVisual& TGlxLayoutInfo::Visual() + { + // visual must never be null when doing layout +// __ASSERT_ALWAYS( iVisual, Panic( EGlxPanicNullCAlfVisual ) ); + return *iVisual; + } + +#endif // __GLXLAYOUTINFO_INL__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxlayoutsplitter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxlayoutsplitter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2008-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: Splits layout chain by visual +* +*/ + + + + +#ifndef T_GLXLAYOUTSPLITTER_H +#define T_GLXLAYOUTSPLITTER_H + +#include +#include + +class CAlfVisual; + +/** + * TGlxLayoutSplitter + * + * Splits the layout chain based on a visual. Client can define + * any number of visual-layout pairs, and a default layout + * for the rest. + * + * @lib glxlayouts.lib + */ +class TGlxLayoutSplitter : public TGlxLayout, public MGlxVisualListObserver + { + public: + + /** + * Constructor. Resets the values + */ + IMPORT_C TGlxLayoutSplitter(); + + /** + * Destructor + */ + IMPORT_C ~TGlxLayoutSplitter(); + + /** + * Sets the visual list for the splitter. + * Must be called before using the splitter + * @param aVisualList the visual list that this layout should deal with + */ + IMPORT_C void SetVisualListL( MGlxVisualList* aVisualList ); + + /** + * Sets a layout that is bound to a visual + * @param aVisual the visual that this layout should deal with + */ + + //Changed the API from AddLayout to SetLayout + IMPORT_C void SetLayoutL( + MGlxLayout* aLayout, const CAlfVisual* aVisual ); + + /** + * Removes a layout that is bound to a visual + * @param aVisual the visual that this layout should deal with + */ + IMPORT_C void RemoveLayout( const CAlfVisual* aVisual ); + + /** + * Sets the default layout. This layout is used when the + * visual being evaluated is not linked to another layout + * (by calling AddLayoutL). If default layout has not been + * defined, the layout will fall through, i.e., values and + * index will not be modified (for non-lined visuals). + * @param aLayout layout pointer or null if client want's to + * undefine default layout. + */ + IMPORT_C void SetDefaultLayout( MGlxLayout* aLayout ); + + /** + * Remove all layouts and remove association with visual list. + */ + IMPORT_C void Reset(); + + protected: // From TGlxLayout + + /// @ref TGlxLayout::DoSetLayoutValues + void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + + public: // From MGlxVisualListObserver + + /// @ref MGlxVisualListObserver::DoSetLayoutValues + void HandleFocusChangedL( + TInt aFocusIndex, TReal32 aItemsPerSecond, MGlxVisualList* aList, + NGlxListDefs::TFocusChangeType aType ); + /// @ref MGlxVisualListObserver::HandleSizeChanged + void HandleSizeChanged( const TSize& aSize, MGlxVisualList* aList ); + /// @ref MGlxVisualListObserver::HandleVisualRemoved + void HandleVisualRemoved( + const CAlfVisual* aVisual, MGlxVisualList* aList ); + /// @ref MGlxVisualListObserver::HandleVisualAddedL + void HandleVisualAddedL( + CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + + private: + + // Helper fo get the layout that corresponds to given visual + MGlxLayout* Layout( const CAlfVisual* aVisual ) const; + // Helper fo get the layoutindex that corresponds to given visual + TInt LayoutIndex( const CAlfVisual* aVisual ) const; + + private: + + /** + * Helper struct to store the layout and visual + */ + struct TLayout + { + /// Ref: the layout + MGlxLayout* iLayout; + /// Ref: the visual + const CAlfVisual* iVisual; + /** + * Helper to tell whether two TLayout structs match + */ + static TBool Match( const TLayout& aLhs, const TLayout& aRhs ); + }; + /// Own: the layout-visual structs + RArray< TLayout > iLayouts; + /// Ref: the default layout + MGlxLayout* iDefaultLayout; + /// Ref: the visual list + MGlxVisualList* iVisualList; + + }; + +#endif // T_GLXLAYOUTSPLITTER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxrotationlayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxrotationlayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2008-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: Temporary rotation layout +* +*/ + + + + +#ifndef GLXROTATIONLAYOUT_H +#define GLXROTATIONLAYOUT_H + +#include + +const TReal32 KGlxRotationNone = 0.0; +const TReal32 KGlxRotationClockwise = -90.0; +const TReal32 KGlxRotationAnticlockwise = 90.0; + +/** + * Apply animated rotation to a visual. + * + * @lib glxlayouts.lib + */ + +class TGlxRotationLayout : public TGlxLayout + { + public: + /** + * Constructor, reset the values + */ + IMPORT_C TGlxRotationLayout(); + + /** + * Destructor + */ + IMPORT_C ~TGlxRotationLayout(); + + /** + * Set rotation value. + * @param aRotation New rotation value, in degrees. + * @param aTransitionTime How long the change in rotation should take. + */ + IMPORT_C void SetRotation(TReal32 aRotation, TInt aTransitionTime); + + protected: // From TGlxLayout + void DoSetLayoutValues(TGlxLayoutInfo& aInfo); + + private: + + /** Amount of rotation, in degrees */ + TReal32 iRotation; + /** Varies between 0 and 1 to animate a change in rotation over time */ + TInt iTransitionTime; + }; + +#endif // GLXROTATIONLAYOUT_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxsetcoefficientlayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxsetcoefficientlayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2008-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: Set coefficient layout +* +*/ + + + + +#ifndef T_GLXSETCOEFFICIENTLAYOUT_H +#define T_GLXSETCOEFFICIENTLAYOUT_H + +#include +#include + +/** + * TGlxSetCoefficientLayout + * + * Resets the coefficient to a defined value. + * The value can be animated. + * + * @lib glxlayouts.lib + */ +class TGlxSetCoefficientLayout : public TGlxLayout + { + public: + + /** + * Constructor. + */ + IMPORT_C TGlxSetCoefficientLayout(); + + /** + * Destructor. + */ + IMPORT_C ~TGlxSetCoefficientLayout(); + + /** + * Set layout type to which the coefficient is set + * @param aType the layout type, see @ref TGlxLayoutInfo::TLayoutType + */ + IMPORT_C void SetType( TGlxLayoutInfo::TLayoutType aType ); + + /** + * SetCoefficient. + * @param aCoefficient the value to set + * @param aMilliseconds the target time for the coefficient value + */ + IMPORT_C void SetCoefficient( TReal32 aCoefficient, TInt aMilliseconds ); + + protected: // From TGlxLayout + + /// @ref TGlxLayout::DoSetLayoutValues + void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + /// @ref TGlxLayout::DoChanged + TBool DoChanged() const; + /// @ref TGlxLayout::DoClearChanged + void DoClearChanged(); + + private: + + /// Own: the type of the layout + TGlxLayoutInfo::TLayoutType iType; + /// Own: the timed value for the coefficient + TAlfTimedValue iCoefficient; + + }; + +#endif // T_GLXSETCOEFFICIENTLAYOUT_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxsetvaluelayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxsetvaluelayout.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2008-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: Set value layout +* +*/ + + + + +#ifndef T_GLXSETVALUELAYOUT_H +#define T_GLXSETVALUELAYOUT_H + +#include +#include + +/** + * TGlxSetValueLayout + * + * Sets value of specific layout attribute(s) + * + * @lib glxlayouts.lib + */ +class TGlxSetValueLayout : public TGlxLayout + { + public: + + /** + * Constructor + */ + IMPORT_C TGlxSetValueLayout(); + + /** + * Destructor + */ + IMPORT_C ~TGlxSetValueLayout(); + + /** + * Set the value. This variant sets the value for opacity and rotation + * value is (TReal) + * This method can only be used for setting EOpacity or ERotation + * @param aTarget the value you wish the visual(s) to have + * @param aMilliseconds the duration for the change + */ + IMPORT_C void SetOpacity( TReal32 aTarget, TInt aMilliseconds ); + + /** + * Set the value. This variant sets the value for size and position + * value is (TReal, TReal) + * This method can only be used for setting ESize or EPosition + * @param aTargetX the value for x + * @param aTargetY the value for y + * @param aMilliseconds the duration for the change + */ + IMPORT_C void SetSize( + TReal32 aTargetWidth, TReal32 aTargetHeight, TInt aMilliseconds ); + + /** + * Set the position + * @param aTargetX the value for x + * @param aTargetY the value for y + * @param aMilliseconds the duration for the change + */ + IMPORT_C void SetPosition( + TReal32 aTargetX, TReal32 aTargetY, TInt aMilliseconds ); + + protected: // From TGlxLayout + + /// @ref TGlxLayout::DoSetLayoutValues + void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); + + private: + + /// Own: the value for opacity + TAlfTimedValue iOpacityValue; + /// Own: the value for size + TAlfTimedPoint iSizeValue; + /// Own: the value for position + TAlfTimedPoint iPositionValue; + /// Own: flag to tell which layout values need to be changed + TInt iValuesToChange; + + }; + +#endif // T_GLXSETVALUELAYOUT_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/glxzoomlayoutbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/glxzoomlayoutbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: Definition of TGlxZoomLayoutBase +* +*/ + + + + +#ifndef GLXZOOMLAYOUTBASE_H +#define GLXZOOMLAYOUTBASE_H + +// INCLUDES + +#include + +// FORWARD DECLARATIONS + +struct TAlfRealRect; + +// CLASS DECLARATION + +/** +* Abtract base class for zooming layouts. Sets layout values based on +* coordinates provided by the derived class. +* +* @internal reviewed 06/06/2007 by Kimmo Hoikka +*/ +class TGlxZoomLayoutBase : public TGlxLayout + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + IMPORT_C TGlxZoomLayoutBase(); + + /** + * Destructor. + */ + IMPORT_C ~TGlxZoomLayoutBase(); + + public: // New functions + + /** + * Set the image dimensions. + * @param aDimensions Dimensions of the image being zoomed (in pixels) + */ + IMPORT_C void SetImageDimensions(const TSize& aDimensions); + /** + * Get the image dimensions. + * @return const TSize& Dimensions of the image being zoomed (in pixels) + */ + IMPORT_C const TSize& ImageDimensions() const; + + /** + * Get current zoom and pan values. The returned rectangle is relative + * to the screen, ie. if the width is 2, the visual should be twice the + * width of the screen, and if the centre of the rectangle is (0, 0) the + * visual should be centred on the screen. If the rectangle is + * (-0.5, -0.5) - (0.5, 0.5) then the visual should exactly fill the + * screen. + * @param aRect Reference to rect in which to return coords. + */ + virtual void GetCurrentCoords(TAlfRealRect& aRect) = 0; + /** + * Get "predicted" zoom and pan values. These are the values that would + * eventually be reached if the user released all zoom/pan keys now. + * @param aRect Reference to rect in which to return coords. + */ + virtual void GetPredictedCoords(TAlfRealRect& aRect) = 0; + + protected: // From TGlxLayout + + /** See @ref TGlxLayout::DoSetLayoutValues */ + IMPORT_C void DoSetLayoutValues(TGlxLayoutInfo& aInfo); + /** See @ref TGlxLayout::DoChanged */ + IMPORT_C TBool DoChanged() const; + /** See @ref TGlxLayout::DoClearChanged */ + IMPORT_C void DoClearChanged(); + + protected: // Data + /** Dimensions of the image being zoomed (in pixels) */ + TSize iImageDimensions; + + private: // Data + /** Whether the layout has changed since last refresh */ + TBool iChanged; + }; + +#endif // GLXZOOMLAYOUTBASE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/inc/mglxlayoutowner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/inc/mglxlayoutowner.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2008-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: Layout owner interface +* +*/ + + + + +#ifndef M_GLXLAYOUTOWNER_H +#define M_GLXLAYOUTOWNER_H + +class MGlxLayout; + +/** + * Layout owner interface to allow classes to access owned layouts + */ +class MGlxLayoutOwner + { +public: + /** + * Return a specified layout, if found + * @param aIndex The index for the layout - the meaning of the index is decided + * by each implementing class individually + * @return The specified layout; NULL if not found + */ + virtual MGlxLayout* GlxLayout(TInt aIndex) = 0; + }; + +#endif // M_GLXLAYOUTOWNER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxblendlayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxblendlayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,265 @@ +/* +* Copyright (c) 2008-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: Layout blender +* +*/ + + + + +#include "glxblendlayout.h" +#include // Panic codes + +// LOCAL METHODS +namespace + { + // helper method to calculate coefficiency for given field + TReal32 GetCoefficiency( + TGlxLayoutInfo& aBaseInfo, + TGlxLayoutInfo& aDeltaInfo, + TGlxLayoutInfo::TLayoutType aType, + TInt aIndex ) + { + /* + // position, get coefficients + //TReal32 new_coeff = aDeltaInfo.Coefficient( aType ); + //TReal32 combined_coeff = aBaseInfo.Coefficient( aType ); + // check if this is the first layout chain in the blender + // and full coefficiency has not been yet reached + if( aIndex == 0 && combined_coeff < 1.0 ) + { + // increase the coefficient to reach 1.0 + new_coeff = 1.0 - combined_coeff; + aBaseInfo.SetCoefficient( aType, 1.0 ); + } + // if the coefficient was bigger than zero + // and full coefficiency has not been yet reached + else if( new_coeff > 0.0 && combined_coeff < 1.0 ) + { + // dont allow coefficient to exceed 1.0 + if( new_coeff > ( 1.0 - combined_coeff ) ) + { + new_coeff = 1.0 - combined_coeff; + } + // increase the coefficient + aBaseInfo.SetCoefficient( aType, combined_coeff + new_coeff ); + } + else + { + // coefficient over or underflow + new_coeff = 0; + } + return new_coeff;*/ + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxBlendLayout::TGlxBlendLayout() + : iChanged( EFalse ) // blender not is changed by default + { + __DEBUG_ONLY( _iName = _L( "TGlxBlendLayout" ) ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxBlendLayout::~TGlxBlendLayout () + { + iLayouts.Close(); + } + +// ----------------------------------------------------------------------------- +// AddLayoutL +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxBlendLayout::AddLayoutL( MGlxLayout* aLayout ) + { + // layout must not be null + __ASSERT_DEBUG( aLayout, Panic( EGlxPanicNullLayout ) ); + // create layout struct + TLayout cache; + cache.iLayout = aLayout; + __ASSERT_DEBUG( + iLayouts.Find( cache, TLayout::Match ) == KErrNotFound, + Panic( EGlxPanicAlreadyAdded ) ); + + // cant set anything sane to layout info at this point + iLayouts.AppendL( cache ); + iChanged = ETrue; + } + +// ----------------------------------------------------------------------------- +// RemoveLayout +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxBlendLayout::RemoveLayout( const MGlxLayout* aLayout ) + { + TInt count = iLayouts.Count(); + for( TInt i = 0; i < count; i++ ) + { + if( iLayouts[ i ].iLayout == aLayout ) + { + // Found it, remove + iLayouts.Remove( i ); + iChanged = ETrue; + return; + } + } + // its ok to remove a layout that was already gone, no harm done there + } + +// ----------------------------------------------------------------------------- +// RemoveAllLayouts +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxBlendLayout::RemoveAllLayouts() + { + iLayouts.Close(); + } + +// ----------------------------------------------------------------------------- +// MapValue +// ----------------------------------------------------------------------------- +void TGlxBlendLayout::DoSetLayoutValues( TGlxLayoutInfo& aInfo ) + { + /* + TInt count = iLayouts.Count(); + // first set each layouts info fields correctly + for( TInt i = 0; i < count; i++ ) + { + // reset the values for the layout info + //iLayouts[ i ].iLayoutInfo.Reset( aInfo.Index() ); + //iLayouts[ i ].iLayoutInfo.SetVisual( aInfo.Visual() ); + //iLayouts[ i ].iLayoutInfo.SetScreenInfo( aInfo.ScreenInfo() ); + } + + // process each layout + for( TInt i = 0; i < count; i++ ) + { + // call the layout (chain) to perform the processing for their own info + iLayouts[ i ].iLayout->SetLayoutValues( iLayouts[ i ].iLayoutInfo ); + } + + // reset completely the aInfo fields and its coefficients + // we use the coefficient fields to know when we have enough values for + // certain field (coefficient reaches 1.0) + // we need to reset the base values as the cached values in layout chains + // had default values (which may not ne 0 for all fields) + aInfo.iPosition.iX = 0; + aInfo.iPosition.iY = 0; + aInfo.SetCoefficient( TGlxLayoutInfo::EPosition, 0 ); + aInfo.iSize.iX = 0; + aInfo.iSize.iY = 0; + aInfo.SetCoefficient( TGlxLayoutInfo::ESize, 0 ); + aInfo.iOpacity = 0; + aInfo.SetCoefficient( TGlxLayoutInfo::EOpacity, 0 ); + aInfo.iRotation = 0; + aInfo.SetCoefficient( TGlxLayoutInfo::ERotation, 0 ); + + // then merge the values according to coefficients + // need to process in reverse order since layout in index 0 + // has the strongest effect + for( TInt i = count - 1; i >= 0; i-- ) + { + // position, get coefficient + TReal32 new_coeff = GetCoefficiency( + aInfo, iLayouts[ i ].iLayoutInfo, + TGlxLayoutInfo::EPosition, i ); + // if the coefficient was bigger than zero + if( new_coeff > 0.0 ) + { + // add new position, multiplied with the coefficient + aInfo.iPosition.iX += + iLayouts[ i ].iLayoutInfo.iPosition.iX * new_coeff; + aInfo.iPosition.iY += + iLayouts[ i ].iLayoutInfo.iPosition.iY * new_coeff; + } + + // size, get coefficient + new_coeff = GetCoefficiency( + aInfo, iLayouts[ i ].iLayoutInfo, + TGlxLayoutInfo::ESize, i ); + // if the coefficient was bigger than zero + if( new_coeff > 0.0 ) + { + // add new size, multiplied with the coefficient + aInfo.iSize.iX += + iLayouts[ i ].iLayoutInfo.iSize.iX * new_coeff; + aInfo.iSize.iY += + iLayouts[ i ].iLayoutInfo.iSize.iY * new_coeff; + } + + // opacity, get coefficient + new_coeff = GetCoefficiency( + aInfo, iLayouts[ i ].iLayoutInfo, + TGlxLayoutInfo::EOpacity, i ); + if( new_coeff > 0.0 ) + { + // add new opacity, multiplied with the coefficient + aInfo.iOpacity += + iLayouts[ i ].iLayoutInfo.iOpacity * new_coeff; + } + + // rotation, get coefficient + new_coeff = GetCoefficiency( + aInfo, iLayouts[ i ].iLayoutInfo, + TGlxLayoutInfo::ERotation, i ); + if( new_coeff > 0.0 ) + { + // add new rotation, multiplied with the coefficient + aInfo.iRotation += + iLayouts[ i ].iLayoutInfo.iRotation * new_coeff; + } + } */ + } + +// ----------------------------------------------------------------------------- +// DoChanged +// ----------------------------------------------------------------------------- +TBool TGlxBlendLayout::DoChanged() const + { + // See if even one layout has changed + /// @todo consider adding the index of current visual to the Changed call +/* TInt count = iLayouts.Count(); + for( TInt i = 0; i < count; i++ ) + { + if( iLayouts[ i ].iLayout->Changed() ) + { + return ETrue; + } + } + + return iChanged; +*/ } + +// ----------------------------------------------------------------------------- +// DoClearChanged +// ----------------------------------------------------------------------------- +void TGlxBlendLayout::DoClearChanged() + { + TInt count = iLayouts.Count(); + for( TInt i = 0; i < count; i++ ) + { +// iLayouts[ i ].iLayout->ClearChanged(); + } + + iChanged = EFalse; + } + +// ----------------------------------------------------------------------------- +// TLayout::Match +// ----------------------------------------------------------------------------- +TBool TGlxBlendLayout::TLayout::Match( const TLayout& aLhs, const TLayout& aRhs ) + { + return aLhs.iLayout == aRhs.iLayout; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxfollowfocuslayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxfollowfocuslayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: Layout mapping index to distance from focus +* +*/ + + + + +#include "glxfollowfocuslayout.h" + +#include // MGlxVisualList +#include "glxpanic.h" // Panic codes +#include + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxFollowFocusLayout::TGlxFollowFocusLayout() + : iVisualList( NULL ) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxFollowFocusLayout::~TGlxFollowFocusLayout() + { + } + +// ----------------------------------------------------------------------------- +// SetVisualListL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxFollowFocusLayout::SetVisualListL( + MGlxVisualList* aVisualList ) + { + __ASSERT_DEBUG( aVisualList, Panic( EGlxPanicNullVisualList ) ); + + iVisualList = aVisualList; + } + +// ----------------------------------------------------------------------------- +// DoSetLayoutValues +// ----------------------------------------------------------------------------- +void TGlxFollowFocusLayout::DoSetLayoutValues( TGlxLayoutInfo& aInfo ) + { + __ASSERT_DEBUG( iVisualList, Panic( EGlxPanicNullVisualList ) ); + + // change the mappedindex to be relative to focus but wrapped around + // so if the list items are + // 0, 1, 2, 3, 4, 5, 6 + // -2,-1, 0, 1, 2, 3,-3 == focus in 2 + // -3,-2,-1, 0, 1, 2, 3 == focus in 3 + // 1, 2, 3,-3,-2,-1, 0 == focus in 6 + // 0, 1, 2, 3,-3,-2,-1 == focus in 0 + + // calculate the current index - focus + TInt index = aInfo.Index() - iVisualList->FocusIndex(); + + // get item count + TInt itemCount = iVisualList->ItemCount(); + TInt maxDist = itemCount / 2; + + // if index is smaller than smallest possible + if ( index < -maxDist ) + { + // wrap around + index += itemCount; + } + // if index is larger than biggest possible + else if ( index >= maxDist ) + { + // wrap around + index -= itemCount; + } + // assign the mapped index + aInfo.iMappedIndex = index; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxlayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxlayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2008-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: Layout base class +* +*/ + + + + +#include "glxlayout.h" +#include // Panic codes + +// ----------------------------------------------------------------------------- +// TGlxLayout class +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayout::TGlxLayout() + : iNextLayout( NULL ) // no CBase so clear value + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayout::~TGlxLayout() + { + } + +// ----------------------------------------------------------------------------- +// SetNext +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayout::SetNext( MGlxLayout* aLayout ) + { + iNextLayout = aLayout; + } + +// ----------------------------------------------------------------------------- +// Next +// ----------------------------------------------------------------------------- +EXPORT_C MGlxLayout* TGlxLayout::Next() const + { + return iNextLayout; + } + +// ----------------------------------------------------------------------------- +// SetLayoutValues +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayout::SetLayoutValues( TGlxLayoutInfo& aInfo ) + { + // first set our own values + DoSetLayoutValues( aInfo ); + + // do we have a successor + if( iNextLayout ) + { + // tell it to set values + iNextLayout->SetLayoutValues( aInfo ); + } + } + +// ----------------------------------------------------------------------------- +// DoMapValue +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayout::DoSetLayoutValues( TGlxLayoutInfo& /*aInfo*/ ) + { + // by default do nothing + } + +// ----------------------------------------------------------------------------- +// CGlxLayout class +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C CGlxLayout::CGlxLayout() + { + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C CGlxLayout::~CGlxLayout() + { + } + +// ----------------------------------------------------------------------------- +// SetNext +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxLayout::SetNext( MGlxLayout* aLayout ) + { + iLayoutImpl.SetNext( aLayout ); + } + +// ----------------------------------------------------------------------------- +// Next +// ----------------------------------------------------------------------------- +EXPORT_C MGlxLayout* CGlxLayout::Next() const + { + return iLayoutImpl.Next(); + } + +// ----------------------------------------------------------------------------- +// SetLayoutValues +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxLayout::SetLayoutValues( TGlxLayoutInfo& aInfo ) + { + // first call our own method + DoSetLayoutValues( aInfo ); + // then the rest + iLayoutImpl.SetLayoutValues( aInfo ); + } + +// ----------------------------------------------------------------------------- +// DoMapValue +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxLayout::DoSetLayoutValues( TGlxLayoutInfo& /*aInfo*/ ) + { + // by default do nothing + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxlayouthelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxlayouthelper.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2008-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: Layout to mapping function adapter class +* +*/ + + + + +#include "glxlayouthelper.h" + +#include // CAlfVisual +#include // MGlxLayout +#include // Panic codes +#include // for TAlfRealPoint +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxLayoutHelper::TGlxLayoutHelper( CAlfVisual& aVisual ) + : iLayoutInfo( &aVisual ), + iVisual( aVisual ), + iLayout( NULL ) + { + // drawing origo is in top left corner of the image + // Alf screen origo is in top left corner so this enables us to use 0,0 + // to get a full screen image onto the center of the screen + iVisual.SetOrigin( EAlfVisualHOriginCenter, EAlfVisualVOriginCenter ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayoutHelper::~TGlxLayoutHelper() + { + // nothing to do + } + +// ----------------------------------------------------------------------------- +// LayoutVisual +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutHelper::LayoutVisual( TInt aIndex, TSize aScreenSize ) + { + // assert that we have a layout before we do laying out of visual + if( iLayout ) + { + // reset the layout info + iLayoutInfo.Reset( aIndex ); + iLayoutInfo.SetScreenSize( aScreenSize ); + // ask for the layout to update new values + iLayout->SetLayoutValues( iLayoutInfo ); + } + } +// ----------------------------------------------------------------------------- +// LayoutVisual +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutHelper::LayoutPanVisual( TInt aIndex, TSize aScreenSize ) + { + // assert that we have a layout before we do laying out of visual + if( iLayout ) + { + // reset the layout info + iLayoutInfo.Reset( aIndex ); + iLayoutInfo.SetScreenSize( aScreenSize ); + } + } +// ----------------------------------------------------------------------------- +// SetLayout +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutHelper::SetLayout( MGlxLayout* aLayout ) + { + iLayout = aLayout; + } +// ----------------------------------------------------------------------------- +// GetUpdatedVisualSize +// ----------------------------------------------------------------------------- +EXPORT_C TSize TGlxLayoutHelper::GetUpdatedVisualSize( ) + { + return iLayoutInfo.iVisualSize ; + } + + +// ----------------------------------------------------------------------------- +// GetUpdatedRectSize +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayoutInfo& TGlxLayoutHelper::GetUpdatedLayoutInfo( ) + { + return iLayoutInfo; + } +//End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxlayoutinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxlayoutinfo.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-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: Layout base classes +* +*/ + + + + +#include "glxlayoutinfo.h" + +// ----------------------------------------------------------------------------- +// TGlxLayoutInfo +// ----------------------------------------------------------------------------- +TGlxLayoutInfo::TGlxLayoutInfo( CAlfVisual* aVisual ) + : iMappedIndex( 0 ), + iIndex( 0 ), + iVisual( aVisual ) + { + } + +// ----------------------------------------------------------------------------- +// TGlxLayoutInfoResetter +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayoutInfoResetter::TGlxLayoutInfoResetter() + : TGlxLayoutInfo( NULL ) + { + // reset the object + Reset( 0 ); + } + +// ----------------------------------------------------------------------------- +// TGlxLayoutInfoResetter +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayoutInfoResetter::TGlxLayoutInfoResetter( CAlfVisual* aVisual ) + : TGlxLayoutInfo( aVisual ) + { + // reset the object + Reset( 0 ); + } + +// ----------------------------------------------------------------------------- +// SetVisual +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutInfoResetter::SetVisual( CAlfVisual* aVisual ) + { + iVisual = aVisual; + } +// ----------------------------------------------------------------------------- +// SetScreenSize +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutInfoResetter::SetScreenSize( TSize aSize ) + { + iScreenSize = aSize; + } + +// ----------------------------------------------------------------------------- +// Reset +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutInfoResetter::Reset( TInt aIndex ) + { + // reset index + iIndex = aIndex; + iMappedIndex = iIndex; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxlayoutsplitter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxlayoutsplitter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2008-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: Splits layout chain by visual +* +*/ + + + + +#include "glxlayoutsplitter.h" + +#include +#include +#include // Panic codes + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayoutSplitter::TGlxLayoutSplitter() + : iDefaultLayout( NULL ), + iVisualList( NULL ) + { + __DEBUG_ONLY( _iName = _L("TGlxLayoutSplitter") ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxLayoutSplitter::~TGlxLayoutSplitter() + { + Reset(); + } + +// ----------------------------------------------------------------------------- +// Tells the splitter what is the visual list object +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutSplitter::SetVisualListL( + MGlxVisualList* aVisualList ) + { + __ASSERT_DEBUG( + aVisualList, Panic( EGlxPanicNullVisualList ) ); + iVisualList = aVisualList; + iVisualList->AddObserverL( this ); + } + +// ----------------------------------------------------------------------------- +// SetLayoutL +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutSplitter::SetLayoutL( + MGlxLayout* aLayout, const CAlfVisual* aVisual ) + { + // Call SetVisualListL first + __ASSERT_DEBUG( iVisualList, Panic( EGlxPanicNullVisualList ) ); + // to replace EGlxPanicNullCHuiVisual + //__ASSERT_DEBUG( aVisual && aLayout, Panic( EGlxPanicNullCAlfVisual ) ); + // search if there already is a layout for this visual + __DEBUG_ONLY( TLayout temp;temp.iVisual = aVisual; ); + __ASSERT_DEBUG( + iLayouts.Find( temp, TLayout::Match ) == KErrNotFound, + Panic( EGlxPanicAlreadyAdded ) ); + + // create layout struct + TLayout newLayoutStruct; + newLayoutStruct.iLayout = aLayout; + newLayoutStruct.iVisual = aVisual; + // append to the array + iLayouts.AppendL( newLayoutStruct ); + } + +// ----------------------------------------------------------------------------- +// Removes an existing layout +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutSplitter::RemoveLayout( + const CAlfVisual* aVisual ) + { + TInt index = LayoutIndex( aVisual ); + if( index != KErrNotFound ) + { + iLayouts.Remove( index ); + } + // NOTE! it is ok to try to remove a layout from visual when there was none + } + +// ----------------------------------------------------------------------------- +// Sets layout to be used when for visuals which don't have a specific layout +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutSplitter::SetDefaultLayout( + MGlxLayout* aLayout ) + { + iDefaultLayout = aLayout; + } + +// ----------------------------------------------------------------------------- +// Reset +// Remove all layouts and remove association with visual list. +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxLayoutSplitter::Reset() + { + // Remove all layouts + iLayouts.Close(); + + if( iVisualList ) + { + iVisualList->RemoveObserver( this ); + iVisualList = NULL; + } + } + +// ----------------------------------------------------------------------------- +// DoSetLayoutValues +// ----------------------------------------------------------------------------- +void TGlxLayoutSplitter::DoSetLayoutValues( + TGlxLayoutInfo& aInfo ) + { + // Call SetVisualListL to avoid this assert + __ASSERT_DEBUG( iVisualList, Panic( EGlxPanicNullVisualList ) ); + + // Does a layout exist for the visual + // If yes, use the specific layout. If not, use default layout. + MGlxLayout* layout = Layout( &aInfo.Visual() ); + // if layout was found + if( layout ) + { + // return its value + return layout->SetLayoutValues( aInfo ); + } + // otherwise return the default layout value + else if( iDefaultLayout ) + { + return iDefaultLayout->SetLayoutValues( aInfo ); + } + // nothing to do, no layout for the visual nor default + } + +// ----------------------------------------------------------------------------- +// HandleVisualAddedL +// ----------------------------------------------------------------------------- +void TGlxLayoutSplitter::HandleVisualAddedL( + CAlfVisual* /*aVisual*/, TInt /*aIndex*/, MGlxVisualList* /*aList*/) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleVisualRemoved +// Remove the layout associated with the visual, if any. +// ----------------------------------------------------------------------------- +void TGlxLayoutSplitter::HandleVisualRemoved( + const CAlfVisual* aVisual, MGlxVisualList* /*aList*/ ) + { + // Try to find a layout struct with the provided visual, and remove + // it if found + TInt index = LayoutIndex( aVisual ); + if( index != KErrNotFound ) + { + iLayouts.Remove( index ); + } + } + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL +// ----------------------------------------------------------------------------- +void TGlxLayoutSplitter::HandleFocusChangedL( + TInt /*aFocusIndex*/, + TReal32 /*aItemsPerSecond*/, + MGlxVisualList* /*aList*/, + NGlxListDefs::TFocusChangeType /*aType*/ ) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// HandleSizeChanged +// ----------------------------------------------------------------------------- +void TGlxLayoutSplitter::HandleSizeChanged( + const TSize& /*aSize*/, MGlxVisualList* /*aList*/ ) + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// Returns the layout associated with the aInIndex, or NULL if not found +// ----------------------------------------------------------------------------- +MGlxLayout* TGlxLayoutSplitter::Layout( + const CAlfVisual* aVisual ) const + { + // Find the layout that is intended for this visual + TInt index = LayoutIndex( aVisual ); + if( index != KErrNotFound ) + { + return iLayouts[ index ].iLayout; + } + return NULL; + } + +// ----------------------------------------------------------------------------- +// Returns layout struct index or KErrNotFound +// ----------------------------------------------------------------------------- +TInt TGlxLayoutSplitter::LayoutIndex( + const CAlfVisual* aVisual ) const + { + // search if there already is a layout for this visual + TLayout temp; + temp.iVisual = aVisual; + return iLayouts.Find( temp, TLayout::Match ); + } + +// ----------------------------------------------------------------------------- +// TGlxLayoutSplitter::Match +// ----------------------------------------------------------------------------- +TBool TGlxLayoutSplitter::TLayout::Match( + const TLayout& aLhs, const TLayout& aRhs ) + { + // return true if the visuals are same + return aLhs.iVisual == aRhs.iVisual; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxrotationlayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxrotationlayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2008-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: Temporary rotation layout +* +*/ + + + + +#include "glxrotationlayout.h" + +#include +#include +#include +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxRotationLayout::TGlxRotationLayout() + : iRotation( KGlxRotationNone ) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxRotationLayout::~TGlxRotationLayout() + { + } + +// ----------------------------------------------------------------------------- +// SetVisualListL +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxRotationLayout::SetRotation(TReal32 aRotation, + TInt aTransitionTime) + { + // just remember the values + iRotation = aRotation; + iTransitionTime = aTransitionTime; + } + +// ----------------------------------------------------------------------------- +// DoSetLayoutValues +// ----------------------------------------------------------------------------- +void TGlxRotationLayout::DoSetLayoutValues(TGlxLayoutInfo& aInfo) + { + // get the visual + CAlfVisual& visual = aInfo.Visual(); + TAlfTimedValue value( iRotation, iTransitionTime ); + + // Update the transformation for the rotation + CAlfTransformation& tranformation = visual.Transformation(); + tranformation.LoadIdentity(); + // rotate the visual + tranformation.Rotate( value ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxsetcoefficientlayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxsetcoefficientlayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2008-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: Set coefficient layout +* +*/ + + + + +#include "glxsetcoefficientlayout.h" + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxSetCoefficientLayout::TGlxSetCoefficientLayout() + { + __DEBUG_ONLY( _iName = _L( "TGlxSetCoefficientLayout" ) ); + + // by default set all coefficients + iType = TGlxLayoutInfo::ELastEnum; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxSetCoefficientLayout::~TGlxSetCoefficientLayout() + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// SetType +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxSetCoefficientLayout::SetType( TGlxLayoutInfo::TLayoutType aType ) + { + iType = aType; + } + +// ----------------------------------------------------------------------------- +// SetCoefficient +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxSetCoefficientLayout::SetCoefficient( + TReal32 aCoefficient, TInt aMilliseconds) + { +// iCoefficient.Set( aCoefficient, aMilliseconds ); + } + +// ----------------------------------------------------------------------------- +// DoMapValue +// ----------------------------------------------------------------------------- +void TGlxSetCoefficientLayout::DoSetLayoutValues( TGlxLayoutInfo& aInfo ) + { + // set coefficient + if( iType == TGlxLayoutInfo::ELastEnum ) + { + // set them all + for( TInt i = 0; i < TGlxLayoutInfo::ELastEnum; i++ ) + { + // need to cast the index to enum type for the compiler to be happy +// aInfo.SetCoefficient( +// (TGlxLayoutInfo::TLayoutType)i, iCoefficient.Now() ); + } + } + else + { + // just set the one specified +// aInfo.SetCoefficient( iType, iCoefficient.Now() ); + } + } + +// ----------------------------------------------------------------------------- +// DoChanged +// ----------------------------------------------------------------------------- +TBool TGlxSetCoefficientLayout::DoChanged() const + { +// return iCoefficient.Changed(); + } + +// ----------------------------------------------------------------------------- +// DoClearChanged +// ----------------------------------------------------------------------------- +void TGlxSetCoefficientLayout::DoClearChanged() + { +// iCoefficient.ClearChanged(); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxsetvaluelayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxsetvaluelayout.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2008-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: Set coefficient layout +* +*/ + + + + +#include "glxsetvaluelayout.h" +#include +#include // Panic codes + +namespace + { + const TInt KModifyOpacity = 0x01; + const TInt KModifySize = 0x02; + const TInt KModifyPosition = 0x04; + } + +// ----------------------------------------------------------------------------- +// TGlxSetValueLayout +// ----------------------------------------------------------------------------- +EXPORT_C TGlxSetValueLayout::TGlxSetValueLayout() + : iOpacityValue( 0.0 ), // set initial values + iSizeValue( 0.0, 0.0 ), + iPositionValue( 0.0, 0.0 ), + iValuesToChange( 0 ) + { + __DEBUG_ONLY( _iName = _L( "TGlxSetValueLayout" ) ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxSetValueLayout::~TGlxSetValueLayout() + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// SetValue +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxSetValueLayout::SetOpacity( + TReal32 aTarget, + TInt aMilliseconds ) + { + // flag that we change opacity + iValuesToChange |= KModifyOpacity; + // set the value for alf timed value + iOpacityValue.SetTarget( aTarget, aMilliseconds ); + } + +// ----------------------------------------------------------------------------- +// SetValue +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxSetValueLayout::SetSize( + TReal32 aTargetWidth, TReal32 aTargetHeight, TInt aMilliseconds ) + { + // flag that we change size + iValuesToChange |= KModifySize; + // set the value for alf timed point + iSizeValue.SetTarget( + TAlfRealPoint( aTargetWidth, aTargetHeight ), aMilliseconds ); + } + +// ----------------------------------------------------------------------------- +// TimedPoint +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxSetValueLayout::SetPosition( + TReal32 aTargetX, TReal32 aTargetY, TInt aMilliseconds ) + { + // flag that we change position + iValuesToChange |= KModifyPosition; + // set the value for alf timed point + iPositionValue.SetTarget( TAlfRealPoint( aTargetX, aTargetY ), aMilliseconds ); + } + +// ----------------------------------------------------------------------------- +// DoMapValue +// ----------------------------------------------------------------------------- +void TGlxSetValueLayout::DoSetLayoutValues( TGlxLayoutInfo& aInfo ) + { + CAlfVisual& visual = aInfo.Visual(); + // modify all the specified values + if( iValuesToChange & KModifyOpacity ) + { + // change the opacity + visual.SetOpacity( iOpacityValue ); + } + if( iValuesToChange & KModifySize ) + { + // change the size + visual.SetSize( iSizeValue ); + } + if( iValuesToChange & KModifyPosition ) + { + // change the position + visual.SetPos( iPositionValue ); + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/layouts/src/glxzoomlayoutbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/layouts/src/glxzoomlayoutbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of TGlxZoomLayoutBase +* +*/ + + + + +// INCLUDE FILES + +#include "glxzoomlayoutbase.h" + +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxZoomLayoutBase::TGlxZoomLayoutBase() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxZoomLayoutBase::~TGlxZoomLayoutBase() + { + } + +// ----------------------------------------------------------------------------- +// SetImageDimensions +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxZoomLayoutBase::SetImageDimensions(const TSize& aDimensions) + { + iImageDimensions = aDimensions; + iChanged = ETrue; + } + +// ----------------------------------------------------------------------------- +// ImageDimensions +// ----------------------------------------------------------------------------- +// +EXPORT_C const TSize& TGlxZoomLayoutBase::ImageDimensions() const + { + return iImageDimensions; + } + +// ----------------------------------------------------------------------------- +// DoSetLayoutValues +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxZoomLayoutBase::DoSetLayoutValues(TGlxLayoutInfo& aInfo) + { + TAlfRealRect rect; + GetCurrentCoords(rect); + + // These checks on iImageDimensions width/height must occur after GetCurrentCoords, + /* // since they may be changed as a result of the call to GetCurrentCoords + if ( iImageDimensions.iWidth > 0 && iImageDimensions.iHeight > 0 ) + { + // The previous layout in the chain has set the position and size for + // the visual to fill the screen, so we base the values on that. + + // Now adjust according to zoom coordinates + TAlfRealPoint centre = rect.Center(); + TReal32 width = aInfo.iScreenSize.iX * rect.Width(); + TReal32 height = aInfo.iScreenSize.iY * rect.Height(); + + // Adjust size according to proportion of screen that image fills + // Account for TGlxRotationLayout swapping width and height + TAlfRealSize imageSize(iImageDimensions); + TAlfRealSize screenSize(aInfo.ScreenInfo()->iWidth, + aInfo.ScreenInfo()->iHeight); + if ( screenSize.iHeight * imageSize.iWidth + < imageSize.iHeight * screenSize.iWidth ) + { + // Screen has wider aspect than image + TReal32 sizeRatioX = (screenSize.iHeight * imageSize.iWidth) + / (screenSize.iWidth * imageSize.iHeight); + if ( aInfo.iRotation ) + { + // Rotated + height *= sizeRatioX; + } + else + { + // Normal + width *= sizeRatioX; + } + } + else + { + // Screen has taller aspect than image + TReal32 sizeRatioY = (screenSize.iWidth * imageSize.iHeight) + / (screenSize.iHeight * imageSize.iWidth); + if ( aInfo.iRotation ) + { + // Rotated + width *= sizeRatioY; + } + else + { + // Normal + height *= sizeRatioY; + } + } + + aInfo.iPosition.iX += centre.iX * aInfo.iSize.iX; + aInfo.iPosition.iY += centre.iY * aInfo.iSize.iY; + aInfo.iSize.iX = width; + aInfo.iSize.iY = height; + } +*/ + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/bwins/glxmedialistsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/bwins/glxmedialistsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,126 @@ +EXPORTS + ?SetToFirst@TGlxSelectionIterator@@UAEXPBVMGlxMediaList@@@Z @ 1 NONAME ; void TGlxSelectionIterator::SetToFirst(class MGlxMediaList const *) + ??0TGlxExclusionIterator@@QAE@AAVMGlxMediaListIterator@@0@Z @ 2 NONAME ; TGlxExclusionIterator::TGlxExclusionIterator(class MGlxMediaListIterator &, class MGlxMediaListIterator &) + ?SetHighQualityOnly@CGlxThumbnailContext@@QAEXH@Z @ 3 NONAME ; void CGlxThumbnailContext::SetHighQualityOnly(int) + ??0TGlxFetchContextRemover@@QAE@PAVMGlxFetchContext@@AAVMGlxMediaList@@@Z @ 4 NONAME ; TGlxFetchContextRemover::TGlxFetchContextRemover(class MGlxFetchContext *, class MGlxMediaList &) + ?SetToFirst@TGlxExclusionIterator@@UAEXPBVMGlxMediaList@@@Z @ 5 NONAME ; void TGlxExclusionIterator::SetToFirst(class MGlxMediaList const *) + ?NewL@CGlxThumbnailContext@@SAPAV1@PAVMGlxMediaListIterator@@@Z @ 6 NONAME ; class CGlxThumbnailContext * CGlxThumbnailContext::NewL(class MGlxMediaListIterator *) + ??1CGlxListWindow@@UAE@XZ @ 7 NONAME ; CGlxListWindow::~CGlxListWindow(void) + ?SetDisabledIfMoreThanRangeSelected@TGlxSelectionIterator@@QAEXH@Z @ 8 NONAME ; void TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected(int) + ??0TGlxWindowIterator@@QAE@ABV0@@Z @ 9 NONAME ; TGlxWindowIterator::TGlxWindowIterator(class TGlxWindowIterator const &) + ?NewL@CGlxDefaultAttributeContext@@SAPAV1@XZ @ 10 NONAME ; class CGlxDefaultAttributeContext * CGlxDefaultAttributeContext::NewL(void) + ?SetRangeOffsets@TGlxFromFocusOutwardIterator@@QAEXHH@Z @ 11 NONAME ; void TGlxFromFocusOutwardIterator::SetRangeOffsets(int, int) + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 12 NONAME ; int TGlxMedia::GetSize(int &) const + ??ETGlxWindowIterator@@QAEHH@Z @ 13 NONAME ; int TGlxWindowIterator::operator++(int) + ?__DbgTestInvariant@CGlxListWindow@@QBEXXZ @ 14 NONAME ; void CGlxListWindow::__DbgTestInvariant(void) const + ?NewL@CGlxUStringConverter@@SAPAV1@XZ @ 15 NONAME ; class CGlxUStringConverter * CGlxUStringConverter::NewL(void) + ?InstanceL@MGlxCache@@SAPAV1@XZ @ 16 NONAME ; class MGlxCache * MGlxCache::InstanceL(void) + ?Reset@CGlxMedia@@QAEXXZ @ 17 NONAME ; void CGlxMedia::Reset(void) + ?AddObjects@CGlxListWindow@@QAEXHHHH@Z @ 18 NONAME ; void CGlxListWindow::AddObjects(int, int, int, int) + ??0CGlxThumbnailContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 19 NONAME ; CGlxThumbnailContext::CGlxThumbnailContext(class MGlxMediaListIterator *) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHHHH@Z @ 20 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int, int, int) + ??0TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 21 NONAME ; TGlxFromFocusOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator(void) + ?UnmarkAllL@MGlxMediaList@@SAXAAV1@@Z @ 22 NONAME ; void MGlxMediaList::UnmarkAllL(class MGlxMediaList &) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 23 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ??1TGlxSelectionIterator@@QAE@XZ @ 24 NONAME ; TGlxSelectionIterator::~TGlxSelectionIterator(void) + ?SetGranularity@CGlxAttributeContext@@QAEXI@Z @ 25 NONAME ; void CGlxAttributeContext::SetGranularity(unsigned int) + ??0TGlxSelectionIterator@@QAE@XZ @ 26 NONAME ; TGlxSelectionIterator::TGlxSelectionIterator(void) + ??0TGlxFromFocusOutwardIterator@@QAE@XZ @ 27 NONAME ; TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator(void) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 28 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ??1TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 29 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::~TGlxFromManualIndexOutwardBlockyIterator(void) + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 30 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ??0TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 31 NONAME ; TGlxFromManualIndexBlockyIterator::TGlxFromManualIndexBlockyIterator(void) + ?SetRangeOffsets@TGlxFromIndexOutwardBlockyIterator@@QAEXHH@Z @ 32 NONAME ; void TGlxFromIndexOutwardBlockyIterator::SetRangeOffsets(int, int) + ?SetFocusIndex@CGlxListWindow@@QAEXH@Z @ 33 NONAME ; void CGlxListWindow::SetFocusIndex(int) + ??1TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 34 NONAME ; TGlxFromFocusOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator(void) + ??1CGlxDefaultThumbnailContext@@UAE@XZ @ 35 NONAME ; CGlxDefaultThumbnailContext::~CGlxDefaultThumbnailContext(void) + ?IsFullThumbnail@GlxThumbnailUtility@@SAHABVTMPXAttribute@@@Z @ 36 NONAME ; int GlxThumbnailUtility::IsFullThumbnail(class TMPXAttribute const &) + ??0TGlxFromIndexOutwardBlockyIterator@@QAE@ABVMGlxIndex@0@@Z @ 37 NONAME ; TGlxFromIndexOutwardBlockyIterator::TGlxFromIndexOutwardBlockyIterator(class TGlxFromIndexOutwardBlockyIterator::MGlxIndex const &) + ?ConstructL@CGlxListWindow@@QAEXXZ @ 38 NONAME ; void CGlxListWindow::ConstructL(void) + ?SetRange@TGlxSequentialIterator@@QAEXH@Z @ 39 NONAME ; void TGlxSequentialIterator::SetRange(int) + ?ImageUri@CGlxImageViewerManager@@QAEPAVHBufC16@@XZ @ 40 NONAME ; class HBufC16 * CGlxImageViewerManager::ImageUri(void) + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 41 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?SetRangeOffsets@TGlxFromManualIndexBlockyIterator@@QAEXHH@Z @ 42 NONAME ; void TGlxFromManualIndexBlockyIterator::SetRangeOffsets(int, int) + ?SetIndex@TGlxFromManualIndexOutwardBlockyIterator@@QAEXH@Z @ 43 NONAME ; void TGlxFromManualIndexOutwardBlockyIterator::SetIndex(int) + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 44 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 45 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 46 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?SetRange@TGlxSelectionIterator@@QAEXH@Z @ 47 NONAME ; void TGlxSelectionIterator::SetRange(int) + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 48 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 49 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 50 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?IsPrivate@CGlxImageViewerManager@@QAEHXZ @ 51 NONAME ; int CGlxImageViewerManager::IsPrivate(void) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 52 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?IsStatic@TGlxMedia@@QBEHXZ @ 53 NONAME ; int TGlxMedia::IsStatic(void) const + ??0CGlxListWindow@@QAE@AAVMGlxWindowObjectFactory@@@Z @ 54 NONAME ; CGlxListWindow::CGlxListWindow(class MGlxWindowObjectFactory &) + ?AddSpecForItemL@CGlxThumbnailContext@@QAEXHHH@Z @ 55 NONAME ; void CGlxThumbnailContext::AddSpecForItemL(int, int, int) + ??1CGlxDefaultAttributeContext@@UAE@XZ @ 56 NONAME ; CGlxDefaultAttributeContext::~CGlxDefaultAttributeContext(void) + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 57 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ??1TGlxFirstThenLastIterator@@QAE@XZ @ 58 NONAME ; TGlxFirstThenLastIterator::~TGlxFirstThenLastIterator(void) + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 59 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ??ETGlxSelectionIterator@@UAEHH@Z @ 60 NONAME ; int TGlxSelectionIterator::operator++(int) + ?AddAttributeL@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 61 NONAME ; void CGlxAttributeContext::AddAttributeL(class TMPXAttribute const &) + ?SetRangeOffsets@CGlxDefaultThumbnailContext@@QAEXHH@Z @ 62 NONAME ; void CGlxDefaultThumbnailContext::SetRangeOffsets(int, int) + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 63 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 64 NONAME ; int TGlxMedia::GetDuration(float &) const + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 65 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?IncrementRefCount@CGlxImageViewerManager@@QAEXXZ @ 66 NONAME ; void CGlxImageViewerManager::IncrementRefCount(void) + ?InstanceL@MGlxMediaList@@SAPAV1@ABVCMPXCollectionPath@@ABV?$TGlxId@VTGlxIdHierarchyBase@@@@PAVCMPXMedia@@@Z @ 67 NONAME ; class MGlxMediaList * MGlxMediaList::InstanceL(class CMPXCollectionPath const &, class TGlxId const &, class CMPXMedia *) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 68 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?RemoveObjects@CGlxListWindow@@QAEXHHHH@Z @ 69 NONAME ; void CGlxListWindow::RemoveObjects(int, int, int, int) + ?Iterator@CGlxListWindow@@QBE?AVTGlxWindowIterator@@XZ @ 70 NONAME ; class TGlxWindowIterator CGlxListWindow::Iterator(void) const + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 71 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ??0CGlxAttributeContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 72 NONAME ; CGlxAttributeContext::CGlxAttributeContext(class MGlxMediaListIterator *) + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 73 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 74 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?AddObjects@CGlxListWindow@@QAEXHH@Z @ 75 NONAME ; void CGlxListWindow::AddObjects(int, int) + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 76 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@ABVTMPXAttribute@@@Z @ 77 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, class TMPXAttribute const &) + ??0TGlxSequentialIterator@@QAE@XZ @ 78 NONAME ; TGlxSequentialIterator::TGlxSequentialIterator(void) + ?AttributeCount@CGlxAttributeContext@@QAEHXZ @ 79 NONAME ; int CGlxAttributeContext::AttributeCount(void) + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 80 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?__DbgTestInvariant@CGlxNavigableList@@QBEXXZ @ 81 NONAME ; void CGlxNavigableList::__DbgTestInvariant(void) const + ?SetFocusIndex@CGlxListWindow@@QAEXHH@Z @ 82 NONAME ; void CGlxListWindow::SetFocusIndex(int, int) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 83 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 84 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 85 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 86 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 87 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ??1CGlxMedia@@UAE@XZ @ 88 NONAME ; CGlxMedia::~CGlxMedia(void) + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 89 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 90 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ??1CGlxThumbnailContext@@UAE@XZ @ 91 NONAME ; CGlxThumbnailContext::~CGlxThumbnailContext(void) + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 92 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 93 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?RemoveObjects@CGlxListWindow@@QAEXHH@Z @ 94 NONAME ; void CGlxListWindow::RemoveObjects(int, int) + ?Close@TGlxFetchContextRemover@@QAEXXZ @ 95 NONAME ; void TGlxFetchContextRemover::Close(void) + ?At@CGlxListWindow@@QBEPBVCBase@@H@Z @ 96 NONAME ; class CBase const * CGlxListWindow::At(int) const + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@H@Z @ 97 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, int) + ?At@CGlxListWindow@@QAEPAVCBase@@H@Z @ 98 NONAME ; class CBase * CGlxListWindow::At(int) + ??1TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 99 NONAME ; TGlxFromManualIndexBlockyIterator::~TGlxFromManualIndexBlockyIterator(void) + ?RemoveAttribute@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 100 NONAME ; void CGlxAttributeContext::RemoveAttribute(class TMPXAttribute const &) + ??1TGlxFromIndexOutwardBlockyIterator@@QAE@XZ @ 101 NONAME ; TGlxFromIndexOutwardBlockyIterator::~TGlxFromIndexOutwardBlockyIterator(void) + ?ClosestThumbnail@GlxThumbnailUtility@@SAHABVTSize@@ABVCGlxMedia@@H@Z @ 102 NONAME ; int GlxThumbnailUtility::ClosestThumbnail(class TSize const &, class CGlxMedia const &, int) + ??0TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 103 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::TGlxFromManualIndexOutwardBlockyIterator(void) + ?Cleanup@CGlxListWindow@@QAEXXZ @ 104 NONAME ; void CGlxListWindow::Cleanup(void) + ??1TGlxExclusionIterator@@QAE@XZ @ 105 NONAME ; TGlxExclusionIterator::~TGlxExclusionIterator(void) + ??1TGlxFetchContextRemover@@QAE@XZ @ 106 NONAME ; TGlxFetchContextRemover::~TGlxFetchContextRemover(void) + ?SetDefaultSpec@CGlxThumbnailContext@@QAEXHH@Z @ 107 NONAME ; void CGlxThumbnailContext::SetDefaultSpec(int, int) + ?ImageFileHandle@CGlxImageViewerManager@@QBEAAVRFile64@@XZ @ 108 NONAME ; class RFile64 & CGlxImageViewerManager::ImageFileHandle(void) const + ??0TGlxSpecificIdIterator@@QAE@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@VTGlxMediaId@@@Z @ 109 NONAME ; TGlxSpecificIdIterator::TGlxSpecificIdIterator(class TGlxId const &, class TGlxMediaId) + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 110 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 111 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHH@Z @ 112 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 113 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 114 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ??0TGlxFirstThenLastIterator@@QAE@XZ @ 115 NONAME ; TGlxFirstThenLastIterator::TGlxFirstThenLastIterator(void) + ??1CGlxAttributeContext@@UAE@XZ @ 116 NONAME ; CGlxAttributeContext::~CGlxAttributeContext(void) + ?SetRangeOffsets@CGlxDefaultAttributeContext@@QAEXHH@Z @ 117 NONAME ; void CGlxDefaultAttributeContext::SetRangeOffsets(int, int) + ?AsStringL@CGlxUStringConverter@@QBEXABVTGlxMedia@@ABVTMPXAttribute@@HAAPAVHBufC16@@@Z @ 118 NONAME ; void CGlxUStringConverter::AsStringL(class TGlxMedia const &, class TMPXAttribute const &, int, class HBufC16 * &) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 119 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 120 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?NewL@CGlxDefaultThumbnailContext@@SAPAV1@XZ @ 121 NONAME ; class CGlxDefaultThumbnailContext * CGlxDefaultThumbnailContext::NewL(void) + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 122 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ??1TGlxFromFocusOutwardIterator@@QAE@XZ @ 123 NONAME ; TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator(void) + ?InRange@TGlxSelectionIterator@@UBEHH@Z @ 124 NONAME ; int TGlxSelectionIterator::InRange(int) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/eabi/glxmedialistsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/eabi/glxmedialistsu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,195 @@ +EXPORTS + _ZN13MGlxMediaList10UnmarkAllLERS_ @ 1 NONAME + _ZN13MGlxMediaList9InstanceLERK18CMPXCollectionPathRK6TGlxIdI19TGlxIdHierarchyBaseEP9CMPXMedia @ 2 NONAME + _ZN14CGlxListWindow10AddObjectsEii @ 3 NONAME + _ZN14CGlxListWindow10AddObjectsEiiii @ 4 NONAME + _ZN14CGlxListWindow10ConstructLEv @ 5 NONAME + _ZN14CGlxListWindow13RemoveObjectsEii @ 6 NONAME + _ZN14CGlxListWindow13RemoveObjectsEiiii @ 7 NONAME + _ZN14CGlxListWindow13SetFocusIndexEi @ 8 NONAME + _ZN14CGlxListWindow13SetFocusIndexEii @ 9 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEii @ 10 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEiiii @ 11 NONAME + _ZN14CGlxListWindow2AtEi @ 12 NONAME + _ZN14CGlxListWindow7CleanupEv @ 13 NONAME + _ZN14CGlxListWindowC1ER23MGlxWindowObjectFactory @ 14 NONAME + _ZN14CGlxListWindowC2ER23MGlxWindowObjectFactory @ 15 NONAME + _ZN14CGlxListWindowD0Ev @ 16 NONAME + _ZN14CGlxListWindowD1Ev @ 17 NONAME + _ZN14CGlxListWindowD2Ev @ 18 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediaRK13TMPXAttribute @ 19 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediai @ 20 NONAME + _ZN18TGlxWindowIteratorC1ERKS_ @ 21 NONAME + _ZN18TGlxWindowIteratorC2ERKS_ @ 22 NONAME + _ZN18TGlxWindowIteratorppEi @ 23 NONAME + _ZN19GlxThumbnailUtility15IsFullThumbnailERK13TMPXAttribute @ 24 NONAME + _ZN19GlxThumbnailUtility16ClosestThumbnailERK5TSizeRK9CGlxMediai @ 25 NONAME + _ZN20CGlxAttributeContext13AddAttributeLERK13TMPXAttribute @ 26 NONAME + _ZN20CGlxAttributeContext14AttributeCountEv @ 27 NONAME + _ZN20CGlxAttributeContext14SetGranularityEj @ 28 NONAME + _ZN20CGlxAttributeContext15RemoveAttributeERK13TMPXAttribute @ 29 NONAME + _ZN20CGlxAttributeContextC1EP21MGlxMediaListIterator @ 30 NONAME + _ZN20CGlxAttributeContextC2EP21MGlxMediaListIterator @ 31 NONAME + _ZN20CGlxAttributeContextD0Ev @ 32 NONAME + _ZN20CGlxAttributeContextD1Ev @ 33 NONAME + _ZN20CGlxAttributeContextD2Ev @ 34 NONAME + _ZN20CGlxThumbnailContext14SetDefaultSpecEii @ 35 NONAME + _ZN20CGlxThumbnailContext15AddSpecForItemLEiii @ 36 NONAME + _ZN20CGlxThumbnailContext18SetHighQualityOnlyEi @ 37 NONAME + _ZN20CGlxThumbnailContext4NewLEP21MGlxMediaListIterator @ 38 NONAME + _ZN20CGlxThumbnailContextC1EP21MGlxMediaListIterator @ 39 NONAME + _ZN20CGlxThumbnailContextC2EP21MGlxMediaListIterator @ 40 NONAME + _ZN20CGlxThumbnailContextD0Ev @ 41 NONAME + _ZN20CGlxThumbnailContextD1Ev @ 42 NONAME + _ZN20CGlxThumbnailContextD2Ev @ 43 NONAME + _ZN20CGlxUStringConverter4NewLEv @ 44 NONAME + _ZN21TGlxExclusionIterator10SetToFirstEPK13MGlxMediaList @ 45 NONAME + _ZN21TGlxExclusionIteratorC1ER21MGlxMediaListIteratorS1_ @ 46 NONAME + _ZN21TGlxExclusionIteratorC2ER21MGlxMediaListIteratorS1_ @ 47 NONAME + _ZN21TGlxExclusionIteratorD1Ev @ 48 NONAME + _ZN21TGlxExclusionIteratorD2Ev @ 49 NONAME + _ZN21TGlxSelectionIterator10SetToFirstEPK13MGlxMediaList @ 50 NONAME + _ZN21TGlxSelectionIterator34SetDisabledIfMoreThanRangeSelectedEi @ 51 NONAME + _ZN21TGlxSelectionIterator8SetRangeEi @ 52 NONAME + _ZN21TGlxSelectionIteratorC1Ev @ 53 NONAME + _ZN21TGlxSelectionIteratorC2Ev @ 54 NONAME + _ZN21TGlxSelectionIteratorD1Ev @ 55 NONAME + _ZN21TGlxSelectionIteratorD2Ev @ 56 NONAME + _ZN21TGlxSelectionIteratorppEi @ 57 NONAME + _ZN22CGlxImageViewerManager8ImageUriEv @ 58 NONAME + _ZN22CGlxImageViewerManager9IsPrivateEv @ 59 NONAME + _ZN22TGlxSequentialIterator8SetRangeEi @ 60 NONAME + _ZN22TGlxSequentialIteratorC1Ev @ 61 NONAME + _ZN22TGlxSequentialIteratorC2Ev @ 62 NONAME + _ZN22TGlxSpecificIdIteratorC1ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 63 NONAME + _ZN22TGlxSpecificIdIteratorC2ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 64 NONAME + _ZN23TGlxFetchContextRemover5CloseEv @ 65 NONAME + _ZN23TGlxFetchContextRemoverC1EP16MGlxFetchContextR13MGlxMediaList @ 66 NONAME + _ZN23TGlxFetchContextRemoverC2EP16MGlxFetchContextR13MGlxMediaList @ 67 NONAME + _ZN23TGlxFetchContextRemoverD1Ev @ 68 NONAME + _ZN23TGlxFetchContextRemoverD2Ev @ 69 NONAME + _ZN25TGlxFirstThenLastIteratorC1Ev @ 70 NONAME + _ZN25TGlxFirstThenLastIteratorC2Ev @ 71 NONAME + _ZN25TGlxFirstThenLastIteratorD1Ev @ 72 NONAME + _ZN25TGlxFirstThenLastIteratorD2Ev @ 73 NONAME + _ZN27CGlxDefaultAttributeContext15SetRangeOffsetsEii @ 74 NONAME + _ZN27CGlxDefaultAttributeContext4NewLEv @ 75 NONAME + _ZN27CGlxDefaultAttributeContextD0Ev @ 76 NONAME + _ZN27CGlxDefaultAttributeContextD1Ev @ 77 NONAME + _ZN27CGlxDefaultAttributeContextD2Ev @ 78 NONAME + _ZN27CGlxDefaultThumbnailContext15SetRangeOffsetsEii @ 79 NONAME + _ZN27CGlxDefaultThumbnailContext4NewLEv @ 80 NONAME + _ZN27CGlxDefaultThumbnailContextD0Ev @ 81 NONAME + _ZN27CGlxDefaultThumbnailContextD1Ev @ 82 NONAME + _ZN27CGlxDefaultThumbnailContextD2Ev @ 83 NONAME + _ZN28TGlxFromFocusOutwardIterator15SetRangeOffsetsEii @ 84 NONAME + _ZN28TGlxFromFocusOutwardIteratorC1Ev @ 85 NONAME + _ZN28TGlxFromFocusOutwardIteratorC2Ev @ 86 NONAME + _ZN28TGlxFromFocusOutwardIteratorD1Ev @ 87 NONAME + _ZN28TGlxFromFocusOutwardIteratorD2Ev @ 88 NONAME + _ZN33TGlxFromManualIndexBlockyIterator15SetRangeOffsetsEii @ 89 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC1Ev @ 90 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC2Ev @ 91 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD1Ev @ 92 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD2Ev @ 93 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC1Ev @ 94 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC2Ev @ 95 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD1Ev @ 96 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD2Ev @ 97 NONAME + _ZN34TGlxFromIndexOutwardBlockyIterator15SetRangeOffsetsEii @ 98 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC1ERKNS_9MGlxIndexE @ 99 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC2ERKNS_9MGlxIndexE @ 100 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD1Ev @ 101 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD2Ev @ 102 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIterator8SetIndexEi @ 103 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC1Ev @ 104 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC2Ev @ 105 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD1Ev @ 106 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD2Ev @ 107 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 108 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 109 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 110 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 111 NONAME + _ZN9CGlxMedia5ResetEv @ 112 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 113 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 114 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 115 NONAME + _ZN9CGlxMediaD0Ev @ 116 NONAME + _ZN9CGlxMediaD1Ev @ 117 NONAME + _ZN9CGlxMediaD2Ev @ 118 NONAME + _ZN9MGlxCache9InstanceLEv @ 119 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 120 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 121 NONAME + _ZNK14CGlxListWindow2AtEi @ 122 NONAME + _ZNK14CGlxListWindow8IteratorEv @ 123 NONAME + _ZNK20CGlxUStringConverter9AsStringLERK9TGlxMediaRK13TMPXAttributeiRP7HBufC16 @ 124 NONAME + _ZNK21TGlxSelectionIterator7InRangeEi @ 125 NONAME + _ZNK22CGlxImageViewerManager15ImageFileHandleEv @ 126 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 127 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 128 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 129 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 130 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 131 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 132 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 133 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 134 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 135 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 136 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 137 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 138 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 139 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 140 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 141 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 142 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 143 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 144 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 145 NONAME + _ZNK9TGlxMedia3UriEv @ 146 NONAME + _ZNK9TGlxMedia5TitleEv @ 147 NONAME + _ZNK9TGlxMedia7CommentEv @ 148 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 149 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 150 NONAME + _ZNK9TGlxMedia8CategoryEv @ 151 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 152 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 153 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 154 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 155 NONAME + _ZTI13CGlxMediaList @ 156 NONAME + _ZTI14CGlxListWindow @ 157 NONAME + _ZTI15CGlxImageReader @ 158 NONAME + _ZTI16CGlxCacheManager @ 159 NONAME + _ZTI20CGlxAttributeContext @ 160 NONAME + _ZTI20CGlxGarbageCollector @ 161 NONAME + _ZTI20CGlxThumbnailContext @ 162 NONAME + _ZTI21TGlxExclusionIterator @ 163 NONAME + _ZTI21TGlxSelectionIterator @ 164 NONAME + _ZTI22TGlxSequentialIterator @ 165 NONAME + _ZTI22TGlxSpecificIdIterator @ 166 NONAME + _ZTI25TGlxFirstThenLastIterator @ 167 NONAME + _ZTI27CGlxDefaultAttributeContext @ 168 NONAME + _ZTI27CGlxDefaultThumbnailContext @ 169 NONAME + _ZTI28TGlxFromFocusOutwardIterator @ 170 NONAME + _ZTI33TGlxFromManualIndexBlockyIterator @ 171 NONAME + _ZTI34TGlxFromFocusOutwardBlockyIterator @ 172 NONAME + _ZTI34TGlxFromIndexOutwardBlockyIterator @ 173 NONAME + _ZTI40TGlxFromManualIndexOutwardBlockyIterator @ 174 NONAME + _ZTV13CGlxMediaList @ 175 NONAME + _ZTV14CGlxListWindow @ 176 NONAME + _ZTV15CGlxImageReader @ 177 NONAME + _ZTV16CGlxCacheManager @ 178 NONAME + _ZTV20CGlxAttributeContext @ 179 NONAME + _ZTV20CGlxGarbageCollector @ 180 NONAME + _ZTV20CGlxThumbnailContext @ 181 NONAME + _ZTV21TGlxExclusionIterator @ 182 NONAME + _ZTV21TGlxSelectionIterator @ 183 NONAME + _ZTV22TGlxSequentialIterator @ 184 NONAME + _ZTV22TGlxSpecificIdIterator @ 185 NONAME + _ZTV25TGlxFirstThenLastIterator @ 186 NONAME + _ZTV27CGlxDefaultAttributeContext @ 187 NONAME + _ZTV27CGlxDefaultThumbnailContext @ 188 NONAME + _ZTV28TGlxFromFocusOutwardIterator @ 189 NONAME + _ZTV33TGlxFromManualIndexBlockyIterator @ 190 NONAME + _ZTV34TGlxFromFocusOutwardBlockyIterator @ 191 NONAME + _ZTV34TGlxFromIndexOutwardBlockyIterator @ 192 NONAME + _ZTV40TGlxFromManualIndexOutwardBlockyIterator @ 193 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2008 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: Build information file for project glxmedialists.dll + * +*/ + + + + +PRJ_MMPFILES +glxmedialists.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/group/glxmedialists.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/group/glxmedialists.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project glxmedialists.dll +* +*/ + + + + +#include +#include + +#include "../../../group/glxbuildcommon.mmh" +#include "../../../inc/glxalfhelper.mmh" + +TARGET glxmedialists.dll +TARGETTYPE DLL +UID 0x1000008d 0x200009F0 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src + +SOURCE glxattributecontext.cpp +SOURCE glxcache.cpp +SOURCE glxcachemanager.cpp +SOURCE glxerrormanager.cpp +SOURCE glxfetchcontextremover.cpp +SOURCE glxfetcherror.cpp +SOURCE glxfetcherrorarray.cpp +SOURCE glxgarbagecollector.cpp +SOURCE glxitemlist.cpp +SOURCE glxlistutils.cpp +SOURCE glxlistwindow.cpp +SOURCE glxmedia.cpp +SOURCE glxustringconverter.cpp +SOURCE glxmedialist.cpp +SOURCE glxmedialistarray.cpp +SOURCE glxmedialistiterator.cpp +SOURCE glxnavigablelist.cpp +SOURCE glxstaticitemlist.cpp +SOURCE glxthumbnailcontext.cpp +SOURCE glxthumbnailutility.cpp +SOURCE mglxcache.cpp +SOURCE mglxmedialist.cpp +SOURCE glximagereader.cpp + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../common/inc +SYSTEMINCLUDE ../../../commonui/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../drmutility/inc +SYSTEMINCLUDE ../../inc // for GlxTvOut +SYSTEMINCLUDE ../../../gallery/inc + +APP_LAYER_SYSTEMINCLUDE + +// if you comment the lines below out, Photos dB will be used for thumbnail fetching +MACRO USE_S60_TNM +MACRO MEDIA_ID_BASED_TN_FETCH_ENABLED +#define USE_S60_TNM + +LIBRARY avkon.lib // CAknView +LIBRARY cone.lib // MCoeView +LIBRARY charconv.lib // CnvUtfConverter::ConvertFromUnicodeToUtf8L +LIBRARY commonengine.lib // String Loader +LIBRARY estor.lib // RBufWriteStream +LIBRARY euser.lib // RAllocator +LIBRARY eikctl.lib // for eik controls +LIBRARY fbscli.lib // CFbsBitmap +LIBRARY glxcommon.lib // CGlxSingetonStore +LIBRARY glxcommonui.lib // CGlxResolutionUtility +LIBRARY glxdrmutility.lib // CGlxDrmUtility +LIBRARY lbs.lib // TCoordinate +LIBRARY mpxcollectionutility.lib // MpxCollection Utility +LIBRARY mpxcommon.lib // Mpx Attributes +LIBRARY osncore.lib // CAlfString +LIBRARY libstdcpp.lib // STL code +LIBRARY flogger.lib +LIBRARY hal.lib // HAL +LIBRARY featmgr.lib // Feature Manager +LIBRARY efsrv.lib +LIBRARY apgrfx.lib // For ImageViewer mime type extraction +LIBRARY apmime.lib // For ImageViewer mime type extraction +LIBRARY imageconversion.lib // icl decoder +LIBRARY glximageviewermanager.lib +LIBRARY caf.lib +LIBRARY cafutils.lib +#ifdef USE_S60_TNM +LIBRARY thumbnailmanager.lib +LIBRARY bitgdi.lib +#endif + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxattributecontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxattributecontext.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2008-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: Generic fetch context to retrieve attributes +* +*/ + + + + +#ifndef C_GLXATTRIBUTECONTEXT_H +#define C_GLXATTRIBUTECONTEXT_H + +#include +#include "mglxfetchcontext.h" +#include "glxmedialistiterator.h" // for TGlxSequentialIterator + +// Forward declarations +class MGlxMediaList; +class TMPXAttribute; +class T_CGlxAttributeContext; // For E-unit only + +/** + * CGlxAttributeContext + * + * Fetch context to retrieve thumbnails + * + * @lib glxmedialists.lib + */ +class CGlxAttributeContext : public CBase, public MGlxFetchContext + { +public: + /** + * Constructor + * @param aIterator Iterator that determines the order of attribute + * retrieval and for which items attributes are and are not retrieved + */ + IMPORT_C CGlxAttributeContext(MGlxMediaListIterator* aIterator); + IMPORT_C ~CGlxAttributeContext(); + + /** + * Adds an attribute to be retrieved for all items + * @param aAttribute The attribute to be retrieved + */ + IMPORT_C void AddAttributeL(const TMPXAttribute& aAttribute); + + /** + * Removes an attribute from the "retrieval instructions" + * @param aAttribute The attribute to be removed + */ + IMPORT_C void RemoveAttribute(const TMPXAttribute& aAttribute); + + /** + * Returns the count of the attributes to be retrieved + * @return the count of the attribtues to be retrieved + */ + IMPORT_C TInt AttributeCount(); + + /** + * Sets granularity of the item index array returned from AttributeRequestL + */ + IMPORT_C void SetGranularity(TUint aGranularity); + +public: // From MGlxFetchContext + /// See @ref MGlxFetchContext::AttributeRequestL + TInt AttributeRequestL(const MGlxMediaList* aList, RArray& aItemIndices, + RArray& aAttributes, CMPXAttributeSpecs*& aDetailedSpecs) const; + + /// See @ref MGlxFetchContext::AllAttributesL + void AllAttributesL(const MGlxMediaList* aList, TInt aListIndex, + RArray& aAttributes) const; + + /// See @ref MGlxFetchContext::RequestCountL + TInt RequestCountL(const MGlxMediaList* aList) const; + +private: + /** + * Determine attributes to request for an item + * @param aIndexInList item index in media list + * @param aList media list + * @param aAttributes requested attributes + * @return ETrue if attributes to be requested, otherwise EFalse + */ + TBool AddItemAttributesL(TInt aIndexInList, const MGlxMediaList* aList, RArray& aAttributes, + TInt& aError, TBool aFirstItem) const; + + /** + * Append attribute to array, no duplicates + * @param aAttributes requested attributes + * @param aAttribute attribute to be added + */ + void AddItemAttributeL(RArray& aAttributes, const TMPXAttribute& aAttribute) const; + +private: + /** Attributes to be requested for all items */ + RArray iAttributes; + + /** + * Iterator for traversing the list + */ + MGlxMediaListIterator* iIterator; + + /** + * Granularity of the item index array returned from AttributeRequestL + */ + TUint iGranularity; + + /** Tester class */ + friend class T_CGlxAttributeContext; + }; + +/** + * CGlxDefaultAttributeContext + * + * Fetch context to retrieve MPX attributes starting from focus outward + * + * @lib glxmedialists.lib + */ +class CGlxDefaultAttributeContext : public CGlxAttributeContext + { +public: + IMPORT_C static CGlxDefaultAttributeContext* NewL(); + IMPORT_C ~CGlxDefaultAttributeContext(); + + /** + * Set the range offsets. These determine the outer limits + * of attributes to be retrieved, compared to current focus in + * the list + * If ranges not defined, retrieves the attributes for focused item only + */ + IMPORT_C void SetRangeOffsets(TInt aFrontOffset, TInt aRearOffset); + +private: + CGlxDefaultAttributeContext(); + +private: + TGlxFromFocusOutwardIterator iFromFocusIterator; + }; + +#endif // C_GLXATTRIBUTECONTEXT_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxcache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxcache.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2008-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: Cache implementation for media items sharing the same Id space +* +*/ + + + + +#ifndef C_GLXCACHE_H +#define C_GLXCACHE_H + +#include + +#include "glxmediaid.h" + +// Forward declarations +class CMPXMedia; +class CGlxMedia; +class T_CacheTestHelpers; +class TMPXAttribute; +class CGlxCacheManager; + +/** + * CGlxCache + * + * Individual cache of media items sharing the same Id space + */ +NONSHARABLE_CLASS( CGlxCache ) : public CBase + { +public: + /** + * Constructor + * @param aIdSpaceId The id of the id address space of this cache + * @param aCacheManager Instance of cachemanager to cleanup the media + */ + CGlxCache( const TGlxIdSpaceId& aIdSpaceId, CGlxCacheManager* aCacheManager ); + + /** + * Destructor + */ + ~CGlxCache(); + + /** + * Returns the Id space covered by this cache + * @return The Id space covered by this cache + */ + TGlxIdSpaceId IdSpaceId() const; + + /** + * Notify the cache that attributes have changed on media item(s) + * @param aMedia The updated media item or array of updated media items + */ + void MediaUpdatedL( const CMPXMedia& aMedia ); + + /** + * Update media item + * + * @param aMedia The updated media item + */ + void UpdateMediaL( const CMPXMedia& aMedia ); + + /** + * Cleanup the media of the given media id: broadcast this to all observers + * @param aMediaId The media id of the item + */ + void CleanupMedia(const TGlxMediaId& aMediaId); + + /** + * Handles modifications of item in cache + * + * @param aId Media item id + * @param aAttributes Attributes that have been modified + */ + void HandleItemModified( const TGlxMediaId& aId, const RArray& aAttributes ); + + /** + * Access to the items stored in the cache: return the item matching the given media Id + * @param aId The media Id + * @return The media item, or NULL if not found + */ + CGlxMedia* Media( const TGlxMediaId& aId ) const; + + /** + * Access to the items stored in the cache: return the item matching the given media Id. + * If not found, a new item is created + * @param aId The media Id + * @return The media item + */ + CGlxMedia* FindItemForceCreateL( const TGlxMediaId& aId ); + + /** + * Number of items in cache + * @return Number of items in cache + */ + TInt Count(); + + /** + * Cached item by index + * @param aIndex index of the item + * @return Cached item + */ + CGlxMedia& Media( TInt aIndex ); + + /** + * Delete an item at index from the cache. + * @param aIndex Index of the item to delete + */ + void Delete( TInt aIndex ); + + /** + * Reserve space for a number of users, for all items in the cache + * + * @param aCount The number of users to reserve space for + */ + void ReserveUsersL( TInt aCount ); + + /** + * Finds the media index present in cache + * @returns the index of media + */ + TInt FindMediaIndexInCache(TGlxMediaId aMediaId); + +private: + /** + * Copy the new and modified attributes from aSource to aTarget + * @param aTarget The target media item + * @param aSource The source media item + * @param aNewAttributes The new and modified attributes + */ + void CopyNewAndModifiedL( CGlxMedia& aTarget, const CMPXMedia& aSource, + RArray& aNewAttributes ); + + /** + * Function for TLinearOrder() for comparing two CGlxMedias + * Used from ordering the iItemPool by id + * @param aItem1 The first item to compare + * @param aItem2 The second item to compare + * @return -1 if aItem1 < aItem2; 1 if aItem1 > aItem2; 0 if aItem1 == aItem2 + */ + static TInt MediaItemOrderById( const CGlxMedia& aItem1, const CGlxMedia& aItem2 ); + + /** + * Function for comparing a TGlxMediaId with a CGlxMedia + * Used from ordering iItemPool by media id + * @param aMediaId The media id to compare against aItem2 + * @param aItem2 The second item to compare + * @return -1 if aMediaId < aItem2.Id(); 1 if aMediaId > aItem2.Id(); 0 if aMediaId == aItem2.Id() + */ + static TInt MediaItemOrderByKey( const TGlxMediaId* aMediaId, const CGlxMedia& aItem2 ); + + /** + * Create and add an item to the item pool + * @param aId Id for the new item + * @return Pointer to the created item + */ + CGlxMedia* CreateItemL( const TGlxMediaId& aId ); + +private: + /// Id space that this cache covers + TGlxIdSpaceId iIdSpaceId; + + /// Pool of media items. Owned + RPointerArray iItemPool; + + ///Instance of cacheManager to cleanup cache + CGlxCacheManager* iCacheManager; + + friend class T_CacheTestHelpers; + }; + +#endif // C_GLXCACHE_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxcachemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxcachemanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,391 @@ +/* +* Copyright (c) 2008-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: Manager of media item cache +* +*/ + + + + +#ifndef C_GLXCACHEMANAGER_H +#define C_GLXCACHEMANAGER_H + +#include + +#include "mglxcache.h" +#include "mglxcacheobserver.h" +#include "mglxmediapool.h" +#include "glximagereader.h" + +#include + +#ifdef USE_S60_TNM +#include +#include +#endif + +// Forward declarations +class CFbsBitmap; +class CGlxCache; +class CGlxGarbageCollector; +class CGlxMedia; +class CGlxMediaList; +class CMPXCollectionPath; +class CMPXMedia; +class MGlxMediaList; +class CGlxImageViewerManager; + +/** + * CGlxCacheManager + * + * Manager of item caches + * + * @lib glxmedialists.lib + */ +class CGlxCacheManager : public CBase, public MGlxCache, public MGlxMediaPool +#ifdef USE_S60_TNM +, public MThumbnailManagerObserver,public MImageReadyCallBack +#endif + { +public: + /** + * Return a reference-counted instance of CGlxCacheManager. User MUST Close() this when finished with it. + * @return Singleton cache manager object + */ + static CGlxCacheManager* InstanceL(); + + /** + * Called when a media item has new attributes + * @param aIdSpaceId Id space of media item + * @param aMedia The media object + * @param aError Error + */ + void HandleCollectionMediaL(const TGlxIdSpaceId& aIdSpaceId, const CMPXMedia& aMedia, TInt aError); + + /** + * Informs that focus in the window of the list has changed. The lists + * calls this function so that the manager knows to start updating the cache + * to load the now needed items. + * + * @param aList List that has changed + */ + void HandleWindowChangedL(CGlxMediaList* aList); + + /** + * Handles modification of item in a cache + * + * @param aIdSpaceId Id space of the cache containing the media item + * @param aMediaId Media item id + * @param aAttributes Attributes that have been modified + */ + void HandleItemModified(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aMediaId, const RArray& aAttributes); + + /** + * Returns the temporary thumbnail used in a thumbnail request + * @return The temporary thumbnail used in a thumbnail request + * @deprecated Temporary solution - waiting for global chunk solution + */ + CFbsBitmap* TempThumbnail(); + + /** + * The Id of the temporary thumbnail used in a thumbnail request + * @return The Id of the temporary thumbnail used in a thumbnail request + * @deprecated Temporary solution - waiting for global chunk solution + */ + TGlxMediaId TempThumbnailId(); + + /** + * Sets the temporary thumbnail to NULL. Thumbnail is not deleted, use when ownership has transfered to + * another object + * @deprecated Temporary solution - waiting for global chunk solution + */ + void SetTempThumbnailToNull(); + + /** + * New attributes are available for a media item: broadcast this to all observers + * @param aIdSpaceId The Id Space of the item + * @param aMediaId The media id of the item + * @param aAttributes The new attributes + * @param aMedia The media item + */ + void BroadcastAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId, + const RArray& aAttributes, + const CGlxMedia* aMedia); + + /** + * Cleanup the media of the given media id: broadcast this to all observers + * @param aMediaId The media id of the item + */ + void CleanupMedia(const TGlxMediaId& aMediaId); + + /** + * Returns an array of all id-space caches currently in use. + * @return Array of all id-space caches currently in use. + */ + const RPointerArray& Caches(); + + /** + * Sets the temporary error flag. When set, this indicates that there is at least one temporary + * error on an item in the cache. + */ + void SetTemporaryErrorFlag(); + + /** + * Informs that a media list has been deleted. The lists + * calls this function so that the manager can check to + * see if the last request was from this list. If so, it + * should reset and continue with requests from other lists + * + * @param aList List that has been deleted + */ + void HandleListDeleted(CGlxMediaList* aList); + + /** + * Inform cache manager to reserve space for a number of users + * for all items in a particular cache + * + * @param aIdSpaceId The Id space Id to determine which cache to reserve users + * @param aCount The number of users to reserve space for + */ + void ReserveUsersL(const TGlxIdSpaceId& aIdSpaceId, TInt aCount); + + /** + * Check if the media item selected is NULL. + * If media item is NULL, cancel the pending requests + * and place a new request + */ + void CancelPreviousRequest(); + +public: // From MGlxCache + CGlxMedia* Media( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId ) const; + void AddObserverL( MGlxCacheObserver* aObserver ); + void RemoveObserver( MGlxCacheObserver* aObserver ); + void RefreshL(); + void Close(); + //OOM + void ReleaseRAML(TBool aFlushOnRequest = EFalse); + void StopRAMReleaseL(); + //OOM + void ForceCleanupMedia(TGlxIdSpaceId aSpaceId,TGlxMediaId aId); + TBool HasDRMRightsL(TDesC& aFileName); +public: + void ImageReadyL(const TInt& aError, const TSize aSz); +private: + /** + * Constructor + */ + CGlxCacheManager(); + + /** + * All Garbage Clean-up,Cancel Garbage Cleanup is Centralised Here + * It can be used to Cancel Garbage if there is Enough Memory Else it starts Flushing 30 items Together, + * It can be used to start Garbage Clean-up if there is Not Enough Memory + * + * @param aStart + */ + void HandleGarbageCollectionL(TBool aStart); + + /** + * Two-phase construction + */ + static CGlxCacheManager* NewL(); + + /** + * Second-phase constructor + */ + void ConstructL(); + + /** + * Destructor + */ + virtual ~CGlxCacheManager(); + + /** + * Deletes unused items in all id-space caches, requests new attributes + */ + void MaintainCacheL(); + static TInt MaintainCacheL(TAny* aPtr); + + /** + * Compares two paths to see if their levels match + */ + static TBool Match(const CMPXCollectionPath& aPath1, const CMPXCollectionPath& aPath2); + + /** + * Returns the cache for the given id space. Create one if it doesn't exist. + * @param aIdSpaceId The id space + * @return The cache for the id space + */ + CGlxCache* FindCacheForceCreateL(const TGlxIdSpaceId& aIdSpaceId); + + /** + * Finds a media item based on id-space and media id. Creates one if none found + * @param aIdSpaceId The id space of the media item + * @param aMediaId The id of the media item + * @return The media item + */ + CGlxMedia* MediaForceCreateL(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aMediaId); + + /** + * Function for TLinearOrder() for comparing two CGlxCaches + * Used from ordering iCaches by id-space id + * @param aItem1 The first item to compare + * @param aItem2 The second item to compare + * @return -1 if aItem1 < aItem2; 1 if aItem1 > aItem2; 0 if aItem1 == aItem2 + */ + static TInt CacheOrderById(const CGlxCache& aItem1, const CGlxCache& aItem2); + + /** + * Function for comparing a TGlxIdSpaceId with a CGlxCache + * Used from ordering iCaches by id-space id + * @param aIdSpaceId The id space id to compare against aItem2 + * @param aItem2 The second item to compare + * @return -1 if aIdSpaceId < aItem2.Id(); 1 if aIdSpaceId > aItem2.Id(); 0 if aIdSpaceId == aItem2.Id() + */ + static TInt CacheOrderByKey(const TGlxIdSpaceId* aIdSpaceId, const CGlxCache& aItem2); + + /** + * Returns whether any requests are being made on errored attributes + * @return Whether any requests are being made on errored attributes + */ + TBool ErrorsOnRequestedItemsL(); + + /** + * Timer callback for temporary error reminder + * @param aPtr Pointer to object that started the timer + * @return 0 to signal that further callbacks are unnecessary, 1 otherwise + */ + static TInt TempErrorTimerCallbackL(TAny* aPtr); + + /** + * Starts the temporary error timer. When complete, the caches are checked again for any missing attributes + */ + void StartTempErrorTimer(); + + /** + * Called when the temporary error timer completes: forces a re-examination of all caches + */ + void TempErrorTimerCompleteL(); + + /** + * Create a path with the request items + * + * @param aList list to obtain the path + */ + CMPXCollectionPath* RequestAsPathLC(const CGlxMediaList& aList); + + void GetMimeType(TFileName& aFileName, TDataType& aMimeType ); +#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); + +private: // From MThumbnailManagerObserver + + void ThumbnailPreviewReady( MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); + void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); + + TInt FindLoadingById(TThumbnailRequestId aId, TBool aRemove = EFalse); +#endif + +private: + /// Single instance of the cache manager + static CGlxCacheManager* iCacheManager; + + /// Current reference count + TInt iReferenceCount; + + /// List of observers, not owned + RPointerArray iObserverList; + + /// Caches, one per Id space. Owned. + RPointerArray iCaches; + + /// Bitmap for pending thumbnail request + CFbsBitmap* iTempThumbnail; + /// ID of item whose thumbnail was requested + TGlxMediaId iThumbnailId; + + /// Information if a request has been made to collection which + /// has not complete yet. (Currently, only one request is made at a time) + /// Stores the media list that owns the request + CGlxMediaList* iRequestOwner; + + /// The requested Ids in the current request + RArray iRequestedItemIds; + /// The requested attributes in the current request + RArray iRequestedAttrs; + /// The Id Space of the items in the current request + TGlxIdSpaceId iRequestedItemsIdSpace; + + /// Garbage collector + CGlxGarbageCollector* iGarbageCollector; + + /// Temporary error flag + TBool iTempError; + + // Clean up is On Going- Timer Started Or it is Cleaning Up + TBool iCleanUpOnGoing; + + /// Temporary error timer + CPeriodic* iTempErrorTimer; + + CAsyncCallBack* iMaintainCacheCallback; + + RArray iRequestedItemIndexes; + CGlxImageReader* iReader; + TSize iImgSz; + /** + * Active scheduler wait object. (Owned) + */ + CActiveSchedulerWait* iSchedulerWait; + // For image viewer, not own + CGlxImageViewerManager* iImageViewerInstance; +#ifdef USE_S60_TNM + CThumbnailManager* iTnEngine; // Own + CMPXMedia* iMPXMedia; + + // Loading information + class TLoadingTN + { + public: + TLoadingTN(TThumbnailRequestId aId, TGlxIdSpaceId aSpaceId, + TSize aSize, TGlxMediaId aThumbnailId) + : iId(aId), iSpaceId(aSpaceId), + iSize(aSize), iThumbnailId(aThumbnailId) + { + } + + TThumbnailRequestId iId; + TGlxIdSpaceId iSpaceId; + TSize iSize; + TGlxMediaId iThumbnailId; + }; + + RArray iThumbnailRequestIds; +#endif + +#ifdef _DEBUG + TTime iStartTime; + TTime iStopTime; +#endif + }; + +#endif // C_GLXCACHEMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxerrormanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxerrormanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2008-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: Utility class to manage attribute retrieval errors +* +*/ + + + +#ifndef _GLXERRORMANAGER_H +#define _GLXERRORMANAGER_H + +#include +#include "glxfetcherror.h" + +// Forward declaration +class CGlxMedia; + +/// How long temporary errors remain valid for until they can be checked again +/// @todo Find optimal value for this +const TInt KGlxTemporaryErrorValidityPeriodInSeconds = 30; + +/** + * GlxErrorManager + * + * Utility class for handling the error attribute that may be attached to items + * + * @lib glxmedialists.lib + */ +class GlxErrorManager + { +public: + /** + * Check whether an error has been recorded against the given attribute + * @param aItem The item to check + * @param aAttribute The attribute to check + * @return The error associated with the attribute; KErrNone if none + */ + IMPORT_C static TInt HasAttributeErrorL(const CGlxMedia* aItem, const TMPXAttribute& aAttribute); + + /** + * Check whether an error has been recorded against the given attribute + * @param aItem The item to check + * @param aContentId The content id for attribute to check + * @return The error associated with the attribute; KErrNone if none + */ + IMPORT_C static TInt HasAttributeErrorL(const CGlxMedia* aItem, TInt aContentId); + + /** + * Heuristic to determine whether errors may exist within an item. + * @return EFalse, if there are no errors; ETrue if there might be errors (includes possibly expired errors) + */ + static TBool HasError(const CGlxMedia* aItem); + + /** + * Sets error values for the given attributes + * @param aItem The item to add the errors to + * @param aAttributes The attributes affected + * @param aError The error code to set against the attributes + */ + static void SetAttributeErrorL(CGlxMedia* aItem, const RArray& aAttributes, TInt aError); + + /** + * Performs some maintainance on the error attribute of an item. + * - Removes any expired temporary errors + * - Removes any errors for attributes that don't occur in aAttributesInUse + * @param aMedia Media object to clean + * @param aAttributesInUse Superset of all attributes that the item may hold. + */ + static void ClearExpiredAndUnusedErrorsL( CGlxMedia& aMedia, + const RArray& aAttributesInUse ); + + /** + * @return the attribute used to store the error list + */ + static TMPXAttribute ErrorAttribute(); + +private: + /** + * Check whether a given error code is classed as "temporary" + * @param aError Error code to check + * @return ETrue iff aError is temporary + */ + static TBool IsTemporaryError(TInt aError); + + /** + * Given an error, check if it has expired. + * @param aError The error to check + * @return Whether the error has expired + */ + static TBool IsExpired( const TGlxFetchError& aError ); + }; + +#endif // _GLXERRORMANAGER_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxfetchcontextremover.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxfetchcontextremover.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2008-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: Class for removing a fetch context from a list +* +*/ + + + + +#ifndef T_GLXFETCHCONTEXTREMOVER_H +#define T_GLXFETCHCONTEXTREMOVER_H + +#include + +// Forward declarations +class MGlxFetchContext; +class MGlxMediaList; + +/** + * Class that removes the given fetch context from a media list when goes out + * of scope. Use this to avoid trap, and to achieve safe cleanup, when a fetch + * context is created and used within a function. + * + * Note: the media list must not have been deleted when the destructor of this + * class is called. + * + */ +class TGlxFetchContextRemover + { +public: + /** + * Constructor + * @param aContext the context to remove upon destruction + * @param aMediaList List from which to remove the context + */ + IMPORT_C TGlxFetchContextRemover(MGlxFetchContext* aContext, MGlxMediaList& aMediaList); + /** + * Destructor + */ + IMPORT_C ~TGlxFetchContextRemover(); + + /** + * Remove the context from the list + */ + IMPORT_C void Close(); + +private: + /// Context that needs to be removed upon destruction + MGlxFetchContext* iContext; + + /// Media list from which to remove the context from + MGlxMediaList& iMediaList; + }; + +#endif // T_GLXFETCHCONTEXTREMOVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxfetcherror.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxfetcherror.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008-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: Record for an attribute retrieval error +* +*/ + + + + +#ifndef T_GLXFETCHERROR_H +#define T_GLXFETCHERROR_H + +#include +#include + +/** + * TGlxFetchError + * + * Contains information about an attribute retrieval error + * + * @lib glxmedialists.lib + */ +class TGlxFetchError + { +public: + /** + * Constructor. Timestamp is set to current universal time. + * @param aAttr The attribute with the error + * @param aError The error code to record + */ + TGlxFetchError(TMPXAttribute aAttr, TInt aError); + +public: + /// The errored attribute + TMPXAttribute iAttr; + /// The error code + TInt iError; + /// Timestamp of when the error was recorded + TDateTime iTimestamp; + }; + +#endif // T_GLXFETCHERROR_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxfetcherrorarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxfetcherrorarray.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2008-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: Array of attribute retrieval errors +* +*/ + + + + +#ifndef C_GLXFETCHERROR_H +#define C_GLXFETCHERROR_H + +#include +#include "glxfetcherror.h" + +/** + * CGlxFetchErrorArray + * + * Ordered array of attribute retrieval errors + * @see TGlxFetchError + * + * @lib glxmedialists.lib + */ +NONSHARABLE_CLASS(CGlxFetchErrorArray) : public CBase + { +public: + /** + * Constructor + */ + CGlxFetchErrorArray(); + + /** + * Two-phase copy constructor + * @param aErrorArray The existing CGlxFetchErrorArray to copy + */ + static CGlxFetchErrorArray* NewL(const CGlxFetchErrorArray* aErrorArray); + + /** + * Two-phase copy constructor + * @param aErrorArray The existing CGlxFetchErrorArray to copy + */ + static CGlxFetchErrorArray* NewLC(const CGlxFetchErrorArray* aErrorArray); + + /** + * Destructor + */ + ~CGlxFetchErrorArray(); + + /** + * Number of errors stored in array + * @return Number of errors stored in array + */ + TInt ErrorCount() const; + + /** + * The error at a particular index + * @param aIndex The index for the error + * @return The error + */ + TGlxFetchError Error(TInt aIndex) const; + + /** + * Add an error to the array + * @param aError Error to add + */ + void AddErrorL(TGlxFetchError aError); + + /** + * Remove an error from the array + * @param aIndex index of the error to remove + */ + void Remove( TInt aIndex ); + + /** + * Find an error given the attribute + * @param aAttr The attribute to look for + * @return The error code, or KErrNone if none + */ + TInt FindError(TMPXAttribute aAttr) const; + + /** + * Find an error given the content id + * @param aContentId The content id to look for + * @return The error code, or KErrNone if none + */ + TInt FindError(TInt aContentId) const; + +private: + /** + * Second-phase copy constructor + * @param aErrorArray The existing CGlxFetchErrorArray to copy + */ + void CopyConstructL(const CGlxFetchErrorArray* aErrorArray); + + /** + * Ordering function for array + * @see TLinearOrder + */ + static TInt ErrorOrderByKey(const TMPXAttribute* aAttr, const TGlxFetchError& aItem2); + + /** + * Ordering function for array + * @see TLinearOrder + */ + static TInt ErrorOrderById(const TGlxFetchError& aItem1, const TGlxFetchError& aItem2); + +private: + /// Ordered array of errors + RArray iFetchErrors; + }; + +#endif // C_GLXFETCHERROR_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxgarbagecollector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxgarbagecollector.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2008-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: Garbage collector +* +*/ + + + + + +#ifndef C_GLXGARBAGECOLLECTOR_H +#define C_GLXGARBAGECOLLECTOR_H + +#include + + +class CGlxMedia; +class CGlxCache; +class T_CGlxGarbageCollector; +class TMPXAttribute; +/** + * CGlxGarbageCollector + * + * Garbage collector for the media item cache + * + * @lib glxmedialists.lib + */ +class CGlxGarbageCollector : public CBase + { +public: + /** + * Two-phase constructor + * @return new garbage collector instance + */ + static CGlxGarbageCollector* NewL( const RPointerArray& aCaches ); + + /** + * Destructor + */ + ~CGlxGarbageCollector(); + + /** + * Start background garbage collection + */ + void CleanupL(); + + /** + * Cancel background garbage collection + */ + void CancelCleanup(); + + /** + * Flush Some Pages As System Reach Low Memory Limit + * pointer to be used + */ + void FlushPagesL(TInt aCount); + +private: + /** + * Constructor + */ + CGlxGarbageCollector( const RPointerArray& aCaches ); + + /** + * Second-phase constructor + */ + void ConstructL(); + + /** + * Callback for periodic timer + * @see TCallBack + */ + static TInt PeriodicCallbackL( TAny* aPtr ); + + /** + * Callback for periodic timer, non-static, and hence allows this + * pointer to be used + */ + void PeriodicCallbackL(); + + /** + * Perform garbage collection on all caches + * Only cleans up only a certain number of items each call, to avoid + * this call taking a very long time, as this will be called + * from the periodic timer callback + * @param aCount + * @return ETrue if reached the end of caches; EFalse if not + */ + TBool CleanupCaches(TInt aCount = 1); + + /** + * Perform garbage collection on specified cache + * Only cleans up only aRemainingScanCount amount of items. + * @param aRemainingScanCount maximum number of items to scan + * @return the remaining scan count + */ + TInt CleanupCache( CGlxCache& aCache, TInt aRemainingScanCount ); + + /** + * Clean a particular media object: remove attributes that no fetch contexts want + */ + void CleanupMediaL( CGlxCache& aCache, CGlxMedia& aMedia ); + + /** + * Get a list of all attributes that should not be deleted form a given + * media object + * @param aMedia Media object for which attributes are required + * @return aNeededAttributes list of attributes that should not be + * deleted + */ + void GetAttributesInUseL( const CGlxMedia& aMedia, + RArray& aNeededAttributes ) const; + + /** + * Delete attributes from a media object other than those specified + * Removes the fullscreen texture if the fullscreen thumbnail att is deleted + * @param aMedia Media object from which to delete attributes + * @return aAttributesToKeep List of attributes that will not be deleted + */ + void DeleteOtherAttributes( CGlxCache& aCache, CGlxMedia& aMedia, + const RArray& aAttributesToKeep ) const; + + /** + * Check user count in remaining caches for media item to be deleted + * @param aMedia Media id which is to be checked + * @return EFalse if user count is zero in all caches + * ETrue if user count is non zero in any of the caches + */ + TBool MediaInUse(const CGlxMedia& aMedia) const; +private: + /** + * Abstraction of indexes that control the scanning of the cache across idle + * callbacks + */ + struct TScanIndexes + { + /// Index of the cache index that is currently being cleaned up + TInt iCurrentCacheIndex; + /// Index of the media index in the current cache that should next be cleaned up + TInt iNextMediaIndexToCleanup; + }; + +private: // Data + /// Single instance of the garbage collector + static CGlxGarbageCollector* iGarbageCollector; + + /// A list of caches that should be kept clean + /// not own (pointed cache objects) + const RPointerArray& iCaches; + + // A list of attributes that are still in use by an item + RArray iAttributesInUse; + + /// Periodic timer active object to use for callbacks + /// own + CPeriodic* iPeriodic; + + /// Scan indexes of the current scanning position in the caches + TScanIndexes iScanningPosition; + + /// Info of whether a full cleanup round should be performed to have all + /// garbage freed from all caches. + /// ETrue if cleanup should be run from the start before fully cleaned + /// EFalse if the caches are clean currently or after the current cleanup + /// round completes. + TBool iRequiresFullCleanupRound; + + friend class T_CGlxGarbageCollector; + }; + +#endif // C_GLXGARBAGECOLLECTOR_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glximagereader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glximagereader.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2008-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: imagereader header file +* +*/ + + +#ifndef GLXIMAGEREADER_H_ +#define GLXIMAGEREADER_H_ + +#include +#include "glximageviewermanager.h" +class CFbsBitmap; + + +class MImageReadyCallBack + { +public: + virtual void ImageReadyL(const TInt& aError, const TSize aSz) = 0; + }; + + +class CGlxImageReader : public CActive + { + +private: + static CGlxImageReader* NewLC(MImageReadyCallBack& aNotify); + CGlxImageReader(MImageReadyCallBack& aNotify); + void ConstructL(); + + void GetFileTypeL(TDataType aMimeType); + +protected: + void DoCancel(); + void RunL(); + +public: + static CGlxImageReader* NewL(MImageReadyCallBack& aNotify); + ~CGlxImageReader(); + TBool HasDRMRightsL(); + +private: + MImageReadyCallBack& iNotify; + CImageDecoder* iImageDecoder; + CFbsBitmap* iFrame; + TBool iIsLaunchedFromFMngr; + CGlxImageViewerManager* iImgViewerMgr; + }; + +#endif /* GLXIMAGEREADER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxitemlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxitemlist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +#ifndef __C_GLXITEMLIST_H__ +#define __C_GLXITEMLIST_H__ + +#include +#include "glxmedia.h" + +// Forward declarations +class CMPXCollectionPath; +class MGlxItemListObserver; +class MGlxMediaUser; +class MGlxMediaPool; + +namespace NGlxItemList + { + class MListModificationStrategy; + class TDifferenceInfo; + } + +/** + * CGlxItemList + * + * List that has media items + * + * @author Aki Vanhatalo + * + * @internal reviewed 17/07/2007 by Kimmo Hoikka + * + * @ingroup mlm_media_list_manager_design + */ +NONSHARABLE_CLASS( CGlxItemList ) : public CBase + { +public: + /** + * Constructor + * @param aIdSpaceId id of id space in which list item ids are + * @param aObserver Observer to be notified of item addition/removal + * @param aMediaUser User class of media objects - media objects that + * this list links to will be linked to the user, so that + * cache manager is able to quickly access the media lists + * that use particular media objects + */ + static CGlxItemList* NewL( const TGlxIdSpaceId& aIdSpaceId, + MGlxItemListObserver& aObserver, MGlxMediaUser& aMediaUser ); + + /** + * Destructor + */ + ~CGlxItemList(); + + /** + * @return id space id + */ + inline const TGlxIdSpaceId& IdSpaceId() const; + + /** + * Synchronises the list with new path + * Sends added/removed notifications as necessary + * Note: Does not send "perfect" notification if the order of the items + * has been changed. Hence, this function cannot be reliably used when + * sort order has changed + * + * @param aSource path with item ids. + * @param aMediaPool interface from which to ask for media items + */ + void SetContentsL( const CMPXCollectionPath& aSource, const MGlxMediaPool& aMediaPool ); + + /** + * Remove an item form the list + * Sends removed notification + * + * @param aItemId Id of item to remove + * @param aIdSpaceId Id space of the item + */ + void Remove( const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aItemId ); + + /** + * Remove any pointers to the media object at the specified index + * @param aIndex index of media object from which to remove a reference + */ + void RemoveReference( TInt aIndex ); + + /** + * @return count of items in the list + */ + inline TInt Count() const; + + /** + * @return item at index + */ + inline TGlxMedia& Item( TInt aIndex ); + + /** + * @param aId Id of item for which index is needed + * @return index of item with id aId or KErrNotFound + */ + TInt Index( const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId ) const; + +private: + /** + * Constructor + * @param aIdSpaceId id of id space in which list item ids are + * @param aObserver Observer to be notified + * @param aMediaUser User class of media objects - media objects that + * this list links to will be linked to the user, so that + * cache manager is able to quickly access the media lists + * that use particular media objects + */ + CGlxItemList( const TGlxIdSpaceId& aIdSpaceId, + MGlxItemListObserver& aObserver, MGlxMediaUser& aMediaUser ); + + /** + * Process differences between source and current list + * @param aSource source list + * @param aStrategy strategy object that contains the logic of how to + * process the differences that are found + */ + void ProcessDifferences( const CMPXCollectionPath& aSource, + NGlxItemList::MListModificationStrategy& aStrategy ); + + /** + * Find the first matches in the source and current lists. + * @param aInfo object that contains start-search-from indexes in source + * and current list + * @param aSource source list + * @param aSourceMatchIndex On return, contains the index of matching + * source item, or if not found, the count of + * source list. (Returning count simplifies + * client functions algorithm) + * @param aTargetMatchIndex On return, contains the index of matching + * target item, or if not found, the count of + * target (current) list. (Returning count + * simplifies client functions algorithm) + */ + void FindMatchingItems( const NGlxItemList::TDifferenceInfo& aInfo, + const CMPXCollectionPath& aSource, TInt& aSourceMatchIndex, + TInt& aTargetMatchIndex ); + + /** + * Process difference that would require removing items to eliminate. + * Forwards the actual "remove" request to the modification strategy + * @param aTargetMatchIndex Index until which items need to be removed + * @param aInfo Info of indexes needed to remove the items. + * Strategy can modify these indexes + * @param aStrategy strategy object that contains the logic of how to + * process the differences that are found + */ + void ProcessRemove( TInt aTargetMatchIndex, NGlxItemList::TDifferenceInfo& aInfo, + NGlxItemList::MListModificationStrategy& aStrategy ); + + /** + * Process difference that would require inserting items to eliminate. + * Forwards the actual "insert" request to the modification strategy + * @param aSourceMatchIndex Index to which items need to be copies + * @param aInfo Info of indexes needed to insert the items. + * Strategy can modify these indexes + * @param aStrategy strategy object that contains the logic of how to + * process the differences that are found + */ + void ProcessInsert( TInt aSourceMatchIndex, NGlxItemList::TDifferenceInfo& aInfo, + NGlxItemList::MListModificationStrategy& aStrategy ); + + /** + * @return item at index, non-const + */ + inline TGlxMedia& operator[] ( TInt aIndex ); + +private: + /// Media items in this list + RArray< TGlxMedia > iItems; + + /// The id of the "space" of unique item ids + TGlxIdSpaceId iIdSpaceId; + + /// User of media objects. Used for building a link from media object + /// (CGlxMedia) to its used when building a link from item (TGlxMedia) + /// to media object + MGlxMediaUser& iMediaUser; + + /// Observer for changes + MGlxItemListObserver& iObserver; + + __DECLARE_TEST; + }; + +#include "glxitemlist.inl" + +#endif // __C_GLXITEMLIST_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxitemlist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxitemlist.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +#ifndef __C_GLXITEMLIST_INL__ +#define __C_GLXITEMLIST_INL__ + +// ----------------------------------------------------------------------------- +// Return id space id +// ----------------------------------------------------------------------------- +// +inline const TGlxIdSpaceId& CGlxItemList::IdSpaceId() const + { + return iIdSpaceId; + } + +// ----------------------------------------------------------------------------- +// Return count +// ----------------------------------------------------------------------------- +// +inline TInt CGlxItemList::Count() const + { + return iItems.Count(); + } + +// ----------------------------------------------------------------------------- +// Return item by index +// ----------------------------------------------------------------------------- +// +inline TGlxMedia& CGlxItemList::Item( TInt aIndex ) + { + return iItems[ aIndex ]; + } + +// ----------------------------------------------------------------------------- +// Return item by index +// ----------------------------------------------------------------------------- +// +TGlxMedia& CGlxItemList::operator[]( TInt aIndex ) + { + return iItems[ aIndex ]; + } + +#endif // __C_GLXITEMLIST_INL__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxlistutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxlistutils.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-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: List utilities +* +*/ + + + + +#ifndef __GLXLISTUTILS_H__ +#define __GLXLISTUTILS_H__ + +#include + +// constants +const TUint KGlxDefaultVisibleItemsGranularity = 15; +const TUint KGlxQHDVisibleItemsGranularity = 20; +const TUint KGlxVGAVisibleItemsGranularity = 21; + +/** + * GlxListUtils + * + * @author Aki Vanhatalo + * + * @internal reviewed 16/07/2007 by Kimmo Hoikka + */ +class GlxListUtils + { +public: + /** + * Normalises index in a loop into the range. If aIndex is outside the + * list indexes (i.e., 0 and list size), this function "loops the list" + * to return the correct index normalised to inside the list. + * This function must not be called if the list is empty. + * @param aIndex Index to normalise + * @param aListLength Length of the list + */ + static TInt NormalizedIndex( TInt aIndex, TInt aListLength ); + + /** + * Returns Visible items granularity based on feature + * layout (i.e., qHD, VGA) + * @return TInt visible items granularity / count + */ + static TInt VisibleItemsGranularityL(); + }; + +#endif // __GLXLISTUTILS_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxlistwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxlistwindow.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,252 @@ +/* +* Copyright (c) 2008-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: Window to a list of objects +* +*/ + + + + +#ifndef C_GLXLISTWINDOW_H +#define C_GLXLISTWINDOW_H + +#include + + +/** + * Interface to get, setup and cleanup objects that go into a list window + * Not strictly a factory, as also handles cleanup + */ +class MGlxWindowObjectFactory + { +public: + /** + * Creates an object that the list window will contain + * (not called NewObjectL since signature would be too similar to CGlxListWindowBase::NewObjectL) + * @return an object to be put into the window + */ + virtual CBase* CreateObjectL() const = 0; + + /** + * Makes the object at the index ready for use + * This is called when the object is added to the window + */ + virtual void SetupObject( TInt aListIndex, CBase& aObject ) = 0; + + /** + * Makes the object at the index ready for removal + * If your object builds links from other objects to it, use this + * function to remove those links. The object will be removed from + * the window after this function returns, and may be deleted or reused. + */ + virtual void CleanupObject( TInt aListIndex, CBase& aObject ) = 0; + }; + +class CGlxDataWindow; + +/** + * Iterator that iterates through the items in a window + */ +class TGlxWindowIterator + { +public: + /** Constructor. Not exported since CGlxDataWindow is internal. */ + TGlxWindowIterator( const CGlxDataWindow& aWindow ); + /** Copy constructor */ + IMPORT_C TGlxWindowIterator( const TGlxWindowIterator& aIterator ); + /** + * @return the current item index in the list and move to next + * or KErrNotFound if has reached the end of the list + */ + IMPORT_C TInt operator++( TInt ); + +private: + /// window being iterated + const CGlxDataWindow* iWindow; + /// current position of iteration + TInt iWindowIndex; + }; + +/** + * CGlxListWindowBase + */ +class CGlxListWindow : public CBase + { +public: + /** Constructor */ + IMPORT_C CGlxListWindow( MGlxWindowObjectFactory& aObjectFactory ); + /** Second-phase constructor */ + IMPORT_C void ConstructL(); + /** Destructor */ + IMPORT_C ~CGlxListWindow(); + + /** + * Cleans up the objects, so that the list window can be deleted + * If the objects contained in the window do not build any links + * from other objects to them, this function does not have to be called. + * In this case also your implementation of CleanupObject can be empty. + * + * Depending on usage, may not be necessary to call on destruction + * of the window's owner (e.g., when the whole app is being closed, + * removing links to other objects is usually unnecessary. However, + * if you are removing one list window but leaving others, then + * the list window should be cleaned up, assuming your implementation + * of CleanupObject has some code in it.) + * + * Cannot be called by the destructor of this class, as long as deriving + * classes implement MGlxWindowObjectFactory, since vtable would not + * be valid in the destructor + */ + IMPORT_C void Cleanup(); + + /** + * Updates range offset. The range is the span of indexes that defined + * which objects should exists as actual objects in the window (and which + * should be abstract in the form of indexes). The range is calculated + * as a number (aFrontOffset) of objects in the front of the focus index + * and as a number (aRearOffset) of objects after the focus index. + */ + IMPORT_C void SetRangeOffsetsL( TInt aFrontOffset, TInt aRearOffset ); /// @todo depricated + IMPORT_C void SetRangeOffsetsL( TInt aFocusIndex, TInt aTotalSize, + TInt aFrontOffset, TInt aRearOffset ); + + /** @return an iterator that allows going through the items in the window */ + IMPORT_C TGlxWindowIterator Iterator() const; + + /** + * Sets the focus. + * @param aFocusIndex index of the object to be focused in the list + */ + /* @todo depricated */ IMPORT_C void SetFocusIndex( TInt aFocusIndex ); + IMPORT_C void SetFocusIndex( TInt aFocusIndex, TInt aTotalSize ); + + /** + * Adds objects to the list. Updates window if necessary. + * The function assumes that the underlying data structure has + * already changed. + */ + /* @todo depricated */ IMPORT_C void AddObjects( TInt aFirstNewIndex, TInt aLastNewIndex ); + IMPORT_C void AddObjects( TInt aFocusIndex, TInt aTotalSize, + TInt aFirstNewIndex, TInt aLastNewIndex ); + + /** + * Removes objects from the list. Updates window if necessary. + * The function assumes that the underlying data structure has + * already changed. + */ + /* @todo depricated */ IMPORT_C void RemoveObjects( TInt aFirstRemovedIndex, TInt aLastRemovedIndex ); + IMPORT_C void RemoveObjects( TInt aFocusIndex, TInt aTotalSize, + TInt aFirstRemovedIndex, TInt aLastRemovedIndex ); + + /** + * Access to objects in window + * For iteration through items in the window use Iterator() + * @return a pointer to an object or NULL if not found + */ + IMPORT_C CBase* At( TInt aIndex ); + IMPORT_C const CBase* At( TInt aIndex ) const; + +public: + /** Range of the window in the list */ + struct TRange + { + TInt iStartIndex; + TInt iLength; + }; + +private: + /** Type of chance that happened to the full list */ + enum TChangeType + { + EChangeNone, + EChangeObjectsAdded, + EChangeObjectsRemoved + }; + + /** Class to describe a change to the full list */ + class TChange // declare struct as class to avoid CodeScanner warning... + { + public: + /** Constructor */ + TChange( TInt aNewFocusIndex, TInt aNewTotalSize, TChangeType aChangeType, + TInt aFirstChangedIndex, TInt aLastChangedIndex ); + + TInt iNewFocusIndex; + TInt iNewTotalSize; + TChangeType iChangeType; + /// first index added or removed, depending on iChangeType + TInt iFirstChangedIndex; + /// last index added or removed, depending on iChangeType + TInt iLastChangedIndex; + }; + + /** Update the window based on the change */ + void Update( const TChange& aChange ); + /** Move objects from main window to working window, or object pool if not needed */ + void PopulateExistingAndUnuseOld( const TChange& aChange ); + /** Populate main window with items from object pool */ + void PopulateNew(); + /** Make working window the main window and vice versa */ + void SwapWindows(); + /** @return an object from the object pool */ + CBase* UnusedObject(); + /** + * @return the index of the item at aIndex, when adjusted by the change, so + * that index keeps pointing to the same logical item. + */ + TInt IndexAfterChange( TInt aIndex, const TChange& aChange ) const; + + /** @return the first and last index of the range range */ + TRange Range( const TChange& aChange ) const; + +private: + /** + * Position of the focus + * If not defined (=list empty) value is -1 + */ + /// @todo remove as soon as possible, this is causing the focus change logic on remove/addition + /// to be specified in media list AND here + TInt iFocusIndex; + + /** + * Front offset to focus for where window will start + * The window will start at position iFocusIndex + iFrontOffset + * (Although it may loop around the start and end of the list) + * Hence, iFrontOffset must be negative or zero + */ + TInt iFrontOffset; + + /** + * Front offset to focus for where window will end + * The window will end at position iFocusIndex + iRearOffset + * (Although it may loop around the start and end of the list) + * Hence, iRearOffset must be positive or zero + */ + TInt iRearOffset; + + /// Main window + CGlxDataWindow* iWindow; + /// Working window, used when the list is being updates + CGlxDataWindow* iWorkingWindow; + /// Unused objects pool + RPointerArray< CBase > iUnusedObjects; + + /// Factory that creates, sets up and cleans up objects that are stored in the window + MGlxWindowObjectFactory& iObjectFactory; + + __DECLARE_TEST; + }; + +#endif // C_GLXLISTWINDOW_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxmedia.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxmedia.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,620 @@ +/* +* Copyright (c) 2008-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: Media item +* +*/ + + + + +#ifndef C_GLXMEDIA_H +#define C_GLXMEDIA_H + +#include +#include +#include + +#include "glxmediaid.h" +#include "glxthumbnailinfo.h" + +class CGlxMedia; +class CGlxMediaList; +class CGlxThumbnailAttribute; +class CGlxUstringConverter; +class MGlxMediaUser; +class TCoordinate; +/** + * TGlxMedia + * + * Reference to a media item in the item pool. + * + * @ingroup mlm_media_list_manager_design + */ +NONSHARABLE_CLASS( TGlxMedia ) + { + friend class CGlxMediaList; // To avoid exposing a SetProperties(...) interface + //Only to access AttributeTypeId to get the MPX attribute type + friend class GlxUStringConverter; +public: + inline TGlxMedia( const TGlxMediaId& aId ) : iId( aId ) { iItem = NULL; }; + inline TGlxMedia( const TGlxMediaId& aId, CGlxMedia* aProperties ) : iId( aId ) { iItem = aProperties; }; + inline TGlxMedia( const TGlxMedia& aItem ) : iId( aItem.iId ) { iItem = aItem.iItem; }; + + /** + * Constructor + * Not inlined as not intended to be used outside the dll + * Only intended to be used for static items + * @param aMedia Media object from which to take the id, and to which to point + */ + TGlxMedia( CGlxMedia& aMedia ); + + /** + * @return Id of this media item + */ + inline TGlxMediaId Id() const { return iId; }; + + /** + * @return Properties object of this media item + * @note May return NULL if the properties are not yet available + */ + inline const CGlxMedia* Properties() const { return iItem; }; + + /** + * Compare two media items by id + * This can be used in array's Find etc. methods + */ + IMPORT_C static TBool MatchById(const TGlxMedia& aMedia1, const TGlxMedia& aMedia2); + + /** + * Tests to see if the Media is a static. + * returns False if item is not static + * True is item is static + */ + IMPORT_C TBool IsStatic() const; + + /** + * Get the command associated with a static media item. + * @param aCmd Reference to variable into which to place the command + * @return EFalse if unable to get command - aCmd is unchanged. + * ETrue if command successfully put in aCmd. + */ + IMPORT_C TBool GetStaticItemCommand(TInt& aCmd) const; + + /** + * Get the date associated with the media. + * @param aDate Reference to variable into which to place the date + * @return EFalse if unable to get date - aDate is unchanged. + * ETrue if date successfully put in aDate. + */ + IMPORT_C TBool GetDate(TTime& aDate) const; + + /** + * Get the date associated with the media. + * @param aDate Reference to variable into which to place the date + * @return EFalse if unable to get date - aDate is unchanged. + * ETrue if date successfully put in aDate. + */ + IMPORT_C TBool GetLastModifiedDate(TTime& aDate) const; + + /** + * Get the general category associated with the media. + * @param aCategory Reference to variable into which to place the category + * @return The category or EMPXNoCategory if unsuccessful. + */ + IMPORT_C TMPXGeneralCategory Category() const; + + /** + * Get the dimensions associated with the media. + * @param aSize Reference to variable into which to place the dimensions + * @return EFalse if unable to get dimensions - aSize is unchanged. + * ETrue if dimensions successfully put in aSize. + */ + IMPORT_C TBool GetDimensions(TSize& aSize) const; + + /** + * Get the (file) size associated with the media. + * @param aSize Reference to variable into which to place the (file) size + * @return EFalse if unable to get size - aSize is unchanged. + * ETrue if size successfully put in aSize. + */ + IMPORT_C TBool GetSize(TInt& aSize) const; + + /** + * Get the duration associated with the media. + * @param aDuration Reference to variable into which to place the duration + * @return EFalse if unable to get size - aDuration is unchanged. + * ETrue if duration successfully put in aDuration. + */ + IMPORT_C TBool GetDuration(TReal32& aDuration) const; + + /** + * Get the frame count associated with the media. + * @param aFrameCount Reference to variable into which to place count + * @return EFalse if unable to get count - aFrameCount is unchanged. + * ETrue if count successfully put in aFrameCount. + */ + IMPORT_C TBool GetFrameCount(TInt& aFrameCount) const; + + /** + * Get the general count associated with the media. + * @param aGeneralCount Reference to variable into which to place count + * @return EFalse if unable to get count - aGeneralCount is unchanged. + * ETrue if count successfully put in aGeneralCount. + */ + IMPORT_C TBool GetContainedItemCount(TInt& aGeneralCount) const; + + /** + * Get the general count associated with the media. + * @param aGeneralCount Reference to variable into which to place count + * @return EFalse if unable to get count - aGeneralCount is unchanged. + * ETrue if count successfully put in aGeneralCount. + */ + IMPORT_C TBool GetSlideshowPlayableContainedItemCount(TInt& aGeneralCount) const; + + /** + * Get the coordinate associated with the media. + * @param aCoordinate Reference to variable into which to place the coordinate + * @return EFalse if unable to get coordinate - aCoordinate is unchanged. + * ETrue if coordinate successfully put in aCoordinate. + */ + IMPORT_C TBool GetCoordinate(TCoordinate& aCoordinate) const; + + /** + * Get the Icon Info associated with the media. + * @param aInfo Reference to variable into which to place the icon Info + * @return EFalse if unable to get info - aInfo is unchanged. + * ETrue if info successfully put in aInfo. + */ + IMPORT_C TBool GetIconInfo(TIconInfo& aInfo) const; + + /** + * Returns the DRM protection indication associated with the media. + * @return EFalse if not protected. + * ETrue if protected (also by default). + */ + IMPORT_C TBool IsDrmProtected() const; + + /** + * Get the DRM protection indicator associated with the media. + * @param aIsProtected Reference to variable into which to place the DRM indicator + * @return EFalse if unable to get indicator - aIsProtected is unchanged. + * ETrue if indicator successfully put in aIsProtected. + */ + IMPORT_C TBool GetDrmProtected(TBool& aIsProtected) const; + + /** + * Get the DRM protection indicator associated with the media. + * @param aIsProtected Reference to variable into which to place the DRM indicator + * @return EFalse if unable to get indicator - aIsProtected is unchanged. + * ETrue if indicator successfully put in aIsProtected. + */ + IMPORT_C TBool GetDrmValidity(TGlxMediaGeneralRightsValidity& aIsValid) const; + + /** + * Get the System Item indicator associated with the media. + * @param aIsSystemItem Reference to variable into which to place the SI indicator + * @return EFalse if unable to get indicator - aIsSystemItem is unchanged. + * ETrue if indicator successfully put in aIsSystemItem. + */ + IMPORT_C TBool GetSystemItem(TBool& aIsSystemItem) const; + + /** + * Get the title associated with the media. + * @return descriptor reference to title if found, else to an empty descriptor. + */ + IMPORT_C const TDesC& Title() const; + + /** + * Get the subtitle associated with the media. + * @return descriptor reference to subtitle if found, else to an empty descriptor. + */ + IMPORT_C const TDesC& SubTitle() const; + + /** + * Get the comment associated with the media. + * @return descriptor reference to comment if found, else to the NULL descriptor. + */ + IMPORT_C const TDesC& Comment() const; + + /** + * Get the URI associated with the media. + * @return Uri for success or KNullDesC for failure + */ + IMPORT_C const TDesC& Uri() const; + + /** + * Get the MimeType associated with the media. + * @return MimeType for success or KNullDesC for failure + */ + IMPORT_C const TDesC& MimeType() const; + + /** + * Get a thumbnail attribute associated with the media. + * @param aAttribute The attribute to obtain + * @return A pointer to the thumbnail attribute or NULL if unsuccessful. + */ + IMPORT_C const CGlxThumbnailAttribute* TGlxMedia::ThumbnailAttribute( + TMPXAttribute& aAttribute) const; + + /** + * Find the closest available thumbnail to a given size. + * @param aAttribute Set to the closest available thumbnail, if any + * @param aDesiredSize Size of thumbnail required + * @param aDrmValid If false, the function will not return a thumbnail + bigger than the requested size + * @return EFalse if no thumbnails available. + * ETrue if aAttribute has been set. + */ + IMPORT_C TBool GetClosestThumbnail( TMPXAttribute& aAttribute, + const TSize& aDesiredSize, TBool aDrmValid ) const; + + /** + * Can the media be played in slideshow + * @return EFalse if not playable. + * ETrue if playable. + */ + IMPORT_C TBool IsSlideShowPlayableContent() const; + + /** + * Returns the IdSpaceId associated with the media. + * @return TGlxIdSpaceId of the media + */ + IMPORT_C TGlxIdSpaceId IdSpaceId() const; + + /** + * Set media object pointer + * not inlined, since will not be exported + * @param aMedia Media object, or NULL + * @param aMediaUser User of media + * @param aIndex Index of media object in media list user + */ + void SetMedia( CGlxMedia* Media, MGlxMediaUser& aMediaUser, TInt aIndex = KErrNotFound); + + /** + * Update media object + * Used to update the index into the media list user + * @param aMediaUser User of media + * @param aIndex Index of media object in media list user + */ + void UpdateMedia( MGlxMediaUser& aMediaUser, TInt aIndex ); + + IMPORT_C void DeleteLocationAttribute(); + +private: + /** + * Unique identifier of this media item + */ + TGlxMediaId iId; + + /** + * Pointer to the shared instance of media item properties + * Not owned + */ + CGlxMedia* iItem; + }; + +/** + * CGlxMedia + * + * Basic properties for a media item + * + * @lib glxmedialists.lib + */ +NONSHARABLE_CLASS( CGlxMedia ) : public CBase + { +public: + + /** + * Constructor + * @param aId media item ID + */ + IMPORT_C CGlxMedia( const TGlxMediaId& aId ); + + /** + * Destructor + */ + IMPORT_C ~CGlxMedia(); + + /** + * @param aId New Id for this media item. + */ + inline void SetId(const TGlxMediaId& aId) { iId = aId; } // TEMPORARY, merge to attribute array + + /** + * @return Id of this media item + */ + inline TGlxMediaId Id() const { return iId; }; // TEMPORARY, merge to attribute array + +public: + + /** + * The attributes provided in this media object + * + * @return array of attributes indicating the attributes for the values contained + * in this object + */ + inline const TArray Attributes() const; + + /** + * Does this object contain the value for a given attribute + * + * @param aAttribute, the specified attribute + * @return whether supported or not + */ + inline TBool IsSupported(const TMPXAttribute& aAttribute) const; + + /** + * The number of attribute values provided in this media object + * + * @return count of attribute values in this object + */ + inline TInt Count() const; + + /** + * The attribute for a specific index + * + * @param aIndex the index from 0 to Count()-1, covering all the values + * provided in this object + * @return the attribute corresponding to the value at the specified index + */ + inline const TMPXAttribute& Attribute(TInt aIndex) const; + + /** + * The index of a given attribute + * + * @param aAttribute the specified attribute + * @return the index, or KErrNotFound if not present in this object + */ + inline TInt Index(const TMPXAttribute& aAttribute) const; + + /** + * The value for a specific attribute + * + * @param aAttribute, the attribute whose value is queried + * @return value of the attribute + */ + template + inline T ValueTObject(const TMPXAttribute& aAttribute) const; + + /** + * Get the value for a specific attribute, indicating success + * + * @param aValue, reference to object into which to place the value + * @param aAttribute, the attribute whose value is queried + * @return EFalse if unable to get value - aValue is unchanged. + * ETrue if value successfully put in aValue. + */ + template + inline TBool GetValueTObject(T& aValue, const TMPXAttribute& aAttribute) const; + + + /** + * The value for a specific attribute + * + * @param aAttribute, the attribute whose value is queried + * @return value of the attribute + */ + IMPORT_C const TDesC& ValueText(const TMPXAttribute& aAttribute) const; + + /** + * Get the text for a specific attribute, indicating success + * + * @param aText, reference to object into which to place a pointer to the text + * @param aAttribute, the attribute whose value is queried + * @return EFalse if unable to get text - aText is unchanged. + * ETrue if pointer to text successfully put in aText. + */ + IMPORT_C TBool GetValueText(TPtrC& aText, + const TMPXAttribute& aAttribute) const; + + + /** + * The value for a specific attribute + * + * @param aAttribute, the attribute whose value is queried + * @return value of the attribute + */ + IMPORT_C const CBase* ValueCObject(const TMPXAttribute& aAttribute) const; + + /** + * Clears all the attributes and values + */ + IMPORT_C void Reset(); + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present + * + * @param aAttribute the attribute whose value is added/modified + * @return value of the attribute + */ + IMPORT_C void SetTextValueL(const TMPXAttribute& aAttribute, + const TDesC& aValue); + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present + * + * @param aAttribute the attribute whose value is added/modified + * @return value of the attribute + */ + template + inline void SetTObjectValueL(const TMPXAttribute& aAttribute, T aValue); + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present + * + * @param aAttribute the attribute whose value is added/modified + * Takes ownership, unless leaves. + * @return value of the attribute + */ + IMPORT_C void SetCObjectValueL(const TMPXAttribute& aAttribute, CBase* aValue_TakesOwnership); + + /** + * Delete an attribute of the media item + * @param aAttribute The attribute that is deleted + */ + IMPORT_C void DeleteAttribute(const TMPXAttribute& aAttribute); + + /** + * Delete an attribute of the media item + * @param aAttributeIndex index of the attribute to delete + */ + void DeleteAttribute( TInt aAttributeIndex ); + + /** + * Handles modification of item + * + * @param aAttributes Attributes that have been modified + */ + IMPORT_C void HandleModified(const RArray& aAttributes); + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present + * + * @param aAttribute the attribute whose value is added/modified + * @param aValue value of the attribute + * @param aType type of the attribute + */ + IMPORT_C void SetValueL(const TMPXAttribute& aAttribute, TAny* aValue, TMPXAttributeType aType); + +public: // Media-list-manager-internal management interface + /** + * Reserve space for users to be added, so AddUser can be called with + * danger of failure + * This should not be exported + * @param aReservationCount space is allocated for this number of users + */ + void ReserveUsersL( TInt aReservationCount ); + + /** + * Add the list as a user of the media object + * The index into list is also stored, to allow clients that + * are processing users of a media, to index directly into the list + * This should not be exported + * Reservation must have been made before calling this + * @param aUser the object to be added as a user + * @param aIndex the index into the media list user + */ + void AddUser( MGlxMediaUser& aUser, TInt aIndex ); + + /** + * Remove the list as a user list of the media object + * This should not be exported + * @param aUser the user to be removed + */ + void RemoveUser( const MGlxMediaUser& aUser ); + + /** + * Determines if the list is a user + * This should not be exported + * @return ETrue if the object is a user of this media object + */ + TBool IsUser( const MGlxMediaUser& aUser ) const; + + /** + * Count of user lists + * This should not be exported + * @return The number of users of this media object + */ + TInt UserCount() const; + + /** + * User by index + * This should not be exported + * @param aIndex index of the user + * @return User by index + */ + MGlxMediaUser& User(TInt aIndex) const; + + /** + * Index in the media list user + * This should not be exported + * @param aIndex index of the user + * @return Index in the media list user + */ + TInt IndexInUser(TInt aIndex) const; + + /** + * Update index in the media list user + * This should not be exported + * @param aUser the user to be updated + * @param aIndex the index into the media list user + */ + void UpdateUser( MGlxMediaUser& aUser, TInt aIndex ); + + /** + * Returns the TMPXAttributeType corresponding to TMPXAttribute + * @param aAttribute the attribute whose type is required + */ + TMPXAttributeType AttributeTypeId(const TMPXAttribute& aAttribute) const; + +private: + struct TValue + { + inline TValue(TAny* aValue, TMPXAttributeType aType); + TAny* iValue; + TMPXAttributeType iType; + }; + + /** + * Deletes a value in the right way, depending on its type + */ + void Delete(TValue& aValue); + +private: + struct TMediaUser + { + /** + * Find match by MGlxMediaUser + */ + static TBool MatchUser(const TMediaUser& aUser1, + const TMediaUser& aUser2); + + /** + * Constructor + */ + TMediaUser(MGlxMediaUser* aMediaUser, TInt aIndex = KErrNotFound); + + MGlxMediaUser* iMediaUser; + TInt iIndex; + }; + +private: + RArray iValues; // Array index corresponds to iAttributes + RArray iAttributes; // Array index corresponds to iValues + + /** + * Media item id + */ + TGlxMediaId iId; // TEMPORARY, merge to attribute array + + /** + * Objects by which this object is used by. When the array is empty, + * the item does not have any users (and can be deleted). + * Only exposed to CGlxMediaListManager + */ + RArray< TMediaUser > iUsers; // TEMPORARY, merge to attribute array + + /// Number of users currently reserved on iUsers + __DEBUG_ONLY( TInt _iUserReservationCount; ) + + __DECLARE_TEST; + }; + +#include "glxmedia.inl" + +#endif // C_GLXMEDIA_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxmedia.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxmedia.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-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: Media item +* +*/ + + + + +#ifndef C_GLXMEDIA_INL +#define C_GLXMEDIA_INL + +// ----------------------------------------------------------------------------- +// The attributes provided in this media object +// ----------------------------------------------------------------------------- +// +inline const TArray CGlxMedia::Attributes() const + { + return iAttributes.Array(); + } + +// ----------------------------------------------------------------------------- +// Does this object contain the value for a given attribute +// ----------------------------------------------------------------------------- +// +inline TBool CGlxMedia::IsSupported(const TMPXAttribute& aAttribute) const + { + return KErrNotFound != Index(aAttribute); + } + +// ----------------------------------------------------------------------------- +// The number of attribute values provided in this media object +// ----------------------------------------------------------------------------- +// +inline TInt CGlxMedia::Count() const + { + return iAttributes.Count(); + } + +// ----------------------------------------------------------------------------- +// The attribute for a specific index +// ----------------------------------------------------------------------------- +// +inline const TMPXAttribute& CGlxMedia::Attribute(TInt aIndex) const + { + return iAttributes[aIndex]; + } + +// ----------------------------------------------------------------------------- +// The index of a given attribute +// ----------------------------------------------------------------------------- +// +inline TInt CGlxMedia::Index(const TMPXAttribute& aAttribute) const + { + return iAttributes.Find(aAttribute, TMPXAttribute::Match); + } + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +template +inline T CGlxMedia::ValueTObject(const TMPXAttribute& aAttribute) const + { + TInt i = Index(aAttribute); + + __ASSERT_DEBUG( i != KErrNotFound, Panic( EGlxPanicIllegalArgument ) ); + + __ASSERT_DEBUG(EMPXTypeTObject == iValues[i].iType, + Panic(EGlxPanicWrongAttributeType)); + const TValue& value = iValues[i]; + const T* ptr = reinterpret_cast(value.iValue); + __ASSERT_DEBUG(ptr != NULL, Panic(EGlxPanicNullPointer)); + return *ptr; + } + +template +inline TBool CGlxMedia::GetValueTObject(T& aValue, const TMPXAttribute& aAttribute) const + { + TInt i = Index(aAttribute); + if (KErrNotFound == i) + { + return EFalse; + } + + __ASSERT_DEBUG(EMPXTypeTObject == iValues[i].iType, + Panic(EGlxPanicWrongAttributeType)); + const TValue& value = iValues[i]; + const T* ptr = reinterpret_cast(value.iValue); + __ASSERT_DEBUG(ptr != NULL, Panic(EGlxPanicNullPointer)); + aValue = *ptr; + return ETrue; + } + + +// ----------------------------------------------------------------------------- +// Set the value for a specific attribute +// ----------------------------------------------------------------------------- +// +template +inline void CGlxMedia::SetTObjectValueL(const TMPXAttribute& aAttribute, T aValue) + { + TAny* ptr = User::AllocL(sizeof(T)); + memcpy(ptr, &aValue, sizeof(T)); + + SetValueL(aAttribute, ptr, EMPXTypeTObject); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxMedia::TValue::TValue(TAny* aValue, TMPXAttributeType aType) + { + iValue = aValue; + iType = aType; + } + +#endif // C_GLXMEDIA_INL diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxmedialist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxmedialist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,514 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +#ifndef C_GLXMEDIALIST_H +#define C_GLXMEDIALIST_H + +#include +#include +#include + +#include "mglxmedialist.h" +#include "mglxnavigablelistobserver.h" +#include "mglxmediauser.h" + +// Forward declarations +class CGlxCacheManager; +class CGlxErrorPoster; +class CGlxNavigableList; +class CMPXCollectionPath; +class MGlxFetchContext; +class MMPXCollection; +class MMPXCollectionUtility; +class TGlxMedia; +class CGlxMediaListArray; + +namespace NGlxMediaList + { + class TNotificationStrategy; + } + +/** + * CGlxMediaList + * + * Interface for reading lists of media items + * + * @ingroup mlm_media_list_manager_design + * @lib glxmedialists.lib + */ +class CGlxMediaList : + public CBase, public MGlxMediaList, public MMPXCollectionObserver, + public MGlxNavigableListObserver, public MGlxMediaUser + { +public: + /** + * Return a reference-counted instance of CGlxMediaList. User MUST Close() this when finished with it. + * + * @param aPath Path to the collection + * @param aHierarchyId Id of the client hierarchy + * @param aFilter Filter on the collection + * @return instance of media list object + */ + static CGlxMediaList* InstanceL(const CMPXCollectionPath& aPath, + const TGlxHierarchyId& aHierarchyId = KGlxIdNone, CMPXFilter* aFilter = NULL); + + + /** + * Gives an array of all media lists in current use + * + * @return The array of media lists + */ + static RPointerArray& MediaListsL(); + +public: + /** + * Media object is available. The list picks up the pointer to the media object + * if it has a matching item, and adds itself as a user of the media object + * The index into the list is also stored, to allow clients that + * are processing users of a media, to index directly into the list + * Note: The function assumes that a reservation for at least one list has been + * made in each CGlxMedia::iUsedByLists array, and this object can use that + * reservation + * + * @param aItems media items to offer to list + */ + void OfferMedia(const TGlxIdSpaceId& aIdSpaceId, CGlxMedia* aItems); + + /** + * Ask if the list has any requests to place + * + * @param aItemIndexes Indexes of the items to request attributes for + * @param aItemIds Ids of the items to request attributes for + * @param aAttributes attributes to request for the items + * @param aDetailedSpecs attribute specifications + */ + void AttributeRequestL(RArray& aItemIndexes, RArray& aItemIds, RArray& aAttributes, CMPXAttributeSpecs*& aDetailedSpecs) const; + + /** + * Ordering function for attributes + * + * @see TLinearOrder + * + * @param aItem1 first item to order + * @param aItem2 second item to order + * @return TInt indicating ordering + */ + static TInt AttributeOrder(const TMPXAttribute& aItem1, const TMPXAttribute& aItem2); + + /** + * Ordering function for attributes + * + * @see TLinearOrder + * + * @param aItem1 first item to order + * @param aItem2 second item to order + * @return TInt indicating ordering + */ + static TInt AttributeOrderReversed(const TMPXAttribute& aItem1, const TMPXAttribute& aItem2); + +public: // From MGlxMediaList + /// See @ref MGlxMediaList::Close + void Close(); + + /// See @ref MGlxMediaList::Id + TGlxMediaListId Id() const; + + /// See @ref MGlxMediaList::Count + TInt Count(NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll) const; + + /// See @ref MGlxMediaList::FocusIndex + TInt FocusIndex() const; + + /// See @ref MGlxMediaList::SetFocusL + void SetFocusL(NGlxListDefs::TFocusSetType aType, TInt aValue); + + /// See @ref MGlxMediaList::Item + const TGlxMedia& Item(TInt aIndex) const; + + /// See @ref MGlxMediaList::Index + TInt Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId) const; + + /// See @ref MGlxMediaList::AddMediaListObserverL + void AddMediaListObserverL(MGlxMediaListObserver* aObserver); + + /// See @ref MGlxMediaList::RemoveMediaListObserver + void RemoveMediaListObserver(MGlxMediaListObserver* aObserver); + + /// See @ref MGlxMediaList::AddContext + void AddContextL(const MGlxFetchContext* aContext, TInt aPriority); + + /// See @ref MGlxMediaList::RemoveContext + void RemoveContext(const MGlxFetchContext* aContext); + + /// See @ref MGlxMediaList::Collection + MMPXCollection& Collection() const; + + /// See @ref MGlxMediaList::PathLC + CMPXCollectionPath* PathLC(NGlxListDefs::TPathType aType = NGlxListDefs::EPathAllOrSelection) const; + + /// See @ref MGlxMediaList::IsSelected + TBool IsSelected(TInt aIndex) const; + + /// See @ref MGlxMediaList::SetSelectedL + void SetSelectedL(TInt aIndex, TBool aSelected); + + /// See @ref MGlxMediaList::SelectionCount + TInt SelectionCount() const; + + /// See @ref MGlxMediaList::SelectedItemIndex + TInt SelectedItemIndex(TInt aSelectionIndex) const; + + /// See @ref MGlxMediaList::CommandL + void CommandL(CMPXCommand& aCommand); + + /// See @ref MGlxMediaList::CancelCommand + void CancelCommand(); + + /// See @ref MGlxMediaList::SetFilterL + void SetFilterL(CMPXFilter* aFilter); + + /// See @ref MGlxMediaList::Filter + CMPXFilter* Filter() const; + + /// See @ref MGlxMediaList::IdSpaceId + TGlxIdSpaceId IdSpaceId(TInt aIndex) const; + + /// See @ref MGlxMediaList::IsPopulated + TBool IsPopulated() const; + + /// See @ref MGlxMediaList::AddStaticItemL + void AddStaticItemL( CGlxMedia* aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ); + + /// See @ref MGlxMediaList::RemoveStaticItem + void RemoveStaticItem(const TGlxMediaId& aItemId); + + /// See @ref MGlxMediaList::SetStaticItemsEnabled + void SetStaticItemsEnabled( TBool aEnabled ); + + /// See @ref MGlxMediaList::IsStaticItemsEnabled + TBool IsStaticItemsEnabled() const; + + /// See @ref MGlxMediaList::SetFocusInitialPosition + void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition); + + /// See @ref MGlxMediaList::ResetFocus + void ResetFocus(); + + /// See @ref MGlxMediaList::SetVisibleWindowIndex + void SetVisibleWindowIndexL( TInt aIndex ); + + /// See @ref MGlxMediaList::VisibleWindowIndex + TInt VisibleWindowIndex() const; + + /// See @ref MGlxMediaList::CancelPreviousRequests + void CancelPreviousRequests(); + +public: // From MMPXCollectionObserver + /// See @ref MMPXCollectionObserver::HandleCollectionMessageL + void HandleCollectionMessageL(const CMPXMessage& aMessage); + + /// See @ref MMPXCollectionObserver::HandleOpenL + void HandleOpenL(const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, TInt aError); + + /// See @ref MMPXCollectionObserver::HandleOpenL + void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist, TInt aError); + + /// See @ref MMPXCollectionObserver::HandleCollectionMediaL + void HandleCollectionMediaL(const CMPXMedia& aMedia, TInt aError); + + /// See @ref MMPXCollectionObserver::HandleCommandComplete + void HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError); + + // from MGlxNavigableListObserver + void HandleItemsAdded( TInt aAddedAtIndex, TInt aCount ); + void HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ); + void HandleFocusChanged( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex ); + void HandleItemSelected( TInt aIndex, TBool aSelected ); + + // From MGlxMediaUser + void HandleAttributesAvailableL( TInt aIndex, const RArray< TMPXAttribute >& aAttributes ); + void GetRequiredAttributesL( TInt aIndex, RArray& aAttributes ); + void RemoveReference( TInt aIndex ); + void HandleError(TInt aError); + +private: + /** + * Two phase constructor + */ + static CGlxMediaList* NewLC(const TGlxHierarchyId& aHierarchyId); + + /** + * Constructor + */ + CGlxMediaList(const TGlxHierarchyId& aHierarchyId); + + /** + * Destructor + */ + virtual ~CGlxMediaList(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Initialize the media list + * Copies the levels from the path, and retrieves the + * contents from MPX Collection Server + * + * @param aPath path that this list refers to + */ + void OpenL(const CMPXCollectionPath& aPath); + + /** + * Add a reference + * + * @return new reference count + */ + TInt AddReference(); + + /** + * Remove a reference + * + * @return new reference count + */ + TInt RemoveReference(); + + /** + * Current number of references + * + * @return new reference count + */ + TInt ReferenceCount() const; + + /** + * Determines if path is the same + * + * @param aPath collection path + * @return ETrue if this media list refers to the path + */ + TBool Equals(const CMPXCollectionPath& aPath) const; + + /** + * Determines if this list has a filter applied + * + * @return Boolean indication if filter has been applied + */ + TBool IsFiltered() const; + + /** + * Synchronise the media list + * Re-retrieves the contents from MPX Collection Server + */ + void ReOpenL(); + + /** + * Populates the list with the items in the current path + */ + void PopulateL(); + + /** + * Handles item modifications + * + * @param aId MPX item id + * @param aAttributes Attributes that have been modified + */ + void HandleItemModifiedL(TInt aId, const RArray& aAttributes); + + /** + * Notify observers of media object being now available + * + * @param aListIndex index of item for which properties are available + */ + void NotifyObserversOfMediaL(TInt aListIndex); + + /** + * Notify observers, and reports errors to error manager + */ + void NotifyObservers( NGlxMediaList::TNotificationStrategy& aStrategy ); + + /** + * Populates the path with hierarchy to parent + * + * @param aPath path to populate + */ + void PathPopulateParentL(CMPXCollectionPath& aPath) const; + + /** + * Populates the path with all items + * and sets the focus + * + * @param aPath path to populate + */ + void PathPopulateAllL(CMPXCollectionPath& aPath) const; + + /** + * Populates the path with focused item + * and sets the focus + * + * @param aPath path to populate + */ + void PathPopulateFocusL(CMPXCollectionPath& aPath) const; + + /** + * Populates the path with selected items + * and selects all + * + * @param aPath path to populate + */ + void PathPopulateSelectionL(CMPXCollectionPath& aPath) const; + + /* + * Updates each media used by this media list with the current index + */ + void UpdateMedia(); + + /* + * Updates each media used by this media list with the current index + */ + void UpdateMediaInvalidateAttributesChangedByCounts(TGlxMedia& aItem); + + /** + * Opens a collection at the appropriate level + * + * @param aPath used to determine which collection and level to open + */ + void OpenCollectionL(const CMPXCollectionPath& aPath); + + /** + * Handles the tasks after open completes + */ + void HandleOpenL(); + +private: + /** + * Enumeration to indicate pending sync status + */ + enum TSyncStatus + { + KNonePending, + KSyncPending, + KResyncPending + }; + + /** + * TContext + */ + struct TContext + { + /** + * Find match by context pointer + */ + static TBool Match(const TContext& a1, const TContext& a2); + + /** + * Compare by comparing priority + */ + static TInt Compare(const TContext& a1, const TContext& a2); + + const MGlxFetchContext* iContext; // Not owned + TInt iPriority; // Priority, higher is more important + }; + +private: + /** + * Number of users of this object + */ + TInt iReferenceCount; + + /** + * Manager of this list + * Not owned + */ + CGlxCacheManager* iManager; + + /** + * Observers that will be notified if items get added or removed or if they change + * Not owned + */ + RPointerArray iItemListObservers; + + /** + * Contexts that contain intelligence of attribute (e.g., + * thumbnail of URI) retrieving, incl. priorities. Not owned + */ + RArray iContexts; + + /** List that contains items, focus, and selection */ + CGlxNavigableList* iItemList; + + /** + * Collection utility that is bound to this list. + */ + MMPXCollectionUtility* iCollectionUtility; // own + + RArray iPath; + + /** + * Indicates if a command has already been placed on the collection, which has not complete yet. + * Currently, only one command can be made at a time + * Stores the sessionId (client that issued the command) + */ + TAny* iCommandPending; + + /** + * Filter currently set on the collection. Owned + */ + CMPXFilter* iFilter; + + /// IdSpaceId for items in the list. + TGlxIdSpaceId iIdSpaceId; + + TGlxHierarchyId iHierarchyId; + + /** + * Is populated, set to ETrue + * when the media list is first populated. + */ + TBool iIsPopulated; + + /** + * Singleton to post errors to + */ + CGlxErrorPoster* iErrorPoster; + + /// Indicates that filter was set, so need to re-order contents + TBool iReorderPending; + + /// Indicates that item(s) updated, so need to sync now or resync later + TSyncStatus iSyncStatus; + + /** + * Array of media lists + * (singleton: should be closed, not deleted) + */ + CGlxMediaListArray* iMediaListArray; + + /// Array of attributes to be invalidated when items are added or removed + RArray iCountAttributes; + + /// VisibleWindow Index + TInt iVisibleWindowIndex; + }; + +#endif // C_GLXMEDIALIST_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxmedialistarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxmedialistarray.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +#ifndef C_GLXMEDIALISTARRAY_H +#define C_GLXMEDIALISTARRAY_H + +#include + +class CGlxMediaList; + +/** + * A singleton that owns a pointer array of media lists + */ +NONSHARABLE_CLASS(CGlxMediaListArray) : public CBase + { +public: + /** + * Returns the CMediaListArray singleton + * @return the instance of CMediaListArray + */ + static CGlxMediaListArray* InstanceL(); + + /** + * Closes the singleton + */ + void Close(); + + /** + * Returns array of media lists + */ + RPointerArray& Array(); + +private: + /** + * Constructor (private so that only + * the singleton store can use it) + */ + static CGlxMediaListArray* NewL(); + + /** + * Destructor + */ + ~CGlxMediaListArray(); + +private: + /** + * Array of media lists pointers (owned, contents not owned) + */ + RPointerArray iArray; + }; + +#endif // C_GLXMEDIALISTARRAY_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxmedialistid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxmedialistid.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008-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: Media item list unique id +* +*/ + + + + +#ifndef T_GLXMEDIALISTID_H +#define T_GLXMEDIALISTID_H + +#include + +#include + +/** + * TGlxMediaListId + * + * Type safe id class for media list reader id. + * + * @lib none + */ +class TGlxIdMediaListBase {}; // Don't use this. This is just to make TGlxId type-safe +typedef TGlxId TGlxMediaListId; // Use this + +#endif // T_GLXMEDIALISTID_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxmedialistiterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxmedialistiterator.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,498 @@ +/* +* Copyright (c) 2008-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: Iterators for traversing lists +* +*/ + + + + +#ifndef __C_GLXMEDIALISTITERATOR_H__ +#define __C_GLXMEDIALISTITERATOR_H__ + +#include +#include + +class MGlxMediaList; +class T_CGlxSelectionIterator; // For E-Unit +class T_CGlxFromFocusOutwardIterator; // For E-Unit + +/** + * MGlxMediaListIterator + * + * Interface for going through items in the list in a + * non-sequential order. + * + * This class is primarily intended for Fetch contexts for going + * through the list's items in priority order. The intention is to abstract + * the selection and priorities of items from the attributes being requested. + * This allows reusing same fetch contexts with multiple item orders. + * Can hence have one attribute fethc context that requests first + * and last item and another attribute that requests some items + * starting from focus outwards, without duplicating the attribute fetch + * context code. The order classes can then also be reused in different + * fetch contexts, e.g., in thumbnail fetch context. + * + * @lib glxmedialists.lib + */ +class MGlxMediaListIterator + { +public: + /** + * Resets to the first item to be returned + * What the first item index actually is is entirely + * up to the implementation. It could be the focus index, + * or it could be the first, or even last item in the list + * + * @return the index of the first item or KErrNotFound if + * first item does not exist + */ + virtual void SetToFirst(const MGlxMediaList* aList) = 0; + + /** + * Returns the index of the current item and moves to the next item + * @return the item index or KErrNotFound if the item does not exist + */ + virtual TInt operator++(TInt) = 0; + + /** + * @return ETrue if index is within range, EFalse otherwise + */ + virtual TBool InRange(TInt aIndex) const = 0; + }; + +/** + * TGlxSpecificIdIterator + * + * Used to retrieve attributes relating to one specific media + * id in a media list. + * + * @lib glxmedialists.lib + */ +class TGlxSpecificIdIterator : public MGlxMediaListIterator + { +public: + IMPORT_C TGlxSpecificIdIterator(const TGlxIdSpaceId& aIdSpaceId, TGlxMediaId aRequiredId); + +public: // From MGlxMediaListIterator + void SetToFirst(const MGlxMediaList* aList); + TInt operator++(TInt); + TBool InRange(TInt aIndex) const; + +private: + /** + * Required id + */ + TGlxMediaId iMediaId; + + /** + * List being traversed + */ + const MGlxMediaList* iList; + + const TGlxIdSpaceId iIdSpaceId; + + TBool iFinished; + }; + +/** + * TGlxSequentialIterator + * + * Iterates though all the items in the list sequentially. + * + * @lib glxmedialists.lib + */ +class TGlxSequentialIterator : public MGlxMediaListIterator + { +public: + IMPORT_C TGlxSequentialIterator(); + +public: // From MGlxMediaListIterator + void SetToFirst(const MGlxMediaList* aList); + TInt operator++(TInt); + TBool InRange(TInt aIndex) const; + +public: + /** + * Set the maximum number of items to iterate through + * @param aRange Maximum number of items to iterate through. Set as KMaxTInt to remove limit + */ + IMPORT_C void SetRange( TInt aRange ); + +private: + TInt iCurrentItem; + + /** + * The maximum number of items to retrieve + */ + TInt iRange; + + /** + * List being traversed + */ + const MGlxMediaList* iList; + }; + +/** + * TGlxFirstThenLastIterator + * + * Ordered that returns the index of first and then the + * last item in the list + * + * @lib glxmedialists.lib + */ +class TGlxFirstThenLastIterator : public MGlxMediaListIterator + { +public: + IMPORT_C TGlxFirstThenLastIterator(); + IMPORT_C ~TGlxFirstThenLastIterator(); + +// From MGlxMediaListIterator + virtual void SetToFirst(const MGlxMediaList* aList); + virtual TInt operator++(TInt); + virtual TBool InRange(TInt aIndex) const; + +private: + /** + * The count or ordinal of the item that is currently "selected" + * This translates to how many times ++ has been called + */ + TInt iCurrentItem; + + /** + * List being traversed + */ + const MGlxMediaList* iList; + }; + +/** + * TGlxFromFocusOutwardIterator + * + * Ordered that returns the index of the focused item first and + * then the surrounding items evenly from both sides + * + * @lib glxmedialists.lib + */ +class TGlxFromFocusOutwardIterator : public MGlxMediaListIterator + { +public: + IMPORT_C TGlxFromFocusOutwardIterator(); + IMPORT_C ~TGlxFromFocusOutwardIterator(); + + /** + * Set the range offsets + */ + IMPORT_C void SetRangeOffsets(TInt aRearOffset, TInt aFrontOffset); + +// From MGlxMediaListIterator + virtual void SetToFirst(const MGlxMediaList* aList); + virtual TInt operator++(TInt); + virtual TBool InRange(TInt aIndex) const; + +private: + /** + * The count or ordinal of the item that is currently "selected" + * This translates to how many times ++ has been called + */ + TInt iCurrentItem; + + /** + * Number of items within range after focus index + */ + TInt iFrontOffset; + + /** + * Number of items within range before focus index + */ + TInt iRearOffset; + + /** + * List being traversed + */ + const MGlxMediaList* iList; + + // For E-Unit + friend class T_CGlxFromFocusOutwardIterator; + + /** + * Number of items within range as configured by clients + * This shall be used to restore back + * while coming out of low memory conditions + */ + TInt iOriginalFrontOffset; + TInt iOriginalRearOffset; + }; + +/** + * TGlxFromIndexOutwardBlockyIterator + * + * Ordered that returns the index of the focused item first and + * then the surrounding items evenly from both sides + */ +class TGlxFromIndexOutwardBlockyIterator : public MGlxMediaListIterator + { + +public: + class MGlxIndex + { + public: + virtual TInt Index() const = 0; + }; + +public: + IMPORT_C ~TGlxFromIndexOutwardBlockyIterator( ); + IMPORT_C TGlxFromIndexOutwardBlockyIterator(const MGlxIndex& aIndexFunctor); + + /** + * Set the range offsets + */ + IMPORT_C void SetRangeOffsets(TInt aRearOffset, TInt aFrontOffset); + +// From MGlxMediaListIterator + virtual void SetToFirst(const MGlxMediaList* aList); + virtual TInt operator++(TInt); + virtual TBool InRange(TInt aIndex) const; + +//protected: + /** + * Functor to return index in media list based on unknown rule + * Rule is defined by a deriving class + */ + /* class MGlxIndex + { + public: + virtual TInt Index() const = 0; + };*/ + +private: + /** + * The count or ordinal of the item that is currently "selected" + * This translates to how many times ++ has been called + */ + TInt iCurrentItem; + + /** + * Number of items within range after focus index + */ + TInt iFrontOffset; + + /** + * Number of items within range before focus index + */ + TInt iRearOffset; + + /** + * Functor from which to get the index around which iteration centers (e.g., focus) + */ + const MGlxIndex& iIndexFunctor; + +protected: + /** + * List being traversed + */ + const MGlxMediaList* iList; + }; + +/** + * TGlxFromFocusOutwardBlockyIterator + * + * Ordered that returns the index of the focused item first and + * then the surrounding items evenly from both sides + */ +class TGlxFromFocusOutwardBlockyIterator : public TGlxFromIndexOutwardBlockyIterator, + public TGlxFromIndexOutwardBlockyIterator::MGlxIndex + { +public: + IMPORT_C TGlxFromFocusOutwardBlockyIterator(); + IMPORT_C ~TGlxFromFocusOutwardBlockyIterator(); + +// From MGlxIndex + TInt Index() const; + }; + +/** + * TGlxFromManualIndexOutwardBlockyIterator + */ +class TGlxFromManualIndexOutwardBlockyIterator : public TGlxFromIndexOutwardBlockyIterator, + public TGlxFromIndexOutwardBlockyIterator::MGlxIndex + { +public: + IMPORT_C TGlxFromManualIndexOutwardBlockyIterator(); + IMPORT_C ~TGlxFromManualIndexOutwardBlockyIterator(); + + IMPORT_C void SetIndex( TInt aIndex ); + +// From MGlxIndex + TInt Index() const; + +private: + TInt iIndex; + }; + +/** + * TGlxSelectionIterator + * + * Iterates through the selected items of a media list + * + * @lib glxmedialists.lib + */ +class TGlxSelectionIterator : public MGlxMediaListIterator + { +public: + IMPORT_C TGlxSelectionIterator(); + IMPORT_C ~TGlxSelectionIterator(); + +public: + /** + * Set the maximum number of selected items to iterate through + @param aMaxItems Maximum number of selected items to iterate through. Set as KMaxTInt to remove limit + */ + IMPORT_C void SetRange(TInt aMaxItems); + + /** + * Disables the iterator if the number of selected items is greater than + * the range. (specified using SetRange() above). + * @param aDisabledIfMoreThanRangeSelected If ETrue, the iterator is + * disabled if the number of selected items is greater than the range. + * If EFalse, the iterator is enabled if the number of selected items + * is greater than the range. + */ + IMPORT_C void SetDisabledIfMoreThanRangeSelected(TBool aDisabledIfMoreThanRangeSelected); + + // From MGlxMediaListIterator + IMPORT_C virtual void SetToFirst(const MGlxMediaList* aList); + IMPORT_C virtual TInt operator++(TInt); + IMPORT_C virtual TBool InRange(TInt aIndex) const; + +private: + /** + * The count or ordinal of the item that is currently "selected" + * This translates to how many times ++ has been called + */ + TInt iCurrentItem; + + /** + * List being traversed + */ + const MGlxMediaList* iList; + + /** + * If ETrue, the iterator is disabled if the number of selected + * items is greater than the range. If EFalse, the iterator is enabled + * if the number of selected items is greater than the range. + */ + TInt iDisabledIfMoreThanRangeSelected; + + /** + * The maximum number of selected items to iterate through. + */ + TInt iRange; + + // For E-Unit + friend class T_CGlxSelectionIterator; + }; + +/** + * ExclusionIterator + * + * Iterates through the non visible items + * + * + * @lib glxmedialists.lib + */ +class TGlxExclusionIterator : public MGlxMediaListIterator + { + +public: + IMPORT_C TGlxExclusionIterator( MGlxMediaListIterator &aIncludedItemsIterator, MGlxMediaListIterator &aExcludedItemsIterator ); + IMPORT_C ~TGlxExclusionIterator(); + + // From MGlxMediaListIterator + IMPORT_C void SetToFirst(const MGlxMediaList* aList); + + TInt operator++(TInt); + + TBool InRange(TInt aIndex) const; + +private: + + /** + * The iterator whixh specifies ,which items to be included. + */ + MGlxMediaListIterator& iIncludedItemsIterator; + + /** + * The iterator which specifies ,which items should be excluded., + */ + MGlxMediaListIterator& iExcludedItemsIterator; + + }; + +/** + * TGlxFromManualIndexBlockyIterator + * + * Ordered that returns the index of the visible window item first and + * then the surrounding items evenly from both sides + */ +class TGlxFromManualIndexBlockyIterator : public MGlxMediaListIterator + { + +public: + IMPORT_C ~TGlxFromManualIndexBlockyIterator( ); + IMPORT_C TGlxFromManualIndexBlockyIterator( ); + + /** + * Set the range offsets + */ + IMPORT_C void SetRangeOffsets(TInt aRearOffset, TInt aFrontOffset); + + // From MGlxMediaListIterator + virtual void SetToFirst(const MGlxMediaList* aList); + virtual TInt operator++(TInt); + virtual TBool InRange(TInt aIndex) const; + +private: + /** + * The count or ordinal of the item that is currently "selected" + * This translates to how many times ++ has been called + */ + TInt iCurrentItem; + + /** + * Number of items within range after visible index + */ + TInt iFrontOffset; + + /** + * Number of items within range before visible index + */ + TInt iRearOffset; + + /** + * Number of items within range as configured by clients + * This shall be used to restore back + * while coming out of low memory conditions + */ + TInt iOriginalFrontOffset; + TInt iOriginalRearOffset; + TInt iDefaultVisItems; +protected: + /** + * List being traversed + */ + const MGlxMediaList* iList; + }; + +#endif // __C_GLXMEDIALISTITERATOR_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxmediastaticitemdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxmediastaticitemdefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2008-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: Static item media items +* +*/ + + + + +#ifndef _GLXMEDIASTATICITEMDEFS_H +#define _GLXMEDIASTATICITEMDEFS_H + +#include + +/** + * Content ID identifying static item category + */ +const TInt KGlxMediaIdStaticItem = 0x200071C9; +const TInt KGlxMediaStaticItemPosition = 0x00; +const TInt KGlxMediaStaticItemCommand = 0x01; + +const TInt KGlxStaticSpaceId = 0x200071CA; /// @deprecated, use KGlxStaticItemIdSpaceId +const TInt KGlxStaticItemIdSpaceId = KGlxStaticSpaceId; + +const TMPXAttributeData KGlxAttrMediaStaticItemPosition={KGlxMediaIdStaticItem, KGlxMediaStaticItemPosition}; +/** + * TBool, ETrue is static, EFalse is not + */ +const TMPXAttributeData KGlxMediaStaticItem = { KGlxMediaIdStaticItem, 0x00 }; + +#endif // _GLXMEDIASTATICITEMDEFS_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxnavigablelist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxnavigablelist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,403 @@ +/* +* Copyright (c) 2008-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: List of media items, which has focus +* +*/ + + + + +#ifndef __C_GLXNAVIGABLELIST_H__ +#define __C_GLXNAVIGABLELIST_H__ + +#include +#include + + +#include "glxmediaid.h" +#include "mglxitemlistobserver.h" + +/** @todo +Other required changes: +-Media list must not media for static items to be requested: Remove static item indexes from the list attribute context returned +-Thumbnail context needs to give a low score (very low) to static items, so that it does not stop requesting thumbnails +*/ + +// Forward declarations +class TGlxMedia; +class CGlxMedia; +class CGlxStaticItemList; +class CMPXCollectionPath; +class MGlxMediaPool; +class MGlxMediaUser; +class MGlxNavigableListObserver; + +/** + * Namespace for CGlxNavigableList class' helpers + */ +namespace NGlxNavigableList + { + class MSelectionIndexStrategy; + } + +/** + * CGlxNavigableList + * + * List that has + * - non-static items + * - static items + * - focus + * - selection + * + * @author Aki Vanhatalo + * + * @internal reviewed 16/07/2007 by Kimmo Hoikka + * + * @ingroup mlm_media_list_manager_design + */ +NONSHARABLE_CLASS( CGlxNavigableList ) : public CBase, public MGlxItemListObserver + { +public: + /** + * Two-phase constructor + * @param aIdSpaceId id of the "space" in which all item ids are unique + * @param aObserver Observer to be notified + * @param aMediaUser User of media objects - media objects that + * this list links to will be linked to the user, so that + * cache manager is able to quickly access the media lists + * that use particular media objects + */ + static CGlxNavigableList* NewL( const TGlxIdSpaceId& aIdSpaceId, + MGlxNavigableListObserver& aObserver, MGlxMediaUser& aMediaUser ); + + /** + * Destructor + */ + ~CGlxNavigableList(); + + /** + * @return id space id + */ + const TGlxIdSpaceId& IdSpaceId() const; + + /** + * Synchronises the list with new path + * Sends added/removed notifications as necessary + * Note: Does not copy the selected items or focus + * + * @param aSource path with item ids + * @param aMediaPool interface from which to ask for media items + */ + void SetContentsL( const CMPXCollectionPath& aSource, + const MGlxMediaPool& aMediaPool ); + + /** + * Re-orders the list with new path + * Sends all items removed followed by all items added (from new path) notifications + * Maintains the selected items and focus + * + * @param aSource path with item ids + * @param aMediaPool interface from which to ask for media items + */ + void ReorderContentsL( const CMPXCollectionPath& aSource, + const MGlxMediaPool& aMediaPool ); + + /** + * Remove an item form the list + * Sends removed notification + * + * @param aIdSpaceId Id space of the item. Use KGlxStaticItemIdSpaceId + * if you want to permanently remove a static item. + * @param aItemId Id of item to remove + */ + void Remove( const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aItemId ); + + /** + * Remove any pointers to the media object at the specified index + * @param aIndex index of media object from which to remove a reference + */ + void RemoveReference( TInt aIndex ); + + /** + * Adds a static item and takes ownership + * Note: In case of a leave, aStaticItem may have been modified. + * It is assumed that since ownership of the static item is passed, + * the object is free to be modified. + * @param aStaticItem Static item to be added + * @param aTargetPosition Whether to be added at beginning or end + */ + void AddStaticItemL( CGlxMedia* aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ); + + /** + * Enables or disables static items + * @param aEnabled true if static items should be enabled + * false if static items should be disabled + */ + void SetStaticItemsEnabled( TBool aEnabled ); + + /** + * @return ETrue if static items are enabled + */ + TBool IsStaticItemsEnabled() const; + + /** + * @param aType type of count wanted + * @return count of items, as specified in aType + */ + TInt Count( NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll ) const; + + /** + * @return item at index + */ + TGlxMedia& Item( TInt aIndex ); + + /** + * @param aId Id of item for which index is needed + * @return item with id aId or KErrNotFound + */ + TInt Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId ) const; + + /** + * Sets the initial focus position, first or last item + * @param aFocusInitialPosition initial focus on first or last item + */ + void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition); + + /** + * @return index of focused item + */ + TInt FocusIndex() const; + + /** + * Sets focus to item at index + * Notifies observer via HandleFocusChangedL + * @param aType EAbsolute or ERelative + * @param aValue If aType is EAbsolute, the new index value + * If aType is ERelative, the amount of indexes to move focus + */ + void SetFocus( NGlxListDefs::TFocusSetType aType, TInt aValue ); + + /** + * Resets the focus to the initial position + */ + void ResetFocus(); + + /** + * @return ETrue if item is selected, EFalse if not + */ + TBool IsSelected( TInt aIndex ) const; + + /** + * Selects or deselects an item. + * If item is already at desired selection state, does nothing. + * Otherwise, calls back via HandleItemSelected. + * + * @param aIndex index of item to be selected/deselected + * @param aSelected true if item should be selected + * false if item should be deselected + */ + void SetSelectedL( TInt aIndex, TBool aSelected ); + + /** + * @return Array of indexes of items that are selected + */ + const TArray< TInt > SelectedItemIndices() const; + + // From MGlxItemListObserver + void HandleItemsAdded( TInt aFirstInsertedIndex, TInt aCount ); + void HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ); + +private: + /** + * Constructor + * @param aObserver Observer to be notified + */ + CGlxNavigableList( MGlxNavigableListObserver& aObserver ); + + /** + * Second-phase constructor + * @param aIdSpaceId id of the "space" in which all item ids are unique + * @param aMediaUser User of media objects + */ + void ConstructL( const TGlxIdSpaceId& aIdSpaceId, + MGlxMediaUser& aMediaUser ); + + /** @return id of focused item or KGlxIdNone if nothing focused */ + TGlxMediaId FocusId() const; + + /** + * Populates provided array with currently selected item ids + * @param aItemIds array to contain selected item ids + */ + void SelectionL( RArray< TGlxMediaId >& aItemIds ) const; + + /** + * Sets list contents to nothing, but leaves static items + * @param aMediaPool interface from which to ask for media items + */ + void ClearContentsL( const MGlxMediaPool& aMediaPool ); + + /** + * Selects items by id + * Ok to call if item does not exist in list + * @param aItemIds List of ids of items to select + */ + void SelectL( const RArray< TGlxMediaId >& aItemIds ); + + /** + * Select item at index + * @param aIndex index to be selected + */ + void SelectL( TInt aIndex ); + + /** + * Select item at index + * Must call ReserveFreeSpaceInSelectionL first + * @param aIndex index to be selected + */ + void Select( TInt aIndex ); + + /** + * Reserve free space in selection, so that Select + * can be safely called + * @param aCount Number of times Select will be called (or larger) + */ + void ReserveFreeSpaceInSelectionL( TInt aCount ); + + /** + * Deselect item at index + * @param aIndex index to be deselected + */ + void Deselect( TInt aIndex ); + + /** + * Sets the initial focus + */ + void SetInitialFocus(); + + /** + * Set focus by id. Notifies observer + * Does nothing if id does not exist in list + * @param aItemId Id of the item to be focused + */ + void SetFocus( const TGlxMediaId& aItemId ); + + /** + * Set focus index + * @param aIndex New focus index + * @return Focus change type + */ + NGlxListDefs::TFocusChangeType SetFocus( TInt aIndex ); + + /** + * Move focus index + * @param aDelta amount of indexes to move focus by + * @return Focus change type + */ + NGlxListDefs::TFocusChangeType MoveFocus( TInt aDelta ); + + /** + * Optionally, notify observer of focus change + * @param aType Focus change type + * @param aOldFocusIndex Focus index before focus being moved + * @param aNotify if ETrue, notifies observer + * if EFalse, does nothing + */ + void NotifyFocusChange( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TBool aNotify ); + + /** + * Update focus after items have been inserted to the list + * @param aInsertionIndex Insertion point + * @param aInsertionCount Number of items inserted + * @return ETrue if observer should be notified of focus change + * EFalse if not + */ + TInt UpdateFocusAfterInsertion( TInt aInsertionIndex, TInt aInsertionCount ); + + /** + * Update selection item indexes after removal of items + * @param aRemovedFromIndex First removed item index + * @param aRemovedCount Number of items removed + */ + void UpdateSelectionAfterRemove( TInt aRemovedFromIndex, TInt aRemovedCount ); + + /** + * Update focus after items have been removed from the list + * @param aRemovedFromIndex index of first removed item + * @param aRemovedCount Number of items removed + * @return ETrue if observer should be notified of focus change + * EFalse if not + */ + TBool UpdateFocusAfterRemoval( TInt aRemovedFromIndex, TInt aRemovedCount ); + + /** + * Move focus if index changed. + * @param aChangedIndex Only move focus if index changed. + * @param aMoveBy Amount to move by + * @return ETrue if observer should be notified of focus change + * EFalse if not + */ + TBool MoveFocusIfIndexChanged( TInt aChangedIndex, TInt aMoveBy ); + + + /** + * Run selection index strategy for all selection item indexes that point + * to items between aFromIndex and aToIndex (inclusive) + * @param aFromIndex First item index to be processed (not selection item index, + * but item index) + * @param aToIndex Last item index to be processed (not selection item index, + * but item index) + * @param aStrategy Strategy object that contains the logic of what to do + * with the selection index + */ + void ProcessSelectionItemIndicesBetweenIndexes( TInt aFromIndex, + TInt aToIndex, NGlxNavigableList::MSelectionIndexStrategy& aStrategy ); + + /** + * Find the first selected item index that points to an item index + * smaller aMaxIndex + * @aMaxIndex The item index pointed to by the returned selection index has + * to be smaller than this parameter + * @return selected item index (in iSelectedItemIndices) + */ + TInt FindFirstSelectedItemIndexBefore( TInt aMaxIndex ); + +private: + /// list of items + CGlxStaticItemList* iItemList; // own + + + /// Focus initial position, first or last item + NGlxListDefs::TFocusInitialPosition iFocusInitialPosition; + + /// Focus index or KErrNotFound + TInt iFocusIndex; + + /// Indexes of selected items + RArray iSelectedItemIndices; + + /// Observer for changes + MGlxNavigableListObserver& iObserver; + + /// Free space in iSelectedItemIndices. Used to make sure Select(...) is not + /// called without calling ReserveFreeSpaceInSelectionL first + __DEBUG_ONLY( TInt _iSelectionReserveCount ); + + __DECLARE_TEST; + }; + +#endif // __C_GLXNAVIGABLELIST_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxstaticitemlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxstaticitemlist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,338 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +#ifndef __C_GLXSTATICITEMLIST_H__ +#define __C_GLXSTATICITEMLIST_H__ + +#include + +#include "mglxitemlistobserver.h" +#include "glxlistdefs.h" +#include "glxmediaid.h" + +class CGlxItemList; +class CGlxMedia; +class CMPXCollectionPath; +class MGlxMediaPool; +class MGlxMediaUser; +class TGlxMedia; + +/** + * CGlxItemList + * + * List that has + * - non-static items + * - static items + * + * @author Aki Vanhatalo + * + * @internal reviewed 17/07/2007 by Kimmo Hoikka + * + * @ingroup mlm_media_list_manager_design + */ +NONSHARABLE_CLASS( CGlxStaticItemList ) : public CBase, public MGlxItemListObserver + { +public: // Interface for external use + /** + * Two-phase constructor + * @param aIdSpaceId id of the "space" in which all item ids are unique + * @param aObserver Observer to be notified + * @param aMediaUser User of media objects - media objects that + * this list links to will be linked to the user, so that + * cache manager is able to quickly access the media lists + * that use particular media objects + */ + static CGlxStaticItemList* NewL( const TGlxIdSpaceId& aIdSpaceId, + MGlxItemListObserver& aObserver, MGlxMediaUser& aMediaUser ); + + /** + * Destructor + */ + ~CGlxStaticItemList(); + + /** + * @return id space id + */ + const TGlxIdSpaceId& IdSpaceId() const; + + /** + * Synchronises the list with new path + * Sends added/removed notifications as necessary + * Note: Does not copy the selected items or focus + * + * @param aSource path with item ids + * @param aMediaPool interface from which to ask for media items + */ + void SetContentsL( const CMPXCollectionPath& aSource, const MGlxMediaPool& aMediaPool ); + + /** + * Remove an item form the list + * Sends removed notification + * + * @param aIdSpaceId Id space of the item. Use KGlxStaticItemIdSpaceId + * if you want to permanently remove a static item. + * @param aItemId Id of item to remove + */ + void Remove( const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aItemId ); + + /** + * Remove any pointers to the media object at the specified index + * @param aIndex index of media object from which to remove a reference + */ + void RemoveReference( TInt aIndex ); + + /** + * @param aType type of count (all, static items, etc) + * Default value of "all" to make it easier ro create test template + * @return count of items, as specified in aType + */ + TInt Count( NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll ) const; + + /** + * @return item at index + */ + TGlxMedia& Item( TInt aIndex ); + + /** + * @param aId Id of item for which index is needed + * @return item with id aId or KErrNotFound + */ + TInt Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId ) const; + + /** + * Adds a static item and takes ownership + * If an item with the same id already exists (in the same position), + * deletes the old item. + * Note: In case of a leave, aStaticItem may have been modified. + * It is assumed that since ownership of the static item is passed, + * the object is free to be modifies. + * @param aStaticItem Static item to be added + * @param aTargetPosition Whether to be added at beginning or end + */ + void AddStaticItemL( CGlxMedia* aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ); + + /** + * Enables or disables static items + * @param aEnabled true if static items should be enabled + * false if static items should be disabled + */ + void SetStaticItemsEnabled( TBool aEnabled ); + + /** + * @return ETrue if static items are enabled + */ + TBool IsStaticItemsEnabled() const; + +public: // From MGlxItemListObserver + void HandleItemsAdded( TInt aFirstInsertedIndex, TInt aCount ); + void HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ); + +private: + /** Array that owns static media items */ + class RStaticMediaArray : public RArray< TGlxMedia > + { + public: + /** Destructor */ + ~RStaticMediaArray(); + /** + * Deletes an item at aIndex + * Does not remove the position in the array at index + * @param aIndex index at which to delete the item + */ + void Delete( TInt aIndex ); + }; + +private: + /** + * Constructor + * @param aObserver Observer to be notified + */ + CGlxStaticItemList( MGlxItemListObserver& aObserver ); + + /** + * Second-phase constructor + * @param aMediaUser User of media objects + * @param aIdSpaceId id of the "space" in which all item ids are unique + */ + void ConstructL( const TGlxIdSpaceId& aIdSpaceId, + MGlxMediaUser& aMediaUser ); + + /** @return Number of items in list */ + TInt CountAll() const; + + /** @return Number of static items in list */ + TInt CountStatic() const; + + /** @return Number of non static items */ + TInt CountNonStatic() const; + + /** @return Index of the first post static item */ + TInt FirstPostStaticIndex() const; + + /** + * Make static item ready to be added to the list + * @param aStaticItem Static item to be modified + */ + void SetupStaticItemL( CGlxMedia& aStaticItem ); + + /** + * Delete a static item + * @param aId Id of the static item to be deleted + */ + void DeleteStaticItem( const TGlxMediaId& aId ); + + /** + * Try to replace the static item. Replaces the static item + * only if it is found on the same position as to which the + * replacement is intended for + * @param aStaticItem Static item to replace with + * @param aTargetPosition Position into which to add the item + * @return ETrue if item was replaced, EFalse if not + */ + TBool TryReplaceStaticItem( CGlxMedia& aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ); + + /** + * Try to find the static item in the provided array, and if found, replace + * the item with the supplied one + * @param aStaticItem Static item to replace with + * @param aInArray Array in which to try to find the item + * @return ETrue if item was replaced, EFalse if not + */ + TBool TryReplaceStaticItem( CGlxMedia& aStaticItem, + RStaticMediaArray& aInArray ); + + /** + * Deletes a static item and notifies observer + * @param aId Id of the static item to delete + * @param aFromArray Array from which to try to find the static item + * @param aArrayOffset Index in the full list of the first + * item in aFromArray + * @param aCountCurrentStatic Reference to the member variable + * that stores the current count of the + * aFromArray + */ + void DeleteStaticItem( const TGlxMediaId& aId, + RStaticMediaArray& aFromArray, TInt aArrayOffset, + TInt& aCountCurrentStatic ); + + /** + * Add a static item. Assumes reservation has been made on both front and + * rear static item array, and hence will never leave + * @param aStaticItem Static item to be added + * @param aTargetPosition Whether to be added at beginning or end + */ + void AddStaticItem( CGlxMedia& aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ); + + /** + * Add static item to the beginning of the list. Assumes reservation has + * been made on the front static item array, and hence will never leave + * @param aStaticItem Static item to add. + * Takes ownership + */ + void AddFrontStaticItem( CGlxMedia& aStaticItem ); + + /** + * Add static item to the end of the list. Assumes reservation has been + * made on the rear static item array, and hence will never leave. + * @param aStaticItem Static item to add. + * Takes ownership + */ + void AddRearStaticItem( CGlxMedia& aStaticItem ); + + /** Enable front static items and notify observer of additions */ + void EnableFrontStaticItems(); + /** Enable rear static items and notify observer of additions */ + void EnableRearStaticItems(); + + /** Disable front static items and notify observer of removals */ + void DisableFrontStaticItems(); + /** Disable rear static items and notify observer of removals */ + void DisableRearStaticItems(); + + /** + * @param aId Id of an item to find + * @param aInArray Array in which to find the item + * @return index of item with aId in aInArray or KErrNotFound + */ + TInt Index( const TGlxMediaId& aId, + const RStaticMediaArray& aInArray ) const; + +private: + /// Data model is organised as follows + /// (Static items are items that client, not server, supplied) + /// + /// Example: In a list of 2 front static items, 5 non-static items, 3 rear + /// static items + /// + /// Legend: + /// "S" static item + /// "i" non-static item + /// "|" Link (Pointer) + /// "O" (Static) media object (CGlxMedia) + /// "^" Position of index in relation to list + /// + /// Case: Static items enabled: # # + /// iItems: id + pointer to media object # SSiiiiiSSS # + /// # || ||| # (linked via pointer) + /// iFrontStaticItems: static media objects # OO ||| # + /// iRearStaticItems: static media objects # OOO # + /// # # + /// iFirstNonStaticIndex, static items enabled # ^ # (2) + /// iFirstRearStaticIndex, static items enabled # ^ # (7) + /// + /// Case: Static items disabled: # # + /// iItems: id + pointer to media object # iiiii # + /// # # + /// iFrontStaticItems: static media objects # OO # (not linked to iItems) + /// iRearStaticItems: static media objects # OOO # (not linked to iItems) + /// # # + /// iFirstNonStaticIndex # ^ # (0) + /// iFirstRearStaticIndex # ^ # (5) + + /// List of media items + CGlxItemList* iItemList; // own + + /// Array of command items before the server-originated media items + RStaticMediaArray iFrontStaticItems; // own + + /// Array of command items after the server-originated media items + RStaticMediaArray iRearStaticItems; // own + + /// Current count of front static items. Zero if static items + /// are disabled (or no front static items). + TInt iCountCurrentFrontStatic; + + /// Current count of front static items. Zero if static items + /// are disabled (or no front static items). + TInt iCountCurrentRearStatic; + + /// Info of whether static items are visible or hidden (outside this object) + TBool iStaticItemsEnabled; + + /// Observer for changes + MGlxItemListObserver& iObserver; + + __DECLARE_TEST; + }; + +#endif // __C_GLXSTATICITEMLIST_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxthumbnailcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxthumbnailcontext.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2008-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: Fetch context to retrieve thumbnails +* +*/ + + + + +#ifndef C_GLXTHUMBNAILCONTEXT_H +#define C_GLXTHUMBNAILCONTEXT_H + +#include +#include "mglxfetchcontext.h" +#include "glxmedialistiterator.h" +#include + +// Forward declarations + +class CGlxAttributeContext; +class CGlxDRMUtility; +class CGlxResolutionUtility; +class MGlxCache; +class MGlxMediaList; +class TGlxMedia; + +/** + * CGlxThumbnailContext + * + * Fetch context to retrieve thumbnails + * + * @lib glxmedialists.lib + */ +class CGlxThumbnailContext : public CBase, public MGlxFetchContext, + public MGlxResolutionChangeObserver + { +public: + /** + * Constructor + * @param aIterator Iterator that determines the order of thumbnail + * retrieval and for which items thumbnails are and are not retrieved + */ + IMPORT_C static CGlxThumbnailContext* NewL(MGlxMediaListIterator* aIterator); + + /** + * Constructor + * @param aIterator Iterator that determines the order of thumbnail + * retrieval and for which items thumbnails are and are not retrieved + */ + IMPORT_C CGlxThumbnailContext(MGlxMediaListIterator* aIterator); + IMPORT_C ~CGlxThumbnailContext(); + + /** + * Adds a fetch specification for an individual item + * @param aWidth the width of required bitmap. The context + * may retrieve first a thumbnail of difference size + * if it thinks it helps user experience. + * @param aHeight the width of required bitmap. + * @param aFocusOffset Delta to focus. 0 means focus. + */ + IMPORT_C void AddSpecForItemL(TInt aWidth, TInt aHeight, TInt aFocusOffset); + + /** + * Sets the default fetch specification. The context uses this + * for all items that do not have a specific spec added. + * @param aWidth the width of required bitmap. The context + * may retrieve first a thumbnail of difference size + * if it thinks it helps user experience. + * @param aHeight the heigth of required bitmap. + */ + IMPORT_C void SetDefaultSpec(TInt aWidth, TInt aHeight); + + /** + * Set whether only high quality thumbnails are wanted. + * @param aHighQualityOnly ETrue to skip fetching low quality thumbnails. + */ + IMPORT_C void SetHighQualityOnly( TBool aHighQualityOnly ); + +public: // From MGlxFetchContext + /// See @ref MGlxFetchContext::AttributeRequestL + TInt AttributeRequestL(const MGlxMediaList* aList, RArray& aItemIndices, + RArray& aAttributes, CMPXAttributeSpecs*& aDetailedSpecs) const; + + /// See @ref MGlxFetchContext::AllAttributesL + void AllAttributesL(const MGlxMediaList* aList, TInt aListIndex, + RArray& aAttributes) const; + + /// See @ref MGlxFetchContext::RequestCountL + TInt RequestCountL(const MGlxMediaList* aList) const; + +protected: + /** + * 2nd phase construction + */ + void ConstructL(); + +private: // From MGlxResolutionChangeObserver + void HandleResolutionChangedL(); + +private: + /** + * Select the best thumbnail for processing + * + * @param aList pointer to media list + * @param aError indication of any errors encountered when selecting item + */ + TInt SelectItemL(const MGlxMediaList* aList, TInt& aError) const; + + /** + * Calculates a score for thumbnail retrieval + * + * @param aIndexInList index of the item in the list + * @param aList pointer to media list + * @param aDistance Distance from highest priority index + * @param aError indication of any errors encountered when calculating score + * + * @returns a score of how important processing this item's + * thumbnail is. The higher, the more important. + */ + TUint GetThumbnailScoreL(TInt aIndexInList, const MGlxMediaList* aList, + TInt aDistance, TInt& aError) const; + + /** Item to specify what kind of thumbnail is needed */ + struct TFetchSpec + { + inline TFetchSpec() { iPossWidth = 0; iPossHeight = 0; }; + + /** Width of the thumbnail */ + TReal32 iPossWidth; + + /** Height of the thumbnail */ + TReal32 iPossHeight; + }; + + /** + * Item to specify what kind of thumbnail is needed + * for which item (compared to focus) + */ + struct TAssignedFetchSpec : public TFetchSpec + { + inline TAssignedFetchSpec() { iFocusOffset = 0; }; + + /** Compares two specs by focus offset. Used for RArray::Find() */ + static TBool Match( const TAssignedFetchSpec& aSpec1, + const TAssignedFetchSpec& aSpec2 ); + + /** Delta to focus. If zero, then focused item */ + TInt iFocusOffset; + }; + + /** + * Get the fetch spec to be used for a given media item. + * @param aListIndex Index of current item + * @param aList Pointer to media list + * @return Reference to fetch spec to use for the given item. + */ + const TFetchSpec& SpecForIndex(TInt aListIndex, + const MGlxMediaList* aList) const; + + /** + * Get the size in pixels for a fetch spec. + * @param aSpec Reference to fetch spec. + * @return Size in pixels for the current screen resolution. + */ + TSize SizeFromSpec( const TFetchSpec& aSpec ) const; + + /** + * Check whether a given item has any full thumbnail attributes. + * @param aItem Media item to check. + * @return ETrue if a full thumbnail attribute is present. + */ + TBool HasFullThumbnail( const TGlxMedia& aItem ) const; + + /** + * Check DRM status of item at given index. Updates the fetch spec + * for an item with invalid DRM + * @param aListIndex index of current item + * @param aList pointer to media list + * @param aSpec reference to fetch spec + * @return ETrue if the item at index is not protected or has valid rights + */ + TBool CheckDRMStatusL( TInt aListIndex, const MGlxMediaList* aList, + TSize& aSize ) const; + +private: + /** Specs applies to individual items */ + RArray iSpecs; + + /** Request spec that is applied to all other items than in iSpecs */ + TFetchSpec iDefaultSpec; + + /** Whether to skip fetching low quality thumbnails */ + TBool iHighQualityOnly; + + /** Iterator for traversing the list */ + MGlxMediaListIterator* iIterator; + + /** Cache manager interface (owned) */ + MGlxCache* iCache; + + /** Utility to translate between pixels and poss units */ + CGlxResolutionUtility* iResolutionUtility; + + /** DRM utility for checking rights */ + CGlxDRMUtility* iDrmUtility; + + /** Attribute context to fetch DRM attributes */ + CGlxAttributeContext* iDrmFetchContext; + + /** Size of the default spec */ + TSize iDefaultSpecSize; + }; + +/** + * CGlxDefaultAttributeContext + * + * Fetch context to retrieve MPX attributes starting from focus outward + * + * @lib glxmedialists.lib + */ +class CGlxDefaultThumbnailContext : public CGlxThumbnailContext + { +public: + IMPORT_C static CGlxDefaultThumbnailContext* NewL(); + IMPORT_C ~CGlxDefaultThumbnailContext(); + + /** + * Set the range offsets. These determine the outer limits + * of attributes to be retrieved, compared to current focus in + * the list + * If ranges not defined, retrieves the attributes for focused item only + */ + IMPORT_C void SetRangeOffsets(TInt aFrontOffset, TInt aRearOffset); + +private: + CGlxDefaultThumbnailContext(); + +private: + TGlxFromFocusOutwardIterator iFromFocusIterator; + }; + +#endif // C_GLXTHUMBNAILCONTEXT_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxthumbnailutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxthumbnailutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2008-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: Common utility for thumbnail attributes +* +*/ + + + + +#ifndef __GLXTHUMBNAILUTILITY_H__ +#define __GLXTHUMBNAILUTILITY_H__ + +#include + +// Forward declarations +class CGlxMedia; + +/** + * Common utility for thumbnail attributes + * + * @author Dan Rhodes + * @ingroup glx_media_lists + */ +NONSHARABLE_CLASS( GlxThumbnailUtility ) + { +public: + /** + * Find the closest available thumbnail to a given size for a media item. + * @param aDesiredSize Size of thumbnail required + * @param aMedia Media item whose attributes are to be searched + * @param aDrmValid If false, the function will not return a thumbnail + bigger than the requested size + * @return TInt Index of closest attribute, or KErrNotFound if none found + */ + IMPORT_C static TInt ClosestThumbnail( const TSize& aDesiredSize, + const CGlxMedia& aMedia, TBool aDrmValid ); + + /** + * Check from the attributes if there is a full thumbnail available . + * @param aAttr attribute to check + * @return ETrue if full thumbnail found, else EFalse + */ + IMPORT_C static TBool IsFullThumbnail(const TMPXAttribute& aAttr); + +private: + /** + * Determine if this attribute should be preferred to that already selected + * @param aThisDimen dimension describing this attribute + * @param aSelectedDimen dimension describing the attribute already selected + * @param aReqDimen the required dimension + * @param aQuality the quality of the bitmap of this attribute + * @param aSelectedQuality the quality of the bitmap of the attribute already selected + * @param aDrmValid EFalse for item which has invalid DRM rights + * @return ETrue if this attribute is preferred, else EFalse + */ + static TBool PreferThisAttribute( + TInt aThisDimen, TInt aSelectedDimen, TInt aReqDimen, + TInt aThisQuality, TInt aSelectedQuality, TBool aDrmValid ); + }; + +#endif // __GLXTHUMBNAILUTILITY_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/glxustringconverter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/glxustringconverter.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: UString converter implementation class that converts symbian data +* types to UString types +* +*/ + + + + +#ifndef GLXUSTRINGCONVERTER_H +#define GLXUSTRINGCONVERTER_H + +#include "glxmedia.h" + +namespace osncore + { + //template class AlfPtrVector; + class UString; + } +using namespace osncore; + +// ================================================ +// DO NOT USE THIS CLASS IF NOT GLXDATAPROVIDER.DLL +// ================================================ +// +/** + * CGlxUStringConverter class that converts the symbian types to UString type + */ + +NONSHARABLE_CLASS(CGlxUStringConverter): public CBase +{ +public: + + /** + * Constructor + * @param aMedia The media object + */ + + CGlxUStringConverter(); + + /** + * Two phase construction + * @param aMedia The media object + */ + IMPORT_C static CGlxUStringConverter* NewL(); + + /** + * Two phase construction + * @param aMedia The media object + */ + static CGlxUStringConverter* NewLC(); + + /** + * The function that converts symbian types to UString + * @param aMedia The media object + * @param aAttribute The attribute used to extract the data to be converted + * @param aFormatString Holds the information regarding the format in which data + * should be. + */ + IMPORT_C void AsStringL(const TGlxMedia& aMedia, const TMPXAttribute& aAttribute, TInt aFormatString, HBufC*& aString ) const; + +private: + + ~CGlxUStringConverter(); + + /** + * Returns the item size in the required format + */ + void GetFormattedItemSizeL(const CGlxMedia& media, HBufC*& aString) const; + + /** + * Returns the item location in the required format + * @param aCoordinate holds the coordinate information + */ + void GetFormatLocationL( const TCoordinate& aCoordinate, HBufC*& aString )const; + + /** + * Returns the item duration in the required format + * @param aDuration holds the duration information + */ + void GetFormattedDurationL( const TReal& aDuration, HBufC*& aString ) const; + + /** + * Returns the item resolution in the required format + * @param aSize holds the resolution size information + */ + void GetFormatResolutionL( const TSize& aSize, HBufC*& aString ) const; + +private: + + +}; + +#endif //GLXUSTRINGCONVERTER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxcache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxcache.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2008-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: Interface to media item cache +* +*/ + + + + +#ifndef M_GLXCACHE_H +#define M_GLXCACHE_H + +class CGlxMedia; +class MGlxCacheObserver; + +#include "glxmediaid.h" + +/** + * MGlxCache + * + * External interface to the media item cache + * + * @lib glxmedialists.lib + */ +class MGlxCache + { +public: + /** + * Return a reference-counted instance of MGlxCache. User MUST Close() this when finished with it. + * @return Singleton cache object + */ + IMPORT_C static MGlxCache* InstanceL(); + + /** + * Finds a media item based on id-space and media id + * @param aIdSpaceId The id space of the media item + * @param aMediaId The id of the media item + * @return The media item, if found; NULL if not + */ + virtual CGlxMedia* Media(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aMediaId) const = 0; + + /** + * Add a cache observer + * @param aObserver The observer to add + */ + virtual void AddObserverL(MGlxCacheObserver* aObserver) = 0; + + /** + * Remove a cache observer + * @param aObserver The observer to remove + */ + virtual void RemoveObserver(MGlxCacheObserver* aObserver) = 0; + + /** + * Begin refreshing fetch contexts, if currently idle. + */ + virtual void RefreshL() = 0; + + /** + * Close the MGlxCache object. This MUST be called when the client has finished using it + */ + virtual void Close() = 0; + + //OOM + /** + * ReleaseRAM on request + */ + virtual void ReleaseRAML(TBool aFlushOnRequest = EFalse) = 0; + /** + * Stop RAM realease. + */ + virtual void StopRAMReleaseL() = 0; + //OOM + + /** + * Cleanup Container Cache + */ + virtual void ForceCleanupMedia(TGlxIdSpaceId aSpaceId,TGlxMediaId aId)=0; + }; + +#endif // M_GLXCACHE_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxcacheobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxcacheobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2008-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: Media item cache observer interface +* +*/ + + + + +#ifndef M_GLXCACHEOBSERVER_H +#define M_GLXCACHEOBSERVER_H + +#include +#include "glxmediaid.h" + +class CGlxMedia; + +/** + * MGlxCacheObserver + * + * Media item cache observer interface + * + * @lib glxmedialists.lib + */ +class MGlxCacheObserver + { +public: + /** + * Called when new attributes for a media item are available + * @param aIdSpaceId The Id Space of the item + * @param aMediaId The media id of the item + * @param aAttributes The new attributes + * @param aMedia The media item + */ + virtual void HandleAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId, + const RArray& aAttributes, + const CGlxMedia* aMedia) = 0; + + /** + * Called when a media item needs to be deleted + * @param aMediaId The media id of the item to be deleted + */ + virtual void CleanupMedia(const TGlxMediaId& aMediaId) = 0; + }; + +#endif // M_GLXCACHEOBSERVER_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxfetchcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxfetchcontext.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2008-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: Media and attribute fetch context +* +*/ + + + + +#ifndef M_GLXFETCHCONTEXT_H +#define M_GLXFETCHCONTEXT_H + +#include +#include "glxmediaid.h" + +#include + +class MGlxMediaList; +class TMPXAttribute; + +/** + * MGlxFetchContext + * + * Interface that allows clients to define which media items should be + * retrieved and which properties for them + * + * @lib none + */ +class MGlxFetchContext + { +public: + /** + * Specifies which attributes should be fetched for a particular item + * in the list. + * @param aList the list for which the request relates to + * @return in aItemIndices the list indices for which the attributes should be requested for + * if no items requiring attributes, returns an empty array. + * Caller should make sure the array is empty before calling. + * @return in aAttributes the attributes that should be retrieved + * @return in aDetailedSpecs a new detailed specification object + * regarding the attributes or NULL. Caller must set the + * parameter to NULL. + * @return TInt number of items with outstanding requests. + * KErrGeneral if there are no more requests but there are outstanding errors. + */ + virtual TInt AttributeRequestL(const MGlxMediaList* aList, RArray& aItemIndices, + RArray& aAttributes, CMPXAttributeSpecs*& aDetailedSpecs) const = 0; + + /** + * Lists all attributes that a required for a particular item in the list. + * Ignores whether the attributes have been loaded or not. This function + * is used for garbage collection, in order to know if an attribute is + * still in use. + * @param aList the list for which the call relates to + * @param aListIndex the index in the list of the particular item + * @return in aAttributes all attributes that this context requires. + * if no attributes are required, returns the array as empty. + * Caller must make sure the array is empty before calling. + */ + virtual void AllAttributesL(const MGlxMediaList* aList, TInt aListIndex, + RArray& aAttributes) const = 0; + + /** + * Provides the number of items with currently outstanding requests + * + * @param aList the list for which the call relates to + * @return TInt number of items with outstanding requests. + * KErrGeneral if there are no more requests but there are outstanding errors. + */ + virtual TInt RequestCountL(const MGlxMediaList* aList) const = 0; + }; + +#endif // M_GLXFETCHCONTEXT_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxitemlistobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxitemlistobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008-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: Observer of list of media items +* +*/ + + + + +#ifndef __M_GLXITEMLISTOBSERVER_H__ +#define __M_GLXITEMLISTOBSERVER_H__ + +#include + +/** + * Observer for item list + * + * @author Aki Vanhatalo + * + * @internal reviewed 17/07/2007 by Kimmo Hoikka + * + * @ingroup mlm_media_list_manager_design + */ +class MGlxItemListObserver + { +public: + /** + * Notification of item addition + * @param aAddedAtIndex Index at which items were added + * @param aCount count of items that were added + */ + virtual void HandleItemsAdded( TInt aAddedAtIndex, TInt aCount ) = 0; + + /** + * Notification of item removal + * @param aRemovedFromIndex Index at which items were added + * @param aCount count of items that were added + */ + virtual void HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ) = 0; + }; + +#endif // __M_GLXITEMLISTOBSERVER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxmedialist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxmedialist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,329 @@ +/* +* Copyright (c) 2008-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: Reader interface of media item lists +* +*/ + + + + +#ifndef M_GLXMEDIALIST_H +#define M_GLXMEDIALIST_H + +#include +#include +#include + +#include +#include + +#include "glxmedia.h" // For TGlxMediaId +#include "glxmedialistid.h" + +// Forward declarations +class MMPXCollection; +class MGlxMediaListObserver; +class MGlxFetchContext; + +/** + * MGlxMediaList + * + * Interface for reading lists of media items + * + * @lib glxmedialists.lib + */ +class MGlxMediaList + { +public: + /** + * Returns a new/existing media list interface. + * + * Returns an existing instance if and only if the hierarchy id and path + * are the same. Otherwise a new instance is returned + * + * Filter is only used when a new media list is created, otherwise it + * is ignored. + * + * The new/existing media list is set as highest priority list + * + * @param aPath Path to the collection + * @param aHierarchyId Id of the client hierarchy + * @param aFilter Filter on the collection + * @return Media list interface (does not pass ownership) + */ + IMPORT_C static MGlxMediaList* InstanceL(const CMPXCollectionPath& aPath, + const TGlxHierarchyId& aHierarchyId = KGlxIdNone, CMPXFilter* aFilter = NULL); + + /** + * Releases a media list interface + */ + virtual void Close() = 0; + + /** + * Id of this reader interface. The id of each _existing_ reader interface + * is guaranteed to be unique, but new readers can reuse the ids of deleted + * ones. + * + * @return Unique id of this interface + */ + virtual TGlxMediaListId Id() const = 0; + + /** + * Count of media items in the list + * + * @return Count of media items + */ + virtual TInt Count(NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll) const = 0; + + /** + * Current focus position + * + * @return Index of focused item + */ + virtual TInt FocusIndex() const = 0; + + /** + * Sets the focus. + * The implementation of this function is required to call + * MGlxMediaListObserver::HandleFocusChangedL for all added + * observers. Calling this function will cause the item window + * to be updated and potentially properties and thumbnails + * to be loaded. + * + * @param aType whether the focus change is absolute or relative + * @param aValue value of the focus change + */ + virtual void SetFocusL(NGlxListDefs::TFocusSetType aType, TInt aValue) = 0; + + /** + * Media item at index. + * It is not legal to access items outside the preload + * (or visible) range. + * + * @param aIndex index of the item in the list + * @return Media item pointer + */ + virtual const TGlxMedia& Item(TInt aIndex) const = 0; + + /** + * Item index by media item id + * If the item is not within the preload (or visible) range + * returns KErrNotFound. The item may still exist in the full + * list. This behavior can be changed, if there is a use case. + * + * @param aId Unique id of the media item + * @return Index of the item in the list or KErrNotFound + */ + virtual TInt Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId) const = 0; + + /** + * Add an observer that observes changes to the list. + * This observer will be informed whenever the items in the list + * change, more items get added, or items get deleted, or the + * focus changes. + * + * @param aObserver The observer + */ + virtual void AddMediaListObserverL(MGlxMediaListObserver* aObserver) = 0; + + /** + * Removes a media item list observer from the observer list + * + * @param aObserver The observer + */ + virtual void RemoveMediaListObserver(MGlxMediaListObserver* aObserver) = 0; + + /** + * Registers a context that affects the behavior of attribute and thumbnail loading. + * @param aContext context to register + * @param aPriority priority of the context. The higher the more important. + */ + virtual void AddContextL(const MGlxFetchContext* aContext, TInt aPriority) = 0; + + /** + * Removes an existing context + * + * @param aContext Pointer of the context to be removed + */ + virtual void RemoveContext(const MGlxFetchContext* aContext) = 0; + + /** + * Sets the specified contexts as highest priority contexts. Other + * contexts will retain their relative priority order, but will have + * less priority than the specified contexts. + * + * @param aContextIds Ids of the contexts to be set as highest priority. + * Id at index 0 in the array is set to be the highest priority, + * Id at index 1, the second highest, etc. + */ +// virtual void SetContextAsHighestPriority(RArray aContextIds) = 0; + + /** + * @returns the MPX collection utility that is bound to this list + */ + virtual MMPXCollection& Collection() const = 0; + + /** + * Current path, including selection. Ownership passed to caller. + * + * @return CMPXCollectionPath* representing current path + */ + virtual CMPXCollectionPath* PathLC(NGlxListDefs::TPathType aType = NGlxListDefs::EPathAllOrSelection) const = 0; + + /** + * Determines if an item has been selected + * + * @param aIndex Index of the item to be checked for selection + * @return Boolean indication of the item selection + */ + virtual TBool IsSelected(TInt aIndex) const = 0; + + /** + * Item selection/deselection + * + * @param aIndex Index of the item to be selected/deselected + * @param aSelected Boolean to indicate selection/deselection + */ + virtual void SetSelectedL(TInt aIndex, TBool aSelected) = 0; + + /** + * Selection count + * + * @return TInt count of selected items + */ + virtual TInt SelectionCount() const = 0; + + /** + * Selected item index from selection + * + * @param aSelectionIndex Index in selection array + * @return TInt item index from selection + */ + virtual TInt SelectedItemIndex(TInt aSelectionIndex) const = 0; + + /** + * Sends a command to the collection + * + * @param aCommand MPX command from a command handler + */ + virtual void CommandL(CMPXCommand& aCommand) = 0; + + /** + * Cancels a command on the collection + */ + virtual void CancelCommand() = 0; + + /** + * Sets a filter on the collection. The filter will replace any existing + * filter applied on the collection. If a client needs an aggregate filter, + * they will need to obtain the currently applied filter using Filter() and + * merge the filters + * + * @param aFilter MPX filter on the collection. Ownership passed to media list + */ + virtual void SetFilterL(CMPXFilter* aFilter) = 0; + + /** + * Filter on the collection + * + * @return CMPXFilter on the collection + */ + virtual CMPXFilter* Filter() const = 0; + + /** + * The Id Space Id of the media list. + * + * @param aIndex index of the item in the list + * @return The Id Space of the media list + */ + virtual TGlxIdSpaceId IdSpaceId(TInt aIndex) const = 0; + + /** + * Returns ETrue if the media list has been + * populated else EFalse + */ + virtual TBool IsPopulated() const = 0; + + /** + * Adds a static item and takes ownership + * Note: In case of a leave, aStaticItem may have been modified. + * It is assumed that since ownership of the static item is passed, + * the object is free to be modified. + * @param aStaticItem Static item to be added + * @param aTargetPosition Whether to be added at beginning or end + */ + virtual void AddStaticItemL( CGlxMedia* aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ) = 0; + + /** + * Remove static item from the list. + * @param aItemId Id of item to remove + */ + virtual void RemoveStaticItem(const TGlxMediaId& aItemId) = 0; + + /** + * Enables or disables static items + * @param aEnabled true if static items should be enabled + * false if static items should be disabled + */ + virtual void SetStaticItemsEnabled( TBool aEnabled ) = 0; + + /** + * Tests if static items are enabled. + * @return ETrue if static items are enabled + */ + virtual TBool IsStaticItemsEnabled() const = 0; + + /** + * Sets the initial focus position, first or last item + * @param aFocusInitialPosition initial focus on first or last item + */ + virtual void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition) = 0; + + /** + * Resets the focus to the initial position + */ + virtual void ResetFocus() = 0; + + /** + * Unmarks all items in the medialist. + * @param aList Reference to Medialist items. + */ + IMPORT_C static void UnmarkAllL( MGlxMediaList& aList ); + + /** + * Sets the dataWindow position. + * The implementation of this function is required for the + * item window to be updated while blocky iterator is used + * and potentially properties and thumbnails to be loaded. + * + * @param aIndex value of the dataWindow change + */ + virtual void SetVisibleWindowIndexL( TInt aIndex) = 0; + + /** + * Current visible dataWindow position + */ + virtual TInt VisibleWindowIndex() const = 0; + + virtual ~MGlxMediaList() {}; + + /** + * Cancel the pending requests + */ + virtual void CancelPreviousRequests() = 0; + }; + +#endif // M_GLXMEDIALIST_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxmedialistobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxmedialistobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2008-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: Media item list observer interface +* +*/ + + + + +#ifndef M_GLXMEDIALISTOBSERVER_H +#define M_GLXMEDIALISTOBSERVER_H + +#include +#include +#include +#include + +#include "glxthumbnailinfo.h" + +// Forward declaration +class MGlxMediaList; + +/*! + @class MGlxMediaListObserver + + @discussion Observes for changes in media list + MPX-specific + */ +class MGlxMediaListObserver + { +public: + + /** + * Notification that media items were added to the list + * + * @param aStartIndex First item that was added (inserted) + * @param aEndIndex Last item that was added (inserted) + * @param aList List that this callback relates to + */ + virtual void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList) = 0; + + /** + * Notification that media object is now available for an item + * + * @param Index of the item + * @param aList List that this callback relates to + */ + virtual void HandleMediaL(TInt aListIndex, MGlxMediaList* aList) = 0; + + /** + * Notification that media items were removed from the list + * + * @param aStartIndex First item that was removed + * @param aEndIndex Last item that was removed + * @param aList List that this callback relates to + */ + virtual void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList) = 0; + + /** + * Notification that media items were changed + * + * @param aItemIndexes Indexes of items that were changed + * @param aList List that this callback relates to + */ + virtual void HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* aList) = 0; + + /** + * Notification that attributes are available + * + * @param aItemIndex Index of the item for which attributes are available + * @param aAttributes Array of attributes that have become available + * @param aList List that this callback relates to + */ + virtual void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, + MGlxMediaList* aList) = 0; + + /** + * Notification that focus has moved + * + * @param aType the direction of the focus change + * @param aNewIndex the new index after the focus change + * @param aOldIndex the old index before the focus change + * @param aList List that this callback relates to + */ + virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, + MGlxMediaList* aList) = 0; + + /** + * Notification that an item has been selected/deselected + * + * @param aIndex Index of the item that has been selected/deselected + * @param aSelected Boolean to indicate selection/deselection + * @param aList List that the selection relates to + */ + virtual void HandleItemSelectedL(TInt aIndex, TBool aSelected, + MGlxMediaList* aList) = 0; + + /** + * Notification from the collection + * E.g. Items added/modified/deleted and progress notifications + * + * @param aMessage Message notification from the collection + * @param aList List that the notification relates to + */ + virtual void HandleMessageL(const CMPXMessage& aMessage, + MGlxMediaList* aList) = 0; + + /** + * Notification of an error from the collection + * + * @param aError Error code + */ + virtual void HandleError(TInt aError) { (void)aError; }; + + /** + * Handle completion of a asynchronous command + * @todo: All clients should implement this callback + * + * @param aSessionId session id of the client that issued the command + * @param aCommandResult result of the command, NULL if error + * @param aError error code + * @param aList List that the notification relates to + */ + virtual void HandleCommandCompleteL(TAny* /*aSessionId*/, + CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, + MGlxMediaList* /*aList*/) {}; + + /** + * Handle media list population. + * + * @param aList List that the notification relates to + */ + virtual void HandlePopulatedL(MGlxMediaList* /*aList*/) {}; + }; + +#endif // M_GLXMEDIALISTOBSERVER_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxmediapool.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxmediapool.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2008-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: Media pool interface +* +*/ + + + + +#ifndef __M_GLXMEDIAPOOL_H__ +#define __M_GLXMEDIAPOOL_H__ + +#include + +#include "glxmediaid.h" + +class CGlxMedia; + +/** + * Interface to return media items + * @author Aki Vanhatalo + * + * @internal reviewed 17/07/2007 by Kimmo Hoikka + * + * @ingroup mlm_media_list_manager_design + */ +class MGlxMediaPool + { +public: + /** + * @param aIdSpaceId Id of Id space of aId + * @param aId Id of media object + * @return media object + */ + virtual CGlxMedia* Media( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aId ) const = 0; + }; + +#endif // __M_GLXMEDIAPOOL_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxmediauser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxmediauser.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-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: Media userinterface +* +*/ + + + + +#ifndef __M_GLXMEDIAUSER_H__ +#define __M_GLXMEDIAUSER_H__ + +#include + +#include + +#include "glxmediaid.h" + +class CGlxMedia; + +/** + * Interface for media object users + * @author Aki Vanhatalo + * + * @internal reviewed 17/07/2007 by Kimmo Hoikka + * + * @ingroup mlm_media_list_manager_design + */ +class MGlxMediaUser + { +public: + /** + * For a given item, get all the attributes that may be requested for it + * + * @param aIndex index in media list of item + * @param aAttributes Ordered list of attributes (ordered by AttributeOrder) + * @return aAttributes with any new attributes added + */ + virtual void GetRequiredAttributesL( TInt aIndex, RArray< TMPXAttribute >& aAttributes ) = 0; + + /** + * Called to notify the list that attributes for the item are available + * + * @param aIndex index in media list of item that has attributes available + * @param aAttributes list of attributes available + */ + virtual void HandleAttributesAvailableL( TInt aIndex, + const RArray< TMPXAttribute >& aAttributes ) = 0; + + /** + * Called to notify that the callee should remove all references to the + * media object (as it is about to be deleted) + * @param aIndex index in media list of item to which references should be removed + */ + virtual void RemoveReference( TInt aIndex ) = 0; + + /** + * Notify of error + * + * @param aError Error code + */ + virtual void HandleError( TInt aError ) = 0; + }; + +#endif // __M_GLXMEDIAUSER_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/inc/mglxnavigablelistobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/inc/mglxnavigablelistobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-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: Observer for navigable list +* +*/ + + + + +#ifndef __M_GLXNAVIGABLELISTOBSERVER_H__ +#define __M_GLXNAVIGABLELISTOBSERVER_H__ + +#include +#include "glxlistdefs.h" +#include "mglxitemlistobserver.h" + +/** + * Observer for navigable list + * + * @author Aki Vanhatalo + * + * @internal reviewed 17/07/2007 by Kimmo Hoikka + * + * @ingroup mlm_media_list_manager_design + */ +class MGlxNavigableListObserver : public MGlxItemListObserver + { +public: + /** + * Nofication of focus having been changed + * + * @param aType backward/forward/unknown + * @param aNewIndex New focus index + * @param aOldIndex Old focus index + */ + virtual void HandleFocusChanged( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex ) = 0; + + /** + * Notification that an item has been selected/deselected + * + * @param aIndex Index of the item that has been selected/deselected + * @param aSelected Boolean to indicate selection/deselection + */ + virtual void HandleItemSelected( TInt aIndex, TBool aSelected ) = 0; + }; + +#endif // __M_GLXNAVIGABLELISTOBSERVER_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxattributecontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxattributecontext.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,374 @@ +/* +* Copyright (c) 2008-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: Generic fetch context to retrieve attributes +* +*/ + +#include + +#include "glxattributecontext.h" +#include "mglxmedialist.h" +#include "glxerrormanager.h" +#include "glxtracer.h" +#include "glxlog.h" +#include "glxlistutils.h" + +// Default granularity of items to request for +const TUint KGlxAttributeContextDefaultGranularity = 200; + +const TInt KVisibleItemsCorrectionValue = 1; +const TInt KVisibleItemsModFactor = 2; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxAttributeContext::CGlxAttributeContext(MGlxMediaListIterator* aIterator) : + iIterator(aIterator), + iGranularity(KGlxAttributeContextDefaultGranularity) + { + TRACER("CGlxAttributeContext::Default Constructor"); + + __ASSERT_DEBUG(aIterator, Panic(EGlxPanicNullPointer)); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxAttributeContext::~CGlxAttributeContext() + { + TRACER("CGlxAttributeContext:: Destructor"); + + iAttributes.Close(); + } + +// ----------------------------------------------------------------------------- +// Adds an attribute to be retrieved for all items +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxAttributeContext::AddAttributeL(const TMPXAttribute& aAttribute) + { + TRACER("CGlxAttributeContext::AddAttributeL"); + + // Check that the attribute is not added twice + TIdentityRelation match (&TMPXAttribute::Match); + TInt index = iAttributes.Find(aAttribute, match); + + // Add the attribute + if (KErrNotFound == index) + { + iAttributes.AppendL(aAttribute); + } + } + +// ----------------------------------------------------------------------------- +// Removes an attribute from the "retrieval instructions" +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxAttributeContext::RemoveAttribute(const TMPXAttribute& aAttribute) + { + TRACER("CGlxAttributeContext::RemoveAttribute"); + + // Check that the attribute to be removed exists + TIdentityRelation match (&TMPXAttribute::Match); + TInt index = iAttributes.Find(aAttribute, match); + + // Remove the attribute + if (KErrNotFound != index) + { + iAttributes.Remove(index); + } + } + +// ----------------------------------------------------------------------------- +// CGlxDefaultAttributeContext::AttributeCount +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxAttributeContext::AttributeCount() + { + TRACER("CGlxAttributeContext::AttributeCount"); + + return iAttributes.Count(); + } + +// ----------------------------------------------------------------------------- +// Sets granularity of the item index array returned from AttributeRequestL +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxAttributeContext::SetGranularity(TUint aGranularity) + { + TRACER("CGlxAttributeContext::SetGranularity"); + + iGranularity = aGranularity; + } + +// ----------------------------------------------------------------------------- +// Get attributes request for an item +// From MGlxFetchContext +// ----------------------------------------------------------------------------- +// +TInt CGlxAttributeContext::AttributeRequestL(const MGlxMediaList* aList, + RArray& aItemIndices, RArray& aAttributes, + CMPXAttributeSpecs*& /*aDetailedSpecs*/) const + { + TRACER("CGlxAttributeContext::AttributeRequestL"); + + TInt itemCount = aList->Count(); + if (0 == itemCount || !iIterator) + { + return 0; + } + + // Check through the items in the order defined by the iterator + iIterator->SetToFirst(aList); + + // Loop until iterator does not give any more indexes or granularity reached + TInt index = KErrNotFound; + TInt error = KErrNone; + TBool firstItem = ETrue; + TInt defaultVisItems = GlxListUtils::VisibleItemsGranularityL(); + if (defaultVisItems%KVisibleItemsModFactor == 0) + { + defaultVisItems += KVisibleItemsCorrectionValue; + } + + while ((KErrNotFound != (index = (*iIterator)++)) && (aItemIndices.Count() < iGranularity) && (KErrNone == error)) + { + // Check if this item is lacking attributes + TBool attributesAdded = AddItemAttributesL(index, aList, aAttributes, error, firstItem); + if (attributesAdded) + { + aItemIndices.AppendL(index); + GLX_DEBUG3("CGlxAttributeContext::AttributeRequestL() index=%d, Media Id=%d", + index, aList->Item(index).Id().Value()); + firstItem = EFalse; + + // Fetch the visible items attrib first + if (aItemIndices[0] == (aList->VisibleWindowIndex()+ (defaultVisItems/2)) + && aItemIndices.Count() == defaultVisItems) + { + GLX_DEBUG1("Break to fetch the visible items attrib first"); + break; + } + } + else if ( firstItem && ( error != KErrNone ) ) + { + // Continue iterating through the list + // if the first item had errors + // See EMYP-79VDHP + error = KErrNone; + } + } + + // If an error was found, return KErrGeneral + if (error != KErrNone) + { + return KErrGeneral; + } + + GLX_DEBUG2("CGlxAttributeContext::AttributeRequestL() aItemIndices.Count()=%d", + aItemIndices.Count()); + return aItemIndices.Count(); + } + +// ----------------------------------------------------------------------------- +// Get all attributes required for the item (whether the are fetched or not) +// From MGlxFetchContext +// ----------------------------------------------------------------------------- +// +void CGlxAttributeContext::AllAttributesL(const MGlxMediaList* aList, TInt aListIndex, + RArray& aAttributes) const + { + TRACER("CGlxAttributeContext::AllAttributesL"); + + // An empty request makes no sense, but won't do any harm. + + // If no iterator, no request + if (!iIterator || !iAttributes.Count()) + { + return; + } + + // No requests outside range + iIterator->SetToFirst(aList); + if (!iIterator->InRange(aListIndex)) + { + return; + } + + // Just list all attributes specified for this context + TInt count = iAttributes.Count(); + for (TInt i = 0; i < count; i++) + { + aAttributes.AppendL(iAttributes[i]); + } + } + +// ----------------------------------------------------------------------------- +// Number of current requests +// From MGlxFetchContext +// ----------------------------------------------------------------------------- +TInt CGlxAttributeContext::RequestCountL(const MGlxMediaList* aList) const + { + TRACER("CGlxAttributeContext::RequestCountL"); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attrSpecs = NULL; + + TInt requestCount = AttributeRequestL(aList, itemIndices, attributes, attrSpecs); + + delete attrSpecs; + + CleanupStack::PopAndDestroy(&attributes); + CleanupStack::PopAndDestroy(&itemIndices); + + return requestCount; + } + +// ----------------------------------------------------------------------------- +// Check if the item at the index requires any attributes to be added to request +// ----------------------------------------------------------------------------- +TBool CGlxAttributeContext::AddItemAttributesL(TInt aIndexInList, + const MGlxMediaList* aList, RArray& aAttributes, + TInt& aError, TBool aFirstItem) const + { + TRACER("CGlxAttributeContext::AddItemAttributesL"); + + TInt attributesAdded = EFalse; + + const TGlxMedia& m = aList->Item(aIndexInList); + if (!m.IsStatic()) + { + const CGlxMedia* media = m.Properties(); + TInt attributeCount = iAttributes.Count(); + if (!media) + { + // There are no attributes for this item + // Add all attributes + for (TInt count = 0; count < attributeCount; ++count) + { + AddItemAttributeL(aAttributes, iAttributes[count]); + } + + if ( attributeCount > 0 ) + { + attributesAdded = ETrue; + } + } + else + { + if ( GlxErrorManager::HasError(media) ) + { + // Item has one or more errors on its attributes + // Check if we are going to try to add an attribute that may have an error on it + for (TInt count = 0; (count < attributeCount) && (KErrNone == aError); ++count) + { + aError = GlxErrorManager::HasAttributeErrorL(media, iAttributes[count]); + } + } + + // Always allow attribute adding if it's the first item + if ( KErrNone == aError || aFirstItem ) + { + // There may be some attributes for this item + // Add attributes that don't exist yet + for (TInt count = 0; count < attributeCount; ++count) + { + const TMPXAttribute& attribute = iAttributes[count]; + if (!media->IsSupported(attribute)) + { + if ( KErrNone == GlxErrorManager::HasAttributeErrorL(media, iAttributes[count]) ) + { + AddItemAttributeL(aAttributes, attribute); + attributesAdded = ETrue; + } + } + } + } + } + } + + return attributesAdded; + } + +// ----------------------------------------------------------------------------- +// Add attribute to array, no duplicates +// ----------------------------------------------------------------------------- +void CGlxAttributeContext::AddItemAttributeL(RArray& aAttributes, + const TMPXAttribute& aAttribute) const + { + TRACER("CGlxAttributeContext::AddItemAttributeL"); + + TIdentityRelation match(&TMPXAttribute::Match); + TInt index = aAttributes.Find(aAttribute, match); + + if (index == KErrNotFound) + { + aAttributes.AppendL(aAttribute); + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// CGlxDefaultAttributeContext +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// + +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxDefaultAttributeContext* CGlxDefaultAttributeContext::NewL() + { + TRACER("CGlxDefaultAttributeContext::NewL"); + + CGlxDefaultAttributeContext* obj = new (ELeave) CGlxDefaultAttributeContext(); + return obj; + } + +// ----------------------------------------------------------------------------- +// Constructor +// Sets the iterator of base class to be TGlxFromFocusOutwardIterator +// ----------------------------------------------------------------------------- +// +CGlxDefaultAttributeContext::CGlxDefaultAttributeContext() : + CGlxAttributeContext(&iFromFocusIterator) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxDefaultAttributeContext::~CGlxDefaultAttributeContext() + { + TRACER("CGlxDefaultAttributeContext::Destructor"); + + } + +// ---------------------------------------------------------------------------- +// Set range offsets +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDefaultAttributeContext::SetRangeOffsets(TInt aFrontOffset, TInt aRearOffset) + { + TRACER("CGlxDefaultAttributeContext::SetRangeOffsets"); + + iFromFocusIterator.SetRangeOffsets(aRearOffset, aFrontOffset); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxcache.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,501 @@ +/* +* Copyright (c) 2008-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: Cache implementation for media items sharing the same Id space +* +*/ + + + + +#include "glxcache.h" + +#include +#include // for DRM attributes +#include +#include +#include +#include +#include //for TCoordinate + +#include "glxcachemanager.h" +#include "glxmedialist.h" + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCache::CGlxCache( const TGlxIdSpaceId& aIdSpaceId, CGlxCacheManager* aCacheManager ) + : iIdSpaceId( aIdSpaceId ), iCacheManager(aCacheManager) + { + TRACER("CGlxCache::CGlxCache"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxCache::~CGlxCache() + { + TRACER("CGlxCache::Destructor"); + iItemPool.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// IdSpaceId +// ----------------------------------------------------------------------------- +// +TGlxIdSpaceId CGlxCache::IdSpaceId() const + { + TRACER("CGlxCache::IdSpaceId"); + + return iIdSpaceId; + } + +// ----------------------------------------------------------------------------- +// return a media object or null +// ----------------------------------------------------------------------------- +// +CGlxMedia* CGlxCache::Media( const TGlxMediaId& aId ) const + { + TRACER("CGlxCache::Media"); + + TInt index = iItemPool.FindInOrder(aId, (&MediaItemOrderByKey)); + if ( KErrNotFound != index ) + { + return iItemPool[index]; + } + + return NULL; + } + +// ----------------------------------------------------------------------------- +// FindItemForceCreateL +// ----------------------------------------------------------------------------- +// +CGlxMedia* CGlxCache::FindItemForceCreateL( const TGlxMediaId& aId ) + { + TRACER("CGlxCache::FindItemForceCreateL"); + + CGlxMedia* media = Media( aId ); + + if ( !media ) + { + media = CreateItemL( aId ); + } + + return media; + } + +// ----------------------------------------------------------------------------- +// CreateItemL +// ----------------------------------------------------------------------------- +// +CGlxMedia* CGlxCache::CreateItemL(const TGlxMediaId& aId) + { + TRACER("CGlxCache::CreateItemL"); + + CGlxMedia* item = NULL; + + iItemPool.ReserveL( iItemPool.Count() + 1 ); + item = new (ELeave) CGlxMedia(aId); + TLinearOrder orderer (&MediaItemOrderById); + iItemPool.InsertInOrder(item, orderer); + + // Safe to fail, since if the media objects is not used by any lists, + // garbage collection will simply delete it + RPointerArray& mediaLists = CGlxMediaList::MediaListsL(); + + TInt count = mediaLists.Count(); + item->ReserveUsersL(count); + for (TInt i = 0; i < count; i++) + { + mediaLists[i]->OfferMedia(iIdSpaceId, item); + } + + return item; + } + +// ----------------------------------------------------------------------------- +// MediaUpdatedL +// ----------------------------------------------------------------------------- +// +void CGlxCache::MediaUpdatedL(const CMPXMedia& aMedia) + { + TRACER("CGlxCache::MediaUpdatedL"); + + if (aMedia.IsSupported(KMPXMediaArrayContents)) + { + CMPXMediaArray* mediaArray = aMedia.ValueCObjectL(KMPXMediaArrayContents); + CleanupStack::PushL(mediaArray); + + TInt arrayCount = mediaArray->Count(); + GLX_DEBUG2("CGlxCache::MediaUpdatedL() arrayCount=%d", arrayCount); + for (TInt count = 0; count < arrayCount; ++count) + { + UpdateMediaL(*((*mediaArray)[count])); + } + + CleanupStack::PopAndDestroy(mediaArray); + } + else + { + UpdateMediaL(aMedia); + } + } + +// ----------------------------------------------------------------------------- +// UpdateMediaL +// ----------------------------------------------------------------------------- +void CGlxCache::UpdateMediaL(const CMPXMedia& aMedia) + { + TRACER("CGlxCache::UpdateMediaL"); + + if ( !aMedia.IsSupported(KMPXMediaGeneralId) ) + { + return; + } + // Copy/synchronize attributes + TGlxMediaId id ((TUint32)aMedia.ValueTObjectL(KMPXMediaGeneralId)); + GLX_DEBUG2("CGlxCache::UpdateMediaL() id=%d", id.Value()); + CGlxMedia* item = Media( id ); + + RArray newAttributes; + CleanupClosePushL(newAttributes); + + if (item != NULL) + { + GLX_DEBUG2("MGallery - CGlxCacheManager::HandleCollectionMediaL() existing item for item id %d", id.Value()); + CopyNewAndModifiedL(*item, aMedia, newAttributes); + } + else + { + GLX_DEBUG2("MGallery - CGlxCacheManager::HandleCollectionMediaL() new item for item id %d", id.Value()); + + // This is a new item. Create a media object and offer it to all lists. + // If the item is no longer needed by any list, then this is ok, since + // garbage collection will delete the item + // Add in id order. + item = CreateItemL(id); + + CopyNewAndModifiedL(*item, aMedia, newAttributes); + } + + // Broadcast the new attributes to all observers of the item and the cache + if (newAttributes.Count() > 0) + { + TInt count = item->UserCount(); + for (TInt i = 0; i < count; i++) + { + item->User( i ).HandleAttributesAvailableL( item->IndexInUser( i ), newAttributes ); + } + + // Broadcast to cache observers + // iCacheManager->BroadcastAttributesAvailableL(iIdSpaceId, id, newAttributes, item); + } + + CleanupStack::PopAndDestroy(&newAttributes); + } +// ----------------------------------------------------------------------------- +// Deletes the media item +// ----------------------------------------------------------------------------- +void CGlxCache::CleanupMedia(const TGlxMediaId& aMediaId) + { + TRACER("CGlxCache::CleanupMedia"); + GLX_DEBUG2("CGlxCache::CleanupMedia - aMediaId = %d", aMediaId.Value()); + if(iCacheManager) + { + iCacheManager->CleanupMedia(aMediaId); + } + } + +// ----------------------------------------------------------------------------- +// Handles modifications of item in cache +// ----------------------------------------------------------------------------- +void CGlxCache::HandleItemModified(const TGlxMediaId& aId, const RArray& aAttributes) + { + TRACER("CGlxCache::HandleItemModified"); + + TInt index = iItemPool.FindInOrder(aId, (&MediaItemOrderByKey)); + if (index != KErrNotFound) + { + iItemPool[index]->HandleModified(aAttributes); + } + } + +// ----------------------------------------------------------------------------- +// Copies new and modified attributes from the provided media object +// ----------------------------------------------------------------------------- +// +void CGlxCache::CopyNewAndModifiedL(CGlxMedia& aTarget, const CMPXMedia& aSource, + RArray& aNewAttributes) + { + TRACER("CGlxCache::CopyNewAndModifiedL"); + + /// @todo This is all temporary until global chunk based CMPXMedia is available + TInt count = aSource.Count(); + GLX_DEBUG2("CGlxCache::CopyNewAndModifiedL() Attribs count=%d", count); + aNewAttributes.ReserveL( count ); + + for (TInt i = 0; i < count; i++) + { + const TMPXAttribute& attrib = aSource.Attribute(i); + + if (attrib == KMPXMediaGeneralId) + { + // Ignore id + __ASSERT_DEBUG((TUint32)aSource.ValueTObjectL(attrib) == aTarget.Id().Value(), + Panic(EGlxPanicIllegalArgument)); // aMedia relates to another media object than this + } + else + { + if (!aTarget.IsSupported(attrib)) + { + TMPXAttributeType type = aSource.Type(i); + + if (type == EMPXTypeText) + { + aTarget.SetTextValueL(attrib, aSource.ValueText(attrib)); + } + else if (type == EMPXTypeCObject) + { + if ( KGlxMediaIdThumbnail == attrib.ContentId() ) + { + // This is a thumbnail + CFbsBitmap* thumbnail = iCacheManager->TempThumbnail(); + + if ( thumbnail && iCacheManager->TempThumbnailId() == aTarget.Id() ) + { + // Add new thumbnail attribute + CGlxThumbnailAttribute* value = + aSource.ValueNoNewLCObjectL(attrib); + CleanupStack::PushL(value); + value->iBitmap = thumbnail; + GLX_DEBUG3("CGlxCache::CopyNewAndModifiedL() TN Attrib w(%d) h(%d)", + thumbnail->SizeInPixels().iWidth, thumbnail->SizeInPixels().iHeight); + iCacheManager->SetTempThumbnailToNull(); + aTarget.SetCObjectValueL(attrib, value); + CleanupStack::Pop(value); + } + } + else + { + __DEBUG_ONLY(Panic(EGlxPanicNotImplemented)); // Add support for the attribute here + } + } + else if (type == EMPXTypeTObject) + { + if (attrib == KMPXMediaGeneralThumbnail1) + { + // Old thumbnail attribute - ignore + } + else if (attrib == KMPXMediaGeneralDate) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KGlxMediaGeneralLastModifiedDate) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KMPXMediaGeneralSize) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KMPXMediaColDetailSpaceId) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KMPXMediaGeneralType) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KMPXMediaGeneralCategory) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KMPXMediaGeneralCount) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KGlxMediaGeneralDimensions) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KGlxMediaGeneralLocation) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KMPXMediaGeneralDuration) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KMPXMediaDrmProtected) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KGlxMediaGeneralDRMRightsValid) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KGlxMediaGeneralSystemItem) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if (attrib == KGlxMediaGeneralFramecount) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else if(attrib == KGlxMediaGeneralSlideshowableContent) + { + aTarget.SetTObjectValueL(attrib, aSource.ValueTObjectL(attrib)); + } + else + { + __DEBUG_ONLY(Panic(EGlxPanicNotImplemented)); // Add support for the attribute here + } + } + else + { + __DEBUG_ONLY(Panic(EGlxPanicNotImplemented)); + } + + aNewAttributes.AppendL(attrib); + } + } + } + } + +// ----------------------------------------------------------------------------- +// Delete +// ----------------------------------------------------------------------------- +// +void CGlxCache::Delete( TInt aIndex ) + { + TRACER("CGlxCache::Delete"); + + GLX_ASSERT_DEBUG( 0 <= aIndex && aIndex < iItemPool.Count(), + Panic(EGlxPanicIllegalArgument), "deleting attribute out of bounds"); + + CGlxMedia* media = iItemPool[aIndex]; + + // Cleanup the media from all users, example texture manager + CleanupMedia(media->Id()); + + GLX_DEBUG2("MGallery - CGlxCache::Delete() for item id %d", media->Id().Value()); + // notify users that the media object is about to be deleted. This allows + // users to remove their references + // (loop does not t iterate indexes, since the contents of the User array + // will change during calls to RemoveReferences, as users are removed) + + // safety check that RemoveReference actually removed the reference + __DEBUG_ONLY( TInt _maxLoopCount = 1000 ); + + while ( media->UserCount() > 0 ) + { + // The user must remove a reference and that will decrement the + // UserCount() + media->User( 0 ).RemoveReference( media->IndexInUser( 0 ) ); + + // protect against a bug that would cause hard-to-find infinite loop + __DEBUG_ONLY( _maxLoopCount-- ); + GLX_ASSERT_DEBUG( _maxLoopCount != 0, Panic( EGlxPanicLogicError ), + "infinite loop when removing a media object" ); + } + + delete media; + iItemPool.Remove( aIndex ); + } + +// ----------------------------------------------------------------------------- +// Reserve space for a number of users, for all items in the cache +// ----------------------------------------------------------------------------- +// +void CGlxCache::ReserveUsersL(TInt aCount) + { + TRACER("CGlxCache::ReserveUsersL"); + + TInt count = iItemPool.Count(); + for ( TInt i = 0; i < count ; ++i ) + { + iItemPool[i]->ReserveUsersL( aCount ); + } + } + +// ----------------------------------------------------------------------------- +// MediaItemOrderById +// ----------------------------------------------------------------------------- +// +TInt CGlxCache::MediaItemOrderById(const CGlxMedia& aItem1, const CGlxMedia& aItem2) + { + TRACER("CGlxCache::MediaItemOrderById"); + + // Cannot do aItem1.Id() - aItem2.Id(), since Id().Value() returns an unsigned value + TGlxMediaId id1 = aItem1.Id(); + return MediaItemOrderByKey( &id1, aItem2 ); + } + +// ----------------------------------------------------------------------------- +// MediaItemOrderByKey +// ----------------------------------------------------------------------------- +// +TInt CGlxCache::MediaItemOrderByKey(const TGlxMediaId* aMediaId, const CGlxMedia& aItem2) + { + TRACER("CGlxCache::MediaItemOrderByKey"); + + TGlxMediaId id2 = aItem2.Id(); + if (*aMediaId < id2) + { + return -1; + } + + if (*aMediaId > id2) + { + return 1; + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// Return count of media objects +// ----------------------------------------------------------------------------- +// +TInt CGlxCache::Count() + { + TRACER("CGlxCache::Count"); + + return iItemPool.Count(); + } + +// ----------------------------------------------------------------------------- +// Return media object by index +// ----------------------------------------------------------------------------- +// +CGlxMedia& CGlxCache::Media( TInt aIndex ) + { + TRACER("CGlxCache::Media"); + + return *iItemPool[aIndex]; + } + +// ----------------------------------------------------------------------------- +// Return media index +// ----------------------------------------------------------------------------- +// +TInt CGlxCache::FindMediaIndexInCache(TGlxMediaId aMediaId) + { + TRACER("CGlxCache::FindMediaIndexInCache"); + + return iItemPool.FindInOrder(aMediaId, (&MediaItemOrderByKey)); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxcachemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxcachemanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1381 @@ +/* +* Copyright (c) 2008-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: Manager of media item cache +* +*/ + + + + +#include "glxcachemanager.h" + +#include +#include +#include +#include +#include +#include + +#include "glxcache.h" +#include "glxerrormanager.h" +#include "glxgarbagecollector.h" +#include "glxmedialist.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef USE_S60_TNM +#include +const TInt KMaxGridThumbnailWidth = 200; +_LIT(KFileIdentifier, ":\\"); +#endif + +/// How long to wait before rechecking for cleared temporary errors +/// @todo Find optimal value for this +const TInt KGlxTemporaryErrorRecheckPeriodInSeconds = 5; + +const TInt KGlxLowerMemoryLimitForCleanUp = 15000000; +const TInt KGlxUpperMemoryLimitForCleanUp = 25000000; +const TInt KGlxNoOfPagesToFlushInCriticalLowMemory = 4; +// ----------------------------------------------------------------------------- +// InstanceL +// ----------------------------------------------------------------------------- +// +CGlxCacheManager* CGlxCacheManager::InstanceL() + { + TRACER("CGlxCacheManager::InstanceL"); + + return CGlxSingletonStore::InstanceL(&NewL); + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxCacheManager* CGlxCacheManager::NewL() + { + TRACER("CGlxCacheManager::NewL"); + + CGlxCacheManager* self = new( ELeave ) CGlxCacheManager(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::Close() + { + TRACER("CGlxCacheManager::Close"); + + CGlxSingletonStore::Close(this); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxCacheManager::CGlxCacheManager() + { + TRACER("CGlxCacheManager::Default Constructor"); + + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::ConstructL() + { + TRACER("CGlxCacheManager::ConstructL"); + + iGarbageCollector = CGlxGarbageCollector::NewL( iCaches ); + iTempErrorTimer = CPeriodic::NewL(CActive::EPriorityStandard); + iSchedulerWait = new (ELeave) CActiveSchedulerWait(); + iMaintainCacheCallback = new ( ELeave ) + CAsyncCallBack( TCallBack( MaintainCacheL, this ), CActive::EPriorityStandard ); + +#ifdef USE_S60_TNM + iTnEngine = CThumbnailManager::NewL( *this); + iTnEngine->SetDisplayModeL( EColor64K ); +#endif + iImageViewerInstance = CGlxImageViewerManager::InstanceL(); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxCacheManager::~CGlxCacheManager() + { + TRACER("CGlxCacheManager::Destructor"); + + delete iSchedulerWait; + iObserverList.ResetAndDestroy(); + iCaches.ResetAndDestroy(); + delete iTempThumbnail; + iRequestedItemIds.Reset(); + iRequestedAttrs.Reset(); + iRequestedItemIndexes.Reset(); + if(iReader) + { + delete iReader; + } + + delete iGarbageCollector; + + if (iTempErrorTimer) + { + iTempErrorTimer->Cancel(); + delete iTempErrorTimer; + } + +#ifdef USE_S60_TNM + GLX_DEBUG2("CGlxCacheManager::~CGlxCacheManager() TN Ids count()=%d", + iThumbnailRequestIds.Count()); + for (TInt i = 0; i < iThumbnailRequestIds.Count(); i++) + { + iTnEngine->CancelRequest(iThumbnailRequestIds[i].iId); + } + iThumbnailRequestIds.Reset(); + delete iTnEngine; + delete iMPXMedia; +#endif + + delete iMaintainCacheCallback; + if ( NULL != iImageViewerInstance) + { + iImageViewerInstance->DeleteInstance(); + } + } + +// ----------------------------------------------------------------------------- +// HandleWindowChangedL +// From MVieMediaItemListManager +// The list calls this function to hint the list manager, that the items +// the list contains might not all be loaded, and it would be nice if the list +// manager could load the missing items to the cache. +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::HandleWindowChangedL(CGlxMediaList* /*aList*/) + { + TRACER("CGlxCacheManager::HandleWindowChangedL"); + + GLX_LOG_INFO("---- MGallery - CGlxCacheManager::HandleWindowChangedL()---- "); + + iMaintainCacheCallback->CallBack(); + // Its Better if we are not Cleaning Cache here; Instaed Can Do inside MainTainCache + //MaintainCacheL(); + //iGarbageCollector->Cleanup(); + } + +// ----------------------------------------------------------------------------- +// CancelPreviousRequest +// This API cancels the pending attributes and thumbnail request +// when the media item in focus is NULL +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::CancelPreviousRequest() + { + TRACER("CGlxCacheManager::CancelPreviousRequest"); + + // iRequestOwner is NULL, if there are no pending attribute/thumbnail request + // If no pending request, do nothing, else cancel the the pending requests + if(iRequestOwner) + { + MMPXCollection& collection = iRequestOwner->Collection(); + // Cancel the pending attribute request + collection.CancelRequest(); + + GLX_DEBUG2("CGlxCacheManager::CancelPreviousRequest() iThumbnailRequestIds.Count() %d", iThumbnailRequestIds.Count()); + + // Check if any thumbnail requests are pending and cancel the requests. + for (TInt i = 0; i < iThumbnailRequestIds.Count(); i++) + { + iTnEngine->CancelRequest(iThumbnailRequestIds[i].iId); + } + iThumbnailRequestIds.Reset(); + iRequestOwner = NULL; + } + } + +// ----------------------------------------------------------------------------- +// HandleGarbageCollection +// Garbage Collection Quick or with Timer +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::HandleGarbageCollectionL(TBool aStart) + { + TRACER("CGlxCacheManager::HandleGarbageCollection"); + TInt freeMemory = 0; + + HAL::Get( HALData::EMemoryRAMFree, freeMemory ); + + if(aStart) + { + if(freeMemory < KGlxLowerMemoryLimitForCleanUp) + { + // 2 page - 30 Items for Flush + TInt count = 2; + if(freeMemory < (KGlxLowerMemoryLimitForCleanUp/2)) + { + // If Memory is below this limit it's ok i can wait for 60 items to clean-up + count = KGlxNoOfPagesToFlushInCriticalLowMemory; + } + // Cancel Clean-up before Flush Page; Clean-up will be starting just after Flush page + iGarbageCollector->CancelCleanup(); + iGarbageCollector->FlushPagesL(count); + iGarbageCollector->CleanupL(); + iCleanUpOnGoing = ETrue; // Clean up is Started now i can call CancelClean-up to Stop Clean Up + } + else if((freeMemory < KGlxUpperMemoryLimitForCleanUp) && !iCleanUpOnGoing) + { + iGarbageCollector->CleanupL(); + iCleanUpOnGoing = ETrue; // Clean up is Started now i can call CancelClean-up to Stop Clean Up + } + // This is Added to Keep Assure Clean-up is not going to Disturb normal Flow if there is Enough Memory + // We Remove this Code After Evaluation of Use of this Code + else if(iCleanUpOnGoing) + { + iGarbageCollector->CancelCleanup(); + iCleanUpOnGoing = EFalse; + } + + } + else if(freeMemory < KGlxLowerMemoryLimitForCleanUp) + { + // 2 page - 30 Items for Flush + TInt count = 2; + if(freeMemory < (KGlxLowerMemoryLimitForCleanUp/2)) + { + // If Memory is below this limit it's ok i can wait for 60 items to clean-up + count = KGlxNoOfPagesToFlushInCriticalLowMemory; + } + // Cancel Clean-up before Flush Page; Clean-up will be starting just after Flush page + iGarbageCollector->CancelCleanup(); + iGarbageCollector->FlushPagesL(count); + iGarbageCollector->CleanupL(); + iCleanUpOnGoing = ETrue; // Clean up is Started now i can call CancelClean-up to Stop Clean Up + } + else if(iCleanUpOnGoing) + { + iGarbageCollector->CancelCleanup(); + iCleanUpOnGoing = EFalse; + } + } + +// ----------------------------------------------------------------------------- +// Match +// return ETrue if path levels match +// ----------------------------------------------------------------------------- +// +TBool CGlxCacheManager::Match(const CMPXCollectionPath& aPath1, + const CMPXCollectionPath& aPath2) + { + TRACER("CGlxCacheManager::Match"); + + TInt levels1 = aPath1.Levels(); + TInt levels2 = aPath2.Levels(); + + // Paths must be as deep to match + if (levels1 != levels2) + { + return EFalse; + } + + // Check if all levels match + for (TInt i = 0; i < levels1; i++) + { + if (aPath1.Index(i) != aPath2.Index(i)) + { + return EFalse; + } + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// HandleCollectionMediaL +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::HandleCollectionMediaL(const TGlxIdSpaceId& aIdSpaceId, const CMPXMedia& aMedia, TInt aError) + { + TRACER("CGlxCacheManager::HandleCollectionMediaL"); + + iRequestOwner = NULL; + + if ( KErrNone == aError ) + { + // Update the cache + CGlxCache* cache = FindCacheForceCreateL(aIdSpaceId); + cache->MediaUpdatedL(aMedia); + } + else + { + RPointerArray< MGlxMediaUser > users; + CleanupClosePushL( users ); + + // Record the error on all requested attributes + TInt idCount = iRequestedItemIds.Count(); + + for( TInt idIndex = 0; idIndex < idCount; idIndex++ ) + { + CGlxMedia* item = MediaForceCreateL(aIdSpaceId, iRequestedItemIds[idIndex]); + GlxErrorManager::SetAttributeErrorL(item, iRequestedAttrs, aError); + + // Keep track of media lists to notify later + TInt userCount = item->UserCount(); + for ( TInt userIndex = 0; userIndex < userCount; userIndex++ ) + { + users.InsertInAddressOrder( &item->User( userIndex ) ); + } + } + + // Notify all affected users of error + TInt userCount = users.Count(); + for ( TInt i = 0; i < userCount; i++ ) + { + users[ i ]->HandleError( aError ); + } + + CleanupStack::PopAndDestroy( &users ); + } + + MaintainCacheL(); + } + +// ----------------------------------------------------------------------------- +// FindCacheForceCreateL +// ----------------------------------------------------------------------------- +// +CGlxCache* CGlxCacheManager::FindCacheForceCreateL(const TGlxIdSpaceId& aIdSpaceId) + { + TRACER("CGlxCacheManager::FindCacheForceCreateL"); + + CGlxCache* cache = NULL; + + // Look for existing cache + TInt index = iCaches.FindInOrder(aIdSpaceId, (&CacheOrderByKey)); + if ( KErrNotFound == index ) + { + // Not found: create one + TLinearOrder orderer (&CacheOrderById); + cache = new (ELeave) CGlxCache(aIdSpaceId, this); + + CleanupStack::PushL(cache); + iCaches.InsertInOrderL(cache, orderer); + CleanupStack::Pop(cache); + } + else + { + cache = iCaches[index]; + } + + return cache; + } + +// ----------------------------------------------------------------------------- +// Media +// ----------------------------------------------------------------------------- +// +CGlxMedia* CGlxCacheManager::Media( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId ) const + { + TRACER("CGlxCacheManager::Media"); + + // Look for the correct subcache + TInt index = iCaches.FindInOrder( aIdSpaceId, &CacheOrderByKey ); + + if ( KErrNotFound == index ) + { + // No caches exist with this space id + return NULL; + } + else + { + return iCaches[index]->Media( aMediaId ); + } + } + +// ----------------------------------------------------------------------------- +// MediaForceCreateL +// ----------------------------------------------------------------------------- +// +CGlxMedia* CGlxCacheManager::MediaForceCreateL(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aMediaId) + { + TRACER("CGlxCacheManager::MediaForceCreateL"); + + CGlxCache* cache = FindCacheForceCreateL(aIdSpaceId); + return cache->FindItemForceCreateL(aMediaId); + } + +// ----------------------------------------------------------------------------- +// AddObserverL +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::AddObserverL(MGlxCacheObserver* aObserver) + { + TRACER("CGlxCacheManager::AddObserverL"); + + if ( aObserver ) + { + if ( KErrNotFound == iObserverList.Find( aObserver )) + { + iObserverList.AppendL(aObserver); + } + } + } + +// ----------------------------------------------------------------------------- +// RemoveObserver +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::RemoveObserver(MGlxCacheObserver* aObserver) + { + TRACER("CGlxCacheManager::RemoveObserver"); + + if ( aObserver ) + { + TInt index = iObserverList.Find( aObserver ); + if ( KErrNotFound != index ) + { + iObserverList.Remove(index); + } + } + } + +// --------------------------------------------------------------------------- +// Refresh +// --------------------------------------------------------------------------- +// +void CGlxCacheManager::RefreshL() + { + TRACER("CGlxCacheManager::Refresh"); + + if ( !iRequestOwner ) + { + // Currently idle, so trigger timer immediately to begin refresh + iTempErrorTimer->Cancel(); + iTempErrorTimer->Start( 0, 0, + TCallBack( TempErrorTimerCallbackL, this ) ); + + HandleGarbageCollectionL(ETrue); // Clean-up is needed here; Considering Current Memory Condition + } + } + +// ----------------------------------------------------------------------------- +// MaintainCache +// ----------------------------------------------------------------------------- +// +TInt CGlxCacheManager::MaintainCacheL(TAny* aPtr) + { + TRACER("CGlxCacheManager::MaintainCache"); + + CGlxCacheManager* self + = reinterpret_cast( aPtr ); + self->MaintainCacheL(); + + // Clean-up is needed here; Considering Current Memory Condition + // For Every HandleWindowChangedL; We Should not do Clean-up + self->HandleGarbageCollectionL(ETrue); + return 0; + } + +// ----------------------------------------------------------------------------- +// MaintainCacheL +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::MaintainCacheL() + { + TRACER("CGlxCacheManager::MaintainCacheL"); + + // Handle lists in priority order: all data for the highest priority list + // is retrieved before the data for a lower priority list. NOTE: This + // may need to be changed, since it might not always lead to the best + // user experienced. (It may be sensible to retrieve item properties + // for a lower priority list before all thumbnails for a higher priority + // list, but this probably depends on the speed of the data sources. + // It might be wise to decouple the contexts from the media lists + + if (!iRequestOwner) + { + iTempError = EFalse; + iTempErrorTimer->Cancel(); + + RPointerArray& mediaLists = CGlxMediaList::MediaListsL(); + iRequestedItemIds.Reset(); + iRequestedAttrs.Reset(); + iRequestedItemIndexes.Reset(); + + TInt listCount = mediaLists.Count(); + + // Request attributes in the fetch contexts + for (TInt listIndex = 0; listIndex < listCount && !iRequestOwner; listIndex++) + { + CGlxMediaList* list = mediaLists[listIndex]; + + CMPXAttributeSpecs* attrSpecs = NULL; + + list->AttributeRequestL(iRequestedItemIndexes, iRequestedItemIds, iRequestedAttrs, attrSpecs ); + CleanupStack::PushL(attrSpecs); + + TInt itemIdsCount = iRequestedItemIds.Count(); + if (itemIdsCount > 0) + { + if (attrSpecs) + { + GLX_DEBUG2("CGlxCacheManager::MaintainCacheL() attrSpecs->Count() %d", attrSpecs->Count()); + } + + TGlxMediaId itemId = iRequestedItemIds[0]; + + CMPXCollectionPath* path = RequestAsPathLC( *list ); + + // Add request for id, if does not exist already. Id is used to + // identify which media object the attribute belongs to when + // it is returned + TIdentityRelation match (&TMPXAttribute::Match); + if (iRequestedAttrs.Find(KMPXMediaGeneralId, match) == KErrNotFound) + { + iRequestedAttrs.AppendL(KMPXMediaGeneralId); + } + + // Create the empty bitmap, if the request is for a bitmap + TIdentityRelation matchContent(&TMPXAttribute::MatchContentId); + TMPXAttribute tnAttr(KGlxMediaIdThumbnail, 0); + if (iRequestedAttrs.Find(tnAttr, matchContent) != KErrNotFound) + { +#ifdef USE_S60_TNM + if (iRequestedItemIndexes.Count()) + { + // Cancel Clean-up is needed here; + HandleGarbageCollectionL(EFalse); + + TSize tnSize; + const TMPXAttributeData sizeAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailSize }; + if (attrSpecs && attrSpecs->IsSupported(sizeAttrib)) + { + tnSize = attrSpecs->ValueTObjectL(sizeAttrib); + } + + const TGlxMedia& item = list->Item( iRequestedItemIndexes[0] ); + TBool priority = ETrue; + const TMPXAttributeData priorityAttrib = { KGlxMediaIdThumbnail , KGlxAttribSpecThumbnailQualityOverSpeed }; + if (attrSpecs && attrSpecs->IsSupported(priorityAttrib)) + { + priority = attrSpecs->ValueTObjectL(priorityAttrib); + } + + TGlxIdSpaceId spaceId = list->IdSpaceId(iRequestedItemIndexes[0]); +#ifdef MEDIA_ID_BASED_TN_FETCH_ENABLED + GLX_DEBUG2("CGlxCacheManager::MaintainCacheL() requesting TN attribute (Medialist) itemId %d", itemId.Value()); + if (item.Uri().Find(KFileIdentifier) != KErrNotFound || + item.Uri().Length() == 0 && itemId.Value()) +#else + GLX_DEBUG1("CGlxCacheManager::MaintainCacheL() requesting TN attribute (Medialist) Uri"); + if (item.Uri().Find(KFileIdentifier) != KErrNotFound) +#endif + { +#ifdef _DEBUG + iStartTime.HomeTime(); // Get home time +#endif + if (tnSize.iWidth < KMaxGridThumbnailWidth) + { + iTnEngine->SetFlagsL(CThumbnailManager::ECropToAspectRatio); + iTnEngine->SetThumbnailSizeL(EGridThumbnailSize); + GLX_DEBUG1("MaintainCacheL() - Fetch TN attrib - EGridThumbnailSize"); + } + else + { + iTnEngine->SetFlagsL(CThumbnailManager::EDefaultFlags); + iTnEngine->SetThumbnailSizeL(EFullScreenThumbnailSize); + GLX_DEBUG1("MaintainCacheL() - Fetch TN attrib - EFullScreenThumbnailSize"); + } + + if (priority) + { + iTnEngine->SetQualityPreferenceL(CThumbnailManager::EOptimizeForQuality); + GLX_DEBUG1("MaintainCacheL() - Fetch TN attrib - EOptimizeForQuality"); + } + else + { + iTnEngine->SetQualityPreferenceL(CThumbnailManager::EOptimizeForQualityWithPreview); + GLX_DEBUG1("MaintainCacheL() - Fetch TN attrib - EOptimizeForQualityWithPreview"); + } + + if (list->Collection().UidL().iUid == KGlxCollectionPluginImageViewerImplementationUid) + { + RDebug::Printf("void CGlxCacheManager::MaintainCacheL:ABC: IV TN"); + _LIT( KPrivateFolder, "\\Private\\" ); // Platsec private folder + TParsePtrC parse( item.Uri() ); + if( parse.PathPresent() && + parse.Path().Length() > KPrivateFolder().Length() && + parse.Path().Left( KPrivateFolder().Length() ).CompareF( KPrivateFolder ) == 0 ) + { + RDebug::Printf("void CGlxCacheManager::MaintainCacheL:ABC: In if"); + GLX_DEBUG1("KGlxCollectionPluginImageViewerImplementationUid - Fetch (Private) TN!"); + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(iImageViewerInstance->ImageFileHandle()); + iThumbnailRequestIds.AppendL(TLoadingTN(iTnEngine->GetThumbnailL(*source), spaceId, tnSize, itemId)); + CleanupStack::PopAndDestroy(); + + } + else + { + RDebug::Printf("void CGlxCacheManager::MaintainCacheL:ABC: In else"); + GLX_DEBUG1("KGlxCollectionPluginImageViewerImplementationUid - Fetch TN!"); + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(item.Uri(), 0); + iThumbnailRequestIds.AppendL(TLoadingTN(iTnEngine->GetThumbnailL(*source), spaceId, tnSize, itemId)); + CleanupStack::PopAndDestroy(); + } + } + else + { +#ifdef MEDIA_ID_BASED_TN_FETCH_ENABLED + iThumbnailRequestIds.AppendL(TLoadingTN(iTnEngine->GetThumbnailL(itemId.Value()), spaceId, tnSize, itemId)); +#else + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(item.Uri(), 0); + iThumbnailRequestIds.AppendL(TLoadingTN(iTnEngine->GetThumbnailL(*source), spaceId, tnSize, itemId)); + CleanupStack::PopAndDestroy(); +#endif + } + iThumbnailId = itemId; + } + else + { + delete iTempThumbnail; + iTempThumbnail = NULL; + iTempThumbnail = new (ELeave) CFbsBitmap; + User::LeaveIfError(iTempThumbnail->Create(TSize(), KGlxThumbnailDisplayMode)); + iThumbnailId = itemId; + GLX_DEBUG2("CGlxCacheManager::MaintainCacheL() requesting TN (DataSourceMde) attribute itemId %d", itemId.Value()); + + // Set bitmap handle in attribute spec + if (attrSpecs) + { + TMPXAttribute thHandleAttrSpec(KGlxMediaIdThumbnail, KGlxAttribSpecThumbnailBitmapHandle); + attrSpecs->SetTObjectValueL(thHandleAttrSpec, iTempThumbnail->Handle()); + } + + // Cancel Clean-up is needed here; + // This is Going to Highly Used Call + // Can Think about an Ulternative. + HandleGarbageCollectionL(EFalse); + + GLX_DEBUG3("MGallery - CGlxCacheManager::MaintainCacheL() requesting attribute for list %x and item %d", list, itemId.Value()); + + // Use list's isolated collection + MMPXCollection& collection = list->Collection(); + + // Issue the request + collection.MediaL(*path, iRequestedAttrs.Array(), attrSpecs); + } + } + } + else + { + GLX_DEBUG3("MGallery - CGlxCacheManager::MaintainCacheL() requesting attribute for list %x and item %d", list, itemId.Value()); + + // Use list's isolated collection + MMPXCollection& collection = list->Collection(); + if (collection.UidL().iUid == KGlxCollectionPluginImageViewerImplementationUid) + { + TInt mediaCnt = list->Count(); + + + + GLX_DEBUG3("Image Viewer Collection - Attrib population! mediaCnt=%d, Media Id=%d", + mediaCnt, itemId.Value()); + + delete iMPXMedia; + iMPXMedia = NULL; + + TFileName fileName; + fileName.Append(iImageViewerInstance->ImageUri()->Des()); + + iMPXMedia = CMPXMedia::NewL(); + if(!iReader) + { + iReader = CGlxImageReader::NewL(*this); + iSchedulerWait->Start(); + } + + for ( TInt i = 0; i < iRequestedAttrs.Count(); i++ ) + { + if ( iRequestedAttrs[i] == KMPXMediaGeneralId ) + { + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralId, + (TMPXItemId)itemId.Value()); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralType ) + { + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralCategory ) + { + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralUri ) + { + iMPXMedia->SetTextValueL(KMPXMediaGeneralUri, fileName); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralTitle ) + { + TParsePtrC parser(fileName); + iMPXMedia->SetTextValueL(KMPXMediaGeneralTitle, parser.Name()); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralDate ) + { + TTime time; + time.HomeTime(); + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralDate, time.Int64()); + } + else if ( iRequestedAttrs[i] == KGlxMediaGeneralLastModifiedDate ) + { + TTime time; + time.HomeTime(); + iMPXMedia->SetTObjectValueL(KGlxMediaGeneralLastModifiedDate, time.Int64()); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralSize ) + { + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralSize, 1000); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralDrive ) + { + TParsePtrC parser(fileName); + iMPXMedia->SetTextValueL(KMPXMediaGeneralDrive, parser.Drive()); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralMimeType ) + { + TDataType dataType; + GetMimeType(fileName, dataType); + iMPXMedia->SetTextValueL(KMPXMediaGeneralMimeType, dataType.Des()); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralDuration ) + { + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralDuration, 0); + } + else if ( iRequestedAttrs[i] == KGlxMediaGeneralSystemItem) + { + iMPXMedia->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + } + else if ( iRequestedAttrs[i] == KGlxMediaGeneralDimensions ) + { + //need to fetch the original file dimensions + TSize dimensions(iImgSz.iWidth,iImgSz.iHeight); + + iMPXMedia->SetTObjectValueL(KGlxMediaGeneralDimensions, dimensions); + } + else if ( iRequestedAttrs[i] == KGlxMediaGeneralFramecount ) + { + TInt fcount = 1; + iMPXMedia->SetTObjectValueL(KGlxMediaGeneralFramecount, fcount); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralComment ) + { + iMPXMedia->SetTextValueL(KMPXMediaGeneralComment, KNullDesC); + } + else if (iRequestedAttrs[i] == KMPXMediaDrmProtected ) + { + iMPXMedia->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + } + else if ( iRequestedAttrs[i] == KGlxMediaGeneralDRMRightsValid ) + { + iMPXMedia->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, + EGlxDrmRightsValidityUnknown); + } + else if ( iRequestedAttrs[i] == KMPXMediaGeneralCount ) + { + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralCount, 1); + } + else if ( iRequestedAttrs[i] == KMPXMediaColDetailSpaceId ) + { + TGlxIdSpaceId spaceId = list->IdSpaceId(iRequestedItemIndexes[0]); + iMPXMedia->SetTObjectValueL(KMPXMediaColDetailSpaceId, spaceId.Value()); + } + else if ( iRequestedAttrs[i] == KGlxMediaGeneralSlideshowableContent ) + { + iMPXMedia->SetTObjectValueL(KGlxMediaGeneralSlideshowableContent, -1); + } + else if ( iRequestedAttrs[i] == KGlxMediaGeneralLocation) + { + // Set the attribute to a TCoordinate initialised to NaN. + iMPXMedia->SetTObjectValueL(KGlxMediaGeneralLocation, TCoordinate()); + } + else + { + User::Leave(KErrNotSupported); + } + } + + HandleGarbageCollectionL(EFalse); + CleanupStack::PopAndDestroy(path); + iRequestOwner = list; + CleanupStack::PopAndDestroy(attrSpecs); + TGlxIdSpaceId spaceId = list->IdSpaceId(iRequestedItemIndexes[0]); + HandleCollectionMediaL(spaceId, *iMPXMedia, KErrNone); + return; + } + else + { + // Issue the request + collection.MediaL(*path, iRequestedAttrs.Array(), attrSpecs); + } + } +#else // USE_S60_TNM + delete iTempThumbnail; + iTempThumbnail = NULL; + iTempThumbnail = new (ELeave) CFbsBitmap; + User::LeaveIfError(iTempThumbnail->Create(TSize(), KGlxThumbnailDisplayMode)); + iThumbnailId = itemId; + + // Set bitmap handle in attribute spec + if (attrSpecs) + { + TMPXAttribute thHandleAttrSpec(KGlxMediaIdThumbnail, KGlxAttribSpecThumbnailBitmapHandle); + attrSpecs->SetTObjectValueL(thHandleAttrSpec, iTempThumbnail->Handle()); + } + // Cancel Clean-up is needed here; + // This is Going to Highly Used Call + // Can Think about an Ulternative. + HandleGarbageCollectionL(EFalse); + } + + GLX_DEBUG3("MGallery - CGlxCacheManager::MaintainCacheL() requesting attribute for list %x and item %d", list, itemId.Value()); + + // Use list's isolated collection + MMPXCollection& collection = list->Collection(); + + // Issue the request + collection.MediaL(*path, iRequestedAttrs.Array(), attrSpecs); +#endif + CleanupStack::PopAndDestroy(path); + + iRequestOwner = list; + } + + CleanupStack::PopAndDestroy(attrSpecs); + } + + if ( !iRequestOwner ) + { + if ( iTempError ) + { + // Reawaken in a while to check again + StartTempErrorTimer(); + } + } + } + } + +// ----------------------------------------------------------------------------- +// BroadcastAttributesAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::BroadcastAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId, + const RArray& aAttributes, + const CGlxMedia* aMedia) + { + TRACER("CGlxCacheManager::BroadcastAttributesAvailableL"); + + TInt count = iObserverList.Count(); + TInt i; + for ( i = 0; i < count; i++ ) + { + iObserverList[i]->HandleAttributesAvailableL(aIdSpaceId, aMediaId, aAttributes, aMedia); + } + } + +/** + * Cleanup the media of the given media id: broadcast this to all observers + * @param aMediaId The media id of the item + */ +void CGlxCacheManager::CleanupMedia(const TGlxMediaId& aMediaId) + { + TRACER("CGlxCacheManager::CleanupMedia"); + TInt count = iObserverList.Count(); + GLX_DEBUG2("CGlxCacheManager::CleanupMedia - aMediaId = %d", aMediaId.Value()); + TInt i; + for ( i = 0; i < count; i++ ) + { + iObserverList[i]->CleanupMedia(aMediaId); + } + } + +// ----------------------------------------------------------------------------- +// Handles modification of item in a cache +// ----------------------------------------------------------------------------- +void CGlxCacheManager::HandleItemModified(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aMediaId, const RArray& aAttributes) + { + TRACER("CGlxCacheManager::HandleItemModified"); + + // Look for the correct subcache + TInt index = iCaches.FindInOrder(aIdSpaceId, (&CacheOrderByKey)); + if (index != KErrNotFound) + { + iCaches[index]->HandleItemModified(aMediaId, aAttributes); + } + } + +// ----------------------------------------------------------------------------- +// CacheOrderById +// ----------------------------------------------------------------------------- +// +TInt CGlxCacheManager::CacheOrderById(const CGlxCache& aItem1, const CGlxCache& aItem2) + { + TRACER("CGlxCacheManager::CacheOrderById"); + + // Cannot do aItem1.IdSpaceId() - aItem2.IdSpaceId(), since IdSpaceId().Value() returns an unsigned value + TGlxIdSpaceId id1 = aItem1.IdSpaceId(); + TGlxIdSpaceId id2 = aItem2.IdSpaceId(); + if (id1 < id2) + { + return -1; + } + + if (id1 > id2) + { + return 1; + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// CacheOrderByKey +// ----------------------------------------------------------------------------- +// +TInt CGlxCacheManager::CacheOrderByKey(const TGlxIdSpaceId* aIdSpaceId, const CGlxCache& aItem2) + { + TRACER("CGlxCacheManager::CacheOrderByKey"); + + TGlxIdSpaceId id2 = aItem2.IdSpaceId(); + if (*aIdSpaceId < id2) + { + return -1; + } + + if (*aIdSpaceId > id2) + { + return 1; + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// TempThumbnail +// ----------------------------------------------------------------------------- +// +CFbsBitmap* CGlxCacheManager::TempThumbnail() + { + TRACER("CGlxCacheManager::TempThumbnail"); + + return iTempThumbnail; + } + +// ----------------------------------------------------------------------------- +// TempThumbnailId +// ----------------------------------------------------------------------------- +// +TGlxMediaId CGlxCacheManager::TempThumbnailId() + { + TRACER("CGlxCacheManager::TempThumbnailId"); + + return iThumbnailId; + } + +// ----------------------------------------------------------------------------- +// SetTempThumbnail +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::SetTempThumbnailToNull() + { + TRACER("CGlxCacheManager::SetTempThumbnailToNull"); + + iTempThumbnail = NULL; + } + +// ----------------------------------------------------------------------------- +// ErrorsOnRequestedItemsL +// ----------------------------------------------------------------------------- +// +TBool CGlxCacheManager::ErrorsOnRequestedItemsL() + { + TRACER("CGlxCacheManager::ErrorsOnRequestedItemsL"); + + TBool errorFound = EFalse; + + TInt itemCount = iRequestedItemIds.Count(); + TInt attrCount = iRequestedAttrs.Count(); + + for ( TInt itemIndex = 0; itemIndex < itemCount && !errorFound; itemIndex++ ) + { + CGlxMedia* media = Media(iRequestedItemsIdSpace, iRequestedItemIds[itemIndex]); + + if ( media ) + { + for ( TInt attrIndex = 0; attrIndex < attrCount && !errorFound; attrIndex++ ) + { + errorFound = (KErrNone != GlxErrorManager::HasAttributeErrorL(media, iRequestedAttrs[attrIndex])); + } + } + } + + return errorFound; + } + +// ----------------------------------------------------------------------------- +// Caches +// ----------------------------------------------------------------------------- +// +const RPointerArray& CGlxCacheManager::Caches() + { + TRACER("CGlxCacheManager::Caches"); + + return iCaches; + } + +// ----------------------------------------------------------------------------- +// SetTemporaryErrorFlag +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::SetTemporaryErrorFlag() + { + TRACER("CGlxCacheManager::SetTemporaryErrorFlag"); + + iTempError = ETrue; + } + +// ----------------------------------------------------------------------------- +// StartTempErrorTimer +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::StartTempErrorTimer() + { + TRACER("CGlxCacheManager::StartTempErrorTimer"); + + iTempErrorTimer->Cancel(); + iTempErrorTimer->Start( + TTimeIntervalMicroSeconds32(KGlxTemporaryErrorRecheckPeriodInSeconds * 1000000), + TTimeIntervalMicroSeconds32(KGlxTemporaryErrorRecheckPeriodInSeconds * 1000000), + TCallBack(&CGlxCacheManager::TempErrorTimerCallbackL,(TAny *)this)); + } + +// ----------------------------------------------------------------------------- +// TempErrorTimerCallbackL +// ----------------------------------------------------------------------------- +// +TInt CGlxCacheManager::TempErrorTimerCallbackL(TAny* aPtr) + { + TRACER("CGlxCacheManager::TempErrorTimerCallback"); + + CGlxCacheManager* self = (CGlxCacheManager*) aPtr; + + if ( self ) + { + self->TempErrorTimerCompleteL(); + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// TempErrorTimerComplete +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::TempErrorTimerCompleteL() + { + TRACER("CGlxCacheManager::TempErrorTimerComplete"); + + iTempErrorTimer->Cancel(); + TRAPD(err, MaintainCacheL()); + + // If MaintainCacheL leaves, force gabage collection to start and restart timer + if ( KErrNone != err ) + { + if ( KErrNoMemory == err ) + { + //iGarbageCollector->Cleanup(); + HandleGarbageCollectionL(ETrue); + } + + if ( !iRequestOwner ) + { + StartTempErrorTimer(); + } + } + } + +// ----------------------------------------------------------------------------- +// Create a path with the request items +// ----------------------------------------------------------------------------- +// +inline CMPXCollectionPath* CGlxCacheManager::RequestAsPathLC(const CGlxMediaList& aList) + { + TRACER("CGlxCacheManager::RequestAsPathLC"); + + CMPXCollectionPath* path = aList.PathLC( NGlxListDefs::EPathParent ); + + RArray mpxIds; + CleanupClosePushL( mpxIds ); + + TInt itemIdsCount = iRequestedItemIds.Count(); + + // Reserve space for all items + mpxIds.ReserveL( itemIdsCount ); + + for (TInt i = 0; i < itemIdsCount; ++i) + { + mpxIds.AppendL( iRequestedItemIds[ i ].Value() ); + } + + path->AppendL( mpxIds.Array() ); + path->SelectAllL(); + + CleanupStack::PopAndDestroy( &mpxIds ); + + return path; + } + +// ----------------------------------------------------------------------------- +// HandleListDeleted +// ----------------------------------------------------------------------------- +void CGlxCacheManager::HandleListDeleted(CGlxMediaList* aList) + { + TRACER("CGlxCacheManager::HandleListDeleted"); + + if (iRequestOwner == aList) + { + iRequestOwner = NULL; + + TRAP_IGNORE( MaintainCacheL() ); + } + } + +// ----------------------------------------------------------------------------- +// Inform cache manager to reserve users for an item, for a particular cache +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::ReserveUsersL(const TGlxIdSpaceId& aIdSpaceId, TInt aCount) + { + TRACER("CGlxCacheManager::ReserveUsersL"); + + // Look for existing cache + TInt index = iCaches.FindInOrder( aIdSpaceId, ( &CacheOrderByKey ) ); + if (index != KErrNotFound) + { + iCaches[index]->ReserveUsersL( aCount ); + } + } +//OOM +// ----------------------------------------------------------------------------- +// Start cache cleanup on Low memory event from OOM +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::ReleaseRAML(TBool aFlushOnRequest) +{ + TRACER("CGlxCacheManager::ReleaseRAM"); + if(aFlushOnRequest) + { + HandleGarbageCollectionL(aFlushOnRequest); + } + else + { + iGarbageCollector->CleanupL(); + } +} +// ----------------------------------------------------------------------------- +// Force a cleanup on particular media id : remove all attributes +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::ForceCleanupMedia(TGlxIdSpaceId aSpaceId, + TGlxMediaId aMediaId) + { + TRACER("CGlxCacheManager::ForceCleanupMedia"); + TInt spaceIdIndex = iCaches.FindInOrder( aSpaceId, &CacheOrderByKey ); + if ( KErrNotFound != spaceIdIndex ) + { + if ( iCaches[spaceIdIndex]->Media( aMediaId ) ) + { + TInt mediaIdIndex = iCaches[spaceIdIndex]->FindMediaIndexInCache(aMediaId); + if ( KErrNotFound != mediaIdIndex ) + { + iCaches[spaceIdIndex]->Delete(mediaIdIndex); + } + } + } + } + +// ----------------------------------------------------------------------------- +// Stop cache cleanup on good memory event from OOM +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::StopRAMReleaseL() +{ + TRACER("CGlxCacheManager::StopRAMRelease"); + iGarbageCollector->CancelCleanup(); + +} +//OOM + +#ifdef USE_S60_TNM +// ----------------------------------------------------------------------------- +// CGlxCacheManager::FindLoadingById() +// ----------------------------------------------------------------------------- +// +TInt CGlxCacheManager::FindLoadingById(TThumbnailRequestId aId, TBool aRemove) + { + TRACER("CGlxCacheManager::FindLoadingById"); + TInt index = KErrNotFound; + for(TInt i = 0; i < iThumbnailRequestIds.Count(); ++i) + { + if(iThumbnailRequestIds[i].iId == aId) + { + index = i; + if(aRemove) + { + iThumbnailRequestIds.Remove(i); + } + break; + } + } + return index; + } + +// ----------------------------------------------------------------------------- +// CGlxCacheManager::ThumbnailPreviewReady() +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::ThumbnailPreviewReady(MThumbnailData& aThumbnail, + TThumbnailRequestId aId) + { + TRACER("CGlxCacheManager::ThumbnailPreviewReady"); + TInt error = KErrNotSupported; + if (aThumbnail.Bitmap() != NULL) + { + GLX_DEBUG1("CGlxCacheManager::ThumbnailPreviewReady preview aval"); + error = KErrNone; + } + ThumbnailReadyL(error, aThumbnail, aId, EFalse); + } + +// ----------------------------------------------------------------------------- +// CGlxCacheManager::ThumbnailReady() +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::ThumbnailReady(TInt aError, + MThumbnailData& aThumbnail, TThumbnailRequestId aId) + { + TRACER("CGlxCacheManager::ThumbnailReady"); + GLX_DEBUG2("CGlxCacheManager::ThumbnailReady aError=%d", aError); + ThumbnailReadyL(aError, aThumbnail, aId, ETrue); + } + +// ----------------------------------------------------------------------------- +// CGlxCacheManager::ThumbnailReadyL() +// ----------------------------------------------------------------------------- +// +void CGlxCacheManager::ThumbnailReadyL(TInt aError, MThumbnailData& aThumbnail, + TThumbnailRequestId aId, TBool aQuality) + { + TRACER("CGlxCacheManager::ThumbnailReadyL"); + GLX_DEBUG3("CGlxCacheManager::ThumbnailReadyL aError=%d, aQuality=%d", + aError, aQuality); + +#ifdef _DEBUG + iStopTime.HomeTime(); // Get home time + GLX_DEBUG2("=>CGlxCacheManager::ThumbnailReadyL - TN Fetch took <%d> us", + (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); +#endif + + TInt reqIndex = FindLoadingById(aId, EFalse); + + if (reqIndex == KErrNotFound) + { + return; + } + + delete iMPXMedia; + iMPXMedia = NULL; + + iMPXMedia = CMPXMedia::NewL(); + if (aError == KErrNone) + { + delete iTempThumbnail; + iTempThumbnail = NULL; + iTempThumbnail = aThumbnail.DetachBitmap(); + + CGlxThumbnailAttribute* tnAttribute = new (ELeave) CGlxThumbnailAttribute; + CleanupStack::PushL(tnAttribute); + tnAttribute->iDimensions = iThumbnailRequestIds[reqIndex].iSize; + tnAttribute->iThumbnailQuality = aQuality; + + iMPXMedia->SetTObjectValueL(KMPXMediaGeneralId, + iThumbnailRequestIds[reqIndex].iThumbnailId.Value()); + TUint attributeId = GlxFullThumbnailAttributeId(aQuality, + iThumbnailRequestIds[reqIndex].iSize.iWidth, + iThumbnailRequestIds[reqIndex].iSize.iHeight); + iMPXMedia->SetNoNewLCObjectL( + TMPXAttribute(KGlxMediaIdThumbnail, attributeId), tnAttribute); + CleanupStack::PopAndDestroy(tnAttribute); + + HandleCollectionMediaL(iThumbnailRequestIds[reqIndex].iSpaceId, + *iMPXMedia, aError); + } + else + { + HandleCollectionMediaL(iThumbnailRequestIds[reqIndex].iSpaceId, + *iMPXMedia, aError); + } + + if (aQuality) + { + FindLoadingById(aId, ETrue); + } + } +#endif + +void CGlxCacheManager::GetMimeType(TFileName& aFileName, TDataType& aMimeType) + { + RApaLsSession session; + User::LeaveIfError( session.Connect() ); + CleanupClosePushL( session ); + + TUid uid; + User::LeaveIfError( session.AppForDocument( aFileName, uid, aMimeType ) ); + CleanupStack::PopAndDestroy(); // session + + } +void CGlxCacheManager::ImageReadyL(const TInt& aError, const TSize aSz) + { + if(iSchedulerWait) + { + iSchedulerWait->AsyncStop(); + } + iImgSz = aSz; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxerrormanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxerrormanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2008-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: Utility class to manage attribute retrieval errors +* +*/ + + + + +#include "glxerrormanager.h" + +//#include + +#include "glxfetcherrorarray.h" +#include "glxcachemanager.h" +#include "glxmedialist.h" +#include // For Logs +#include // For Logs + +/** Error attribute content ID */ +const TInt KGlxErrorContentId = 0x200071AC; +const TMPXAttributeData KGlxMediaErrorArray = { KGlxErrorContentId, 0x01 }; // CGlxFetchErrorArray + +const TInt KGlxErrorTimeOut = -10033; + +// ----------------------------------------------------------------------------- +// Return errors +// ----------------------------------------------------------------------------- +// +inline CGlxFetchErrorArray* Errors( const CGlxMedia& aMedia ) + { + TRACER("GlxErrorManager::Errors"); + + return const_cast( + static_cast( aMedia.ValueCObject( + KGlxMediaErrorArray ) ) ); + } + +// ----------------------------------------------------------------------------- +// SetAttributeErrorL +// ----------------------------------------------------------------------------- +// +void GlxErrorManager::SetAttributeErrorL(CGlxMedia* aItem, const RArray& aAttributes, TInt aError) + { + TRACER("GlxErrorManager::SetAttributeErrorL"); + + if ( aItem ) + { + CGlxFetchErrorArray* errorArray = NULL; + + if ( aItem->IsSupported(KGlxMediaErrorArray) ) + { + const CGlxFetchErrorArray* existingArray = static_cast(aItem->ValueCObject(KGlxMediaErrorArray)); + + if ( existingArray ) + { + errorArray = CGlxFetchErrorArray::NewLC(existingArray); + } + } + + if ( !errorArray ) + { + errorArray = new(ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(errorArray); + } + + TInt attrCount = aAttributes.Count(); + + for ( TInt attrIndex = 0; attrIndex < attrCount; attrIndex++ ) + { + errorArray->AddErrorL(TGlxFetchError(aAttributes[attrIndex], aError)); + } + + aItem->SetCObjectValueL(KGlxMediaErrorArray, errorArray); + + CleanupStack::Pop(errorArray); + } + } + +// ----------------------------------------------------------------------------- +// HasAttributeErrorL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt GlxErrorManager::HasAttributeErrorL(const CGlxMedia* aMedia, + const TMPXAttribute& aAttribute) + { + TRACER("GlxErrorManager::HasAttributeErrorL"); + + TInt retVal = KErrNone; + + if ( aMedia ) + { + const CGlxFetchErrorArray* errors = Errors( *aMedia ); + + if ( errors ) + { + TInt index = errors->FindError(aAttribute); + if ( KErrNotFound != index ) + { + TGlxFetchError error = errors->Error(index); + retVal = error.iError; + + if ( IsExpired( error ) ) + { + retVal = KErrNone; + } + + if ( KErrNone != retVal ) + { + if ( IsTemporaryError(retVal) ) + { + // Inform cache manager that at least one temporary error still exists + CGlxCacheManager* cacheManager = CGlxCacheManager::InstanceL(); + cacheManager->SetTemporaryErrorFlag(); + cacheManager->Close(); + } + } + } + } + } + + return retVal; + } + +// ----------------------------------------------------------------------------- +// HasAttributeErrorL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt GlxErrorManager::HasAttributeErrorL(const CGlxMedia* aMedia, + TInt aContentId) + { + TRACER("GlxErrorManager::HasAttributeErrorL"); + + TInt retVal = KErrNone; + if ( aMedia ) + { + const CGlxFetchErrorArray* errors = Errors( *aMedia ); + + if ( errors ) + { + TInt index = errors->FindError(aContentId); + if ( KErrNotFound != index ) + { + TGlxFetchError error = errors->Error(index); + retVal = error.iError; + + if ( IsExpired( error ) ) + { + retVal = KGlxErrorTimeOut; + } + + if ( KErrNone != retVal && KGlxErrorTimeOut != retVal) + { + if ( IsTemporaryError(retVal) ) + { + // Inform cache manager that at least one temporary error still exists + CGlxCacheManager* cacheManager = CGlxCacheManager::InstanceL(); + cacheManager->SetTemporaryErrorFlag(); + cacheManager->Close(); + } + } + } + + } + } + + return retVal; + } + +// ----------------------------------------------------------------------------- +// IsTemporaryError +// ----------------------------------------------------------------------------- +// +TBool GlxErrorManager::IsTemporaryError(TInt aErrorCode) + { + TRACER("GlxErrorManager::IsTemporaryError"); + GLX_DEBUG2("GlxErrorManager::IsTemporaryError() aErrorCode=%d", aErrorCode); + + /// @todo Implement this when list of temporary and permanent errors are known. Currently assume + /// all errors are temporary + switch ( aErrorCode ) + { + case KErrArgument: // fallthrough + case KErrNotSupported: // fallthrough + case KErrNoMemory: + case KErrCorrupt: + // add other permanent error codes here + return EFalse; + + default: + return ETrue; + }; + } + +// ----------------------------------------------------------------------------- +// IsErrorStillVal +// ----------------------------------------------------------------------------- +// +TBool GlxErrorManager::IsExpired( const TGlxFetchError& aError ) + { + TRACER("GlxErrorManager::IsExpired"); + + if ( IsTemporaryError(aError.iError) ) + { + TTime now; + now.UniversalTime(); + + TTime errorTime(aError.iTimestamp); + + if ( now - TTimeIntervalSeconds(KGlxTemporaryErrorValidityPeriodInSeconds) > errorTime ) + { + return ETrue; + } + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// HasError +// ----------------------------------------------------------------------------- +// +TBool GlxErrorManager::HasError(const CGlxMedia* aMedia) + { + TRACER("GlxErrorManager::HasError"); + + if ( aMedia ) + { + return ( Errors( *aMedia ) != NULL ); + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// ClearExpiredAndUnusedErrorsL +// ----------------------------------------------------------------------------- +// +void GlxErrorManager::ClearExpiredAndUnusedErrorsL( CGlxMedia& aMedia, + const RArray& aAttributesInUse ) + { + TRACER("GlxErrorManager::ClearExpiredAndUnusedErrorsL"); + + CGlxFetchErrorArray* errors = Errors( aMedia ); + + if ( errors ) + { + // Iterate through the list of errors backwards, so that removal is more + // efficient, and loop control easier + for ( TInt i = errors->ErrorCount() - 1; i >= 0; i-- ) + { + TGlxFetchError error = errors->Error( i ); + // remove the error if it has expired, or if the attribute + // that the error is for is no longer in use + if ( IsExpired( error ) || + KErrNotFound == aAttributesInUse.Find( error.iAttr, TMPXAttribute::Match ) ) + { + errors->Remove( i ); + } + } + + // no further errors are remaining, so can remove the error array + // attribute from the media object + if ( errors->ErrorCount() == 0 ) + { + aMedia.DeleteAttribute( KGlxMediaErrorArray ); + } + } + } + +// ----------------------------------------------------------------------------- +// Return error attribute's id +// ----------------------------------------------------------------------------- +// +TMPXAttribute GlxErrorManager::ErrorAttribute() + { + TRACER("GlxErrorManager::ErrorAttribute"); + + return KGlxMediaErrorArray; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxfetchcontextremover.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxfetchcontextremover.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2008-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: Class for removing a fetch context from a list +* +*/ + + + + +#include "glxfetchcontextremover.h" + +#include "mglxmedialist.h" +#include // For Logs + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFetchContextRemover::TGlxFetchContextRemover(MGlxFetchContext* aContext, + MGlxMediaList& aMediaList) + : iContext(aContext), iMediaList(aMediaList) + { + TRACER("TGlxFetchContextRemover::Default Constructor"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFetchContextRemover::~TGlxFetchContextRemover() + { + Close(); + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxFetchContextRemover::Close() + { + iMediaList.RemoveContext( iContext ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxfetcherror.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxfetcherror.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008-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: Record for an attribute retrieval error +* +*/ + + + + +#include "glxfetcherror.h" +#include // For Logs + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +TGlxFetchError::TGlxFetchError(TMPXAttribute aAttr, TInt aError) +: iAttr(aAttr), + iError(aError) + { + TRACER("TGlxFetchError::Default Constructor"); + + // Set the timestamp to now + TTime now; + now.UniversalTime(); + iTimestamp = now.DateTime(); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxfetcherrorarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxfetcherrorarray.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2008-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: Array of attribute retrieval errors +* +*/ + + + + +#include "glxfetcherrorarray.h" +#include // For Logs + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxFetchErrorArray::CGlxFetchErrorArray() + { + TRACER("CGlxFetchErrorArray::Default Constructor"); + + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxFetchErrorArray* CGlxFetchErrorArray::NewL(const CGlxFetchErrorArray* aErrorArray) + { + TRACER("CGlxFetchErrorArray::NewL"); + + CGlxFetchErrorArray* self = CGlxFetchErrorArray::NewLC(aErrorArray); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +// +CGlxFetchErrorArray* CGlxFetchErrorArray::NewLC(const CGlxFetchErrorArray* aErrorArray) + { + TRACER("CGlxFetchErrorArray::NewLC"); + + CGlxFetchErrorArray* self = new( ELeave ) CGlxFetchErrorArray(); + CleanupStack::PushL( self ); + self->CopyConstructL(aErrorArray); + return self; + } +// ----------------------------------------------------------------------------- +// CopyConstructL +// ----------------------------------------------------------------------------- +// +void CGlxFetchErrorArray::CopyConstructL(const CGlxFetchErrorArray* aErrorArray) + { + TRACER("CGlxFetchErrorArray::CopyConstructL"); + + if ( aErrorArray ) + { + TInt count = aErrorArray->iFetchErrors.Count(); + for ( TInt index = 0; index < count; index++ ) + { + iFetchErrors.AppendL(aErrorArray->iFetchErrors[index]); + } + } + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxFetchErrorArray::~CGlxFetchErrorArray() + { + TRACER("CGlxFetchErrorArray::Destructor"); + + iFetchErrors.Reset(); + } + +// ----------------------------------------------------------------------------- +// ErrorCount +// ----------------------------------------------------------------------------- +// +TInt CGlxFetchErrorArray::ErrorCount() const + { + TRACER("CGlxFetchErrorArray::ErrorCount"); + + return iFetchErrors.Count(); + } + +// ----------------------------------------------------------------------------- +// Error +// ----------------------------------------------------------------------------- +// +TGlxFetchError CGlxFetchErrorArray::Error(TInt aIndex) const + { + TRACER("CGlxFetchErrorArray::Error"); + + return iFetchErrors[aIndex]; + } + +// ----------------------------------------------------------------------------- +// AddErrorL +// ----------------------------------------------------------------------------- +// +void CGlxFetchErrorArray::AddErrorL(TGlxFetchError aError) + { + TRACER("CGlxFetchErrorArray::AddErrorL"); + + TInt index = FindError(aError.iAttr); + + if ( KErrNotFound == index ) + { + TLinearOrder orderer (&ErrorOrderById); + iFetchErrors.InsertInOrderL(aError, orderer); + } + else + { + iFetchErrors[index] = aError; + } + } + +// ----------------------------------------------------------------------------- +// Remove an error +// ----------------------------------------------------------------------------- +// +void CGlxFetchErrorArray::Remove( TInt aIndex ) + { + TRACER("CGlxFetchErrorArray::Remove"); + + iFetchErrors.Remove( aIndex ); + } + +// ----------------------------------------------------------------------------- +// FindError +// ----------------------------------------------------------------------------- +// +TInt CGlxFetchErrorArray::FindError(TMPXAttribute aAttr) const + { + TRACER("CGlxFetchErrorArray::FindError"); + + return iFetchErrors.FindInOrder(aAttr, (&ErrorOrderByKey)); + } + +// ----------------------------------------------------------------------------- +// FindError +// ----------------------------------------------------------------------------- +// +TInt CGlxFetchErrorArray::FindError(TInt aContentId) const + { + TRACER("CGlxFetchErrorArray::FindError"); + + TInt count = iFetchErrors.Count(); + TInt pos = KErrNotFound; + for(TInt i=0; iContentId(); + TInt contentId2 = aItem2.iAttr.ContentId(); + + if (contentId1 < contentId2) + { + return -1; + } + + if (contentId1 > contentId2) + { + return 1; + } + + TUint attributeId1 = aAttr->AttributeId(); + TUint attributeId2 = aItem2.iAttr.AttributeId(); + + if (attributeId1 < attributeId2) + { + return -1; + } + + if (attributeId1 > attributeId2) + { + return 1; + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// ErrorOrderById +// ----------------------------------------------------------------------------- +// +TInt CGlxFetchErrorArray::ErrorOrderById(const TGlxFetchError& aItem1, const TGlxFetchError& aItem2) + { + TRACER("CGlxFetchErrorArray::ErrorOrderById"); + + return ErrorOrderByKey(&(aItem1.iAttr), aItem2); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxgarbagecollector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxgarbagecollector.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,412 @@ +/* +* Copyright (c) 2008-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: Garbage collector +* +*/ + + + + +#include "glxgarbagecollector.h" + +#include +#include +#include + +#include "glxcache.h" +#include "glxerrormanager.h" +#include "glxmedia.h" +#include "glxmedialist.h" +#include "mglxmediauser.h" +#include "glxthumbnailutility.h" + +/** + * Interval for the periodic timer, in microseconds + */ +const TInt KPeriodicInterval = 500000; +/** + * Start Delay for the periodic timer, in microseconds + */ +const TInt KPeriodicStartDelay = 300000; // It is Changed to 300Micro Second ; To be able to give Others a Chance to Run before it starts +/** + * Max number of items to scan per periodic callback + * @todo Find optimal value for this + */ +const TInt KMaxScannedMediaCountPerPeriodicCallback = 15; // Changed from 30; Still there is Scope for Nominal Value Or Dynamic Value + +/** + * Max number of attributes that an item may have in use + */ +const TInt KMaxAttributesInUse = 50; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxGarbageCollector* CGlxGarbageCollector::NewL( + const RPointerArray& aCaches ) + { + TRACER( "CGlxGarbageCollector::NewL" ); + + CGlxGarbageCollector* self = new( ELeave ) CGlxGarbageCollector( aCaches ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxGarbageCollector::CGlxGarbageCollector( + const RPointerArray& aCaches ) + : iCaches( aCaches ) + { + TRACER("CGlxGarbageCollector::Default Constructor"); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxGarbageCollector::ConstructL() + { + TRACER("CGlxGarbageCollector::ConstructL"); + + // Create callback loop in the lowest priority, so that the garbage + // collection does not slow down the application + iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle ); + iAttributesInUse.ReserveL(KMaxAttributesInUse); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxGarbageCollector::~CGlxGarbageCollector() + { + TRACER("CGlxGarbageCollector::Destructor"); + delete iPeriodic; + iAttributesInUse.Close(); + } + +// ----------------------------------------------------------------------------- +// CleanupL +// ----------------------------------------------------------------------------- +// +void CGlxGarbageCollector::CleanupL() + { + TRACER("CGlxGarbageCollector::CleanupL"); + + if ( !iPeriodic->IsActive() ) + { + iPeriodic->Start( KPeriodicStartDelay, KPeriodicInterval, TCallBack( &PeriodicCallbackL, static_cast( this ) ) ); + } + else + { + // a full cleanup round is required to make the cache fully clean, + // if cleanup is currently ongoing. we don't know whether the cache + // was modified before or after the current (cache or media) index being + // cleaned up. + iRequiresFullCleanupRound = ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CancelCleanup +// ----------------------------------------------------------------------------- +// +void CGlxGarbageCollector::CancelCleanup() + { + TRACER("CGlxGarbageCollector::CancelCleanup"); + + if (iPeriodic->IsActive()) + { + iPeriodic->Cancel(); + // Consideration of Restarting the timer is there; + } + } + +// ----------------------------------------------------------------------------- +// Callback from periodic timer +// ----------------------------------------------------------------------------- +// +TInt CGlxGarbageCollector::PeriodicCallbackL( TAny* aPtr ) + { + TRACER("CGlxGarbageCollector::PeriodicCallback"); + + GLX_ASSERT_DEBUG( aPtr != NULL, Panic( EGlxPanicLogicError ), + "Received null pointer for garbage collector" ); + + // get "this" pointer + static_cast< CGlxGarbageCollector* >( aPtr )->PeriodicCallbackL(); + + // return value ignored for periodic timers + return 0; + } + +// ----------------------------------------------------------------------------- +// Flush Count Pages +// ----------------------------------------------------------------------------- +// +void CGlxGarbageCollector::FlushPagesL(TInt aCount) + { + TBool reachedEnd = CleanupCaches(aCount); + + if ( reachedEnd ) + { + // reset to the start of the caches + iScanningPosition.iCurrentCacheIndex = 0; + iScanningPosition.iNextMediaIndexToCleanup = 0; + + // next time the full round reaches end, the caches will be fully clean + // (unless client calls Cleanup() ) + iRequiresFullCleanupRound = EFalse; + } + } +// ----------------------------------------------------------------------------- +// Callback from periodic timer +// inlined in cpp only => inlines for arm +// ----------------------------------------------------------------------------- +// +inline void CGlxGarbageCollector::PeriodicCallbackL() + { + TRACER("CGlxGarbageCollector::PeriodicCallbackL"); + + TBool reachedEnd = CleanupCaches(); + + // determine whether idle callback should be cancelled (note that check + // needs to be done before resetting iRequiresFullCleanupRound below) + // do not cancel if reached the end, but cache is dirty + if ( reachedEnd && !iRequiresFullCleanupRound ) + { + iPeriodic->Cancel(); + } + + // if scanned to the end of caches, set up for the next cleanup round + if ( reachedEnd ) + { + // reset to the start of the caches + iScanningPosition.iCurrentCacheIndex = 0; + iScanningPosition.iNextMediaIndexToCleanup = 0; + + // next time the full round reaches end, the caches will be fully clean + // (unless client calls Cleanup() ) + iRequiresFullCleanupRound = EFalse; + } + } + +// ----------------------------------------------------------------------------- +// Clean up all caches +// ----------------------------------------------------------------------------- +// +TBool CGlxGarbageCollector::CleanupCaches(TInt aCount) + { + TRACER( "CGlxGarbageCollector::CleanupCaches" ); + + TInt remainingScanCount = 0; + + // set the maximum number of items to scan during this call + // Count is Needed for Flushing Direct + remainingScanCount = aCount*KMaxScannedMediaCountPerPeriodicCallback; + + // Iterate through all cache until scanned enough items (remainingScanCount) + // (unlikely to have many caches, so ok to call RPointerArray::Count() on + // each iteration) + while ( iScanningPosition.iCurrentCacheIndex < iCaches.Count() ) + { + // clean up current cache + remainingScanCount = CleanupCache( + *iCaches[iScanningPosition.iCurrentCacheIndex], remainingScanCount ); + + // exit the loop if reached full scan count, since the above loop might + // have reached the end of the cache. (so don't increment the current + // cache index) + if ( 0 == remainingScanCount ) + { + break; + } + + // set indexes to the beginning of the next cache + iScanningPosition.iCurrentCacheIndex++; + iScanningPosition.iNextMediaIndexToCleanup = 0; + } + + // determine if there is anything more to clean up + TBool reachedEndOfAllCaches = + ( iScanningPosition.iCurrentCacheIndex == iCaches.Count() ); + return reachedEndOfAllCaches; + } + +// ----------------------------------------------------------------------------- +// Clean up cache that is currently under cleanup +// return number of items yet to scan during this idle callback +// ----------------------------------------------------------------------------- +// +TInt CGlxGarbageCollector::CleanupCache( CGlxCache& aCache, + TInt aRemainingScanCount ) + { + TRACER( "CGlxGarbageCollector::CleanupCache" ); + + // set the maximum number of items to scan during this call + TInt remainingScanCount = aRemainingScanCount; + + // don't store cache.Count() locally, as the count changes during the loop + while ( iScanningPosition.iNextMediaIndexToCleanup < aCache.Count() && + remainingScanCount > 0 && ( aCache.IdSpaceId() != KGlxIdSpaceIdRoot ) ) + { + CGlxMedia& media = aCache.Media( iScanningPosition.iNextMediaIndexToCleanup ); + + if ( media.UserCount() > 0 ) + { + // the media object still has users. Check if any attributes + // it has can be deleted. + TRAPD( err, CleanupMediaL( aCache, media ) ); + + // skip the media object if cleanup failed. This allows cleanup to + // continue also when has no free memory. Skip also if there + // are still attributes in use. + if ( ( media.Count() == 0 && !err ) || ( err > 0 ) ) + { + // the media object has no more attributes. It can be deleted. + // don't increment iNextMediaIndexToCleanup since the index + // of the next item will be decreased by one due to removal + aCache.Delete( iScanningPosition.iNextMediaIndexToCleanup ); + GLX_LOG_INFO1( "CGlxGarbageCollector - Deleted Media Id=%d since no attributes left", media.Id().Value()); + } + else if( err < 0 ) + { + // scan next item + iScanningPosition.iNextMediaIndexToCleanup++; + } + else + { + // scan next item + iScanningPosition.iNextMediaIndexToCleanup++; + } + } + else + { + // the media object has no more users in present cache. It may be deleted + if( !MediaInUse( media ) ) + { + // Bug Fix @ EDDG-7V3CJA:: Recheck other caches for UserCount + aCache.Delete( iScanningPosition.iNextMediaIndexToCleanup ); + GLX_LOG_INFO1( "CGlxGarbageCollector - Deleted Media Id=%d since no users left", media.Id().Value()); + } + } + remainingScanCount--; + } + + return remainingScanCount; + } + +// ----------------------------------------------------------------------------- +// Perform cleanup on provided media object +// ----------------------------------------------------------------------------- +// +void CGlxGarbageCollector::CleanupMediaL( CGlxCache& aCache, CGlxMedia& aMedia ) + { + TRACER("CGlxGarbageCollector::CleanupMediaL"); + + // check which attributes can be deleted. + iAttributesInUse.Reset(); + + GetAttributesInUseL( aMedia, iAttributesInUse ); + if ( iAttributesInUse.Count() == 0 ) + { + User::Leave(1); + } + GlxErrorManager::ClearExpiredAndUnusedErrorsL( aMedia, iAttributesInUse ); + + // add the error attribute to the list of attributes that are in use, so + // that it won't be deleted by the loop below. + // (if there are no errors left, GlxErrorManager::ClearExpiredAndNotInUseErrorsL + // would have deleted the error attribute from aMedia, so checking for it + // does no harm) + iAttributesInUse.AppendL( GlxErrorManager::ErrorAttribute() ); + + // delete all attributes that are not being used + DeleteOtherAttributes( aCache, aMedia, iAttributesInUse ); + } + +// ----------------------------------------------------------------------------- +// GetAttributesInUseL +// ----------------------------------------------------------------------------- +// +void CGlxGarbageCollector::GetAttributesInUseL( const CGlxMedia& aMedia, + RArray& aAttributes ) const + { + TRACER("CGlxGarbageCollector::GetAttributesInUseL"); + + // get needed attributes from each user of the media object + // ( unlikely to have many users, so calling CGlxMedia::UserCount and + // CGlxMedia::Id within the loop ) + for ( TInt userIndex = 0; userIndex < aMedia.UserCount(); userIndex++ ) + { + aMedia.User( userIndex ).GetRequiredAttributesL( aMedia.IndexInUser( userIndex ), + aAttributes ); + } + } + +// ----------------------------------------------------------------------------- +// Delete all attributes from a media object except those specified +// ----------------------------------------------------------------------------- +// +void CGlxGarbageCollector::DeleteOtherAttributes( CGlxCache& aCache, CGlxMedia& aMedia, + const RArray& aAttributesToKeep ) const + { + TRACER("CGlxGarbageCollector::DeleteOtherAttributes"); + + // loop backwards so can delete attributes during the loop + for ( TInt attrIndex = aMedia.Count() - 1; attrIndex >= 0; attrIndex-- ) + { + // delete the attribute if it is not in use + const TMPXAttribute& attrib = aMedia.Attribute(attrIndex); + if ( KErrNotFound == aAttributesToKeep.Find( attrib, TMPXAttribute::Match ) ) + { + GLX_LOG_INFO( "CGlxGarbageCollector::DeleteOtherAttributes() - Deleted attribute" ); + aMedia.DeleteAttribute( attrIndex ); + if (GlxThumbnailUtility::IsFullThumbnail(attrib)) + { + GLX_DEBUG2("CGlxGarbageCollector::DeleteOtherAttributes(*** TN ***) aMediaId(%d)", + aMedia.Id().Value()); + aCache.CleanupMedia(aMedia.Id()); + } + } + } + } + +// ----------------------------------------------------------------------------- +// Check for User Count for media to be deleted in the remaining caches +// ----------------------------------------------------------------------------- +// +TBool CGlxGarbageCollector::MediaInUse(const CGlxMedia& aMedia) const + { + // Bug Fix @ EDDG-7V3CJA :: If media has non zero user count in any of the caches + // then deletion of texture is to be avoided. + for(TInt cacheCount = 0; cacheCount < iCaches.Count(); cacheCount++ ) + { + if ( ( iCaches[cacheCount]->Media( aMedia.Id() ) ) + && ( iCaches[cacheCount]->IdSpaceId() != KGlxIdSpaceIdRoot ) ) + { + if ( ( iCaches[cacheCount]->Media(aMedia.Id() ) )->UserCount() > 0 ) + { + return ETrue; + } + } + } + return EFalse; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glximagereader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glximagereader.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2008-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: glximagereader.cpp +* +*/ + + +#include +#include +//for DRM +#include +#include +#include + +#include "glximagereader.h" + + +// --------------------------------------------------------- +// CGlxImageReader::NewL +// --------------------------------------------------------- +// +CGlxImageReader* CGlxImageReader::NewL(MImageReadyCallBack& aNotify) + { + TRACER("CGlxImageReader::NewL"); + + CGlxImageReader* self = CGlxImageReader::NewLC( aNotify); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// CGlxImageReader::NewLC +// --------------------------------------------------------- +// +CGlxImageReader* CGlxImageReader::NewLC(MImageReadyCallBack& aNotify) + { + TRACER("CGlxImageReader::NewLC"); + + CGlxImageReader* self = new(ELeave) CGlxImageReader(aNotify); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------- +// CGlxImageReader::CGlxImageReader +// --------------------------------------------------------- +// +CGlxImageReader::CGlxImageReader(MImageReadyCallBack& aNotify) +:CActive(0),iNotify(aNotify) + { + } + +// --------------------------------------------------------- +// CGlxImageReader::~CGlxImageReader +// --------------------------------------------------------- +// +CGlxImageReader::~CGlxImageReader() + { + TRACER("CGlxImageReader::~"); + + Cancel(); + delete iFrame; + delete iImageDecoder; + if(iImgViewerMgr) + { + iImgViewerMgr->DeleteInstance(); + } + } + +// --------------------------------------------------------- +// CGlxImageReader::ConstructL +// --------------------------------------------------------- +// +void CGlxImageReader::ConstructL() + { + TRACER("CGlxImageReader::ConstructL"); + + CActiveScheduler::Add(this); + iIsLaunchedFromFMngr = EFalse; + TDataType imageType; + + iImgViewerMgr = CGlxImageViewerManager::InstanceL(); + if (iImgViewerMgr && iImgViewerMgr->IsPrivate()) + { + iIsLaunchedFromFMngr = ETrue; + } + + GetFileTypeL(imageType); + if (iIsLaunchedFromFMngr) + { + // TODO type cast handle to RFile + iImageDecoder = CImageDecoder::FileNewL(iImgViewerMgr->ImageFileHandle(), ContentAccess::EPeek); + } + else + { + iImageDecoder = CImageDecoder::FileNewL(CCoeEnv::Static()->FsSession(), iImgViewerMgr->ImageUri()->Des()); + } + + iFrame = new(ELeave)CFbsBitmap(); + iFrame->Create(iImageDecoder->FrameInfo(0).iOverallSizeInPixels,iImageDecoder->FrameInfo(0).iFrameDisplayMode); + iImageDecoder->Convert(&iStatus,*iFrame,0); + SetActive(); + } + +// --------------------------------------------------------- +// CGlxImageReader::GetFileTypeL +// --------------------------------------------------------- +// +void CGlxImageReader::GetFileTypeL(TDataType aMimeType) + { + TRACER("CGlxImageReader::GetFileTypeL"); + + RApaLsSession session; + User::LeaveIfError(session.Connect()); + CleanupClosePushL(session); + + TUid uid; + if(iIsLaunchedFromFMngr) + { + // TODO type cast handle to RFile + User::LeaveIfError(session.AppForDocument(iImgViewerMgr->ImageFileHandle(), uid, aMimeType)); + } + else + { + User::LeaveIfError(session.AppForDocument(iImgViewerMgr->ImageUri()->Des(),uid,aMimeType)); + } + CleanupStack::PopAndDestroy(); // session + } + +// --------------------------------------------------------- +// CGlxImageReader::DoCancel +// --------------------------------------------------------- +// +void CGlxImageReader::DoCancel() + { + TRACER("CGlxImageReader::DoCancel"); + iImageDecoder->Cancel(); + } + +// --------------------------------------------------------- +// CGlxImageReader::RunL +// --------------------------------------------------------- +// +void CGlxImageReader::RunL() + { + TRACER("CGlxImageReader::RunL"); + + const TSize sz = iFrame->SizeInPixels(); + iNotify.ImageReadyL(iStatus.Int(),sz); + } +// --------------------------------------------------------- +// CGlxImageReader::HasDRMRightsL +// --------------------------------------------------------- +// +TBool CGlxImageReader::HasDRMRightsL() + { + TRACER("Entering CGlxImageReader::HasDRMRightsL"); + + RAttributeSet attributeSet; + CleanupClosePushL(attributeSet); + attributeSet.AddL(ECanView); + attributeSet.AddL(EIsProtected); + CContent* content; + if(iIsLaunchedFromFMngr) + { + content = CContent::NewL(iImgViewerMgr->ImageFileHandle()); + } + else + { + content = CContent::NewL(iImgViewerMgr->ImageUri()->Des()); + } + + // Retrieve the attributes from the agent + User::LeaveIfError(content->GetAttributeSet(attributeSet)); + TInt rights = ERightsNone; + TBool drmProtected = EFalse; + attributeSet.GetValue(EIsProtected,drmProtected); + if(!drmProtected) + { + CleanupStack::PopAndDestroy(); + delete content; + content = NULL; + return EFalse; + } + attributeSet.GetValue(ECanView,rights); + CleanupStack::PopAndDestroy(); + + if(content) + { + delete content; + content = NULL; + } + + if(rights) + { + return ETrue; + } + return EFalse; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxitemlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxitemlist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,560 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +// my include +#include "glxitemlist.h" + +// system includes +#include +#include +#include + +// user includes +#include "mglxitemlistobserver.h" +#include "mglxmediapool.h" + +using namespace NGlxItemList; + +namespace NGlxItemList + { + // ----------------------------------------------------------------------------- + // Remove item from list and remove linking + // ----------------------------------------------------------------------------- + // + void RemoveItem( TInt aIndex, RArray< TGlxMedia >& aList, + MGlxMediaUser& aMediaUser ) + { + // Remove link between TGlxMedia and CGlxMedia + aList[ aIndex ].SetMedia( NULL, aMediaUser ); + // Remove from list + aList.Remove( aIndex ); + } + + /** + * Class to contain change processing current state and difference length + * + * @author Aki Vanhatalo + */ + NONSHARABLE_CLASS ( TDifferenceInfo ) + { + public: + /** Constructor */ + TDifferenceInfo() + { + iSourceIndex = 0; + iTargetIndex = 0; + iCount = 0; + } + + /// current index on source list. Modification strategy can change this + /// to skip items in the source list. + TInt iSourceIndex; + + /// current index on target list. Modification strategy can change this + /// to skip items in the target list. + TInt iTargetIndex; + + /// lenght of change: number of items that would need to be added or removed + /// to eliminate difference between source and target list. It is up to + /// the modification strategy to decide if it actually eliminates the + /// difference or simply observes it. Any change of this variable by + /// a strategy is ignored. + TInt iCount; + }; + + /** + * Modification strategy interface + * + * This interface will be called when differences are found in source and + * target list, and instructs how the differences should be solved, + * + * Use of modification strategies allows the same difference evaluation + * algorithm to be used for both calculating required target array space, and + * for doing the actual changes to into the target array. + * + * @author Aki Vanhatalo + */ + class MListModificationStrategy + { + public: + /** + * There is a difference in lists that requires removing items for + * the difference to be eliminated + * @param aInfo iTargetIndex index from which to remove items + * iCount number of items that would need to be removed + * iSourceIndex index in source list (to allow adjustement) + */ + virtual void Remove( TDifferenceInfo& aInfo ) = 0; + + /** + * There is a difference in lists that requires adding items from source + * list to target lits for the difference to be eliminated + * @param aInfo iTargetIndex index in target list at which to insert + * iCount number of items that would need to be copied + * iSourceIndex index in source list from which to copy + */ + virtual void Insert( TDifferenceInfo& aInfo ) = 0; + }; + + /** + * Modification strategy that calculates how much slack space is required for + * differences in lists to be fixed (i.e., TChangeListStategy to be executed) + * + * @author Aki Vanhatalo + */ + NONSHARABLE_CLASS( TCalculateRequiredSpaceStrategy ) : + public MListModificationStrategy + { + public: + /** Constructor */ + TCalculateRequiredSpaceStrategy( const RArray< TGlxMedia >& aTargetList ) + { + // Pick up initial required space + iRequiredSpace = aTargetList.Count(); + // Set initial value + iCurrentLengthDifference = 0; + } + + // from MListModificationStrategy + void Remove( TDifferenceInfo& aInfo ) + { + // Currently required space is reduced + iCurrentLengthDifference -= aInfo.iCount; + + // Skip over "removed" items (items were not removed, simply counted) + aInfo.iTargetIndex += aInfo.iCount; + } + + // from MListModificationStrategy + void Insert( TDifferenceInfo& aInfo ) + { + // Currently required space is increased + iCurrentLengthDifference += aInfo.iCount; + // Check if the currently required space is the maximum space + iRequiredSpace = Max( iCurrentLengthDifference, iRequiredSpace ); + + // Skip over source items, but not target items, since nothing was + // actually inserted + aInfo.iSourceIndex += aInfo.iCount; + } + + public: // allow public since internal to CGlxItemList implementation + /// space required in item list for TChangeListStategy to be + /// executable without fail + TInt iRequiredSpace; + /// current difference in space needed; iRequiredSpace is a max of this + TInt iCurrentLengthDifference; + }; + + /** + * Modification strategy that fixes the differences between source and target + * list. + * + * Note: Implementation assumes that there is enough slack space in target + * list for insertion operations to always succeed. (I.e., + * TCalculateRequiredSpaceStrategy needs to be used first to find out how much + * slack is required) + * + * @author Aki Vanhatalo + */ + NONSHARABLE_CLASS( TChangeListStategy ) : public MListModificationStrategy + { + public: + /** Constructor */ + TChangeListStategy( const CMPXCollectionPath& aSourceList, + const TGlxIdSpaceId& aIdSpaceId, RArray< TGlxMedia >& aTargetList, + const MGlxMediaPool& aMediaPool, MGlxMediaUser& aMediaUser, + MGlxItemListObserver& aObserver ) + : iSource( aSourceList ), iTarget( aTargetList ), + iMediaPool( aMediaPool ), iIdSpaceId( aIdSpaceId ), + iMediaUser( aMediaUser ), iObserver( aObserver ) + { + // do nothing (more) + } + + // from MListModificationStrategy + void Remove( TDifferenceInfo& aInfo ) + { + // Remove block from target list, start from end and work backwards (quicker) + for ( TInt i = aInfo.iTargetIndex + aInfo.iCount - 1; + i >= aInfo.iTargetIndex; + i-- ) + { + RemoveItem( i, iTarget, iMediaUser ); + } + + // Notify observer + iObserver.HandleItemsRemoved( aInfo.iTargetIndex, aInfo.iCount ); + } + + // from MListModificationStrategy + void Insert( TDifferenceInfo& aInfo ) + { + // Insert all items to target list + InsertBlock( aInfo ); + + // Notify observer + iObserver.HandleItemsAdded( aInfo.iTargetIndex, aInfo.iCount ); + + // Skip over inserted and source items + aInfo.iTargetIndex += aInfo.iCount; + aInfo.iSourceIndex += aInfo.iCount; + } + + private: + /** + * Copy a block of items from source to target + * @param aInfo See @ref MListModificationStrategy::Insert + */ + inline void InsertBlock( const TDifferenceInfo& aInfo ) + { + TInt sourceIndex = aInfo.iSourceIndex; + + // Copy items from source list to target list + TInt untilTargetIndex = aInfo.iTargetIndex + aInfo.iCount; + for ( TInt targetIndex = aInfo.iTargetIndex; + targetIndex < untilTargetIndex; targetIndex++ ) + { + // IdOfIndex will not return "invalid id", since the code is only + // asking for ids within the range of the list + TGlxMedia item( TGlxMediaId( iSource.IdOfIndex( sourceIndex ) ) ); + // set media, assumes that media is either NULL, or has an + // allocation made for a new user. Builds a link to CGlxMedia + // object, and from CGlxMedia object to iMediaUser + item.SetMedia( iMediaPool.Media( iIdSpaceId, item.Id() ), iMediaUser ); + // add to item list + // ignore error, cannot fail since reservation made + iTarget.Insert( item, targetIndex ); + + sourceIndex++; + } + } + + private: + /// Source list to copy ids from. + const CMPXCollectionPath& iSource; + /// Target list to which to copy / from which to remove + RArray< TGlxMedia >& iTarget; + /// Provider of media objects + const MGlxMediaPool& iMediaPool; + /// Id space id, for looking up items from media provider + TGlxIdSpaceId iIdSpaceId; + /// User of the new media objects, if any TGlxMedia-CGlxMedia links are added + MGlxMediaUser& iMediaUser; + /// Observer for changes in list + MGlxItemListObserver& iObserver; + }; + + } // namespace NGlxItemList + +// ----------------------------------------------------------------------------- +// CGlxItemList implementation +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Two-phase constructor +// ----------------------------------------------------------------------------- +// +CGlxItemList* CGlxItemList::NewL( const TGlxIdSpaceId& aIdSpaceId, + MGlxItemListObserver& aObserver, MGlxMediaUser& aMediaUser ) + { + TRACER("CGlxItemList::NewL"); + // No ConstructL function currently, so simply return an instance + return new (ELeave) CGlxItemList( aIdSpaceId, aObserver, aMediaUser ); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxItemList::CGlxItemList( const TGlxIdSpaceId& aIdSpaceId, + MGlxItemListObserver& aObserver, MGlxMediaUser& aMediaUser ) + : iIdSpaceId( aIdSpaceId ), iMediaUser( aMediaUser ), + iObserver( aObserver ) + { + TRACER("CGlxItemList::Default Constructor"); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ------------------------------------------------------------------------- ---- +// +CGlxItemList::~CGlxItemList() + { + TRACER( "CGlxItemList::~CGlxItemList" ); + + // Remove user of media objects + TInt count = iItems.Count(); + for ( TInt i = 0; i < count; i++ ) + { + iItems[ i ].SetMedia( NULL, iMediaUser ); + } + + iItems.Close(); + } + +// ----------------------------------------------------------------------------- +// Synchronise contents of the list with the collection path +// ----------------------------------------------------------------------------- +// +void CGlxItemList::SetContentsL( const CMPXCollectionPath& aSource, + const MGlxMediaPool& aMediaPool ) + { + TRACER( "CGlxItemList::SetContentsL" ); + __TEST_INVARIANT; + + // calculate how much space needs to be reserved in the items array + // before doing any modifications. This allows the update to + // be completed successfully or not at all if leave occurs + TCalculateRequiredSpaceStrategy calculateDeltaLengthStrategy ( iItems ); + ProcessDifferences ( aSource, calculateDeltaLengthStrategy ); + + // make reservation so that paths can be syncronised without fail + iItems.ReserveL( iItems.Count() + + calculateDeltaLengthStrategy.iRequiredSpace ); + + // now implement the changes (notifies observer) + TChangeListStategy changeListStrategy( aSource, iIdSpaceId, iItems, + aMediaPool, iMediaUser, iObserver ); + ProcessDifferences ( aSource, changeListStrategy ); + + // Remove slack space from list + iItems.Compress(); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Find differences in new and old path, and ask strategy to act on them +// ----------------------------------------------------------------------------- +// +void CGlxItemList::ProcessDifferences( const CMPXCollectionPath& aSource, + MListModificationStrategy& aModificationStrategy ) + { + TRACER("CGlxItemList::ProcessDifferences"); + + TDifferenceInfo info; + + // Find the indexes of the first items that are the same on both + // source and target list, until there are no more items in either list. + // (If either one of the lists reaches its end, return the next index + // from the last one, i.e., count.) + // Ask the strategy object to handle cases in which items + // have been inserted to the list or removed from the list. + // + // Note: not using a temporary variable for "target count", since count can change + // during the loop, as items may get added/removed. + TInt sourceCount = aSource.Count(); + while ( info.iSourceIndex < sourceCount || info.iTargetIndex < Count() ) + { + // find next matching source and target indexes + TInt sourceMatchIndex = KErrNotFound; + TInt targetMatchIndex = KErrNotFound; + FindMatchingItems( info, aSource, sourceMatchIndex, targetMatchIndex ); + + // Process differences + ProcessRemove( targetMatchIndex, info, aModificationStrategy ); + ProcessInsert( sourceMatchIndex, info, aModificationStrategy ); + + // go to next items + info.iSourceIndex++; + info.iTargetIndex++; + } + } + +// ----------------------------------------------------------------------------- +// Find the next matching item in source and target path +// inline in cpp file only, so will be inlined in arm compiler +// ----------------------------------------------------------------------------- +// +inline void CGlxItemList::FindMatchingItems( const TDifferenceInfo& aInfo, + const CMPXCollectionPath& aSource, TInt& aSourceMatchIndex, + TInt& aTargetMatchIndex ) + { + TRACER("CGlxItemList::FindMatchingItems"); + + // For each remaining source item, test each remaining target item, until + // match found + TInt sourceCount = aSource.Count(); + TInt targetCount = Count(); + TInt sourceIndex = aInfo.iSourceIndex; + + // The most common case is that the next items match (no items changed + // at the indexes being examined). The loop is optimised for that case. + // The loop (including the inner loop) terminates on the first round, + // since matching items are immediately found. + // The case optimised next is the "items were removed from middle" case, + // as this is likely to happen in an active view. In that case, the upper + // loop is run only once, and the inner loop finds the match. + // The slowest cases are when items were inserted or removed from the end. + // In that case both loops may run almost to end, so that is slow. + // However, that case should be a rare case (while view is active), + // so from performance perspective this loop should be ok, even + // though it has N*M complexity. + while ( sourceIndex < sourceCount ) + { + // get next source item id + // IdOfIndex will not return "invalid id", since the code is only + // asking for ids within the range of the list, but even if it did, + // the logic would still work + TGlxMediaId sourceId ( aSource.IdOfIndex( sourceIndex ) ); + + // try to find a target item that matches the source item + // (cannot use RArray::Find, since it does not allow specifying + // start index) + TInt targetIndex = aInfo.iTargetIndex; + while ( targetIndex < targetCount) + { + if ( sourceId == iItems[ targetIndex ].Id() ) + { + // Found match, store return values + aTargetMatchIndex = targetIndex; + aSourceMatchIndex = sourceIndex; + return; + } + targetIndex++; + } + sourceIndex++; + } + + // No match found + aTargetMatchIndex = Count(); + aSourceMatchIndex = aSource.Count(); + } + +// ----------------------------------------------------------------------------- +// Process the need to remove items to eliminate differences +// inline in cpp file only, so will be inlined in arm compiler +// ----------------------------------------------------------------------------- +// +inline void CGlxItemList::ProcessRemove( TInt aTargetMatchIndex, + TDifferenceInfo& aInfo, MListModificationStrategy& aStrategy ) + { + TRACER("CGlxItemList::ProcessRemove"); + + aInfo.iCount = aTargetMatchIndex - aInfo.iTargetIndex; + if ( aInfo.iCount > 0 ) + { + aStrategy.Remove( aInfo ); + } + } + +// ----------------------------------------------------------------------------- +// Process the need to insert items to eliminate differences +// inline in cpp file only, so will be inlined in arm compiler +// ----------------------------------------------------------------------------- +// +inline void CGlxItemList::ProcessInsert( TInt aSourceMatchIndex, + TDifferenceInfo& aInfo, MListModificationStrategy& aStrategy ) + { + TRACER("CGlxItemList::ProcessInsert"); + + aInfo.iCount = aSourceMatchIndex - aInfo.iSourceIndex; + if ( aInfo.iCount > 0 ) + { + aStrategy.Insert( aInfo ); + } + } + +// ----------------------------------------------------------------------------- +// Remove an item from the list +// ----------------------------------------------------------------------------- +// +void CGlxItemList::Remove( const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aItemId ) + { + TRACER("CGlxItemList::Remove"); + + // Assume id space id does not have to be checked for performance reasons, i.e., id + // space id is usually, if not always, correct + TInt index = Index(aIdSpaceId, aItemId ); + if ( KErrNotFound != index && iIdSpaceId == aIdSpaceId ) + { + // Remove item from the list + RemoveItem( index, iItems, iMediaUser ); + // Notify observer + iObserver.HandleItemsRemoved( index, 1 ); + } + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Remove any pointers to the media object at the specified index +// ----------------------------------------------------------------------------- +// +void CGlxItemList::RemoveReference( TInt aIndex ) + { + TRACER( "CGlxItemList::RemoveReference" ); + __TEST_INVARIANT; + + GLX_ASSERT_DEBUG( 0 <= aIndex && aIndex < iItems.Count(), + Panic(EGlxPanicIllegalArgument), "removing reference for item out of bounds"); + + // remove the reference to the media + (*this)[ aIndex ].SetMedia( NULL, iMediaUser ); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Return index by id +// ----------------------------------------------------------------------------- +// +TInt CGlxItemList::Index( const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId ) const + { + TRACER("CGlxItemList::Index"); + + if ( iIdSpaceId == aIdSpaceId ) + { + // set up comparison functor + TIdentityRelation match ( &TGlxMedia::MatchById ); + // create dummy object to compare against + TGlxMedia mediaToCompare( aId ); + // try to find; may return KErrNotFound + return iItems.Find( mediaToCompare, match ); + } + + return KErrNotFound; + } + +// --------------------------------------------------------------------------- +// Test invariant +// --------------------------------------------------------------------------- +void CGlxItemList::__DbgTestInvariant() const + { + #ifdef _DEBUG + + __ASSERT_DEBUG( &iObserver , Panic( EGlxPanicIllegalState ) ); // Null observer + __ASSERT_DEBUG( iIdSpaceId != KGlxIdNone , Panic( EGlxPanicIllegalState ) ); // No id space + + // Make sure the list contains no duplication + TInt count = iItems.Count(); + for ( TInt indexA = 0; indexA < count; ++indexA ) + { + for ( TInt indexB = indexA + 1; indexB < count; ++indexB ) + { + __ASSERT_DEBUG( !TGlxMedia::MatchById( iItems[indexA], iItems[indexB] ), + Panic( EGlxPanicIllegalState ) ); // Duplicate item + } + } + + #endif // _DEBUG + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxlistutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxlistutils.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2008-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: List utilities +* +*/ + + + +#include //For logging +#include +#include // For feature constants + +#include "glxlistutils.h" + +// ----------------------------------------------------------------------------- +// NormalizedIndex +// ----------------------------------------------------------------------------- +// +TInt GlxListUtils::NormalizedIndex( TInt aIndex, TInt aListLength ) + { + TRACER("GlxListUtils::NormalizedIndex"); + + if ( 0 == aListLength ) + { + return KErrNotFound; + } + + TInt index = aIndex % aListLength; + if( index < 0 ) + { + // sign for modulo is the same as left side + // so need to add aListLength + index += aListLength; + } + + return index; + } + +// ----------------------------------------------------------------------------- +// VisibleItemsGranularityL +// ----------------------------------------------------------------------------- +// +TInt GlxListUtils::VisibleItemsGranularityL() + { + TRACER("GlxListUtils::DefaultVisibleItemsGranularityL"); + + //TBD: In MCL 9.1/Corolla env currently the feature flags + //KFeatureIdLayout640_480 and KFeatureIdLayout480_640 are not defined + //so making the default granularity as 21 instead of 15. + //Need to replace with KGlxDefaultVisibleItemsGranularity after + //getting the feature flag. + TInt ret = KGlxVGAVisibleItemsGranularity; + FeatureManager::InitializeLibL(); + + if (FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || + FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch )) + { + ret = KGlxQHDVisibleItemsGranularity; + } + else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || + FeatureManager::FeatureSupported(KFeatureIdLayout480_640)) + { + ret = KGlxVGAVisibleItemsGranularity; + } + FeatureManager::UnInitializeLib(); + return ret; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxlistwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxlistwindow.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,743 @@ +/* +* Copyright (c) 2008-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: Window to a list of objects +* +*/ + + + + +#include "glxlistwindow.h" + +#include "glxpanic.h" +#include "glxlistutils.h" //for GlxListUtils +#include //For logging +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// CGlxDataWindow +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// +class CGlxDataWindow : public CBase + { + friend class TGlxWindowIterator; +public: + /** Destructor*/ + ~CGlxDataWindow() + { + iObjects.Close(); + } + + /** Destroy contents of the window */ + void Destroy() + { + iObjects.ResetAndDestroy(); + } + + /** Reserve max window size */ + inline void ReserveL( TInt aMaxCount ) + { + iObjects.ReserveL( aMaxCount ); + } + + /** Preparet the window to accept items */ + void Initialize( const CGlxListWindow::TRange& aRange, TInt aTotalSize ) + { + __TEST_INVARIANT; + + iTotalSize = aTotalSize; + // use GlxListUtils::NormalizedIndex instead of Normalize to avoid + // execution-order dependency to the setting of iTotalSize + iWindowStartIndex = GlxListUtils::NormalizedIndex( aRange.iStartIndex, iTotalSize ); + + // all existing pointers in the array are NULL, as they have been + // set so by PopulateExistingAndUnuseOld + + // add sufficient number of new null pointers + for ( TInt i = iObjects.Count(); i < aRange.iLength; i++ ) + { + // Append cannot fail since reservation has been made + ( void ) iObjects.Append( NULL ); + } + + // remove unnecessary pointers + for ( TInt i = iObjects.Count() - 1; i >= aRange.iLength; i-- ) + { + iObjects.Remove( i ); + } + + __TEST_INVARIANT; + } + + /** @return an iterator that can iterate throught the items in window */ + inline TGlxWindowIterator Iterator() const + { + return TGlxWindowIterator( *this ); + } + + /** @return whether the list index is within range */ + inline TBool InRange( TInt aListIndex ) const + { + return KErrNotFound != WindowIndex( aListIndex ); + } + + inline CBase*& operator[] ( TInt aListIndex ) + { + return iObjects[ WindowIndex( aListIndex ) ]; + } + + /** @return the length of the window */ + inline TInt Size() const + { + return iObjects.Count(); + } + + /** @return the total length of the list */ + inline TInt TotalSize() const + { + return iTotalSize; + } + +private: + /** convert a window index to list index */ + TInt ListIndex( TInt aWindowIndex ) const + { + __ASSERT_DEBUG( aWindowIndex >= 0 && aWindowIndex < Size(), Panic( EGlxPanicIllegalArgument ) ); + return Normalize( aWindowIndex + iWindowStartIndex ); + } + + /** convert a list index to window index */ + /// @todo Make this private + TInt WindowIndex( TInt aListIndex ) const + { + if ( KErrNotFound == aListIndex ) + { + return KErrNotFound; + } + + __ASSERT_DEBUG( aListIndex >= 0 && aListIndex < iTotalSize, Panic( EGlxPanicIllegalArgument ) ); + + // Convert the list index to a window index + TInt windowIndex = Normalize( aListIndex - iWindowStartIndex ); + if ( windowIndex >= Size() ) + { + return KErrNotFound; // Does not fit to the window + } + return windowIndex; + } + + /** Normalise index to list length */ + inline TInt Normalize( TInt aIndex ) const + { + return GlxListUtils::NormalizedIndex( aIndex, iTotalSize ); + } + + /** Test state */ + void __DbgTestInvariant() const + { + __ASSERT_DEBUG(iTotalSize >= 0 && iTotalSize < 50000, Panic(EGlxPanicIllegalState)); // Sanity check + __ASSERT_DEBUG(iObjects.Count() <= iTotalSize, Panic(EGlxPanicIllegalState)); + } + +private: + /// Full size of the list + TInt iTotalSize; + + /// Index of the first object in iWindow in the list, + /// i.e., the list index from which the window starts from + TInt iWindowStartIndex; + + /// List of objects in the window, starting from iWindowStartIndex + RPointerArray< CBase > iObjects; + }; + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +TGlxWindowIterator::TGlxWindowIterator( const CGlxDataWindow& aWindow ) + { + TRACER("TGlxWindowIterator::TGlxWindowIterator"); + + iWindow = &aWindow; + iWindowIndex = 0; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +EXPORT_C TGlxWindowIterator::TGlxWindowIterator( const TGlxWindowIterator& aIterator ) + { + TRACER("TGlxWindowIterator::TGlxWindowIterator"); + + iWindow = aIterator.iWindow; + iWindowIndex = aIterator.iWindowIndex; + } + +// ----------------------------------------------------------------------------- +// ++ +// ----------------------------------------------------------------------------- +EXPORT_C TInt TGlxWindowIterator::operator++( TInt ) + { + TRACER("TGlxWindowIterator::operator++"); + + if ( iWindowIndex == iWindow->iObjects.Count() ) + { + return KErrNotFound; + } + return iWindow->ListIndex( iWindowIndex++ ); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// TChange +// ----------------------------------------------------------------------------- +// +CGlxListWindow::TChange::TChange( TInt aNewFocusIndex, TInt aNewTotalSize, TChangeType aChangeType, + TInt aFirstChangedIndex, TInt aLastChangedIndex ) + { + TRACER("TChange::Default Constructor"); + + iNewFocusIndex = aNewFocusIndex; + iNewTotalSize = aNewTotalSize; + iChangeType = aChangeType; + iFirstChangedIndex = aFirstChangedIndex; + iLastChangedIndex = aLastChangedIndex; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxListWindow::CGlxListWindow( MGlxWindowObjectFactory& aObjectFactory ) + : iObjectFactory( aObjectFactory ) + { + TRACER("CGlxListWindow::Default Constructor"); + + iFocusIndex = KErrNotFound; // No items, hence no focus + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxListWindow::ConstructL() + { + TRACER("CGlxListWindow::ConstructL"); + + iWorkingWindow = new (ELeave) CGlxDataWindow; + iWindow = new (ELeave) CGlxDataWindow; + // default range offsets are 0, 0, which means that only the focused item + // in in the window by default. Create an object for the focus. This + // makes it optional to call SetRangeOffsetsL if range remains 0,0 + iUnusedObjects.AppendL( iObjectFactory.CreateObjectL() ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxListWindow::~CGlxListWindow() + { + TRACER("CGlxListWindow::Destructor"); + + // objects may exist in either iWindow or object pool (iUnusedObjects) + if ( iWindow ) + { + // this call could be removed, if could call Cleanup here + // currently deriving classes implement CleanupObject, so calling it + // here is not possible => requires a different object as factory + iWindow->Destroy(); + delete iWindow; + } + iUnusedObjects.ResetAndDestroy(); + // the working window does not own anything + delete iWorkingWindow; + } + +// ----------------------------------------------------------------------------- +// Cleans up remaining objects in the window +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxListWindow::Cleanup() + { + TRACER("CGlxListWindow::Cleanup"); + + // make the window empty. this will clean up all remaining objects. + Update( TChange( KErrNotFound, 0, EChangeObjectsRemoved, 0, iWindow->TotalSize() - 1 ) ); + } + +// ----------------------------------------------------------------------------- +// SetRangeOffsetsL +// ----------------------------------------------------------------------------- +// DEPRECATED +EXPORT_C void CGlxListWindow::SetRangeOffsetsL( TInt aFrontOffset, TInt aRearOffset ) + { + TRACER("CGlxListWindow::SetRangeOffsetsL"); + + SetRangeOffsetsL( iFocusIndex, iWindow->TotalSize(), aFrontOffset, aRearOffset ); + } + +// ----------------------------------------------------------------------------- +// SetRangeOffsetsL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxListWindow::SetRangeOffsetsL( TInt aFocusIndex, + TInt aTotalSize, TInt aFrontOffset, TInt aRearOffset ) + { + TRACER("CGlxListWindow::SetRangeOffsetsL"); + + __ASSERT_DEBUG( aFrontOffset <= 0 && aRearOffset >= 0, Panic( EGlxPanicIllegalArgument ) ); + __ASSERT_DEBUG( ( 0 <= aFocusIndex && aFocusIndex < aTotalSize ) || + ( KErrNotFound == aFocusIndex && 0 == aTotalSize ), + Panic( EGlxPanicIllegalArgument ) ); + + iFrontOffset = aFrontOffset; + iRearOffset = aRearOffset; + + // only ever expand the range. there is no use case to do the otherwise, + // so don't bother optimising that case by freeing unnecessary objects. + + // all or no objects may be in use at any time - reserve max count in all arrays + TInt maxObjectCount = aRearOffset - aFrontOffset + 1; + iWorkingWindow->ReserveL( maxObjectCount ); + iWindow->ReserveL( maxObjectCount ); + iUnusedObjects.ReserveL( maxObjectCount ); + + // create enough new objects into the unused objects pool + // objects are either in the main window or in the pool + for ( TInt i = iWindow->Size() + iUnusedObjects.Count(); i < maxObjectCount; i++ ) + { + // cannot fail since reservation made above + ( void ) iUnusedObjects.Append( iObjectFactory.CreateObjectL() ); + } + + Update( TChange( aFocusIndex, aTotalSize, EChangeNone, 0, 0 ) ); + } + +// ----------------------------------------------------------------------------- +// Iterator +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxWindowIterator CGlxListWindow::Iterator() const + { + TRACER("CGlxListWindow::Iterator"); + + return iWindow->Iterator(); + } + +// ----------------------------------------------------------------------------- +// SetFocusIndexL +// ----------------------------------------------------------------------------- +// DEPRICATED +EXPORT_C void CGlxListWindow::SetFocusIndex( TInt aFocusIndex ) + { + TRACER("CGlxListWindow::SetFocusIndex"); + + SetFocusIndex( aFocusIndex, iWindow->TotalSize() ); + } + +// ----------------------------------------------------------------------------- +// SetFocusIndexL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxListWindow::SetFocusIndex( TInt aFocusIndex, TInt aTotalSize ) + { + TRACER("CGlxListWindow::SetFocusIndex"); + + __ASSERT_DEBUG( ( 0 <= aFocusIndex && aFocusIndex < aTotalSize ) || + ( KErrNotFound == aFocusIndex && 0 == aTotalSize ), + Panic( EGlxPanicIllegalArgument ) ); + __TEST_INVARIANT; + + Update( TChange( aFocusIndex, aTotalSize, EChangeNone, 0, 0 ) ); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// AddObjects +// ----------------------------------------------------------------------------- +// DEPRICATED +EXPORT_C void CGlxListWindow::AddObjects( TInt aFirstNewIndex, TInt aLastNewIndex ) + { + TRACER("CGlxListWindow::AddObjects"); + + TInt newItemCount = aLastNewIndex - aFirstNewIndex + 1; + TInt newTotalSize = iWindow->TotalSize() + newItemCount; + + // Check if it is necessary to move focus + TInt newFocusIndex = iFocusIndex; + if ( KErrNotFound == newFocusIndex ) + { + // List is empty, so set focus to the first item + __ASSERT_DEBUG(iWindow->TotalSize() == 0, Panic(EGlxPanicIllegalState)); // Must have had an empty list to have no focus + newFocusIndex = 0; + } + else if (newFocusIndex >= aFirstNewIndex) + { + // Move focus, so that the focus stays on the same item that was + // focused before items were added + newFocusIndex += newItemCount; + } + + AddObjects( newFocusIndex, newTotalSize, aFirstNewIndex, aLastNewIndex ); + } + +// ----------------------------------------------------------------------------- +// AddObjects +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxListWindow::AddObjects( TInt aFocusIndex, + TInt aTotalSize, TInt aFirstNewIndex, TInt aLastNewIndex ) + { + TRACER("CGlxListWindow::AddObjects"); + + __ASSERT_DEBUG( 0 <= aFirstNewIndex && aFirstNewIndex <= aLastNewIndex && + aLastNewIndex < aTotalSize && + 0 <= aFocusIndex && aFocusIndex < aTotalSize, + Panic( EGlxPanicIllegalArgument ) ); + __TEST_INVARIANT; + + Update( TChange( aFocusIndex, aTotalSize, EChangeObjectsAdded, + aFirstNewIndex, aLastNewIndex ) ); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// RemoveObjects +// ----------------------------------------------------------------------------- +// DEPRICATED +EXPORT_C void CGlxListWindow::RemoveObjects( TInt aFirstRemovedIndex, TInt aLastRemovedIndex ) + { + TRACER("CGlxListWindow::RemoveObjects"); + + TInt itemsRemovedCount = aLastRemovedIndex - aFirstRemovedIndex + 1; + TInt newTotalSize = iWindow->TotalSize() - itemsRemovedCount; + TInt newFocusIndex = iFocusIndex; + + // check number of items left + if (newTotalSize == 0) + { + // all items have been removed + newFocusIndex = KErrNotFound; + } + else // still some items in the list + { + // Focus should stay on the same item if possible. If not, it should + // go to the first previous item still existing. If none, it should go to + // first (=first next) item. + + // @todo: Do not maintain focus index in this class!!! This is broken + + // Update focus if the removal point was before the focus + if (aFirstRemovedIndex <= newFocusIndex) + { + TInt firstToFocusCount = newFocusIndex - aFirstRemovedIndex + 1; + newFocusIndex -= Min(itemsRemovedCount, firstToFocusCount); + + if (newFocusIndex < 0) + { + newFocusIndex = 0; + } + } + } + + RemoveObjects( newFocusIndex, newTotalSize, aFirstRemovedIndex, aLastRemovedIndex ); + } + +// ----------------------------------------------------------------------------- +// RemoveObjects +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxListWindow::RemoveObjects( TInt aFocusIndex, + TInt aTotalSize, TInt aFirstRemovedIndex, TInt aLastRemovedIndex ) + { + TRACER("CGlxListWindow::RemoveObjects"); + + __ASSERT_DEBUG( 0 <= aFirstRemovedIndex && aFirstRemovedIndex <= aLastRemovedIndex && + ( ( 0 <= aFocusIndex && aFocusIndex < aTotalSize ) || + ( KErrNotFound == aFocusIndex && aTotalSize == 0 ) ), + Panic( EGlxPanicIllegalArgument ) ); + __TEST_INVARIANT; + + Update( TChange( aFocusIndex, aTotalSize, EChangeObjectsRemoved, + aFirstRemovedIndex, aLastRemovedIndex ) ); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Update +// ----------------------------------------------------------------------------- +// +void CGlxListWindow::Update( const TChange& aChange ) + { + TRACER("CGlxListWindow::Update"); + + // (in a list of: |abcdefghijklm| + // iWindow: |----efghi----| + // iWorkingWindow: undefined state + // iUnusedObjects: XXX (3 objects, in reality only contains objects if list + // is shorter than max window length) + + // Prepare the working window to accept objects + iWorkingWindow->Initialize( Range( aChange ), aChange.iNewTotalSize ); + + // iWindow: |----efghi----| + // iWorkingWindow: |------00000--| + // iUnusedObjects: XXX + + // move unused objects to pool, and reusable objects to working window + PopulateExistingAndUnuseOld( aChange ); + + // iWindow: |----efghi----| + // iWorkingWindow: |------ghi00--| + // iUnusedObjects: XXXXX (2 objects added, used to be e and f) + + // set the current window to working window and vice versa. + // do this before populating new items, since when the deriving class + // is asked to set up the items, it is better to allow it to access the + // objects from the window (only objects from main window can be accessed + // externally) + SwapWindows(); + iFocusIndex = aChange.iNewFocusIndex; + + // iWindow: |------ghi00--| + // iWorkingWindow: |----xxxxx----| = undefined + // iUnusedObjects: XXXXX + + // populate objects in working window that did not exist in current window + PopulateNew(); + + // iWindow: |------ghijk--| + // iWorkingWindow: |----xxxxx----| = undefined + // iUnusedObjects: XXX (2 objects moved to iWindow) + } + +// ----------------------------------------------------------------------------- +// PopulateExistingAndUnuseOld +// ----------------------------------------------------------------------------- +// +void CGlxListWindow::PopulateExistingAndUnuseOld( const TChange& aChange ) + { + TRACER("CGlxListWindow::PopulateExistingAndUnuseOld"); + + // move objects that are needed after the change into the working window, + // and objects that are not needed into the object pool + TGlxWindowIterator currentWindowIterator = iWindow->Iterator(); + TInt index = 0; + while ( KErrNotFound != ( index = currentWindowIterator++ ) ) + { + // translate to what the list index would be after the change. + TInt indexAfterChange = IndexAfterChange( index, aChange ); + // item is needed in the new window if it is in the range of the new window + if ( iWorkingWindow->InRange( indexAfterChange ) ) + { + // move the object from the current window to the working window + ( *iWorkingWindow )[ indexAfterChange ] = ( *iWindow )[ index ]; + } + else + { + // ask deriving class to clean up the object (free resources, etc). + // do this first, so that the deriving class can access the window + // by index, if needed + iObjectFactory.CleanupObject( index, *( *iWindow )[ index ] ); + // add the object to the unused objects pool + // cannot fail since reservation made + ( void ) iUnusedObjects.Append( ( *iWindow )[ index ] ); + } + + // clear the pointer in the existing window. it is not strictly necessary + // to do here, but saves a loop from doing it in CGlxDataWindow::Initialize + ( *iWindow )[ index ] = NULL; + } + } + +// ----------------------------------------------------------------------------- +// Populate objects that were not reused +// ----------------------------------------------------------------------------- +// +void CGlxListWindow::PopulateNew() + { + TRACER("CGlxListWindow::PopulateNew"); + + // iWindow is now partially constructed + // populate all pointers that are null + TGlxWindowIterator newWindowIterator = iWindow->Iterator(); + TInt index = 0; + while ( KErrNotFound != ( index = newWindowIterator++ ) ) + { + if ( NULL == ( *iWindow )[ index ] ) + { + CBase* object = UnusedObject(); + ( *iWindow )[ index ] = object; + // configure the object + iObjectFactory.SetupObject( index, *object ); + } + } + } + +// ----------------------------------------------------------------------------- +// Reuse +// ----------------------------------------------------------------------------- +// +void CGlxListWindow::SwapWindows() + { + TRACER("CGlxListWindow::SwapWindows"); + + CGlxDataWindow* temp = iWorkingWindow; + iWorkingWindow = iWindow; + iWindow = temp; + } + +// ----------------------------------------------------------------------------- +// Return an object from the pool, and remove it from the pool +// ----------------------------------------------------------------------------- +// +CBase* CGlxListWindow::UnusedObject() + { + TRACER("CGlxListWindow::UnusedObject"); + + TInt lastObjectIndex = iUnusedObjects.Count() - 1; + CBase* object = iUnusedObjects[ lastObjectIndex ]; + iUnusedObjects.Remove( lastObjectIndex ); + return object; + } + +// ----------------------------------------------------------------------------- +// Access object by index +// ----------------------------------------------------------------------------- +// +EXPORT_C CBase* CGlxListWindow::At( TInt aIndex ) + { + TRACER("CGlxListWindow::At"); + + if ( iWindow->InRange( aIndex ) ) + { + return ( *iWindow )[ aIndex ]; + } + return NULL; + } + +// ----------------------------------------------------------------------------- +// Access object by index +// ----------------------------------------------------------------------------- +// +EXPORT_C const CBase* CGlxListWindow::At( TInt aIndex ) const + { + TRACER("CGlxListWindow::At"); + + return const_cast< CGlxListWindow* >( this )->At( aIndex ); + } + +// ----------------------------------------------------------------------------- +// Range +// ----------------------------------------------------------------------------- +// +CGlxListWindow::TRange CGlxListWindow::Range( const TChange& aChange ) const + { + TRACER("CGlxListWindow::Range"); + + TRange range; + range.iLength = iRearOffset - iFrontOffset + 1; // Add 1 for focus; + + // Start index is always zero if the whole list fits into the window + if ( range.iLength >= aChange.iNewTotalSize ) + { + // All items are within range + range.iStartIndex = 0; + range.iLength = aChange.iNewTotalSize; + } + else + { + // Not all items in the list fit within the range + range.iStartIndex = GlxListUtils::NormalizedIndex( + aChange.iNewFocusIndex + iFrontOffset, aChange.iNewTotalSize ); + + // check that ranges don't ever meet at the other side of the loop + __ASSERT_DEBUG( range.iStartIndex != GlxListUtils::NormalizedIndex( range.iStartIndex + range.iLength, aChange.iNewTotalSize ) + || ( iFrontOffset == 0 && iRearOffset == 0 ), Panic( EGlxPanicLogicError ) ); + } + + return range; + } + +// ----------------------------------------------------------------------------- +// Convert a list index to a list index in a changed list +// ----------------------------------------------------------------------------- +// +TInt CGlxListWindow::IndexAfterChange( TInt aIndex, + const TChange& aChange ) const + { + TRACER("CGlxListWindow::IndexAfterChange"); + + // Convert the new list index into an old list index + TInt changeCount = aChange.iLastChangedIndex - aChange.iFirstChangedIndex + 1; + + TInt indexAfterChange = aIndex; + if ( aChange.iFirstChangedIndex <= aIndex ) + { + if ( aChange.iChangeType == EChangeObjectsRemoved ) + { + // f l (first, last) + // old: |---NNN---||||||------| + // new: |------||||||------| + + // If the index is between the indexes, the change will remove it + if ( aIndex <= aChange.iLastChangedIndex ) + { + // The index is one of the new items. It does not exist in the old window + indexAfterChange = KErrNotFound; + } + else + { + // The index is after the items that will be removed. Adjust the index by "removing" the items. + indexAfterChange -= changeCount; + } + } + else if ( aChange.iChangeType == EChangeObjectsAdded ) + { + // Adjust the index by "adding" the items before the index + // old: |------||||||------| + // new: |---NNN---||||||------| + // f l (first, last) + indexAfterChange += changeCount; + } + // if EChangeNone, no adjustment needed + } + // else no adjustment need, since the change happened after the index + + return indexAfterChange; + } + +// --------------------------------------------------------------------------- +// Test invariant +// --------------------------------------------------------------------------- +void CGlxListWindow::__DbgTestInvariant() const + { + TRACER("CGlxListWindow::__DbgTestInvariant"); + + __ASSERT_DEBUG( ( iFocusIndex >= 0 && iFocusIndex < iWindow->TotalSize() ) || + ( KErrNotFound == iFocusIndex && 0 == iWindow->TotalSize() ), + Panic( EGlxPanicIllegalState ) ); + __ASSERT_DEBUG( iFrontOffset <= 0 && iRearOffset >= 0, Panic( EGlxPanicIllegalState ) ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxmedia.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxmedia.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1018 @@ +/* +* Copyright (c) 2008-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: Media item +* +*/ + + + + +#include "glxmedia.h" + +#include +#include +#include +#include +#include +#include // for TCoordinate + +#include "glxcollectiongeneraldefs.h" +#include "glxmediastaticitemdefs.h" +#include "glxthumbnailutility.h" +#include //For logging + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +TGlxMedia::TGlxMedia( CGlxMedia& aMedia ) + { + TRACER("TGlxMedia::Default Constructor"); + + __ASSERT_DEBUG ( aMedia.Id() != KGlxIdNone, Panic( EGlxPanicIllegalArgument ) ); // Must have an id defined, + iId = aMedia.Id(); + iItem = &aMedia; + } + +// ----------------------------------------------------------------------------- +// Compare two media items by id +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TGlxMedia::MatchById(const TGlxMedia& aMedia1, const TGlxMedia& aMedia2) + { + TRACER("TGlxMedia::MatchById"); + + return aMedia1.iId == aMedia2.iId; + } + +// ----------------------------------------------------------------------------- +// Tests to see if the Media is a static +// ----------------------------------------------------------------------------- + +EXPORT_C TBool TGlxMedia::IsStatic() const + { + TRACER("TGlxMedia::IsStatic"); + + if ( iItem ) + { + return iItem->IsSupported( KGlxMediaStaticItem ); + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the command associated with a static item +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetStaticItemCommand(TInt& aCmd) const + { + TRACER("TGlxMedia::GetStaticItemCommand"); + + if ( iItem ) + { + TMPXAttribute attrib(KGlxMediaIdStaticItem, + KGlxMediaStaticItemCommand); + return iItem->GetValueTObject( aCmd, attrib ); + } + // by default the cmd value is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the date +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetDate(TTime& aDate) const + { + TRACER("TGlxMedia::GetDate"); + + if ( iItem ) + { + return iItem->GetValueTObject( aDate, KMPXMediaGeneralDate ); + } + // by default the date is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the last modified date +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetLastModifiedDate(TTime& aDate) const + { + TRACER("TGlxMedia::GetLastModifiedDate"); + + if ( iItem ) + { + return iItem->GetValueTObject( aDate, KGlxMediaGeneralLastModifiedDate ); + } + // by default the date is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the general category +// ----------------------------------------------------------------------------- +EXPORT_C TMPXGeneralCategory TGlxMedia::Category() const + { + TRACER("TGlxMedia::Category"); + + TMPXGeneralCategory cat = EMPXNoCategory; + if ( iItem ) + { + // if this fails cat will remain as EMPXNoCategory + iItem->GetValueTObject( cat, KMPXMediaGeneralCategory ); + } + return cat; + } + +// ----------------------------------------------------------------------------- +// Gets the dimensions +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetDimensions(TSize& aSize) const + { + TRACER("TGlxMedia::GetDimensions"); + + if ( iItem ) + { + return iItem->GetValueTObject( aSize, KGlxMediaGeneralDimensions ); + } + // by default the size is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the (file) size +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetSize(TInt& aSize) const + { + TRACER("TGlxMedia::GetSize"); + + if ( iItem ) + { + return iItem->GetValueTObject( aSize, KMPXMediaGeneralSize ); + } + // by default the size is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the duration +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetDuration(TReal32& aDuration) const + { + TRACER("TGlxMedia::GetDuration"); + + if ( iItem ) + { + return iItem->GetValueTObject( aDuration, KMPXMediaGeneralDuration ); + } + // by default the duration is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the frame count +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetFrameCount(TInt& aFrameCount) const + { + TRACER("TGlxMedia::GetFrameCount"); + + if ( iItem ) + { + return iItem->GetValueTObject( aFrameCount, KGlxMediaGeneralFramecount ); + } + // by default the frame count is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the general count +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetContainedItemCount(TInt& aGeneralCount) const + { + TRACER("TGlxMedia::GetContainedItemCount"); + + if ( iItem ) + { + return iItem->GetValueTObject( aGeneralCount, KMPXMediaGeneralCount ); + } + // by default the frame count is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the general count +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetSlideshowPlayableContainedItemCount(TInt& aGeneralCount) const + { + TRACER("TGlxMedia::GetSlideshowPlayableContainedItemCount"); + + if ( iItem ) + { + return iItem->GetValueTObject( aGeneralCount, KGlxMediaGeneralSlideshowableContent ); + } + // by default the frame count is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the coordinate value +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetCoordinate(TCoordinate& aCoordinate) const + { + TRACER("TGlxMedia::GetCoordinate"); + + TBool isSupported = EFalse; + + if ( iItem ) + { + if (iItem->GetValueTObject( aCoordinate, KGlxMediaGeneralLocation )) + { + isSupported = ETrue; + if ( Math::IsNaN( aCoordinate.Latitude() ) || + Math::IsNaN( aCoordinate.Longitude() ) || + aCoordinate.Datum() != KPositionDatumWgs84 ) + { + isSupported = EFalse; + } + } + } + // by default the coodinate is not changed + return isSupported; + } + +// ----------------------------------------------------------------------------- +// Gets the IconInfo +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetIconInfo(TIconInfo& aInfo) const + { + TRACER("TGlxMedia::GetIconInfo"); + + if ( iItem ) + { + return iItem->GetValueTObject( aInfo, KMPXMediaGeneralIcon ); + } + // by default aInfo is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Returns the DRM protection indication - defaults to ETrue if not found +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::IsDrmProtected() const + { + TRACER("TGlxMedia::IsDrmProtected"); + + TBool isDrmProtected = ETrue; + if ( iItem ) + { + // ignore return value. Failure leaves isDrmProtected unchanged as ETrue + iItem->GetValueTObject( isDrmProtected, KMPXMediaDrmProtected ); + } + // by default is protected + return isDrmProtected; + } + +// ----------------------------------------------------------------------------- +// Gets the DRM protection +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetDrmProtected(TBool& aIsProtected) const + { + TRACER("TGlxMedia::GetDrmProtected"); + + if ( iItem ) + { + return iItem->GetValueTObject( aIsProtected, + KMPXMediaDrmProtected ); + } + // by default aIsProtected is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the DRM protection +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetDrmValidity(TGlxMediaGeneralRightsValidity& aIsValid) const + { + if ( iItem ) + { + return iItem->GetValueTObject( aIsValid, + KGlxMediaGeneralDRMRightsValid ); + } + // by default aIsValid is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the System Item indicator +// ----------------------------------------------------------------------------- +EXPORT_C TBool TGlxMedia::GetSystemItem(TBool& aIsSystemItem) const + { + TRACER("TGlxMedia::GetSystemItem"); + + if ( iItem ) + { + return iItem->GetValueTObject( aIsSystemItem, + KGlxMediaGeneralSystemItem ); + } + // by default aIsSystemItem is not changed + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Gets the title +// ----------------------------------------------------------------------------- +EXPORT_C const TDesC& TGlxMedia::Title() const + { + TRACER("TGlxMedia::Title"); + + if ( iItem ) + { + return iItem->ValueText( KMPXMediaGeneralTitle ); + } + return KNullDesC; + } + +// ----------------------------------------------------------------------------- +// Gets the subtitle +// ----------------------------------------------------------------------------- +EXPORT_C const TDesC& TGlxMedia::SubTitle() const + { + TRACER("TGlxMedia::SubTitle"); + + if ( iItem ) + { + return iItem->ValueText( KGlxMediaCollectionPluginSpecificSubTitle ); + } + return KNullDesC; + } + + +// ----------------------------------------------------------------------------- +// Gets the comment +// ----------------------------------------------------------------------------- +EXPORT_C const TDesC& TGlxMedia::Comment() const + { + TRACER("TGlxMedia::Comment"); + + if ( iItem ) + { + return iItem->ValueText( KMPXMediaGeneralComment ); + } + return KNullDesC; + } + +// ----------------------------------------------------------------------------- +// Gets the URI indicating the success in the return value +// ----------------------------------------------------------------------------- +EXPORT_C const TDesC& TGlxMedia::Uri() const + { + TRACER("TGlxMedia::Uri"); + + if( iItem ) + { + return iItem->ValueText( KMPXMediaGeneralUri); + } + // by default descriptor pointer is unchanged + return KNullDesC; + } + +// ----------------------------------------------------------------------------- +// Gets the MimeType indicating the success in the return value +// ----------------------------------------------------------------------------- +EXPORT_C const TDesC& TGlxMedia::MimeType() const + { + TRACER("TGlxMedia::MimeType"); + + if( iItem ) + { + return iItem->ValueText( KMPXMediaGeneralMimeType); + } + // by default descriptor pointer is unchanged + return KNullDesC; + } + + +// ----------------------------------------------------------------------------- +// Gets a thumbnail attribute +// ----------------------------------------------------------------------------- +EXPORT_C const CGlxThumbnailAttribute* TGlxMedia::ThumbnailAttribute( + TMPXAttribute& aAttribute) const + { + TRACER("TGlxMedia::ThumbnailAttribute"); + + if( iItem && KGlxMediaIdThumbnail == aAttribute.ContentId() ) + { + return static_cast + ( iItem->ValueCObject(aAttribute) ); + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// GetClosestThumbnail +// --------------------------------------------------------------------------- +// +EXPORT_C TBool TGlxMedia::GetClosestThumbnail( TMPXAttribute& aAttribute, + const TSize& aDesiredSize, TBool aDrmValid ) const + { + TRACER("TGlxMedia::GetClosestThumbnail"); + + if ( iItem ) + { + TInt index = GlxThumbnailUtility::ClosestThumbnail( aDesiredSize, + *iItem, aDrmValid ); + + if ( index >= 0 ) + { + aAttribute = iItem->Attribute(index); + + return ETrue; + } + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Is the media playable in slideshow +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TGlxMedia::IsSlideShowPlayableContent() const + { + TRACER("TGlxMedia::IsSlideShowPlayableContent"); + + if (iItem) + { + // Only DRM protected images are allowed + if (iItem->IsSupported(KMPXMediaGeneralCategory) && + iItem->IsSupported(KMPXMediaDrmProtected) && + iItem->IsSupported(KGlxMediaGeneralFramecount)) + { + if (iItem->ValueTObject(KMPXMediaGeneralCategory) == EMPXImage && + !iItem->ValueTObject(KMPXMediaDrmProtected) && + iItem->ValueTObject(KGlxMediaGeneralFramecount) == 1) + { + return ETrue; + } + } + // The media item is either not DRM protected, a video or an animated gif + } + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Returns the IdSpaceId associated with the media +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxIdSpaceId TGlxMedia::IdSpaceId() const + { + TRACER("TGlxMedia::IdSpaceId"); + + TGlxIdSpaceId idSpaceId( KGlxIdNone ); + + if ( iItem ) + { + iItem->GetValueTObject( idSpaceId, KMPXMediaColDetailSpaceId ); + } + + return idSpaceId; + } + +// ----------------------------------------------------------------------------- +// Set media pointer +// ----------------------------------------------------------------------------- +// +void TGlxMedia::SetMedia( CGlxMedia* aMedia, MGlxMediaUser& aMediaUser, TInt aIndex ) + { + TRACER("TGlxMedia::SetMedia"); + + __ASSERT_DEBUG( aMedia == NULL || !iItem , Panic(EGlxPanicAlreadyInitialised ) ); // Already has media + if ( aMedia ) + { + // Media object being added + aMedia->AddUser( aMediaUser, aIndex ); + } + else if ( iItem ) + { + // Media object being set to null, remove since old media object exists + iItem->RemoveUser( aMediaUser ); + } + iItem = aMedia; + } + +// ----------------------------------------------------------------------------- +// Update media +// ----------------------------------------------------------------------------- +// +void TGlxMedia::UpdateMedia( MGlxMediaUser& aMediaUser, TInt aIndex ) + { + TRACER("TGlxMedia::UpdateMedia"); + + if ( iItem ) + { + iItem->UpdateUser( aMediaUser, aIndex ); + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMedia::CGlxMedia(const TGlxMediaId& aId) + : iId(aId), iUsers(2) // On average, two list as users assumed + { + TRACER("CGlxMedia::Default Constructor"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMedia::~CGlxMedia() + { + TRACER("CGlxMedia::Destructor"); + + iUsers.Close(); + + Reset(); + iValues.Close(); + iAttributes.Close(); + } + +// ----------------------------------------------------------------------------- +// Make space in the array of users, so can safely append later +// ----------------------------------------------------------------------------- +// +void CGlxMedia::ReserveUsersL(TInt aReservationCount) + { + TRACER("CGlxMedia::ReserveUsersL"); + + iUsers.ReserveL( aReservationCount ); + __DEBUG_ONLY( _iUserReservationCount = aReservationCount ); + } + +// ----------------------------------------------------------------------------- +// Adds a user to the list +// ----------------------------------------------------------------------------- +// +void CGlxMedia::AddUser( MGlxMediaUser& aUser, TInt aIndex ) + { + TRACER("CGlxMedia::AddUser"); + + // Must not exist already + __ASSERT_DEBUG( !IsUser( aUser ), Panic( EGlxPanicAlreadyAdded ) ); + // Client must have made a reservation before calling + __ASSERT_DEBUG( _iUserReservationCount > 0, Panic( EGlxPanicLogicError ) ); + + __DEBUG_ONLY( _iUserReservationCount-- ); + + iUsers.Append( TMediaUser( &aUser, aIndex ) ); // Ignore error, cannot fail since reservation made + } + +// ----------------------------------------------------------------------------- +// RemoveUser +// ----------------------------------------------------------------------------- +// +void CGlxMedia::RemoveUser( const MGlxMediaUser& aUser ) + { + TRACER("CGlxMedia::RemoveUser"); + + TMediaUser mediaUser( const_cast( &aUser ) ); + TInt index = iUsers.Find( mediaUser, &TMediaUser::MatchUser ); + if ( KErrNotFound != index ) + { + iUsers.Remove( index ); + } + } + +// ----------------------------------------------------------------------------- +// IsUser +// ----------------------------------------------------------------------------- +// +TBool CGlxMedia::IsUser( const MGlxMediaUser& aUser ) const + { + TRACER("CGlxMedia::IsUser"); + + TMediaUser mediaUser( const_cast( &aUser ) ); + return ( KErrNotFound != iUsers.Find( mediaUser, &TMediaUser::MatchUser ) ); + } + +// ----------------------------------------------------------------------------- +// Return user by index +// ----------------------------------------------------------------------------- +// +MGlxMediaUser& CGlxMedia::User( TInt aIndex ) const + { + TRACER("CGlxMedia::User"); + + return *( iUsers[ aIndex ].iMediaUser ); + } + +// ----------------------------------------------------------------------------- +// Return index in the media list user +// ----------------------------------------------------------------------------- +// +TInt CGlxMedia::IndexInUser(TInt aIndex) const + { + TRACER("CGlxMedia::IndexInUser"); + + return iUsers[ aIndex ].iIndex; + } + +// ----------------------------------------------------------------------------- +// Update index in the media list user +// ----------------------------------------------------------------------------- +// +void CGlxMedia::UpdateUser( MGlxMediaUser& aUser, TInt aIndex ) + { + TRACER("CGlxMedia::UpdateUser"); + + TMediaUser mediaUser( &aUser ); + TInt index = iUsers.Find( mediaUser, &TMediaUser::MatchUser ); + if ( KErrNotFound != index ) + { + iUsers[ index ].iIndex = aIndex; + } + } + +// ----------------------------------------------------------------------------- +// Return the number of users +// ----------------------------------------------------------------------------- +// +TInt CGlxMedia::UserCount() const + { + TRACER("CGlxMedia::UserCount"); + + return iUsers.Count(); + } + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CGlxMedia::ValueText(const TMPXAttribute& aAttribute) const + { + TRACER("CGlxMedia::ValueText"); + + TInt i = Index(aAttribute); + HBufC* ptr = NULL; + if (i == KErrNotFound) + { + return KNullDesC; + } + + // __ASSERT_DEBUG(EMPXTypeText == iValues[i].iType, + // Panic(EGlxPanicWrongAttributeType)); + if(EMPXTypeText == iValues[i].iType) + { + ptr = reinterpret_cast(iValues[i].iValue); + __ASSERT_DEBUG(ptr != NULL, Panic(EGlxPanicNullPointer)); + } + + return *ptr; + } + +// ----------------------------------------------------------------------------- +// The text from a specific attribute, indicating success +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMedia::GetValueText(TPtrC& aText, + const TMPXAttribute& aAttribute) const + { + TRACER("CGlxMedia::GetValueText"); + + TInt i = Index(aAttribute); + if (i == KErrNotFound) + { + // leave aText unchanged + return EFalse; + } + + __ASSERT_DEBUG(EMPXTypeText == iValues[i].iType, + Panic(EGlxPanicWrongAttributeType)); + HBufC* ptr = reinterpret_cast(iValues[i].iValue); + __ASSERT_DEBUG(ptr != NULL, Panic(EGlxPanicNullPointer)); + aText.Set(*ptr); + return ETrue; + } + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C const CBase* CGlxMedia::ValueCObject(const TMPXAttribute& aAttribute) const + { + TRACER("CGlxMedia::ValueCObject"); + + TInt i = Index(aAttribute); + if (i == KErrNotFound) + { + return NULL; + } + + __ASSERT_DEBUG(EMPXTypeCObject == iValues[i].iType, + Panic(EGlxPanicWrongAttributeType)); + CBase* ptr = reinterpret_cast(iValues[i].iValue); + __ASSERT_DEBUG(ptr != NULL, Panic(EGlxPanicNullPointer)); + return ptr; + } + +// ----------------------------------------------------------------------------- +// Clears all the attributes and values +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMedia::Reset() + { + TRACER("CGlxMedia::Reset"); + + // Delete attribute values + TInt count = iValues.Count(); + __ASSERT_DEBUG(iAttributes.Count() == count, Panic(EGlxPanicLogicError)); + for (TInt i = 0; i < count; i++) + { + Delete(iValues[i]); + } + + // Remove also attributes and pointers to values + iValues.Reset(); + iAttributes.Reset(); + } + +// ----------------------------------------------------------------------------- +// Deletes the value +// ----------------------------------------------------------------------------- +// +void CGlxMedia::Delete(TValue& aValue) + { + TRACER("CGlxMedia::Delete"); + + TMPXAttributeType type = aValue.iType; + if (type == EMPXTypeText) + { + delete reinterpret_cast(aValue.iValue); + } + else if (type == EMPXTypeCObject) + { + delete reinterpret_cast(aValue.iValue); + } + else if (type == EMPXTypeTObject) + { + User::Free(aValue.iValue); + } + } + +// ----------------------------------------------------------------------------- +// Sets or modifies the value +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMedia::SetTextValueL(const TMPXAttribute& aAttribute, + const TDesC& aValue) + { + TRACER("CGlxMedia::SetTextValueL"); + + // Allocate first for leave safely + HBufC* buf = aValue.AllocLC(); + + TInt i = Index(aAttribute); + if (i != KErrNotFound) + { + // Replace the existing value + TValue& value = iValues[i]; + Delete(value); + + value.iValue = buf; + value.iType = EMPXTypeText; + } + else + { + iValues.AppendL(TValue(buf, EMPXTypeText)); + TInt err = iAttributes.Append(aAttribute); + if (err != KErrNone) + { + // Failed, undo the append + iValues.Remove(iValues.Count() - 1); + User::Leave(err); + } + } + + CleanupStack::Pop(buf); + } + +// ----------------------------------------------------------------------------- +// Sets or modifies the value +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMedia::SetCObjectValueL(const TMPXAttribute& aAttribute, + CBase* aValue_TakesOwnership) + { + TRACER("CGlxMedia::SetCObjectValueL"); + + TInt i = Index(aAttribute); + if (i != KErrNotFound) + { + // Replace the existing value + TValue& value = iValues[i]; + Delete(value); + + value.iValue = aValue_TakesOwnership; + value.iType = EMPXTypeCObject; + } + else + { + iValues.AppendL(TValue(aValue_TakesOwnership, EMPXTypeCObject)); + TInt err = iAttributes.Append(aAttribute); + if (err != KErrNone) + { + // Failed, undo the append + iValues.Remove(iValues.Count() - 1); + User::Leave(err); + } + } + } + +// ----------------------------------------------------------------------------- +// DeleteAttribute +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMedia::DeleteAttribute(const TMPXAttribute& aAttribute) + { + TRACER("CGlxMedia::DeleteAttribute"); + + TInt index = Index( aAttribute ); + if ( KErrNotFound != index ) + { + DeleteAttribute( index ); + } + } + +// ----------------------------------------------------------------------------- +// AttributeTypeId +// ----------------------------------------------------------------------------- +// +TMPXAttributeType CGlxMedia::AttributeTypeId(const TMPXAttribute& aAttribute) const + { + TRACER("CGlxMedia::AttributeTypeId"); + + TMPXAttributeType type(EMPXTypeUnknown); + TInt index(Index(aAttribute)); + if( index != KErrNotFound) + { + return iValues[index].iType; + } + return type; + + } +// ----------------------------------------------------------------------------- +// DeleteAttribute +// ----------------------------------------------------------------------------- +// +void CGlxMedia::DeleteAttribute( TInt aAttributeIndex ) + { + TRACER("CGlxMedia::DeleteAttribute"); + + GLX_ASSERT_DEBUG( 0 <= aAttributeIndex && aAttributeIndex < iValues.Count(), + Panic(EGlxPanicIllegalArgument), "deleting attribute out of bounds"); + + // Delete the existing value + TValue& value = iValues[aAttributeIndex]; + Delete( value ); + iValues.Remove( aAttributeIndex ); + iAttributes.Remove( aAttributeIndex ); + } + +// ----------------------------------------------------------------------------- +// Handles modification of item +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxMedia::HandleModified(const RArray& aAttributes) + { + TRACER("CGlxMedia::HandleModified"); + + TInt attributeCount = aAttributes.Count(); + if (attributeCount > 0) + { + // Remove specified attributes + for (TInt count = 0; count < attributeCount; ++count) + { + DeleteAttribute(aAttributes[count]); + } + } + else + { + // Remove all attributes + Reset(); + } + } + +// ----------------------------------------------------------------------------- +// Sets generic TAny* value +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxMedia::SetValueL(const TMPXAttribute& aAttribute, TAny* aValue, TMPXAttributeType aType) + { + TRACER("CGlxMedia::SetValueL"); + + TInt i = Index(aAttribute); + if (KErrNotFound != i) + { + // Replace the existing value + TValue& value = iValues[i]; + Delete(value); + + value.iValue = aValue; // Takes ownership + value.iType = aType; + } + else + { + TInt err = iValues.Append(TValue(aValue, aType)); + + // If appended value ok, try to append the attribute. + if (KErrNone == err) + { + err = iAttributes.Append(aAttribute); + if (err != KErrNone) + { + // Failed, undo the append + iValues.Remove(iValues.Count() - 1); + } + } + + if (KErrNone != err) + { + User::Free(aValue); + User::Leave(err); + } + } + } + + +// --------------------------------------------------------------------------- +// Find match by MGlxMediaUser +// --------------------------------------------------------------------------- +// +TBool CGlxMedia::TMediaUser::MatchUser(const TMediaUser& aUser1, const TMediaUser& aUser2) + { + TRACER("CGlxMedia::TMediaUser::MatchUser"); + + return aUser1.iMediaUser == aUser2.iMediaUser; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxMedia::TMediaUser::TMediaUser(MGlxMediaUser* aMediaUser, TInt aIndex) : + iMediaUser( aMediaUser ), + iIndex( aIndex ) + { + TRACER("CGlxMedia::TMediaUser::Default Constructor"); + + } + +// --------------------------------------------------------------------------- +// Test invariant +// --------------------------------------------------------------------------- +void CGlxMedia::__DbgTestInvariant() const + { + TRACER("CGlxMedia::__DbgTestInvariant"); + + #ifdef _DEBUG + + __ASSERT_DEBUG( Id() != KGlxIdNone, Panic(EGlxPanicIllegalState)); + // Make sure each list is a user only once + TInt userCount = iUsers.Count(); + for (TInt i = 0; i < userCount; i++) + { + for (TInt j = i + 1; j < userCount; j++) + { + __ASSERT_DEBUG( !TMediaUser::MatchUser( iUsers[i], iUsers[j] ), Panic(EGlxPanicIllegalState)); + } + } + + #endif // _DEBUG + } + +// ----------------------------------------------------------------------------- +// Delete location attribute +// ----------------------------------------------------------------------------- +EXPORT_C void TGlxMedia::DeleteLocationAttribute() + { + TRACER("TGlxMedia::DeleteLocationAttribute"); + if ( iItem ) + { + iItem->DeleteAttribute( KGlxMediaGeneralLocation ); + } + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxmedialist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxmedialist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1888 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +#include "glxmedialist.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "glxcachemanager.h" +#include "glxmedialistarray.h" +#include "glxnavigablelist.h" +#include "mglxfetchcontext.h" +#include "mglxmedialistobserver.h" +#include "glxmediastaticitemdefs.h" + +/** + * Min & Max wait interval for a modify event, in microseconds + * This is to allow thumbnail manager to procees the event first. + */ +const TInt KModifyEventMinWaitInterval = 2000000; +const TInt KModifyEventMaxWaitInterval = 3000000; +/** + * Maximum items count for minimum wait interval. + */ +const TInt KMaxItemsCount = 500; +namespace NGlxMediaList + { + /** + * Interface to notify observers. Allows different notifications to use + * the same (complicated) iteration loop + */ + class TNotificationStrategy + { + public: + TNotificationStrategy( MGlxMediaList& aList ) + : iList( aList ) + { + } + + /** + * Notify observer + * @param aObserver Observer to notify + */ + virtual void NotifyL( MGlxMediaListObserver& aObserver ) = 0; + + protected: + MGlxMediaList& iList; + }; + + /** + * Notification strategy for items being added + */ + class TItemsAddedNotificationStrategy : public TNotificationStrategy + { + public: + /** + * Constructor + * @param aFirstAddedIndex Index of the first item added + * @param aCount number of items added + * @param aList Media list that sends the notification + */ + TItemsAddedNotificationStrategy( TInt aFirstAddedIndex, + TInt aCount, MGlxMediaList& aList ) + : TNotificationStrategy( aList ) + { + iFirstAddedIndex = aFirstAddedIndex; + iLastAddedIndex = aFirstAddedIndex + aCount - 1; + } + + // From MGlxNotificationStrategy + void NotifyL( MGlxMediaListObserver& aObserver ) + { + aObserver.HandleItemAddedL( iFirstAddedIndex, iLastAddedIndex, + &iList ); + } + + private: + /// Index of the first item added + TInt iFirstAddedIndex; + /// Index of the last item added + TInt iLastAddedIndex; + }; + + /** + * Notification strategy for items being removed + */ + class TItemsRemovedNotificationStrategy : public TNotificationStrategy + { + public: + /** + * Constructor + * @param aFirstRemovedIndex Index of the first item removed + * @param aCount number of items removed + * @param aList Media list that sends the notification + */ + TItemsRemovedNotificationStrategy( TInt aFirstRemovedIndex, + TInt aCount, MGlxMediaList& aList ) + : TNotificationStrategy( aList ) + { + iFirstRemovedIndex = aFirstRemovedIndex; + iLastRemovedIndex = aFirstRemovedIndex + aCount - 1; + } + + // From MGlxNotificationStrategy + void NotifyL( MGlxMediaListObserver& aObserver ) + { + aObserver.HandleItemRemovedL( iFirstRemovedIndex, + iLastRemovedIndex, &iList ); + } + + private: + /// Index of the first item removed + TInt iFirstRemovedIndex; + /// Index of the last item removed + TInt iLastRemovedIndex; + }; + + /** + * Notification strategy for focus being changed + */ + class TFocusChangedNotificationStrategy : public TNotificationStrategy + { + public: + /** + * Constructor + * @param aFirstRemovedIndex Index of the first item removed + * @param aCount number of items removed + * @param aList Media list that sends the notification + */ + TFocusChangedNotificationStrategy( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList& aList ) + : TNotificationStrategy( aList ) + { + iType = aType; + iNewIndex = aNewIndex; + iOldIndex = aOldIndex; + } + + // From MGlxNotificationStrategy + void NotifyL( MGlxMediaListObserver& aObserver ) + { + aObserver.HandleFocusChangedL( iType, iNewIndex, iOldIndex, &iList ); + } + + private: + /// Focus change type + NGlxListDefs::TFocusChangeType iType; + /// New focus index + TInt iNewIndex; + /// Old focus index + TInt iOldIndex; + }; + + /** + * Notification strategy for selection being changed + */ + class TItemSelectedNotificationStrategy : public TNotificationStrategy + { + public: + /** + * Constructor + * @param aIndex Index of item being selected/deselected + * @param aSelected Selection/deselection info + * @param aList Media list that sends the notification + */ + TItemSelectedNotificationStrategy( TInt aIndex, TBool aSelected, + MGlxMediaList& aList ) + : TNotificationStrategy( aList ) + { + iIndex = aIndex; + iSelected = aSelected; + } + + // From MGlxNotificationStrategy + void NotifyL( MGlxMediaListObserver& aObserver ) + { + aObserver.HandleItemSelectedL( iIndex, iSelected, &iList ); + } + + private: + /// Index of item being selected/deselected + TInt iIndex; + /// Selection/deselection info + TBool iSelected; + }; + + /** + * Notification strategy for command being completed + */ + class TCommandCompletedNotificationStrategy : public TNotificationStrategy + { + public: + /** + * Constructor + * @param aSessionId Session id of client that issued the command + * @param aCommand Command which was completed + * @param aError Error code from execution of the command + * @param aList Media list that sends the notification + */ + TCommandCompletedNotificationStrategy( TAny* aSessionId, + CMPXCommand* aCommand, TInt aError, MGlxMediaList& aList ) + : TNotificationStrategy( aList ) + { + iSessionId = aSessionId; + iCommand = aCommand; + iError = aError; + } + + // From MGlxNotificationStrategy + void NotifyL( MGlxMediaListObserver& aObserver ) + { + /// @todo: make this call leaving + aObserver.HandleCommandCompleteL( iSessionId, iCommand, iError, &iList ); + } + + private: + /// Session id of client that issued the command + TAny* iSessionId; + /// Command which was completed + CMPXCommand* iCommand; + /// Error code + TBool iError; + }; + + + + /** + * Notification strategy for list population + */ + class TListPopulatedNotificationStrategy : public TNotificationStrategy + { + public: + /** + * Constructor + * @param aList Media list that sends the notification + */ + TListPopulatedNotificationStrategy ( MGlxMediaList& aList ) + : TNotificationStrategy( aList ) + { + } + + // From MGlxNotificationStrategy + void NotifyL( MGlxMediaListObserver& aObserver ) + { + aObserver.HandlePopulatedL( &iList ); + } + }; + + /** + * Notification strategy for messages + */ + class TMessageNotificationStrategy : public TNotificationStrategy + { + public: + /** + * Constructor + * @param aList Media list that sends the notification + */ + TMessageNotificationStrategy ( const CMPXMessage& aMessage, MGlxMediaList& aList ) : + TNotificationStrategy( aList ), + iMessage( aMessage ) + { + } + + // From MGlxNotificationStrategy + void NotifyL( MGlxMediaListObserver& aObserver ) + { + aObserver.HandleMessageL( iMessage, &iList ); + } + + private: + /// Message which was received + const CMPXMessage& iMessage; + }; + } // namespace NGlxMediaList + +using namespace NGlxMediaList; + +// ----------------------------------------------------------------------------- +// Returns a new/existing media list interface +// ----------------------------------------------------------------------------- +CGlxMediaList* CGlxMediaList::InstanceL(const CMPXCollectionPath& aPath, + const TGlxHierarchyId& aHierarchyId, CMPXFilter* aFilter) + { + TRACER("CGlxMediaList::InstanceL" ); + + CGlxMediaListArray* mediaListArray = CGlxMediaListArray::InstanceL(); + CleanupClosePushL(*mediaListArray); + + RPointerArray& mediaLists = mediaListArray->Array(); + + TInt matchIndex = KErrNotFound; + CGlxMediaList* mediaListInstance = NULL; // List to return + + // Try to find an existing media list to return (by matching the path) + TInt listCount = mediaLists.Count(); + for (TInt count = 0; count < listCount; ++count) + { + CGlxMediaList* mediaList = mediaLists[count]; + + // See if path's and hierarchy id's match + // Filter is ignored + if (mediaList->Equals(aPath) && (mediaList->iHierarchyId == aHierarchyId)) + { + // Found a match + matchIndex = count; + mediaListInstance = mediaList; + break; + } + } + + // Create a new media list if could not use an existing one + if (matchIndex == KErrNotFound) + { + __ASSERT_DEBUG(!mediaListInstance, Panic(EGlxPanicAlreadyInitialised)); + + mediaListInstance = CGlxMediaList::NewLC(aHierarchyId); + + // Set specified filter (if any) before opening the collection to path + mediaListInstance->SetFilterL(aFilter); + mediaListInstance->OpenL(aPath); + + // Insert media list as highest priority + mediaLists.InsertL(mediaListInstance, 0); + CleanupStack::Pop(mediaListInstance); + } + else + { + __ASSERT_DEBUG(mediaListInstance, Panic(EGlxPanicNullPointer)); + + // Match found, set as highest priority + mediaLists.InsertL(mediaListInstance, 0); + mediaLists.Remove(matchIndex + 1); + } + + mediaListInstance->AddReference(); // Add user + + CleanupStack::PopAndDestroy(mediaListArray); + + return mediaListInstance; + } + +// ----------------------------------------------------------------------------- +// Gives an array of all media lists in current use +// ----------------------------------------------------------------------------- +RPointerArray& CGlxMediaList::MediaListsL() + { + TRACER("CGlxMediaList::MediaListsL" ); + + CGlxMediaListArray* mediaListArray = CGlxMediaListArray::InstanceL(); + RPointerArray& array = mediaListArray->Array(); + mediaListArray->Close(); + return array; + } + +// ----------------------------------------------------------------------------- +// OfferMedia +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::OfferMedia(const TGlxIdSpaceId& aIdSpaceId, CGlxMedia* aMedia) + { + TRACER("CGlxMediaList::OfferMedia" ); + + // try to find the matching item in this list + TInt index = Index( aIdSpaceId, aMedia->Id() ); + // if matching item found, link media object + if ( KErrNotFound != index ) + { + TGlxMedia& item = iItemList->Item( index ); + + // static items should not be offered + if ( !item.IsStatic() ) + { + item.SetMedia( aMedia, *this, index ); + } + } + } + +// ----------------------------------------------------------------------------- +// NotifyThumbnailAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::HandleAttributesAvailableL(TInt aIndex, + const RArray& aAttributes) + { + TRACER("CGlxMediaList::HandleAttributesAvailableL" ); + + __ASSERT_DEBUG(aIndex >= 0, Panic(EGlxPanicLogicError)); // Must exist + // Need to get exact count of iItemListObservers at + // every iteration because it is possible that + // RemoveMediaListObserver might call during this iteration + for (TInt i = 0; i < iItemListObservers.Count(); i++) + { + iItemListObservers[i]->HandleAttributesAvailableL(aIndex, aAttributes, this); + } + } + +// ----------------------------------------------------------------------------- +// Ask if the list has any requests to place +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::AttributeRequestL(RArray& aItemIndexes, + RArray& aItemIds, + RArray& aAttributes, + CMPXAttributeSpecs*& aDetailedSpecs) const + { + TRACER("CGlxMediaList::AttributeRequestL" ); + + // Find the highest priority context that has something to request + TInt count = iContexts.Count(); + for (TInt i = 0; i < count; i++) + { + // Determine items (referenced by index) to request attributes for + iContexts[i].iContext->AttributeRequestL(this, aItemIndexes, aAttributes, aDetailedSpecs); + + // Map item indices to item Ids + TInt itemIndicesCount = aItemIndexes.Count(); + for (TInt itemIndicesCounter = 0; itemIndicesCounter < itemIndicesCount; ++itemIndicesCounter) + { + const TGlxMedia& item = iItemList->Item( aItemIndexes[itemIndicesCounter] ); + if (!item.IsStatic()) + { + aItemIds.AppendL( item.Id() ); + } + } + + // break if context has something to request + if (itemIndicesCount > 0) + { + break; + } + } + } + +// --------------------------------------------------------------------------- +// AllAttributesL +// --------------------------------------------------------------------------- +// +void CGlxMediaList::GetRequiredAttributesL(TInt aIndex, RArray& aAttributes) + { + TRACER("CGlxMediaList::GetRequiredAttributesL" ); + + TLinearOrder orderer (&AttributeOrder); + + // Determine all attributes to request for an item, for all contexts + TInt contextCount = iContexts.Count(); + for ( TInt contextIndex = 0; contextIndex < contextCount; contextIndex++ ) + { + const MGlxFetchContext* context = iContexts[contextIndex].iContext; + if ( context ) + { + // Determine all attributes to request for an item, for this context + context->AllAttributesL(this, aIndex, aAttributes); + + } + } + } + +// --------------------------------------------------------------------------- +// AttributeOrder +// --------------------------------------------------------------------------- +// +TInt CGlxMediaList::AttributeOrder(const TMPXAttribute& aItem1, + const TMPXAttribute& aItem2) + { + TRACER("CGlxMediaList::AttributeOrder"); + + TInt contentId1 = aItem1.ContentId(); + TInt contentId2 = aItem2.ContentId(); + + if (contentId1 < contentId2) + { + return -1; + } + + if (contentId1 > contentId2) + { + return 1; + } + + TUint attributeId1 = aItem1.AttributeId(); + TUint attributeId2 = aItem2.AttributeId(); + + if (attributeId1 < attributeId2) + { + return -1; + } + + if (attributeId1 > attributeId2) + { + return 1; + } + + return 0; + } + +// --------------------------------------------------------------------------- +// AttributeOrderReversed +// --------------------------------------------------------------------------- +// +TInt CGlxMediaList::AttributeOrderReversed(const TMPXAttribute& aItem1, + const TMPXAttribute& aItem2) + { + TRACER("CGlxMediaList::AttributeOrderReversed"); + + return -AttributeOrder(aItem1, aItem2); + } + +// --------------------------------------------------------------------------- +// Remore references to the media object +// --------------------------------------------------------------------------- +// +void CGlxMediaList::RemoveReference( TInt aIndex ) + { + TRACER( "CGlxMediaList::RemoveReference" ); + GLX_ASSERT_DEBUG( iItemList, Panic( EGlxPanicNotInitialised ), + "not ready to remove references" ); + + GLX_LOG_INFO1( "CGlxMediaList::RemoveReference %d", aIndex ); + iItemList->RemoveReference( aIndex ); + } + +// --------------------------------------------------------------------------- +// HandleError +// --------------------------------------------------------------------------- +// +void CGlxMediaList::HandleError(TInt aError) + { + TRACER( "CGlxMediaList::HandleError"); + GLX_LOG_INFO1( "CGlxMediaList::HandleError %d", aError ); + TInt obsCount = iItemListObservers.Count(); + for (TInt obsIdx = 0; obsIdx < obsCount; ++obsIdx) + { + iItemListObservers[obsIdx]->HandleError(aError); + } + } + +// ----------------------------------------------------------------------------- +// Releases a media list interface +// ----------------------------------------------------------------------------- +void CGlxMediaList::Close() + { + TRACER( "CGlxMediaList::Close" ); + + RPointerArray& mediaLists = iMediaListArray->Array(); + + TInt listCount = mediaLists.Count(); + for (TInt count = 0; count < listCount; ++count) + { + CGlxMediaList* mediaList = mediaLists[count]; + + if (mediaList == this) + { + TInt referenceCount = mediaList->RemoveReference(); + if (referenceCount == 0) + { + mediaLists.Remove(count); + mediaLists.Compress(); + + delete mediaList; + break; + } + } + } + } + +// ----------------------------------------------------------------------------- +// Id +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +TGlxMediaListId CGlxMediaList::Id() const + { + TRACER( "CGlxMediaList::Id" ); + + return TGlxMediaListId((unsigned int)(void*)this); + } + +// ----------------------------------------------------------------------------- +// Count +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +TInt CGlxMediaList::Count(NGlxListDefs::TCountType aType) const + { + TRACER("CGlxMediaList::Count"); + + return iItemList->Count( aType ); + } + +// ----------------------------------------------------------------------------- +// FocusIndex +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +TInt CGlxMediaList::FocusIndex() const + { + TRACER("CGlxMediaList::FocusIndex"); + + return iItemList->FocusIndex(); + } + +// ----------------------------------------------------------------------------- +// SetFocusL +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::SetFocusL(NGlxListDefs::TFocusSetType aType, TInt aValue) + { + TRACER("CGlxMediaList::SetFocusL"); + + GLX_LOG_INFO1( "CGlxMediaList::SetFocusL %d", aValue ); + iItemList->SetFocus( aType, aValue ); + } + +// ----------------------------------------------------------------------------- +// Item +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +const TGlxMedia& CGlxMediaList::Item(TInt aIndex) const + { + TRACER("CGlxMediaList::Item"); + + return iItemList->Item( aIndex ); + } + +// ----------------------------------------------------------------------------- +// Index +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +TInt CGlxMediaList::Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId) const + { + TRACER("CGlxMediaList::Index"); + + return iItemList->Index( aIdSpaceId, aId ); + } + +// ----------------------------------------------------------------------------- +// AddMediaListObserverL +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::AddMediaListObserverL(MGlxMediaListObserver* aObserver) + { + TRACER("CGlxMediaList::AddMediaListObserverL"); + GLX_LOG_INFO1( "CGlxMediaList::AddMediaListObserverL(0x%x)", aObserver ); + + // Make sure the observer is not already in the array + __ASSERT_DEBUG(iItemListObservers.Find(aObserver) == -1, Panic(EGlxPanicIllegalArgument)); // Observer already added + + iItemListObservers.AppendL(aObserver); + } + +// ----------------------------------------------------------------------------- +// RemoveMediaListObserver +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::RemoveMediaListObserver(MGlxMediaListObserver* aObserver) + { + TRACER("CGlxMediaList::RemoveMediaListObserver"); + GLX_LOG_INFO1( "CGlxMediaList::RemoveMediaListObserver(0x%x)", aObserver ); + + TInt index = iItemListObservers.Find(aObserver); + + // Make sure the observer is in the array + // LOG THIS! __ASSERT_DEBUG(index != -1, Panic(EGlxPanicIllegalArgument)); // No such observer + + if (index != KErrNotFound) + { + iItemListObservers.Remove(index); + } + } + +// ----------------------------------------------------------------------------- +// AddContextL +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::AddContextL(const MGlxFetchContext* aContext, + TInt aPriority) + { + TRACER("CGlxMediaList::AddContextL"); + GLX_LOG_INFO1( "CGlxMediaList::AddContextL(0x%x)", aContext ); + + if (!aContext) + { + return; + } + + // Add the new context in priority order + TContext context; + context.iContext = aContext; + context.iPriority = aPriority; + +#ifdef _DEBUG + + // Make sure no duplicate entries + TIdentityRelation match (&CGlxMediaList::TContext::Match); + __ASSERT_DEBUG(iContexts.Find(context, match) == KErrNotFound, Panic(EGlxPanicAlreadyAdded)); + +#endif // _DEBUG + + TLinearOrder orderer (&CGlxMediaList::TContext::Compare); + TInt ret = iContexts.InsertInOrderAllowRepeats(context, orderer); + User::LeaveIfError(ret); + + iManager->HandleWindowChangedL(this); + } + +// ----------------------------------------------------------------------------- +// RemoveContext +// From MGlxMediaList +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::RemoveContext(const MGlxFetchContext* aContext) + { + TRACER("CGlxMediaList::RemoveContext"); + GLX_LOG_INFO1( "CGlxMediaList::RemoveContext(0x%x)", aContext ); + + if (!aContext) + { + return; + } + + TIdentityRelation match (&CGlxMediaList::TContext::Match); + TContext context; + context.iContext = aContext; + context.iPriority = 0; + TInt index = iContexts.Find(context, match); + + // remove the context if it was found, just ignore if its not found + if (index != KErrNotFound) + { + iContexts.Remove(index); + // notify cache manager: garbage collection needs to be run to free the + // items that the removed context required + TRAP_IGNORE( iManager->HandleWindowChangedL( this ) ); + } + } + +// ----------------------------------------------------------------------------- +// Returns the isolated collection, that is used by this media list +// ----------------------------------------------------------------------------- +// +MMPXCollection& CGlxMediaList::Collection() const + { + TRACER("CGlxMediaList::Collection"); + __ASSERT_DEBUG(iCollectionUtility != NULL, Panic(EGlxPanicNullPointer)); + return iCollectionUtility->Collection(); + } + +// ----------------------------------------------------------------------------- +// Returns the current path +// ----------------------------------------------------------------------------- +CMPXCollectionPath* CGlxMediaList::PathLC(NGlxListDefs::TPathType aType) const + { + TRACER("CGlxMediaList::PathLC"); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + + // Add navigation to parent + PathPopulateParentL( *path ); + + if ( aType == NGlxListDefs::EPathAllOrSelection || + aType == NGlxListDefs:: EPathFocusOrSelection ) + { + // If selection exists, add only selection + // Otherwise add all items or focused item + if ( iItemList->SelectedItemIndices().Count() > 0 ) + { + PathPopulateSelectionL( *path ); + } + else + { + if ( aType == NGlxListDefs::EPathAllOrSelection ) + { + PathPopulateAllL( *path ); + } + else if ( aType == NGlxListDefs:: EPathFocusOrSelection ) + { + PathPopulateFocusL( *path ); + } + } + } + + return path; + } + +// ----------------------------------------------------------------------------- +// Determines if an item has been selected +// ----------------------------------------------------------------------------- +TBool CGlxMediaList::IsSelected(TInt aIndex) const + { + TRACER("CGlxMediaList::IsSelected"); + GLX_LOG_INFO1( "CGlxMediaList::IsSelected %d", aIndex ); + return iItemList->IsSelected( aIndex ); + } + +// ----------------------------------------------------------------------------- +// Handles item selection/deselection +// ----------------------------------------------------------------------------- +void CGlxMediaList::SetSelectedL(TInt aIndex, TBool aSelected) + { + TRACER("CGlxMediaList::SetSelectedL"); + GLX_LOG_INFO2( "CGlxMediaList::SetSelectedL %d:%d", aIndex, aSelected ); + iItemList->SetSelectedL( aIndex, aSelected ); + } + +// ----------------------------------------------------------------------------- +// Returns selection count +// ----------------------------------------------------------------------------- +TInt CGlxMediaList::SelectionCount() const + { + TRACER("CGlxMediaList::SelectionCount"); + + return iItemList->SelectedItemIndices().Count(); + } + +// ----------------------------------------------------------------------------- +// Returns selected item index from selection +// ----------------------------------------------------------------------------- +TInt CGlxMediaList::SelectedItemIndex(TInt aSelectionIndex) const + { + TRACER("CGlxMediaList::SelectedItemIndex"); + GLX_LOG_INFO1( "CGlxMediaList::SelectedItemIndex %d", aSelectionIndex ); + return iItemList->SelectedItemIndices()[ aSelectionIndex ]; + } + +// ----------------------------------------------------------------------------- +// Sends a command to the collection +// ----------------------------------------------------------------------------- +void CGlxMediaList::CommandL(CMPXCommand& aCommand) + { + TRACER("CGlxMediaList::CommandL"); + + // Multiple commands should not happen + __ASSERT_DEBUG( !iCommandPending, Panic( EGlxPanicLogicError ) ); + + // Send the command + Collection().CommandL( aCommand ); + + // Use the sessionId to indicate that a command is pending + __ASSERT_DEBUG( aCommand.IsSupported( KMPXCommandGeneralSessionId ), + Panic( EGlxPanicLogicError ) ); + + iCommandPending = aCommand.ValueTObjectL( KMPXCommandGeneralSessionId ); + } + +// ----------------------------------------------------------------------------- +// Cancels a command on the collection +// ----------------------------------------------------------------------------- +void CGlxMediaList::CancelCommand() + { + TRACER("CGlxMediaList::CancelCommand"); + + // Cancelling a non issued command should not happen + __ASSERT_DEBUG( iCommandPending, Panic( EGlxPanicLogicError ) ); + + // Cancel command + Collection().CancelRequest(); + iCommandPending = NULL; + } + +// ----------------------------------------------------------------------------- +// Specify filter on the media list +// ----------------------------------------------------------------------------- +void CGlxMediaList::SetFilterL(CMPXFilter* aFilter) + { + TRACER("CGlxMediaList::SetFilterL"); + + // This method now takes a copy of the filter. It does not take ownership of aFilter + + CMPXFilter* tempFilter = NULL; + + if (aFilter) + { + // Create copy of filter + tempFilter = CMPXFilter::NewL(*aFilter); + CleanupStack::PushL(tempFilter); + } + + // Set filter on the collection + Collection().SetFilterL(aFilter); + + // Re-open collection if filter has been applied and list is already populated + if ( iIsPopulated ) + { + ReOpenL(); + + iReorderPending = ETrue; + } + + delete iFilter; + iFilter = NULL; + + if (aFilter) + { + // SetFilterL did not leave. So take ownership of copy + CleanupStack::Pop(tempFilter); + iFilter = tempFilter; + } + } + +// ----------------------------------------------------------------------------- +// Returns filter on the media list +// ----------------------------------------------------------------------------- +CMPXFilter* CGlxMediaList::Filter() const + { + TRACER("CGlxMediaList::Filter"); + + return iFilter; + } + +// --------------------------------------------------------------------------- +// IdSpaceId +// --------------------------------------------------------------------------- +// +TGlxIdSpaceId CGlxMediaList::IdSpaceId(TInt aIndex) const + { + TRACER("CGlxMediaList::IdSpaceId"); + + ///@todo Delegate id space to item list. + if (Count() && iItemList->Item(aIndex).IsStatic()) + { + return KGlxStaticItemIdSpaceId; + } + else + { + return iIdSpaceId; + } + } + +// --------------------------------------------------------------------------- +// CGlxMediaList::IsPopulated() +// --------------------------------------------------------------------------- +// +TBool CGlxMediaList::IsPopulated() const + { + TRACER("CGlxMediaList::IsPopulated"); + + return iIsPopulated; + } + + +// ----------------------------------------------------------------------------- +// Add a static item +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::AddStaticItemL( CGlxMedia* aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ) + { + TRACER("CGlxMediaList::AddStaticItemL"); + + iItemList->AddStaticItemL( aStaticItem, aTargetPosition ); + } + +// ----------------------------------------------------------------------------- +// Remove a static item +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::RemoveStaticItem(const TGlxMediaId& aItemId) + { + TRACER("CGlxMediaList::RemoveStaticItem"); + + iItemList->Remove(TGlxIdSpaceId(KGlxStaticItemIdSpaceId), aItemId); + } + +// ----------------------------------------------------------------------------- +// Enable/disable static items +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::SetStaticItemsEnabled( TBool aEnabled ) + { + TRACER("CGlxMediaList::SetStaticItemsEnabled"); + + iItemList->SetStaticItemsEnabled( aEnabled ); + } + +// ----------------------------------------------------------------------------- +// return ETrue if static items are enabled +// ----------------------------------------------------------------------------- +// +TBool CGlxMediaList::IsStaticItemsEnabled() const + { + TRACER("CGlxMediaList::IsStaticItemsEnabled"); + + return iItemList->IsStaticItemsEnabled(); + } + +// ----------------------------------------------------------------------------- +// Sets the initial focus position +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition) + { + TRACER("CGlxMediaList::SetFocusInitialPosition"); + + iItemList->SetFocusInitialPosition( aFocusInitialPosition ); + } + +// ----------------------------------------------------------------------------- +// Resets the focus to the initial position +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::ResetFocus() + { + TRACER("CGlxMediaList::ResetFocus"); + + iItemList->ResetFocus(); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// Handle collection message +// --------------------------------------------------------------------------- +void CGlxMediaList::HandleCollectionMessageL(const CMPXMessage& aMessage) + { + TRACER("CGlxMediaList::HandleCollectionMessageL"); + + + if (aMessage.IsSupported(KMPXMessageGeneralId)) + { + TInt messageId = aMessage.ValueTObjectL(KMPXMessageGeneralId); + if ( messageId == KMPXMessageGeneral ) + { + if (!aMessage.IsSupported(KMPXMessageGeneralEvent) || + !aMessage.IsSupported(KMPXMessageGeneralType)) + { + return; + } + + TInt messageEvent = aMessage.ValueTObjectL(KMPXMessageGeneralEvent); + if (messageEvent == TMPXCollectionMessage::EPathChanged) + { + GLX_LOG_INFO("CGlxMediaList::HandleCollectionMessageL() EPathChanged"); + + TInt messageType = aMessage.ValueTObjectL(KMPXMessageGeneralType); + switch (messageType) + { + case EMcPathChangedByOpen: + { + HandleOpenL(); + break; + } + case EMcPathChangedByCollectionChange: + { + break; + } + default: + __ASSERT_DEBUG(EFalse, Panic(EGlxPanicLogicError)); + break; + } + } + } + else if (messageId == KMPXMessageIdItemChanged) + { + if (!aMessage.IsSupported(KMPXMessageMediaGeneralCategory) || + !aMessage.IsSupported(KMPXMessageChangeEventType) || + !aMessage.IsSupported(KMPXMessageMediaGeneralId)) + { + return; + } + + TMPXChangeEventType messageType = aMessage.ValueTObjectL(KMPXMessageChangeEventType); + switch (messageType) + { + case EMPXItemModified: + { + RArray attributes; + CleanupClosePushL(attributes); + TMPXItemId itemId = aMessage.ValueTObjectL(KMPXMessageMediaGeneralId); + HandleItemModifiedL(itemId, attributes); + CleanupStack::PopAndDestroy(&attributes); + iManager->HandleWindowChangedL(this); + + // Drop through to perform sync, in case the order has changed + } + case EMPXItemInserted: + case EMPXItemDeleted: + default: + // Items have changed, determine whether to sync now + // or resync later if a sync is already pending after opening + if ( iSyncStatus == KNonePending ) + { + ReOpenL(); // force re-opens + + iSyncStatus = KSyncPending; + } + else + { + iSyncStatus = KResyncPending; + } + break; + } + } + else // received message isn't handled by media list + { + // Inform observers of message + TMessageNotificationStrategy strategy( aMessage, *this ); + NotifyObservers( strategy ); + } + } + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// Handles the collection entries being opened. Typically called +// when client has Open()'d a folder +// --------------------------------------------------------------------------- +// +void CGlxMediaList::HandleOpenL(const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, + TBool /*aComplete*/, TInt aError) + { + TRACER("CGlxMediaList::HandleOpenL"); + + /// @todo Need to handle errors + __ASSERT_DEBUG(aError == KErrNone, Panic(EGlxPanicLogicError)); + HandleOpenL(); + } + +// ----------------------------------------------------------------------------- +// HandleOpenL +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::HandleOpenL() + { + TRACER("CGlxMediaList::HandleOpenL"); + + // if we dont have the item list constructed + // dont do anything as it would lead to a crash + if( iItemList ) + { + PopulateL(); + // Sync (via population) has now occured, + // determine whether to resync if one is pending + if ( iSyncStatus == KResyncPending ) + { + ReOpenL(); + + iSyncStatus = KSyncPending; + } + + iManager->HandleWindowChangedL(this); + } + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// Handles the collection entries being opened. Typically called +// when client has Open()'d an item. Client typically responds by +// 'playing' the item +// --------------------------------------------------------------------------- +// +void CGlxMediaList::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/, + TInt /*aError*/) + { + TRACER("CGlxMediaList::HandleOpenL" ); + __ASSERT_DEBUG(EFalse, Panic(EGlxPanicLogicError)); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// Handle extended media properties +// --------------------------------------------------------------------------- +// +void CGlxMediaList::HandleCollectionMediaL(const CMPXMedia& aMedia, TInt aError) + { + TRACER("CGlxMediaList::HandleCollectionMediaL" ); + + iManager->HandleCollectionMediaL(iIdSpaceId, aMedia, aError); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// Handle command completion +// --------------------------------------------------------------------------- +// +void CGlxMediaList::HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError) + { + TRACER("CGlxMediaList::HandleCommandComplete" ); + + // SessionId is stored in iCommandPending + TAny* sessionId = iCommandPending; + + // Clear command pending flag here, in case an observer issues another command + iCommandPending = NULL; + + TCommandCompletedNotificationStrategy strategy( sessionId, aCommandResult, aError, *this ); + NotifyObservers( strategy ); + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +// +CGlxMediaList* CGlxMediaList::NewLC(const TGlxHierarchyId& aHierarchyId) + { + TRACER("CGlxMediaList::NewLC" ); + + CGlxMediaList* obj = new (ELeave) CGlxMediaList(aHierarchyId); + CleanupStack::PushL(obj); + obj->ConstructL(); + return obj; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxMediaList::CGlxMediaList(const TGlxHierarchyId& aHierarchyId) : + iIdSpaceId(KGlxIdNone), + iHierarchyId(aHierarchyId), iVisibleWindowIndex( 0 ) + { + TRACER("CGlxMediaList::CGlxMediaList"); + + __ASSERT_DEBUG(KErrNotFound == -1, Panic(EGlxPanicDebugUnexpectedError)); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxMediaList::~CGlxMediaList() + { + TRACER("CGlxMediaList::~CGlxMediaList" ); + + if (iCollectionUtility) + { + iCollectionUtility->Close(); + } + + iErrorPoster->Close(); + + iItemListObservers.Close(); + __ASSERT_DEBUG(iContexts.Count() == 0, Panic(EGlxPanicLogicError)); // Release all contexts + iContexts.Close(); + iPath.Close(); + + delete iItemList; + delete iFilter; + + if (iMediaListArray) + { + iMediaListArray->Close(); + } + + iCountAttributes.Close(); + + // close the manager last as it may delete the cache and thus the CGlxMedia + // objects.. item list destructor manipulates those objects so need to do it in this order + if(iManager) + { + iManager->HandleListDeleted( this ); + iManager->Close(); + } + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::ConstructL() + { + TRACER("CGlxMediaList::ConstructL" ); + + iCollectionUtility = MMPXCollectionUtility::NewL(this, KMcModeIsolated); + iManager = CGlxCacheManager::InstanceL(); + iErrorPoster = CGlxErrorPoster::InstanceL(); + iMediaListArray = CGlxMediaListArray::InstanceL(); + iCountAttributes.AppendL(KGlxMediaCollectionPluginSpecificSubTitle); + iCountAttributes.AppendL(KGlxMediaGeneralSlideshowableContent); + } + +// ----------------------------------------------------------------------------- +// Initialize the media list +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::OpenL(const CMPXCollectionPath& aPath) + { + TRACER("CGlxMediaList::OpenL" ); + + __ASSERT_DEBUG(iPath.Count() == 0, Panic(EGlxPanicAlreadyInitialised)); + + // Copy the path's depth dimension + TInt levels = aPath.Levels(); + + iPath.ReserveL(levels); + for (TInt level = 0; level < levels; level++) + { + TGlxMediaId id(aPath.Id(level)); + iPath.Append(id); + } + + + // Id space ids will no longer be retrieved from the collection framework + // See ID: ESLU-7C8CVN Inc9 MP: Error "Program closed: Music player" occurs if + // user presses Rocker Select key continually in Album art view. + + // Consider the following scenario: + // 1. User launches fetcher dialog + // 2. Fetcher opens a medialist + // 3. MGlxMediaList::InstanceL starts an async wait loop allowing other active objects to run + // 4. User cancels fetcher + // 5. Fetcher does not have a handle to the MGlxMediaList so it cannot cancel or close it. + // --> We leak a medialist and leave an async wait loop in client processes active scheduler. + + if (levels) + { + iIdSpaceId = aPath.Id(0); + } + else + { + iIdSpaceId = KGlxIdSpaceIdRoot; + } + + iItemList = CGlxNavigableList::NewL( iIdSpaceId, *this, *this ); + + OpenCollectionL( aPath ); + } + +// ----------------------------------------------------------------------------- +// AddReference +// ----------------------------------------------------------------------------- +// +TInt CGlxMediaList::AddReference() + { + TRACER("CGlxMediaList::AddReference"); + + iReferenceCount++; + return iReferenceCount; + } + +// ----------------------------------------------------------------------------- +// RemoveReference +// ----------------------------------------------------------------------------- +// +TInt CGlxMediaList::RemoveReference() + { + TRACER("CGlxMediaList::RemoveReference"); + + __ASSERT_ALWAYS(iReferenceCount > 0, Panic(EGlxPanicLogicError)); + iReferenceCount--; + return iReferenceCount; + } + +// ----------------------------------------------------------------------------- +// ReferenceCount +// ----------------------------------------------------------------------------- +// +TInt CGlxMediaList::ReferenceCount() const + { + TRACER("CGlxMediaList::ReferenceCount"); + + return iReferenceCount; + } + +// ----------------------------------------------------------------------------- +// Returns ETrue if this media list refers to the path +// ----------------------------------------------------------------------------- +// +TBool CGlxMediaList::Equals(const CMPXCollectionPath& aPath) const + { + TRACER("CGlxMediaList::Equals" ); + + TInt myLevels = iPath.Count(); + TInt pathLevels = aPath.Levels(); + if (myLevels != pathLevels) + { + return EFalse; + } + + // Check if path's match + for (TInt i = 0; i < myLevels; i++) + { + if (iPath[i] != TGlxMediaId(aPath.Id(i))) + { + return EFalse; + } + } + + return ETrue; // Match + } + +// ----------------------------------------------------------------------------- +// Determines if a filter has been set +// ----------------------------------------------------------------------------- +TBool CGlxMediaList::IsFiltered() const + { + TRACER("CGlxMediaList::IsFiltered"); + + return iFilter != NULL; + } + +// ----------------------------------------------------------------------------- +// Synchronise the media list +// ----------------------------------------------------------------------------- +void CGlxMediaList::ReOpenL() + { + TRACER("CGlxMediaList::ReOpenL" ); + + // We must not re-open the list before it has been opened the first time + // note - this can happen if update messages are received whilst retreiving + // the id space id + if ( !iItemList ) + { + return; + } + + CMPXCollectionPath* path = PathLC( NGlxListDefs::EPathParent ); + + OpenCollectionL( *path ); + + CleanupStack::PopAndDestroy(path); + } + +// ----------------------------------------------------------------------------- +// Populates the list, i.e., opens the collection with the path +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::PopulateL() + { + TRACER("CGlxMediaList::PopulateL" ); + + // Reserve space for all items in cache, that this media list is a potential user + // This allows SetContentsL to build user links without having to reserve space + iManager->ReserveUsersL( iIdSpaceId, CGlxMediaList::MediaListsL().Count() ); + + CMPXCollectionPath* path = Collection().PathL(); + CleanupStack::PushL(path); + + if ( iReorderPending ) + { + iItemList->ReorderContentsL( *path, *iManager ); + iReorderPending = EFalse; + } + else + { + iItemList->SetContentsL( *path, *iManager ); + + // Sync has now occured, + // if only a sync was pending, clear sync status + if ( iSyncStatus == KSyncPending ) + { + iSyncStatus = KNonePending; + } + } + + CleanupStack::PopAndDestroy(path); + + // The list contents may have changed, so update each used media with the + // current index into the list + UpdateMedia(); + + // Inform observers of first time population + if (!iIsPopulated) + { + TListPopulatedNotificationStrategy strategy( *this ); + NotifyObservers( strategy ); + iIsPopulated = ETrue; // Do this only once. + } + } + +// ----------------------------------------------------------------------------- +// Handles item modifications +// ----------------------------------------------------------------------------- +void CGlxMediaList::HandleItemModifiedL(TInt aId, const RArray& aAttributes) + { + TRACER("CGlxMediaList::HandleItemModifiedL"); + GLX_LOG_INFO1( "CGlxMediaList::HandleItemModifiedL %d", aId ); + TGlxMediaId id(aId); + + /// @todo: Check that the correct IdSpaceId is being used here + + TInt index = Index(iIdSpaceId, id); + + if (index != KErrNotFound) + { + iManager->HandleItemModified(iIdSpaceId, id, aAttributes); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + itemIndices.AppendL(index); + + // Inform observers of modified items + TInt obsCount = iItemListObservers.Count(); + GLX_DEBUG2("ML:HandleItemModifiedL obsCount=%d", obsCount); + for (TInt obsIdx = 0; obsIdx < obsCount; obsIdx++) + { + MGlxMediaListObserver* obs = iItemListObservers[obsIdx]; + obs->HandleItemModifiedL(itemIndices, this); + } + + CleanupStack::PopAndDestroy(&itemIndices); + RPointerArray& mediaLists = iMediaListArray->Array(); + TInt listCount = mediaLists.Count(); + GLX_DEBUG2("ML:HandleItemModifiedL listCount=%d", listCount); + if (listCount > 0) + { + CGlxMediaList* mediaList = mediaLists[listCount-1]; + // Force a delay to allow TNM to process the modified event + if (mediaList == this) + { + GLX_DEBUG3("ML:HandleItemModifiedL(wait) listCount=%d, Id=%d", + listCount, id.Value()); + TTimeIntervalMicroSeconds32 timeout; + timeout = (mediaList->Count() > KMaxItemsCount ? + KModifyEventMaxWaitInterval : KModifyEventMinWaitInterval ); + RTimer timer; + CleanupClosePushL(timer); + TRequestStatus status; + timer.CreateLocal(); + timer.After(status, timeout); + // User::WaitForRequest() will add codescanner warning but is necessary + // as User::WaitForAnyRequest() cannot be used in this case + User::WaitForRequest(status); + CleanupStack::PopAndDestroy(&timer); + } + } + } + } + +// ----------------------------------------------------------------------------- +// NotifyObserversOfMediaL +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::NotifyObserversOfMediaL(TInt aListIndex) + { + TRACER("CGlxMediaList::NotifyObserversOfMediaL"); + GLX_LOG_INFO1( "CGlxMediaList::NotifyObserversOfMediaL %d", aListIndex ); + TInt count = iItemListObservers.Count(); + for (TInt i = 0; i < count; i++) + { + iItemListObservers[i]->HandleMediaL(aListIndex, this); + } + } + +// ----------------------------------------------------------------------------- +// Notify observers of items added +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::HandleItemsAdded( TInt aAddedAtIndex, TInt aCount ) + { + TRACER("CGlxMediaList::HandleItemsAdded"); + + TItemsAddedNotificationStrategy strategy( aAddedAtIndex, aCount, *this ); + NotifyObservers( strategy ); + } + +// ----------------------------------------------------------------------------- +// Notify observers of items removed +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ) + { + TRACER("CGlxMediaList::HandleItemsRemoved"); + + TItemsRemovedNotificationStrategy strategy( aRemovedFromIndex, aCount, + *this ); + NotifyObservers( strategy ); + } + +// ----------------------------------------------------------------------------- +// Notify observers of focus change +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::HandleFocusChanged( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex ) + { + TRACER("CGlxMediaList::HandleFocusChanged"); + + TFocusChangedNotificationStrategy strategy( aType, aNewIndex, aOldIndex, + *this ); + NotifyObservers( strategy ); + } + +// ----------------------------------------------------------------------------- +// Notify observers of selection having changed +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::HandleItemSelected( TInt aIndex, TBool aSelected ) + { + TRACER("CGlxMediaList::HandleItemSelected"); + + TItemSelectedNotificationStrategy strategy( aIndex, aSelected, *this ); + NotifyObservers( strategy ); + } + +// ----------------------------------------------------------------------------- +// Call strategy object for each observer +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::NotifyObservers( TNotificationStrategy& aStrategy ) + { + TRACER("CGlxMediaList::NotifyObservers"); + + // Notify all observers, even if some of them leave leave. + // "i" needs to be volatile, so that it does not get optimised into a + // register. If i were in a register and observer left, i's new value + // would be lost. + volatile TInt i = iItemListObservers.Count() - 1; + + // Loop count + 1 times, so that iManager also gets notified if last + // observer leaves. Iterate backwards in case observes remove themselves + // from the observer array during the callbacks. + while ( i >= -1 ) // usually tested only twice + { + TRAPD( err, + { + while ( i >= 0 ) + { + aStrategy.NotifyL( *iItemListObservers[ i ] ); + i--; + } + + iManager->HandleWindowChangedL( this ); + } + ); + + if ( err != KErrNone ) + { + iErrorPoster->PostError(err); + } + + i--; + } + } + +// ----------------------------------------------------------------------------- +// Populates the path with hierarchy to parent +// ----------------------------------------------------------------------------- +// +inline void CGlxMediaList::PathPopulateParentL(CMPXCollectionPath& aPath) const + { + TRACER("CGlxMediaList::PathPopulateParentL"); + + // Add navigational hierarchy to path + TInt pathCount = iPath.Count(); + for (TInt i = 0; i < pathCount; ++i) + { + aPath.AppendL( iPath[ i ].Value() ); + } + } + +// ----------------------------------------------------------------------------- +// Populates the path with all items and sets the focus +// ----------------------------------------------------------------------------- +// +inline void CGlxMediaList::PathPopulateAllL(CMPXCollectionPath& aPath) const + { + TRACER("CGlxMediaList::PathPopulateAllL"); + + RArray mpxIds; + CleanupClosePushL( mpxIds ); + + // Reserve space for all items + TInt itemCount = iItemList->Count(); + mpxIds.ReserveL( itemCount ); + + // Obtain TMPXItemId for each item + for (TInt i = 0; i < itemCount; ++i) + { + if ( !iItemList->Item( i ).IsStatic() ) + { + mpxIds.AppendL( iItemList->Item( i ).Id().Value() ); + } + } + + // Add Ids to current level in path + aPath.AppendL( mpxIds.Array() ); + + // Set focused item + TInt focusIndex = FocusIndex(); + if ( focusIndex >= 0 ) + { + if ( !iItemList->Item( focusIndex ).IsStatic() ) + { + aPath.Set( focusIndex - iItemList->Count( NGlxListDefs::ECountPreStatic ) ); + } + } + + CleanupStack::PopAndDestroy( &mpxIds ); + } + +// ----------------------------------------------------------------------------- +// Populates the path with focused item and sets the focus +// ----------------------------------------------------------------------------- +// +inline void CGlxMediaList::PathPopulateFocusL(CMPXCollectionPath& aPath) const + { + TRACER("CGlxMediaList::PathPopulateFocusL"); + + // Obtain focused item + TInt focusIndex = FocusIndex(); + if ( focusIndex >= 0 ) + { + const TGlxMedia& item = iItemList->Item( focusIndex ); + if ( !item.IsStatic() ) + { + // Add focused item to path + aPath.AppendL( item.Id().Value() ); + aPath.Set( 0 ); + } + } + } + +// ----------------------------------------------------------------------------- +// Populates the path with selected items and selects all +// ----------------------------------------------------------------------------- +// +inline void CGlxMediaList::PathPopulateSelectionL(CMPXCollectionPath& aPath) const + { + TRACER("CGlxMediaList::PathPopulateSelectionL"); + + RArray mpxIds; + CleanupClosePushL( mpxIds ); + + // Reserve space for all items + TInt selectionCount = iItemList->SelectedItemIndices().Count(); + mpxIds.ReserveL( selectionCount ); + + // Obtain TMPXItemId for each item + for (TInt i = 0; i < selectionCount; ++i) + { + TInt selectedItemIndex = iItemList->SelectedItemIndices()[ i ]; + mpxIds.AppendL( iItemList->Item( selectedItemIndex ).Id().Value() ); + } + + // Add Ids to current level in path + aPath.AppendL( mpxIds.Array() ); + + // Set selection + aPath.SelectAllL(); + + CleanupStack::PopAndDestroy( &mpxIds ); + } + +// ----------------------------------------------------------------------------- +// Updates each media used by this media list with the current index +// ----------------------------------------------------------------------------- +// +inline void CGlxMediaList::UpdateMedia() + { + TRACER("CGlxMediaList::UpdateMedia"); + + TInt count = iItemList->Count(); + for (TInt i = 0; i < count; ++i) + { + TGlxMedia& item = iItemList->Item( i ); + + // static items should not be updated + if ( !item.IsStatic() ) + { + item.UpdateMedia( *this, i ); + UpdateMediaInvalidateAttributesChangedByCounts(item); + } + } + } + +// ----------------------------------------------------------------------------- +// Updates each media used by this media list with the current index +// ----------------------------------------------------------------------------- +// +inline void CGlxMediaList::UpdateMediaInvalidateAttributesChangedByCounts(TGlxMedia& aItem) + { + TRACER("CGlxMediaList::UpdateMediaInvalidateAttributesChangedByCounts"); + + iManager->HandleItemModified(iIdSpaceId, aItem.Id(), iCountAttributes); + } + +// ----------------------------------------------------------------------------- +// Opens a collection at the appropriate level +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::OpenCollectionL(const CMPXCollectionPath& aPath) + { + TRACER("CGlxMediaList::OpenCollectionL"); + + // Open the level + if ( aPath.Levels() == 0 ) + { + Collection().OpenL( TUid::Uid( EGlxCollectionPluginShowInMainListView ) ); + } + else + { + Collection().OpenL( aPath ); + } + } + + +// ----------------------------------------------------------------------------- +// Compare contexts by pointer +// ----------------------------------------------------------------------------- +// +TBool CGlxMediaList::TContext::Match(const TContext& a1, const TContext& a2) + { + TRACER("CGlxMediaList::TContext::Match"); + + return a1.iContext == a2.iContext; + } + +// ----------------------------------------------------------------------------- +// Compare contexts by priority +// ----------------------------------------------------------------------------- +// +TBool CGlxMediaList::TContext::Compare(const TContext& a1, const TContext& a2) + { + TRACER("CGlxMediaList::TContext::Compare"); + + return a2.iPriority - a1.iPriority; + } + +// ----------------------------------------------------------------------------- +// Set the visible dataWindow index +// ----------------------------------------------------------------------------- +// +void CGlxMediaList::SetVisibleWindowIndexL( TInt aIndex ) + { + TRACER("CGlxMediaList::SetVisibleWindowIndexL"); + __ASSERT_ALWAYS( aIndex <= Count(), Panic( EGlxPanicIllegalArgument ) ); + if( aIndex != iVisibleWindowIndex ) + { + iVisibleWindowIndex = aIndex; + GLX_DEBUG2("SetVisibleWindowIndexL() iVisibleWindowIndex=%d", + iVisibleWindowIndex); + iManager->HandleWindowChangedL(this); + iManager->RefreshL(); + } + } + +// ----------------------------------------------------------------------------- +// Returns visible dataWindow index +// ----------------------------------------------------------------------------- +// +TInt CGlxMediaList::VisibleWindowIndex() const + { + TRACER("CGlxMediaList::VisibleWindowIndex"); + return iVisibleWindowIndex; + } + +// ----------------------------------------------------------------------------- +// Cancels the pending attribute/thumbnail requests +// ----------------------------------------------------------------------------- + +void CGlxMediaList::CancelPreviousRequests() + { + TRACER("CGlxMediaList::CancelPreviousRequests"); + + TInt focusIndex = FocusIndex(); + + if(focusIndex >= KErrNone) + { + if(!Item(focusIndex).Properties()) + { + // If media is NULL, cancel the previous pending request. + // Place a new request for the item in focus, to fetch the media attributes + iManager->CancelPreviousRequest(); + } + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxmedialistarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxmedialistarray.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +#include "glxmedialistarray.h" + +#include //For logs + +// --------------------------------------------------------------------------- +// CMediaListArray::InstanceL +// --------------------------------------------------------------------------- +// +CGlxMediaListArray* CGlxMediaListArray::InstanceL() + { + TRACER("CGlxMediaListArray::InstanceL"); + + return CGlxSingletonStore::InstanceL(&NewL); + } + +// --------------------------------------------------------------------------- +// CMediaListArray::Close +// --------------------------------------------------------------------------- +// +void CGlxMediaListArray::Close() + { + TRACER("CGlxMediaListArray::Close"); + + CGlxSingletonStore::Close(this); + } + +// --------------------------------------------------------------------------- +// CMediaListArray::NewL +// --------------------------------------------------------------------------- +// +CGlxMediaListArray* CGlxMediaListArray::NewL() + { + TRACER("CGlxMediaListArray::NewL"); + + return new (ELeave) CGlxMediaListArray; + } + +// --------------------------------------------------------------------------- +// CMediaListArray::~CMediaListArray +// --------------------------------------------------------------------------- +// +CGlxMediaListArray::~CGlxMediaListArray() + { + TRACER("CGlxMediaListArray::~CGlxMediaListArray"); + + iArray.Close(); + } + +// --------------------------------------------------------------------------- +// CMediaListArray::Array +// --------------------------------------------------------------------------- +// +RPointerArray& CGlxMediaListArray::Array() + { + TRACER("CGlxMediaListArray::Array"); + + return iArray; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxmedialistiterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxmedialistiterator.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1071 @@ +/* +* Copyright (c) 2008-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: Item ordered for traversing lists +* +*/ + + + + +#include "mglxmedialist.h" +#include "glxlistutils.h" +#include "glxmedialistiterator.h" + +#include +#include +#include + +const TInt KSequentialIteratorInitialValue = -1; +// Default granularity of items to request for +const TUint KGlxBlockyIteratorDefaultGranularity = 15; + +const TInt KGlxLowerMemoryLimitForCacheSize = 15000000; +const TInt KGlxUpperMemoryLimitForCacheSize = 25000000; + +const TInt KMaxLowMemOffsetValue = 3; +const TInt KMinLowMemOffsetValue = 1; + +EXPORT_C TGlxSequentialIterator::TGlxSequentialIterator() + { + TRACER("TGlxSequentialIterator::TGlxSequentialIterator"); + + iList = NULL; + iCurrentItem = KSequentialIteratorInitialValue; + iRange = KMaxTInt; // To support full list length iteration,if range is not set + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +void TGlxSequentialIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxSequentialIterator::SetToFirst"); + + __ASSERT_DEBUG(aList != NULL, Panic(EGlxPanicNullPointer)); + iList = aList; + iCurrentItem = KSequentialIteratorInitialValue; + } + +// ----------------------------------------------------------------------------- +// Return the next item index or KErrNotFound +// ----------------------------------------------------------------------------- +// +TInt TGlxSequentialIterator::operator++(TInt) + { + TRACER("TGlxSequentialIterator::operator++"); + + iCurrentItem++; + if (iCurrentItem < iList->Count() && iCurrentItem < iRange ) + { + return iCurrentItem; + } + else + { + return KErrNotFound; + } + } + +// ----------------------------------------------------------------------------- +// Return ETrue if index is within range, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool TGlxSequentialIterator::InRange(TInt aIndex) const + { + TRACER("TGlxSequentialIterator::InRange"); + + return (aIndex < iRange && aIndex < iList->Count() && aIndex >= 0); + } +// ----------------------------------------------------------------------------- +// SetRange +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxSequentialIterator::SetRange( TInt aRange ) + { + TRACER("TGlxSequentialIterator::SetRange"); + + iRange = aRange; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxSpecificIdIterator::TGlxSpecificIdIterator(const TGlxIdSpaceId& aIdSpaceId, TGlxMediaId aMediaId) + : iMediaId(aMediaId), iIdSpaceId(aIdSpaceId), iFinished(EFalse) + { + TRACER("TGlxSpecificIdIterator::TGlxSpecificIdIterator"); + + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +void TGlxSpecificIdIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxSpecificIdIterator::SetToFirst"); + + __ASSERT_DEBUG(aList != NULL, Panic(EGlxPanicNullPointer)); + iList = aList; + iFinished = EFalse; + } + +// ----------------------------------------------------------------------------- +// Return the next item index or KErrNotFound +// ----------------------------------------------------------------------------- +// +TInt TGlxSpecificIdIterator::operator++(TInt) + { + TRACER("TGlxSpecificIdIterator::operator++"); + + if (iFinished) + { + return KErrNotFound; + } + else + { + iFinished = ETrue; + return iList->Index(iIdSpaceId, iMediaId); + } + } +// ----------------------------------------------------------------------------- +// Return ETrue if index is within range, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool TGlxSpecificIdIterator::InRange(TInt aIndex) const + { + TRACER("TGlxSpecificIdIterator::InRange"); + + return (aIndex == iList->Index(iIdSpaceId, iMediaId)); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFirstThenLastIterator::TGlxFirstThenLastIterator() + { + TRACER("TGlxFirstThenLastIterator::TGlxFirstThenLastIterator"); + + iCurrentItem = 0; + iList = NULL; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFirstThenLastIterator::~TGlxFirstThenLastIterator() + { + TRACER("TGlxFirstThenLastIterator::~TGlxFirstThenLastIterator"); + + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +void TGlxFirstThenLastIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxFirstThenLastIterator::SetToFirst"); + __ASSERT_DEBUG(aList, Panic(EGlxPanicNullPointer)); + + iList = aList; + iCurrentItem = 0; + } + +// ----------------------------------------------------------------------------- +// Return the next item index or KErrNotFound +// ----------------------------------------------------------------------------- +// +TInt TGlxFirstThenLastIterator::operator++(TInt) + { + TRACER("TGlxFirstThenLastIterator::operator++"); + __ASSERT_DEBUG(iList != NULL, Panic(EGlxPanicNullPointer)); + + TInt count = iList->Count(); + if (count <= 0) + { + return KErrNotFound; + } + + if (iCurrentItem == 0) + { + // Return first item index + iCurrentItem++; + return 0; + } + + if (iCurrentItem == 1) + { + // Return last item index + iCurrentItem++; + return count - 1; + } + + // At last item already + return KErrNotFound; + } +// ----------------------------------------------------------------------------- +// Return ETrue if index is within range, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool TGlxFirstThenLastIterator::InRange(TInt aIndex) const + { + TRACER("TGlxFirstThenLastIterator::InRange"); + __ASSERT_DEBUG(aIndex >= 0 && aIndex < iList->Count(), Panic(EGlxPanicIllegalArgument)); + + // Return ETrue if first or last item + return (aIndex == 0) || (aIndex == iList->Count() - 1); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator() + { + TRACER("TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator"); + iCurrentItem = 0; + iFrontOffset = 0; + iRearOffset = 0; + iList = NULL; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator() + { + TRACER("TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator"); + } + +// ---------------------------------------------------------------------------- +// Set range offsets +// ---------------------------------------------------------------------------- +// +EXPORT_C void TGlxFromFocusOutwardIterator::SetRangeOffsets(TInt aRearOffset, + TInt aFrontOffset) + { + TRACER("TGlxFromFocusOutwardIterator::SetRangeOffsets"); + __ASSERT_DEBUG(aRearOffset >= 0 && aFrontOffset >= 0, Panic(EGlxPanicIllegalArgument)); + iFrontOffset = aFrontOffset; + iRearOffset = aRearOffset; + iOriginalFrontOffset = iFrontOffset; + iOriginalRearOffset = iRearOffset; + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +void TGlxFromFocusOutwardIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxFromFocusOutwardIterator::SetToFirst"); + __ASSERT_DEBUG(aList != NULL, Panic(EGlxPanicNullPointer)); + + iList = aList; + iCurrentItem = 0; + } + +// ----------------------------------------------------------------------------- +// Return the item index or KErrNotFound, and goes to next +// ----------------------------------------------------------------------------- +// +TInt TGlxFromFocusOutwardIterator::operator++(TInt) + { + TRACER("TGlxFromFocusOutwardIterator::operator++"); + __ASSERT_DEBUG(iList != NULL, Panic(EGlxPanicNullPointer)); + + TInt count = iList->Count(); + if (count <= 0) + { + return KErrNotFound; + } + + if (iOriginalFrontOffset > KMaxLowMemOffsetValue && + iOriginalRearOffset > KMaxLowMemOffsetValue) + { + TInt freeMemory = 0; + HAL::Get( HALData::EMemoryRAMFree, freeMemory ); + if ( freeMemory < KGlxUpperMemoryLimitForCacheSize && + freeMemory > KGlxLowerMemoryLimitForCacheSize ) + { + iFrontOffset = KMaxLowMemOffsetValue; + iRearOffset = KMaxLowMemOffsetValue; + } + else if ( freeMemory < KGlxLowerMemoryLimitForCacheSize ) + { + iFrontOffset = KMinLowMemOffsetValue; + iRearOffset = KMinLowMemOffsetValue; + } + else if (iFrontOffset != iOriginalFrontOffset + && iRearOffset!= iOriginalRearOffset) + { + iFrontOffset = Max(iFrontOffset, iOriginalFrontOffset ); + iRearOffset = Max(iRearOffset, iOriginalRearOffset ); + } + } + + // Check if out of bounds + if (iFrontOffset + iRearOffset < iCurrentItem || count <= iCurrentItem) + { + return KErrNotFound; + } + + // The ranges may be inequal, which means there won't be any jumping between + // front and rear. + + // |-------F----------------------| + // |< jumping zone>| + + TInt index = iList->FocusIndex(); + + TInt min = Min(iFrontOffset, iRearOffset); + TInt jumpingZoneLength = min * 2; + if (iCurrentItem <= jumpingZoneLength) + { + // Still within the (rear-front-rear-front) jumping zone + TInt distanceFromFocus = (iCurrentItem + 1) / 2; + TBool rear = !(iCurrentItem & 1); // Rear if number is even + if (rear) + { + index -= distanceFromFocus; + } + else + { + index += distanceFromFocus; + } + } + else + { + __ASSERT_DEBUG(iFrontOffset != iRearOffset, Panic(EGlxPanicLogicError)); + + // index is currently focus index. Figure out how much need to move. + TInt indexesFromFocus = iCurrentItem - min; + if (iRearOffset < iFrontOffset) + { + // Front range is longer than rear, so the item is on the front side + index += indexesFromFocus; + } + else + { + // Rear range is longer than front, so the item is on the rear side + index -= indexesFromFocus; + } + } + + iCurrentItem++; + + // The index may be below 0 or above count. Normalise back to list indexes. + return GlxListUtils::NormalizedIndex(index, count); + } + +// ----------------------------------------------------------------------------- +// Return ETrue if index is within range, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool TGlxFromFocusOutwardIterator::InRange(TInt aIndex) const + { + TRACER("TGlxFromFocusOutwardIterator::InRange"); + TInt count = iList->Count(); + + // Handle the case where range is longer than count separately, because looping will + // confuse otherwise + if (count <= iRearOffset + iFrontOffset) + { + // Range is longer than count, must be in range + return ETrue; + } + + TInt focusIndex = iList->FocusIndex(); + TInt firstInRange = GlxListUtils::NormalizedIndex(focusIndex - iRearOffset, count); + TInt lastInRange = GlxListUtils::NormalizedIndex(focusIndex + iFrontOffset, count); + + if (firstInRange <= lastInRange) + { + // Normal case: | F-------L | + return aIndex >= firstInRange && aIndex <= lastInRange; + } + else + { + // Looping case: |----L F----| + return aIndex <= lastInRange || aIndex >= firstInRange; + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromIndexOutwardBlockyIterator::TGlxFromIndexOutwardBlockyIterator( + const MGlxIndex& aIndexFunctor ) + : iIndexFunctor( aIndexFunctor ) + { + TRACER("TGlxFromIndexOutwardBlockyIterator::TGlxFromIndexOutwardBlockyIterator"); + + iCurrentItem = 0; + iFrontOffset = 2 * KGlxBlockyIteratorDefaultGranularity; + iRearOffset = 2 * KGlxBlockyIteratorDefaultGranularity; + iList = NULL; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromIndexOutwardBlockyIterator::~TGlxFromIndexOutwardBlockyIterator() + { + TRACER("TGlxFromIndexOutwardBlockyIterator::~TGlxFromIndexOutwardBlockyIterator"); + + } + +// ---------------------------------------------------------------------------- +// Set range offsets +// ---------------------------------------------------------------------------- +// +EXPORT_C void TGlxFromIndexOutwardBlockyIterator::SetRangeOffsets(TInt aRearOffset, + TInt aFrontOffset) + { + TRACER("TGlxFromIndexOutwardBlockyIterator::SetRangeOffsets"); + + __ASSERT_DEBUG(aRearOffset >= 0 && aFrontOffset >= 0, Panic(EGlxPanicIllegalArgument)); + iFrontOffset = Max(aFrontOffset, KGlxBlockyIteratorDefaultGranularity ); + iRearOffset = Max(aRearOffset, KGlxBlockyIteratorDefaultGranularity ); + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +void TGlxFromIndexOutwardBlockyIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxFromIndexOutwardBlockyIterator::SetToFirst"); + __ASSERT_DEBUG(aList != NULL, Panic(EGlxPanicNullPointer)); + + iList = aList; + iCurrentItem = 0; + } + +// ----------------------------------------------------------------------------- +// Return the item index or KErrNotFound, and goes to next +// ----------------------------------------------------------------------------- +// +TInt TGlxFromIndexOutwardBlockyIterator::operator++(TInt) + { + TRACER("TGlxFromIndexOutwardBlockyIterator::operator++"); + __ASSERT_DEBUG(iList != NULL, Panic(EGlxPanicNullPointer)); + + TInt count = iList->Count(); + if (count <= 0) + { + return KErrNotFound; + } + + // Check if out of bounds + if (iFrontOffset + iRearOffset < iCurrentItem || count <= iCurrentItem) + { + return KErrNotFound; + } + + // The ranges may be inequal, which means there won't be any jumping between + // front and rear. + + // |-------F----------------------| + // |< jumping zone>| + + TInt index = iIndexFunctor.Index(); + __ASSERT_ALWAYS( index >= 0 && index < iList->Count(), Panic( EGlxPanicIllegalState ) ); + index -= index % KGlxBlockyIteratorDefaultGranularity; + + TInt min = Min(iFrontOffset, iRearOffset); + TInt jumpingZoneLength = min * 2; + if (iCurrentItem <= jumpingZoneLength) + { + // Still within the (rear-front-rear-front) jumping zone + TInt distanceFromFocus = (iCurrentItem + 1) / 2; + TBool rear = !(iCurrentItem & 1); // Rear if number is even + if (rear) + { + index -= distanceFromFocus; + } + else + { + index += distanceFromFocus; + } + } + else + { + __ASSERT_DEBUG(iFrontOffset != iRearOffset, Panic(EGlxPanicLogicError)); + + // index is currently focus index. Figure out how much need to move. + TInt indexesFromFocus = iCurrentItem - min; + if (iRearOffset < iFrontOffset) + { + // Front range is longer than rear, so the item is on the front side + index += indexesFromFocus; + } + else + { + // Rear range is longer than front, so the item is on the rear side + index -= indexesFromFocus; + } + } + + iCurrentItem++; + + // The index may be below 0 or above count. Normalise back to list indexes. + return GlxListUtils::NormalizedIndex(index, count); + } + +// ----------------------------------------------------------------------------- +// Return ETrue if index is within range, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool TGlxFromIndexOutwardBlockyIterator::InRange(TInt aIndex) const + { + TRACER("TGlxFromIndexOutwardBlockyIterator::InRange"); + TInt count = iList->Count(); + + // Handle the case where range is longer than count separately, because looping will + // confuse otherwise + if (count <= iRearOffset + iFrontOffset) + { + // Range is longer than count, must be in range + return ETrue; + } + + TInt index = iIndexFunctor.Index(); + __ASSERT_ALWAYS( index >= 0 && index < iList->Count(), Panic( EGlxPanicIllegalState ) ); + index -= index % KGlxBlockyIteratorDefaultGranularity; + TInt firstInRange = GlxListUtils::NormalizedIndex(index - iRearOffset, count); + TInt lastInRange = GlxListUtils::NormalizedIndex(index + iFrontOffset, count); + + if (firstInRange <= lastInRange) + { + // Normal case: | F-------L | + return aIndex >= firstInRange && aIndex <= lastInRange; + } + else + { + // Looping case: |----L F----| + return aIndex <= lastInRange || aIndex >= firstInRange; + } + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromFocusOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator() + : TGlxFromIndexOutwardBlockyIterator(*static_cast(this) ) + { + TRACER("TGlxFromIndexOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromFocusOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator() + { + TRACER("TGlxFromIndexOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator"); + } + +// ----------------------------------------------------------------------------- +// Index +// ----------------------------------------------------------------------------- +// +TInt TGlxFromFocusOutwardBlockyIterator::Index() const + { + TRACER("TGlxFromIndexOutwardBlockyIterator::Index"); + return iList->FocusIndex(); + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromManualIndexOutwardBlockyIterator::TGlxFromManualIndexOutwardBlockyIterator() + : TGlxFromIndexOutwardBlockyIterator( *static_cast(this) ), iIndex( 0 ) + { + TRACER("TGlxFromManualIndexOutwardBlockyIterator::TGlxFromManualIndexOutwardBlockyIterator"); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromManualIndexOutwardBlockyIterator::~TGlxFromManualIndexOutwardBlockyIterator() + { + TRACER("TGlxFromManualIndexOutwardBlockyIterator::~TGlxFromManualIndexOutwardBlockyIterator"); + } + +// ----------------------------------------------------------------------------- +// SetIndex +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxFromManualIndexOutwardBlockyIterator::SetIndex( TInt aIndex ) + { + TRACER("TGlxFromManualIndexOutwardBlockyIterator::SetIndex"); + + __ASSERT_DEBUG( aIndex >= 0 && aIndex < iList->Count(), Panic( EGlxPanicIllegalArgument ) ); + iIndex = aIndex; + } + +// ----------------------------------------------------------------------------- +// Index +// ----------------------------------------------------------------------------- +// +TInt TGlxFromManualIndexOutwardBlockyIterator::Index() const + { + TRACER("TGlxFromManualIndexOutwardBlockyIterator::Index"); + + return iIndex; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxSelectionIterator::TGlxSelectionIterator() + { + TRACER("TGlxSelectionIterator::TGlxSelectionIterator"); + + iCurrentItem = 0; + iList = NULL; + iRange = KMaxTInt; + iDisabledIfMoreThanRangeSelected = EFalse; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxSelectionIterator::~TGlxSelectionIterator() + { + TRACER("TGlxSelectionIterator::~TGlxSelectionIterator"); + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxSelectionIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxSelectionIterator::SetToFirst"); + __ASSERT_DEBUG(aList != NULL, Panic(EGlxPanicNullPointer)); + + iList = aList; + iCurrentItem = 0; + } + +// ----------------------------------------------------------------------------- +// Return the next item index or KErrNotFound +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TGlxSelectionIterator::operator++(TInt) + { + TRACER("TGlxSelectionIterator::operator++"); + __ASSERT_DEBUG(iList != NULL, Panic(EGlxPanicNullPointer)); + + TInt result = KErrNotFound; + + TInt selectionCount = iList->SelectionCount(); + + if (!iDisabledIfMoreThanRangeSelected || (selectionCount <= iRange)) + { + if (selectionCount == 0) + { + // If no items are selected, treat the focused index as the selection + if ( iCurrentItem == 0 ) + { + result = iList->FocusIndex(); + iCurrentItem++; + } + } + else + { + if ( iCurrentItem < iRange && iCurrentItem < selectionCount ) + { + result = iList->SelectedItemIndex(iCurrentItem); + iCurrentItem++; + } + } + } + return result; + } + +// ----------------------------------------------------------------------------- +// TGlxSelectionIterator::InRange +// ----------------------------------------------------------------------------- +// + +EXPORT_C TBool TGlxSelectionIterator::InRange(TInt aIndex) const + { + TRACER("TGlxSelectionIterator::InRange"); + __ASSERT_DEBUG(aIndex >= 0 && aIndex < iList->Count(), Panic(EGlxPanicIllegalArgument)); + + TInt selectionCount = iList->SelectionCount(); + TBool inRange = EFalse; + + if (selectionCount) + { + TBool legalIndex = EFalse; + if (selectionCount > iRange) + { + if (iDisabledIfMoreThanRangeSelected) + { + legalIndex = EFalse; + } + else + { + legalIndex = (iList->SelectedItemIndex(iRange) > aIndex); + } + } + else + { + legalIndex = ETrue; + } + + if(legalIndex) + { + inRange = iList->IsSelected(aIndex); + } + } + else + { + if (!(iDisabledIfMoreThanRangeSelected && (iRange == 0))) + { + inRange = (aIndex == iList->FocusIndex()); + } + } + return inRange; +} + +// ----------------------------------------------------------------------------- +// TGlxSelectionIterator::SetRange +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxSelectionIterator::SetRange(TInt aMaxItems) + { + TRACER("TGlxSelectionIterator::SetRange"); + iRange = aMaxItems; + } + +// ----------------------------------------------------------------------------- +// TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected(TBool aDisabledIfMoreThanRangeSelected) + { + TRACER("TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected"); + iDisabledIfMoreThanRangeSelected = aDisabledIfMoreThanRangeSelected; + } +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxExclusionIterator::TGlxExclusionIterator( MGlxMediaListIterator& aIncludedItemsIterator, + MGlxMediaListIterator& aExcludedItemsIterator ) + :iIncludedItemsIterator( aIncludedItemsIterator ), + iExcludedItemsIterator( aExcludedItemsIterator ) + { + TRACER("TGlxExclusionIterator::TGlxExclusionIterator" ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxExclusionIterator::~TGlxExclusionIterator() + { + TRACER("TGlxExclusionIterator::~TGlxExclusionIterator"); + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +EXPORT_C void TGlxExclusionIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxExclusionIterator::SetToFirst"); + __ASSERT_DEBUG(aList != NULL, Panic(EGlxPanicNullPointer)); + + //implementation delegates to both the iterators + iIncludedItemsIterator.SetToFirst( aList ); + iExcludedItemsIterator.SetToFirst( aList ); + } + +// ----------------------------------------------------------------------------- +// Return the next item index or KErrNotFound +// ----------------------------------------------------------------------------- +// +TInt TGlxExclusionIterator::operator++(TInt ) + { + TRACER("TGlxExclusionIterator::operator++"); + + // This method returns the next valid item of the iterator such that + // (1) The index is within the range of iIncludedItemsIterator + // and + // (2) The index is not in the range of iExcludedItemsIterator. + // If iIncludedItemsIterator reaches its end in this process then we loop to the + // first item and repeat the above steps. + + TInt index = KErrNotFound; // assign initial value for maintenance safety + + do { + index = iIncludedItemsIterator++; + } while ( KErrNotFound != index && iExcludedItemsIterator.InRange( index ) ); + + return index; + } + + +// ----------------------------------------------------------------------------- +// Return ETrue if index is within range, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool TGlxExclusionIterator::InRange(TInt aIndex) const + { + TRACER("TGlxExclusionIterator::InRange"); + + // Verify that aIndex is + // (1) In the range of iIncludedItemsIterator + // and + // (2) Not in the range of iExcludedItemsIterator + + + return iIncludedItemsIterator.InRange(aIndex) && + !iExcludedItemsIterator.InRange(aIndex); + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromManualIndexBlockyIterator::TGlxFromManualIndexBlockyIterator( ) + { + TRACER("TGlxFromManualIndexBlockyIterator::TGlxFromManualIndexBlockyIterator"); + iDefaultVisItems = GlxListUtils::VisibleItemsGranularityL(); + iCurrentItem = 0; + iFrontOffset = 4 * iDefaultVisItems; + iRearOffset = 2 * iDefaultVisItems; + iOriginalFrontOffset = iFrontOffset; + iOriginalRearOffset = iRearOffset; + iList = NULL; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxFromManualIndexBlockyIterator::~TGlxFromManualIndexBlockyIterator() + { + TRACER("TGlxFromManualIndexBlockyIterator::~TGlxFromManualIndexBlockyIterator"); + + } + +// ---------------------------------------------------------------------------- +// Set range offsets +// ---------------------------------------------------------------------------- +// +EXPORT_C void TGlxFromManualIndexBlockyIterator::SetRangeOffsets(TInt aRearOffset, + TInt aFrontOffset) + { + TRACER("TGlxFromManualIndexBlockyIterator::SetRangeOffsets"); + + __ASSERT_DEBUG(aRearOffset >= 0 && aFrontOffset >= 0, Panic(EGlxPanicIllegalArgument)); + iFrontOffset = Max(aFrontOffset, iDefaultVisItems ); + iRearOffset = Max(aRearOffset, iDefaultVisItems ); + iOriginalFrontOffset = iFrontOffset; + iOriginalRearOffset = iRearOffset; + } + +// ----------------------------------------------------------------------------- +// Set to first item +// ----------------------------------------------------------------------------- +// +void TGlxFromManualIndexBlockyIterator::SetToFirst(const MGlxMediaList* aList) + { + TRACER("TGlxFromManualIndexBlockyIterator::SetToFirst"); + __ASSERT_DEBUG(aList != NULL, Panic(EGlxPanicNullPointer)); + + iList = aList; + iCurrentItem = 0; + } + +// ----------------------------------------------------------------------------- +// Return the item index or KErrNotFound, and goes to next +// ----------------------------------------------------------------------------- +// +TInt TGlxFromManualIndexBlockyIterator::operator++(TInt) + { + TRACER("TGlxFromManualIndexBlockyIterator::operator++"); + __ASSERT_DEBUG(iList != NULL, Panic(EGlxPanicNullPointer)); + + TInt count = iList->Count(); + if (count <= 0) + { + return KErrNotFound; + } + + if (iOriginalFrontOffset > KMaxLowMemOffsetValue* iDefaultVisItems && + iOriginalRearOffset > KMaxLowMemOffsetValue * iDefaultVisItems) + { + TInt freeMemory = 0; + HAL::Get( HALData::EMemoryRAMFree, freeMemory ); + if ( freeMemory < KGlxUpperMemoryLimitForCacheSize && + freeMemory > KGlxLowerMemoryLimitForCacheSize ) + { + iFrontOffset = 2*iDefaultVisItems; + iRearOffset = 3*iDefaultVisItems; + } + else if ( freeMemory < KGlxLowerMemoryLimitForCacheSize ) + { + iFrontOffset = iDefaultVisItems; + iRearOffset = iDefaultVisItems; + } + else if (iFrontOffset != iOriginalFrontOffset + && iRearOffset!= iOriginalRearOffset) + { + iFrontOffset = Max(iFrontOffset, iOriginalFrontOffset ); + iRearOffset = Max(iRearOffset, iOriginalRearOffset ); + } + } + + // Check if out of bounds + if (iFrontOffset + iRearOffset < iCurrentItem || count <= iCurrentItem) + { + return KErrNotFound; + } + + // The ranges may be inequal, which means there won't be any jumping between + // front and rear. + + // |-------F----------------------| + // |< jumping zone>| + + TInt visIndex = iList->VisibleWindowIndex(); + TInt index = visIndex; + TInt listCount = iList->Count(); + __ASSERT_ALWAYS( index >= 0 && index <= listCount, Panic( EGlxPanicIllegalState ) ); + //Inorder to ensure that the start of refresh of thumbnails is contained in + //in the current visible window. We set the startIndex to center element of + //the current visible window. + TInt startIndex = index + iDefaultVisItems/2; + if (listCount < iDefaultVisItems) + { + startIndex = listCount/2; + } + + index = ( (startIndex) <= (listCount)) ? startIndex : listCount; + + TInt min = Min(iFrontOffset, iRearOffset); + TInt jumpingZoneLength = min * 2; + if (iCurrentItem <= jumpingZoneLength) + { + // Still within the (rear-front-rear-front) jumping zone + TInt distanceFromFocus = (iCurrentItem + 1) / 2; + TBool rear = !(iCurrentItem & 1); // Rear if number is even + // Check if out of bounds + if (rear) + { + if (index - distanceFromFocus <= visIndex - iRearOffset) + { + return KErrNotFound; + } + index -= distanceFromFocus; + } + else + { + if (index + distanceFromFocus >= visIndex + iFrontOffset) + { + return KErrNotFound; + } + index += distanceFromFocus; + } + } + else + { + __ASSERT_DEBUG(iFrontOffset != iRearOffset, Panic(EGlxPanicLogicError)); + + // index is currently visible index. Figure out how much need to move. + TInt indexesFromFocus = iCurrentItem - min; + if (iRearOffset < iFrontOffset) + { + // Front range is longer than rear, so the item is on the front side + index += indexesFromFocus; + } + else + { + // Rear range is longer than front, so the item is on the rear side + index -= indexesFromFocus; + } + } + + iCurrentItem++; + + // The index may be below 0 or above count. Normalise back to list indexes. + return GlxListUtils::NormalizedIndex(index, count); + } + +// ----------------------------------------------------------------------------- +// Return ETrue if index is within range, EFalse otherwise +// ----------------------------------------------------------------------------- +// +TBool TGlxFromManualIndexBlockyIterator::InRange(TInt aIndex) const + { + TRACER("TGlxFromManualIndexBlockyIterator::InRange"); + TInt count = iList->Count(); + + // Handle the case where range is longer than count separately, because looping will + // confuse otherwise + if (count <= iRearOffset + iFrontOffset) + { + // Range is longer than count, must be in range + return ETrue; + } + + TInt index = iList->VisibleWindowIndex(); + __ASSERT_ALWAYS( index >= 0 && index < iList->Count(), Panic( EGlxPanicIllegalState ) ); + + TInt firstInRange = GlxListUtils::NormalizedIndex(index - iRearOffset, count); + TInt lastInRange = GlxListUtils::NormalizedIndex(index + iFrontOffset, count); + + if (firstInRange <= lastInRange) + { + // Normal case: | F-------L | + return aIndex >= firstInRange && aIndex <= lastInRange; + } + else + { + // Looping case: |----L F----| + return aIndex <= lastInRange || aIndex >= firstInRange; + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxnavigablelist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxnavigablelist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,956 @@ +/* +* Copyright (c) 2008-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: List of media items, which has focus +* +*/ + + + + +// my include +#include "glxnavigablelist.h" + +// system includes +#include +#include +#include + +// user includes +#include "glxlistutils.h" +#include "glxmedia.h" +#include "glxstaticitemlist.h" +#include "mglxnavigablelistobserver.h" + +using namespace NGlxNavigableList; + +namespace NGlxNavigableList + { + + /** + * Strategy to process selection indexes + */ + class MSelectionIndexStrategy + { + public: + /** + * Process a single selection index + * @param aSelectedItemIndex index in selected item index array to process + */ + virtual void Process( TInt aSelectedItemIndex ) = 0; + }; + + /** + * Strategy to remove selection indexes + */ + NONSHARABLE_CLASS( TRemoveSelectedItemIndexStrategy ) : + public MSelectionIndexStrategy + { + public: + /** + * Constructor + * @param aSelectedItemIndices Selected item index array + */ + TRemoveSelectedItemIndexStrategy( RArray< TInt>& aSelectedItemIndices ) + : iSelectedItemIndices( aSelectedItemIndices ) + { + } + + /** See @ref MSelectionIndexStrategy */ + void Process( TInt aSelectedItemIndex ) + { + iSelectedItemIndices.Remove( aSelectedItemIndex ); + } + + private: + /// Selected item indexes + RArray< TInt>& iSelectedItemIndices; + }; + + /** + * Strategy to move selection indexes + */ + NONSHARABLE_CLASS( TMoveSelectedItemIndexStrategy ) : + public MSelectionIndexStrategy + { + public: + /** + * Constructor + * @param aMoveCount a number of items to move index by + */ + TMoveSelectedItemIndexStrategy( RArray< TInt>& aSelectedItemIndices, + TInt aMoveCount ) + : iSelectedItemIndices( aSelectedItemIndices ) + { + iMoveCount = aMoveCount; + } + + /** See @ref MSelectionIndexStrategy */ + void Process( TInt aSelectedItemIndex ) + { + iSelectedItemIndices[ aSelectedItemIndex ] += iMoveCount; + } + + private: + /// The count of items to move by + TInt iMoveCount; + /// Selected item indexes + RArray< TInt>& iSelectedItemIndices; + }; + + } // namespace NGlxNavigableList + +// ----------------------------------------------------------------------------- +// Two-phase constructor +// ----------------------------------------------------------------------------- +// +CGlxNavigableList* CGlxNavigableList::NewL( const TGlxIdSpaceId& aIdSpaceId, + MGlxNavigableListObserver& aObserver, MGlxMediaUser& aMediaUser ) + { + TRACER("CGlxNavigableList::NewL"); + + CGlxNavigableList* self = new (ELeave) CGlxNavigableList( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL( aIdSpaceId, aMediaUser ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxNavigableList::CGlxNavigableList( MGlxNavigableListObserver& aObserver ) : + iFocusInitialPosition( NGlxListDefs::EFocusFirst ), + iObserver( aObserver ) + { + TRACER("CGlxNavigableList::CGlxNavigableList"); + + iFocusIndex = KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// Second-phase constructor +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::ConstructL( const TGlxIdSpaceId& aIdSpaceId, + MGlxMediaUser& aMediaUser ) + { + TRACER("CGlxNavigableList::ConstructL"); + + iItemList = CGlxStaticItemList::NewL( aIdSpaceId, *this, aMediaUser ); + + + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxNavigableList::~CGlxNavigableList() + { + TRACER( "CGlxNavigableList::~CGlxNavigableList" ); + iSelectedItemIndices.Close(); + delete iItemList; + + + } + +// ----------------------------------------------------------------------------- +// return id space id +// ----------------------------------------------------------------------------- +// +const TGlxIdSpaceId& CGlxNavigableList::IdSpaceId() const + { + TRACER( "CGlxNavigableList::IdSpaceId"); + + return iItemList->IdSpaceId(); + } + +// ----------------------------------------------------------------------------- +// Synchronise contents of the list with the collection path +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::SetContentsL( const CMPXCollectionPath& aPath, + const MGlxMediaPool& aMediaPool ) + { + TRACER( "CGlxNavigableList::SetContentsL" ); + iItemList->SetContentsL( aPath, aMediaPool ); + } + +// ----------------------------------------------------------------------------- +// Re-orders contents of the list with the collection path +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::ReorderContentsL( const CMPXCollectionPath& aPath, + const MGlxMediaPool& aMediaPool ) + { + TRACER( "CGlxNavigableList::ReorderContentsL" ); + __TEST_INVARIANT; + + // List contents have been reordered. If we called SetContentsL directly, + // the client would get semi-random (but correct) sequence of added/removed + // notifications. To provide a cleaner notification, send only "all removed" + // and "all added" notifications. + + // store the focus and selection temporarily for restoring later- + // (store ids; cannot store index, since indexes may change upon reorder) + TGlxMediaId focusedItemId = FocusId(); + + RArray< TGlxMediaId > selectedItemIds; + CleanupClosePushL( selectedItemIds ); + SelectionL( selectedItemIds ); + + // send notification "all items removed" + ClearContentsL( aMediaPool ); + + // set contents to reordered list, this removes focus and selection. + // send notification of "all items added" (in new order) + SetContentsL( aPath, aMediaPool ); + + // restore focus and selection + SetFocus( focusedItemId ); + SelectL( selectedItemIds ); + + CleanupStack::PopAndDestroy( &selectedItemIds ); + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Remove an item form the list +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::Remove( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aItemId ) + { + TRACER( "CGlxNavigableList::Remove" ); + iItemList->Remove( aIdSpaceId, aItemId ); + } + +// ----------------------------------------------------------------------------- +// Remove any pointers to the media object at the specified index +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::RemoveReference( TInt aIndex ) + { + TRACER( "CGlxNavigableList::RemoveReference" ); + iItemList->RemoveReference( aIndex ); + } + +// ----------------------------------------------------------------------------- +// Add a static item +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::AddStaticItemL( CGlxMedia* aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ) + { + TRACER( "CGlxNavigableList::AddStaticItemL" ); + iItemList->AddStaticItemL( aStaticItem, aTargetPosition ); + } + +// ----------------------------------------------------------------------------- +// Enable/disable static items +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::SetStaticItemsEnabled( TBool aEnabled ) + { + TRACER( "CGlxNavigableList::SetStaticItemsEnabled" ); + iItemList->SetStaticItemsEnabled( aEnabled ); + } + +// ----------------------------------------------------------------------------- +// return ETrue if static items are enabled +// ----------------------------------------------------------------------------- +// +TBool CGlxNavigableList::IsStaticItemsEnabled() const + { + TRACER( "CGlxNavigableList::IsStaticItemsEnabled"); + + return iItemList->IsStaticItemsEnabled(); + } + +// ----------------------------------------------------------------------------- +// Return count +// ----------------------------------------------------------------------------- +// +TInt CGlxNavigableList::Count( NGlxListDefs::TCountType aType ) const + { + TRACER( "CGlxNavigableList::Count"); + + return iItemList->Count( aType ); + } + +// ----------------------------------------------------------------------------- +// Sets the initial focus position, first or last item +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition aFocusInitialPosition) + { + TRACER( "CGlxNavigableList::SetFocusInitialPosition"); + + iFocusInitialPosition = aFocusInitialPosition; + SetInitialFocus(); + } + +// ----------------------------------------------------------------------------- +// Return focus index +// ----------------------------------------------------------------------------- +// +TInt CGlxNavigableList::FocusIndex() const + { + TRACER( "CGlxNavigableList::FocusIndex"); + + return iFocusIndex; + } + +// ----------------------------------------------------------------------------- +// Set focus index +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::SetFocus( NGlxListDefs::TFocusSetType aType, TInt aValue ) + { + TRACER( "CGlxNavigableList::SetFocus"); + GLX_LOG_INFO1( "CGlxNavigableList::SetFocus: Entry: %d", aValue ); + + __TEST_INVARIANT; + + // Observer callback needs to know the focus change type + NGlxListDefs::TFocusChangeType type = NGlxListDefs::EUnknown; + + TInt oldIndex = iFocusIndex; + + switch ( aType ) + { + case NGlxListDefs::EAbsolute: + type = SetFocus( aValue ); + break; + + case NGlxListDefs::ERelative: + type = MoveFocus( aValue ); + break; + + default: + Panic( EGlxPanicIllegalArgument ); // Unsupported focus change type + break; + } + + + + // notify observer if focus changed + NotifyFocusChange( type, oldIndex, iFocusIndex != oldIndex ); + + __TEST_INVARIANT; + GLX_LOG_INFO( "CGlxNavigableList::SetFocusL: Exit" ); + } + +// ----------------------------------------------------------------------------- +// Set focus by id +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::SetFocus( const TGlxMediaId& aItemId ) + { + TRACER( "CGlxNavigableList::SetFocus"); + + TInt index = Index( IdSpaceId(), aItemId ); + if ( KErrNotFound != index ) + { + // Focus the item if it still exists in the new list + SetFocus( NGlxListDefs::EAbsolute, index ); + } + } + +// ----------------------------------------------------------------------------- +// Set focus index +// ----------------------------------------------------------------------------- +// +NGlxListDefs::TFocusChangeType CGlxNavigableList::SetFocus( TInt aIndex ) + { + TRACER( "CGlxNavigableList::SetFocus"); + __ASSERT_ALWAYS( aIndex >= 0 && aIndex < Count(), Panic( EGlxPanicIllegalArgument ) ); + + iFocusIndex = aIndex; + + // it is not possible to know which direction focus was moving, since + // client did not specify it. Looping of the list makes it impossible to + // compare the old and new index. + return NGlxListDefs::EUnknown; + } + +// ----------------------------------------------------------------------------- +// Move focus index +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline NGlxListDefs::TFocusChangeType CGlxNavigableList::MoveFocus( TInt aDelta ) + { + TRACER( "CGlxNavigableList::MoveFocus"); + + // Moving focus in not possible when the list is empty + if ( KErrNotFound != iFocusIndex ) + { + // Move focus index + iFocusIndex += aDelta; + + // wrap back into the loop + iFocusIndex = GlxListUtils::NormalizedIndex( iFocusIndex, Count() ); + + // determine direction of focus change + if ( aDelta > 0 ) + { + return NGlxListDefs::EForward; + } + // client won't be notified if aDelta is 0, so it is suitable + // to return EBackward, even if focus does not move + return NGlxListDefs::EBackward; + } + + return NGlxListDefs::EUnknown; + } + +// ----------------------------------------------------------------------------- +// Notify observers of focus change +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::NotifyFocusChange( NGlxListDefs::TFocusChangeType aType, + TInt aOldIndex, TBool aNotify ) + { + TRACER( "CGlxNavigableList::NotifyFocusChange"); + + if ( aNotify ) + { + iObserver.HandleFocusChanged( aType, iFocusIndex, aOldIndex ); + } + } + +// ----------------------------------------------------------------------------- +// Sets the initial focus +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::SetInitialFocus() + { + TRACER( "CGlxNavigableList::SetInitialFocus"); + + // Only need to set focus if there are some items + if ( Count() ) + { + if ( iFocusInitialPosition == NGlxListDefs::EFocusFirst ) + { + iFocusIndex = 0; + } + else // iFocusInitialPosition == NGlxListDefs::EFocusLast + { + iFocusIndex = Count() - 1; + } + } + } + +// ----------------------------------------------------------------------------- +// Resets the focus to the initial position +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::ResetFocus() + { + TRACER( "CGlxNavigableList::ResetFocus"); + + TInt oldFocusIndex = iFocusIndex; + + SetInitialFocus(); + + // notify of focus change after resetting focus + // Only need to notify if there are some items + if( Count() ) + { + NotifyFocusChange( NGlxListDefs::EUnknown, oldFocusIndex, ETrue ); + } + } + +// ----------------------------------------------------------------------------- +// Return item by index +// ----------------------------------------------------------------------------- +// +TGlxMedia& CGlxNavigableList::Item( TInt aIndex ) + { + TRACER( "CGlxNavigableList::Item"); + + return iItemList->Item( aIndex ); + } + +// ----------------------------------------------------------------------------- +// Return index by id +// ----------------------------------------------------------------------------- +// +TInt CGlxNavigableList::Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId ) const + { + TRACER( "CGlxNavigableList::Index"); + + return iItemList->Index(aIdSpaceId, aId ); + } + +// ----------------------------------------------------------------------------- +// Return whether item at index is selected +// ----------------------------------------------------------------------------- +// +TBool CGlxNavigableList::IsSelected(TInt aIndex) const + { + TRACER( "CGlxNavigableList::IsSelected"); + + return ( KErrNotFound != iSelectedItemIndices.FindInOrder( aIndex ) ); + } + +// ----------------------------------------------------------------------------- +// Select/deselect item +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::SetSelectedL( TInt aIndex, TBool aSelected ) + { + TRACER( "CGlxNavigableList::SetSelectedL"); + GLX_LOG_INFO2( "CGlxNavigableList::SetSelectedL: index %d selected %b", + aIndex, aSelected ); + __TEST_INVARIANT; + + if ( aSelected ) + { + SelectL( aIndex ); + } + else + { + Deselect( aIndex ); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Return id of focused item or KGlxIdNone +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline TGlxMediaId CGlxNavigableList::FocusId() const + { + TRACER( "CGlxNavigableList::FocusId"); + + if ( KErrNotFound != iFocusIndex ) + { + return iItemList->Item( iFocusIndex ).Id(); + } + return KGlxIdNone; + } + +// ----------------------------------------------------------------------------- +// Return id of focused item or KGlxIdNone +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::SelectionL( RArray< TGlxMediaId >& aItemIds ) const + { + TRACER( "CGlxNavigableList::SelectionL"); + + aItemIds.Reset(); + + // Reserve full required space to avoid reallocations during loop + aItemIds.ReserveL( iSelectedItemIndices.Count() ); + + TInt count = iSelectedItemIndices.Count(); + for ( TInt i = 0; i < count; ++i ) + { + aItemIds.AppendL( iItemList->Item( iSelectedItemIndices[ i ] ).Id() ); + } + } + +// ----------------------------------------------------------------------------- +// Clear list contents +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::ClearContentsL( const MGlxMediaPool& aMediaPool ) + { + TRACER( "CGlxNavigableList::ClearContentsL"); + + // Create a path with no items in order to empty the list + CMPXCollectionPath* emptyPath = CMPXCollectionPath::NewL(); + CleanupStack::PushL( emptyPath ); + + iItemList->SetContentsL( *emptyPath, aMediaPool ); + + CleanupStack::PopAndDestroy( emptyPath ); + } + +// ----------------------------------------------------------------------------- +// Select items by id +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::SelectL( const RArray< TGlxMediaId >& aItemIds ) + { + TRACER( "CGlxNavigableList::SelectL"); + + // Reserve free space for the full selection, so that the operation can + // be atomic + ReserveFreeSpaceInSelectionL( aItemIds.Count() ); + + // pick id space id locally to avoid re-retrieving during the loop + TGlxIdSpaceId idSpaceId = IdSpaceId(); + + // Select the requested items + TInt count = aItemIds.Count(); + for ( TInt i = 0; i < count; i++ ) + { + TInt index = Index( idSpaceId, aItemIds[ i ] ); + if ( index != KErrNotFound ) + { + Select( index ); + } + } + } + +// ----------------------------------------------------------------------------- +// Select item +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::SelectL( TInt aIndex ) + { + TRACER( "CGlxNavigableList::SelectL"); + + // Don't allow static items to be selected + if ( !Item( aIndex ).IsStatic() ) + { + ReserveFreeSpaceInSelectionL( 1 ); + Select( aIndex ); + } + } + +// ----------------------------------------------------------------------------- +// Select item. Must call ReserveFreeSpaceInSelectionL before +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::Select( TInt aIndex ) + { + TRACER( "CGlxNavigableList::Select"); + + __ASSERT_DEBUG( _iSelectionReserveCount > 0, Panic( EGlxPanicNoReservation ) ); // No reservation made + __DEBUG_ONLY( _iSelectionReserveCount-- ); + + // returns KErrNone if inserted successfully, KErrAlreadyExists if already exists + if ( KErrNone == iSelectedItemIndices.InsertInOrder( aIndex ) ) + { + iObserver.HandleItemSelected( aIndex, ETrue ); + } + } + +// ----------------------------------------------------------------------------- +// Reserve free space is selected item indexes array +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::ReserveFreeSpaceInSelectionL( TInt aCount ) + { + TRACER( "CGlxNavigableList::ReserveFreeSpaceInSelectionL"); + + iSelectedItemIndices.ReserveL( iSelectedItemIndices.Count() + aCount ); + + // store reservation count so can protect agains Select(...) being called + // without reservation + __DEBUG_ONLY( _iSelectionReserveCount = aCount ); + } + +// ----------------------------------------------------------------------------- +// Deselect item +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::Deselect( TInt aIndex ) + { + TRACER( "CGlxNavigableList::Deselect"); + + // item has been deselected, remove if found + TInt selectionArrayIndex = iSelectedItemIndices.FindInOrder( aIndex ); + if ( KErrNotFound != selectionArrayIndex ) + { + // remove from array of selected items + iSelectedItemIndices.Remove( selectionArrayIndex ); + + // free unused memory from selected item indexes array + // (this call may be a performance bottleneck if executing unmark all + // in a list of many thousands of items when most of them are marked. + // if it is proved to be a performance bottleneck, it may be sensible + // to count how many times Deselect has been called, an only + // compress every x times.) + //iSelectedItemIndices.Compress(); + + // selection has changed, notify observer + iObserver.HandleItemSelected( aIndex, EFalse ); + } + // else: ignore if item was not selected + } + +// ----------------------------------------------------------------------------- +// Return selected items +// ----------------------------------------------------------------------------- +// +const TArray< TInt > CGlxNavigableList::SelectedItemIndices() const + { + TRACER( "CGlxNavigableList::SelectedItemIndices"); + + return iSelectedItemIndices.Array(); + } + +// ----------------------------------------------------------------------------- +// Handle items being added +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::HandleItemsAdded( TInt aFirstInsertedIndex, + TInt aCount ) + { + TRACER( "CGlxNavigableList::HandleItemsAdded" ); + + // Do not test invariant in the beginning of this function. Right now, + // the state is not valid, since iItemList's state has already changed, and + // this function will align the state of this object with iItemList. + + // Move selection indexes from insertion point + TMoveSelectedItemIndexStrategy moveStrategy( iSelectedItemIndices, aCount ); + ProcessSelectionItemIndicesBetweenIndexes( aFirstInsertedIndex, + Count( NGlxListDefs::ECountAll ), moveStrategy ); + + // move focus + TInt oldFocusIndex = iFocusIndex; + TInt notifyOfFocusChange = UpdateFocusAfterInsertion( aFirstInsertedIndex, aCount ); + + // Adjust index by amount of static items + iObserver.HandleItemsAdded( aFirstInsertedIndex, aCount ); + + // notify of focus change after having notified of items being added, + // so that focus index points to the correct real item on client side + NotifyFocusChange( NGlxListDefs::EUnknown, oldFocusIndex, + notifyOfFocusChange ); + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Move focus after items have been inserted +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline TInt CGlxNavigableList::UpdateFocusAfterInsertion( TInt aInsertionIndex, + TInt aInsertionCount ) + { + TRACER( "CGlxNavigableList::UpdateFocusAfterInsertion" ); + + // Move focus if index is changed. + TBool notifyObserver = MoveFocusIfIndexChanged( aInsertionIndex, aInsertionCount ); + + // Set focus to initial focus position if not previously set. Test also that count larger + // than zero, just to be safe for future maintenance of other classes + if ( KErrNotFound == iFocusIndex && Count( NGlxListDefs::ECountAll ) > 0 ) + { + GLX_LOG_INFO("iFocusIndex is KErrNotFound"); + + // Set initial focus position + SetInitialFocus(); + + notifyObserver = ETrue; + } + + return notifyObserver; + } + +// ----------------------------------------------------------------------------- +// Move focus if index is changed. +// ----------------------------------------------------------------------------- +// +TBool CGlxNavigableList::MoveFocusIfIndexChanged( TInt aChangedIndex, TInt aMoveBy ) + { + TRACER( "CGlxNavigableList::MoveFocusIfIndexChanged" ); + + if ( iFocusIndex >= aChangedIndex ) + { + iFocusIndex += aMoveBy; + return ETrue; // notify observer + } + + return EFalse; // don't notify observer + } + +// ----------------------------------------------------------------------------- +// Handle items being removed +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ) + { + TRACER( "CGlxNavigableList::HandleItemsRemoved" ); + + // Do not test invariant in the beginning of this function. Right now, + // the state is not valid, since iItemList's state has already changed, and + // this function will align the state of this object with iItemList. + + // update selection + UpdateSelectionAfterRemove( aRemovedFromIndex, aCount ); + TInt oldFocusIndex = iFocusIndex; + TBool notifyOfFocusChange = UpdateFocusAfterRemoval( aRemovedFromIndex, + aCount ); + + // notify observer + iObserver.HandleItemsRemoved( aRemovedFromIndex, aCount ); + + // notify of focus change after having notified of items being removed, + // so that focus index points to the correct real item on client side + NotifyFocusChange( NGlxListDefs::EUnknown, oldFocusIndex, + notifyOfFocusChange ); + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Update selection after remove +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxNavigableList::UpdateSelectionAfterRemove( TInt aRemovedFromIndex, + TInt aRemovedCount ) + { + TRACER( "CGlxNavigableList::UpdateSelectionAfterRemove"); + + // remove items from selected list that were removed + TRemoveSelectedItemIndexStrategy removeStrategy( iSelectedItemIndices ); + ProcessSelectionItemIndicesBetweenIndexes( aRemovedFromIndex, + aRemovedFromIndex + aRemovedCount, removeStrategy ); + + // move selection indexes from removal point + TMoveSelectedItemIndexStrategy moveStrategy( iSelectedItemIndices, -aRemovedCount ); + ProcessSelectionItemIndicesBetweenIndexes( aRemovedFromIndex + aRemovedCount, + KMaxTInt, moveStrategy ); + } + +// ----------------------------------------------------------------------------- +// Move focus after items have been removed +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline TBool CGlxNavigableList::UpdateFocusAfterRemoval( TInt aRemovedFromIndex, + TInt aRemovedCount ) + { + TRACER( "CGlxNavigableList::UpdateFocusAfterRemoval"); + + // Assume focus will be changed (simplifies code below) + TBool notifyObserver = EFalse; + + // move focus if it is after the last removed item (incl. list has become empty) + if ( iFocusIndex >= aRemovedFromIndex + aRemovedCount ) + { + iFocusIndex -= aRemovedCount; + // although the focus did not logically change in this case, notify + // anyway to simplify client code + notifyObserver = ETrue; + } + // move focus if it is on removed items + else if ( iFocusIndex >= aRemovedFromIndex ) + { + iFocusIndex = Min( aRemovedFromIndex, Count() - 1 ); + notifyObserver = ETrue; + } + // else focus is before removed items, so do nothing + + return notifyObserver; + } + +// ----------------------------------------------------------------------------- +// Remove selection indices between two indexes +// ----------------------------------------------------------------------------- +// +void CGlxNavigableList::ProcessSelectionItemIndicesBetweenIndexes( + TInt aFromIndex, TInt aToIndex, MSelectionIndexStrategy& aStrategy ) + { + TRACER("CGlxNavigableList::ProcessSelectionItemIndicesBetweenIndexes"); + + // Find first selection item index that points to an index larger or equal + // than aFromIndex + TInt selectedItemIndex = FindFirstSelectedItemIndexBefore( aToIndex ); + // Process until finds a selection item index pointing to an item smaller + // than aFromIndex + while ( selectedItemIndex >= 0 && + iSelectedItemIndices[ selectedItemIndex ] >= aFromIndex ) + { + aStrategy.Process( selectedItemIndex ); + selectedItemIndex--; + } + } + +// ----------------------------------------------------------------------------- +// Return first selection item index on or after +// ----------------------------------------------------------------------------- +// +inline TInt CGlxNavigableList::FindFirstSelectedItemIndexBefore( TInt aMaxIndex ) + { + TRACER( "CGlxNavigableList::FindFirstSelectedItemIndexBefore"); + + // Find first selection item index that points to an index larger or equal + // than aAtLeastIndex + TInt i = iSelectedItemIndices.Count() - 1; + while ( i >= 0 ) + { + if ( iSelectedItemIndices[i] < aMaxIndex ) + { + break; + } + i--; + } + + // KErrNotFound == -1, which will be returned if the loop did not break + return i; + } + +// --------------------------------------------------------------------------- +// Test invariant +// --------------------------------------------------------------------------- +void CGlxNavigableList::__DbgTestInvariant() const + { + TRACER( "CGlxNavigableList::__DbgTestInvariant"); + + #if 0 + //def _DEBUG + + // focus index must be KErrNotFound if list is empty + __ASSERT_DEBUG( iFocusIndex == KErrNotFound || iItemList->Count( NGlxListDefs::ECountAll ), Panic( EGlxPanicIllegalState ) ); + // focus index must be between 0 and count if list is not empty + __ASSERT_DEBUG( ( iFocusIndex >= 0 && + iFocusIndex < iItemList->Count( NGlxListDefs::ECountAll ) ) || + !iItemList->Count( NGlxListDefs::ECountAll ), + Panic( EGlxPanicIllegalState ) ); + // max count amount of items can be selected + __ASSERT_DEBUG( iSelectedItemIndices.Count() <= iItemList->Count( NGlxListDefs::ECountAll ), Panic( EGlxPanicIllegalState ) ); + // test selection item index array + TInt previousSelectedIndex = -1; + for ( TInt i = 0; i < iSelectedItemIndices.Count(); i++ ) + { + // index must be between zero and count + __ASSERT_DEBUG( iSelectedItemIndices[ i ] >= 0 && iSelectedItemIndices[ i ] < iItemList->Count( NGlxListDefs::ECountAll ), Panic( EGlxPanicIllegalState ) ); + // index must not be in order + __ASSERT_DEBUG( iSelectedItemIndices[ i ] > previousSelectedIndex, Panic( EGlxPanicIllegalState ) ); + // prepare next round + previousSelectedIndex = iSelectedItemIndices[ i ]; + } + + #endif // _DEBUG + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxstaticitemlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxstaticitemlist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,742 @@ +/* +* Copyright (c) 2008-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: List of media items +* +*/ + + + + +// my include +#include "glxstaticitemlist.h" + +// system includes +#include +#include + +// user includes +#include "glxitemlist.h" +#include "glxmediastaticitemdefs.h" + +using namespace NGlxListDefs; + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxStaticItemList::RStaticMediaArray::~RStaticMediaArray() + { + TRACER( "CGlxStaticItemList::RStaticMediaArray::~RStaticMediaArray" ); + + // delete owned static items + TInt count = Count(); + for ( TInt i = 0 ; i < count; i++ ) + { + Delete( i ); + } + Close(); + } + +// ----------------------------------------------------------------------------- +// Delete item at index +// ----------------------------------------------------------------------------- +void CGlxStaticItemList::RStaticMediaArray::Delete( TInt aIndex ) + { + TRACER( "CGlxStaticItemList::RStaticMediaArray::Delete" ); + + delete ( (*this)[ aIndex ] ).Properties(); + } + +// ----------------------------------------------------------------------------- +// CGlxStaticItemList class implementation +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Two-phase constructor +// ----------------------------------------------------------------------------- +// +CGlxStaticItemList* CGlxStaticItemList::NewL( const TGlxIdSpaceId& aIdSpaceId, + MGlxItemListObserver& aObserver, MGlxMediaUser& aMediaUser ) + { + TRACER( "CGlxStaticItemList::NewL"); + CGlxStaticItemList* self = new (ELeave) CGlxStaticItemList( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL( aIdSpaceId, aMediaUser ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxStaticItemList::CGlxStaticItemList( MGlxItemListObserver& aObserver ) + : iObserver( aObserver ) + { + TRACER( "CGlxStaticItemList::CGlxStaticItemList" ); + + // Enable static items by default + iStaticItemsEnabled = ETrue; + } + +// ----------------------------------------------------------------------------- +// Second-phase constructor +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::ConstructL( const TGlxIdSpaceId& aIdSpaceId, + MGlxMediaUser& aMediaUser ) + { + TRACER( "CGlxStaticItemList::ConstructL" ); + + iItemList = CGlxItemList::NewL( aIdSpaceId, *this, aMediaUser ); + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxStaticItemList::~CGlxStaticItemList() + { + TRACER( "CGlxStaticItemList::~CGlxStaticItemList" ); + + delete iItemList; + // iFrontStaticItems and iRearStaticItems have a destructor that closes them + } + +// ----------------------------------------------------------------------------- +// return id space id +// ----------------------------------------------------------------------------- +// +const TGlxIdSpaceId& CGlxStaticItemList::IdSpaceId() const + { + TRACER( "CGlxStaticItemList::IdSpaceId"); + return iItemList->IdSpaceId(); + } + +// ----------------------------------------------------------------------------- +// Synchronise contents of the list with the collection path +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::SetContentsL( const CMPXCollectionPath& aPath, + const MGlxMediaPool& aMediaPool ) + { + TRACER( "CGlxStaticItemList::SetContentsL" ); + + __TEST_INVARIANT; + iItemList->SetContentsL( aPath, aMediaPool ); + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Remove an item form the list +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::Remove( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aItemId ) + { + TRACER( "CGlxStaticItemList::Remove" ); + + __TEST_INVARIANT; + + if ( aIdSpaceId == KGlxStaticItemIdSpaceId ) + { + DeleteStaticItem( aItemId ); + } + else + { + iItemList->Remove( aIdSpaceId, aItemId ); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Remove any pointers to the media object at the specified index +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::RemoveReference( TInt aIndex ) + { + TRACER( "CGlxStaticItemList::RemoveReference" ); + + __ASSERT_DEBUG( aIndex >= iCountCurrentFrontStatic && + aIndex < iCountCurrentFrontStatic + CountNonStatic(), + Panic( EGlxPanicIllegalArgument ) ); + + return iItemList->RemoveReference( aIndex - iCountCurrentFrontStatic ); + } + +// ----------------------------------------------------------------------------- +// Add a static item +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::AddStaticItemL( CGlxMedia* aStaticItem, + TInsertionPosition aTargetPosition ) + { + TRACER( "CGlxStaticItemList::AddStaticItemL" ); + __TEST_INVARIANT; + + if ( !aStaticItem ) + { + GLX_LOG_WARNING( "Supplied static item is null" ); + return; + } + + __ASSERT_DEBUG( aStaticItem->Id() != KGlxIdNone, Panic( EGlxPanicIllegalArgument ) ); // Must have an id defined, + + // Since ownership is given, it is assumed that this function is free to + // modify the static item + SetupStaticItemL( *aStaticItem ); + + // make reservations to arrays so that the object supplied as parameter + // can be safely modified. Assumption is that client has pushed aStaticItem + // to cleanup stack. + // for simplicity, reserve in both static arrays, although only one is needed + iRearStaticItems.ReserveL( iRearStaticItems.Count() + 1 ); // Space for one new item + iFrontStaticItems.ReserveL( iFrontStaticItems.Count() + 1 ); // Space for one new item + + // try to replace existing static item with the same id, if any + // TryReplaceStaticItem only replaces the item if the item exists + // in the same position (list beginning/end) as the new one + if ( !TryReplaceStaticItem( *aStaticItem, aTargetPosition ) ) + { + // TryReplaceStaticItem will fail if the item already exists, but in the + // other end of the list (aTargetPosition). Therefore, need to try to + // delete the static item, if any. + // this call notifies the observer of item being removed + DeleteStaticItem( aStaticItem->Id() ); + + // add the item to static item list, notified observer if + // static items currently active + AddStaticItem( *aStaticItem, aTargetPosition ); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Try to replace and existing static item +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline TBool CGlxStaticItemList::TryReplaceStaticItem( CGlxMedia& aStaticItem, + TInsertionPosition aTargetPosition ) + { + TRACER( "CGlxStaticItemList::TryReplaceStaticItem" ); + + GLX_ASSERT_DEBUG(aTargetPosition == EInsertFirst || aTargetPosition == EInsertLast, Panic(EGlxPanicLogicError), "Unknown static item target position"); + + if (aTargetPosition == EInsertFirst) + { + return TryReplaceStaticItem( aStaticItem, iFrontStaticItems ); + } + else + { + return TryReplaceStaticItem( aStaticItem, iRearStaticItems ); + } + } + +// ----------------------------------------------------------------------------- +// Try to replace and existing static item +// ----------------------------------------------------------------------------- +// +TBool CGlxStaticItemList::TryReplaceStaticItem( CGlxMedia& aStaticItem, + RStaticMediaArray& aStaticItemArray ) + { + TRACER( "CGlxStaticItemList::TryReplaceStaticItem"); + + // try to find a static item with the same id in the array. + // if found, replace the original static item with the new one + TInt index = Index( aStaticItem.Id(), aStaticItemArray ); + if ( KErrNotFound != index ) + { + // delete old static itemm does not remove space from array + aStaticItemArray.Delete( index ); + // take ownership of the static item + aStaticItemArray[ index ] = TGlxMedia( aStaticItem ); + + GLX_LOG_INFO( "Existing static item replaced" ); + return ETrue; // replaced + } + + return EFalse; // not replaced + } + +// ----------------------------------------------------------------------------- +// Remove static item +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::DeleteStaticItem( const TGlxMediaId& aId ) + { + TRACER( "CGlxStaticItemList::DeleteStaticItem"); + + // blindly try both arrays, does nothing if item not found + DeleteStaticItem( aId, iFrontStaticItems, 0, + iCountCurrentFrontStatic ); + DeleteStaticItem( aId, iRearStaticItems, FirstPostStaticIndex(), + iCountCurrentRearStatic ); + } + +// ----------------------------------------------------------------------------- +// Remove static item +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::DeleteStaticItem( const TGlxMediaId& aId, + RStaticMediaArray& aStaticItemArray, TInt aArrayOffset, + TInt& aCountCurrentStatic ) + { + TRACER( "CGlxStaticItemList::DeleteStaticItem"); + + TInt index = Index( aId, aStaticItemArray ); + if ( KErrNotFound != index ) + { + // delete old static item, does not remove space from array + aStaticItemArray.Delete( index ); + + // remove item from array + aStaticItemArray.Remove( index ); + + if ( iStaticItemsEnabled ) + { + // Remove from static item count + aCountCurrentStatic--; + // notify observer + iObserver.HandleItemsRemoved( index + aArrayOffset, 1 ); + } + } + } + +// ----------------------------------------------------------------------------- +// Add a static item +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::AddStaticItem( CGlxMedia& aStaticItem, + NGlxListDefs::TInsertionPosition aTargetPosition ) + { + TRACER( "CGlxStaticItemList::AddStaticItem"); + + // add the item to static item list, notified observer if + // static items currently active + if ( EInsertFirst == aTargetPosition ) + { + AddFrontStaticItem( aStaticItem ); + } + else + { + AddRearStaticItem( aStaticItem ); + } + } + +// ----------------------------------------------------------------------------- +// Add static item to the front of the list +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxStaticItemList::AddFrontStaticItem( CGlxMedia& aStaticItem ) + { + TRACER( "CGlxStaticItemList::AddFrontStaticItem"); + + // Add to the beginning of front static item array + iFrontStaticItems.Insert( TGlxMedia( aStaticItem ), 0 ); + // ignore return value, since assumes reservation was made to the array + // prior to calling this function, i.e. cannot fail + + // if static items are currently enabled, add item to the main item list + if ( iStaticItemsEnabled ) + { + iCountCurrentFrontStatic++; + + // notify of item being added + iObserver.HandleItemsAdded( 0, 1 ); + } + } + +// ----------------------------------------------------------------------------- +// Add static item to the front of the end of the list +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxStaticItemList::AddRearStaticItem( CGlxMedia& aStaticItem ) + { + TRACER( "CGlxStaticItemList::AddRearStaticItem"); + + // Add to the end of rear static item array + iRearStaticItems.Append( TGlxMedia( aStaticItem ) ); + // ignore return value, since assumes reservation was made to the array + // prior to calling this function, i.e. cannot fail + + // if static items are currently enabled, add item to the main item list + if ( iStaticItemsEnabled ) + { + iCountCurrentRearStatic++; + + // notify of item being added + TInt addIndex = CountAll() - 1; + iObserver.HandleItemsAdded( addIndex, 1 ); + } + } + +// ----------------------------------------------------------------------------- +// Make static item ready to be added to the list +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxStaticItemList::SetupStaticItemL( CGlxMedia& aStaticItem ) + { + TRACER( "CGlxStaticItemList::SetupStaticItemL"); + + // add static attribute, so that can later check if this item is static + aStaticItem.SetTObjectValueL( KGlxMediaStaticItem, ETrue ); + + // set media category attribute to "command", unless already defined by client + if( !aStaticItem.IsSupported( KMPXMediaGeneralCategory ) ) + { + aStaticItem.SetTObjectValueL( KMPXMediaGeneralCategory, EMPXCommand ); + } + } + +// ----------------------------------------------------------------------------- +// return ETrue if static items are enabled +// ----------------------------------------------------------------------------- +// +TBool CGlxStaticItemList::IsStaticItemsEnabled() const + { + TRACER( "CGlxStaticItemList::IsStaticItemsEnabled"); + + return iStaticItemsEnabled; + } + +// ----------------------------------------------------------------------------- +// Enable/disable static items +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::SetStaticItemsEnabled( TBool aEnabled ) + { + TRACER( "CGlxStaticItemList::SetStaticItemsEnabled"); + GLX_LOG_INFO1( "CGlxStaticItemList::SetStaticItemsEnabled: %b", aEnabled ); + __TEST_INVARIANT; + + iStaticItemsEnabled = aEnabled; + if ( aEnabled ) + { + EnableFrontStaticItems(); + EnableRearStaticItems(); + } + else + { + DisableFrontStaticItems(); + DisableRearStaticItems(); + } + + __TEST_INVARIANT; + } + +// ----------------------------------------------------------------------------- +// Enable front static items +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxStaticItemList::EnableFrontStaticItems() + { + TRACER( "CGlxStaticItemList::EnableFrontStaticItems"); + + // Notify only if current static item count is zero and there is more than + // one fron static item + if ( iCountCurrentFrontStatic < iFrontStaticItems.Count() ) + { + // Add front items and notify observer + iCountCurrentFrontStatic = iFrontStaticItems.Count(); + iObserver.HandleItemsAdded( 0, iCountCurrentFrontStatic ); + } + } + +// ----------------------------------------------------------------------------- +// Enable rear static items +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxStaticItemList::EnableRearStaticItems() + { + TRACER( "CGlxStaticItemList::EnableRearStaticItems"); + + // Notify only if current static item count is zero and there is more than + // one fron static item + if ( iCountCurrentRearStatic < iRearStaticItems.Count() ) + { + // Add rear items and notify observer + iCountCurrentRearStatic = iRearStaticItems.Count(); + iObserver.HandleItemsAdded( FirstPostStaticIndex(), + iCountCurrentRearStatic ); + } + } + +// ----------------------------------------------------------------------------- +// Disable static items from the front +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxStaticItemList::DisableFrontStaticItems() + { + TRACER( "CGlxStaticItemList::DisableFrontStaticItems"); + + // Remove static items from front + if ( iCountCurrentFrontStatic > 0 ) + { + TInt removedCount = iCountCurrentFrontStatic; + iCountCurrentFrontStatic = 0; + + // Notify observer + iObserver.HandleItemsRemoved( 0, removedCount ); + } + } + +// ----------------------------------------------------------------------------- +// Enable static items from the front +// inline private member function only in cpp file, so will be inlined in arm +// (ok as long as called only once) +// ----------------------------------------------------------------------------- +// +inline void CGlxStaticItemList::DisableRearStaticItems() + { + TRACER( "CGlxStaticItemList::DisableRearStaticItems"); + + // Remove static items from rear + if ( iCountCurrentRearStatic > 0 ) + { + TInt removedCount = iCountCurrentRearStatic; + iCountCurrentRearStatic = 0; + + // Notify observer + iObserver.HandleItemsRemoved( FirstPostStaticIndex(), removedCount ); + } + } + +// ----------------------------------------------------------------------------- +// Return count +// ----------------------------------------------------------------------------- +// +TInt CGlxStaticItemList::Count( NGlxListDefs::TCountType aType ) const + { + TRACER( "CGlxStaticItemList::Count"); + + switch ( aType ) + { + case ECountAllStatic: + return CountStatic(); + + case ECountPreStatic: + return iCountCurrentFrontStatic; + + case ECountPostStatic: + return iCountCurrentRearStatic; + + case ECountNonStatic: + return CountNonStatic(); + + default: + GLX_LOG_WARNING( "Unsupported count type" ); + // Fall through, and return all count as default + case ECountAll: + return CountAll(); + } + } + +// ----------------------------------------------------------------------------- +// Return count of all items +// inline private member function only in cpp file, so will be inlined in arm +// ----------------------------------------------------------------------------- +// +inline TInt CGlxStaticItemList::CountStatic() const + { + TRACER( "CGlxStaticItemList::CountStatic"); + + return iCountCurrentFrontStatic + iCountCurrentRearStatic; + } + +// ----------------------------------------------------------------------------- +// Return count of non-static items +// inline private member function only in cpp file, so will be inlined in arm +// ----------------------------------------------------------------------------- +// +inline TInt CGlxStaticItemList::CountNonStatic() const + { + TRACER( "CGlxStaticItemList::CountNonStatic"); + + return iItemList->Count(); + } + +// ----------------------------------------------------------------------------- +// Return count of all items +// inline private member function only in cpp file, so will be inlined in arm +// ----------------------------------------------------------------------------- +// +inline TInt CGlxStaticItemList::CountAll() const + { + TRACER( "CGlxStaticItemList::CountAll"); + + return iCountCurrentFrontStatic + iItemList->Count() + iCountCurrentRearStatic; + } + +// ----------------------------------------------------------------------------- +// Index of the first post static item +// ----------------------------------------------------------------------------- +// +TInt CGlxStaticItemList::FirstPostStaticIndex() const + { + TRACER( "CGlxStaticItemList::FirstPostStaticIndex"); + + return iCountCurrentFrontStatic + iItemList->Count(); + } + +// ----------------------------------------------------------------------------- +// Return item by index +// ----------------------------------------------------------------------------- +// +TGlxMedia& CGlxStaticItemList::Item( TInt aIndex ) + { + TRACER( "CGlxStaticItemList::Item"); + + // test if a front static index + if ( aIndex < iCountCurrentFrontStatic ) + { + return iFrontStaticItems[ aIndex ]; + } + + // test if normal index + if ( aIndex < iCountCurrentFrontStatic + CountNonStatic() ) + { + return iItemList->Item( aIndex - iCountCurrentFrontStatic ); + } + + // must be a rear static index + return iRearStaticItems[ aIndex - iCountCurrentFrontStatic - CountNonStatic() ]; + } + +// ----------------------------------------------------------------------------- +// Return index by id +// ----------------------------------------------------------------------------- +// +TInt CGlxStaticItemList::Index( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aId ) const + { + TRACER( "CGlxStaticItemList::Index"); + + if ( KGlxStaticItemIdSpaceId == aIdSpaceId.Value() ) + { + // try to find from front static items; may return KErrNotFound + TInt index = Index( aId, iFrontStaticItems ); + if ( KErrNotFound != index ) + { + return index; + } + + // Try rear static items + index = Index( aId, iRearStaticItems ); + if ( KErrNotFound != index ) + { + return index + FirstPostStaticIndex(); + } + } + else + { + // Look at the main list first (most likely case) + TInt index = iItemList->Index( aIdSpaceId, aId ); + if ( KErrNotFound != index ) + { + return index + iCountCurrentFrontStatic; + } + } + + // No such id + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// Return index by id +// ----------------------------------------------------------------------------- +// +TInt CGlxStaticItemList::Index( const TGlxMediaId& aId, + const RStaticMediaArray& aStaticItems ) const + { + TRACER( "CGlxStaticItemList::Index"); + + // set up comparison functor + TIdentityRelation< TGlxMedia > match ( &TGlxMedia::MatchById ); + // create dummy object to compare against + // Create to stack directly, CMedia constructor NULLs all member variables + TGlxMedia mediaToCompare( aId ); + + return aStaticItems.Find( mediaToCompare, match ); + } + +// ----------------------------------------------------------------------------- +// Handle items being added +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::HandleItemsAdded( TInt aFirstInsertedIndex, + TInt aCount ) + { + TRACER( "CGlxStaticItemList::HandleItemsAdded"); + + // there may be static items at the front of the list, so adjust and forward + // to observer + iObserver.HandleItemsAdded( aFirstInsertedIndex + iCountCurrentFrontStatic, + aCount ); + } + +// ----------------------------------------------------------------------------- +// Handle items being removed +// ----------------------------------------------------------------------------- +// +void CGlxStaticItemList::HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ) + { + TRACER( "CGlxStaticItemList::HandleItemsRemoved"); + + // there may be static items at the front of the list, so adjust and forward + // to observer + iObserver.HandleItemsRemoved( aRemovedFromIndex + iCountCurrentFrontStatic, + aCount ); + } + +// --------------------------------------------------------------------------- +// Test invariant +// --------------------------------------------------------------------------- +void CGlxStaticItemList::__DbgTestInvariant() const + { + TRACER( "CGlxStaticItemList::__DbgTestInvariant"); + + #ifdef _DEBUG + + __ASSERT_DEBUG( &iObserver, Panic( EGlxPanicIllegalState ) ); // Null observer + __ASSERT_DEBUG( iItemList, Panic( EGlxPanicIllegalState ) ); // No list + + // Make sure static item counts are zero when static items are disabled + __ASSERT_DEBUG( ( iCountCurrentFrontStatic == 0 && iCountCurrentRearStatic == 0 ) + || iStaticItemsEnabled, Panic( EGlxPanicIllegalState ) ); // No list + + // Make sure static item counts are match array counts when static items are enabled + __ASSERT_DEBUG( ( iCountCurrentFrontStatic == iFrontStaticItems.Count() + && iCountCurrentRearStatic == iRearStaticItems.Count() ) + || !iStaticItemsEnabled, Panic( EGlxPanicIllegalState ) ); // No list + + #endif // _DEBUG + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxthumbnailcontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxthumbnailcontext.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,685 @@ +/* +* Copyright (c) 2008-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: Fetch context to retrieve thumbnails +* +*/ + + + + + +#include +#include +#include +#include +#include // for KMPXMediaColDetailSpaceId +#include +#include + +#include "glxattributecontext.h" +#include "glxthumbnailcontext.h" +#include "glxmedialist.h" +#include "glxerrormanager.h" +#include "glxthumbnailutility.h" +#include "mglxcache.h" +#include "glxlistutils.h" + +/** + * Scoring for thumbnail provision order + * Having no thumbnail is the most important, so it gets the highest bit + * Proximity to focus is the final (lowest priority) criteria) + */ +const TUint KTNScoreNoThumbnail = 0x80000000; +// bits 0 to 24 are reserved for distance from focus (excessive, but free...) +const TUint KTNScoreMaxForDistanceFromFocus = 0x00FFFFFF; + + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxThumbnailContext* CGlxThumbnailContext::NewL(MGlxMediaListIterator* + aIterator) + { + TRACER( "CGlxThumbnailContext::NewL"); + + CGlxThumbnailContext* self = new(ELeave)CGlxThumbnailContext(aIterator); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxThumbnailContext::CGlxThumbnailContext(MGlxMediaListIterator* aIterator) : + iIterator(aIterator) + { + TRACER( "CGlxThumbnailContext::CGlxThumbnailContext"); + + __ASSERT_DEBUG(aIterator, Panic(EGlxPanicNullPointer)); + } + +// ----------------------------------------------------------------------------- +// ConstructL (2nd phase construction) +// ----------------------------------------------------------------------------- +// +void CGlxThumbnailContext::ConstructL() + { + TRACER( "CGlxThumbnailContext::ConstructL"); + + iCache = MGlxCache::InstanceL(); + iResolutionUtility = CGlxResolutionUtility::InstanceL(); + iResolutionUtility->AddObserverL( *this ); + + iDrmUtility = CGlxDRMUtility::InstanceL(); + + // create attribute context for DRM attributes + iDrmFetchContext = new (ELeave) CGlxAttributeContext(iIterator); + iDrmFetchContext->AddAttributeL(KMPXMediaDrmProtected); +#ifdef RD_MDS_2_5 + iDrmFetchContext->AddAttributeL(KGlxMediaGeneralDRMRightsValid); +#endif + iDrmFetchContext->AddAttributeL(KMPXMediaGeneralCategory); + iDrmFetchContext->AddAttributeL(KMPXMediaGeneralUri); + iDrmFetchContext->AddAttributeL(KMPXMediaGeneralSize); + iDrmFetchContext->AddAttributeL(KGlxMediaGeneralLastModifiedDate); + // add size attribute + iDrmFetchContext->AddAttributeL(KGlxMediaGeneralDimensions); + // add to speed up details retrieval + iDrmFetchContext->AddAttributeL(KMPXMediaGeneralTitle); + iDrmFetchContext->AddAttributeL(KMPXMediaGeneralDate); + iDrmFetchContext->AddAttributeL(KMPXMediaGeneralDrive); + iDrmFetchContext->AddAttributeL(KGlxMediaGeneralFramecount); + //Need to implement IdSpaceId() functionality. + iDrmFetchContext->AddAttributeL(KMPXMediaColDetailSpaceId); + // Attributes required to launch Options + iDrmFetchContext->AddAttributeL(KMPXMediaGeneralMimeType); + iDrmFetchContext->AddAttributeL(KGlxMediaGeneralLocation); + iDrmFetchContext->AddAttributeL(KGlxMediaGeneralSystemItem); + iDrmFetchContext->AddAttributeL(KGlxMediaGeneralSlideshowableContent); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxThumbnailContext::~CGlxThumbnailContext() + { + TRACER( "CGlxThumbnailContext::~CGlxThumbnailContext"); + + delete iDrmFetchContext; + + if ( iDrmUtility ) + { + iDrmUtility->Close(); + } + + iSpecs.Close(); + + if ( iResolutionUtility ) + { + iResolutionUtility->RemoveObserver( *this ); + iResolutionUtility->Close(); + } + + if ( iCache ) + { + iCache->Close(); + } + } + +// ----------------------------------------------------------------------------- +// Adds a new fetch specification for an item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxThumbnailContext::AddSpecForItemL( + TInt aWidth, TInt aHeight, TInt aFocusOffset ) + { + TRACER( "CGlxThumbnailContext::AddSpecForItemL"); + + TReal32 width( aWidth ); + TReal32 height( aHeight ); + + TAssignedFetchSpec spec; + spec.iPossWidth = iResolutionUtility->PixelsToPoss( width ); + spec.iPossHeight = iResolutionUtility->PixelsToPoss( height ); + spec.iFocusOffset = aFocusOffset; + + // Has this focus index has already been added? + #ifdef _DEBUG + TIdentityRelation match (&TAssignedFetchSpec::Match); + #endif + __ASSERT_DEBUG(iSpecs.Find(spec, match) == KErrNotFound, Panic(EGlxPanicAlreadyAdded)); + + iSpecs.AppendL(spec); + } + +// ----------------------------------------------------------------------------- +// Sets the default fetch specification +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxThumbnailContext::SetDefaultSpec(TInt aWidth, TInt aHeight) + { + TRACER( "CGlxThumbnailContext::SetDefaultSpec"); + + iDefaultSpecSize = TSize(aWidth, aHeight); + + TReal32 width( aWidth ); + TReal32 height( aHeight ); + + iDefaultSpec.iPossWidth = iResolutionUtility->PixelsToPoss( width ); + iDefaultSpec.iPossHeight = iResolutionUtility->PixelsToPoss( height ); + } + +// --------------------------------------------------------------------------- +// SetHighQualityOnly +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxThumbnailContext::SetHighQualityOnly( + TBool aHighQualityOnly ) + { + TRACER( "CGlxThumbnailContext::SetHighQualityOnly"); + + iHighQualityOnly = aHighQualityOnly; + } + +// ----------------------------------------------------------------------------- +// Get all attributes required for the item (whether the are fetched or not) +// From MGlxFetchContext +// ----------------------------------------------------------------------------- +// +void CGlxThumbnailContext::AllAttributesL(const MGlxMediaList* aList, TInt aListIndex, + RArray& aAttributes) const + { + TRACER( "CGlxThumbnailContext::AllAttributesL"); + + if (!iIterator) + { + return; + } + + // add attributes from owned attribute context + iDrmFetchContext->AllAttributesL(aList,aListIndex, aAttributes); + + // No requests outside range + iIterator->SetToFirst(aList); + if (!iIterator->InRange(aListIndex)) + { + return; + } + TBool drmValid = EFalse; + TSize size = iDefaultSpecSize; + const TGlxMedia& item( aList->Item( aListIndex ) ); + if( item.GetDrmProtected(drmValid) && drmValid) + { + drmValid = CheckDRMStatusL( aListIndex, aList, size ); + } + + TLinearOrder orderer (&CGlxMediaList::AttributeOrder); + // Always want high quality thumbnail + TMPXAttribute attr( KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, size.iWidth, size.iHeight ) ); + aAttributes.InsertInOrderAllowRepeatsL( attr , orderer); + + // If don't have high quality thumbnail, find closest available thumbnail + + const CGlxMedia* properties = item.Properties(); + if ( properties && !properties->IsSupported( attr ) ) + { + TMPXAttribute attr2; + + if ( item.GetClosestThumbnail( attr2, size, drmValid ) ) + { + aAttributes.InsertInOrderAllowRepeatsL( attr2 , orderer ); + } + } + + } + +// ----------------------------------------------------------------------------- +// Get attributes request for the item +// From MGlxFetchContext +// ----------------------------------------------------------------------------- +// +TInt CGlxThumbnailContext::AttributeRequestL(const MGlxMediaList* aList, + RArray& aItemIndices, RArray& aAttributes, + CMPXAttributeSpecs*& aDetailedSpecs) const + { + TRACER( "CGlxThumbnailContext::AttributeRequestL"); + + // Fetch the visible items attribs & thumbnail first. + TInt error = KErrNone; + TInt listIndex = SelectItemL(aList, error); + if ((listIndex >= 0 && aList->Item(listIndex).Uri().Length() == 0) || + aList->Count() <= GlxListUtils::VisibleItemsGranularityL()) + { + TInt reqCount = iDrmFetchContext->AttributeRequestL(aList, + aItemIndices, aAttributes, aDetailedSpecs); + + // if owned context requires DRM atributes need to request those 1st + if ( reqCount != 0 ) + { + GLX_DEBUG2("CGlxThumbnailContext::AttributeRequestL() reqCount=%d", reqCount); + return reqCount; + } + } + + // Select an item to process + error = KErrNone; + listIndex = SelectItemL(aList, error); + if (KErrNotFound != listIndex) + { + GLX_DEBUG2("CGlxThumbnailContext::AttributeRequestL() listIndex=%d", listIndex); + const TGlxMedia& item = aList->Item( listIndex ); + TSize size = iDefaultSpecSize; + + TBool drmValid = EFalse; + if( item.GetDrmProtected(drmValid) && drmValid) + { + CheckDRMStatusL( listIndex, aList, size ); + } + + // Request high quality thumbnail if already have any thumbnail + TBool quality = iHighQualityOnly + || HasFullThumbnail( aList->Item( listIndex ) ); + + GLX_DEBUG2("CGlxThumbnailContext::AttributeRequestL() quality=%d", quality); + TMPXAttribute attr( KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( + quality, size.iWidth, size.iHeight ) ); + + aAttributes.AppendL(attr); + + aItemIndices.AppendL(listIndex); + + // Allocate CMPXAttributeSpecs + CMPXAttributeSpecs* attributeSpecs = CMPXAttributeSpecs::NewL(); + CleanupStack::PushL(attributeSpecs); + + attributeSpecs->SetTObjectValueL( + TMPXAttribute( KGlxMediaIdThumbnail, + KGlxAttribSpecThumbnailSize ), size ); + + attributeSpecs->SetTObjectValueL( + TMPXAttribute( KGlxMediaIdThumbnail, + KGlxAttribSpecThumbnailQualityOverSpeed ), quality ); + + + aDetailedSpecs = attributeSpecs; + + // Pop from stack + CleanupStack::Pop(attributeSpecs); + } + else + { + // If an error was found, return KErrGeneral + if (error != KErrNone) + { + return KErrGeneral; + } + } + + return aItemIndices.Count(); + } + +// ----------------------------------------------------------------------------- +// Number of current requests +// From MGlxFetchContext +// ----------------------------------------------------------------------------- +TInt CGlxThumbnailContext::RequestCountL(const MGlxMediaList* aList) const + { + TRACER( "CGlxThumbnailContext::RequestCountL"); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attrSpecs = NULL; + + TInt requestCount = AttributeRequestL(aList, itemIndices, attributes, attrSpecs); + + delete attrSpecs; + + CleanupStack::PopAndDestroy(&attributes); + CleanupStack::PopAndDestroy(&itemIndices); + + return requestCount; + } + +// ----------------------------------------------------------------------------- +// HandleResolutionChanged +// ----------------------------------------------------------------------------- +// +void CGlxThumbnailContext::HandleResolutionChangedL() + { + TRACER( "CGlxThumbnailContext::HandleResolutionChanged"); + + // Ask cache manager to refresh, to fetch thumbnails in new size + iCache->RefreshL(); + } + +// ----------------------------------------------------------------------------- +// SelectItemL +// ----------------------------------------------------------------------------- +// +TInt CGlxThumbnailContext::SelectItemL(const MGlxMediaList* aList, TInt& aError) const + { + TRACER( "CGlxThumbnailContext::SelectItemL"); + + // Order of priorities when selecting the item: (highest priority rule first) + // Items with no thumbnail before items with thumbnail + // Items closer to the focus before + + TInt count = aList->Count(); + if (0 == count || !iIterator) + { + return KErrNotFound; + } + + // Iterate through range from iterator in search of the highest scoring thumbnail + TUint bestScore = 0; + TInt bestIndex = KErrNotFound; + iIterator->SetToFirst(aList); + TInt distanceFromFirst = 0; + TInt i; + while (KErrNotFound != (i = (*iIterator)++)) + { + // Calculate the score for this item + TUint score = GetThumbnailScoreL(i, aList, distanceFromFirst, aError); + __ASSERT_DEBUG(score != bestScore || score == 0, Panic(EGlxPanicLogicError)); // For safety, cannot allow two items with the same score + if (score > bestScore) + { + bestScore = score; + bestIndex = i; + } + + distanceFromFirst++; + } + + return bestIndex; + } + +// ----------------------------------------------------------------------------- +// GetThumbnailScoreL +// ----------------------------------------------------------------------------- +// +TUint CGlxThumbnailContext::GetThumbnailScoreL(TInt aListIndex, const MGlxMediaList* aList, + TInt aDistance, TInt& aError) const + { + TRACER( "CGlxThumbnailContext::GetThumbnailScoreL"); + + const TGlxMedia& item = aList->Item(aListIndex); + const CGlxMedia* properties = item.Properties(); + + // Check for the static item in the list. + // defualt icons needs to be displayed for static items. + if(item.IsStatic()) + { + return 0; + } + + TBool thumbnail = HasFullThumbnail( item ); + TUint score = 0; + + if ( properties ) + { + TSize size = iDefaultSpecSize; + + TBool drmValid = EFalse; + if( item.GetDrmProtected(drmValid) && drmValid) + { + CheckDRMStatusL( aListIndex, aList, size ); + } + + // Want high quality thumbnail if already have any thumbnail + TBool quality = iHighQualityOnly || thumbnail; + TMPXAttribute attr( KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( + quality, size.iWidth, size.iHeight ) ); + + // Items that are "perfect" are skipped + if ( quality && properties->IsSupported( attr ) ) + { + return 0; + } + + // Items for which fetching thumbnail failed are skipped + TInt error = GlxErrorManager::HasAttributeErrorL( properties, attr ); + if ( error != KErrNone ) + { + aError = error; + return 0; + } + } + + // Score on not having any thumbnail + if ( !thumbnail ) + { + score |= KTNScoreNoThumbnail; + } + + // Score on proximity to focus + score |= KTNScoreMaxForDistanceFromFocus - aDistance; // More distance, less points + + __ASSERT_DEBUG(score != 0, Panic(EGlxPanicLogicError)); + + return score; + } + +// ----------------------------------------------------------------------------- +// SpecForIndex +// ----------------------------------------------------------------------------- +// +const CGlxThumbnailContext::TFetchSpec& CGlxThumbnailContext::SpecForIndex( + TInt aListIndex, const MGlxMediaList* aList) const + { + TRACER( "CGlxThumbnailContext::SpecForIndex"); + + __ASSERT_DEBUG(aList, Panic(EGlxPanicNullPointer)); + + TInt count = aList->Count(); + TInt offset = Abs(aListIndex - aList->FocusIndex()); + + if ( offset > count / 2 ) + { + offset = count - offset; + } + + // Use specific context if one exists + TAssignedFetchSpec spec; + spec.iFocusOffset = offset; + TInt index = iSpecs.Find(spec, TAssignedFetchSpec::Match); + if ( KErrNotFound != index ) + { + return iSpecs[index]; + } + + return iDefaultSpec; + } + +// --------------------------------------------------------------------------- +// SizeFromSpec +// --------------------------------------------------------------------------- +// +TSize CGlxThumbnailContext::SizeFromSpec( const TFetchSpec& aSpec ) const + { + TRACER( "CGlxThumbnailContext::SizeFromSpec"); + + TReal32 width = iResolutionUtility->PossToPixels( aSpec.iPossWidth ); + TReal32 height = iResolutionUtility->PossToPixels( aSpec.iPossHeight ); + + // Round to the nearest integers + return TSize( width + 0.5F, height + 0.5F ); + } + +// ----------------------------------------------------------------------------- +// Compares two specs by focus offset. +// ----------------------------------------------------------------------------- +// +TBool CGlxThumbnailContext::TAssignedFetchSpec::Match( + const TAssignedFetchSpec& aSpec1, const TAssignedFetchSpec& aSpec2 ) + { + TRACER( "CGlxThumbnailContext::TAssignedFetchSpec::Match"); + + return aSpec1.iFocusOffset == aSpec2.iFocusOffset; + } + +// ----------------------------------------------------------------------------- +// HasFullThumbnail +// ----------------------------------------------------------------------------- +// +TBool CGlxThumbnailContext::HasFullThumbnail( const TGlxMedia& aItem ) const + { + TRACER( "CGlxThumbnailContext::HasFullThumbnail"); + + const CGlxMedia* properties = aItem.Properties(); + + if ( properties ) + { + TInt count = properties->Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( GlxThumbnailUtility::IsFullThumbnail( + properties->Attribute( i ) ) ) + { + return ETrue; + } + } + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Check DRM status of specified item +// ----------------------------------------------------------------------------- +// +TBool CGlxThumbnailContext::CheckDRMStatusL( TInt aListIndex, + const MGlxMediaList* aList, TSize& aSize ) const + { + TRACER( "CGlxThumbnailContext::CheckDRMStatusL"); + + const TGlxMedia& item = aList->Item( aListIndex ); + TBool valid = EFalse; + + aSize = SizeFromSpec( SpecForIndex( aListIndex, aList ) ); + + TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown; + item.GetDrmValidity(isValid); + if ( EGlxDrmRightsValidityUnknown == isValid ) + { + // check rights + TMPXGeneralCategory cat = item.Category(); + const TDesC& uri = item.Uri(); + if ( uri.Length() && cat != EMPXNoCategory ) + { + valid = iDrmUtility->CheckOpenRightsL( uri, ( cat == EMPXImage ) ); + CGlxMedia* properties = const_cast(item.Properties()); + if( valid ) + { + + isValid = EGlxDrmRightsValid; + } + else + { + + isValid = EGlxDrmRightsInvalid; + } + properties->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, isValid); + } + } + else if ( EGlxDrmRightsValid == isValid ) + { + valid = ETrue; + } + if ( !valid ) + { + // modify spec to request 'small' thumbnail + TSize size; + // ignore success/failure return - accept default + item.GetDimensions(size); + + TSize thumbnailSize = iDrmUtility->DRMThumbnailSize( size ); + + // only update spec if either dimension of required DRM thumbnail + // is smaller than correspnding spec dimension (so don't request + // a new thumbnail if existing one if of appropriate size ) + if( thumbnailSize.iWidth < aSize.iWidth + || thumbnailSize.iHeight < aSize.iHeight ) + { + aSize = thumbnailSize; + } + } + return valid; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// CGlxDefaultThumbnailContext +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxDefaultThumbnailContext* CGlxDefaultThumbnailContext::NewL() + { + TRACER( "CGlxDefaultThumbnailContext::NewL"); + + CGlxDefaultThumbnailContext* obj = new (ELeave) CGlxDefaultThumbnailContext(); + CleanupStack::PushL(obj); + obj->ConstructL(); + CleanupStack::Pop(obj); + return obj; + } + +// ----------------------------------------------------------------------------- +// Constructor +// Sets the iterator of base class to be TGlxFromFocusOutwardIterator +// ----------------------------------------------------------------------------- +// +CGlxDefaultThumbnailContext::CGlxDefaultThumbnailContext() : + CGlxThumbnailContext(&iFromFocusIterator) + { + TRACER( "CGlxDefaultThumbnailContext::CGlxDefaultThumbnailContext"); + + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxDefaultThumbnailContext::~CGlxDefaultThumbnailContext() + { + TRACER( "CGlxDefaultThumbnailContext::~CGlxDefaultThumbnailContext"); + + } + +// ---------------------------------------------------------------------------- +// Set range offsets +// ---------------------------------------------------------------------------- +// +EXPORT_C void CGlxDefaultThumbnailContext::SetRangeOffsets(TInt aFrontOffset, TInt aRearOffset) + { + TRACER( "CGlxDefaultThumbnailContext::SetRangeOffsets"); + + iFromFocusIterator.SetRangeOffsets(aFrontOffset, aRearOffset); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxthumbnailutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxthumbnailutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2008-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: Common utility for thumbnail attributes +* +*/ + + + + +// my include +#include "glxthumbnailutility.h" + +// system includes +#include + +// user includes +#include "glxmedia.h" +#include "glxthumbnailattributeinfo.h" + +// --------------------------------------------------------------------------- +// ClosestThumbnail +// --------------------------------------------------------------------------- +// +EXPORT_C /*static*/ TInt GlxThumbnailUtility::ClosestThumbnail( + const TSize& aDesiredSize, const CGlxMedia& aMedia, TBool aDrmValid ) + { + TRACER("GlxThumbnailUtility::ClosestThumbnail"); + + TInt selectedIndex = KErrNotFound; + TInt selectedQuality = 0; + TSize selectedSize; // Default constructor sets to zero + TInt count = aMedia.Count(); + + for ( TInt i = 0; i < count; i++ ) + { + const TMPXAttribute& attr( aMedia.Attribute( i ) ); + + // is it a thumbnail + if ( GlxThumbnailUtility::IsFullThumbnail( attr )) + { + const CGlxThumbnailAttribute* thumbnail + = static_cast( + aMedia.ValueCObject( attr ) ); + + if ( thumbnail ) + { + // Check to see if this is to be the preferred attribute + TBool preferThis = ETrue; + TInt quality = thumbnail->iThumbnailQuality; + TSize size( thumbnail->iDimensions ); + + // Compare aspect ratios of required size and + // this size to decide if using heights or widths + if ( size.iHeight * aDesiredSize.iWidth + >= aDesiredSize.iHeight * size.iWidth ) + { + // using heights + preferThis = PreferThisAttribute( size.iHeight, + selectedSize.iHeight, aDesiredSize.iHeight, + quality, selectedQuality, aDrmValid ); + } + else + { + // using widths + preferThis = PreferThisAttribute( size.iWidth, + selectedSize.iWidth, aDesiredSize.iWidth, + quality, selectedQuality, aDrmValid ); + } + + if ( preferThis ) + { + // Set this one as preferred so far + selectedIndex = i; + selectedQuality = quality; + selectedSize = size; + } + } + } + } + + return selectedIndex; + } + + +// ----------------------------------------------------------------------------- +// IsFullThumbnail +// ----------------------------------------------------------------------------- +// +EXPORT_C /*static*/ TBool GlxThumbnailUtility::IsFullThumbnail(const TMPXAttribute& aAttr) + { + TRACER("GlxThumbnailUtility::IsFullThumbnail"); + + return ((KGlxMediaIdThumbnail == aAttr.ContentId()) + && GlxIsFullThumbnailAttribute(aAttr.AttributeId())); + } + + +// ----------------------------------------------------------------------------- +// PreferThisAttribute +// ----------------------------------------------------------------------------- +// +/*static*/ TBool GlxThumbnailUtility::PreferThisAttribute( + TInt aThisDimen, TInt aSelectedDimen, TInt aReqDimen, + TInt aThisQuality, TInt aSelectedQuality, TBool aDrmValid ) + { + TRACER("GlxThumbnailUtility::PreferThisAttribute"); + + TBool preferThis = ETrue; + + if ( aThisDimen == aSelectedDimen ) + { + // Only interested if better quality + preferThis = ( aThisQuality > aSelectedQuality ); + } + else if ( aThisDimen < aReqDimen ) + { + // Only interested if this one is larger than the selected one + preferThis = ( aSelectedDimen < aThisDimen ); + } + else if ( aThisDimen > aReqDimen ) + { + // Only interested if the selected one is smaller than requested + // or this one is smaller than the selected one + preferThis = ( aDrmValid && + ( aSelectedDimen < aReqDimen || aThisDimen < aSelectedDimen ) ); + } + else // aThisDimen == aReqDimen + { + // The right size, so choose it + } + + return preferThis; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/glxustringconverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/glxustringconverter.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,353 @@ +/* +* Copyright (c) 2008-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: UString converter implementation class that converts symbian data +* types to UString types +* +*/ + + + + +#include "glxustringconverter.h" +#include "glxmediageneraldefs.h" + +#include +#include // CAknLocationEditor +#include +#include // CnvUtfConverter +#include // for new(EMM) +#include +#include +#include +#include // for TCoordinate +#include // For Cenrep Keys + +const TInt KBytesInKB = 1024; +const TInt KBytesInMB = 1024 * 1024; +_LIT( KBlankText, " " ); + + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxUStringConverter::CGlxUStringConverter() + { + TRACER("CGlxUStringConverter::CGlxUStringConverter()"); + + } + +// ----------------------------------------------------------------------------- +// Two phase Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxUStringConverter* CGlxUStringConverter::NewL() + { + TRACER("CGlxUStringConverter::NewL"); + CGlxUStringConverter* self = CGlxUStringConverter::NewLC(); + + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Two phase Constructor +// ----------------------------------------------------------------------------- +// +CGlxUStringConverter* CGlxUStringConverter::NewLC() + { + TRACER("CGlxUStringConverter::NewLC"); + CGlxUStringConverter* self = new (ELeave) CGlxUStringConverter(); + CleanupStack::PushL(self ); + return self; + } + +CGlxUStringConverter::~CGlxUStringConverter() + { + + } +// ----------------------------------------------------------------------------- +// Converts the TDesC into UString type +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUStringConverter::AsStringL(const TGlxMedia& aMedia, const TMPXAttribute& aAttribute, TInt aFormatString, HBufC*& aString ) const + { + TRACER("CGlxUStringConverter::AsStringL"); + const CGlxMedia* media = aMedia.Properties(); + if( media ) + { + switch( media->AttributeTypeId(aAttribute) ) + { + case EMPXTypeText: + { + aString = ( media->ValueText(aAttribute) ).Alloc(); + } + break; + + + case EMPXTypeTObject: + { + if( aAttribute == KMPXMediaGeneralDate ) + { + TTime date(0); + if( aFormatString == R_QTN_DATE_USUAL_WITH_ZERO ) + { + HBufC* dateString = HBufC::NewLC(KMaxLongDateFormatSpec); + TPtr dateStringPtr (dateString->Des()); + media->GetValueTObject(date,KMPXMediaGeneralDate); + HBufC* dateFormat = CCoeEnv::Static()->AllocReadResourceLC + ( R_QTN_DATE_USUAL_WITH_ZERO ); + date.FormatL( dateStringPtr , *dateFormat ); + CleanupStack::PopAndDestroy(dateFormat); + AknTextUtils::LanguageSpecificNumberConversion( dateStringPtr ); + + HBufC* timeString = HBufC::NewLC(KMaxTimeFormatSpec); + TPtr timeStringPtr (timeString->Des()); + media->GetValueTObject(date,KMPXMediaGeneralDate); + HBufC* timeFormat = CCoeEnv::Static()->AllocReadResourceLC + ( R_QTN_TIME_USUAL_WITH_ZERO ); + date.FormatL( timeStringPtr , *timeFormat ); + CleanupStack::PopAndDestroy(timeFormat); + AknTextUtils::LanguageSpecificNumberConversion( timeStringPtr ); + + HBufC* dateAndTime = HBufC::NewLC(dateStringPtr.Length()+timeStringPtr.Length()+1); + TPtr dateAndTimePtr (dateAndTime->Des()); + dateAndTimePtr = dateStringPtr; + dateAndTimePtr.Append( KBlankText ); + dateAndTimePtr.Append(timeStringPtr); + aString = dateAndTime->Alloc(); + CleanupStack::PopAndDestroy(dateAndTime); + CleanupStack::PopAndDestroy(timeString); + CleanupStack::PopAndDestroy(dateString); + } + else if( aFormatString == R_QTN_TIME_USUAL_WITH_ZERO) + { + TBuf<20> timeString; + media->GetValueTObject(date,KMPXMediaGeneralDate); + HBufC* timeFormat = CCoeEnv::Static()->AllocReadResourceLC + ( R_QTN_TIME_USUAL_WITH_ZERO ); + + date.FormatL( timeString , *timeFormat ); + CleanupStack::PopAndDestroy(timeFormat); + AknTextUtils::LanguageSpecificNumberConversion( timeString ); + aString = timeString.Alloc(); + } + else if( aFormatString == R_QTN_DATE_USUAL) + { + TBuf<20> dateString; + media->GetValueTObject(date,KMPXMediaGeneralDate); + HBufC* dateFormat = CCoeEnv::Static()->AllocReadResourceLC + ( R_QTN_DATE_USUAL ); + + date.FormatL( dateString , *dateFormat ); + CleanupStack::PopAndDestroy(dateFormat); + AknTextUtils::LanguageSpecificNumberConversion( dateString ); + aString = dateString.Alloc(); + } + + } + else if( aAttribute == KMPXMediaGeneralSize ) + { + GetFormattedItemSizeL(*media, aString); + } + else if( aAttribute == KGlxMediaGeneralLocation ) + { + TCoordinate coordinate; + if(aMedia.GetCoordinate( coordinate )) + { + GetFormatLocationL(coordinate, aString); + } + else + { + HBufC* locationTextBuf = HBufC::NewLC(1); + TPtr ptr(locationTextBuf->Des()); + _LIT(KFormat," "); + ptr.Append(KFormat); + aString = locationTextBuf->Alloc(); + CleanupStack::PopAndDestroy(locationTextBuf); + } + } + else if( aAttribute == KMPXMediaGeneralDuration ) + { + TReal32 duration( 0 ); + aMedia.GetDuration( duration ); + TBuf<20> timeBuf(0); + if(duration) + { + GetFormattedDurationL(duration, aString); + } + } + else if( aAttribute == KGlxMediaGeneralDimensions ) + { + TSize resolution; + if(aMedia.GetDimensions(resolution)) + { + GetFormatResolutionL(resolution, aString); + } + } + else + { + // no implementation + } + } + break; + default: + break; + } + } + } + + +// --------------------------------------------------------------------------- +// Returns the item size in the required format +// --------------------------------------------------------------------------- +// +void CGlxUStringConverter::GetFormattedItemSizeL(const CGlxMedia& aMedia, HBufC*& aString) const + { + TRACER("CGlxUStringConverter::GetFormattedItemSizeL"); + TInt size(0); + if(aMedia.GetValueTObject( size, KMPXMediaGeneralSize )) + { + if(size >= KBytesInMB) + { + TInt mbSize = size / KBytesInMB ; // Size in MB + aString = StringLoader::LoadL(R_QTN_SIZE_MB, mbSize); + } + else if(size >= KBytesInKB) + { + aString = HBufC::NewL(64); + TInt kBsize = size / KBytesInKB; // bytes to kB + HBufC* textSizeKb = CCoeEnv::Static()->AllocReadResourceLC( R_QTN_SIZE_KB ); + TPtr ptr = aString->Des(); + TPtr sizePtr = textSizeKb->Des(); + StringLoader::Format(ptr,sizePtr, -1, kBsize); + CleanupStack::PopAndDestroy(textSizeKb); + } + else + { + HBufC* textSizeB = CCoeEnv::Static()->AllocReadResourceLC( R_QTN_SIZE_B ); + aString = HBufC::NewL(64); + TPtr ptr = aString->Des(); + TPtr sizePtr = textSizeB->Des(); + StringLoader::Format(ptr, sizePtr, -1, size); + CleanupStack::PopAndDestroy(textSizeB); + } + if(aString) + { + TPtr ptr = aString->Des(); + AknTextUtils::LanguageSpecificNumberConversion(ptr); + } + } + } + +// --------------------------------------------------------------------------- +// Returns the item location in the required format +// --------------------------------------------------------------------------- +// +void CGlxUStringConverter::GetFormatLocationL(const TCoordinate& aCoordinate, HBufC*& aString ) const + { + TRACER("CGlxUStringConverter::GetFormatLocationL"); + CGlxSettingsModel* settingsModel = CGlxSettingsModel::InstanceL(); + CleanupClosePushL(*settingsModel); + TBool showGeoCoordinates = settingsModel->ShowGeoCoordinatesInDisplay(); + CleanupStack::PopAndDestroy(settingsModel); + + if (showGeoCoordinates) + { + //Show geocoordinates + TPosition origin; + origin.SetCoordinate(aCoordinate.Latitude(),aCoordinate.Longitude()); + HBufC* latBuf = CAknLocationEditor::DisplayableLocationL( origin, CAknLocationEditor::ELatitudeOnly ); + HBufC* longBuf = CAknLocationEditor::DisplayableLocationL( origin, CAknLocationEditor::ELongitudeOnly ); + HBufC* combinedLocationTextBuf = HBufC::NewLC( latBuf->Length() + longBuf->Length() + 2 ); + TPtr ptr(combinedLocationTextBuf->Des()); + _LIT(KFormat,", "); + ptr.Append(*latBuf); + ptr.Append(KFormat); + ptr.Append(*longBuf); + aString = combinedLocationTextBuf->Alloc(); + CleanupStack::PopAndDestroy(combinedLocationTextBuf); + if( latBuf ) + { + delete latBuf; + latBuf = NULL; + } + if( longBuf ) + { + delete longBuf; + longBuf = NULL; + } + } + else + { + //Hide geocoordinates + TBuf noLocationTextBuf; + noLocationTextBuf.AppendNum(0); + noLocationTextBuf.AppendNum(0); + aString = noLocationTextBuf.Alloc(); + } + } + +// --------------------------------------------------------------------------- +// Returns the item duration in the required format +// --------------------------------------------------------------------------- +// + void CGlxUStringConverter::GetFormattedDurationL(const TReal& aDuration , HBufC*& aString ) const + { + TRACER("CGlxUStringConverter::GetFormattedDurationL"); + TInt resourceId = R_QTN_TIME_DURAT_LONG; + if( aDuration <= 3600 ) //60 seconds *60 minutes + { + // minute:seconds format + resourceId = R_QTN_TIME_DURAT_MIN_SEC; + } + + // This class does not have access to a CEikonEnv and hence + // pls ignore the code scanner warning - Using CEikonEnv::Static + HBufC* timeFormat = CEikonEnv::Static()->AllocReadResourceLC( resourceId ); + + TTime time( 0 ); + TBuf<20> timeBuf; + time += TTimeIntervalSeconds ( aDuration ); + time.FormatL( timeBuf , *timeFormat ); + //to convert between arabic-indic digits and european digits. + //based on existing language setting. + AknTextUtils::LanguageSpecificNumberConversion(timeBuf); + CleanupStack::PopAndDestroy(timeFormat); + aString = timeBuf.Alloc(); + } + +// --------------------------------------------------------------------------- +// Returns the item resolution in the required format +// --------------------------------------------------------------------------- +// +void CGlxUStringConverter::GetFormatResolutionL(const TSize& aSize, HBufC*& aString ) const + { + TRACER("CGlxUStringConverter::GetFormatResolutionL"); + CArrayFix* array = new (ELeave) CArrayFixFlat(2); + CleanupStack::PushL(array); + array->AppendL(aSize.iWidth); + array->AppendL(aSize.iHeight); + + //@todo: to be included when the metadata dialog's resource file is ready. + HBufC* formatString = + StringLoader::LoadL(R_GLX_METADATA_VIEW_RESOLUTION_DETAIL_NSERIES,*array,CCoeEnv::Static()); + CleanupStack::PopAndDestroy(array); + aString = formatString->Alloc(); + if( formatString ) + { + delete formatString; + formatString = NULL; + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/mglxcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/mglxcache.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2008-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: Interface to media item cache +* +*/ + + + + +#include "mglxcache.h" +#include "glxcachemanager.h" +#include + +// ----------------------------------------------------------------------------- +// InstanceL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxCache* MGlxCache::InstanceL() + { + TRACER("MGlxCache::InstanceL"); + + return CGlxCacheManager::InstanceL(); + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/src/mglxmedialist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/src/mglxmedialist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2008-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: Reader interface of media item lists +* +*/ + + + + +#include "mglxmedialist.h" +#include "glxmedialist.h" +#include + +// ----------------------------------------------------------------------------- +// Returns a new/existing media list interface +// ----------------------------------------------------------------------------- +EXPORT_C MGlxMediaList* MGlxMediaList::InstanceL(const CMPXCollectionPath& aPath, + const TGlxHierarchyId& aHierarchyId, CMPXFilter* aFilter) + { + TRACER("MGlxMediaList::InstanceL"); + + return CGlxMediaList::InstanceL(aPath, aHierarchyId, aFilter); + } +// ----------------------------------------------------------------------------- +// Unmark all medialist items. +// ----------------------------------------------------------------------------- +EXPORT_C void MGlxMediaList::UnmarkAllL( MGlxMediaList& aList ) + { + TRACER("MGlxMediaList::UnmarkAllL"); + + TInt count = aList.Count(); + + for ( TInt i = 0; i <= count ; i++ ) + { + aList.SetSelectedL( i, EFalse ); + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxcacheu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxcacheu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 2 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??1CGlxMedia@@UAE@XZ @ 3 NONAME ; CGlxMedia::~CGlxMedia(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 4 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 5 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 6 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 7 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 8 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 9 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 10 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 11 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 12 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 13 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 14 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 15 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 16 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 17 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 18 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 19 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 20 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 21 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 22 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 23 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 24 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@ABVTMPXAttribute@@@Z @ 25 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, class TMPXAttribute const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@H@Z @ 26 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, int) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 27 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 28 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 29 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 30 NONAME ; int TGlxMedia::IsStatic(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 31 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 32 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?Reset@CGlxMedia@@QAEXXZ @ 33 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 34 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 35 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 36 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 37 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 38 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 39 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 40 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 41 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 42 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 43 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 44 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxNavigableList@@QBEXXZ @ 45 NONAME ; void CGlxNavigableList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 46 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxfetcherrorarrayu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxfetcherrorarrayu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxgarbagecollectoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxgarbagecollectoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CIdle@@IAE@H@Z @ 2 NONAME ; CIdle::CIdle(int) + ??1CGlxMedia@@UAE@XZ @ 3 NONAME ; CGlxMedia::~CGlxMedia(void) + ??1CIdle@@UAE@XZ @ 4 NONAME ; CIdle::~CIdle(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 5 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 6 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 7 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 8 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 9 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?DoCancel@CIdle@@MAEXXZ @ 10 NONAME ; void CIdle::DoCancel(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 11 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 12 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 13 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 14 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 15 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 16 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 17 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 18 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 19 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 20 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 21 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 22 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 23 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 24 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 25 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 26 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 27 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@ABVTMPXAttribute@@@Z @ 28 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, class TMPXAttribute const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@H@Z @ 29 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, int) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 30 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 31 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 32 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 33 NONAME ; int TGlxMedia::IsStatic(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 34 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 35 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?New@CIdle@@SAPAV1@H@Z @ 36 NONAME ; class CIdle * CIdle::New(int) + ?NewL@CIdle@@SAPAV1@H@Z @ 37 NONAME ; class CIdle * CIdle::NewL(int) + ?Reset@CGlxMedia@@QAEXXZ @ 38 NONAME ; void CGlxMedia::Reset(void) + ?RunL@CIdle@@MAEXXZ @ 39 NONAME ; void CIdle::RunL(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 40 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 41 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 42 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?Start@CIdle@@QAEXVTCallBack@@@Z @ 43 NONAME ; void CIdle::Start(class TCallBack) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 44 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 45 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 46 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 47 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 48 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 49 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 50 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 51 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxNavigableList@@QBEXXZ @ 52 NONAME ; void CGlxNavigableList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 53 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxmediau.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/t_cglxmediau.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 2 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??1CGlxMedia@@UAE@XZ @ 3 NONAME ; CGlxMedia::~CGlxMedia(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 4 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 5 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 6 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 7 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 8 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 9 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 10 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 11 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 12 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 13 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 14 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 15 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 16 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 17 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 18 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 19 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 20 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 21 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 22 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 23 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 24 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 25 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 26 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 27 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 28 NONAME ; int TGlxMedia::IsStatic(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 29 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 30 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?Reset@CGlxMedia@@QAEXXZ @ 31 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 32 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 33 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 34 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 35 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 36 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 37 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 38 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 39 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 40 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 41 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/t_glxfromfocusoutwarditeratoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/t_glxfromfocusoutwarditeratoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/t_glxlistwindowu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/t_glxlistwindowu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,21 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxListWindow@@QAE@AAVMGlxWindowObjectFactory@@@Z @ 2 NONAME ; CGlxListWindow::CGlxListWindow(class MGlxWindowObjectFactory &) + ??0TGlxWindowIterator@@QAE@ABV0@@Z @ 3 NONAME ; TGlxWindowIterator::TGlxWindowIterator(class TGlxWindowIterator const &) + ??1CGlxListWindow@@UAE@XZ @ 4 NONAME ; CGlxListWindow::~CGlxListWindow(void) + ??ETGlxWindowIterator@@QAEHH@Z @ 5 NONAME ; int TGlxWindowIterator::operator++(int) + ?AddObjects@CGlxListWindow@@QAEXHH@Z @ 6 NONAME ; void CGlxListWindow::AddObjects(int, int) + ?AddObjects@CGlxListWindow@@QAEXHHHH@Z @ 7 NONAME ; void CGlxListWindow::AddObjects(int, int, int, int) + ?At@CGlxListWindow@@QAEPAVCBase@@H@Z @ 8 NONAME ; class CBase * CGlxListWindow::At(int) + ?At@CGlxListWindow@@QBEPBVCBase@@H@Z @ 9 NONAME ; class CBase const * CGlxListWindow::At(int) const + ?Cleanup@CGlxListWindow@@QAEXXZ @ 10 NONAME ; void CGlxListWindow::Cleanup(void) + ?ConstructL@CGlxListWindow@@QAEXXZ @ 11 NONAME ; void CGlxListWindow::ConstructL(void) + ?Iterator@CGlxListWindow@@QBE?AVTGlxWindowIterator@@XZ @ 12 NONAME ; class TGlxWindowIterator CGlxListWindow::Iterator(void) const + ?RemoveObjects@CGlxListWindow@@QAEXHH@Z @ 13 NONAME ; void CGlxListWindow::RemoveObjects(int, int) + ?RemoveObjects@CGlxListWindow@@QAEXHHHH@Z @ 14 NONAME ; void CGlxListWindow::RemoveObjects(int, int, int, int) + ?SetFocusIndex@CGlxListWindow@@QAEXH@Z @ 15 NONAME ; void CGlxListWindow::SetFocusIndex(int) + ?SetFocusIndex@CGlxListWindow@@QAEXHH@Z @ 16 NONAME ; void CGlxListWindow::SetFocusIndex(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHH@Z @ 17 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHHHH@Z @ 18 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int, int, int) + ?__DbgTestInvariant@CGlxListWindow@@QBEXXZ @ 19 NONAME ; void CGlxListWindow::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/t_tglxexclusioniteratoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/t_tglxexclusioniteratoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,50 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxListWindow@@QAE@AAVMGlxWindowObjectFactory@@@Z @ 2 NONAME ; CGlxListWindow::CGlxListWindow(class MGlxWindowObjectFactory &) + ??0TGlxExclusionIterator@@QAE@AAVMGlxMediaListIterator@@0@Z @ 3 NONAME ; TGlxExclusionIterator::TGlxExclusionIterator(class MGlxMediaListIterator &, class MGlxMediaListIterator &) + ??0TGlxFirstThenLastIterator@@QAE@XZ @ 4 NONAME ; TGlxFirstThenLastIterator::TGlxFirstThenLastIterator(void) + ??0TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 5 NONAME ; TGlxFromFocusOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator(void) + ??0TGlxFromFocusOutwardIterator@@QAE@XZ @ 6 NONAME ; TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator(void) + ??0TGlxFromIndexOutwardBlockyIterator@@QAE@ABVMGlxIndex@0@@Z @ 7 NONAME ; TGlxFromIndexOutwardBlockyIterator::TGlxFromIndexOutwardBlockyIterator(class TGlxFromIndexOutwardBlockyIterator::MGlxIndex const &) + ??0TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 8 NONAME ; TGlxFromManualIndexBlockyIterator::TGlxFromManualIndexBlockyIterator(void) + ??0TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 9 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::TGlxFromManualIndexOutwardBlockyIterator(void) + ??0TGlxSelectionIterator@@QAE@XZ @ 10 NONAME ; TGlxSelectionIterator::TGlxSelectionIterator(void) + ??0TGlxSequentialIterator@@QAE@XZ @ 11 NONAME ; TGlxSequentialIterator::TGlxSequentialIterator(void) + ??0TGlxSpecificIdIterator@@QAE@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@VTGlxMediaId@@@Z @ 12 NONAME ; TGlxSpecificIdIterator::TGlxSpecificIdIterator(class TGlxId const &, class TGlxMediaId) + ??0TGlxWindowIterator@@QAE@ABV0@@Z @ 13 NONAME ; TGlxWindowIterator::TGlxWindowIterator(class TGlxWindowIterator const &) + ??1CGlxListWindow@@UAE@XZ @ 14 NONAME ; CGlxListWindow::~CGlxListWindow(void) + ??1TGlxExclusionIterator@@QAE@XZ @ 15 NONAME ; TGlxExclusionIterator::~TGlxExclusionIterator(void) + ??1TGlxFirstThenLastIterator@@QAE@XZ @ 16 NONAME ; TGlxFirstThenLastIterator::~TGlxFirstThenLastIterator(void) + ??1TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 17 NONAME ; TGlxFromFocusOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator(void) + ??1TGlxFromFocusOutwardIterator@@QAE@XZ @ 18 NONAME ; TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator(void) + ??1TGlxFromIndexOutwardBlockyIterator@@QAE@XZ @ 19 NONAME ; TGlxFromIndexOutwardBlockyIterator::~TGlxFromIndexOutwardBlockyIterator(void) + ??1TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 20 NONAME ; TGlxFromManualIndexBlockyIterator::~TGlxFromManualIndexBlockyIterator(void) + ??1TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 21 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::~TGlxFromManualIndexOutwardBlockyIterator(void) + ??1TGlxSelectionIterator@@QAE@XZ @ 22 NONAME ; TGlxSelectionIterator::~TGlxSelectionIterator(void) + ??ETGlxSelectionIterator@@UAEHH@Z @ 23 NONAME ; int TGlxSelectionIterator::operator++(int) + ??ETGlxWindowIterator@@QAEHH@Z @ 24 NONAME ; int TGlxWindowIterator::operator++(int) + ?AddObjects@CGlxListWindow@@QAEXHH@Z @ 25 NONAME ; void CGlxListWindow::AddObjects(int, int) + ?AddObjects@CGlxListWindow@@QAEXHHHH@Z @ 26 NONAME ; void CGlxListWindow::AddObjects(int, int, int, int) + ?At@CGlxListWindow@@QAEPAVCBase@@H@Z @ 27 NONAME ; class CBase * CGlxListWindow::At(int) + ?At@CGlxListWindow@@QBEPBVCBase@@H@Z @ 28 NONAME ; class CBase const * CGlxListWindow::At(int) const + ?Cleanup@CGlxListWindow@@QAEXXZ @ 29 NONAME ; void CGlxListWindow::Cleanup(void) + ?ConstructL@CGlxListWindow@@QAEXXZ @ 30 NONAME ; void CGlxListWindow::ConstructL(void) + ?InRange@TGlxSelectionIterator@@UBEHH@Z @ 31 NONAME ; int TGlxSelectionIterator::InRange(int) const + ?Iterator@CGlxListWindow@@QBE?AVTGlxWindowIterator@@XZ @ 32 NONAME ; class TGlxWindowIterator CGlxListWindow::Iterator(void) const + ?RemoveObjects@CGlxListWindow@@QAEXHH@Z @ 33 NONAME ; void CGlxListWindow::RemoveObjects(int, int) + ?RemoveObjects@CGlxListWindow@@QAEXHHHH@Z @ 34 NONAME ; void CGlxListWindow::RemoveObjects(int, int, int, int) + ?SetDisabledIfMoreThanRangeSelected@TGlxSelectionIterator@@QAEXH@Z @ 35 NONAME ; void TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected(int) + ?SetFocusIndex@CGlxListWindow@@QAEXH@Z @ 36 NONAME ; void CGlxListWindow::SetFocusIndex(int) + ?SetFocusIndex@CGlxListWindow@@QAEXHH@Z @ 37 NONAME ; void CGlxListWindow::SetFocusIndex(int, int) + ?SetIndex@TGlxFromManualIndexOutwardBlockyIterator@@QAEXH@Z @ 38 NONAME ; void TGlxFromManualIndexOutwardBlockyIterator::SetIndex(int) + ?SetRange@TGlxSelectionIterator@@QAEXH@Z @ 39 NONAME ; void TGlxSelectionIterator::SetRange(int) + ?SetRange@TGlxSequentialIterator@@QAEXH@Z @ 40 NONAME ; void TGlxSequentialIterator::SetRange(int) + ?SetRangeOffsets@TGlxFromFocusOutwardIterator@@QAEXHH@Z @ 41 NONAME ; void TGlxFromFocusOutwardIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromIndexOutwardBlockyIterator@@QAEXHH@Z @ 42 NONAME ; void TGlxFromIndexOutwardBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromManualIndexBlockyIterator@@QAEXHH@Z @ 43 NONAME ; void TGlxFromManualIndexBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHH@Z @ 44 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHHHH@Z @ 45 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int, int, int) + ?SetToFirst@TGlxExclusionIterator@@UAEXPBVMGlxMediaList@@@Z @ 46 NONAME ; void TGlxExclusionIterator::SetToFirst(class MGlxMediaList const *) + ?SetToFirst@TGlxSelectionIterator@@UAEXPBVMGlxMediaList@@@Z @ 47 NONAME ; void TGlxSelectionIterator::SetToFirst(class MGlxMediaList const *) + ?__DbgTestInvariant@CGlxListWindow@@QBEXXZ @ 48 NONAME ; void CGlxListWindow::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxattributecontextu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxattributecontextu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxAttributeContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 2 NONAME ; CGlxAttributeContext::CGlxAttributeContext(class MGlxMediaListIterator *) + ??0CGlxListWindow@@QAE@AAVMGlxWindowObjectFactory@@@Z @ 3 NONAME ; CGlxListWindow::CGlxListWindow(class MGlxWindowObjectFactory &) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 4 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??0CGlxThumbnailContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 5 NONAME ; CGlxThumbnailContext::CGlxThumbnailContext(class MGlxMediaListIterator *) + ??0TGlxExclusionIterator@@QAE@AAVMGlxMediaListIterator@@0@Z @ 6 NONAME ; TGlxExclusionIterator::TGlxExclusionIterator(class MGlxMediaListIterator &, class MGlxMediaListIterator &) + ??0TGlxFetchContextRemover@@QAE@PAVMGlxFetchContext@@AAVMGlxMediaList@@@Z @ 7 NONAME ; TGlxFetchContextRemover::TGlxFetchContextRemover(class MGlxFetchContext *, class MGlxMediaList &) + ??0TGlxFirstThenLastIterator@@QAE@XZ @ 8 NONAME ; TGlxFirstThenLastIterator::TGlxFirstThenLastIterator(void) + ??0TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 9 NONAME ; TGlxFromFocusOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator(void) + ??0TGlxFromFocusOutwardIterator@@QAE@XZ @ 10 NONAME ; TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator(void) + ??0TGlxFromIndexOutwardBlockyIterator@@QAE@ABVMGlxIndex@0@@Z @ 11 NONAME ; TGlxFromIndexOutwardBlockyIterator::TGlxFromIndexOutwardBlockyIterator(class TGlxFromIndexOutwardBlockyIterator::MGlxIndex const &) + ??0TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 12 NONAME ; TGlxFromManualIndexBlockyIterator::TGlxFromManualIndexBlockyIterator(void) + ??0TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 13 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::TGlxFromManualIndexOutwardBlockyIterator(void) + ??0TGlxSelectionIterator@@QAE@XZ @ 14 NONAME ; TGlxSelectionIterator::TGlxSelectionIterator(void) + ??0TGlxSequentialIterator@@QAE@XZ @ 15 NONAME ; TGlxSequentialIterator::TGlxSequentialIterator(void) + ??0TGlxSpecificIdIterator@@QAE@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@VTGlxMediaId@@@Z @ 16 NONAME ; TGlxSpecificIdIterator::TGlxSpecificIdIterator(class TGlxId const &, class TGlxMediaId) + ??0TGlxWindowIterator@@QAE@ABV0@@Z @ 17 NONAME ; TGlxWindowIterator::TGlxWindowIterator(class TGlxWindowIterator const &) + ??1CGlxAttributeContext@@UAE@XZ @ 18 NONAME ; CGlxAttributeContext::~CGlxAttributeContext(void) + ??1CGlxDefaultAttributeContext@@UAE@XZ @ 19 NONAME ; CGlxDefaultAttributeContext::~CGlxDefaultAttributeContext(void) + ??1CGlxDefaultThumbnailContext@@UAE@XZ @ 20 NONAME ; CGlxDefaultThumbnailContext::~CGlxDefaultThumbnailContext(void) + ??1CGlxListWindow@@UAE@XZ @ 21 NONAME ; CGlxListWindow::~CGlxListWindow(void) + ??1CGlxMedia@@UAE@XZ @ 22 NONAME ; CGlxMedia::~CGlxMedia(void) + ??1CGlxThumbnailContext@@UAE@XZ @ 23 NONAME ; CGlxThumbnailContext::~CGlxThumbnailContext(void) + ??1TGlxExclusionIterator@@QAE@XZ @ 24 NONAME ; TGlxExclusionIterator::~TGlxExclusionIterator(void) + ??1TGlxFetchContextRemover@@QAE@XZ @ 25 NONAME ; TGlxFetchContextRemover::~TGlxFetchContextRemover(void) + ??1TGlxFirstThenLastIterator@@QAE@XZ @ 26 NONAME ; TGlxFirstThenLastIterator::~TGlxFirstThenLastIterator(void) + ??1TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 27 NONAME ; TGlxFromFocusOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator(void) + ??1TGlxFromFocusOutwardIterator@@QAE@XZ @ 28 NONAME ; TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator(void) + ??1TGlxFromIndexOutwardBlockyIterator@@QAE@XZ @ 29 NONAME ; TGlxFromIndexOutwardBlockyIterator::~TGlxFromIndexOutwardBlockyIterator(void) + ??1TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 30 NONAME ; TGlxFromManualIndexBlockyIterator::~TGlxFromManualIndexBlockyIterator(void) + ??1TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 31 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::~TGlxFromManualIndexOutwardBlockyIterator(void) + ??1TGlxSelectionIterator@@QAE@XZ @ 32 NONAME ; TGlxSelectionIterator::~TGlxSelectionIterator(void) + ??ETGlxSelectionIterator@@UAEHH@Z @ 33 NONAME ; int TGlxSelectionIterator::operator++(int) + ??ETGlxWindowIterator@@QAEHH@Z @ 34 NONAME ; int TGlxWindowIterator::operator++(int) + ?AddAttributeL@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 35 NONAME ; void CGlxAttributeContext::AddAttributeL(class TMPXAttribute const &) + ?AddObjects@CGlxListWindow@@QAEXHH@Z @ 36 NONAME ; void CGlxListWindow::AddObjects(int, int) + ?AddObjects@CGlxListWindow@@QAEXHHHH@Z @ 37 NONAME ; void CGlxListWindow::AddObjects(int, int, int, int) + ?AddSpecForItemL@CGlxThumbnailContext@@QAEXHHH@Z @ 38 NONAME ; void CGlxThumbnailContext::AddSpecForItemL(int, int, int) + ?At@CGlxListWindow@@QAEPAVCBase@@H@Z @ 39 NONAME ; class CBase * CGlxListWindow::At(int) + ?At@CGlxListWindow@@QBEPBVCBase@@H@Z @ 40 NONAME ; class CBase const * CGlxListWindow::At(int) const + ?AttributeCount@CGlxAttributeContext@@QAEHXZ @ 41 NONAME ; int CGlxAttributeContext::AttributeCount(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 42 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?CheckOpenRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 43 NONAME ; int CGlxDRMUtility::CheckOpenRightsL(class TDesC16 const &, int) + ?Cleanup@CGlxListWindow@@QAEXXZ @ 44 NONAME ; void CGlxListWindow::Cleanup(void) + ?Close@CGlxDRMUtility@@QAEXXZ @ 45 NONAME ; void CGlxDRMUtility::Close(void) + ?Close@TGlxFetchContextRemover@@QAEXXZ @ 46 NONAME ; void TGlxFetchContextRemover::Close(void) + ?ClosestThumbnail@GlxThumbnailUtility@@SAHABVTSize@@ABVCGlxMedia@@H@Z @ 47 NONAME ; int GlxThumbnailUtility::ClosestThumbnail(class TSize const &, class CGlxMedia const &, int) + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 48 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?ConstructL@CGlxListWindow@@QAEXXZ @ 49 NONAME ; void CGlxListWindow::ConstructL(void) + ?DRMThumbnailSize@CGlxDRMUtility@@QAE?AVTSize@@AAV2@@Z @ 50 NONAME ; class TSize CGlxDRMUtility::DRMThumbnailSize(class TSize &) + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 51 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 52 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 53 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 54 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 55 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 56 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 57 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 58 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 59 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 60 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 61 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 62 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 63 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 64 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 65 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 66 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 67 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 68 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 69 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@ABVTMPXAttribute@@@Z @ 70 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, class TMPXAttribute const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@H@Z @ 71 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, int) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 72 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?InRange@TGlxSelectionIterator@@UBEHH@Z @ 73 NONAME ; int TGlxSelectionIterator::InRange(int) const + ?InstanceL@CGlxDRMUtility@@SAPAV1@XZ @ 74 NONAME ; class CGlxDRMUtility * CGlxDRMUtility::InstanceL(void) + ?InstanceL@MGlxCache@@SAPAV1@XZ @ 75 NONAME ; class MGlxCache * MGlxCache::InstanceL(void) + ?InstanceL@MGlxMediaList@@SAPAV1@ABVCMPXCollectionPath@@ABV?$TGlxId@VTGlxIdHierarchyBase@@@@PAVCMPXMedia@@@Z @ 76 NONAME ; class MGlxMediaList * MGlxMediaList::InstanceL(class CMPXCollectionPath const &, class TGlxId const &, class CMPXMedia *) + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 77 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsFullThumbnail@GlxThumbnailUtility@@SAHABVTMPXAttribute@@@Z @ 78 NONAME ; int GlxThumbnailUtility::IsFullThumbnail(class TMPXAttribute const &) + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 79 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 80 NONAME ; int TGlxMedia::IsStatic(void) const + ?Iterator@CGlxListWindow@@QBE?AVTGlxWindowIterator@@XZ @ 81 NONAME ; class TGlxWindowIterator CGlxListWindow::Iterator(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 82 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 83 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?NewL@CGlxDefaultAttributeContext@@SAPAV1@XZ @ 84 NONAME ; class CGlxDefaultAttributeContext * CGlxDefaultAttributeContext::NewL(void) + ?NewL@CGlxDefaultThumbnailContext@@SAPAV1@XZ @ 85 NONAME ; class CGlxDefaultThumbnailContext * CGlxDefaultThumbnailContext::NewL(void) + ?NewL@CGlxThumbnailContext@@SAPAV1@PAVMGlxMediaListIterator@@@Z @ 86 NONAME ; class CGlxThumbnailContext * CGlxThumbnailContext::NewL(class MGlxMediaListIterator *) + ?RemoveAttribute@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 87 NONAME ; void CGlxAttributeContext::RemoveAttribute(class TMPXAttribute const &) + ?RemoveObjects@CGlxListWindow@@QAEXHH@Z @ 88 NONAME ; void CGlxListWindow::RemoveObjects(int, int) + ?RemoveObjects@CGlxListWindow@@QAEXHHHH@Z @ 89 NONAME ; void CGlxListWindow::RemoveObjects(int, int, int, int) + ?Reset@CGlxMedia@@QAEXXZ @ 90 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 91 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetDefaultSpec@CGlxThumbnailContext@@QAEXHH@Z @ 92 NONAME ; void CGlxThumbnailContext::SetDefaultSpec(int, int) + ?SetDisabledIfMoreThanRangeSelected@TGlxSelectionIterator@@QAEXH@Z @ 93 NONAME ; void TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected(int) + ?SetFocusIndex@CGlxListWindow@@QAEXH@Z @ 94 NONAME ; void CGlxListWindow::SetFocusIndex(int) + ?SetFocusIndex@CGlxListWindow@@QAEXHH@Z @ 95 NONAME ; void CGlxListWindow::SetFocusIndex(int, int) + ?SetGranularity@CGlxAttributeContext@@QAEXI@Z @ 96 NONAME ; void CGlxAttributeContext::SetGranularity(unsigned int) + ?SetHighQualityOnly@CGlxThumbnailContext@@QAEXH@Z @ 97 NONAME ; void CGlxThumbnailContext::SetHighQualityOnly(int) + ?SetIndex@TGlxFromManualIndexOutwardBlockyIterator@@QAEXH@Z @ 98 NONAME ; void TGlxFromManualIndexOutwardBlockyIterator::SetIndex(int) + ?SetRange@TGlxSelectionIterator@@QAEXH@Z @ 99 NONAME ; void TGlxSelectionIterator::SetRange(int) + ?SetRange@TGlxSequentialIterator@@QAEXH@Z @ 100 NONAME ; void TGlxSequentialIterator::SetRange(int) + ?SetRangeOffsets@CGlxDefaultAttributeContext@@QAEXHH@Z @ 101 NONAME ; void CGlxDefaultAttributeContext::SetRangeOffsets(int, int) + ?SetRangeOffsets@CGlxDefaultThumbnailContext@@QAEXHH@Z @ 102 NONAME ; void CGlxDefaultThumbnailContext::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromFocusOutwardIterator@@QAEXHH@Z @ 103 NONAME ; void TGlxFromFocusOutwardIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromIndexOutwardBlockyIterator@@QAEXHH@Z @ 104 NONAME ; void TGlxFromIndexOutwardBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromManualIndexBlockyIterator@@QAEXHH@Z @ 105 NONAME ; void TGlxFromManualIndexBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHH@Z @ 106 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHHHH@Z @ 107 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int, int, int) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 108 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetToFirst@TGlxExclusionIterator@@UAEXPBVMGlxMediaList@@@Z @ 109 NONAME ; void TGlxExclusionIterator::SetToFirst(class MGlxMediaList const *) + ?SetToFirst@TGlxSelectionIterator@@UAEXPBVMGlxMediaList@@@Z @ 110 NONAME ; void TGlxSelectionIterator::SetToFirst(class MGlxMediaList const *) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 111 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 112 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 113 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 114 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?UnmarkAllL@MGlxMediaList@@SAXAAV1@@Z @ 115 NONAME ; void MGlxMediaList::UnmarkAllL(class MGlxMediaList &) + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 116 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 117 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 118 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 119 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxListWindow@@QBEXXZ @ 120 NONAME ; void CGlxListWindow::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 121 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxNavigableList@@QBEXXZ @ 122 NONAME ; void CGlxNavigableList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 123 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxitemlistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxitemlistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 2 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??1CGlxMedia@@UAE@XZ @ 3 NONAME ; CGlxMedia::~CGlxMedia(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 4 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?ClosestThumbnail@GlxThumbnailUtility@@SAHABVTSize@@ABVCGlxMedia@@H@Z @ 5 NONAME ; int GlxThumbnailUtility::ClosestThumbnail(class TSize const &, class CGlxMedia const &, int) + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 6 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 7 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 8 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 9 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 10 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 11 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 12 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 13 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 14 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 15 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 16 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 17 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 18 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 19 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 20 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 21 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 22 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 23 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 24 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 25 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 26 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 27 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsFullThumbnail@GlxThumbnailUtility@@SAHABVTMPXAttribute@@@Z @ 28 NONAME ; int GlxThumbnailUtility::IsFullThumbnail(class TMPXAttribute const &) + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 29 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 30 NONAME ; int TGlxMedia::IsStatic(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 31 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 32 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?Reset@CGlxMedia@@QAEXXZ @ 33 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 34 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 35 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 36 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 37 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 38 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 39 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 40 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 41 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 42 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 43 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 44 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxmedialistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxmedialistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxAttributeContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 2 NONAME ; CGlxAttributeContext::CGlxAttributeContext(class MGlxMediaListIterator *) + ??0CGlxListWindow@@QAE@AAVMGlxWindowObjectFactory@@@Z @ 3 NONAME ; CGlxListWindow::CGlxListWindow(class MGlxWindowObjectFactory &) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 4 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??0CGlxThumbnailContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 5 NONAME ; CGlxThumbnailContext::CGlxThumbnailContext(class MGlxMediaListIterator *) + ??0TGlxExclusionIterator@@QAE@AAVMGlxMediaListIterator@@0@Z @ 6 NONAME ; TGlxExclusionIterator::TGlxExclusionIterator(class MGlxMediaListIterator &, class MGlxMediaListIterator &) + ??0TGlxFetchContextRemover@@QAE@PAVMGlxFetchContext@@AAVMGlxMediaList@@@Z @ 7 NONAME ; TGlxFetchContextRemover::TGlxFetchContextRemover(class MGlxFetchContext *, class MGlxMediaList &) + ??0TGlxFirstThenLastIterator@@QAE@XZ @ 8 NONAME ; TGlxFirstThenLastIterator::TGlxFirstThenLastIterator(void) + ??0TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 9 NONAME ; TGlxFromFocusOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator(void) + ??0TGlxFromFocusOutwardIterator@@QAE@XZ @ 10 NONAME ; TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator(void) + ??0TGlxFromIndexOutwardBlockyIterator@@QAE@ABVMGlxIndex@0@@Z @ 11 NONAME ; TGlxFromIndexOutwardBlockyIterator::TGlxFromIndexOutwardBlockyIterator(class TGlxFromIndexOutwardBlockyIterator::MGlxIndex const &) + ??0TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 12 NONAME ; TGlxFromManualIndexBlockyIterator::TGlxFromManualIndexBlockyIterator(void) + ??0TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 13 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::TGlxFromManualIndexOutwardBlockyIterator(void) + ??0TGlxSelectionIterator@@QAE@XZ @ 14 NONAME ; TGlxSelectionIterator::TGlxSelectionIterator(void) + ??0TGlxSequentialIterator@@QAE@XZ @ 15 NONAME ; TGlxSequentialIterator::TGlxSequentialIterator(void) + ??0TGlxSpecificIdIterator@@QAE@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@VTGlxMediaId@@@Z @ 16 NONAME ; TGlxSpecificIdIterator::TGlxSpecificIdIterator(class TGlxId const &, class TGlxMediaId) + ??0TGlxWindowIterator@@QAE@ABV0@@Z @ 17 NONAME ; TGlxWindowIterator::TGlxWindowIterator(class TGlxWindowIterator const &) + ??1CGlxAttributeContext@@UAE@XZ @ 18 NONAME ; CGlxAttributeContext::~CGlxAttributeContext(void) + ??1CGlxDefaultAttributeContext@@UAE@XZ @ 19 NONAME ; CGlxDefaultAttributeContext::~CGlxDefaultAttributeContext(void) + ??1CGlxDefaultThumbnailContext@@UAE@XZ @ 20 NONAME ; CGlxDefaultThumbnailContext::~CGlxDefaultThumbnailContext(void) + ??1CGlxListWindow@@UAE@XZ @ 21 NONAME ; CGlxListWindow::~CGlxListWindow(void) + ??1CGlxMedia@@UAE@XZ @ 22 NONAME ; CGlxMedia::~CGlxMedia(void) + ??1CGlxThumbnailContext@@UAE@XZ @ 23 NONAME ; CGlxThumbnailContext::~CGlxThumbnailContext(void) + ??1TGlxExclusionIterator@@QAE@XZ @ 24 NONAME ; TGlxExclusionIterator::~TGlxExclusionIterator(void) + ??1TGlxFetchContextRemover@@QAE@XZ @ 25 NONAME ; TGlxFetchContextRemover::~TGlxFetchContextRemover(void) + ??1TGlxFirstThenLastIterator@@QAE@XZ @ 26 NONAME ; TGlxFirstThenLastIterator::~TGlxFirstThenLastIterator(void) + ??1TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 27 NONAME ; TGlxFromFocusOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator(void) + ??1TGlxFromFocusOutwardIterator@@QAE@XZ @ 28 NONAME ; TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator(void) + ??1TGlxFromIndexOutwardBlockyIterator@@QAE@XZ @ 29 NONAME ; TGlxFromIndexOutwardBlockyIterator::~TGlxFromIndexOutwardBlockyIterator(void) + ??1TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 30 NONAME ; TGlxFromManualIndexBlockyIterator::~TGlxFromManualIndexBlockyIterator(void) + ??1TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 31 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::~TGlxFromManualIndexOutwardBlockyIterator(void) + ??1TGlxSelectionIterator@@QAE@XZ @ 32 NONAME ; TGlxSelectionIterator::~TGlxSelectionIterator(void) + ??ETGlxSelectionIterator@@UAEHH@Z @ 33 NONAME ; int TGlxSelectionIterator::operator++(int) + ??ETGlxWindowIterator@@QAEHH@Z @ 34 NONAME ; int TGlxWindowIterator::operator++(int) + ?AddAttributeL@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 35 NONAME ; void CGlxAttributeContext::AddAttributeL(class TMPXAttribute const &) + ?AddObjects@CGlxListWindow@@QAEXHH@Z @ 36 NONAME ; void CGlxListWindow::AddObjects(int, int) + ?AddObjects@CGlxListWindow@@QAEXHHHH@Z @ 37 NONAME ; void CGlxListWindow::AddObjects(int, int, int, int) + ?AddSpecForItemL@CGlxThumbnailContext@@QAEXHHH@Z @ 38 NONAME ; void CGlxThumbnailContext::AddSpecForItemL(int, int, int) + ?At@CGlxListWindow@@QAEPAVCBase@@H@Z @ 39 NONAME ; class CBase * CGlxListWindow::At(int) + ?At@CGlxListWindow@@QBEPBVCBase@@H@Z @ 40 NONAME ; class CBase const * CGlxListWindow::At(int) const + ?AttributeCount@CGlxAttributeContext@@QAEHXZ @ 41 NONAME ; int CGlxAttributeContext::AttributeCount(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 42 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?CheckOpenRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 43 NONAME ; int CGlxDRMUtility::CheckOpenRightsL(class TDesC16 const &, int) + ?Cleanup@CGlxListWindow@@QAEXXZ @ 44 NONAME ; void CGlxListWindow::Cleanup(void) + ?Close@CGlxDRMUtility@@QAEXXZ @ 45 NONAME ; void CGlxDRMUtility::Close(void) + ?Close@TGlxFetchContextRemover@@QAEXXZ @ 46 NONAME ; void TGlxFetchContextRemover::Close(void) + ?ClosestThumbnail@GlxThumbnailUtility@@SAHABVTSize@@ABVCGlxMedia@@H@Z @ 47 NONAME ; int GlxThumbnailUtility::ClosestThumbnail(class TSize const &, class CGlxMedia const &, int) + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 48 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?ConstructL@CGlxListWindow@@QAEXXZ @ 49 NONAME ; void CGlxListWindow::ConstructL(void) + ?DRMThumbnailSize@CGlxDRMUtility@@QAE?AVTSize@@AAV2@@Z @ 50 NONAME ; class TSize CGlxDRMUtility::DRMThumbnailSize(class TSize &) + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 51 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 52 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 53 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 54 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 55 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 56 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 57 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 58 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 59 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 60 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 61 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 62 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 63 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 64 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 65 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 66 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 67 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 68 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 69 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@ABVTMPXAttribute@@@Z @ 70 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, class TMPXAttribute const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@H@Z @ 71 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, int) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 72 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?InRange@TGlxSelectionIterator@@UBEHH@Z @ 73 NONAME ; int TGlxSelectionIterator::InRange(int) const + ?InstanceL@CGlxDRMUtility@@SAPAV1@XZ @ 74 NONAME ; class CGlxDRMUtility * CGlxDRMUtility::InstanceL(void) + ?InstanceL@MGlxCache@@SAPAV1@XZ @ 75 NONAME ; class MGlxCache * MGlxCache::InstanceL(void) + ?InstanceL@MGlxMediaList@@SAPAV1@ABVCMPXCollectionPath@@ABV?$TGlxId@VTGlxIdHierarchyBase@@@@PAVCMPXMedia@@@Z @ 76 NONAME ; class MGlxMediaList * MGlxMediaList::InstanceL(class CMPXCollectionPath const &, class TGlxId const &, class CMPXMedia *) + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 77 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsFullThumbnail@GlxThumbnailUtility@@SAHABVTMPXAttribute@@@Z @ 78 NONAME ; int GlxThumbnailUtility::IsFullThumbnail(class TMPXAttribute const &) + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 79 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 80 NONAME ; int TGlxMedia::IsStatic(void) const + ?Iterator@CGlxListWindow@@QBE?AVTGlxWindowIterator@@XZ @ 81 NONAME ; class TGlxWindowIterator CGlxListWindow::Iterator(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 82 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 83 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?NewL@CGlxDefaultAttributeContext@@SAPAV1@XZ @ 84 NONAME ; class CGlxDefaultAttributeContext * CGlxDefaultAttributeContext::NewL(void) + ?NewL@CGlxDefaultThumbnailContext@@SAPAV1@XZ @ 85 NONAME ; class CGlxDefaultThumbnailContext * CGlxDefaultThumbnailContext::NewL(void) + ?NewL@CGlxThumbnailContext@@SAPAV1@PAVMGlxMediaListIterator@@@Z @ 86 NONAME ; class CGlxThumbnailContext * CGlxThumbnailContext::NewL(class MGlxMediaListIterator *) + ?RemoveAttribute@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 87 NONAME ; void CGlxAttributeContext::RemoveAttribute(class TMPXAttribute const &) + ?RemoveObjects@CGlxListWindow@@QAEXHH@Z @ 88 NONAME ; void CGlxListWindow::RemoveObjects(int, int) + ?RemoveObjects@CGlxListWindow@@QAEXHHHH@Z @ 89 NONAME ; void CGlxListWindow::RemoveObjects(int, int, int, int) + ?Reset@CGlxMedia@@QAEXXZ @ 90 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 91 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetDefaultSpec@CGlxThumbnailContext@@QAEXHH@Z @ 92 NONAME ; void CGlxThumbnailContext::SetDefaultSpec(int, int) + ?SetDisabledIfMoreThanRangeSelected@TGlxSelectionIterator@@QAEXH@Z @ 93 NONAME ; void TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected(int) + ?SetFocusIndex@CGlxListWindow@@QAEXH@Z @ 94 NONAME ; void CGlxListWindow::SetFocusIndex(int) + ?SetFocusIndex@CGlxListWindow@@QAEXHH@Z @ 95 NONAME ; void CGlxListWindow::SetFocusIndex(int, int) + ?SetGranularity@CGlxAttributeContext@@QAEXI@Z @ 96 NONAME ; void CGlxAttributeContext::SetGranularity(unsigned int) + ?SetHighQualityOnly@CGlxThumbnailContext@@QAEXH@Z @ 97 NONAME ; void CGlxThumbnailContext::SetHighQualityOnly(int) + ?SetIndex@TGlxFromManualIndexOutwardBlockyIterator@@QAEXH@Z @ 98 NONAME ; void TGlxFromManualIndexOutwardBlockyIterator::SetIndex(int) + ?SetRange@TGlxSelectionIterator@@QAEXH@Z @ 99 NONAME ; void TGlxSelectionIterator::SetRange(int) + ?SetRange@TGlxSequentialIterator@@QAEXH@Z @ 100 NONAME ; void TGlxSequentialIterator::SetRange(int) + ?SetRangeOffsets@CGlxDefaultAttributeContext@@QAEXHH@Z @ 101 NONAME ; void CGlxDefaultAttributeContext::SetRangeOffsets(int, int) + ?SetRangeOffsets@CGlxDefaultThumbnailContext@@QAEXHH@Z @ 102 NONAME ; void CGlxDefaultThumbnailContext::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromFocusOutwardIterator@@QAEXHH@Z @ 103 NONAME ; void TGlxFromFocusOutwardIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromIndexOutwardBlockyIterator@@QAEXHH@Z @ 104 NONAME ; void TGlxFromIndexOutwardBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromManualIndexBlockyIterator@@QAEXHH@Z @ 105 NONAME ; void TGlxFromManualIndexBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHH@Z @ 106 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHHHH@Z @ 107 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int, int, int) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 108 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetToFirst@TGlxExclusionIterator@@UAEXPBVMGlxMediaList@@@Z @ 109 NONAME ; void TGlxExclusionIterator::SetToFirst(class MGlxMediaList const *) + ?SetToFirst@TGlxSelectionIterator@@UAEXPBVMGlxMediaList@@@Z @ 110 NONAME ; void TGlxSelectionIterator::SetToFirst(class MGlxMediaList const *) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 111 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 112 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 113 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 114 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?UnmarkAllL@MGlxMediaList@@SAXAAV1@@Z @ 115 NONAME ; void MGlxMediaList::UnmarkAllL(class MGlxMediaList &) + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 116 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 117 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 118 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 119 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxListWindow@@QBEXXZ @ 120 NONAME ; void CGlxListWindow::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 121 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxNavigableList@@QBEXXZ @ 122 NONAME ; void CGlxNavigableList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 123 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxnavigablelistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxnavigablelistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 2 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??1CGlxMedia@@UAE@XZ @ 3 NONAME ; CGlxMedia::~CGlxMedia(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 4 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?ClosestThumbnail@GlxThumbnailUtility@@SAHABVTSize@@ABVCGlxMedia@@H@Z @ 5 NONAME ; int GlxThumbnailUtility::ClosestThumbnail(class TSize const &, class CGlxMedia const &, int) + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 6 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 7 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 8 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 9 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 10 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 11 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 12 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 13 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 14 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 15 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 16 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 17 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 18 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 19 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 20 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 21 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 22 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 23 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 24 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 25 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 26 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 27 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsFullThumbnail@GlxThumbnailUtility@@SAHABVTMPXAttribute@@@Z @ 28 NONAME ; int GlxThumbnailUtility::IsFullThumbnail(class TMPXAttribute const &) + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 29 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 30 NONAME ; int TGlxMedia::IsStatic(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 31 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 32 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?Reset@CGlxMedia@@QAEXXZ @ 33 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 34 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 35 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 36 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 37 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 38 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 39 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 40 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 41 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 42 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 43 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 44 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxNavigableList@@QBEXXZ @ 45 NONAME ; void CGlxNavigableList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 46 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxstaticitemlistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/ut_cglxstaticitemlistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,47 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 2 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??1CGlxMedia@@UAE@XZ @ 3 NONAME ; CGlxMedia::~CGlxMedia(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 4 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?ClosestThumbnail@GlxThumbnailUtility@@SAHABVTSize@@ABVCGlxMedia@@H@Z @ 5 NONAME ; int GlxThumbnailUtility::ClosestThumbnail(class TSize const &, class CGlxMedia const &, int) + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 6 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 7 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 8 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 9 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 10 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 11 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 12 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 13 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 14 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 15 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 16 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 17 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 18 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 19 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 20 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 21 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 22 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 23 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 24 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 25 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 26 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 27 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsFullThumbnail@GlxThumbnailUtility@@SAHABVTMPXAttribute@@@Z @ 28 NONAME ; int GlxThumbnailUtility::IsFullThumbnail(class TMPXAttribute const &) + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 29 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 30 NONAME ; int TGlxMedia::IsStatic(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 31 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 32 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?Reset@CGlxMedia@@QAEXXZ @ 33 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 34 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 35 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 36 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 37 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 38 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 39 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 40 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 41 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 42 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 43 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 44 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 45 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/ut_glxerrormanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/ut_glxerrormanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + ??0CGlxAttributeContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 2 NONAME ; CGlxAttributeContext::CGlxAttributeContext(class MGlxMediaListIterator *) + ??0CGlxListWindow@@QAE@AAVMGlxWindowObjectFactory@@@Z @ 3 NONAME ; CGlxListWindow::CGlxListWindow(class MGlxWindowObjectFactory &) + ??0CGlxMedia@@QAE@ABVTGlxMediaId@@@Z @ 4 NONAME ; CGlxMedia::CGlxMedia(class TGlxMediaId const &) + ??0CGlxThumbnailContext@@QAE@PAVMGlxMediaListIterator@@@Z @ 5 NONAME ; CGlxThumbnailContext::CGlxThumbnailContext(class MGlxMediaListIterator *) + ??0TGlxExclusionIterator@@QAE@AAVMGlxMediaListIterator@@0@Z @ 6 NONAME ; TGlxExclusionIterator::TGlxExclusionIterator(class MGlxMediaListIterator &, class MGlxMediaListIterator &) + ??0TGlxFetchContextRemover@@QAE@PAVMGlxFetchContext@@AAVMGlxMediaList@@@Z @ 7 NONAME ; TGlxFetchContextRemover::TGlxFetchContextRemover(class MGlxFetchContext *, class MGlxMediaList &) + ??0TGlxFirstThenLastIterator@@QAE@XZ @ 8 NONAME ; TGlxFirstThenLastIterator::TGlxFirstThenLastIterator(void) + ??0TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 9 NONAME ; TGlxFromFocusOutwardBlockyIterator::TGlxFromFocusOutwardBlockyIterator(void) + ??0TGlxFromFocusOutwardIterator@@QAE@XZ @ 10 NONAME ; TGlxFromFocusOutwardIterator::TGlxFromFocusOutwardIterator(void) + ??0TGlxFromIndexOutwardBlockyIterator@@QAE@ABVMGlxIndex@0@@Z @ 11 NONAME ; TGlxFromIndexOutwardBlockyIterator::TGlxFromIndexOutwardBlockyIterator(class TGlxFromIndexOutwardBlockyIterator::MGlxIndex const &) + ??0TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 12 NONAME ; TGlxFromManualIndexBlockyIterator::TGlxFromManualIndexBlockyIterator(void) + ??0TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 13 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::TGlxFromManualIndexOutwardBlockyIterator(void) + ??0TGlxSelectionIterator@@QAE@XZ @ 14 NONAME ; TGlxSelectionIterator::TGlxSelectionIterator(void) + ??0TGlxSequentialIterator@@QAE@XZ @ 15 NONAME ; TGlxSequentialIterator::TGlxSequentialIterator(void) + ??0TGlxSpecificIdIterator@@QAE@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@VTGlxMediaId@@@Z @ 16 NONAME ; TGlxSpecificIdIterator::TGlxSpecificIdIterator(class TGlxId const &, class TGlxMediaId) + ??0TGlxWindowIterator@@QAE@ABV0@@Z @ 17 NONAME ; TGlxWindowIterator::TGlxWindowIterator(class TGlxWindowIterator const &) + ??1CGlxAttributeContext@@UAE@XZ @ 18 NONAME ; CGlxAttributeContext::~CGlxAttributeContext(void) + ??1CGlxDefaultAttributeContext@@UAE@XZ @ 19 NONAME ; CGlxDefaultAttributeContext::~CGlxDefaultAttributeContext(void) + ??1CGlxDefaultThumbnailContext@@UAE@XZ @ 20 NONAME ; CGlxDefaultThumbnailContext::~CGlxDefaultThumbnailContext(void) + ??1CGlxListWindow@@UAE@XZ @ 21 NONAME ; CGlxListWindow::~CGlxListWindow(void) + ??1CGlxMedia@@UAE@XZ @ 22 NONAME ; CGlxMedia::~CGlxMedia(void) + ??1CGlxThumbnailContext@@UAE@XZ @ 23 NONAME ; CGlxThumbnailContext::~CGlxThumbnailContext(void) + ??1TGlxExclusionIterator@@QAE@XZ @ 24 NONAME ; TGlxExclusionIterator::~TGlxExclusionIterator(void) + ??1TGlxFetchContextRemover@@QAE@XZ @ 25 NONAME ; TGlxFetchContextRemover::~TGlxFetchContextRemover(void) + ??1TGlxFirstThenLastIterator@@QAE@XZ @ 26 NONAME ; TGlxFirstThenLastIterator::~TGlxFirstThenLastIterator(void) + ??1TGlxFromFocusOutwardBlockyIterator@@QAE@XZ @ 27 NONAME ; TGlxFromFocusOutwardBlockyIterator::~TGlxFromFocusOutwardBlockyIterator(void) + ??1TGlxFromFocusOutwardIterator@@QAE@XZ @ 28 NONAME ; TGlxFromFocusOutwardIterator::~TGlxFromFocusOutwardIterator(void) + ??1TGlxFromIndexOutwardBlockyIterator@@QAE@XZ @ 29 NONAME ; TGlxFromIndexOutwardBlockyIterator::~TGlxFromIndexOutwardBlockyIterator(void) + ??1TGlxFromManualIndexBlockyIterator@@QAE@XZ @ 30 NONAME ; TGlxFromManualIndexBlockyIterator::~TGlxFromManualIndexBlockyIterator(void) + ??1TGlxFromManualIndexOutwardBlockyIterator@@QAE@XZ @ 31 NONAME ; TGlxFromManualIndexOutwardBlockyIterator::~TGlxFromManualIndexOutwardBlockyIterator(void) + ??1TGlxSelectionIterator@@QAE@XZ @ 32 NONAME ; TGlxSelectionIterator::~TGlxSelectionIterator(void) + ??ETGlxSelectionIterator@@UAEHH@Z @ 33 NONAME ; int TGlxSelectionIterator::operator++(int) + ??ETGlxWindowIterator@@QAEHH@Z @ 34 NONAME ; int TGlxWindowIterator::operator++(int) + ?AddAttributeL@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 35 NONAME ; void CGlxAttributeContext::AddAttributeL(class TMPXAttribute const &) + ?AddObjects@CGlxListWindow@@QAEXHH@Z @ 36 NONAME ; void CGlxListWindow::AddObjects(int, int) + ?AddObjects@CGlxListWindow@@QAEXHHHH@Z @ 37 NONAME ; void CGlxListWindow::AddObjects(int, int, int, int) + ?AddSpecForItemL@CGlxThumbnailContext@@QAEXHHH@Z @ 38 NONAME ; void CGlxThumbnailContext::AddSpecForItemL(int, int, int) + ?At@CGlxListWindow@@QAEPAVCBase@@H@Z @ 39 NONAME ; class CBase * CGlxListWindow::At(int) + ?At@CGlxListWindow@@QBEPBVCBase@@H@Z @ 40 NONAME ; class CBase const * CGlxListWindow::At(int) const + ?AttributeCount@CGlxAttributeContext@@QAEHXZ @ 41 NONAME ; int CGlxAttributeContext::AttributeCount(void) + ?Category@TGlxMedia@@QBE?AW4TMPXGeneralCategory@@XZ @ 42 NONAME ; enum TMPXGeneralCategory TGlxMedia::Category(void) const + ?CheckOpenRightsL@CGlxDRMUtility@@QAEHABVTDesC16@@H@Z @ 43 NONAME ; int CGlxDRMUtility::CheckOpenRightsL(class TDesC16 const &, int) + ?Cleanup@CGlxListWindow@@QAEXXZ @ 44 NONAME ; void CGlxListWindow::Cleanup(void) + ?Close@CGlxDRMUtility@@QAEXXZ @ 45 NONAME ; void CGlxDRMUtility::Close(void) + ?Close@TGlxFetchContextRemover@@QAEXXZ @ 46 NONAME ; void TGlxFetchContextRemover::Close(void) + ?ClosestThumbnail@GlxThumbnailUtility@@SAHABVTSize@@ABVCGlxMedia@@H@Z @ 47 NONAME ; int GlxThumbnailUtility::ClosestThumbnail(class TSize const &, class CGlxMedia const &, int) + ?Comment@TGlxMedia@@QBEABVTDesC16@@XZ @ 48 NONAME ; class TDesC16 const & TGlxMedia::Comment(void) const + ?ConstructL@CGlxListWindow@@QAEXXZ @ 49 NONAME ; void CGlxListWindow::ConstructL(void) + ?DRMThumbnailSize@CGlxDRMUtility@@QAE?AVTSize@@AAV2@@Z @ 50 NONAME ; class TSize CGlxDRMUtility::DRMThumbnailSize(class TSize &) + ?DeleteAttribute@CGlxMedia@@QAEXABVTMPXAttribute@@@Z @ 51 NONAME ; void CGlxMedia::DeleteAttribute(class TMPXAttribute const &) + ?DeleteLocationAttribute@TGlxMedia@@QAEXXZ @ 52 NONAME ; void TGlxMedia::DeleteLocationAttribute(void) + ?GetClosestThumbnail@TGlxMedia@@QBEHAAVTMPXAttribute@@ABVTSize@@H@Z @ 53 NONAME ; int TGlxMedia::GetClosestThumbnail(class TMPXAttribute &, class TSize const &, int) const + ?GetContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 54 NONAME ; int TGlxMedia::GetContainedItemCount(int &) const + ?GetCoordinate@TGlxMedia@@QBEHAAVTCoordinate@@@Z @ 55 NONAME ; int TGlxMedia::GetCoordinate(class TCoordinate &) const + ?GetDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 56 NONAME ; int TGlxMedia::GetDate(class TTime &) const + ?GetDimensions@TGlxMedia@@QBEHAAVTSize@@@Z @ 57 NONAME ; int TGlxMedia::GetDimensions(class TSize &) const + ?GetDrmProtected@TGlxMedia@@QBEHAAH@Z @ 58 NONAME ; int TGlxMedia::GetDrmProtected(int &) const + ?GetDrmValidity@TGlxMedia@@QBEHAAW4TGlxMediaGeneralRightsValidity@@@Z @ 59 NONAME ; int TGlxMedia::GetDrmValidity(enum TGlxMediaGeneralRightsValidity &) const + ?GetDuration@TGlxMedia@@QBEHAAM@Z @ 60 NONAME ; int TGlxMedia::GetDuration(float &) const + ?GetFrameCount@TGlxMedia@@QBEHAAH@Z @ 61 NONAME ; int TGlxMedia::GetFrameCount(int &) const + ?GetIconInfo@TGlxMedia@@QBEHAAUTIconInfo@@@Z @ 62 NONAME ; int TGlxMedia::GetIconInfo(struct TIconInfo &) const + ?GetLastModifiedDate@TGlxMedia@@QBEHAAVTTime@@@Z @ 63 NONAME ; int TGlxMedia::GetLastModifiedDate(class TTime &) const + ?GetSize@TGlxMedia@@QBEHAAH@Z @ 64 NONAME ; int TGlxMedia::GetSize(int &) const + ?GetSlideshowPlayableContainedItemCount@TGlxMedia@@QBEHAAH@Z @ 65 NONAME ; int TGlxMedia::GetSlideshowPlayableContainedItemCount(int &) const + ?GetStaticItemCommand@TGlxMedia@@QBEHAAH@Z @ 66 NONAME ; int TGlxMedia::GetStaticItemCommand(int &) const + ?GetSystemItem@TGlxMedia@@QBEHAAH@Z @ 67 NONAME ; int TGlxMedia::GetSystemItem(int &) const + ?GetValueText@CGlxMedia@@QBEHAAVTPtrC16@@ABVTMPXAttribute@@@Z @ 68 NONAME ; int CGlxMedia::GetValueText(class TPtrC16 &, class TMPXAttribute const &) const + ?HandleModified@CGlxMedia@@QAEXABV?$RArray@VTMPXAttribute@@@@@Z @ 69 NONAME ; void CGlxMedia::HandleModified(class RArray const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@ABVTMPXAttribute@@@Z @ 70 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, class TMPXAttribute const &) + ?HasAttributeErrorL@GlxErrorManager@@SAHPBVCGlxMedia@@H@Z @ 71 NONAME ; int GlxErrorManager::HasAttributeErrorL(class CGlxMedia const *, int) + ?IdSpaceId@TGlxMedia@@QBE?AV?$TGlxId@VTGlxIdSpaceIdBase@@@@XZ @ 72 NONAME ; class TGlxId TGlxMedia::IdSpaceId(void) const + ?InRange@TGlxSelectionIterator@@UBEHH@Z @ 73 NONAME ; int TGlxSelectionIterator::InRange(int) const + ?InstanceL@CGlxDRMUtility@@SAPAV1@XZ @ 74 NONAME ; class CGlxDRMUtility * CGlxDRMUtility::InstanceL(void) + ?InstanceL@MGlxCache@@SAPAV1@XZ @ 75 NONAME ; class MGlxCache * MGlxCache::InstanceL(void) + ?InstanceL@MGlxMediaList@@SAPAV1@ABVCMPXCollectionPath@@ABV?$TGlxId@VTGlxIdHierarchyBase@@@@PAVCMPXMedia@@@Z @ 76 NONAME ; class MGlxMediaList * MGlxMediaList::InstanceL(class CMPXCollectionPath const &, class TGlxId const &, class CMPXMedia *) + ?IsDrmProtected@TGlxMedia@@QBEHXZ @ 77 NONAME ; int TGlxMedia::IsDrmProtected(void) const + ?IsFullThumbnail@GlxThumbnailUtility@@SAHABVTMPXAttribute@@@Z @ 78 NONAME ; int GlxThumbnailUtility::IsFullThumbnail(class TMPXAttribute const &) + ?IsSlideShowPlayableContent@TGlxMedia@@QBEHXZ @ 79 NONAME ; int TGlxMedia::IsSlideShowPlayableContent(void) const + ?IsStatic@TGlxMedia@@QBEHXZ @ 80 NONAME ; int TGlxMedia::IsStatic(void) const + ?Iterator@CGlxListWindow@@QBE?AVTGlxWindowIterator@@XZ @ 81 NONAME ; class TGlxWindowIterator CGlxListWindow::Iterator(void) const + ?MatchById@TGlxMedia@@SAHABV1@0@Z @ 82 NONAME ; int TGlxMedia::MatchById(class TGlxMedia const &, class TGlxMedia const &) + ?MimeType@TGlxMedia@@QBEABVTDesC16@@XZ @ 83 NONAME ; class TDesC16 const & TGlxMedia::MimeType(void) const + ?NewL@CGlxDefaultAttributeContext@@SAPAV1@XZ @ 84 NONAME ; class CGlxDefaultAttributeContext * CGlxDefaultAttributeContext::NewL(void) + ?NewL@CGlxDefaultThumbnailContext@@SAPAV1@XZ @ 85 NONAME ; class CGlxDefaultThumbnailContext * CGlxDefaultThumbnailContext::NewL(void) + ?NewL@CGlxThumbnailContext@@SAPAV1@PAVMGlxMediaListIterator@@@Z @ 86 NONAME ; class CGlxThumbnailContext * CGlxThumbnailContext::NewL(class MGlxMediaListIterator *) + ?RemoveAttribute@CGlxAttributeContext@@QAEXABVTMPXAttribute@@@Z @ 87 NONAME ; void CGlxAttributeContext::RemoveAttribute(class TMPXAttribute const &) + ?RemoveObjects@CGlxListWindow@@QAEXHH@Z @ 88 NONAME ; void CGlxListWindow::RemoveObjects(int, int) + ?RemoveObjects@CGlxListWindow@@QAEXHHHH@Z @ 89 NONAME ; void CGlxListWindow::RemoveObjects(int, int, int, int) + ?Reset@CGlxMedia@@QAEXXZ @ 90 NONAME ; void CGlxMedia::Reset(void) + ?SetCObjectValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAVCBase@@@Z @ 91 NONAME ; void CGlxMedia::SetCObjectValueL(class TMPXAttribute const &, class CBase *) + ?SetDefaultSpec@CGlxThumbnailContext@@QAEXHH@Z @ 92 NONAME ; void CGlxThumbnailContext::SetDefaultSpec(int, int) + ?SetDisabledIfMoreThanRangeSelected@TGlxSelectionIterator@@QAEXH@Z @ 93 NONAME ; void TGlxSelectionIterator::SetDisabledIfMoreThanRangeSelected(int) + ?SetFocusIndex@CGlxListWindow@@QAEXH@Z @ 94 NONAME ; void CGlxListWindow::SetFocusIndex(int) + ?SetFocusIndex@CGlxListWindow@@QAEXHH@Z @ 95 NONAME ; void CGlxListWindow::SetFocusIndex(int, int) + ?SetGranularity@CGlxAttributeContext@@QAEXI@Z @ 96 NONAME ; void CGlxAttributeContext::SetGranularity(unsigned int) + ?SetHighQualityOnly@CGlxThumbnailContext@@QAEXH@Z @ 97 NONAME ; void CGlxThumbnailContext::SetHighQualityOnly(int) + ?SetIndex@TGlxFromManualIndexOutwardBlockyIterator@@QAEXH@Z @ 98 NONAME ; void TGlxFromManualIndexOutwardBlockyIterator::SetIndex(int) + ?SetRange@TGlxSelectionIterator@@QAEXH@Z @ 99 NONAME ; void TGlxSelectionIterator::SetRange(int) + ?SetRange@TGlxSequentialIterator@@QAEXH@Z @ 100 NONAME ; void TGlxSequentialIterator::SetRange(int) + ?SetRangeOffsets@CGlxDefaultAttributeContext@@QAEXHH@Z @ 101 NONAME ; void CGlxDefaultAttributeContext::SetRangeOffsets(int, int) + ?SetRangeOffsets@CGlxDefaultThumbnailContext@@QAEXHH@Z @ 102 NONAME ; void CGlxDefaultThumbnailContext::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromFocusOutwardIterator@@QAEXHH@Z @ 103 NONAME ; void TGlxFromFocusOutwardIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromIndexOutwardBlockyIterator@@QAEXHH@Z @ 104 NONAME ; void TGlxFromIndexOutwardBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsets@TGlxFromManualIndexBlockyIterator@@QAEXHH@Z @ 105 NONAME ; void TGlxFromManualIndexBlockyIterator::SetRangeOffsets(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHH@Z @ 106 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int) + ?SetRangeOffsetsL@CGlxListWindow@@QAEXHHHH@Z @ 107 NONAME ; void CGlxListWindow::SetRangeOffsetsL(int, int, int, int) + ?SetTextValueL@CGlxMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 108 NONAME ; void CGlxMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetToFirst@TGlxExclusionIterator@@UAEXPBVMGlxMediaList@@@Z @ 109 NONAME ; void TGlxExclusionIterator::SetToFirst(class MGlxMediaList const *) + ?SetToFirst@TGlxSelectionIterator@@UAEXPBVMGlxMediaList@@@Z @ 110 NONAME ; void TGlxSelectionIterator::SetToFirst(class MGlxMediaList const *) + ?SetValueL@CGlxMedia@@QAEXABVTMPXAttribute@@PAXW4TMPXAttributeType@@@Z @ 111 NONAME ; void CGlxMedia::SetValueL(class TMPXAttribute const &, void *, enum TMPXAttributeType) + ?SubTitle@TGlxMedia@@QBEABVTDesC16@@XZ @ 112 NONAME ; class TDesC16 const & TGlxMedia::SubTitle(void) const + ?ThumbnailAttribute@TGlxMedia@@QBEPBVCGlxThumbnailAttribute@@AAVTMPXAttribute@@@Z @ 113 NONAME ; class CGlxThumbnailAttribute const * TGlxMedia::ThumbnailAttribute(class TMPXAttribute &) const + ?Title@TGlxMedia@@QBEABVTDesC16@@XZ @ 114 NONAME ; class TDesC16 const & TGlxMedia::Title(void) const + ?UnmarkAllL@MGlxMediaList@@SAXAAV1@@Z @ 115 NONAME ; void MGlxMediaList::UnmarkAllL(class MGlxMediaList &) + ?Uri@TGlxMedia@@QBEABVTDesC16@@XZ @ 116 NONAME ; class TDesC16 const & TGlxMedia::Uri(void) const + ?ValueCObject@CGlxMedia@@QBEPBVCBase@@ABVTMPXAttribute@@@Z @ 117 NONAME ; class CBase const * CGlxMedia::ValueCObject(class TMPXAttribute const &) const + ?ValueText@CGlxMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 118 NONAME ; class TDesC16 const & CGlxMedia::ValueText(class TMPXAttribute const &) const + ?__DbgTestInvariant@CGlxItemList@@QBEXXZ @ 119 NONAME ; void CGlxItemList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxListWindow@@QBEXXZ @ 120 NONAME ; void CGlxListWindow::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxMedia@@QBEXXZ @ 121 NONAME ; void CGlxMedia::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxNavigableList@@QBEXXZ @ 122 NONAME ; void CGlxNavigableList::__DbgTestInvariant(void) const + ?__DbgTestInvariant@CGlxStaticItemList@@QBEXXZ @ 123 NONAME ; void CGlxStaticItemList::__DbgTestInvariant(void) const + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/BWINS/ut_tglxselectioniteratoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/BWINS/ut_tglxselectioniteratoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/t_cglxcacheu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/t_cglxcacheu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,57 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediaRK13TMPXAttribute @ 2 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediai @ 3 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 4 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 5 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 6 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 7 NONAME + _ZN9CGlxMedia5ResetEv @ 8 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 9 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 10 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 11 NONAME + _ZN9CGlxMediaD0Ev @ 12 NONAME + _ZN9CGlxMediaD1Ev @ 13 NONAME + _ZN9CGlxMediaD2Ev @ 14 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 15 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 16 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 17 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 18 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 19 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 20 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 21 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 22 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 23 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 24 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 25 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 26 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 27 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 28 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 29 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 30 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 31 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 32 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 33 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 34 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 35 NONAME + _ZNK9TGlxMedia3UriEv @ 36 NONAME + _ZNK9TGlxMedia5TitleEv @ 37 NONAME + _ZNK9TGlxMedia7CommentEv @ 38 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 39 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 40 NONAME + _ZNK9TGlxMedia8CategoryEv @ 41 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 42 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 43 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 44 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 45 NONAME + _ZTI13CGlxMediaList @ 46 NONAME ; ## + _ZTI16CGlxCacheManager @ 47 NONAME ; ## + _ZTI20CGlxGarbageCollector @ 48 NONAME ; ## + _ZTIN11T_CGlxCache17CGlxMediaUserTestE @ 49 NONAME ; ## + _ZTIN11T_CGlxCache21CGlxCacheObserverTestE @ 50 NONAME ; ## + _ZTV13CGlxMediaList @ 51 NONAME ; ## + _ZTV16CGlxCacheManager @ 52 NONAME ; ## + _ZTV20CGlxGarbageCollector @ 53 NONAME ; ## + _ZTVN11T_CGlxCache17CGlxMediaUserTestE @ 54 NONAME ; ## + _ZTVN11T_CGlxCache21CGlxCacheObserverTestE @ 55 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/t_cglxfetcherrorarrayu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/t_cglxfetcherrorarrayu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/t_cglxgarbagecollectoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/t_cglxgarbagecollectoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,69 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediaRK13TMPXAttribute @ 2 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediai @ 3 NONAME + _ZN5CIdle3NewEi @ 4 NONAME + _ZN5CIdle4NewLEi @ 5 NONAME + _ZN5CIdle4RunLEv @ 6 NONAME + _ZN5CIdle5StartE9TCallBack @ 7 NONAME + _ZN5CIdle8DoCancelEv @ 8 NONAME + _ZN5CIdleC1Ei @ 9 NONAME + _ZN5CIdleC2Ei @ 10 NONAME + _ZN5CIdleD0Ev @ 11 NONAME + _ZN5CIdleD1Ev @ 12 NONAME + _ZN5CIdleD2Ev @ 13 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 14 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 15 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 16 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 17 NONAME + _ZN9CGlxMedia5ResetEv @ 18 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 19 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 20 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 21 NONAME + _ZN9CGlxMediaD0Ev @ 22 NONAME + _ZN9CGlxMediaD1Ev @ 23 NONAME + _ZN9CGlxMediaD2Ev @ 24 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 25 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 26 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 27 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 28 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 29 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 30 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 31 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 32 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 33 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 34 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 35 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 36 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 37 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 38 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 39 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 40 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 41 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 42 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 43 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 44 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 45 NONAME + _ZNK9TGlxMedia3UriEv @ 46 NONAME + _ZNK9TGlxMedia5TitleEv @ 47 NONAME + _ZNK9TGlxMedia7CommentEv @ 48 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 49 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 50 NONAME + _ZNK9TGlxMedia8CategoryEv @ 51 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 52 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 53 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 54 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 55 NONAME + _ZTI13CGlxMediaList @ 56 NONAME ; ## + _ZTI16CGlxCacheManager @ 57 NONAME ; ## + _ZTI20CGlxGarbageCollector @ 58 NONAME ; ## + _ZTI5CIdle @ 59 NONAME ; ## + _ZTIN22T_CGlxGarbageCollector10CTimerTestE @ 60 NONAME ; ## + _ZTIN22T_CGlxGarbageCollector17CGlxMediaUserTestE @ 61 NONAME ; ## + _ZTV13CGlxMediaList @ 62 NONAME ; ## + _ZTV16CGlxCacheManager @ 63 NONAME ; ## + _ZTV20CGlxGarbageCollector @ 64 NONAME ; ## + _ZTV5CIdle @ 65 NONAME ; ## + _ZTVN22T_CGlxGarbageCollector10CTimerTestE @ 66 NONAME ; ## + _ZTVN22T_CGlxGarbageCollector17CGlxMediaUserTestE @ 67 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/t_cglxmediau.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/t_cglxmediau.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,45 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 2 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 3 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 4 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 5 NONAME + _ZN9CGlxMedia5ResetEv @ 6 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 7 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 8 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 9 NONAME + _ZN9CGlxMediaD0Ev @ 10 NONAME + _ZN9CGlxMediaD1Ev @ 11 NONAME + _ZN9CGlxMediaD2Ev @ 12 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 13 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 14 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 15 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 16 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 17 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 18 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 19 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 20 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 21 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 22 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 23 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 24 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 25 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 26 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 27 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 28 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 29 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 30 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 31 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 32 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 33 NONAME + _ZNK9TGlxMedia3UriEv @ 34 NONAME + _ZNK9TGlxMedia5TitleEv @ 35 NONAME + _ZNK9TGlxMedia7CommentEv @ 36 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 37 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 38 NONAME + _ZNK9TGlxMedia8CategoryEv @ 39 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 40 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 41 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 42 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 43 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/t_glxfromfocusoutwarditeratoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/t_glxfromfocusoutwarditeratoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/t_glxlistwindowu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/t_glxlistwindowu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN14CGlxListWindow10AddObjectsEii @ 2 NONAME + _ZN14CGlxListWindow10AddObjectsEiiii @ 3 NONAME + _ZN14CGlxListWindow10ConstructLEv @ 4 NONAME + _ZN14CGlxListWindow13RemoveObjectsEii @ 5 NONAME + _ZN14CGlxListWindow13RemoveObjectsEiiii @ 6 NONAME + _ZN14CGlxListWindow13SetFocusIndexEi @ 7 NONAME + _ZN14CGlxListWindow13SetFocusIndexEii @ 8 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEii @ 9 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEiiii @ 10 NONAME + _ZN14CGlxListWindow2AtEi @ 11 NONAME + _ZN14CGlxListWindow7CleanupEv @ 12 NONAME + _ZN14CGlxListWindowC1ER23MGlxWindowObjectFactory @ 13 NONAME + _ZN14CGlxListWindowC2ER23MGlxWindowObjectFactory @ 14 NONAME + _ZN14CGlxListWindowD0Ev @ 15 NONAME + _ZN14CGlxListWindowD1Ev @ 16 NONAME + _ZN14CGlxListWindowD2Ev @ 17 NONAME + _ZN18TGlxWindowIteratorC1ERKS_ @ 18 NONAME + _ZN18TGlxWindowIteratorC2ERKS_ @ 19 NONAME + _ZN18TGlxWindowIteratorppEi @ 20 NONAME + _ZNK14CGlxListWindow2AtEi @ 21 NONAME + _ZNK14CGlxListWindow8IteratorEv @ 22 NONAME + _ZTI14CGlxListWindow @ 23 NONAME ; ## + _ZTV14CGlxListWindow @ 24 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/t_tglxexclusioniteratoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/t_tglxexclusioniteratoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,93 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN14CGlxListWindow10AddObjectsEii @ 2 NONAME + _ZN14CGlxListWindow10AddObjectsEiiii @ 3 NONAME + _ZN14CGlxListWindow10ConstructLEv @ 4 NONAME + _ZN14CGlxListWindow13RemoveObjectsEii @ 5 NONAME + _ZN14CGlxListWindow13RemoveObjectsEiiii @ 6 NONAME + _ZN14CGlxListWindow13SetFocusIndexEi @ 7 NONAME + _ZN14CGlxListWindow13SetFocusIndexEii @ 8 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEii @ 9 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEiiii @ 10 NONAME + _ZN14CGlxListWindow2AtEi @ 11 NONAME + _ZN14CGlxListWindow7CleanupEv @ 12 NONAME + _ZN14CGlxListWindowC1ER23MGlxWindowObjectFactory @ 13 NONAME + _ZN14CGlxListWindowC2ER23MGlxWindowObjectFactory @ 14 NONAME + _ZN14CGlxListWindowD0Ev @ 15 NONAME + _ZN14CGlxListWindowD1Ev @ 16 NONAME + _ZN14CGlxListWindowD2Ev @ 17 NONAME + _ZN18TGlxWindowIteratorC1ERKS_ @ 18 NONAME + _ZN18TGlxWindowIteratorC2ERKS_ @ 19 NONAME + _ZN18TGlxWindowIteratorppEi @ 20 NONAME + _ZN21TGlxExclusionIterator10SetToFirstEPK13MGlxMediaList @ 21 NONAME + _ZN21TGlxExclusionIteratorC1ER21MGlxMediaListIteratorS1_ @ 22 NONAME + _ZN21TGlxExclusionIteratorC2ER21MGlxMediaListIteratorS1_ @ 23 NONAME + _ZN21TGlxExclusionIteratorD1Ev @ 24 NONAME + _ZN21TGlxExclusionIteratorD2Ev @ 25 NONAME + _ZN21TGlxSelectionIterator10SetToFirstEPK13MGlxMediaList @ 26 NONAME + _ZN21TGlxSelectionIterator34SetDisabledIfMoreThanRangeSelectedEi @ 27 NONAME + _ZN21TGlxSelectionIterator8SetRangeEi @ 28 NONAME + _ZN21TGlxSelectionIteratorC1Ev @ 29 NONAME + _ZN21TGlxSelectionIteratorC2Ev @ 30 NONAME + _ZN21TGlxSelectionIteratorD1Ev @ 31 NONAME + _ZN21TGlxSelectionIteratorD2Ev @ 32 NONAME + _ZN21TGlxSelectionIteratorppEi @ 33 NONAME + _ZN22TGlxSequentialIterator8SetRangeEi @ 34 NONAME + _ZN22TGlxSequentialIteratorC1Ev @ 35 NONAME + _ZN22TGlxSequentialIteratorC2Ev @ 36 NONAME + _ZN22TGlxSpecificIdIteratorC1ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 37 NONAME + _ZN22TGlxSpecificIdIteratorC2ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 38 NONAME + _ZN25TGlxFirstThenLastIteratorC1Ev @ 39 NONAME + _ZN25TGlxFirstThenLastIteratorC2Ev @ 40 NONAME + _ZN25TGlxFirstThenLastIteratorD1Ev @ 41 NONAME + _ZN25TGlxFirstThenLastIteratorD2Ev @ 42 NONAME + _ZN28TGlxFromFocusOutwardIterator15SetRangeOffsetsEii @ 43 NONAME + _ZN28TGlxFromFocusOutwardIteratorC1Ev @ 44 NONAME + _ZN28TGlxFromFocusOutwardIteratorC2Ev @ 45 NONAME + _ZN28TGlxFromFocusOutwardIteratorD1Ev @ 46 NONAME + _ZN28TGlxFromFocusOutwardIteratorD2Ev @ 47 NONAME + _ZN33TGlxFromManualIndexBlockyIterator15SetRangeOffsetsEii @ 48 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC1Ev @ 49 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC2Ev @ 50 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD1Ev @ 51 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD2Ev @ 52 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC1Ev @ 53 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC2Ev @ 54 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD1Ev @ 55 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD2Ev @ 56 NONAME + _ZN34TGlxFromIndexOutwardBlockyIterator15SetRangeOffsetsEii @ 57 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC1ERKNS_9MGlxIndexE @ 58 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC2ERKNS_9MGlxIndexE @ 59 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD1Ev @ 60 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD2Ev @ 61 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIterator8SetIndexEi @ 62 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC1Ev @ 63 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC2Ev @ 64 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD1Ev @ 65 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD2Ev @ 66 NONAME + _ZNK14CGlxListWindow2AtEi @ 67 NONAME + _ZNK14CGlxListWindow8IteratorEv @ 68 NONAME + _ZNK21TGlxSelectionIterator7InRangeEi @ 69 NONAME + _ZTI14CGlxListWindow @ 70 NONAME ; ## + _ZTI21TGlxExclusionIterator @ 71 NONAME ; ## + _ZTI21TGlxSelectionIterator @ 72 NONAME ; ## + _ZTI22TGlxSequentialIterator @ 73 NONAME ; ## + _ZTI22TGlxSpecificIdIterator @ 74 NONAME ; ## + _ZTI25TGlxFirstThenLastIterator @ 75 NONAME ; ## + _ZTI28TGlxFromFocusOutwardIterator @ 76 NONAME ; ## + _ZTI33TGlxFromManualIndexBlockyIterator @ 77 NONAME ; ## + _ZTI34TGlxFromFocusOutwardBlockyIterator @ 78 NONAME ; ## + _ZTI34TGlxFromIndexOutwardBlockyIterator @ 79 NONAME ; ## + _ZTI40TGlxFromManualIndexOutwardBlockyIterator @ 80 NONAME ; ## + _ZTV14CGlxListWindow @ 81 NONAME ; ## + _ZTV21TGlxExclusionIterator @ 82 NONAME ; ## + _ZTV21TGlxSelectionIterator @ 83 NONAME ; ## + _ZTV22TGlxSequentialIterator @ 84 NONAME ; ## + _ZTV22TGlxSpecificIdIterator @ 85 NONAME ; ## + _ZTV25TGlxFirstThenLastIterator @ 86 NONAME ; ## + _ZTV28TGlxFromFocusOutwardIterator @ 87 NONAME ; ## + _ZTV33TGlxFromManualIndexBlockyIterator @ 88 NONAME ; ## + _ZTV34TGlxFromFocusOutwardBlockyIterator @ 89 NONAME ; ## + _ZTV34TGlxFromIndexOutwardBlockyIterator @ 90 NONAME ; ## + _ZTV40TGlxFromManualIndexOutwardBlockyIterator @ 91 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxattributecontextu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxattributecontextu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,191 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN13MGlxMediaList10UnmarkAllLERS_ @ 2 NONAME + _ZN13MGlxMediaList9InstanceLERK18CMPXCollectionPathRK6TGlxIdI19TGlxIdHierarchyBaseEP9CMPXMedia @ 3 NONAME + _ZN14CGlxListWindow10AddObjectsEii @ 4 NONAME + _ZN14CGlxListWindow10AddObjectsEiiii @ 5 NONAME + _ZN14CGlxListWindow10ConstructLEv @ 6 NONAME + _ZN14CGlxListWindow13RemoveObjectsEii @ 7 NONAME + _ZN14CGlxListWindow13RemoveObjectsEiiii @ 8 NONAME + _ZN14CGlxListWindow13SetFocusIndexEi @ 9 NONAME + _ZN14CGlxListWindow13SetFocusIndexEii @ 10 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEii @ 11 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEiiii @ 12 NONAME + _ZN14CGlxListWindow2AtEi @ 13 NONAME + _ZN14CGlxListWindow7CleanupEv @ 14 NONAME + _ZN14CGlxListWindowC1ER23MGlxWindowObjectFactory @ 15 NONAME + _ZN14CGlxListWindowC2ER23MGlxWindowObjectFactory @ 16 NONAME + _ZN14CGlxListWindowD0Ev @ 17 NONAME + _ZN14CGlxListWindowD1Ev @ 18 NONAME + _ZN14CGlxListWindowD2Ev @ 19 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediaRK13TMPXAttribute @ 20 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediai @ 21 NONAME + _ZN18TGlxWindowIteratorC1ERKS_ @ 22 NONAME + _ZN18TGlxWindowIteratorC2ERKS_ @ 23 NONAME + _ZN18TGlxWindowIteratorppEi @ 24 NONAME + _ZN19GlxThumbnailUtility15IsFullThumbnailERK13TMPXAttribute @ 25 NONAME + _ZN19GlxThumbnailUtility16ClosestThumbnailERK5TSizeRK9CGlxMediai @ 26 NONAME + _ZN20CGlxAttributeContext13AddAttributeLERK13TMPXAttribute @ 27 NONAME + _ZN20CGlxAttributeContext14AttributeCountEv @ 28 NONAME + _ZN20CGlxAttributeContext14SetGranularityEj @ 29 NONAME + _ZN20CGlxAttributeContext15RemoveAttributeERK13TMPXAttribute @ 30 NONAME + _ZN20CGlxAttributeContextC1EP21MGlxMediaListIterator @ 31 NONAME + _ZN20CGlxAttributeContextC2EP21MGlxMediaListIterator @ 32 NONAME + _ZN20CGlxAttributeContextD0Ev @ 33 NONAME + _ZN20CGlxAttributeContextD1Ev @ 34 NONAME + _ZN20CGlxAttributeContextD2Ev @ 35 NONAME + _ZN20CGlxThumbnailContext14SetDefaultSpecEii @ 36 NONAME + _ZN20CGlxThumbnailContext15AddSpecForItemLEiii @ 37 NONAME + _ZN20CGlxThumbnailContext18SetHighQualityOnlyEi @ 38 NONAME + _ZN20CGlxThumbnailContext4NewLEP21MGlxMediaListIterator @ 39 NONAME + _ZN20CGlxThumbnailContextC1EP21MGlxMediaListIterator @ 40 NONAME + _ZN20CGlxThumbnailContextC2EP21MGlxMediaListIterator @ 41 NONAME + _ZN20CGlxThumbnailContextD0Ev @ 42 NONAME + _ZN20CGlxThumbnailContextD1Ev @ 43 NONAME + _ZN20CGlxThumbnailContextD2Ev @ 44 NONAME + _ZN21TGlxExclusionIterator10SetToFirstEPK13MGlxMediaList @ 45 NONAME + _ZN21TGlxExclusionIteratorC1ER21MGlxMediaListIteratorS1_ @ 46 NONAME + _ZN21TGlxExclusionIteratorC2ER21MGlxMediaListIteratorS1_ @ 47 NONAME + _ZN21TGlxExclusionIteratorD1Ev @ 48 NONAME + _ZN21TGlxExclusionIteratorD2Ev @ 49 NONAME + _ZN21TGlxSelectionIterator10SetToFirstEPK13MGlxMediaList @ 50 NONAME + _ZN21TGlxSelectionIterator34SetDisabledIfMoreThanRangeSelectedEi @ 51 NONAME + _ZN21TGlxSelectionIterator8SetRangeEi @ 52 NONAME + _ZN21TGlxSelectionIteratorC1Ev @ 53 NONAME + _ZN21TGlxSelectionIteratorC2Ev @ 54 NONAME + _ZN21TGlxSelectionIteratorD1Ev @ 55 NONAME + _ZN21TGlxSelectionIteratorD2Ev @ 56 NONAME + _ZN21TGlxSelectionIteratorppEi @ 57 NONAME + _ZN22TGlxSequentialIterator8SetRangeEi @ 58 NONAME + _ZN22TGlxSequentialIteratorC1Ev @ 59 NONAME + _ZN22TGlxSequentialIteratorC2Ev @ 60 NONAME + _ZN22TGlxSpecificIdIteratorC1ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 61 NONAME + _ZN22TGlxSpecificIdIteratorC2ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 62 NONAME + _ZN23TGlxFetchContextRemover5CloseEv @ 63 NONAME + _ZN23TGlxFetchContextRemoverC1EP16MGlxFetchContextR13MGlxMediaList @ 64 NONAME + _ZN23TGlxFetchContextRemoverC2EP16MGlxFetchContextR13MGlxMediaList @ 65 NONAME + _ZN23TGlxFetchContextRemoverD1Ev @ 66 NONAME + _ZN23TGlxFetchContextRemoverD2Ev @ 67 NONAME + _ZN25TGlxFirstThenLastIteratorC1Ev @ 68 NONAME + _ZN25TGlxFirstThenLastIteratorC2Ev @ 69 NONAME + _ZN25TGlxFirstThenLastIteratorD1Ev @ 70 NONAME + _ZN25TGlxFirstThenLastIteratorD2Ev @ 71 NONAME + _ZN27CGlxDefaultAttributeContext15SetRangeOffsetsEii @ 72 NONAME + _ZN27CGlxDefaultAttributeContext4NewLEv @ 73 NONAME + _ZN27CGlxDefaultAttributeContextD0Ev @ 74 NONAME + _ZN27CGlxDefaultAttributeContextD1Ev @ 75 NONAME + _ZN27CGlxDefaultAttributeContextD2Ev @ 76 NONAME + _ZN27CGlxDefaultThumbnailContext15SetRangeOffsetsEii @ 77 NONAME + _ZN27CGlxDefaultThumbnailContext4NewLEv @ 78 NONAME + _ZN27CGlxDefaultThumbnailContextD0Ev @ 79 NONAME + _ZN27CGlxDefaultThumbnailContextD1Ev @ 80 NONAME + _ZN27CGlxDefaultThumbnailContextD2Ev @ 81 NONAME + _ZN28TGlxFromFocusOutwardIterator15SetRangeOffsetsEii @ 82 NONAME + _ZN28TGlxFromFocusOutwardIteratorC1Ev @ 83 NONAME + _ZN28TGlxFromFocusOutwardIteratorC2Ev @ 84 NONAME + _ZN28TGlxFromFocusOutwardIteratorD1Ev @ 85 NONAME + _ZN28TGlxFromFocusOutwardIteratorD2Ev @ 86 NONAME + _ZN33TGlxFromManualIndexBlockyIterator15SetRangeOffsetsEii @ 87 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC1Ev @ 88 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC2Ev @ 89 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD1Ev @ 90 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD2Ev @ 91 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC1Ev @ 92 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC2Ev @ 93 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD1Ev @ 94 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD2Ev @ 95 NONAME + _ZN34TGlxFromIndexOutwardBlockyIterator15SetRangeOffsetsEii @ 96 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC1ERKNS_9MGlxIndexE @ 97 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC2ERKNS_9MGlxIndexE @ 98 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD1Ev @ 99 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD2Ev @ 100 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIterator8SetIndexEi @ 101 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC1Ev @ 102 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC2Ev @ 103 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD1Ev @ 104 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD2Ev @ 105 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 106 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 107 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 108 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 109 NONAME + _ZN9CGlxMedia5ResetEv @ 110 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 111 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 112 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 113 NONAME + _ZN9CGlxMediaD0Ev @ 114 NONAME + _ZN9CGlxMediaD1Ev @ 115 NONAME + _ZN9CGlxMediaD2Ev @ 116 NONAME + _ZN9MGlxCache9InstanceLEv @ 117 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 118 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 119 NONAME + _ZNK14CGlxListWindow2AtEi @ 120 NONAME + _ZNK14CGlxListWindow8IteratorEv @ 121 NONAME + _ZNK21TGlxSelectionIterator7InRangeEi @ 122 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 123 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 124 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 125 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 126 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 127 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 128 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 129 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 130 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 131 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 132 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 133 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 134 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 135 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 136 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 137 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 138 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 139 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 140 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 141 NONAME + _ZNK9TGlxMedia3UriEv @ 142 NONAME + _ZNK9TGlxMedia5TitleEv @ 143 NONAME + _ZNK9TGlxMedia7CommentEv @ 144 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 145 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 146 NONAME + _ZNK9TGlxMedia8CategoryEv @ 147 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 148 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 149 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 150 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 151 NONAME + _ZTI13CGlxMediaList @ 152 NONAME ; ## + _ZTI14CGlxListWindow @ 153 NONAME ; ## + _ZTI16CGlxCacheManager @ 154 NONAME ; ## + _ZTI20CGlxAttributeContext @ 155 NONAME ; ## + _ZTI20CGlxGarbageCollector @ 156 NONAME ; ## + _ZTI20CGlxThumbnailContext @ 157 NONAME ; ## + _ZTI21TGlxExclusionIterator @ 158 NONAME ; ## + _ZTI21TGlxSelectionIterator @ 159 NONAME ; ## + _ZTI22TGlxSequentialIterator @ 160 NONAME ; ## + _ZTI22TGlxSpecificIdIterator @ 161 NONAME ; ## + _ZTI25TGlxFirstThenLastIterator @ 162 NONAME ; ## + _ZTI27CGlxDefaultAttributeContext @ 163 NONAME ; ## + _ZTI27CGlxDefaultThumbnailContext @ 164 NONAME ; ## + _ZTI28TGlxFromFocusOutwardIterator @ 165 NONAME ; ## + _ZTI33TGlxFromManualIndexBlockyIterator @ 166 NONAME ; ## + _ZTI34TGlxFromFocusOutwardBlockyIterator @ 167 NONAME ; ## + _ZTI34TGlxFromIndexOutwardBlockyIterator @ 168 NONAME ; ## + _ZTI40TGlxFromManualIndexOutwardBlockyIterator @ 169 NONAME ; ## + _ZTIN23UT_CGlxAttributeContext17CGlxMediaListTestE @ 170 NONAME ; ## + _ZTV13CGlxMediaList @ 171 NONAME ; ## + _ZTV14CGlxListWindow @ 172 NONAME ; ## + _ZTV16CGlxCacheManager @ 173 NONAME ; ## + _ZTV20CGlxAttributeContext @ 174 NONAME ; ## + _ZTV20CGlxGarbageCollector @ 175 NONAME ; ## + _ZTV20CGlxThumbnailContext @ 176 NONAME ; ## + _ZTV21TGlxExclusionIterator @ 177 NONAME ; ## + _ZTV21TGlxSelectionIterator @ 178 NONAME ; ## + _ZTV22TGlxSequentialIterator @ 179 NONAME ; ## + _ZTV22TGlxSpecificIdIterator @ 180 NONAME ; ## + _ZTV25TGlxFirstThenLastIterator @ 181 NONAME ; ## + _ZTV27CGlxDefaultAttributeContext @ 182 NONAME ; ## + _ZTV27CGlxDefaultThumbnailContext @ 183 NONAME ; ## + _ZTV28TGlxFromFocusOutwardIterator @ 184 NONAME ; ## + _ZTV33TGlxFromManualIndexBlockyIterator @ 185 NONAME ; ## + _ZTV34TGlxFromFocusOutwardBlockyIterator @ 186 NONAME ; ## + _ZTV34TGlxFromIndexOutwardBlockyIterator @ 187 NONAME ; ## + _ZTV40TGlxFromManualIndexOutwardBlockyIterator @ 188 NONAME ; ## + _ZTVN23UT_CGlxAttributeContext17CGlxMediaListTestE @ 189 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxitemlistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxitemlistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,51 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN19GlxThumbnailUtility15IsFullThumbnailERK13TMPXAttribute @ 2 NONAME + _ZN19GlxThumbnailUtility16ClosestThumbnailERK5TSizeRK9CGlxMediai @ 3 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 4 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 5 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 6 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 7 NONAME + _ZN9CGlxMedia5ResetEv @ 8 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 9 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 10 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 11 NONAME + _ZN9CGlxMediaD0Ev @ 12 NONAME + _ZN9CGlxMediaD1Ev @ 13 NONAME + _ZN9CGlxMediaD2Ev @ 14 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 15 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 16 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 17 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 18 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 19 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 20 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 21 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 22 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 23 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 24 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 25 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 26 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 27 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 28 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 29 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 30 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 31 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 32 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 33 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 34 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 35 NONAME + _ZNK9TGlxMedia3UriEv @ 36 NONAME + _ZNK9TGlxMedia5TitleEv @ 37 NONAME + _ZNK9TGlxMedia7CommentEv @ 38 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 39 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 40 NONAME + _ZNK9TGlxMedia8CategoryEv @ 41 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 42 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 43 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 44 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 45 NONAME + _ZTI16CGlxListTestBaseI12CGlxItemList26CGlxItemListReconstructionE @ 46 NONAME ; ## + _ZTI26CGlxListReconstructionBase @ 47 NONAME ; ## + _ZTV16CGlxListTestBaseI12CGlxItemList26CGlxItemListReconstructionE @ 48 NONAME ; ## + _ZTV26CGlxListReconstructionBase @ 49 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxmedialistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxmedialistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,191 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN13MGlxMediaList10UnmarkAllLERS_ @ 2 NONAME + _ZN13MGlxMediaList9InstanceLERK18CMPXCollectionPathRK6TGlxIdI19TGlxIdHierarchyBaseEP9CMPXMedia @ 3 NONAME + _ZN14CGlxListWindow10AddObjectsEii @ 4 NONAME + _ZN14CGlxListWindow10AddObjectsEiiii @ 5 NONAME + _ZN14CGlxListWindow10ConstructLEv @ 6 NONAME + _ZN14CGlxListWindow13RemoveObjectsEii @ 7 NONAME + _ZN14CGlxListWindow13RemoveObjectsEiiii @ 8 NONAME + _ZN14CGlxListWindow13SetFocusIndexEi @ 9 NONAME + _ZN14CGlxListWindow13SetFocusIndexEii @ 10 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEii @ 11 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEiiii @ 12 NONAME + _ZN14CGlxListWindow2AtEi @ 13 NONAME + _ZN14CGlxListWindow7CleanupEv @ 14 NONAME + _ZN14CGlxListWindowC1ER23MGlxWindowObjectFactory @ 15 NONAME + _ZN14CGlxListWindowC2ER23MGlxWindowObjectFactory @ 16 NONAME + _ZN14CGlxListWindowD0Ev @ 17 NONAME + _ZN14CGlxListWindowD1Ev @ 18 NONAME + _ZN14CGlxListWindowD2Ev @ 19 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediaRK13TMPXAttribute @ 20 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediai @ 21 NONAME + _ZN18TGlxWindowIteratorC1ERKS_ @ 22 NONAME + _ZN18TGlxWindowIteratorC2ERKS_ @ 23 NONAME + _ZN18TGlxWindowIteratorppEi @ 24 NONAME + _ZN19GlxThumbnailUtility15IsFullThumbnailERK13TMPXAttribute @ 25 NONAME + _ZN19GlxThumbnailUtility16ClosestThumbnailERK5TSizeRK9CGlxMediai @ 26 NONAME + _ZN20CGlxAttributeContext13AddAttributeLERK13TMPXAttribute @ 27 NONAME + _ZN20CGlxAttributeContext14AttributeCountEv @ 28 NONAME + _ZN20CGlxAttributeContext14SetGranularityEj @ 29 NONAME + _ZN20CGlxAttributeContext15RemoveAttributeERK13TMPXAttribute @ 30 NONAME + _ZN20CGlxAttributeContextC1EP21MGlxMediaListIterator @ 31 NONAME + _ZN20CGlxAttributeContextC2EP21MGlxMediaListIterator @ 32 NONAME + _ZN20CGlxAttributeContextD0Ev @ 33 NONAME + _ZN20CGlxAttributeContextD1Ev @ 34 NONAME + _ZN20CGlxAttributeContextD2Ev @ 35 NONAME + _ZN20CGlxThumbnailContext14SetDefaultSpecEii @ 36 NONAME + _ZN20CGlxThumbnailContext15AddSpecForItemLEiii @ 37 NONAME + _ZN20CGlxThumbnailContext18SetHighQualityOnlyEi @ 38 NONAME + _ZN20CGlxThumbnailContext4NewLEP21MGlxMediaListIterator @ 39 NONAME + _ZN20CGlxThumbnailContextC1EP21MGlxMediaListIterator @ 40 NONAME + _ZN20CGlxThumbnailContextC2EP21MGlxMediaListIterator @ 41 NONAME + _ZN20CGlxThumbnailContextD0Ev @ 42 NONAME + _ZN20CGlxThumbnailContextD1Ev @ 43 NONAME + _ZN20CGlxThumbnailContextD2Ev @ 44 NONAME + _ZN21TGlxExclusionIterator10SetToFirstEPK13MGlxMediaList @ 45 NONAME + _ZN21TGlxExclusionIteratorC1ER21MGlxMediaListIteratorS1_ @ 46 NONAME + _ZN21TGlxExclusionIteratorC2ER21MGlxMediaListIteratorS1_ @ 47 NONAME + _ZN21TGlxExclusionIteratorD1Ev @ 48 NONAME + _ZN21TGlxExclusionIteratorD2Ev @ 49 NONAME + _ZN21TGlxSelectionIterator10SetToFirstEPK13MGlxMediaList @ 50 NONAME + _ZN21TGlxSelectionIterator34SetDisabledIfMoreThanRangeSelectedEi @ 51 NONAME + _ZN21TGlxSelectionIterator8SetRangeEi @ 52 NONAME + _ZN21TGlxSelectionIteratorC1Ev @ 53 NONAME + _ZN21TGlxSelectionIteratorC2Ev @ 54 NONAME + _ZN21TGlxSelectionIteratorD1Ev @ 55 NONAME + _ZN21TGlxSelectionIteratorD2Ev @ 56 NONAME + _ZN21TGlxSelectionIteratorppEi @ 57 NONAME + _ZN22TGlxSequentialIterator8SetRangeEi @ 58 NONAME + _ZN22TGlxSequentialIteratorC1Ev @ 59 NONAME + _ZN22TGlxSequentialIteratorC2Ev @ 60 NONAME + _ZN22TGlxSpecificIdIteratorC1ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 61 NONAME + _ZN22TGlxSpecificIdIteratorC2ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 62 NONAME + _ZN23TGlxFetchContextRemover5CloseEv @ 63 NONAME + _ZN23TGlxFetchContextRemoverC1EP16MGlxFetchContextR13MGlxMediaList @ 64 NONAME + _ZN23TGlxFetchContextRemoverC2EP16MGlxFetchContextR13MGlxMediaList @ 65 NONAME + _ZN23TGlxFetchContextRemoverD1Ev @ 66 NONAME + _ZN23TGlxFetchContextRemoverD2Ev @ 67 NONAME + _ZN25TGlxFirstThenLastIteratorC1Ev @ 68 NONAME + _ZN25TGlxFirstThenLastIteratorC2Ev @ 69 NONAME + _ZN25TGlxFirstThenLastIteratorD1Ev @ 70 NONAME + _ZN25TGlxFirstThenLastIteratorD2Ev @ 71 NONAME + _ZN27CGlxDefaultAttributeContext15SetRangeOffsetsEii @ 72 NONAME + _ZN27CGlxDefaultAttributeContext4NewLEv @ 73 NONAME + _ZN27CGlxDefaultAttributeContextD0Ev @ 74 NONAME + _ZN27CGlxDefaultAttributeContextD1Ev @ 75 NONAME + _ZN27CGlxDefaultAttributeContextD2Ev @ 76 NONAME + _ZN27CGlxDefaultThumbnailContext15SetRangeOffsetsEii @ 77 NONAME + _ZN27CGlxDefaultThumbnailContext4NewLEv @ 78 NONAME + _ZN27CGlxDefaultThumbnailContextD0Ev @ 79 NONAME + _ZN27CGlxDefaultThumbnailContextD1Ev @ 80 NONAME + _ZN27CGlxDefaultThumbnailContextD2Ev @ 81 NONAME + _ZN28TGlxFromFocusOutwardIterator15SetRangeOffsetsEii @ 82 NONAME + _ZN28TGlxFromFocusOutwardIteratorC1Ev @ 83 NONAME + _ZN28TGlxFromFocusOutwardIteratorC2Ev @ 84 NONAME + _ZN28TGlxFromFocusOutwardIteratorD1Ev @ 85 NONAME + _ZN28TGlxFromFocusOutwardIteratorD2Ev @ 86 NONAME + _ZN33TGlxFromManualIndexBlockyIterator15SetRangeOffsetsEii @ 87 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC1Ev @ 88 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC2Ev @ 89 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD1Ev @ 90 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD2Ev @ 91 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC1Ev @ 92 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC2Ev @ 93 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD1Ev @ 94 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD2Ev @ 95 NONAME + _ZN34TGlxFromIndexOutwardBlockyIterator15SetRangeOffsetsEii @ 96 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC1ERKNS_9MGlxIndexE @ 97 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC2ERKNS_9MGlxIndexE @ 98 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD1Ev @ 99 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD2Ev @ 100 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIterator8SetIndexEi @ 101 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC1Ev @ 102 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC2Ev @ 103 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD1Ev @ 104 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD2Ev @ 105 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 106 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 107 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 108 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 109 NONAME + _ZN9CGlxMedia5ResetEv @ 110 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 111 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 112 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 113 NONAME + _ZN9CGlxMediaD0Ev @ 114 NONAME + _ZN9CGlxMediaD1Ev @ 115 NONAME + _ZN9CGlxMediaD2Ev @ 116 NONAME + _ZN9MGlxCache9InstanceLEv @ 117 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 118 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 119 NONAME + _ZNK14CGlxListWindow2AtEi @ 120 NONAME + _ZNK14CGlxListWindow8IteratorEv @ 121 NONAME + _ZNK21TGlxSelectionIterator7InRangeEi @ 122 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 123 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 124 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 125 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 126 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 127 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 128 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 129 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 130 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 131 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 132 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 133 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 134 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 135 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 136 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 137 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 138 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 139 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 140 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 141 NONAME + _ZNK9TGlxMedia3UriEv @ 142 NONAME + _ZNK9TGlxMedia5TitleEv @ 143 NONAME + _ZNK9TGlxMedia7CommentEv @ 144 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 145 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 146 NONAME + _ZNK9TGlxMedia8CategoryEv @ 147 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 148 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 149 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 150 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 151 NONAME + _ZTI13CGlxMediaList @ 152 NONAME ; ## + _ZTI14CGlxListWindow @ 153 NONAME ; ## + _ZTI16CGlxCacheManager @ 154 NONAME ; ## + _ZTI20CGlxAttributeContext @ 155 NONAME ; ## + _ZTI20CGlxGarbageCollector @ 156 NONAME ; ## + _ZTI20CGlxThumbnailContext @ 157 NONAME ; ## + _ZTI21TGlxExclusionIterator @ 158 NONAME ; ## + _ZTI21TGlxSelectionIterator @ 159 NONAME ; ## + _ZTI22TGlxSequentialIterator @ 160 NONAME ; ## + _ZTI22TGlxSpecificIdIterator @ 161 NONAME ; ## + _ZTI25TGlxFirstThenLastIterator @ 162 NONAME ; ## + _ZTI27CGlxDefaultAttributeContext @ 163 NONAME ; ## + _ZTI27CGlxDefaultThumbnailContext @ 164 NONAME ; ## + _ZTI28TGlxFromFocusOutwardIterator @ 165 NONAME ; ## + _ZTI33TGlxFromManualIndexBlockyIterator @ 166 NONAME ; ## + _ZTI34TGlxFromFocusOutwardBlockyIterator @ 167 NONAME ; ## + _ZTI34TGlxFromIndexOutwardBlockyIterator @ 168 NONAME ; ## + _ZTI40TGlxFromManualIndexOutwardBlockyIterator @ 169 NONAME ; ## + _ZTIN16UT_CGlxMediaList25CGlxMediaListObserverTestE @ 170 NONAME ; ## + _ZTV13CGlxMediaList @ 171 NONAME ; ## + _ZTV14CGlxListWindow @ 172 NONAME ; ## + _ZTV16CGlxCacheManager @ 173 NONAME ; ## + _ZTV20CGlxAttributeContext @ 174 NONAME ; ## + _ZTV20CGlxGarbageCollector @ 175 NONAME ; ## + _ZTV20CGlxThumbnailContext @ 176 NONAME ; ## + _ZTV21TGlxExclusionIterator @ 177 NONAME ; ## + _ZTV21TGlxSelectionIterator @ 178 NONAME ; ## + _ZTV22TGlxSequentialIterator @ 179 NONAME ; ## + _ZTV22TGlxSpecificIdIterator @ 180 NONAME ; ## + _ZTV25TGlxFirstThenLastIterator @ 181 NONAME ; ## + _ZTV27CGlxDefaultAttributeContext @ 182 NONAME ; ## + _ZTV27CGlxDefaultThumbnailContext @ 183 NONAME ; ## + _ZTV28TGlxFromFocusOutwardIterator @ 184 NONAME ; ## + _ZTV33TGlxFromManualIndexBlockyIterator @ 185 NONAME ; ## + _ZTV34TGlxFromFocusOutwardBlockyIterator @ 186 NONAME ; ## + _ZTV34TGlxFromIndexOutwardBlockyIterator @ 187 NONAME ; ## + _ZTV40TGlxFromManualIndexOutwardBlockyIterator @ 188 NONAME ; ## + _ZTVN16UT_CGlxMediaList25CGlxMediaListObserverTestE @ 189 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxnavigablelistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxnavigablelistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,51 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN19GlxThumbnailUtility15IsFullThumbnailERK13TMPXAttribute @ 2 NONAME + _ZN19GlxThumbnailUtility16ClosestThumbnailERK5TSizeRK9CGlxMediai @ 3 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 4 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 5 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 6 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 7 NONAME + _ZN9CGlxMedia5ResetEv @ 8 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 9 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 10 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 11 NONAME + _ZN9CGlxMediaD0Ev @ 12 NONAME + _ZN9CGlxMediaD1Ev @ 13 NONAME + _ZN9CGlxMediaD2Ev @ 14 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 15 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 16 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 17 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 18 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 19 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 20 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 21 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 22 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 23 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 24 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 25 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 26 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 27 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 28 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 29 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 30 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 31 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 32 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 33 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 34 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 35 NONAME + _ZNK9TGlxMedia3UriEv @ 36 NONAME + _ZNK9TGlxMedia5TitleEv @ 37 NONAME + _ZNK9TGlxMedia7CommentEv @ 38 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 39 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 40 NONAME + _ZNK9TGlxMedia8CategoryEv @ 41 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 42 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 43 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 44 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 45 NONAME + _ZTI16CGlxListTestBaseI17CGlxNavigableList31CGlxNavigableListReconstructionE @ 46 NONAME ; ## + _ZTI26CGlxListReconstructionBase @ 47 NONAME ; ## + _ZTV16CGlxListTestBaseI17CGlxNavigableList31CGlxNavigableListReconstructionE @ 48 NONAME ; ## + _ZTV26CGlxListReconstructionBase @ 49 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxstaticitemlistu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_cglxstaticitemlistu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,51 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN19GlxThumbnailUtility15IsFullThumbnailERK13TMPXAttribute @ 2 NONAME + _ZN19GlxThumbnailUtility16ClosestThumbnailERK5TSizeRK9CGlxMediai @ 3 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 4 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 5 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 6 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 7 NONAME + _ZN9CGlxMedia5ResetEv @ 8 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 9 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 10 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 11 NONAME + _ZN9CGlxMediaD0Ev @ 12 NONAME + _ZN9CGlxMediaD1Ev @ 13 NONAME + _ZN9CGlxMediaD2Ev @ 14 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 15 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 16 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 17 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 18 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 19 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 20 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 21 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 22 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 23 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 24 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 25 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 26 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 27 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 28 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 29 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 30 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 31 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 32 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 33 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 34 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 35 NONAME + _ZNK9TGlxMedia3UriEv @ 36 NONAME + _ZNK9TGlxMedia5TitleEv @ 37 NONAME + _ZNK9TGlxMedia7CommentEv @ 38 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 39 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 40 NONAME + _ZNK9TGlxMedia8CategoryEv @ 41 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 42 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 43 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 44 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 45 NONAME + _ZTI16CGlxListTestBaseI18CGlxStaticItemList32CGlxStaticItemListReconstructionE @ 46 NONAME ; ## + _ZTI26CGlxListReconstructionBase @ 47 NONAME ; ## + _ZTV16CGlxListTestBaseI18CGlxStaticItemList32CGlxStaticItemListReconstructionE @ 48 NONAME ; ## + _ZTV26CGlxListReconstructionBase @ 49 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_glxerrormanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_glxerrormanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,189 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME + _ZN13MGlxMediaList10UnmarkAllLERS_ @ 2 NONAME + _ZN13MGlxMediaList9InstanceLERK18CMPXCollectionPathRK6TGlxIdI19TGlxIdHierarchyBaseEP9CMPXMedia @ 3 NONAME + _ZN14CGlxListWindow10AddObjectsEii @ 4 NONAME + _ZN14CGlxListWindow10AddObjectsEiiii @ 5 NONAME + _ZN14CGlxListWindow10ConstructLEv @ 6 NONAME + _ZN14CGlxListWindow13RemoveObjectsEii @ 7 NONAME + _ZN14CGlxListWindow13RemoveObjectsEiiii @ 8 NONAME + _ZN14CGlxListWindow13SetFocusIndexEi @ 9 NONAME + _ZN14CGlxListWindow13SetFocusIndexEii @ 10 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEii @ 11 NONAME + _ZN14CGlxListWindow16SetRangeOffsetsLEiiii @ 12 NONAME + _ZN14CGlxListWindow2AtEi @ 13 NONAME + _ZN14CGlxListWindow7CleanupEv @ 14 NONAME + _ZN14CGlxListWindowC1ER23MGlxWindowObjectFactory @ 15 NONAME + _ZN14CGlxListWindowC2ER23MGlxWindowObjectFactory @ 16 NONAME + _ZN14CGlxListWindowD0Ev @ 17 NONAME + _ZN14CGlxListWindowD1Ev @ 18 NONAME + _ZN14CGlxListWindowD2Ev @ 19 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediaRK13TMPXAttribute @ 20 NONAME + _ZN15GlxErrorManager18HasAttributeErrorLEPK9CGlxMediai @ 21 NONAME + _ZN18TGlxWindowIteratorC1ERKS_ @ 22 NONAME + _ZN18TGlxWindowIteratorC2ERKS_ @ 23 NONAME + _ZN18TGlxWindowIteratorppEi @ 24 NONAME + _ZN19GlxThumbnailUtility15IsFullThumbnailERK13TMPXAttribute @ 25 NONAME + _ZN19GlxThumbnailUtility16ClosestThumbnailERK5TSizeRK9CGlxMediai @ 26 NONAME + _ZN20CGlxAttributeContext13AddAttributeLERK13TMPXAttribute @ 27 NONAME + _ZN20CGlxAttributeContext14AttributeCountEv @ 28 NONAME + _ZN20CGlxAttributeContext14SetGranularityEj @ 29 NONAME + _ZN20CGlxAttributeContext15RemoveAttributeERK13TMPXAttribute @ 30 NONAME + _ZN20CGlxAttributeContextC1EP21MGlxMediaListIterator @ 31 NONAME + _ZN20CGlxAttributeContextC2EP21MGlxMediaListIterator @ 32 NONAME + _ZN20CGlxAttributeContextD0Ev @ 33 NONAME + _ZN20CGlxAttributeContextD1Ev @ 34 NONAME + _ZN20CGlxAttributeContextD2Ev @ 35 NONAME + _ZN20CGlxThumbnailContext14SetDefaultSpecEii @ 36 NONAME + _ZN20CGlxThumbnailContext15AddSpecForItemLEiii @ 37 NONAME + _ZN20CGlxThumbnailContext18SetHighQualityOnlyEi @ 38 NONAME + _ZN20CGlxThumbnailContext4NewLEP21MGlxMediaListIterator @ 39 NONAME + _ZN20CGlxThumbnailContextC1EP21MGlxMediaListIterator @ 40 NONAME + _ZN20CGlxThumbnailContextC2EP21MGlxMediaListIterator @ 41 NONAME + _ZN20CGlxThumbnailContextD0Ev @ 42 NONAME + _ZN20CGlxThumbnailContextD1Ev @ 43 NONAME + _ZN20CGlxThumbnailContextD2Ev @ 44 NONAME + _ZN21TGlxExclusionIterator10SetToFirstEPK13MGlxMediaList @ 45 NONAME + _ZN21TGlxExclusionIteratorC1ER21MGlxMediaListIteratorS1_ @ 46 NONAME + _ZN21TGlxExclusionIteratorC2ER21MGlxMediaListIteratorS1_ @ 47 NONAME + _ZN21TGlxExclusionIteratorD1Ev @ 48 NONAME + _ZN21TGlxExclusionIteratorD2Ev @ 49 NONAME + _ZN21TGlxSelectionIterator10SetToFirstEPK13MGlxMediaList @ 50 NONAME + _ZN21TGlxSelectionIterator34SetDisabledIfMoreThanRangeSelectedEi @ 51 NONAME + _ZN21TGlxSelectionIterator8SetRangeEi @ 52 NONAME + _ZN21TGlxSelectionIteratorC1Ev @ 53 NONAME + _ZN21TGlxSelectionIteratorC2Ev @ 54 NONAME + _ZN21TGlxSelectionIteratorD1Ev @ 55 NONAME + _ZN21TGlxSelectionIteratorD2Ev @ 56 NONAME + _ZN21TGlxSelectionIteratorppEi @ 57 NONAME + _ZN22TGlxSequentialIterator8SetRangeEi @ 58 NONAME + _ZN22TGlxSequentialIteratorC1Ev @ 59 NONAME + _ZN22TGlxSequentialIteratorC2Ev @ 60 NONAME + _ZN22TGlxSpecificIdIteratorC1ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 61 NONAME + _ZN22TGlxSpecificIdIteratorC2ERK6TGlxIdI17TGlxIdSpaceIdBaseE11TGlxMediaId @ 62 NONAME + _ZN23TGlxFetchContextRemover5CloseEv @ 63 NONAME + _ZN23TGlxFetchContextRemoverC1EP16MGlxFetchContextR13MGlxMediaList @ 64 NONAME + _ZN23TGlxFetchContextRemoverC2EP16MGlxFetchContextR13MGlxMediaList @ 65 NONAME + _ZN23TGlxFetchContextRemoverD1Ev @ 66 NONAME + _ZN23TGlxFetchContextRemoverD2Ev @ 67 NONAME + _ZN25TGlxFirstThenLastIteratorC1Ev @ 68 NONAME + _ZN25TGlxFirstThenLastIteratorC2Ev @ 69 NONAME + _ZN25TGlxFirstThenLastIteratorD1Ev @ 70 NONAME + _ZN25TGlxFirstThenLastIteratorD2Ev @ 71 NONAME + _ZN27CGlxDefaultAttributeContext15SetRangeOffsetsEii @ 72 NONAME + _ZN27CGlxDefaultAttributeContext4NewLEv @ 73 NONAME + _ZN27CGlxDefaultAttributeContextD0Ev @ 74 NONAME + _ZN27CGlxDefaultAttributeContextD1Ev @ 75 NONAME + _ZN27CGlxDefaultAttributeContextD2Ev @ 76 NONAME + _ZN27CGlxDefaultThumbnailContext15SetRangeOffsetsEii @ 77 NONAME + _ZN27CGlxDefaultThumbnailContext4NewLEv @ 78 NONAME + _ZN27CGlxDefaultThumbnailContextD0Ev @ 79 NONAME + _ZN27CGlxDefaultThumbnailContextD1Ev @ 80 NONAME + _ZN27CGlxDefaultThumbnailContextD2Ev @ 81 NONAME + _ZN28TGlxFromFocusOutwardIterator15SetRangeOffsetsEii @ 82 NONAME + _ZN28TGlxFromFocusOutwardIteratorC1Ev @ 83 NONAME + _ZN28TGlxFromFocusOutwardIteratorC2Ev @ 84 NONAME + _ZN28TGlxFromFocusOutwardIteratorD1Ev @ 85 NONAME + _ZN28TGlxFromFocusOutwardIteratorD2Ev @ 86 NONAME + _ZN33TGlxFromManualIndexBlockyIterator15SetRangeOffsetsEii @ 87 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC1Ev @ 88 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorC2Ev @ 89 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD1Ev @ 90 NONAME + _ZN33TGlxFromManualIndexBlockyIteratorD2Ev @ 91 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC1Ev @ 92 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorC2Ev @ 93 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD1Ev @ 94 NONAME + _ZN34TGlxFromFocusOutwardBlockyIteratorD2Ev @ 95 NONAME + _ZN34TGlxFromIndexOutwardBlockyIterator15SetRangeOffsetsEii @ 96 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC1ERKNS_9MGlxIndexE @ 97 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorC2ERKNS_9MGlxIndexE @ 98 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD1Ev @ 99 NONAME + _ZN34TGlxFromIndexOutwardBlockyIteratorD2Ev @ 100 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIterator8SetIndexEi @ 101 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC1Ev @ 102 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorC2Ev @ 103 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD1Ev @ 104 NONAME + _ZN40TGlxFromManualIndexOutwardBlockyIteratorD2Ev @ 105 NONAME + _ZN9CGlxMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 106 NONAME + _ZN9CGlxMedia14HandleModifiedERK6RArrayI13TMPXAttributeE @ 107 NONAME + _ZN9CGlxMedia15DeleteAttributeERK13TMPXAttribute @ 108 NONAME + _ZN9CGlxMedia16SetCObjectValueLERK13TMPXAttributeP5CBase @ 109 NONAME + _ZN9CGlxMedia5ResetEv @ 110 NONAME + _ZN9CGlxMedia9SetValueLERK13TMPXAttributePv17TMPXAttributeType @ 111 NONAME + _ZN9CGlxMediaC1ERK11TGlxMediaId @ 112 NONAME + _ZN9CGlxMediaC2ERK11TGlxMediaId @ 113 NONAME + _ZN9CGlxMediaD0Ev @ 114 NONAME + _ZN9CGlxMediaD1Ev @ 115 NONAME + _ZN9CGlxMediaD2Ev @ 116 NONAME + _ZN9MGlxCache9InstanceLEv @ 117 NONAME + _ZN9TGlxMedia23DeleteLocationAttributeEv @ 118 NONAME + _ZN9TGlxMedia9MatchByIdERKS_S1_ @ 119 NONAME + _ZNK14CGlxListWindow2AtEi @ 120 NONAME + _ZNK14CGlxListWindow8IteratorEv @ 121 NONAME + _ZNK21TGlxSelectionIterator7InRangeEi @ 122 NONAME + _ZNK9CGlxMedia12GetValueTextER7TPtrC16RK13TMPXAttribute @ 123 NONAME + _ZNK9CGlxMedia12ValueCObjectERK13TMPXAttribute @ 124 NONAME + _ZNK9CGlxMedia9ValueTextERK13TMPXAttribute @ 125 NONAME + _ZNK9TGlxMedia11GetDurationERf @ 126 NONAME + _ZNK9TGlxMedia11GetIconInfoER9TIconInfo @ 127 NONAME + _ZNK9TGlxMedia13GetCoordinateER11TCoordinate @ 128 NONAME + _ZNK9TGlxMedia13GetDimensionsER5TSize @ 129 NONAME + _ZNK9TGlxMedia13GetFrameCountERi @ 130 NONAME + _ZNK9TGlxMedia13GetSystemItemERi @ 131 NONAME + _ZNK9TGlxMedia14GetDrmValidityER30TGlxMediaGeneralRightsValidity @ 132 NONAME + _ZNK9TGlxMedia14IsDrmProtectedEv @ 133 NONAME + _ZNK9TGlxMedia15GetDrmProtectedERi @ 134 NONAME + _ZNK9TGlxMedia18ThumbnailAttributeER13TMPXAttribute @ 135 NONAME + _ZNK9TGlxMedia19GetClosestThumbnailER13TMPXAttributeRK5TSizei @ 136 NONAME + _ZNK9TGlxMedia19GetLastModifiedDateER5TTime @ 137 NONAME + _ZNK9TGlxMedia20GetStaticItemCommandERi @ 138 NONAME + _ZNK9TGlxMedia21GetContainedItemCountERi @ 139 NONAME + _ZNK9TGlxMedia26IsSlideShowPlayableContentEv @ 140 NONAME + _ZNK9TGlxMedia38GetSlideshowPlayableContainedItemCountERi @ 141 NONAME + _ZNK9TGlxMedia3UriEv @ 142 NONAME + _ZNK9TGlxMedia5TitleEv @ 143 NONAME + _ZNK9TGlxMedia7CommentEv @ 144 NONAME + _ZNK9TGlxMedia7GetDateER5TTime @ 145 NONAME + _ZNK9TGlxMedia7GetSizeERi @ 146 NONAME + _ZNK9TGlxMedia8CategoryEv @ 147 NONAME + _ZNK9TGlxMedia8IsStaticEv @ 148 NONAME + _ZNK9TGlxMedia8MimeTypeEv @ 149 NONAME + _ZNK9TGlxMedia8SubTitleEv @ 150 NONAME + _ZNK9TGlxMedia9IdSpaceIdEv @ 151 NONAME + _ZTI13CGlxMediaList @ 152 NONAME ; ## + _ZTI14CGlxListWindow @ 153 NONAME ; ## + _ZTI16CGlxCacheManager @ 154 NONAME ; ## + _ZTI20CGlxAttributeContext @ 155 NONAME ; ## + _ZTI20CGlxGarbageCollector @ 156 NONAME ; ## + _ZTI20CGlxThumbnailContext @ 157 NONAME ; ## + _ZTI21TGlxExclusionIterator @ 158 NONAME ; ## + _ZTI21TGlxSelectionIterator @ 159 NONAME ; ## + _ZTI22TGlxSequentialIterator @ 160 NONAME ; ## + _ZTI22TGlxSpecificIdIterator @ 161 NONAME ; ## + _ZTI25TGlxFirstThenLastIterator @ 162 NONAME ; ## + _ZTI27CGlxDefaultAttributeContext @ 163 NONAME ; ## + _ZTI27CGlxDefaultThumbnailContext @ 164 NONAME ; ## + _ZTI28TGlxFromFocusOutwardIterator @ 165 NONAME ; ## + _ZTI33TGlxFromManualIndexBlockyIterator @ 166 NONAME ; ## + _ZTI34TGlxFromFocusOutwardBlockyIterator @ 167 NONAME ; ## + _ZTI34TGlxFromIndexOutwardBlockyIterator @ 168 NONAME ; ## + _ZTI40TGlxFromManualIndexOutwardBlockyIterator @ 169 NONAME ; ## + _ZTV13CGlxMediaList @ 170 NONAME ; ## + _ZTV14CGlxListWindow @ 171 NONAME ; ## + _ZTV16CGlxCacheManager @ 172 NONAME ; ## + _ZTV20CGlxAttributeContext @ 173 NONAME ; ## + _ZTV20CGlxGarbageCollector @ 174 NONAME ; ## + _ZTV20CGlxThumbnailContext @ 175 NONAME ; ## + _ZTV21TGlxExclusionIterator @ 176 NONAME ; ## + _ZTV21TGlxSelectionIterator @ 177 NONAME ; ## + _ZTV22TGlxSequentialIterator @ 178 NONAME ; ## + _ZTV22TGlxSpecificIdIterator @ 179 NONAME ; ## + _ZTV25TGlxFirstThenLastIterator @ 180 NONAME ; ## + _ZTV27CGlxDefaultAttributeContext @ 181 NONAME ; ## + _ZTV27CGlxDefaultThumbnailContext @ 182 NONAME ; ## + _ZTV28TGlxFromFocusOutwardIterator @ 183 NONAME ; ## + _ZTV33TGlxFromManualIndexBlockyIterator @ 184 NONAME ; ## + _ZTV34TGlxFromFocusOutwardBlockyIterator @ 185 NONAME ; ## + _ZTV34TGlxFromIndexOutwardBlockyIterator @ 186 NONAME ; ## + _ZTV40TGlxFromManualIndexOutwardBlockyIterator @ 187 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_glxlistwindowu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_glxlistwindowu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/eabi/ut_tglxselectioniteratoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/eabi/ut_tglxselectioniteratoru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2 @@ +EXPORTS + _Z16CreateTestSuiteLv @ 1 NONAME diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxcollectionpluginbase. +* +*/ + + + + +#include + +PRJ_TESTEXPORTS + +PRJ_TESTMMPFILES +t_glxlistwindow.mmp +t_cglxmedia.mmp +t_cglxgarbagecollector.mmp +t_cglxfetcherrorarray.mmp +t_cglxcache.mmp +ut_cglxnavigablelist.mmp +ut_cglxstaticitemlist.mmp +ut_cglxitemlist.mmp +ut_cglxattributecontext.mmp +//ut_cglxmedialist.mmp +ut_glxerrormanager.mmp +t_glxfromfocusoutwarditerator.mmp +//ut_tglxselectioniterator.mmp +t_tglxexclusioniterator.mmp + +PRJ_MMPFILES +../../group/glxmedialists.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/t_cglxcache.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/t_cglxcache.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCache unit test project file +* +*/ + + +#include + +TARGET t_cglxcache.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +MACRO USE_S60_TNM +#define USE_S60_TNM + +SOURCEPATH ../t_cglxcache +SOURCE t_cglxcache_dllmain.cpp +SOURCE t_cglxcache.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxcache.cpp + +SOURCE glxcachemanager.cpp +SOURCE glxerrormanager.cpp +SOURCE glxfetcherror.cpp +SOURCE glxfetcherrorarray.cpp +SOURCE glxgarbagecollector.cpp +SOURCE glxitemlist.cpp +SOURCE glxlistutils.cpp +SOURCE glxmedia.cpp +SOURCE glxmedialist.cpp +SOURCE glxnavigablelist.cpp +SOURCE glxstaticitemlist.cpp +SOURCE glxmedialistarray.cpp +SOURCE glximagereader.cpp + +USERINCLUDE ../t_cglxcache + +// User include folders required by the tested code +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../gallery/inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY fbscli.lib +LIBRARY lbs.lib + +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib + +LIBRARY glxcommonui.lib +LIBRARY glxcommon.lib +LIBRARY glxmedialists.lib +LIBRARY glxlogging.lib +LIBRARY hal.lib // HAL +LIBRARY featmgr.lib // Feature Manager +LIBRARY efsrv.lib +LIBRARY apgrfx.lib // For ImageViewer mime type extraction +LIBRARY apmime.lib // For ImageViewer mime type extraction +LIBRARY imageconversion.lib // icl decoder +LIBRARY glximageviewermanager.lib +LIBRARY caf.lib +LIBRARY cafutils.lib +LIBRARY cone.lib // MCoeView + +#ifdef USE_S60_TNM +LIBRARY thumbnailmanager.lib +LIBRARY bitgdi.lib +#endif + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/t_cglxfetcherrorarray.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/t_cglxfetcherrorarray.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxFetchErrorArray unit test project file +* +*/ + + +#include + +TARGET t_cglxfetcherrorarray.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +SOURCEPATH ../t_cglxfetcherrorarray +SOURCE t_cglxfetcherrorarray_dllmain.cpp +SOURCE t_cglxfetcherrorarray.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxfetcherrorarray.cpp +SOURCE glxfetcherror.cpp + +USERINCLUDE ../t_cglxfetcherrorarray + +// User include folders required by the tested code +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SYSTEMINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +LIBRARY mpxcommon.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/t_cglxgarbagecollector.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/t_cglxgarbagecollector.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxGarbageCollector unit test project file +* +*/ + + +#include + +TARGET t_cglxgarbagecollector.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +MACRO USE_S60_TNM +#define USE_S60_TNM +SOURCEPATH ../t_cglxgarbagecollector +SOURCE t_cglxgarbagecollector_dllmain.cpp +SOURCE t_cglxgarbagecollector.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxgarbagecollector.cpp + +SOURCE glxcache.cpp +SOURCE glxcachemanager.cpp +SOURCE glxerrormanager.cpp +SOURCE glxfetcherror.cpp +SOURCE glxfetcherrorarray.cpp +SOURCE glxitemlist.cpp +SOURCE glxlistutils.cpp +SOURCE glxmedia.cpp +SOURCE glxmedialist.cpp +SOURCE glxnavigablelist.cpp +SOURCE glxstaticitemlist.cpp +SOURCE glxmedialistarray.cpp +SOURCE glximagereader.cpp + +USERINCLUDE ../t_cglxgarbagecollector + +// User include folders required by the tested code +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../gallery/inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY charconv.lib // CnvUtfConverter::ConvertFromUnicodeToUtf8L +LIBRARY commonengine.lib // String Loader +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY eikctl.lib // for eik controls +LIBRARY fbscli.lib +LIBRARY glxdrmutility.lib // CGlxDrmUtility +LIBRARY lbs.lib + +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib + +LIBRARY glxcommonui.lib +LIBRARY glxcommon.lib // for CGlxSingetonStore +LIBRARY glxmedialists.lib +LIBRARY glxlogging.lib +LIBRARY hal.lib +LIBRARY featmgr.lib // Feature Manager +LIBRARY efsrv.lib +LIBRARY apgrfx.lib // For ImageViewer mime type extraction +LIBRARY apmime.lib // For ImageViewer mime type extraction +LIBRARY imageconversion.lib // icl decoder +LIBRARY glximageviewermanager.lib +LIBRARY caf.lib +LIBRARY cafutils.lib +LIBRARY cone.lib // MCoeView + +#ifdef USE_S60_TNM +LIBRARY thumbnailmanager.lib +LIBRARY bitgdi.lib +#endif + +EXPORTUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/t_cglxmedia.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/t_cglxmedia.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCache unit test project file +* +*/ + + +#include + +TARGET t_cglxmedia.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../t_cglxmedia +SOURCE t_cglxmedia_dllmain.cpp +SOURCE t_cglxmedia.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxmedia.cpp + +USERINCLUDE ../t_cglxmedia + +// User include folders required by the tested code +USERINCLUDE ../inc +USERINCLUDE ../../inc + +SYSTEMINCLUDE ../../../../inc + + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY lbs.lib + +LIBRARY mpxcommon.lib + +LIBRARY glxmedialists.lib +LIBRARY glxlogging.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/t_glxfromfocusoutwarditerator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/t_glxfromfocusoutwarditerator.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TGlxFromFocusOutwardItemOrder unit test project file +* +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_glxfromfocusoutwarditerator.dll +TARGETTYPE dll +TARGETPATH /DigiaEUnit/Tests +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../t_glxfromfocusoutwarditerator +SOURCE t_glxfromfocusoutwarditeratordllmain.cpp +SOURCE t_glxfromfocusoutwarditerator.cpp + +USERINCLUDE ../t_glxfromfocusoutwarditerator +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../../inc +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY glxmedialists.lib +LIBRARY lbs.lib // TCoordinate + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/t_glxlistwindow.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/t_glxlistwindow.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_glxlistwindow.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../t_glxlistwindow +SOURCE t_glxlistwindow.cpp +SOURCE t_glxlistwindow_dllmain.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxlistwindow.cpp +SOURCE glxlistutils.cpp + +USERINCLUDE ../t_glxlistwindow + +// User include folders required by the tested code +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE + + +// System include folders required by the tested code +SYSTEMINCLUDE ../../../../inc + +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY featmgr.lib // Feature Manager + +// Libraries required by the tested code + +EXPORTUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/t_tglxexclusioniterator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/t_tglxexclusioniterator.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing glxexclusioniterator +* +*/ + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET t_tglxexclusioniterator.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +// Sources required by the test suite +SOURCEPATH ../t_tglxexclusioniterator +SOURCE t_tglxexclusioniterator.cpp +SOURCE t_tglxexclusioniterator_DllMain.cpp +SOURCEPATH ../../src +SOURCE glxmedialistiterator.cpp +SOURCE glxlistwindow.cpp +SOURCE glxlistutils.cpp +USERINCLUDE ../t_tglxexclusioniterator +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY mpxcommon.lib +//LIBRARY glxmedialists.lib +LIBRARY hal.lib +LIBRARY featmgr.lib // Feature Manager + + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/ut_cglxattributecontext.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/ut_cglxattributecontext.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxAttributeContext unit test project file +* +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET ut_cglxattributecontext.dll +TARGETTYPE dll +TARGETPATH /DigiaEUnit/Tests +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +MACRO USE_S60_TNM +#define USE_S60_TNM +SOURCEPATH ../ut_cglxattributecontext +SOURCE ut_cglxattributecontextdllmain.cpp +SOURCE ut_cglxattributecontext.cpp + +// Sources needed by the test +SOURCEPATH ../../src +SOURCE glxattributecontext.cpp +SOURCE glxcachemanager.cpp +SOURCE glxerrormanager.cpp +SOURCE glxfetcherror.cpp +SOURCE glxfetcherrorarray.cpp +SOURCE glxfetchcontextremover.cpp +SOURCE glxgarbagecollector.cpp +SOURCE glxcache.cpp +SOURCE glxitemlist.cpp +SOURCE glxlistutils.cpp +SOURCE glxlistwindow.cpp +SOURCE glxmedia.cpp +SOURCE glxmedialist.cpp +SOURCE glxmedialistiterator.cpp +SOURCE glxnavigablelist.cpp +SOURCE glxstaticitemlist.cpp +SOURCE glxthumbnailcontext.cpp +SOURCE glxthumbnailutility.cpp +SOURCE mglxcache.cpp +SOURCE mglxmedialist.cpp +SOURCE glxmedialistarray.cpp +SOURCE glximagereader.cpp + +USERINCLUDE ../ut_cglxattributecontext + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../../inc + +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../drmutility/inc +SYSTEMINCLUDE ../../../../gallery/inc +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY apparc.lib +LIBRARY bafl.lib +LIBRARY edbms.lib +LIBRARY eikcore.lib +LIBRARY estor.lib +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommonui.lib // for CGlxResolutionUtility +LIBRARY glxcommon.lib +LIBRARY glxmedialists.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY lbs.lib // TCoordinate +LIBRARY hal.lib +LIBRARY avkon.lib +LIBRARY featmgr.lib // Feature Manager +LIBRARY efsrv.lib +LIBRARY apgrfx.lib // For ImageViewer mime type extraction +LIBRARY apmime.lib // For ImageViewer mime type extraction +LIBRARY imageconversion.lib // icl decoder +LIBRARY glximageviewermanager.lib +LIBRARY caf.lib +LIBRARY cafutils.lib +LIBRARY cone.lib // MCoeView +#ifdef USE_S60_TNM +LIBRARY thumbnailmanager.lib +LIBRARY bitgdi.lib +#endif + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/ut_cglxitemlist.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/ut_cglxitemlist.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET ut_cglxitemlist.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../ut_cglxitemlist +SOURCE ut_cglxitemlist.cpp +SOURCEPATH ../src +SOURCE glxlistreconstruction.cpp +SOURCE _glxnotification.cpp +SOURCE _glxlisttesthelpers.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxmedia.cpp +SOURCE glxitemlist.cpp +SOURCE glxthumbnailutility.cpp +SOURCEPATH ../ut_cglxitemlist +SOURCE ut_cglxitemlist_dllmain.cpp + +USERINCLUDE ../ut_cglxitemlist + +// User include folders required by the tested code +USERINCLUDE ../src +USERINCLUDE ../../src +USERINCLUDE ../../inc + + +// System include folders required by the tested code +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../../inc + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// Libraries required by the tested code +LIBRARY mpxcommon.lib +LIBRARY Lbs.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/ut_cglxmedialist.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/ut_cglxmedialist.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMediaList unit test project file +* +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET ut_cglxmedialist.dll +TARGETTYPE dll +TARGETPATH /DigiaEUnit/Tests +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../ut_cglxmedialist +SOURCE ut_cglxmedialistdllmain.cpp +SOURCE ut_cglxmedialist.cpp + +// Sources needed by the test +SOURCEPATH ../../src +SOURCE glxattributecontext.cpp +SOURCE glxcachemanager.cpp +SOURCE glxerrormanager.cpp +SOURCE glxfetcherror.cpp +SOURCE glxfetcherrorarray.cpp +SOURCE glxfetchcontextremover.cpp +SOURCE glxgarbagecollector.cpp +SOURCE glxcache.cpp +SOURCE glxitemlist.cpp +SOURCE glxlistutils.cpp +SOURCE glxlistwindow.cpp +SOURCE glxmedia.cpp +SOURCE glxmedialist.cpp +SOURCE glxmedialistiterator.cpp +SOURCE glxnavigablelist.cpp +SOURCE glxstaticitemlist.cpp +SOURCE glxthumbnailcontext.cpp +SOURCE glxthumbnailutility.cpp +SOURCE mglxcache.cpp +SOURCE mglxmedialist.cpp +SOURCE glxmedialistarray.cpp + +USERINCLUDE ../ut_cglxmedialist + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../drmutility/inc +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY estor.lib +LIBRARY glxcommonui.lib +LIBRARY glxcommon.lib +LIBRARY lbs.lib // TCoordinate +LIBRARY hal.lib + +EXPORTUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/ut_cglxnavigablelist.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/ut_cglxnavigablelist.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET ut_cglxnavigablelist.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../ut_cglxnavigablelist +SOURCE ut_cglxnavigablelist.cpp +SOURCEPATH ../src +SOURCE glxlistreconstruction.cpp +SOURCE _glxnotification.cpp +SOURCE _glxlisttesthelpers.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxstaticitemlist.cpp +SOURCE glxmedia.cpp +SOURCE glxitemlist.cpp +SOURCE glxnavigablelist.cpp +SOURCE glxlistutils.cpp +SOURCE glxthumbnailutility.cpp +SOURCEPATH ../ut_cglxnavigablelist +SOURCE ut_cglxnavigablelist_dllmain.cpp + +USERINCLUDE ../ut_cglxnavigablelist + +// User include folders required by the tested code +USERINCLUDE ../src +USERINCLUDE ../../src +USERINCLUDE ../../inc + + +// System include folders required by the tested code +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../../inc + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib + +// Libraries required by the tested code +LIBRARY mpxcommon.lib +LIBRARY Lbs.lib +LIBRARY featmgr.lib // Feature Manager + +EXPORTUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/ut_cglxstaticitemlist.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/ut_cglxstaticitemlist.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET ut_cglxstaticitemlist.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +SOURCEPATH ../ut_cglxstaticitemlist +SOURCE ut_cglxstaticitemlist.cpp +SOURCEPATH ../src +SOURCE glxlistreconstruction.cpp +SOURCE _glxnotification.cpp +SOURCE _glxlisttesthelpers.cpp + +// Sources required by the test suite +SOURCEPATH ../../src +SOURCE glxstaticitemlist.cpp +SOURCE glxmedia.cpp +SOURCE glxitemlist.cpp +SOURCE glxthumbnailutility.cpp +SOURCEPATH ../ut_cglxstaticitemlist +SOURCE ut_cglxstaticitemlist_dllmain.cpp + +USERINCLUDE ../ut_cglxstaticitemlist + +// User include folders required by the tested code +USERINCLUDE ../src +USERINCLUDE ../../src +USERINCLUDE ../../inc + + +// System include folders required by the tested code +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../../inc + +LIBRARY EUnit.lib +LIBRARY EUnitUtil.lib +LIBRARY euser.lib +LIBRARY lbs.lib + +// Libraries required by the tested code +LIBRARY mpxcommon.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/ut_glxerrormanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/ut_glxerrormanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: GlxErrorManager unit test project file +* +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET ut_glxerrormanager.dll +TARGETTYPE dll +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +MACRO USE_S60_TNM +#define USE_S60_TNM +SOURCEPATH ../ut_glxerrormanager +SOURCE ut_glxerrormanager.cpp + +// Sources required by the test suite +SOURCE ut_glxerrormanager_DllMain.cpp + +// Sources needed by the test +SOURCEPATH ../../src +SOURCE glxattributecontext.cpp +SOURCE glxcachemanager.cpp +SOURCE glxerrormanager.cpp +SOURCE glxfetcherror.cpp +SOURCE glxfetcherrorarray.cpp +SOURCE glxfetchcontextremover.cpp +SOURCE glxgarbagecollector.cpp +SOURCE glxcache.cpp +SOURCE glxitemlist.cpp +SOURCE glxlistutils.cpp +SOURCE glxlistwindow.cpp +SOURCE glxmedia.cpp +SOURCE glxmedialist.cpp +SOURCE glxmedialistiterator.cpp +SOURCE glxnavigablelist.cpp +SOURCE glxstaticitemlist.cpp +SOURCE glxthumbnailcontext.cpp +SOURCE glxthumbnailutility.cpp +SOURCE mglxcache.cpp +SOURCE mglxmedialist.cpp +SOURCE glxmedialistarray.cpp +SOURCE glximagereader.cpp + +USERINCLUDE ../ut_glxerrormanager + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../drmutility/inc +SYSTEMINCLUDE ../../../../gallery/inc +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY apparc.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY edbms.lib +LIBRARY efsrv.lib +LIBRARY eikcore.lib +LIBRARY estor.lib +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY glxcommonui.lib +LIBRARY glxcommon.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY lbs.lib // TCoordinate +LIBRARY hal.lib +LIBRARY avkon.lib +LIBRARY featmgr.lib // Feature Manager +LIBRARY apgrfx.lib // For ImageViewer mime type extraction +LIBRARY apmime.lib // For ImageViewer mime type extraction +LIBRARY imageconversion.lib // icl decoder +LIBRARY glximageviewermanager.lib +LIBRARY caf.lib +LIBRARY cafutils.lib +#ifdef USE_S60_TNM +LIBRARY thumbnailmanager.lib +LIBRARY bitgdi.lib +#endif + +EXPORTUNFROZEN +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/group/ut_tglxselectioniterator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/group/ut_tglxselectioniterator.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TGlxSelectionIterator unit test project file +* +*/ + + + +#include +#include "../../../../group/glxbuildcommon.mmh" + +TARGET ut_tglxselectioniterator.dll +TARGETTYPE dll +TARGETPATH /DigiaEUnit/Tests +UID 0x1000af5a 0x01700000 + +CAPABILITY ALL -TCB + +SOURCEPATH ../ut_tglxselectioniterator +SOURCE ut_tglxselectioniteratordllmain.cpp +SOURCE ut_tglxselectioniterator.cpp + +USERINCLUDE ../ut_tglxselectioniterator +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../../../inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY EUnit.lib +LIBRARY euser.lib +LIBRARY glxmedialists.lib +LIBRARY mpxcommon.lib + +EXPORTUNFROZEN + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/inc/t_cachetesthelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/inc/t_cachetesthelpers.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Cache test helper class +* +*/ + + + + +#ifndef __T_CACHETESTHELPERS_H__ +#define __T_CACHETESTHELPERS_H__ + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES +#include "glxcache.h" + +// FORWARD DECLARATIONS +class CGlxMedia; + +// CLASS DEFINITION +/** + * Helper class for testing cache + * + */ +NONSHARABLE_CLASS( T_CacheTestHelpers ) + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + T_CacheTestHelpers(CGlxCache* aCache) : iCache(aCache) {}; + /** + * Destructor + */ + ~T_CacheTestHelpers() {}; + + public: + + RPointerArray& ItemPool() const { return iCache->iItemPool; }; + static TInt MediaItemOrderByKey(const TGlxMediaId* aMediaId, const CGlxMedia& aItem2) { return CGlxCache::MediaItemOrderByKey(aMediaId, aItem2); }; + + private: // Data + + CGlxCache* iCache; + }; + +#endif // __T_CACHETESTHELPERS_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/inc/t_mglxreferenceobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/inc/t_mglxreferenceobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ReferenceObserver for a callback from CGlxMediaUserTest to T_CGlxGarbageCollector +* +*/ + +#ifndef T_MGLXREFERENCEOBSERVER_H_ +#define T_MGLXREFERENCEOBSERVER_H_ + + +class MGlxReferenceObserver + { +public: + virtual void RemoveMediaReference(TInt aIndex) = 0; + }; + + +#endif /* T_MGLXREFERENCEOBSERVER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/inc/tmglxmedialist_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/inc/tmglxmedialist_stub.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,702 @@ +/* +* Copyright (c) 2007-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: Medialist stub + * +*/ + + + + +#ifndef __TMGLXMEDIALIST_STUB_H__ +#define __TMGLXMEDIALIST_STUB_H__ + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +// EXTERNAL INCLUDES +#include + +#include +#include + +// INTERNAL INCLUDES +namespace TMGlxMediaList_Stub_Config + { + const TBool KDefaultIsPopulated = ETrue; + const TInt KDefaultSize = 3; + const TInt KDefaultFocus = 1; + } + +/** + * Observer interface for medialist stub method calls + * The test class is informed about any calls to the + * corresponding adapter using this interface. + */ +NONSHARABLE_CLASS( MGlxMediaList_Stub_Observer ) + { + public: // enums + + enum TMGlxMediaListMethodId + { + E_NotCalled, + E_Close, + E_TGlxMediaListId_Id_, + E_TInt_Count_, + E_TInt_FocusIndex_, + E_void_SetFocusL_TInt_, + E_const_TGlxMedia_r_Item_TInt_, + E_TInt_Index_const_TGlxMediaId_r_, + E_void_AddMediaListObserverL_MGlxMediaListObserver_p_, + E_void_RemoveMediaListObserver_MGlxMediaListObserver_p_, + E_void_AddContextL_const_MGlxFetchContext_p_TInt_, + E_void_RemoveContext_const_MGlxFetchContext_p_, + E_MMPXCollection_r_Collection_, + E_CMPXCollectionPath_p_PathLC_, + E_TBool_IsSelected_TInt_, + E_void_SetSelectedL_TInt_TBool_, + E_TInt_SelectionCount_, + E_TInt_SelectedItemIndex_TInt_, + E_void_CommandL_CMPXCommand_r_, + E_void_CancelCommand_, + E_void_SetFilterL_CMPXFilter_p_, + E_CMPXFilter_p_Filter_, + E_TGlxIdSpaceId_IdSpaceId_TInt_, + E_TBool_IsPopulated + }; + + protected: // Destructor + + /** + * Destructor + */ + virtual ~MGlxMediaList_Stub_Observer() {}; + + public: // Abstract methods + + /** + * This method gets called when the media list stub is called + * @param aMethodId the method id that was called + */ + virtual void MGlxMediaList_MethodCalled(TMGlxMediaListMethodId aMethodId) = 0; + + }; + +// CLASS DEFINITION +/** + * Stub implementation of gallery medialist + */ +NONSHARABLE_CLASS( TMGlxMediaList_Stub ) : public MGlxMediaList + { + public: // Constructors and destructors + + /** + * Constructor + * @param aObserver, the observer for the medialist events + */ + inline TMGlxMediaList_Stub( MGlxMediaList_Stub_Observer* aObserver ); + + /** + * Destructor + */ + inline ~TMGlxMediaList_Stub(); + + public: + + /** + * This method can be used by test code to call + * HandleAttributesAvailableL of the + * observer of this media list. + * @param aIndex the index for which the attributes are available + */ + inline void NotifyAttributesAvailableL( TInt aIndex ); + + /** + * This method can be used by test code to call + * HandleError of the observer of this media list. + * @param aError the error code + */ + inline void NotifyError( TInt aError ); + + /** + * This method can be used by test code to call + * NotifyItemRemoved of the observer of this media list. + * @param aStartIndex the first item index + * @param aEndIndex the last item index + */ + inline void NotifyItemRemoved( TInt aStartIndex, TInt aEndIndex ); + + /** + * This method can be used by test code to call + * HandlePopulatedL of the observer of this media list. + */ + inline void NotifyHandlePopulatedL(); + + /** + * This method deletes the filter currently in use + */ + inline void RemoveFilter(); + + public: // from MGlxMediaList + + inline void Close(); + inline TGlxMediaListId Id() const; + inline TInt Count( NGlxListDefs::TCountType aType ) const; + inline TInt FocusIndex() const; + inline void SetFocusL(NGlxListDefs::TFocusSetType aType, TInt aValue); + inline const TGlxMedia& Item(TInt aIndex) const; + inline TInt Index(const TGlxIdSpaceId& aIdSpaceId, const TGlxMediaId& aId) const; + inline void AddMediaListObserverL(MGlxMediaListObserver* aObserver); + inline void RemoveMediaListObserver(MGlxMediaListObserver* aObserver); + inline void AddContextL(const MGlxFetchContext* aContext, TInt aPriority); + inline void RemoveContext(const MGlxFetchContext* aContext); + inline MMPXCollection& Collection() const; + inline CMPXCollectionPath* PathLC(NGlxListDefs::TPathType aType) const; + inline TBool IsSelected(TInt aIndex) const; + inline void SetSelectedL(TInt aIndex, TBool aSelected); + inline TInt SelectionCount() const; + inline TInt SelectedItemIndex(TInt aSelectionIndex) const; + inline void CommandL(CMPXCommand& aCommand); + inline void CancelCommand(); + inline void SetFilterL(CMPXFilter* aFilter); + inline CMPXFilter* Filter() const; + inline TGlxIdSpaceId IdSpaceId(TInt aIndex) const; + inline TBool IsPopulated() const; + + ///@todo implement these methods + void AddStaticItemL( CGlxMedia* /*aStaticItem*/, + NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {} + void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {} + void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; } + TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; } + + virtual void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition /*aFocusInitialPosition*/) { }; + virtual void ResetFocus(){ }; + virtual void SetVisibleWindowIndexL( TInt /*aIndex*/) { }; + virtual TInt VisibleWindowIndex() const { }; + virtual void CancelPreviousRequests() {}; + + public: // Data, public so that the test can specify the values it needs to be returned + + /// Array that contains the attributes + RArray iAttributesAvailable; + /// The selection + RArray iSelection; + /// media properties object + CGlxMedia* iGlxMediaProperties; + /// media + TGlxMedia iGlxMedia; + /// Whether the list is populated or not + TBool iIsPopulated; + /// The item count of the list + TInt iCount; + /// The focus index + TInt iFocus; + /// Collection path + CMPXCollectionPath* iMPXCollectionPath; + // Filter in use + CMPXFilter* iMPXFilter; + + private: // Data, needed for functionality + + RArray iObservers; + MGlxMediaList_Stub_Observer* iMGlxMediaList_Observer; + TBool iStaticItemsEnabled; + }; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +TMGlxMediaList_Stub::TMGlxMediaList_Stub( + MGlxMediaList_Stub_Observer* aObserver ) + : iGlxMediaProperties( NULL ), + iGlxMedia( TGlxMediaId( 0 ), iGlxMediaProperties ), + iIsPopulated( TMGlxMediaList_Stub_Config::KDefaultIsPopulated ), + iCount( TMGlxMediaList_Stub_Config::KDefaultSize ), + iFocus( TMGlxMediaList_Stub_Config::KDefaultFocus ), + iMPXCollectionPath( NULL ), + iMGlxMediaList_Observer( aObserver ), + iMPXFilter(0) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +TMGlxMediaList_Stub::~TMGlxMediaList_Stub() + { + iSelection.Close(); + iObservers.Close(); + delete iMPXFilter; + } + +// ----------------------------------------------------------------------------- +// NotifyAttributesAvailableL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::NotifyAttributesAvailableL( TInt aIndex ) + { + EUNIT_PRINT( + _L( "TMGlxMediaList_Stub::Notifying attributes available %d" ), + aIndex ); + + // make the call to all registered observers + for( TInt i=0; iHandleAttributesAvailableL( + aIndex, iAttributesAvailable, this ); + } + } + +// ----------------------------------------------------------------------------- +// NotifyError +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::NotifyError( TInt aError ) + { + EUNIT_PRINT( _L("TMGlxMediaList_Stub::Notifying error %d"), aError ); + + // make the call to all registered observers + for( TInt i=0; iHandleError( aError ); + } + } + +// ----------------------------------------------------------------------------- +// NotifyItemRemoved +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::NotifyItemRemoved( + TInt aStartIndex, TInt aEndIndex ) + { + EUNIT_PRINT( + _L("TMGlxMediaList_Stub::Notifying items removed %d->%d"), + aStartIndex, aEndIndex ); + + // make the call to all registered observers + for( TInt i=0; iHandleItemRemovedL( + aStartIndex, aEndIndex, this ); + } + } + +// ----------------------------------------------------------------------------- +// NotifyHandlePopulatedL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::NotifyHandlePopulatedL() + { + EUNIT_PRINT( + _L("TMGlxMediaList_Stub::Notifying handle populated") ); + + // make the call to all registered observers + for( TInt i=0; iHandlePopulatedL( this ); + } + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::Close() + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_Close ); + } + iObservers.Close(); + } + +// ----------------------------------------------------------------------------- +// Id +// ----------------------------------------------------------------------------- +TGlxMediaListId TMGlxMediaList_Stub::Id() const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TGlxMediaListId_Id_ ); + } + // just return this pointer as id + return TGlxMediaListId((unsigned int)(void*)this); + } + +// ----------------------------------------------------------------------------- +// Count +// ----------------------------------------------------------------------------- +TInt TMGlxMediaList_Stub::Count( NGlxListDefs::TCountType /*aType*/ ) const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TInt_Count_ ); + } + // return the specified count + return iCount; + } + +// ----------------------------------------------------------------------------- +// FocusIndex +// ----------------------------------------------------------------------------- +TInt TMGlxMediaList_Stub::FocusIndex() const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TInt_FocusIndex_ ); + } + // return given focus + return iFocus; + } + +// ----------------------------------------------------------------------------- +// SetFocusL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::SetFocusL( + NGlxListDefs::TFocusSetType /*aType*/, TInt /*aValue*/ ) + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_SetFocusL_TInt_ ); + } + // make an alloc to cause a leave in memory tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +// ----------------------------------------------------------------------------- +// Item +// ----------------------------------------------------------------------------- +const TGlxMedia& TMGlxMediaList_Stub::Item( TInt /*aIndex*/ ) const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_const_TGlxMedia_r_Item_TInt_ ); + } + // return the glxmedia object + return iGlxMedia; + } + +// ----------------------------------------------------------------------------- +// Index +// ----------------------------------------------------------------------------- +TInt TMGlxMediaList_Stub::Index( + const TGlxIdSpaceId& /*aIdSpaceId*/, const TGlxMediaId& /*aId*/ ) const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TInt_Index_const_TGlxMediaId_r_ ); + } + // Default return value generated by EUnit Wizard + return 0; + } + +// ----------------------------------------------------------------------------- +// AddMediaListObserverL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::AddMediaListObserverL( + MGlxMediaListObserver* aObserver ) + { + EUNIT_PRINT( _L("TMGlxMediaList_Stub::AddMediaListObserverL" ) ); + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_AddMediaListObserverL_MGlxMediaListObserver_p_ ); + } + // add the observer to array + iObservers.AppendL( aObserver ); + + // make an alloc to cause a leave in memory tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +// ----------------------------------------------------------------------------- +// RemoveMediaListObserver +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::RemoveMediaListObserver( + MGlxMediaListObserver* aObserver ) + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_RemoveMediaListObserver_MGlxMediaListObserver_p_ ); + } + + // find the observer + TInt index = iObservers.Find( aObserver ); + // was it found + if( index > KErrNotFound ) + { + iObservers.Remove( index ); + } + } + +// ----------------------------------------------------------------------------- +// AddContextL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::AddContextL( + const MGlxFetchContext* /*aContext*/, TInt /*aPriority */) + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_AddContextL_const_MGlxFetchContext_p_TInt_ ); + } + + // make an alloc to cause a leave in memory tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +// ----------------------------------------------------------------------------- +// RemoveContext +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::RemoveContext( + const MGlxFetchContext* /*aContext */) + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_RemoveContext_const_MGlxFetchContext_p_ ); + } + } + +// ----------------------------------------------------------------------------- +// Collection +// ----------------------------------------------------------------------------- +MMPXCollection& TMGlxMediaList_Stub::Collection() const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_MMPXCollection_r_Collection_ ); + } + + // this method is not called in current tests, + // this is just to make the code compile + MMPXCollection* empty = NULL; + return *empty; + } + +// ----------------------------------------------------------------------------- +// PathLC +// ----------------------------------------------------------------------------- +CMPXCollectionPath* TMGlxMediaList_Stub::PathLC(NGlxListDefs::TPathType /*aType*/) const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_CMPXCollectionPath_p_PathLC_ ); + } + + // make an alloc to cause a leave in memory tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + // put the path to cleanupstack + CleanupStack::PushL( iMPXCollectionPath ); + // so just make the code compile + return iMPXCollectionPath; + } + +// ----------------------------------------------------------------------------- +// IsSelected +// ----------------------------------------------------------------------------- +TBool TMGlxMediaList_Stub::IsSelected( TInt /*aIndex */) const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TBool_IsSelected_TInt_ ); + } + + // Default return value generated by EUnit Wizard + return EFalse; + } + +// ----------------------------------------------------------------------------- +// SetSelectedL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::SetSelectedL( + TInt /*aIndex*/, TBool /*aSelected */) + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_SetSelectedL_TInt_TBool_ ); + } + + // make an alloc to cause a leave in memory tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +// ----------------------------------------------------------------------------- +// SelectionCount +// ----------------------------------------------------------------------------- +TInt TMGlxMediaList_Stub::SelectionCount() const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TInt_SelectionCount_ ); + } + + return 0; + } + +// ----------------------------------------------------------------------------- +// SelectedItemIndex +// ----------------------------------------------------------------------------- +TInt TMGlxMediaList_Stub::SelectedItemIndex(TInt /*aSelectionIndex*/) const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TInt_SelectedItemIndex_TInt_ ); + } + + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// CommandL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::CommandL( CMPXCommand& /*aCommand */) + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_CommandL_CMPXCommand_r_ ); + } + + // make an alloc to cause a leave in memory tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +// ----------------------------------------------------------------------------- +// CancelCommand +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::CancelCommand() + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_CancelCommand_ ); + } + } + +// ----------------------------------------------------------------------------- +// SetFilterL +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::SetFilterL(CMPXFilter* aFilter) + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_void_SetFilterL_CMPXFilter_p_ ); + } + + if (iMPXFilter) + { + delete iMPXFilter; + iMPXFilter = NULL; + } + iMPXFilter = CMPXFilter::NewL(*aFilter); + + // make an alloc to cause a leave in memory tests + TInt* memAlloc = new (ELeave) TInt; + delete memAlloc; + } + +// ----------------------------------------------------------------------------- +// Filter +// ----------------------------------------------------------------------------- +CMPXFilter* TMGlxMediaList_Stub::Filter() const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_CMPXFilter_p_Filter_ ); + } + // return the filter (set by the test case) + return iMPXFilter; + } + +// ----------------------------------------------------------------------------- +// RemoveFilter +// ----------------------------------------------------------------------------- +void TMGlxMediaList_Stub::RemoveFilter() + { + delete iMPXFilter; + iMPXFilter = NULL; + } + +// ----------------------------------------------------------------------------- +// IdSpaceId +// ----------------------------------------------------------------------------- +TGlxIdSpaceId TMGlxMediaList_Stub::IdSpaceId(TInt /*aIndex*/) const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TGlxIdSpaceId_IdSpaceId_TInt_ ); + } + return KGlxIdNone; + } + +// ----------------------------------------------------------------------------- +// IsPopulated +// ----------------------------------------------------------------------------- +TBool TMGlxMediaList_Stub::IsPopulated() const + { + // inform the test case + if( iMGlxMediaList_Observer ) + { + iMGlxMediaList_Observer->MGlxMediaList_MethodCalled( + MGlxMediaList_Stub_Observer::E_TBool_IsPopulated ); + } + // return the specified value + return iIsPopulated; + } + +#endif // __TMGLXMEDIALIST_STUB_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/_glxlisttesthelpers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/_glxlisttesthelpers.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#include "_glxlisttesthelpers.h" + +namespace NGlxListTestHelpers + { + // ----------------------------------------------------------------------------- + // Constructor + // ----------------------------------------------------------------------------- + // + TStaticItemInfo::TStaticItemInfo( const TStaticItemInfo::TData aInfoData ) + { + iData.iId = aInfoData.iId; + iData.iPosition = aInfoData.iPosition; + } + // ----------------------------------------------------------------------------- + // Operator == + // ----------------------------------------------------------------------------- + // + TBool TStaticItemInfo::operator==( const TStaticItemInfo::TData aInfoData ) const + { + return iData.iId == aInfoData.iId + && iData.iPosition == aInfoData.iPosition; + } + + // ----------------------------------------------------------------------------- + // Operator != + // ----------------------------------------------------------------------------- + // + TBool TStaticItemInfo::operator!=( const TStaticItemInfo::TData aInfoData ) const + { + return !( (*this) == aInfoData ); + } + } // NGlxListTest diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/_glxlisttesthelpers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/_glxlisttesthelpers.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#ifndef __GLXLISTTESTHELPERS_H__ +#define __GLXLISTTESTHELPERS_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + +namespace NGlxListTestHelpers + { + struct TStaticItemInfo + { + // Data needs to be a simple struct with no member functions, to allow + // arrays to be easily declared + struct TData + { + TChar iId; + NGlxListDefs::TInsertionPosition iPosition; + }; + + TStaticItemInfo( const TStaticItemInfo::TData aData ); + TBool operator==( const TStaticItemInfo::TData aInfoData ) const; + TBool operator!=( const TStaticItemInfo::TData aInfoData ) const; + TData iData; + }; + + #define K_STATIC_ITEMS_END 0, static_cast( -1 ) + const TStaticItemInfo::TData KEndMarkerData = { K_STATIC_ITEMS_END }; + const TStaticItemInfo KEndMarker = KEndMarkerData; + } // NGlxListTest + +#endif // __GLXLISTTESTHELPERS_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/_glxnotification.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/_glxnotification.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class that reconstructs a list from notifications +* +*/ + + + + +// CLASS HEADER +#include "_glxnotification.h" + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES + +TNotification::TNotification( TNotification::TData aData ) + { + iData = aData; + } + +TBool TNotification::operator==( const TNotification::TData& aNotificationData ) const + { + return iData.iType == aNotificationData.iType + && iData.iAtIndex == aNotificationData.iAtIndex + && iData.iData == aNotificationData.iData; + } + +TBool TNotification::operator!=( const TNotification::TData& aNotificationData ) const + { + return !( *this == aNotificationData ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/_glxnotification.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/_glxnotification.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#ifndef ___T_GLXNOTIFICATION_H__ +#define ___T_GLXNOTIFICATION_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS + +/** + * Notification of change + */ +class TNotification + { + public: + enum TNotificationType + { + ERemove, + EAdd, + EFocus, + ESelection, + EEndMarker // Last notification + }; + + // Data needs to be a simple struct with no member functions, to allow + // arrays to be easily declared + struct TData + { + TNotificationType iType; + TInt iAtIndex; // Old focus index for EFocus + TInt iData; // count for ERemove and EAdd, NGlxListDefs::TFocusChangeType for EFocus, TBool for ESelection + }; + public: + TNotification( TData aData ); + TBool operator==( const TNotification::TData& aNotification ) const; + TBool operator!=( const TNotification::TData& aNotification ) const; + + private: + TData iData; + }; + +// Marker to signal the end of notifications list +#define END_MARKER TNotification::EEndMarker, 0, 0 // { EEndMarker, 0, 0 }; +const TNotification::TData KEndMarkerData = { END_MARKER }; +const TNotification KEndMarker = KEndMarkerData; + +#endif // ___T_GLXNOTIFICATION_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/glxlistreconstruction.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/glxlistreconstruction.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class that reconstructs a list from notifications +* +*/ + + + + +// CLASS HEADER +#include "glxlistreconstruction.h" + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +void CGlxListReconstructionBase::ConstructL( TInt aReservationCount ) + { + iNotifications.ReserveL( aReservationCount ); + iReconstructedList.ReserveL( aReservationCount ); + iFocusIndex = -1; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxListReconstructionBase::~CGlxListReconstructionBase() + { + iNotifications.Close(); + iReconstructedList.Close(); + iSelectedItemIndices.Close(); + } + +// ----------------------------------------------------------------------------- +// Clear notifications array +// ----------------------------------------------------------------------------- +// +void CGlxListReconstructionBase::ClearNotifications() + { + iNotifications.Reset(); + } + +// ----------------------------------------------------------------------------- +// Handle items being added +// ----------------------------------------------------------------------------- +// +void CGlxListReconstructionBase::HandleItemsAdded( TInt aAddedAtIndex, TInt aCount ) + { + TNotification::TData notification[] = { TNotification::EAdd, aAddedAtIndex, aCount }; + // If fails, not big enough reservation + EUNIT_ASSERT( KErrNone == iNotifications.Append( *notification ) ); + + // reconstruct the list + for ( TInt i = 0; i < aCount; i++ ) + { + // If fails, not big enough reservation + EUNIT_ASSERT( KErrNone == iReconstructedList.Insert( + OriginalItem( aAddedAtIndex ), aAddedAtIndex ) ); + } + + // Move focus + if ( KErrNotFound == iFocusIndex ) + { + iFocusIndex = 0; + } + else if ( iFocusIndex >= aAddedAtIndex ) + { + iFocusIndex += aCount; + } + + // Move selection + for ( TInt i = 0; i < iSelectedItemIndices.Count(); i++ ) + { + if ( iSelectedItemIndices[ i ] >= aAddedAtIndex ) + { + iSelectedItemIndices[ i ] += aCount; + } + } + + // Make sure the original and reconstruction match + EUNIT_ASSERT( ReconstructionEquals() ); + } + +// ----------------------------------------------------------------------------- +// Handle items being removed +// ----------------------------------------------------------------------------- +// +void CGlxListReconstructionBase::HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ) + { + TNotification::TData notification[] = { TNotification::ERemove, aRemovedFromIndex, aCount }; + // If fails, not big enough reservation + EUNIT_ASSERT( KErrNone == iNotifications.Append( *notification ) ); + // reconstruct the list + for ( TInt i = 0; i < aCount; i++ ) + { + iReconstructedList.Remove( aRemovedFromIndex ); + } + + // Move focus + if ( iFocusIndex >= aRemovedFromIndex + aCount ) + { + iFocusIndex -= aCount; + } + else if ( iFocusIndex >= aRemovedFromIndex ) + { + // Focused item was removed + iFocusIndex = aRemovedFromIndex - 1; + if ( iFocusIndex < 0 ) + { + iFocusIndex = 0; + } + } + if ( !iReconstructedList.Count() ) + { + iFocusIndex = KErrNotFound; + } + + // Move/remove selection + TInt i = 0; + while ( i < iSelectedItemIndices.Count() ) + { + if ( iSelectedItemIndices[ i ] >= aRemovedFromIndex + aCount ) + { + iSelectedItemIndices[ i ] -= aCount; + } + else if ( iSelectedItemIndices[ i ] >= aRemovedFromIndex ) + { + iSelectedItemIndices.Remove( i ); + continue; + } + i++; + } + + // Make sure the original and reconstruction match + EUNIT_ASSERT( ReconstructionEquals() ); + } + +// ----------------------------------------------------------------------------- +// Handle focus changed +// ----------------------------------------------------------------------------- +// +void CGlxListReconstructionBase::HandleFocusChanged( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex ) + { + TNotification::TData notification[] = { TNotification::EFocus, aOldIndex, static_cast< TInt >( aType ) }; + // If fails, not big enough reservation + EUNIT_ASSERT( iNotifications.Append( *notification ) == KErrNone ); + + iFocusIndex = aNewIndex; + + // Make sure the original and reconstruction match + EUNIT_ASSERT( ReconstructionEquals() ); + } + +// ----------------------------------------------------------------------------- +// Handle items selected +// ----------------------------------------------------------------------------- +// +void CGlxListReconstructionBase::HandleItemSelected( TInt aIndex, TBool aSelected ) + { + TNotification::TData notification[] = { TNotification::ESelection, aIndex, aSelected }; + // If fails, not big enough reservation + EUNIT_ASSERT( iNotifications.Append( *notification ) == KErrNone ); + + // Should not get a notification that causes no change + if ( aSelected ) + { + EUNIT_ASSERT( KErrNotFound == iSelectedItemIndices.Find( aIndex ) ); + iSelectedItemIndices.Append( aIndex ); + } + else + { + TInt index = iSelectedItemIndices.Find( aIndex ); + EUNIT_ASSERT( KErrNotFound != index ); + iSelectedItemIndices.Remove( index ); + } + + EUNIT_ASSERT( ReconstructionEquals() ); + } + +// ----------------------------------------------------------------------------- +// Test if notifications match +// ----------------------------------------------------------------------------- +// +TBool CGlxListReconstructionBase::NotificationListEquals( const TNotification::TData* aNotificationList ) + { + ASSERT( aNotificationList ); + + TBool fail = EFalse; + // Iterator through notifications list + TBool markerFound = EFalse; + TInt i = 0; + while ( ETrue ) + { + if ( i == iNotifications.Count() ) + { + if ( KEndMarker == aNotificationList[ i ] ) + { + markerFound = ETrue; + } + break; + } + // Notifications must match + const TNotification& notification = iNotifications[ i ]; + fail |= ( notification != aNotificationList[ i ] ); + i++; + } + // Must have reached the end of iNotifications + fail |= ( i != iNotifications.Count() ); + // Must have found a marker + fail |= !markerFound; + + return !fail; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/glxlistreconstruction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/glxlistreconstruction.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#ifndef __C_GLXLISTCONSTRUCTION_H__ +#define __C_GLXLISTCONSTRUCTION_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "glxmediaid.h" +#include "mglxnavigablelistobserver.h" +#include "_glxnotification.h" + +// FORWARD DECLARATIONS +class CGlxItemList; +class CGlxStaticItemList; +class CGlxNavigableList; +class TGlxMedia; +class CMPXCollectionPath; + +/** + * Reconstruction of a list + * + */ +class CGlxListReconstructionBase : public CBase, public MGlxNavigableListObserver + { + public: + ~CGlxListReconstructionBase(); + + void ClearNotifications(); + + TBool NotificationListEquals( const TNotification::TData* aNotificationList ); + + // From MGlxNavigableListObserver + void HandleItemsAdded( TInt aAddedAtIndex, TInt aCount ); + void HandleItemsRemoved( TInt aRemovedFromIndex, TInt aCount ); + void HandleFocusChanged( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex ); + void HandleItemSelected( TInt aIndex, TBool aSelected ); + + virtual const TGlxMediaId& OriginalItem( TInt aIndex ) const = 0; + virtual TBool ReconstructionEquals() const = 0; + + protected: + void ConstructL( TInt aReservationCount = 400 ); + + protected: + // List of notifications received + RArray< TNotification > iNotifications; + // list that has been reconstructed from notifications + RArray< TGlxMediaId > iReconstructedList; + // focus index reconstructed from notifications + TInt iFocusIndex; + // selection reconstructed from notifications + RArray< TInt> iSelectedItemIndices; + }; + +/** + * Reconstruction of a item list + */ +template < class _ListClass > +class CGlxListReconstruction : public CGlxListReconstructionBase + { + public: + inline CGlxListReconstruction(); + inline void SetList( _ListClass& aList ); + + inline TBool ItemsEqual() const; + + // From CGlxListReconstructionBase + inline const TGlxMediaId& OriginalItem( TInt aIndex ) const; + + protected: + _ListClass* iList; + }; + +#include "glxlistreconstruction.inl" + +#endif // __C_GLXITEMLISTCONSTRUCTION_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/glxlistreconstruction.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/glxlistreconstruction.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class that reconstructs a list from notifications +* +*/ + + + + +// CONSTRUCTION + +#include "glxmedia.h" + +template < class _ListClass > +inline CGlxListReconstruction< _ListClass >::CGlxListReconstruction() + { + } + +template < class _ListClass > +inline void CGlxListReconstruction< _ListClass >::SetList( _ListClass& aList ) + { + iList = &aList; + } + +template < class _ListClass > +inline const TGlxMediaId& CGlxListReconstruction< _ListClass >::OriginalItem( TInt aIndex ) const + { + return iList->Item( aIndex ).Id(); + } + +template < class _ListClass > +inline TBool CGlxListReconstruction< _ListClass >::ItemsEqual() const + { + // test lengths match + TBool fail = ( iList->Count() != iReconstructedList.Count() ); + // test all items are the same + TInt i = 0; + while ( i < iList->Count() && !fail ) + { + fail |= ( iList->Item( i ).Id() == iReconstructedList[ i ] ); + i++; + } + return !fail; + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/glxlisttestbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/glxlisttestbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#ifndef __C_GLXLISTTESTBASE_H__ +#define __C_GLXLISTTESTBASE_H__ + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include "mglxmediapool.h" +#include "mglxmediauser.h" +#include "_glxlisttesthelpers.h" + +// FORWARD DECLARATIONS +class CGlxItemListReconstruction; +class CMPXCollectionPath; +class TNotification; + +template < class _ListClass, class _ReconstructionClass > +class CGlxListTestBase : public CEUnitTestSuiteClass, public MGlxMediaPool, + public MGlxMediaUser + { + protected: + ~CGlxListTestBase(); + void DeleteMembers(); + + // From MGlxMediaPool + CGlxMedia* Media( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aId) const; + + /** + * Create a collection path from a string, in which each char + * is an id + */ + CMPXCollectionPath* CreatePathLC( const TDesC8& aString ); + + /** + * Add a static item - can be only used for _ListClass + * that support AddStaticItemL(...) + */ + void AddStaticItemL( TChar aId, NGlxListDefs::TInsertionPosition aPosition ); + void AddStaticItemsL( NGlxListTestHelpers::TStaticItemInfo::TData* aInfos ); + + /** + * Test if counts equal - can only be used for _ListClass that supports + * Count( NGlxListDefs::TCountType ) and SetStaticItemsEnabled + * Note: Will test with both static items enabled and disabled, so sends + * notifications to list observer, which will affect notification list + * of the reconstruction. So don't use when notifications list is being tested. + */ + TBool CountEqualsL( TInt aCountAll, TInt aCountNonStatic, + TInt aCountAllStatic, TInt aCountPreStatic, TInt aCountPostStatic ); + + void CreateListL( const TDesC8& aString ); + void CreateListL( const TDesC8& aString, const TDesC8& aLinkedToMedia ); + void CreateListL( const TDesC8& aString, TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ); + + void CreateReconstructionL(); + TBool Equals( const TDesC8& aNewString ); + TBool Equals( const TDesC8& aNewString, const TNotification::TData* aNotificationList ); + TBool Equals( const TDesC8& aStringWithoutStaticItems, + const TDesC8& aStringWithStaticItems, TBool aStaticItemsEnabled, + const TNotification::TData* aNotificationList); + + /** + * Checks if items are linked to media objects + * @param aAnswers expected linking, format "tttft", in which + * 't' indicates "yes, is linked", + * and 'f' indicates "no, is not linked" + */ + TBool IsLinkedToMedia( const TDesC8& aAnswers ) const; + /** + * Creates a media object in pool, and offers to list. + * @param aAnswers See IsLinkedToMedia + * @param aShouldAccept ETrue if list should accept the offer + */ + //TBool TryOfferMedia( TChar aId, const TDesC8& aAnswers, TBool aShouldAccept ); + + /** + * Tries to remove reference of list from media + * @param aAnswers See IsLinkedToMedia + */ + TBool TryRemoveReference( TInt aIndex, const TDesC8& aAnswers ); + + /** Set contents, compare result */ + TBool TrySetContentsL( const TDesC8& aOldString, const TDesC8& aNewString ); + /** Set contents, compare result and notifications list */ + TBool TrySetContentsL( const TDesC8& aOldString, const TDesC8& aNewString, + const TNotification::TData* aNotificationList ); + /** Set contents with and without static items, compare result and notifications list */ + TBool TrySetContentsL( const TDesC8& aOldString, const TDesC8& aNewString, + const TDesC8& aNewStringWithStaticItems, + const TNotification::TData* aNotificationListStaticItemsEnabled, + const TNotification::TData* aNotificationListStaticItemsDisabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ); + + TBool TryRemoveL( const TDesC8& aOldString, const TChar aItemToRemove, + const TDesC8& aNewString, const TNotification::TData* aNotificationList ); + TBool TryRemoveL( const TDesC8& aOldString, + const TChar aItemToRemove, TBool aIsStaticId, + const TDesC8& aNewStringWithoutStaticItems, + const TDesC8& aNewStringWithStaticItems, + const TNotification::TData* aNotificationListStaticItemsDisabled, + const TNotification::TData* aNotificationListStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos); + /** + * Test setting static items enabled + */ + TBool TrySetStaticItemsEnabledL( const TDesC8& aStringWithoutStaticItems, + const TDesC8& aStringWithStaticItems, + NGlxListTestHelpers::TStaticItemInfo::TData* aInfos, + const TNotification::TData* aNotificationListForEnable, + const TNotification::TData* aNotificationListForDisable ); + + TBool TryAddStaticItemL( const TDesC8& aInitString, + TChar aStaticItemId, NGlxListDefs::TInsertionPosition aInsertPos, + const TDesC8& aStringAfter, const TNotification::TData* aNotificationListForAdd, + const TNotification::TData* aNotificationListForAllStatic, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ); + + /** Sets contents, does not create a list */ + TBool SetContentsL( const TDesC8& aString ); + + /** Reorders contents, does not create a list */ + TBool ReorderContentsL( const TDesC8& aString ); + + /** Run test for OfferMedia */ + void TestOfferMediaL(); + /** Run test for RemoveReference */ + void TestRemoveReferenceL(); + /** Run test for IdSpaceId */ + void TestIdSpaceIdL(); + /** Run test for Count, requires static items support in deriving class */ + void TestCountL(); + /** Run test for Index, requires static items support in deriving class */ + void TestIndexL(); + /** Run test for Item, requires static items support in deriving class */ + void TestItemL(); + + private: + TBool TrySetContentsL( const TDesC8& aOldString, + const TDesC8& aNewString, const TDesC8& aNewStringWithStaticItems, + const TNotification::TData* aNotificationList, + TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ); + + TBool TryRemoveL( const TDesC8& aOldString, + const TChar aItemToRemove, TBool aIsStaticId, + const TDesC8& aNewString, + const TNotification::TData* aNotificationList, + TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ); + + TBool TryAddStaticItemL( const TDesC8& aInitString, TChar aStaticItemId, + NGlxListDefs::TInsertionPosition aInsertPos, + const TDesC8& aStringAfter, + const TNotification::TData* aNotificationList, + TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ); + + void GetRequiredAttributesL( TInt aIndex, RArray< TMPXAttribute >& aAttributes ); + void HandleAttributesAvailableL( TInt aIndex, const RArray< TMPXAttribute >& aAttributes ); + void RemoveReference( TInt aIndex ); + void HandleError( TInt aError ); + + protected: + // class under test + _ListClass* iList; + // reconstruction of list based on notifications + _ReconstructionClass* iReconstruction; + // Pool of media items + RPointerArray< CGlxMedia > iMediaPool; + }; + +#include "glxlisttestbase.inl" + +#endif // __C_GLXLISTTESTBASE_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/src/glxlisttestbase.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/src/glxlisttestbase.inl Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,893 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#include "glxlistreconstruction.h" + +#include +#include +#include +#include +#include + +#include "glxmediastaticitemdefs.h" + +const TGlxIdSpaceId KListIdSpace( 1 ); + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > +CGlxListTestBase< _List, _Reconstruction >::~CGlxListTestBase() + { + DeleteMembers(); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > +void CGlxListTestBase< _List, _Reconstruction >::DeleteMembers() + { + delete iReconstruction; + iReconstruction = NULL; + delete iList; + iList = NULL; + iMediaPool.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// Ignore +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::GetRequiredAttributesL( + TInt /*aIndex*/, RArray< TMPXAttribute >& /*aAttributes*/ ) + { + } + +// ----------------------------------------------------------------------------- +// Ignore +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction > + ::HandleAttributesAvailableL(TInt /*aIndex*/, + const RArray< TMPXAttribute >& /*aAttributes*/ ) + { + } + +// ----------------------------------------------------------------------------- +// Ignore +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction > + ::RemoveReference( TInt /*aIndex*/ ) + { + } + +// ----------------------------------------------------------------------------- +// Ignore +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction > + ::HandleError( TInt /*aError*/ ) + { + } + +// ----------------------------------------------------------------------------- +// MGlxMediaPool::Media implementation +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > +CGlxMedia* CGlxListTestBase< _List, _Reconstruction > + ::Media( const TGlxIdSpaceId& /*aIdSpaceId*/, const TGlxMediaId& /*aId*/) const + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// Create a list from string +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction > + ::CreateListL( const TDesC8& aString ) + { + CMPXCollectionPath* path = CreatePathLC( aString ); + + // Create reconstruction + CreateReconstructionL(); + + // Delete media items + iMediaPool.ResetAndDestroy(); + + // Create list + delete iList; + iList = NULL; + iList = _List::NewL( KListIdSpace, *iReconstruction, *this ); + iReconstruction->SetList( *iList ); + // Set the contents of the old list + iList->SetContentsL( *path, *this ); + // Reset for test + iReconstruction->ClearNotifications(); + + CleanupStack::PopAndDestroy(path ); + } + +// ----------------------------------------------------------------------------- +// Create a list from string +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction > + ::CreateListL( const TDesC8& aString, const TDesC8& aLinkedToMedia ) + { + // Create list + CreateListL( aString ); + + // Link to media + for ( TInt i = 0; i < aLinkedToMedia.Length(); i++) + { + if ( aLinkedToMedia[ i ] == 't' ) + { + CGlxMedia* media = new (ELeave) CGlxMedia( iList->Item( i ).Id() ); + CleanupStack::PushL( media ); + iMediaPool.AppendL( media ); + CleanupStack::Pop( media ); + + media->ReserveUsersL( 1 ); + iList->Item(i).SetMedia( media, *this); + } + } + } + +// ----------------------------------------------------------------------------- +// Create a list from string +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction > + ::CreateListL( const TDesC8& aString, TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ) + { + // Create list + CreateListL( aString ); + // Add static items, if any + AddStaticItemsL( aStaticItemInfos ); + // Enable/disable static items + iList->SetStaticItemsEnabled( aStaticItemsEnabled ); + // Reset for test + iReconstruction->ClearNotifications(); + } + +// ----------------------------------------------------------------------------- +// Create reconstruction +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::CreateReconstructionL() + { + delete iReconstruction; + iReconstruction = NULL; + iReconstruction = _Reconstruction::NewL(); + } + +// ----------------------------------------------------------------------------- +// Test if list equals the list in the string +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction >::Equals( const TDesC8& aNewString ) + { + ASSERT( iList && iReconstruction ); + // length of list and string must match + TBool fail = ( iList->Count() != aNewString.Length() ); + + for ( TInt i = 0; i < iList->Count(); i++ ) + { + fail |= ( iList->Item( i ).Id() != TGlxMediaId( aNewString[ i ] ) ); + } + + // Test reconstruction + fail |= !iReconstruction->ReconstructionEquals(); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test if list matches the string and reconstruction matches original +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > +TBool CGlxListTestBase< _List, _Reconstruction >::Equals( const TDesC8& aNewString, + const TNotification::TData* aNotificationList ) + { + ASSERT( iList && iReconstruction ); + // Test if list contents match the new intended contents + TBool fail = !Equals( aNewString ); + + // Test notifications and reconstruction match + fail |= !iReconstruction->NotificationListEquals( aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test match +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > +TBool CGlxListTestBase< _List, _Reconstruction > + ::Equals( const TDesC8& aStringWithoutStaticItems, + const TDesC8& aStringWithStaticItems, + TBool aStaticItemsEnabled, + const TNotification::TData* aNotificationList) + { + TBool fail = EFalse; + if ( aStaticItemsEnabled ) + { + fail |= !Equals( aStringWithStaticItems, aNotificationList ); + } + else + { + fail |= !Equals( aStringWithoutStaticItems, aNotificationList ); + } + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test if items are linked to media objects correctly +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::IsLinkedToMedia( const TDesC8& aAnswers ) const + { + TBool fail = EFalse; + for ( TInt i = 0; i < aAnswers.Length(); i++) + { + TBool shouldBeLinked = ( aAnswers[ i ] == 't' ); + TBool isLinked = ( iList->Item( i ).Properties() != NULL ); + // Test via not, just in case true is not always exactly 1 + fail |= ( !shouldBeLinked != !isLinked ); + } + return !fail; + } + +// ----------------------------------------------------------------------------- +// Try linking to media item +// ----------------------------------------------------------------------------- +// +/*template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TryOfferMedia( TChar aId, const TDesC8& aAnswers, TBool aShouldAccept ) + { + ASSERT( iList ); + + CGlxMedia* media = new (ELeave) CGlxMedia( TGlxMediaId( aId ) ); + CleanupStack::PushL( media ); + iMediaPool.AppendL( media ); + CleanupStack::Pop( media ); + media->ReserveUsersL( 1 ); + // Offer media and test acceptance. Compare via not, to since True might be not be 1 + TBool fail = ( !iList->OfferMedia(KListIdSpace, *media ) != !aShouldAccept ); + fail |= !IsLinkedToMedia( aAnswers ); + return !fail; + }*/ + +// ----------------------------------------------------------------------------- +// Try removing link from media item +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TryRemoveReference( TInt aIndex, const TDesC8& aAnswers ) + { + ASSERT( iList ); + + // Remove reference + iList->RemoveReference( aIndex ); + TBool fail = !IsLinkedToMedia( aAnswers ); + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test OfferMedia(...) +// ----------------------------------------------------------------------------- +// +/*template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::TestOfferMediaL() + { + // Create the item list + CreateListL( _L8("abcdefg") ); + + EUNIT_ASSERT( IsLinkedToMedia( _L8("fffffff") ) ); + EUNIT_ASSERT( TryOfferMedia( '0', _L8("fffffff"), EFalse ) ); // reject + EUNIT_ASSERT( TryOfferMedia( 'a', _L8("tffffff"), ETrue ) ); + EUNIT_ASSERT( TryOfferMedia( 'c', _L8("tftffff"), ETrue ) ); + EUNIT_ASSERT( TryOfferMedia( 'd', _L8("tfttfff"), ETrue ) ); + EUNIT_ASSERT( TryOfferMedia( 'g', _L8("tfttfft"), ETrue ) ); + EUNIT_ASSERT( TryOfferMedia( '1', _L8("tfttfft"), EFalse ) ); // reject + }*/ + +// ----------------------------------------------------------------------------- +// Test RemoveReference(...) +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::TestRemoveReferenceL() + { + // Create the item list + CreateListL( _L8("abcdefg"), _L8("tfttfft") ); + EUNIT_ASSERT( IsLinkedToMedia( _L8("tfttfft") ) ); + + // Add static items + // Static items are linked to media + AddStaticItemL( '0', NGlxListDefs::EInsertFirst ); + AddStaticItemL( '1', NGlxListDefs::EInsertLast ); + EUNIT_ASSERT( IsLinkedToMedia( _L8("ttfttfftt") ) ); + + EUNIT_ASSERT( TryRemoveReference( 1, _L8("tffttfftt") ) ); + EUNIT_ASSERT( TryRemoveReference( 3, _L8("tffftfftt") ) ); + EUNIT_ASSERT( TryRemoveReference( 4, _L8("tfffffftt") ) ); + EUNIT_ASSERT( TryRemoveReference( 7, _L8("tffffffft") ) ); + EUNIT_ASSERT_PANIC_DESC( TryRemoveReference( 8, _L8("tffffffft") ), + "Images & videos", EGlxPanicIllegalArgument, + "Incorrect panic" ); + } + +// ----------------------------------------------------------------------------- +// Test setting new contents +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::SetContentsL( const TDesC8& aString ) + { + ASSERT( iList ); + + // Create source + CMPXCollectionPath* path = CreatePathLC( aString ); + // Copy source for comparison + TInt originalIndex = path->Index(); + // Set the source + iList->SetContentsL( *path, *this ); + + // Test path was not modified + TBool fail = !( !path->Levels() || originalIndex == path->Index() ); + + CleanupStack::PopAndDestroy( path ); + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test reordering contents +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::ReorderContentsL( const TDesC8& aString ) + { + ASSERT( iList ); + + // Create source + CMPXCollectionPath* path = CreatePathLC( aString ); + // Copy source for comparison + TInt originalIndex = path->Index(); + // Set the source + iList->ReorderContentsL( *path, *this ); + + // Test path was not modified + TBool fail = !( !path->Levels() || originalIndex == path->Index() ); + + CleanupStack::PopAndDestroy( path ); + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test setting new contents +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TrySetContentsL( const TDesC8& aOldString, const TDesC8& aNewString ) + { + // Create the item list + CreateListL( aOldString ); + // Set the contents + TBool fail = !SetContentsL( aNewString ); + // Test if list contents match the new intended contents + fail |= !Equals( aNewString ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test setting contents and test notifications also +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TrySetContentsL( const TDesC8& aOldString, const TDesC8& aNewString, + const TNotification::TData* aNotificationList ) + { + // Test list creation + TBool fail = !TrySetContentsL( aOldString, aNewString ); + // Test if notification list matches expected + fail |= !Equals( aNewString, aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test setting contents and test notifications also +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TrySetContentsL( const TDesC8& aOldString, const TDesC8& aNewString, + const TDesC8& aNewStringWithStaticItems, + const TNotification::TData* aNotificationList, + TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ) + { + // Create list + CreateListL( aOldString, aStaticItemsEnabled, aStaticItemInfos ); + + TBool fail = !SetContentsL( aNewString ); + fail |= !Equals( aNewString, aNewStringWithStaticItems, aStaticItemsEnabled, + aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test setting contents and test notifications also with and without static items +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TrySetContentsL( const TDesC8& aOldString, const TDesC8& aNewString, + const TDesC8& aNewStringWithStaticItems, + const TNotification::TData* aNotificationListStaticItemsEnabled, + const TNotification::TData* aNotificationListStaticItemsDisabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ) + { + // without adding static items, while static items are enabled + TBool fail = !TrySetContentsL( aOldString, aNewString, aNewString, + aNotificationListStaticItemsDisabled, ETrue, NULL ); + + // without adding static items, while static items are disabled + fail |= !TrySetContentsL( aOldString, aNewString, aNewStringWithStaticItems, + aNotificationListStaticItemsDisabled, EFalse, NULL ); + + // with adding static items, while static items are enabled + fail |= !TrySetContentsL( aOldString, aNewString, aNewStringWithStaticItems, + aNotificationListStaticItemsEnabled, ETrue, aStaticItemInfos ); + + // with adding static items, while static items are disabled + fail |= !TrySetContentsL( aOldString, aNewString, aNewStringWithStaticItems, + aNotificationListStaticItemsDisabled, EFalse, aStaticItemInfos ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test Adding a static item +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TryAddStaticItemL( const TDesC8& aInitString, TChar aStaticItemId, + NGlxListDefs::TInsertionPosition aInsertPos, + const TDesC8& aStringAfter, + const TNotification::TData* aNotificationList, + TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ) + { + CreateListL( aInitString, aStaticItemsEnabled, aStaticItemInfos ); + CGlxMedia* media = new (ELeave) CGlxMedia( TGlxMediaId ( aStaticItemId ) ); + CleanupStack::PushL( media ); + iList->AddStaticItemL( media, aInsertPos ); + CleanupStack::Pop( media ); + + TBool fail = !Equals( aInitString, aStringAfter, aStaticItemsEnabled, + aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test Adding a static item +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TryAddStaticItemL( const TDesC8& aInitString, + TChar aStaticItemId, NGlxListDefs::TInsertionPosition aInsertPos, + const TDesC8& aStringAfter, const TNotification::TData* aNotificationListForAdd, + const TNotification::TData* aNotificationListForAllStatic, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ) + { + TNotification::TData noNotifications[] = + { { END_MARKER } }; + + // with adding static items, while static items are enabled + TBool fail = !TryAddStaticItemL( aInitString, aStaticItemId, aInsertPos, + aStringAfter, aNotificationListForAdd, ETrue, aStaticItemInfos ); + + // with adding static items, while static items are disabled + fail |= !TryAddStaticItemL( aInitString, aStaticItemId, aInsertPos, + aInitString, noNotifications, EFalse, aStaticItemInfos ); + + // turn on static items, to make sure items were added in disabled state + iReconstruction->ClearNotifications(); + iList->SetStaticItemsEnabled( ETrue ); + fail |= !Equals( aStringAfter, aNotificationListForAllStatic ); + + return !fail; + } + + +// ----------------------------------------------------------------------------- +// Test removing an item +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TryRemoveL( const TDesC8& aOldString, const TChar aItemToRemove, + const TDesC8& aNewString, const TNotification::TData* aNotificationList ) + { + CreateListL( aOldString ); + iList->Remove( KListIdSpace, TGlxMediaId( aItemToRemove ) ); + // Test if notification list matches expected + return Equals( aNewString, aNotificationList ); + } + +// ----------------------------------------------------------------------------- +// Test removing an item +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TryRemoveL( const TDesC8& aOldString, const TChar aItemToRemove, + TBool aIsStaticId, const TDesC8& aNewString, + const TNotification::TData* aNotificationList, + TBool aStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos ) + { + CreateListL( aOldString, aStaticItemsEnabled, aStaticItemInfos ); + + iList->Remove( aIsStaticId ? KGlxStaticItemIdSpaceId : KListIdSpace, + TGlxMediaId( aItemToRemove ) ); + TBool fail = !Equals( aNewString, aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test setting contents and test notifications also +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > +TBool CGlxListTestBase< _List, _Reconstruction > + ::TryRemoveL( const TDesC8& aOldString, const TChar aItemToRemove, TBool aIsStaticId, + const TDesC8& aNewStringWithoutStaticItems, + const TDesC8& aNewStringWithStaticItems, + const TNotification::TData* aNotificationListStaticItemsDisabled, + const TNotification::TData* aNotificationListStaticItemsEnabled, + NGlxListTestHelpers::TStaticItemInfo::TData* aStaticItemInfos) + { + // without adding static items, while static items are enabled + TBool fail = !TryRemoveL( aOldString, aItemToRemove, aIsStaticId, + aNewStringWithoutStaticItems, aNotificationListStaticItemsDisabled, + ETrue, NULL ); + + // without adding static items, while static items are disabled + fail |= !TryRemoveL( aOldString, aItemToRemove, aIsStaticId, + aNewStringWithoutStaticItems, aNotificationListStaticItemsDisabled, + EFalse, NULL ); + + // with adding static items, while static items are enabled + fail |= !TryRemoveL( aOldString, aItemToRemove, aIsStaticId, + aNewStringWithStaticItems, aNotificationListStaticItemsEnabled, + ETrue, aStaticItemInfos ); + + // with adding static items, while static items are disabled + fail |= !TryRemoveL( aOldString, aItemToRemove, aIsStaticId, + aNewStringWithoutStaticItems, aNotificationListStaticItemsDisabled, + EFalse, aStaticItemInfos ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// MGlxMediaPool::Media implementation +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + CMPXCollectionPath* CGlxListTestBase< _List, _Reconstruction > + ::CreatePathLC( const TDesC8& aString ) + { + // Populate array from the string + RArray ids; + CleanupClosePushL( ids ); + TInt count = aString.Length(); + for ( TInt i = 0; i < count; i++ ) + { + ids.AppendL( aString[ i ] ); + } + // Populate path from the array + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( ids.Array() ); + CleanupStack::Pop( path ); // ids + CleanupStack::PopAndDestroy(); // ids + CleanupStack::PushL( path ); + return path; + } + +// ----------------------------------------------------------------------------- +// Add a static item +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::AddStaticItemL( + TChar aId, NGlxListDefs::TInsertionPosition aPosition ) + { + ASSERT( iList ); + CGlxMedia* item = new (ELeave) CGlxMedia( TGlxMediaId( aId ) ); + CleanupStack::PushL( item ); + iList->AddStaticItemL( item, aPosition ); + CleanupStack::Pop( item ); + } + +// ----------------------------------------------------------------------------- +// Add a static items +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction > + ::AddStaticItemsL( NGlxListTestHelpers::TStaticItemInfo::TData* aInfos ) + { + if ( aInfos ) + { + TInt i = 0; + while ( NGlxListTestHelpers::KEndMarker != aInfos[ i ] ) + { + AddStaticItemL( aInfos[ i ].iId, aInfos[ i ].iPosition ); + i++; + } + } + } + +// ----------------------------------------------------------------------------- +// Check if counts equal +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction >::CountEqualsL( TInt aAll, + TInt aNonStatic, TInt aAllStatic, TInt aPreStatic, TInt aPostStatic ) + { + TBool enabled = iList->IsStaticItemsEnabled(); + + // static items disabled + iList->SetStaticItemsEnabled( EFalse ); + TBool fail = ( iList->Count( NGlxListDefs::ECountAll ) != aNonStatic ); + fail |= ( iList->Count( NGlxListDefs::ECountNonStatic ) != aNonStatic ); + fail |= ( iList->Count( NGlxListDefs::ECountAllStatic ) != 0 ); + fail |= ( iList->Count( NGlxListDefs::ECountPreStatic ) != 0 ); + fail |= ( iList->Count( NGlxListDefs::ECountPostStatic ) != 0 ); + fail |= ( iList->Count() != iList->Count( NGlxListDefs::ECountAll ) ); + + // static items enabled + iList->SetStaticItemsEnabled( ETrue ); + fail |= ( iList->Count( NGlxListDefs::ECountAll ) != aAll ); + fail |= ( iList->Count( NGlxListDefs::ECountNonStatic ) != aNonStatic ); + fail |= ( iList->Count( NGlxListDefs::ECountAllStatic ) != aAllStatic ); + fail |= ( iList->Count( NGlxListDefs::ECountPreStatic ) != aPreStatic ); + fail |= ( iList->Count( NGlxListDefs::ECountPostStatic ) != aPostStatic ); + fail |= ( iList->Count() != iList->Count( NGlxListDefs::ECountAll ) ); + + // Reset to original state + iList->SetStaticItemsEnabled( enabled ); + return !fail; + } + +// ----------------------------------------------------------------------------- +// Try enabling static items +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + TBool CGlxListTestBase< _List, _Reconstruction > + ::TrySetStaticItemsEnabledL( const TDesC8& aStringWithoutStaticItems, + const TDesC8& aStringWithStaticItems, + NGlxListTestHelpers::TStaticItemInfo::TData* aInfos, + const TNotification::TData* aNotificationListForEnable, + const TNotification::TData* aNotificationListForDisable ) + { + CreateListL( aStringWithoutStaticItems ); + AddStaticItemsL( aInfos ); + iList->SetStaticItemsEnabled( EFalse ); + TBool fail = iList->IsStaticItemsEnabled(); + // test enabling static items + iReconstruction->ClearNotifications(); + iList->SetStaticItemsEnabled( ETrue ); + fail |= !iList->IsStaticItemsEnabled(); + fail |= !Equals( aStringWithStaticItems, aNotificationListForEnable ); + // test disabling static items + iReconstruction->ClearNotifications(); + iList->SetStaticItemsEnabled( EFalse ); + fail |= iList->IsStaticItemsEnabled(); + fail |= !Equals( aStringWithoutStaticItems, aNotificationListForDisable ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test Count(...) +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::TestCountL() + { + // Test list with no normal items + CreateListL( _L8("") ); + EUNIT_ASSERT( CountEqualsL( 0, 0, 0, 0, 0 ) ); // All, non-static, static, pre-static, post-static + + AddStaticItemL( '0', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( CountEqualsL( 1, 0, 1, 1, 0 ) ); // All, non-static, static, pre-static, post-static + + AddStaticItemL( '1', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( CountEqualsL( 2, 0, 2, 2, 0 ) ); // All, non-static, static, pre-static, post-static + + AddStaticItemL( '2', NGlxListDefs::EInsertLast ); + EUNIT_ASSERT( CountEqualsL( 3, 0, 3, 2, 1 ) ); // All, non-static, static, pre-static, post-static + + // Test list with normal items + CreateListL( _L8("abcdefg") ); + // test items + EUNIT_ASSERT( CountEqualsL( 7, 7, 0, 0, 0 ) ); // All, non-static, static, pre-static, post-static + + AddStaticItemL( '0', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( CountEqualsL( 8, 7, 1, 1, 0 ) ); // All, non-static, static, pre-static, post-static + + AddStaticItemL( '1', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( CountEqualsL( 9, 7, 2, 2, 0 ) ); // All, non-static, static, pre-static, post-static + + AddStaticItemL( '2', NGlxListDefs::EInsertLast ); + EUNIT_ASSERT( CountEqualsL( 10, 7, 3, 2, 1 ) ); // All, non-static, static, pre-static, post-static + } + +// ----------------------------------------------------------------------------- +// Test Item(...) +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::TestItemL( ) + { + // Test list with no normal items + CreateListL( _L8("") ); + AddStaticItemL( '0', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Item(0).Id() == TGlxMediaId( '0' ) ); + + AddStaticItemL( '1', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Item(0).Id() == TGlxMediaId( '1' ) ); + EUNIT_ASSERT( iList->Item(1).Id() == TGlxMediaId( '0' ) ); + + AddStaticItemL( '2', NGlxListDefs::EInsertLast ); + EUNIT_ASSERT( iList->Item(0).Id() == TGlxMediaId( '1' ) ); + EUNIT_ASSERT( iList->Item(1).Id() == TGlxMediaId( '0' ) ); + EUNIT_ASSERT( iList->Item(2).Id() == TGlxMediaId( '2' ) ); + + // Test list with normal items + CreateListL( _L8("abcdefg") ); + // test items + EUNIT_ASSERT( iList->Item(0).Id() == TGlxMediaId( 'a' ) ); + EUNIT_ASSERT( iList->Item(2).Id() == TGlxMediaId( 'c' ) ); + EUNIT_ASSERT( iList->Item(6).Id() == TGlxMediaId( 'g' ) ); + + AddStaticItemL( '0', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Item(0).Id() == TGlxMediaId( '0' ) ); + EUNIT_ASSERT( iList->Item(1).Id() == TGlxMediaId( 'a' ) ); + EUNIT_ASSERT( iList->Item(3).Id() == TGlxMediaId( 'c' ) ); + EUNIT_ASSERT( iList->Item(7).Id() == TGlxMediaId( 'g' ) ); + + AddStaticItemL( '1', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Item(0).Id() == TGlxMediaId( '1' ) ); + EUNIT_ASSERT( iList->Item(1).Id() == TGlxMediaId( '0' ) ); + EUNIT_ASSERT( iList->Item(2).Id() == TGlxMediaId( 'a' ) ); + EUNIT_ASSERT( iList->Item(4).Id() == TGlxMediaId( 'c' ) ); + EUNIT_ASSERT( iList->Item(8).Id() == TGlxMediaId( 'g' ) ); + + AddStaticItemL( '2', NGlxListDefs::EInsertLast ); + EUNIT_ASSERT( iList->Item(0).Id() == TGlxMediaId( '1' ) ); + EUNIT_ASSERT( iList->Item(1).Id() == TGlxMediaId( '0' ) ); + EUNIT_ASSERT( iList->Item(2).Id() == TGlxMediaId( 'a' ) ); + EUNIT_ASSERT( iList->Item(4).Id() == TGlxMediaId( 'c' ) ); + EUNIT_ASSERT( iList->Item(8).Id() == TGlxMediaId( 'g' ) ); + EUNIT_ASSERT( iList->Item(9).Id() == TGlxMediaId( '2' ) ); + } + +// ----------------------------------------------------------------------------- +// Test Index(...) +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::TestIndexL() + { + // Test list with no normal items + CreateListL( _L8("") ); + AddStaticItemL( '0', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '0' ) ) == 0 ); + + AddStaticItemL( '1', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '1' ) ) == 0 ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '0' ) ) == 1 ); + + AddStaticItemL( '2', NGlxListDefs::EInsertLast ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '1' ) ) == 0 ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '0' ) ) == 1 ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '2' ) ) == 2 ); + + // Test list with normal items + CreateListL( _L8("abcdefg") ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'a' ) ) == 0 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'c' ) ) == 2 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'g' ) ) == 6 ); + + AddStaticItemL( '0', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '0' ) ) == 0 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'a' ) ) == 1 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'c' ) ) == 3 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'g' ) ) == 7 ); + + AddStaticItemL( '1', NGlxListDefs::EInsertFirst ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '1' ) ) == 0 ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '0' ) ) == 1 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'a' ) ) == 2 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'c' ) ) == 4 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'g' ) ) == 8 ); + + AddStaticItemL( '2', NGlxListDefs::EInsertLast ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '1' ) ) == 0 ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '0' ) ) == 1 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'a' ) ) == 2 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'c' ) ) == 4 ); + EUNIT_ASSERT( iList->Index(KListIdSpace, TGlxMediaId( 'g' ) ) == 8 ); + EUNIT_ASSERT( iList->Index(KGlxStaticItemIdSpaceId, TGlxMediaId( '2' ) ) == 9 ); + } + +// ----------------------------------------------------------------------------- +// Test IdSpaceId +// ----------------------------------------------------------------------------- +// +template < class _List, class _Reconstruction > + void CGlxListTestBase< _List, _Reconstruction >::TestIdSpaceIdL() + { + CreateReconstructionL(); + iList = _List::NewL( KListIdSpace, *iReconstruction, *this ); + EUNIT_ASSERT( iList->IdSpaceId() == TGlxIdSpaceId( 1 ) ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxcache/t_cglxcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxcache/t_cglxcache.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,807 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCache unit tests +* +*/ + + + + +// CLASS HEADER +#include "t_cglxcache.h" + +// EXTERNAL INCLUDES +#include +#include + +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "glxcachemanager.h" +#include "glxmedia.h" + +#include "glxmediageneraldefs.h" + +#include "glxpanic.h" + +#include "t_cachetesthelpers.h" + +const TInt KIdSpaceId = 1; + +const TInt KMediaId1 = 1; +const TInt KMediaId2 = 2; +const TInt KMediaId3 = 3; +const TInt KMediaId4 = 4; +const TInt KMediaId5 = 5; + +// CONSTRUCTION +T_CGlxCache* T_CGlxCache::NewL() + { + T_CGlxCache* self = T_CGlxCache::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CGlxCache* T_CGlxCache::NewLC() + { + T_CGlxCache* self = new( ELeave ) T_CGlxCache(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CGlxCache::~T_CGlxCache() + { + } + +// Default constructor +T_CGlxCache::T_CGlxCache() + { + } + +// Second phase construct +void T_CGlxCache::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void T_CGlxCache::SetupL( ) + { + iCacheManager = CGlxCacheManager::InstanceL(); + iCGlxCache = new (ELeave) CGlxCache(TGlxIdSpaceId(KIdSpaceId),iCacheManager); + + SetupCacheL(); + } + + +void T_CGlxCache::Teardown( ) + { + iCacheManager->Close(); + delete iCGlxCache; + iCGlxCache = NULL; + } + + +void T_CGlxCache::T_CGlxCache_IdSpaceIdL( ) + { + TGlxIdSpaceId idSpaceId = iCGlxCache->IdSpaceId( ); + EUNIT_PRINT(_L("Check IdSpaceId")); + EUNIT_ASSERT_DESC( idSpaceId == TGlxIdSpaceId(KIdSpaceId), "Incorrect IdSpaceId"); + } + +void T_CGlxCache::T_CGlxCache_MediaUpdatedLL( ) + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + // New media + CMPXMedia* newMedia3 = CMPXMedia::NewL(); + CleanupStack::PushL(newMedia3); + + newMedia3->SetTObjectValueL(KMPXMediaGeneralId, TMPXItemId(KMediaId3)); + + EUNIT_PRINT(_L("Add new media")); + iCGlxCache->MediaUpdatedL(*newMedia3); + + EUNIT_PRINT(_L("Check new media added")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 3, "Cache doesn't contain three items"); + + TInt cachedNewMedia3Index = cacheTestHelper.ItemPool().FindInOrder(TGlxMediaId(KMediaId3), T_CacheTestHelpers::MediaItemOrderByKey); + EUNIT_ASSERT_DESC(cachedNewMedia3Index != KErrNotFound, "New media not added to cache"); + + CleanupStack::PopAndDestroy(newMedia3); + + // Multiple new media + CMPXMedia* newMultipleMedia = CMPXMedia::NewL(); + CleanupStack::PushL(newMultipleMedia); + + CMPXMediaArray* newMediaArray = CMPXMediaArray::NewL(); + CleanupStack::PushL(newMediaArray); + + CMPXMedia* newMedia4 = CMPXMedia::NewL(); + CleanupStack::PushL(newMedia4); + + newMedia4->SetTObjectValueL(KMPXMediaGeneralId, TMPXItemId(KMediaId4)); + + newMediaArray->AppendL(newMedia4); + CleanupStack::Pop(newMedia4); + + CMPXMedia* newMedia5 = CMPXMedia::NewL(); + CleanupStack::PushL(newMedia5); + + newMedia5->SetTObjectValueL(KMPXMediaGeneralId, TMPXItemId(KMediaId5)); + + newMediaArray->AppendL(newMedia5); + CleanupStack::Pop(newMedia5); + + newMultipleMedia->SetCObjectValueL(KMPXMediaArrayContents, newMediaArray); + newMultipleMedia->SetTObjectValueL(KMPXMediaArrayCount, newMediaArray->Count()); + + EUNIT_PRINT(_L("Add multiple new media")); + iCGlxCache->MediaUpdatedL(*newMultipleMedia); + + CleanupStack::PopAndDestroy(newMediaArray); + CleanupStack::PopAndDestroy(newMultipleMedia); + + EUNIT_PRINT(_L("Check multiple new media added")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 5, "Cache doesn't contain five items"); + + TInt cachedNewMedia4Index = cacheTestHelper.ItemPool().FindInOrder(TGlxMediaId(KMediaId4), T_CacheTestHelpers::MediaItemOrderByKey); + TInt cachedNewMedia5Index = cacheTestHelper.ItemPool().FindInOrder(TGlxMediaId(KMediaId5), T_CacheTestHelpers::MediaItemOrderByKey); + EUNIT_ASSERT_DESC((cachedNewMedia4Index != KErrNotFound) && (cachedNewMedia5Index != KErrNotFound), "Multiple new media not added to cache"); + } + +void T_CGlxCache::T_CGlxCache_UpdateMediaLL( ) + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + // Create cache observer class + CGlxCacheObserverTest* cacheObserver = CGlxCacheObserverTest::NewL(); + CleanupStack::PushL(cacheObserver); + + CGlxCacheManager* cacheManager = CGlxCacheManager::InstanceL(); + CleanupClosePushL(*cacheManager); + + cacheManager->AddObserverL(cacheObserver); + + // New media without id + CMPXMedia* newMedia3 = CMPXMedia::NewL(); + CleanupStack::PushL(newMedia3); + + EUNIT_PRINT(_L("Add new media without id")); + iCGlxCache->UpdateMediaL(*newMedia3); + + EUNIT_PRINT(_L("Check new media not added")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 2, "Cache doesn't contain two items"); + + // New media without attributes + newMedia3->SetTObjectValueL(KMPXMediaGeneralId, TMPXItemId(KMediaId3)); + + EUNIT_PRINT(_L("Add new media without attributes")); + iCGlxCache->UpdateMediaL(*newMedia3); + + EUNIT_PRINT(_L("Check new media added without attributes")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 3, "Cache doesn't contain three items"); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool()[2]->Count() == 0, "Item contains attributes"); + + TInt cachedNewMedia3Index = cacheTestHelper.ItemPool().FindInOrder(TGlxMediaId(KMediaId3), T_CacheTestHelpers::MediaItemOrderByKey); + EUNIT_ASSERT_DESC(cachedNewMedia3Index != KErrNotFound, "New media not added to cache"); + + EUNIT_PRINT(_L("Check observer not notified of new media attributes")); + EUNIT_ASSERT_DESC(!cacheObserver->AttributesAvailableNotified(), "Observer notified of new media attributes"); + + CleanupStack::PopAndDestroy(newMedia3); + + // New media with attributes + CMPXMedia* newMedia4 = CMPXMedia::NewL(); + CleanupStack::PushL(newMedia4); + + newMedia4->SetTObjectValueL(KMPXMediaGeneralId, TMPXItemId(KMediaId4)); + newMedia4->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(640, 480)); + + EUNIT_PRINT(_L("Add new media with attributes")); + cacheObserver->ResetCalls(); + iCGlxCache->UpdateMediaL(*newMedia4); + + EUNIT_PRINT(_L("Check new media added with attributes")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 4, "Cache doesn't contain four items"); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool()[3]->Count() == 1, "Item doesn't contain attributes"); + + EUNIT_PRINT(_L("Check observer notified of new media attributes")); + EUNIT_ASSERT_DESC(cacheObserver->AttributesAvailableNotified(), "Observer not notified of new media attributes"); + EUNIT_ASSERT_DESC(cacheObserver->IdSpaceId().Value() == KIdSpaceId, "Observer not notified of correct new media IdSpaceId"); + EUNIT_ASSERT_DESC(cacheObserver->MediaId().Value() == KMediaId4, "Observer not notified of correct new media Id"); + + EUNIT_ASSERT_DESC(TMPXAttribute::Match(cacheObserver->Attributes()[0], KGlxMediaGeneralDimensions), "Observer not notified of correct new media attribute"); + EUNIT_ASSERT_DESC(cacheObserver->Attributes().Count() == 1, "Observer not notified of correct new media attribute count"); + + EUNIT_ASSERT_DESC(cacheObserver->Media() == cacheTestHelper.ItemPool()[3], "Observer not notified of correct new media pointer"); + + CleanupStack::PopAndDestroy(newMedia4); + + // Create media user class + CGlxMediaUserTest* mediaUser = CGlxMediaUserTest::NewL(); + CleanupStack::PushL(mediaUser); + + cacheTestHelper.ItemPool()[0]->ReserveUsersL(1); + cacheTestHelper.ItemPool()[0]->AddUser(*mediaUser, KErrNotFound); + + // Update media with existing attributes + CMPXMedia* Media1 = CMPXMedia::NewL(); + CleanupStack::PushL(Media1); + Media1->SetTObjectValueL(KMPXMediaGeneralId, TMPXItemId(KMediaId1)); + Media1->SetTObjectValueL(KMPXMediaDrmProtected, ETrue); + + EUNIT_PRINT(_L("Update media with existing attributes")); + cacheObserver->ResetCalls(); + iCGlxCache->UpdateMediaL(*Media1); + + EUNIT_PRINT(_L("Check media updated with existing attributes")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 4, "Cache doesn't contain four items"); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool()[0]->Count() == 1, "Item doesn't contain 1 attribute"); + + EUNIT_PRINT(_L("Check user not notified of media new attributes")); + EUNIT_ASSERT_DESC(!mediaUser->AttributesAvailableNotified(), "User notified of updated media new attributes"); + EUNIT_ASSERT_DESC(!cacheObserver->AttributesAvailableNotified(), "Observer notified of updated media new attributes"); + + // Update media with new attributes + Media1->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(1024, 768)); + + EUNIT_PRINT(_L("Update media with new attributes")); + cacheObserver->ResetCalls(); + mediaUser->ResetCalls(); + iCGlxCache->UpdateMediaL(*Media1); + + EUNIT_PRINT(_L("Check media updated with new attributes")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 4, "Cache doesn't contain four items"); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool()[0]->Count() == 2, "Item doesn't contain 2 attributes"); + + EUNIT_PRINT(_L("Check user notified of updated media new attributes")); + EUNIT_ASSERT_DESC(mediaUser->AttributesAvailableNotified(), "User not notified of updated media new attributes"); + EUNIT_ASSERT_DESC(mediaUser->IdSpaceId().Value() == KIdSpaceId, "User not notified of correct updated media IdSpaceId"); + EUNIT_ASSERT_DESC(mediaUser->MediaId().Value() == KMediaId1, "User not notified of correct updated media Id"); + + EUNIT_ASSERT_DESC(TMPXAttribute::Match(mediaUser->Attributes()[0], KGlxMediaGeneralDimensions), "Observer not notified of correct updated media attribute"); + EUNIT_ASSERT_DESC(mediaUser->Attributes().Count() == 1, "Observer not notified of correct updated media attribute count"); + + EUNIT_PRINT(_L("Check observer notified of updated media new attributes")); + EUNIT_ASSERT_DESC(cacheObserver->AttributesAvailableNotified(), "Observer not notified of updated media new attributes"); + EUNIT_ASSERT_DESC(cacheObserver->IdSpaceId().Value() == KIdSpaceId, "Observer not notified of correct updated media IdSpaceId"); + EUNIT_ASSERT_DESC(cacheObserver->MediaId().Value() == KMediaId1, "Observer not notified of correct updated media Id"); + + EUNIT_ASSERT_DESC(TMPXAttribute::Match(cacheObserver->Attributes()[0], KGlxMediaGeneralDimensions), "Observer not notified of correct updated media attribute"); + EUNIT_ASSERT_DESC(cacheObserver->Attributes().Count() == 1, "Observer not notified of correct updated media attribute count"); + + EUNIT_ASSERT_DESC(cacheObserver->Media() == cacheTestHelper.ItemPool()[0], "Observer not notified of correct updated media pointer"); + + cacheTestHelper.ItemPool()[0]->RemoveUser(*mediaUser); + cacheManager->RemoveObserver(cacheObserver); + + CleanupStack::PopAndDestroy(Media1); + CleanupStack::PopAndDestroy(mediaUser); + CleanupStack::PopAndDestroy(cacheManager); + CleanupStack::PopAndDestroy(cacheObserver); + } + +void T_CGlxCache::T_CGlxCache_HandleItemModifiedL( ) + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + RArray attributes; + CleanupClosePushL(attributes); + + attributes.AppendL(KMPXMediaDrmProtected); + + EUNIT_PRINT(_L("Modify item attributes")); + iCGlxCache->HandleItemModified(TGlxMediaId(KMediaId1), attributes); + + CleanupStack::PopAndDestroy(&attributes); + + EUNIT_PRINT(_L("Check attribute deleted as result of item modification")); + TInt Media1AttributeCount = cacheTestHelper.ItemPool()[0]->Count(); + TInt Media2AttributeCount = cacheTestHelper.ItemPool()[1]->Count(); + + EUNIT_ASSERT_DESC(Media1AttributeCount == 0, "Attribute not deleted for item modified"); + EUNIT_ASSERT_DESC(Media2AttributeCount == 1, "Attribute deleted for item not modified"); + } + +void T_CGlxCache::T_CGlxCache_MediaL( ) + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + EUNIT_PRINT(_L("Obtain non-existing media by id")); + CGlxMedia* media = iCGlxCache->Media(TGlxMediaId(KMediaId3)); + + EUNIT_PRINT(_L("Check returned media")); + EUNIT_ASSERT_DESC(media == NULL, "Media returned"); + + EUNIT_PRINT(_L("Obtain media by id")); + media = iCGlxCache->Media(TGlxMediaId(KMediaId1)); + + EUNIT_PRINT(_L("Check returned media")); + EUNIT_ASSERT_DESC(media == cacheTestHelper.ItemPool()[0], "Incorrect media returned"); + } + +void T_CGlxCache::T_CGlxCache_FindItemForceCreateLL( ) + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + // Find existing instance + EUNIT_PRINT(_L("Find existing media")); + CGlxMedia* media = iCGlxCache->FindItemForceCreateL(TGlxMediaId(KMediaId1)); + + EUNIT_PRINT(_L("Check returned media")); + EUNIT_ASSERT_DESC(media == cacheTestHelper.ItemPool()[0], "Incorrect media returned"); + + // Find non-existing media + EUNIT_PRINT(_L("Find non-existing media")); + media = iCGlxCache->FindItemForceCreateL(TGlxMediaId(KMediaId3)); + + EUNIT_PRINT(_L("Check returned media")); + EUNIT_ASSERT_DESC(media == cacheTestHelper.ItemPool()[2], "Incorrect media returned"); + } + +void T_CGlxCache::T_CGlxCache_CountL( ) + { + EUNIT_PRINT(_L("Obtain media count")); + TInt count = iCGlxCache->Count(); + + EUNIT_PRINT(_L("Check media count")); + EUNIT_ASSERT_DESC(count == 2, "Incorrect media count"); + } + +void T_CGlxCache::T_CGlxCache_Media2L( ) + { + EUNIT_PRINT(_L("Obtain media by index")); + CGlxMedia& media = iCGlxCache->Media(1); + + EUNIT_PRINT(_L("Check returned media")); + EUNIT_ASSERT_DESC(media.Id().Value() == KMediaId2, "Incorrect media returned"); + } + +void T_CGlxCache::T_CGlxCache_Delete_SubTest1L( ) + { +#ifdef _DEBUG + // Delete index less than 0 + EUNIT_PRINT(_L("Delete index less than 0")); + EUNIT_ASSERT_PANIC_DESC(iCGlxCache->Delete(-1), "Images & videos", EGlxPanicIllegalArgument, "Incorrect panic"); +#endif // _DEBUG + } + +void T_CGlxCache::T_CGlxCache_Delete_SubTest2L( ) + { +#ifdef _DEBUG + // Delete index greater than number of items + EUNIT_PRINT(_L("Delete index greater than number of items")); + EUNIT_ASSERT_PANIC_DESC(iCGlxCache->Delete(2), "Images & videos", EGlxPanicIllegalArgument, "Incorrect panic"); +#endif // _DEBUG + } + +void T_CGlxCache::T_CGlxCache_Delete_SubTest3L( ) + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + // Create item without users + CGlxMedia* media3 = new (ELeave) CGlxMedia(TGlxMediaId(KMediaId3)); + CleanupStack::PushL(media3); + + media3->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + cacheTestHelper.ItemPool().AppendL(media3); + + CleanupStack::Pop(media3); + + // Delete item without users + EUNIT_PRINT(_L("Delete item without users")); + iCGlxCache->Delete(2); + + EUNIT_PRINT(_L("Check item deleted")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 2, "Cache doesn't contain two items"); + + TInt media1Index = cacheTestHelper.ItemPool().FindInOrder(TGlxMediaId(KMediaId1), T_CacheTestHelpers::MediaItemOrderByKey); + TInt media2Index = cacheTestHelper.ItemPool().FindInOrder(TGlxMediaId(KMediaId2), T_CacheTestHelpers::MediaItemOrderByKey); + EUNIT_ASSERT_DESC((media1Index != KErrNotFound) && (media2Index != KErrNotFound), "Incorrect item deleted from cache"); + } + +void T_CGlxCache::T_CGlxCache_Delete_SubTest4L( ) + { +#ifdef _DEBUG + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + // Create media user class + CGlxMediaUserTest* mediaUser = CGlxMediaUserTest::NewL(); + CleanupStack::PushL(mediaUser); + + cacheTestHelper.ItemPool()[0]->ReserveUsersL(1); + cacheTestHelper.ItemPool()[0]->AddUser(*mediaUser, KErrNotFound); + + // Delete item where user doesn't have reference to media + EUNIT_PRINT(_L("Delete item where user doesn't have reference to media")); + EUNIT_ASSERT_PANIC_DESC(iCGlxCache->Delete(0), "Images & videos", EGlxPanicLogicError, "Item deleted where user had reference to media"); +#endif // _DEBUG + } + +void T_CGlxCache::T_CGlxCache_Delete_SubTest5L( ) + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + // Create media user class + CGlxMediaUserTest* mediaUser = CGlxMediaUserTest::NewL(); + CleanupStack::PushL(mediaUser); + + cacheTestHelper.ItemPool()[1]->ReserveUsersL(1); + cacheTestHelper.ItemPool()[1]->AddUser(*mediaUser, KErrNotFound); + + // Delete item where user has reference to media + EUNIT_PRINT(_L("Delete item where user has reference to media")); + iCGlxCache->Delete(1); + + EUNIT_PRINT(_L("Check item deleted")); + EUNIT_ASSERT_DESC(cacheTestHelper.ItemPool().Count() == 1, "Cache doesn't contain one item"); + + TInt media1Index = cacheTestHelper.ItemPool().FindInOrder(TGlxMediaId(KMediaId1), T_CacheTestHelpers::MediaItemOrderByKey); + EUNIT_ASSERT_DESC(media1Index != KErrNotFound, "Incorrect item deleted from cache"); + + EUNIT_PRINT(_L("Check user called to remove reference")); + EUNIT_ASSERT_DESC(mediaUser->RemoveReferenceCalled(), "User not called to remove reference"); + + CleanupStack::PopAndDestroy(mediaUser); + } + +void T_CGlxCache::T_CGlxCache_ReserveUsersLL( ) + { + // iCGlxCache->ReserveUsersL( ); + EUNIT_ASSERT_DESC( EFalse, "Generated assert, replace with real"); + } + +void T_CGlxCache::SetupCacheL() + { + // Create helper class + T_CacheTestHelpers cacheTestHelper(iCGlxCache); + + CGlxMedia* media1 = new (ELeave) CGlxMedia(TGlxMediaId(KMediaId1)); + CleanupStack::PushL(media1); + + media1->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); + cacheTestHelper.ItemPool().AppendL(media1); + + CleanupStack::Pop(media1); + + CGlxMedia* media2 = new (ELeave) CGlxMedia(TGlxMediaId(KMediaId2)); + CleanupStack::PushL(media2); + + media2->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(320, 240)); + cacheTestHelper.ItemPool().AppendL(media2); + + CleanupStack::Pop(media2); + } + +// Test cache observer +T_CGlxCache::CGlxCacheObserverTest* T_CGlxCache::CGlxCacheObserverTest::NewL() + { + CGlxCacheObserverTest* self = new (ELeave) CGlxCacheObserverTest(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +T_CGlxCache::CGlxCacheObserverTest::CGlxCacheObserverTest() : + iAttributesAvailableNotified(EFalse), + iIdSpaceId(KGlxIdNone), + iMediaId(KGlxIdNone), + iAttributes(), + iMedia(NULL) + { + } + +T_CGlxCache::CGlxCacheObserverTest::~CGlxCacheObserverTest() + { + iAttributes.Close(); + } + +void T_CGlxCache::CGlxCacheObserverTest::ConstructL() + { + } + +TBool T_CGlxCache::CGlxCacheObserverTest::AttributesAvailableNotified() const + { + return iAttributesAvailableNotified; + } + +void T_CGlxCache::CGlxCacheObserverTest::ResetCalls() + { + iAttributesAvailableNotified = EFalse; + } + +const TGlxIdSpaceId& T_CGlxCache::CGlxCacheObserverTest::IdSpaceId() const + { + return iIdSpaceId; + } + +const TGlxMediaId& T_CGlxCache::CGlxCacheObserverTest::MediaId() const + { + return iMediaId; + } + +const RArray& T_CGlxCache::CGlxCacheObserverTest::Attributes() const + { + return iAttributes; + } + +const CGlxMedia* T_CGlxCache::CGlxCacheObserverTest::Media() const + { + return iMedia; + } + +void T_CGlxCache::CGlxCacheObserverTest::HandleAttributesAvailableL( + const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId, + const RArray& aAttributes, + const CGlxMedia* aMedia) + { + iIdSpaceId = aIdSpaceId; + iMediaId = aMediaId; + + iAttributes.Reset(); + TInt attributeCount = aAttributes.Count(); + for (TInt i = 0; i < attributeCount; ++i) + { + TMPXAttribute attribute = aAttributes[i]; + iAttributes.AppendL(attribute); + } + + iMedia = const_cast(aMedia); + + iAttributesAvailableNotified = ETrue; + } + + +void T_CGlxCache::CGlxCacheObserverTest::CleanupMedia(const TGlxMediaId& /*aMediaId*/) + { + //No Implementation + } + + +// Test media user +T_CGlxCache::CGlxMediaUserTest* T_CGlxCache::CGlxMediaUserTest::NewL() + { + CGlxMediaUserTest* self = new (ELeave) CGlxMediaUserTest(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +T_CGlxCache::CGlxMediaUserTest::CGlxMediaUserTest() : + iAttributesAvailableNotified(EFalse), + iRemoveReferenceCalled(EFalse), + iIdSpaceId(KGlxIdNone), + iMediaId(KGlxIdNone), + iAttributes() + { + } + +T_CGlxCache::CGlxMediaUserTest::~CGlxMediaUserTest() + { + iAttributes.Close(); + } + +void T_CGlxCache::CGlxMediaUserTest::ConstructL() + { + } + +TBool T_CGlxCache::CGlxMediaUserTest::AttributesAvailableNotified() const + { + return iAttributesAvailableNotified; + } + +TBool T_CGlxCache::CGlxMediaUserTest::RemoveReferenceCalled() const + { + return iRemoveReferenceCalled; + } + +void T_CGlxCache::CGlxMediaUserTest::ResetCalls() + { + iAttributesAvailableNotified = EFalse; + iRemoveReferenceCalled = EFalse; + } + +const TGlxIdSpaceId& T_CGlxCache::CGlxMediaUserTest::IdSpaceId() const + { + return iIdSpaceId; + } + +const TGlxMediaId& T_CGlxCache::CGlxMediaUserTest::MediaId() const + { + return iMediaId; + } + +const RArray& T_CGlxCache::CGlxMediaUserTest::Attributes() const + { + return iAttributes; + } + +void T_CGlxCache::CGlxMediaUserTest::HandleAttributesAvailableL( + const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aItemId, + const RArray& aAttributes) + { + iIdSpaceId = aIdSpaceId; + iMediaId = aItemId; + + iAttributes.Reset(); + TInt attributeCount = aAttributes.Count(); + for (TInt i = 0; i < attributeCount; ++i) + { + TMPXAttribute attribute = aAttributes[i]; + iAttributes.AppendL(attribute); + } + + iAttributesAvailableNotified = ETrue; + } + +void T_CGlxCache::CGlxMediaUserTest::RemoveReference(CGlxMedia& aMedia) + { + // This is related to T_CGlxCache_Delete_SubTest4L and T_CGlxCache_Delete_SubTest5L + // T_CGlxCache_Delete_SubTest4L: Delete item where user doesn't have reference to media -> Don't remove reference + // T_CGlxCache_Delete_SubTest5L: Delete item where user has reference to media -> Remove reference + if (aMedia.Id().Value() == KMediaId2) + { + aMedia.RemoveUser(*this); + } + + iRemoveReferenceCalled = ETrue; + } + + +void T_CGlxCache::CGlxMediaUserTest::RemoveReference(TInt aIndex) + { + + } + + +void T_CGlxCache::CGlxMediaUserTest:: HandleAttributesAvailableL(TInt aIndex, + const RArray& aAttributes) + { + + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CGlxCache, + "Add test suite description here.", + "UNIT" ) + +EUNIT_TEST( + "IdSpaceId - test1", + "CGlxCache", + "IdSpaceId - test1", + "FUNCTIONALITY", + SetupL, T_CGlxCache_IdSpaceIdL, Teardown) + +/*EUNIT_TEST( + "MediaUpdatedL - test2", + "CGlxCache", + "MediaUpdatedL - test2", + "FUNCTIONALITY", + SetupL, T_CGlxCache_MediaUpdatedLL, Teardown)*/ + +/*EUNIT_TEST( + "UpdateMediaL - test3", + "CGlxCache", + "UpdateMediaL - test3", + "FUNCTIONALITY", + SetupL, T_CGlxCache_UpdateMediaLL, Teardown)*/ + +EUNIT_TEST( + "HandleItemModified - test4", + "CGlxCache", + "HandleItemModified - test4", + "FUNCTIONALITY", + SetupL, T_CGlxCache_HandleItemModifiedL, Teardown) + +EUNIT_TEST( + "Media - test5", + "CGlxCache", + "Media - test5", + "FUNCTIONALITY", + SetupL, T_CGlxCache_MediaL, Teardown) + +/*EUNIT_TEST( + "FindItemForceCreateL - test6", + "CGlxCache", + "FindItemForceCreateL - test6", + "FUNCTIONALITY", + SetupL, T_CGlxCache_FindItemForceCreateLL, Teardown)*/ + +EUNIT_TEST( + "Count - test7", + "CGlxCache", + "Count - test7", + "FUNCTIONALITY", + SetupL, T_CGlxCache_CountL, Teardown) + +EUNIT_TEST( + "Media - test8", + "CGlxCache", + "Media - test8", + "FUNCTIONALITY", + SetupL, T_CGlxCache_Media2L, Teardown) + +EUNIT_TEST( + "Delete - test9, subtest1", + "CGlxCache", + "Delete - test9, subtest1", + "FUNCTIONALITY", + SetupL, T_CGlxCache_Delete_SubTest1L, Teardown) + +EUNIT_TEST( + "Delete - test9, subtest2", + "CGlxCache", + "Delete - test9, subtest2", + "FUNCTIONALITY", + SetupL, T_CGlxCache_Delete_SubTest2L, Teardown) + +EUNIT_TEST( + "Delete - test9, subtest3", + "CGlxCache", + "Delete - test9, subtest3", + "FUNCTIONALITY", + SetupL, T_CGlxCache_Delete_SubTest3L, Teardown) + +EUNIT_TEST( + "Delete - test9, subtest4", + "CGlxCache", + "Delete - test9, subtest4", + "FUNCTIONALITY", + SetupL, T_CGlxCache_Delete_SubTest4L, Teardown) + +EUNIT_TEST( + "Delete - test9, subtest5", + "CGlxCache", + "Delete - test9, subtest5", + "FUNCTIONALITY", + SetupL, T_CGlxCache_Delete_SubTest5L, Teardown) + +/*EUNIT_TEST( + "ReserveUsersL - test10", + "CGlxCache", + "ReserveUsersL - test10", + "FUNCTIONALITY", + SetupL, T_CGlxCache_ReserveUsersLL, Teardown)*/ + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxcache/t_cglxcache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxcache/t_cglxcache.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCache unit tests +* +*/ + + + + +#ifndef __T_CGLXCACHE_H__ +#define __T_CGLXCACHE_H__ + +// EXTERNAL INCLUDES +#include +#include + +#include + +#include + +// INTERNAL INCLUDES +#include "mglxcacheobserver.h" +#include "mglxmediauser.h" + +// FORWARD DECLARATIONS +class CGlxCache; +class CGlxMedia; +class CGlxCacheManager; + +// CLASS DEFINITION +/** + * T_CGlxCache Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_CGlxCache ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CGlxCache* NewL(); + static T_CGlxCache* NewLC(); + /** + * Destructor + */ + ~T_CGlxCache(); + + private: // Constructors and destructors + + T_CGlxCache(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_CGlxCache_IdSpaceIdL(); + + void T_CGlxCache_MediaUpdatedLL(); + + void T_CGlxCache_UpdateMediaLL(); + + void T_CGlxCache_HandleItemModifiedL(); + + void T_CGlxCache_MediaL(); + + void T_CGlxCache_FindItemForceCreateLL(); + + void T_CGlxCache_CountL(); + + void T_CGlxCache_Media2L(); + + void T_CGlxCache_Delete_SubTest1L(); + + void T_CGlxCache_Delete_SubTest2L(); + + void T_CGlxCache_Delete_SubTest3L(); + + void T_CGlxCache_Delete_SubTest4L(); + + void T_CGlxCache_Delete_SubTest5L(); + + void T_CGlxCache_ReserveUsersLL(); + + private: // Internal methods + + void SetupCacheL(); + + + private: // Data + + CGlxCache* iCGlxCache; + CGlxCacheManager *iCacheManager; + EUNIT_DECLARE_TEST_TABLE; + + + private: // Test classes + + // Test cache observer + class CGlxCacheObserverTest : public CBase, public MGlxCacheObserver + { + public: + static CGlxCacheObserverTest* NewL(); + virtual ~CGlxCacheObserverTest(); + + public: + TBool AttributesAvailableNotified() const; + void ResetCalls(); + + const TGlxIdSpaceId& IdSpaceId() const; + const TGlxMediaId& MediaId() const; + const RArray& Attributes() const; + const CGlxMedia* Media() const; + + private: + CGlxCacheObserverTest(); + void ConstructL(); + + private: // From MGlxCacheObserver + void HandleAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId, + const RArray& aAttributes, + const CGlxMedia* aMedia); + virtual void CleanupMedia(const TGlxMediaId& aMediaId); + + private: // Data + TBool iAttributesAvailableNotified; + + TGlxIdSpaceId iIdSpaceId; + TGlxMediaId iMediaId; + RArray iAttributes; + CGlxMedia* iMedia; + }; + + // Test media user + class CGlxMediaUserTest : public CBase, public MGlxMediaUser + { + public: + static CGlxMediaUserTest* NewL(); + virtual ~CGlxMediaUserTest(); + + public: + TBool AttributesAvailableNotified() const; + TBool RemoveReferenceCalled() const; + void ResetCalls(); + + const TGlxIdSpaceId& IdSpaceId() const; + const TGlxMediaId& MediaId() const; + const RArray& Attributes() const; + + private: + CGlxMediaUserTest(); + void ConstructL(); + + private: // From MGlxMediaUser + void GetRequiredAttributesL(TInt /*aIndex*/, + RArray& /*aAttributes*/) {}; + void HandleAttributesAvailableL(TInt aIndex, + const RArray& aAttributes); + void HandleAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aItemId, + const RArray& aAttributes); + + void RemoveReference(TInt aIndex); + void RemoveReference(CGlxMedia& aMedia); + void HandleError(TInt /*aError*/) {}; + + private: // Data + TBool iAttributesAvailableNotified; + TBool iRemoveReferenceCalled; + + TGlxIdSpaceId iIdSpaceId; + TGlxMediaId iMediaId; + RArray iAttributes; + }; + }; + +#endif // __T_CGLXCACHE_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxcache/t_cglxcache_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxcache/t_cglxcache_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxCache unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "t_cglxcache.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CGlxCache::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxfetcherrorarray/t_cglxfetcherrorarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxfetcherrorarray/t_cglxfetcherrorarray.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxFetchErrorArray unit tests +* +*/ + + + + +// CLASS HEADER +#include "t_cglxfetcherrorarray.h" + +// EXTERNAL INCLUDES +#include +#include + +#include + +#include + +// INTERNAL INCLUDES +#include "glxfetcherrorarray.h" +#include "glxfetcherror.h" + +const TInt KTestMediaIdGeneral = 1; + +// CONSTRUCTION +T_CGlxFetchErrorArray* T_CGlxFetchErrorArray::NewL() + { + T_CGlxFetchErrorArray* self = T_CGlxFetchErrorArray::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CGlxFetchErrorArray* T_CGlxFetchErrorArray::NewLC() + { + T_CGlxFetchErrorArray* self = new( ELeave ) T_CGlxFetchErrorArray(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CGlxFetchErrorArray::~T_CGlxFetchErrorArray() + { + } + +// Default constructor +T_CGlxFetchErrorArray::T_CGlxFetchErrorArray() + { + } + +// Second phase construct +void T_CGlxFetchErrorArray::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void T_CGlxFetchErrorArray::SetupL( ) + { + EUNIT_PRINT(_L("Initial setup")); + + EUNIT_PRINT(_L("ErrorArray1 has 2 errors")); + iCGlxFetchErrorArray1 = new (ELeave) CGlxFetchErrorArray(); + + TGlxFetchError error1(KMPXMediaGeneralSize, KErrNotSupported); + iCGlxFetchErrorArray1->AddErrorL(error1); + + TGlxFetchError error2(KGlxMediaGeneralSystemItem, KErrNotFound); + iCGlxFetchErrorArray1->AddErrorL(error2); + + EUNIT_PRINT(_L("ErrorArray2 has 0 errors")); + iCGlxFetchErrorArray2 = new (ELeave) CGlxFetchErrorArray(); + } + + +void T_CGlxFetchErrorArray::Teardown( ) + { + delete iCGlxFetchErrorArray1; + iCGlxFetchErrorArray1 = NULL; + + delete iCGlxFetchErrorArray2; + iCGlxFetchErrorArray2 = NULL; + } + + +void T_CGlxFetchErrorArray::T_CGlxFetchErrorArray_ErrorCountL( ) + { + // Check ErrorArray1 has 2 errors + EUNIT_PRINT(_L("Check ErrorArray1 has 2 errors")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->ErrorCount() == 2, "Incorrect error count"); + + // Check ErrorArray2 has 0 errors + EUNIT_PRINT(_L("Check ErrorArray2 has 0 errors")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray2->ErrorCount() == 0, "Incorrect error count"); + } + +void T_CGlxFetchErrorArray::T_CGlxFetchErrorArray_ErrorL( ) + { + // Obtain error at index 0 + EUNIT_PRINT(_L("Obtain error at ErrorArray1 index 0")); + const TGlxFetchError& error1 = iCGlxFetchErrorArray1->Error(0); + + EUNIT_PRINT(_L("Check error at ErrorArray1 index 0")); + EUNIT_ASSERT_DESC(error1.iAttr == KMPXMediaGeneralSize && error1.iError == KErrNotSupported, "Incorrect error returned"); + + // Obtain error at index 1 + EUNIT_PRINT(_L("Obtain error at ErrorArray1 index 1")); + const TGlxFetchError& error2 = iCGlxFetchErrorArray1->Error(1); + + EUNIT_PRINT(_L("Check error at ErrorArray1 index 1")); + EUNIT_ASSERT_DESC(error2.iAttr == KGlxMediaGeneralSystemItem && error2.iError == KErrNotFound, "Incorrect error returned"); + } + +void T_CGlxFetchErrorArray::T_CGlxFetchErrorArray_AddErrorLL( ) + { + // Add existing error + EUNIT_PRINT(_L("Add existing error to ErrorArray1")); + TGlxFetchError error1(KMPXMediaGeneralSize, KErrGeneral); + iCGlxFetchErrorArray1->AddErrorL(error1); + + EUNIT_PRINT(_L("Check ErrorArray1 still has 2 errors")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->ErrorCount() == 2, "Incorrect error count"); + + const TGlxFetchError& storedError1 = iCGlxFetchErrorArray1->Error(0); + EUNIT_ASSERT_DESC(storedError1.iAttr == KMPXMediaGeneralSize && storedError1.iError == KErrGeneral, "Incorrect error returned"); + + // Add new error + EUNIT_PRINT(_L("Add new error to ErrorArray2")); + TGlxFetchError error2(KMPXMediaGeneralDate, KErrCorrupt); + iCGlxFetchErrorArray2->AddErrorL(error2); + + EUNIT_PRINT(_L("Check ErrorArray2 has 1 new error")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray2->ErrorCount() == 1, "Incorrect error count"); + + const TGlxFetchError& storedError2 = iCGlxFetchErrorArray2->Error(0); + EUNIT_ASSERT_DESC(storedError2.iAttr == KMPXMediaGeneralDate && storedError2.iError == KErrCorrupt, "Incorrect error returned"); + } + +void T_CGlxFetchErrorArray::T_CGlxFetchErrorArray_RemoveL( ) + { + // Remove error at index 1 + EUNIT_PRINT(_L("Remove error at ErrorArray1 index 1")); + iCGlxFetchErrorArray1->Remove(1); + + EUNIT_PRINT(_L("Check ErrorArray1 still has 1 error")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->ErrorCount() == 1, "Incorrect error count"); + + const TGlxFetchError& storedError1 = iCGlxFetchErrorArray1->Error(0); + EUNIT_ASSERT_DESC(storedError1.iAttr == KMPXMediaGeneralSize && storedError1.iError == KErrNotSupported, "Incorrect error returned"); + } + +void T_CGlxFetchErrorArray::T_CGlxFetchErrorArray_FindErrorL( ) + { + // Find existing error + EUNIT_PRINT(_L("Find existing error in ErrorArray1")); + + EUNIT_PRINT(_L("Check correct ErrorArray1 index returned")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->FindError(KMPXMediaGeneralSize) == 0, "Incorrect index for error"); + + // Find non-existing error + EUNIT_PRINT(_L("Find non-existing error in ErrorArray1")); + + EUNIT_PRINT(_L("Check KErrNotFound returned")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->FindError(KMPXMediaGeneralTitle) == KErrNotFound, "Index should be KErrNotFound"); + + // Find non-existing error on empty ErrorArray2 + EUNIT_PRINT(_L("Find non-existing error in empty ErrorArray2")); + + EUNIT_PRINT(_L("Check KErrNotFound returned")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray2->FindError(KMPXMediaGeneralSize) == KErrNotFound, "Index should be KErrNotFound"); + } + +void T_CGlxFetchErrorArray::T_CGlxFetchErrorArray_FindError2L( ) + { + // Find KMPXMediaIdGeneral errors + EUNIT_PRINT(_L("Find KMPXMediaIdGeneral errors in ErrorArray1")); + + EUNIT_PRINT(_L("Check correct ErrorArray1 index returned")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->FindError(KMPXMediaIdGeneral) == 0, "Incorrect index for error"); + + // Find KGlxMediaIdGeneral errors + EUNIT_PRINT(_L("Find KGlxMediaIdGeneral errors in ErrorArray1")); + + EUNIT_PRINT(_L("Check correct ErrorArray1 index returned")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->FindError(KGlxMediaIdGeneral) == 1, "Incorrect index for error"); + + // Find non-existing error + EUNIT_PRINT(_L("Find non-existing error in ErrorArray1")); + + EUNIT_PRINT(_L("Check KErrNotFound returned")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray1->FindError(KTestMediaIdGeneral) == KErrNotFound, "Index should be KErrNotFound"); + + // Find non-existing error on empty ErrorArray2 + EUNIT_PRINT(_L("Find non-existing error on empty ErrorArray2")); + + EUNIT_PRINT(_L("Check KErrNotFound returned")); + EUNIT_ASSERT_DESC(iCGlxFetchErrorArray2->FindError(KTestMediaIdGeneral) == KErrNotFound, "Index should be KErrNotFound"); + } + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CGlxFetchErrorArray, + "Add test suite description here.", + "UNIT" ) + +EUNIT_TEST( + "ErrorCount - test1", + "CGlxFetchErrorArray", + "ErrorCount - test1", + "FUNCTIONALITY", + SetupL, T_CGlxFetchErrorArray_ErrorCountL, Teardown) + +EUNIT_TEST( + "Error - test2", + "CGlxFetchErrorArray", + "Error - test2", + "FUNCTIONALITY", + SetupL, T_CGlxFetchErrorArray_ErrorL, Teardown) + +EUNIT_TEST( + "AddErrorL - test3", + "CGlxFetchErrorArray", + "AddErrorL - test3", + "FUNCTIONALITY", + SetupL, T_CGlxFetchErrorArray_AddErrorLL, Teardown) + +EUNIT_TEST( + "Remove - test4", + "CGlxFetchErrorArray", + "Remove - test4", + "FUNCTIONALITY", + SetupL, T_CGlxFetchErrorArray_RemoveL, Teardown) + +EUNIT_TEST( + "FindError - test5", + "CGlxFetchErrorArray", + "FindError - test5", + "FUNCTIONALITY", + SetupL, T_CGlxFetchErrorArray_FindErrorL, Teardown) + +EUNIT_TEST( + "FindError - test6", + "CGlxFetchErrorArray", + "FindError - test6", + "FUNCTIONALITY", + SetupL, T_CGlxFetchErrorArray_FindError2L, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxfetcherrorarray/t_cglxfetcherrorarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxfetcherrorarray/t_cglxfetcherrorarray.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxFetchErrorArray unit tests +* +*/ + + + + +#ifndef __T_CGLXFETCHERRORARRAY_H__ +#define __T_CGLXFETCHERRORARRAY_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS +class CGlxFetchErrorArray; + +// CLASS DEFINITION +/** + * T_CGlxFetchErrorArray Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_CGlxFetchErrorArray ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CGlxFetchErrorArray* NewL(); + static T_CGlxFetchErrorArray* NewLC(); + /** + * Destructor + */ + ~T_CGlxFetchErrorArray(); + + private: // Constructors and destructors + + T_CGlxFetchErrorArray(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_CGlxFetchErrorArray_ErrorCountL(); + + void T_CGlxFetchErrorArray_ErrorL(); + + void T_CGlxFetchErrorArray_AddErrorLL(); + + void T_CGlxFetchErrorArray_RemoveL(); + + void T_CGlxFetchErrorArray_FindErrorL(); + + void T_CGlxFetchErrorArray_FindError2L(); + + + private: // Data + + CGlxFetchErrorArray* iCGlxFetchErrorArray1; + CGlxFetchErrorArray* iCGlxFetchErrorArray2; + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CGLXFETCHERRORARRAY_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxfetcherrorarray/t_cglxfetcherrorarray_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxfetcherrorarray/t_cglxfetcherrorarray_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxFetchErrorArray unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "t_cglxfetcherrorarray.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CGlxFetchErrorArray::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxgarbagecollector/t_cglxgarbagecollector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxgarbagecollector/t_cglxgarbagecollector.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,2631 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxGarbageCollector unit tests +* +*/ + + + + +// CLASS HEADER +#include "glxcachemanager.h" +#include "t_cglxgarbagecollector.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +#include + +// INTERNAL INCLUDES +#include "glxerrormanager.h" +#include "glxfetcherrorarray.h" +#include "glxgarbagecollector.h" +#include "glxmedia.h" + +#include "t_cachetesthelpers.h" + +T_CGlxGarbageCollector* T_CGlxGarbageCollector::iGarbageCollectorTest = NULL; + +const TInt KIdSpaceId1 = 1; +const TInt KIdSpaceId2 = 2; +const TInt KIdSpaceId3 = 3; + +const TInt KCache1Media1Id = 1; +const TInt KCache1Media2Id = 2; +const TInt KCache1Media3Id = 3; + +const TInt KCache2Media1Id = 1; +const TInt KCache2Media2Id = 2; + +const TInt KCache3Media1Id = 1; +const TInt KCache3Media2Id = 2; +const TInt KCache3Media3Id = 3; +const TInt KCache3Media4Id = 4; +const TInt KCache3Media5Id = 5; +const TInt KCache3Media6Id = 6; +const TInt KCache3Media7Id = 7; + +_LIT(KCache1Media1Title, "Captured"); +//_LIT(KCache1Media2Title, "Albums"); +//_LIT(KCache1Media3Title, "All"); + +_LIT(KCache1Media1SubTitle, "0 items"); +//_LIT(KCache1Media2SubTitle, "0 albums"); +//_LIT(KCache1Media3SubTitle, "7 items"); + +_LIT(KCache2Media1Title, "Favourites"); +_LIT(KCache2Media2Title, "Print later"); + +_LIT(KCache2Media1SubTitle, "0 items"); +_LIT(KCache2Media2SubTitle, "0 items"); + +_LIT(KCache3Media1Title, "Spring"); +//_LIT(KCache3Media2Title, "Summer"); +_LIT(KCache3Media3Title, "Autumn"); +_LIT(KCache3Media4Title, "Winter"); +_LIT(KCache3Media5Title, "Sun"); +//_LIT(KCache3Media6Title, "Moon"); +//_LIT(KCache3Media7Title, "Stars"); + +const TInt KCache3Media1Size = 8; +const TInt KCache3Media2Size = 16; +const TInt KCache3Media3Size = 32; +//const TInt KCache3Media4Size = 64; +//const TInt KCache3Media5Size = 128; +//const TInt KCache3Media6Size = 256; +//const TInt KCache3Media7Size = 512; + +// This value must be the same as in the garbage collector +const TInt KItemsScannedPerGCRound = 10; + +const TInt KErrorExpiryPeriod = 30; +const TInt KTimerCallbackPeriod1 = 5; +const TInt KTimerCallbackPeriod2 = 35; +const TInt KMicrosecondsInSeconds = 1000000; + +// These values are for CleanupCaches test +const TInt KItemsToScan = 10; +const TInt KCache1ItemCount = 3; +const TInt KCache2ItemCount = 2; +const TInt KCache3ItemCount = 7; + +// CONSTRUCTION +T_CGlxGarbageCollector* T_CGlxGarbageCollector::NewL() + { + T_CGlxGarbageCollector* self = T_CGlxGarbageCollector::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CGlxGarbageCollector* T_CGlxGarbageCollector::NewLC() + { + T_CGlxGarbageCollector* self = new( ELeave ) T_CGlxGarbageCollector(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CGlxGarbageCollector::~T_CGlxGarbageCollector() + { + } + +// Default constructor +T_CGlxGarbageCollector::T_CGlxGarbageCollector() + { + } + +// Second phase construct +void T_CGlxGarbageCollector::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void T_CGlxGarbageCollector::SetupL( ) + { + EUNIT_PRINT(_L("T_CGlxGarbageCollector::SetupL()")); + + SetupCachesL(); + + iCGlxGarbageCollector = CGlxGarbageCollector::NewL(iCaches); + + // Set this variable to 'this' in the tests if they need to know + // if idlecallbacks have been called on garbage collector + iGarbageCollectorTest = NULL; + } + + +void T_CGlxGarbageCollector::Teardown( ) + { + iCaches.ResetAndDestroy(); + iCacheManager->Close(); + delete iCGlxGarbageCollector; + iCGlxGarbageCollector = NULL; + } + +void T_CGlxGarbageCollector::RemoveMediaReference(TInt aIndex) + { + EUNIT_PRINT(_L("Remove iMediaUser_Test from the mentioned Cache")); + + // Remove this mediauser from the mentioned Caache + /* Case specific medias must be removed from the caches. + + CGlxCache* cache3 = iCaches[2]; + RemoveMediaUserFromCacheMedias(*cache3, *iMediaUser_Test); + */ + + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_Cleanup_SubTest0L() + { + //Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser3")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser3 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser3); + + EUNIT_PRINT(_L("All media in cache3 used by mediauser3")); + CGlxCache* cache3 = iCaches[2]; + AddMediaUserToCacheMediasL(*cache3, *mediaUser3); + iMediaUser_Test = mediaUser3; + + // Cleanup + EUNIT_PRINT(_L("iCGlxGarbageCollector.Cleanup")); + iCGlxGarbageCollector->CleanupL(); + + // Timer callback will stop the wait loop we are about to start + CTimerTest* timer = CTimerTest::NewL(this); + CleanupStack::PushL(timer); + + timer->StartTimer(KTimerCallbackPeriod1); //5 + + // Start the wait loop + iWait.Start(); + + // Wait loop stopped + CleanupStack::PopAndDestroy(timer); + + CleanupStack::PopAndDestroy(mediaUser3); + CleanupStack::PopAndDestroy(&attributes); + } + + + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_Cleanup_SubTest1L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title and Subtitle attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + EUNIT_PRINT(_L("System Item attribute wanted by mediauser2")); + attributes.Reset(); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser2 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser2); + + EUNIT_PRINT(_L("Media1 in cache2 used by mediauser2")); + CGlxCache* cache2 = iCaches[1]; + AddMediaUserToMediaL(*cache2, 0, *mediaUser2); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser3")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser3 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser3); + + EUNIT_PRINT(_L("Title attribute wanted by mediauser4")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralTitle); + + CGlxMediaUserTest* mediaUser4 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser4); + + EUNIT_PRINT(_L("All media in cache3 used by mediauser3 and mediauser4")); + CGlxCache* cache3 = iCaches[2]; + AddMediaUserToCacheMediasL(*cache3, *mediaUser3); + AddMediaUserToCacheMediasL(*cache3, *mediaUser4); + + // Cleanup + EUNIT_PRINT(_L("Cleanup")); + iCGlxGarbageCollector->CleanupL(); + EUNIT_PRINT(_L("Cleanup DONE!!")); + + // Timer callback will stop the wait loop we are about to start + CTimerTest* timer = CTimerTest::NewL(this); + CleanupStack::PushL(timer); + + timer->StartTimer(KTimerCallbackPeriod1); //5 + + // Start the wait loop + iWait.Start(); + + // Wait loop stopped + CleanupStack::PopAndDestroy(timer); + + // Garbage collector should have cleaned up once + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 3, "Remaining media should be 3"); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CheckCache1MediaAttributes(*media1Cache1, 2, ETrue, ETrue, EFalse); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + CheckCache1MediaAttributes(*media3Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache2")); + EUNIT_ASSERT_DESC(cache2->Count() == 1, "Remaining media should be 1"); + + // Create helper class + T_CacheTestHelpers cache2Helper(cache2); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache2")); + CGlxMedia* media1Cache2 = cache2Helper.ItemPool()[0]; + CheckCache2MediaAttributes(*media1Cache2, 1, EFalse, EFalse, ETrue); + CheckCache2MediaErrors(*media1Cache2, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache3")); + EUNIT_ASSERT_DESC(cache3->Count() == 4, "Remaining media should be 4"); + + // Create helper class + T_CacheTestHelpers cache3Helper(cache3); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache3")); + CGlxMedia* media1Cache3 = cache3Helper.ItemPool()[0]; + CheckCache3MediaAttributes(*media1Cache3, 2, ETrue, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media1Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache3")); + CGlxMedia* media2Cache3 = cache3Helper.ItemPool()[1]; + CheckCache3MediaAttributes(*media2Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media2Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache3")); + CGlxMedia* media3Cache3 = cache3Helper.ItemPool()[2]; + CheckCache3MediaAttributes(*media3Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media3Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media4 in cache3")); + CGlxMedia* media4Cache3 = cache3Helper.ItemPool()[3]; + CheckCache3MediaAttributes(*media4Cache3, 2, EFalse, ETrue, EFalse, EFalse, ETrue); + CheckCache3MediaErrors(*media4Cache3, ETrue, ETrue, EFalse, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser4); + CleanupStack::PopAndDestroy(mediaUser3); + CleanupStack::PopAndDestroy(mediaUser2); + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_Cleanup_SubTest2L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title and Subtitle attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + EUNIT_PRINT(_L("System Item attribute wanted by mediauser2")); + attributes.Reset(); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser2 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser2); + + EUNIT_PRINT(_L("Media1 in cache2 used by mediauser2")); + CGlxCache* cache2 = iCaches[1]; + AddMediaUserToMediaL(*cache2, 0, *mediaUser2); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser3")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser3 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser3); + + EUNIT_PRINT(_L("Title attribute wanted by mediauser4")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralTitle); + + CGlxMediaUserTest* mediaUser4 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser4); + + EUNIT_PRINT(_L("All media in cache3 used by mediauser3 and mediauser4")); + CGlxCache* cache3 = iCaches[2]; + AddMediaUserToCacheMediasL(*cache3, *mediaUser3); + AddMediaUserToCacheMediasL(*cache3, *mediaUser4); + + // Cleanup + EUNIT_PRINT(_L("Cleanup")); + iCGlxGarbageCollector->CleanupL(); + + iGarbageCollectorTest = this; + + // Timer callback will stop the wait loop we are about to start + CTimerTest* timer = CTimerTest::NewL(this); + CleanupStack::PushL(timer); + + timer->StartTimer(KTimerCallbackPeriod1); + + // Start the wait loop + iWait.Start(); + + // Wait loop stopped + CleanupStack::PopAndDestroy(timer); + + // Garbage collector should have cleaned up twice + // Second round caused by updated media + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 3, "Remaining media should be 3"); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CheckCache1MediaAttributes(*media1Cache1, 2, ETrue, ETrue, EFalse); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + CheckCache1MediaAttributes(*media3Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache2")); + EUNIT_ASSERT_DESC(cache2->Count() == 1, "Remaining media should be 1"); + + // Create helper class + T_CacheTestHelpers cache2Helper(cache2); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache2")); + CGlxMedia* media1Cache2 = cache2Helper.ItemPool()[0]; + CheckCache2MediaAttributes(*media1Cache2, 1, EFalse, EFalse, ETrue); + CheckCache2MediaErrors(*media1Cache2, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache3")); + EUNIT_ASSERT_DESC(cache3->Count() == 4, "Remaining media should be 4"); + + // Create helper class + T_CacheTestHelpers cache3Helper(cache3); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache3")); + CGlxMedia* media1Cache3 = cache3Helper.ItemPool()[0]; + CheckCache3MediaAttributes(*media1Cache3, 2, ETrue, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media1Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache3")); + CGlxMedia* media2Cache3 = cache3Helper.ItemPool()[1]; + CheckCache3MediaAttributes(*media2Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media2Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache3")); + CGlxMedia* media3Cache3 = cache3Helper.ItemPool()[2]; + CheckCache3MediaAttributes(*media3Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media3Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media4 in cache3")); + CGlxMedia* media4Cache3 = cache3Helper.ItemPool()[3]; + CheckCache3MediaAttributes(*media4Cache3, 2, EFalse, ETrue, EFalse, EFalse, ETrue); + CheckCache3MediaErrors(*media4Cache3, ETrue, ETrue, EFalse, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser4); + CleanupStack::PopAndDestroy(mediaUser3); + CleanupStack::PopAndDestroy(mediaUser2); + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_Cleanup_SubTest3L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title and Subtitle attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + EUNIT_PRINT(_L("System Item attribute wanted by mediauser2")); + attributes.Reset(); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser2 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser2); + + EUNIT_PRINT(_L("Media1 in cache2 used by mediauser2")); + CGlxCache* cache2 = iCaches[1]; + AddMediaUserToMediaL(*cache2, 0, *mediaUser2); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser3")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser3 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser3); + + EUNIT_PRINT(_L("Title attribute wanted by mediauser4")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralTitle); + + CGlxMediaUserTest* mediaUser4 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser4); + + EUNIT_PRINT(_L("All media in cache3 used by mediauser3 and mediauser4")); + CGlxCache* cache3 = iCaches[2]; + AddMediaUserToCacheMediasL(*cache3, *mediaUser3); + AddMediaUserToCacheMediasL(*cache3, *mediaUser4); + + // Cleanup + EUNIT_PRINT(_L("Cleanup")); + iCGlxGarbageCollector->CleanupL(); + + // Timer callback will stop the wait loop we are about to start + CTimerTest* timer = CTimerTest::NewL(this); + CleanupStack::PushL(timer); + + timer->StartTimer(KTimerCallbackPeriod1); + + // Start the wait loop + iWait.Start(); + + // Wait loop stopped + // Update media + UpdateMediaL(); + + // Timer callback will stop the wait loop we are about to start + timer->StartTimer(KTimerCallbackPeriod1); + + // Start the wait loop + iWait.Start(); + + // Wait loop stopped + CleanupStack::PopAndDestroy(timer); + + // Garbage collector should have cleaned up twice + // Second round caused by updated media + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 3, "Remaining media should be 3"); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CheckCache1MediaAttributes(*media1Cache1, 2, ETrue, ETrue, EFalse); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + CheckCache1MediaAttributes(*media3Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache2")); + EUNIT_ASSERT_DESC(cache2->Count() == 1, "Remaining media should be 1"); + + // Create helper class + T_CacheTestHelpers cache2Helper(cache2); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache2")); + CGlxMedia* media1Cache2 = cache2Helper.ItemPool()[0]; + CheckCache2MediaAttributes(*media1Cache2, 1, EFalse, EFalse, ETrue); + CheckCache2MediaErrors(*media1Cache2, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache3")); + EUNIT_ASSERT_DESC(cache3->Count() == 4, "Remaining media should be 4"); + + // Create helper class + T_CacheTestHelpers cache3Helper(cache3); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache3")); + CGlxMedia* media1Cache3 = cache3Helper.ItemPool()[0]; + CheckCache3MediaAttributes(*media1Cache3, 2, ETrue, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media1Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache3")); + CGlxMedia* media2Cache3 = cache3Helper.ItemPool()[1]; + CheckCache3MediaAttributes(*media2Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media2Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache3")); + CGlxMedia* media3Cache3 = cache3Helper.ItemPool()[2]; + CheckCache3MediaAttributes(*media3Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media3Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media4 in cache3")); + CGlxMedia* media4Cache3 = cache3Helper.ItemPool()[3]; + CheckCache3MediaAttributes(*media4Cache3, 2, EFalse, ETrue, EFalse, EFalse, ETrue); + CheckCache3MediaErrors(*media4Cache3, ETrue, ETrue, EFalse, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser4); + CleanupStack::PopAndDestroy(mediaUser3); + CleanupStack::PopAndDestroy(mediaUser2); + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +// This test takes longer than 30 seconds +// Therefore, EUnit timeout should be set to greater than this +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_Cleanup_SubTest4L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title and Subtitle attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes, *this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + EUNIT_PRINT(_L("System Item attribute wanted by mediauser2")); + attributes.Reset(); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser2 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser2); + + EUNIT_PRINT(_L("Media1 in cache2 used by mediauser2")); + CGlxCache* cache2 = iCaches[1]; + AddMediaUserToMediaL(*cache2, 0, *mediaUser2); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser3")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser3 = CGlxMediaUserTest::NewL(attributes,*this); + CleanupStack::PushL(mediaUser3); + + EUNIT_PRINT(_L("Title attribute wanted by mediauser4")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralTitle); + + CGlxMediaUserTest* mediaUser4 = CGlxMediaUserTest::NewL(attributes,*this); + CleanupStack::PushL(mediaUser4); + + EUNIT_PRINT(_L("All media in cache3 used by mediauser3 and mediauser4")); + CGlxCache* cache3 = iCaches[2]; + AddMediaUserToCacheMediasL(*cache3, *mediaUser3); + AddMediaUserToCacheMediasL(*cache3, *mediaUser4); + + // Cleanup + EUNIT_PRINT(_L("Cleanup")); + iCGlxGarbageCollector->CleanupL(); + + // Timer callback will stop the wait loop we are about to start + CTimerTest* timer = CTimerTest::NewL(this); + CleanupStack::PushL(timer); + + timer->StartTimer(KTimerCallbackPeriod2); + + // Start the wait loop + iWait.Start(); + + // Wait loop stopped + // Cleanup again + EUNIT_PRINT(_L("Cleanup again")); + iCGlxGarbageCollector->CleanupL(); + + // Timer callback will stop the wait loop we are about to start + timer->StartTimer(KTimerCallbackPeriod1); + + // Start the wait loop + iWait.Start(); + + // Wait loop stopped + CleanupStack::PopAndDestroy(timer); + + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 3, "Remaining media should be 3"); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Garbage collector should have cleaned up twice + // Second round caused by temporary error timer callback + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CheckCache1MediaAttributes(*media1Cache1, 2, ETrue, ETrue, EFalse); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, EFalse, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + CheckCache1MediaAttributes(*media3Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache2")); + EUNIT_ASSERT_DESC(cache2->Count() == 1, "Remaining media should be 1"); + + // Create helper class + T_CacheTestHelpers cache2Helper(cache2); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache2")); + CGlxMedia* media1Cache2 = cache2Helper.ItemPool()[0]; + CheckCache2MediaAttributes(*media1Cache2, 1, EFalse, EFalse, ETrue); + CheckCache2MediaErrors(*media1Cache2, EFalse); + + EUNIT_PRINT(_L("Check remaining media in cache3")); + EUNIT_ASSERT_DESC(cache3->Count() == 4, "Remaining media should be 4"); + + // Create helper class + T_CacheTestHelpers cache3Helper(cache3); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache3")); + CGlxMedia* media1Cache3 = cache3Helper.ItemPool()[0]; + CheckCache3MediaAttributes(*media1Cache3, 2, ETrue, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media1Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache3")); + CGlxMedia* media2Cache3 = cache3Helper.ItemPool()[1]; + CheckCache3MediaAttributes(*media2Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media2Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache3")); + CGlxMedia* media3Cache3 = cache3Helper.ItemPool()[2]; + CheckCache3MediaAttributes(*media3Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media3Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media4 in cache3")); + CGlxMedia* media4Cache3 = cache3Helper.ItemPool()[3]; + CheckCache3MediaAttributes(*media4Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media4Cache3, EFalse); + + CleanupStack::PopAndDestroy(mediaUser4); + CleanupStack::PopAndDestroy(mediaUser3); + CleanupStack::PopAndDestroy(mediaUser2); + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupCachesL( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title and Subtitle attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + EUNIT_PRINT(_L("System Item attribute wanted by mediauser2")); + attributes.Reset(); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser2 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser2); + + EUNIT_PRINT(_L("Media1 in cache2 used by mediauser2")); + CGlxCache* cache2 = iCaches[1]; + AddMediaUserToMediaL(*cache2, 0, *mediaUser2); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser3")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser3 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser3); + + EUNIT_PRINT(_L("Title attribute wanted by mediauser4")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralTitle); + + CGlxMediaUserTest* mediaUser4 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser4); + + EUNIT_PRINT(_L("All media in cache3 used by mediauser3 and mediauser4")); + CGlxCache* cache3 = iCaches[2]; + AddMediaUserToCacheMediasL(*cache3, *mediaUser3); + AddMediaUserToCacheMediasL(*cache3, *mediaUser4); + + // Create helper class + T_CacheTestHelpers cache2Helper(cache2); + + // Keep original cache pointers + CGlxMedia* oldMedia1Cache2 = cache2Helper.ItemPool()[0]; + + // Create helper class + T_CacheTestHelpers cache3Helper(cache3); + + // Keep original cache pointers + CGlxMedia* oldMedia1Cache3 = cache3Helper.ItemPool()[0]; + CGlxMedia* oldMedia3Cache3 = cache3Helper.ItemPool()[2]; + CGlxMedia* oldMedia4Cache3 = cache3Helper.ItemPool()[3]; + CGlxMedia* oldMedia5Cache3 = cache3Helper.ItemPool()[4]; + CGlxMedia* oldMedia6Cache3 = cache3Helper.ItemPool()[5]; + CGlxMedia* oldMedia7Cache3 = cache3Helper.ItemPool()[6]; + + // Cleanup all caches + EUNIT_PRINT(_L("Cleanup all caches")); + TBool scannedAllCaches = iCGlxGarbageCollector->CleanupCaches(); + + // The tests from hereon in are based on KItemsToScan being 10 + // Tests only work on this basis + + // The tests from hereon in are based on KItemsScannedPerGCRound + // being the same value contained in the garbage collector + if (KItemsScannedPerGCRound <= KItemsToScan) + { + EUNIT_PRINT(_L("Check whether all caches scanned")); + EUNIT_ASSERT_DESC(!scannedAllCaches, "Some caches shouldn't have been scanned"); + } + + if (KCache1ItemCount < KItemsScannedPerGCRound) + { + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 3, "Remaining media should be 3"); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CheckCache1MediaAttributes(*media1Cache1, 2, ETrue, ETrue, EFalse); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + CheckCache1MediaAttributes(*media3Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + + if (KCache1ItemCount + KCache2ItemCount < KItemsScannedPerGCRound) + { + EUNIT_PRINT(_L("Check remaining media in cache2")); + EUNIT_ASSERT_DESC(cache2->Count() == 1, "Remaining media should be 1"); + + CGlxMedia* media1Cache2 = cache2Helper.ItemPool()[0]; + EUNIT_ASSERT_DESC(media1Cache2 == oldMedia1Cache2, "New media1 in cache2 should be old media1"); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache2")); + CheckCache2MediaAttributes(*media1Cache2, 1, EFalse, EFalse, ETrue); + CheckCache2MediaErrors(*media1Cache2, EFalse); + + if (KItemsScannedPerGCRound == KItemsToScan) + { + EUNIT_PRINT(_L("Check remaining media in cache3")); + EUNIT_ASSERT_DESC(cache3->Count() == 6, "Remaining media should be 6"); + + CGlxMedia* media1Cache3 = cache3Helper.ItemPool()[0]; + CGlxMedia* media2Cache3 = cache3Helper.ItemPool()[1]; + CGlxMedia* media3Cache3 = cache3Helper.ItemPool()[2]; + CGlxMedia* media4Cache3 = cache3Helper.ItemPool()[3]; + CGlxMedia* media5Cache3 = cache3Helper.ItemPool()[4]; + CGlxMedia* media6Cache3 = cache3Helper.ItemPool()[5]; + EUNIT_ASSERT_DESC(media1Cache3 == oldMedia1Cache3, "New media1 in cache3 should be old media1"); + EUNIT_ASSERT_DESC(media2Cache3 == oldMedia3Cache3, "New media2 in cache3 should be old media3"); + EUNIT_ASSERT_DESC(media3Cache3 == oldMedia4Cache3, "New media3 in cache3 should be old media4"); + EUNIT_ASSERT_DESC(media4Cache3 == oldMedia5Cache3, "New media4 in cache3 should be old media5"); + EUNIT_ASSERT_DESC(media5Cache3 == oldMedia6Cache3, "New media5 in cache3 should be old media6"); + EUNIT_ASSERT_DESC(media6Cache3 == oldMedia7Cache3, "New media6 in cache3 should be old media7"); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache3")); + CheckCache3MediaAttributes(*media1Cache3, 2, ETrue, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media1Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache3")); + CheckCache3MediaAttributes(*media2Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media2Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache3")); + CheckCache3MediaAttributes(*media3Cache3, 1, EFalse, ETrue, EFalse, EFalse); + CheckCache3MediaErrors(*media3Cache3, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media4 in cache3")); + CheckCache3MediaAttributes(*media4Cache3, 2, EFalse, ETrue, EFalse, EFalse, ETrue); + CheckCache3MediaErrors(*media4Cache3, ETrue, ETrue, EFalse, EFalse, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media5 in cache3")); + CheckCache3MediaAttributes(*media5Cache3, 1, EFalse, EFalse, EFalse, EFalse, ETrue); + CheckCache3MediaErrors(*media5Cache3, ETrue, EFalse, EFalse, EFalse, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media6 in cache3")); + CheckCache3MediaAttributes(*media6Cache3, 1, EFalse, EFalse, EFalse, EFalse, ETrue); + CheckCache3MediaErrors(*media6Cache3, ETrue, EFalse, EFalse, EFalse, ETrue); + } + } + } + + CleanupStack::PopAndDestroy(mediaUser4); + CleanupStack::PopAndDestroy(mediaUser3); + CleanupStack::PopAndDestroy(mediaUser2); + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupCache_SubTest1L( ) + { + // Cleanup cache1, scan for 0 items + CGlxCache* cache1 = iCaches[0]; + EUNIT_PRINT(_L("Cleanup cache1, scan for 0 items")); + TInt remainingScan = iCGlxGarbageCollector->CleanupCache(*cache1, 0); + + EUNIT_PRINT(_L("Check remaining scan count is 0")); + EUNIT_ASSERT_DESC(remainingScan == 0, "Remaining scan count should be 0"); + + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 3, "Remaining media should be 3"); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CheckCache1MediaAttributes(*media1Cache1, 3, ETrue, ETrue, ETrue); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + CheckCache1MediaAttributes(*media3Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupCache_SubTest2L( ) + { + // Create helper class + CGlxCache* cache1 = iCaches[0]; + T_CacheTestHelpers cache1Helper(cache1); + + // Keep original cache pointers + CGlxMedia* oldMedia2Cache1 = cache1Helper.ItemPool()[1]; + CGlxMedia* oldMedia3Cache1 = cache1Helper.ItemPool()[2]; + + // No media users + // Cleanup cache1, scan for 1 item + EUNIT_PRINT(_L("Cleanup cache1, scan for 1 item")); + TInt remainingScan = iCGlxGarbageCollector->CleanupCache(*cache1, 1); + + EUNIT_PRINT(_L("Check remaining scan count is 0")); + EUNIT_ASSERT_DESC(remainingScan == 0, "Remaining scan count should be 0"); + + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 2, "Remaining media should be 2"); + + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + EUNIT_ASSERT_DESC(media1Cache1 == oldMedia2Cache1, "New media1 in cache1 should be old media2"); + EUNIT_ASSERT_DESC(media2Cache1 == oldMedia3Cache1, "New media2 in cache1 should be old media3"); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media1Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, EFalse, EFalse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupCache_SubTest3L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title, Subtitle and System item attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Cleanup cache1, scan for 1 item + EUNIT_PRINT(_L("Cleanup cache1, scan for 1 item")); + TInt remainingScan = iCGlxGarbageCollector->CleanupCache(*cache1, 1); + + EUNIT_PRINT(_L("Check remaining scan count is 0")); + EUNIT_ASSERT_DESC(remainingScan == 0, "Remaining scan count should be 0"); + + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 3, "Remaining media should be 3"); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CheckCache1MediaAttributes(*media1Cache1, 3, ETrue, ETrue, ETrue); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + CheckCache1MediaAttributes(*media3Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupCache_SubTest4L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("No attributes wanted by mediauser1")); + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Keep original cache pointers + CGlxMedia* oldMedia2Cache1 = cache1Helper.ItemPool()[1]; + CGlxMedia* oldMedia3Cache1 = cache1Helper.ItemPool()[2]; + + // Cleanup cache1, scan for 1 item + EUNIT_PRINT(_L("Cleanup cache1, scan for 1 item")); + TInt remainingScan = iCGlxGarbageCollector->CleanupCache(*cache1, 1); + + EUNIT_PRINT(_L("Check remaining scan count is 0")); + EUNIT_ASSERT_DESC(remainingScan == 0, "Remaining scan count should be 0"); + + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 2, "Remaining media should be 2"); + + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + EUNIT_ASSERT_DESC(media1Cache1 == oldMedia2Cache1, "New media1 in cache1 should be old media2"); + EUNIT_ASSERT_DESC(media2Cache1 == oldMedia3Cache1, "New media2 in cache1 should be old media3"); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media1Cache1, ETrue, ETrue, ETrue, EFalse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupCache_SubTest5L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("No attributes wanted by mediauser1")); + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("Media2 in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToMediaL(*cache1, 1, *mediaUser1); + + EUNIT_PRINT(_L("Subtitle and System item attributes wanted by mediauser2")); + attributes.AppendL(KMPXMediaGeneralSubTitle); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser2 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser2); + + EUNIT_PRINT(_L("Media3 in cache1 used by mediauser2")); + AddMediaUserToMediaL(*cache1, 2, *mediaUser2); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Keep original cache pointers + CGlxMedia* oldMedia3Cache1 = cache1Helper.ItemPool()[2]; + + // Cleanup cache1, scan for 4 items + EUNIT_PRINT(_L("Cleanup cache1, scan for 4 items")); + TInt remainingScan = iCGlxGarbageCollector->CleanupCache(*cache1, 4); + + EUNIT_PRINT(_L("Check remaining scan count is 1")); + EUNIT_ASSERT_DESC(remainingScan == 1, "Remaining scan count should be 1"); + + EUNIT_PRINT(_L("Check remaining media in cache1")); + EUNIT_ASSERT_DESC(cache1->Count() == 1, "Remaining media should be 1"); + + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + EUNIT_ASSERT_DESC(media1Cache1 == oldMedia3Cache1, "New media1 in cache1 should be old media3"); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 1, EFalse, EFalse, ETrue, EFalse); + CheckCache1MediaErrors(*media1Cache1, EFalse); + + CleanupStack::PopAndDestroy(mediaUser2); + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest1L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title, Subtitle and System item attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media1 in cache1 + EUNIT_PRINT(_L("Cleanup media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + //CGlxMedia& media = cache1->Media(0); + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media1Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 3, ETrue, ETrue, ETrue); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest2L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("System item attribute wanted by mediauser1")); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media1 in cache1 + EUNIT_PRINT(_L("Cleanup media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media1Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 1, EFalse, EFalse, ETrue); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest3L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media1 in cache1 + EUNIT_PRINT(_L("Cleanup media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media1Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 0, EFalse, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest4L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("No attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media1 in cache1 + EUNIT_PRINT(_L("Cleanup media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media1Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 0, EFalse, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest5L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title, Subtitle and System item attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media2Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest6L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("System item attribute wanted by mediauser1")); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media2Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, ETrue, EFalse); + CheckCache1MediaErrors(*media2Cache1, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest7L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title and Subtitle attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media2Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, ETrue, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest8L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title and System item attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media2Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media2Cache1, ETrue, ETrue, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest9L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Thumbnail attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media2Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 0, EFalse, EFalse, EFalse, EFalse); + CheckCache1MediaErrors(*media2Cache1, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest10L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("No attributes wanted by mediauser1")); + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media2Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 0, EFalse, EFalse, EFalse, EFalse); + CheckCache1MediaErrors(*media2Cache1, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest11L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title, Subtitle and System item attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media3 in cache1")); + CGlxMedia* media3Cache1 = cache1Helper.ItemPool()[2]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media3Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media3 in cache1")); + CheckCache1MediaAttributes(*media3Cache1, 2, EFalse, EFalse, ETrue, ETrue); + CheckCache1MediaErrors(*media3Cache1, ETrue, ETrue, EFalse, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_CleanupMediaL_SubTest12L( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("No attributes wanted by mediauser1")); + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + // Cleanup media2 in cache1 + EUNIT_PRINT(_L("Cleanup media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->CleanupMediaL(*cache1,*media2Cache1); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 0, EFalse, EFalse, EFalse, EFalse); + CheckCache1MediaErrors(*media2Cache1, EFalse); + + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_GetAttributesInUseLL( ) + { + // Create media users + RArray attributes; + CleanupClosePushL(attributes); + + EUNIT_PRINT(_L("Title, Subtitle and System item attributes wanted by mediauser1")); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralSubTitle); + attributes.AppendL(KGlxMediaGeneralSystemItem); + + CGlxMediaUserTest* mediaUser1 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser1); + + EUNIT_PRINT(_L("All media in cache1 used by mediauser1")); + CGlxCache* cache1 = iCaches[0]; + AddMediaUserToCacheMediasL(*cache1, *mediaUser1); + + EUNIT_PRINT(_L("Thumbnail attribute wanted by mediauser2")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralThumbnail1); + + CGlxMediaUserTest* mediaUser2 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser2); + + EUNIT_PRINT(_L("Title, Date and Size attributes wanted by mediauser3")); + attributes.Reset(); + attributes.AppendL(KMPXMediaGeneralTitle); + attributes.AppendL(KMPXMediaGeneralDate); + attributes.AppendL(KMPXMediaGeneralSize); + + CGlxMediaUserTest* mediaUser3 = CGlxMediaUserTest::NewL(attributes ,*this); + CleanupStack::PushL(mediaUser3); + + EUNIT_PRINT(_L("All media in cache3 used by mediauser2 and mediauser3")); + CGlxCache* cache3 = iCaches[2]; + AddMediaUserToCacheMediasL(*cache3, *mediaUser2); + AddMediaUserToCacheMediasL(*cache3, *mediaUser3); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + // Obtain attributes in use for media1 in cache1 + EUNIT_PRINT(_L("Obtain attributes in use for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->GetAttributesInUseL(*media1Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check attributes in use for media1 in cache1")); + EUNIT_ASSERT_DESC(attributesInUse.Count() == 3, "Three attributes should be in use"); + EUNIT_ASSERT_DESC(attributesInUse.Find(KMPXMediaGeneralTitle, TMPXAttribute::Match) != KErrNotFound, "Title attribute should be in use"); + EUNIT_ASSERT_DESC(attributesInUse.Find(KMPXMediaGeneralSubTitle, TMPXAttribute::Match) != KErrNotFound, "Subtitle attribute should be in use"); + EUNIT_ASSERT_DESC(attributesInUse.Find(KGlxMediaGeneralSystemItem, TMPXAttribute::Match) != KErrNotFound, "System item attribute should be in use"); + + // Create helper class + T_CacheTestHelpers cache3Helper(cache3); + + attributesInUse.Reset(); + + // Obtain attributes in use for media1 in cache3 + EUNIT_PRINT(_L("Obtain attributes in use for media1 in cache3")); + CGlxMedia* media1Cache3 = cache3Helper.ItemPool()[0]; + iCGlxGarbageCollector->GetAttributesInUseL(*media1Cache3, attributesInUse); + + EUNIT_PRINT(_L("Check attributes in use for media1 in cache3")); + EUNIT_ASSERT_DESC(attributesInUse.Count() == 4, "Four attributes should be in use"); + EUNIT_ASSERT_DESC(attributesInUse.Find(KMPXMediaGeneralThumbnail1, TMPXAttribute::Match) != KErrNotFound, "Thumbnail attribute should be in use"); + EUNIT_ASSERT_DESC(attributesInUse.Find(KMPXMediaGeneralTitle, TMPXAttribute::Match) != KErrNotFound, "Title attribute should be in use"); + EUNIT_ASSERT_DESC(attributesInUse.Find(KMPXMediaGeneralDate, TMPXAttribute::Match) != KErrNotFound, "Date attribute should be in use"); + EUNIT_ASSERT_DESC(attributesInUse.Find(KMPXMediaGeneralSize, TMPXAttribute::Match) != KErrNotFound, "Size attribute should be in use"); + + CleanupStack::PopAndDestroy(&attributesInUse); + CleanupStack::PopAndDestroy(mediaUser3); + CleanupStack::PopAndDestroy(mediaUser2); + CleanupStack::PopAndDestroy(mediaUser1); + CleanupStack::PopAndDestroy(&attributes); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest1L( ) + { + EUNIT_PRINT(_L("Title, Subtitle and System item attributes in use for media1 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(KMPXMediaGeneralTitle); + attributesInUse.AppendL(KMPXMediaGeneralSubTitle); + attributesInUse.AppendL(KGlxMediaGeneralSystemItem); + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media1 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media1Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 3, ETrue, ETrue, ETrue); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest2L( ) + { + EUNIT_PRINT(_L("Title and Subtitle attributes in use for media1 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(KMPXMediaGeneralTitle); + attributesInUse.AppendL(KMPXMediaGeneralSubTitle); + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media1 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media1Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 2, ETrue, ETrue, EFalse); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest3L( ) + { + EUNIT_PRINT(_L("Thumbnail attribute in use for media1 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(KMPXMediaGeneralThumbnail1); + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media1 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media1Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 0, EFalse, EFalse, EFalse); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest4L( ) + { + EUNIT_PRINT(_L("No attributes in use for media1 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media1 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media1 in cache1")); + CGlxMedia* media1Cache1 = cache1Helper.ItemPool()[0]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media1Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media1 in cache1")); + CheckCache1MediaAttributes(*media1Cache1, 0, EFalse, EFalse, EFalse); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest5L( ) + { + EUNIT_PRINT(_L("Title, Subtitle and System item attributes in use for media2 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(KMPXMediaGeneralTitle); + attributesInUse.AppendL(KMPXMediaGeneralSubTitle); + attributesInUse.AppendL(KGlxMediaGeneralSystemItem); + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media2 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media2Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest6L( ) + { + EUNIT_PRINT(_L("System item attribute in use for media2 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(KGlxMediaGeneralSystemItem); + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media2 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media2Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 2, EFalse, EFalse, ETrue, ETrue); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest7L( ) + { + EUNIT_PRINT(_L("Title and Subtitle attributes in use for media2 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(KMPXMediaGeneralTitle); + attributesInUse.AppendL(KMPXMediaGeneralSubTitle); + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media2 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media2Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest8L( ) + { + EUNIT_PRINT(_L("Thumbnail attribute in use for media2 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(KMPXMediaGeneralThumbnail1); + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media2 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media2Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest9L( ) + { + EUNIT_PRINT(_L("No attributes in use for media2 in cache1")); + RArray attributesInUse; + CleanupClosePushL(attributesInUse); + + attributesInUse.AppendL(GlxErrorManager::ErrorAttribute()); + + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + // Delete attributes not in use for media2 in cache1 + EUNIT_PRINT(_L("Delete attributes not in use for media2 in cache1")); + CGlxMedia* media2Cache1 = cache1Helper.ItemPool()[1]; + iCGlxGarbageCollector->DeleteOtherAttributes(*iCaches[0],*media2Cache1, attributesInUse); + + EUNIT_PRINT(_L("Check remaining attributes for media2 in cache1")); + CheckCache1MediaAttributes(*media2Cache1, 1, EFalse, EFalse, EFalse, ETrue); + + CleanupStack::PopAndDestroy(&attributesInUse); + } + +void T_CGlxGarbageCollector::TimerCallback() + { + // Stop wait loop + iWait.AsyncStop(); + } + +void T_CGlxGarbageCollector::IdleCallbackCalledL() + { + ++iIdleCallbackCount; + + // After first idle callback called on garbage collector, + // Update media in cache + if (iIdleCallbackCount == 1) + { + UpdateMediaL(); + } + } + +void T_CGlxGarbageCollector::UpdateMediaL() + { + // Create helper class + T_CacheTestHelpers cache1Helper(iCaches[0]); + + TTime time; + time.UniversalTime(); + + // Add attributes to media1 in cache1 whilst garbage collector is cleaning up + CGlxMedia* cache1Media1 = cache1Helper.ItemPool()[0]; + cache1Media1->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + + CGlxFetchErrorArray* cache1Media1ErrorArray = new (ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(cache1Media1ErrorArray); + + TGlxFetchError cache1Media1Error1(KMPXMediaGeneralCount, KErrNotFound); + cache1Media1ErrorArray->AddErrorL(cache1Media1Error1); + + cache1Media1->SetCObjectValueL(GlxErrorManager::ErrorAttribute(), cache1Media1ErrorArray); + + CleanupStack::Pop(cache1Media1ErrorArray); + + // Cleanup again + EUNIT_PRINT(_L("Cleanup again")); + iCGlxGarbageCollector->CleanupL(); + } + +void T_CGlxGarbageCollector::SetupCachesL() + { + iCacheManager = CGlxCacheManager::InstanceL(); + // Create cache1 + CGlxCache* cache1 = new (ELeave) CGlxCache(TGlxIdSpaceId(KIdSpaceId1),iCacheManager); + CleanupStack::PushL(cache1); + iCaches.AppendL(cache1); + CleanupStack::Pop(cache1); + + // Create helper class + T_CacheTestHelpers cache1Helper(cache1); + + TTime time; + time.UniversalTime(); + + // Create media1 + CGlxMedia* cache1Media1 = new (ELeave) CGlxMedia(TGlxMediaId(KCache1Media1Id)); + CleanupStack::PushL(cache1Media1); + + cache1Media1->SetTextValueL(KMPXMediaGeneralTitle, KCache1Media1Title); + cache1Media1->SetTextValueL(KMPXMediaGeneralSubTitle, KCache1Media1SubTitle); + cache1Media1->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + + cache1Helper.ItemPool().AppendL(cache1Media1); + + CleanupStack::Pop(cache1Media1); + + // Create media2 + CGlxMedia* cache1Media2 = new (ELeave) CGlxMedia(TGlxMediaId(KCache1Media2Id)); + CleanupStack::PushL(cache1Media2); + + cache1Media2->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + + CGlxFetchErrorArray* cache1Media2ErrorArray = new (ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(cache1Media2ErrorArray); + + time.UniversalTime(); + + TGlxFetchError cache1Media2Error1(KMPXMediaGeneralTitle, KErrNotSupported); + cache1Media2ErrorArray->AddErrorL(cache1Media2Error1); + + TGlxFetchError cache1Media2Error2(KMPXMediaGeneralSubTitle, KErrNotFound); + cache1Media2ErrorArray->AddErrorL(cache1Media2Error2); + + cache1Media2->SetCObjectValueL(GlxErrorManager::ErrorAttribute(), cache1Media2ErrorArray); + + CleanupStack::Pop(cache1Media2ErrorArray); + + cache1Helper.ItemPool().AppendL(cache1Media2); + + CleanupStack::Pop(cache1Media2); + + // Create media3 + CGlxMedia* cache1Media3 = new (ELeave) CGlxMedia(TGlxMediaId(KCache1Media3Id)); + CleanupStack::PushL(cache1Media3); + + cache1Media3->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + + CGlxFetchErrorArray* cache1Media3ErrorArray = new (ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(cache1Media3ErrorArray); + + time.UniversalTime(); + time -= TTimeIntervalSeconds(KErrorExpiryPeriod); + + TGlxFetchError cache1Media3Error1(KMPXMediaGeneralTitle, KErrNotSupported); + cache1Media3Error1.iTimestamp = time.DateTime(); + cache1Media3ErrorArray->AddErrorL(cache1Media3Error1); + + TGlxFetchError cache1Media3Error2(KMPXMediaGeneralSubTitle, KErrNotFound); + cache1Media3Error2.iTimestamp = time.DateTime(); + cache1Media3ErrorArray->AddErrorL(cache1Media3Error2); + + cache1Media3->SetCObjectValueL(GlxErrorManager::ErrorAttribute(), cache1Media3ErrorArray); + + CleanupStack::Pop(cache1Media3ErrorArray); + + cache1Helper.ItemPool().AppendL(cache1Media3); + + CleanupStack::Pop(cache1Media3); + + // Create cache2 + CGlxCache* cache2 = new (ELeave) CGlxCache(TGlxIdSpaceId(KIdSpaceId2),iCacheManager); + CleanupStack::PushL(cache2); + iCaches.AppendL(cache2); + CleanupStack::Pop(cache2); + + // Create helper class + T_CacheTestHelpers cache2Helper(cache2); + + // Create media1 + CGlxMedia* cache2Media1 = new (ELeave) CGlxMedia(TGlxMediaId(KCache2Media1Id)); + CleanupStack::PushL(cache2Media1); + + cache2Media1->SetTextValueL(KMPXMediaGeneralTitle, KCache2Media1Title); + cache2Media1->SetTextValueL(KMPXMediaGeneralSubTitle, KCache2Media1SubTitle); + cache2Media1->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); + + cache2Helper.ItemPool().AppendL(cache2Media1); + + CleanupStack::Pop(cache2Media1); + + // Create media2 + CGlxMedia* cache2Media2 = new (ELeave) CGlxMedia(TGlxMediaId(KCache2Media2Id)); + CleanupStack::PushL(cache2Media2); + + cache2Media2->SetTextValueL(KMPXMediaGeneralTitle, KCache2Media2Title); + cache2Media2->SetTextValueL(KMPXMediaGeneralSubTitle, KCache2Media2SubTitle); + cache2Media2->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + + cache2Helper.ItemPool().AppendL(cache2Media2); + + CleanupStack::Pop(cache2Media2); + + // Create cache3 + CGlxCache* cache3 = new (ELeave) CGlxCache(TGlxIdSpaceId(KIdSpaceId3),iCacheManager); + CleanupStack::PushL(cache3); + iCaches.AppendL(cache3); + CleanupStack::Pop(cache3); + + // Create helper class + T_CacheTestHelpers cache3Helper(cache3); + + // Create media1 + CGlxMedia* cache3Media1 = new (ELeave) CGlxMedia(TGlxMediaId(KCache3Media1Id)); + CleanupStack::PushL(cache3Media1); + + time.UniversalTime(); + + cache3Media1->SetTObjectValueL(KMPXMediaGeneralThumbnail1, KCache3Media1Id); + cache3Media1->SetTextValueL(KMPXMediaGeneralTitle, KCache3Media1Title); + cache3Media1->SetTObjectValueL(KMPXMediaGeneralDate, time.Int64()); + cache3Media1->SetTObjectValueL(KMPXMediaGeneralSize, KCache3Media1Size); + + cache3Helper.ItemPool().AppendL(cache3Media1); + + CleanupStack::Pop(cache3Media1); + + // Create media2 + CGlxMedia* cache3Media2 = new (ELeave) CGlxMedia(TGlxMediaId(KCache3Media2Id)); + CleanupStack::PushL(cache3Media2); + + cache3Media2->SetTObjectValueL(KMPXMediaGeneralSize, KCache3Media2Size); + + cache3Helper.ItemPool().AppendL(cache3Media2); + + CleanupStack::Pop(cache3Media2); + + // Create media3 + CGlxMedia* cache3Media3 = new (ELeave) CGlxMedia(TGlxMediaId(KCache3Media3Id)); + CleanupStack::PushL(cache3Media3); + + cache3Media3->SetTextValueL(KMPXMediaGeneralTitle, KCache3Media3Title); + cache3Media3->SetTObjectValueL(KMPXMediaGeneralSize, KCache3Media3Size); + + cache3Helper.ItemPool().AppendL(cache3Media3); + + CleanupStack::Pop(cache3Media3); + + // Create media4 + CGlxMedia* cache3Media4 = new (ELeave) CGlxMedia(TGlxMediaId(KCache3Media4Id)); + CleanupStack::PushL(cache3Media4); + + cache3Media4->SetTextValueL(KMPXMediaGeneralTitle, KCache3Media4Title); + cache3Media4->SetTObjectValueL(KMPXMediaGeneralDate, time.Int64()); + + CGlxFetchErrorArray* cache3Media4ErrorArray = new (ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(cache3Media4ErrorArray); + + time.UniversalTime(); + time -= TTimeIntervalSeconds(KErrorExpiryPeriod); + + TGlxFetchError cache3Media4Error1(KMPXMediaGeneralThumbnail1, KErrNotFound); + cache3Media4Error1.iTimestamp = time.DateTime(); + cache3Media4ErrorArray->AddErrorL(cache3Media4Error1); + + TGlxFetchError cache3Media4Error2(KMPXMediaGeneralSize, KErrCorrupt); + cache3Media4Error2.iTimestamp = time.DateTime(); + cache3Media4ErrorArray->AddErrorL(cache3Media4Error2); + + cache3Media4->SetCObjectValueL(GlxErrorManager::ErrorAttribute(), cache3Media4ErrorArray); + + CleanupStack::Pop(cache3Media4ErrorArray); + + cache3Helper.ItemPool().AppendL(cache3Media4); + + CleanupStack::Pop(cache3Media4); + + // Create media5 + CGlxMedia* cache3Media5 = new (ELeave) CGlxMedia(TGlxMediaId(KCache3Media5Id)); + CleanupStack::PushL(cache3Media5); + + time.UniversalTime(); + + cache3Media5->SetTextValueL(KMPXMediaGeneralTitle, KCache3Media5Title); + cache3Media5->SetTObjectValueL(KMPXMediaGeneralDate, time.Int64()); + + CGlxFetchErrorArray* cache3Media5ErrorArray = new (ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(cache3Media5ErrorArray); + + TGlxFetchError cache3Media5Error1(KMPXMediaGeneralThumbnail1, KErrNotFound); + cache3Media5Error1.iTimestamp = time.DateTime(); + cache3Media5ErrorArray->AddErrorL(cache3Media5Error1); + + TGlxFetchError cache3Media5Error2(KMPXMediaGeneralSize, KErrCorrupt); + cache3Media5Error2.iTimestamp = time.DateTime(); + cache3Media5ErrorArray->AddErrorL(cache3Media5Error2); + + cache3Media5->SetCObjectValueL(GlxErrorManager::ErrorAttribute(), cache3Media5ErrorArray); + + CleanupStack::Pop(cache3Media5ErrorArray); + + cache3Helper.ItemPool().AppendL(cache3Media5); + + CleanupStack::Pop(cache3Media5); + + // Create media6 + CGlxMedia* cache3Media6 = new (ELeave) CGlxMedia(TGlxMediaId(KCache3Media6Id)); + CleanupStack::PushL(cache3Media6); + + CGlxFetchErrorArray* cache3Media6ErrorArray = new (ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(cache3Media6ErrorArray); + + time.UniversalTime(); + time -= TTimeIntervalSeconds(KErrorExpiryPeriod); + + TGlxFetchError cache3Media6Error1(KMPXMediaGeneralSize, KErrCorrupt); + cache3Media6Error1.iTimestamp = time.DateTime(); + cache3Media6ErrorArray->AddErrorL(cache3Media6Error1); + + cache3Media6->SetCObjectValueL(GlxErrorManager::ErrorAttribute(), cache3Media6ErrorArray); + + CleanupStack::Pop(cache3Media6ErrorArray); + + cache3Helper.ItemPool().AppendL(cache3Media6); + + CleanupStack::Pop(cache3Media6); + + // Create media7 + CGlxMedia* cache3Media7 = new (ELeave) CGlxMedia(TGlxMediaId(KCache3Media7Id)); + CleanupStack::PushL(cache3Media7); + + CGlxFetchErrorArray* cache3Media7ErrorArray = new (ELeave) CGlxFetchErrorArray(); + CleanupStack::PushL(cache3Media7ErrorArray); + + time.UniversalTime(); + + TGlxFetchError cache3Media7Error1(KMPXMediaGeneralSize, KErrCorrupt); + cache3Media7Error1.iTimestamp = time.DateTime(); + cache3Media7ErrorArray->AddErrorL(cache3Media7Error1); + + cache3Media7->SetCObjectValueL(GlxErrorManager::ErrorAttribute(), cache3Media7ErrorArray); + + CleanupStack::Pop(cache3Media7ErrorArray); + + cache3Helper.ItemPool().AppendL(cache3Media7); + + CleanupStack::Pop(cache3Media7); + } + +void T_CGlxGarbageCollector::AddMediaUserToCacheMediasL(CGlxCache& aCache, + MGlxMediaUser& aMediaUser) + { + // Create helper class + T_CacheTestHelpers cacheHelper(&aCache); + + TInt cacheCount = aCache.Count(); + for (TInt i = 0; i < cacheCount; ++i) + { + CGlxMedia* media = cacheHelper.ItemPool()[i]; + + TInt userCount = media->UserCount(); + + media->ReserveUsersL(userCount + 1); + media->AddUser(aMediaUser, KErrNotFound); + } + } + +void T_CGlxGarbageCollector::RemoveMediaUserFromCacheMedias(CGlxCache& aCache, + MGlxMediaUser& aMediaUser) + { + // Create helper class + T_CacheTestHelpers cacheHelper(&aCache); + + TInt cacheCount = aCache.Count(); + for (TInt i = 0; i < cacheCount; ++i) + { + CGlxMedia* media = cacheHelper.ItemPool()[i]; + media->RemoveUser(aMediaUser); + } + } + +void T_CGlxGarbageCollector::AddMediaUserToMediaL(CGlxCache& aCache, TInt aIndex, + MGlxMediaUser& aMediaUser) + { + // Create helper class + T_CacheTestHelpers cacheHelper(&aCache); + + CGlxMedia* media = cacheHelper.ItemPool()[aIndex]; + + TInt userCount = media->UserCount(); + + media->ReserveUsersL(userCount + 1); + media->AddUser(aMediaUser, KErrNotFound); + } + +void T_CGlxGarbageCollector::RemoveMediaUserFromMedia(CGlxCache& aCache, TInt aIndex, + MGlxMediaUser& aMediaUser) + { + // Create helper class + T_CacheTestHelpers cacheHelper(&aCache); + + CGlxMedia* media = cacheHelper.ItemPool()[aIndex]; + media->RemoveUser(aMediaUser); + } + +void T_CGlxGarbageCollector::CheckCache1MediaAttributes(const CGlxMedia& aMedia, + TInt aAttributeCount, TBool aTitleSupported, TBool aSubtitleSupported, + TBool aSystemItemSupported, TBool aErrorSupported) + { + EUNIT_ASSERT_DESC(aMedia.Count() == aAttributeCount, "Incorrect attributes remaining"); + + EUNIT_ASSERT_DESC(aMedia.IsSupported(KMPXMediaGeneralTitle) == aTitleSupported, "Incorrect Title attribute expectation"); + EUNIT_ASSERT_DESC(aMedia.IsSupported(KMPXMediaGeneralSubTitle) == aSubtitleSupported, "Incorrect Subtitle attribute expectation"); + EUNIT_ASSERT_DESC(aMedia.IsSupported(KGlxMediaGeneralSystemItem) == aSystemItemSupported, "Incorrect System item attribute expectation"); + EUNIT_ASSERT_DESC(aMedia.IsSupported(GlxErrorManager::ErrorAttribute()) == aErrorSupported, "Incorrect error attribute expectation"); + } + +void T_CGlxGarbageCollector::CheckCache2MediaAttributes(const CGlxMedia& aMedia, + TInt aAttributeCount, TBool aTitleSupported, TBool aSubtitleSupported, + TBool aSystemItemSupported, TBool aErrorSupported) + { + CheckCache1MediaAttributes(aMedia, aAttributeCount, aTitleSupported, aSubtitleSupported, aSystemItemSupported, aErrorSupported); + } + +void T_CGlxGarbageCollector::CheckCache3MediaAttributes(const CGlxMedia& aMedia, + TInt aAttributeCount, TBool aThumbnailSupported, TBool aTitleSupported, + TBool aDateSupported, TBool aSizeSupported, TBool aErrorSupported) + { + EUNIT_ASSERT_DESC(aMedia.Count() == aAttributeCount, "Incorrect attributes remaining"); + + EUNIT_ASSERT_DESC(aMedia.IsSupported(KMPXMediaGeneralThumbnail1) == aThumbnailSupported, "Incorrect Thumbnail attribute expectation"); + EUNIT_ASSERT_DESC(aMedia.IsSupported(KMPXMediaGeneralTitle) == aTitleSupported, "Incorrect Title attribute expectation"); + EUNIT_ASSERT_DESC(aMedia.IsSupported(KMPXMediaGeneralDate) == aDateSupported, "Incorrect Date attribute expectation"); + EUNIT_ASSERT_DESC(aMedia.IsSupported(KMPXMediaGeneralSize) == aSizeSupported, "Incorrect Size attribute expectation"); + EUNIT_ASSERT_DESC(aMedia.IsSupported(GlxErrorManager::ErrorAttribute()) == aErrorSupported, "Incorrect error attribute expectation"); + } + +void T_CGlxGarbageCollector::CheckCache1MediaErrors(const CGlxMedia& aMedia, + TBool aError, TBool aTitleError, TBool aSubtitleError, TBool aSystemItemError) + { + EUNIT_ASSERT_DESC(GlxErrorManager::HasError(&aMedia) == aError, "Incorrect error expectation"); + + EUNIT_ASSERT_DESC((GlxErrorManager::HasAttributeErrorL(&aMedia, KMPXMediaGeneralTitle) != KErrNone) == aTitleError, "Incorrect Title attribute error expectation"); + EUNIT_ASSERT_DESC((GlxErrorManager::HasAttributeErrorL(&aMedia, KMPXMediaGeneralSubTitle) != KErrNone) == aSubtitleError, "Incorrect Subtitle attribute error expectation"); + EUNIT_ASSERT_DESC((GlxErrorManager::HasAttributeErrorL(&aMedia, KGlxMediaGeneralSystemItem) != KErrNone) == aSystemItemError, "Incorrect System item attribute error expectation"); + } + +void T_CGlxGarbageCollector::CheckCache2MediaErrors(const CGlxMedia& aMedia, + TBool aError, TBool aTitleError, TBool aSubtitleError, TBool aSystemItemError) + { + CheckCache1MediaErrors(aMedia, aError, aTitleError, aSubtitleError, aSystemItemError); + } + +void T_CGlxGarbageCollector::CheckCache3MediaErrors(const CGlxMedia& aMedia, + TBool aError, TBool aThumbnailError, TBool aTitleError, TBool aDateError, TBool aSizeError) + { + EUNIT_ASSERT_DESC(GlxErrorManager::HasError(&aMedia) == aError, "Incorrect error expectation"); + + EUNIT_ASSERT_DESC((GlxErrorManager::HasAttributeErrorL(&aMedia, KMPXMediaGeneralThumbnail1) != KErrNone) == aThumbnailError, "Incorrect Thumbnail attribute error expectation"); + EUNIT_ASSERT_DESC((GlxErrorManager::HasAttributeErrorL(&aMedia, KMPXMediaGeneralTitle) != KErrNone) == aTitleError, "Incorrect Title attribute error expectation"); + EUNIT_ASSERT_DESC((GlxErrorManager::HasAttributeErrorL(&aMedia, KMPXMediaGeneralDate) != KErrNone) == aDateError, "Incorrect Date attribute error expectation"); + EUNIT_ASSERT_DESC((GlxErrorManager::HasAttributeErrorL(&aMedia, KMPXMediaGeneralSize) != KErrNone) == aSizeError, "Incorrect Size attribute error expectation"); + } + +// Test media user +T_CGlxGarbageCollector::CGlxMediaUserTest* T_CGlxGarbageCollector::CGlxMediaUserTest::NewL(const RArray& aAttributes, T_CGlxGarbageCollector& aGarbageCollector) + { + CGlxMediaUserTest* self = new (ELeave) CGlxMediaUserTest(aGarbageCollector); + CleanupStack::PushL(self); + self->ConstructL(aAttributes); + CleanupStack::Pop(); + return self; + } + +T_CGlxGarbageCollector::CGlxMediaUserTest::CGlxMediaUserTest(T_CGlxGarbageCollector& aGarbageCollector) : + iAttributes(), iGarbageCollector(aGarbageCollector) + { + } + +T_CGlxGarbageCollector::CGlxMediaUserTest::~CGlxMediaUserTest() + { + iAttributes.Close(); + } + +void T_CGlxGarbageCollector::CGlxMediaUserTest::ConstructL(const RArray& aAttributes) + { + TInt attributeCount = aAttributes.Count(); + for (TInt i = 0; i < attributeCount; ++i) + { + iAttributes.AppendL(aAttributes[i]); + } + } + +void T_CGlxGarbageCollector::CGlxMediaUserTest::GetRequiredAttributesL( + TInt /*aIndex*/, + RArray& aAttributes) + { + TInt attributeCount = iAttributes.Count(); + for (TInt i = 0; i < attributeCount; ++i) + { + aAttributes.AppendL(iAttributes[i]); + } + } + +void T_CGlxGarbageCollector::CGlxMediaUserTest::RemoveReference(TInt aIndex) + { + EUNIT_PRINT(_L("Call remove Reference on T_CGlxGaarbageCollector")); + + // Call remove Reference on T_CGlxGaarbageCollector + iGarbageCollector.RemoveMediaReference(aIndex); + } + +// Test timer +T_CGlxGarbageCollector::CTimerTest* T_CGlxGarbageCollector::CTimerTest::NewL( + T_CGlxGarbageCollector* aTestGarbageCollector) + { + CTimerTest* self = new (ELeave) CTimerTest(aTestGarbageCollector); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +T_CGlxGarbageCollector::CTimerTest::CTimerTest( + T_CGlxGarbageCollector* aTestGarbageCollector) : + CTimer(EPriorityLow), + iTestGarbageCollector(aTestGarbageCollector) + { + CActiveScheduler::Add(this); + } + +T_CGlxGarbageCollector::CTimerTest::~CTimerTest() + { + Cancel(); + } + +void T_CGlxGarbageCollector::CTimerTest::ConstructL() + { + CTimer::ConstructL(); + } + +void T_CGlxGarbageCollector::CTimerTest::StartTimer(TInt aSeconds) + { + After(aSeconds * KMicrosecondsInSeconds); + } + +void T_CGlxGarbageCollector::CTimerTest::RunL() + { + iTestGarbageCollector->TimerCallback(); + } + +// Override CIdle implementation for test purposes, +// So that test can do things just after idle callbacks +EXPORT_C CIdle* CIdle::New(TInt aPriority) + { + CIdle *pI=new CIdle(aPriority); + if (pI!=NULL) + CActiveScheduler::Add(pI); + return(pI); + } + +EXPORT_C CIdle* CIdle::NewL(TInt aPriority) + { + CIdle *pI=new(ELeave) CIdle(aPriority); + CActiveScheduler::Add(pI); + return(pI); + } + +EXPORT_C CIdle::CIdle(TInt aPriority) + : CActive(aPriority) + { + } + +EXPORT_C CIdle::~CIdle() + { + Cancel(); + } + +EXPORT_C void CIdle::Start(TCallBack aCallBack) + { + iCallBack=aCallBack; + iStatus=KRequestPending; + TRequestStatus *pS=(&iStatus); + User::RequestComplete(pS,0); + SetActive(); + } + +EXPORT_C void CIdle::RunL() + { + if (iCallBack.CallBack()) + { + Start(iCallBack); + + if (T_CGlxGarbageCollector::iGarbageCollectorTest) + { + T_CGlxGarbageCollector::iGarbageCollectorTest->IdleCallbackCalledL(); + } + } + } + +EXPORT_C void CIdle::DoCancel() + { + } + + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + T_CGlxGarbageCollector, + "Add test suite description here.", + "UNIT" ) +/* +EUNIT_TEST( + "Cleanup - test0, subtest0", + "CGlxGarbageCollector", + "Cleanup - test0, subtest0", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_Cleanup_SubTest0L, Teardown) + + +EUNIT_TEST( + "Cleanup - test1, subtest1", + "CGlxGarbageCollector", + "Cleanup - test1, subtest1", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_Cleanup_SubTest1L, Teardown) + +EUNIT_TEST( + "Cleanup - test1, subtest2", + "CGlxGarbageCollector", + "Cleanup - test1, subtest2", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_Cleanup_SubTest2L, Teardown) + + +EUNIT_TEST( + "Cleanup - test1, subtest3", + "CGlxGarbageCollector", + "Cleanup - test1, subtest3", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_Cleanup_SubTest3L, Teardown) + +EUNIT_TEST( + "Cleanup - test1, subtest4", + "CGlxGarbageCollector", + "Cleanup - test1, subtest4", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_Cleanup_SubTest4L, Teardown) + + +EUNIT_TEST( + "CleanupCaches - test2", + "CGlxGarbageCollector", + "CleanupCaches - test2", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupCachesL, Teardown) +*/ +EUNIT_TEST( + "CleanupCache - test3, subtest1", + "CGlxGarbageCollector", + "CleanupCache - test3, subtest1", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupCache_SubTest1L, Teardown) + +EUNIT_TEST( + "CleanupCache - test3, subtest2", + "CGlxGarbageCollector", + "CleanupCache - test3, subtest2", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupCache_SubTest2L, Teardown) + +EUNIT_TEST( + "CleanupCache - test3, subtest3", + "CGlxGarbageCollector", + "CleanupCache - test3, subtest3", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupCache_SubTest3L, Teardown) +/* +EUNIT_TEST( + "CleanupCache - test3, subtest4", + "CGlxGarbageCollector", + "CleanupCache - test3, subtest4", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupCache_SubTest4L, Teardown) + + +EUNIT_TEST( + "CleanupCache - test3, subtest5", + "CGlxGarbageCollector", + "CleanupCache - test3, subtest5", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupCache_SubTest5L, Teardown) +*/ + +EUNIT_TEST( + "CleanupMediaL - test4, subtest1", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest1", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest1L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest2", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest2", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest2L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest3", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest3", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest3L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest4", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest4", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest4L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest5", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest5", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest5L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest6", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest6", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest6L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest7", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest7", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest7L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest8", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest8", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest8L, Teardown) + +EUNIT_TEST( + "CleanupMediaL - test4, subtest9", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest9", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest9L, Teardown) +/* +EUNIT_TEST( + "CleanupMediaL - test4, subtest10", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest10", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest10L, Teardown) +*/ +EUNIT_TEST( + "CleanupMediaL - test4, subtest11", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest11", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest11L, Teardown) +/* +EUNIT_TEST( + "CleanupMediaL - test4, subtest12", + "CGlxGarbageCollector", + "CleanupMediaL - test4, subtest12", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_CleanupMediaL_SubTest12L, Teardown) +*/ +EUNIT_TEST( + "GetAttributesInUseL - test5", + "CGlxGarbageCollector", + "GetAttributesInUseL - test5", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_GetAttributesInUseLL, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest1", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest1", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest1L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest2", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest2", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest2L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest3", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest3", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest3L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest4", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest4", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest4L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest5", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest5", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest5L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest6", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest6", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest6L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest7", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest7", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest7L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest8", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest8", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest8L, Teardown) + +EUNIT_TEST( + "DeleteOtherAttributes - test6, subtest9", + "CGlxGarbageCollector", + "DeleteOtherAttributes - test6, subtest9", + "FUNCTIONALITY", + SetupL, T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest9L, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxgarbagecollector/t_cglxgarbagecollector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxgarbagecollector/t_cglxgarbagecollector.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxGarbageCollector unit tests +* +*/ + + + + +#ifndef __T_CGLXGARBAGECOLLECTOR_H__ +#define __T_CGLXGARBAGECOLLECTOR_H__ + +// EXTERNAL INCLUDES +#include +#include + +#include + +// INTERNAL INCLUDES +#include "mglxmediauser.h" +#include "t_mglxreferenceobserver.h" + +// FORWARD DECLARATIONS +class CGlxCache; +class CGlxGarbageCollector; +class CGlxCacheManager; + +// CLASS DEFINITION +/** + * T_CGlxGarbageCollector Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_CGlxGarbageCollector ) + : public CEUnitTestSuiteClass, + public MGlxReferenceObserver + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CGlxGarbageCollector* NewL(); + static T_CGlxGarbageCollector* NewLC(); + /** + * Destructor + */ + ~T_CGlxGarbageCollector(); + + public: + + void IdleCallbackCalledL(); + + public: + //From ReferenceObserver + void RemoveMediaReference(TInt aIndex); + + private: // Constructors and destructors + + T_CGlxGarbageCollector(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_CGlxGarbageCollector_Cleanup_SubTest0L(); + void T_CGlxGarbageCollector_Cleanup_SubTest1L(); + void T_CGlxGarbageCollector_Cleanup_SubTest2L(); + void T_CGlxGarbageCollector_Cleanup_SubTest3L(); + void T_CGlxGarbageCollector_Cleanup_SubTest4L(); + + void T_CGlxGarbageCollector_CleanupCachesL(); + + void T_CGlxGarbageCollector_CleanupCache_SubTest1L(); + void T_CGlxGarbageCollector_CleanupCache_SubTest2L(); + void T_CGlxGarbageCollector_CleanupCache_SubTest3L(); + void T_CGlxGarbageCollector_CleanupCache_SubTest4L(); + void T_CGlxGarbageCollector_CleanupCache_SubTest5L(); + + void T_CGlxGarbageCollector_CleanupMediaL_SubTest1L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest2L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest3L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest4L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest5L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest6L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest7L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest8L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest9L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest10L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest11L(); + void T_CGlxGarbageCollector_CleanupMediaL_SubTest12L(); + + void T_CGlxGarbageCollector_GetAttributesInUseLL(); + + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest1L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest2L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest3L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest4L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest5L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest6L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest7L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest8L(); + void T_CGlxGarbageCollector_DeleteOtherAttributes_SubTest9L(); + + private: // Internal methods + + void TimerCallback(); + + void UpdateMediaL(); + + void SetupCachesL(); + + void AddMediaUserToCacheMediasL(CGlxCache& aCache, MGlxMediaUser& aMediaUser); + void RemoveMediaUserFromCacheMedias(CGlxCache& aCache, MGlxMediaUser& aMediaUser); + + void AddMediaUserToMediaL(CGlxCache& aCache, TInt aIndex, MGlxMediaUser& aMediaUser); + void RemoveMediaUserFromMedia(CGlxCache& aCache, TInt aIndex, MGlxMediaUser& aMediaUser); + + void CheckCache1MediaAttributes(const CGlxMedia& aMedia, TInt aAttributeCount, + TBool aTitleSupported, TBool aSubtitleSupported, TBool aSystemItemSupported, + TBool aErrorSupported = EFalse); + void CheckCache2MediaAttributes(const CGlxMedia& aMedia, TInt aAttributeCount, + TBool aTitleSupported, TBool aSubtitleSupported, TBool aSystemItemSupported, + TBool aErrorSupported = EFalse); + void CheckCache3MediaAttributes(const CGlxMedia& aMedia, TInt aAttributeCount, + TBool aThumbnailSupported, TBool aTitleSupported, TBool aDateSupported, + TBool aSizeSupported, TBool aErrorSupported = EFalse); + + void CheckCache1MediaErrors(const CGlxMedia& aMedia, TBool aError, + TBool aTitleError = EFalse, TBool aSubtitleError = EFalse, + TBool aSystemItemError = EFalse); + void CheckCache2MediaErrors(const CGlxMedia& aMedia, TBool aError, + TBool aTitleError = EFalse, TBool aSubtitleError = EFalse, + TBool aSystemItemError = EFalse); + void CheckCache3MediaErrors(const CGlxMedia& aMedia, TBool aError, + TBool aThumbnailError = EFalse, TBool aTitleError = EFalse, + TBool aDateError = EFalse, TBool aSizeError = EFalse); + + + + private: // Test classes + + // Test media user + class CGlxMediaUserTest : public CBase, public MGlxMediaUser + { + public: + static CGlxMediaUserTest* NewL(const RArray& aAttributes, T_CGlxGarbageCollector& aGarbageCollector); + virtual ~CGlxMediaUserTest(); + + private: + CGlxMediaUserTest(T_CGlxGarbageCollector& aGarbageCollector); + void ConstructL(const RArray& aAttributes); + + private: // From MGlxMediaUser + void GetRequiredAttributesL(TInt aIndex, RArray& aAttributes); + void HandleAttributesAvailableL(TInt /*aIndex*/, + const RArray& /*aAttributes*/) {}; + void RemoveReference(TInt aIndex); + void HandleError(TInt /*aError*/) {}; + + private: // Data + RArray iAttributes; + T_CGlxGarbageCollector& iGarbageCollector; + }; + + // Test timer + class CTimerTest : public CTimer + { + public: + static CTimerTest* NewL(T_CGlxGarbageCollector* aTestGarbageCollector); + virtual ~CTimerTest(); + + public: + void StartTimer(TInt aSeconds); + + private: + CTimerTest(T_CGlxGarbageCollector* aTestGarbageCollector); + void ConstructL(); + + private: // From CTimer/CActive + void RunL(); + + private: + T_CGlxGarbageCollector* iTestGarbageCollector; + }; + + public: // Data + + static T_CGlxGarbageCollector* iGarbageCollectorTest; + + private: // Data + + CGlxGarbageCollector* iCGlxGarbageCollector; + + RPointerArray iCaches; + + CActiveSchedulerWait iWait; + + TInt iIdleCallbackCount; + + CGlxCacheManager* iCacheManager; + + MGlxMediaUser* iMediaUser_Test; + + EUNIT_DECLARE_TEST_TABLE; + }; + +#endif // __T_CGLXGARBAGECOLLECTOR_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxgarbagecollector/t_cglxgarbagecollector_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxgarbagecollector/t_cglxgarbagecollector_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxGarbageCollector unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "t_cglxgarbagecollector.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CGlxGarbageCollector::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxmedia/t_cglxmedia.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxmedia/t_cglxmedia.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMedia unit tests +* +*/ + + + + +// CLASS HEADER +#include "t_cglxmedia.h" + +// EXTERNAL INCLUDES +#include +#include + +#include +#include + +#include + +// INTERNAL INCLUDES +#include "glxmedia.h" + +const TInt KMediaId = 1; + +_LIT(KMediaTitle, "Captured"); +_LIT(KMediaSubTitle, "0 items"); + +// CONSTRUCTION +T_CGlxMedia* T_CGlxMedia::NewL() + { + T_CGlxMedia* self = T_CGlxMedia::NewLC(); + CleanupStack::Pop(); + + return self; + } + +T_CGlxMedia* T_CGlxMedia::NewLC() + { + T_CGlxMedia* self = new( ELeave ) T_CGlxMedia(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +T_CGlxMedia::~T_CGlxMedia() + { + } + +// Default constructor +T_CGlxMedia::T_CGlxMedia() + { + } + +// Second phase construct +void T_CGlxMedia::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void T_CGlxMedia::SetupL( ) + { + iCGlxMedia = new (ELeave) CGlxMedia(TGlxMediaId(KMediaId));; + iCGlxMedia->SetTextValueL(KMPXMediaGeneralTitle, KMediaTitle); + iCGlxMedia->SetTextValueL(KMPXMediaGeneralSubTitle, KMediaSubTitle); + iCGlxMedia->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); + } + +void T_CGlxMedia::Teardown( ) + { + delete iCGlxMedia; + iCGlxMedia = NULL; + } + +void T_CGlxMedia::T_CGlxMedia_DeleteAttributeL( ) + { + // Delete non existing attribute + EUNIT_PRINT(_L("Delete non existing attribute")); + iCGlxMedia->DeleteAttribute(KMPXMediaGeneralThumbnail1); + EUNIT_ASSERT_DESC(iCGlxMedia->Count() == 3, "3 attributes should remain"); + EUNIT_ASSERT_DESC(iCGlxMedia->IsSupported(KMPXMediaGeneralTitle), "Title attribute should remain"); + EUNIT_ASSERT_DESC(iCGlxMedia->IsSupported(KMPXMediaGeneralSubTitle), "Subtitle attribute should remain"); + EUNIT_ASSERT_DESC(iCGlxMedia->IsSupported(KGlxMediaGeneralSystemItem), "System item attribute should remain"); + + // Delete existing attribute + EUNIT_PRINT(_L("Delete existing attribute")); + iCGlxMedia->DeleteAttribute(KMPXMediaGeneralSubTitle); + EUNIT_ASSERT_DESC(iCGlxMedia->Count() == 2, "2 attributes should remain"); + EUNIT_ASSERT_DESC(iCGlxMedia->IsSupported(KMPXMediaGeneralTitle), "Title attribute should remain"); + EUNIT_ASSERT_DESC(!iCGlxMedia->IsSupported(KMPXMediaGeneralSubTitle), "Subtitle attribute shouldn't remain"); + EUNIT_ASSERT_DESC(iCGlxMedia->IsSupported(KGlxMediaGeneralSystemItem), "System item attribute should remain"); + } + +void T_CGlxMedia::T_CGlxMedia_DeleteAttribute2_SubTest1L( ) + { +#ifdef _DEBUG + // Delete index less than 0 + EUNIT_PRINT(_L("Delete index less than 0")); + EUNIT_ASSERT_PANIC_DESC(iCGlxMedia->DeleteAttribute(-1), "Images & videos", EGlxPanicIllegalArgument, "Incorrect panic"); +#endif // _DEBUG + } + +void T_CGlxMedia::T_CGlxMedia_DeleteAttribute2_SubTest2L( ) + { +#ifdef _DEBUG + // Delete index greater than number of attributes + EUNIT_PRINT(_L("Delete index greater than number of attributes")); + EUNIT_ASSERT_PANIC_DESC(iCGlxMedia->DeleteAttribute(3), "Images & videos", EGlxPanicIllegalArgument, "Incorrect panic"); +#endif // _DEBUG + } + +void T_CGlxMedia::T_CGlxMedia_DeleteAttribute2_SubTest3L( ) + { + // Delete existing attribute + EUNIT_PRINT(_L("Delete existing attribute")); + iCGlxMedia->DeleteAttribute(2); + EUNIT_ASSERT_DESC(iCGlxMedia->Count() == 2, "2 attributes should remain"); + EUNIT_ASSERT_DESC(iCGlxMedia->IsSupported(KMPXMediaGeneralTitle), "Title attribute should remain"); + EUNIT_ASSERT_DESC(iCGlxMedia->IsSupported(KMPXMediaGeneralSubTitle), "Subtitle attribute should remain"); + EUNIT_ASSERT_DESC(!iCGlxMedia->IsSupported(KGlxMediaGeneralSystemItem), "System item attribute shouldn't remain"); + } + + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + T_CGlxMedia, + "Add test suite description here.", + "UNIT" ) + +EUNIT_TEST( + "DeleteAttribute - test1", + "CGlxMedia", + "DeleteAttribute - test1", + "FUNCTIONALITY", + SetupL, T_CGlxMedia_DeleteAttributeL, Teardown) + +EUNIT_TEST( + "DeleteAttribute2 - test2, subtest1", + "CGlxMedia", + "DeleteAttribute2 - test2, subtest1", + "FUNCTIONALITY", + SetupL, T_CGlxMedia_DeleteAttribute2_SubTest1L, Teardown) + +EUNIT_TEST( + "DeleteAttribute2 - test2, subtest2", + "CGlxMedia", + "DeleteAttribute2 - test2, subtest2", + "FUNCTIONALITY", + SetupL, T_CGlxMedia_DeleteAttribute2_SubTest2L, Teardown) + +EUNIT_TEST( + "DeleteAttribute2 - test2, subtest3", + "CGlxMedia", + "DeleteAttribute2 - test2, subtest3", + "FUNCTIONALITY", + SetupL, T_CGlxMedia_DeleteAttribute2_SubTest3L, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxmedia/t_cglxmedia.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxmedia/t_cglxmedia.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMedia unit tests +* +*/ + + + + +#ifndef __T_CGLXMEDIA_H__ +#define __T_CGLXMEDIA_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS +class CGlxMedia; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( T_CGlxMedia ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static T_CGlxMedia* NewL(); + static T_CGlxMedia* NewLC(); + /** + * Destructor + */ + ~T_CGlxMedia(); + + private: // Constructors and destructors + + T_CGlxMedia(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_CGlxMedia_DeleteAttributeL(); + + void T_CGlxMedia_DeleteAttribute2_SubTest1L(); + + void T_CGlxMedia_DeleteAttribute2_SubTest2L(); + + void T_CGlxMedia_DeleteAttribute2_SubTest3L(); + + + private: // Data + + CGlxMedia* iCGlxMedia; + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_CGLXMEDIA_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_cglxmedia/t_cglxmedia_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_cglxmedia/t_cglxmedia_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMedia unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "t_cglxmedia.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CGlxMedia::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_glxfromfocusoutwarditerator/t_glxfromfocusoutwarditerator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_glxfromfocusoutwarditerator/t_glxfromfocusoutwarditerator.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,680 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TGlxFromFocusOutwardIterator unit tests +* +*/ + + + + +#include + +#include "t_glxfromfocusoutwarditerator.h" + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +T_CGlxFromFocusOutwardIterator* T_CGlxFromFocusOutwardIterator::NewL() + { + T_CGlxFromFocusOutwardIterator* self = T_CGlxFromFocusOutwardIterator::NewLC(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +T_CGlxFromFocusOutwardIterator* T_CGlxFromFocusOutwardIterator::NewLC() + { + T_CGlxFromFocusOutwardIterator* self = new( ELeave ) T_CGlxFromFocusOutwardIterator(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +T_CGlxFromFocusOutwardIterator::~T_CGlxFromFocusOutwardIterator() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +T_CGlxFromFocusOutwardIterator::T_CGlxFromFocusOutwardIterator() + { + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// ---------------------------------------------------------------------------- +// Setup +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::SetupL( ) + { + iOrder = &iFocusOrder; + iList.iCount = 0; + iList.iFocusIndex = -1; + iOrder->SetToFirst(&iList); + iFocusOrder.SetRangeOffsets(0, 0); + } + +// ---------------------------------------------------------------------------- +// Teardown +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::Teardown( ) + { + } + +// ---------------------------------------------------------------------------- +// UT_TestEmptyL +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::UT_TestEmptyL( ) + { + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && iFocusOrder.iFrontOffset == 0 && + iFocusOrder.iRearOffset == 0 && iFocusOrder.iList == &iList); + TInt index; + + // Test with empty list + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + EUNIT_ASSERT(iFocusOrder.iFrontOffset == 0 && iFocusOrder.iRearOffset == 0 && iFocusOrder.iList == &iList); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + + // Test with a range + iOrder->SetToFirst(&iList); // (Does nothing) + iFocusOrder.SetRangeOffsets(1, 1); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + EUNIT_ASSERT(iFocusOrder.iFrontOffset == 1 && iFocusOrder.iRearOffset == 1 && iFocusOrder.iList == &iList); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + + // Test with a range + iOrder->SetToFirst(&iList); // (Does nothing) + iFocusOrder.SetRangeOffsets(4, 0); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + EUNIT_ASSERT(iFocusOrder.iFrontOffset == 0 && iFocusOrder.iRearOffset == 4 && iFocusOrder.iList == &iList); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + + // Test with a range + iOrder->SetToFirst(&iList); // (Does nothing) + iFocusOrder.SetRangeOffsets(0, 5); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + EUNIT_ASSERT(iFocusOrder.iFrontOffset == 5 && iFocusOrder.iRearOffset == 0 && iFocusOrder.iList == &iList); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && index == KErrNotFound); + } + +// ---------------------------------------------------------------------------- +// UT_TestSymmetricRangeL +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::UT_TestSymmetricRangeL( ) + { + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 0 && iFocusOrder.iFrontOffset == 0 && + iFocusOrder.iRearOffset == 0 && iFocusOrder.iList == &iList); + TInt index; + + // Test with a list with 1 item, no range + iList.iCount = 1; + iList.iFocusIndex = 0; + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == 0); + EUNIT_ASSERT(iFocusOrder.iFrontOffset == 0 && iFocusOrder.iRearOffset == 0 && iFocusOrder.iList == &iList); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == KErrNotFound); + EUNIT_ASSERT(iFocusOrder.iFrontOffset == 0 && iFocusOrder.iRearOffset == 0 && iFocusOrder.iList == &iList); + + // Test with a list with 2 items, no range + iOrder->SetToFirst(&iList); + iList.iCount = 2; + iList.iFocusIndex = 0; + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == 0); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == KErrNotFound); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == KErrNotFound); + + // Focus to 1 + iOrder->SetToFirst(&iList); + iList.iFocusIndex = 1; + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == 1); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == KErrNotFound); + index = (*iOrder)++; + EUNIT_ASSERT(iFocusOrder.iCurrentItem == 1 && index == KErrNotFound); + + ////////////////////////////////////////////////////////////// + // Test with a list with 2 items, 1-1 range + // indexes: 01 + // focus: F + // order: 01 + TestSingleRange(2, 0, 1, 1, "01ee"); // count, focus, rear, front, result + // indexes: 01 + // focus: F + // order: 10 + TestSingleRange(2, 1, 1, 1, "10ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 3 items, 1-1 range + // indexes: 012 + // focus: F + // order: 012 + TestSingleRange(3, 0, 1, 1, "012ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 201 + TestSingleRange(3, 1, 1, 1, "120ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 201 + TestSingleRange(3, 2, 1, 1, "201ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 4 items, 1-1 range + // indexes: 0123 + // focus: F + // order: 01 2 + TestSingleRange(4, 0, 1, 1, "013ee"); // count, focus, rear, front, result + // indexes: 0123 + // focus: F + // order: 201 + TestSingleRange(4, 1, 1, 1, "120ee"); // count, focus, rear, front, result + // indexes: 0123 + // focus: F + // order: 201 + TestSingleRange(4, 2, 1, 1, "231ee"); // count, focus, rear, front, result + // indexes: 0123 + // focus: F + // order: 1 20 + TestSingleRange(4, 3, 1, 1, "302ee"); // count, focus, rear, front, result + } + +// ---------------------------------------------------------------------------- +// UT_TestAsymmetricRangeL +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::UT_TestAsymmetricRangeL( ) + { + // Test with a list with 5 items, 1-2 range + // indexes: 01234 + // focus: F + // order: 013 2 + TestSingleRange(5, 0, 1, 2, "0142ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 2013 + TestSingleRange(5, 1, 1, 2, "1203ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 2013 + TestSingleRange(5, 2, 1, 2, "2314ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 3 201 + TestSingleRange(5, 3, 1, 2, "3420ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 13 20 + TestSingleRange(5, 4, 1, 2, "4031ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 5 items, 2-1 range + // indexes: 01234 + // focus: F + // order: 01 32 + TestSingleRange(5, 0, 2, 1, "0143ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 201 3 + TestSingleRange(5, 1, 2, 1, "1204ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 3201 + TestSingleRange(5, 2, 2, 1, "2310ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 3201 + TestSingleRange(5, 3, 2, 1, "3421ee"); // count, focus, rear, front, result + // indexes: 01234 + // focus: F + // order: 1 320 + TestSingleRange(5, 4, 2, 1, "4032ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 6 items, 4-2 range + // indexes: 012345 + // focus: F + // order: 013542 + TestSingleRange(6, 0, 4, 2, "015243ee"); // count, focus, rear, front, result + // indexes: 012345 + // focus: F + // order: 201354 + TestSingleRange(6, 1, 4, 2, "120354ee"); // count, focus, rear, front, result + // indexes: 012345 + // focus: F + // order: 420135 + TestSingleRange(6, 2, 4, 2, "231405ee"); // count, focus, rear, front, result + // indexes: 012345 + // focus: F + // order: 542013 + TestSingleRange(6, 3, 4, 2, "342510ee"); // count, focus, rear, front, result + // indexes: 012345 + // focus: F + // order: 354201 + TestSingleRange(6, 4, 4, 2, "453021ee"); // count, focus, rear, front, result + // indexes: 012345 + // focus: F + // order: 135420 + TestSingleRange(6, 5, 4, 2, "504132ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 7 items, 4-2 range + // indexes: 0123456 + // focus: F + // order: 0136542 + TestSingleRange(7, 0, 4, 2, "0162543ee"); // count, focus, rear, front, result + // indexes: 0123456 + // focus: F + // order: 2013654 + TestSingleRange(7, 1, 4, 2, "1203654ee"); // count, focus, rear, front, result + // indexes: 0123456 + // focus: F + // order: 4201365 + TestSingleRange(7, 2, 4, 2, "2314065ee"); // count, focus, rear, front, result + // indexes: 0123456 + // focus: F + // order: 5420136 + TestSingleRange(7, 3, 4, 2, "3425106ee"); // count, focus, rear, front, result + // indexes: 0123456 + // focus: F + // order: 6542013 + TestSingleRange(7, 4, 4, 2, "4536210ee"); // count, focus, rear, front, result + // indexes: 0123456 + // focus: F + // order: 3654201 + TestSingleRange(7, 5, 4, 2, "5640321ee"); // count, focus, rear, front, result + // indexes: 0123456 + // focus: F + // order: 1365420 + TestSingleRange(7, 6, 4, 2, "6051432ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 8 items, 4-2 range + // indexes: 01234567 + // focus: F + // order: 013 6542 + TestSingleRange(8, 0, 4, 2, "0172654ee"); // count, focus, rear, front, result + // indexes: 01234567 + // focus: F + // order: 2013 654 + TestSingleRange(8, 1, 4, 2, "1203765ee"); // count, focus, rear, front, result + // indexes: 01234567 + // focus: F + // order: 42013 65 + TestSingleRange(8, 2, 4, 2, "2314076ee"); // count, focus, rear, front, result + // indexes: 01234567 + // focus: F + // order: 542013 6 + TestSingleRange(8, 3, 4, 2, "3425107ee"); // count, focus, rear, front, result + // indexes: 01234567 + // focus: F + // order: 6542013 + TestSingleRange(8, 4, 4, 2, "4536210ee"); // count, focus, rear, front, result + // indexes: 01234567 + // focus: F + // order: 6542013 + TestSingleRange(8, 5, 4, 2, "5647321ee"); // count, focus, rear, front, result + // indexes: 01234567 + // focus: F + // order: 3 654201 + TestSingleRange(8, 6, 4, 2, "6750432ee"); // count, focus, rear, front, result + // indexes: 01234567 + // focus: F + // order: 13 65420 + TestSingleRange(8, 7, 4, 2, "7061543ee"); // count, focus, rear, front, result + } + +// ---------------------------------------------------------------------------- +// UT_TestOneSideRangeL +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::UT_TestOneSideRangeL( ) + { + // 1 item, 1-0 range + TestSingleRange(1, 0, 1, 0, "0ee"); // count, focus, rear, front, result + // 1 item, 0-1 range + TestSingleRange(1, 0, 0, 1, "0ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 2 items, 1-0 range + // indexes: 01 + // focus: F + // order: 01 + TestSingleRange(2, 0, 1, 0, "01ee"); // count, focus, rear, front, result + // indexes: 01 + // focus: F + // order: 01 + TestSingleRange(2, 1, 1, 0, "10ee"); // count, focus, rear, front, result + ////////////////////////////////////////////////////////////// + // Test with a list with 2 items, 0-1 range + // indexes: 01 + // focus: F + // order: 01 + TestSingleRange(2, 0, 0, 1, "01ee"); // count, focus, rear, front, result + // indexes: 01 + // focus: F + // order: 01 + TestSingleRange(2, 1, 0, 1, "10ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 3 items, 0-1 range + // indexes: 012 + // focus: F + // order: 01 + TestSingleRange(3, 0, 0, 1, "01ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 01 + TestSingleRange(3, 1, 0, 1, "12ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 1 0 + TestSingleRange(3, 2, 0, 1, "20ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 3 items, 1-0 range + // indexes: 012 + // focus: F + // order: 0 1 + TestSingleRange(3, 0, 1, 0, "02ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 10 + TestSingleRange(3, 1, 1, 0, "10ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 10 + TestSingleRange(3, 2, 1, 0, "21ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 3 items, 0-2 range + // indexes: 012 + // focus: F + // order: 012 + TestSingleRange(3, 0, 0, 2, "012ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 201 + TestSingleRange(3, 1, 0, 2, "120ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 120 + TestSingleRange(3, 2, 0, 2, "201ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 3 items, 2-0 range + // indexes: 012 + // focus: F + // order: 021 + TestSingleRange(3, 0, 2, 0, "021ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 102 + TestSingleRange(3, 1, 2, 0, "102ee"); // count, focus, rear, front, result + // indexes: 012 + // focus: F + // order: 210 + TestSingleRange(3, 2, 2, 0, "210ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 2 items, 0-2 range + // indexes: 01 + // focus: F + // order: 01 + TestSingleRange(2, 0, 0, 2, "01ee"); // count, focus, rear, front, result + // indexes: 01 + // focus: F + // order: 10 + TestSingleRange(2, 1, 0, 2, "10ee"); // count, focus, rear, front, result + + ////////////////////////////////////////////////////////////// + // Test with a list with 3 items, 2-0 range + // indexes: 01 + // focus: F + // order: 01 + TestSingleRange(2, 0, 2, 0, "01ee"); // count, focus, rear, front, result + // indexes: 01 + // focus: F + // order: 10 + TestSingleRange(2, 1, 2, 0, "10ee"); // count, focus, rear, front, result + } + +// ---------------------------------------------------------------------------- +// Run a single test +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::TestSingleRange(TInt aCount, + TInt aFocusIndex, TInt aRearOffset, TInt aFrontOffset, char* aResults) + { + __ASSERT_DEBUG(aFocusIndex >= 0 && aFocusIndex < aCount && aCount >= 0, Panic(EGlxPanicIllegalArgument)); // Make sure is testing all cases, also failed case + + // Test with a list with 5 items, 1-2 range + iFocusOrder.SetRangeOffsets(aRearOffset, aFrontOffset); + iOrder->SetToFirst(&iList); + iList.iCount = aCount; + iList.iFocusIndex = aFocusIndex; + + // poor man's strlen... + TInt resultCount = 0; + char* tmp = aResults; + while (*tmp) + { + resultCount++; + tmp++; + } + + __ASSERT_DEBUG(resultCount > aFrontOffset + aRearOffset + 1, Panic(EGlxPanicIllegalArgument)); // Make sure is testing all cases, also failed case + + for (TInt i = 0; i < resultCount; i++) + { + TInt result = (*iOrder)++; + char c = aResults[i]; + TInt expectedResult = c - '0'; + if (c == 'e') + { + expectedResult = KErrNotFound; + } + EUNIT_ASSERT(result == expectedResult); + } + } + +// ---------------------------------------------------------------------------- +// Run a single in range test +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::TestSingleInRange(TInt aCount, + TInt aFocusIndex, TInt aRearOffset, TInt aFrontOffset, char* aResults) + { + __ASSERT_DEBUG(aFocusIndex >= 0 && aFocusIndex < aCount && aCount >= 0, Panic(EGlxPanicIllegalArgument)); // Make sure is testing all cases, also failed case + + // Test with a list with 5 items, 1-2 range + iFocusOrder.SetRangeOffsets(aRearOffset, aFrontOffset); + iOrder->SetToFirst(&iList); + iList.iCount = aCount; + iList.iFocusIndex = aFocusIndex; + + for (TInt i = 0; i < aCount; i++) + { + char c = aResults[i]; + __ASSERT_DEBUG(c != 0, Panic(EGlxPanicIllegalArgument)); // Not enough results + + TBool inRange = iOrder->InRange(i); + EUNIT_ASSERT((inRange && c == 'x') || (!inRange && c == ' ')); + } + } + +// ---------------------------------------------------------------------------- +// Run a single test +// ---------------------------------------------------------------------------- +// +void T_CGlxFromFocusOutwardIterator::UT_TestInRangeL() + { + // List of 1 + // indexes: 0 + // focus: F + // range: x + TestSingleInRange(1, 0, 0, 0, "x"); // count, focus, rear range, front range, result per index + TestSingleInRange(1, 0, 2, 0, "x"); // count, focus, rear range, front range, result per index + TestSingleInRange(1, 0, 0, 2, "x"); // count, focus, rear range, front range, result per index + TestSingleInRange(1, 0, 2, 2, "x"); // count, focus, rear range, front range, result per index + + // List of 3 + // indexes: 012 + // focus: F + // range: x + TestSingleInRange(3, 0, 0, 0, "x "); // count, focus, rear range, front range, result per index + TestSingleInRange(3, 1, 0, 0, " x "); // count, focus, rear range, front range, result per index + TestSingleInRange(3, 2, 0, 0, " x"); // count, focus, rear range, front range, result per index + + // List of 4, range of 1 + // indexes: 0123 + // focus: F + TestSingleInRange(4, 0, 1, 1, "xx x"); // count, focus, rear range, front range, result per index + TestSingleInRange(4, 1, 1, 1, "xxx "); // count, focus, rear range, front range, result per index + TestSingleInRange(4, 2, 1, 1, " xxx"); // count, focus, rear range, front range, result per index + TestSingleInRange(4, 3, 1, 1, "x xx"); // count, focus, rear range, front range, result per index + + // List of 4, range of 2-3 + // indexes: 0123 + // focus: F + // range: xxxx + TestSingleInRange(4, 0, 2, 3, "xxxx"); // count, focus, rear range, front range, result per index + + // List of 7, range of 2-4 + // indexes: 0123456 + // focus: F + // range: xxxxxxx + TestSingleInRange(7, 0, 2, 4, "xxxxxxx"); // count, focus, rear range, front range, result per index + TestSingleInRange(7, 1, 2, 4, "xxxxxxx"); // count, focus, rear range, front range, result per index + TestSingleInRange(7, 3, 2, 4, "xxxxxxx"); // count, focus, rear range, front range, result per index + TestSingleInRange(7, 6, 2, 4, "xxxxxxx"); // count, focus, rear range, front range, result per index + + // List of 8, range of 2-4 + // indexes: 01234567 + // focus: F + // range: xxx xxxx + TestSingleInRange(8, 0, 4, 2, "xxx xxxx"); // count, focus, rear range, front range, result per index + // indexes: 01234567 + // focus: F + // range: xxxx xxx + TestSingleInRange(8, 1, 4, 2, "xxxx xxx"); // count, focus, rear range, front range, result per index + // indexes: 01234567 + // focus: F + // range: xxxxx xx + TestSingleInRange(8, 2, 4, 2, "xxxxx xx"); // count, focus, rear range, front range, result per index + // indexes: 01234567 + // focus: F + // range: xxxxxx x + TestSingleInRange(8, 3, 4, 2, "xxxxxx x"); // count, focus, rear range, front range, result per index + // indexes: 01234567 + // focus: F + // range: xxxxxxx + TestSingleInRange(8, 4, 4, 2, "xxxxxxx "); // count, focus, rear range, front range, result per index + // indexes: 01234567 + // focus: F + // range: xxxxxxx + TestSingleInRange(8, 5, 4, 2, " xxxxxxx"); // count, focus, rear range, front range, result per index + // indexes: 01234567 + // focus: F + // range: x xxxxxx + TestSingleInRange(8, 6, 4, 2, "x xxxxxx"); // count, focus, rear range, front range, result per index + // indexes: 01234567 + // focus: F + // range: xx xxxxx + TestSingleInRange(8, 7, 4, 2, "xx xxxxx"); // count, focus, rear range, front range, result per index + + } + +// ---------------------------------------------------------------------------- +// Test table +// ---------------------------------------------------------------------------- +// + +EUNIT_BEGIN_TEST_TABLE( + T_CGlxFromFocusOutwardIterator, + "Unit tests for TGlxFromFocusOutwardItemOrder", + "UNIT" ) + +EUNIT_TEST( + "Test empty list", + "TGlxFromFocusOutwardItemOrder", + "++", + "FUNCTIONALITY", + SetupL, UT_TestEmptyL, Teardown) + +EUNIT_TEST( + "Test symmetric ranges", + "TGlxFromFocusOutwardItemOrder", + "++", + "FUNCTIONALITY", + SetupL, UT_TestSymmetricRangeL, Teardown) + +EUNIT_TEST( + "Test asymmetric ranges", + "TGlxFromFocusOutwardItemOrder", + "++", + "FUNCTIONALITY", + SetupL, UT_TestAsymmetricRangeL, Teardown) + +EUNIT_TEST( + "Test one-sided ranges", + "TGlxFromFocusOutwardItemOrder", + "++", + "FUNCTIONALITY", + SetupL, UT_TestOneSideRangeL, Teardown) + +EUNIT_TEST( + "Test in range", + "TGlxFromFocusOutwardItemOrder", + "InRange", + "FUNCTIONALITY", + SetupL, UT_TestInRangeL, Teardown) + +EUNIT_END_TEST_TABLE +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_glxfromfocusoutwarditerator/t_glxfromfocusoutwarditerator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_glxfromfocusoutwarditerator/t_glxfromfocusoutwarditerator.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TGlxFromFocusOutwardIterator unit tests +* +*/ + + + + +#ifndef __T_GLXFROMFOCUSOUTWARDITERATOR_H__ +#define __T_GLXFROMFOCUSOUTWARDITERATOR_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "mglxmedialist.h" +#include "glxmedialistiterator.h" + +// FORWARD DECLARATIONS + +#include +#ifndef NONSHARABLE_CLASS + #define NONSHARABLE_CLASS(x) class x +#endif + +// CLASS DEFINITION +/** + * + * EUnitWizard generated test class. + * + */ +NONSHARABLE_CLASS( T_CGlxFromFocusOutwardIterator ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + static T_CGlxFromFocusOutwardIterator* NewL(); + static T_CGlxFromFocusOutwardIterator* NewLC(); + ~T_CGlxFromFocusOutwardIterator(); + + private: // Constructors and destructors + T_CGlxFromFocusOutwardIterator(); + void ConstructL(); + + private: // New methods + void SetupL(); + void Teardown(); + + void UT_TestEmptyL(); + void UT_TestSymmetricRangeL(); + void UT_TestAsymmetricRangeL(); + void UT_TestOneSideRangeL(); + void UT_TestInRangeL(); + + /** + * Run a single test + * @param aCount Number of items in list + * @param aFocusIndex index of focus + * @param aFrontOffset + * @param aRearOffset + * @param aResult expected results in format "iiiii*e", + * where i is an index, and e means KErrNotFound. + * E.g., "14523ee" means iOrder++ should return 1 first, + * 4 then, etc. and finally KErrNotFound two times + */ + void TestSingleRange(TInt aCount, TInt aFocusIndex, TInt aRearOffset, + TInt aFrontOffset, char* aResult); + + /** + * Run a single "InRange()" test + * @param aCount Number of items in list + * @param aFocusIndex index of focus + * @param aFrontOffset + * @param aRearOffset + * @param aResult expected results in format "xxx xx", + * where x means the n-th item is in range, and space means it is not + */ + void TestSingleInRange(TInt aCount, TInt aFocusIndex, TInt aRearOffset, + TInt aFrontOffset, char* aResult); + + private: + // Dummy media list class + struct TGlxMediaListTester : public MGlxMediaList + { + TGlxMediaListTester() : iItem(TGlxMediaId(1)), iSelectedItems() + { + iCount = 0; + iFocusIndex = KErrNotFound; + }; + virtual void Close() {}; + virtual TGlxMediaListId Id() const { return TGlxMediaListId(1); }; + virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const { return iCount; }; + virtual TInt FocusIndex() const { return iFocusIndex; }; + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) { iFocusIndex = aValue; }; + virtual const TGlxMedia& Item(TInt /*aIndex*/) const { return iItem; }; + virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& /*aId*/) const { return 0; }; + virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) {}; + virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) {}; + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) {}; + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) {}; + virtual MMPXCollection& Collection() const { MMPXCollection* c = NULL; return *c; }; // Don't call + virtual CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const { CMPXCollectionPath* p = NULL; return p; }; // Don't call + virtual TBool IsSelected(TInt /*aIndex*/) const { return EFalse; }; + virtual void SetSelectedL(TInt /*aIndex*/, TBool /*aSelected*/) {}; + virtual TInt SelectionCount() const { return iSelectedItems.Count(); }; + virtual TInt SelectedItemIndex(TInt /*aSelectionIndex*/) const { return KErrNotFound; }; + virtual void CommandL(CMPXCommand& /*aCommand*/) {}; + virtual void CancelCommand() {}; + virtual void SetFilterL(CMPXFilter* /*aFilter*/) {}; + virtual CMPXFilter* Filter() const { return NULL; }; + virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const { return TGlxIdSpaceId(1); }; + virtual TBool IsPopulated() const { return ETrue; }; // Don't call + virtual void AddStaticItemL( CGlxMedia* /*aStaticItem*/, + NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}; + virtual void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}; + virtual void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }; + virtual TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }; + virtual void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition /*aFocusInitialPosition*/) { }; + virtual void ResetFocus(){ }; + virtual void SetVisibleWindowIndexL( TInt /*aIndex*/) { }; + virtual TInt VisibleWindowIndex() const { }; + virtual void CancelPreviousRequests() {}; + + TGlxMedia iItem; + TInt iCount; + TInt iFocusIndex; + RArray iSelectedItems; + TBool iStaticItemsEnabled; + }; + + private: // Data + MGlxMediaListIterator* iOrder; // To access virtual functions only + TGlxMediaListTester iList; + TGlxFromFocusOutwardIterator iFocusOrder; + + EUNIT_DECLARE_TEST_TABLE; + }; + +#endif // __T_GLXFROMFOCUSOUTWARDITERATOR_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_glxfromfocusoutwarditerator/t_glxfromfocusoutwarditeratordllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_glxfromfocusoutwarditerator/t_glxfromfocusoutwarditeratordllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "t_glxfromfocusoutwarditerator.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CGlxFromFocusOutwardIterator::NewL(); + } + + + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_glxlistwindow/t_glxlistwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_glxlistwindow/t_glxlistwindow.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,600 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +// CLASS HEADER +#include "t_glxlistwindow.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxlistwindow.h" + +// ----------------------------------------------------------------------------- +// Constructors & destructors +// ----------------------------------------------------------------------------- +// +t_CGlxListWindow* t_CGlxListWindow::NewL() + { + t_CGlxListWindow* self = t_CGlxListWindow::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_CGlxListWindow* t_CGlxListWindow::NewLC() + { + t_CGlxListWindow* self = new( ELeave ) t_CGlxListWindow(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// Destructor (virtual by CBase) +t_CGlxListWindow::~t_CGlxListWindow() + { + } + +// Default constructor +t_CGlxListWindow::t_CGlxListWindow() + { + } + +// Second phase construct +void t_CGlxListWindow::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// Setup & Teardown +// ----------------------------------------------------------------------------- +// +void t_CGlxListWindow::SetupL( ) + { + } + +void t_CGlxListWindow::Teardown( ) + { + } + +// return string length +TInt strlen( const char* aString ) + { + // poor man's strlen... + TInt count = 0; + const char* tmp = aString; + while ( *tmp ) + { + count++; + tmp++; + } + return count; + } + +// entry object for the window +class CEntry : public CBase + { +public: + ~CEntry() + { + delete iOwned; + } + + void ConstructL() + { + iOwned = HBufC::NewL( 1 ); + } + + void SetId( TChar aId ) + { + iId = aId; + iId.LowerCase(); + } + + TChar Id() const + { + return iId; + } + + TInt iCleanupCount; +private: + TChar iId; + HBufC* iOwned; // have an owned object to make sure destructor is being called + }; + +// window class +class CTestWindow : public CGlxListWindow, + public MGlxWindowObjectFactory + { +public: + CTestWindow( const char* aList ) + : CGlxListWindow( static_cast< MGlxWindowObjectFactory& >( *this ) ) + { + iList = aList; + iOldList = iList; + } + + ~CTestWindow() + { + iEntries.Close(); + } + + // From MGlxWindowObjectFactory + CBase* CreateObjectL() const + { + CEntry* entry = new ( ELeave ) CEntry; + CleanupStack::PushL( entry ); + entry->ConstructL(); + const_cast< CTestWindow* >( this )->iEntries.AppendL( entry ); + CleanupStack::Pop( entry ); + return entry; + } + + // From MGlxWindowObjectFactory + void SetupObject( TInt aListIndex, CBase& aEntry ) + { + CEntry& entry = static_cast< CEntry& >( aEntry ); + // initialise the entry by setting the id from the original list + entry.SetId( iList[ aListIndex ] ); + } + + // From MGlxWindowObjectFactory + void CleanupObject( TInt aListIndex, CBase& aEntry ) + { + CEntry& entry = static_cast< CEntry& >( aEntry ); + + EUNIT_ASSERT_DESC( iOldList[ aListIndex ] == entry.Id(), "list index is correct" ); + + // clean up the entry + entry.SetId( 0 ); + // check how many times entry is cleaned up so can check that object + // is not cleaned up any more often that it needs to + entry.iCleanupCount++; + } + + const CEntry* operator[]( TInt aIndex ) const + { + return static_cast< const CEntry* >( At( aIndex ) ); + } + + const char* iList; // main list of items. not own + const char* iOldList; // list of items before change. not own + RPointerArray< CEntry > iEntries; // not own. owned by base class + }; + +struct TWindowInfo + { + TWindowInfo() + { + iStartIndex = KErrNotFound; + iFocusIndex = KErrNotFound; + iWindowSize = 0; + } + TInt iStartIndex; + TInt iFocusIndex; + TInt iWindowSize; + TInt iTotalSize; + }; + +TWindowInfo AnalyzeWindow( const char* aWindow ) + { + TWindowInfo info; + TInt index = 0; + TChar ch = 0; + // gapBefore is to set the start index in case list is "###----###" + // i.e., gapBefore is true if there is a gap in the window before + // the index + TBool gapBefore = EFalse; + while ( 0 != ( ch = aWindow[ index ] ) ) + { + if ( '-' == ch ) // is item a gap (outside window) + { + gapBefore = ETrue; + } + else + { + info.iWindowSize++; + + if ( ch.IsUpper() ) // focus index? + { + ASSERT( KErrNotFound == info.iFocusIndex ); // Check not multiple focus indexes defined + info.iFocusIndex = index; + } + + if ( gapBefore || // this is for "###----S##" + KErrNotFound == info.iStartIndex ) // this is for "--S####---" + { + info.iStartIndex = index; + gapBefore = EFalse; + } + } + index++; + } + info.iTotalSize = index; + return info; + } + +// aWindow: "---abcDe---" +// - is non-window +// a,b,c,e is id +// D focus +void AssertWindow( const CTestWindow& aWindow, const char* aWindowString ) + { + TWindowInfo info = AnalyzeWindow( aWindowString ); + + TGlxWindowIterator iterator = aWindow.Iterator(); + TInt index = iterator++; + // check start index is correct + EUNIT_ASSERT_DESC( index == info.iStartIndex, "start index is correct" ); + + TInt size = 0; + // check items in window are correct + while ( KErrNotFound != index ) + { + TChar ch = aWindowString[ index ]; + ch.LowerCase(); + EUNIT_ASSERT_DESC( ch == aWindow[ index ]->Id(), "item is correct" ); + size++; + index = iterator++; + } + + // check window length is correct + EUNIT_ASSERT_DESC( size == info.iWindowSize, "window size is correct" ); + } + +enum TChange + { + ENone, + EAdd, + ERemove + }; + +/** Convert an index to an index before a change happened */ +TInt indexBeforeChange( TInt aIndex, TChange aChange, TInt aFirstChanged, + TInt aChangeCount ) + { + TInt index = aIndex; + if ( aFirstChanged <= aIndex ) + { + if ( aChange == EAdd ) + { + if ( aIndex <= aFirstChanged + aChangeCount ) + { + index = KErrNotFound; + } + else + { + index -= aChangeCount; + } + } + else if ( aChange == ERemove ) + { + index += aChangeCount; + } + } + return index; + } + +/** Makes sure objects were not cleaned up unnecessarily */ +void AssertReuse( const CTestWindow& aWindow, const char* aWindowBefore, + const char* aWindowAfter, TChange aChange, TInt aChangedIndex, + TInt aChangeCount ) + { + TGlxWindowIterator iterator = aWindow.Iterator(); + TInt index = 0; + while ( KErrNotFound != ( index = iterator++ ) ) + { + TInt indexBefore = indexBeforeChange( index, aChange, aChangedIndex, aChangeCount ); + if ( KErrNotFound != indexBefore ) + { + TChar chBefore = aWindowBefore[ indexBefore ]; + chBefore.LowerCase(); + TChar chAfter = aWindowAfter[ index ]; + chAfter.LowerCase(); + if ( chBefore != '-' ) + { + ASSERT( chBefore == chAfter ); // error is test case? + ASSERT( aWindow[ index ]->Id() == chAfter ); // error is test code? + EUNIT_ASSERT_DESC( 0 == aWindow[ index ]->iCleanupCount, "reused item was not cleaned up" ); + } + } + } + } + +/** Creates a window */ +CTestWindow* CreateWindowLC( const char* aListString, TInt aFrontOffset, + TInt aRearOffset, const char* aWindowString ) + { + CTestWindow* window = new ( ELeave ) CTestWindow( aListString ); + CleanupStack::PushL( window ); + window->ConstructL(); + window->SetRangeOffsetsL( aFrontOffset, aRearOffset ); + AssertWindow( *window, "" ); // kind of unnecessary... + + // populate initial list + TWindowInfo info = AnalyzeWindow( aWindowString ); + /// @todo combine these 3 lines to a single call to AddObjects + if ( info.iTotalSize > 0 ) + { + window->AddObjects( info.iFocusIndex, info.iTotalSize, + 0, info.iTotalSize - 1 ); + } + + // assert initial window + AssertWindow( *window, aWindowString ); + + return window; + } + +/** Cleans up a window */ +void Cleanup( CTestWindow& aWindow ) + { + aWindow.Cleanup(); + // test cleanup ok + for ( TInt i = 0; i < aWindow.iEntries.Count(); i++ ) + { + EUNIT_ASSERT_DESC( aWindow.iEntries[ i ]->Id() == 0, "cleaned up correctly" ); + } + } + +void VerifyAndCleanup( CTestWindow& aWindow, const char* aWindowBefore, + const char* aWindowAfter, TChange aChange = ENone, + TInt aChangedIndex = KErrNotFound, TInt aChangeCount = 0 ) + { + // assert window after change + AssertWindow( aWindow, aWindowAfter ); + // makes sure reused items have not been cleaned up during update + AssertReuse( aWindow, aWindowBefore, aWindowAfter, aChange, aChangedIndex, aChangeCount ); + Cleanup( aWindow ); + } + +/** + * Notation: * focus + * - items outside of window + * any other char is the id of an item + */ +void TestUpdateL( const char* aListBeforeChange, const char* aWindowBefore, + const char* aWindowAfter, TInt aFrontOffset, TInt aRearOffset, + TChange aChange = ENone, TInt aChangedIndex = KErrNotFound, + const char* aListAfterChange = NULL ) + { + // window and list strings must have the same length + ASSERT( strlen( aListBeforeChange ) == strlen( aWindowBefore ) ); + if ( aListAfterChange ) + { + ASSERT( strlen( aWindowAfter ) == strlen( aListAfterChange ) ); + } + + // create window object + CTestWindow* window = CreateWindowLC( aListBeforeChange, aFrontOffset, + aRearOffset, aWindowBefore ); + + // apply changes + TInt changeCount = 0; + if ( EAdd == aChange ) + { + window->iList = aListAfterChange; + changeCount = strlen( aListAfterChange ) - strlen( aListBeforeChange ); + TWindowInfo info = AnalyzeWindow( aWindowAfter ); + window->AddObjects( info.iFocusIndex, info.iTotalSize, // focus, size + aChangedIndex, aChangedIndex + changeCount - 1 ); // first index, last index + window->iOldList = window->iList; // iOldList is used to check cleanup + } + else if ( ERemove == aChange ) + { + window->iList = aListAfterChange; + changeCount = strlen( aListBeforeChange ) - strlen( aListAfterChange ); + TWindowInfo info = AnalyzeWindow( aWindowAfter ); + window->RemoveObjects( info.iFocusIndex, info.iTotalSize, // focus, size + aChangedIndex, aChangedIndex + changeCount - 1 ); // first index, last index + window->iOldList = window->iList; // iOldList is used to check cleanup + } + if ( ENone == aChange ) + { + TWindowInfo info = AnalyzeWindow( aWindowAfter ); + window->SetFocusIndex( info.iFocusIndex, info.iTotalSize ); + } + + VerifyAndCleanup( *window, aWindowBefore, aWindowAfter, aChange, + aChangedIndex, changeCount ); + CleanupStack::PopAndDestroy( window ); + } + +/** Test SetRangeOffsetsL */ +void TestSetRangesL( const char* aList, + const char* aWindowBefore, TInt aFrontOffsetBefore, TInt aRearOffsetBefore, + const char* aWindowAfter, TInt aFrontOffsetAfter, TInt aRearOffsetAfter ) + { + // window and list strings must have the same length + ASSERT( strlen( aList ) == strlen( aWindowBefore ) ); + ASSERT( strlen( aWindowAfter ) == strlen( aWindowBefore ) ); + + // create window object + CTestWindow* window = CreateWindowLC( aList, aFrontOffsetBefore, aRearOffsetBefore, + aWindowBefore ); + + TWindowInfo info = AnalyzeWindow( aWindowAfter ); + window->SetRangeOffsetsL( info.iFocusIndex, info.iTotalSize, + aFrontOffsetAfter, aRearOffsetAfter ); + + VerifyAndCleanup( *window, aWindowBefore, aWindowAfter ); + + CleanupStack::PopAndDestroy( window ); + } + +// ----------------------------------------------------------------------------- +void t_CGlxListWindow::T_SetRangeOffsetsLL( ) + { + TestSetRangesL( "abcdefghijk", "---deFghi--", -2, 3, "--cdeFghij-", -3, 4 ); + TestSetRangesL( "abcdefghijk", "--cdeFghij-", -3, 4, "---deFghi--", -2, 3 ); + TestSetRangesL( "abcdefghijk", "--cdeFghij-", -3, 4, "-----F-----", 0, 0 ); + TestSetRangesL( "abcdefghijk", "--cdeFghij-", -3, 4, "abcdeFghijk", -10, 10 ); + } + +// ----------------------------------------------------------------------------- +void t_CGlxListWindow::T_SetFocusIndexL( ) + { + TestUpdateL( "abcd", "-B--", "-B--", 0, 0 ); + // when whole list fits to window + // ... set focus on list with 1 item + TestUpdateL( "a", "A", "A", -2, 3 ); + // ... set focus on list with multiple items + TestUpdateL( "abcde", "Abcde", "abcDe", -2, 3 ); + // ... set focus when list is as long max length of window + TestUpdateL( "abcdef", "Abcdef", "abcDef", -2, 3 ); + TestUpdateL( "abcdef", "Abcdef", "abcdeF", -2, 3 ); + TestUpdateL( "abcdef", "abcdeF", "Abcdef", -2, 3 ); + TestUpdateL( "abcdef", "abcdEf", "abCdef", -2, 3 ); + // ... set focus to same item again + TestUpdateL( "abcdef", "abCdef", "abCdef", -2, 3 ); + TestUpdateL( "abcdef", "Abcdef", "abcdeF", -2, 3 ); + TestUpdateL( "abcdef", "Abcdef", "abcdeF", -2, 3 ); + + // when whole list does not fit to window + TestUpdateL( "abcdefg", "Abcd-fg", "ab-deFg", -2, 3 ); + TestUpdateL( "abcdefg", "abc-efG", "-bcDefg", -2, 3 ); + TestUpdateL( "abcdefg", "abCdef-", "Abcd-fg", -2, 3 ); + // ... set focus on list with 2 items + TestUpdateL( "abcdefghijk", "---deFghi--", "----efGhij-", -2, 3 ); + TestUpdateL( "abcdefghijk", "---deFghi--", "abc-----ijK", -2, 3 ); + TestUpdateL( "abcdefghijk", "---deFghi--", "---deFghi--", -2, 3 ); + + TestUpdateL( "abcdefghijk", "---deFghi--", "abc-----ijK", -2, 3 ); + TestUpdateL( "abcdefghijk", "---deFghi--", "ab-----hiJk", -2, 3 ); + TestUpdateL( "abcdefghijk", "---deFghi--", "Abcd-----jk", -2, 3 ); + TestUpdateL( "abcdefghijk", "---deFghi--", "aBcde-----k", -2, 3 ); + TestUpdateL( "abcdefghijk", "abc-----ijK", "abc-----ijK", -2, 3 ); + TestUpdateL( "abcdefghijk", "abc-----ijK", "ab-----hiJk", -2, 3 ); + TestUpdateL( "abcdefghijk", "abc-----ijK", "Abcd-----jk", -2, 3 ); + TestUpdateL( "abcdefghijk", "abc-----ijK", "aBcde-----k", -2, 3 ); + TestUpdateL( "abcdefghijk", "Abcd-----jk", "abc-----ijK", -2, 3 ); + TestUpdateL( "abcdefghijk", "Abcd-----jk", "ab-----hiJk", -2, 3 ); + TestUpdateL( "abcdefghijk", "Abcd-----jk", "Abcd-----jk", -2, 3 ); + TestUpdateL( "abcdefghijk", "Abcd-----jk", "aBcde-----k", -2, 3 ); + // non-overlapping old and new + TestUpdateL( "abcdefghijk", "Abc------jk", "----efGhi--", -2, 2 ); + TestUpdateL( "abcdefghijk", "Abc------jk", "---deFgh---", -2, 2 ); + } + +// ----------------------------------------------------------------------------- +void t_CGlxListWindow::T_AddObjectsL( ) + { + TestUpdateL( "abcd", "-B--", "---B---", 0, 0, EAdd, 0, "23abcde" ); + // add to empty list + TestUpdateL( "", "", "Abcd-----jk", -2, 3, EAdd, 0, "abcdefghijk"); + TestUpdateL( "", "", "----efGhij-", -2, 3, EAdd, 0, "abcdefghijk"); + TestUpdateL( "", "", "abc-----ijK", -2, 3, EAdd, 0, "abcdefghijk"); + // add to a list that does not fill the window + TestUpdateL( "abc", "Abc", "Abcde", -2, 3, EAdd, 3, "abcde"); + TestUpdateL( "abc", "Abc", "Adebc", -2, 3, EAdd, 1, "adebc"); + // add before list + TestUpdateL( "abc", "Abc", "Abc-ef", -2, 2, EAdd, 3, "abcdef"); + TestUpdateL( "abcdefghi", "---deFghi", "-----deFghi", -2, 3, EAdd, 1, "a12bcdefghi"); + TestUpdateL( "abcdefghi", "---deFghi", "-----deFghi", -2, 3, EAdd, 3, "abc12defghi"); + TestUpdateL( "abcdefghi", "abc---ghI", "abc-----ghI", -2, 3, EAdd, 1, "abcde12fghi"); + TestUpdateL( "abcdefghi", "abc---ghI", "abc-----ghI", -2, 3, EAdd, 3, "abcdef12ghi"); + TestUpdateL( "abcdefghi", "Abcd---hi", "Abcd-----hi", -2, 3, EAdd, 6, "abcdef12ghi"); + TestUpdateL( "abcdefghi", "Abcd---hi", "Abcd-----hi", -2, 3, EAdd, 7, "abcdefg12hi"); + // add before focus, on list + TestUpdateL( "abcdefghi", "---deFghi", "-----2eFghi", -2, 3, EAdd, 4, "abcd12efghi"); + TestUpdateL( "abcdefghi", "---deFghi", "-----12Fghi", -2, 3, EAdd, 5, "abcde12fghi"); + TestUpdateL( "abcdefghi", "abc---ghI", "abc-----2hI", -2, 3, EAdd, 7, "abcdefg12hi"); + TestUpdateL( "abcdefghi", "abc---ghI", "abc-----12I", -2, 3, EAdd, 8, "abcdefgh12i"); + TestUpdateL( "abcdefghi", "Abcd---hi", "Abcd-----2i", -2, 3, EAdd, 8, "abcdefgh12i"); + TestUpdateL( "abcdefghi", "Abcd---hi", "Abcd-----12", -2, 3, EAdd, 9, "abcdefghi12"); + // add after focus, on list + TestUpdateL( "abcdefghi", "---deFghi", "---deF12g--", -2, 3, EAdd, 6, "abcdef12ghi"); + TestUpdateL( "abcdefghi", "---deFghi", "---deFg12--", -2, 3, EAdd, 7, "abcdefg12hi"); + TestUpdateL( "abcdefghi", "---deFghi", "---deFgh1--", -2, 3, EAdd, 8, "abcdefgh12i"); + TestUpdateL( "abcdefghi", "---deFghi", "---deFghi--", -2, 3, EAdd, 9, "abcdefghi12"); + TestUpdateL( "abcdefghi", "abc---ghI", "12a-----ghI", -2, 3, EAdd, 0, "12abcdefghi"); + TestUpdateL( "abcdefghi", "abc---ghI", "a12-----ghI", -2, 3, EAdd, 1, "a12bcdefghi"); + TestUpdateL( "abcdefghi", "abc---ghI", "ab1-----ghI", -2, 3, EAdd, 2, "ab12cdefghi"); + TestUpdateL( "abcdefghi", "abc---ghI", "abc-----ghI", -2, 3, EAdd, 3, "abc12defghi"); + // add after list + TestUpdateL( "abcdefghi", "---deFgh-", "---deFgh---", -2, 2, EAdd, 9, "abcdefghi12"); + } + +// ----------------------------------------------------------------------------- +void t_CGlxListWindow::T_RemoveObjectsL( ) + { + TestUpdateL( "abcd", "--C-", "C--", 0, 0, ERemove, 0, "cde" ); + // test remove before list + TestUpdateL( "abcdefghi", "---deFgh-", "-deFgh-", -2, 2, ERemove, 0, "cdefghi"); + // test remove before focus, on list + TestUpdateL( "abcdefghi", "---deFgh-", "-beFgh-", -2, 2, ERemove, 2, "abefghi"); + TestUpdateL( "abcdefghi", "---deFgh-", "-bcFgh-", -2, 2, ERemove, 3, "abcfghi"); + // test remove after focus, on list + TestUpdateL( "abcdefghi", "---deFgh-", "a--deFg", -2, 2, ERemove, 7, "abcdefg"); + // test remove after list + TestUpdateL( "abcdefghi", "-bcDef---", "-bcDef-", -2, 2, ERemove, 7, "abcdefg"); + // test remove all + TestUpdateL( "abcdefghi", "---deFgh-", "", -2, 2, ERemove, 0, ""); + TestUpdateL( "abcdefghi", "Abc----hi", "", -2, 2, ERemove, 0, ""); + TestUpdateL( "abcdefghi", "ab----ghI", "", -2, 2, ERemove, 0, ""); + // with 0 ranges + TestUpdateL( "abcdefghi", "--------I", "", 0, 0, ERemove, 0, ""); + TestUpdateL( "abcdefghi", "---D-----", "---D---", 0, 0, ERemove, 7, "abcdefg"); + } + +// ----------------------------------------------------------------------------- +// Test table +// ----------------------------------------------------------------------------- +// +EUNIT_BEGIN_TEST_TABLE( + t_CGlxListWindow, + "List window test suite", + "UNIT" ) + +EUNIT_TEST( + "SetRangeOffsetsL", + "CGlxListWindow", + "SetRangeOffsetsL", + "FUNCTIONALITY", + SetupL, T_SetRangeOffsetsLL, Teardown) + +EUNIT_TEST( + "SetFocusIndex", + "CGlxListWindow", + "SetFocusIndex", + "FUNCTIONALITY", + SetupL, T_SetFocusIndexL, Teardown) + +EUNIT_TEST( + "AddObjects", + "CGlxListWindow", + "AddObjects", + "FUNCTIONALITY", + SetupL, T_AddObjectsL, Teardown) + +EUNIT_TEST( + "RemoveObjects", + "CGlxListWindow", + "RemoveObjects", + "FUNCTIONALITY", + SetupL, T_RemoveObjectsL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_glxlistwindow/t_glxlistwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_glxlistwindow/t_glxlistwindow.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#ifndef __T_GLXLISTWINDOW_H__ +#define __T_GLXLISTWINDOW_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES + +// FORWARD DECLARATIONS + +/** + * EUnit test suite + */ +NONSHARABLE_CLASS( t_CGlxListWindow ) : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + /** + * Two phase construction + */ + static t_CGlxListWindow* NewL(); + static t_CGlxListWindow* NewLC(); + /** + * Destructor + */ + ~t_CGlxListWindow(); + + private: // Constructors and destructors + t_CGlxListWindow(); + void ConstructL(); + + private: // New methods + void SetupL(); + void Teardown(); + + void T_CleanupL(); + void T_SetRangeOffsetsLL(); + void T_SetFocusIndexL(); + void T_AddObjectsL(); + void T_RemoveObjectsL(); + + private: // Data + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_GLXLISTWINDOW_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_glxlistwindow/t_glxlistwindow_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_glxlistwindow/t_glxlistwindow_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests, entry point +* +*/ + + + + +// CLASS HEADER +#include "t_glxlistwindow.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_CGlxListWindow::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_tglxexclusioniterator/t_tglxexclusioniterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_tglxexclusioniterator/t_tglxexclusioniterator.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing glxexclusioniterator +* +*/ + + + + +// CLASS HEADER +#include "t_tglxexclusioniterator.h" + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES + +// CONSTRUCTION +t_tglxexclusioniterator* t_tglxexclusioniterator::NewL() + { + t_tglxexclusioniterator* self = t_tglxexclusioniterator::NewLC(); + CleanupStack::Pop(); + + return self; + } + +t_tglxexclusioniterator* t_tglxexclusioniterator::NewLC() + { + t_tglxexclusioniterator* self = new( ELeave ) t_tglxexclusioniterator(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +t_tglxexclusioniterator::~t_tglxexclusioniterator() + { + } + +// Default constructor +t_tglxexclusioniterator::t_tglxexclusioniterator(): iList(0),iExclusionOrder(iIncludeIterator,iExcludeIterator) + { + } + +// Second phase construct +void t_tglxexclusioniterator::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void t_tglxexclusioniterator::SetupL( ) + { + iExclusionOrder.SetToFirst(&iList); + } +void t_tglxexclusioniterator::Teardown( ) + { + // Do nothing + EUNIT_PRINT(_L("test done")); + } + +void t_tglxexclusioniterator::T_InRangeL() + { + + EUNIT_PRINT(_L(" test for T_InRangeL")); + + // test for less than a screenfull of items + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(2,0,1); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(2,1,1); + + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(4,2,2); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(15,8,7); + + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(16,9,9); + + //test for more than a screenfull of items + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_True(100,20,9); + + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_True(100,17,9); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_True(100,18,9); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_True(100,19,9); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(100,99,0); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(100,98,0); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(100,97,0); + + + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + TestRange_False(100,96,0); + } +void t_tglxexclusioniterator::TestRange_True(TInt aCount,TInt aIndex,TInt aFocusIndex) + { + iList.iCount = aCount; + iList.iFocus = aFocusIndex; + EUNIT_ASSERT(iExclusionOrder.InRange(aIndex)==ETrue); + + } +void t_tglxexclusioniterator::TestRange_False(TInt aCount,TInt aIndex,TInt aFocusIndex) + { + iList.iCount = aCount; + iList.iFocus = aFocusIndex; + EUNIT_ASSERT(iExclusionOrder.InRange(aIndex)==EFalse); + } +void t_tglxexclusioniterator::T_PlusPlusL() + { + EUNIT_PRINT(_L(" Test T_PlusPlusL L-R ")); + + Test(100,17,8); + + Test(100,18,9); + + Test(100,19,10); + + Test(100,20,11); + + EUNIT_PRINT(_L(" Test T_PlusPlusL--R-L ")); + + Test(100,91,92); + + Test(100,90,89); + + Test(100,89,88); + + Test(100,86,87); + } +void t_tglxexclusioniterator::Test( TInt aCount,TInt aIndex,TInt aFocusIndex) + { + iList.iCount = aCount; + iList.iFocus = aFocusIndex; + iIncludeIterator.SetRange(2*7); + iExcludeIterator.SetRangeOffsets(7,7); + + TInt newIndex = iExclusionOrder++; + EUNIT_ASSERT(iExclusionOrder.InRange(newIndex )); + } +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + t_tglxexclusioniterator, + "Add test suite description here.", + "UNIT" ) + +/*EUNIT_TEST( + "Test InRange", + "t_tglxexclusioniterator", + "T_InRangeL", + "FUNCTIONALITY", + SetupL,T_InRangeL,Teardown) */ +EUNIT_TEST( + "Test PlusPlus ", + "t_tglxexclusioniterator", + "T_PlusPlusL", + "FUNCTIONALITY", + SetupL,T_PlusPlusL,Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_tglxexclusioniterator/t_tglxexclusioniterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_tglxexclusioniterator/t_tglxexclusioniterator.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing glxexclusioniterator +* +*/ + + + + +#ifndef __T_TGLXEXCLUSIONITERATOR_H__ +#define __T_TGLXEXCLUSIONITERATOR_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +#include +#include +#include "tmglxmedialist_stub.h" + +#include + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( t_tglxexclusioniterator ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static t_tglxexclusioniterator* NewL(); + static t_tglxexclusioniterator* NewLC(); + /** + * Destructor + */ + ~t_tglxexclusioniterator(); + + private: // Constructors and destructors + + t_tglxexclusioniterator(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_InRangeL(); + + // unit test for the InRange function. + void TestRange_True(TInt aCount,TInt aIndex,TInt aFocusIndex); + // unit test for the InRange function. + void TestRange_False(TInt aCount,TInt aIndex,TInt aFocusIndex); + + // unit test for the plus plus operator + void T_PlusPlusL(); + + void Test( TInt aCount,TInt aIndex,TInt aFocusIndex); + + + private: // Data + + MGlxMediaListIterator* iVirtualIterator; // To access virtual functions only + TMGlxMediaList_Stub iList; + TGlxSequentialIterator iIncludeIterator; + TGlxFromFocusOutwardIterator iExcludeIterator; + TGlxExclusionIterator iExclusionOrder; + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __T_TGLXEXCLUSIONITERATOR_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/t_tglxexclusioniterator/t_tglxexclusioniterator_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/t_tglxexclusioniterator/t_tglxexclusioniterator_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Create glxexclusioniterator Test Suite +* +*/ + + + + +// CLASS HEADER +#include "t_tglxexclusioniterator.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return t_tglxexclusioniterator::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxattributecontext/ut_cglxattributecontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxattributecontext/ut_cglxattributecontext.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,832 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxAttributeContext unit tests +* +*/ + + + + +// CLASS HEADER +#include "UT_CGlxAttributeContext.h" + +// EXTERNAL INCLUDES +#include + +#include + +#include + +#include + +// INTERNAL INCLUDES +#include "glxattributecontext.h" + +const TInt KNumberOfMedia = 9; +const TInt KFrontOffset = 2; +const TInt KRearOffset = 2; +const TInt KItemsInRange = 1 + KFrontOffset + KRearOffset; +const TInt KOneItem = 1; +const TInt KGranularityLessThanRange = 2; +const TInt KGranularityGreaterThanRange = KItemsInRange + 2; + +void CGlxDRMUtility::Close() + { + delete this; + } + +TBool CGlxDRMUtility::CheckOpenRightsL(const TDesC&, TBool) + { + return ETrue; + } + +CGlxDRMUtility* CGlxDRMUtility::InstanceL() + { + CGlxDRMUtility* drm = new(ELeave)CGlxDRMUtility(); + return drm; + } + +TSize CGlxDRMUtility::DRMThumbnailSize(TSize& aSize) + { + return aSize; + } + +CGlxDRMUtility::CGlxDRMUtility() + { + + } + +CGlxDRMUtility::~CGlxDRMUtility() + { + + } + +// CONSTRUCTION +UT_CGlxAttributeContext* UT_CGlxAttributeContext::NewL() + { + UT_CGlxAttributeContext* self = UT_CGlxAttributeContext::NewLC(); + CleanupStack::Pop(); + + return self; + } + +UT_CGlxAttributeContext* UT_CGlxAttributeContext::NewLC() + { + UT_CGlxAttributeContext* self = new( ELeave ) UT_CGlxAttributeContext(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +UT_CGlxAttributeContext::~UT_CGlxAttributeContext() + { + } + +// Default constructor +UT_CGlxAttributeContext::UT_CGlxAttributeContext() + { + } + +// Second phase construct +void UT_CGlxAttributeContext::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + +void UT_CGlxAttributeContext::SetupL( ) + { + iAttributeContext = CGlxDefaultAttributeContext::NewL(); + } + +void UT_CGlxAttributeContext::Teardown( ) + { + delete iAttributeContext; + iAttributeContext = NULL; + } + +void UT_CGlxAttributeContext::UT_CGlxAttributeContext_CGlxAttributeContextL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxAttributeContext::UT_CGlxAttributeContext_AddAttributeLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxAttributeContext::UT_CGlxAttributeContext_RemoveAttributeL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxAttributeContext::UT_CGlxAttributeContext_AllAttributesLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxAttributeContext::UT_CGlxAttributeContext_AttributeRequestLL( ) + { + // Setup test + SetupAttributeRequestTestL(); + + FetchItems_NoMediaL(); + FetchOneItem_IndexZeroL(); + FetchOneItem_IndexOneL(); + FetchOneItem_IndexTwoL(); + FetchOneItem_IndexThreeL(); + FetchOneItem_IndexFourL(); + FetchItems_GranularityLessThanRange_IndexZeroL(); + FetchItems_GranularityLessThanRange_IndexOneL(); + FetchItems_GranularityLessThanRange_IndexTwoL(); + FetchItems_GranularityLessThanRange_IndexThreeL(); + FetchItems_GranularityLessThanRange_IndexFourL(); + FetchItems_GranularityLessThanRange_IndexFiveL(); + FetchItems_GranularityGreaterThanRangeL(); + } + +void UT_CGlxAttributeContext::SetupAttributeRequestTestL() + { + // Initial offsets, rear is 2 and front is 2 + EUNIT_PRINT(_L("Initial offsets: rear is 2 and front is 2")); + iAttributeContext->SetRangeOffsets(KRearOffset, KFrontOffset); + + // Initial attributes to fetch + EUNIT_PRINT(_L("Initial attributes: Title and date")); + iAttributeContext->AddAttributeL(KMPXMediaGeneralTitle); + iAttributeContext->AddAttributeL(KMPXMediaGeneralDate); + } + +void UT_CGlxAttributeContext::FetchItems_NoMediaL() + { + // Fetch items with empty media list + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(0); + CleanupStack::PushL(mediaList); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with empty media list")); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check no item indices returned")); + EUNIT_ASSERT(itemIndices.Count() == 0); + + EUNIT_PRINT(_L("Check no attributes returned")); + EUNIT_ASSERT(attributes.Count() == 0); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchOneItem_IndexZeroL() + { + // Fetch 1 item with focus on index 0 + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 0); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 0: granularity is 1")); + iAttributeContext->SetGranularity(KOneItem); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 1 item index is returned: Item index is 0")); + EUNIT_ASSERT((itemIndices.Count() == KOneItem) && itemIndices[0] == 0); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchOneItem_IndexOneL() + { + // Fetch 1 item with focus on index 1 + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 1); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 1: granularity is 1")); + iAttributeContext->SetGranularity(KOneItem); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 1 item index is returned: Item index is 1")); + EUNIT_ASSERT((itemIndices.Count() == KOneItem) && itemIndices[0] == 1); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchOneItem_IndexTwoL() + { + // Fetch 1 item with focus on index 2 + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 2); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 2: granularity is 1")); + iAttributeContext->SetGranularity(KOneItem); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 1 item index is returned: Item index is 2")); + EUNIT_ASSERT((itemIndices.Count() == KOneItem) && itemIndices[0] == 2); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 1 attribute returned: Date")); + EUNIT_ASSERT((attributes.Count() == 1) && !titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchOneItem_IndexThreeL() + { + // Fetch 1 item with focus on index 3 + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 3); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 3: granularity is 1")); + iAttributeContext->SetGranularity(KOneItem); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 1 item index is returned: Item index is 3")); + EUNIT_ASSERT((itemIndices.Count() == KOneItem) && itemIndices[0] == 3); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 1 attribute returned: Title")); + EUNIT_ASSERT((attributes.Count() == 1) && titleAttributeFound && !dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchOneItem_IndexFourL() + { + // Fetch 1 item with focus on index 4 + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 4); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 4: granularity is 1")); + iAttributeContext->SetGranularity(KOneItem); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 1 item index is returned: Item index is 5")); + EUNIT_ASSERT((itemIndices.Count() == KOneItem) && itemIndices[0] == 5); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexZeroL() + { + // Fetch items with focus on index 0 (granularity less than range) + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 0); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 0: granularity is 2")); + iAttributeContext->SetGranularity(KGranularityLessThanRange); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 2 item indices are returned: Item indices 0 and 1")); + EUNIT_ASSERT((itemIndices.Count() == KGranularityLessThanRange) && itemIndices[0] == 0 && itemIndices[1] == 1); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexOneL() + { + // Fetch items with focus on index 1 (granularity less than range) + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 1); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 1: granularity is 2")); + iAttributeContext->SetGranularity(KGranularityLessThanRange); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 2 item indices are returned: Item indices 1 and 2")); + EUNIT_ASSERT((itemIndices.Count() == KGranularityLessThanRange) && itemIndices[0] == 1 && itemIndices[1] == 2); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexTwoL() + { + // Fetch items with focus on index 2 (granularity less than range) + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 2); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 2: granularity is 2")); + iAttributeContext->SetGranularity(KGranularityLessThanRange); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 2 item indices are returned: Item indices 2 and 3")); + EUNIT_ASSERT((itemIndices.Count() == KGranularityLessThanRange) && itemIndices[0] == 2 && itemIndices[1] == 3); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexThreeL() + { + // Fetch items with focus on index 3 (granularity less than range) + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 3); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 3: granularity is 2")); + iAttributeContext->SetGranularity(KGranularityLessThanRange); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 2 item indices are returned: Item indices 3 and 2")); + EUNIT_ASSERT((itemIndices.Count() == KGranularityLessThanRange) && itemIndices[0] == 3 && itemIndices[1] == 2); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexFourL() + { + // Fetch items with focus on index 4 (granularity less than range) + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 4); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 4: granularity is 2")); + iAttributeContext->SetGranularity(KGranularityLessThanRange); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 2 item indices are returned: Item indices 5 and 3")); + EUNIT_ASSERT((itemIndices.Count() == KGranularityLessThanRange) && itemIndices[0] == 5 && itemIndices[1] == 3); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchItems_GranularityLessThanRange_IndexFiveL() + { + // Fetch items with focus on index 5 (granularity less than range) + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 5); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 5: granularity is 2")); + iAttributeContext->SetGranularity(KGranularityLessThanRange); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 2 item indices are returned: Item indices 5 and 6")); + EUNIT_ASSERT((itemIndices.Count() == KGranularityLessThanRange) && itemIndices[0] == 5 && itemIndices[1] == 6); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +void UT_CGlxAttributeContext::FetchItems_GranularityGreaterThanRangeL() + { + // Fetch items with focus on index 4 (granularity greater than range) + CGlxMediaListTest* mediaList = CGlxMediaListTest::NewL(KNumberOfMedia); + CleanupStack::PushL(mediaList); + + mediaList->SetFocusL(NGlxListDefs::EAbsolute, 4); + + RArray itemIndices; + CleanupClosePushL(itemIndices); + + RArray attributes; + CleanupClosePushL(attributes); + + CMPXAttributeSpecs* attributeSpecs = NULL; + + EUNIT_PRINT(_L("Fetch items with focus on index 4: granularity is 7")); + iAttributeContext->SetGranularity(KGranularityGreaterThanRange); + iAttributeContext->AttributeRequestL(mediaList, itemIndices, attributes, attributeSpecs); + + EUNIT_PRINT(_L("Check 4 item indices are returned: Item indices 5, 3, 6 and 2")); + EUNIT_ASSERT((itemIndices.Count() == 4) && itemIndices[0] == 5 && itemIndices[1] == 3 && itemIndices[2] == 6 && itemIndices[3] == 2); + + TBool titleAttributeFound = FindAttribute(attributes, KMPXMediaGeneralTitle); + TBool dateAttributeFound = FindAttribute(attributes, KMPXMediaGeneralDate); + + EUNIT_PRINT(_L("Check 2 attributes returned: Title and date")); + EUNIT_ASSERT((attributes.Count() == 2) && titleAttributeFound && dateAttributeFound); + + delete attributeSpecs; + attributeSpecs = NULL; + + CleanupStack::Pop(); + attributes.Close(); + + CleanupStack::Pop(); + itemIndices.Close(); + + CleanupStack::PopAndDestroy(); + } + +TBool UT_CGlxAttributeContext::FindAttribute(RArray& aAttributes, const TMPXAttribute& aAttribute) + { + TIdentityRelation match(&TMPXAttribute::Match); + TInt index = aAttributes.Find(aAttribute, match); + if (index == KErrNotFound) + { + return EFalse; + } + + return ETrue; + } + +UT_CGlxAttributeContext::CGlxMediaListTest* UT_CGlxAttributeContext::CGlxMediaListTest::NewL(TUint aNumberOfMedia) + { + CGlxMediaListTest* self = new (ELeave) CGlxMediaListTest(); + CleanupStack::PushL(self); + self->ConstructL(aNumberOfMedia); + CleanupStack::Pop(); + return self; + } + +UT_CGlxAttributeContext::CGlxMediaListTest::~CGlxMediaListTest() + { + for (TInt count = 0; count < iMedias.Count(); ++count) + { + delete iMedias[count]; + } + + iMedias.Close(); + iItems.Close(); + iSelectedItems.Close(); + } + +UT_CGlxAttributeContext::CGlxMediaListTest::CGlxMediaListTest() : + iFocusIndex(KErrNotFound), iMedias(), iItems(), iSelectedItems() + { + } + +void UT_CGlxAttributeContext::CGlxMediaListTest::ConstructL(TUint aNumberOfMedia) + { + for (TInt count = 0; count < aNumberOfMedia; ++count) + { + CreateMediaL(count + 1); + } + } + +void UT_CGlxAttributeContext::CGlxMediaListTest::CreateMediaL(TUint aMediaId) + { + TGlxMediaId id(aMediaId); + CGlxMedia* cGlxMedia = NULL; + + TInt modulo = (aMediaId - 1) % 5; + if (modulo > 0) + { + cGlxMedia = new (ELeave) CGlxMedia(id); + CleanupStack::PushL(cGlxMedia); + + if (modulo == 1) + { + // No attributes + } + else if (modulo == 2) + { + cGlxMedia->SetTextValueL(KMPXMediaGeneralTitle, _L("Title")); + } + else if (modulo == 3) + { + cGlxMedia->SetTextValueL(KMPXMediaGeneralDate, _L("Date")); + } + else if (modulo == 4) + { + cGlxMedia->SetTextValueL(KMPXMediaGeneralTitle, _L("Title")); + cGlxMedia->SetTextValueL(KMPXMediaGeneralDate, _L("Date")); + } + + iMedias.AppendL(cGlxMedia); + CleanupStack::Pop(); + } + + TGlxMedia tGlxMedia(id, cGlxMedia); + iItems.AppendL(tGlxMedia); + } + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + UT_CGlxAttributeContext, + "Unit tests for CGlxAttributeContext", + "UNIT" ) +/* +EUNIT_TEST( + "CGlxAttributeContext - test ", + "CGlxAttributeContext", + "CGlxAttributeContext", + "FUNCTIONALITY", + SetupL, UT_CGlxAttributeContext_CGlxAttributeContextL, Teardown) + +EUNIT_TEST( + "AddAttributeL - test ", + "CGlxAttributeContext", + "AddAttributeL", + "FUNCTIONALITY", + SetupL, UT_CGlxAttributeContext_AddAttributeLL, Teardown) + +EUNIT_TEST( + "RemoveAttribute - test ", + "CGlxAttributeContext", + "RemoveAttribute", + "FUNCTIONALITY", + SetupL, UT_CGlxAttributeContext_RemoveAttributeL, Teardown) + +EUNIT_TEST( + "AllAttributesL - test ", + "CGlxAttributeContext", + "AllAttributesL", + "FUNCTIONALITY", + SetupL, UT_CGlxAttributeContext_AllAttributesLL, Teardown) +*/ +EUNIT_TEST( + "AttributeRequestL - test ", + "CGlxAttributeContext", + "AttributeRequestL", + "FUNCTIONALITY", + SetupL, UT_CGlxAttributeContext_AttributeRequestLL, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxattributecontext/ut_cglxattributecontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxattributecontext/ut_cglxattributecontext.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxAttributeContext unit tests +* +*/ + + + + +#ifndef __UT_CGLXATTRIBUTECONTEXT_H__ +#define __UT_CGLXATTRIBUTECONTEXT_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "mglxmedialist.h" + +// FORWARD DECLARATIONS +class CGlxDefaultAttributeContext; + +#include +#ifndef NONSHARABLE_CLASS + #define NONSHARABLE_CLASS(x) class x +#endif + +// CLASS DEFINITION +/** + * + * EUnitWizard generated test class. + * + */ +NONSHARABLE_CLASS( UT_CGlxAttributeContext ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static UT_CGlxAttributeContext* NewL(); + static UT_CGlxAttributeContext* NewLC(); + /** + * Destructor + */ + ~UT_CGlxAttributeContext(); + + private: // Constructors and destructors + + UT_CGlxAttributeContext(); + void ConstructL(); + + public: // From observer interface + + + private: // New methods + + void SetupL(); + + void Teardown(); + + void UT_CGlxAttributeContext_CGlxAttributeContextL(); + + + void UT_CGlxAttributeContext_AddAttributeLL(); + + + void UT_CGlxAttributeContext_RemoveAttributeL(); + + + void UT_CGlxAttributeContext_AllAttributesLL(); + + + void UT_CGlxAttributeContext_AttributeRequestLL(); + + void SetupAttributeRequestTestL(); + void FetchItems_NoMediaL(); + void FetchOneItem_IndexZeroL(); + void FetchOneItem_IndexOneL(); + void FetchOneItem_IndexTwoL(); + void FetchOneItem_IndexThreeL(); + void FetchOneItem_IndexFourL(); + void FetchItems_GranularityLessThanRange_IndexZeroL(); + void FetchItems_GranularityLessThanRange_IndexOneL(); + void FetchItems_GranularityLessThanRange_IndexTwoL(); + void FetchItems_GranularityLessThanRange_IndexThreeL(); + void FetchItems_GranularityLessThanRange_IndexFourL(); + void FetchItems_GranularityLessThanRange_IndexFiveL(); + void FetchItems_GranularityGreaterThanRangeL(); + TBool FindAttribute(RArray& aAttributes, const TMPXAttribute& aAttribute); + + private: // Data + + CGlxDefaultAttributeContext* iAttributeContext; + + EUNIT_DECLARE_TEST_TABLE; + + private: + + // Test media list + class CGlxMediaListTest : public CBase, public MGlxMediaList + { + public: + static CGlxMediaListTest* NewL(TUint aNumberOfMedia); + + virtual ~CGlxMediaListTest(); + + // From MGlxMediaList + virtual void Close() {}; + virtual TGlxMediaListId Id() const { return TGlxMediaListId(1); }; + virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const { return iItems.Count(); }; + virtual TInt FocusIndex() const { return iFocusIndex; }; + virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) { iFocusIndex = aValue; }; + virtual const TGlxMedia& Item(TInt aIndex) const { return iItems[aIndex]; }; + virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& /*aId*/) const { return 0; }; + virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) {}; + virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) {}; + virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) {}; + virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) {}; + virtual MMPXCollection& Collection() const { MMPXCollection* c = NULL; return *c; }; // Don't call + virtual CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const { CMPXCollectionPath* p = NULL; return p; }; // Don't call + virtual TBool IsSelected(TInt /*aIndex*/) const { return EFalse; }; + virtual void SetSelectedL(TInt /*aIndex*/, TBool /*aSelected*/) {}; + virtual TInt SelectionCount() const { return 0; }; + virtual TInt SelectedItemIndex(TInt /*aSelectionIndex*/) const { return KErrNotFound; }; + virtual void CommandL(CMPXCommand& /*aCommand*/) {}; + virtual void CancelCommand() {}; + virtual void SetFilterL(CMPXFilter* /*aFilter*/) {}; + virtual CMPXFilter* Filter() const { return NULL; }; + virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const { return KGlxIdNone; }; + virtual TBool IsPopulated() const { return ETrue; }; // Don't call + virtual void AddStaticItemL( CGlxMedia* /*aStaticItem*/, + NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}; + virtual void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}; + virtual void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }; + virtual TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }; + + virtual void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition /*aFocusInitialPosition*/) { }; + virtual void ResetFocus(){ }; + virtual void SetVisibleWindowIndexL( TInt /*aIndex*/) { }; + virtual TInt VisibleWindowIndex() const { }; + virtual void CancelPreviousRequests() {}; + private: + CGlxMediaListTest(); + void ConstructL(TUint aNumberOfMedia); + + void CreateMediaL(TUint aMediaId); + + TInt iFocusIndex; + RPointerArray iMedias; + RArray iItems; + RArray iSelectedItems; + TBool iStaticItemsEnabled; + }; + }; + +#endif // __UT_CGLXATTRIBUTECONTEXT_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxattributecontext/ut_cglxattributecontextdllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxattributecontext/ut_cglxattributecontextdllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxAttributeContext unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "UT_CGlxAttributeContext.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return UT_CGlxAttributeContext::NewL(); + } + + + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxitemlist/ut_cglxitemlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxitemlist/ut_cglxitemlist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,610 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxitemlist.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "glxitemlist.h" +#include "_glxnotification.h" + +// ----------------------------------------------------------------------------- +// Constructors +// ----------------------------------------------------------------------------- +// +CGlxItemListReconstruction* CGlxItemListReconstruction::NewL( TInt aReservationCount ) + { + CGlxItemListReconstruction* self = new (ELeave) CGlxItemListReconstruction(); + CleanupStack::PushL( self ); + self->ConstructL( aReservationCount ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Test reconstruction +// ----------------------------------------------------------------------------- +// +TBool CGlxItemListReconstruction::ReconstructionEquals() const + { + return ItemsEqual(); + } + +// ----------------------------------------------------------------------------- +// Constructors & destructors +// ----------------------------------------------------------------------------- +// +ut_CGlxItemList* ut_CGlxItemList::NewL() + { + ut_CGlxItemList* self = ut_CGlxItemList::NewLC(); + CleanupStack::Pop(); + + return self; + } + +ut_CGlxItemList* ut_CGlxItemList::NewLC() + { + ut_CGlxItemList* self = new( ELeave ) ut_CGlxItemList(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +ut_CGlxItemList::~ut_CGlxItemList() + { + } + +// Default constructor +ut_CGlxItemList::ut_CGlxItemList() + { + } + +// Second phase construct +void ut_CGlxItemList::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// Setup & teardown +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::SetupL( ) + { + } + +void ut_CGlxItemList::Teardown( ) + { + DeleteMembers(); + } + +// ----------------------------------------------------------------------------- +// Test SetContentsL +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::T_SetContentsLL( ) + { + // Test population of empty list with empty list + { + TNotification::TData notifications[] = { { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8(""), + _L8(""), + notifications ) ); + } + + // Test additions ///////////////////////////////////////////////////////// + + // Test population of empty list + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 3 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8(""), + _L8("abc"), + notifications ) ); + } + + // Test population of empty list + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8(""), + _L8("a"), + notifications ) ); + } + // Test insert at end of list + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 1, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("a"), + _L8("ab"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 1, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("a"), + _L8("abc"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 2, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("ab"), + _L8("abc"), + notifications ) ); + } + // Test insert at the beginning of the list + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("b"), + _L8("ab"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("c"), + _L8("abc"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("bc"), + _L8("abc"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 3 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("de"), + _L8("abcde"), + notifications ) ); + } + + // Test insert at the middle of the list + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 1, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("ac"), + _L8("abc"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 1, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("ad"), + _L8("abcd"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 2, 3 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abf"), + _L8("abcdef"), + notifications ) ); + } + + + // Test multiple insertions + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, // a + { TNotification::EAdd, 2, 1 }, // c + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("b"), + _L8("abc"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 2 }, // ab + { TNotification::EAdd, 3, 2 }, // de + { TNotification::EAdd, 6, 2 }, // gh + { TNotification::EAdd, 9, 1 }, // j + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("cfi"), + _L8("abcdefghij"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 2, 3 }, // cde + { TNotification::EAdd, 6, 1 }, // g + { TNotification::EAdd, 8, 1 }, // i + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abfhj"), + _L8("abcdefghij"), + notifications ) ); + } + + + // Test removals ////////////////////////////////////////////////////////// + + // Test list being made empty + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("a"), + _L8(""), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 3 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abc"), + _L8(""), + notifications ) ); + } + + + // Remove from end + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 1, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("ab"), + _L8("a"), + notifications ) ); + } + + + // Remove from end + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 1, 5 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdef"), + _L8("a"), + notifications ) ); + } + + + // Remove from beginning + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdef"), + _L8("f"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("af"), + _L8("f"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 3 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdef"), + _L8("def"), + notifications ) ); + } + + // Remove from middle + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 1, 4 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdef"), + _L8("af"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 2, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdef"), + _L8("abef"), + notifications ) ); + } + + // Test multiple removals + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 1, 2 }, // bc + { TNotification::ERemove, 2, 1 }, // e + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdef"), + _L8("adf"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 1 }, // a + { TNotification::ERemove, 1, 1 }, // c + { TNotification::ERemove, 3, 3 }, // fgh + { TNotification::ERemove, 5, 1 }, // k + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdefghijk"), + _L8("bdeij"), + notifications ) ); + } + + // Test simultaneous additions and removals /////////////////////////////// + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 1 }, // a + { TNotification::EAdd, 0, 3 }, // 123 + { TNotification::EAdd, 4, 2 }, // 45 + { TNotification::ERemove, 7, 1 }, // d + { TNotification::ERemove, 8, 2 }, // fg + { TNotification::EAdd, 8, 3 }, // 678 + { TNotification::ERemove, 13, 2 }, // jk + { TNotification::EAdd, 13, 5 }, // 90#¤% + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdefghijk"), + _L8("123b45ce678hi90#¤%"), + notifications ) ); + } + + // Test replacement /////////////////////////////////////////////////////// + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 26 }, // abcdefghijkolmnopqrstuvwxyz + { TNotification::EAdd, 0, 10 }, // 1234567890 + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdefghijklmnopqrstuvwxyz"), + _L8("1234567890"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 10 }, // 1234567890 + { TNotification::EAdd, 0, 26 }, // abcdefghijkolmnopqrstuvwxyz + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("1234567890"), + _L8("abcdefghijklmnopqrstuvwxyz"), + notifications ) ); + } + // Test reorder /////////////////////////////////////////////////////////// + // don't really care about the order of notifications, only that reconstruction + // matches the original during sync and at the end. During sync is checked by + // HandleItemsAdded and HandleItemsRemoved. After sync is checked here. + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdefghijklmnopqrstuvwxyz"), + _L8("akjipebvwzcd") ) ); + EUNIT_ASSERT( TrySetContentsL ( _L8("akjipebvwzcd"), + _L8("abcdefghijklmnopqrstuvwxyz") ) ); + EUNIT_ASSERT( TrySetContentsL ( _L8("cdabkoljnpqsrihyzx"), + _L8("abcdefghijklmnopqrstuvwxyz") ) ); + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdefghijklmnopqrstuvwxyz"), + _L8("cdabkoljnpqsrihyzx") ) ); + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdefghijklmnopqrstuvwxyz"), + _L8("qrscdehizyjabklmnoptuvfgwx") ) ); + } + +// ----------------------------------------------------------------------------- +// Test Remove(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::T_RemoveL() + { + // Test by creating a list, and removing items from it + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + 'a', + _L8("bcdefg"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 2, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + 'c', + _L8("abdefg"), + notifications ) ); + } + + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 6, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + 'g', + _L8("abcdef"), + notifications ) ); + } + } + +// ----------------------------------------------------------------------------- +// Test RemoveReference(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::T_RemoveReferenceL( ) + { + // Create the item list + CreateListL( _L8("abcdefg"), _L8("tfttfft") ); + + EUNIT_ASSERT( IsLinkedToMedia( _L8("tfttfft") ) ); + EUNIT_ASSERT( TryRemoveReference( 0, _L8("ffttfft") ) ); + EUNIT_ASSERT( TryRemoveReference( 2, _L8("ffftfft") ) ); + EUNIT_ASSERT( TryRemoveReference( 3, _L8("fffffft") ) ); + EUNIT_ASSERT( TryRemoveReference( 6, _L8("fffffff") ) ); + EUNIT_ASSERT_PANIC_DESC( TryRemoveReference( KErrNotFound, _L8("tfttfft") ), + "Images & videos", EGlxPanicIllegalArgument, + "Incorrect panic" ); + } + +// ----------------------------------------------------------------------------- +// Test Index(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::T_IndexL( ) + { + // Create the item list + CreateListL( _L8("abcdefg") ); + + EUNIT_ASSERT_DESC( iList->Index(KListIdSpace, TGlxMediaId('a') ) == 0, "index match a" ); + EUNIT_ASSERT_DESC( iList->Index(KListIdSpace, TGlxMediaId('c') ) == 2, "index match c" ); + EUNIT_ASSERT_DESC( iList->Index(KListIdSpace, TGlxMediaId('g') ) == 6, "index match g" ); + EUNIT_ASSERT_DESC( iList->Index(KListIdSpace, TGlxMediaId('h') ) == KErrNotFound, "index no match" ); + } + +// ----------------------------------------------------------------------------- +// Test Count() +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::T_CountL( ) + { + // test count of new list + CreateReconstructionL(); + iList = CGlxItemList::NewL( TGlxIdSpaceId( 1 ), *iReconstruction, *this ); + EUNIT_ASSERT_DESC( iList->Count() == 0, "count 0" ); + + // test count of non-empty list + CreateListL( _L8("abcdefg") ); + EUNIT_ASSERT_DESC( iList->Count() == 7, "count 7" ); + } + +// ----------------------------------------------------------------------------- +// Test Item(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::T_ItemL( ) + { + // Create the item list + CreateListL( _L8("abcdefg") ); + // test item + EUNIT_ASSERT_DESC( iList->Item(0).Id() == TGlxMediaId('a'), "item a" ); + EUNIT_ASSERT_DESC( iList->Item(2).Id() == TGlxMediaId('c'), "item c" ); + EUNIT_ASSERT_DESC( iList->Item(6).Id() == TGlxMediaId('g'), "item g" ); + } + +// ----------------------------------------------------------------------------- +// Test IdSpaceId +// ----------------------------------------------------------------------------- +// +void ut_CGlxItemList::T_IdSpaceIdL() + { + TestIdSpaceIdL(); + } + +// ----------------------------------------------------------------------------- +// Test table +// ----------------------------------------------------------------------------- +// +EUNIT_BEGIN_TEST_TABLE( + ut_CGlxItemList, + "Add test suite description here.", + "UNIT" ) + +EUNIT_TEST( + "SetContentsL", + "CGlxItemList", + "SetContentsL", + "FUNCTIONALITY", + SetupL, T_SetContentsLL, Teardown) + +EUNIT_TEST( + "Remove", + "CGlxItemList", + "Remove", + "FUNCTIONALITY", + SetupL, T_RemoveL, Teardown) + +EUNIT_TEST( + "RemoveReference", + "CGlxItemList", + "RemoveReference", + "FUNCTIONALITY", + SetupL, T_RemoveReferenceL, Teardown) + +EUNIT_TEST( + "Index", + "CGlxItemList", + "Index", + "FUNCTIONALITY", + SetupL, T_IndexL, Teardown) + +EUNIT_TEST( + "Count", + "CGlxItemList", + "Count", + "FUNCTIONALITY", + SetupL, T_CountL, Teardown) + +EUNIT_TEST( + "Item", + "CGlxItemList", + "Item", + "FUNCTIONALITY", + SetupL, T_ItemL, Teardown) + +EUNIT_TEST( + "Id space id", + "CGlxItemList", + "IdSpaceId", + "FUNCTIONALITY", + SetupL, T_IdSpaceIdL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxitemlist/ut_cglxitemlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxitemlist/ut_cglxitemlist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#ifndef __UT_CGLXITEMLIST_H__ +#define __UT_CGLXITEMLIST_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxitemlist.h" +#include "glxlistreconstruction.h" +#include "glxlisttestbase.h" + +// FORWARD DECLARATIONS + +/** + * Reconstruction of an item list + */ +NONSHARABLE_CLASS( CGlxItemListReconstruction ) : public CGlxListReconstruction< CGlxItemList > + { + public: + static CGlxItemListReconstruction* NewL( TInt aReservationCount = 400 ); + // From CGlxListReconstructionBase + TBool ReconstructionEquals() const; + }; + +/** + * EUnit test suite + */ +NONSHARABLE_CLASS( ut_CGlxItemList ) : + public CGlxListTestBase< CGlxItemList, CGlxItemListReconstruction > + { + public: // Constructors and destructors + /** + * Two phase construction + */ + static ut_CGlxItemList* NewL(); + static ut_CGlxItemList* NewLC(); + /** + * Destructor + */ + ~ut_CGlxItemList(); + void ConstructL(); + + private: // Constructors and destructors + ut_CGlxItemList(); + + private: // New methods + void SetupL(); + void Teardown(); + + void T_SetContentsLL(); + void T_RemoveL(); + void T_RemoveReferenceL(); + void T_CountL(); + void T_ItemL(); + void T_IndexL(); + void T_IdSpaceIdL(); + + private: // Data + EUNIT_DECLARE_TEST_TABLE; + }; + +#endif // __UT_CGLXITEMLIST_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxitemlist/ut_cglxitemlist_dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxitemlist/ut_cglxitemlist_dllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxitemlist.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return ut_CGlxItemList::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxmedialist/ut_cglxmedialist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxmedialist/ut_cglxmedialist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1532 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMediaList unit tests +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxmedialist.h" + +// EXTERNAL INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "glxmedialist.h" +#include "glxattributecontext.h" + +_LIT(KTitle, "Albums"); + +const TInt KTestCollectionPluginUid = 0x20007195; +const TInt KTestAlbumCollectionPluginUid = 0x2000718B; +const TInt KFavouritesAlbumId = 3000; +const TInt KFavouritesAlbumFirstItemId = 3009; +const TInt KProgressTotalCount = 10; + +const TMPXAttribute KProgressCountAttr(KMPXMessageContentIdProgress, EMPXMessageProgressCurrentCount); +const TMPXAttribute KProgressTotalCountAttr(KMPXMessageContentIdProgress, EMPXMessageProgressTotalCount); + +void CGlxDRMUtility::Close() + { + delete this; + } + +TBool CGlxDRMUtility::CheckOpenRightsL(const TDesC&, TBool) + { + return ETrue; + } + +CGlxDRMUtility* CGlxDRMUtility::InstanceL() + { + CGlxDRMUtility* drm = new(ELeave)CGlxDRMUtility(); + return drm; + } + +TSize CGlxDRMUtility::DRMThumbnailSize(TSize& aSize) + { + return aSize; + } + +CGlxDRMUtility::CGlxDRMUtility() + { + + } + +CGlxDRMUtility::~CGlxDRMUtility() + { + + } + +// CONSTRUCTION +UT_CGlxMediaList* UT_CGlxMediaList::NewL() + { + UT_CGlxMediaList* self = UT_CGlxMediaList::NewLC(); + CleanupStack::Pop(); + + return self; + } + +UT_CGlxMediaList* UT_CGlxMediaList::NewLC() + { + UT_CGlxMediaList* self = new( ELeave ) UT_CGlxMediaList(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +UT_CGlxMediaList::~UT_CGlxMediaList() + { + } + +// Default constructor +UT_CGlxMediaList::UT_CGlxMediaList() + { + } + +// Second phase construct +void UT_CGlxMediaList::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + +void UT_CGlxMediaList::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + iSchedulerWait->AsyncStop(); + } + +void UT_CGlxMediaList::HandleAttributesAvailableL(TInt /*aItemIndex*/, const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/) + { + iSchedulerWait->AsyncStop(); + } + +void UT_CGlxMediaList::SetupL( ) + { + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL(path); + + path->AppendL(KTestCollectionPluginUid); + path->AppendL(KFavouritesAlbumId); + + iCGlxMediaList = CGlxMediaList::InstanceL(*path, NULL); + CleanupStack::PopAndDestroy(); // path + + iCGlxMediaList->AddMediaListObserverL(this); + + iContext = CGlxDefaultAttributeContext::NewL(); + iContext->AddAttributeL(KMPXMediaGeneralTitle); + + iCGlxMediaList->AddContextL(iContext, 0); + + + iSchedulerWait = new (ELeave) CActiveSchedulerWait(); + iSchedulerWait->Start(); // wait for Media list to be populated (HandleItemAddedL will be called) + } + +void UT_CGlxMediaList::Teardown( ) + { + iCGlxMediaList->RemoveContext(iContext); + delete iContext; + iContext = NULL; + + iCGlxMediaList->RemoveMediaListObserver(this); + iCGlxMediaList->Close(); + + delete iSchedulerWait; + iSchedulerWait = NULL; + } + +void UT_CGlxMediaList::UT_CGlxMediaList_InstanceLL( ) + { + // Obtain instance of media list to existing path with filter applied + CMPXCollectionPath* existingPath = CMPXCollectionPath::NewL(); + CleanupStack::PushL(existingPath); + + + existingPath->AppendL(KTestCollectionPluginUid); + existingPath->AppendL(KFavouritesAlbumId); + + + CMPXFilter* filter1 = CMPXFilter::NewL(); + CleanupStack::PushL(filter1); + + EUNIT_PRINT(_L("Obtain instance of media list to existing path with filter applied")); + CGlxMediaList* filteredCGlxMediaList1 = CGlxMediaList::InstanceL(*existingPath, KGlxIdNone, filter1); + + // filter ownership passed to media list + CleanupStack::Pop(filter1); + + CleanupClosePushL(*filteredCGlxMediaList1); + + // Check instance is different + EUNIT_PRINT(_L("Check instance is different")); + EUNIT_ASSERT(filteredCGlxMediaList1 != iCGlxMediaList); + + // Obtain instance of media list with different path + CMPXCollectionPath* differentPath = CMPXCollectionPath::NewL(); + CleanupStack::PushL(differentPath); + + differentPath->AppendL(KTestAlbumCollectionPluginUid); + differentPath->AppendL(KFavouritesAlbumId); + + EUNIT_PRINT(_L("Obtain instance of media list with different path")); + CGlxMediaList* cGlxMediaList1 = CGlxMediaList::InstanceL(*differentPath, NULL); + + CleanupClosePushL(*cGlxMediaList1); + + // Check instance is different + EUNIT_PRINT(_L("Check instance is different")); + EUNIT_ASSERT(cGlxMediaList1 != iCGlxMediaList); + + // Obtain instance of media list to existing path with filter applied + CMPXFilter* filter2 = CMPXFilter::NewL(); + CleanupStack::PushL(filter2); + + EUNIT_PRINT(_L("Obtain instance of media list to existing path with filter applied")); + CGlxMediaList* filteredCGlxMediaList2 = CGlxMediaList::InstanceL(*existingPath, KGlxIdNone, filter2); + + // filter ownership passed to media list + CleanupStack::Pop(filter2); + + CleanupClosePushL(*filteredCGlxMediaList2); + + // Check instance is different + EUNIT_PRINT(_L("Check instance is different")); + EUNIT_ASSERT(filteredCGlxMediaList2 != filteredCGlxMediaList1) + + // Obtain instance of media list with same path + EUNIT_PRINT(_L("Obtain instance of media list with same path")); + CGlxMediaList* cGlxMediaList2 = CGlxMediaList::InstanceL(*existingPath, NULL); + + CleanupClosePushL(*cGlxMediaList2); + + // Check instance is the same + EUNIT_PRINT(_L("Check instance is the same")); + EUNIT_ASSERT(cGlxMediaList2 == iCGlxMediaList); + + CleanupStack::PopAndDestroy(cGlxMediaList2); + CleanupStack::PopAndDestroy(filteredCGlxMediaList2); + CleanupStack::PopAndDestroy(cGlxMediaList1); + CleanupStack::PopAndDestroy(differentPath); + CleanupStack::PopAndDestroy(filteredCGlxMediaList1); + CleanupStack::PopAndDestroy(existingPath); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_MediaListsL( ) + { + // Check media lists array + EUNIT_PRINT(_L("Check media lists array")); + RPointerArray& mediaLists = CGlxMediaList::MediaListsL(); + + // Check media lists initial count + TInt mediaListCount = mediaLists.Count(); + EUNIT_PRINT(_L("Check media lists initial count")); + EUNIT_ASSERT(mediaListCount == 1); + + // Check media lists initial item + EUNIT_PRINT(_L("Check media lists initial item")); + EUNIT_ASSERT(mediaLists[0] == iCGlxMediaList); + + // Obtain instance of media list with different path + CMPXCollectionPath* differentPath = CMPXCollectionPath::NewL(); + CleanupStack::PushL(differentPath); + + differentPath->AppendL(KTestAlbumCollectionPluginUid); + differentPath->AppendL(KFavouritesAlbumId); + + EUNIT_PRINT(_L("Obtain instance of media list with different path")); + CGlxMediaList* cGlxMediaList1 = CGlxMediaList::InstanceL(*differentPath, NULL); + + CleanupClosePushL(*cGlxMediaList1); + + // Check media lists count + mediaListCount = mediaLists.Count(); + EUNIT_PRINT(_L("Check media lists count")); + EUNIT_ASSERT(mediaListCount == 2); + + // Check media lists items + EUNIT_PRINT(_L("Check media lists items")); + EUNIT_ASSERT((mediaLists[0] == cGlxMediaList1) && (mediaLists[1] == iCGlxMediaList)); + + // Obtain instance of media list to existing path + CMPXCollectionPath* existingPath = CMPXCollectionPath::NewL(); + CleanupStack::PushL(existingPath); + + existingPath->AppendL(KTestCollectionPluginUid); + existingPath->AppendL(KFavouritesAlbumId); + + EUNIT_PRINT(_L("Obtain instance of media list with existing path")); + CGlxMediaList* cGlxMediaList2 = CGlxMediaList::InstanceL(*existingPath, NULL); + + CleanupClosePushL(*cGlxMediaList2); + + // Check media lists count + mediaListCount = mediaLists.Count(); + EUNIT_PRINT(_L("Check media lists count")); + EUNIT_ASSERT(mediaListCount == 2); + + // Check media lists items + EUNIT_PRINT(_L("Check media lists items")); + EUNIT_ASSERT((mediaLists[1] == cGlxMediaList1) && (mediaLists[0] == iCGlxMediaList)); + + CleanupStack::PopAndDestroy(cGlxMediaList2); + CleanupStack::PopAndDestroy(existingPath); + CleanupStack::PopAndDestroy(cGlxMediaList1); + CleanupStack::PopAndDestroy(differentPath); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_NewLCL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_OpenLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_AddReferenceL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_RemoveReferenceL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_ReferenceCountL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_EqualsL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_OfferMediaL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_HandleAttributesAvailableLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_AttributeRequestLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_CloseL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_IdL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_CountL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_FocusIndexL( ) + { + // Setup test + SetupFocusTestL(); + + // Check focus is index 3 + EUNIT_PRINT(_L("Check focus is index 3")); + TInt focusIndex = iCGlxMediaList->FocusIndex(); + EUNIT_ASSERT(focusIndex == 3); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_SetFocusLL( ) + { + // Setup test + SetupFocusTestL(); + + MoveFocusAbsoluteGreaterThanCurrentFocusL(); + MoveFocusAbsoluteLessThanCurrentFocusL(); + MoveFocusRelativeForwardL(); + MoveFocusRelativeBackwardL(); + MoveFocusRelativeForwardGreaterThanListCountL(); + MoveFocusRelativeBackwardLessThanZeroL(); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_ItemL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_IndexL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_AddMediaListObserverLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_RemoveMediaListObserverL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_AddContextLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_RemoveContextL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_CollectionL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_PathLCL( ) + { + // Setup test + SetupPathTestL(); + + CMPXCollectionPath* path = iCGlxMediaList->PathLC(); + + // Check path has 3 levels + EUNIT_PRINT(_L("Check path has 3 levels")); + EUNIT_ASSERT(path->Levels() == 3); + + // Check level 0 is test collection plugin uid + EUNIT_PRINT(_L("Check level 0 is test collection plugin uid")); + EUNIT_ASSERT(path->Id(0) == KTestCollectionPluginUid); + + // Check level 1 is favourites album id + EUNIT_PRINT(_L("Check level 1 is favourites album id")); + EUNIT_ASSERT(path->Id(1) == KFavouritesAlbumId); + + // Check level 2 is favourites album first item id + EUNIT_PRINT(_L("Check level 2 is favourites album first item id")); + EUNIT_ASSERT(path->Id(2) == KFavouritesAlbumFirstItemId); + + // Check path item count + TInt pathCount = path->Count(); + TInt listCount = iCGlxMediaList->Count(); + EUNIT_PRINT(_L("Check path item count")); + EUNIT_ASSERT(pathCount == listCount); + + // Check path items + EUNIT_PRINT(_L("Check path items")); + for (TInt count = 0; count < pathCount; ++count) + { + EUNIT_ASSERT(path->IdOfIndex(count) == TMPXItemId(iCGlxMediaList->Item(count).Id().Value())); + } + + // Check path selection count + TArray pathSelection = path->Selection(); + TInt pathSelectionCount = pathSelection.Count(); + TInt listSelectionCount = iCGlxMediaList->SelectionCount(); + EUNIT_PRINT(_L("Check path selection count")); + EUNIT_ASSERT(pathSelectionCount == listSelectionCount); + + // Check path selected items + EUNIT_PRINT(_L("Check path selected items")); + for (TInt count = 0; count < pathSelectionCount; ++count) + { + EUNIT_ASSERT(pathSelection[count] == iCGlxMediaList->SelectedItemIndex(count)); + } + + // Check focused item + EUNIT_PRINT(_L("Check focused item")); + EUNIT_ASSERT(path->Id() == TMPXItemId(iCGlxMediaList->Item(iCGlxMediaList->FocusIndex()).Id().Value())); + + CleanupStack::PopAndDestroy(path); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_IsSelectedL( ) + { + // Setup test + SetupSelectionTestL(); + + TBool isSelected = EFalse; + + // Check 2 is selected + EUNIT_PRINT(_L("Check 2 is selected")); + isSelected = iCGlxMediaList->IsSelected(2); + EUNIT_ASSERT(isSelected == ETrue); + + // Check 3 is not selected + EUNIT_PRINT(_L("Check 3 is not selected")); + isSelected = iCGlxMediaList->IsSelected(3); + EUNIT_ASSERT(isSelected == EFalse); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_SetSelectedLL( ) + { + // Setup test + SetupSelectionTestL(); + + // Select 1 (insert at beginning) + EUNIT_PRINT(_L("Select 1")); + iCGlxMediaList->SetSelectedL(1, ETrue); + + RArray selection; + CleanupClosePushL(selection); + + TInt selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 1, 2 and 4 is selected in order")); + EUNIT_ASSERT(selection.Count() == 3 && selection[0] == 1 && selection[1] == 2 && selection[2] == 4); + + // Select 3 (insert in middle) + EUNIT_PRINT(_L("Select 3")); + iCGlxMediaList->SetSelectedL(3, ETrue); + + selection.Reset(); + selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 1, 2, 3 and 4 is selected in order")); + EUNIT_ASSERT(selection.Count() == 4 && selection[0] == 1 && selection[1] == 2 && selection[2] == 3 && selection[3] == 4); + + // Select 3 again (already selected) + EUNIT_PRINT(_L("Select 3 again")); + iCGlxMediaList->SetSelectedL(3, ETrue); + + selection.Reset(); + selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 1, 2, 3 and 4 is still selected in order")); + EUNIT_ASSERT(selection.Count() == 4 && selection[0] == 1 && selection[1] == 2 && selection[2] == 3 && selection[3] == 4); + + // Select 5 (insert at end) + EUNIT_PRINT(_L("Select 5")); + iCGlxMediaList->SetSelectedL(5, ETrue); + + selection.Reset(); + selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 1, 2, 3, 4 and 5 is selected in order")); + EUNIT_ASSERT(selection.Count() == 5 && selection[0] == 1 && selection[1] == 2 && selection[2] == 3 && selection[3] == 4 && selection[4] == 5); + + // Deselect 1 (remove from beginning) + EUNIT_PRINT(_L("Deselect 1")); + iCGlxMediaList->SetSelectedL(1, EFalse); + + selection.Reset(); + selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 2, 3, 4 and 5 is selected in order")); + EUNIT_ASSERT(selection.Count() == 4 && selection[0] == 2 && selection[1] == 3 && selection[2] == 4 && selection[3] == 5); + + // Deselect 3 (remove from middle) + EUNIT_PRINT(_L("Deselect 3")); + iCGlxMediaList->SetSelectedL(3, EFalse); + + selection.Reset(); + selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 2, 4 and 5 is selected in order")); + EUNIT_ASSERT(selection.Count() == 3 && selection[0] == 2 && selection[1] == 4 && selection[2] == 5); + + // Deselect 3 again (already removed) + EUNIT_PRINT(_L("Deselect 3 again")); + iCGlxMediaList->SetSelectedL(3, EFalse); + + selection.Reset(); + selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 2, 4 and 5 is still selected in order")); + EUNIT_ASSERT(selection.Count() == 3 && selection[0] == 2 && selection[1] == 4 && selection[2] == 5); + + // Deselect 5 (remove from end) + EUNIT_PRINT(_L("Deselect 5")); + iCGlxMediaList->SetSelectedL(5, EFalse); + + selection.Reset(); + selectionCount = iCGlxMediaList->SelectionCount(); + for (TInt count = 0; count < selectionCount; ++count) + { + selection.AppendL(iCGlxMediaList->SelectedItemIndex(count)); + } + + EUNIT_PRINT(_L("Check 2 and 4 is selected in order")); + EUNIT_ASSERT(selection.Count() == 2 && selection[0] == 2 && selection[1] == 4); + + CleanupStack::PopAndDestroy(&selection); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_SelectionCountL( ) + { + // Setup test + SetupSelectionTestL(); + + // Check selection count is 2 + TInt selectionCount = iCGlxMediaList->SelectionCount(); + + EUNIT_PRINT(_L("Check selection count is 2")); + EUNIT_ASSERT(selectionCount == 2); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_SelectedItemIndexL( ) + { + // Setup test + SetupSelectionTestL(); + + // Check selected item index for selection index 0 is 2 + TInt selectedItemIndex = iCGlxMediaList->SelectedItemIndex(0); + + EUNIT_PRINT(_L("Check selected item index for selection index 0 is 2")); + EUNIT_ASSERT(selectedItemIndex == 2); + + // Check selected item index for selection index 1 is 4 + selectedItemIndex = iCGlxMediaList->SelectedItemIndex(1); + + EUNIT_PRINT(_L("Check selected item index for selection index 1 is 4")); + EUNIT_ASSERT(selectedItemIndex == 4); + + // Check selected item index for out of bounds selection index is KErrNotFound + // SelectedItemIndex does not return KErrNotFound. + EUNIT_ASSERT_PANIC_DESC( selectedItemIndex = iCGlxMediaList->SelectedItemIndex(2) ,"USER",130,"Index out of bounds" ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_CommandLL( ) + { + CMPXCommand* addContainerCommand = CMPXCommand::NewL(); + CleanupStack::PushL(addContainerCommand); + + addContainerCommand->SetTObjectValueL(KMPXCommandGeneralId, KGlxCommandIdAdd); + addContainerCommand->SetTObjectValueL(KMPXCommandGeneralSessionId, (TInt)this); + addContainerCommand->SetTextValueL(KMPXMediaGeneralTitle, KTitle()); + + EUNIT_PRINT(_L("Send add container command")); + iCGlxMediaList->CommandL(*addContainerCommand); + + TInt attributeCount = addContainerCommand->Count(); + EUNIT_PRINT(_L("Check correct attributes for sent command")); + EUNIT_ASSERT(attributeCount == 3); + + TBool commandIdAvailable = addContainerCommand->IsSupported(KMPXCommandGeneralId); + TUint32 commandId(0); + if (commandIdAvailable) + { + commandId = *(addContainerCommand->Value(KMPXCommandGeneralId)); + } + EUNIT_PRINT(_L("Check command id sent and is correct value")); + EUNIT_ASSERT(commandIdAvailable && (commandId == KGlxCommandIdAdd)); + + TBool sessionIdAvailable = addContainerCommand->IsSupported(KMPXCommandGeneralSessionId); + TInt sessionId(0); + if (sessionIdAvailable) + { + sessionId = *(addContainerCommand->Value(KMPXCommandGeneralSessionId)); + } + EUNIT_PRINT(_L("Check session id sent and is correct value")); + EUNIT_ASSERT(sessionIdAvailable && (sessionId == (TInt)this)); + + TBool titleAvailable = addContainerCommand->IsSupported(KMPXMediaGeneralTitle); + HBufC* title = NULL; + if (titleAvailable) + { + title = HBufC::NewL((addContainerCommand->ValueText(KMPXMediaGeneralTitle)).Length()); + TPtr titlePtr = title->Des(); + titlePtr.Append(addContainerCommand->ValueText(KMPXMediaGeneralTitle)); + } + EUNIT_PRINT(_L("Check title sent and is correct value")); + EUNIT_ASSERT(titleAvailable && (*title == KTitle())); + + delete title; + CleanupStack::PopAndDestroy(); // addContainerCommand + } + +void UT_CGlxMediaList::UT_CGlxMediaList_CancelCommandL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_SetFilterLL( ) + { + // Setup test + SetupFilterTestL(); + + // Change filter to videos + EUNIT_PRINT(_L("Set filter to videos")); + CMPXFilter* filter = iCGlxMediaList->Filter(); + filter->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + iCGlxMediaList->SetFilterL(filter); + + filter = iCGlxMediaList->Filter(); + + TBool mediaCategoryAvailable = filter->IsSupported(KMPXMediaGeneralCategory); + TMPXGeneralCategory category(EMPXNoCategory); + if (mediaCategoryAvailable) + { + category = *(filter->Value(KMPXMediaGeneralCategory)); + } + EUNIT_PRINT(_L("Check filter is videos")); + EUNIT_ASSERT(mediaCategoryAvailable && (category == EMPXVideo)); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_FilterL( ) + { + // Setup test + SetupFilterTestL(); + + CMPXFilter* filter = iCGlxMediaList->Filter(); + + TBool mediaCategoryAvailable = filter->IsSupported(KMPXMediaGeneralCategory); + TMPXGeneralCategory category(EMPXNoCategory); + if (mediaCategoryAvailable) + { + category = *(filter->Value(KMPXMediaGeneralCategory)); + } + EUNIT_PRINT(_L("Check filter is images")); + EUNIT_ASSERT(mediaCategoryAvailable && (category == EMPXImage)); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_HandleOpenLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_HandleOpenL_1L( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_HandleCollectionMediaLL( ) + { + EUNIT_ASSERT( EFalse ); + } + +void UT_CGlxMediaList::UT_CGlxMediaList_HandleCollectionMessageL_1L( ) + { + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + CMPXMessage* message = CMPXMessage::NewL(); + CleanupStack::PushL(message); + + message->SetTObjectValueL(KMPXMessageGeneralId, KMPXMessageContentIdProgress); + message->SetTObjectValueL(KMPXCommandGeneralSessionId, (TInt)this); + message->SetTObjectValueL(KProgressTotalCountAttr, KProgressTotalCount); + + // Send progress messages + EUNIT_PRINT(_L("Send progress messages")); + for (TInt count = 0; count < KProgressTotalCount; ++count) + { + message->SetTObjectValueL(KProgressCountAttr, count + 1); + iCGlxMediaList->HandleCollectionMessageL(*message); + } + + CleanupStack::PopAndDestroy(); // message + + // Check correct notification was observed + const TInt messageCount = mediaListObserver->MessageCount(); + + EUNIT_PRINT(_L("Check correct number of messages was received by observer")); + EUNIT_ASSERT(messageCount == KProgressTotalCount); + + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + + EUNIT_PRINT(_L("Check correct media list was received by observer")); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + const CMPXMessage* observedMessage = mediaListObserver->Message(); + TInt attributeCount = observedMessage->Count(); + + EUNIT_PRINT(_L("Check correct number of attributes for received progress message")); + EUNIT_ASSERT(attributeCount == 4); + + TBool messageIdAvailable = observedMessage->IsSupported(KMPXMessageGeneralId); + TUint32 messageId(0); + if (messageIdAvailable) + { + messageId = *(observedMessage->Value(KMPXMessageGeneralId)); + } + EUNIT_PRINT(_L("Check message id received and is correct value")); + EUNIT_ASSERT(messageIdAvailable && (messageId == KMPXMessageContentIdProgress)); + + TBool sessionIdAvailable = observedMessage->IsSupported(KMPXCommandGeneralSessionId); + TInt sessionId(0); + if (sessionIdAvailable) + { + sessionId = *(observedMessage->Value(KMPXCommandGeneralSessionId)); + } + EUNIT_PRINT(_L("Check session id received and is correct value")); + EUNIT_ASSERT(sessionIdAvailable && (sessionId == (TInt)this)); + + TBool progressCountAvailable = observedMessage->IsSupported(KProgressCountAttr); + TInt progressCount(0); + if (progressCountAvailable) + { + progressCount = *(observedMessage->Value(KProgressCountAttr)); + } + EUNIT_PRINT(_L("Check progress current count received and is correct value")); + EUNIT_ASSERT(progressCountAvailable && (progressCount == KProgressTotalCount)); + + TBool progressTotalCountAvailable = observedMessage->IsSupported(KProgressTotalCountAttr); + TInt progressTotalCount(0); + if (progressTotalCountAvailable) + { + progressTotalCount = *(observedMessage->Value(KProgressTotalCountAttr)); + } + EUNIT_PRINT(_L("Check progress total count received and is correct value")); + EUNIT_ASSERT(progressTotalCountAvailable && (progressTotalCount == KProgressTotalCount)); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(); // mediaListObserver + } + +void UT_CGlxMediaList::SetupFocusTestL() + { + // Initial focus 3 + EUNIT_PRINT(_L("Initial focus 3")); + iCGlxMediaList->SetFocusL(NGlxListDefs::EAbsolute, 3); + } + +void UT_CGlxMediaList::SetupPathTestL() + { + SetupSelectionTestL(); + } + +void UT_CGlxMediaList::SetupSelectionTestL() + { + // Initial selection 2 and 4 + EUNIT_PRINT(_L("Initial selection 2 and 4")); + iCGlxMediaList->SetSelectedL(2, ETrue); + iCGlxMediaList->SetSelectedL(4, ETrue); + } + +void UT_CGlxMediaList::SetupFilterTestL() + { + // Initial filter images + EUNIT_PRINT(_L("Initial filter images")); + CMPXFilter* filter = CMPXFilter::NewL(); + CleanupStack::PushL(filter); + + filter->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); + + iCGlxMediaList->SetFilterL(filter); + + CleanupStack::Pop(filter); // filter ownership passed to media list + } + +void UT_CGlxMediaList::MoveFocusAbsoluteGreaterThanCurrentFocusL() + { + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + // Set focus to absolute value 4 + EUNIT_PRINT(_L("Set focus to absolute value 4")); + iCGlxMediaList->SetFocusL(NGlxListDefs::EAbsolute, 4); + + // Check focus is index 4 + EUNIT_PRINT(_L("Check focus is index 4")); + TInt focusIndex = iCGlxMediaList->FocusIndex(); + EUNIT_ASSERT(focusIndex == 4); + + // Check correct notification was observed + EUNIT_PRINT(_L("Check correct media list was received by observer")); + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + EUNIT_PRINT(_L("Check correct focus change type was received by observer")); + NGlxListDefs::TFocusChangeType observedFocusChangeType = mediaListObserver->FocusChangeType(); + EUNIT_ASSERT(observedFocusChangeType == NGlxListDefs::EForward); + + EUNIT_PRINT(_L("Check correct new focus index was received by observer")); + TInt observedFocusNewIndex = mediaListObserver->FocusNewIndex(); + EUNIT_ASSERT(observedFocusNewIndex == 4); + + EUNIT_PRINT(_L("Check correct old focus index was received by observer")); + TInt observedFocusOldIndex = mediaListObserver->FocusOldIndex(); + EUNIT_ASSERT(observedFocusOldIndex == 3); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(); // mediaListObserver + } + +void UT_CGlxMediaList::MoveFocusAbsoluteLessThanCurrentFocusL() + { + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + // Set focus to absolute value 2 + EUNIT_PRINT(_L("Set focus to absolute value 2")); + iCGlxMediaList->SetFocusL(NGlxListDefs::EAbsolute, 2); + + // Check focus is index 2 + EUNIT_PRINT(_L("Check focus is index 2")); + TInt focusIndex = iCGlxMediaList->FocusIndex(); + EUNIT_ASSERT(focusIndex == 2); + + // Check correct notification was observed + EUNIT_PRINT(_L("Check correct media list was received by observer")); + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + EUNIT_PRINT(_L("Check correct focus change type was received by observer")); + NGlxListDefs::TFocusChangeType observedFocusChangeType = mediaListObserver->FocusChangeType(); + EUNIT_ASSERT(observedFocusChangeType == NGlxListDefs::EBackward); + + EUNIT_PRINT(_L("Check correct new focus index was received by observer")); + TInt observedFocusNewIndex = mediaListObserver->FocusNewIndex(); + EUNIT_ASSERT(observedFocusNewIndex == 2); + + EUNIT_PRINT(_L("Check correct old focus index was received by observer")); + TInt observedFocusOldIndex = mediaListObserver->FocusOldIndex(); + EUNIT_ASSERT(observedFocusOldIndex == 4); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(); // mediaListObserver + } + +void UT_CGlxMediaList::MoveFocusRelativeForwardL() + { + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + // Set focus to relative value forward 1 + EUNIT_PRINT(_L("Set focus to relative value forward 1")); + iCGlxMediaList->SetFocusL(NGlxListDefs::ERelative, 1); + + // Check focus is index 3 + EUNIT_PRINT(_L("Check focus is index 3")); + TInt focusIndex = iCGlxMediaList->FocusIndex(); + EUNIT_ASSERT(focusIndex == 3); + + // Check correct notification was observed + EUNIT_PRINT(_L("Check correct media list was received by observer")); + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + EUNIT_PRINT(_L("Check correct focus change type was received by observer")); + NGlxListDefs::TFocusChangeType observedFocusChangeType = mediaListObserver->FocusChangeType(); + EUNIT_ASSERT(observedFocusChangeType == NGlxListDefs::EForward); + + EUNIT_PRINT(_L("Check correct new focus index was received by observer")); + TInt observedFocusNewIndex = mediaListObserver->FocusNewIndex(); + EUNIT_ASSERT(observedFocusNewIndex == 3); + + EUNIT_PRINT(_L("Check correct old focus index was received by observer")); + TInt observedFocusOldIndex = mediaListObserver->FocusOldIndex(); + EUNIT_ASSERT(observedFocusOldIndex == 2); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(); // mediaListObserver + } + +void UT_CGlxMediaList::MoveFocusRelativeBackwardL() + { + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + // Set focus to relative value backwards 1 + EUNIT_PRINT(_L("Set focus to relative value backwards 1")); + iCGlxMediaList->SetFocusL(NGlxListDefs::ERelative, -1); + + // Check focus is index 2 + EUNIT_PRINT(_L("Check focus is index 2")); + TInt focusIndex = iCGlxMediaList->FocusIndex(); + EUNIT_ASSERT(focusIndex == 2); + + // Check correct notification was observed + EUNIT_PRINT(_L("Check correct media list was received by observer")); + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + EUNIT_PRINT(_L("Check correct focus change type was received by observer")); + NGlxListDefs::TFocusChangeType observedFocusChangeType = mediaListObserver->FocusChangeType(); + EUNIT_ASSERT(observedFocusChangeType == NGlxListDefs::EBackward); + + EUNIT_PRINT(_L("Check correct new focus index was received by observer")); + TInt observedFocusNewIndex = mediaListObserver->FocusNewIndex(); + EUNIT_ASSERT(observedFocusNewIndex == 2); + + EUNIT_PRINT(_L("Check correct old focus index was received by observer")); + TInt observedFocusOldIndex = mediaListObserver->FocusOldIndex(); + EUNIT_ASSERT(observedFocusOldIndex == 3); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(); // mediaListObserver + } + +void UT_CGlxMediaList::MoveFocusRelativeForwardGreaterThanListCountL() + { + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + // Set focus to relative value forward list count - 1 + EUNIT_PRINT(_L("Set focus to relative value forward list count - 1")); + TInt listCount = iCGlxMediaList->Count(); + iCGlxMediaList->SetFocusL(NGlxListDefs::ERelative, listCount - 1); + + // Check focus is index 1 + EUNIT_PRINT(_L("Check focus is index 1")); + TInt focusIndex = iCGlxMediaList->FocusIndex(); + EUNIT_ASSERT(focusIndex == 1); + + // Check correct notification was observed + EUNIT_PRINT(_L("Check correct media list was received by observer")); + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + EUNIT_PRINT(_L("Check correct focus change type was received by observer")); + NGlxListDefs::TFocusChangeType observedFocusChangeType = mediaListObserver->FocusChangeType(); + EUNIT_ASSERT(observedFocusChangeType == NGlxListDefs::EForward); + + EUNIT_PRINT(_L("Check correct new focus index was received by observer")); + TInt observedFocusNewIndex = mediaListObserver->FocusNewIndex(); + EUNIT_ASSERT(observedFocusNewIndex == 1); + + EUNIT_PRINT(_L("Check correct old focus index was received by observer")); + TInt observedFocusOldIndex = mediaListObserver->FocusOldIndex(); + EUNIT_ASSERT(observedFocusOldIndex == 2); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(); // mediaListObserver + } + +void UT_CGlxMediaList::MoveFocusRelativeBackwardLessThanZeroL() + { + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + // Set focus to relative value backwards 2 + EUNIT_PRINT(_L("Set focus to relative value backwards 2")); + iCGlxMediaList->SetFocusL(NGlxListDefs::ERelative, -2); + + // Check focus is index (list count - 1) + EUNIT_PRINT(_L("Check focus is index (list count - 1)")); + TInt listCount = iCGlxMediaList->Count(); + TInt focusIndex = iCGlxMediaList->FocusIndex(); + EUNIT_ASSERT(focusIndex == (listCount - 1)); + + // Check correct notification was observed + EUNIT_PRINT(_L("Check correct media list was received by observer")); + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + EUNIT_PRINT(_L("Check correct focus change type was received by observer")); + NGlxListDefs::TFocusChangeType observedFocusChangeType = mediaListObserver->FocusChangeType(); + EUNIT_ASSERT(observedFocusChangeType == NGlxListDefs::EBackward); + + EUNIT_PRINT(_L("Check correct new focus index was received by observer")); + TInt observedFocusNewIndex = mediaListObserver->FocusNewIndex(); + EUNIT_ASSERT(observedFocusNewIndex == (listCount - 1)); + + EUNIT_PRINT(_L("Check correct old focus index was received by observer")); + TInt observedFocusOldIndex = mediaListObserver->FocusOldIndex(); + EUNIT_ASSERT(observedFocusOldIndex == 1); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(); // mediaListObserver + } + +void UT_CGlxMediaList::ReceiveMessageItemChangedItemModifiedL() + { + iSchedulerWait->Start(); // wait for attributes to be retrieved (HandleAttributesAvailableL will be called) + + // Check media attributes initial count + TInt listIndex = iCGlxMediaList->Index(NULL, TGlxMediaId(KFavouritesAlbumFirstItemId)); + + EUNIT_PRINT(_L("Check initial media has 1 attribute")); + const TGlxMedia& tGlxMediaBefore = iCGlxMediaList->Item(listIndex); + const CGlxMedia* cGlxMediaBefore = tGlxMediaBefore.Properties(); + EUNIT_ASSERT(cGlxMediaBefore->Count() == 1); + + CGlxMediaListObserverTest* mediaListObserver = CGlxMediaListObserverTest::NewL(); + CleanupStack::PushL(mediaListObserver); + + iCGlxMediaList->AddMediaListObserverL(mediaListObserver); + + // Send item modified notification for item not in list + EUNIT_PRINT(_L("Send item modified notification for item not in list")); + TMPXCollectionMessage message1(TMPXCollectionMessage::EItemChanged, EMcItemModified, KFavouritesAlbumId); +// iCGlxMediaList->HandleCollectionMessageL(message1); + + // Check no notification was observed + TInt messageCount = mediaListObserver->MessageCount(); + + EUNIT_PRINT(_L("Check no messages was received by observer")); + EUNIT_ASSERT(messageCount == 0); + + // Send item modified notification for item in list + EUNIT_PRINT(_L("Send item modified notification for item in list")); + TMPXCollectionMessage message2(TMPXCollectionMessage::EItemChanged, EMcItemModified, KFavouritesAlbumFirstItemId); +// iCGlxMediaList->HandleCollectionMessageL(message2); + + // Check correct notification was observed + messageCount = mediaListObserver->MessageCount(); + + EUNIT_PRINT(_L("Check correct number of messages was received by observer")); + EUNIT_ASSERT(messageCount == 1); + + const MGlxMediaList* observedMediaList = mediaListObserver->List(); + + EUNIT_PRINT(_L("Check correct media list was received by observer")); + EUNIT_ASSERT(observedMediaList == (MGlxMediaList*)iCGlxMediaList); + + const RArray& modifiedItemIndices = mediaListObserver->ModifiedItemIndices(); + + EUNIT_PRINT(_L("Check correct number of modified items was received by observer")); + TInt modifiedItemIndicesCount = modifiedItemIndices.Count(); + EUNIT_ASSERT(modifiedItemIndicesCount == 1); + + EUNIT_PRINT(_L("Check correct modified items was received by observer")); + TInt modifedItemIndex = modifiedItemIndices[0]; + EUNIT_ASSERT(modifedItemIndex == listIndex); + + // Check media attributes removed + EUNIT_PRINT(_L("Check media has no attributes")); + const TGlxMedia& tGlxMediaAfter = iCGlxMediaList->Item(listIndex); + const CGlxMedia* cGlxMediaAfter = tGlxMediaAfter.Properties(); + EUNIT_ASSERT(cGlxMediaAfter->Count() == 0); + + iCGlxMediaList->RemoveMediaListObserver(mediaListObserver); + + CleanupStack::PopAndDestroy(mediaListObserver); + } + +UT_CGlxMediaList::CGlxMediaListObserverTest* UT_CGlxMediaList::CGlxMediaListObserverTest::NewL() + { + CGlxMediaListObserverTest* self = new (ELeave) CGlxMediaListObserverTest(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +UT_CGlxMediaList::CGlxMediaListObserverTest::~CGlxMediaListObserverTest() + { + delete iMessage; + iMessage = NULL; + + iModifiedItemIndices.Close(); + } + +UT_CGlxMediaList::CGlxMediaListObserverTest::CGlxMediaListObserverTest() : + iList(NULL), + iFocusChangeType(NGlxListDefs::EUnknown), + iFocusNewIndex(KErrNotFound), + iFocusOldIndex(KErrNotFound), + iModifiedItemIndices(), + iMessage(NULL), + iMessageCount(0) + { + } + +void UT_CGlxMediaList::CGlxMediaListObserverTest::ConstructL() + { + iMessage = CMPXMessage::NewL(); + } + +void UT_CGlxMediaList::CGlxMediaListObserverTest::HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList) + { + iList = aList; + + iFocusChangeType = aType; + iFocusNewIndex = aNewIndex; + iFocusOldIndex = aOldIndex; + + ++iMessageCount; + } + +void UT_CGlxMediaList::CGlxMediaListObserverTest::HandleItemModifiedL(const RArray& aItemIndices, MGlxMediaList* aList) + { + iList = aList; + + TInt itemIndexCount = aItemIndices.Count(); + for (TInt count = 0; count < itemIndexCount; ++count) + { + iModifiedItemIndices.AppendL(aItemIndices[count]); + } + + ++iMessageCount; + } + +void UT_CGlxMediaList::CGlxMediaListObserverTest::HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList) + { + iList = aList; + + if (aMessage.IsSupported(KMPXMessageGeneralId)) + { + TUint32 messageId = *(aMessage.Value(KMPXMessageGeneralId)); + iMessage->SetTObjectValueL(KMPXMessageGeneralId, messageId); + } + + if (aMessage.IsSupported(KMPXCommandGeneralSessionId)) + { + TInt sessionId = *(aMessage.Value(KMPXCommandGeneralSessionId)); + iMessage->SetTObjectValueL(KMPXCommandGeneralSessionId, sessionId); + } + + if (aMessage.IsSupported(KProgressCountAttr)) + { + TInt progressCount = *(aMessage.Value(KProgressCountAttr)); + iMessage->SetTObjectValueL(KProgressCountAttr, progressCount); + } + + if (aMessage.IsSupported(KProgressTotalCountAttr)) + { + TInt progressTotalCount = *(aMessage.Value(KProgressTotalCountAttr)); + iMessage->SetTObjectValueL(KProgressTotalCountAttr, progressTotalCount); + } + + ++iMessageCount; + } + +// TEST TABLE + +EUNIT_BEGIN_TEST_TABLE( + UT_CGlxMediaList, + "Unit tests for CGlxMediaList", + "UNIT" ) + +EUNIT_TEST( + "InstanceL - test ", + "CGlxMediaList", + "InstanceL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_InstanceLL, Teardown) + +EUNIT_TEST( + "MediaLists - test ", + "CGlxMediaList", + "MediaLists", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_MediaListsL, Teardown) +/* +EUNIT_TEST( + "NewLC - test ", + "CGlxMediaList", + "NewLC", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_NewLCL, Teardown) + +EUNIT_TEST( + "OpenL - test ", + "CGlxMediaList", + "OpenL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_OpenLL, Teardown) + +EUNIT_TEST( + "AddReference - test ", + "CGlxMediaList", + "AddReference", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_AddReferenceL, Teardown) + +EUNIT_TEST( + "RemoveReference - test ", + "CGlxMediaList", + "RemoveReference", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_RemoveReferenceL, Teardown) + +EUNIT_TEST( + "ReferenceCount - test ", + "CGlxMediaList", + "ReferenceCount", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_ReferenceCountL, Teardown) + +EUNIT_TEST( + "Equals - test ", + "CGlxMediaList", + "Equals", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_EqualsL, Teardown) + +EUNIT_TEST( + "OfferMedia - test ", + "CGlxMediaList", + "OfferMedia", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_OfferMediaL, Teardown) + +EUNIT_TEST( + "HandleAttributesAvailableL - test ", + "CGlxMediaList", + "HandleAttributesAvailableL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_HandleAttributesAvailableLL, Teardown) + +EUNIT_TEST( + "AttributeRequestL - test ", + "CGlxMediaList", + "AttributeRequestL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_AttributeRequestLL, Teardown) + +EUNIT_TEST( + "Close - test ", + "CGlxMediaList", + "Close", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_CloseL, Teardown) + +EUNIT_TEST( + "Id - test ", + "CGlxMediaList", + "Id", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_IdL, Teardown) + +EUNIT_TEST( + "Count - test ", + "CGlxMediaList", + "Count", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_CountL, Teardown) +*/ +EUNIT_TEST( + "FocusIndex - test ", + "CGlxMediaList", + "FocusIndex", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_FocusIndexL, Teardown) + +EUNIT_TEST( + "SetFocusL - test ", + "CGlxMediaList", + "SetFocusL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_SetFocusLL, Teardown) +/* +EUNIT_TEST( + "Item - test ", + "CGlxMediaList", + "Item", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_ItemL, Teardown) + +EUNIT_TEST( + "Index - test ", + "CGlxMediaList", + "Index", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_IndexL, Teardown) + +EUNIT_TEST( + "AddMediaListObserverL - test ", + "CGlxMediaList", + "AddMediaListObserverL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_AddMediaListObserverLL, Teardown) + +EUNIT_TEST( + "RemoveMediaListObserver - test ", + "CGlxMediaList", + "RemoveMediaListObserver", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_RemoveMediaListObserverL, Teardown) + +EUNIT_TEST( + "AddContextL - test ", + "CGlxMediaList", + "AddContextL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_AddContextLL, Teardown) + +EUNIT_TEST( + "RemoveContext - test ", + "CGlxMediaList", + "RemoveContext", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_RemoveContextL, Teardown) + +EUNIT_TEST( + "Collection - test ", + "CGlxMediaList", + "Collection", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_CollectionL, Teardown) +*/ +EUNIT_TEST( + "PathLC - test ", + "CGlxMediaList", + "PathLC", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_PathLCL, Teardown) + +EUNIT_TEST( + "IsSelected - test ", + "CGlxMediaList", + "IsSelected", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_IsSelectedL, Teardown) + +EUNIT_TEST( + "SetSelectedL - test ", + "CGlxMediaList", + "SetSelectedL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_SetSelectedLL, Teardown) + +EUNIT_TEST( + "SelectionCount - test ", + "CGlxMediaList", + "SelectionCount", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_SelectionCountL, Teardown) + +EUNIT_TEST( + "SelectedItemIndex - test ", + "CGlxMediaList", + "SelectedItemIndex", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_SelectedItemIndexL, Teardown) + +EUNIT_TEST( + "CommandL - test ", + "CGlxMediaList", + "CommandL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_CommandLL, Teardown) +/* +EUNIT_TEST( + "CancelCommand - test ", + "CGlxMediaList", + "CancelCommand", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_CancelCommandL, Teardown) +*/ +EUNIT_TEST( + "SetFilterL - test ", + "CGlxMediaList", + "SetFilterL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_SetFilterLL, Teardown) + +EUNIT_TEST( + "Filter - test ", + "CGlxMediaList", + "Filter", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_FilterL, Teardown) + +/** +EUNIT_TEST( + "HandleCollectionMessageL - test ", + "CGlxMediaList", + "HandleCollectionMessageL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_HandleCollectionMessageLL, Teardown) +/ +EUNIT_TEST( + "HandleOpenL - test ", + "CGlxMediaList", + "HandleOpenL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_HandleOpenLL, Teardown) + +EUNIT_TEST( + "HandleOpenL - test ", + "CGlxMediaList", + "HandleOpenL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_HandleOpenL_1L, Teardown) + +EUNIT_TEST( + "HandleCollectionMediaL - test ", + "CGlxMediaList", + "HandleCollectionMediaL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_HandleCollectionMediaLL, Teardown) + +EUNIT_TEST( + "HandleCollectionMessageL - test ", + "CGlxMediaList", + "HandleCollectionMessageL", + "FUNCTIONALITY", + SetupL, UT_CGlxMediaList_HandleCollectionMessageL_1L, Teardown) +*/ +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxmedialist/ut_cglxmedialist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxmedialist/ut_cglxmedialist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMediaList unit tests +* +*/ + + + + +#ifndef __UT_CGLXMEDIALIST_H__ +#define __UT_CGLXMEDIALIST_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "mglxmedialistobserver.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CGlxMediaList; +class CGlxDefaultAttributeContext; +class CActiveSchedulerWait; + +#include +#ifndef NONSHARABLE_CLASS + #define NONSHARABLE_CLASS(x) class x +#endif + +// CLASS DEFINITION +/** + * + * EUnitWizard generated test class. + * + */ +NONSHARABLE_CLASS( UT_CGlxMediaList ) + : public CEUnitTestSuiteClass, public MGlxMediaListObserver + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static UT_CGlxMediaList* NewL(); + static UT_CGlxMediaList* NewLC(); + /** + * Destructor + */ + ~UT_CGlxMediaList(); + + private: // Constructors and destructors + + UT_CGlxMediaList(); + void ConstructL(); + + public: // From observer interface + + // From MGlxMediaListObserver + virtual void HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/); + virtual void HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleItemModifiedL(const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleAttributesAvailableL(TInt /*aItemIndex*/, const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/); + virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleMessageL(const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) {}; + + private: // New methods + + void SetupL(); + + void Teardown(); + + void UT_CGlxMediaList_InstanceLL(); + + + void UT_CGlxMediaList_MediaListsL(); + + + void UT_CGlxMediaList_NewLCL(); + + + void UT_CGlxMediaList_OpenLL(); + + + void UT_CGlxMediaList_AddReferenceL(); + + + void UT_CGlxMediaList_RemoveReferenceL(); + + + void UT_CGlxMediaList_ReferenceCountL(); + + + void UT_CGlxMediaList_EqualsL(); + + + void UT_CGlxMediaList_OfferMediaL(); + + + void UT_CGlxMediaList_HandleAttributesAvailableLL(); + + + void UT_CGlxMediaList_AttributeRequestLL(); + + + void UT_CGlxMediaList_CloseL(); + + + void UT_CGlxMediaList_IdL(); + + + void UT_CGlxMediaList_CountL(); + + + void UT_CGlxMediaList_FocusIndexL(); + + + void UT_CGlxMediaList_SetFocusLL(); + + + void UT_CGlxMediaList_ItemL(); + + + void UT_CGlxMediaList_IndexL(); + + + void UT_CGlxMediaList_AddMediaListObserverLL(); + + + void UT_CGlxMediaList_RemoveMediaListObserverL(); + + + void UT_CGlxMediaList_AddContextLL(); + + + void UT_CGlxMediaList_RemoveContextL(); + + + void UT_CGlxMediaList_CollectionL(); + + + void UT_CGlxMediaList_PathLCL(); + + + void UT_CGlxMediaList_IsSelectedL(); + + + void UT_CGlxMediaList_SetSelectedLL(); + + + void UT_CGlxMediaList_SelectionCountL(); + + + void UT_CGlxMediaList_SelectedItemIndexL(); + + + void UT_CGlxMediaList_CommandLL(); + + + void UT_CGlxMediaList_CancelCommandL(); + + + void UT_CGlxMediaList_SetFilterLL(); + + + void UT_CGlxMediaList_FilterL(); + + + void UT_CGlxMediaList_HandleOpenLL(); + + + void UT_CGlxMediaList_HandleOpenL_1L(); + + + void UT_CGlxMediaList_HandleCollectionMediaLL(); + + + void UT_CGlxMediaList_HandleCollectionMessageL_1L(); + + void SetupFocusTestL(); + void SetupPathTestL(); + void SetupSelectionTestL(); + void SetupFilterTestL(); + + void MoveFocusAbsoluteGreaterThanCurrentFocusL(); + void MoveFocusAbsoluteLessThanCurrentFocusL(); + void MoveFocusRelativeForwardL(); + void MoveFocusRelativeBackwardL(); + void MoveFocusRelativeForwardGreaterThanListCountL(); + void MoveFocusRelativeBackwardLessThanZeroL(); + + void ReceiveMessageItemChangedItemModifiedL(); + + private: // Data + CGlxMediaList* iCGlxMediaList; + CGlxDefaultAttributeContext* iContext; + + CActiveSchedulerWait* iSchedulerWait; + + EUNIT_DECLARE_TEST_TABLE; + + private: + + // Test media list observer + class CGlxMediaListObserverTest : public CBase, public MGlxMediaListObserver + { + public: + static CGlxMediaListObserverTest* NewL(); + + virtual ~CGlxMediaListObserverTest(); + + // From MGlxMediaListObserver + virtual void HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleItemModifiedL(const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/); + virtual void HandleAttributesAvailableL(TInt /*aItemIndex*/, const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + virtual void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/) {}; + virtual void HandleMessageL(const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/); + + const MGlxMediaList* List() { return iList; }; + + // HandleFocusChangedL observations + NGlxListDefs::TFocusChangeType FocusChangeType() { return iFocusChangeType; }; + TInt FocusNewIndex() { return iFocusNewIndex; }; + TInt FocusOldIndex() { return iFocusOldIndex; }; + + // HandleItemModifiedL observations + const RArray& ModifiedItemIndices() { return iModifiedItemIndices; }; + + // HandleMessageL observations + const CMPXMessage* Message() { return iMessage; }; + TInt MessageCount() { return iMessageCount; }; + + private: + CGlxMediaListObserverTest(); + void ConstructL(); + + private: + MGlxMediaList* iList; + + // data from HandleFocusChangedL + NGlxListDefs::TFocusChangeType iFocusChangeType; + TInt iFocusNewIndex; + TInt iFocusOldIndex; + + // data from HandleItemModifiedL + RArray iModifiedItemIndices; + + // data from HandleMessageL + CMPXMessage* iMessage; + TInt iMessageCount; + }; + }; + +#endif // __UT_CGLXMEDIALIST_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxmedialist/ut_cglxmedialistdllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxmedialist/ut_cglxmedialistdllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CGlxMediaList unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxmedialist.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return UT_CGlxMediaList::NewL(); + } + + + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxnavigablelist/ut_cglxnavigablelist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxnavigablelist/ut_cglxnavigablelist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,992 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +// CLASS HEADER +#include "ut_CGlxNavigableList.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxnavigablelist.h" + +using namespace NGlxListDefs; + +const TNotification::TData KNotificationsList_Empty[] = { { END_MARKER } }; + +// ----------------------------------------------------------------------------- +// Constructors +// ----------------------------------------------------------------------------- +// +CGlxNavigableListReconstruction* CGlxNavigableListReconstruction::NewL( TInt aReservationCount ) + { + CGlxNavigableListReconstruction* self = new (ELeave) CGlxNavigableListReconstruction(); + CleanupStack::PushL( self ); + self->ConstructL( aReservationCount ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Test if reconstruction equals original +// ----------------------------------------------------------------------------- +// +TBool CGlxNavigableListReconstruction::ReconstructionEquals() const + { + // test items + TBool fail = !ItemsEqual(); + // test focus + fail |= ( iList->FocusIndex() != iFocusIndex ); + // test selection + fail |= !SelectionEquals(); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test if reconstruction of selection equals original +// ----------------------------------------------------------------------------- +// +TBool CGlxNavigableListReconstruction::SelectionEquals() const + { + TBool fail = ( iList->SelectedItemIndices().Count() != iSelectedItemIndices.Count() ); + + // Don't assume order in arrays is the same: make sure all items in replica + // exist in original, and all items in original are in replica + for ( TInt i = 0; i < iSelectedItemIndices.Count(); i++ ) + { + // Try to find replica index from original + fail |= ( KErrNotFound == FindInOriginalSelection( iSelectedItemIndices[ i ] ) ); + } + + for ( TInt i = 0; i < iList->SelectedItemIndices().Count(); i++ ) + { + fail |= ( KErrNotFound == iSelectedItemIndices.Find( iList->SelectedItemIndices()[ i ] ) ); + } + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Return index of selected item index in original list +// ----------------------------------------------------------------------------- +// +TInt CGlxNavigableListReconstruction::FindInOriginalSelection( TInt aSelectionIndex ) const + { + TInt i = 0; + while ( i < iList->SelectedItemIndices().Count() ) + { + TInt originalIndex = iList->SelectedItemIndices()[ i ]; + if ( originalIndex == aSelectionIndex ) + { + return i; // Found it + } + i++; + } + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// Constructors & destructors +// ----------------------------------------------------------------------------- +// +ut_CGlxNavigableList* ut_CGlxNavigableList::NewL() + { + ut_CGlxNavigableList* self = ut_CGlxNavigableList::NewLC(); + CleanupStack::Pop(); + + return self; + } + +ut_CGlxNavigableList* ut_CGlxNavigableList::NewLC() + { + ut_CGlxNavigableList* self = new( ELeave ) ut_CGlxNavigableList(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +ut_CGlxNavigableList::~ut_CGlxNavigableList() + { + } + +// Default constructor +ut_CGlxNavigableList::ut_CGlxNavigableList() + { + } + +// Second phase construct +void ut_CGlxNavigableList::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// Setup & Teardown +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::SetupL( ) + { + } + +void ut_CGlxNavigableList::Teardown( ) + { + DeleteMembers(); + } + +// ----------------------------------------------------------------------------- +// Test FocusIndex(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_FocusIndexL( ) + { + CreateListL( _L8("") ); + EUNIT_ASSERT ( KErrNotFound == iList->FocusIndex() ); + CreateListL( _L8("ab") ); + EUNIT_ASSERT ( 0 == iList->FocusIndex() ); + iList->SetFocus( EAbsolute, 1 ); + EUNIT_ASSERT ( 1 == iList->FocusIndex() ); + } + +// ----------------------------------------------------------------------------- +// TrySetFocusL +// ----------------------------------------------------------------------------- +// +TBool ut_CGlxNavigableList::TrySetFocusL( const TDesC8& aContents, + TInt aInitialFocus, TFocusSetType aFocusSetType, + TInt aFocusValue, TInt aExpectedFocus, + const TNotification::TData* aNotificationList ) + { + CreateListL( aContents ); + // We need to set the focus to aInitialFocus only if it's valid + if ( KErrNotFound != aInitialFocus ) + { + iList->SetFocus( EAbsolute, aInitialFocus ); + } + iReconstruction->ClearNotifications(); + // Set focus + iList->SetFocus( aFocusSetType, aFocusValue ); + TBool fail = ( iList->FocusIndex() != aExpectedFocus ); + fail |= !iReconstruction->ReconstructionEquals(); + fail |= !iReconstruction->NotificationListEquals( aNotificationList ); + return !fail; + + } + +// ----------------------------------------------------------------------------- +// Test SetFocus(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_SetFocusL( ) + { + { // Test setting focus to same index + // absolute + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 1, EAbsolute, 1, + 1, KNotificationsList_Empty ) ); + // relative + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 1, ERelative, 0, + 1, KNotificationsList_Empty ) ); + } + + { // Test setting focus to another index + TNotification::TData notifications[] = + { { END_MARKER } }; + // absolute + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 1, EAbsolute, 1, + 1, notifications ) ); + // relative + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 1, ERelative, 0, + 1, notifications ) ); + } + + { // Test setting focus to directly another index + TNotification::TData notifications[] = + { { TNotification::EFocus, 0, EUnknown }, // type, old focus, focus change type + { END_MARKER } }; + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 0, EAbsolute, 1, + 1, notifications ) ); + } + + // Test moving focus + { // Non-looping, 0 > 2 + TNotification::TData notifications[] = + { { TNotification::EFocus, 0, EForward }, // type, old focus, focus change type + { END_MARKER } }; + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 0, ERelative, 2, + 2, notifications ) ); + } + + { // Non-looping, 1 > 4 + TNotification::TData notifications[] = + { { TNotification::EFocus, 1, EForward }, // type, old focus, focus change type + { END_MARKER } }; + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 1, ERelative, 3, + 4, notifications ) ); + } + + { // Non-looping, 4 > 0 + TNotification::TData notifications[] = + { { TNotification::EFocus, 4, EBackward }, // type, old focus, focus change type + { END_MARKER } }; + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 4, ERelative, -4, + 0, notifications ) ); + } + + { // Looping, 4 > 0 + TNotification::TData notifications[] = + { { TNotification::EFocus, 4, EForward }, // type, old focus, focus change type + { END_MARKER } }; + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 4, ERelative, 1, + 0, notifications ) ); + } + + { // Looping, 2 > 3 + TNotification::TData notifications[] = + { { TNotification::EFocus, 2, EForward }, // type, old focus, focus change type + { END_MARKER } }; + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 2, ERelative, 6, + 3, notifications ) ); + } + + { // Looping, 3 > 2 + TNotification::TData notifications[] = + { { TNotification::EFocus, 3, EBackward }, // type, old focus, focus change type + { END_MARKER } }; + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 3, ERelative, -1, + 2, notifications ) ); + } + + { // Looping, 2 > 2 + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 2, ERelative, 5, + 2, KNotificationsList_Empty ) ); + } + + { // Looping, 2 > 2 + EUNIT_ASSERT ( TrySetFocusL( _L8("abcde"), 2, ERelative, -5, + 2, KNotificationsList_Empty ) ); + } + + { // empty list + EUNIT_ASSERT ( TrySetFocusL( _L8(""), -1, ERelative, -5, + -1, KNotificationsList_Empty ) ); + } + + } + +// ----------------------------------------------------------------------------- +// Test IsSelected(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_IsSelectedL( ) + { + CreateListL( _L8("abcde") ); + EUNIT_ASSERT( !iList->IsSelected( 0 ) ); + EUNIT_ASSERT( !iList->IsSelected( 1 ) ); + EUNIT_ASSERT( !iList->IsSelected( 2 ) ); + EUNIT_ASSERT( !iList->IsSelected( 3 ) ); + EUNIT_ASSERT( !iList->IsSelected( 4 ) ); + iList->SetSelectedL( 3, ETrue ); + iList->SetSelectedL( 0, ETrue ); + iList->SetSelectedL( 4, ETrue ); + EUNIT_ASSERT( iList->IsSelected( 0 ) ); + EUNIT_ASSERT( !iList->IsSelected( 1 ) ); + EUNIT_ASSERT( !iList->IsSelected( 2 ) ); + EUNIT_ASSERT( iList->IsSelected( 3 ) ); + EUNIT_ASSERT( iList->IsSelected( 4 ) ); + } + +// ----------------------------------------------------------------------------- +// SetSelectedL(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::SetSelectedL( const TDesC8& aSelection ) + { + for ( TInt i = 0; i < aSelection.Length(); i++ ) + { + iList->SetSelectedL( i, 't' == aSelection[ i ] ); + } + } + +// ----------------------------------------------------------------------------- +// SelectionEquals(...) +// ----------------------------------------------------------------------------- +// +TBool ut_CGlxNavigableList::SelectionEquals( const TDesC8& aSelection ) const + { + // aSelection should have a flag for each item in the list + TBool fail = ( iList->Count() != aSelection.Length() ); + TInt selectedItemCount = 0; + for ( TInt i = 0; i < aSelection.Length(); i++ ) + { + TBool shouldBeSelected = 't' == aSelection[ i ]; + if ( shouldBeSelected ) + { + selectedItemCount++; + } + // Compare via not, to make sure true is always the same value + fail |= ( !iList->IsSelected( i ) != !shouldBeSelected ); + } + // Make sure there are no additional items selected + fail |= ( iList->SelectedItemIndices().Count() != selectedItemCount ); + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test SetSelectedL(...) +// ----------------------------------------------------------------------------- +// +TBool ut_CGlxNavigableList::TrySetSelectedL( const TDesC8& aContents, + const TDesC8& aInitialSelection, const TDesC8& aFinalSelection, + TBool aSelect, TInt aIndex, + const TNotification::TData* aNotificationList ) + { + CreateListL( aContents ); + // set initial selection + SetSelectedL( aInitialSelection ); + iReconstruction->ClearNotifications(); + // run test + iList->SetSelectedL( aIndex, aSelect ); + + // Check item is selected/unselected as expected + TBool fail = EFalse; + if ( aSelect ) + { + fail |= !iList->IsSelected( aIndex ); + } + else + { + fail |= iList->IsSelected( aIndex ); + } + // Test selection matches + fail |= SelectionEquals( aFinalSelection ); + // Test reconstruction matched + fail |= !iReconstruction->ReconstructionEquals(); + // Test notification equal + fail |= !iReconstruction->NotificationListEquals( aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test SetSelectedL(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_SetSelectedLL( ) + { + { // Select first item + TNotification::TData notifications[] = + { { TNotification::ESelection, 0, ETrue }, + { END_MARKER } }; + TrySetSelectedL( _L8("abcde"), _L8("fffff"), _L8("tffff"), ETrue, 0, + notifications ); + } + + { // Select another item + TNotification::TData notifications[] = + { { TNotification::ESelection, 3, ETrue }, + { END_MARKER } }; + TrySetSelectedL( _L8("abcde"), _L8("tfftf"), _L8("tfttf"), ETrue, 3, + notifications ); + } + + { // Select a selected item + TrySetSelectedL( _L8("abcde"), _L8("tfftf"), _L8("tfftf"), ETrue, 0, + KNotificationsList_Empty ); + } + + { // Unselect item + TNotification::TData notifications[] = + { { TNotification::ESelection, 4, EFalse }, + { END_MARKER } }; + TrySetSelectedL( _L8("abcde"), _L8("tfftf"), _L8("tffff"), EFalse, 4, + notifications ); + } + + { // Unselect last item + TNotification::TData notifications[] = + { { TNotification::ESelection, 0, EFalse }, + { END_MARKER } }; + TrySetSelectedL( _L8("abcde"), _L8("tffff"), _L8("fffff"), EFalse, 0, + notifications ); + } + + { // Unselect an unselected item + TrySetSelectedL( _L8("abcde"), _L8("tftff"), _L8("tftff"), EFalse, 4, + KNotificationsList_Empty ); + } + + { // Try to select static items + // Add a static item at front, and two at rear + NGlxListTestHelpers::TStaticItemInfo::TData staticItemInfos[] = + { { '0', EInsertFirst }, + { '1', EInsertLast }, + { '2', EInsertLast }, + { K_STATIC_ITEMS_END } }; + + CreateListL( _L8("abcde"), ETrue, staticItemInfos ); + iList->SetSelectedL( 0, ETrue ); // static item + iList->SetSelectedL( 1, ETrue ); // normal item + iList->SetSelectedL( 6, ETrue ); // static item + iList->SetSelectedL( 7, ETrue ); // static item + TNotification::TData notifications[] = + { { TNotification::ESelection, 1, ETrue }, + { END_MARKER } }; + // Test selection matches + TBool fail = !SelectionEquals( _L8("ftffffff") ); + // Test reconstruction matched + fail |= !iReconstruction->ReconstructionEquals(); + // Test notification equal + fail |= !iReconstruction->NotificationListEquals( notifications); + EUNIT_ASSERT( !fail ); + } + } + +// ----------------------------------------------------------------------------- +// Test SelectedItemIndices(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_SelectedItemIndicesL( ) + { + CreateListL( _L8("abcde") ); + EUNIT_ASSERT( iList->SelectedItemIndices().Count() == 0 ); + iList->SetSelectedL( 3, ETrue ); + iList->SetSelectedL( 0, ETrue ); + iList->SetSelectedL( 4, ETrue ); + EUNIT_ASSERT( iList->SelectedItemIndices().Count() == 3 ); + // This test code assumes indexes are ordered, but this is not a requirement + // for navigable list. So if ordering navigable list is modified, this may + // need changing also + EUNIT_ASSERT( iList->SelectedItemIndices()[ 0 ] == 0 ); + EUNIT_ASSERT( iList->SelectedItemIndices()[ 1 ] == 3 ); + EUNIT_ASSERT( iList->SelectedItemIndices()[ 2 ] == 4 ); + } + +// ----------------------------------------------------------------------------- +// TrySetContentsL(...) +// ----------------------------------------------------------------------------- +// +TBool ut_CGlxNavigableList::TrySetContentsL( const TDesC8& aStringBefore, + const TDesC8& aStringAfter, TBool aFocusBefore, TBool aFocusAfter, + const TDesC8& aSelectionBefore, const TDesC8& aSelectionAfter, + const TNotification::TData* aNotificationList ) + { + CreateListL( aStringBefore ); + SetSelectedL( aSelectionBefore ); + if ( KErrNotFound != aFocusBefore ) + { + iList->SetFocus( EAbsolute, aFocusBefore ); + } + iReconstruction->ClearNotifications(); + + // Run function under test + SetContentsL( aStringAfter ); + + // Test reconstruction matched + TBool fail = !Equals( aStringAfter ); + // Test focus matches + fail |= ( iList->FocusIndex() != aFocusAfter ); + // Test selection matches + fail |= !SelectionEquals( aSelectionAfter ); + // Test notification equal + fail |= !iReconstruction->NotificationListEquals( aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test SetContentsL(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_SetContentsLL( ) + { + // Set no contents to empty list + { + EUNIT_ASSERT( TrySetContentsL( _L8(""), _L8(""), KErrNotFound, KErrNotFound, + _L8(""), _L8(""), KNotificationsList_Empty ) ); + } + + // Set contents to empty list + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8(""), _L8("abcde"), KErrNotFound, 0, + _L8(""), _L8("fffff"), notifications ) ); + } + + // Set contents so that focus is before insertion point + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 3, 4 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("abc0123de"), 2, 2, + _L8("tfttf"), _L8("tftfffftf"), notifications ) ); + } + // Set contents so that focus is after insertion point + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 2, 4 }, + { TNotification::EFocus, 2, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("ab0123cde"), 2, 6, + _L8("ftftf"), _L8("ftffffftf"), notifications ) ); + } + // Set contents so that focus is before removed items + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 2, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("abe"), 1, 1, + _L8("ftttf"), _L8("ftf"), notifications ) ); + + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("abe"), 0, 0, + _L8("ttttt"), _L8("ttt"), notifications ) ); + } + // Set contents so that focus is after removed items + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 2, 2 }, + { TNotification::EFocus, 4, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("abe"), 4, 2, // focus on e + _L8("ffttf"), _L8("fff"), notifications ) ); + } + // Set contents so that focus is on removed items, item before exists + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 2, 2 }, + { TNotification::EFocus, 3, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("abe"), 3, 1, // Focus from d to b + _L8("fffff"), _L8("fff"), notifications ) ); + } + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 2, 2 }, + { TNotification::EFocus, 2, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("abe"), 2, 1, // Focus from c to b + _L8("fffff"), _L8("fff"), notifications ) ); + } + // Set contents so that focus is on removed items, item before does not exist + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 2 }, + { TNotification::EFocus, 0, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("cde"), 0, 0, // Focus from a to c + _L8("fffff"), _L8("fff"), notifications ) ); + } + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 2 }, + { TNotification::EFocus, 1, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("cde"), 1, 0, // Focus from b to c + _L8("fffff"), _L8("fff"), notifications ) ); + } + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 2 }, + { TNotification::EFocus, 2, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("cde"), 2, 0, // Focus on c + _L8("fffff"), _L8("fff"), notifications ) ); + } + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 2 }, + { TNotification::EFocus, 3, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("cde"), 3, 1, // Focus on d + _L8("fffff"), _L8("fff"), notifications ) ); + } + // Set contents to empty + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 1, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8(""), 1, KErrNotFound, // focus initially on b + _L8("fffff"), _L8(""), notifications ) ); + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8(""), 1, KErrNotFound, // focus initially on b + _L8("ttttt"), _L8(""), notifications ) ); + } + // Set contents so items get replaced + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 2, 2 }, + { TNotification::EFocus, 3, EUnknown }, + { TNotification::EAdd, 2, 4 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL( _L8("abcde"), _L8("ab0123e"), 3, 1, // focus d to b + _L8("fttft"), _L8("ftfffft"), notifications ) ); + } + // Set contents so that some selected items stay, some move and some are removed + } + +// ----------------------------------------------------------------------------- +// TryReorderContentsL(...) +// ----------------------------------------------------------------------------- +// +TBool ut_CGlxNavigableList::TryReorderContentsL( const TDesC8& aStringBefore, + const TDesC8& aStringAfter, TBool aFocusBefore, TBool aFocusAfter, + const TDesC8& aSelectionBefore, const TDesC8& aSelectionAfter, + const TNotification::TData* aNotificationList ) + { + CreateListL( aStringBefore ); + SetSelectedL( aSelectionBefore ); + if ( KErrNotFound != aFocusBefore ) + { + iList->SetFocus( EAbsolute, aFocusBefore ); + } + iReconstruction->ClearNotifications(); + + // Run function under test + ReorderContentsL( aStringAfter ); + + // Test reconstruction matched + TBool fail = !Equals( aStringAfter ); + // Test focus matches + fail |= ( iList->FocusIndex() != aFocusAfter ); + // Test selection matches + fail |= !SelectionEquals( aSelectionAfter ); + // Test notification equal + fail |= !iReconstruction->NotificationListEquals( aNotificationList ); + + return !fail; + } + +// ----------------------------------------------------------------------------- +// Test ReorderContentsL(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_ReorderContentsLL( ) + { + // Reorder no contents from empty list + { + EUNIT_ASSERT( TryReorderContentsL( _L8(""), _L8(""), KErrNotFound, KErrNotFound, + _L8(""), _L8(""), KNotificationsList_Empty ) ); + } + + // Reorder contents from empty list + { + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8(""), _L8("abcde"), KErrNotFound, 0, + _L8(""), _L8("fffff"), notifications ) ); + } + + // Reorder contents so that focus is unchanged + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8("abcde"), 0, 0, + _L8("fffff"), _L8("fffff"), notifications ) ); + } + + // Reorder contents so that focus is changed + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { TNotification::EFocus, 0, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8("bcdea"), 0, 4, + _L8("fffff"), _L8("fffff"), notifications ) ); + } + + // Reorder contents so that focus is lost + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::EAdd, 0, 4 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8("bcde"), 0, 0, + _L8("fffff"), _L8("ffff"), notifications ) ); + } + + // Reorder contents so that selection is unchanged + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { TNotification::ESelection, 0, ETrue }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8("abcde"), 0, 0, + _L8("tffff"), _L8("tffff"), notifications ) ); + } + + // Reorder contents so that selection is changed + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::ESelection, 4, ETrue }, + { TNotification::ESelection, 1, ETrue }, + { TNotification::ESelection, 3, ETrue }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8("bcdea"), 0, 4, + _L8("tftft"), _L8("ftftt"), notifications ) ); + } + + // Reorder contents so that selection is lost + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { TNotification::ESelection, 0, ETrue }, + { TNotification::ESelection, 2, ETrue }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8("abcd0"), 0, 0, + _L8("tftft"), _L8("tftff"), notifications ) ); + } + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { TNotification::EAdd, 0, 5 }, + { TNotification::EFocus, KErrNotFound, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8("a0123"), 0, 0, + _L8("ftttt"), _L8("fffff"), notifications ) ); + } + + // Reorder contents to empty + { + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 5 }, + { TNotification::EFocus, 0, EUnknown }, + { END_MARKER } }; + EUNIT_ASSERT( TryReorderContentsL( _L8("abcde"), _L8(""), 0, KErrNotFound, + _L8("ttttt"), _L8(""), notifications ) ); + } + } + +// ----------------------------------------------------------------------------- +// Test RemoveReference(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_RemoveReferenceL( ) + { + TestRemoveReferenceL(); + } + +// ----------------------------------------------------------------------------- +// Test Remove(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_RemoveL( ) + { + } + +// ----------------------------------------------------------------------------- +// Test AddStaticItemL(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_AddStaticItemLL( ) + { + } + +// ----------------------------------------------------------------------------- +// Test SetStaticItemsEnabled(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_SetStaticItemsEnabledL( ) + { + } + +// ----------------------------------------------------------------------------- +// Test Count(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_CountL( ) + { + TestCountL(); + } + +// ----------------------------------------------------------------------------- +// Test Item(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_ItemL( ) + { + TestItemL(); + } + +// ----------------------------------------------------------------------------- +// Test Index(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_IndexL( ) + { + TestIndexL(); + } + +// ----------------------------------------------------------------------------- +// Test IdSpaceId +// ----------------------------------------------------------------------------- +// +void ut_CGlxNavigableList::T_IdSpaceIdL() + { + TestIdSpaceIdL(); + } + +// ----------------------------------------------------------------------------- +// Test table +// ----------------------------------------------------------------------------- +// +EUNIT_BEGIN_TEST_TABLE( + ut_CGlxNavigableList, + "Add test suite description here.", + "UNIT" ) + +/*EUNIT_TEST( + "SetContentsL", + "CGlxNavigableList", + "SetContentsL", + "FUNCTIONALITY", + SetupL, T_SetContentsLL, Teardown)*/ + +/*EUNIT_TEST( + "ReorderContentsL", + "CGlxNavigableList", + "ReorderContentsL", + "FUNCTIONALITY", + SetupL, T_ReorderContentsLL, Teardown)*/ + +EUNIT_TEST( + "Remove", + "CGlxNavigableList", + "Remove", + "FUNCTIONALITY", + SetupL, T_RemoveL, Teardown) + +EUNIT_TEST( + "RemoveReference", + "CGlxNavigableList", + "RemoveReference", + "FUNCTIONALITY", + SetupL, T_RemoveReferenceL, Teardown) + +EUNIT_TEST( + "AddStaticItemL", + "CGlxNavigableList", + "AddStaticItemL", + "FUNCTIONALITY", + SetupL, T_AddStaticItemLL, Teardown) + +EUNIT_TEST( + "SetStaticItemsEnabled", + "CGlxNavigableList", + "SetStaticItemsEnabled", + "FUNCTIONALITY", + SetupL, T_SetStaticItemsEnabledL, Teardown) + +EUNIT_TEST( + "Count", + "CGlxNavigableList", + "Count", + "FUNCTIONALITY", + SetupL, T_CountL, Teardown) + +EUNIT_TEST( + "FocusIndex", + "CGlxNavigableList", + "FocusIndex", + "FUNCTIONALITY", + SetupL, T_FocusIndexL, Teardown) + +/*EUNIT_TEST( + "SetFocus", + "CGlxNavigableList", + "SetFocus", + "FUNCTIONALITY", + SetupL, T_SetFocusL, Teardown)*/ + +EUNIT_TEST( + "Item", + "CGlxNavigableList", + "Item", + "FUNCTIONALITY", + SetupL, T_ItemL, Teardown) + +EUNIT_TEST( + "Index", + "CGlxNavigableList", + "Index", + "FUNCTIONALITY", + SetupL, T_IndexL, Teardown) + +EUNIT_TEST( + "IsSelected", + "CGlxNavigableList", + "IsSelected", + "FUNCTIONALITY", + SetupL, T_IsSelectedL, Teardown) + +EUNIT_TEST( + "SetSelectedL", + "CGlxNavigableList", + "SetSelectedL", + "FUNCTIONALITY", + SetupL, T_SetSelectedLL, Teardown) + +EUNIT_TEST( + "SelectedItemIndices", + "CGlxNavigableList", + "SelectedItemIndices", + "FUNCTIONALITY", + SetupL, T_SelectedItemIndicesL, Teardown) + +EUNIT_TEST( + "IdSpaceId", + "CGlxNavigableList", + "IdSpaceId", + "FUNCTIONALITY", + SetupL, T_IdSpaceIdL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxnavigablelist/ut_cglxnavigablelist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxnavigablelist/ut_cglxnavigablelist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +#ifndef __UT_CGLXNAVIGABLELIST_H__ +#define __UT_CGLXNAVIGABLELIST_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxnavigablelist.h" +#include "glxlistreconstruction.h" +#include "glxlisttestbase.h" + +// FORWARD DECLARATIONS + +/** + * Reconstruction of a navigable item list + */ +NONSHARABLE_CLASS( CGlxNavigableListReconstruction ) : public CGlxListReconstruction< CGlxNavigableList > + { + public: + static CGlxNavigableListReconstruction* NewL( TInt aReservationCount = 400 ); + // From CGlxListReconstructionBase + TBool ReconstructionEquals() const; + + private: + TBool SelectionEquals() const; + TInt FindInOriginalSelection( TInt aSelectionIndex ) const; + }; + +/** + * EUnit test suite + */ +NONSHARABLE_CLASS( ut_CGlxNavigableList ) : + public CGlxListTestBase< CGlxNavigableList, CGlxNavigableListReconstruction > + { + public: // Constructors and destructors + /** + * Two phase construction + */ + static ut_CGlxNavigableList* NewL(); + static ut_CGlxNavigableList* NewLC(); + /** + * Destructor + */ + ~ut_CGlxNavigableList(); + + private: // Constructors and destructors + ut_CGlxNavigableList(); + void ConstructL(); + + private: // New methods + void SetupL(); + void Teardown(); + + void T_SetContentsLL(); + void T_ReorderContentsLL(); + void T_RemoveL(); + void T_RemoveReferenceL(); + void T_AddStaticItemLL(); + void T_SetStaticItemsEnabledL(); + void T_CountL(); + void T_FocusIndexL(); + void T_SetFocusL(); + void T_ItemL(); + void T_IndexL(); + void T_IsSelectedL(); + void T_SetSelectedLL(); + void T_SelectedItemIndicesL(); + void T_IdSpaceIdL(); + + TBool TrySetFocusL( const TDesC8& aContents, TInt aInitialFocus, + NGlxListDefs::TFocusSetType aFocusSetType, TInt aFocusValue, TInt aExpectedFocus, + const TNotification::TData* aNotificationList ); + + TBool TrySetContentsL( const TDesC8& aStringBefore, + const TDesC8& aStringAfter, TBool aFocusBefore, TBool aFocusAfter, + const TDesC8& aSelectionBefore, const TDesC8& aSelectionAfter, + const TNotification::TData* aNotificationList ); + + TBool TryReorderContentsL( const TDesC8& aStringBefore, + const TDesC8& aStringAfter, TBool aFocusBefore, TBool aFocusAfter, + const TDesC8& aSelectionBefore, const TDesC8& aSelectionAfter, + const TNotification::TData* aNotificationList ); + + TBool TrySetSelectedL( const TDesC8& aContents, + const TDesC8& aInitialSelection, const TDesC8& aFinalSelection, + TBool aSelect, TInt aIndex, const TNotification::TData* aNotificationList ); + + void SetSelectedL( const TDesC8& aSelection ); + TBool SelectionEquals( const TDesC8& aSelection ) const; + + private: // Data + + EUNIT_DECLARE_TEST_TABLE; + + }; + +#endif // __UT_CGLXNAVIGABLELIST_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxnavigablelist/ut_cglxnavigablelist_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxnavigablelist/ut_cglxnavigablelist_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests, entry point +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxnavigablelist.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return ut_CGlxNavigableList::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxstaticitemlist/ut_cglxstaticitemlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxstaticitemlist/ut_cglxstaticitemlist.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,656 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxstaticitemlist.h" + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxstaticitemlist.h" +#include "_glxlisttesthelpers.h" + +using namespace NGlxListDefs; + +// Add no static items +NGlxListTestHelpers::TStaticItemInfo::TData info_add_none[] = + { { K_STATIC_ITEMS_END } }; + +// Add a static item at front +NGlxListTestHelpers::TStaticItemInfo::TData info_add_front_0[] = + { { '0', NGlxListDefs::EInsertFirst }, + { K_STATIC_ITEMS_END } }; + +// Add a static item at front +NGlxListTestHelpers::TStaticItemInfo::TData info_add_rear_0[] = + { { '0', NGlxListDefs::EInsertLast }, + { K_STATIC_ITEMS_END } }; + +// Add two static items at front +NGlxListTestHelpers::TStaticItemInfo::TData info_add_front_01[] = + { { '1', NGlxListDefs::EInsertFirst }, + { '0', NGlxListDefs::EInsertFirst }, + { K_STATIC_ITEMS_END } }; + + +// Add two static items at front +NGlxListTestHelpers::TStaticItemInfo::TData info_add_front_0_rear_12[] = + { { '0', NGlxListDefs::EInsertFirst }, + { '1', NGlxListDefs::EInsertLast }, + { '2', NGlxListDefs::EInsertLast }, + { K_STATIC_ITEMS_END } }; + +// ----------------------------------------------------------------------------- +// Constructors +// ----------------------------------------------------------------------------- +// +CGlxStaticItemListReconstruction* CGlxStaticItemListReconstruction::NewL( TInt aReservationCount ) + { + CGlxStaticItemListReconstruction* self = new (ELeave) CGlxStaticItemListReconstruction(); + CleanupStack::PushL( self ); + self->ConstructL( aReservationCount ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Reconstruction +// ----------------------------------------------------------------------------- +// +TBool CGlxStaticItemListReconstruction::ReconstructionEquals() const + { + return ItemsEqual(); + } + +// ----------------------------------------------------------------------------- +// Constructors & destructors +// ----------------------------------------------------------------------------- +// +ut_CGlxStaticItemList* ut_CGlxStaticItemList::NewL() + { + ut_CGlxStaticItemList* self = ut_CGlxStaticItemList::NewLC(); + CleanupStack::Pop(); + + return self; + } + +ut_CGlxStaticItemList* ut_CGlxStaticItemList::NewLC() + { + ut_CGlxStaticItemList* self = new( ELeave ) ut_CGlxStaticItemList(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +ut_CGlxStaticItemList::~ut_CGlxStaticItemList() + { + } + +// Default constructor +ut_CGlxStaticItemList::ut_CGlxStaticItemList() + { + } + +// Second phase construct +void ut_CGlxStaticItemList::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// Setup & Teardown +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::SetupL( ) + { + } + + +void ut_CGlxStaticItemList::Teardown( ) + { + DeleteMembers(); + } + +// ----------------------------------------------------------------------------- +// Test SetContentsL(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_SetContentsLL( ) + { + TNotification::TData notificationsStaticItemsDisabled[] = + { { TNotification::ERemove, 0, 1 }, // a + { TNotification::EAdd, 0, 3 }, // ABC + { TNotification::EAdd, 4, 2 }, // DE + { TNotification::ERemove, 7, 1 }, // d + { TNotification::ERemove, 8, 2 }, // fg + { TNotification::EAdd, 8, 3 }, // FGH + { END_MARKER } }; + TNotification::TData notificationsStaticItemsEnabled[] = + { { TNotification::ERemove, 1, 1 }, // a + { TNotification::EAdd, 1, 3 }, // ABC + { TNotification::EAdd, 5, 2 }, // DE + { TNotification::ERemove, 8, 1 }, // d + { TNotification::ERemove, 9, 2 }, // fg + { TNotification::EAdd, 9, 3 }, // FGH + { END_MARKER } }; + EUNIT_ASSERT( TrySetContentsL ( _L8("abcdefg"), // original list + _L8("ABCbDEceFGH"), // new list + _L8("0ABCbDEceFGH12"), // new list with static items + notificationsStaticItemsEnabled, + notificationsStaticItemsDisabled, + info_add_front_0_rear_12 ) ); + } + +// ----------------------------------------------------------------------------- +// Test RemoveReference(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_RemoveReferenceL( ) + { + TestRemoveReferenceL(); + } + +// ----------------------------------------------------------------------------- +// Test Remove(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_RemoveL() + { + { // Test removing first item + TNotification::TData notificationStaticItemsDisabled[] = + { { TNotification::ERemove, 0, 1 }, + { END_MARKER } }; + TNotification::TData notificationStaticItemsEnabled[] = + { { TNotification::ERemove, 1, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + 'a', EFalse, + _L8("bcdefg"), + _L8("0bcdefg12"), + notificationStaticItemsDisabled, + notificationStaticItemsEnabled, + info_add_front_0_rear_12 ) ); + } + + { // Test removing middle item + TNotification::TData notificationStaticItemsDisabled[] = + { { TNotification::ERemove, 2, 1 }, + { END_MARKER } }; + TNotification::TData notificationStaticItemsEnabled[] = + { { TNotification::ERemove, 3, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + 'c', EFalse, + _L8("abdefg"), + _L8("0abdefg12"), + notificationStaticItemsDisabled, + notificationStaticItemsEnabled, + info_add_front_0_rear_12 ) ); + } + + { // Test removing last item + TNotification::TData notificationStaticItemsDisabled[] = + { { TNotification::ERemove, 6, 1 }, + { END_MARKER } }; + TNotification::TData notificationStaticItemsEnabled[] = + { { TNotification::ERemove, 7, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + 'g', EFalse, + _L8("abcdef"), + _L8("0abcdef12"), + notificationStaticItemsDisabled, + notificationStaticItemsEnabled, + info_add_front_0_rear_12 ) ); + } + + { // Test removing front static item + TNotification::TData notificationStaticItemsDisabled[] = + { { END_MARKER } }; + TNotification::TData notificationStaticItemsEnabled[] = + { { TNotification::ERemove, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + '0', ETrue, + _L8("abcdefg"), + _L8("abcdefg12"), + notificationStaticItemsDisabled, + notificationStaticItemsEnabled, + info_add_front_0_rear_12 ) ); + } + + { // Test removing rear static item 1 + TNotification::TData notificationStaticItemsDisabled[] = + { { END_MARKER } }; + TNotification::TData notificationStaticItemsEnabled[] = + { { TNotification::ERemove, 8, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + '1', ETrue, + _L8("abcdefg"), + _L8("0abcdefg2"), + notificationStaticItemsDisabled, + notificationStaticItemsEnabled, + info_add_front_0_rear_12 ) ); + } + + { // Test removing rear static item 2 + TNotification::TData notificationStaticItemsDisabled[] = + { { END_MARKER } }; + TNotification::TData notificationStaticItemsEnabled[] = + { { TNotification::ERemove, 9, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + '2', ETrue, + _L8("abcdefg"), + _L8("0abcdefg1"), + notificationStaticItemsDisabled, + notificationStaticItemsEnabled, + info_add_front_0_rear_12 ) ); + } + + { // Test removing non-existent static item + TNotification::TData notificationStaticItemsDisabled[] = + { { END_MARKER } }; + TNotification::TData notificationStaticItemsEnabled[] = + { { END_MARKER } }; + EUNIT_ASSERT( TryRemoveL( _L8("abcdefg"), + '#', ETrue, + _L8("abcdefg"), + _L8("0abcdefg12"), + notificationStaticItemsDisabled, + notificationStaticItemsEnabled, + info_add_front_0_rear_12 ) ); + } + } + +// ----------------------------------------------------------------------------- +// Test AddStaticItemL(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_AddStaticItemLL( ) + { + { // Test adding first static item to front, empty list + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8(""), + '0', NGlxListDefs::EInsertFirst, + _L8("0"), + notifications, notifications, + info_add_none ) ); + } + + { // Test adding first static item to rear, empty list + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8(""), + '0', NGlxListDefs::EInsertLast, + _L8("0"), + notifications, notifications, + info_add_none ) ); + } + + { // Test adding first static item to rear, empty list + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8(""), + '0', NGlxListDefs::EInsertLast, + _L8("0"), + notifications, notifications, + info_add_none ) ); + } + + { // Test adding first static item to front + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + TNotification::TData notificationsWithAllStaticItems[] = + { { TNotification::EAdd, 0, 2 }, + { TNotification::EAdd, 2, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8(""), + '3', NGlxListDefs::EInsertFirst, + _L8("3012"), + notifications, notificationsWithAllStaticItems, + info_add_front_0_rear_12 ) ); + } + + { // Test adding first static item to rear + TNotification::TData notifications[] = + { { TNotification::EAdd, 3, 1 }, + { END_MARKER } }; + TNotification::TData notificationsWithAllStaticItems[] = + { { TNotification::EAdd, 0, 1 }, + { TNotification::EAdd, 1, 3 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8(""), + '3', NGlxListDefs::EInsertLast, + _L8("0123"), + notifications, notificationsWithAllStaticItems, + info_add_front_0_rear_12 ) ); + } + + { // Test adding first static item to rear + TNotification::TData notifications[] = + { { TNotification::EAdd, 4, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8("abcd"), + '0', NGlxListDefs::EInsertLast, + _L8("abcd0"), + notifications, notifications, + info_add_none ) ); + } + + { // Test adding static item to front + TNotification::TData notifications[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + TNotification::TData notificationsWithAllStaticItems[] = + { { TNotification::EAdd, 0, 2 }, + { TNotification::EAdd, 6, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8("abcd"), + '3', NGlxListDefs::EInsertFirst, + _L8("30abcd12"), + notifications, notificationsWithAllStaticItems, + info_add_front_0_rear_12 ) ); + } + + // Test adding a static item that already exists + + { // Test adding existing static item to front + TNotification::TData notifications[] = + { { END_MARKER } }; + TNotification::TData notificationsWithAllStaticItems[] = + { { TNotification::EAdd, 0, 1 }, + { TNotification::EAdd, 5, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8("abcd"), + '0', NGlxListDefs::EInsertFirst, + _L8("0abcd12"), + notifications, notificationsWithAllStaticItems, + info_add_front_0_rear_12 ) ); + } + + { // Test adding existing static item to rear + TNotification::TData notifications[] = + { { END_MARKER } }; + TNotification::TData notificationsWithAllStaticItems[] = + { { TNotification::EAdd, 0, 1 }, + { TNotification::EAdd, 5, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8("abcd"), + '2', NGlxListDefs::EInsertLast, + _L8("0abcd12"), + notifications, notificationsWithAllStaticItems, + info_add_front_0_rear_12 ) ); + } + + // Test adding a static item that already exists, but in different end of list + { // Test adding existing static item to front, when old on is at rear + TNotification::TData notifications[] = + { { TNotification::ERemove, 5, 1 }, + { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + TNotification::TData notificationsWithAllStaticItems[] = + { { TNotification::EAdd, 0, 2 }, + { TNotification::EAdd, 6, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8("abcd"), + '1', NGlxListDefs::EInsertFirst, + _L8("10abcd2"), + notifications, notificationsWithAllStaticItems, + info_add_front_0_rear_12 ) ); + } + + { // Test adding existing static item to rear, when old on is at front + TNotification::TData notifications[] = + { { TNotification::ERemove, 0, 1 }, + { TNotification::EAdd, 6, 1 }, + { END_MARKER } }; + TNotification::TData notificationsWithAllStaticItems[] = + { { TNotification::EAdd, 4, 3 }, + { END_MARKER } }; + EUNIT_ASSERT( TryAddStaticItemL( _L8("abcd"), + '0', NGlxListDefs::EInsertLast, + _L8("abcd120"), + notifications, notificationsWithAllStaticItems, + info_add_front_0_rear_12 ) ); + } + } + +// ----------------------------------------------------------------------------- +// Test SetStaticItemsEnabled(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_SetStaticItemsEnabledL( ) + { + // Test list with no normal items + { // Add to front + TNotification::TData notificationsForEnable[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + TNotification::TData notificationsForDisable[] = + { { TNotification::ERemove, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetStaticItemsEnabledL( _L8(""), + _L8("0"), + info_add_front_0, + notificationsForEnable, + notificationsForDisable ) ); + } + + { // Add to front + TNotification::TData notificationsForEnable[] = + { { TNotification::EAdd, 0, 2 }, + { END_MARKER } }; + TNotification::TData notificationsForDisable[] = + { { TNotification::ERemove, 0, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetStaticItemsEnabledL( _L8(""), + _L8("01"), + info_add_front_01, + notificationsForEnable, + notificationsForDisable ) ); + } + + { // Add to front and rear + TNotification::TData notificationsForEnable[] = + { { TNotification::EAdd, 0, 1 }, + { TNotification::EAdd, 1, 2 }, + { END_MARKER } }; + TNotification::TData notificationsForDisable[] = + { { TNotification::ERemove, 0, 1 }, + { TNotification::ERemove, 0, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetStaticItemsEnabledL( _L8(""), + _L8("012"), + info_add_front_0_rear_12, + notificationsForEnable, + notificationsForDisable ) ); + } + + // Test list with also normal items + { // Add to front + TNotification::TData notificationsForEnable[] = + { { TNotification::EAdd, 0, 1 }, + { END_MARKER } }; + TNotification::TData notificationsForDisable[] = + { { TNotification::ERemove, 0, 1 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetStaticItemsEnabledL( _L8("abcde"), + _L8("0abcde"), + info_add_front_0, + notificationsForEnable, + notificationsForDisable ) ); + } + + { // Add to front + TNotification::TData notificationsForEnable[] = + { { TNotification::EAdd, 0, 2 }, + { END_MARKER } }; + TNotification::TData notificationsForDisable[] = + { { TNotification::ERemove, 0, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetStaticItemsEnabledL( _L8("abcde"), + _L8("01abcde"), + info_add_front_01, + notificationsForEnable, + notificationsForDisable ) ); + } + + { // Add to front and rear + TNotification::TData notificationsForEnable[] = + { { TNotification::EAdd, 0, 1 }, + { TNotification::EAdd, 6, 2 }, + { END_MARKER } }; + TNotification::TData notificationsForDisable[] = + { { TNotification::ERemove, 0, 1 }, + { TNotification::ERemove, 5, 2 }, + { END_MARKER } }; + EUNIT_ASSERT( TrySetStaticItemsEnabledL( _L8("abcde"), + _L8("0abcde12"), + info_add_front_0_rear_12, + notificationsForEnable, + notificationsForDisable ) ); + } + } + +// ----------------------------------------------------------------------------- +// Test Count(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_CountL( ) + { + TestCountL(); + } + +// ----------------------------------------------------------------------------- +// Test Item(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_ItemL( ) + { + TestItemL(); + } + +// ----------------------------------------------------------------------------- +// Test Index(...) +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_IndexL( ) + { + TestIndexL(); + } + +// ----------------------------------------------------------------------------- +// Test IdSpaceId +// ----------------------------------------------------------------------------- +// +void ut_CGlxStaticItemList::T_IdSpaceIdL() + { + TestIdSpaceIdL(); + } + +// ----------------------------------------------------------------------------- +// Test table +// ----------------------------------------------------------------------------- +// +EUNIT_BEGIN_TEST_TABLE( + ut_CGlxStaticItemList, + "Static item list test suite.", + "UNIT" ) + +EUNIT_TEST( + "AddStaticItemL", + "CGlxStaticItemList", + "AddStaticItemL", + "FUNCTIONALITY", + SetupL, T_AddStaticItemLL, Teardown) + +EUNIT_TEST( + "SetStaticItemsEnabled", + "CGlxStaticItemList", + "SetStaticItemsEnabled", + "FUNCTIONALITY", + SetupL, T_SetStaticItemsEnabledL, Teardown) + +EUNIT_TEST( + "SetContentsL", + "CGlxStaticItemList", + "SetContentsL", + "FUNCTIONALITY", + SetupL, T_SetContentsLL, Teardown) + +EUNIT_TEST( + "Remove", + "CGlxStaticItemList", + "Remove", + "FUNCTIONALITY", + SetupL, T_RemoveL, Teardown) + +EUNIT_TEST( + "RemoveReference", + "CGlxStaticItemList", + "RemoveReference", + "FUNCTIONALITY", + SetupL, T_RemoveReferenceL, Teardown) + +EUNIT_TEST( + "Count", + "CGlxStaticItemList", + "Count", + "FUNCTIONALITY", + SetupL, T_CountL, Teardown) + +EUNIT_TEST( + "Item", + "CGlxStaticItemList", + "Item", + "FUNCTIONALITY", + SetupL, T_ItemL, Teardown) + +EUNIT_TEST( + "Index", + "CGlxStaticItemList", + "Index", + "FUNCTIONALITY", + SetupL, T_IndexL, Teardown) + +EUNIT_TEST( + "Id space id", + "CGlxStaticItemList", + "IdSpaceId", + "FUNCTIONALITY", + SetupL, T_IdSpaceIdL, Teardown) + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxstaticitemlist/ut_cglxstaticitemlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxstaticitemlist/ut_cglxstaticitemlist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests, entry point +* +*/ + + + + +#ifndef __UT_CGLXSTATICITEMLIST_H__ +#define __UT_CGLXSTATICITEMLIST_H__ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "glxstaticitemlist.h" +#include "glxlistreconstruction.h" +#include "glxlisttestbase.h" + +// FORWARD DECLARATIONS + +/** + * Reconstruction of a static item list + */ +NONSHARABLE_CLASS( CGlxStaticItemListReconstruction ) : public CGlxListReconstruction< CGlxStaticItemList > + { + public: + static CGlxStaticItemListReconstruction* NewL( TInt aReservationCount = 400 ); + // From CGlxListReconstructionBase + TBool ReconstructionEquals() const; + }; + +/** + * EUnit test suite + */ +NONSHARABLE_CLASS( ut_CGlxStaticItemList ) : + public CGlxListTestBase< CGlxStaticItemList, CGlxStaticItemListReconstruction > + { + public: // Constructors and destructors + /** + * Two phase construction + */ + static ut_CGlxStaticItemList* NewL(); + static ut_CGlxStaticItemList* NewLC(); + /** + * Destructor + */ + ~ut_CGlxStaticItemList(); + + private: // Constructors and destructors + ut_CGlxStaticItemList(); + void ConstructL(); + + private: // New methods + void SetupL(); + void Teardown(); + + void T_SetContentsLL(); + void T_RemoveL(); + void T_RemoveReferenceL(); + void T_CountL(); + void T_ItemL(); + void T_IndexL(); + void T_IdSpaceIdL(); + void T_SetStaticItemsEnabledL(); + void T_AddStaticItemLL(); + + private: // Data + EUNIT_DECLARE_TEST_TABLE; + }; + +#endif // __UT_CGLXSTATICITEMLIST_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_cglxstaticitemlist/ut_cglxstaticitemlist_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_cglxstaticitemlist/ut_cglxstaticitemlist_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit tests +* +*/ + + + + +// CLASS HEADER +#include "ut_cglxstaticitemlist.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return ut_CGlxStaticItemList::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_glxerrormanager/ut_glxerrormanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_glxerrormanager/ut_glxerrormanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,569 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing GlxErrorManager +* +*/ + + + + +// CLASS HEADER +#include "ut_glxerrormanager.h" + +// EXTERNAL INCLUDES +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +// INTERNAL INCLUDES +#include "glxmediaid.h" +#include "glxerrormanager.h" +#include "glxfetcherrorarray.h" +#include "glxmedia.h" +#include "glxcachemanager.h" +#include "glxmedialist.h" + +#include + +void CGlxDRMUtility::Close() + { + delete this; + } + +TBool CGlxDRMUtility::CheckOpenRightsL(const TDesC&, TBool) + { + return ETrue; + } + +CGlxDRMUtility* CGlxDRMUtility::InstanceL() + { + CGlxDRMUtility* drm = new(ELeave)CGlxDRMUtility(); + return drm; + } + +TSize CGlxDRMUtility::DRMThumbnailSize(TSize& aSize) + { + return aSize; + } + +CGlxDRMUtility::CGlxDRMUtility() + { + + } + +CGlxDRMUtility::~CGlxDRMUtility() + { + + } + + +// CONSTRUCTION +ut_glxerrormanager* ut_glxerrormanager::NewL() + { + ut_glxerrormanager* self = ut_glxerrormanager::NewLC(); + CleanupStack::Pop(); + + return self; + } + +ut_glxerrormanager* ut_glxerrormanager::NewLC() + { + ut_glxerrormanager* self = new( ELeave ) ut_glxerrormanager(); + CleanupStack::PushL( self ); + + self->ConstructL(); + + return self; + } + +// Destructor (virtual by CBase) +ut_glxerrormanager::~ut_glxerrormanager() + { + } + +// Default constructor +ut_glxerrormanager::ut_glxerrormanager() + { + } + +// Second phase construct +void ut_glxerrormanager::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// METHODS + + +void ut_glxerrormanager::SetupL( ) + { + iItem1 = new (ELeave) CGlxMedia(TGlxMediaId(1)); + + iItem2 = new (ELeave) CGlxMedia(TGlxMediaId(2)); + RArray attrSet2; + CleanupClosePushL(attrSet2); + attrSet2.AppendL(KMPXMediaGeneralThumbnail1); + attrSet2.AppendL(KMPXMediaGeneralDate); + attrSet2.AppendL(KMPXMediaGeneralSize); + GlxErrorManager::SetAttributeErrorL(iItem2, attrSet2, KErrGeneral); + CleanupStack::PopAndDestroy(&attrSet2); + + iItem3 = new (ELeave) CGlxMedia(TGlxMediaId(3)); + RArray attrSet3; + CleanupClosePushL(attrSet3); + attrSet3.AppendL(KMPXMediaGeneralThumbnail1); + GlxErrorManager::SetAttributeErrorL(iItem3, attrSet3, KErrGeneral); + CleanupStack::PopAndDestroy(&attrSet3); + + iItem4 = new (ELeave) CGlxMedia(TGlxMediaId(4)); + iItem5 = new (ELeave) CGlxMedia(TGlxMediaId(5)); + + iItem6 = new (ELeave) CGlxMedia(TGlxMediaId(6)); + RArray attrSet6; + CleanupClosePushL(attrSet6); + attrSet6.AppendL(KMPXMediaGeneralThumbnail1); + GlxErrorManager::SetAttributeErrorL(iItem6, attrSet6, KErrNotSupported); + CleanupStack::PopAndDestroy(&attrSet6); + } + + +void ut_glxerrormanager::Teardown( ) + { + delete iItem1; + iItem1 = NULL; + delete iItem2; + iItem2 = NULL; + delete iItem3; + iItem3 = NULL; + delete iItem4; + iItem4 = NULL; + delete iItem5; + iItem5 = NULL; + delete iItem6; + iItem6 = NULL; + } + + +// ----------------------------------------------------------------------------- +// *********************** WARNING ******************************************** +// ----------------------------------------------------------------------------- +// This test may not complete unless the EUnit timeout settings are altered +// The timeout settings must be more than: +// KGlxTemporaryErrorValidityPeriodInSeconds * 1.25 +// (Currently, 60 seconds will do it) +// ----------------------------------------------------------------------------- +// +void ut_glxerrormanager::T_Test1L( ) + { + // Check for attribute errors on null item + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(NULL, KMPXMediaGeneralThumbnail1), + "Null item has an error on KMPXMediaIdGeneral attributes"); + + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has an error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + // Check for attribute errors on non errored attribute + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralTitle), + "iItem2 has an error on KMPXMediaGeneralTitle"); + + EUNIT_ASSERT_DESC( KErrNone != GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralThumbnail1), + "iItem2 has no error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone != GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralDate), + "iItem2 has no error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone != GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralSize), + "iItem2 has no error on KMPXMediaGeneralSize"); + + EUNIT_ASSERT_DESC( KErrNone != GlxErrorManager::HasAttributeErrorL(iItem3, KMPXMediaGeneralThumbnail1), + "iItem3 has no error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem3, KMPXMediaGeneralDate), + "iItem3 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem3, KMPXMediaGeneralSize), + "iItem3 has an error on KMPXMediaGeneralSize"); + + // Wait for half the validity period + User::After(KGlxTemporaryErrorValidityPeriodInSeconds * 1000000 * 1.25); + + // Check for permanent error + EUNIT_ASSERT_DESC( KErrNotSupported == GlxErrorManager::HasAttributeErrorL(iItem6, KMPXMediaGeneralThumbnail1), + "iItem6 has no error on KMPXMediaGeneralThumbnail1"); + } + +void ut_glxerrormanager::T_Test2L( ) + { + RArray attrSet; + CleanupClosePushL(attrSet); + + // Set errors one by one + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has an error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + attrSet.Close(); + attrSet.AppendL(KMPXMediaGeneralThumbnail1); + GlxErrorManager::SetAttributeErrorL(iItem1, attrSet, KErrGeneral); + + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has wrong error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + attrSet.Close(); + attrSet.AppendL(KMPXMediaGeneralDate); + GlxErrorManager::SetAttributeErrorL(iItem1, attrSet, KErrGeneral); + + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has wrong error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has wrong error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + attrSet.Close(); + attrSet.AppendL(KMPXMediaGeneralSize); + GlxErrorManager::SetAttributeErrorL(iItem1, attrSet, KErrGeneral); + + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has wrong error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has wrong error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has wrong error on KMPXMediaGeneralSize"); + + + // Set many errors in one go + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralThumbnail1), + "iItem4 has an error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralDate), + "iItem4 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralSize), + "iItem4 has an error on KMPXMediaGeneralSize"); + + attrSet.Close(); + attrSet.AppendL(KMPXMediaGeneralThumbnail1); + attrSet.AppendL(KMPXMediaGeneralDate); + attrSet.AppendL(KMPXMediaGeneralSize); + GlxErrorManager::SetAttributeErrorL(iItem4, attrSet, KErrGeneral); + + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralThumbnail1), + "iItem4 has wrong error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralDate), + "iItem4 has wrong error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralSize), + "iItem4 has wrong error on KMPXMediaGeneralSize"); + + CleanupStack::PopAndDestroy(&attrSet); + } + +void ut_glxerrormanager::T_Test3L( ) + { + // Check for errors on null item + EUNIT_ASSERT_DESC( !GlxErrorManager::HasError(NULL), + "Null item has some errors attached"); + + EUNIT_ASSERT_DESC( EFalse == GlxErrorManager::HasError(iItem1), + "iItem1 has some errors attached"); + EUNIT_ASSERT_DESC( ETrue == GlxErrorManager::HasError(iItem2), + "iItem2 has no errors attached"); + EUNIT_ASSERT_DESC( ETrue == GlxErrorManager::HasError(iItem3), + "iItem3 has no errors attached"); + EUNIT_ASSERT_DESC( EFalse == GlxErrorManager::HasError(iItem4), + "iItem4 has some errors attached"); + EUNIT_ASSERT_DESC( EFalse == GlxErrorManager::HasError(iItem5), + "iItem5 has some errors attached"); + + // Check for permanent errors + EUNIT_ASSERT_DESC( GlxErrorManager::HasError(iItem6), + "iItem6 has no errors attached"); + } + +void ut_glxerrormanager::T_Test4L( ) + { + // Check returned error array attribute + TMPXAttribute errorAttribute = GlxErrorManager::ErrorAttribute(); + + // HACK - error attribute is private, so these should reflect the values used in the error manager implementation + EUNIT_ASSERT_DESC(errorAttribute.ContentId() == 0x200071AC && errorAttribute.AttributeId() == 0x01, "Incorrect error attribute"); + } + +// ----------------------------------------------------------------------------- +// *********************** WARNING ******************************************** +// ----------------------------------------------------------------------------- +// This test may not complete unless the EUnit timeout settings are altered +// The timeout settings must be more than: +// KGlxTemporaryErrorValidityPeriodInSeconds * 1.25 +// (Currently, 60 seconds will do it) +// ----------------------------------------------------------------------------- +// +void ut_glxerrormanager::T_Test5L( ) + { + RArray attrSet; + CleanupClosePushL(attrSet); + + // Clean unused errors on iItem3 + attrSet.AppendL(KMPXMediaGeneralTitle); + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem3, attrSet); + + // HasError should now report false for iItem3 + EUNIT_ASSERT_DESC( !GlxErrorManager::HasError(iItem3), + "iItem3 has unused errors attached"); + + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralThumbnail1); + GlxErrorManager::SetAttributeErrorL(iItem1, attrSet, KErrGeneral); + + // Wait for half the validity period + User::After(KGlxTemporaryErrorValidityPeriodInSeconds * 1000000 / 2); + + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has wrong error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralDate); + GlxErrorManager::SetAttributeErrorL(iItem1, attrSet, KErrGeneral); + + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has wrong error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has wrong error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + // Wait for another .75 of the validity period + User::After(KGlxTemporaryErrorValidityPeriodInSeconds * 1000000 * 3 / 4); + + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has an unexpired error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has expired error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + // HasError should report true for iItem1, since there is still an outstanding error + EUNIT_ASSERT_DESC( GlxErrorManager::HasError(iItem1), + "iItem1 has no errors attached"); + + // HasError should still report true for iItem2, even though all the errors have expired + EUNIT_ASSERT_DESC( GlxErrorManager::HasError(iItem2), + "iItem2 has no errors attached"); + + // But checking HasAttributeErrorL shouldn't find any + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralThumbnail1), + "iItem2 has an error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralDate), + "iItem2 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralSize), + "iItem2 has an error on KMPXMediaGeneralSize"); + + // Now we clean iItem1 and iItem2 + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralThumbnail1); + attrSet.AppendL(KMPXMediaGeneralDate); + attrSet.AppendL(KMPXMediaGeneralSize); + + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem1, attrSet); + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem2, attrSet); + + // HasError should report true for iItem1, since there is still an outstanding error + EUNIT_ASSERT_DESC( GlxErrorManager::HasError(iItem1), + "iItem1 has no errors attached"); + + // HasError should now report false for iItem2 + EUNIT_ASSERT_DESC( !GlxErrorManager::HasError(iItem2), + "iItem2 has uncleared errors attached"); + + // Check all errors + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralThumbnail1), + "iItem1 has an error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralDate), + "iItem1 has no error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaGeneralSize), + "iItem1 has an error on KMPXMediaGeneralSize"); + + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralThumbnail1), + "iItem2 has an error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralDate), + "iItem2 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaGeneralSize), + "iItem2 has an error on KMPXMediaGeneralSize"); + + // Clean unused errors on iItem1 + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralTitle); + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem1, attrSet); + + // HasError should now report false for iItem1 + EUNIT_ASSERT_DESC( !GlxErrorManager::HasError(iItem1), + "iItem1 has unused errors attached"); + + + // Now try ClearExpiredAndUnusedErrorsL with a smaller set of attributes in use + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralThumbnail1); + attrSet.AppendL(KMPXMediaGeneralDate); + attrSet.AppendL(KMPXMediaGeneralSize); + GlxErrorManager::SetAttributeErrorL(iItem4, attrSet, KErrGeneral); + + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralThumbnail1), + "iItem4 has wrong error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralDate), + "iItem4 has wrong error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralSize), + "iItem4 has wrong error on KMPXMediaGeneralSize"); + + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralSize); + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem4, attrSet); + + // HasError should report true for iItem4, since there is still an error + EUNIT_ASSERT_DESC( GlxErrorManager::HasError(iItem4), + "iItem4 has no errors attached"); + + // Only the KMPXMediaGeneralSize error should remain + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralThumbnail1), + "iItem4 has an error on KMPXMediaGeneralThumbnail1"); + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralDate), + "iItem4 has an error on KMPXMediaGeneralDate"); + EUNIT_ASSERT_DESC( KErrGeneral == GlxErrorManager::HasAttributeErrorL(iItem4, KMPXMediaGeneralSize), + "iItem4 has wrong error on KMPXMediaGeneralSize"); + + // Clear expired and unused errors on item with no errors + EUNIT_ASSERT_DESC( !GlxErrorManager::HasError(iItem5), + "iItem5 has some errors attached"); + + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralThumbnail1); + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem5, attrSet); + + EUNIT_ASSERT_DESC( !GlxErrorManager::HasError(iItem5), + "iItem5 has some errors attached"); + + // Clear errors on item with permanent errors + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralThumbnail1); + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem6, attrSet); + + EUNIT_ASSERT_DESC( GlxErrorManager::HasError(iItem6), + "iItem6 has no errors attached"); + + EUNIT_ASSERT_DESC( KErrNotSupported == GlxErrorManager::HasAttributeErrorL(iItem6, KMPXMediaGeneralThumbnail1), + "iItem6 has wrong error on KMPXMediaGeneralThumbnail1"); + + // Clear unused errors which are permanent + attrSet.Reset(); + attrSet.AppendL(KMPXMediaGeneralTitle); + GlxErrorManager::ClearExpiredAndUnusedErrorsL(*iItem6, attrSet); + + EUNIT_ASSERT_DESC( !GlxErrorManager::HasError(iItem6), + "iItem6 has some errors attached"); + + CleanupStack::PopAndDestroy(&attrSet); + } + +void ut_glxerrormanager::T_Test6L( ) + { + // Check for attribute errors on null item + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(NULL, KMPXMediaIdGeneral), + "Null item has an error on KMPXMediaIdGeneral attributes"); + + // Check for KMPXMediaIdGeneral attribute errors on item with no errors + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem1, KMPXMediaIdGeneral), + "iItem1 has an error on KMPXMediaIdGeneral attributes"); + + // Check for KGlxMediaIdGeneral attribute errors on item with errors + EUNIT_ASSERT_DESC( KErrNone == GlxErrorManager::HasAttributeErrorL(iItem2, KGlxMediaIdGeneral), + "iItem2 has an error on KGlxMediaIdGeneral attributes"); + + // Check for KMPXMediaIdGeneral attribute errors on item with errors + EUNIT_ASSERT_DESC( KErrNone != GlxErrorManager::HasAttributeErrorL(iItem2, KMPXMediaIdGeneral), + "iItem2 has no error on KMPXMediaIdGeneral attributes"); + + // Check for KMPXMediaIdGeneral attribute errors on item with permanent errors + EUNIT_ASSERT_DESC( KErrNone != GlxErrorManager::HasAttributeErrorL(iItem6, KMPXMediaIdGeneral), + "iItem6 has no error on KMPXMediaIdGeneral attributes"); + } + +// TEST TABLE +EUNIT_BEGIN_TEST_TABLE( + ut_glxerrormanager, + "Testing GlxErrorManager utility class.", + "UNIT" ) + +/*EUNIT_TEST( + "HasAttributeError_1L - Test1", + "GlxErrorManager", + "HasAttributeError_1L", + "FUNCTIONALITY", + SetupL, T_Test1L, Teardown)*/ + +EUNIT_TEST( + "SetAttributeErrorL - Test2", + "GlxErrorManager", + "SetAttributeErrorL", + "FUNCTIONALITY", + SetupL, T_Test2L, Teardown) + +EUNIT_TEST( + "HasError - Test3", + "GlxErrorManager", + "HasError", + "FUNCTIONALITY", + SetupL, T_Test3L, Teardown) + +EUNIT_TEST( + "ErrorAttribute - Test4", + "GlxErrorManager", + "ErrorAttribute", + "FUNCTIONALITY", + SetupL, T_Test4L, Teardown) + +EUNIT_TEST( + "ClearExpiredAndUnusedErrorsL - Test5", + "GlxErrorManager", + "ClearExpiredAndUnusedErrorsL", + "FUNCTIONALITY", + SetupL, T_Test5L, Teardown) + +EUNIT_TEST( + "HasAttributeError_2L - Test6", + "GlxErrorManager", + "HasAttributeError_2L", + "FUNCTIONALITY", + SetupL, T_Test6L, Teardown) + + +EUNIT_END_TEST_TABLE + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_glxerrormanager/ut_glxerrormanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_glxerrormanager/ut_glxerrormanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Testing GlxErrorManager +* +*/ + + + + +#ifndef __UT_GLXERRORMANAGER_H__ +#define __UT_GLXERRORMANAGER_H__ + +// EXTERNAL INCLUDES +#include +#include + + +// INTERNAL INCLUDES + + +// FORWARD DECLARATIONS +class CGlxMedia; + +// CLASS DEFINITION +/** + * TODO Auto-generated EUnit test suite + * + */ +NONSHARABLE_CLASS( ut_glxerrormanager ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + + /** + * Two phase construction + */ + static ut_glxerrormanager* NewL(); + static ut_glxerrormanager* NewLC(); + /** + * Destructor + */ + ~ut_glxerrormanager(); + + private: // Constructors and destructors + + ut_glxerrormanager(); + void ConstructL(); + + private: // New methods + + void SetupL(); + + void Teardown(); + + void T_Test1L(); + void T_Test2L(); + void T_Test3L(); + void T_Test4L(); + void T_Test5L(); + void T_Test6L(); + + + private: // Data + + + EUNIT_DECLARE_TEST_TABLE; + + CGlxMedia* iItem1; + CGlxMedia* iItem2; + CGlxMedia* iItem3; + CGlxMedia* iItem4; + CGlxMedia* iItem5; + CGlxMedia* iItem6; + }; + +#endif // __UT_GLXERRORMANAGER_H__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_glxerrormanager/ut_glxerrormanager_DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_glxerrormanager/ut_glxerrormanager_DllMain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Creates and Return TestSuite +* +*/ + + + + +// CLASS HEADER +#include "ut_glxerrormanager.h" + +// EXTERNAL INCLUDES +#include + +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return ut_glxerrormanager::NewL(); + } + +#ifndef EKA2 +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif + +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_tglxselectioniterator/ut_tglxselectioniterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_tglxselectioniterator/ut_tglxselectioniterator.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TGlxFromFocusOutwardIterator unit tests +* +*/ + + + + +#include + +#include "ut_tglxselectioniterator.h" + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +T_CGlxSelectionIterator* T_CGlxSelectionIterator::NewL() + { + T_CGlxSelectionIterator* self = T_CGlxSelectionIterator::NewLC(); + CleanupStack::Pop(); + return self; + } + +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +T_CGlxSelectionIterator* T_CGlxSelectionIterator::NewLC() + { + T_CGlxSelectionIterator* self = new( ELeave ) T_CGlxSelectionIterator(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +T_CGlxSelectionIterator::~T_CGlxSelectionIterator() + { + // Don't do anything + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +T_CGlxSelectionIterator::T_CGlxSelectionIterator() +: iList(NULL) + { + // Don't do anything + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +void T_CGlxSelectionIterator::ConstructL() + { + // The ConstructL from the base class CEUnitTestSuiteClass must be called. + // It generates the test case table. + CEUnitTestSuiteClass::ConstructL(); + } + +// ---------------------------------------------------------------------------- +// T_CGlxSelectionIterator::SetupL() +// ---------------------------------------------------------------------------- +// +void T_CGlxSelectionIterator::SetupL() + { + iVirtualIterator = &iConcreateIterator; + } + +// ---------------------------------------------------------------------------- +// T_CGlxSelectionIterator::Teardown() +// ---------------------------------------------------------------------------- +// +void T_CGlxSelectionIterator::Teardown() + { + // Don't do anything + } + +// ---------------------------------------------------------------------------- +// T_CGlxSelectionIterator::UT_TestOperatorPlusPlusL() +// ---------------------------------------------------------------------------- +// +void T_CGlxSelectionIterator::UT_TestOperatorPlusPlusL() + { + + RArray selection; + CleanupClosePushL(selection); + + selection.AppendL(0); + selection.AppendL(1); + selection.AppendL(2); + + Test(3, EFalse, 3, 0, selection, "012e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + Test(3, ETrue, 3, 0, selection, "012e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + + Test(2, EFalse, 3, 0, selection, "01e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + Test(2, ETrue, 3, 0, selection, "e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + + selection.Reset(); + + selection.AppendL(0); + selection.AppendL(3); + selection.AppendL(4); + selection.AppendL(7); + selection.AppendL(9); + + Test(13, EFalse, 14, 0, selection, "03479e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + Test(13, ETrue, 14, 0, selection, "03479e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + + selection.Reset(); + + selection.AppendL(5); + selection.AppendL(9); + + Test(13, EFalse, 11, 0, selection, "59e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + Test(1, EFalse, 11, 0, selection, "5e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + Test(1, ETrue, 11, 0, selection, "e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + + selection.Reset(); + + // Focus no selection + Test(13, EFalse, 10, 4, selection, "4e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + + Test(13, ETrue, 10, 4, selection, "4e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + Test(1, ETrue, 10, 4, selection, "4e"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + + CleanupStack::PopAndDestroy(&selection); + } + +// ---------------------------------------------------------------------------- +// T_CGlxSelectionIterator::UT_TestInRangeL() +// ---------------------------------------------------------------------------- +// +void T_CGlxSelectionIterator::UT_TestInRangeL() + { + RArray selection; + CleanupClosePushL(selection); + + selection.AppendL(0); + selection.AppendL(1); + selection.AppendL(2); + + TestSingleInRange(3, EFalse, 3, 0, selection, "xxx"); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + TestSingleInRange(4, EFalse, 4, 0, selection, "xxx "); + TestSingleInRange(4, EFalse, 3, 0, selection, "xxx"); + TestSingleInRange(4, ETrue, 3, 0, selection, "xxx"); + TestSingleInRange(2, EFalse, 4, 0, selection, "xx "); + TestSingleInRange(2, ETrue, 4, 0, selection, " "); + + selection.Reset(); + + selection.AppendL(2); + selection.AppendL(4); + + TestSingleInRange(3, EFalse, 6, 0, selection, " x x "); // range, disable_if_more_than_range_selected, list count, focus index, selection, result + TestSingleInRange(4, EFalse, 5, 0, selection, " x x"); + TestSingleInRange(4, ETrue, 6, 0, selection, " x x "); + TestSingleInRange(2, EFalse, 6, 0, selection, " x x "); + TestSingleInRange(2, ETrue, 6, 0, selection, " x x "); + TestSingleInRange(1, EFalse, 6, 0, selection, " x "); + TestSingleInRange(1, ETrue, 6, 0, selection, " "); + + CleanupStack::PopAndDestroy(&selection); + } + +// ---------------------------------------------------------------------------- +// T_CGlxSelectionIterator::Test +// ---------------------------------------------------------------------------- +// +void T_CGlxSelectionIterator::Test(TInt aRange, TBool aDisabledIfMoreThanRangeSelected, + TInt aListCount, TInt aFocusIndex, RArray& aSelection, const char* aResults) + { + + __ASSERT_DEBUG(aFocusIndex >= 0 && aFocusIndex < aListCount && aListCount >= 0, Panic(EGlxPanicIllegalArgument)); // Make sure is testing all cases, also failed case + + iConcreateIterator.SetRange(aRange); + iConcreateIterator.SetDisabledIfMoreThanRangeSelected(aDisabledIfMoreThanRangeSelected); + iVirtualIterator->SetToFirst(&iList); + iList.iCount = aListCount; + iList.iFocus = aFocusIndex; + iList.iSelection = aSelection; + TInt resultCount = User::StringLength(reinterpret_cast(aResults)); + + for (TInt i = 0; i < resultCount; i++) + { + TInt result = (*iVirtualIterator)++; + char c = aResults[i]; + TInt expectedResult = c - '0'; + if (c == 'e') + { + expectedResult = KErrNotFound; + } + EUNIT_ASSERT(result == expectedResult); + } + } + +// ---------------------------------------------------------------------------- +// T_CGlxSelectionIterator::TestSingleInRange +// ---------------------------------------------------------------------------- +// +void T_CGlxSelectionIterator::TestSingleInRange( + TInt aRange, TBool aDisabledIfMoreThanRangeSelected, TInt aListCount, + TInt aFocusIndex, RArray& aSelection, const char* aResult) + { + __ASSERT_DEBUG(aFocusIndex >= 0 && aFocusIndex < aListCount && aListCount >= 0, Panic(EGlxPanicIllegalArgument)); // Make sure is testing all cases, also failed case + iConcreateIterator.SetRange(aRange); + iConcreateIterator.SetDisabledIfMoreThanRangeSelected(aDisabledIfMoreThanRangeSelected); + iVirtualIterator->SetToFirst(&iList); + iList.iCount = aListCount; + iList.iFocus = aFocusIndex; + iList.iSelection = aSelection; + + + for (TInt i = 0; i < aListCount; i++) + { + char c = aResult[i]; + __ASSERT_DEBUG(c != 0, Panic(EGlxPanicIllegalArgument)); // Not enough results + + TBool inRange = iVirtualIterator->InRange(i); + EUNIT_ASSERT((inRange && c == 'x') || (!inRange && c == ' ')); + } + + } + + + +// ---------------------------------------------------------------------------- +// Test table +// ---------------------------------------------------------------------------- +// + +EUNIT_BEGIN_TEST_TABLE( + T_CGlxSelectionIterator, + "Unit tests for T_CGlxSelectionIterator", + "UNIT" ) + +EUNIT_TEST( + "Test operator++", + "TGlxSelectionIterator", + "++", + "FUNCTIONALITY", + SetupL, UT_TestOperatorPlusPlusL, Teardown) + +EUNIT_TEST( + "Test InRange", + "TGlxSelectionIterator", + "++", + "FUNCTIONALITY", + SetupL, UT_TestInRangeL, Teardown) + +EUNIT_END_TEST_TABLE +// END OF FILE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_tglxselectioniterator/ut_tglxselectioniterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_tglxselectioniterator/ut_tglxselectioniterator.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TGlxSelectionIterator unit tests +* +*/ + + + + +#ifndef __T_GLXSELECTIONITERATOR_H__ +#define __T_GLXSELECTIONITERATOR_H__ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "mglxmedialist.h" +#include "glxmedialistiterator.h" +#include "tmglxmedialist_stub.h" +// FORWARD DECLARATIONS + +#include +#ifndef NONSHARABLE_CLASS + #define NONSHARABLE_CLASS(x) class x +#endif + +// CLASS DEFINITION +/** + * + * EUnitWizard generated test class. + * + */ +NONSHARABLE_CLASS( T_CGlxSelectionIterator ) + : public CEUnitTestSuiteClass + { + public: // Constructors and destructors + static T_CGlxSelectionIterator* NewL(); + static T_CGlxSelectionIterator* NewLC(); + ~T_CGlxSelectionIterator(); + + private: // Constructors and destructors + T_CGlxSelectionIterator(); + void ConstructL(); + + private: // New methods + void SetupL(); + void Teardown(); + + void UT_TestOperatorPlusPlusL(); + void UT_TestInRangeL(); + + /** + * Run a single test + * @param aCount Number of items in list + * @param aFocusIndex index of focus + * @param aRange + * @param aResult expected results in format "iiiii*e", + * where i is an index, and e means KErrNotFound. + * E.g., "14523ee" means iOrder++ should return 1 first, + * 4 then, etc. and finally KErrNotFound two times + */ + void Test(TInt aRange, TBool aDisabledIfMoreThanRangeSelected, + TInt aListCount, TInt aFocusIndex, RArray& aSelection, const char* aResult); + + /** + * Run a single "InRange()" test + * @param aCount Number of items in list + * @param aFocusIndex index of focus + * @param aFrontOffset + * @param aRearOffset + * @param aResult expected results in format "xxx xx", + * where x means the n-th item is in range, and space means it is not + */ + void TestSingleInRange(TInt aRange, TBool aDisabledIfMoreThanRangeSelected, + TInt aListCount, TInt aFocusIndex, RArray& aSelection, const char* aResult); + + private: // Data + MGlxMediaListIterator* iVirtualIterator; // To access virtual functions only + TMGlxMediaList_Stub iList; + TGlxSelectionIterator iConcreateIterator; + + EUNIT_DECLARE_TEST_TABLE; + }; + +#endif // __T_GLXSELECTIONITERATOR_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/medialists/tsrc/ut_tglxselectioniterator/ut_tglxselectioniteratordllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/medialists/tsrc/ut_tglxselectioniterator/ut_tglxselectioniteratordllmain.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Unit test entry point +* +*/ + + + + +// CLASS HEADER +#include "ut_tglxselectioniterator.h" + +// EXTERNAL INCLUDES +#include + +/** + * Test suite factory function. + */ +EXPORT_C MEUnitTest* CreateTestSuiteL() + { + return T_CGlxSelectionIterator::NewL(); + } + + + +// END OF FILE + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/data/2000A7C3.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/data/2000A7C3.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + + +// INCLUDES +#include +#include +#include "glxfullscreenviewplugin.hrh" + +// RESOURCE DEFINITIONS + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: uid of the supported Playback/Collection plugin. + * E.g. if the view plugin supports Local Playback plugin, the list of + * uids will be: 0x101FFC06 + * Now the Opaque data can contain a Depth (Path Level) UID. + * This is to differentiate between the Album Plugin requires a List View (Depth 2 - list of Albums) + * and it requiring a FullScreen View (Depth 3 Contents of an album). + * However the Plugin ID must score higher than the depth. So now we must add the plugin Id 4 Times + * The value of the depths are KGlxDepthTwo - ,KGlxDepthThree - 0x2000A776 and KGlxDepthFour - 0x200104DB + * I could not seem to use a #define in between the

<\p> tags so the values had to be used + * + * uid + * uid: plugin type uid. + * E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0 + * + * flags [optional] + * flags: sum of the required feature flags that listed in mpxviewplugin.hrh. + * E.g. if the view plugin needs to be pre-loaded and it's user-selectable, + * then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003. + * + * priority [optional] + * priority: a value of type TMPXViewPluginPriorities. This value determines + * which view plugin will be resolved when several plugins can support the + * same set of Uids. + * Default value of this field is EMPXViewPluginPriorityNormal. + * + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2000A7C3; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXViewPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxMainFullScreenViewImplementationId; + version_no = 1; + display_name = "Main fullscreen view"; + default_data = ""; + opaque_data = "

0x200104DD;0x2000A775;0x2000A7C1;0x2000A7C1;0x2000A7C1;0x2000A7C1

" + "0x2000D24B" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxAlbumFullScreenViewImplementationId; + version_no = 1; + display_name = "Album fullscreen view"; + default_data = ""; + opaque_data = "

0x200104DD;0x2000A776;0x20007197;0x20007197;0x20007197;0x20007197;

" + "0x2000D24C" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxDownloadsFullScreenViewImplementationId; + version_no = 1; + display_name = "Downloads fullscreen view"; + default_data = ""; + opaque_data = "

0x200104DD;0x2000A775;0x2000a76b;0x2000a76b;0x2000a76b;0x2000a76b

" + "0x2000D24E" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCameraAlbumFullScreenViewImplementationId; + version_no = 1; + display_name = "Camera Albums fullscreen view"; + default_data = ""; + opaque_data = "

0x200104DD;0x2000A775;2000A767;0x2000A767;0x2000A767;0x2000A767

" + "0x2000D24D" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxMonthsFullScreenViewImplementationId; + version_no = 1; + display_name = "Months fullscreen view"; + default_data = ""; + opaque_data = "

0x200104DD;0x2000A775;0x2000A769;0x2000A769;0x2000A769;0x2000A769

" + "0x2000D249" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxTagFullScreenViewPluginImplementationUid; + version_no = 1; + display_name = "Tag fullscreen view"; + default_data = ""; + opaque_data = "

0x200104DD;0x2000A776;0x200071AE;0x200071AE;0x200071AE;0x200071AE

" + "0x2000D24A" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxImageViewerFullScreenViewImplementationId; + version_no = 1; + display_name = "Tag fullscreen view"; + default_data = ""; + opaque_data = "

0x200104DD;0x200071CC;0x200104E6;0x200104E6;0x200104E6;0x200104E6

" + "0x2000D24F" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/data/glxfullscreenviewdata.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/data/glxfullscreenviewdata.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,561 @@ +/* +* Copyright (c) 2008-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: Resource definitions for fullscreen View plugin +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME MPXF + +// INCLUDES + +#include "glxcommandhandlers.hrh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="GLFV"; } + + +// ----------------------------------------------------------------------------------- +// Resource Definitions +// ----------------------------------------------------------------------------------- + +// Downloads, Captured and Months Fullscreen View +RESOURCE AVKON_VIEW r_glx_fullscreen_view + { + menubar = r_glx_fullscreen_menubar; + cba = r_glx_fullscreen_softkeys; + toolbar = r_glx_fullscreen_view_toolbar; + } + +// Albums Fullscreen View +RESOURCE AVKON_VIEW r_glx_album_fullscreen_view + { + menubar = r_glx_album_fullscreen_menubar; + cba = r_glx_fullscreen_softkeys; + toolbar = r_glx_fullscreen_view_toolbar; + } + +// Tags Fullscreen View +RESOURCE AVKON_VIEW r_glx_tagfullscreen_view + { + menubar = r_glx_tagfullscreen_menubar; + cba = r_glx_fullscreen_softkeys; + toolbar = r_glx_fullscreen_view_toolbar; + } + +// ImageViewer Fullscreen View +RESOURCE AVKON_VIEW r_glx_imageviewer_fullscreen_view + { + menubar = r_glx_imageviewer_fullscreen_menubar; + cba = r_glx_fullscreen_softkeys; + toolbar = r_glx_imageviewer_fullscreen_view_toolbar; + } + + +// ------------------------------------------------------------------------------------ +// Menu Bar Resources +// ------------------------------------------------------------------------------------ + +// Downloads, Captured and Months Fullscreen View +RESOURCE MENU_BAR r_glx_fullscreen_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_glx_fullscreen_menu; txt=""; } + }; + } + +// Albums Fullscreen View +RESOURCE MENU_BAR r_glx_album_fullscreen_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_glx_album_fullscreen_menu; txt=""; } + }; + } + +//Tag fullscreen View +RESOURCE MENU_BAR r_glx_tagfullscreen_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_glx_tagfullscreen_menu; txt=""; } + }; + } + +//ImageViewer fullscreen View +RESOURCE MENU_BAR r_glx_imageviewer_fullscreen_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_glx_imageviewer_fullscreen_menu; txt=""; } + }; + } + + +// ------------------------------------------------------------------------------------ +// Menu Contents for Fullscreen views +// ------------------------------------------------------------------------------------ +// +// Basic fullscreen views +RESOURCE MENU_PANE r_glx_fullscreen_menu + { + items= + { + MENU_ITEM { command = EGlxStopShowing; + txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command = EGlxCmdPlay; + txt = qtn_lgal_options_play; }, + MENU_ITEM { command = EGlxCmdHideUI; + txt = qtn_lgal_options_hide_toolbar; }, + MENU_ITEM { command = EGlxCmdSend; + txt = qtn_options_send_via; }, + MENU_ITEM { command = EGlxCmdAiwShareOnOvi; + /* txt comes from ShareOnline 4.3 */}, + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; }, + MENU_ITEM { command = EGlxCmdSlideshow; + txt = qtn_lgal_options_slideshow; + cascade = r_glx_fullscreen_shw_menu;}, + MENU_ITEM { command = EGlxCmdAiwEdit; + txt = qtn_lgal_options_edit; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDetails; + txt = qtn_lgal_options_details; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; }, + MENU_ITEM { command = EGlxCmdAiwAssign; + txt = qtn_lgal_options_use_items; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; + txt = qtn_lgal_option_show_on_map; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline; + txt=qtn_drm_options_more_info; }, +// MENU_ITEM { command=EGlxCmdRotate; +// txt=qtn_lgal_options_rotate; +// cascade = r_rotate_sub_menu; }, + MENU_ITEM { command = EGlxCmdAiwPrint; + txt = qtn_lgal_options_print_menu; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command=EGlxShowViaUpnp; + txt=qtn_lgal_options_show_ext; }, + MENU_ITEM { command = EAknCmdHelp; + txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; + txt = qtn_options_exit; } + }; + } + + +// Albums Fullscreen view +RESOURCE MENU_PANE r_glx_album_fullscreen_menu + { + items= + { + MENU_ITEM { command = EGlxStopShowing; + txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command = EGlxCmdPlay; + txt = qtn_lgal_options_play; }, + MENU_ITEM { command = EGlxCmdHideUI; + txt = qtn_lgal_options_hide_toolbar; }, + MENU_ITEM { command = EGlxCmdSend; + txt = qtn_options_send_via; }, + MENU_ITEM { command = EGlxCmdAiwShareOnOvi; + /* txt comes from ShareOnline 4.3 */}, + MENU_ITEM { command = EGlxCmdRemoveFrom; + txt = qtn_lgal_options_remove_from_album; }, + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; }, + MENU_ITEM { command = EGlxCmdSlideshow; + txt = qtn_lgal_options_slideshow; + cascade = r_glx_fullscreen_shw_menu;}, + MENU_ITEM { command = EGlxCmdAiwEdit; + txt = qtn_lgal_options_edit; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDetails; + txt = qtn_lgal_options_details; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; }, + MENU_ITEM { command = EGlxCmdAiwAssign; + txt = qtn_lgal_options_use_items; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; + txt = qtn_lgal_option_show_on_map; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline; + txt=qtn_drm_options_more_info; }, +// MENU_ITEM { command=EGlxCmdRotate; +// txt=qtn_lgal_options_rotate; +// cascade = r_rotate_sub_menu; }, + MENU_ITEM { command = EGlxCmdAiwPrint; + txt = qtn_lgal_options_print_menu; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command=EGlxShowViaUpnp; + txt=qtn_lgal_options_show_ext; }, + MENU_ITEM { command = EAknCmdHelp; + txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; + txt = qtn_options_exit; } + }; + } + +// Tag Fullscreen view +RESOURCE MENU_PANE r_glx_tagfullscreen_menu + { + items= + { + MENU_ITEM { command = EGlxStopShowing; + txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command = EGlxCmdPlay; + txt = qtn_lgal_options_play; }, + MENU_ITEM { command = EGlxCmdHideUI; + txt = qtn_lgal_options_hide_toolbar; }, + MENU_ITEM { command = EGlxCmdSend; + txt = qtn_options_send_via; }, + MENU_ITEM { command = EGlxCmdAiwShareOnOvi; + /* txt comes from ShareOnline 4.3 */}, + MENU_ITEM { command=EGlxCmdRemoveFrom; + txt = qtn_lgal_options_remove_from_tag; }, + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; }, + MENU_ITEM { command = EGlxCmdSlideshow; + txt = qtn_lgal_options_slideshow; + cascade = r_glx_fullscreen_shw_menu;}, + MENU_ITEM { command = EGlxCmdAiwEdit; + txt = qtn_lgal_options_edit; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDetails; + txt = qtn_lgal_options_details; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; }, + MENU_ITEM { command = EGlxCmdAiwAssign; + txt = qtn_lgal_options_use_items; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; + txt = qtn_lgal_option_show_on_map; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline; + txt=qtn_drm_options_more_info; }, +// MENU_ITEM { command=EGlxCmdRotate; +// txt=qtn_lgal_options_rotate; +// cascade = r_rotate_sub_menu; }, + MENU_ITEM { command = EGlxCmdAiwPrint; + txt = qtn_lgal_options_print_menu; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command=EGlxShowViaUpnp; + txt=qtn_lgal_options_show_ext; }, + MENU_ITEM { command = EAknCmdHelp; + txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; + txt = qtn_options_exit; } + }; + } + +// ImageViewer Fullscreen view +RESOURCE MENU_PANE r_glx_imageviewer_fullscreen_menu + { + items= + { + MENU_ITEM { command = EGlxCmdSave; + txt= "Save"; }, + //txt= qtn_lgal_tooltip_save; }, + MENU_ITEM { command = EGlxCmdSend; + txt = qtn_options_send_via; }, + MENU_ITEM { command = EGlxCmdAiwShareOnOvi; + /* txt comes from ShareOnline 4.3 */}, + MENU_ITEM { command = EGlxCmdAiwEdit; + txt = qtn_lgal_options_edit; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDetails; + txt = qtn_lgal_options_details; }, + MENU_ITEM { command = EGlxCmdAiwAssign; + txt = qtn_lgal_options_use_items; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdAiwPrint; + txt = qtn_lgal_options_print_menu; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EAknCmdHelp; + txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; + txt = qtn_options_exit; } + }; + } + + + + +// ------------------------------------------------------------------------------------ +// Submenu Contents +// ------------------------------------------------------------------------------------ + +// Slideshow sub menu +RESOURCE MENU_PANE r_glx_fullscreen_shw_menu + { + items= + { + MENU_ITEM { command=EGlxCmdSlideshowPlay; txt=qtn_lgal_options_slideshow_play; }, + MENU_ITEM { command=EGlxCmdSlideshowSettings; txt=qtn_lgal_options_slideshow_settings_general; } + }; + } + +// Rotate Sub menu +//RESOURCE MENU_PANE r_rotate_sub_menu +// { +// items = +// { +// MENU_ITEM +// { +// command = EGlxCmdRotateLeft; +// txt = qtn_lgal_options_rotate_left; +// }, +// MENU_ITEM +// { +// command = EGlxCmdRotateRight; +// txt = qtn_lgal_options_rotate_right; +// } +// }; +// } + + +// ------------------------------------------------------------------------------------ +// Softkey Resources +// ------------------------------------------------------------------------------------ + +// Fullscreen softkeys +RESOURCE CBA r_glx_fullscreen_softkeys + { + flags = EEikCbaFlagTransparent; + buttons = + { + CBA_BUTTON + { + id = EGlxCmdOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EAknSoftkeyEmpty; + txt = " "; + } + }; + } + +// Zoom control softkeys +RESOURCE CBA r_glx_fullscreen_softkeys_zoom + { + flags = EEikCbaFlagTransparent; + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyEmpty; + txt = " "; + }, + CBA_BUTTON + { + id = EGlxCmdFullScreenBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EAknSoftkeyEmpty; + txt = " "; + } + }; + } + + +// ------------------------------------------------------------------------------------ +// Toolbar Resource (if it is a touch screen device) +// ------------------------------------------------------------------------------------ + +// For all FullScreen views +RESOURCE AVKON_TOOLBAR r_glx_fullscreen_view_toolbar + { + flags = KAknToolbarFixed|KAknToolbarTransparent|KAknToolbarNoBackground; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSend; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + helptxt = qtn_lgal_tooltip_send; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdDelete; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + helptxt = qtn_lgal_tooltip_delete; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdUpload; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + } + }; + }; + } + }; + } + +// For ImageViewer Fullscreen views +RESOURCE AVKON_TOOLBAR r_glx_imageviewer_fullscreen_view_toolbar + { + flags = KAknToolbarFixed|KAknToolbarTransparent|KAknToolbarNoBackground; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSave; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsSave; + bmpmask = EMbmGlxiconsSave_mask; + press_bmpid = EMbmGlxiconsSave; + press_bmpmask = EMbmGlxiconsSave_mask; + //helptxt = qtn_lgal_tooltip_save; + helptxt = "Save"; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSend; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + helptxt = qtn_lgal_tooltip_send; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdAiwAssign; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsUse_as; + bmpmask = EMbmGlxiconsUse_as_mask; + press_bmpid = EMbmGlxiconsUse_as; + press_bmpmask = EMbmGlxiconsUse_as_mask; + helptxt = qtn_lgal_options_use_image_as; + } + }; + }; + } + }; + } +// ------------------------------------------------------------------------------------ +// Single Line meta pane resource +// ------------------------------------------------------------------------------------ +RESOURCE TBUF r_fullscreen_no_location_info + { +// buf = qtn_lgal_no_location_info; + buf = "#No Location info"; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/group/glxfullscreenviewplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/group/glxfullscreenviewplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxfullscreenviewplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2000A7C3 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxmainfullscreenviewplugin.cpp +SOURCE glxalbumfullscreenviewplugin.cpp +SOURCE glxcameraalbumfullscreenviewplugin.cpp +SOURCE glxdownloadsfullscreenviewplugin.cpp +SOURCE glxmonthsfullscreenviewplugin.cpp +SOURCE glxfullscreenviewpluginproxy.cpp +SOURCE glxtagfullscreenviewplugin.cpp +SOURCE glximageviewerfullscreenviewplugin.cpp + +START RESOURCE ../data/2000A7C3.rss +TARGET glxfullscreenviewplugin.rsc +END // RESOURCE + +START RESOURCE ../data/glxfullscreenviewdata.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +// System includes from epoc32/include +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../layouts/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../views/fullscreenview/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../fullscreenviewpluginbase/inc // for localisation + +LIBRARY cone.lib // for MCoeView +LIBRARY efsrv.lib // for TParseBase +LIBRARY euser.lib // for RAllocator +LIBRARY glxcommon.lib // for CResourceUtilities +LIBRARY glxcommoncommandhandlers.lib // for CommandHandlers +LIBRARY glxfullscreenview.lib +LIBRARY glxfullscreenviewpluginbase.lib +LIBRARY glxviewbase.lib // for CGlxViewBase +LIBRARY mpxviewplugin.lib // for CMPXViewPlugin +LIBRARY flogger.lib // For Logging Tracer +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxalbumfullscreenviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxalbumfullscreenviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: MPX FullScreen view plugin definition. +* +*/ + + + + + +#ifndef C_GLXALBUMFULLSCREENVIEWPLUGIN_H +#define C_GLXALBUMFULLSCREENVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxAlbumFullScreenViewPlugin ) : public CGlxFullScreenViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxAlbumFullScreenViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxAlbumFullScreenViewPlugin(); + +private: + + /** + * From CGlxAlbumFullScreenViewPluginBase + * + */ + void AddCommandHandlersL(); + + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxAlbumFullScreenViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXALBUMFULLSCREENVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxcameraalbumfullscreenviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxcameraalbumfullscreenviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: MPX FullScreen view plugin definition. +* +*/ + + + + + +#ifndef C_GLXCAMERAALBUMFULLSCREENVIEWPLUGIN_H +#define C_GLXCAMERAALBUMFULLSCREENVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxCameraAlbumFullScreenViewPlugin ) : public CGlxFullScreenViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxCameraAlbumFullScreenViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxCameraAlbumFullScreenViewPlugin(); + +private: + + /** + * From CGlxAlbumFullScreenViewPluginBase + * + */ + void AddCommandHandlersL(); + + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxCameraAlbumFullScreenViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXCAMERAALBUMFULLSCREENVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxdownloadsfullscreenviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxdownloadsfullscreenviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: MPX FullScreen view plugin definition. +* +*/ + + + + + +#ifndef C_GLXDOWNLOADSFULLSCREENVIEWPLUGIN_H +#define C_GLXDOWNLOADSFULLSCREENVIEWPLUGIN_H + + +// INCLUDES +#include +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxDownloadsFullScreenViewPlugin ) : public CGlxFullScreenViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxDownloadsFullScreenViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxDownloadsFullScreenViewPlugin(); + +private: + + /** + * From CGlxFullScreenViewPluginBase + * + */ + void AddCommandHandlersL(); + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxDownloadsFullScreenViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + /** + *Resource file offset + */ + mutable TInt iResOffset; + + }; + +#endif // C_GLXDOWNLOADSFULLSCREENVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxfullscreenviewplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxfullscreenviewplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + + +#ifndef GLXFULLSCREENVIEWPLUGIN_HRH +#define GLXFULLSCREENVIEWPLUGIN_HRH + +// CONSTANTS + +#define KGlxMainFullScreenViewImplementationId 0x2000D24B +#define KGlxAlbumFullScreenViewImplementationId 0x2000D24C +#define KGlxCameraAlbumFullScreenViewImplementationId 0x2000D24D +#define KGlxDownloadsFullScreenViewImplementationId 0x2000D24E +#define KGlxImageViewerFullScreenViewImplementationId 0x2000D24F + +#define KGlxMonthsFullScreenViewImplementationId 0x2000D249 +#define KGlxTagFullScreenViewPluginImplementationUid 0x2000D24A + +#endif // GLXFULLSCREENVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glximageviewerfullscreenviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glximageviewerfullscreenviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: MPX FullScreen view plugin definition. +* +*/ + + + + + +#ifndef C_GLXIVFULLSCREENVIEWPLUGIN_H +#define C_GLXIVFULLSCREENVIEWPLUGIN_H + + +// INCLUDES +#include +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxImageViewerScreenViewPlugin ) : public CGlxFullScreenViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxImageViewerScreenViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxImageViewerScreenViewPlugin(); + +private: + + /** + * From CGlxFullScreenViewPluginBase + * + */ + void AddCommandHandlersL(); + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxImageViewerScreenViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + /** + *Resource file offset + */ + mutable TInt iResOffset; + + }; + +#endif // C_GLXIVFULLSCREENVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxmainfullscreenviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxmainfullscreenviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: MPX FullScreen view plugin definition. +* +*/ + + + + + +#ifndef C_GLXMAINFULLSCREENVIEWPLUGIN_H +#define C_GLXMAINFULLSCREENVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxMainFullScreenViewPlugin ) : public CGlxFullScreenViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxMainFullScreenViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxMainFullScreenViewPlugin(); + + +private: + + /** + * Add plugin specific command handlers + */ + void AddCommandHandlersL(); + + /** + * From CGlxFullScreenViewPluginBase + * + */ + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxMainFullScreenViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXMAINFULLSCREENVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxmonthsfullscreenviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxmonthsfullscreenviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: MPX FullScreen view plugin definition. +* +*/ + + + + + +#ifndef C_GLXMONTHSFULLSCREENVIEWPLUGIN_H +#define C_GLXMONTHSFULLSCREENVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxMonthsFullScreenViewPlugin ) : public CGlxFullScreenViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxMonthsFullScreenViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxMonthsFullScreenViewPlugin(); + +private: + + /** + * From CGlxAlbumFullScreenViewPluginBase + * + */ + void AddCommandHandlersL(); + + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxMonthsFullScreenViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXMONTHSFULLSCREENVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxtagfullscreenviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/inc/glxtagfullscreenviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2008-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: MPX FullScreen view plugin definition. +* +*/ + + + + +// INCLUDES +#include + +#ifndef C_GLXTESTFULLSCREENVIEWPLUGIN_H +#define C_GLXTESTFULLSCREENVIEWPLUGIN_H + +// CLASS DECLARATION + + +/** + * CGlxTagFullScreenViewPlugin + */ + /* MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxTagFullScreenViewPlugin ) : public CGlxFullScreenViewPluginBase + { + //Unit Testing + + friend class ut_CGlxTagFullScreenViewPlugin; +public: + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxTagFullScreenViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxTagFullScreenViewPlugin(); + +private: + //From CGlxFullScreenViewPluginBase + /** + * Adds Command Handlers to the view + */ + void AddCommandHandlersL(); + /** + * Define the resource file + * @param filename + */ + void GetResourceFilenameL(TFileName& aResFile); + +private: + /** + * C++ default constructor. + */ + CGlxTagFullScreenViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_GLXTESTFULLSCREENVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxalbumfullscreenviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxalbumfullscreenviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxalbumfullscreenviewplugin.h" + +#include "glxfullscreenviewplugin.hrh" +#include +#include + +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include + +#include "glxcommandhandlerdetails.h" +#include "glxfullscreenview.h" + +_LIT(KGlxFullScreenResource,"glxfullscreenviewdata.rsc"); + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxAlbumFullScreenViewPlugin::CGlxAlbumFullScreenViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_ALBUM_FULLSCREEN_MENU; + iResourceIds.iViewId = R_GLX_ALBUM_FULLSCREEN_VIEW; + iResourceIds.iCbaId = R_GLX_FULLSCREEN_SOFTKEYS; + iViewUID = KGlxAlbumFullScreenViewImplementationId; + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxAlbumFullScreenViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxAlbumFullScreenViewPlugin* CGlxAlbumFullScreenViewPlugin::NewL() + { + CGlxAlbumFullScreenViewPlugin* self = + new ( ELeave ) CGlxAlbumFullScreenViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxAlbumFullScreenViewPlugin::~CGlxAlbumFullScreenViewPlugin() + { + // Do nothing + } + + +void CGlxAlbumFullScreenViewPlugin::AddCommandHandlersL() + { + CGlxFullScreenViewPluginBase::AddCommandHandlersL(); + // Remove from Album. + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom::NewL(iFullScreenView, EMPXAlbum)); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_ALBUM_FULLSCREEN; + + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + + + +void CGlxAlbumFullScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxFullScreenResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxcameraalbumfullscreenviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxcameraalbumfullscreenviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxcameraalbumfullscreenviewplugin.h" + +#include "glxfullscreenviewplugin.hrh" +#include +#include + +#include + +#include "glxcommandhandlerdetails.h" +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include "glxfullscreenview.h" + +_LIT(KGlxFullScreenResource,"glxfullscreenviewdata.rsc"); + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCameraAlbumFullScreenViewPlugin::CGlxCameraAlbumFullScreenViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_FULLSCREEN_MENU; + iResourceIds.iViewId = R_GLX_FULLSCREEN_VIEW; + iResourceIds.iCbaId = R_GLX_FULLSCREEN_SOFTKEYS; + iViewUID = KGlxCameraAlbumFullScreenViewImplementationId; + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCameraAlbumFullScreenViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxCameraAlbumFullScreenViewPlugin* CGlxCameraAlbumFullScreenViewPlugin::NewL() + { + CGlxCameraAlbumFullScreenViewPlugin* self = + new ( ELeave ) CGlxCameraAlbumFullScreenViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxCameraAlbumFullScreenViewPlugin::~CGlxCameraAlbumFullScreenViewPlugin() + { + // Do nothing + } + + +void CGlxCameraAlbumFullScreenViewPlugin::AddCommandHandlersL() + { + CGlxFullScreenViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_CAMERA_ALBUM_FULLSCRN; + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +void CGlxCameraAlbumFullScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxFullScreenResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxdownloadsfullscreenviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxdownloadsfullscreenviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of download FullScreen view plugin +* +*/ + + + + + +// INCLUDE FILES + +#include "glxdownloadsfullscreenviewplugin.h" + +#include "glxfullscreenviewplugin.hrh" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include // For Cenrep Keys +#include +#include +#include +#include +#include + +#include +#include // icons + +_LIT(KGlxFullScreenResource,"glxfullscreenviewdata.rsc"); + + + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxDownloadsFullScreenViewPlugin::CGlxDownloadsFullScreenViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_FULLSCREEN_MENU; + iResourceIds.iViewId = R_GLX_FULLSCREEN_VIEW; + iResourceIds.iCbaId = R_GLX_FULLSCREEN_SOFTKEYS; + iViewUID = KGlxDownloadsFullScreenViewImplementationId; + + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxDownloadsFullScreenViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxDownloadsFullScreenViewPlugin* CGlxDownloadsFullScreenViewPlugin::NewL() + { + CGlxDownloadsFullScreenViewPlugin* self = + new ( ELeave ) CGlxDownloadsFullScreenViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxDownloadsFullScreenViewPlugin::~CGlxDownloadsFullScreenViewPlugin() + { + if ( iResOffset ) + { + CCoeEnv::Static()->DeleteResourceFile( iResOffset ); + } + } + +// --------------------------------------------------------------------------- +// AddCommandHandlersL +// --------------------------------------------------------------------------- +// +void CGlxDownloadsFullScreenViewPlugin::AddCommandHandlersL() + { + GLX_LOG_ENTRY_EXIT_LEAVE_L("CGlxDownloadsFullScreenViewPlugin::AddCommandHandlersL()"); + CGlxFullScreenViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_DOWNLOADS_FULLSCREEN; + + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + + + +// ----------------------------------------------------------------------------- +// GetResourceFilenameL +// ----------------------------------------------------------------------------- +// +void CGlxDownloadsFullScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxFullScreenResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxfullscreenviewpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxfullscreenviewpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + + +// INCLUDE FILES +#include +#include "glxfullscreenviewplugin.hrh" +#include "glxmainfullscreenviewplugin.h" +#include "glxalbumfullscreenviewplugin.h" +#include "glxcameraalbumfullscreenviewplugin.h" +#include "glxdownloadsfullscreenviewplugin.h" +#include "glxmonthsfullscreenviewplugin.h" +#include "glxtagfullscreenviewplugin.h" +#include "glximageviewerfullscreenviewplugin.h" + +#if ( !defined IMPLEMENTATION_PROXY_ENTRY ) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) } +#endif + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// The list of implementations +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( + KGlxMainFullScreenViewImplementationId, + CGlxMainFullScreenViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxAlbumFullScreenViewImplementationId, + CGlxAlbumFullScreenViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxCameraAlbumFullScreenViewImplementationId, + CGlxCameraAlbumFullScreenViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxDownloadsFullScreenViewImplementationId, + CGlxDownloadsFullScreenViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxMonthsFullScreenViewImplementationId, + CGlxMonthsFullScreenViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxTagFullScreenViewPluginImplementationUid, + CGlxTagFullScreenViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxImageViewerFullScreenViewImplementationId, + CGlxImageViewerScreenViewPlugin::NewL ), + }; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = + sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glximageviewerfullscreenviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glximageviewerfullscreenviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of download FullScreen view plugin +* +*/ + + + + + +// INCLUDE FILES + +#include "glximageviewerfullscreenviewplugin.h" + +#include "glxfullscreenviewplugin.hrh" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include // For Cenrep Keys +#include +#include +#include +#include +#include + +#include +#include // icons + +_LIT(KGlxFullScreenResource,"glxfullscreenviewdata.rsc"); + + + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxImageViewerScreenViewPlugin::CGlxImageViewerScreenViewPlugin() + + { + + TRACER("CGlxImageViewerScreenViewPlugin::CGlxImageViewerScreenViewPlugin()"); + + iResourceIds.iMenuId = R_GLX_IMAGEVIEWER_FULLSCREEN_MENU; //r_glx_imageviewer_fullscreen_menu + iResourceIds.iViewId = R_GLX_IMAGEVIEWER_FULLSCREEN_VIEW; //r_glx_imageviewer_fullscreen_view + iResourceIds.iCbaId = R_GLX_FULLSCREEN_SOFTKEYS; + iViewUID = KGlxImageViewerFullScreenViewImplementationId; + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxImageViewerScreenViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxImageViewerScreenViewPlugin* CGlxImageViewerScreenViewPlugin::NewL() + { + TRACER("CGlxImageViewerScreenViewPlugin::::NewL()"); + + CGlxImageViewerScreenViewPlugin* self = + new ( ELeave ) CGlxImageViewerScreenViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxImageViewerScreenViewPlugin::~CGlxImageViewerScreenViewPlugin() + { + TRACER("CGlxImageViewerScreenViewPlugin::::~CGlxImageViewerScreenViewPlugin()"); + + if ( iResOffset ) + { + CCoeEnv::Static()->DeleteResourceFile( iResOffset ); + } + } + +// --------------------------------------------------------------------------- +// AddCommandHandlersL +// --------------------------------------------------------------------------- +// +void CGlxImageViewerScreenViewPlugin::AddCommandHandlersL() + { + TRACER("CGlxImageViewerScreenViewPlugin::AddCommandHandlersL()"); + + GLX_LOG_ENTRY_EXIT_LEAVE_L("CGlxImageViewerScreenViewPlugin::AddCommandHandlersL()"); + CGlxFullScreenViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_DOWNLOADS_FULLSCREEN; + + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + + + +// ----------------------------------------------------------------------------- +// GetResourceFilenameL +// ----------------------------------------------------------------------------- +// +void CGlxImageViewerScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TRACER("CGlxImageViewerScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile)"); + + TParse parse; + parse.Set(KGlxFullScreenResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxmainfullscreenviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxmainfullscreenviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxmainfullscreenviewplugin.h" +#include "glxfullscreenviewplugin.hrh" + +#include + +#include +#include // for CGlxResourceUtilities + +#include + +#include +#include +#include + +#include +#include +#include + + +_LIT(KGlxFullScreenResource,"glxfullscreenviewdata.rsc"); + + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxMainFullScreenViewPlugin::CGlxMainFullScreenViewPlugin() + + { + TRACER("CGlxMainFullScreenViewPlugin::CGlxMainFullScreenViewPlugin()"); + iResourceIds.iMenuId = R_GLX_FULLSCREEN_MENU; + iResourceIds.iViewId = R_GLX_FULLSCREEN_VIEW; + iResourceIds.iCbaId = R_GLX_FULLSCREEN_SOFTKEYS; + iViewUID = KGlxMainFullScreenViewImplementationId; + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMainFullScreenViewPlugin::ConstructL() + { + TRACER("CGlxMainFullScreenViewPlugin::ConstructL()"); + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxMainFullScreenViewPlugin* CGlxMainFullScreenViewPlugin::NewL() + { + TRACER("CGlxMainFullScreenViewPlugin::NewL()"); + CGlxMainFullScreenViewPlugin* self = + new ( ELeave ) CGlxMainFullScreenViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMainFullScreenViewPlugin::~CGlxMainFullScreenViewPlugin() + { + TRACER("CGlxMainFullScreenViewPlugin::~CGlxMainFullScreenViewPlugin()"); + // Do nothing + } + +// --------------------------------------------------------------------------- +// AddCommandHandlersL +// --------------------------------------------------------------------------- +// +void CGlxMainFullScreenViewPlugin::AddCommandHandlersL() + { + CGlxFullScreenViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_ALL_FULLSCREEN; + + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +void CGlxMainFullScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TRACER("CGlxMainFullScreenViewPlugin::GetResourceFilenameL()"); + TParse parse; + parse.Set(KGlxFullScreenResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxmonthsfullscreenviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxmonthsfullscreenviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE Files + +#include "glxmonthsfullscreenviewplugin.h" +#include "glxfullscreenviewplugin.hrh" + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include + +#include "glxfullscreenview.h" + +#include + +_LIT(KGlxFullScreenResource,"glxfullscreenviewdata.rsc"); + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxMonthsFullScreenViewPlugin::CGlxMonthsFullScreenViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_FULLSCREEN_MENU; + iResourceIds.iViewId = R_GLX_FULLSCREEN_VIEW; + iResourceIds.iCbaId = R_GLX_FULLSCREEN_SOFTKEYS; + iViewUID = KGlxMonthsFullScreenViewImplementationId; + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMonthsFullScreenViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxMonthsFullScreenViewPlugin* CGlxMonthsFullScreenViewPlugin::NewL() + { + CGlxMonthsFullScreenViewPlugin* self = + new ( ELeave ) CGlxMonthsFullScreenViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMonthsFullScreenViewPlugin::~CGlxMonthsFullScreenViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// AddCommandHandlersL +// --------------------------------------------------------------------------- +// +void CGlxMonthsFullScreenViewPlugin::AddCommandHandlersL() + { + CGlxFullScreenViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_MONTH_FULLSCREEN; + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +void CGlxMonthsFullScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxFullScreenResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxtagfullscreenviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewplugin/src/glxtagfullscreenviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxtagfullscreenviewplugin.h" +#include "glxfullscreenviewplugin.hrh" // KGlxTagTileViewPluginImplementationUid + +#include + +#include //BaflUtils +#include //KDC_APP_RESOURCE_DIR +#include //CGlxCommandHandlerRemoveFrom +#include +#include +#include + +#include // for CGlxResourceUtilities + + + +_LIT(KGlxTileResource,"glxfullscreenviewdata.rsc"); //TagTileView Resource File + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +CGlxTagFullScreenViewPlugin::CGlxTagFullScreenViewPlugin() + { + TRACER("CGlxTagFullScreenViewPlugin::CGlxTagFullScreenViewPlugin()"); + + iResourceIds.iViewId = R_GLX_TAGFULLSCREEN_VIEW; + iResourceIds.iMenuId = R_GLX_TAGFULLSCREEN_MENU; + iResourceIds.iCbaId = R_GLX_FULLSCREEN_SOFTKEYS; + iViewUID = KGlxTagFullScreenViewPluginImplementationUid; + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +void CGlxTagFullScreenViewPlugin::ConstructL() + { + TRACER("CGlxTagFullScreenViewPlugin::CGlxTagFullScreenViewPlugin()"); + // Do nothing + } + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- + CGlxTagFullScreenViewPlugin* CGlxTagFullScreenViewPlugin::NewL() + { + + TRACER( "CGlxTagFullScreenViewPlugin::NewL"); + + CGlxTagFullScreenViewPlugin* self = new ( ELeave ) CGlxTagFullScreenViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CGlxTagFullScreenViewPlugin::~CGlxTagFullScreenViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Adds Command Handlers to the view +//----------------------------------------------------------------------------- +void CGlxTagFullScreenViewPlugin::AddCommandHandlersL() + { + TRACER( "CGlxTagFullScreenViewPlugin::AddCommandHandlersL"); + + CGlxFullScreenViewPluginBase::AddCommandHandlersL(); + + //For tag tile view + GLX_LOG_INFO("Adding CGlxCommandHandlerRemoveFrom"); + //iTileView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom::NewL(iTileView, EMPXTag)); + + // set up help context info + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_TAGS_GRID; + helpInfo.iBrowseContext = LGAL_HLP_TAGS_FULLSCREEN; + + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +//----------------------------------------------------------------------------- +// Get the Resource File Name +//----------------------------------------------------------------------------- + +void CGlxTagFullScreenViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TRACER( "CGlxTagFullScreenViewPlugin::GetResourceFilenameL"); //Logging + TParse parse; + parse.Set(KGlxTileResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +//End Of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewpluginbase/bwins/glxfullscreenviewpluginbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewpluginbase/bwins/glxfullscreenviewpluginbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,11 @@ +EXPORTS + ?AddCommandHandlersL@CGlxFullScreenViewPluginBase@@MAEXXZ @ 1 NONAME ; void CGlxFullScreenViewPluginBase::AddCommandHandlersL(void) + ?GetResourceFilenameL@CGlxFullScreenViewPluginBase@@MAEXAAV?$TBuf@$0BAA@@@@Z @ 2 NONAME ; void CGlxFullScreenViewPluginBase::GetResourceFilenameL(class TBuf<256> &) + ?ImageUri@CGlxImageViewerManager@@QAEPAVHBufC16@@XZ @ 3 NONAME ; class HBufC16 * CGlxImageViewerManager::ImageUri(void) + ?ImageFileHandle@CGlxImageViewerManager@@QBEAAVRFile64@@XZ @ 4 NONAME ; class RFile64 & CGlxImageViewerManager::ImageFileHandle(void) const + ?IncrementRefCount@CGlxImageViewerManager@@QAEXXZ @ 5 NONAME ; void CGlxImageViewerManager::IncrementRefCount(void) + ??1CGlxFullScreenViewPluginBase@@UAE@XZ @ 6 NONAME ; CGlxFullScreenViewPluginBase::~CGlxFullScreenViewPluginBase(void) + ??0CGlxFullScreenViewPluginBase@@QAE@XZ @ 7 NONAME ; CGlxFullScreenViewPluginBase::CGlxFullScreenViewPluginBase(void) + ?IsPrivate@CGlxImageViewerManager@@QAEHXZ @ 8 NONAME ; int CGlxImageViewerManager::IsPrivate(void) + ?ConstructViewLC@CGlxFullScreenViewPluginBase@@MAEPAVCAknView@@XZ @ 9 NONAME ; class CAknView * CGlxFullScreenViewPluginBase::ConstructViewLC(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewpluginbase/eabi/glxfullscreenviewpluginbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewpluginbase/eabi/glxfullscreenviewpluginbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,12 @@ +EXPORTS + _ZN28CGlxFullScreenViewPluginBase15ConstructViewLCEv @ 1 NONAME + _ZN28CGlxFullScreenViewPluginBase19AddCommandHandlersLEv @ 2 NONAME + _ZN28CGlxFullScreenViewPluginBase20GetResourceFilenameLER4TBufILi256EE @ 3 NONAME + _ZN28CGlxFullScreenViewPluginBaseC1Ev @ 4 NONAME + _ZN28CGlxFullScreenViewPluginBaseC2Ev @ 5 NONAME + _ZN28CGlxFullScreenViewPluginBaseD0Ev @ 6 NONAME + _ZN28CGlxFullScreenViewPluginBaseD1Ev @ 7 NONAME + _ZN28CGlxFullScreenViewPluginBaseD2Ev @ 8 NONAME + _ZTI28CGlxFullScreenViewPluginBase @ 9 NONAME + _ZTV28CGlxFullScreenViewPluginBase @ 10 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewpluginbase/group/glxfullscreenviewpluginbase.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewpluginbase/group/glxfullscreenviewpluginbase.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxfullscreenviewpluginbase.dll +TARGETTYPE dll +UID 0x10009D8D 0x2000A770 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxfullscreenviewpluginbase.cpp + + +USERINCLUDE ../inc + +// System includes from the source tree +// System includes from the source tree +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlermarking/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlermoreinfo/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerupnp/inc //Command Handler Upnp +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../layouts/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../views/fullscreenview/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../common/inc + +// System includes from epoc32/include +APP_LAYER_SYSTEMINCLUDE + + + +LIBRARY cone.lib // for MCoeView +LIBRARY euser.lib // for RAllocator +LIBRARY glxcommoncommandhandlers.lib // for CommandHandlers +LIBRARY glxcommandhandlermoreinfo.lib +LIBRARY glxfullscreenview.lib +LIBRARY glxupnpcommandhandler.lib //For Upnp Command Handler +LIBRARY glxviewbase.lib // for CGlxViewBase +LIBRARY mpxviewplugin.lib // for CMPXViewPlugin +LIBRARY flogger.lib // For Logging Tracer + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewpluginbase/inc/glxfullscreenviewpluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewpluginbase/inc/glxfullscreenviewpluginbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2008-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: MPX Tile view plugin definition. +* +*/ + + + + + +#ifndef C_GLXFULLSCREENVIEWPLUGINBASE_H +#define C_GLXFULLSCREENVIEWPLUGINBASE_H + + +// INCLUDES +#include +#include "glxmedialistfactory.h" +#include "glxfullscreenview.h" // for TTileViewResourceIds + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +class CGlxFullScreenViewPluginBase : public CMPXAknViewPlugin, public MGlxMediaListFactory + { +public: + + /** + + /** + * Destructor. + */ +IMPORT_C virtual ~CGlxFullScreenViewPluginBase(); + +protected: + + /** + * From CMPXAknViewPlugin + * Construct Avkon view. + * + * @since S60 v3.0 + * @return Pointer to a newly created Avkon view. + */ +IMPORT_C CAknView* ConstructViewLC(); + + /** + * Override to add command handlers to the view + * + */ +virtual void AddCommandHandlersL(); + + /** + * Override to define resource file + * + */ +virtual void GetResourceFilenameL(TFileName& aResFile); + +public: + + /** + * C++ default constructor. + */ +IMPORT_C CGlxFullScreenViewPluginBase(); + +private: + /** + * Callback for periodic timer, non-static, and hence allows this + * pointer to be used + */ + static TInt PeriodicCallback( TAny* aPtr ); + /** + * Callback for periodic timer, non-static, and hence allows this + * pointer to be used + */ + void PeriodicCallback(); + + +protected: + // Pointer to the created tile view, not owned + CGlxFullScreenView* iFullScreenView; + + TFullScreenViewResourceIds iResourceIds; + TInt iResourceOffset; + TInt iViewUID; + //View Specific Widget Ids + TViewWidgetIds iWidgetIds; + CPeriodic* iPeriodic; + }; + +#endif // C_GLXFULLSCREENVIEWPLUGINBASE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/fullscreenviewpluginbase/src/glxfullscreenviewpluginbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/fullscreenviewpluginbase/src/glxfullscreenviewpluginbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,282 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES +#include "glxfullscreenviewpluginbase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //Command Handlers Upnp +#include +#include + +#include "glxfullscreenview.h" + +/** + * Start Delay for the periodic timer, in microseconds + */ +const TInt KPeriodicStartDelay = 500000; + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxFullScreenViewPluginBase::CGlxFullScreenViewPluginBase() + { + TRACER("CGlxFullScreenViewPluginBase::CGlxFullScreenViewPluginBase()"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxFullScreenViewPluginBase::~CGlxFullScreenViewPluginBase() + { + TRACER("CGlxFullScreenViewPluginBase::~CGlxFullScreenViewPluginBase()"); + // Do nothing + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + if (iPeriodic) + { + iPeriodic->Cancel(); + delete iPeriodic; + } + } +// ----------------------------------------------------------------------------- +// Callback from periodic timer +// ----------------------------------------------------------------------------- +// +TInt CGlxFullScreenViewPluginBase::PeriodicCallback(TAny* aPtr ) + { + //GLX_ASSERT_DEBUG( aPtr != NULL, Panic( EGlxPanicLogicError ), + // "Received null pointer for garbage collector" ); + + // get "this" pointer + static_cast< CGlxFullScreenViewPluginBase* >( aPtr )->PeriodicCallback(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Callback from periodic timer, non-static +// ----------------------------------------------------------------------------- +// + +inline void CGlxFullScreenViewPluginBase::PeriodicCallback() + { + TRAP_IGNORE(AddCommandHandlersL()); + iPeriodic->Cancel(); + } + +// --------------------------------------------------------------------------- +// From CMPXAknViewPlugin +// Construct Avkon view. +// --------------------------------------------------------------------------- +// +EXPORT_C CAknView* CGlxFullScreenViewPluginBase::ConstructViewLC() + { + GLX_LOG_INFO("=>CGlxFullScreenViewPluginBase::ConstructViewLC"); + + TFileName resFile; + GetResourceFilenameL(resFile); + + if(resFile.Length() > 0) + { + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resFile); + } + + CGlxFullScreenView* fullScreenView = CGlxFullScreenView::NewLC(this, + iResourceIds, iViewUID); + + iFullScreenView = fullScreenView; + + //AddCommandHandlersL(); + GLX_LOG_INFO("Adding CGlxCommandHandlerBack"); + iFullScreenView->AddCommandHandlerL( + CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL()); + + if(!iPeriodic) + { + iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard); + } + + if ( !iPeriodic->IsActive() ) + { + iPeriodic->Start( KPeriodicStartDelay, KMaxTInt, TCallBack( &PeriodicCallback, + static_cast( this ) ) ); + } + + GLX_LOG_INFO("<=CGlxFullScreenViewPluginBase::ConstructViewLC"); + // Return on cleanup stack with ownership passed + return fullScreenView; + } + +// --------------------------------------------------------------------------- +// Add the command handlers +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxFullScreenViewPluginBase::AddCommandHandlersL() + { + TRACER("CGlxFullScreenViewPluginBase::AddCommandHandlersL()"); + + // Note that the order in which the command handlers are added determines + // the order in which the toolbar displays the icons + + GLX_LOG_INFO( "Adding CGlxCommandHandlerSave" ); + iFullScreenView->AddCommandHandlerL( + CGlxCommandHandlerSave::NewL( iFullScreenView, ETrue ) ); + + GLX_LOG_INFO( "Adding CGlxCommandHandlerSlideshow" ); + iFullScreenView->AddCommandHandlerL( + CGlxCommandHandlerSlideshow::NewL( iFullScreenView, ETrue , ETrue ) ); + + GLX_LOG_INFO("Adding CGlxCommandHandlerDetails"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerDetails:: + NewL(iFullScreenView)); + +// GLX_LOG_INFO("Adding CGlxCommandHandlerRotate"); +// iFullScreenView->AddCommandHandlerL( +// CGlxCommandHandlerRotate::NewL( iFullScreenView ) ); + + GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: + NewAddToAlbumCommandHandlerL(iFullScreenView, EFalse)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: + NewAddToFavCommandHandlerL(iFullScreenView, EFalse)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerDetails"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerDetails:: + NewL(iFullScreenView)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: + NewAddToTagCommandHandlerL(iFullScreenView, EFalse)); + // The AIW service handlers + // ShowMap must be the first one + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShowMap"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwShowMap:: + NewL(iFullScreenView, iResourceIds.iMenuId)); + // Assign must be the second one + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwAssign"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwAssign:: + NewL(iFullScreenView, iResourceIds.iMenuId)); + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwEdit"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwEdit:: + NewL(iFullScreenView, iResourceIds.iMenuId)); + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwPrintPreview"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwPrintPreview:: + NewL(iFullScreenView, iResourceIds.iMenuId)); + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShareOnOvi"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwShareOnOvi:: + NewL(iFullScreenView, iResourceIds.iMenuId)); + // End of AIW service handlers + + GLX_LOG_INFO("Adding CGlxCommandHandlerMoreInfo"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerMoreInfo:: + NewL(iFullScreenView,EFalse)); + GLX_LOG_INFO("Adding CGlxCommandHandlerHideUi"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHideUi::NewL()); + + //Fix for error ID EVTY-7M87LF + //@ Registration of Video Playback Command handler has to before UPnP. + //@ else UPnP will not get play command once video playback command is consumed. + GLX_LOG_INFO("Adding CGlxCommandHandlerVideoPlayback"); + iFullScreenView->AddCommandHandlerL( + CGlxCommandHandlerVideoPlayback::NewL( iFullScreenView ) ); + + //Fix for error ID EVTY-7M87LF + //@ Registration of UPnP Command handler has to be after video play back command + //@ priorty of command handling is last registered in first server basis. + //@ UPnP will get play command first everytime, where it'll check for UPnP active. + //@ if UPnP is active it'll consume the event, else it'll allow other registered command to execute it. + + GLX_LOG_INFO("Adding CGlxCommandHandlerShowVisUpnp"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerShowViaUpnp::NewL( + iFullScreenView,EFalse)); + + //Toolbar commands for all Fullscreen views. May also be present in Options menu. + GLX_LOG_INFO("Adding CGlxCommandHandlerSend"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerSend::NewL( + iFullScreenView, ETrue)); + GLX_LOG_INFO("Adding CGlxCommandHandlerDelete"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerDelete:: + NewL(iFullScreenView, EFalse, ETrue)); + GLX_LOG_INFO("Adding CGlxCommandHandlerUpload"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerUpload::NewL( + iFullScreenView, ETrue)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShowMapHardKey"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwShowMapHardKey::NewL( + iFullScreenView, ETrue)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerRemoveFrom"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom:: + NewL(iFullScreenView, EMPXTag)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerRemoveFromFavourites"); + iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom:: + NewRemFromFavCommandHandlerL(iFullScreenView )); + + } + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxFullScreenViewPluginBase::GetResourceFilenameL(TFileName& aResFile) + { + TRACER("CGlxFullScreenViewPluginBase::GetResourceFilenameL()"); + + aResFile = KNullDesC; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/data/20000a03.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/data/20000a03.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + + +// INCLUDES +#include +#include +#include "glxgridviewplugin.hrh" + +// RESOURCE DEFINITIONS + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: uid of the supported Playback/Collection plugin. + * E.g. if the view plugin supports Local Playback plugin, the list of + * uids will be: 0x101FFC06 + * Now the Opaque data can contain a Depth (Path Level) UID. + * This is to differentiate between the Album Plugin requires a List View (Depth 2 - list of Albums) + * and it requiring a Grid View (Depth 3 Contents of an album). + * However the Plugin ID must score higher than the depth. So now we must add the plugin Id 4 Times + * The value of the depths are KGlxDepthTwo - , KGlxDepthThree - 0x2000A776 and KGlxDepthFour - 0x200104DB + * I could not seem to use a #define in between the

<\p> tags so the values had to be used + * + * uid + * uid: plugin type uid. + * E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0 + * + * flags [optional] + * flags: sum of the required feature flags that listed in mpxviewplugin.hrh. + * E.g. if the view plugin needs to be pre-loaded and it's user-selectable, + * then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003. + * + * priority [optional] + * priority: a value of type TMPXViewPluginPriorities. This value determines + * which view plugin will be resolved when several plugins can support the + * same set of Uids. + * Default value of this field is EMPXViewPluginPriorityNormal. + * + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x20000A03; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXViewPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxMainGridViewImplementationId; + version_no = 1; + display_name = "Main Grid view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A775;0x2000A7C1;0x2000A7C1;0x2000A7C1;0x2000A7C1

" + "0x20000A04" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxAlbumGridViewImplementationId; + version_no = 1; + display_name = "Album Grid view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A776;0x20007197;0x20007197;0x20007197;0x20007197;

" + "0x2000A772" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxDownloadsGridViewImplementationId; + version_no = 1; + display_name = "Downloads Grid view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A775;0x2000a76b;0x2000a76b;0x2000a76b;0x2000a76b

" + "0x2000A774" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxCameraAlbumGridViewImplementationId; + version_no = 1; + display_name = "Camera Albums Grid view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A775;2000A767;0x2000A767;0x2000A767;0x2000A767

" + "0x2000A773" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxMonthsGridViewImplementationId; + version_no = 1; + display_name = "Months Grid view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A776;0x2000A769;0x2000A769;0x2000A769;0x2000A769

" + "0x2000718E" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxTagGridViewPluginImplementationUid; + version_no = 1; + display_name = "Tag Grid view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A776;0x200071AE;0x200071AE;0x200071AE;0x200071AE

" + "0x2000A762" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/data/glxcontainercommonresources.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/data/glxcontainercommonresources.rh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008-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: Common macros for menu options in Tag Grid view, Captured Grid view and Album Grid view. +* +*/ + + + + +// Macros to provide common options for the menus in Album Grid view, Captured Grid view and Tag Grid view respectively. +#include + +// if show images & show videos only feature is enabled, add it to the menu +#ifdef GLX_GRID_VIEW_IMAGES_OR_VIDEOS_ONLY_FILTERING + +#define GLX_CONTAINER_OPTIONS_LIST1 MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline;\ + txt=qtn_drm_options_more_info; },\ + MENU_ITEM { command = EGlxCmdDelete;\ + txt = qtn_lgal_options_delete; },\ + MENU_ITEM { command=EGlxCmdHideUI;\ + txt=qtn_lgal_options_toolbar_off; },\ + MENU_ITEM { command = EGlxCmdSlideshow;\ + txt = qtn_lgal_options_slideshow;\ + cascade = r_grid_shw_menu;},\ + MENU_ITEM { command = EGlxCmdSend;\ + txt = qtn_options_send_via;},\ + MENU_ITEM { command = EGlxCmdMarkingSubmenu;\ + txt = qtn_options_list;\ + cascade = r_viu_editlist_menu;},\ + MENU_ITEM { command = EGlxCmdShow; \ + txt = qtn_lgal_options_show; \ + cascade = r_grid_show_menu;}, \ + MENU_ITEM { command = EGlxCmdAiwShowMap;\ + txt = qtn_lgal_option_show_on_map;\ + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; },\ + MENU_ITEM { command = EGlxCmdDetails;\ + txt = qtn_lgal_options_details;},\ + MENU_ITEM { command = EGlxCmdAddTag;\ + txt = qtn_lgal_options_properties_add_tags; },\ + MENU_ITEM { command = EGlxCmdAddToAlbum;\ + txt = qtn_lgal_options_add_to_album; }, +#else + +#define GLX_CONTAINER_OPTIONS_LIST1 MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline;\ + txt=qtn_drm_options_more_info; },\ + MENU_ITEM { command = EGlxCmdDelete;\ + txt = qtn_lgal_options_delete; },\ + MENU_ITEM { command=EGlxCmdHideUI;\ + txt=qtn_lgal_options_toolbar_off; },\ + MENU_ITEM { command = EGlxCmdSlideshow;\ + txt = qtn_lgal_options_slideshow;\ + cascade = r_grid_shw_menu;},\ + MENU_ITEM { command = EGlxCmdMarkingSubmenu;\ + txt = qtn_options_list;\ + cascade = r_viu_editlist_menu;},\ + MENU_ITEM { command = EGlxCmdAiwShowMap;\ + txt = qtn_lgal_option_show_on_map;\ + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; },\ + MENU_ITEM { command = EGlxCmdDetails;\ + txt = qtn_lgal_options_details;},\ + MENU_ITEM { command = EGlxCmdAddTag;\ + txt = qtn_lgal_options_properties_add_tags; },\ + MENU_ITEM { command = EGlxCmdAddToAlbum;\ + txt = qtn_lgal_options_add_to_album; }, +#endif + +#define GLX_CONTAINER_OPTIONS_LIST2 MENU_ITEM { command = EGlxCmdAiwPrint;\ + txt = qtn_lgal_options_print_menu;\ + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; },\ + MENU_ITEM { command = EGlxCmdAiwEdit;\ + txt = qtn_lgal_options_edit;\ + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; },\ + MENU_ITEM { command = EGlxCmdAiwAssign;\ + txt = qtn_lgal_options_use_items;\ + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; },\ + MENU_ITEM { command = EGlxCmdCopyMoveSubmenu;\ + txt = qtn_lgal_move_copy;\ + cascade = r_grid_copy_move_menu; },\ + MENU_ITEM { command = EGlxHomeNetworkSubmenu;\ + txt = qtn_lgal_options_home_network;\ + cascade = r_home_network_menu; },\ + MENU_ITEM { command=EGlxShowViaUpnp; txt=qtn_lgal_options_show_ext; },\ + MENU_ITEM { command=EGlxStopShowing; txt=qtn_lgal_options_stop_show; },\ + MENU_ITEM { command = EAknCmdHelp;\ + txt = qtn_options_help; },\ + MENU_ITEM { command = EAknCmdExit;\ + txt = qtn_options_exit; } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/data/glxdownloadtext.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/data/glxdownloadtext.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Grid View plugin +* +*/ + + + + +// RESOURCE IDENTIFIER + +// NOTE: VARIANT TEAM: Please DO NOT CHANGE the NAME tag below to any other value than what is provided +// when giving a different resource file. +NAME MPXD + +#include +#include +#include +#include + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="GLTV"; } + +// Resource to provide the download link text for Image +RESOURCE TBUF r_grid_view_text_download_images + { + buf = qtn_lgal_info_download_images_text; + } + +// Resource to provide the download link text for Videos +RESOURCE TBUF r_grid_view_text_download_videos + { + buf = qtn_lgal_info_download_videos_text; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/data/glxgridviewdata.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/data/glxgridviewdata.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,610 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Grid View plugin +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME MPXC + +// INCLUDES + +#include "glxcommandhandlers.hrh" +#include "glxcontainercommonresources.rh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="GLTV"; } + +// ----------------------------------------------------------------------------------- +// Resource Definitions +// ----------------------------------------------------------------------------------- + +// Downloads Grid View +RESOURCE AVKON_VIEW r_grid_view + { + menubar = r_grid_menubar; + cba = r_grid_softkeys; + toolbar = r_glx_grid_view_toolbar; + } + +// Captured Grid View +RESOURCE AVKON_VIEW r_glx_captured_grid_view + { + menubar = r_grid_menubar; + cba = r_grid_softkeys; + toolbar = r_glx_grid_view_toolbar; + } + +// Months Grid View +RESOURCE AVKON_VIEW r_glx_months_grid_view + { + menubar = r_grid_menubar; + cba = r_grid_softkeys; + toolbar = r_glx_grid_view_toolbar; + } + +// Albums Grid View +RESOURCE AVKON_VIEW r_glx_album_grid_view + { + menubar = r_glx_album_grid_menubar; + cba = r_grid_softkeys; + toolbar = r_glx_grid_view_toolbar; + } + +// Tag Grid View +RESOURCE AVKON_VIEW r_taggrid_view + { + menubar = r_taggrid_menubar; + cba = r_grid_softkeys; + toolbar = r_glx_grid_view_toolbar; + } + + +// ------------------------------------------------------------------------------------ +// Menu Bar Resources +// ------------------------------------------------------------------------------------ + +// Basic Grid Views +RESOURCE MENU_BAR r_grid_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_glx_grid_menu; txt=""; } + }; + } + +// Albums Grid View +RESOURCE MENU_BAR r_glx_album_grid_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_glx_album_grid_menu; txt=""; } + }; + } + +// Tags Grid View +RESOURCE MENU_BAR r_taggrid_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_taggrid_menu; txt=""; } + }; + } + + +// ------------------------------------------------------------------------------------ +// Menu Contents for Grid views +// ------------------------------------------------------------------------------------ + +// Basic grid views +RESOURCE MENU_PANE r_glx_grid_menu + { + items= + { + MENU_ITEM { command = EAknCmdOpen; + txt = qtn_msk_open; }, + MENU_ITEM { command = EGlxCmdPlay; + txt = qtn_lgal_options_play; }, + MENU_ITEM { command = EGlxCmdSend; + txt = qtn_options_send_via; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAiwShareOnOvi; + /* txt comes from ShareOnline 4.3 */ + flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdSlideshowPlay; + txt = qtn_lgal_options_slideshow; + flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EGlxCmdSlideshow; + txt = qtn_lgal_options_slideshow; + cascade = r_grid_shw_menu; }, + MENU_ITEM { command = EGlxCmdAiwEdit; + txt = qtn_lgal_options_edit; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; + flags = EEikMenuItemSpecificListQuery;}, + MENU_ITEM { command = EGlxCmdDetails; + txt = qtn_lgal_options_details; }, + MENU_ITEM { command = EGlxCmdMarkingSubmenu; + txt = qtn_options_list; + cascade = r_viu_editlist_menu; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAiwAssign; + txt = qtn_lgal_options_use_items; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; + txt = qtn_lgal_option_show_on_map; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline; + txt=qtn_drm_options_more_info; }, + MENU_ITEM { command = EGlxCmdAiwPrint; + txt = qtn_lgal_options_print_menu; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxHomeNetworkSubmenu; + txt = qtn_lgal_options_home_network; + cascade = r_home_network_menu; }, + MENU_ITEM { command = EAknCmdHelp; + txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; + txt = qtn_options_exit; } + }; + } + +// Albums Grid +RESOURCE MENU_PANE r_glx_album_grid_menu + { + items= + { + MENU_ITEM { command = EAknCmdOpen; + txt = qtn_msk_open; }, + MENU_ITEM { command = EGlxCmdPlay; + txt = qtn_lgal_options_play; }, + MENU_ITEM { command = EGlxCmdSend; + txt = qtn_options_send_via; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAiwShareOnOvi; + /* txt comes from ShareOnline 4.3 */ + flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EGlxCmdRemoveFrom; + txt = qtn_lgal_options_remove_from_album; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdSlideshowPlay; + txt = qtn_lgal_options_slideshow; + flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EGlxCmdSlideshow; + txt = qtn_lgal_options_slideshow; + cascade = r_grid_shw_menu; }, + MENU_ITEM { command = EGlxCmdAiwEdit; + txt = qtn_lgal_options_edit; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; + flags = EEikMenuItemSpecificListQuery;}, + MENU_ITEM { command = EGlxCmdDetails; + txt = qtn_lgal_options_details; }, + MENU_ITEM { command = EGlxCmdMarkingSubmenu; + txt = qtn_options_list; + cascade = r_viu_editlist_menu; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; }, + MENU_ITEM { command = EGlxCmdAiwAssign; + txt = qtn_lgal_options_use_items; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; + txt = qtn_lgal_option_show_on_map; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline; + txt=qtn_drm_options_more_info; }, + MENU_ITEM { command = EGlxCmdAiwPrint; + txt = qtn_lgal_options_print_menu; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxHomeNetworkSubmenu; + txt = qtn_lgal_options_home_network; + cascade = r_home_network_menu; }, + MENU_ITEM { command = EAknCmdHelp; + txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; + txt = qtn_options_exit; } + }; + } + +// Tags Grid +RESOURCE MENU_PANE r_taggrid_menu + { + items= + { + MENU_ITEM { command = EAknCmdOpen; + txt = qtn_msk_open; }, + MENU_ITEM { command = EGlxCmdPlay; + txt = qtn_lgal_options_play; }, + MENU_ITEM { command = EGlxCmdSend; + txt = qtn_options_send_via; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAiwShareOnOvi; + /* txt comes from ShareOnline 4.3 */ + flags = EEikMenuItemSpecific;}, + MENU_ITEM { command=EGlxCmdRemoveFrom; + txt = qtn_lgal_options_remove_from_tag; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdSlideshowPlay; + txt = qtn_lgal_options_slideshow; + flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EGlxCmdAiwEdit; + txt = qtn_lgal_options_edit; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; + flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EGlxCmdDetails; + txt = qtn_lgal_options_details; }, + MENU_ITEM { command = EGlxCmdMarkingSubmenu; + txt = qtn_options_list; + cascade = r_viu_editlist_menu; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAiwAssign; + txt = qtn_lgal_options_use_items; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; + txt = qtn_lgal_option_show_on_map; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxCmdDrmMoreInfoOnline; + txt=qtn_drm_options_more_info; }, + MENU_ITEM { command = EGlxCmdAiwPrint; + txt = qtn_lgal_options_print_menu; + cascade = AIW_INTELLIGENT_CASCADE_ID|AIW_LOCK_SUBMENU_TITLE; }, + MENU_ITEM { command = EGlxHomeNetworkSubmenu; + txt = qtn_lgal_options_home_network; + cascade = r_home_network_menu; }, + MENU_ITEM { command = EAknCmdHelp; + txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; + txt = qtn_options_exit; } + }; + } + + + + +// ------------------------------------------------------------------------------------ +// Submenu contents +// ------------------------------------------------------------------------------------ + +// Slideshow submenu +RESOURCE MENU_PANE r_grid_shw_menu + { + items= + { + MENU_ITEM { command=EGlxCmdSlideshowPlay; txt=qtn_lgal_options_slideshow_play; }, + MENU_ITEM { command=EGlxCmdSlideshowSettings; txt=qtn_lgal_options_slideshow_settings_general; } + }; + } + + +// EditList sub menu for Marking +RESOURCE MENU_PANE r_viu_editlist_menu + { + items = + { + /*MENU_ITEM + { + command = EAknCmdMark; + txt = qtn_options_list_mark_one; + },*/ + MENU_ITEM + { + command = EAknMarkAll; + txt = qtn_options_list_mark_all; + }, + /*MENU_ITEM + { + command = EAknCmdUnmark; + txt = qtn_options_list_unmark_one; + },*/ + MENU_ITEM + { + command = EAknUnmarkAll; + txt = qtn_options_list_unmark_all; + } + }; + } + +// Rotate Sub menu +//RESOURCE MENU_PANE r_rotate_sub_menu +// { +// items = +// { +// MENU_ITEM +// { +// command = EGlxCmdRotateLeft; +// txt = qtn_lgal_options_rotate_left; +// }, +// MENU_ITEM +// { +// command = EGlxCmdRotateRight; +// txt = qtn_lgal_options_rotate_right; +// } +// }; +// } + +// Home Network sub menu +RESOURCE MENU_PANE r_home_network_menu + { + items= + { + MENU_ITEM { command=EGlxShowViaUpnpSubmenuVersion; txt=qtn_lgal_options_sub_show_ext; }, + MENU_ITEM { command=EGlxStopShowingSubmenuVersion; txt=qtn_lgal_options_sub_stop_show; }, + MENU_ITEM { command=EGlxCopyToHomeNetwork; txt=qtn_lgal_options_copy_to_home_net; } + }; + } + + +// ------------------------------------------------------------------------------------ +// Other Menubars +// ------------------------------------------------------------------------------------ + +RESOURCE MENU_BAR r_grid_ok_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_grid_ok_menu; txt=""; } + }; + } + +RESOURCE MENU_BAR r_grid_ok_menubar_album_gridview + { + titles= + { + MENU_TITLE { menu_pane=r_grid_ok_menu_album_gridview; txt=""; } + }; + } + +RESOURCE MENU_BAR r_grid_ok_menubar_tag_gridview + { + titles= + { + MENU_TITLE { menu_pane=r_grid_ok_menu_tag_gridview; txt=""; } + }; + } + +RESOURCE MENU_PANE r_grid_ok_menu + { + items= + { + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; }, + MENU_ITEM { command = EAknUnmarkAll; + txt = qtn_options_list_unmark_all; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; } + }; + } + +RESOURCE MENU_PANE r_grid_ok_menu_album_gridview + { + items= + { + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; }, + MENU_ITEM { command = EAknUnmarkAll; + txt = qtn_options_list_unmark_all; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; }, + MENU_ITEM { command = EGlxCmdRemoveFrom; + txt = qtn_lgal_options_remove_from_album; } + }; + } + +RESOURCE MENU_PANE r_grid_ok_menu_tag_gridview + { + items= + { + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete; }, + MENU_ITEM { command = EAknUnmarkAll; + txt = qtn_options_list_unmark_all; }, + MENU_ITEM { command = EGlxCmdAddToAlbum; + txt = qtn_lgal_options_add_to_album; }, + MENU_ITEM { command = EGlxCmdAddTag; + txt = qtn_lgal_options_properties_add_tag; }, + MENU_ITEM { command=EGlxCmdRemoveFrom; + txt=qtn_lgal_options_remove_from_tag; } + }; + } + +// ------------------------------------------------------------------------------------ +// Softkey resources +// ------------------------------------------------------------------------------------ + +RESOURCE CBA r_grid_softkeys + { + buttons = + { + CBA_BUTTON + { + id = EGlxCmdOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EAknCmdOpen; + txt = qtn_msk_open; + } + }; + } + + +RESOURCE CBA r_grid_softkeys_fullscreen + { + buttons = + { + CBA_BUTTON + { + id = EGlxCmdOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EGlxCmdFullScreenBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EAknSoftkeySelect; + txt = qtn_msk_select; + } + }; + } + +// ------------------------------------------------------------------------------------ +// Empty text resource +// ------------------------------------------------------------------------------------ +RESOURCE TBUF r_grid_empty_view_text + { + buf = qtn_lgal_empty_grid_no_items; + } + +RESOURCE TBUF r_grid_view_text_download_header + { + buf = qtn_lgal_info_download_header; + } + +RESOURCE TBUF r_grid_marking_mode + { + buf = qtn_lgal_title_marking_mode; + } + +// --------------------------------------------------------------------------- +// Toolbar Resource +// --------------------------------------------------------------------------- +// +RESOURCE AVKON_TOOLBAR r_glx_grid_view_toolbar + { + flags = KAknToolbarFixed; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSlideshowPlay; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + helptxt = qtn_lgal_options_slideshow; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdStartMultipleMarking; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_mark; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_mark_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_mark; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_mark_mask; + helptxt = qtn_lgal_tooltip_mark_items; + }, + AVKON_BUTTON_STATE + { + flags = KAknButtonStateHasLatchedFrame; + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_unmark; + bmpmask = EMbmGlxiconsQgn_indi_tb_unmark_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_unmark; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_unmark_mask; + helptxt = qtn_lgal_tooltip_unmark_all; + } + }; + }; + }, + + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdUpload; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + } + }; + }; + } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/group/glxgridviewplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/group/glxgridviewplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxgridviewplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20000A03 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxmaingridviewplugin.cpp +SOURCE glxalbumgridviewplugin.cpp +SOURCE glxcameraalbumgridviewplugin.cpp +SOURCE glxdownloadsgridviewplugin.cpp +SOURCE glxmonthsgridviewplugin.cpp +SOURCE glxgridviewpluginproxy.cpp +SOURCE glxtaggridviewplugin.cpp + +START RESOURCE ../data/20000a03.rss +TARGET glxgridviewplugin.rsc +END // RESOURCE + +START RESOURCE ../data/glxgridviewdata.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +START RESOURCE ../data/glxdownloadtext.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlermarking/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../layouts/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../views/gridview/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc +SYSTEMINCLUDE ../../gridviewpluginbase/inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../gallery/loc // for localisation + +LIBRARY glxcommoncommandhandlers.lib +LIBRARY glxcommandhandlermarking.lib +LIBRARY cone.lib // for MCoeView +LIBRARY efsrv.lib // for TParseBase +LIBRARY euser.lib // for RAllocator +LIBRARY glxgridview.lib // for CGlxGridView +LIBRARY mpxviewplugin.lib // for CMPXViewPlugin +LIBRARY glxmedialists.lib // for CGlxMedialist +LIBRARY mpxcommon.lib // for TMPXAttribute +LIBRARY glxgridviewpluginbase.lib +LIBRARY glxviewbase.lib // for CGlxViewBase +LIBRARY commonengine.lib // for StringLoader +LIBRARY glxcommon.lib // for CResourceUtilities +LIBRARY centralrepository.lib // for CRepository +LIBRARY flogger.lib // For Logging Tracer + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/inc/glxalbumgridviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/inc/glxalbumgridviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: MPX Grid view plugin definition. +* +*/ + + + + + +#ifndef C_GLXALBUMGRIDVIEWPLUGIN_H +#define C_GLXALBUMGRIDVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxAlbumGridViewPlugin ) : public CGlxGridViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxAlbumGridViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxAlbumGridViewPlugin(); + +private: + + /** + * From CGlxAlbumGridViewPluginBase + * + */ + void AddCommandHandlersL(); + + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxAlbumGridViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXALBUMGRIDVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/inc/glxcameraalbumgridviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/inc/glxcameraalbumgridviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: MPX Grid view plugin definition. +* +*/ + + + + + +#ifndef C_GLXCAMERAALBUMGRIDVIEWPLUGIN_H +#define C_GLXCAMERAALBUMGRIDVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxCameraAlbumGridViewPlugin ) : public CGlxGridViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxCameraAlbumGridViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxCameraAlbumGridViewPlugin(); + +private: + + /** + * From CGlxAlbumGridViewPluginBase + * + */ + void AddCommandHandlersL(); + + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxCameraAlbumGridViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXCAMERAALBUMGRIDVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/inc/glxdownloadsgridviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/inc/glxdownloadsgridviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-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: MPX Grid view plugin definition. +* +*/ + + + + + +#ifndef C_GLXDOWNLOADSGRIDVIEWPLUGIN_H +#define C_GLXDOWNLOADSGRIDVIEWPLUGIN_H + + +// INCLUDES +#include +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxDownloadsGridViewPlugin ) : public CGlxGridViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxDownloadsGridViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxDownloadsGridViewPlugin(); + + + virtual MGlxMediaList& CreateMediaListL(MMPXCollectionUtility& aCollectionUtility) const; + + +private: + + /** + * From CGlxGridViewPluginBase + * + */ + void AddCommandHandlersL(); + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxDownloadsGridViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + /** + *Resource file offset + */ + mutable TInt iResOffset; + + }; + +#endif // C_GLXDOWNLOADSGRIDVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/inc/glxgridviewplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/inc/glxgridviewplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + + +#ifndef GLXGRIDVIEWPLUGIN_HRH +#define GLXGRIDVIEWPLUGIN_HRH + +// CONSTANTS + +#define KGlxMainGridViewImplementationId 0x20000A04 +#define KGlxAlbumGridViewImplementationId 0x2000A772 +#define KGlxCameraAlbumGridViewImplementationId 0x2000A773 +#define KGlxDownloadsGridViewImplementationId 0x2000A774 +#define KGlxMonthsGridViewImplementationId 0x2000718E +#define KGlxTagGridViewPluginImplementationUid 0x2000A762 + +#endif // GLXGRIDVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/inc/glxmaingridviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/inc/glxmaingridviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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: MPX Grid view plugin definition. +* +*/ + + + + + +#ifndef C_GLXMAINGRIDVIEWPLUGIN_H +#define C_GLXMAINGRIDVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxMainGridViewPlugin ) : public CGlxGridViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxMainGridViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxMainGridViewPlugin(); + + +private: + + /** + * Add plugin specific command handlers + */ + void AddCommandHandlersL(); + + /** + * From CGlxGridViewPluginBase + * + */ + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxMainGridViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXMAINGRIDVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/inc/glxmonthsgridviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/inc/glxmonthsgridviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: MPX Grid view plugin definition. +* +*/ + + + + + +#ifndef C_GLXMONTHSGRIDVIEWPLUGIN_H +#define C_GLXMONTHSGRIDVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CGlxMonthsGridViewPlugin ) : public CGlxGridViewPluginBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxMonthsGridViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxMonthsGridViewPlugin(); + +private: + + /** + * From CGlxAlbumGridViewPluginBase + * + */ + void AddCommandHandlersL(); + + + void GetResourceFilenameL(TFileName& aResFile); + + + +private: + + /** + * C++ default constructor. + */ + CGlxMonthsGridViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + }; + +#endif // C_GLXMONTHSGRIDVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/inc/glxtaggridviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/inc/glxtaggridviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2008-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: MPX Grid view plugin definition. +* +*/ + + + + +// INCLUDES +#include + +#ifndef C_GLXTAGGRIDVIEWPLUGIN_H +#define C_GLXTAGGRIDVIEWPLUGIN_H + +// CLASS DECLARATION +/** + * @internal reviewed 12/06/2007 by Alex Birkett + */ + +/** + * CGlxTagGridViewPlugin + * @author Ranjini Srinivasa + */ + /* MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + * + */ +NONSHARABLE_CLASS( CGlxTagGridViewPlugin ) : public CGlxGridViewPluginBase + { + //Unit Testing + + friend class ut_CGlxTagGridViewPlugin; +public: + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxTagGridViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxTagGridViewPlugin(); + +private: + //From CGlxGridViewPluginBase + /** + * Adds Command Handlers to the view + */ + void AddCommandHandlersL(); + /** + * Define the resource file + * @param filename + */ + void GetResourceFilenameL(TFileName& aResFile); + +private: + /** + * C++ default constructor. + */ + CGlxTagGridViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_GLXTESTGRIDVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/src/glxalbumgridviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/src/glxalbumgridviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxalbumgridviewplugin.h" + +#include "glxgridviewplugin.hrh" +#include +#include + +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include + +#include "glxcommandhandlerdetails.h" +#include "glxgridview.h" + +_LIT(KGlxGridResource,"glxgridviewdata.rsc"); + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxAlbumGridViewPlugin::CGlxAlbumGridViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_ALBUM_GRID_MENU; + iResourceIds.iViewId = R_GLX_ALBUM_GRID_VIEW; + iResourceIds.iCbaId = R_GRID_SOFTKEYS; + iResourceIds.iEmptyViewTextId = R_GRID_EMPTY_VIEW_TEXT; + iResourceIds.iOkOptionsMenuId = R_GRID_OK_MENUBAR_ALBUM_GRIDVIEW; + iViewUID = KGlxAlbumGridViewImplementationId; + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxAlbumGridViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxAlbumGridViewPlugin* CGlxAlbumGridViewPlugin::NewL() + { + CGlxAlbumGridViewPlugin* self = + new ( ELeave ) CGlxAlbumGridViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxAlbumGridViewPlugin::~CGlxAlbumGridViewPlugin() + { + // Do nothing + } + + +void CGlxAlbumGridViewPlugin::AddCommandHandlersL() + { + CGlxGridViewPluginBase::AddCommandHandlersL(); + // Remove from Album + ///@todo this should only be added to the albums view plugin. + iGridView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom::NewL(iGridView, EMPXAlbum)); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_ALBUM_GRID; + helpInfo.iViewContext = LGAL_HLP_ALBUM_FULLSCREEN; + + iGridView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + + } + + + +void CGlxAlbumGridViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxGridResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/src/glxcameraalbumgridviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/src/glxcameraalbumgridviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxcameraalbumgridviewplugin.h" + +#include "glxgridviewplugin.hrh" +#include +#include + +#include + + +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include + +#include "glxgridview.h" + +_LIT(KGlxGridResource,"glxgridviewdata.rsc"); + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCameraAlbumGridViewPlugin::CGlxCameraAlbumGridViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_GRID_MENU; + iResourceIds.iViewId = R_GLX_CAPTURED_GRID_VIEW; + iResourceIds.iCbaId = R_GRID_SOFTKEYS; + iResourceIds.iEmptyViewTextId = R_GRID_EMPTY_VIEW_TEXT; + iResourceIds.iOkOptionsMenuId = R_GRID_OK_MENUBAR; + iViewUID = KGlxCameraAlbumGridViewImplementationId; + + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCameraAlbumGridViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxCameraAlbumGridViewPlugin* CGlxCameraAlbumGridViewPlugin::NewL() + { + CGlxCameraAlbumGridViewPlugin* self = + new ( ELeave ) CGlxCameraAlbumGridViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxCameraAlbumGridViewPlugin::~CGlxCameraAlbumGridViewPlugin() + { + // Do nothing + } + + +void CGlxCameraAlbumGridViewPlugin::AddCommandHandlersL() + { + CGlxGridViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_CAMERA_ALBUM_GRID; + helpInfo.iViewContext = LGAL_HLP_CAMERA_ALBUM_FULLSCRN; + iGridView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +void CGlxCameraAlbumGridViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxGridResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/src/glxdownloadsgridviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/src/glxdownloadsgridviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of download Grid view plugin +* +*/ + + + + + +/** + * @internal reviewed 26/06/2007 by Rowland Cook + */ + +// INCLUDE FILES + +#include "glxdownloadsgridviewplugin.h" + +#include "glxgridviewplugin.hrh" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include // For Cenrep Keys +#include +#include +#include +#include +#include + +#include +#include // icons +#include + +_LIT(KGlxGridResource,"glxgridviewdata.rsc"); + +const TInt KStaticItemId1 = 12345; +const TInt KStaticItemId2 = 12346; + + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxDownloadsGridViewPlugin::CGlxDownloadsGridViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_GRID_MENU; + iResourceIds.iViewId = R_GRID_VIEW; + iResourceIds.iCbaId = R_GRID_SOFTKEYS; + iResourceIds.iEmptyViewTextId = R_GRID_EMPTY_VIEW_TEXT; + iResourceIds.iOkOptionsMenuId = R_GRID_OK_MENUBAR; + iViewUID = KGlxDownloadsGridViewImplementationId; + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxDownloadsGridViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxDownloadsGridViewPlugin* CGlxDownloadsGridViewPlugin::NewL() + { + CGlxDownloadsGridViewPlugin* self = + new ( ELeave ) CGlxDownloadsGridViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxDownloadsGridViewPlugin::~CGlxDownloadsGridViewPlugin() + { + if ( iResOffset ) + { + CCoeEnv::Static()->DeleteResourceFile( iResOffset ); + } + } + + + +void CGlxDownloadsGridViewPlugin::AddCommandHandlersL() + { + TRACER("CGlxDownloadsGridViewPlugin::AddCommandHandlersL()"); + CGlxGridViewPluginBase::AddCommandHandlersL(); + + TInt isDownloadLink = CGlxSettingsModel::ValueL( KGlxDownloadLink ); + + if ( isDownloadLink ) + { + GLX_LOG_INFO("Adding CGlxCommandHandlerDownload"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerDownload::NewL()); + } + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_DOWNLOADS_GRID; + helpInfo.iViewContext = LGAL_HLP_DOWNLOADS_FULLSCREEN; + + iGridView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + + + +// ----------------------------------------------------------------------------- +// GetResourceFilenameL +// ----------------------------------------------------------------------------- +// +void CGlxDownloadsGridViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxGridResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + + +// ----------------------------------------------------------------------------- +// CreateMediaListL +// ----------------------------------------------------------------------------- +// +MGlxMediaList& CGlxDownloadsGridViewPlugin::CreateMediaListL( + MMPXCollectionUtility& aCollectionUtility) const + { + TRACER("CGlxDownloadsGridViewPlugin::CreateMediaListL()"); + MGlxMediaList* mediaList = NULL; + + // Create media list + CMPXCollectionPath* path = aCollectionUtility.Collection().PathL(); + CleanupStack::PushL(path); + + // need to check the level for EUnit test case, if there are no more level in the path + // there is no point in going back. + if ( path->Levels() ) + { + path->Back(); + } + mediaList = MGlxMediaList::InstanceL(*path); + CleanupClosePushL(*mediaList); + TInt isDownloadLink = CGlxSettingsModel::ValueL( KGlxDownloadLink ); + if (!isDownloadLink) + { + CleanupStack::Pop(mediaList); + CleanupStack::PopAndDestroy(path); + return *mediaList; + } + + // add a static items + TGlxMediaId testId(KStaticItemId1); + CGlxMedia* newMedia1 = new (ELeave) CGlxMedia(testId); + CleanupStack::PushL(newMedia1); + + TGlxMediaId testId2(KStaticItemId2); + CGlxMedia* newMedia2 = new (ELeave) CGlxMedia(testId2); + CleanupStack::PushL(newMedia2); + TFileName reslocName = CGlxSettingsModel::ValueL( KGlxDownloadLinkText ); + TParse parse; + parse.Set(reslocName, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + if(!iResOffset) + { + iResOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + } + HBufC* title = + StringLoader::LoadLC(R_GRID_VIEW_TEXT_DOWNLOAD_HEADER); + newMedia1->SetTextValueL(KMPXMediaGeneralTitle, *title); + newMedia2->SetTextValueL(KMPXMediaGeneralTitle, *title); + CleanupStack::PopAndDestroy(title); + + HBufC* subtitle = + StringLoader::LoadLC(R_GRID_VIEW_TEXT_DOWNLOAD_IMAGES); + newMedia1->SetTextValueL(KGlxMediaCollectionPluginSpecificSubTitle, + *subtitle); + CleanupStack::PopAndDestroy(subtitle); + + HBufC* subtitle2 = + StringLoader::LoadLC(R_GRID_VIEW_TEXT_DOWNLOAD_VIDEOS); + newMedia2->SetTextValueL(KGlxMediaCollectionPluginSpecificSubTitle, + *subtitle2); + CleanupStack::PopAndDestroy(subtitle2); + + // add static attribute containing the command id of the command + // handled by the command handler + newMedia1->SetTObjectValueL( + TMPXAttribute(KGlxMediaIdStaticItem, + KGlxMediaStaticItemCommand), + EGlxCmdDownloadImages); + + newMedia2->SetTObjectValueL( + TMPXAttribute(KGlxMediaIdStaticItem, + KGlxMediaStaticItemCommand), + EGlxCmdDownloadVideos); + + const TFileName resName = CGlxSettingsModel::ValueL( KGlxDownloadLinkIcon ); + parse.Set(resName, &KDC_APP_RESOURCE_DIR, NULL); + TFileName iconFile(KNullDesC); + iconFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(iconFile); + + TIconInfo info; + //add icons to the static media items + info.bitmapId = EMbmGlxiconsQgn_prop_download_images; + info.maskId = EMbmGlxiconsQgn_prop_download_images_mask; + info.bmpfile = iconFile; + newMedia1->SetTObjectValueL(KMPXMediaGeneralIcon, info); + + info.bitmapId = EMbmGlxiconsQgn_prop_download_video; + info.maskId = EMbmGlxiconsQgn_prop_download_video_mask; + newMedia2->SetTObjectValueL(KMPXMediaGeneralIcon, info); + + // Add the items to the list + mediaList->AddStaticItemL(newMedia2, NGlxListDefs::EInsertFirst); + mediaList->AddStaticItemL(newMedia1, NGlxListDefs::EInsertFirst); + + //set the focus on 1st static item + mediaList->SetFocusL(NGlxListDefs::EAbsolute,0); + + CleanupStack::Pop(newMedia2); + CleanupStack::Pop(newMedia1); + + CleanupStack::Pop(mediaList); + CleanupStack::PopAndDestroy(path); + + return *mediaList; + } +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/src/glxgridviewpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/src/glxgridviewpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + + +// INCLUDE FILES +#include +#include "glxgridviewplugin.hrh" +#include "glxmaingridviewplugin.h" +#include "glxalbumgridviewplugin.h" +#include "glxcameraalbumgridviewplugin.h" +#include "glxdownloadsgridviewplugin.h" +#include "glxmonthsgridviewplugin.h" +#include "glxtaggridviewplugin.h" + +#if ( !defined IMPLEMENTATION_PROXY_ENTRY ) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) } +#endif + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// The list of implementations +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( + KGlxMainGridViewImplementationId, + CGlxMainGridViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxAlbumGridViewImplementationId, + CGlxAlbumGridViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxCameraAlbumGridViewImplementationId, + CGlxCameraAlbumGridViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxDownloadsGridViewImplementationId, + CGlxDownloadsGridViewPlugin::NewL ), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxMonthsGridViewImplementationId, + CGlxMonthsGridViewPlugin::NewL ), + IMPLEMENTATION_PROXY_ENTRY( + KGlxTagGridViewPluginImplementationUid, + CGlxTagGridViewPlugin::NewL ), + }; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = + sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/src/glxmaingridviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/src/glxmaingridviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxmaingridviewplugin.h" +#include "glxgridviewplugin.hrh" + +#include + +#include +#include // for CGlxResourceUtilities + +#include + +#include +#include +#include + +#include +#include +#include +#include + + +_LIT(KGlxGridResource,"glxGridviewdata.rsc"); + + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxMainGridViewPlugin::CGlxMainGridViewPlugin() + + { + TRACER("CGlxMainGridViewPlugin::CGlxMainGridViewPlugin()"); + iResourceIds.iMenuId = R_GLX_GRID_MENU; + iResourceIds.iViewId = R_GRID_VIEW; + iResourceIds.iCbaId = R_GRID_SOFTKEYS; + iResourceIds.iEmptyViewTextId = R_GRID_EMPTY_VIEW_TEXT; + iResourceIds.iOkOptionsMenuId = R_GRID_OK_MENUBAR; + iViewUID = KGlxMainGridViewImplementationId; + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMainGridViewPlugin::ConstructL() + { + GLX_LOG_INFO("CGlxMainGridViewPlugin::ConstructL()"); + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxMainGridViewPlugin* CGlxMainGridViewPlugin::NewL() + { + TRACER("CGlxMainGridViewPlugin::NewL()"); + CGlxMainGridViewPlugin* self = + new ( ELeave ) CGlxMainGridViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMainGridViewPlugin::~CGlxMainGridViewPlugin() + { + TRACER("CGlxMainGridViewPlugin::~CGlxMainGridViewPlugin()"); + // Do nothing + } + +// --------------------------------------------------------------------------- +// AddCommandHandlersL +// --------------------------------------------------------------------------- +// +void CGlxMainGridViewPlugin::AddCommandHandlersL() + { + CGlxGridViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_ALL_GRID; + helpInfo.iViewContext = LGAL_HLP_ALL_FULLSCREEN; + GLX_LOG_INFO( "Adding CGlxCommandHandlerSlideshow" ); + iGridView->AddCommandHandlerL( + CGlxCommandHandlerSlideshow::NewL( iGridView, ETrue , EFalse ) ); + iGridView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +void CGlxMainGridViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TRACER("CGlxMainGridViewPlugin::GetResourceFilenameL()"); + TParse parse; + parse.Set(KGlxGridResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/src/glxmonthsgridviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/src/glxmonthsgridviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxmonthsgridviewplugin.h" +#include "glxgridviewplugin.hrh" + +#include +#include + +#include + +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include + +#include + +#include "glxgridview.h" + +#include + +_LIT(KGlxGridResource,"glxgridviewdata.rsc"); + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxMonthsGridViewPlugin::CGlxMonthsGridViewPlugin() + + { + iResourceIds.iMenuId = R_GLX_GRID_MENU; + iResourceIds.iViewId = R_GLX_MONTHS_GRID_VIEW; + iResourceIds.iCbaId = R_GRID_SOFTKEYS; + iResourceIds.iEmptyViewTextId = R_GRID_EMPTY_VIEW_TEXT; + iResourceIds.iOkOptionsMenuId = R_GRID_OK_MENUBAR; + iViewUID = KGlxMonthsGridViewImplementationId; + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMonthsGridViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxMonthsGridViewPlugin* CGlxMonthsGridViewPlugin::NewL() + { + CGlxMonthsGridViewPlugin* self = + new ( ELeave ) CGlxMonthsGridViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMonthsGridViewPlugin::~CGlxMonthsGridViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// AddCommandHandlersL +// --------------------------------------------------------------------------- +// +void CGlxMonthsGridViewPlugin::AddCommandHandlersL() + { + CGlxGridViewPluginBase::AddCommandHandlersL(); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_MONTH_GRID; + helpInfo.iViewContext = LGAL_HLP_MONTH_FULLSCREEN; + iGridView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +void CGlxMonthsGridViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxGridResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewplugin/src/glxtaggridviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewplugin/src/glxtaggridviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +#include "glxtaggridviewplugin.h" +#include "glxgridviewplugin.hrh" // KGlxTagGridViewPluginImplementationUid + +#include + +#include //BaflUtils +#include //KDC_APP_RESOURCE_DIR +#include //CGlxCommandHandlerRemoveFrom +#include +#include +#include + +#include // for CGlxResourceUtilities + + + +_LIT(KGlxGridResource,"glxgridviewdata.rsc"); //TagGridView Resource File + +/** + * @internal reviewed 12/06/2007 by Alex Birkett + */ + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +CGlxTagGridViewPlugin::CGlxTagGridViewPlugin() + { + TRACER("CGlxTagGridViewPlugin::CGlxTagGridViewPlugin()"); + + iResourceIds.iViewId = R_TAGGRID_VIEW; + iResourceIds.iMenuId = R_TAGGRID_MENU; + iResourceIds.iCbaId = R_GRID_SOFTKEYS; + iResourceIds.iEmptyViewTextId = R_GRID_EMPTY_VIEW_TEXT; + iResourceIds.iOkOptionsMenuId = R_GRID_OK_MENUBAR_TAG_GRIDVIEW; + iViewUID = KGlxTagGridViewPluginImplementationUid; + + + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +void CGlxTagGridViewPlugin::ConstructL() + { + TRACER("CGlxTagGridViewPlugin::CGlxTagGridViewPlugin()"); + // Do nothing + } + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- + CGlxTagGridViewPlugin* CGlxTagGridViewPlugin::NewL() + { + + TRACER( "CGlxTagGridViewPlugin::NewL"); + + CGlxTagGridViewPlugin* self = new ( ELeave ) CGlxTagGridViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CGlxTagGridViewPlugin::~CGlxTagGridViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Adds Command Handlers to the view +//----------------------------------------------------------------------------- +void CGlxTagGridViewPlugin::AddCommandHandlersL() + { + TRACER( "CGlxTagGridViewPlugin::AddCommandHandlersL"); + + CGlxGridViewPluginBase::AddCommandHandlersL(); + + //For tag Grid view + GLX_LOG_INFO("Adding CGlxCommandHandlerRemoveFrom"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom::NewL(iGridView, EMPXTag)); + + // set up help context info + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_TAGS_GRID; + helpInfo.iViewContext = LGAL_HLP_TAGS_FULLSCREEN; + + iGridView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +//----------------------------------------------------------------------------- +// Get the Resource File Name +//----------------------------------------------------------------------------- + +void CGlxTagGridViewPlugin::GetResourceFilenameL(TFileName& aResFile) + { + TRACER( "CGlxTagGridViewPlugin::GetResourceFilenameL"); //Logging + TParse parse; + parse.Set(KGlxGridResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +//End Of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewpluginbase/bwins/glxgridviewpluginbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewpluginbase/bwins/glxgridviewpluginbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ??0CGlxGridViewPluginBase@@QAE@XZ @ 1 NONAME ; CGlxGridViewPluginBase::CGlxGridViewPluginBase(void) + ??1CGlxGridViewPluginBase@@UAE@XZ @ 2 NONAME ; CGlxGridViewPluginBase::~CGlxGridViewPluginBase(void) + ?AddCommandHandlersL@CGlxGridViewPluginBase@@MAEXXZ @ 3 NONAME ; void CGlxGridViewPluginBase::AddCommandHandlersL(void) + ?ConstructViewLC@CGlxGridViewPluginBase@@MAEPAVCAknView@@XZ @ 4 NONAME ; class CAknView * CGlxGridViewPluginBase::ConstructViewLC(void) + ?GetResourceFilenameL@CGlxGridViewPluginBase@@MAEXAAV?$TBuf@$0BAA@@@@Z @ 5 NONAME ; void CGlxGridViewPluginBase::GetResourceFilenameL(class TBuf<256> &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewpluginbase/eabi/glxgridviewpluginbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewpluginbase/eabi/glxgridviewpluginbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,12 @@ +EXPORTS + _ZN22CGlxGridViewPluginBase15ConstructViewLCEv @ 1 NONAME + _ZN22CGlxGridViewPluginBase19AddCommandHandlersLEv @ 2 NONAME + _ZN22CGlxGridViewPluginBase20GetResourceFilenameLER4TBufILi256EE @ 3 NONAME + _ZN22CGlxGridViewPluginBaseC1Ev @ 4 NONAME + _ZN22CGlxGridViewPluginBaseC2Ev @ 5 NONAME + _ZN22CGlxGridViewPluginBaseD0Ev @ 6 NONAME + _ZN22CGlxGridViewPluginBaseD1Ev @ 7 NONAME + _ZN22CGlxGridViewPluginBaseD2Ev @ 8 NONAME + _ZTI22CGlxGridViewPluginBase @ 9 NONAME ; ## + _ZTV22CGlxGridViewPluginBase @ 10 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewpluginbase/group/glxgridviewpluginbase.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewpluginbase/group/glxgridviewpluginbase.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" + +#include "../../../../inc/glxalfhelper.mmh" +TARGET glxgridviewpluginbase.dll +TARGETTYPE dll +UID 0x1000008d 0x2000A76F + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxgridviewpluginbase.cpp + + +USERINCLUDE ../inc + +// System includes from the source tree +// System includes from the source tree +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlermarking/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlermoreinfo/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerupnp/inc //Command Handler Upnp +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../layouts/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../views/gridview/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc +SYSTEMINCLUDE ../../gridviewpluginbase/inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../common/inc + + +APP_LAYER_SYSTEMINCLUDE + + + +LIBRARY glxcommoncommandhandlers.lib +LIBRARY glxcommandhandlermarking.lib +LIBRARY glxcommandhandlermoreinfo.lib +LIBRARY cone.lib // for MCoeView +LIBRARY euser.lib // for RAllocator +LIBRARY glxgridview.lib // for CGlxGridView +LIBRARY mpxviewplugin.lib // for CMPXViewPlugin +LIBRARY glxviewbase.lib // for CGlxViewBase +LIBRARY glxupnpcommandhandler.lib // For Upnp Command Handler +LIBRARY flogger.lib // For Logging Tracer +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewpluginbase/inc/glxgridviewpluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewpluginbase/inc/glxgridviewpluginbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2008-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: MPX Grid view plugin definition. +* +*/ + + + + + +#ifndef C_GLXGRIDVIEWPLUGINBASE_H +#define C_GLXGRIDVIEWPLUGINBASE_H + + +// INCLUDES +#include +#include "glxmedialistfactory.h" +#include "glxgridview.h" // for TGridViewResourceIds + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib mpxcollectionviewplugin.lib + * @since S60 v3.0 + */ +class CGlxGridViewPluginBase : public CMPXAknViewPlugin, public MGlxMediaListFactory + { +public: + + /** + + /** + * Destructor. + */ +IMPORT_C virtual ~CGlxGridViewPluginBase(); + +protected: + + /** + * From CMPXAknViewPlugin + * Construct Avkon view. + * + * @since S60 v3.0 + * @return Pointer to a newly created Avkon view. + */ +IMPORT_C CAknView* ConstructViewLC(); + + /** + * Override to add command handlers to the view + * + */ +virtual void AddCommandHandlersL(); + + /** + * Override to define resource file + * + */ +virtual void GetResourceFilenameL(TFileName& aResFile); + +public: + + /** + * C++ default constructor. + */ +IMPORT_C CGlxGridViewPluginBase(); + + + +protected: + // Pointer to the created Grid view, not owned + CGlxGridView* iGridView; + + TGridViewResourceIds iResourceIds; + TInt iResourceOffset; + TInt iViewUID; + //View Specific Widget Ids + TViewWidgetIds iWidgetIds; + }; + +#endif // C_GLXGRIDVIEWPLUGINBASE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/gridviewpluginbase/src/glxgridviewpluginbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/gridviewpluginbase/src/glxgridviewpluginbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES +#include "glxgridviewpluginbase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //Command Handlers Upnp +#include +#include +#include +#include +#include +#include +#include +#include +#include // CGlxCommandHandlerFilterImagesOrVideos +#include +#include "glxgridview.h" + +/** + * @internal reviewed 08/02/2008 by Rhodri Byles + */ + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxGridViewPluginBase::CGlxGridViewPluginBase() + { + TRACER("CGlxGridViewPluginBase::CGlxGridViewPluginBase()"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxGridViewPluginBase::~CGlxGridViewPluginBase() + { + TRACER("CGlxGridViewPluginBase::~CGlxGridViewPluginBase()"); + // Do nothing + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + } + +// --------------------------------------------------------------------------- +// From CMPXAknViewPlugin +// Construct Avkon view. +// --------------------------------------------------------------------------- +// +EXPORT_C CAknView* CGlxGridViewPluginBase::ConstructViewLC() + { + GLX_LOG_INFO("=>CGlxGridViewPluginBase::ConstructViewLC"); + + TFileName resFile; + GetResourceFilenameL(resFile); + + if(resFile.Length() > 0) + { + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resFile); + } + + CGlxGridView* gridView = CGlxGridView::NewLC(this, iResourceIds, iViewUID); + + iGridView = gridView; + + AddCommandHandlersL(); + + GLX_LOG_INFO("<=CGlxGridViewPluginBase::ConstructViewLC"); + // Return on cleanup stack with ownership passed + return gridView; + } + +// --------------------------------------------------------------------------- +// Add the command handlers +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxGridViewPluginBase::AddCommandHandlersL() + { + TRACER("CGlxGridViewPluginBase::AddCommandHandlersL()"); + + GLX_LOG_INFO( "Adding CGlxCommandHandlerSlideshow" ); + + iGridView->AddCommandHandlerL( + CGlxCommandHandlerSlideshow::NewL( iGridView, ETrue , EFalse ) ); + + + GLX_LOG_INFO("Adding CGlxCommandHandlerSend"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerSend::NewL(iGridView, ETrue)); + + + GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: + NewAddToAlbumCommandHandlerL(iGridView, EFalse)); + GLX_LOG_INFO("Adding CGlxCommandHandlerDetails"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerDetails:: + NewL(iGridView)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerOpen"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerOpen:: + NewL(iGridView)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerDelete"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerDelete:: + NewL(iGridView, EFalse, EFalse)); + + GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: + NewAddToTagCommandHandlerL(iGridView, EFalse)); + // The AIW service handlers + // ShowMap must be the first one + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShowMap"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwShowMap:: + NewL(iGridView, iResourceIds.iMenuId)); + // Assign must be the second one + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwAssign"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwAssign:: + NewL(iGridView, iResourceIds.iMenuId)); + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwEdit"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwEdit:: + NewL(iGridView, iResourceIds.iMenuId)); + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwPrintPreview"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwPrintPreview:: + NewL(iGridView, iResourceIds.iMenuId)); + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShareOnOvi"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwShareOnOvi:: + NewL(iGridView, iResourceIds.iMenuId)); + // End of AIW service handlers + + GLX_LOG_INFO("Adding CGlxCommandHandlerMarking"); + iGridView->AddCommandHandlerL( CGlxCommandHandlerMarking::NewL( + iGridView, ETrue ) ); + + GLX_LOG_INFO("Adding CGlxCommandHandlerBack"); + iGridView->AddCommandHandlerL( + CGlxCommandHandlerBack::NewBackCommandHandlerL()); + + GLX_LOG_INFO("Adding CGlxCommandHandlerMoreInfo"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerMoreInfo:: + NewL(iGridView,EFalse)); + GLX_LOG_INFO("Adding CGlxCommandHandlerHideUi"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerHideUi::NewL()); + +#ifdef GLX_GRID_VIEW_IMAGES_OR_VIDEOS_ONLY_FILTERING + iGridView->AddCommandHandlerL( CGlxCommandHandlerFilterImagesOrVideos::NewL( iGridView ) ); +#endif + GLX_LOG_INFO("Adding CGlxCommandHandlerCopyToHomeNetwork"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerCopyToHomeNetwork::NewL(*iGridView)); + + //GLX_LOG_INFO("Adding CGlxCommandHandlerMarking"); + //iGridView->AddCommandHandlerL( CGlxCommandHandlerMarking::NewL(iGridView/*, *iGridView, ETrue*/ ) ); + GLX_LOG_INFO("Adding CGlxCommandHandlerUpload"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerUpload::NewL(iGridView, ETrue)); + + //Fix for error ID EVTY-7M87LF + //@ Registration of Video Playback Command handler has to before UPnP. + //@ else UPnP will not get play command once video playback command is consumed. + GLX_LOG_INFO("Adding CGlxCommandHandlerVideoPlayback"); + iGridView->AddCommandHandlerL( + CGlxCommandHandlerVideoPlayback::NewL( iGridView ) ); + + //Fix for error ID EVTY-7M87LF + //@ Registration of UPnP Command handler has to be after video play back command + //@ priorty of command handling is last registered in first server basis. + //@ UPnP will get play command first everytime, where it'll check for UPnP active. + //@ if UPnP is active it'll consume the event, else it'll allow other registered command to execute it. + GLX_LOG_INFO("Adding CGlxCommandHandlerShowVisUpnp"); + iGridView->AddCommandHandlerL(CGlxCommandHandlerShowViaUpnp::NewL(iGridView, ETrue)); + + } + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxGridViewPluginBase::GetResourceFilenameL(TFileName& aResFile) + { + TRACER("CGlxGridViewPluginBase::GetResourceFilenameL()"); + + aResFile = KNullDesC; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2008-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: Build information file for view plugins. +* +*/ + + + + +#include +PRJ_MMPFILES +../gridviewpluginbase/group/glxgridviewpluginbase.mmp +../gridviewplugin/group/glxgridviewplugin.mmp +../listviewpluginbase/group/glxlistviewpluginbase.mmp +../listviewplugin/group/glxlistviewplugin.mmp +../fullscreenviewpluginbase/group/glxfullscreenviewpluginbase.mmp +../fullscreenviewplugin/group/glxfullscreenviewplugin.mmp + +// View Plugins +#include "../tagsbrowserviewplugin/group/bld.inf" + +PRJ_TESTMMPFILES +//../gridviewplugin/tsrc/ut_CGlxTagGridViewPlugin/ut_cglxtaggridview.mmp +//../gridviewplugin/tsrc/t_cglxdownloadsgridviewplugin/t_cglxdownloadsgridviewplugin.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/data/20000a0b.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/data/20000a0b.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +// INCLUDES + +#include +#include +#include "glxlistviewplugin.hrh" + +// RESOURCE DEFINITIONS + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: uid of the supported Playback/Collection plugin. + * E.g. if the view plugin supports Local Playback plugin, the list of + * uids will be: 0x101FFC06 + * Now the Opaque data can contain a Depth (Path Level) UID. + * This is to differentiate between the Album Plugin requires a List View (Depth 2 - list of Albums) + * and it requiring a Tile View (Depth 3 Contents of an album). + * However the Plugin ID must score higher than the depth. So now we must add the plugin Id 4 Times + * The value of the depths are KGlxDepthTwo - , KGlxDepthThree - 0x2000A776 and KGlxDepthFour - 0x200104DB + * I could not seem to use a #define in between the

<\p> tags so the values had to be used + * + * uid + * uid: plugin type uid. + * E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0 + * + * flags [optional] + * flags: sum of the required feature flags that listed in mpxviewplugin.hrh. + * E.g. if the view plugin needs to be pre-loaded and it's user-selectable, + * then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003. + * + * priority [optional] + * priority: a value of type TMPXViewPluginPriorities. This value determines + * which view plugin will be resolved when several plugins can support the + * same set of Uids. + * Default value of this field is EMPXViewPluginPriorityNormal. + * + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxListPluginDllUid; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXViewPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxMainListViewImplementationUid; + version_no = 1; + display_name = "Main view"; + default_data = ""; + opaque_data = "

0x200071CC

" + "0x20000A0C" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KGlxAlbumListViewImplementationUid; + version_no = 1; + display_name = "Album view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A775;0x20007197;0x20007197;0x20007197;0x20007197

" + "0x20000A0E" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KGlxMonthListViewImplementationUid; + version_no = 1; + display_name = "Month view"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A775;0x2000A769;0x2000A769;0x2000A769;0x2000A769

" + "0x2000718C" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/data/glxlistviewplugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/data/glxlistviewplugin.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2008-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: Resource file +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME MGLV + +// INCLUDES +#include +#include + +#include +#include + +#include +#include + +#include +#include + +// RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf = "MGLV"; } + +RESOURCE AVKON_VIEW r_glx_list_view + { + menubar = r_glx_list_view_menubar; + cba = r_glx_list_view_softkeys; + } + +RESOURCE AVKON_VIEW r_glx_main_list_view + { + menubar = r_glx_main_list_view_menubar; + cba = r_glx_main_list_view_softkeys; + } + +RESOURCE AVKON_VIEW r_glx_album_list_view + { + menubar = r_glx_album_list_view_menubar; + cba = r_glx_list_view_softkeys; + toolbar = r_glx_album_list_view_toolbar; + } + +RESOURCE AVKON_VIEW r_glx_month_list_view + { + menubar = r_glx_month_list_view_menubar; + cba = r_glx_list_view_softkeys; + } + +RESOURCE MENU_BAR r_glx_list_view_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_glx_list_view_menu; } + }; + } + +RESOURCE MENU_BAR r_glx_main_list_view_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_glx_main_list_view_menu; } + }; + } + +RESOURCE MENU_BAR r_glx_album_list_view_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_glx_album_list_view_menu; } + }; + } + +RESOURCE MENU_BAR r_glx_month_list_view_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_glx_month_list_view_menu; } + }; + } + +RESOURCE MENU_PANE r_glx_list_view_menu + { + items = + { + MENU_ITEM { command = EGlxStopShowing; txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_PANE r_glx_main_list_view_menu + { + items = + { + MENU_ITEM { command = EGlxStopShowing; txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_PANE r_glx_album_list_view_menu + { + items = + { + MENU_ITEM { command = EGlxStopShowing; txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command = EGlxCmdSlideshowPlay; + txt = qtn_lgal_options_slideshow; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdDelete; txt = qtn_lgal_options_delete; flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EGlxCmdAddMedia; txt = qtn_lgal_options_new_album;}, + MENU_ITEM { command = EGlxCmdRename; txt = qtn_lgal_options_rename; flags = EEikMenuItemSpecific;}, + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_PANE r_glx_month_list_view_menu + { + items = + { + MENU_ITEM { command = EGlxStopShowing; txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command = EGlxCmdSlideshowPlay; + txt = qtn_lgal_options_slideshow; + flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_PANE r_glx_list_view_slideshow_menu + { + items = + { + MENU_ITEM { command = EGlxCmdSlideshowPlay; txt = qtn_lgal_options_slideshow_play; }, + MENU_ITEM { command = EGlxCmdSlideshowSettings; txt = qtn_lgal_options_slideshow_settings_general; } + }; + } + +RESOURCE CBA r_glx_list_view_softkeys + { + buttons = + { + CBA_BUTTON + { + id = EGlxCmdOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = text_softkey_back; + }, + CBA_BUTTON + { + id = EAknCmdOpen; + txt = qtn_msk_open; + } + }; + } + +RESOURCE CBA r_glx_main_list_view_softkeys + { + buttons = + { + CBA_BUTTON + { + id = EGlxCmdOptions; + txt = text_softkey_option; + }, + CBA_BUTTON + { + id = EAknSoftkeyExit; + txt = text_softkey_exit; + }, + CBA_BUTTON + { + id = EAknCmdOpen; + txt = qtn_msk_open; + } + }; + } + +RESOURCE TBUF r_glx_list_view_empty_text { buf = qtn_lgal_info_no_files; } + +RESOURCE TBUF r_list_empty_view_text + { + buf = qtn_lgal_empty_list_no_captured_items; + } + +RESOURCE TBUF r_glx_main_list_view_title + { + buf = qtn_lgal_title_main_view; + } + + + +// ---------------------------------------------------------------------------- +// +// r_glx_main_list_view_toolbar +// +// ---------------------------------------------------------------------------- +// +RESOURCE AVKON_TOOLBAR r_glx_album_list_view_toolbar + { + flags = KAknToolbarFixed; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSlideshowPlay; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + helptxt = qtn_lgal_tooltip_slideshow; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdAddMedia; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_new_album; + bmpmask = EMbmGlxiconsQgn_indi_tb_new_album_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_new_album; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_new_album_mask; + helptxt = qtn_lgal_tooltip_new_album; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdRename; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_gallery_rename; + bmpmask = EMbmGlxiconsQgn_indi_tb_gallery_rename_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_gallery_rename; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_gallery_rename_mask; + helptxt = qtn_lgal_tooltip_rename; + } + }; + }; + } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/group/glxlistviewplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/group/glxlistviewplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxlistviewplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20000A0B + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxlistviewpluginproxy.cpp +SOURCE glxmainlistviewplugin.cpp +SOURCE glxalbumlistviewplugin.cpp +SOURCE glxmonthlistviewplugin.cpp + +START RESOURCE ../data/20000a0b.rss +TARGET glxlistviewplugin.rsc +END // RESOURCE + +START RESOURCE ../data/glxlistviewplugin.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../plugins/listviewpluginbase/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../views/listview/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerupnp/inc //Command Handler Upnp +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../../../gallery/loc + + + + +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY commonengine.lib + +LIBRARY mpxviewplugin.lib + +LIBRARY glxlistviewpluginbase.lib +LIBRARY glxviewbase.lib +LIBRARY glxlistview.lib +LIBRARY glxcommoncommandhandlers.lib +LIBRARY glxupnpcommandhandler.lib //upnp Command handlers + + +//EXPORTUNFROZEN + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/inc/glxalbumlistviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/inc/glxalbumlistviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-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: List view plugin definition. +* +*/ + + + + +#ifndef C_GLXALBUMLISTVIEWPLUGIN_H +#define C_GLXALBUMLISTVIEWPLUGIN_H + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * Gallery album list view plugin. + * + * @ingroup list_view + */ +NONSHARABLE_CLASS( CGlxAlbumListViewPlugin ) : public CGlxListViewPluginBase + { +public: + /** + * Two-phased constructor for album list view plugin. + */ + static CGlxAlbumListViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxAlbumListViewPlugin(); + +private: // From CGlxListViewPluginBase + /** + * Construct the list view + * + * @param aMediaListFactory object providing media list + * + * @return pointer to created list view + */ + CGlxListView* ConstructListViewLC(MGlxMediaListFactory* aMediaListFactory); + + /** + * Add view specific command handlers + */ + void AddCommandHandlersL(); + +private: + /** + * C++ default constructor. + */ + CGlxAlbumListViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_GLXALBUMLISTVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/inc/glxlistviewplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/inc/glxlistviewplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXLISTVIEWPLUGIN_HRH +#define GLXLISTVIEWPLUGIN_HRH + +// CONSTANTS + +#define KGlxListPluginDllUid 0x20000A0B +#define KGlxMainListViewImplementationUid 0x20000A0C +#define KGlxAlbumListViewImplementationUid 0x20000A0E +#define KGlxMonthListViewImplementationUid 0x2000718C + +#endif // GLXLISTVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/inc/glxmainlistviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/inc/glxmainlistviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-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: List view plugin definition. +* +*/ + + + + +#ifndef C_GLXMAINLISTVIEWPLUGIN_H +#define C_GLXMAINLISTVIEWPLUGIN_H + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * Gallery main list view plugin. + * + * @ingroup list_view + */ +NONSHARABLE_CLASS( CGlxMainListViewPlugin ) : public CGlxListViewPluginBase + { +public: + /** + * Two-phased constructor for main list view plugin. + */ + static CGlxMainListViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxMainListViewPlugin(); + +private: // From CGlxListViewPluginBase + /** + * Construct the list view + * + * @param aMediaListFactory object providing media list + * + * @return pointer to created list view + */ + CGlxListView* ConstructListViewLC(MGlxMediaListFactory* aMediaListFactory); + + /** + * Add view specific command handlers + */ + void AddCommandHandlersL(); + +private: + /** + * C++ default constructor. + */ + CGlxMainListViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_GLXMAINLISTVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/inc/glxmonthlistviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/inc/glxmonthlistviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-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: List view plugin definition. +* +*/ + + + + +#ifndef C_GLXMONTHLISTVIEWPLUGIN_H +#define C_GLXMONTHLISTVIEWPLUGIN_H + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * Gallery month list view plugin. + * + * @ingroup list_view + */ +NONSHARABLE_CLASS( CGlxMonthListViewPlugin ) : public CGlxListViewPluginBase + { +public: + /** + * Two-phased constructor for month list view plugin. + */ + static CGlxMonthListViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxMonthListViewPlugin(); + +private: // From CGlxListViewPluginBase + /** + * Construct the list view + * + * @param aMediaListFactory object providing media list + * + * @return pointer to created list view + */ + CGlxListView* ConstructListViewLC(MGlxMediaListFactory* aMediaListFactory); + + /** + * Add view specific command handlers + */ + void AddCommandHandlersL(); + +private: + /** + * C++ default constructor. + */ + CGlxMonthListViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_GLXMONTHLISTVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/src/glxalbumlistviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/src/glxalbumlistviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008-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: List view plugin implementation +* +*/ + + + + +// INCLUDE FILES +#include "glxalbumlistviewplugin.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "glxlistviewplugin.hrh" + +// --------------------------------------------------------------------------- +// Two-phased constructor for album list view plugin. +// --------------------------------------------------------------------------- +// +CGlxAlbumListViewPlugin* CGlxAlbumListViewPlugin::NewL() + { + CGlxAlbumListViewPlugin* self = new (ELeave) CGlxAlbumListViewPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxAlbumListViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// --------------------------------------------------------------------------- +// +CGlxAlbumListViewPlugin::CGlxAlbumListViewPlugin() + { + iResourceIds.iViewId = R_GLX_ALBUM_LIST_VIEW; + iResourceIds.iMenuId = R_GLX_ALBUM_LIST_VIEW_MENU; + iResourceIds.iCbaId = R_GLX_LIST_VIEW_SOFTKEYS; + iResourceIds.iEmptyTextId = R_GLX_LIST_VIEW_EMPTY_TEXT; + + + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxAlbumListViewPlugin::~CGlxAlbumListViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// From CGlxListViewPluginBase +// --------------------------------------------------------------------------- +// +CGlxListView* CGlxAlbumListViewPlugin::ConstructListViewLC(MGlxMediaListFactory* aMediaListFactory) + { + return CGlxListView::NewLC(aMediaListFactory, KGlxAlbumListViewImplementationUid, iResourceIds); + } + +// --------------------------------------------------------------------------- +// From CGlxListViewPluginBase +// --------------------------------------------------------------------------- +// +void CGlxAlbumListViewPlugin::AddCommandHandlersL() + { + CGlxListViewPluginBase::AddCommandHandlersL(); + iListView->AddCommandHandlerL(CGlxCommandHandlerSlideshow::NewL( iListView, EFalse, ETrue ) ); + iListView->AddCommandHandlerL(CGlxCommandHandlerDelete::NewL(iListView, ETrue, EFalse)); + iListView->AddCommandHandlerL(CGlxCommandHandlerNewMedia::NewL(iListView)); + iListView->AddCommandHandlerL(CGlxCommandHandlerRename::NewL(iListView, ETrue)); + // add help command handler + + // set up help context info + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_ALBUM_LIST; + + iListView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/src/glxlistviewpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/src/glxlistviewpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin +* +*/ + + + + +// INCLUDE FILES +#include + +#include "glxmainlistviewplugin.h" +#include "glxalbumlistviewplugin.h" +#include "glxmonthlistviewplugin.h" + +#include "glxlistviewplugin.hrh" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// The list of implementations +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( + KGlxMainListViewImplementationUid, CGlxMainListViewPlugin::NewL), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxAlbumListViewImplementationUid, CGlxAlbumListViewPlugin::NewL), + + IMPLEMENTATION_PROXY_ENTRY( + KGlxMonthListViewImplementationUid, CGlxMonthListViewPlugin::NewL) + }; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/src/glxmainlistviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/src/glxmainlistviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2008-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: List view plugin implementation +* +*/ + + + + +// INCLUDE FILES +#include "glxmainlistviewplugin.h" + +#include //StringLoader + +#include //Command Handler Help +#include //Command Handlers Show Via upnp +#include +#include + +#include "glxlistviewplugin.hrh" + +// --------------------------------------------------------------------------- +// Two-phased constructor for main list view plugin. +// --------------------------------------------------------------------------- +// +CGlxMainListViewPlugin* CGlxMainListViewPlugin::NewL() + { + CGlxMainListViewPlugin* self = new (ELeave) CGlxMainListViewPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMainListViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// --------------------------------------------------------------------------- +// +CGlxMainListViewPlugin::CGlxMainListViewPlugin() + { + iResourceIds.iViewId = R_GLX_MAIN_LIST_VIEW; + iResourceIds.iMenuId = R_GLX_MAIN_LIST_VIEW_MENU; + iResourceIds.iCbaId = R_GLX_MAIN_LIST_VIEW_SOFTKEYS; + iResourceIds.iEmptyTextId = R_GLX_LIST_VIEW_EMPTY_TEXT; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMainListViewPlugin::~CGlxMainListViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// From CGlxListViewPluginBase +// --------------------------------------------------------------------------- +// +CGlxListView* CGlxMainListViewPlugin::ConstructListViewLC(MGlxMediaListFactory* aMediaListFactory) + { + HBufC* mainTitle = StringLoader::LoadLC(R_GLX_MAIN_LIST_VIEW_TITLE); + + CGlxListView* listView = CGlxListView::NewL(aMediaListFactory, KGlxMainListViewImplementationUid, iResourceIds,*mainTitle); + + CleanupStack::PopAndDestroy(mainTitle); + + CleanupStack::PushL(listView); + + iListView = listView; + + return listView; + } + +// --------------------------------------------------------------------------- +// From CGlxListViewPluginBase +// --------------------------------------------------------------------------- +// +void CGlxMainListViewPlugin::AddCommandHandlersL() + { + // add help command handler + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_VIEW_LIST; + iListView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + //add ShowViaUpnp Command Handler for stop showing + iListView->AddCommandHandlerL(CGlxCommandHandlerShowViaUpnp::NewL(iListView, EFalse)); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewplugin/src/glxmonthlistviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewplugin/src/glxmonthlistviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: List view plugin implementation +* +*/ + + + + +// INCLUDE FILES +#include "glxmonthlistviewplugin.h" + +#include +#include +#include + +#include + + +#include "glxlistviewplugin.hrh" + +// --------------------------------------------------------------------------- +// Two-phased constructor for month list view plugin. +// --------------------------------------------------------------------------- +// +CGlxMonthListViewPlugin* CGlxMonthListViewPlugin::NewL() + { + CGlxMonthListViewPlugin* self = new (ELeave) CGlxMonthListViewPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMonthListViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// --------------------------------------------------------------------------- +// +CGlxMonthListViewPlugin::CGlxMonthListViewPlugin() + { + iResourceIds.iViewId = R_GLX_MONTH_LIST_VIEW; + iResourceIds.iMenuId = R_GLX_MONTH_LIST_VIEW_MENU; + iResourceIds.iCbaId = R_GLX_LIST_VIEW_SOFTKEYS; + iResourceIds.iEmptyTextId = R_GLX_LIST_VIEW_EMPTY_TEXT; + + + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMonthListViewPlugin::~CGlxMonthListViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// From CGlxListViewPluginBase +// --------------------------------------------------------------------------- +// +CGlxListView* CGlxMonthListViewPlugin::ConstructListViewLC(MGlxMediaListFactory* aMediaListFactory) + { + + return CGlxListView::NewLC(aMediaListFactory, KGlxMonthListViewImplementationUid, iResourceIds); + } + +// --------------------------------------------------------------------------- +// From CGlxListViewPluginBase +// --------------------------------------------------------------------------- +// +void CGlxMonthListViewPlugin::AddCommandHandlersL() + { + CGlxListViewPluginBase::AddCommandHandlersL(); + + // set up help context info + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_MONTH_LIST; + + iListView->AddCommandHandlerL(CGlxCommandHandlerSlideshow::NewL( iListView, EFalse, ETrue ) ); + iListView->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewpluginbase/bwins/glxlistviewpluginbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewpluginbase/bwins/glxlistviewpluginbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ??0CGlxListViewPluginBase@@QAE@XZ @ 1 NONAME ; CGlxListViewPluginBase::CGlxListViewPluginBase(void) + ??1CGlxListViewPluginBase@@UAE@XZ @ 2 NONAME ; CGlxListViewPluginBase::~CGlxListViewPluginBase(void) + ?AddCommandHandlersL@CGlxListViewPluginBase@@MAEXXZ @ 3 NONAME ; void CGlxListViewPluginBase::AddCommandHandlersL(void) + ?ConstructViewLC@CGlxListViewPluginBase@@EAEPAVCAknView@@XZ @ 4 NONAME ; class CAknView * CGlxListViewPluginBase::ConstructViewLC(void) + ?GetResourceFilenameL@CGlxListViewPluginBase@@MAEXAAV?$TBuf@$0BAA@@@@Z @ 5 NONAME ; void CGlxListViewPluginBase::GetResourceFilenameL(class TBuf<256> &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewpluginbase/eabi/glxlistviewpluginbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewpluginbase/eabi/glxlistviewpluginbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,11 @@ +EXPORTS + _ZN22CGlxListViewPluginBase15ConstructViewLCEv @ 1 NONAME + _ZN22CGlxListViewPluginBase19AddCommandHandlersLEv @ 2 NONAME + _ZN22CGlxListViewPluginBase20GetResourceFilenameLER4TBufILi256EE @ 3 NONAME + _ZN22CGlxListViewPluginBaseC2Ev @ 4 NONAME + _ZN22CGlxListViewPluginBaseD0Ev @ 5 NONAME + _ZN22CGlxListViewPluginBaseD1Ev @ 6 NONAME + _ZN22CGlxListViewPluginBaseD2Ev @ 7 NONAME + _ZTI22CGlxListViewPluginBase @ 8 NONAME ; ## + _ZTV22CGlxListViewPluginBase @ 9 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewpluginbase/group/glxlistviewpluginbase.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewpluginbase/group/glxlistviewpluginbase.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxlistviewpluginbase.dll +TARGETTYPE dll +UID 0x1000008d 0x2000718D + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxlistviewpluginbase.cpp + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../views/listview/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerupnp/inc // for Command Handler Upnp +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities + + +APP_LAYER_SYSTEMINCLUDE + + + + +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY avkon.lib +LIBRARY efsrv.lib + +LIBRARY mpxviewplugin.lib + +LIBRARY glxviewbase.lib +LIBRARY glxlistview.lib +LIBRARY glxcommoncommandhandlers.lib +LIBRARY glxupnpcommandhandler.lib // For Upnp Command Handler +LIBRARY glxcommon.lib // for CResourceUtilities + +//EXPORTUNFROZEN + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewpluginbase/inc/glxlistviewpluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewpluginbase/inc/glxlistviewpluginbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2008-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: MPX List view plugin definition. +* +*/ + + + + +#ifndef C_GLXLISTVIEWPLUGINBASE_H +#define C_GLXLISTVIEWPLUGINBASE_H + +// INCLUDES +#include + +#include +#include // ConstructListViewLC + +class TListViewResourceIds; + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib glxlistviewpluginbase.lib + */ +class CGlxListViewPluginBase : public CMPXAknViewPlugin, + public MGlxMediaListFactory + { +public: + /** + * C++ default constructor. + */ + IMPORT_C CGlxListViewPluginBase(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CGlxListViewPluginBase(); + +protected: + /** + * Override to add command handlers to the view + * + */ + IMPORT_C virtual void AddCommandHandlersL(); + + /** + * Override to define resource file + * + */ + IMPORT_C virtual void GetResourceFilenameL(TFileName& aResFile); + +private: + /** + * From CMPXAknViewPlugin + * Construct Avkon view. + * + * @return Pointer to a newly created Avkon view. + */ + IMPORT_C CAknView* ConstructViewLC(); + + /** + * Construct GLX list view. + * + * @param aMediaListFactory object providing media list + * + * @return Pointer to a newly created list view. + */ + virtual CGlxListView* ConstructListViewLC(MGlxMediaListFactory* aMediaListFactory) = 0; + +protected: + // Created list view - not owned + CGlxListView* iListView; + + // View specific resource ids + TListViewResourceIds iResourceIds; + + //View Specific Widget Ids + TViewWidgetIds iWidgetIds; + + // Resource offset + TInt iResourceOffset; + }; + +#endif // C_GLXLISTVIEWPLUGINBASE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/listviewpluginbase/src/glxlistviewpluginbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/listviewpluginbase/src/glxlistviewpluginbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation +* +*/ + + + + +// INCLUDE FILES + +// CLASS HEADER +#include "glxlistviewpluginbase.h" + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include +#include +#include +#include // Command Handlers Stop Showing(upnp) +#include // for GetResourceFilenameL + + +namespace + { + _LIT(KGlxListViewPluginResource, "glxlistviewplugin.rsc"); + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxListViewPluginBase::CGlxListViewPluginBase() + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxListViewPluginBase::~CGlxListViewPluginBase() + { + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + } + +// --------------------------------------------------------------------------- +// From CMPXAknViewPlugin +// Construct Avkon view. +// --------------------------------------------------------------------------- +// +EXPORT_C CAknView* CGlxListViewPluginBase::ConstructViewLC() + { + TFileName resFile; + GetResourceFilenameL(resFile); + + if(resFile.Length() > 0) + { + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resFile); + } + + CGlxListView* listView = ConstructListViewLC(this); + + iListView = listView; + + AddCommandHandlersL(); + + // Return on cleanup stack with ownership passed + return listView; + } + + +// --------------------------------------------------------------------------- +// AddCommandHandlersL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxListViewPluginBase::AddCommandHandlersL() + { + // we dont want to step back in path for slide show in this case + + iListView->AddCommandHandlerL( + CGlxCommandHandlerBack::NewBackCommandHandlerL()); + iListView->AddCommandHandlerL( + CGlxCommandHandlerShowViaUpnp::NewL(iListView, EFalse)); + } + + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxListViewPluginBase::GetResourceFilenameL(TFileName& aResFile) + { + TParse parse; + parse.Set(KGlxListViewPluginResource, &KDC_APP_RESOURCE_DIR, NULL); + aResFile.Append(parse.FullName()); + + CGlxResourceUtilities::GetResourceFilenameL(aResFile); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/data/200071af.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/data/200071af.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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 : Resource Definitions +* +*/ + + + +// INCLUDES +#include +#include +#include "glxmetadataviewplugin.hrh" + + +// RESOURCE DEFINITIONS + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: uid of the supported Playback/Collection plugin. + * E.g. if the view plugin supports Local Playback plugin, the list of + * uids will be: 0x101FFC06 + * + * uid + * uid: plugin type uid. + * E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0 + * + * flags [optional] + * flags: sum of the required feature flags that listed in mpxviewplugin.hrh. + * E.g. if the view plugin needs to be pre-loaded and it's user-selectable, + * then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003. + * + * priority [optional] + * priority: a value of type TMPXViewPluginPriorities. This value determines + * which view plugin will be resolved when several plugins can support the + * same set of Uids. + * Default value of this field is EMPXViewPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x200071AF; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXViewPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxMetadataViewImplementationId; + version_no = 1 ; + display_name = "Metadata view"; + default_data = ""; + opaque_data = "

0x2000A7C1

" + "0x200071B0" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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 : Project build file +* +*/ + + + +PRJ_EXPORTS + +//../rom/glxmetadataviewplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxmetadataviewplugin.iby) + +PRJ_MMPFILES + +//glxmetadataviewplugin.mmp + +//End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/group/glxmetadataviewplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/group/glxmetadataviewplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxunifiedmetadataviewplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200071AF + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxmetadataviewpluginproxy.cpp +SOURCE glxmetadataviewplugin.cpp + +START RESOURCE ../data/200071AF.rss +//TARGET 200071AF.rsc +TARGET glxunifiedmetadataviewplugin.rsc +END // RESOURCE + +USERINCLUDE ../inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../views/metadataview/inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib // for RAllocator +LIBRARY mpxviewplugin.lib // for CMPXViewPlugin +LIBRARY glxunifiedmetadataview.lib // for CGlxMetadataView +LIBRARY glxviewbase.lib // for CGlxViewBase +LIBRARY glxcommoncommandhandlers.lib + + +//EXPORTUNFROZEN + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/inc/glxmetadataviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/inc/glxmetadataviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-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 : Metadata view plugin definition. +* +*/ + + +#ifndef C_GLXMETADATAVIEWPLUGIN_H +#define C_GLXMETADATAVIEWPLUGIN_H + + +// INCLUDES +#include + +#include "glxmedialistfactory.h" + +// CLASS DECLARATION + +/** + * MPX Collection view plugin definition. + * + * @lib glxunifiedmetadataviewplugin.lib + */ +NONSHARABLE_CLASS( CGlxMetadataViewPlugin ) : public CMPXAknViewPlugin + { +public: + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + static CGlxMetadataViewPlugin* NewL(); + + /** + * Destructor. + */ + virtual ~CGlxMetadataViewPlugin(); + +private: + + /** + * From CMPXAknViewPlugin + * Construct Avkon view. + * + * @return Pointer to a newly created Avkon view. + */ + CAknView* ConstructViewLC(); + +private: + + /** + * C++ default constructor. + */ + CGlxMetadataViewPlugin(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_GLXMETADATAVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/inc/glxmetadataviewplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/inc/glxmetadataviewplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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 : Resource header +* +*/ + + + +#ifndef GLXMETADATAVIEWPLUGIN_HRH +#define GLXMETADATAVIEWPLUGIN_HRH + +// CONSTANTS + +#define KGlxMetadataViewImplementationId 0x200071B0 + +#endif // GLXMETADATAVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/rom/glxmetadataviewplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/rom/glxmetadataviewplugin.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2008-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 : Metadata View Plugin iby file. +* +*/ + + + +#ifndef __GLXMETADATAVIEWPLUGIN_IBY__ +#define __GLXMETADATAVIEWPLUGIN_IBY__ + +ECOM_PLUGIN( glxunifiedmetadataviewplugin.dll, glxunifiedmetadataviewplugin.rsc ) + +#endif // __GLXMETADATAVIEWPLUGIN_IBY__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/src/glxmetadataviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/src/glxmetadataviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description : Implementation of metadata view plugin +* +*/ + + + +// INCLUDE FILES + +#include "glxmetadataviewplugin.h" + +#include // For CGlxCommandHandlerBack +#include +#include +#include + +#include "glxmetadataview.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxMetadataViewPlugin::CGlxMetadataViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewPlugin::ConstructL() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxMetadataViewPlugin* CGlxMetadataViewPlugin::NewL() + { + CGlxMetadataViewPlugin* self = new ( ELeave ) CGlxMetadataViewPlugin(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMetadataViewPlugin::~CGlxMetadataViewPlugin() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// From CMPXAknViewPlugin +// Construct Avkon view. +// --------------------------------------------------------------------------- +// +CAknView* CGlxMetadataViewPlugin::ConstructViewLC() + { + /*Create view it self medialist provider ? */ + CGlxMetadataView* view = CGlxMetadataView::NewLC(NULL); + + // add command handlers + view->AddCommandHandlerL(CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL(view)); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_DETAILS_VIEW; + view->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + + return view; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/metadataviewplugin/src/glxmetadataviewpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/metadataviewplugin/src/glxmetadataviewpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-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 : Standard proxy of the ECOM plugin +* +*/ + + +// INCLUDE FILES +#include +#include "glxmetadataviewplugin.hrh" +#include "glxmetadataviewplugin.h" + +#if ( !defined IMPLEMENTATION_PROXY_ENTRY ) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) } +#endif + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// The list of implementations +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( + KGlxMetadataViewImplementationId, + CGlxMetadataViewPlugin::NewL ) + }; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = + sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/data/200071b6.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/data/200071b6.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2000 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: Resource definitions +* +*/ + + + + +// INCLUDES + +#include +#include +#include "glxtagsbrowserviewplugin.hrh" + +// RESOURCE DEFINITIONS + +/** + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: uid of the supported Playback/Collection plugin. + * E.g. if the view plugin supports Local Playback plugin, the list of + * uids will be: 0x101FFC06 + * + * uid + * uid: plugin type uid. + * E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0 + * + * flags [optional] + * flags: sum of the required feature flags that listed in mpxviewplugin.hrh. + * E.g. if the view plugin needs to be pre-loaded and it's user-selectable, + * then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003. + * + * priority [optional] + * priority: a value of type TMPXViewPluginPriorities. This value determines + * which view plugin will be resolved when several plugins can support the + * same set of Uids. + * Default value of this field is EMPXViewPluginPriorityNormal. + */ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KGlxTagsBrowserPluginDllUid ; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXViewPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KGlxTagsBrowserPluginImplementationUid; + version_no = 1; + display_name = "Tags"; + default_data = ""; + opaque_data = "

0x200104DC;0x2000A775;0x200071AE;0x200071AE;0x200071AE;0x200071AE

" + "0x200071B7" + "0x0002" + ""EMPXViewPluginPriorityLowest""; + } + }; + + } + }; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/data/glxtagsbrowserview.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/data/glxtagsbrowserview.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Tags Browser View +* +*/ + + + + +// RESOURCE IDENTIFIER +NAME GLTB // 4 letter ID + + +// INCLUDES +#include +#include +#include +#include +#include +#include //for localization +#include // For Command Ids +#include + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE AVKON_VIEW r_tagsbrowser_view + { + menubar = r_tagsbrowser_menubar; + cba = r_tagsbrowser_softkeys_options_back_select; + toolbar = r_tagsbrowser_toolbar; + } + +RESOURCE MENU_BAR r_tagsbrowser_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_tagsbrowser_menu; txt=""; } + }; + } + +RESOURCE MENU_PANE r_tagsbrowser_menu + { + items= + { + MENU_ITEM { command = EGlxCmdSlideshow; + txt = qtn_lgal_options_slideshow; + cascade = r_tile_shw_menu;}, + MENU_ITEM { command=EGlxCmdSortByAlphabetical; + txt=qtn_lgal_options_alphabetical; }, + MENU_ITEM { command=EGlxCmdSortByCount; + txt=qtn_lgal_options_most_used; }, + MENU_ITEM { command = EGlxCmdDelete; + txt = qtn_lgal_options_delete;}, + MENU_ITEM { command = EGlxCmdRename; + txt = qtn_lgal_options_rename;}, + MENU_ITEM { command=EGlxStopShowing; + txt=qtn_lgal_options_stop_show; }, + MENU_ITEM { command=EAknCmdHelp; + txt=qtn_clipb_litxt_help; }, + MENU_ITEM { command=EAknCmdExit; + txt=qtn_options_exit; } + }; + } + +RESOURCE MENU_PANE r_tile_shw_menu + { + items= + { + MENU_ITEM { command=EGlxCmdSlideshowPlay; txt=qtn_lgal_options_slideshow_play; }, + MENU_ITEM { command=EGlxCmdSlideshowSettings; txt=qtn_lgal_options_slideshow_settings_general; } + }; + } +RESOURCE CBA r_tagsbrowser_softkeys_options_back_select + { + flags = 0; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, + CBA_BUTTON {id=EAknCmdOpen; txt = qtn_msk_open;} + }; + } +RESOURCE CBA r_tagsbrowser_softkeys_msk_disabled + { + flags = 0; + buttons = + { + CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, + CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, + CBA_BUTTON {id=EAknSoftkeyOptions; txt = qtn_msk_open;} + }; + } + +RESOURCE TBUF r_tagsbrowser_empty_text + { + buf = qtn_lgal_empty_tag_browser; + } + +RESOURCE TBUF r_tagsbrowser_subtitle_single + { + buf = qtn_lgal_list_detail_one_item; + } + +RESOURCE TBUF r_tagsbrowser_subtitle_multiple + { + buf = qtn_lgal_list_detail_multi_item; + } + +// ----------------------------------------------------------------------------------- +// r_tagsbrowser_toolbar +// ----------------------------------------------------------------------------------- +// +RESOURCE AVKON_TOOLBAR r_tagsbrowser_toolbar + { + flags = KAknToolbarFixed; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSlideshowPlay; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + helptxt = qtn_lgal_tooltip_slideshow; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdDelete; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + helptxt = qtn_lgal_tooltip_delete; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdRename; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_gallery_rename; + bmpmask = EMbmGlxiconsQgn_indi_tb_gallery_rename_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_gallery_rename; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_gallery_rename_mask; + helptxt = qtn_lgal_tooltip_rename; + } + }; + }; + } + }; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxtagsbrowserviewplugin. +* +*/ + + + + +#include + +PRJ_EXPORTS +../rom/tagsbrowserviewplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tagsbrowserviewplugin.iby) +../rom/tagsbrowserviewplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(tagsbrowserviewplugin_resources.iby) + +PRJ_MMPFILES +glxtagsbrowserviewplugin.mmp + +PRJ_TESTMMPFILES +//../tsrc/t_cglxtagsbrowserviewplugin/t_cglxtagsbrowserviewplugin.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/group/glxtagsbrowserviewplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/group/glxtagsbrowserviewplugin.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxtagsbrowserviewplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x200071B6 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE glxtagsbrowserviewpluginproxy.cpp +SOURCE glxtagsbrowserviewplugin.cpp + +SOURCEPATH ../data + +START RESOURCE glxtagsbrowserview.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END // RESOURCE + +START RESOURCE 200071b6.rss +TARGET glxtagsbrowserviewplugin.rsc +LANGUAGE_IDS +END // RESOURCE + +APP_LAYER_SYSTEMINCLUDE + +// User include path +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../../views/cloudview/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerupnp/inc //Command Handler Upnp +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../../slideshow/engine/inc + +//to be used with new gallery +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../../inc + +// Libraries +LIBRARY centralrepository.lib //for CRepository +LIBRARY euser.lib // for RAllocator +LIBRARY mpxviewplugin.lib // For CMPXAknViewPlugin +LIBRARY glxviewbase.lib // For CGlxViewBase +LIBRARY glxcommoncommandhandlers.lib // For CGlxCommandHandlerAddToContainer, CGlxCommandHandlerDelete +LIBRARY mpxcommon.lib // For CMPXCollectionPath, MGlxMediaList, TMPXAttribute +LIBRARY glxcloudview.lib // For CGlxCloudView +LIBRARY glxupnpcommandhandler.lib // For Upnp Command Handler +LIBRARY glxcommon.lib // For filters +LIBRARY glxmedialists.lib // For MGlxMediaList +LIBRARY flogger.lib // For Logging Tracer + +//EXPORTUNFROZEN + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/inc/glxtagsbrowserviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/inc/glxtagsbrowserviewplugin.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2008-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: Tag Browser view plugin definition. + * +*/ + + + + +#ifndef C_GLXTAGSBROWSERVIEWPLUGIN_H + #define C_GLXTAGSBROWSERVIEWPLUGIN_H + + // INCLUDES + #include + #include + + // CLASS DECLARATION + + /** + * Gallery tag browser view plugin. It uses the Cloud view of Gallery. + * + * @lib glxtagsbrowserviewplugin.lib + * @since S60 v3.2 + */ + NONSHARABLE_CLASS(CGlxTagsBrowserViewPlugin): public CMPXAknViewPlugin, + public MGlxMediaListFactory + { + public: + + /** + * Two-phased constructor. + * + * @since 3.2 + * @return Pointer to newly created object. + */ + static CGlxTagsBrowserViewPlugin *NewL(); + + /** + * Destructor. + */ + virtual ~CGlxTagsBrowserViewPlugin(); + + /* Creates and returns a Media List. Ownership of Media List is transfered. + * @param aCollectionUtility The collection utility to use when creating the media list + * @return The Media List (ownership transfered to caller) + */ + MGlxMediaList& CreateMediaListL(MMPXCollectionUtility& aCollectionUtility) const; + + + private: + + /** + * From CMPXAknViewPlugin + * Construct Avkon view. + * + * @since S60 v3.2 + * @return Pointer to a newly created Avkon view. + */ + CAknView *ConstructViewLC(); + + private: + + /** + * C++ default constructor. + */ + CGlxTagsBrowserViewPlugin(); + + /** + *Symbian 2nd phase Constructor + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + }; + +#endif // C_GLXTAGSBROWSERVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/inc/glxtagsbrowserviewplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/inc/glxtagsbrowserviewplugin.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008-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: Resource headers +* +*/ + + + + +#ifndef GLXTAGSBROWSERVIEWPLUGIN_HRH +#define GLXTAGSBROWSERVIEWPLUGIN_HRH + +// CONSTANTS + +#define KGlxTagsBrowserPluginDllUid 0x200071B6 +#define KGlxTagsBrowserPluginImplementationUid 0x200071B7 + + +#endif // GLXTAGSBROWSERVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/rom/tagsbrowserviewplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/rom/tagsbrowserviewplugin.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008-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: TagBrowserViewPlugin's iby file.* +*/ + + + + +#ifndef __TAGSBROWSERVIEWPLUGIN_IBY__ +#define __TAGSBROWSERVIEWPLUGIN_IBY__ + +#ifdef GALLERY_TESTING +ECOM_PLUGIN( glxtagsbrowserviewplugin.dll, glxtagsbrowserviewplugin.rsc ) +#else +ECOM_PLUGIN( glxtagsbrowserviewplugin.dll, glxtagsbrowserviewplugin.rsc ) +#endif // GALLERY_TESTING + +#endif // __TAGSBROWSERVIEWPLUGIN_IBY__ + +// End of file +----------------------------------------------------------- \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/rom/tagsbrowserviewplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/rom/tagsbrowserviewplugin_resources.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008-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: TagBrowserViewPlugin's iby file.* +*/ + + + + +#ifndef __TAGSBROWSERVIEWPLUGIN__RESOURCES_IBY__ +#define __TAGSBROWSERVIEWPLUGIN__RESOURCES_IBY__ + +#ifdef GALLERY_TESTING +data=DATAZ_\APP_RESOURCE_DIR\glxtagsbrowserview.rsc RESOURCE_FILES_DIR\glxtagsbrowserview.rsc +#else +data=DATAZ_\APP_RESOURCE_DIR\glxtagsbrowserview.rsc RESOURCE_FILES_DIR\glxtagsbrowserview.rsc +#endif // GALLERY_TESTING + +#endif // __TAGSBROWSERVIEWPLUGIN__RESOURCES_IBY__ + +// End of file +----------------------------------------------------------- \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/src/glxtagsbrowserviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/src/glxtagsbrowserviewplugin.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2008-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: Tag browser view plugin implementation + * +*/ + + + + +// INCLUDE FILES + +#include "glxtagsbrowserviewplugin.h" //class header + +#include +#include // For Logs +#include // For MMPXCollectionUtility +#include // For resources +#include // For CGlxSimpleListView +#include // For CGlxCommandHandlerBack +#include //Command Handlers stop showing +#include // For CGlxCommandHandlerSortOrder +#include +#include // For TGlxFilterFactory +#include // For Cenrep Keys +#include // for slide show command handler +#include +#include +#include //For tag manager launch +#include + +#include "glxtagsbrowserviewplugin.hrh" // For Plugin Uids + +// Resource File +_LIT(KResourceFile, "glxtagsbrowserview.rsc"); + + +// --------------------------------------------------------------------------- +// C++ default constructor +// --------------------------------------------------------------------------- +// +CGlxTagsBrowserViewPlugin::CGlxTagsBrowserViewPlugin() +{ + TRACER("CGlxTagsBrowserViewPlugin::CGlxTagsBrowserViewPlugin"); +} + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxTagsBrowserViewPlugin::ConstructL() +{ + TRACER("CGlxTagsBrowserViewPlugin::ConstructL"); +} + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxTagsBrowserViewPlugin *CGlxTagsBrowserViewPlugin::NewL() +{ + TRACER("CGlxTagsBrowserViewPlugin::NewL"); + + CGlxTagsBrowserViewPlugin *self = new(ELeave)CGlxTagsBrowserViewPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxTagsBrowserViewPlugin::~CGlxTagsBrowserViewPlugin() +{ + TRACER("CGlxTagsBrowserViewPlugin::~CGlxTagsBrowserViewPlugin "); + +} + +// --------------------------------------------------------------------------- +// From CMPXAknViewPlugin +// Construct Avkon view. +// --------------------------------------------------------------------------- +// +CAknView *CGlxTagsBrowserViewPlugin::ConstructViewLC() +{ + TRACER("CGlxTagsBrowserViewPlugin::ConstructViewLC"); + + GLX_LOG_INFO("CGlxTagsBrowserViewPlugin::ConstructViewLC - Create the view"); + CGlxCloudView *view = CGlxCloudView::NewLC(this, KResourceFile(), + // Resource file name + R_TAGSBROWSER_VIEW, // View resource + R_TAGSBROWSER_EMPTY_TEXT, // Empty list text + R_TAGSBROWSER_SOFTKEYS_OPTIONS_BACK_SELECT, //softket resource id + R_TAGSBROWSER_SOFTKEYS_MSK_DISABLED //msk disabled resource id + ); + + // Add commnad handler + view->AddCommandHandlerL(CGlxCommandHandlerSlideshow::NewL(view,EFalse,ETrue)); + view->AddCommandHandlerL(CGlxCommandHandlerBack::NewBackCommandHandlerL()); + view->AddCommandHandlerL(CGlxCommandHandlerShowViaUpnp::NewL(view, EFalse)); + view->AddCommandHandlerL(CGlxCommandHandlerSortOrder::NewL(view,KGlxSortOrderTagBrowser)); + view->AddCommandHandlerL(CGlxCommandHandlerDetails::NewL(view)); + GLX_LOG_INFO("Adding CGlxCommandHandlerDelete"); + view->AddCommandHandlerL(CGlxCommandHandlerDelete:: + NewL(view, ETrue, ETrue)); + + TGlxHelpContext helpInfo; + helpInfo.iBrowseContext = LGAL_HLP_TAGS_BROWSER; + view->AddCommandHandlerL(CGlxCommandHandlerHelp::NewL(helpInfo)); + view->AddCommandHandlerL(CGlxCommandHandlerRename::NewL(view,ETrue)); + + return view; +} + +// ----------------------------------------------------------------------------- +// MediaListL +// ----------------------------------------------------------------------------- +// +MGlxMediaList& CGlxTagsBrowserViewPlugin::CreateMediaListL(MMPXCollectionUtility& aCollectionUtility) const + { + MGlxMediaList* mediaList = NULL; + + // Create media list + CMPXCollectionPath* path = aCollectionUtility.Collection().PathL(); + CleanupStack::PushL(path); + path->Back(); + + // Create a filter + GLX_LOG_INFO("CGlxTagsBrowserViewPlugin::MediaListL - Create a new filter"); + // Getting sort order from cenrep setting + TGlxFilterSortOrder sortOrder = static_cast ( CGlxSettingsModel::ValueL( KGlxSortOrderTagBrowser )); + + // If sort order is alphbetical or no order is specified the create alphbetical filter + CMPXFilter* filter = NULL; + if( sortOrder == EGlxFilterSortOrderAlphabetical || sortOrder == EGlxFilterSortOrderNotUsed ) + { + filter = TGlxFilterFactory::CreateAlphabeticSortFilterL(); + } + else + { + filter = TGlxFilterFactory::CreateItemCountSortFilterL(); + } + CleanupStack::PushL(filter); + + mediaList = MGlxMediaList::InstanceL(*path, KGlxIdNone, filter); + GLX_LOG_INFO1("CGlxTagsBrowserViewPlugin::MediaListL - Path level = %d", path->Levels()); + + CleanupStack::PopAndDestroy(filter); // filter + CleanupStack::PopAndDestroy(path); // path + + return *mediaList; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/plugins/tagsbrowserviewplugin/src/glxtagsbrowserviewpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/plugins/tagsbrowserviewplugin/src/glxtagsbrowserviewpluginproxy.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-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: Standard proxy of the ECOM plugin + * +*/ + + + + +// INCLUDE FILES +#include +#include "glxtagsbrowserviewplugin.hrh" +#include "glxtagsbrowserviewplugin.h" + +#if ( !defined IMPLEMENTATION_PROXY_ENTRY ) + typedef TAny *TProxyNewLPtr; + #define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( + TProxyNewLPtr )( aFuncPtr ) } +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// The list of implementations +// --------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = +{ + IMPLEMENTATION_PROXY_ENTRY(KGlxTagsBrowserPluginImplementationUid, + CGlxTagsBrowserViewPlugin::NewL), + +}; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy *ImplementationGroupProxy(TInt &aTableCount) +{ + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; +} + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/bwins/glxtexturemanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/bwins/glxtexturemanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,17 @@ +EXPORTS + ?CreateColorAvkonIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTAknsItemID@@HVTRgb@@0HVTSize@@@Z @ 1 NONAME ; class CAlfTexture & CGlxTextureManager::CreateColorAvkonIconTextureL(class TAknsItemID const &, int, class TRgb, class TAknsItemID const &, int, class TSize) + ?CreateFlatColourTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@VTRgb@@@Z @ 2 NONAME ; class CAlfTexture & CGlxTextureManager::CreateFlatColourTextureL(class TRgb) + ?CreateAvkonIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTAknsItemID@@HVTSize@@@Z @ 3 NONAME ; class CAlfTexture & CGlxTextureManager::CreateAvkonIconTextureL(class TAknsItemID const &, int, class TSize) + ?CreateIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@HAAVTDesC16@@VTSize@@@Z @ 4 NONAME ; class CAlfTexture & CGlxTextureManager::CreateIconTextureL(int, class TDesC16 &, class TSize) + ?CreateZoomedTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTGlxMedia@@ABVTMPXAttribute@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@PAVMGlxTextureObserver@@@Z @ 5 NONAME ; class CAlfTexture & CGlxTextureManager::CreateZoomedTextureL(class TGlxMedia const &, class TMPXAttribute const &, class TGlxId, class MGlxTextureObserver *) + ?NewL@CGlxTextureManager@@SAPAV1@AAVCAlfTextureManager@@@Z @ 6 NONAME ; class CGlxTextureManager * CGlxTextureManager::NewL(class CAlfTextureManager &) + ?RemoveTexture@CGlxTextureManager@@QAEXABVTGlxMediaId@@H@Z @ 7 NONAME ; void CGlxTextureManager::RemoveTexture(class TGlxMediaId const &, int) + ?TextureNeedsUpdating@CGlxTextureManager@@QAEHVTGlxMedia@@V?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTSize@@@Z @ 8 NONAME ; int CGlxTextureManager::TextureNeedsUpdating(class TGlxMedia, class TGlxId, class TSize const &) + ?RemoveTexture@CGlxTextureManager@@QAEXABVCAlfTexture@@@Z @ 9 NONAME ; void CGlxTextureManager::RemoveTexture(class CAlfTexture const &) + ?RemoveZoomList@CGlxTextureManager@@QAEXXZ @ 10 NONAME ; void CGlxTextureManager::RemoveZoomList(void) + ?CreateAnimatedGifTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTDesC16@@ABVTSize@@@Z @ 11 NONAME ; class CAlfTexture & CGlxTextureManager::CreateAnimatedGifTextureL(class TDesC16 const &, class TSize const &) + ?CreateAvkonIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTAknsItemID@@VTSize@@@Z @ 12 NONAME ; class CAlfTexture & CGlxTextureManager::CreateAvkonIconTextureL(class TAknsItemID const &, class TSize) + ?CreateColorIconTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@HAAVTDesC16@@VTRgb@@ABVTAknsItemID@@HVTSize@@@Z @ 13 NONAME ; class CAlfTexture & CGlxTextureManager::CreateColorIconTextureL(int, class TDesC16 &, class TRgb, class TAknsItemID const &, int, class TSize) + ?CreateThumbnailTextureL@CGlxTextureManager@@QAEAAVCAlfTexture@@ABVTGlxMedia@@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTSize@@PAVMGlxTextureObserver@@H@Z @ 14 NONAME ; class CAlfTexture & CGlxTextureManager::CreateThumbnailTextureL(class TGlxMedia const &, class TGlxId const &, class TSize const &, class MGlxTextureObserver *, int) + ?CreateNewTextureForMediaL@CGlxTextureManager@@QAEAAVCAlfTexture@@VTSize@@ABVTGlxMedia@@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@PAVMGlxTextureObserver@@@Z @ 15 NONAME ; class CAlfTexture & CGlxTextureManager::CreateNewTextureForMediaL(class TSize, class TGlxMedia const &, class TGlxId const &, class MGlxTextureObserver *) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/eabi/glxtexturemanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/eabi/glxtexturemanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,21 @@ +EXPORTS + _ZN18CGlxTextureManager13RemoveTextureERK11CAlfTexture @ 1 NONAME + _ZN18CGlxTextureManager13RemoveTextureERK11TGlxMediaIdi @ 2 NONAME + _ZN18CGlxTextureManager14RemoveZoomListEv @ 3 NONAME + _ZN18CGlxTextureManager18CreateIconTextureLEiR7TDesC165TSize @ 4 NONAME + _ZN18CGlxTextureManager20CreateZoomedTextureLERK9TGlxMediaRK13TMPXAttribute6TGlxIdI17TGlxIdSpaceIdBaseEP19MGlxTextureObserver @ 5 NONAME + _ZN18CGlxTextureManager20TextureNeedsUpdatingE9TGlxMedia6TGlxIdI17TGlxIdSpaceIdBaseERK5TSize @ 6 NONAME + _ZN18CGlxTextureManager23CreateAvkonIconTextureLERK11TAknsItemID5TSize @ 7 NONAME + _ZN18CGlxTextureManager23CreateAvkonIconTextureLERK11TAknsItemIDi5TSize @ 8 NONAME + _ZN18CGlxTextureManager23CreateColorIconTextureLEiR7TDesC164TRgbRK11TAknsItemIDi5TSize @ 9 NONAME + _ZN18CGlxTextureManager23CreateThumbnailTextureLERK9TGlxMediaRK6TGlxIdI17TGlxIdSpaceIdBaseERK5TSizeP19MGlxTextureObserveri @ 10 NONAME + _ZN18CGlxTextureManager24CreateFlatColourTextureLE4TRgb @ 11 NONAME + _ZN18CGlxTextureManager25CreateAnimatedGifTextureLERK7TDesC16RK5TSize @ 12 NONAME + _ZN18CGlxTextureManager25CreateNewTextureForMediaLE5TSizeRK9TGlxMediaRK6TGlxIdI17TGlxIdSpaceIdBaseEP19MGlxTextureObserver @ 13 NONAME + _ZN18CGlxTextureManager28CreateColorAvkonIconTextureLERK11TAknsItemIDi4TRgbS2_i5TSize @ 14 NONAME + _ZN18CGlxTextureManager4NewLER18CAlfTextureManager @ 15 NONAME + _ZTI22CGlxTextureManagerImpl @ 16 NONAME + _ZTI24CGlxBitmapDecoderWrapper @ 17 NONAME + _ZTV22CGlxTextureManagerImpl @ 18 NONAME + _ZTV24CGlxBitmapDecoderWrapper @ 19 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2008-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: Build information for subsystem Texture Manager. +* +*/ + + + + +PRJ_MMPFILES +glxtexturemanager.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/group/glxtexturemanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/group/glxtexturemanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include + +#include "../../../group/glxbuildcommon.mmh" + + +TARGET glxtexturemanager.dll +TARGETTYPE dll +UID 0x1000008d 0x200071a7 +CAPABILITY CAP_GENERAL_DLL + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +SOURCEPATH ../src +SOURCE glxtexturemanager.cpp +SOURCE glxtexturemanagerimpl.cpp +SOURCE glxbitmapdecoderwrapper.cpp + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../medialists/inc +SYSTEMINCLUDE ../../drmutility/inc +SYSTEMINCLUDE ../../../commonui/inc +SYSTEMINCLUDE ../../uiutilities/inc +SYSTEMINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY aknicon.lib +LIBRARY aknskins.lib +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY bitgdi.lib +LIBRARY gdi.lib +LIBRARY glxdrmutility.lib +LIBRARY glxmedialists.lib +LIBRARY hitchcock.lib // HUI framework +LIBRARY mpxcommon.lib +LIBRARY glxcommonui.lib // for CGlxResolutionUtility +LIBRARY alfclient.lib // For Alfred Hitchcock framework +LIBRARY glxuiutilities.lib +LIBRARY imageconversion.lib +LIBRARY bitmaptransforms.lib +LIBRARY iclextjpegapi.lib +LIBRARY efsrv.lib +LIBRARY hal.lib // HAL, HALData +LIBRARY exiflib.lib +LIBRARY oommonitor.lib // For Requesting RAM +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/inc/glxbitmapdecoderwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/inc/glxbitmapdecoderwrapper.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2008-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: Texture Manager component/Decodes the Image in step for large images + * +*/ + + + + +#ifndef C_GLXBITMAPDECODERWRAPPER_H +#define C_GLXBITMAPDECODERWRAPPER_H + +// INCLUDE FILES +#include +#include // For CExtJpegDecoder + +/** + * Observer interface used to be notified when texture bitmap is completed. + */ +NONSHARABLE_CLASS( MGlxBitmapDecoderObserver ) + { + public: + /** + * Called when the content of the texture is changed. + * @param aHasContent Whether the texture now has content. + */ + virtual void HandleBitmapDecodedL(TInt aThumbnailIndex,CFbsBitmap* aBitmap) = 0; + }; +/** + * This class does the decoding of the images in steps depending on the size of the images . + * this is a wrapper class, doesn't actually decode the images. + */ + +class CGlxBitmapDecoderWrapper: public CActive + { +public: + /*This Enums specifies the state of the Decoding*/ + enum TDecoderState + { + ESTate0, ESTate1,ESTateFinal + }; + /*This Enums specifies the size of the images*/ + enum TImageLevel + { + ELevel0, ELevel1,ELevel2 + }; + /** + * Two-phased constructor + * @param aObserver:The Observer contains the CGlxTextureManagerImpl Object + * @return Constructed object + */ + static CGlxBitmapDecoderWrapper* NewL(MGlxBitmapDecoderObserver* aObserver); + + /** + * Destructor + */ + ~CGlxBitmapDecoderWrapper(); + + /** + * intiates the Decoding the Image and updates the no:of steps to decode + * @param aSourceFileName :contains the file name + * @param aindex:contains the index value + */ + void DoDecodeImageL(const TDesC & aSourceFileName,TInt aIndex); + + /** + * starts the decoding and updates the state of the decoding + */ + void DecodeImageL(); + /** + * Request free memory with Out of Memory Monitor + * @param aBytesRequested : Request for free memory in Bytes + */ + TInt OOMRequestFreeMemoryL( TInt aBytesRequested); + +public: + /** + * Standard Active object functions + * */ + virtual void RunL(); + virtual void DoCancel(); + +private: + /* + * Constructor + * */ + CGlxBitmapDecoderWrapper(); + + /* + *Second-phase constuction + * */ + void ConstructL(MGlxBitmapDecoderObserver* aObserver); + /* + * Get the orientation of the file + * This API reads the Exif tag in an image and returns the orientation of that Image + */ + TUint16 GetOrientationL(const TDesC& aFileName) ; + /* + * Get the Rotation Angle and Mirroring status of the image so as to set it on the decoder + * This API calculates the rotation angle and the Mirroring status required by the decoder + * @param aOrientation Orientation of the image. + * @param aRotAngle Rotation angle to be set on the image decoder. + * @param aFlipStatus Mirroring status for the decoder if 1 then mirroring should be set. + * Internally it also sets the iOriginalSize to the required size + */ + void GetRotationParameters(TUint16 aOrientation, TInt& aRotAngle, TBool& aFlipStatus) ; + +private: + /* Contains the TextureManagerImpl object,calls the HandleBitmapDecoded*/ + MGlxBitmapDecoderObserver* iObserver; + /*Specifies the Decoder */ + CImageDecoder* iImageDecoder; // decoder from ICL API + /*Contains the Thumbnail Index*/ + TInt iThumbnailIndex; + /*Contains the Bitmap generated*/ + CFbsBitmap* iBitmap; + /*contains the original size of the image*/ + TAlfRealSize iOriginalSize; + /*A handle to a file server session.*/ + RFs iFs; + /*Specifies the state of decoding ,if it is in initial level(3MP), Middlelevel(6MP) or final level*/ + TDecoderState iDecoderState; + /*Specifies the size of teh image and levels to decode*/ + TImageLevel iImageLevel; +#ifdef _DEBUG + + TTime iDecodeProcessstartTime; + TTime iStartTime; + TTime iStopTime; +#endif + }; + +#endif //C_GLXBITMAPDECODERWRAPPER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/inc/glxtexturemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/inc/glxtexturemanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2008-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: Texture Manager component +* +*/ + + + + +#ifndef C_GLXTEXTUREMANAGER_H +#define C_GLXTEXTUREMANAGER_H + +#include +#include +#include +#include +#include "mglxskinchangeobserver.h" + +class TAknsItemID; +class CAlfTexture; +class TMPXAttribute; +class CGlxDRMUtility; +class CGlxMedia; +class CAlfImageLoaderUtil; +class CAlfTextureManager; +class MGlxCache; +class TGlxMedia; +class CGlxResolutionUtility; +class CGlxTextureManagerImpl; +class MGlxTextureObserver; + +/** + * CGlxTextureManager + * + * Texture Manager component. + * + * @author David Holland + * + */ +NONSHARABLE_CLASS ( CGlxTextureManager ) : public CBase, + public MGlxSkinChangeObserver + { +public: + /** + * Two-phased constructor + * @param aAlfTextureManager The Alf Texture Manager + * @return Constructed object + */ + IMPORT_C static CGlxTextureManager* NewL( + CAlfTextureManager& aAlfTextureManager); + + + /** + * Destructor + */ + ~CGlxTextureManager(); + /** + * Determins if the texture need updating + * @param aMediaId The Id of the media item + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aRequiredSize The preferred size of the texture + * @return ETrue if the texture needs updating. EFalse if not. + */ + IMPORT_C TBool TextureNeedsUpdating(TGlxMedia aMedia, TGlxIdSpaceId aIdSpaceId, + const TSize& aRequiredSize); + + /** + * Requests the best match texture. If it already exists this method does nothing. + * However if it doed not exist it will create it and replace the old texture + * if necessary. + * @param aSize The size of the requested texture + * @param aMedia The TGlxMedia item + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aObserver Observer for the texture. + * @return Created texture, or NULL if the texture alreay exists + */ + + IMPORT_C CAlfTexture& CreateNewTextureForMediaL( + TSize aSize, + const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId, + MGlxTextureObserver* aObserver ); + /** + * Create a texture from an Avkon icon + * @param aId The Id associated with the icon in the Skin + * @param aBitmapId The Id associated with the bitmap in the Avkon icon bitmap file + * The bitmap Id is used if no icon is found for the skin Id + * @param aRequestedSize requested size. If default used size is based on size of original graphic + * @return Created texture + */ + IMPORT_C CAlfTexture& CreateAvkonIconTextureL(const TAknsItemID &aID, + TInt aBitmapId, + TSize aRequestedSize = TSize(0,0)); + + /** + * Create a texture from an Avkon icon + * @param aId The Id associated with the icon in the Skin + * @param aBitmapId The Id associated with the bitmap in the Avkon icon bitmap file + * The bitmap Id is used if no icon is found for the skin Id + * @param aDefaultColor colour use if skin clour not specified or not found + * @param aSkinColorId Id of the skin colour table + * @param aSkinColorIndex Index of the colour in the table + * @param aRequestedSize requested size. If default used size is based on size of original graphic + * @return Created texture + */ + IMPORT_C CAlfTexture& CreateColorAvkonIconTextureL( + const TAknsItemID& aID, + TInt aBitmapId, + TRgb aDefaultColor, + const TAknsItemID& aSkinColorId = KAknsIIDNone, + TInt aSkinColorIndex = 0, + TSize aRequestedSize = TSize(0,0)); + + + /** + * Create a texture from an Avkon icon + * @param aId The Id associated with the icon in the Skin + * @param aRequestedSize requested size. If default used size is based on size of original graphic + * @return Created texture + */ + IMPORT_C CAlfTexture& CreateAvkonIconTextureL(const TAknsItemID &aID, + TSize aRequestedSize = TSize(0,0)); + + /** + * Create a texture from an icon within the application + * @param aIconResourceId The Id associated with the icon .mif file + * @param aFilename The full path name of the .mif file + * @param aRequestedSize requested size. If default used size is based on size of original graphic + * @return Created texture + */ + IMPORT_C CAlfTexture& CreateIconTextureL(TInt aIconResourceId, + TDesC& aFilename, + TSize aRequestedSize = TSize(0,0)); + + /** + * Create a texture from an icon within the application, modifying the icon colour + * @param aIconResourceId The Id associated with the icon .mif file + * @param aFilename The full path name of the .mif file + * @param aDefaultColor colour use if skin clour not specified or not found + * @param aSkinColorId Id of the skin colour table + * @param aSkinColorIndex Index of the colour in the table + * @param aRequestedSize requested size. If default used size is based on size of original graphic + * @return Created texture + */ + IMPORT_C CAlfTexture& CreateColorIconTextureL( + TInt aIconResourceId, + TDesC& aFilename, + TRgb aDefaultColor, + const TAknsItemID& aSkinColorId = KAknsIIDNone, + TInt aSkinColorIndex = 0, + TSize aRequestedSize = TSize(0,0)); + + /** + * Create a texture from a bitmap from the attribute of a media item + * @param aMediaId The Id of the media item + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aRequiredSize The preferred size of the texture + * @param aObserver Observer for the texture. + * @param aScaleGridTnm ETrue if the grid tnm to be scaled else EFalse by default. + * @return Created texture + */ + IMPORT_C CAlfTexture& CreateThumbnailTextureL( + const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId, + const TSize& aRequiredSize, MGlxTextureObserver* aObserver, + TBool aScaleGridTnm=EFalse); + + /** + * Create a texture from a zoomed thumbnail attribute of a media item + * @param aMedia The media item + * @param aAttribute Which attribute + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aTextureId The created texture's id, required when the texture is removed. + * @return Created texture + */ + IMPORT_C CAlfTexture& CreateZoomedTextureL(const TGlxMedia& aMedia, + const TMPXAttribute& aAttribute, + TGlxIdSpaceId aIdSpaceId, MGlxTextureObserver* aObserver); + + /** + * Create an animated texture from a GIF file + * @param aFilename The filename of the GIF file + * @param aSize The size of the GIF file + * @return Created texture: ownership transfered + */ + IMPORT_C CAlfTexture& CreateAnimatedGifTextureL( const TDesC& aFilename, + const TSize& aSize ); + + /** + * Creates a flat color texture and returns the reference to it + * Note that the texture ownership stays within texture manager + * @param aColour the color for the texture + */ + IMPORT_C CAlfTexture& CreateFlatColourTextureL( TRgb aColour ); + + /** + * Removes the texture if it was created by CreateThumbnailTextureL or + * CreateZoomedTextureL + * @param aTexture The texture to be removed + */ + IMPORT_C void RemoveTexture(const CAlfTexture& aTexture); + /** + * Removes the texture if it was created by CreateThumbnailTextureL or + * CreateZoomedTextureL + * @param aTexture The texture to be removed + */ + IMPORT_C void RemoveZoomList(); + + /** + * Removes the texture if it was created by CreateThumbnailTextureL or + * CreateZoomedTextureL + * @param aMediaId The MediaId to be removed + * @param aAllTexture Flag to remove all textures + * Bug fix for PKAA-7NRBYZ - added bAllTexture param + */ + IMPORT_C void RemoveTexture(const TGlxMediaId& aMediaId, TBool aAllTexture=EFalse); + +public: // from MGlxSkinChangeObserver + + void HandleSkinChanged(); + + +private: + //implementation class + CGlxTextureManagerImpl* iImpl; + }; + + + +#endif // C_GLXTEXTUREMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/inc/glxtexturemanagerimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/inc/glxtexturemanagerimpl.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,395 @@ +/* +* Copyright (c) 2008-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: Texture Manager component +* +*/ + + + + +#ifndef C_GLXTEXTUREMANAGERIMPL_H +#define C_GLXTEXTUREMANAGERIMPL_H + +#include +#include // For CDesCArrayFlat +#include + +#include +#include +#include +#include +#include +#include +#include "glxbitmapdecoderwrapper.h" +#include + +#include +#include +#include +class CAlfTexture; +class CGlxDRMUtility; +class CGlxMedia; +//class CAlfGifAnimationTexture; +class CAlfImageLoaderUtil; +class CAlfTextureManager; +class MGlxCache; +class TGlxMedia; +class CGlxResolutionUtility; +class MGlxTextureObserver; +class CGlxBitmapDecoderWrapper; +class MGlxBitmapDecoderObserver; +class CGlxThumbnailAttribute; +/** + * CGlxTextureManagerImpl + * + * Implementation of Texture Manager component. + * + * @author David Holland + * @internal reviewed 03/07/2007 by Dan Rhodes + * + */ +class CGlxTextureManagerImpl : public CBase, public MAlfBitmapProvider, + public MGlxResolutionChangeObserver, + public MGlxBitmapDecoderObserver, + public MGlxCacheObserver + { +public: + /** + * Two-phased constructor + * @param aAlfTextureManager The Alf Texture Manager + * @return Constructed object + */ + static CGlxTextureManagerImpl* NewL( + CAlfTextureManager& aAlfTextureManager); + + /** + * Two-phased constructor + * @param aAlfTextureManager The Alf Texture Manager + * @return Constructed object + */ + static CGlxTextureManagerImpl* NewLC( + CAlfTextureManager& aAlfTextureManager); + + /** + * Destructor + */ + ~CGlxTextureManagerImpl(); + + /** + * Determins if the texture need updating + * @param aMediaId The Id of the media item + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aRequiredSize The preferred size of the texture + * @return ETrue if the texture needs updating. EFalse if not. + */ + TBool TextureNeedsUpdating(TGlxMedia aMedia, TGlxIdSpaceId aIdSpaceId, + const TSize& aRequiredSize); + /** + * Create a texture from an icon within the application + * @param aSkinID The skin Id associated with the icon + * @param aIconResourceId The Id associated with the icon .mif file + * @param aFilename The full path name of the .mif file + * @param aSetColor ETrue if colour of icon is to be modified + * @param aDefaultColor colour use if skin clour not specified or not found + * @param aSkinColorId Id of the skin colour table + * @param aSkinColorIndex Index of the colour in the table + * @param aRequestedSize requested size. If default used size is based on size of original graphic + * @return Created texture + */ + CAlfTexture& CreateIconTextureL(const TAknsItemID& aSkinID, + TInt aIconResourceId, + const TDesC& aFilename, + TBool aSetColor, + TRgb aDefaultColor, + const TAknsItemID& aSkinColorId, + TInt aSkinColorIndex, + TSize aRequestedSize); + + /** + * Requests the best match texture. If it already exists this method does nothing. + * However if it doed not exist it will create it and replace the old texture + * if necessary. + * @param aSize The size of the requested texture + * @param aMedia The TGlxMedia item + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aObserver Observer for the texture. + * @param aScaleGridTnm ETrue if the grid tnm to be scaled else EFalse. + * @return Created texture, or NULL if the texture alreay exists + */ + CAlfTexture& CreateNewTextureForMediaL(TSize aSize, const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId, MGlxTextureObserver* aObserver, TBool aScaleGridTnm ); + + + /** + * Create a texture from a zoomed thumbnail attribute of a media item + * @param aMedia The media item + * @param aAttribute Which attribute + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aTextureId The created texture's id, required when the texture is removed. + * @return Created texture + */ + CAlfTexture& CreateZoomedTextureL(const TGlxMedia& aMedia, + const TMPXAttribute& aAttribute, + TGlxIdSpaceId aIdSpaceId, MGlxTextureObserver* aObserver); + + /** + * Create an animated texture from a GIF file + * @param aFilename The filename of the GIF file + * @param aSize The size of the GIF file + * @return Created texture: ownership transfered + */ + CAlfTexture& CreateAnimatedGifTextureL(const TDesC& aFilename, + const TSize& aSize); + + /** + * Removes the texture if it was created by CreateThumbnailTextureL or + * CreateZoomedTextureL + * @param aTexture The texture to be removed + */ + void RemoveTexture( const CAlfTexture& aTexture ); + /** + * Removes the texture if it was created by CreateThumbnailTextureL or + * CreateZoomedTextureL + * @param aTexture The texture to be removed + */ + void RemoveZoomList(); + + /** + * Removes the texture if it was created by CreateThumbnailTextureL or + * CreateZoomedTextureL + * @param TGlxMediaId The iMediaId to be removed + * @param aAllTexture Flag to remove all textures + * Bug fix for PKAA-7NRBYZ - added bAllTexture param. + */ + void RemoveTexture( const TGlxMediaId& aMediaId, TBool aAllTexture); + + + /** + * Creates a flat color texture and returns the reference to it + */ + CAlfTexture& CreateFlatColourTextureL( TRgb aColour ); + +public: // From MGlxCacheObserver + void HandleAttributesAvailableL(const TGlxIdSpaceId& aIdSpaceId, + const TGlxMediaId& aMediaId, + const RArray& aAttributes, + const CGlxMedia* aMedia); + + void CleanupMedia(const TGlxMediaId& aMediaId); + +public: // from MAlfBitmapProvider + void ProvideBitmapL(TInt aId, + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMaskBitmap); + + +public: // From MGlxResolutionChangeObserver + void HandleResolutionChangedL(); + + /** + * Updates the texture for every Icon in the IconList. + */ + void UpdateTexture(); +public: // From MGlxTextureRotatorObserver + void HandleBitmapDecodedL(TInt aThumbnailIndex,CFbsBitmap* aBitmap); + + +private: + /** + * Constructor + * @param aAlfTextureManager The Alf Texture Manager + */ + CGlxTextureManagerImpl(CAlfTextureManager& aAlfTextureManager); + + /** + * Second-phase constuction + */ + void ConstructL(); + + + /** + * GetThumbnailAttributeAndIndexL + * @param aSize The size of the requested texture + * @param aMedia The TGlxMedia item. + * @param aThumbnailIndex on return will contain the Index of the thumbnail in the iThumbnailList + * or KErrNotFound + * @param aThumbnailAttribute on return will contain the Thumbnail attribute (if found) + * @return ETrue if Thumbnail is available, EFalse if it needs to be created + */ + TBool GetThumbnailAttributeAndIndexL( TSize aSize, const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId, TInt& aThumbnailIndex, + TMPXAttribute& aThumbnailAttribute ); + + /** + * TGlxIcon + * Values associated with a bitmap/svg icon + */ + class TGlxIcon + { + public: + TInt iTextureId; + CAlfTexture* iTexture; + TAknsItemID iAvkonSkinId; + TInt iBitmapId; + TInt iFilenameIndex; + TBool iSetColor; // indicates if color to be modified + TRgb iDefaultColor; + TAknsItemID iSkinColorId; + TInt iSkinColorIndex; + TReal32 iHeightInPoss; + TReal32 iWidthInPoss; + + /** + * Helper functor to be able to find texture from array + */ + static TBool MatchTexture( + const CAlfTexture* aTexture, + const TGlxIcon& aRhs ) + { + // return true if the address of the texture match + return aTexture == aRhs.iTexture; + } + }; + + /** + * TGlxThumbIcon + * Values associated with a thumbnail. + */ + class TGlxThumbnailIcon + { + public: + TInt iTextureId; + CAlfTexture* iTexture; + TMPXAttribute iAttribId; + TSize iRequiredSize; + TGlxMediaId iMediaId; + TGlxIdSpaceId iIdSpaceId; + MGlxTextureObserver* iObserver; + CFbsBitmap* iBitmap; + TTime iImageDate; + /** + * Helper functor to be able to find texture from array + */ + static TBool MatchTexture( + const CAlfTexture* aTexture, + const TGlxThumbnailIcon& aRhs ) + { + // return true if the address of the texture match + return aTexture == aRhs.iTexture; + } + }; + /** + * Requests the best match texture. If it already exists this method does nothing. + * However if it doed not exist it will create it and replace the old texture + * if necessary. + * @param aSize The size of the requested texture + * @param aMedia The TGlxMedia item + * @param aIdSpaceId The Id of the Id space in which the media Id is defined + * @param aObserver Observer for the texture. + * @param aAttribute specifies the type of texture to create + * @param aThumbData the tumbnail data + * @param aScaleGridTnm ETrue if the grid tnm to be scaled else EFalse. + * @return Created texture, or NULL if the texture alreay exists + */ + CAlfTexture& CreateNewTextureL( TSize aSize, const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId, MGlxTextureObserver* aObserver, + TMPXAttribute& aAttribute, TGlxThumbnailIcon& aThumbData,TBool aIsThumbnailTexture, TBool aScaleGridTnm); + + + /** + * TGlxProvideBitmapHolder + * Used to hold the bitmaps and their associated texture id between + * the call to create the alf texture and the callback to ProvideBitmap. + */ + class TGlxProvideBitmapHolder + { + public: + TInt iTextureId; + CFbsBitmap* iBitmap; // not owned + CFbsBitmap* iMaskBitmap; // not owned + }; + + /** + * Select the most appropriate attribute to use to load bitmap + * @param aThumbnail contains the data concerning the texture + * @param aMedia the media + * @return Index of selected attribute in list or KErrNotFound + */ + TMPXAttribute SelectAttributeL(TSize& aThumbnail, + const TGlxMedia& aMedia); + + + /** + * Duplicates a bitmap + * @param aOriginalBitmap original bitmap + * @return duplicate bitmap + */ + CFbsBitmap* CreateDuplicateBitmapL( CFbsBitmap& aOriginalBitmap ); + + /** + * Increments the texture id and returns it + * @return next texture id + */ + TInt NextTextureId(); + + // void DoHandleResolutionChangedL(TInt aIconIndex); + + /** + * Scales the grid Thumbnail bitmap to the fullscreen keeping the aspect + * ratio. + * @param aSrcSize The size of the original image + * @param aDestSize The Fullscreen size + * @param aScaledBitmap Pointer to the scaled bitmap + * @param thumb thumbnail attributes. + */ + void ScaleGridTnmToFsL(TSize aSrcSize, TSize aDestSize, + CFbsBitmap *aScaledBitmap, const CGlxThumbnailAttribute* thumb); + +private: + // Alf Texture manager (not owned) + CAlfTextureManager& iAlfTextureManager; + + // Next id to be allocated to icon textures provide within the application. + TInt iNextTextureId; + + // List containing data for icon textures provided within the application. + RArray iIconList; + + // List containing data for textures generated from thumbnail bitmaps. + RArray iThumbnailList; + + // List containing data for textures generated from zoomed thumbnail. + RArray iZoomedList; + + // List of .mif filenames of files containing icons. + CDesCArrayFlat* iMifFilenames; + + // DRM utility class + CGlxDRMUtility* iDrmUtility; + + // MGlxCache instance + MGlxCache* iCache; + + // CGlxResolutionUtility instance + CGlxResolutionUtility* iResUtil; + + //The Bitmap Decoder Engine + CGlxBitmapDecoderWrapper* iZoomDecoder; + // Temporary storage class used between call to create a texture and the + //callback from alf to ProvideBitmap + TGlxProvideBitmapHolder iProvideBitmapHolder; + + }; + +#endif // C_GLXTEXTUREMANAGERIMPL_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/inc/mglxtextureobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/inc/mglxtextureobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2008-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: Texture Manager component +* +*/ + + + + +#ifndef M_GLXTEXTUREOBSERVER_H +#define M_GLXTEXTUREOBSERVER_H + +#include +#include +/** + * Observer interface used to be notified when texture content changes. + * + * @author Dan Rhodes + */ +NONSHARABLE_CLASS( MGlxTextureObserver ) + { +public: + /** + * Called when the content of the texture is changed. + * @param aHasContent Whether the texture now has content. + */ + virtual void TextureContentChangedL( TBool aHasContent , CAlfTexture* aNewTexture) = 0; + }; + +#endif // M_GLXTEXTUREOBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/src/glxbitmapdecoderwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/src/glxbitmapdecoderwrapper.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,412 @@ +/* +* Copyright (c) 2008-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: Texture Manager component/Decodes the Image in step for large sized images + * +*/ + + + + +// INCLUDE FILES +#include "glxbitmapdecoderwrapper.h" +#include // For Log +#include +#include +#include +#include +#include +#include +#include +#include +namespace +{ +const TInt KGlxDecodingThreshold = 3000000; + + +// Photos low_ram_threshold [8.637 MB] as in oomconfig.xml +const TInt KGlxCriticalRAMForPhotos = 9056550; +const TInt KGlxDecodeBitmapFactor = 3; +// All EXIF data is within the first KGlxMaxExifSize bytes of the file +const TInt KGlxMaxExifSize = 0x10000; +} + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxBitmapDecoderWrapper* CGlxBitmapDecoderWrapper::NewL(MGlxBitmapDecoderObserver* aObserver) + { + TRACER("CGlxBitmapDecoderWrapper:: NewL "); + CGlxBitmapDecoderWrapper* self = new(ELeave)CGlxBitmapDecoderWrapper(); + CleanupStack::PushL(self); + self->ConstructL(aObserver); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxBitmapDecoderWrapper::CGlxBitmapDecoderWrapper() + :CActive( EPriorityLow ) + { + TRACER("CGlxBitmapDecoderWrapper:: NewL "); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// + +CGlxBitmapDecoderWrapper::~CGlxBitmapDecoderWrapper() + { + TRACER("CGlxBitmapDecoderWrapper:: ~CGlxBitmapDecoderWrapper "); + iFs.Close(); + Cancel(); + if (iImageDecoder) + { + delete iImageDecoder; + iImageDecoder = NULL; + } + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +void CGlxBitmapDecoderWrapper::ConstructL(MGlxBitmapDecoderObserver* aObserver) + { + TRACER("CGlxBitmapDecoderWrapper::ConstructL "); + iObserver = aObserver; + User::LeaveIfError(iFs.Connect()); + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// DoDecodeImageL +// --------------------------------------------------------------------------- + +void CGlxBitmapDecoderWrapper::DoDecodeImageL(const TDesC & aSourceFileName,TInt aIndex) + { + TRACER("CGlxBitmapDecoderWrapper:: DoDecodeImageL "); + iThumbnailIndex = aIndex; + //Variable used to get the decoder type used; + TBool isExtDecoderUsed = ETrue; + +#ifdef _DEBUG + iDecodeProcessstartTime.HomeTime(); +#endif + + if (iImageDecoder) + { + delete iImageDecoder; + iImageDecoder = NULL; + } + // Use extended JPEG decoder + TRAPD( err, iImageDecoder = CExtJpegDecoder::FileNewL( + CExtJpegDecoder::EHwImplementation, iFs, aSourceFileName, CImageDecoder::EOptionNone ) ); + if ( KErrNone != err ) + { + GLX_LOG_INFO( "DoDecodeImageL:: ESwImplementation" ); + TRAP(err,iImageDecoder = CExtJpegDecoder::FileNewL( + CExtJpegDecoder::ESwImplementation, iFs, aSourceFileName, CImageDecoder::EOptionNone ) ); + if ( KErrNone != err ) + { + GLX_LOG_INFO( "DoDecodeImageL:: CImageDecoder" ); + // Not a JPEG - use standard decoder + iImageDecoder = CImageDecoder::FileNewL( iFs, aSourceFileName, CImageDecoder::EOptionNone ); + isExtDecoderUsed = EFalse; + } + } +#ifdef _DEBUG + iStopTime.HomeTime(); + GLX_DEBUG1("=== DECODER CREATION ==="); + GLX_DEBUG2("Decoder Creation took <%d> us", + (TInt)iStopTime.MicroSecondsFrom(iDecodeProcessstartTime).Int64()); +#endif + + TSize imageSize = iImageDecoder->FrameInfo().iOverallSizeInPixels; + if(isExtDecoderUsed) + { + TUint16 orientation=0; + //Read the orientation from the Exif header of the image if present + TRAPD(error, orientation=GetOrientationL(aSourceFileName)); + if(KErrNone == error ) + { + //Get the rotation angle and the flip status from orientation + TInt rotAngle = 0; + TBool flipStatus = EFalse; + GetRotationParameters(orientation, rotAngle, flipStatus); + //Set the parameters to the decoder + CExtJpegDecoder* extDecoder = (CExtJpegDecoder*)iImageDecoder; + extDecoder->SetRotationL(rotAngle); + if(flipStatus) + { + extDecoder->SetMirroringL(); + } + //Switch Image Height and width in case orientation > 4 as that + //corresponds to angles 180 and 270 degrees + if (orientation > 4) + { + imageSize.SetSize(imageSize.iHeight,imageSize.iWidth); + } + } + + } + iOriginalSize.iWidth = imageSize.iWidth; + iOriginalSize.iHeight = imageSize.iHeight; + + if (iBitmap) + { + delete iBitmap; + iBitmap = NULL; + } + DecodeImageL(); + } +// --------------------------------------------------------------------------- +// DecodeImageL +// --------------------------------------------------------------------------- +// +void CGlxBitmapDecoderWrapper::DecodeImageL() + { + TRACER("CGlxBitmapDecoderWrapper:: DecodeImageL "); + TReal32 mFactor = 1; + //Set Size according to level and state + TReal32 width = iOriginalSize.iWidth; + TReal32 height = iOriginalSize.iHeight; + GLX_LOG_INFO1("DecodeImageL:width=%f", width); + GLX_LOG_INFO1("DecodeImageL:height=%f",height); + + + if ( KGlxDecodingThreshold < (width * height)) + { + mFactor = TReal32(KGlxDecodingThreshold) / (width*height); + } + + // create the destination bitmap + if(!iBitmap) + { + TInt freeMemory = 0; + HAL::Get( HALData::EMemoryRAMFree, freeMemory ); + width*=mFactor; + height*=mFactor; + TInt minmemorytodecode = KGlxDecodeBitmapFactor*width*height; + GLX_LOG_INFO2("DecodeImageL: after factoring width=%f, height=%f", width, height); + GLX_LOG_INFO2("DecodeImageL:minmemorytodecode=%d, freememory=%d", + minmemorytodecode, freeMemory); + if(minmemorytodecode < (freeMemory - KGlxCriticalRAMForPhotos)) + { + GLX_LOG_INFO("DecodeImageL:RAM available decoding image"); + + iBitmap = new (ELeave) CFbsBitmap(); + iBitmap->Create( TSize(width,height),iImageDecoder->FrameInfo().iFrameDisplayMode ); +#ifdef _DEBUG + iStartTime.HomeTime(); // Get home time +#endif + iImageDecoder->Convert( &iStatus, *iBitmap ); + } + else + { + //case when sufficient memory is not available + //request OOM FW to release the required memory + GLX_LOG_INFO("DecodeImageL:insufficient RAM - request OOM"); + TInt err = OOMRequestFreeMemoryL(minmemorytodecode); + if(err == KErrNoMemory) + { + //if OOM fails, release Photos Cache + GLX_LOG_INFO("DecodeImageL:insufficient RAM - OOM failed - request Cache"); + MGlxCache* cacheManager = MGlxCache::InstanceL(); + cacheManager->ReleaseRAML(ETrue); + cacheManager->Close(); + //Try and release memory again + err = OOMRequestFreeMemoryL(minmemorytodecode); + } + if(err != KErrNoMemory) + { + GLX_LOG_INFO("DecodeImageL:Sufficient RAM available"); + iBitmap = new (ELeave) CFbsBitmap(); + iBitmap->Create( TSize(width,height),iImageDecoder->FrameInfo().iFrameDisplayMode ); +#ifdef _DEBUG + iStartTime.HomeTime(); // Get home time +#endif + iImageDecoder->Convert( &iStatus, *iBitmap ); + } + else + { + GLX_LOG_INFO("NOT ENOUGH MEMORY - Using the Fullscreen Thumbnail For Zoom"); + //release the file held by decoder immediately. + iImageDecoder->Cancel(); + delete iImageDecoder; + iImageDecoder = NULL; + //Inform the client that there is no decode happened and there we take care + //of showing the fullscreen thumbnail. + iObserver->HandleBitmapDecodedL(iThumbnailIndex,NULL); + return; + } + } + + SetActive(); + } + } +// --------------------------------------------------------------------------- +// RunL +// --------------------------------------------------------------------------- +// +void CGlxBitmapDecoderWrapper::RunL() + { + TRACER("CGlxBitmapDecoderWrapper:: RunL "); + if( iStatus == KErrNone ) + { + iObserver->HandleBitmapDecodedL(iThumbnailIndex,iBitmap); + iBitmap = NULL; + + //release the file held by decoder immediately. + GLX_LOG_INFO( " CGlxBitmapDecoderWrapper::RunL:Decoding Finished" ); + iImageDecoder->Cancel(); + delete iImageDecoder; + iImageDecoder = NULL; +#ifdef _DEBUG + iStopTime.HomeTime(); + GLX_DEBUG1("=== IMAGE DECODE ==="); + GLX_DEBUG2("=>Image Decode Took took <%d> us", + (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); +#endif + + } + } +// --------------------------------------------------------------------------- +// DoCancel +// --------------------------------------------------------------------------- +// +void CGlxBitmapDecoderWrapper::DoCancel() + { + TRACER("CGlxBitmapDecoderWrapper:: DoCancel "); + if(iImageDecoder) + { + GLX_LOG_INFO( " CGlxBitmapDecoderWrapper::DoCancel:Deleting" ); + iImageDecoder->Cancel(); + delete iImageDecoder; + iImageDecoder = NULL; + } + if(iBitmap) + { + delete iBitmap; + iBitmap = NULL; + } + } + +// --------------------------------------------------------------------------- +// GetOrientationL +// --------------------------------------------------------------------------- +// +TUint16 CGlxBitmapDecoderWrapper::GetOrientationL(const TDesC& aFileName) + { + TRACER("CGlxBitmapDecoderWrapper:: GetOrientationL "); + //Get Exif Metadata and the orientation tag from the file first + RFile file; + CleanupClosePushL(file); + User::LeaveIfError(file.Open(iFs, + aFileName, EFileRead)); + TInt size; + User::LeaveIfError(file.Size(size)); + if ( KGlxMaxExifSize < size ) + { + size = KGlxMaxExifSize; + } + TUint16 orientation = 9; + HBufC8* exifData = HBufC8::NewLC(size); + TPtr8 ptr(exifData->Des()); + User::LeaveIfError(file.Read(ptr)); + CExifRead* exifReader = NULL; + TRAPD(exifErr,exifReader = CExifRead::NewL(*exifData, CExifRead::ENoJpeg)); + if(exifErr == KErrNone) + { + CleanupStack::PushL(exifReader); + + TInt readErr = exifReader->GetOrientation(orientation); + if(readErr != KErrNone) + { + orientation = 9; + } + CleanupStack::PopAndDestroy(exifReader); + } + CleanupStack::PopAndDestroy(exifData); + //Close and pop file Session + CleanupStack::PopAndDestroy(&file); + return orientation; + + } +// --------------------------------------------------------------------------- +// DoCancel +// --------------------------------------------------------------------------- +// +void CGlxBitmapDecoderWrapper::GetRotationParameters(TUint16 aOrientation, TInt& aRotAngle, TBool& aFlipStatus) + { + TRACER("CGlxBitmapDecoderWrapper:: DoCancel "); + //Get the orientation and set rotation on the decoder + //as well as update the original size + aRotAngle = 0; + aFlipStatus = EFalse; + TInt isOrientationOdd = aOrientation%2; + if(aOrientation>8) + { + return; + } + if(aOrientation >= 3 && aOrientation < 5) + { + aRotAngle = 180; + } + else if(aOrientation >= 5 && aOrientation < 7) + { + aRotAngle = 90; + + } + else if(aOrientation >= 7 && aOrientation <= 8) + { + aRotAngle = 270; + } + if(aOrientation>4 ) + { + if(isOrientationOdd ) + { + aFlipStatus = ETrue; + } + } + + } + +// --------------------------------------------------------------------------- +// OOMRequestFreeMemoryL +// --------------------------------------------------------------------------- +// +TInt CGlxBitmapDecoderWrapper::OOMRequestFreeMemoryL( TInt aBytesRequested) + { + TRACER("CGlxBitmapDecoderWrapper::OOMRequestFreeMemoryL"); + GLX_LOG_INFO1("CGlxBitmapDecoderWrapper::OOMRequestFreeMemoryL() aBytesRequested=%d", + aBytesRequested); + ROomMonitorSession oomMonitor; + User::LeaveIfError( oomMonitor.Connect() ); + // No leaving code after this point, so no need to use cleanup stack + // for oomMonitor + TInt errorCode = oomMonitor.RequestFreeMemory( aBytesRequested ); + GLX_LOG_INFO1("CGlxBitmapDecoderWrapper::OOMRequestFreeMemoryL(1) errorCode=%d",errorCode); + if ( errorCode != KErrNone ) + { + // try one more time + errorCode = oomMonitor.RequestFreeMemory( aBytesRequested ); + GLX_LOG_INFO1("CGlxBitmapDecoderWrapper::OOMRequestFreeMemoryL(2) errorCode=%d",errorCode); + } + oomMonitor.Close(); + return errorCode; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/src/glxtexturemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/src/glxtexturemanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,298 @@ +/* +* Copyright (c) 2008-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: Texture Manager +* +*/ + + + + +// INCLUDE FILES + +#include +#include +#include +#include "glxtexturemanager.h" + +#include + +#include "glxtexturemanagerimpl.h" + + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxTextureManager::~CGlxTextureManager() + { + TRACER("CGlxTextureManager::~CGlxTextureManager"); + GLX_LOG_INFO( "CGlxTextureManager::~CGlxTextureManager" ); + delete iImpl; + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxTextureManager* CGlxTextureManager::NewL( + CAlfTextureManager& aAlfTextureManager) + { + TRACER("CGlxTextureManager::NewL"); + GLX_LOG_INFO( "CGlxTextureManager::NewL" ); + CGlxTextureManager* self = + new (ELeave) CGlxTextureManager(); + CleanupStack::PushL(self); + self->iImpl = CGlxTextureManagerImpl::NewL(aAlfTextureManager); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +///CreateNewTextureForMediaL +// ----------------------------------------------------------------------------- + +EXPORT_C CAlfTexture& CGlxTextureManager::CreateNewTextureForMediaL( + TSize aSize, + const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId, + MGlxTextureObserver* aObserver ) + { + TRACER("CGlxTextureManager::CreateNewTextureForMediaL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateNewTextureForMediaL" ); + return iImpl->CreateNewTextureForMediaL(aSize,aMedia,aIdSpaceId,aObserver,EFalse); + + } +// CreateAvkonIconTextureL - with backup bitmap ID +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateAvkonIconTextureL( + const TAknsItemID &aID, + TInt aBitmapId, + TSize aRequestedSize) + { + TRACER("CGlxTextureManager::CreateAvkonIconTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateAvkonIconTextureL" ); + return iImpl->CreateIconTextureL(aID, + aBitmapId, + KAvkonBitmapFile, + EFalse, + KRgbWhite, + KAknsIIDNone, + 0, + aRequestedSize); + } + +// ----------------------------------------------------------------------------- +// CreateColorAvkonIconTextureL - with backup bitmap ID and ability to set color +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateColorAvkonIconTextureL( + const TAknsItemID& aID, + TInt aBitmapId, + TRgb aDefaultColor, + const TAknsItemID& aSkinColorId, + TInt aSkinColorIndex, + TSize aRequestedSize) + { + TRACER("CGlxTextureManager::CreateColorAvkonIconTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateColorAvkonIconTextureL" ); + return iImpl->CreateIconTextureL(aID, + aBitmapId, + KAvkonBitmapFile, + ETrue, + aDefaultColor, + aSkinColorId, + aSkinColorIndex, + aRequestedSize); + } + +// ----------------------------------------------------------------------------- +// CreateAvkonIconTextureL - no backup bitmap ID +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateAvkonIconTextureL( + const TAknsItemID &aID, + TSize aRequestedSize) + { + TRACER("CGlxTextureManager::CreateAvkonIconTextureL 2"); + GLX_LOG_INFO( "CGlxTextureManager::CreateAvkonIconTextureL 2" ); + return iImpl->CreateIconTextureL(aID, + 0, + KNullDesC(), + EFalse, + KRgbWhite, + KAknsIIDNone, + 0, + aRequestedSize); + } + +// ----------------------------------------------------------------------------- +// CreateIconTextureL - from ID and mif/mbm file name +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateIconTextureL( + TInt aIconResourceId, + TDesC& aFilename, + TSize aRequestedSize) + { + TRACER("CGlxTextureManager::CreateIconTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateIconTextureL" ); + return iImpl->CreateIconTextureL(KAknsIIDNone, + aIconResourceId, + aFilename, + EFalse, + KRgbWhite, + KAknsIIDNone, + 0, + aRequestedSize); + } + +// ----------------------------------------------------------------------------- +// CreateColorIconTextureL - from ID and mif/mbm file name, modifying colour +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateColorIconTextureL( + TInt aIconResourceId, + TDesC& aFilename, + TRgb aDefaultColor, + const TAknsItemID& aSkinColorId, + TInt aSkinColorIndex, + TSize aRequestedSize) + + { + TRACER("CGlxTextureManager::CreateColorIconTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateColorIconTextureL" ); + return iImpl->CreateIconTextureL(KAknsIIDNone, + aIconResourceId, + aFilename, + ETrue, + aDefaultColor, + aSkinColorId, + aSkinColorIndex, + aRequestedSize); + } + + + +// ----------------------------------------------------------------------------- +// CreateThumbnailTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateThumbnailTextureL( + const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId, + const TSize& aRequiredSize, MGlxTextureObserver* aObserver, + TBool aScaleGridTnm) + { + TRACER("CGlxTextureManager::CreateThumbnailTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateThumbnailTextureL" ); + return iImpl->CreateNewTextureForMediaL( aRequiredSize, aMedia, aIdSpaceId, + aObserver,aScaleGridTnm ); + } + +// ----------------------------------------------------------------------------- +// CreateZoomedTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateZoomedTextureL( + const TGlxMedia& aMedia, const TMPXAttribute& aAttribute, + TGlxIdSpaceId aIdSpaceId, MGlxTextureObserver* aObserver) + { + TRACER("CGlxTextureManager::CreateZoomedTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateZoomedTextureL" ); + return iImpl->CreateZoomedTextureL(aMedia, aAttribute, aIdSpaceId,aObserver); + } + +// ----------------------------------------------------------------------------- +// CreateAnimatedGifTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateAnimatedGifTextureL( + const TDesC& aFilename,const TSize& aSize ) + { + TRACER("CGlxTextureManager::CreateAnimatedGifTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateAnimatedGifTextureL" ); + return iImpl->CreateAnimatedGifTextureL( aFilename, aSize ); + } + +// ----------------------------------------------------------------------------- +// CreateFlatColourTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxTextureManager::CreateFlatColourTextureL( TRgb aColour ) + { + TRACER("CGlxTextureManager::CreateFlatColourTextureL"); + GLX_LOG_INFO( "CGlxTextureManager::CreateFlatColourTextureL" ); + return iImpl->CreateFlatColourTextureL( aColour ); + } + +// ----------------------------------------------------------------------------- +// RemoveTexture +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxTextureManager::RemoveTexture( + const CAlfTexture& aTexture) + { + TRACER("CGlxTextureManager::RemoveTexture"); + GLX_LOG_INFO( "CGlxTextureManager::RemoveTexture" ); + iImpl->RemoveTexture(aTexture); + } + +// ----------------------------------------------------------------------------- +// RemoveTexture +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxTextureManager::RemoveTexture(const TGlxMediaId& aMediaId,TBool aAllTexture) + { + TRACER("CGlxTextureManager::RemoveTexture 2"); + GLX_LOG_INFO( "CGlxTextureManager::RemoveTexture 2" ); + //Bug fix for PKAA-7NRBYZ - added aAllTexture param + iImpl->RemoveTexture(aMediaId, aAllTexture); + } + +// ----------------------------------------------------------------------------- +// IsBetterThumbnailAvailable +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxTextureManager::TextureNeedsUpdating( TGlxMedia aMedia, + TGlxIdSpaceId aIdSpaceId, const TSize& aRequiredSize ) + { + TRACER("CGlxTextureManager::TextureNeedsUpdating"); + GLX_LOG_INFO( "CGlxTextureManager::TextureNeedsUpdating" ); + return iImpl->TextureNeedsUpdating( aMedia, aIdSpaceId, aRequiredSize ); + } + + +// ---------------------------------------------------------------------------- +// HandleSkinChanged +// ---------------------------------------------------------------------------- + +void CGlxTextureManager::HandleSkinChanged() + { + TRACER("CGlxTextureManager::HandleSkinChanged"); + GLX_LOG_INFO( "CGlxTextureManager::HandleSkinChanged" ); + iImpl->UpdateTexture(); + } + + +// ----------------------------------------------------------------------------- +// RemoveZoomList +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxTextureManager::RemoveZoomList() + { + TRACER("CGlxTextureManager::RemoveZoomList"); + GLX_LOG_INFO( "CGlxTextureManager::RemoveZoomList" ); + iImpl->RemoveZoomList(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/texturemanager/src/glxtexturemanagerimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/texturemanager/src/glxtexturemanagerimpl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1152 @@ +/* +* Copyright (c) 2008-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: Texture Manager +* +*/ + + + + +// INCLUDE FILES + +#include "glxtexturemanagerimpl.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mglxtextureobserver.h" + +namespace + { + const TInt KGlxFirstAlfThumbnailTextureId = 0x10000001; + const TInt KGlxLastAlfThumbnailTextureId = 0x20000000; + const TInt KGlxFirstThumbnailTextureId = 0x20000001; + /** Bitmap size for flat (solid colour) textures */ + const TInt KGlxFlatTextureSize = 64; + } + + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxTextureManagerImpl::CGlxTextureManagerImpl + (CAlfTextureManager& aAlfTextureManager) : + iAlfTextureManager(aAlfTextureManager), + iNextTextureId( KGlxFirstThumbnailTextureId ) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxTextureManagerImpl::~CGlxTextureManagerImpl() + { + TRACER("CGlxTextureManagerImpl::~CGlxTextureManagerImpl"); + + // delete other icon textures + // iIconLIst should deleted only once in destructor as + // they are using in full applicaiton + TInt count = iIconList.Count(); + for(TInt i = count - 1; i >= 0; i--) + { + delete iIconList[i].iTexture; + } + iIconList.Close(); + + iThumbnailList.Close(); + + // delete zoom textures + count = iZoomedList.Count(); + GLX_LOG_INFO1("CGlxTextureManagerImpl iZoomedList.Count=%d",count); + for(TInt i = count - 1; i >= 0; i--) + { + GLX_LOG_INFO1("CGlxTextureManagerImpldeleted i=%d",i); + delete iZoomedList[i].iTexture; + } + iZoomedList.Close(); + + delete iMifFilenames; + + if ( iDrmUtility ) + { + iDrmUtility->Close(); + } + + if ( iCache ) + { + iCache->RemoveObserver(this); + iCache->Close(); + } + + if ( iResUtil ) + { + iResUtil->RemoveObserver(*this); + iResUtil->Close(); + } + if(iZoomDecoder) + { + delete iZoomDecoder; + } + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxTextureManagerImpl* CGlxTextureManagerImpl::NewL( + CAlfTextureManager& aAlfTextureManager) + { + TRACER("CGlxTextureManagerImpl::NewL"); + CGlxTextureManagerImpl* self = CGlxTextureManagerImpl::NewLC(aAlfTextureManager); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +// +CGlxTextureManagerImpl* CGlxTextureManagerImpl::NewLC( + CAlfTextureManager& aAlfTextureManager) + { + TRACER("CGlxTextureManagerImpl::NewLC"); + CGlxTextureManagerImpl* self = + new (ELeave) CGlxTextureManagerImpl(aAlfTextureManager); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::ConstructL() + { + TRACER("CGlxTextureManagerImpl::ConstructL"); + iMifFilenames = new (ELeave) CDesCArrayFlat(2); + + // get handle to DRM utility + iDrmUtility = CGlxDRMUtility::InstanceL(); + // get handle to the media cache + iCache = MGlxCache::InstanceL(); + iCache->AddObserverL(this); + + // Get instance of Resolution utility and register for notification of + // resolution changes + /// @todo implement CGlxResolutionUtility this later + iResUtil = CGlxResolutionUtility::InstanceL(); + iResUtil->AddObserverL(*this); + // Set the TextureId range. Now we can set our own ID outside this Range + iAlfTextureManager.SetAutomaticTextureIdRange( + KGlxFirstAlfThumbnailTextureId, + KGlxLastAlfThumbnailTextureId); + } + + +// ----------------------------------------------------------------------------- +// TextureNeedsUpdating +// ----------------------------------------------------------------------------- +// +TBool CGlxTextureManagerImpl::TextureNeedsUpdating( TGlxMedia aMedia, + TGlxIdSpaceId aIdSpaceId, const TSize& aRequiredSize ) + { + TRACER("CGlxTextureManagerImpl::TextureNeedsUpdating"); + TInt thumbnailIndex = KErrNotFound; + TMPXAttribute thumbNailAttribute( 0, 0 ); + TBool updateTexture = ETrue; + TRAPD( err, updateTexture = GetThumbnailAttributeAndIndexL( aRequiredSize, + aMedia, aIdSpaceId, thumbnailIndex, thumbNailAttribute ) ); + // don't update the texture if there's an error + return ( err == KErrNone ? updateTexture : EFalse ); + } + +// ----------------------------------------------------------------------------- +// CreateIconTextureL +// ----------------------------------------------------------------------------- +// +CAlfTexture& CGlxTextureManagerImpl::CreateIconTextureL( + const TAknsItemID& aSkinID, + TInt aIconResourceId, + const TDesC& aFilename, + TBool aSetColor, + TRgb aDefaultColor, + const TAknsItemID& aSkinColorId, + TInt aSkinColorIndex, + TSize aRequestedSize) + { + TRACER("CGlxTextureManagerImpl::CreateIconTextureL"); + // Convert size to POSS + TReal32 heightInPoss = + iResUtil->PixelsToPoss(TReal32(aRequestedSize.iHeight)); + + TReal32 widthInPoss = + iResUtil->PixelsToPoss(TReal32(aRequestedSize.iWidth)); + + + CAlfTexture* texture = NULL; + //search array for existing item + TInt i = iIconList.Count(); + while(i > 0 && !texture) + { + i--; + TGlxIcon icon = iIconList[i]; + if( icon.iAvkonSkinId == aSkinID && + icon.iBitmapId == aIconResourceId && + icon.iSetColor == aSetColor && + icon.iDefaultColor == aDefaultColor && + icon.iSkinColorId == aSkinColorId && + icon.iSkinColorIndex == aSkinColorIndex && + icon.iHeightInPoss == heightInPoss && + icon.iWidthInPoss == widthInPoss ) + { + // also compare file names + TFileName filename(KNullDesC); + if(icon.iFilenameIndex >= 0) + { + filename = iMifFilenames->MdcaPoint(icon.iFilenameIndex); + } + if(0 == filename.CompareF(aFilename) ) + { + // match found - use existing texture + texture = icon.iTexture; + } + } + } + + if(!texture) + { + // existing texture not found - prepare to create new one + TInt filenameIndex = -1; + if(aFilename.Length() > 0) + { + // is filename already in filename list + if(iMifFilenames->MdcaCount()) + { + iMifFilenames->Find(aFilename, filenameIndex); + if(filenameIndex == iMifFilenames->MdcaCount()) + { + filenameIndex = -1; + } + } + if(filenameIndex < 0) + { + // name not in list. Add it + iMifFilenames->AppendL(aFilename); + filenameIndex = iMifFilenames->MdcaCount() - 1; + } + } + // Create new icon entry + TGlxIcon icon; + icon.iTextureId = NextTextureId(); + icon.iTexture = NULL; + icon.iAvkonSkinId = aSkinID; + icon.iBitmapId = aIconResourceId; + icon.iFilenameIndex = filenameIndex; + icon.iSetColor = aSetColor; + icon.iDefaultColor = aDefaultColor; + icon.iSkinColorId = aSkinColorId; + icon.iSkinColorIndex = aSkinColorIndex; + icon.iHeightInPoss = heightInPoss; + icon.iWidthInPoss = widthInPoss; + + // add to list so ProvideBitmapL can use it + iIconList.AppendL(icon); + + // trap create texture + TRAPD(err, texture = &iAlfTextureManager.CreateTextureL( + icon.iTextureId, + this, + EAlfTextureFlagDefault)); + if(err) + { + // if error delete entry and leave + iIconList.Remove(iIconList.Count() - 1); + User::Leave(err); + } + else + { + // if no error add texture to entry + iIconList[iIconList.Count() - 1].iTexture = texture; + } + } + + User::LeaveIfNull(texture); //should not be possible + return *texture; + } + + + +// ----------------------------------------------------------------------------- +// CreateNewTextureForMediaL +// ----------------------------------------------------------------------------- +// +CAlfTexture& CGlxTextureManagerImpl::CreateNewTextureForMediaL( + TSize aSize, + const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId, + MGlxTextureObserver* aObserver, + TBool aScaleGridTnm) + { + TRACER("CGlxTextureManagerImpl::CreateNewTextureForMediaL"); + TInt thumbnailIndex = KErrNotFound; + TMPXAttribute thumbNailAttribute(0,0); + TGlxThumbnailIcon thumbData; + + // If the current thumbnail matches what is required then return the current texture otherwise + // create a new one. + if (!GetThumbnailAttributeAndIndexL(aSize, aMedia, aIdSpaceId, thumbnailIndex, thumbNailAttribute)) + { + return *iThumbnailList[thumbnailIndex].iTexture; + } + + // We have 2 scenarios here. + // 1) We do not have a thumbnail + // 2) The thumbnail we have is not good enough + iThumbnailList.ReserveL( iThumbnailList.Count() + 1 ); + + CAlfTexture& texture = CreateNewTextureL(aSize, aMedia, aIdSpaceId, + aObserver, thumbNailAttribute, thumbData,ETrue,aScaleGridTnm); + + + if ( thumbnailIndex != KErrNotFound ) + { + // A new texture was created so remove the old one and + // update the thumbnail list. + iAlfTextureManager.UnloadTexture(iThumbnailList[thumbnailIndex].iTextureId); + iThumbnailList.Remove(thumbnailIndex); + GLX_LOG_INFO("CGlxTextureManagerImpl CreateNewTextureForMediaL UnloadTexture "); + } + + return texture; + } + +// ----------------------------------------------------------------------------- +// CreateFlatColourTextureL +// ----------------------------------------------------------------------------- +// +CAlfTexture& CGlxTextureManagerImpl::CreateFlatColourTextureL( TRgb aColour ) + { + TRACER("CGlxTextureManagerImpl::CreateFlatColourTextureL"); + // Create a picture with the colour + CFbsBitmap* picture = new (ELeave) CFbsBitmap; + CleanupStack::PushL(picture); + User::LeaveIfError(picture->Create(TSize(KGlxFlatTextureSize, + KGlxFlatTextureSize), EColor64K ) ); + + CFbsBitmapDevice* drawBufDevice = CFbsBitmapDevice::NewL(picture); + CleanupStack::PushL(drawBufDevice); + + CFbsBitGc* drawBufContext; + User::LeaveIfError(drawBufDevice->CreateContext(drawBufContext)); + CleanupStack::PushL(drawBufContext); + + // draw the color + drawBufContext->Activate(drawBufDevice); + drawBufContext->SetBrushColor(aColour); + drawBufContext->Clear(); + + TInt alpha = aColour.Alpha(); + + CleanupStack::PopAndDestroy(drawBufContext); + CleanupStack::PopAndDestroy(drawBufDevice); + + CFbsBitmap* mask = NULL; + if( alpha != 0 ) + { + mask = new (ELeave) CFbsBitmap(); + CleanupStack::PushL( mask ); + User::LeaveIfError( mask->Create(TSize( KGlxFlatTextureSize, + KGlxFlatTextureSize ), EGray256 )); + + CFbsBitmapDevice* maskBufDevice = CFbsBitmapDevice::NewL( mask ); + CleanupStack::PushL( maskBufDevice ); + + CFbsBitGc* maskBufContext = NULL; + User::LeaveIfError( maskBufDevice->CreateContext( maskBufContext ) ); + CleanupStack::PushL( maskBufContext ); + + // draw the mask + maskBufContext->Activate(maskBufDevice); + maskBufContext->SetBrushColor( TRgb::Color256( alpha ) ); + maskBufContext->Clear(); + + CleanupStack::PopAndDestroy( maskBufContext ); + CleanupStack::PopAndDestroy( maskBufDevice ); + } + + // Manage the texture ids ourself. Get the next id and store the + // associated bitmap and mask to ensure that we supply the correct bitmaps + // when alf calls back to ProvideBitmap + TInt nextTextureId = NextTextureId(); + iProvideBitmapHolder.iTextureId = nextTextureId; + iProvideBitmapHolder.iBitmap = picture; + iProvideBitmapHolder.iMaskBitmap = mask; + + CAlfTexture& newTexture = iAlfTextureManager.CreateTextureL( + nextTextureId, + this, + EAlfTextureFlagDefault ); + // don't want alf to delete this texture + newTexture.SetPriority( EAlfTexturePriorityHighest ); + + // if we had alpha, release the mask + if( alpha != 0 ) + { + CleanupStack::Pop( mask ); + } + + CleanupStack::Pop( picture ); + + return newTexture; + } + + +// ----------------------------------------------------------------------------- +// RemoveTexture +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::RemoveTexture( const CAlfTexture& aTexture ) + { + TRACER("CGlxTextureManagerImpl::RemoveTexture"); + // Find the texture in the iThumbnailList + TInt index = iThumbnailList.Find( aTexture, &TGlxThumbnailIcon::MatchTexture ); + if ( index != KErrNotFound ) + { + iThumbnailList.Remove( index ); + iAlfTextureManager.UnloadTexture( aTexture.Id() ); + } + else + { + // Find the texture in the zoomed list + index = iZoomedList.Find( aTexture, &TGlxThumbnailIcon::MatchTexture ); + GLX_LOG_INFO1("CGlxTextureManagerImpl RemoveTexture index=%d",index); + if ( index != KErrNotFound ) + { + GLX_LOG_INFO("CGlxTextureManagerImpl RemoveTexture index != KErrNotFound"); + iAlfTextureManager.UnloadTexture( aTexture.Id() ); + if(iZoomedList[index].iBitmap) + { + GLX_LOG_INFO("CGlxTextureManagerImpl RemoveTexture iZoomedList[index].iBitmap delete"); + delete iZoomedList[index].iBitmap; + iZoomedList[index].iBitmap=NULL; + iZoomedList.Remove( index ); + } + } + // iIconLIst should deleted only once in destructor as + // they are using in full applicaiton + } + } + +// ----------------------------------------------------------------------------- +// RemoveZoomList +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::RemoveZoomList() + { + TRACER("CGlxTextureManagerImpl::RemoveZoomList"); + TInt count = iZoomedList.Count(); + GLX_LOG_INFO1("CGlxTextureManagerImpl RemoveZoomList Count()=%d",count); + if(iZoomDecoder) + { + iZoomDecoder->Cancel(); + } + for(TInt i = count - 1; i >= 0; i--) + { + iAlfTextureManager.UnloadTexture( iZoomedList[i].iTextureId ); + if( iZoomedList[i].iBitmap) + { + GLX_LOG_INFO("CGlxTextureManagerImpl RemoveZoomList delete iZoomedList[i]"); + delete iZoomedList[i].iBitmap; + iZoomedList[i].iBitmap=NULL; + } + iZoomedList.Remove( i ); + } + iZoomedList.Reset(); + + } + +// ----------------------------------------------------------------------------- +// RemoveTexture Using TGlxMediaId& +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::RemoveTexture(const TGlxMediaId& aMediaId,TBool aAllTexture ) + { + TRACER("CGlxTextureManagerImpl::RemoveTexture 2"); + //Bug fix for PKAA-7NRBYZ - added bAllTexture param + // Find the texture in the iThumbnailList + TInt i = iThumbnailList.Count(); + while(i > 0) + { + --i; + if (iThumbnailList[i].iMediaId == aMediaId) + { + TInt aTexture = iThumbnailList[i].iTextureId; + iThumbnailList.Remove(i); + iAlfTextureManager.UnloadTexture(aTexture ); + //Bug fix for PKAA-7NRBYZ - Delete all the texture only if it is asked. + if(!aAllTexture) + break; + } + } + } +// ----------------------------------------------------------------------------- +// GetThumbnailAttributeAndIndexL +// ----------------------------------------------------------------------------- +// +TBool CGlxTextureManagerImpl::GetThumbnailAttributeAndIndexL( TSize aSize, + const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId, + TInt& aThumbnailIndex, TMPXAttribute& aThumbnailAttribute ) + { + TRACER("CGlxTextureManagerImpl::GetThumbnailAttributeAndIndexL"); + GLX_LOG_INFO( "CGlxTextureManagerImpl::GetThumbnailAttributeAndIndexL" ); + aThumbnailIndex = KErrNotFound; + + aThumbnailAttribute = SelectAttributeL(aSize, aMedia); // Find Thumbnail attributes + + TInt i = iThumbnailList.Count(); + TTime reqTime; + aMedia.GetLastModifiedDate(reqTime); + while(i > 0 && aThumbnailIndex == KErrNotFound) + { + --i; + if ((iThumbnailList[i].iMediaId == aMedia.Id()) && + (iThumbnailList[i].iIdSpaceId == aIdSpaceId) && + (iThumbnailList[i].iImageDate == reqTime) && + (iThumbnailList[i].iRequiredSize == aSize)) + { + aThumbnailIndex = i; + if ( iThumbnailList[aThumbnailIndex].iAttribId == aThumbnailAttribute) + { + // We have found that the best match already exists + // No need to do anything + return EFalse; + } + } + } + + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CreateNewTextureL +// ----------------------------------------------------------------------------- +CAlfTexture& CGlxTextureManagerImpl::CreateNewTextureL( TSize aSize, + const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId, + MGlxTextureObserver* aObserver, TMPXAttribute& aAttribute, + TGlxThumbnailIcon& aThumbData,TBool aIsThumbnailTexture, TBool aScaleGridTnm ) + { + TRACER("CGlxTextureManagerImpl::CreateNewTextureL"); + // This method only works if the call to CreateTextureL which in turn calls ProvideBitmapL behaves ina synchronous manor + + // First find if there is an existing texture + // Find the texture in the iThumbnailList + + // We have 2 scenarios here. + // 1) We do not have a thumbnail + // 2) The thumbnail we have is not good enough + + aThumbData.iTextureId = NextTextureId(); + aThumbData.iTexture = NULL; + aThumbData.iAttribId = aAttribute; + aThumbData.iMediaId = aMedia.Id(); + aThumbData.iIdSpaceId = aIdSpaceId; + //Get the ThumbData creation date + aMedia.GetLastModifiedDate(aThumbData.iImageDate); + const CGlxThumbnailAttribute* thumb = aMedia.ThumbnailAttribute(aAttribute); + __ASSERT_DEBUG(thumb, Panic(EGlxPanicLogicError)); // thumb should not be NULL + aThumbData.iBitmap = thumb->iBitmap; + CFbsBitmap *scaledBitmap = NULL; + + if(aScaleGridTnm) + { +#ifdef _DEBUG + TTime startTime, stopTime; + startTime.HomeTime(); +#endif + TSize origSize; + aMedia.GetDimensions(origSize); + scaledBitmap = new (ELeave) CFbsBitmap(); + CleanupStack::PushL(scaledBitmap); + ScaleGridTnmToFsL(origSize,aSize,scaledBitmap,thumb); + aThumbData.iBitmap = scaledBitmap; + +#ifdef _DEBUG + stopTime.HomeTime(); + GLX_LOG_INFO1("=>GRID TNM SCALE TO FS took <%d> us", + (TInt)stopTime.MicroSecondsFrom(startTime).Int64()); +#endif + } + + if( aIsThumbnailTexture ) + { + //Add to the thumbnail list + GLX_LOG_INFO("CGlxTextureManagerImpl::CreateNewTextureL iThumbnailList.Append "); + iThumbnailList.Append(aThumbData); + } + else + { + GLX_LOG_INFO1("CGlxTextureManagerImpl::CreateNewTextureL,count=%d",iZoomedList.Count()); + iZoomedList.Append(aThumbData); + } + + // If we got this far we need to create a new texture + CAlfTexture* newTexture = &iAlfTextureManager.CreateTextureL( + aThumbData.iTextureId, + this, + EAlfTextureFlagDefault); + + + if( aIsThumbnailTexture ) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::CreateNewTextureL aIsThumbnailTexture "); + TInt index = iThumbnailList.Count()-1; + iThumbnailList[index].iTexture = newTexture; + iThumbnailList[index].iRequiredSize = aSize; + } + + else + { + GLX_LOG_INFO("CGlxTextureManagerImpl::CreateNewTextureL else aIsThumbnailTexture "); + TInt index = iZoomedList.Count()-1; + iZoomedList[index].iTexture = newTexture; + iZoomedList[index].iRequiredSize = aSize; + iZoomedList[index].iBitmap=NULL; + } + + if (aObserver) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::CreateNewTextureL aObserver "); + aThumbData.iObserver = aObserver; + aThumbData.iObserver->TextureContentChangedL( ETrue , newTexture); + } + + if(scaledBitmap) + { + CleanupStack::PopAndDestroy(scaledBitmap); + } + + return *newTexture; + } + + +// ----------------------------------------------------------------------------- +// CreateZoomedTextureL +// ----------------------------------------------------------------------------- +// +CAlfTexture& CGlxTextureManagerImpl::CreateZoomedTextureL( + const TGlxMedia& aMedia, const TMPXAttribute& aAttribute, + TGlxIdSpaceId aIdSpaceId, MGlxTextureObserver* aObserver) + { + TRACER("CGlxTextureManagerImpl::CreateZoomedTextureL"); + if(!iZoomDecoder) + { + GLX_LOG_INFO("CGlxTextureManagerImpl:: CreateZoomedTextureL,iZoomDecoder == NULL"); + iZoomDecoder = CGlxBitmapDecoderWrapper::NewL(this); + } + + TGlxThumbnailIcon aThumbData; + + aThumbData.iTextureId = NextTextureId(); + aThumbData.iTexture = NULL; + aThumbData.iAttribId = aAttribute; + aThumbData.iMediaId = aMedia.Id(); + aThumbData.iIdSpaceId = aIdSpaceId; + + //Add to the thumbnail list + iZoomedList.Append(aThumbData); + + TInt index = iZoomedList.Count()-1; + GLX_LOG_INFO1("CGlxTextureManagerImpl:: CreateZoomedTextureL,index=%d",index); + + iZoomedList[index].iTexture = NULL; + aMedia.GetDimensions( iZoomedList[index].iRequiredSize ); + + iZoomedList[index].iBitmap=NULL; + iZoomedList[index].iObserver = aObserver ; + + iZoomDecoder->DoDecodeImageL(aMedia.Uri(), iZoomedList.Count()-1); + + return *(iZoomedList[index].iTexture); + } + +// ----------------------------------------------------------------------------- +// CreateAnimatedGifTextureL +// ----------------------------------------------------------------------------- +// +CAlfTexture& CGlxTextureManagerImpl::CreateAnimatedGifTextureL( + const TDesC& aFilename, const TSize& aSize) + { + TRACER("CGlxTextureManagerImpl::CreateAnimatedGifTextureL"); + return iAlfTextureManager.LoadTextureL(aFilename,aSize, + EAlfTextureFlagDefault,NextTextureId() ); + } + + +// ----------------------------------------------------------------------------- +// UpdateTexture +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::UpdateTexture() + { + TRACER("CGlxTextureManagerImpl::UpdateTexture"); + TInt count = iIconList.Count(); + for(TInt i = count - 1; i >= 0; i--) + { + //to-check + // TRAP_IGNORE(DoHandleResolutionChangedL(i);) + } + } + +// ----------------------------------------------------------------------------- +// HandleResolutionChanged +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::HandleResolutionChangedL() + { + TRACER("CGlxTextureManagerImpl::HandleResolutionChangedL"); + UpdateTexture(); + } + +// ----------------------------------------------------------------------------- +// DoHandleResolutionChangedL +// ----------------------------------------------------------------------------- +// +//To-do +/*void CGlxTextureManagerImpl::DoHandleResolutionChangedL(TInt aIconIndex) + { + TGlxIcon& icon = iIconList[aIconIndex]; + CAlfTexture* texture = icon.iTexture; + // Clear previous content + //texture->SetSegmentCountL(0); + + // Get new bitmaps + CFbsBitmap* bitmap = NULL; + CFbsBitmap* mask = NULL; + ProvideBitmapL(icon.iTextureId, bitmap, mask); + // Upload to texture + if(bitmap) + { + CleanupStack::PushL(bitmap); + texture->SetSize(bitmap->SizeInPixels()); + if(mask) + { + CleanupStack::PushL(mask); + texture->UploadL( *bitmap, mask, + EAlfTextureUploadFlagDefault ); + CleanupStack::PopAndDestroy(mask); + } + else + { + texture->UploadL( *bitmap, NULL, + EAlfTextureUploadFlagDefault ); + + } + CleanupStack::PopAndDestroy(bitmap); + } + }*/ + + +// ----------------------------------------------------------------------------- +// ProvideBitmapL +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::ProvideBitmapL(TInt aTextureId, + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMaskBitmap) + { + TRACER("CGlxTextureManagerImpl::ProvideBitmapL"); + // Test whether we've already created bitmaps for the given texture id + if ( aTextureId == iProvideBitmapHolder.iTextureId ) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::ProvideBitmapL aTextureId"); + aBitmap = iProvideBitmapHolder.iBitmap; + aMaskBitmap = iProvideBitmapHolder.iMaskBitmap; + // reset the flags to prevent multiple calls into here + iProvideBitmapHolder.iTextureId = KErrNotFound; + iProvideBitmapHolder.iBitmap = NULL; + iProvideBitmapHolder.iMaskBitmap = NULL; + return; + } + + // loop to search the zoomed thumbnail list + TInt i = iZoomedList.Count(); + GLX_LOG_INFO1("CGlxTextureManagerImpl::ProvideBitmapL iZoomedList.Count=%d",i); + while(i > 0) + { + --i; + if (iZoomedList[i].iTextureId == aTextureId) + { + // We have found the texture, create a duplicate as alf destroys + // the bitmap once the texture's been created. + GLX_LOG_INFO1("CGlxTextureManagerImpl::ProvideBitmapL i=%d",i); + aBitmap = CreateDuplicateBitmapL( *iZoomedList[i].iBitmap ); + return; + } + } + // add loop to search the iThumbnailList for the aTextureId + i = iThumbnailList.Count(); + while(i > 0) + { + --i; + if ((iThumbnailList[i].iTextureId == aTextureId)) + { + // We have found the texture, create a duplicate as alf destroys + // the bitmap once the texture's been created. + aBitmap = CreateDuplicateBitmapL( *iThumbnailList[i].iBitmap ); + return; + } + } + // find in iIconList + i = iIconList.Count(); + TBool found = EFalse; + TGlxIcon icon; + while(i > 0 && !found) + { + i--; + if(iIconList[i].iTextureId == aTextureId) + { + icon = iIconList[i]; + found = ETrue; + } + } + + if(!found) + { + User::Leave(KErrNotFound); + } + + TInt bitmapId = icon.iBitmapId; + TInt maskId = bitmapId; + if(bitmapId) + { + maskId++; + } + + TFileName filename(KNullDesC); + if(icon.iFilenameIndex >= 0) + { + filename = iMifFilenames->MdcaPoint(icon.iFilenameIndex); + } + + if(icon.iSetColor) + { + AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), + icon.iAvkonSkinId, + icon.iSkinColorId, + icon.iSkinColorIndex, + aBitmap, + aMaskBitmap, + filename, + bitmapId, + maskId, + icon.iDefaultColor ); + } + else + { + AknsUtils::CreateIconL( AknsUtils::SkinInstance(), + icon.iAvkonSkinId, + aBitmap, + aMaskBitmap, + filename, + bitmapId, + maskId ); + } + + // Leave if bitmap or mask is NULL. + User::LeaveIfNull( aBitmap ); + + // set size + // In preference use requested size if there is one + TInt height =TInt(iResUtil->PossToPixels(icon.iHeightInPoss)); + TInt width =TInt(iResUtil->PossToPixels(icon.iWidthInPoss)); + + TSize size(width, height); + + // Disable compression so that the bitmap may be able to be + // duplicated inside HUITK when BITGDI renderer is in use. + AknIconUtils::DisableCompression( aBitmap ); + + if ( size == TSize(0, 0) ) + { + // If no requested size use original size of the graphic + TAknContentDimensions origDim; + AknIconUtils::GetContentDimensions(aBitmap, origDim); + size = TSize(origDim.iWidth, origDim.iHeight); + + // But if the original size is small make smallest dimension 64 + // and keep aspect ratio + if ( size.iHeight < 64 && size.iWidth < 64 ) + { + if(origDim.iWidth < origDim.iHeight) + { + size = TSize(64, 64.0F * origDim.iHeight / origDim.iWidth); + } + else + { + size = TSize(64.0F * origDim.iWidth / origDim.iHeight, 64); + } + } + } + AknIconUtils::SetSize(aBitmap, size, EAspectRatioNotPreserved); + } + +// ----------------------------------------------------------------------------- +// SelectAttributeL +// ----------------------------------------------------------------------------- +// +TMPXAttribute CGlxTextureManagerImpl::SelectAttributeL( TSize& aSize, + const TGlxMedia& aMedia ) + { + TRACER("CGlxTextureManagerImpl::SelectAttributeL"); + const CGlxMedia& media = *aMedia.Properties(); + if ( aMedia.Properties() == NULL || media.Count() == 0 ) + { + GLX_LOG_INFO("SelectAttributeL - NULL CGlxMedia / No Attribs"); + User::Leave( KErrArgument ); + } + // first check if DRM protected + TBool drmInvalid = EFalse; + if ( aMedia.GetDrmProtected(drmInvalid) && drmInvalid ) + { + // require URI attribute + TMPXGeneralCategory cat = aMedia.Category(); + // get URI + const TDesC& uri = aMedia.Uri(); + if( (uri.Length() == 0) || (EMPXNoCategory == cat) ) + { + User::Leave( KErrArgument ); + } + + // check if rights have expired + TBool checkViewRights = (cat==EMPXImage); + + drmInvalid = !iDrmUtility->CheckDisplayRightsL(uri, checkViewRights); + CGlxMedia* properties = const_cast(aMedia.Properties()); + if( !drmInvalid ) + { + properties->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsValid); + } + else + { + properties->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsInvalid); + } + } + + // if invalid need dimensions + if ( drmInvalid ) + { + TSize dimensions(0,0); + if(!aMedia.GetDimensions(dimensions)) + { + User::Leave( KErrArgument ); + } + + aSize = iDrmUtility->DRMThumbnailSize(dimensions); + } + + // Get the index for the attribute + TInt index = GlxThumbnailUtility::ClosestThumbnail( aSize, + media, !drmInvalid ); + // check it's valid + if (KErrNotFound == index) + { + GLX_LOG_INFO("GlxThumbnailUtility::ClosestThumbnail fail "); + User::Leave( KErrArgument ); + } + + return media.Attribute(index); + } + + +// ----------------------------------------------------------------------------- +// CreateDuplicateBitmapL +// ----------------------------------------------------------------------------- +// +CFbsBitmap* CGlxTextureManagerImpl::CreateDuplicateBitmapL(CFbsBitmap& aOriginalBitmap ) + { + TRACER("CGlxTextureManagerImpl::CreateDuplicateBitmapL"); + CFbsBitmap* duplicateBitmap = new( ELeave) CFbsBitmap(); + TInt err=duplicateBitmap->Duplicate( aOriginalBitmap.Handle()); + if ( err != KErrNone ) + { + delete duplicateBitmap; + duplicateBitmap = NULL; + GLX_LOG_INFO1("CGlxTextureManagerImpl::CreateDuplicateBitmapL fail =%d",err); + } + + return duplicateBitmap; + } + +// ----------------------------------------------------------------------------- +// NextTextureId +// ----------------------------------------------------------------------------- +// +TInt CGlxTextureManagerImpl::NextTextureId() + { + TRACER("CGlxTextureManagerImpl::NextTextureId"); + return ++iNextTextureId; + } + + +void CGlxTextureManagerImpl::HandleBitmapDecodedL(TInt aThumbnailIndex,CFbsBitmap* aBitmap) + { + TRACER("CGlxTextureManagerImpl::HandleBitmapDecodedL"); + CAlfTexture* newTexture = NULL; + TBool textureCreated = ETrue; + TInt textureID = -1; + TInt textureToBeUnloaded = -1; + + //check if the image is decoded + if(aBitmap != NULL) + { + iZoomedList[aThumbnailIndex].iBitmap = aBitmap; + + //if we already have a texture then dont unload the texture before creating + //the next one. It might happen that because of low memory we might not be able + //to create a new texture. + if(iZoomedList[aThumbnailIndex].iTexture) + { + textureID = NextTextureId(); + textureToBeUnloaded = iZoomedList[aThumbnailIndex].iTextureId ; + iZoomedList[aThumbnailIndex].iTextureId = textureID ; + } + else + { + textureID = iZoomedList[aThumbnailIndex].iTextureId; + } + + TRAPD(err, newTexture = &iAlfTextureManager.CreateTextureL( + textureID, this, EAlfTextureFlagDefault)); + if ( KErrNone != err && KErrNoMemory == err ) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::HandleBitmapDecoded ReleaseRam : START RAM RELEASE"); + iCache->ReleaseRAML(ETrue); + TRAPD(err, newTexture = &iAlfTextureManager.CreateTextureL(textureID, this, EAlfTextureFlagDefault)); + if ( KErrNone != err && KErrNoMemory == err ) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::HandleBitmapDecoded CreateTextureL : LOW MEMORY CONDITION"); + textureCreated = EFalse; + } + } + } + else + { + textureCreated = EFalse; + } + + if(iZoomedList[aThumbnailIndex].iBitmap) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::HandleBitmapDecoded delete iBitmap"); + delete iZoomedList[aThumbnailIndex].iBitmap; + iZoomedList[aThumbnailIndex].iBitmap = NULL; + } + + if (textureCreated && (NULL != newTexture)) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::HandleBitmapDecoded textureCreated && newTexture"); + //If the new texture is created then unload the old texture and store the new texture and textureID. + if(iZoomedList[aThumbnailIndex].iTexture) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::HandleBitmapDecoded Unloading Old Texture"); + iAlfTextureManager.UnloadTexture(textureToBeUnloaded ); + } + iZoomedList[aThumbnailIndex].iTextureId = textureID; + + iZoomedList[aThumbnailIndex].iTexture = newTexture; + } + + if (iZoomedList[aThumbnailIndex].iObserver) + { + GLX_LOG_INFO("CGlxTextureManagerImpl::HandleBitmapDecoded TextureContentChangedL"); + iZoomedList[aThumbnailIndex].iObserver->TextureContentChangedL( textureCreated ,iZoomedList[aThumbnailIndex].iTexture); + } + GLX_LOG_INFO("CGlxTextureManagerImpl::HandleBitmapDecodedL Exit "); + } + +// ----------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::HandleAttributesAvailableL(const TGlxIdSpaceId& /*aIdSpaceId*/, + const TGlxMediaId& /*aMediaId*/, + const RArray& /*aAttributes*/, + const CGlxMedia* /*aMedia*/) + { + + } + +// ----------------------------------------------------------------------------- +// CleanupTextureCacheL +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::CleanupMedia(const TGlxMediaId& aMediaId) + { + TRACER("CGlxTextureManagerImpl::CleanupMedia"); + RemoveTexture(aMediaId, EFalse); + } + + + +// ----------------------------------------------------------------------------- +// ScaleGridTnmToFsL +// ----------------------------------------------------------------------------- +// +void CGlxTextureManagerImpl::ScaleGridTnmToFsL(TSize aSrcSize, TSize aDestSize, + CFbsBitmap *aScaledBitmap, const CGlxThumbnailAttribute* thumb) + { + TRACER("CGlxTextureManagerImpl::ScaleGridTnmToFsL"); + // Scale the Image to required size if the thumbnail is smaller.Instead of Displaying Small thumbnail + // Calculate destination rect to maintain aspect ratio + TReal aspectRatio = (TReal)aDestSize.iWidth/(TReal)aDestSize.iHeight ; + TReal thumbAspectRatio = (TReal)aSrcSize.iWidth/(TReal)aSrcSize.iHeight ; + TSize destinationSize ; + if(thumbAspectRatio >= aspectRatio) + { + destinationSize.iWidth = aDestSize.iWidth ; + destinationSize.iHeight = aDestSize.iWidth*aSrcSize.iHeight/aSrcSize.iWidth ; + } + else + { + destinationSize.iHeight = aDestSize.iHeight ; + destinationSize.iWidth = aDestSize.iHeight*aSrcSize.iWidth/aSrcSize.iHeight ; + } + aScaledBitmap->Create(destinationSize,thumb->iBitmap->DisplayMode()); + CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(aScaledBitmap); + CleanupStack::PushL(bitmapDevice); + CFbsBitGc * bitmapGc = CFbsBitGc::NewL(); + CleanupStack::PushL(bitmapGc); + bitmapGc->Activate(bitmapDevice); + bitmapGc->DrawBitmap(TRect(destinationSize),thumb->iBitmap); + CleanupStack::PopAndDestroy(bitmapGc); + CleanupStack::PopAndDestroy(bitmapDevice); + GLX_LOG_INFO2("===== Actual Image Size %d x %d",aSrcSize.iWidth,aSrcSize.iHeight); + GLX_LOG_INFO2("===== Scaled Image Size %d x %d",destinationSize.iWidth,destinationSize.iHeight); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/bwins/glxtvoutu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/bwins/glxtvoutu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,13 @@ +EXPORTS + ?ScreenSizeL@CGlxTv@@QBE?AVTSize@@XZ @ 1 NONAME ; class TSize CGlxTv::ScreenSizeL(void) const + ??1CGlxTv@@UAE@XZ @ 2 NONAME ; CGlxTv::~CGlxTv(void) + ??1CGlxHdmiController@@UAE@XZ @ 3 NONAME ; CGlxHdmiController::~CGlxHdmiController(void) + ?IsWidescreen@CGlxTv@@QBEHXZ @ 4 NONAME ; int CGlxTv::IsWidescreen(void) const + ?IsConnected@CGlxTv@@QBEHXZ @ 5 NONAME ; int CGlxTv::IsConnected(void) const + ?NewL@CGlxTv@@SAPAV1@AAVMGlxTvObserver@@@Z @ 6 NONAME ; class CGlxTv * CGlxTv::NewL(class MGlxTvObserver &) + ?IsVideo@CGlxHdmiController@@QAEXXZ @ 7 NONAME ; void CGlxHdmiController::IsVideo(void) + ?NewL@CGlxHdmiController@@SAPAV1@ABVTDesC16@@@Z @ 8 NONAME ; class CGlxHdmiController * CGlxHdmiController::NewL(class TDesC16 const &) + ?SetImageL@CGlxHdmiController@@QAEXABVTDesC16@@VTSize@@H@Z @ 9 NONAME ; void CGlxHdmiController::SetImageL(class TDesC16 const &, class TSize, int) + ?ActivateZoom@CGlxHdmiController@@QAEXXZ @ 10 NONAME ; void CGlxHdmiController::ActivateZoom(void) + ?DeactivateZoom@CGlxHdmiController@@QAEXXZ @ 11 NONAME ; void CGlxHdmiController::DeactivateZoom(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/data/Thumbs.db Binary file photosgallery/viewframework/tvout/data/Thumbs.db has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/eabi/glxtvoutu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/eabi/glxtvoutu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +EXPORTS + _ZN18CGlxHdmiController12ActivateZoomEv @ 1 NONAME + _ZN18CGlxHdmiController14DeactivateZoomEv @ 2 NONAME + _ZN18CGlxHdmiController4NewLERK7TDesC16 @ 3 NONAME + _ZN18CGlxHdmiController7IsVideoEv @ 4 NONAME + _ZN18CGlxHdmiController9SetImageLERK7TDesC165TSizei @ 5 NONAME + _ZN18CGlxHdmiControllerD0Ev @ 6 NONAME + _ZN18CGlxHdmiControllerD1Ev @ 7 NONAME + _ZN18CGlxHdmiControllerD2Ev @ 8 NONAME + _ZN6CGlxTv4NewLER14MGlxTvObserver @ 9 NONAME + _ZN6CGlxTvD0Ev @ 10 NONAME + _ZN6CGlxTvD1Ev @ 11 NONAME + _ZN6CGlxTvD2Ev @ 12 NONAME + _ZNK6CGlxTv11IsConnectedEv @ 13 NONAME + _ZNK6CGlxTv11ScreenSizeLEv @ 14 NONAME + _ZNK6CGlxTv12IsWidescreenEv @ 15 NONAME + _ZTI17CGlxHdmiContainer @ 16 NONAME + _ZTI17CGlxHdmiDecoderAO @ 17 NONAME + _ZTI18CGlxHdmiController @ 18 NONAME + _ZTI22CGlxHdmiSurfaceUpdater @ 19 NONAME + _ZTV17CGlxHdmiContainer @ 20 NONAME + _ZTV17CGlxHdmiDecoderAO @ 21 NONAME + _ZTV18CGlxHdmiController @ 22 NONAME + _ZTV22CGlxHdmiSurfaceUpdater @ 23 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Build information for TV out component +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + + #include + +PRJ_EXPORTS +../rom/glxtvout.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxtvout.iby) + +PRJ_MMPFILES +glxtvout.mmp + +PRJ_TESTMMPFILES +//../tsrc/group/t_glxtvout.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/group/glxtvout.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/group/glxtvout.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + + +#include +#include + +#include "../../../group/glxbuildcommon.mmh" + +TARGET glxtvout.dll +TARGETTYPE dll +UID 0x1000008d 0x2000A7BC + +CAPABILITY CAP_GENERAL_DLL + +// System includes from epoc32/include +APP_LAYER_SYSTEMINCLUDE + +// Class descriptions +SOURCEPATH ../src +SOURCE glxwindowvisibilitymonitor.cpp +SOURCE glxtvconnectionmonitor.cpp +SOURCE glxtv.cpp +SOURCE glxhdmicontainer.cpp +SOURCE glxhdmicontroller.cpp +SOURCE glxhdmisurfaceupdater.cpp +SOURCE glxactivedecoder.cpp + +// Component class definitions +USERINCLUDE ../inc + + +// System includes from the source tree +SYSTEMINCLUDE ../../../gallery/loc // Photos +SYSTEMINCLUDE ../../inc // viewframework +SYSTEMINCLUDE ../../uiutilities/inc +SYSTEMINCLUDE ../../../inc // for tv out constants +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/icl + +// Common Libraries +LIBRARY euser.lib +LIBRARY ws32.lib // for RWsSession +LIBRARY avkon.lib // for AppUi +LIBRARY cone.lib // for CCoeEnv +LIBRARY centralrepository.lib // for Central Repository +LIBRARY accclient.lib // for RAccessoryServer +LIBRARY alfclient.lib // For Alfred Hitchcock framework +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY surfaceupdateclient.lib // surface update client +LIBRARY surfacemanager.lib // surface manager +LIBRARY imageconversion.lib // ICL +LIBRARY efsrv.lib +// Other Dependency Libraries +#ifdef __MARM +LIBRARY GSServerEngine.lib // FOr AspectRatio +#endif +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxactivecallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxactivecallback.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2008-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: Handles & propogates UI state change notifications. +* +*/ + + +#ifndef CGLXACTIVE_CALLBACK_H +#define CGLXACTIVE_CALLBACK_H + +// INCLUDES +#include + +// CLASS DECLARATION + +class CGlxActiveCallBack : public CActive + { + public: + CGlxActiveCallBack( TCallBack aCallBack, TInt aPriority): CActive(aPriority), + iCallBack(aCallBack) {}; + CGlxActiveCallBack(); + + public: // Functions from base classes + void SetActive() { CActive::SetActive();}; + void RunL() { iCallBack.CallBack();}; + void DoCancel() {}; + + private: // Data + TCallBack iCallBack; + }; + +#endif // CGLXACTIVE_CALLBACK_H + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxactivedecoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxactivedecoder.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2008-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 GLXACTIVEDECODER_H_ +#define GLXACTIVEDECODER_H_ + +// INCLUDES +#include +#include +#include "glxhdmisurfaceupdater.h" + +class CImageDecoder; +// CLASS DECLARATION + +class CGlxHdmiDecoderAO : public CActive + { +public: + /* + * NewL() + * @Param1 CGlxHdmiSurfaceUpdater + * @param2 framecount + */ + static CGlxHdmiDecoderAO* NewL(CGlxHdmiSurfaceUpdater* aHdmiSurfaceUpdater, + TInt aFrameCount); + + /* + * Destructor + */ + ~CGlxHdmiDecoderAO(); + + /* + * ConvertImageL() + * This calls the asyncronous service request to ICL convert + * @param1 - Destination Bitmap + * @param2 - Framecount + * @param3 - Image decoder + */ + void ConvertImageL(CFbsBitmap& iBitmap, TInt aFrameNum,CImageDecoder* aDecoder); + +// void SetActive() { CActive::SetActive();}; + +protected: + // from CActive + void RunL(); + void DoCancel(); +private: + /* + * Constructor + */ + CGlxHdmiDecoderAO(CGlxHdmiSurfaceUpdater* aHdmiSurfaceUpdater,TInt aFrameCount); + +private: + CGlxHdmiSurfaceUpdater* iHdmiSurfaceUpdater; // not owned + CImageDecoder* iDecoder; + TInt iFrameCount; + TInt iDecodeCount; + }; + +#endif /* GLXACTIVEDECODER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxhdmicontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxhdmicontainer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2008-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: Handles & propogates UI state change notifications. +* +*/ + +#ifndef GLXHDMICONTAINER_H_ +#define GLXHDMICONTAINER_H_ + +#include +#include "glxhdmisurfaceupdater.h" + +class CGlxHdmiContainer : public CCoeControl, public MGlxGenCallback + { +public: + /* + * NewLC + */ + static CGlxHdmiContainer* NewL(const TRect& aRect); + + /* + * Destructor + */ + ~CGlxHdmiContainer(); + + /* + * Get window instance + */ + RWindow* GetWindow(); + +private:// from MGlxGenCallback + void DoGenCallback(); + +private: // from CCoeControl + void Draw(); + +private: + /* + * Ctor + */ + CGlxHdmiContainer(const TRect& aRect); + + /* + * ConstructL() + */ + void ConstructL(); + + /* + * Create window for HDMI + * Create a screendevice + */ + void CreateHdmiWindowL(); + +private: + TRect iRect; + RWsSession iSession; + RWindow iWsWindow; + CWsScreenDevice* iScreenDevice; + RWindowGroup iWsWindowGroup; + CWindowGc* iWindowGc; + TInt iWsWindowGroupID; + }; + +#endif /* GLXHDMICONTAINER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxhdmicontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxhdmicontroller.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2008-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: Handles & propogates UI state change notifications. +* +*/ + +#ifndef GLXHDMICONTROLLER_H_ +#define GLXHDMICONTROLLER_H_ + +// Internal includes +#include // for inteface MGlxTvObserver + +class CGlxHdmiContainer; +class CGlxHdmiSurfaceUpdater; +class CGlxTv; + +/* + * This class will be called from FS and Slideshow for its requirements + */ +class CGlxHdmiController : public CBase, + public MGlxTvObserver // for TV Out + { +public: + /* + * NewLC + * @param1 - Image file path default to NULL + */ + IMPORT_C static CGlxHdmiController* NewL(const TDesC& aImageFile = KNullDesC ); + + /* + * Destructor + */ + IMPORT_C ~CGlxHdmiController(); + + /* + * Update Image + * @param1 - Image file path + * @param2 - Image dimensions + * @param3 - frame count + */ + IMPORT_C void SetImageL(const TDesC& aImageFile,TSize aImageDimensions, + TInt aFrameCount); + + /* + * To Determine it is a video and not image + */ + IMPORT_C void IsVideo(); + + /* + * Activating zoom in posting mode + */ + IMPORT_C void ActivateZoom(); + /* + * Deactivating zoom in posting mode + */ + IMPORT_C void DeactivateZoom(); +private:// From MGlxTvObserver + virtual void HandleTvStatusChangedL ( TTvChangeType aChangeType ); + +private: + /* + * Constructor + */ + CGlxHdmiController(const TDesC& aImageFile); + + /* + * ConstructL + */ + void ConstructL(); + + /* + * Create the Hdmi Container + */ + void CreateHdmiContainerL(); + + /* + * Create surface updater and update background surface + * @param1 - Image file + * @param2 - Image dimensions + * @param3 - framecount + */ + void CreateSurfaceUpdaterL(const TDesC& aImageFile, TSize aImageDimensions, + TInt aFrameCount); + + /* + * To Destroy the surface updater if present + */ + void DestroySurfaceUpdater(); + + /* + * Detroy the container + */ + void DestroyContainer(); + + /* + * + */ + void StoreImageInfoL(const TDesC& aImageFile, + TSize aImageDimensions, TInt aFrameCount); + +private: + const TDesC& iImagePath; // Image path + HBufC* iStoredImagePath; + TSize iImageDimensions; + TInt iFrameCount; + + CGlxHdmiContainer* iHdmiContainer; + CGlxHdmiSurfaceUpdater* iSurfaceUpdater; + CGlxTv* iGlxTvOut; + }; + +#endif /* GLXHDMICONTROLLER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxhdmisurfaceupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxhdmisurfaceupdater.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,170 @@ +/* Copyright (c) 2008-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: Handles & propogates UI state change notifications. +* +*/ + +#ifndef GLXHDMISURFACEUPDATER_H_ +#define GLXHDMISURFACEUPDATER_H_ + +#include +#include + +// GCE Surface +#include "graphics/surfacemanager.h" +#include "graphics/surface.h" +#include "graphics/surfaceupdateclient.h" +#include +class CGlxActiveCallBack; +class CGlxHdmiDecoderAO; +class CImageDecoder; +class TSurfaceConfiguration; +class MGlxGenCallback + { +public: + virtual void DoGenCallback() = 0; + }; + +class CGlxHdmiSurfaceUpdater: public CBase + { +public: + /* + * + */ + static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, + TSize aImageDimensions, TInt aFrameCount, MGlxGenCallback* aCallBack); + + /* + * destructor + */ + ~CGlxHdmiSurfaceUpdater(); +public: + /* + * This is to cancel the active object from decoding + */ + void HandleRunL(); + + /* + * This updates the new image. + */ + void UpdateNewImageL(const TDesC& aImageFile, + TInt aFrameCount); + + /* + * Activate Zoom + */ + void ActivateZoom(); + /* + * Deactivate Zoom + */ + void DeactivateZoom(); + /* + * Zoom in our out depending on parameter + */ + void Zoom(TBool aZoom); +private: + /* + * Ctor + */ + CGlxHdmiSurfaceUpdater(RWindow* aWindow, const TDesC& aImageFile, + TSize aOrigImageDimensions, TInt aFrameCount, MGlxGenCallback* aCallBack); + + /* + * ConstructL() + */ + void ConstructL(TSize aImageDimensions); + + /* + * Create a New surface with given size + * @param1 size + */ + void CreateSurfaceL(TSize aSize); + /* + * Create surface manager with given size + * @param1 size + */ + void MapSurfaceL(); + + static TInt SurfBuffer0Ready(TAny* aObject); + /* + * Call a refresh on the screen + */ + void Refresh(); + + /* + * Dump the buffer on to the surface stride + */ + void SwapBuffers(); + + /* + * Release contents + */ + void ReleaseContent(); + + /* + * Create bitmap + */ + void CreateBitmapL(); + + /* + * Create an image decoder with given file + * @param1 - Image file + */ + void CreateImageDecoderL(const TDesC& aImageFile); + + /* + * Creating all enablers for HDMI + * @param1 if creating a surface is required, + * by default it is not required + */ + void CreateHdmiL(TBool aCreateSurface = ETrue); + + static TInt TimeOut(TAny* aSelf); +private: + RWindow* iWindow; + const TDesC& iImagePath; + TSize iOrigImageDimensions; + TInt iFrameCount; + MGlxGenCallback* iCallBack; + + // GCE Surface + RSurfaceUpdateSession iSurfUpdateSession; + TSurfaceId iSurfId; // TSurfaceId + RSurfaceManager* iSurfManager; // RSurfaceManager + RChunk* iSurfChunk; // RChunk + TInt iSurfaceStride; // surface stride + TSurfaceConfiguration iConfig; // surface configuration for zoom + + TSize iZoomRectSz ; + CFbsBitmap* iDecodedBitmap; //Decoded bitmap of the focussed image + + void* iSurfBuffer; // Surface buffer + CGlxActiveCallBack* iSurfBufferAO; // Surface buffer AO + + //ICL + CGlxHdmiDecoderAO* iGlxDecoderAO; // Internal Image decoder AO + CImageDecoder* iImageDecoder; // Image Decoder + TInt iAnimCount; // animation count + RFs iFsSession; // RFs + + TBool iFirstTime; + TPoint iLeftCornerForZoom; + CPeriodic* iTimer; + TBool iZoom; +#ifdef _DEBUG + TTime iStartTime; + TTime iStopTime; +#endif + + }; +#endif /* GLXHDMISURFACEUPDATER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxtv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxtv.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2008-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: Handles & propogates UI state change notifications. +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +#ifndef __GLXTV_H__ +#define __GLXTV_H__ + +// External Includes +#include +#include + +// Internal Includes +#include + +// Forward Declarations +class MGlxTvObserver; +class CGlxWindowVisibilityMonitor; +class CGlxTvConnectionMonitor; +class CRepository; + +// For window server visibility notifications +class MGlxWindowVisibilityObserver + { +public: + /** + * Handle changes to the application window visiblity + * Called when window visible state changes + * @param aChangeType The visibility change type + */ + virtual void HandleWindowVisibilityChangedL( TTvChangeType aChangeType ) = 0; + }; + + + +// For Tv connection notification +class MGlxTvConnectionObserver + { +public: + /** + * Handle TV connection state changes + */ + virtual void HandleTvConnectionStatusChangedL( ) = 0; + }; + + + + +/** + * Class Description + * A class that handles and propagates UI change notifications + * @author Loughlin + */ +NONSHARABLE_CLASS (CGlxTv) : public CBase, + public MGlxWindowVisibilityObserver, + public MGlxTvConnectionObserver + { +public: + /** + * Static Symbian 2 stage constructor. + * @param a TvObserver + */ + IMPORT_C static CGlxTv* NewL( MGlxTvObserver& aTvObserver ); + + /** + * Destructor. + */ + IMPORT_C ~CGlxTv(); + +private: + + /** + * Standard C++ constructor + * @param a TvObserver + */ + CGlxTv(MGlxTvObserver& aTvObserver); + + /* + * Symbian second stage construction + */ + void ConstructL(); + +public: // class public method + + /** + * Get the current screen size + * @return the Screen size in pixels + */ + IMPORT_C TSize ScreenSizeL() const; + + /** + * Is the TV Connected + * @return ETrue if active, otherwise EFalse + */ + IMPORT_C TBool IsConnected() const; + + /** + * Is the TV widescreen + * @return ETrue if widescreen, otherwise EFalse + */ + IMPORT_C TBool IsWidescreen() const; + + +public: // from MGlxWindowVisibilityObserver + /** + * @ref MGlxWindowVisibilityObserver::HandleWindowVisibilityChangedL + */ + void HandleWindowVisibilityChangedL( TTvChangeType aChangeType ); + + +public: // from MGlxTvConnectionObserver + /** + * @ref MGlxTvConnectionObserver::HandleTvConnectionStatusChangedL + */ + void HandleTvConnectionStatusChangedL( ); + +private: // new private methods + /** + * Retrive the TV Display Aspect Ratio and TV Setting + * Calculate the screen size from aspect ratio and TV type + */ + void CalcTvScreenSzL(); + + /** + * Start monitoring the environment for changes to the TV aspect ratio + * and the Gallery window groups visiblity + */ + void MonitorEnvironmentL(); + + /** + * Stop monitoring the environment for changes to the TV aspect ratio + * and the Gallery window groups visiblity + */ + void StopMonitoringEnvironment(); + +private: // class member data + // Not Owned: The TV out observer + MGlxTvObserver& iTvObserver; + + // Owned: The Window visibility monitor + CGlxWindowVisibilityMonitor* iWindowVisibilityMonitor; + + // Owned: The TV connection monitor + CGlxTvConnectionMonitor* iTvConnectionMonitor; + + // Size of the TV Out display size + TSize iSzInPixels; + + // Owned: The central repository where TV display ratio is held. + CRepository* iCenRep; + + // The implementation of the class, hidden from clients + class CGlxTvOutCenRepMonitor; + + // Owned: Monitoring class for Tv Ratio Values + CGlxTvOutCenRepMonitor* iTvDisplayAspectRatioMonitor; + + // The TV aspect ratio + TInt iAspectRatio; + }; + + +#endif // __GLXTV_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxtvconnectionmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxtvconnectionmonitor.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-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: Monitoring class of the Tv Out Connection +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +#ifndef __GLX_WNDWCONNECTION_MONITOR_H__ +#define __GLX_WNDWCONNECTION_MONITOR_H__ + +// External Includes +#include // for CActive +#include // for MAknWsEventObserver +#include // for RAccessoryServer +#include // for RAccessoryMode + + +// Forward Declarations +class MGlxTvConnectionObserver; + + +/** + * Class Description + * An Active object derived class is used to monitor the TV out connection + * @author Loughlin + */ +NONSHARABLE_CLASS(CGlxTvConnectionMonitor) : public CActive + { +public: + + /** + * Static Symbian 2 stage constructor. + */ + static CGlxTvConnectionMonitor* NewL( + MGlxTvConnectionObserver& aConnectionObserver); + + /** + * Destructor. + */ + ~CGlxTvConnectionMonitor(); + +private: + + /** + * Standard C++ constructor + */ + CGlxTvConnectionMonitor( + MGlxTvConnectionObserver& aConnectionObserver); + + /* + * Symbian second stage construction + */ + void ConstructL(); + +public: // class member functions + + /* + * Provides the caller with the current TV connetion state + * @return The TV connection state + */ + TBool IsConnected() const; + + +private: // From CActive + /** + * @ref CActive::RunL + */ + void RunL(); + + /** + * @ref CActive::DoCancel + */ + void DoCancel(); + + /** + * @ref CActive::RunError + */ + TInt RunError( TInt aError ); + + +private: + + /** + * Requests TV on/off events + */ + void IssueRequest(); + + /** + * Sends notification to observers when TV Out cable is connected + */ + void IssueNotificationL(); + + +private: // class member data + + // Not owned: TV connection observer + MGlxTvConnectionObserver& iConnectionObserver; + + // The Connection state + TBool iConnectionState; + + // The (external device) Accessory Server + RAccessoryServer iTvAccServer; + + // Accessory mode + RAccessoryMode iTvAccMode; + + // Accessory Mode structure - details the type of accessory + TAccPolAccessoryMode iCurrentAccMode; + + }; + + +#endif // __GLX_WNDWCONNECTION_MONITOR_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/inc/glxwindowvisibilitymonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/inc/glxwindowvisibilitymonitor.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2008-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: Class definition that monitors tv window visibility +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +#ifndef __GLXWINVISIBILITYMONITOR_H__ +#define __GLXWINVISIBILITYMONITOR_H__ + +// External Includes +#include // for CBase +#include // for MAknWsEventObserver + + +// Forward Declarations +class MGlxWindowVisibilityObserver; + + + +/** + * Class Description + * An Active object derived class is used to monitor the visibility of the + * TV out window. + * @author Loughlin + */ +NONSHARABLE_CLASS(CGlxWindowVisibilityMonitor) : public CBase, + public MAknWsEventObserver + { +public: + /** + * Static Symbian 2 stage constructor. + */ + static CGlxWindowVisibilityMonitor* NewL( + MGlxWindowVisibilityObserver& aVisibilityObserver ); + + /** + * Destructor. + */ + ~CGlxWindowVisibilityMonitor(); + + + /** + * Close. + */ + void Close(); + +private: + + /** + * Standard C++ constructor + */ + CGlxWindowVisibilityMonitor( + MGlxWindowVisibilityObserver& aVisibilityObserver ); + + /* + * Symbian second stage construction + */ + void ConstructL(); + +public: // class member functions + + /* + * Provides the caller with the current visible state + * @return ETrue if the window is visible or false otherwise + */ + TBool IsVisible() const; + +public: // from MAknWsEventObserver + + void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ); + +private: // class member data + // Not ownded: The Akn event monitor + CAknWsEventMonitor* iAknEventMonitor; + + // Not owned: Window visibility observer + MGlxWindowVisibilityObserver& iVisibilityObserver; + + // The visible state + TBool iIsVisible; + }; + + + +#endif // __GLXWINVISIBILITYMONITOR_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/rom/glxtvout.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/rom/glxtvout.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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: Photos TV Out iby file. +* +*/ + + + + +#ifndef __GLX_TVOUT_IBY__ +#define __GLX_TVOUT_IBY__ + +file=ABI_DIR\BUILD_DIR\glxtvout.dll SHARED_LIB_DIR\glxtvout.dll + +#endif // __GLX_TVOUT_IBY__ + +// End of file +----------------------------------------------------------- \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/src/glxactivedecoder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/src/glxactivedecoder.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-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 "glxactivedecoder.h" + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +CGlxHdmiDecoderAO* CGlxHdmiDecoderAO::NewL(CGlxHdmiSurfaceUpdater* aHdmiSurfaceUpdater, + TInt aFrameCount) + { + TRACER("CGlxHdmiDecoderAO::NewL()"); + CGlxHdmiDecoderAO* self = new (ELeave) CGlxHdmiDecoderAO(aHdmiSurfaceUpdater, + aFrameCount); + return self; + } + +// ----------------------------------------------------------------------------- +// CGlxHdmiDecoderAO() +// ----------------------------------------------------------------------------- +CGlxHdmiDecoderAO::CGlxHdmiDecoderAO(CGlxHdmiSurfaceUpdater* aHdmiSurfaceUpdater, + TInt aFrameCount):CActive(CActive::EPriorityStandard-1), + iHdmiSurfaceUpdater(aHdmiSurfaceUpdater), iFrameCount(aFrameCount) + { + TRACER("CGlxHdmiDecoderAO::CGlxHdmiDecoderAO()"); + iDecodeCount = 0; + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// ~CGlxHdmiDecoderAO +// Cancel the outstanding request +// ----------------------------------------------------------------------------- +CGlxHdmiDecoderAO::~CGlxHdmiDecoderAO() + { + TRACER("CGlxHdmiDecoderAO::~CGlxHdmiDecoderAO()"); + } + +// ----------------------------------------------------------------------------- +// RunL +// Calls iHdmiSurfaceUpdater->HandleRunL() which is expected to handle the call +// ----------------------------------------------------------------------------- +void CGlxHdmiDecoderAO::RunL() + { + TRACER("CGlxHdmiDecoderAO::RunL()"); + iHdmiSurfaceUpdater->HandleRunL(); + CActiveScheduler::Stop(); + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +void CGlxHdmiDecoderAO::DoCancel() + { + TRACER("CGlxHdmiDecoderAO::DoCancel()"); + iDecoder->Cancel(); + } + +// ----------------------------------------------------------------------------- +// ConvertImageL +// ----------------------------------------------------------------------------- +void CGlxHdmiDecoderAO::ConvertImageL(CFbsBitmap& aBitmap, TInt aFrameNum, + CImageDecoder* aDecoder) + { + TRACER("CGlxHdmiDecoderAO::ConvertImageL()"); + iDecoder = aDecoder; + iDecoder->Convert(&iStatus,aBitmap, aFrameNum); + SetActive(); + CActiveScheduler::Start(); + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/src/glxhdmicontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/src/glxhdmicontainer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2008-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 +#include +#include "glxhdmicontainer.h" +const TInt KGroupNameLength = 32; +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +CGlxHdmiContainer* CGlxHdmiContainer::NewL(const TRect& aRect) + { + TRACER("CGlxHdmiContainer* CGlxHdmiContainer::NewL()"); + CGlxHdmiContainer* self = new (ELeave) CGlxHdmiContainer(aRect); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// destructor +// ----------------------------------------------------------------------------- +CGlxHdmiContainer::~CGlxHdmiContainer() + { + TRACER("CGlxHdmiContainer::~CGlxHdmiContainer()"); + iWsWindowGroup.Close(); + delete iWindowGc; + delete iScreenDevice; + } + +// ----------------------------------------------------------------------------- +// CTor +// ----------------------------------------------------------------------------- +CGlxHdmiContainer::CGlxHdmiContainer(const TRect& aRect): + iRect(aRect) + { + TRACER("CGlxHdmiContainer::CGlxHdmiContainer()"); + // Implement nothing here + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxHdmiContainer::ConstructL() + { + TRACER("CGlxHdmiContainer::ConstructL()"); + CreateHdmiWindowL(); + ActivateL(); + } + +// ---------------------------------------------------------- +// GetWindow() +// ---------------------------------------------------------- +// +RWindow* CGlxHdmiContainer::GetWindow() + { + TRACER("CGlxHdmiContainer::GetWindow()"); + return &Window(); + } + +// ----------------------------------------------------------------------------- +// CreateHdmiWindowL +// ----------------------------------------------------------------------------- +void CGlxHdmiContainer::CreateHdmiWindowL() + { + TRACER ("CGlxHdmiContainer::CreateHdmiWindowL()"); + const TUint32 id = 12345678; + + // Create screen device and gc + iSession = ControlEnv()->WsSession(); + iScreenDevice = new(ELeave) CWsScreenDevice(iSession); + User::LeaveIfError(iScreenDevice->Construct(1)); // use Screen 1 + User::LeaveIfError(iScreenDevice->CreateContext(iWindowGc)); + + // Create window group + iWsWindowGroup = RWindowGroup(iSession); + User::LeaveIfError(iWsWindowGroup.Construct(id, iScreenDevice)); + iWsWindowGroup.SetOrdinalPosition(0); + TBuf winGroupName(_L("PhotosHdmi")); + iWsWindowGroup.SetName(winGroupName); + iWsWindowGroupID = iWsWindowGroup.Identifier(); + + // Create window + CreateWindowL(iWsWindowGroup); + iWsWindow = Window(); + SetRect(TRect(iScreenDevice->SizeInPixels())); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxHdmiContainer::Draw() + { + TRACER("CGlxHdmiContainer::Draw()"); + CWindowGc& gc = SystemGc(); + gc.DrawRect(iRect); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxHdmiContainer::DoGenCallback() + { + TRACER("CGlxHdmiContainer::DoGenCallback()"); + DrawNow(); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/src/glxhdmicontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/src/glxhdmicontroller.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2008-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 +#include +#include "glxtv.h" // for CGlxTv +#include "glxhdmicontainer.h" +#include "glxhdmisurfaceupdater.h" + + +#include "glxhdmicontroller.h" + +// 720p image size +const TInt KHdTvWidth = 1280; +const TInt KHdTvHeight = 720; + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +EXPORT_C CGlxHdmiController* CGlxHdmiController::NewL(const TDesC& aImageFile) + { + TRACER("CGlxHdmiController* CGlxHdmiController::NewL()"); + CGlxHdmiController* self = new (ELeave) CGlxHdmiController(aImageFile); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// destructor +// ----------------------------------------------------------------------------- +EXPORT_C CGlxHdmiController::~CGlxHdmiController() + { + TRACER("CGlxHdmiController::~CGlxHdmiController()"); + DestroySurfaceUpdater(); + DestroyContainer(); + delete iStoredImagePath; + iStoredImagePath = NULL; + } + +// ----------------------------------------------------------------------------- +// Setting an Image Path +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxHdmiController::SetImageL(const TDesC& aImageFile, + TSize aImageDimensions, TInt aFrameCount) + { + TRACER("CGlxHdmiController::SetImageL()"); + StoreImageInfoL(aImageFile, aImageDimensions, aFrameCount); + if (iGlxTvOut->IsConnected()) + { + if(aImageDimensions.iHeight<=KHdTvHeight && + aImageDimensions.iWidth<= KHdTvWidth && aFrameCount > 0) + { + DestroySurfaceUpdater(); + if (!iHdmiContainer) + { + CreateHdmiContainerL(); + } + CreateSurfaceUpdaterL(aImageFile, aImageDimensions, aFrameCount); + } + else + { + // do not close the surface , use the same surface instead. + // Call a function to pass imagefile, imagedimension, framecount + if (!iHdmiContainer) + { + CreateHdmiContainerL(); + } + if (!iSurfaceUpdater) + { + // This case would come when surface updater is not created at the first instance and also + // it satisfies the 720p condition + CreateSurfaceUpdaterL(aImageFile, aImageDimensions, aFrameCount); + } + else + { + iSurfaceUpdater->UpdateNewImageL(aImageFile, aFrameCount); + } + iHdmiContainer->DrawNow(); + } + } + } + +// ----------------------------------------------------------------------------- +// IsVideo +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxHdmiController::IsVideo() + { + TRACER("CGlxHdmiController::IsVideo()"); + if (iGlxTvOut->IsConnected()) + { + DestroySurfaceUpdater(); + } + } + + +// ----------------------------------------------------------------------------- +// ActivateZoom +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxHdmiController::ActivateZoom() + { + TRACER("CGlxHdmiController::ActivateZoom()"); + if (iGlxTvOut->IsConnected()) + { + iSurfaceUpdater->ActivateZoom(); + } + } + +// ----------------------------------------------------------------------------- +// DeactivateZoom +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxHdmiController::DeactivateZoom() + { + TRACER("CGlxHdmiController::DeactivateZoom()"); + if (iGlxTvOut->IsConnected()) + { + iSurfaceUpdater->DeactivateZoom(); + } + } +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +CGlxHdmiController::CGlxHdmiController(const TDesC& aImageFile): + iImagePath(aImageFile) + { + TRACER("CGlxHdmiController::CGlxHdmiController()"); + // Implement nothing here + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxHdmiController::ConstructL() + { + TRACER("CGlxHdmiController::ConstructL()"); + iGlxTvOut = CGlxTv::NewL(*this); + } + +// ----------------------------------------------------------------------------- +// DestroyContainer +// ----------------------------------------------------------------------------- +void CGlxHdmiController::DestroyContainer() + { + TRACER("CGlxHdmiController::DestroyContainer()"); + if (iHdmiContainer) + { + GLX_LOG_INFO("CGlxHdmiController::DestroyHdmi() - deleting iHdmiContainer 1"); + delete iHdmiContainer; + iHdmiContainer = NULL; + } + } + +// ----------------------------------------------------------------------------- +// DestroySurfaceUpdater +// ----------------------------------------------------------------------------- +void CGlxHdmiController::DestroySurfaceUpdater() + { + TRACER("CGlxHdmiController::DestroySurfaceUpdater()"); + if (iSurfaceUpdater) + { + delete iSurfaceUpdater; + iSurfaceUpdater = NULL; + } + } + + +// ----------------------------------------------------------------------------- +// CreateHdmiContainerL +// ----------------------------------------------------------------------------- +void CGlxHdmiController::CreateHdmiContainerL() + { + TRACER("CGlxHdmiController::CreateHdmiContainer()"); + TRect rect = AlfUtil::ScreenSize(); + iHdmiContainer = CGlxHdmiContainer::NewL(rect); + } + +// ----------------------------------------------------------------------------- +// CreateSurfaceUpdaterL +// ----------------------------------------------------------------------------- +void CGlxHdmiController::CreateSurfaceUpdaterL(const TDesC& aImageFile, + TSize aImageDimensions, TInt aFrameCount) + { + TRACER("CGlxHdmiController::CreateSurfaceUpdater()"); + RWindow* window = iHdmiContainer->GetWindow(); + iSurfaceUpdater = CGlxHdmiSurfaceUpdater::NewL(window, aImageFile, aImageDimensions, + aFrameCount, iHdmiContainer); + iHdmiContainer->DrawNow(); + } + +// ----------------------------------------------------------------------------- +// StoreImageInfoL +// ----------------------------------------------------------------------------- +void CGlxHdmiController::StoreImageInfoL(const TDesC& aImageFile, + TSize aImageDimensions, TInt aFrameCount) + { + TRACER("CGlxHdmiController::StoreImageInfoL()"); + iStoredImagePath = aImageFile.AllocL(); + iImageDimensions = aImageDimensions; + iFrameCount = aFrameCount; + } + +// ----------------------------------------------------------------------------- +// HandleTvStatusChangedL +// ----------------------------------------------------------------------------- +void CGlxHdmiController::HandleTvStatusChangedL( TTvChangeType aChangeType ) + { + TRACER("CGlxHdmiController::HandleTvStatusChangedL()"); + if ( aChangeType == ETvConnectionChanged ) + { + if ( iGlxTvOut->IsConnected() ) + { + GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Connected"); + // Calling SetImageL() with appropriate parameters + SetImageL(iStoredImagePath->Des(), iImageDimensions, iFrameCount); + } + else + { + // if it gets disconnected, destroy the surface + GLX_LOG_INFO("CGlxHdmiController::HandleTvStatusChangedL() - HDMI Not Connected"); + DestroySurfaceUpdater(); + } + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/src/glxhdmisurfaceupdater.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/src/glxhdmisurfaceupdater.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,472 @@ +/* +* Copyright (c) 2008-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 +#include + +#include +#include +#include +#include + +#include "glxactivecallback.h" +#include "glxhdmisurfaceupdater.h" +#include "glxactivedecoder.h" + +// 720p image size +const TInt KHdTvWidth = 1280; +const TInt KHdTvHeight = 720; +const TInt KMulFactorToCreateBitmap = 4; +const TInt KZoomDelay = 10000; +//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; +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL(RWindow* aWindow, const TDesC& aImageFile, + TSize aImageDimensions, TInt aFrameCount, MGlxGenCallback* aCallBack) + { + TRACER("CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL()"); + CGlxHdmiSurfaceUpdater* self = new (ELeave) CGlxHdmiSurfaceUpdater(aWindow, aImageFile, + aImageDimensions, aFrameCount, aCallBack); + CleanupStack::PushL(self); + self->ConstructL(aImageDimensions); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// destructor +// ----------------------------------------------------------------------------- +CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() + { + TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()"); + ReleaseContent(); + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } + delete iTimer; + if (iGlxDecoderAO) + { + delete iGlxDecoderAO; + } + iGlxDecoderAO = NULL; + iFsSession.Close(); + if (iSurfManager) + { + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() - Close"); + iSurfUpdateSession.Close(); + if (iSurfChunk) + { + iSurfChunk->Close(); + } + delete iSurfChunk; + iSurfChunk = NULL; + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater(). iSurfManager->CloseSurface()"); + iSurfManager->CloseSurface(iSurfId); + GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater(). iSurfManager->Close()"); + iSurfManager->Close(); + delete iSurfManager; + iSurfManager = NULL; + } + } + +// ----------------------------------------------------------------------------- +// ReleaseContent +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::ReleaseContent() + { + TRACER("void CGlxHdmiSurfaceUpdater::ReleaseContent()"); + + iGlxDecoderAO->Cancel(); + if(iDecodedBitmap) + { + delete iDecodedBitmap; + iDecodedBitmap= NULL; + } + if (iSurfBufferAO->IsActive()) + { + iSurfBufferAO->Cancel(); + } + if(iImageDecoder) + { + delete iImageDecoder; + iImageDecoder = NULL; + } + iSurfUpdateSession.CancelAllUpdateNotifications(); + } + +// ----------------------------------------------------------------------------- +// CTor +// ----------------------------------------------------------------------------- +CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater(RWindow* aWindow, const TDesC& aImageFile, + TSize aOrigImageDimensions, TInt aFrameCount, MGlxGenCallback* aCallBack): + iWindow(aWindow), iImagePath(aImageFile), iOrigImageDimensions(aOrigImageDimensions), + iFrameCount(aFrameCount ),iCallBack(aCallBack) + { + TRACER("CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater()"); + // Implement nothing here + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::ConstructL(TSize /*aImageDimensions*/) + { + TRACER("CGlxHdmiSurfaceUpdater::ConstructL()"); + TInt error = iFsSession.Connect (); + if ( KErrNone!= iFsSession.Connect () ) + { + User::LeaveIfError(error); + } + + // Create the active object + iGlxDecoderAO = CGlxHdmiDecoderAO::NewL(this, iFrameCount); + CreateImageDecoderL(iImagePath); + CreateBitmapL(); + CreateHdmiL(); + error = iSurfUpdateSession.Connect(); + #ifdef _DEBUG + iStartTime.HomeTime(); + #endif + //to refresh the HD screen for the first time. + iFirstTime = ETrue; + //start decoding the image + iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder); + + if (KErrNone !=error) + { + GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() Surface update Session Connect Failed with error = %d", error); + User::LeaveIfError(error); + } + iLeftCornerForZoom.iX = 0; + iLeftCornerForZoom.iY = 0; + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + iZoom = ETrue; + } + +// ----------------------------------------------------------------------------- +// UpdateNewImageL +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::UpdateNewImageL(const TDesC& aImageFile, + TInt /*aFrameCount*/) + { + TRACER("CGlxHdmiSurfaceUpdater::UpdateNewImageL()"); + ReleaseContent(); + CreateImageDecoderL(aImageFile); + CreateBitmapL(); + CreateHdmiL(EFalse); + #ifdef _DEBUG + iStartTime.HomeTime(); + #endif + //start decoding the image + iGlxDecoderAO->ConvertImageL(*iDecodedBitmap,0,iImageDecoder); + } + +// ----------------------------------------------------------------------------- +// CreateHDMI +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::CreateHdmiL(TBool aCreateSurface) + { + TRACER("CGlxHdmiSurfaceUpdater::CreateHdmiL()"); + + if (aCreateSurface) + { + TSize rectSz = iDecodedBitmap->SizeInPixels(); // For animation + GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::CreateHdmiL() Size height = %d and width = %d", rectSz.iHeight, rectSz.iWidth); + CreateSurfaceL(rectSz); + } + + // Active objects for double buffered draw signalling + if(!iSurfBufferAO) + { + iSurfBufferAO = new(ELeave) CGlxActiveCallBack(TCallBack(SurfBuffer0Ready, this), + CActive::EPriorityStandard-1); + CActiveScheduler::Add(iSurfBufferAO); + } + + //Set the background Surface + iWindow->SetBackgroundSurface(iSurfId); + } + +// ----------------------------------------------------------------------------- +// CreateSurfaceL +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::CreateSurfaceL(TSize aSize) + { + TRACER("CGlxHdmiSurfaceUpdater::CreateSurfaceL()"); + + iSurfManager = new(ELeave) RSurfaceManager(); + TInt error = iSurfManager->Open(); + if (error != KErrNone) + { + GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL Open Surface manager failed with error = %d", error); + User::LeaveIfError(error); + } + RSurfaceManager::TSurfaceCreationAttributesBuf attributes; + attributes().iPixelFormat = EUidPixelFormatARGB_8888;// EUidPixelFormatYUV_420Planar; + attributes().iSize = aSize; + + attributes().iBuffers = 1; + attributes().iStride = aSize.iWidth * KMulFactorToCreateBitmap; + attributes().iAlignment = KMulFactorToCreateBitmap; + attributes().iContiguous = EFalse; + attributes().iMappable = ETrue; + + error = iSurfManager->CreateSurface(attributes, iSurfId); + if(error) + { + GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL, Creating surface failed with error : %d",error); + User::LeaveIfError(error); + } + //Map the surface and stire the surface info + MapSurfaceL(); + } + +void CGlxHdmiSurfaceUpdater::MapSurfaceL() + { + TRACER("CGlxHdmiSurfaceUpdater::MapSurfaceL()"); + + //Create chunk to map it to the surface ID. + iSurfChunk = new(ELeave) RChunk(); + User::LeaveIfNull(iSurfChunk); + TInt error = iSurfManager->MapSurface(iSurfId, *iSurfChunk); + if(error!=KErrNone) + { + GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::CreateSurfaceL(), MapSurface Failed wint error : %d",error); + } + + // Get the info from the surfaceManager + // and store pointers to the pixel data + RSurfaceManager::TInfoBuf info; + error = iSurfManager->SurfaceInfo(iSurfId, info); + iSurfaceStride = info().iStride; + User::LeaveIfError(error); + TInt offset = 0; + iSurfManager->GetBufferOffset( iSurfId, 0,offset); + iSurfBuffer = iSurfChunk->Base()+offset; + } +// ----------------------------------------------------------------------------- +// SurfBuffer0Ready +// ----------------------------------------------------------------------------- +TInt CGlxHdmiSurfaceUpdater::SurfBuffer0Ready(TAny* /*aObject*/) + { + TRACER("CGlxHdmiSurfaceUpdater::SurfBuffer0Ready()"); + return ETrue; + } + +// ----------------------------------------------------------------------------- +// Refresh +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::Refresh() + { + TRACER("CGlxHdmiSurfaceUpdater::Refresh()"); + SwapBuffers(); + iCallBack->DoGenCallback(); + if(iFirstTime) + { + iFirstTime = EFalse; + iWindow->RemoveBackgroundSurface(ETrue); + iWindow->SetBackgroundSurface(iSurfId); + } + } + +// ----------------------------------------------------------------------------- +// SwapBuffers +// This is used to sawp the buffers shown and to be shown +// After this is done, a refresh to the window should be done to refresh the TV +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::SwapBuffers() + { + TRACER("CGlxHdmiSurfaceUpdater::SwapBuffers()"); + + // Lock the heap so that subsequent call to dataaddress doesnt happen + iDecodedBitmap->LockHeap(); + + // Data stride + TUint fs = iDecodedBitmap->DataStride(); + + //Bitmap address from where the data has to be copied. + TUint8* from = (TUint8*)iDecodedBitmap->DataAddress(); + + //surface chunk address to where the bitmap data has to be copied. + TUint8* to = (TUint8*)iSurfBuffer; + + // To buffer (32 bit colors) + TUint ts = iSurfaceStride; + //No of bytes to be copied on to the surface. + TUint bytes = iDecodedBitmap->SizeInPixels().iWidth * KMulFactorToCreateBitmap; + + GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::SwapBuffers() - decodeSize width = %d and height %d", + iDecodedBitmap->SizeInPixels().iWidth, iDecodedBitmap->SizeInPixels().iHeight ); + + // Copy the bitmap on to the surface. + for (TInt y = iDecodedBitmap->SizeInPixels().iHeight; y >0; y--) + { + Mem::Copy(to, from, bytes); + to += ts; + from += fs; + } + iDecodedBitmap->UnlockHeap(); + } + +// ----------------------------------------------------------------------------- +// StartImageDecodeL +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::CreateBitmapL() + { + TRACER("CGlxHdmiSurfaceUpdater::StartImageDecodeL()"); + TSize decodeSize; + decodeSize.iHeight = (iOrigImageDimensions.iHeight>KHdTvHeight? KHdTvHeight: + iOrigImageDimensions.iHeight); + decodeSize.iWidth = (iOrigImageDimensions.iWidth>KHdTvWidth? KHdTvWidth: + iOrigImageDimensions.iWidth); + GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::StartImageDecodeL() - decodeSize width = %d and height %d", + decodeSize.iWidth, decodeSize.iHeight ); + + //create the bitmap for the required size + iDecodedBitmap = new(ELeave) CFbsBitmap(); + + TInt err = iDecodedBitmap->Create(decodeSize,EColor16MU ); + User::LeaveIfNull(iDecodedBitmap); + } + +// ----------------------------------------------------------------------------- +// HandleRunL +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::HandleRunL() + { + TRACER("CGlxHdmiSurfaceUpdater::HandleRunL()"); + + #ifdef _DEBUG + iStopTime.HomeTime(); + GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::HandleRunL() ConvertImageL took us %d us", + iStopTime.MicroSecondsFrom(iStartTime) ); + #endif + + iZoomRectSz = iDecodedBitmap->SizeInPixels(); + if (iSurfBufferAO->iStatus != KRequestPending && !iSurfBufferAO->IsActive()) + { + Refresh(); + iSurfBufferAO->iStatus = KRequestPending; + iSurfBufferAO->SetActive(); + iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus); + TInt err = iSurfUpdateSession.SubmitUpdate(1, iSurfId, 0, NULL); + } + } + +// ----------------------------------------------------------------------------- +// CreateImageDecoderL +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::CreateImageDecoderL(const TDesC& aImageFile) + { + TRACER("CGlxHdmiController::CreateImageDecoderL()"); + // Create a decoder for the image in the named file + TRAPD(error,iImageDecoder = CImageDecoder::FileNewL(iFsSession, + aImageFile, CImageDecoder::EOptionNone, KNullUid)); + if (error!=KErrNone) + { + User::Leave(error); + } + } +// ----------------------------------------------------------------------------- +// ActivateZoom +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::ActivateZoom() + { + TRACER("CGlxHdmiSurfaceUpdater::ActivateZoom()"); + iConfig.SetSurfaceId(iSurfId); + iZoom = ETrue; + if(!iTimer->IsActive()) + { + iTimer->Start(KZoomDelay,KZoomDelay,TCallBack( TimeOut,this )); + } + } +// ----------------------------------------------------------------------------- +// DeactivateZoom +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::DeactivateZoom() + { + TRACER("CGlxHdmiSurfaceUpdater::DeactivateZoom()"); + if(iDecodedBitmap) + { + TSize bitmapsize = iDecodedBitmap->SizeInPixels(); + iConfig.SetViewport(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight)); + iConfig.SetExtent(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight)); + iWindow->SetBackgroundSurface(iConfig, ETrue); + } + + } +// --------------------------------------------------------------------------- +// TimeOut +// --------------------------------------------------------------------------- +// +TInt CGlxHdmiSurfaceUpdater::TimeOut(TAny* aSelf) + { + TRACER("CGlxHdmiSurfaceUpdater::TimeOut"); + if(aSelf) + { + CGlxHdmiSurfaceUpdater* self = static_cast (aSelf); + if (self) + { + self->Zoom(ETrue); + } + } + return KErrNone; + } +// ----------------------------------------------------------------------------- +// Zoom +// ----------------------------------------------------------------------------- +void CGlxHdmiSurfaceUpdater::Zoom(TBool aZoom) + { + TRACER("CGlxHdmiSurfaceUpdater::Zoom()"); + if(iLeftCornerForZoom.iX == KMaxZoomLimit) + { + iZoom = EFalse; + } + if(aZoom && iZoom) + { + iZoomRectSz.iWidth = TInt(iZoomRectSz.iWidth-KSingleStepForZoom); + iZoomRectSz.iHeight = TInt(iZoomRectSz.iHeight-KSingleStepForZoom); + iLeftCornerForZoom.iX =iLeftCornerForZoom.iX+KSingleStepForZoom/2; + iLeftCornerForZoom.iY =iLeftCornerForZoom.iY+KSingleStepForZoom/2; + GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 2,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight); + iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight)); + } + else + { + iZoomRectSz.iWidth = TInt(iZoomRectSz.iWidth+KSingleStepForZoom); + iZoomRectSz.iHeight = TInt(iZoomRectSz.iHeight+KSingleStepForZoom); + iLeftCornerForZoom.iX =iLeftCornerForZoom.iX-KSingleStepForZoom/2; + iLeftCornerForZoom.iY =iLeftCornerForZoom.iY-KSingleStepForZoom/2; + if(iLeftCornerForZoom.iX == 0) + { + iTimer->Cancel(); + iZoom = ETrue; + } + GLX_LOG_INFO2("CGlxHdmiSurfaceUpdater::Zoom()--- 4,iZoomRectSz.iWidth = %d, iZoomRectSz.iHeight = %d", iZoomRectSz.iWidth,iZoomRectSz.iHeight); + iConfig.SetViewport(TRect(iLeftCornerForZoom.iX,iLeftCornerForZoom.iY,iZoomRectSz.iWidth,iZoomRectSz.iHeight)); + } + TSize bitmapsize = iDecodedBitmap->SizeInPixels(); + iConfig.SetExtent(TRect(0,0,bitmapsize.iWidth,bitmapsize.iHeight)); + iWindow->SetBackgroundSurface(iConfig, ETrue); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/src/glxtv.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/src/glxtv.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,476 @@ +/* +* Copyright (c) 2008-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: Handles & propogates UI state change notifications. +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +// Class header +#include "glxtv.h" + +// External includes +#include // for TWsVisibilityChangedEvent + +// INTERNAL INCLUDES +#include // for debug logging +#include // for debug logging +#include // for Gallery panic codes +#include // for ETvConnectionChanged, TV heights +#include // for CRepository +#ifdef __MARM +#include +#endif + +// GLXTVOUT INCLUDES +#include "mglxtvobserver.h" // for MGlxTvObserver +#include "glxwindowvisibilitymonitor.h" // for CGlxWindowVisibilityMonitor +#include "glxtvconnectionmonitor.h" // for CGlxTvConnectionMonitor + +const TUid KCRUidTvoutSettings = {0x1020730B}; + +using namespace glxTvOut; + +/** +* CGlxTvOutCenRepMonitor +* CGlxTv conainted class for observing changes in central +* repository TV aspect Ratio value +* @author Loughlin Spollen +*/ +NONSHARABLE_CLASS( CGlxTv::CGlxTvOutCenRepMonitor ) + : public CActive + { + public: // Constructors and destructor + /** + * Symbian Constructor. + * @param The TV Observer + * @param The central repository + * @return constructed object + */ + static CGlxTvOutCenRepMonitor* NewL(MGlxTvObserver& aTvObserver, + CRepository& aRepository); + + /** + * Destructor. + */ + ~CGlxTvOutCenRepMonitor(); + + private: + /** + * C++ constructor. + * @param The TV Observer + * @param The central repository + * @return constructed object + */ + CGlxTvOutCenRepMonitor(MGlxTvObserver& aTvObserver, + CRepository& aRepository); + /** + * 2nd phase constructor + */ + void ConstructL(); + + protected: // from CActive + /** + * @ref CActive::RunL + */ + void RunL(); + + /** + * @ref CActive::DoCancel + */ + void DoCancel(); + + /** + * @ref CActive::RunError + */ + TInt RunError(TInt aError); + + private: + + // Not Owned: the Glx TV observer + MGlxTvObserver& iTvObserver; + + // Not Owned: the central repository API + CRepository& iRepository; + + TUint iSettingsTVAspectRatio; + // the central repository identifier + TUid iRepositoryUid; + }; + + + + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CGlxTv::CGlxTvOutCenRepMonitor* CGlxTv::CGlxTvOutCenRepMonitor::NewL + ( MGlxTvObserver& aTvObserver, + CRepository& aRepository ) + { + TRACER("CGlxTv::CGlxTvOutCenRepMonitor::NewL()"); + + CGlxTvOutCenRepMonitor* self + = new(ELeave) CGlxTvOutCenRepMonitor( aTvObserver, aRepository ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + + +// ----------------------------------------------------------------------------- +// C++ constructor. +// ----------------------------------------------------------------------------- +inline CGlxTv::CGlxTvOutCenRepMonitor::CGlxTvOutCenRepMonitor + ( MGlxTvObserver& aTvObserver, + CRepository& aRepository ) + : CActive( EPriorityStandard ), + iTvObserver ( aTvObserver ), + iRepository( aRepository ) + { + TRACER("CGlxTv::CGlxTvOutCenRepMonitor::CGlxTvOutCenRepMonitor()"); + } + + + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor +// ---------------------------------------------------------------------------- +void CGlxTv::CGlxTvOutCenRepMonitor::ConstructL() + { + TRACER("CGlxTv::CGlxTvOutCenRepMonitor::ConstructL"); + CActiveScheduler::Add( this ); +#ifdef __MARM + CGSServerEngine* aGSServerEngine= CGSServerEngine::NewLC(); + iSettingsTVAspectRatio = aGSServerEngine->AspectRatioL(); + CleanupStack::Pop(aGSServerEngine); +#else + iSettingsTVAspectRatio = 0; +#endif + // Commenting out code for request notification as these doesnt work fine, + // would be soon updated with latest api's to support aspectration chnages. + // Request notification when the user changes cenrep values +// TInt err = iRepository.NotifyRequest( iSettingsTVAspectRatio, iStatus ); +// if (!(KErrNone ==err ||KErrAlreadyExists ==err)) +// { +// RDebug::Printf("## Error code in CGlxTv::CGlxTvOutCenRepMonitor::ConstructL() is %d",err); +// User::Leave(err); +// } + +// SetActive(); + } + + + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +CGlxTv::CGlxTvOutCenRepMonitor::~CGlxTvOutCenRepMonitor() + { + TRACER("CGlxTv::~CGlxTvOutCenRepMonitor()"); + Cancel(); + } + + + +// ---------------------------------------------------------------------------- +// CGlxTvOutCenRepMonitor::RunL +// From class CActive. +// ---------------------------------------------------------------------------- +void CGlxTv::CGlxTvOutCenRepMonitor::RunL() + { + TRACER("CGlxTv::CGlxTvOutCenRepMonitor::RunL"); + // Check for errors + User::LeaveIfError( iStatus.Int() ); + GLX_LOG_INFO("CGlxTvOutCenRepMonitor - RunL completed with Err Code"); + User::LeaveIfError( iRepository.NotifyRequest( iSettingsTVAspectRatio, iStatus ) ); + if (!IsActive()) + { + SetActive(); + iTvObserver.HandleTvStatusChangedL( ETvConnectionChanged ); + } + } + + + +// ---------------------------------------------------------------------------- +// CGlxTvOutCenRepMonitor::DoCancel +// From class CActive. +// ---------------------------------------------------------------------------- +void CGlxTv::CGlxTvOutCenRepMonitor::DoCancel() + { + TRACER("CGlxTv::CGlxTvOutCenRepMonitor::DoCancel()"); + iRepository.NotifyCancel( iSettingsTVAspectRatio ); + } + + + +//----------------------------------------------------------------------------- +// CGlxTvOutCenRepMonitor::RunError +// From class CActive. +//----------------------------------------------------------------------------- +// +TInt CGlxTv::CGlxTvOutCenRepMonitor::RunError( TInt /*aError*/ ) + { + TRACER("CGlxTv::CGlxTvOutCenRepMonitor::RunError()"); + return KErrNone; + } + + +//----------------------------------------------------------------------------- +// Return new object +//----------------------------------------------------------------------------- +// +EXPORT_C CGlxTv* CGlxTv::NewL( MGlxTvObserver& aTvObserver ) + { + TRACER("CGlxTv::NewL()"); + CGlxTv* self = new (ELeave) CGlxTv( aTvObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +// +EXPORT_C CGlxTv::~CGlxTv() + { + TRACER("CGlxTv::~CGlxTv()"); + StopMonitoringEnvironment(); + delete iTvConnectionMonitor; + } + + + + +//----------------------------------------------------------------------------- +// Default C++ constructor +//----------------------------------------------------------------------------- +// +CGlxTv::CGlxTv( MGlxTvObserver& aTvObserver ) : iTvObserver( aTvObserver ), + iAspectRatio( KErrUnknown ) + { + TRACER("CGlxTv::CGlxTv()"); + } + + + + +//----------------------------------------------------------------------------- +// Symbian second phase constructor +//----------------------------------------------------------------------------- +// +void CGlxTv::ConstructL() + { + TRACER("CGlxTv::ConstructL()"); + // Don't create the visibility monitor until the TV Out cable is connected + + // Owned: The TV connection monitor + iTvConnectionMonitor = CGlxTvConnectionMonitor::NewL( *this ); + + if ( iTvConnectionMonitor->IsConnected() ) + { + // Start monitoring the environment for changes + MonitorEnvironmentL(); + + // Calculate the TV Out screen buffer size + CalcTvScreenSzL(); + } + } + + + + +//----------------------------------------------------------------------------- +// returns the TV screen size +//----------------------------------------------------------------------------- +// +EXPORT_C TSize CGlxTv::ScreenSizeL() const + { + TRACER("CGlxTv::ScreenSizeL()"); + return iSzInPixels; + } + + + + +//----------------------------------------------------------------------------- +// Is the TV Connected +//----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxTv::IsConnected() const + { + TRACER("CGlxTv::IsConnected()"); + return iTvConnectionMonitor->IsConnected(); + } + + + +//----------------------------------------------------------------------------- +// Is the TV widescreen +//----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxTv::IsWidescreen() const + { + TRACER("CGlxTv::IsWidescreen()"); + return iAspectRatio == KGlxTvAspectWide; + } + + +//----------------------------------------------------------------------------- +// From class MGlxWindowVisibilityObserver. +// Called when window becomes fully visible or not visible. +//----------------------------------------------------------------------------- +// +void CGlxTv::HandleWindowVisibilityChangedL( TTvChangeType aChangeType ) + { + TRACER("CGlxTv::HandleWindowVisibilityChangedL()"); + iTvObserver.HandleTvStatusChangedL( aChangeType ); + } + + + +//----------------------------------------------------------------------------- +// From class MGlxTvConnectionObserver. +// Called when TV connection state changes +//----------------------------------------------------------------------------- +// +void 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 ); + } + + + +//----------------------------------------------------------------------------- +// Retrieve the TV display aspect ratio +//----------------------------------------------------------------------------- +// +void CGlxTv::CalcTvScreenSzL() + { + TRACER("CGlxTv::CalcTvScreenSzL()"); + + // Retrieve the aspect ratio and the settings info from CenRep + iAspectRatio = KErrNotFound; + +#ifdef __MARM + CGSServerEngine* aGSServerEngine = CGSServerEngine::NewLC(); + iAspectRatio = aGSServerEngine->AspectRatioL(); + CleanupStack::Pop(aGSServerEngine); + User::LeaveIfError( iAspectRatio ); +#else + iAspectRatio = 0; +#endif + // note: Constants are defined in the GSServerEngine.cpp and not exported + // they are defined locally in glxtvconstants.h + switch( iAspectRatio ) + { + case KGlxTvAspectWide: + { + iSzInPixels = TSize ( KGlxTvOutWidthWide, KGlxTvOutHeightWide) ; + break; + } + case KGlxTvAspectNormal: + { + iSzInPixels = TSize ( KGlxTvOutWidth, KGlxTvOutHeight ); + break; + } + default: + { + User::Leave(KErrUnknown); + } + } + } + + +//----------------------------------------------------------------------------- +// From class MonitorEnvironmentL. +// Called when TV connection state changes to connected +//----------------------------------------------------------------------------- +// +void CGlxTv::MonitorEnvironmentL() + { + TRACER("CGlxTv::MonitorEnvironmentL()"); + + // Instantiate the central repository + if (!iCenRep) + { + // The Uid is hardcoded here as the hrh file giving us the Uid has been depricated and + // moved to a private folder + iCenRep = CRepository::NewL( KCRUidTvoutSettings ); + } + + // Monitor changes to the aspect ratio in the central repository + if (!iTvDisplayAspectRatioMonitor) + { + iTvDisplayAspectRatioMonitor + = CGlxTvOutCenRepMonitor::NewL( iTvObserver, *iCenRep ); + } + + // create window visibility monitoring object + if ( !iWindowVisibilityMonitor ) + { + iWindowVisibilityMonitor = + CGlxWindowVisibilityMonitor::NewL( *this ); + } + } + + +//----------------------------------------------------------------------------- +// StopMonitoringEnvironment(). +// Called when TV connection state changes to disconnected +//----------------------------------------------------------------------------- +// +void CGlxTv::StopMonitoringEnvironment() + { + TRACER("CGlxTv::StopMonitoringEnvironment()"); + delete iTvDisplayAspectRatioMonitor; // destroy before iCenRep - must cancel + iTvDisplayAspectRatioMonitor = NULL; // outstanding requests + if (iWindowVisibilityMonitor) + { + iWindowVisibilityMonitor->Close(); + } + delete iWindowVisibilityMonitor; + iWindowVisibilityMonitor = NULL; + delete iCenRep; + iCenRep = NULL; + } + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/src/glxtvconnectionmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/src/glxtvconnectionmonitor.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2008-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: Monitors the Tv Out Connection +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +// CLASS HEADER +#include "glxtvconnectionmonitor.h" + +// EXTERNAL INCLUDES + +// INTERNAL INCLUDES + +#include +#include +#include "glxtv.h" + + +//----------------------------------------------------------------------------- +// Return new object +//----------------------------------------------------------------------------- +// +CGlxTvConnectionMonitor* CGlxTvConnectionMonitor::NewL( + MGlxTvConnectionObserver& aConnectionObserver ) + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::NewL"); + CGlxTvConnectionMonitor* self = new (ELeave) + CGlxTvConnectionMonitor( aConnectionObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +// +CGlxTvConnectionMonitor::~CGlxTvConnectionMonitor() + { + GLX_LOG_INFO("~CGlxTvConnectionMonitor"); + Cancel(); + iTvAccServer.Disconnect(); + } + + +//----------------------------------------------------------------------------- +// Default C++ constructor +//----------------------------------------------------------------------------- +// +CGlxTvConnectionMonitor::CGlxTvConnectionMonitor + ( MGlxTvConnectionObserver& aConnectionObserver ) + :CActive(EPriorityStandard), + iConnectionObserver ( aConnectionObserver ) + { + GLX_LOG_INFO("CGlxTvConnectionMonitor"); + CActiveScheduler::Add( this ); + } + + +//----------------------------------------------------------------------------- +// Symbian second phase constructor +//----------------------------------------------------------------------------- +// +void CGlxTvConnectionMonitor::ConstructL() + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::ConstructL"); + User::LeaveIfError( iTvAccServer.Connect() ); + User::LeaveIfError( iTvAccMode.CreateSubSession( iTvAccServer ) ); + User::LeaveIfError( iTvAccMode.GetAccessoryMode( iCurrentAccMode ) ); + iConnectionState = ( iCurrentAccMode.iAccessoryMode == EAccModeTVOut ); + + IssueRequest(); + } + +//----------------------------------------------------------------------------- +// From class CActive. +// Receive notification of change in the connection state +//----------------------------------------------------------------------------- +// +void CGlxTvConnectionMonitor::RunL() + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::RunL"); + // Check for errors + User::LeaveIfError( iStatus.Int() ); + // Notify observers + IssueNotificationL(); + // Request the next event + IssueRequest(); + } + + +//----------------------------------------------------------------------------- +// From class CActive. +// DoCancel +//----------------------------------------------------------------------------- +// +void CGlxTvConnectionMonitor::DoCancel() + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::DoCancel"); + iTvAccMode.CancelNotifyAccessoryModeChanged(); + } + + + +//----------------------------------------------------------------------------- +// From class CActive. +// RunError +//----------------------------------------------------------------------------- +// +TInt CGlxTvConnectionMonitor::RunError(TInt aError) + { + GLX_LOG_INFO1("CGlxTvConnectionMonitor::RunError - %d", aError); + return KErrNone; + } + +//----------------------------------------------------------------------------- +// Is the TV out cable connected +// IsConnected +//----------------------------------------------------------------------------- +// +TBool CGlxTvConnectionMonitor::IsConnected() const + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::IsConnected"); + return iConnectionState; + } + + +//----------------------------------------------------------------------------- +// Request accessory server events +//----------------------------------------------------------------------------- +// +void CGlxTvConnectionMonitor::IssueRequest() + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::IssueRequest"); + if (!IsActive()) // required for testing + { + iTvAccMode.NotifyAccessoryModeChanged( iStatus, iCurrentAccMode ); + SetActive(); + } + } + + +//----------------------------------------------------------------------------- +// Sends notification to observers if TV Out is connected +//----------------------------------------------------------------------------- +// +void CGlxTvConnectionMonitor::IssueNotificationL() + { + GLX_LOG_INFO("CGlxTvConnectionMonitor::IssueNotificationL"); + iConnectionState = ( iCurrentAccMode.iAccessoryMode == EAccModeTVOut ); + iConnectionObserver.HandleTvConnectionStatusChangedL(); + } + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/tvout/src/glxwindowvisibilitymonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/tvout/src/glxwindowvisibilitymonitor.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2008-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: Class that monitors tv window visibility +* +*/ + + + +/** + * @internal reviewed 24/08/2007 by D Holland + */ + +// CLASS HEADER +#include "glxwindowvisibilitymonitor.h" + +// EXTERNAL INCLUDES +#include // for TWsEvent +#include // for KAknFullOrPartialForegroundLost +#include // for EventMonitor +#include + +// INTERNAL INCLUDES +#include +#include +#include "glxtv.h" // for MGlxWindowVisibilityObserver + + + +//----------------------------------------------------------------------------- +// Return new object +//----------------------------------------------------------------------------- +// +CGlxWindowVisibilityMonitor* CGlxWindowVisibilityMonitor::NewL( + MGlxWindowVisibilityObserver& aVisibilityObserver ) + { + GLX_LOG_INFO("CGlxWindowVisibilityMonitor::NewL"); + CGlxWindowVisibilityMonitor* self = new ( ELeave ) + CGlxWindowVisibilityMonitor( aVisibilityObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +// +CGlxWindowVisibilityMonitor::~CGlxWindowVisibilityMonitor() + { + GLX_LOG_INFO("~CGlxWindowVisibilityMonitor"); + } + + +//----------------------------------------------------------------------------- +// Close +// To overcome code-scanner high rated warning +//----------------------------------------------------------------------------- +// +void CGlxWindowVisibilityMonitor::Close() + { + iAknEventMonitor->Enable( EFalse ); + iAknEventMonitor->RemoveObserver( this ); + } + +//----------------------------------------------------------------------------- +// Default C++ constructor +//----------------------------------------------------------------------------- +// +CGlxWindowVisibilityMonitor::CGlxWindowVisibilityMonitor + ( MGlxWindowVisibilityObserver& aVisibilityObserver ) + :iVisibilityObserver ( aVisibilityObserver ) + { + GLX_LOG_INFO("CGlxWindowVisibilityMonitor"); + } + + +//----------------------------------------------------------------------------- +// Symbian second phase constructor +//----------------------------------------------------------------------------- +// +void CGlxWindowVisibilityMonitor::ConstructL() + { + GLX_LOG_INFO("CGlxWindowVisibilityMonitor::ConstructL"); + // Register for visibility events + iAknEventMonitor = + static_cast(CCoeEnv::Static()->AppUi())->EventMonitor(); + iAknEventMonitor->Enable( ETrue ); + iAknEventMonitor->AddObserverL( this ); + } + + +//----------------------------------------------------------------------------- +// From class MAknWsEventObserver +// Propagates window server visibility events to the observer +//----------------------------------------------------------------------------- +// +void CGlxWindowVisibilityMonitor::HandleWsEventL( const TWsEvent& aEvent, + CCoeControl* /*aDestination*/ ) + { + GLX_LOG_INFO("CGlxWindowVisibilityMonitor::HandleWsEventL"); + TInt eventType = aEvent.Type(); + + if ( eventType == EEventWindowVisibilityChanged ) + { + // check the state + TUint visible = aEvent.VisibilityChanged()->iFlags; + // notify the observer + if ( visible & TWsVisibilityChangedEvent::EFullyVisible ) + { + GLX_LOG_INFO("Visibility Event - EFullyVisible"); + iVisibilityObserver.HandleWindowVisibilityChangedL( ETvDisplayIsVisible ); + } + else if ( visible & TWsVisibilityChangedEvent::ENotVisible ) + { + GLX_LOG_INFO("Visibility Event - ENotVisible"); + iVisibilityObserver.HandleWindowVisibilityChangedL( ETvDisplayNotVisible ); + } + else if (visible & TWsVisibilityChangedEvent::EPartiallyVisible) + { + GLX_LOG_INFO("Visibility Event - EPartiallyVisible"); + iVisibilityObserver.HandleWindowVisibilityChangedL( ETvDisplayNotVisible ); + } + } + } + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/bwins/glxuiutilitiesu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/bwins/glxuiutilitiesu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +EXPORTS + ?VisibleItemsInPageGranularityL@CGlxUiUtility@@QAEHXZ @ 1 NONAME ; int CGlxUiUtility::VisibleItemsInPageGranularityL(void) + ?ViewNavigationDirection@CGlxUiUtility@@QAE?AW4TGlxNavigationDirection@@XZ @ 2 NONAME ; enum TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection(void) + ?SetRotatedImageSize@CGlxUiUtility@@QAEXVTSize@@@Z @ 3 NONAME ; void CGlxUiUtility::SetRotatedImageSize(class TSize) + ?NewL@CGlxScreenFurniture@@SAPAV1@AAVCGlxUiUtility@@@Z @ 4 NONAME ; class CGlxScreenFurniture * CGlxScreenFurniture::NewL(class CGlxUiUtility &) + ?SetExitingState@CGlxUiUtility@@QAEXH@Z @ 5 NONAME ; void CGlxUiUtility::SetExitingState(int) + ?GlxTextureManager@CGlxUiUtility@@QAEAAVCGlxTextureManager@@XZ @ 6 NONAME ; class CGlxTextureManager & CGlxUiUtility::GlxTextureManager(void) + ?ExecuteLD@CGlxTextEntryPopup@@QAEHXZ @ 7 NONAME ; int CGlxTextEntryPopup::ExecuteLD(void) + ?ShowErrorNoteL@GlxGeneralUiUtilities@@SAXH@Z @ 8 NONAME ; void GlxGeneralUiUtilities::ShowErrorNoteL(int) + ?RegisterActiveMediaList@CGlxActiveMediaListRegistry@@QAEXPAVMGlxMediaList@@@Z @ 9 NONAME ; void CGlxActiveMediaListRegistry::RegisterActiveMediaList(class MGlxMediaList *) + ?FormatString@GlxGeneralUiUtilities@@SAXAAVTDes16@@ABVTDesC16@@HHH@Z @ 10 NONAME ; void GlxGeneralUiUtilities::FormatString(class TDes16 &, class TDesC16 const &, int, int, int) + ?AppOrientation@CGlxUiUtility@@QBE?AW4TGlxOrientation@@XZ @ 11 NONAME ; enum TGlxOrientation CGlxUiUtility::AppOrientation(void) const + ?NewLC@CGlxScreenFurniture@@SAPAV1@AAVCGlxUiUtility@@@Z @ 12 NONAME ; class CGlxScreenFurniture * CGlxScreenFurniture::NewLC(class CGlxUiUtility &) + ?ShowAlfDisplayL@CGlxUiUtility@@SAXXZ @ 13 NONAME ; void CGlxUiUtility::ShowAlfDisplayL(void) + ?LayoutIsMirrored@GlxGeneralUiUtilities@@SAHXZ @ 14 NONAME ; int GlxGeneralUiUtilities::LayoutIsMirrored(void) + ?IsLandscape@GlxGeneralUiUtilities@@SAHXZ @ 15 NONAME ; int GlxGeneralUiUtilities::IsLandscape(void) + ?SetToolbarPosition@CGlxScreenFurniture@@QAEXXZ @ 16 NONAME ; void CGlxScreenFurniture::SetToolbarPosition(void) + ?HandleTvStatusChangedL@CGlxUiUtility@@UAEXW4TTvChangeType@@@Z @ 17 NONAME ; void CGlxUiUtility::HandleTvStatusChangedL(enum TTvChangeType) + ?ModifySoftkeyIdL@CGlxScreenFurniture@@QAEXW4TCommandPosition@CEikButtonGroupContainer@@HHABVTDesC16@@@Z @ 18 NONAME ; void CGlxScreenFurniture::ModifySoftkeyIdL(enum CEikButtonGroupContainer::TCommandPosition, int, int, class TDesC16 const &) + ?Close@CGlxUiUtility@@QAEXXZ @ 19 NONAME ; void CGlxUiUtility::Close(void) + ?ViewDeactivated@CGlxScreenFurniture@@QAEXH@Z @ 20 NONAME ; void CGlxScreenFurniture::ViewDeactivated(int) + ?CreateViewAnimationL@GlxAnimationFactory@@SAPAVMGlxAnimation@@W4TGlxViewswitchAnimation@@W4TGlxNavigationDirection@@AAV?$RPointerArray@VCAlfControlGroup@@@@@Z @ 21 NONAME ; class MGlxAnimation * GlxAnimationFactory::CreateViewAnimationL(enum TGlxViewswitchAnimation, enum TGlxNavigationDirection, class RPointerArray &) + ?AppState@GlxSetAppState@@SA?AW4TGlxAppState@@XZ @ 22 NONAME ; enum TGlxAppState GlxSetAppState::AppState(void) + ?ShowInfoNoteL@GlxGeneralUiUtilities@@SAXABVTDesC16@@H@Z @ 23 NONAME ; void GlxGeneralUiUtilities::ShowInfoNoteL(class TDesC16 const &, int) + ?RemoveSkinChangeObserver@CGlxUiUtility@@QAEXAAVMGlxSkinChangeObserver@@@Z @ 24 NONAME ; void CGlxUiUtility::RemoveSkinChangeObserver(class MGlxSkinChangeObserver &) + ?UtilityL@CGlxUiUtility@@SAPAV1@XZ @ 25 NONAME ; class CGlxUiUtility * CGlxUiUtility::UtilityL(void) + ?HideAlfDisplayL@CGlxUiUtility@@SAXXZ @ 26 NONAME ; void CGlxUiUtility::HideAlfDisplayL(void) + ?DisplaySize@CGlxUiUtility@@QBE?AVTSize@@XZ @ 27 NONAME ; class TSize CGlxUiUtility::DisplaySize(void) const + ?ShowErrorNoteL@GlxGeneralUiUtilities@@SAXABVTDesC16@@H@Z @ 28 NONAME ; void GlxGeneralUiUtilities::ShowErrorNoteL(class TDesC16 const &, int) + ?SetActiveView@CGlxScreenFurniture@@QAEXH@Z @ 29 NONAME ; void CGlxScreenFurniture::SetActiveView(int) + ?SetState@GlxSetAppState@@SAXW4TGlxAppState@@@Z @ 30 NONAME ; void GlxSetAppState::SetState(enum TGlxAppState) + ?SetLeftSoftKeyL@CGlxTextEntryPopup@@QAEXH@Z @ 31 NONAME ; void CGlxTextEntryPopup::SetLeftSoftKeyL(int) + ?SetToolbarItemVisibility@CGlxScreenFurniture@@QAEXHH@Z @ 32 NONAME ; void CGlxScreenFurniture::SetToolbarItemVisibility(int, int) + ?AddSkinChangeObserverL@CGlxUiUtility@@QAEXAAVMGlxSkinChangeObserver@@@Z @ 33 NONAME ; void CGlxUiUtility::AddSkinChangeObserverL(class MGlxSkinChangeObserver &) + ?SetTooltipL@CGlxScreenFurniture@@QAEXHW4TTooltipPosition@CAknButton@@ABVTDesC16@@@Z @ 34 NONAME ; void CGlxScreenFurniture::SetTooltipL(int, enum CAknButton::TTooltipPosition, class TDesC16 const &) + ?GetRotatedImageSize@CGlxUiUtility@@QAE?AVTSize@@XZ @ 35 NONAME ; class TSize CGlxUiUtility::GetRotatedImageSize(void) + ?SetToolbarVisibility@CGlxScreenFurniture@@QAEXH@Z @ 36 NONAME ; void CGlxScreenFurniture::SetToolbarVisibility(int) + ?IsPenSupported@CGlxUiUtility@@QAEHXZ @ 37 NONAME ; int CGlxUiUtility::IsPenSupported(void) + ?IsExitingState@CGlxUiUtility@@QAEHXZ @ 38 NONAME ; int CGlxUiUtility::IsExitingState(void) + ?RetrieveL@GlxAttributeRetriever@@SAHABVMGlxFetchContext@@AAVMGlxMediaList@@H@Z @ 39 NONAME ; int GlxAttributeRetriever::RetrieveL(class MGlxFetchContext const &, class MGlxMediaList &, int) + ?TextStyleIdL@CGlxUiUtility@@QAEHHH@Z @ 40 NONAME ; int CGlxUiUtility::TextStyleIdL(int, int) + ?InstanceL@CGlxActiveMediaListRegistry@@SAPAV1@PAVMGlxActiveMediaListChangeObserver@@@Z @ 41 NONAME ; class CGlxActiveMediaListRegistry * CGlxActiveMediaListRegistry::InstanceL(class MGlxActiveMediaListChangeObserver *) + ?DeregisterActiveMediaList@CGlxActiveMediaListRegistry@@QAEXPAVMGlxMediaList@@@Z @ 42 NONAME ; void CGlxActiveMediaListRegistry::DeregisterActiveMediaList(class MGlxMediaList *) + ?CreateImageLoadingAnimationL@GlxAnimationFactory@@SAPAVMGlxAnimation@@AAVCAlfVisual@@AAVCAlfTexture@@@Z @ 43 NONAME ; class MGlxAnimation * GlxAnimationFactory::CreateImageLoadingAnimationL(class CAlfVisual &, class CAlfTexture &) + ?SetAppOrientationL@CGlxUiUtility@@QAEXW4TGlxOrientation@@@Z @ 44 NONAME ; void CGlxUiUtility::SetAppOrientationL(enum TGlxOrientation) + ?ConfirmQueryL@GlxGeneralUiUtilities@@SAHABVTDesC16@@@Z @ 45 NONAME ; int GlxGeneralUiUtilities::ConfirmQueryL(class TDesC16 const &) + ?SetToolbarItemDimmed@CGlxScreenFurniture@@QAEXHH@Z @ 46 NONAME ; void CGlxScreenFurniture::SetToolbarItemDimmed(int, int) + ?NewL@CGlxTextEntryPopup@@SAPAV1@ABVTDesC16@@AAVTDes16@@@Z @ 47 NONAME ; class CGlxTextEntryPopup * CGlxTextEntryPopup::NewL(class TDesC16 const &, class TDes16 &) + ?Display@CGlxUiUtility@@QBEPAVCAlfDisplay@@XZ @ 48 NONAME ; class CAlfDisplay * CGlxUiUtility::Display(void) const + ?CreateViewAnimationL@GlxAnimationFactory@@SAPAVMGlxAnimation@@W4TGlxViewswitchAnimation@@W4TGlxNavigationDirection@@PAVCAlfControlGroup@@@Z @ 49 NONAME ; class MGlxAnimation * GlxAnimationFactory::CreateViewAnimationL(enum TGlxViewswitchAnimation, enum TGlxNavigationDirection, class CAlfControlGroup *) + ?Env@CGlxUiUtility@@QBEPAVCAlfEnv@@XZ @ 50 NONAME ; class CAlfEnv * CGlxUiUtility::Env(void) const + ?SetViewNavigationDirection@CGlxUiUtility@@QAEXW4TGlxNavigationDirection@@@Z @ 51 NONAME ; void CGlxUiUtility::SetViewNavigationDirection(enum TGlxNavigationDirection) + ?ShowConfirmationNoteL@GlxGeneralUiUtilities@@SAXABVTDesC16@@H@Z @ 52 NONAME ; void GlxGeneralUiUtilities::ShowConfirmationNoteL(class TDesC16 const &, int) + ?ScreenFurniture@CGlxUiUtility@@QAEPAVCGlxScreenFurniture@@XZ @ 53 NONAME ; class CGlxScreenFurniture * CGlxUiUtility::ScreenFurniture(void) + ?ConfirmQueryL@GlxGeneralUiUtilities@@SAHHABVTDesC16@@@Z @ 54 NONAME ; int GlxGeneralUiUtilities::ConfirmQueryL(int, class TDesC16 const &) + ?SetFocusL@CGlxScreenFurniture@@QAEXH@Z @ 55 NONAME ; void CGlxScreenFurniture::SetFocusL(int) + ?GetGridIconSize@CGlxUiUtility@@QAE?AVTSize@@XZ @ 56 NONAME ; class TSize CGlxUiUtility::GetGridIconSize(void) + ?InstanceL@MGlxActiveMediaListResolver@@SAPAV1@PAVMGlxActiveMediaListChangeObserver@@@Z @ 57 NONAME ; class MGlxActiveMediaListResolver * MGlxActiveMediaListResolver::InstanceL(class MGlxActiveMediaListChangeObserver *) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/data/capped_element.png Binary file photosgallery/viewframework/uiutilities/data/capped_element.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/data/glxuiutilities.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/data/glxuiutilities.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,798 @@ +/* +* Copyright (c) 2008-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: Resource definitions +* +*/ + + + + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include "glxutilities.hrh" +#include + +NAME GLXR // 4 letter ID + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Resource signature +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE {} + +// Active palette tooltips + +RESOURCE TBUF r_glx_ap_tooltip_slideshow + { + buf = qtn_lgal_tooltip_slideshow; + } + +RESOURCE TBUF r_glx_ap_tooltip_add_to_album + { + buf = qtn_lgal_tooltip_add_to_album; + } + +RESOURCE TBUF r_glx_ap_tooltip_remove_from_album + { + buf = qtn_lgal_ap_tooltip_remove_from_album; + } + +RESOURCE TBUF r_glx_ap_tooltip_landscape + { + buf = qtn_lgal_tooltip_view_in_landscape; + } + +RESOURCE TBUF r_glx_ap_tooltip_portrait + { + buf = qtn_lgal_tooltip_view_in_portrait; + } + +RESOURCE TBUF r_glx_ap_tooltip_send + { + buf = qtn_lgal_tooltip_send; + } + +RESOURCE TBUF r_glx_ap_tooltip_delete + { + buf = qtn_lgal_tooltip_delete; + } + +RESOURCE TBUF r_glx_ap_tooltip_properties + { + buf = qtn_lgal_tooltip_details; + } + +// No images to play slideshow pop-up when empty containers are in focus. +RESOURCE TBUF r_glx_no_images_to_play_slideshow + { + buf = qtn_lgal_note_no_images_to_play_slideshow; + } + +// the album selection popup title +RESOURCE TBUF r_glx_album_selection_popup_title + { + buf = qtn_lgal_title_select_albums; + } + +// the default album name +RESOURCE TBUF r_glx_default_album_name + { + buf = qtn_lgal_name_album; + } + +// the name prompt +RESOURCE TBUF r_glx_prompt_name + { + buf = qtn_lgal_query_enter_name; + } + +// the album popup empty list text +RESOURCE TBUF r_glx_album_selection_popup_empty_list + { + buf = ""; + } + +// the new album selection name +RESOURCE TBUF r_glx_new_album_selection_name + { + buf = qtn_lgal_album_create; + } + +// Add to container completion note for one item album +RESOURCE TBUF r_glx_completion_add_to_container_one_item_album + { + buf = qtn_lgal_note_added_one_item_album; + } + +// Add to container completion note for multi item album +RESOURCE TBUF r_glx_completion_add_to_container_multi_item_album + { + buf = qtn_lgal_note_added_multi_item_album; + } + +// Add to container completion note for one item tag +RESOURCE TBUF r_glx_completion_add_to_container_one_item_tag + { + buf = qtn_lgal_note_added_one_item_tag; + } + +// Add to container completion note for multi item tag +RESOURCE TBUF r_glx_completion_add_to_container_multi_item_tag + { + buf = qtn_lgal_note_added_multi_item_tag; + } + +// General processing note +RESOURCE TBUF r_glx_progress_general + { + buf = qtn_lgal_note_wait_processing; + } + +// General navi counter +RESOURCE TBUF r_glx_navi_counter + { + buf = qtn_lgal_item_counter; + } + +// General navi counter on static item +RESOURCE TBUF r_glx_navi_counter_dl + { + buf = qtn_lgal_navi_counter_dl; + } + +// General counter on static item in counter box in portrait tile view +RESOURCE TBUF r_glx_tile_counter_dash + { + buf = qtn_lgal_tile_counter_dash; + } + +// General navi zoom percentage +RESOURCE TBUF r_glx_navi_zoom_percent + { + buf = qtn_lgal_zoom_ratio; + } + +// +// Delete confirmation notes +// + +// Delete single item confirmation note +RESOURCE TBUF r_glx_confirmation_delete_single + { + //buf = qtn_lgal_note_delete_image; + buf = qtn_query_common_conf_delete; + } + +// Delete multiple items confirmation note +RESOURCE TBUF r_glx_confirmation_delete_multiple + { + buf = qtn_lgal_note_delete_items; + } + +// Delete single container confirmation note +RESOURCE TBUF r_glx_confirmation_delete_container_single + { + buf = qtn_lgal_note_delete_container; + } + +// Delete multiple containers confirmation note +RESOURCE TBUF r_glx_confirmation_delete_container_multiple + { + buf = qtn_lgal_note_delete_container_multi; + } + +// Remove single item from album confirmation note +RESOURCE TBUF r_glx_confirmation_remove_name_album + { + buf = qtn_lgal_note_remove_name_album; + } + +// Remove multiple items from album confirmation note +RESOURCE TBUF r_glx_confirmation_remove_items_album + { + buf = qtn_lgal_note_remove_items_album; + } + +// Remove single item from tag confirmation note +RESOURCE TBUF r_glx_confirmation_remove_name_tag + { + buf = qtn_lgal_note_remove_name_tag; + } + +// Remove multiple items from album confirmation note +RESOURCE TBUF r_glx_confirmation_remove_items_tag + { + buf = qtn_lgal_note_remove_items_tag; + } + +// Play +RESOURCE TBUF r_glx_options_play + { + buf = qtn_lgal_tooltip_play; + } + + +// Send media item pop-up title +RESOURCE TBUF r_qtn_lgal_popup_send + { + //buf = qtn_lgal_popup_send; + buf = qtn_query_heading_send; + } + +// Use Image menu item, for AIW Assign handler +RESOURCE TBUF r_qtn_lgal_options_use_image_as + { + buf = qtn_lgal_options_use_image_as; + } + +// Use Video menu item, for AIW Assign handler +RESOURCE TBUF r_qtn_lgal_options_use_video_as + { + buf = qtn_lgal_options_use_video_as; + } + +// Use items menu item, for AIW Assign handler +RESOURCE TBUF r_qtn_lgal_options_use_items + { + buf = qtn_lgal_options_use_items; + } + +//use print menu item, for AIW print preview handler +RESOURCE TBUF r_qtn_lgal_options_print_menu + { + buf = qtn_lgal_options_print_menu; + } + +//single clk chng +//use items menu item, for Edit options +RESOURCE TBUF r_qtn_lgal_options_edit + { + buf = qtn_lgal_options_edit; + } +// +// Rename popup +// + +// Popup title text +RESOURCE TBUF r_glx_popup_rename_title + { + buf = qtn_lgal_options_rename; + } + +// Show on Map No Location Info Popup +RESOURCE TBUF r_glx_popup_no_location_info + { + buf = qtn_lgal_note_no_location; + } + +RESOURCE DIALOG r_glx_text_entry_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EAknCtQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control=EDWIN + { + flags = EEikEdwinAutoSelection | KSingleLineHorizontalScrollingEditorFlags; + maxlength = 128; // KMGXMaxFileName + lines = 1; + avkon_flags = EAknEditorFlagNoT9; + }; + }; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_query_yes_no +// Confirmation query. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_glx_query_yes_no + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EAknCtQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + + +// ----------------------------------------------------------------------------- +// +// r_glx_query_ok_cancel +// Confirmation query. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_glx_query_ok_cancel + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EAknCtQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_progress_note +// Progress note +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_glx_progress_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EAknCtNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_wait_note +// Confirmation query. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_glx_wait_note + { + flags = EAknWaitNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGlxDlgWaitNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + singular_label = r_glx_wait_dlg_processing; + }; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_wait_note +// Confirmation query. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_glx_wait_note_blocking + { + flags = EAknWaitNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGlxDlgWaitNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + singular_label = r_glx_wait_dlg_processing; + }; + } + }; + } + + +// ----------------------------------------------------------------------------- +// +// r_glx_aiw_assign_to_contact_interest +// AIW interest structure for assign +// +// ----------------------------------------------------------------------------- +RESOURCE AIW_INTEREST r_glx_aiw_assign_to_contact_interest + { + items= + { + AIW_CRITERIA_ITEM + { + id = EGlxCmdAiwAssign; + serviceCmd = KAiwCmdAssign; + contentType = "*"; + serviceClass = KAiwClassMenu; + defaultProvider = 0x101F85BB; // Phonebook, uid not exported anywhere + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_aiw_edit_interest +// AIW interest structure for edit +// +// ----------------------------------------------------------------------------- +RESOURCE AIW_INTEREST r_glx_aiw_edit_interest + { + items= + { + AIW_CRITERIA_ITEM + { + id = EGlxCmdAiwEdit; + serviceCmd = KAiwCmdEdit; + contentType = "*"; + serviceClass = KAiwClassMenu; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_aiw_print_interest +// AIW interest structure for print preview +// +// ----------------------------------------------------------------------------- +RESOURCE AIW_INTEREST r_glx_aiw_print_interest + { + items= + { + AIW_CRITERIA_ITEM + { + id = EGlxCmdAiwPrint; + serviceCmd = KAiwCmdPrint; + contentType = "image/*"; + serviceClass = KAiwClassMenu; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_aiw_showmap_interest +// AIW interest structure for show on map +// +// ----------------------------------------------------------------------------- +RESOURCE AIW_INTEREST r_glx_aiw_showmap_interest + { + items= + { + AIW_CRITERIA_ITEM + { + id = KGlxCmdMnShowMap; + serviceCmd = KAiwCmdMnShowMap; + contentType = "*"; + serviceClass = KAiwClassMenu; + } + }; + } + + +//---------------------------------------------------- +// +// r_glx_aiw_showmap_interest_hardkey +// AIW interest for show on map hardkey +// +//---------------------------------------------------- +// +RESOURCE AIW_INTEREST r_glx_aiw_showmap_interest_hardkey + { + items = + { + AIW_CRITERIA_ITEM + { + id = KGlxCmdMnShowMap; + serviceCmd = KAiwCmdMnShowMap; + contentType = "application/x-landmark"; + serviceClass = KAiwClassBase; + } + }; + } + + +// ----------------------------------------------------------------------------- +// +// r_glx_name_already_used +// Used by new media command handler +// +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_glx_name_already_used + { + buf = qtn_fldr_name_already_used; + } + +// ----------------------------------------------------------------------------- +// +// r_glx_rename_query +// Rename query when item already exists +// +// ----------------------------------------------------------------------------- +RESOURCE TBUF r_glx_rename_query + { + buf = qtn_fldr_rename_query; + } + + +// ----------------------------------------------------------------------------- +// +// r_aiw_share_base_interest +// One Click Upload resource +// +// ----------------------------------------------------------------------------- +// +RESOURCE AIW_INTEREST r_aiw_share_base_interest + { + items= + { + AIW_CRITERIA_ITEM + { + id = EGlxCmdUpload;// 1006; + serviceCmd = KAiwCmdUpload; + contentType = "*"; + serviceClass = KAiwClassBase; + maxProviders = 1; + } + }; + } + +// ----------------------------------------------------------------------------- +// +// r_aiw_share_interest +// Share On Ovi resource +// +// ----------------------------------------------------------------------------- +// +RESOURCE AIW_INTEREST r_aiw_share_interest + { + items= + { + AIW_CRITERIA_ITEM + { + id = EGlxCmdAiwShareOnOvi; + serviceCmd = KAiwCmdUpload; + contentType = "*"; + serviceClass = KAiwClassMenu; + maxProviders = 1; + } + }; + } + +// ----------------------------------------------------------------------------- +// R_GLX_FLOATING_TOOLBAR +// Used by ScreenFurniture to create the avkon toolbar for non-touch fullscreen +// ----------------------------------------------------------------------------- +// +RESOURCE AVKON_TOOLBAR r_glx_fullscreen_floating_toolbar + { + lines = 2; + flags = ( KAknToolbarWithoutCba | KAknToolbarTransparent | KAknToolbarFlexiblePosition ); + + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdPlay; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_media_thumbnail; + bmpmask = EMbmGlxiconsQgn_indi_media_thumbnail_mask; + dim_bmpid = EMbmGlxiconsQgn_indi_media_thumbnail; + dim_bmpmask = EMbmGlxiconsQgn_indi_media_thumbnail_mask; + hover_bmpid = EMbmGlxiconsQgn_indi_media_thumbnail; + hover_bmpmask = EMbmGlxiconsQgn_indi_media_thumbnail_mask; + press_bmpid = EMbmGlxiconsQgn_indi_media_thumbnail; + press_bmpmask = EMbmGlxiconsQgn_indi_media_thumbnail_mask; + helptxt = qtn_lgal_tooltip_play; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSlideshowPlay; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + dim_bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + dim_bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + hover_bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + hover_bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + press_bmpid = EMbmGlxiconsQgn_indi_tb_slideshow; + press_bmpmask = EMbmGlxiconsQgn_indi_tb_slideshow_mask; + helptxt = qtn_lgal_ap_tooltip_slideshow_start; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdSend; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + dim_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + dim_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + hover_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + hover_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_send; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_send_mask; + helptxt = qtn_lgal_tooltip_send; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdUpload; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + dim_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + dim_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + hover_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + hover_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_upload; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_upload_mask; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = EGlxCmdDelete; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\glxicons.mif"; + bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + dim_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + dim_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + hover_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + hover_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + press_bmpid = EMbmGlxiconsQgn_indi_cam4_tb_delete; + press_bmpmask = EMbmGlxiconsQgn_indi_cam4_tb_delete_mask; + helptxt = qtn_lgal_tooltip_delete; + } + }; + }; + } + + }; + } +// ----------------------------------------------------------------------------- +// resource for metadata msk edit +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_msk_edit + { + buf = qtn_msk_edit; + } + +// ----------------------------------------------------------------------------- +// resource for metadata msk add +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_msk_add + { + buf = qtn_msk_add; + } + +// ----------------------------------------------------------------------------- +// resource for metadata msk blank +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_msk_blank + { + buf = " "; + } + +// ------------------------------------------------------------------------------------ +// Single Line meta pane resource +// ------------------------------------------------------------------------------------ +RESOURCE TBUF r_glx_completion_add_to_favourites + { + //buf = qtn_lgal_note_added_to_favourites; + buf = "#Added to Favourites"; + } + +RESOURCE TBUF r_glx_completion_rem_from_favourites + { + //buf = qtn_lgal_note_remove_from_favourites; + buf = "#Removed from Favourites"; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/data/icon4.png Binary file photosgallery/viewframework/uiutilities/data/icon4.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/data/listbox_bar.png Binary file photosgallery/viewframework/uiutilities/data/listbox_bar.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/data/listbox_thumb.png Binary file photosgallery/viewframework/uiutilities/data/listbox_thumb.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/data/selector.png Binary file photosgallery/viewframework/uiutilities/data/selector.png has changed diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/eabi/glxuiutilitiesu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/eabi/glxuiutilitiesu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +EXPORTS + _ZN13CGlxUiUtility12TextStyleIdLEii @ 1 NONAME + _ZN13CGlxUiUtility14IsExitingStateEv @ 2 NONAME + _ZN13CGlxUiUtility14IsPenSupportedEv @ 3 NONAME + _ZN13CGlxUiUtility15GetGridIconSizeEv @ 4 NONAME + _ZN13CGlxUiUtility15HideAlfDisplayLEv @ 5 NONAME + _ZN13CGlxUiUtility15ScreenFurnitureEv @ 6 NONAME + _ZN13CGlxUiUtility15SetExitingStateEi @ 7 NONAME + _ZN13CGlxUiUtility15ShowAlfDisplayLEv @ 8 NONAME + _ZN13CGlxUiUtility17GlxTextureManagerEv @ 9 NONAME + _ZN13CGlxUiUtility18SetAppOrientationLE15TGlxOrientation @ 10 NONAME + _ZN13CGlxUiUtility19GetRotatedImageSizeEv @ 11 NONAME + _ZN13CGlxUiUtility19SetRotatedImageSizeE5TSize @ 12 NONAME + _ZN13CGlxUiUtility22AddSkinChangeObserverLER22MGlxSkinChangeObserver @ 13 NONAME + _ZN13CGlxUiUtility22HandleTvStatusChangedLE13TTvChangeType @ 14 NONAME + _ZN13CGlxUiUtility23ViewNavigationDirectionEv @ 15 NONAME + _ZN13CGlxUiUtility24RemoveSkinChangeObserverER22MGlxSkinChangeObserver @ 16 NONAME + _ZN13CGlxUiUtility26SetViewNavigationDirectionE23TGlxNavigationDirection @ 17 NONAME + _ZN13CGlxUiUtility30VisibleItemsInPageGranularityLEv @ 18 NONAME + _ZN13CGlxUiUtility5CloseEv @ 19 NONAME + _ZN13CGlxUiUtility8UtilityLEv @ 20 NONAME + _ZN14GlxSetAppState8AppStateEv @ 21 NONAME + _ZN14GlxSetAppState8SetStateE12TGlxAppState @ 22 NONAME + _ZN18CGlxTextEntryPopup15SetLeftSoftKeyLEi @ 23 NONAME + _ZN18CGlxTextEntryPopup4NewLERK7TDesC16R6TDes16 @ 24 NONAME + _ZN18CGlxTextEntryPopup9ExecuteLDEv @ 25 NONAME + _ZN19CGlxScreenFurniture11SetTooltipLEiN10CAknButton16TTooltipPositionERK7TDesC16 @ 26 NONAME + _ZN19CGlxScreenFurniture13SetActiveViewEi @ 27 NONAME + _ZN19CGlxScreenFurniture15ViewDeactivatedEi @ 28 NONAME + _ZN19CGlxScreenFurniture16ModifySoftkeyIdLEN24CEikButtonGroupContainer16TCommandPositionEiiRK7TDesC16 @ 29 NONAME + _ZN19CGlxScreenFurniture18SetToolbarPositionEv @ 30 NONAME + _ZN19CGlxScreenFurniture20SetToolbarItemDimmedEii @ 31 NONAME + _ZN19CGlxScreenFurniture20SetToolbarVisibilityEi @ 32 NONAME + _ZN19CGlxScreenFurniture24SetToolbarItemVisibilityEii @ 33 NONAME + _ZN19CGlxScreenFurniture4NewLER13CGlxUiUtility @ 34 NONAME + _ZN19CGlxScreenFurniture5NewLCER13CGlxUiUtility @ 35 NONAME + _ZN19CGlxScreenFurniture9SetFocusLEi @ 36 NONAME + _ZN19GlxAnimationFactory20CreateViewAnimationLE23TGlxViewswitchAnimation23TGlxNavigationDirectionP16CAlfControlGroup @ 37 NONAME + _ZN19GlxAnimationFactory20CreateViewAnimationLE23TGlxViewswitchAnimation23TGlxNavigationDirectionR13RPointerArrayI16CAlfControlGroupE @ 38 NONAME + _ZN19GlxAnimationFactory28CreateImageLoadingAnimationLER10CAlfVisualR11CAlfTexture @ 39 NONAME + _ZN21GlxAttributeRetriever9RetrieveLERK16MGlxFetchContextR13MGlxMediaListi @ 40 NONAME + _ZN21GlxGeneralUiUtilities11IsLandscapeEv @ 41 NONAME + _ZN21GlxGeneralUiUtilities12FormatStringER6TDes16RK7TDesC16iii @ 42 NONAME + _ZN21GlxGeneralUiUtilities13ConfirmQueryLERK7TDesC16 @ 43 NONAME + _ZN21GlxGeneralUiUtilities13ConfirmQueryLEiRK7TDesC16 @ 44 NONAME + _ZN21GlxGeneralUiUtilities13ShowInfoNoteLERK7TDesC16i @ 45 NONAME + _ZN21GlxGeneralUiUtilities14ShowErrorNoteLERK7TDesC16i @ 46 NONAME + _ZN21GlxGeneralUiUtilities14ShowErrorNoteLEi @ 47 NONAME + _ZN21GlxGeneralUiUtilities16LayoutIsMirroredEv @ 48 NONAME + _ZN21GlxGeneralUiUtilities21ShowConfirmationNoteLERK7TDesC16i @ 49 NONAME + _ZN27CGlxActiveMediaListRegistry23RegisterActiveMediaListEP13MGlxMediaList @ 50 NONAME + _ZN27CGlxActiveMediaListRegistry25DeregisterActiveMediaListEP13MGlxMediaList @ 51 NONAME + _ZN27CGlxActiveMediaListRegistry9InstanceLEP33MGlxActiveMediaListChangeObserver @ 52 NONAME + _ZN27MGlxActiveMediaListResolver9InstanceLEP33MGlxActiveMediaListChangeObserver @ 53 NONAME + _ZNK13CGlxUiUtility11DisplaySizeEv @ 54 NONAME + _ZNK13CGlxUiUtility14AppOrientationEv @ 55 NONAME + _ZNK13CGlxUiUtility3EnvEv @ 56 NONAME + _ZNK13CGlxUiUtility7DisplayEv @ 57 NONAME + _ZTI13CGlxUiUtility @ 58 NONAME + _ZTI17CGlxAnimationView @ 59 NONAME + _ZTI18CGlxAnimationTimed @ 60 NONAME + _ZTI18CGlxTextEntryPopup @ 61 NONAME + _ZTI21CGlxSkinChangeMonitor @ 62 NONAME + _ZTI25CGlxAnimationImageLoading @ 63 NONAME + _ZTI32CGlxWaitDialogAttributeRetriever @ 64 NONAME + _ZTI33CGlxSynchronousAttributeRetriever @ 65 NONAME + _ZTV13CGlxUiUtility @ 66 NONAME + _ZTV17CGlxAnimationView @ 67 NONAME + _ZTV18CGlxAnimationTimed @ 68 NONAME + _ZTV18CGlxTextEntryPopup @ 69 NONAME + _ZTV21CGlxSkinChangeMonitor @ 70 NONAME + _ZTV25CGlxAnimationImageLoading @ 71 NONAME + _ZTV32CGlxWaitDialogAttributeRetriever @ 72 NONAME + _ZTV33CGlxSynchronousAttributeRetriever @ 73 NONAME + _ZThn4_N13CGlxUiUtility22HandleTvStatusChangedLE13TTvChangeType @ 74 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Build information for subsystem UI utilities. +* +*/ + + + + +PRJ_EXPORTS + +PRJ_MMPFILES +glxuiutilities.mmp +PRJ_TESTMMPFILES +//../test/group/ut_cglxactivemedialistregistry.mmp +//../test/group/t_glxvisualutilities +//../test/t_cglxuiutility/t_cglxuiutility.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/group/glxuiutilities.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/group/glxuiutilities.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include + +#include "../../../group/glxbuildcommon.mmh" + +TARGET glxuiutilities.dll +TARGETTYPE dll +UID 0x1000008d 0x20000A08 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src + +SOURCE glxactivemedialistregistry.cpp +SOURCE glxanimationfactory.cpp +SOURCE glxanimationimageloading.cpp +SOURCE glxanimationtimed.cpp +SOURCE glxanimationview.cpp +SOURCE glxattributeretriever.cpp +SOURCE glxgeneraluiutilities.cpp +SOURCE glxuiutility.cpp +SOURCE glxscreenfurniture.cpp +SOURCE glxsetappstate.cpp +SOURCE glxtextentrypopup.cpp +SOURCE mglxactivemedialistresolver.cpp +SOURCE glxskinchangemonitor.cpp + +// System includes from epoc32/include +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../common/inc +SYSTEMINCLUDE ../../../commonui/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../gallery/loc +SYSTEMINCLUDE ../../commandhandlers/inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../medialists/inc +SYSTEMINCLUDE ../../texturemanager/inc +SYSTEMINCLUDE ../../tvout/inc // for GlxTvOut + +SOURCEPATH ../data + +START RESOURCE glxuiutilities.rss +HEADER +TARGETPATH /resource/apps +LANGUAGE_IDS +END // RESOURCE + +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknskins.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY cdlengine.lib +LIBRARY centralrepository.lib // For CGlxSettingsModel +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY eikdlg.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY featmgr.lib // For FeatureManager::FeatureSupported +LIBRARY gdi.lib +LIBRARY glxcommon.lib // for CGlxResolutionManager +LIBRARY glxcommonui.lib // for +LIBRARY glxtexturemanager.lib +LIBRARY alfclient.lib // For Alfred Hitchcock framework +LIBRARY hlplch.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY ws32.lib +LIBRARY glxtvout.lib // for TV out notificaions +LIBRARY libpthread.lib +// Uiaccelerator related libraries +LIBRARY osncore.lib +LIBRARY alfwidgetmodel.lib +// MUL related libraries +LIBRARY mulmodelutility.lib //For Visual Item and Filter action item +//for handling the Ustring memory leak +LIBRARY libc.lib +LIBRARY libglib.lib +LIBRARY libstdcpp.lib +LIBRARY flogger.lib +//LIBRARY hgcontextutility.lib // For Teleport +// EXPORTUNFROZEN + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxactivemedialistregistry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxactivemedialistregistry.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2008-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: Class that stores the active media list pointer +* +*/ + + + + +#ifndef __C_GLXACTIVEMEDIALISTREGISTRY_H__ +#define __C_GLXACTIVEMEDIALISTREGISTRY_H__ + +#include +#include + +#include "mglxactivemedialistresolver.h" + +class MGlxMediaList; +class MGlxActiveMediaListChangeObserver; + +/** + * Class to store the active media list + */ +NONSHARABLE_CLASS( CGlxActiveMediaListRegistry ) : public CBase, public MGlxActiveMediaListResolver + { +public: + /** + * Return a (singleton) instance of the interface + * Close the instance by calling Close() when done with the instance + * @param aObserver Observer to add + */ + IMPORT_C static CGlxActiveMediaListRegistry* InstanceL( + MGlxActiveMediaListChangeObserver* aObserver = NULL); + + /** + * Close the instance and remove observer if any + * See @ref MGlxActiveMediaListResolver::Close + * @param aObserver Observer to remove + */ + void Close(MGlxActiveMediaListChangeObserver* aObserver = NULL); + + /** + * Registers a media list as being active + * Calls MGlxActiveMediaListChangeObserver::HandleActiveMediaListChanged + * @param aMediaList list to register as active + */ + IMPORT_C void RegisterActiveMediaList(MGlxMediaList* aMediaList); + + /** + * Deregisters a media list that has previously registerd as active + * Takes a pointer to the media list, so that implementation can + * know if the deregistration refers to a list that has been registered + * before the currenlty active list has been registered. + * The background is that the DoDeactivateL of the previous view + * is called after the DoActivateL of the new view. + * Note: This must be called while the media list is still alive, + * i.e., not closed! + * If no other media list has been registered, the currently active + * media list will be set to NULL. + * Calls MGlxActiveMediaListChangeObserver::HandleActiveMediaListChanged + * @param aMediaList list to deregister as active + */ + IMPORT_C void DeregisterActiveMediaList(MGlxMediaList* aMediaList); + + /** + * See @ref MGlxActiveMediaListResolver::ActiveMediaList + * @return the active media list + */ + MGlxMediaList* ActiveMediaList() const; + +private: + /** + * Constructor + */ + CGlxActiveMediaListRegistry(); + + /** + * Destructor + */ + ~CGlxActiveMediaListRegistry(); + + /** + * Notify observers of change to the list pointer + */ + void NotifyObservers(); + + /** + * 2-phase constructor + */ + static CGlxActiveMediaListRegistry* NewL(); + +private: + /** + * The list in the currently open view that the user is navigating, or + * NULL if that media list is not known + */ + MGlxMediaList* iActiveMediaList; + + /** + * True if two views have registered the currently active list + * Allows the current and previous view to register the same list + */ + TBool iRegisteredTwice; + + /** List of observers */ + RPointerArray iObservers; + }; + +#endif // __C_GLXACTIVEMEDIALISTREGISTRY_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxanimationfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxanimationfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2008-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: Factory for gallery animations +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by Michael Yip + */ + +#ifndef GLXANIMATIONFACTORY_H +#define GLXANIMATIONFACTORY_H + +#include "glxuiutility.h" + +class CAlfControlGroup; +class MGlxAnimation; +class CAlfVisual; +class CAlfTexture; + +/** + * View switching animation types + */ +enum TGlxViewswitchAnimation + { + EGlxViewAnimationNone, + EGlxViewAnimationEntry, + EGlxViewAnimationExit + }; + +/** + * Factory class to create animation instances + */ +class GlxAnimationFactory + { +public: + /** + * Create a view-switch animation + * @param aAnimType Type of animation (e.g. entry / exit) + * @param aDirection Direction of animation (e.g. forwards / backwards) + * @param aControlGroup The control group to animate + * @return The requested animation + */ + IMPORT_C static MGlxAnimation* CreateViewAnimationL( + TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection, + CAlfControlGroup* aControlGroup); + + /** + * Create a view-switch animation + * @param aAnimType Type of animation (e.g. entry / exit) + * @param aDirection Direction of animation (e.g. forwards / backwards) + * @param aControlGroups List of control groups to animate + * @return The requested animation + */ + IMPORT_C static MGlxAnimation* CreateViewAnimationL( + TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection, + RPointerArray& aControlGroups); + + /** + * Create an image-loading animation + * @param aVisual The visual that the image has been loaded into + * @param aFlashTexture The texture to use for the "flash" effect + * @return The requested animation + */ + IMPORT_C static MGlxAnimation* CreateImageLoadingAnimationL( + CAlfVisual& aVisual, + CAlfTexture& aFlashTexture); + }; + +#endif // GLXANIMATIONFACTORY_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxanimationimageloading.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxanimationimageloading.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2008-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: Image loading animation +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Michael Yip + */ + +#ifndef GLXANIMATIONIMAGELOADING_H +#define GLXANIMATIONIMAGELOADING_H + +#include "glxanimationtimed.h" + +class CAlfVisual; +class CAlfTexture; +class CAlfImageBrush; + +/** + * Animation for a newly-loaded image + */ +class CGlxAnimationImageLoading : public CGlxAnimationTimed + { +public: + /** + * Two-phase constructor + * @param aVisual The visual that the image has been loaded into + * @param aFlashTexture The texture to use for the "flash" effect + * @return The requested animation + */ + static CGlxAnimationImageLoading* NewL( + CAlfVisual& aVisual, + CAlfTexture& aFlashTexture); + + /** + * Destructor + */ + ~CGlxAnimationImageLoading(); + + + private: // From CGlxAnimationTimed + + void StartTimedAnimationL( TInt aTime ); + +private: + /** + * Second-phase construction + */ + void ConstructL(); + + /** + * Constructor + * @param aVisual The visual that the image has been loaded into + * @param aFlashTexture The texture to use for the "flash" effect + */ + CGlxAnimationImageLoading(CAlfVisual& aVisual, + CAlfTexture& aFlashTexture); + +private: + /// Ref: The visual that the image has been loaded into + CAlfVisual& iVisual; + + /// Ref: The texture to use for the "flash" effect + CAlfTexture& iFlashTexture; + + /// Own: The image brush used for the flash effect + CAlfImageBrush* iImageBrush; + }; + + +#endif // GLXANIMATIONIMAGELOADING_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxanimationtimed.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxanimationtimed.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008-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: Base class for timed animations +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Michael Yip + */ + +#ifndef C_GLXANIMATIONTIMED_H +#define C_GLXANIMATIONTIMED_H + +#include + +// INTERNAL INCLUDES +#include "mglxanimation.h" + +// FORWARD DECLARES +class CGlxUiUtility; + +/** + * Base class for timed animations + */ +class CGlxAnimationTimed : public CBase, public MGlxAnimation, public MAlfEventHandler + { + public: + /** + * Constructor + */ + CGlxAnimationTimed(); + + /** + * Destructor + */ + ~CGlxAnimationTimed(); + + private: // From MGlxAnimation + void AnimateL( TInt aTime, MGlxAnimationObserver* aObserver ); + + private: // From MAlfEventHandler + TBool OfferEventL( const TAlfEvent &aEvent ); + + protected: + + /** + * Start the animation using the supplied timed value + * @param aTimer Timer to use for the animation. @see MGlxAnimation::AnimateL + */ + virtual void StartTimedAnimationL( TInt aTime ) = 0; + + private: + /// Ref: Observer to animation, if any + MGlxAnimationObserver* iObserver; + + /// Own: The Alf utility + CGlxUiUtility* iUiUtility; + + /// Whether an animation is in progress + TBool iTimedAnimationInProgress; + }; + +#endif // C_GLXANIMATIONTIMED_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxanimationview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxanimationview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: View-transition animations +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Michael Yip + */ + +#ifndef GLXANIMATIONVIEW_H +#define GLXANIMATIONVIEW_H + +#include "glxanimationtimed.h" +#include "glxanimationfactory.h" + +/** + * Implementation of View-switch animations + */ +class CGlxAnimationView : public CGlxAnimationTimed + { +public: + /** + * Two-phase construction + * @param aAnimType Type of animation (e.g. entry / exit) + * @param aDirection Direction of animation (e.g. forwards / backwards) + * @param aControlGroups List of the control groups to animate + * @return The requested animation + */ + static CGlxAnimationView* NewL( + TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection, + const RPointerArray& aControlGroups); + + /** + * Destructor + */ + ~CGlxAnimationView(); + + private: // From CGlxAnimationTimed + + void StartTimedAnimationL( TInt aTime ); + +private: + /** + * Second-phase construction + * @param aControlGroups List of the control groups to animate + */ + void ConstructL(const RPointerArray& aControlGroups); + + /** + * Constructor + * @param aAnimType Type of animation (e.g. entry / exit) + * @param aDirection Direction of animation (e.g. forwards / backwards) + */ + CGlxAnimationView(TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection); + +private: + /// The type of animation + TGlxViewswitchAnimation iAnimType; + + /// Direction of navigation + TGlxNavigationDirection iDirection; + + /// Control groups to animate (array members not owned) + RPointerArray iControlGroups; + }; + +#endif // GLXANIMATIONVIEW_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxattributeretriever.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxattributeretriever.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2008-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: Blocking attribute retriever +* +*/ + + + + +#ifndef C_GLXATTRIBUTERETRIEVER_H +#define C_GLXATTRIBUTERETRIEVER_H + +#include +#include "mglxmedialistobserver.h" + +// Forward declarations +class MGlxFetchContext; +class MGlxMediaList; +class CGlxAttributeRetrieverObj; + +const TInt KGlxFetchContextPriorityBlocking = KMaxTInt32; + +/** + * GlxAttributeRetriever + * + * This class blocks until all requested metadata has been retrieved + * + * @ingroup mlm_media_list_manager_design + * @lib glxuiutilities.lib + */ +NONSHARABLE_CLASS( GlxAttributeRetriever ) + { +public: + /** + * Retrieves all metadata required by the context + * @param aContext Fetch context that informs what metadata needs to be retrieved + * @param aList List for which metadata is required for + * @param aShowDialog Whether to show a wait dialog while retrieval takes place. Should only + * be false if there is another wait dialog already active + * @return Error code + */ + IMPORT_C static TInt RetrieveL(const MGlxFetchContext& aContext, MGlxMediaList& aList, TBool aShowDialog = ETrue); + }; + +#endif // C_GLXATTRIBUTERETRIEVER_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxgeneraluiutilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxgeneraluiutilities.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2008-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: general utitities +* +*/ + + + + +#ifndef __GLXGENERALUIUTILITIES_H__ +#define __GLXGENERALUIUTILITIES_H__ + +// INCLUDE FILES +#include +#include + +/** + * General utilties class definition + * + * @lib glxuiutilities.lib + */ +NONSHARABLE_CLASS(GlxGeneralUiUtilities) + { +public: + /** + * Used to display error by displaying a dialog + * @param aError the error to display + */ + IMPORT_C static void ShowErrorNoteL(TInt aError); + + /** + * Confirmation dialog wrapper + * @param aQueryResourceId the resource id of the dialog + * @param aTitleText the text to display on the dialog + * @return error + */ + IMPORT_C static TBool ConfirmQueryL( TInt aQueryResourceId, const TDesC& aTitleText ); + + /** + * Confirmation dialog wrapper + * @param aTitleText the text to display on the dialog + * @return error + */ + IMPORT_C static TBool ConfirmQueryL( const TDesC& aTitleText ); + + /** + * Information note wrapper + * @param aInfoText the string to display + * @param aWaitingDialog whether the dialog is waiting or not + */ + IMPORT_C static void ShowInfoNoteL( const TDesC& aInfoText, TBool aWaitingDialog ); + + /** + * Information note wrapper + * @param aInfoText the string to display + * @param aWaitingDialog whether the dialog is waiting or not + */ + IMPORT_C static void ShowErrorNoteL( const TDesC& aInfoText, TBool aWaitingDialog ); + + /** + * Confirmation note wrapper + * @param aInfoText the string to display + * @param aWaitingDialog whether the dialog is waiting or not + */ + IMPORT_C static void ShowConfirmationNoteL( const TDesC& aInfoText, TBool aWaitingDialog ); + + /** + * Formats the given source buffer and stores the formatted + * presentation into destination buffer + * @param aDestination Destination buffer for the formatted string + * @param aSource Unformatted source buffer + * @param aPosition The index of the key string. + * @param aNumber the replacing TInt. + * @param aNumberConversion, ETrue if language specific number conversion + * should be applied to aDestination after formatting + */ + IMPORT_C static void FormatString( TDes& aDestination, + const TDesC& aSource, + TInt aPosition, + TInt aNumber, + TBool aNumberConversion ); + + /** + * Checks whether the screen is in landscape or portrait + * @return indicates whether screen is in landscape + */ + + IMPORT_C static TBool IsLandscape(); + + + /** + * Wrapper of AknLayoutUtils::LayoutMirrored() + * allows result to be forced for tesing purposes + * @return indicates if layout should be mirrored + */ + IMPORT_C static TBool LayoutIsMirrored(); + }; + +#endif // __GLXGENERALUIUTILITIES_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxscreenfurniture.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxscreenfurniture.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2008-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: Screenfurniture interface. Used to show/hide UI or +* enable/disable induvidual screenfurniture items. Contains +* softkeys, toolbar and the title statuspane as part of it. +* +*/ + + + + +#ifndef C_GLXSCREENFURNITURE_H +#define C_GLXSCREENFURNITURE_H + +#include "glxuiutility.h" + +#include +#include +#include + +/** + * CGlxScreenFurniture + * + * ScreenFurniture is responsible for handling the floating toolbar for + * non-touch + * + * @lib glxuiutils.lib + */ +NONSHARABLE_CLASS( CGlxScreenFurniture ): public CBase, + public MAknToolbarObserver + { + +public: + /** + * Two-phased constructor + * @param aParentUtility Instance of CGlxUiUtility used to create this + * @return Constructed object + */ + IMPORT_C static CGlxScreenFurniture* NewL( CGlxUiUtility& aParentUtility ); + + /** + * Two-phased constructor + * @param aParentUtility Instance of CGlxUiUtility used to create this + * @return Constructed object + */ + IMPORT_C static CGlxScreenFurniture* NewLC( CGlxUiUtility& aParentUtility ); + + /** + * Set the ID of the currently active view. Call this in DoActivateL(). + * @param aViewId The view that is trying to control the screen furniture + */ + IMPORT_C void SetActiveView( TInt aViewId); + + /** + * Lets the screen furniture know that a view has been deactivated. + * If no other views are Active, the screen furniture will turn itself off. + * Call this in DoDeactivate(). + * @param aViewId The view that is trying to control the screen furniture + */ + IMPORT_C void ViewDeactivated( TInt aViewId); + + /** + * To set the toolbar visibility + * @param aVisible Whether toolbar should be visible or not. + * @param aFocus Whether focus is required by default + */ + IMPORT_C void SetToolbarVisibility(TBool aVisible); + + /** + * To set the item specific visibility + * @param aCommand The command that should be shown or hidden + * @param aVisible ETrue if item needs to be shown else EFalse + */ + IMPORT_C void SetToolbarItemVisibility( TInt aCommand, TBool aVisible ); + + /** + * To set the command dimmed + * @param aCommand The command that should be dimmed + * @param aDimmed ETrue if command needs to be dimmed. + */ + IMPORT_C void SetToolbarItemDimmed( TInt aCommand, TBool aDimmed ); + + /** + * To set the focus of the toolbar + * @param aCommand The command that should be focused. + */ + IMPORT_C void SetFocusL( TInt aCommand ); + + /** + * Set the toolbar position w.r.t the screen area * + */ + IMPORT_C void SetToolbarPosition(); + + /** + * Sets the tooltip position of each toolbar item. + * @param aCommand Command Id + * @param aPos Position of the tooltip to be set. + EPositionTop = 1, Tool tip alignment vertically to top + EPositionBottom, Tool tip alignment vertically to bottom + EPositionLeft, Tool tip alignment horizontally to left + EPositionRight, Tool tip alignment horizontally to right + */ + IMPORT_C void SetTooltipL( TInt aCommand, + CAknButton::TTooltipPosition aToolTipPos, const TDesC& aToolTipText = KNullDesC); + + /** + * This will be called for changing softkeys(MSK and RSK) and providing commands to them + */ + IMPORT_C void ModifySoftkeyIdL(CEikButtonGroupContainer::TCommandPosition aPosition, TInt aCommandId, TInt aResourceId, const TDesC& aText= KNullDesC ); + + /** + * Destructor + */ + ~CGlxScreenFurniture(); + +private: + /** + * Default constructor + */ + CGlxScreenFurniture( CGlxUiUtility& aParentUtility ); + + /** + * ConstructL + */ + void ConstructL(); + +private: //From MAknToolbarObserver + void OfferToolbarEventL( TInt aCommand ); + void SetToolbarObserver(MAknToolbarObserver* aObserver); + +private: + /// The ID of the view currently using the screen furniture + TInt iActiveView; + + // Resource offset + TInt iResourceOffset; + + /// Parent UiUtility reference + CGlxUiUtility& iParentUtility; + + /// Avkon floating toolbar with focus (Owned) + CAknToolbar* iToolbar; + }; + +#endif /*C_GLXSCREENFURNITUREIMPL_H*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxscrollbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxscrollbar.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2008-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: Scrollbar +* +*/ + + + + +#ifndef C_GLXSCROLLBAR_H +#define C_GLXSCROLLBAR_H + +#include + +class MGlxScrollbarObserver; +class CAlfControl; +class CAlfLayout; +class CAlfAnchorLayout; +class CGlxTextureManager; + +/** + * CGlxScrollbar + * + * Class to handle controlling/drawing of scrollbar + * + * Example: Scrollbar required for list with 10 items, with 3 visible items + * The first visible row is at position 0. + * The position is always from 0 to (full length - 1). + * + * Client calls: + * + * SetFullLength(10) + * SetVisibleLength(3) + * SetPosition(0) + * + * @lib glxuiutilities.lib + * + * @author Michael Yip + */ +class CGlxScrollbar : public CBase + { +public: + /** + * Two phase constructor + * + * @param aControl The Alf control + * @param aParentLayout The Alf layout that owns this scrollbar + */ + IMPORT_C static CGlxScrollbar* NewL(CAlfControl& aControl, CAlfLayout& aParentLayout); + + /** + * Two phase constructor + * + * @param aControl The Alf control + * @param aParentLayout The Alf layout that owns this scrollbar + */ + IMPORT_C static CGlxScrollbar* NewLC(CAlfControl& aControl, CAlfLayout& aParentLayout); + + /** + * Add an observer to observe scrollbar + * Observers are notified if the scrollbar is scrollable + * + * @param aObserver The observer + */ + IMPORT_C void AddObserverL(MGlxScrollbarObserver* aObserver); + + /** + * Remove an observer + * + * @param aObserver The observer + */ + IMPORT_C void RemoveObserver(MGlxScrollbarObserver* aObserver); + + /** + * Sets the visible length of the scrollbar + * + * @param aVisibleLength The visible length + */ + IMPORT_C void SetVisibleLength(TUint aVisibleLength); + + /** + * Sets the full length of the scrollbar + * + * @param aFullLength The full length + * @param aTransitionTime The transition time in milliseconds if any animation is required + */ + IMPORT_C void SetFullLength(TUint aFullLength, TUint aTransitionTime = 0); + + /** + * Sets the position of the first visible row in the full length + * + * @param aPosition The position + * @param aTransitionTime The transition time in milliseconds if any animation is required + */ + IMPORT_C void SetPosition(TUint aPosition, TUint aTransitionTime = 0); + + /** + * Destructor + */ + ~CGlxScrollbar(); + +private: + /** + * Constructor + */ + CGlxScrollbar(); + + /** + * Two phase constructor + * + * @param aControl The Alf control + * @param aParentLayout The Alf layout that owns this scrollbar + */ + void ConstructL(CAlfControl& aControl, CAlfLayout& aParentLayout); + + /** + * Set the textures for the visuals + */ + void SetTexturesL(); + + /** + * Set the textures for the visuals in the background layout + * + * @param aTextureManager The texture manager for creating textures + */ + void SetBackgroundTexturesL(CGlxTextureManager& aTextureManager); + + /** + * Set the textures for the visuals in the thumb layout + * + * @param aTextureManager The texture manager for creating textures + */ + void SetThumbTexturesL(CGlxTextureManager& aTextureManager); + + /** + * Set the background or thumb layout anchors + * + * @param aLayout The anchor layout to set the anchors for + */ + void SetAnchors(CAlfAnchorLayout& aLayout); + + /** + * Update the scrollbar + * + * @param aTransitionTime The transition time in milliseconds if any animation is required + */ + void Update(TUint aTransitionTime = 0); + + /** + * Notify observers if the scrollbar is scrollable + */ + void NotifyObservers(); + +private: + /// The Alf layout for the scrollbar + /// Ownership passed to parent layout + CAlfLayout* iLayout; + + /// The visible length of the scrollbar + TUint iVisibleLength; + + /// The full length of the scrollbar + TUint iFullLength; + + /// The position of the first visible row in the full length + TUint iPosition; + + /// Observers of the scrollbar + RPointerArray iObservers; + }; + +#endif // C_GLXSCROLLBAR_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxsetappstate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxsetappstate.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008-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: Update PCFW with current application state +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by David Holland + */ + + +#ifndef GLXSETAPPSTATE_H +#define GLXSETAPPSTATE_H + +#include + +// DATA TYPES +/** +* Supported application states +*/ +enum TGlxAppState + { + EGlxAppStateUndefined, + EGlxInCarouselView, + EGlxInFullScreenView, + EGlxInZoomedView, + EGlxInVideoPlaybackView, + EGlxInSlideshowView, + EGlxInListView, + EGlxInTagBrowserView, + EGlxInMapBrowserView, + EGlxInTextEntry + }; + +/** + * GlxSetAppState + * + * Update PCFW with current application state + * + * @lib glxuiutilities.lib + */ +class GlxSetAppState + { +public: + /** + * Set Gallery KPCFWAppStatePSUid with current app state + * @param aAppState new app state + */ + IMPORT_C static void SetState(TGlxAppState aAppState); + + /** + * Get current value of Gallery KPCFWAppStatePSUid + * @return aAppState new app state + */ + IMPORT_C static TGlxAppState AppState(); + }; + +#endif // GLXSETAPPSTATE_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxsfitems.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxsfitems.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,39 @@ +/* +* 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: header files for softkeys enum +* +*/ + + + +#ifndef GLXSFTEMS_H_ +#define GLXSFTEMS_H_ + +enum TGlxSfItem + { + EGlxSfItemTitle = 0, + EGlxSfItemSoftkey1, + EGlxSfItemSoftkey2, + EGlxSfItemToolbar + }; + + +const TInt KSoftkey1 = 1; +const TInt KSoftkey2 = 2; + +const TInt KToolBarItem1 = 0; +const TInt KToolBarItem2 = 1; +const TInt KToolBarItem3 = 2; + +#endif /*GLXSFTEMS_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxsimpleobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxsimpleobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2008-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: Simple observer interface. +* +*/ + + + + +#ifndef GLXSIMPLEOBSERVER_H +#define GLXSIMPLEOBSERVER_H + +#include "glxsimpleobserverevents.h" + +/** + * MGlxSimpleObserver + * + * Simple observer interface. Only classes implementing this can register with MGlxSimpleObservable classes. + * + * @lib glxuiutils.lib + */ +class MGlxSimpleObserver + { +public: + /** + * Receive a broadcast event from an MGlxSimpleObservable class. + * @param aEvent The event received + */ + virtual void HandleObservedEvent( TGlxSimpleObserverEvent aEvent ) = 0; + }; + + +#endif // GLXSIMPLEOBSERVER_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxsimpleobserverevents.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxsimpleobserverevents.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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: Screen Furniture cross-fader utility +* +*/ + + + + +#ifndef GLXSIMPLEOBSERVEREVENTS_H +#define GLXSIMPLEOBSERVEREVENTS_H + +class MGlxSimpleObservable; + +/** +* Simple-observer event codes +* @bug minor:drhodes:26/09/07:Most of these events are not used and should be removed +*/ +enum TGlxSimpleObserverEventCode + { + // Universal events + EGlxObservableDestroyed, + + // Screen Furniture related events + EGlxSfUiHidden, + EGlxSfUiShown, + EGlxSfKeyCaptured, + EGlxSfCourtesyTimerComplete, + EGlxSfTitleCourtesyTimerComplete, + EGlxSfNavipaneCourtesyTimerComplete, + EGlxSfLeftSoftkeyCourtesyTimerComplete, + EGlxSfRightSoftkeyCourtesyTimerComplete, + EGlxSfMiddleSoftkeyCourtesyTimerComplete, + EGlxSfLayoutUpdated, + + // Media List Existence events + EGlxMvbMediaListCreated, + EGlxMvbMediaListDestroyed + + }; + +/** +* TGlxSimpleObserverEvent +* +* The event sent by MGlxSimpleObservable objects to MGlxSimpleObserver objects. +* Contains the address of the broadcaster, and an event code. +*/ +struct TGlxSimpleObserverEvent + { + /** + * Constructor + * @param aBroadcaster Address of the broadcaster + * @param aEventCode Event code to send + */ + TGlxSimpleObserverEvent(MGlxSimpleObservable* aBroadcaster, TGlxSimpleObserverEventCode aEventCode) + { + iBroadcaster = aBroadcaster; + iEventCode = aEventCode; + } + + /// The broadcaster + MGlxSimpleObservable* iBroadcaster; + + /// The event code being broadcast + TGlxSimpleObserverEventCode iEventCode; + }; + +#endif // GLXSIMPLEOBSERVEREVENTS_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxskinchangemonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxskinchangemonitor.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: CoeControl utility for monitoring skin change +* +*/ + + + + + +#ifndef C_GLXSKINCHANGEMONITOR_H +#define C_GLXSKINCHANGEMONITOR_H + +#include +#include +#include "mglxskinchangeobserver.h" + +/** + * CGlxSkinChangeMonitor + * + * Utility to handle skin changes. + * + * @lib + * + * @internal reviewed + */ +class CGlxSkinChangeMonitor : public CCoeControl + { + + /* for unit testing */ + friend class t_glxskinchangemonitor; + friend class t_cglxhuiutility; + + public: // the API + + virtual ~CGlxSkinChangeMonitor(); + + /** + * Two-phased constructor. + * + * @return Pointer + */ + static CGlxSkinChangeMonitor* NewL(); + + + + private: // Implementation + + /** + * C++ constructor + * @param aEnv the Hui environment + */ + CGlxSkinChangeMonitor(); + + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + + public: + /** + * Handles resource change. From CCoeControl + * + * @ref CCoeControl::HandleResourceChange + */ + void HandleResourceChange( TInt aType ); + + /** + *Add MGlxSkinChangeObserver to skin change observers array. + *@param aObserver Reference of the MGlxSkinChangeObserver. + */ + void AddSkinChangeObserverL( MGlxSkinChangeObserver& aObserver ); + + /** + *Remove MGlxSkinChangeObserver from skin change observers array. + *@param aObserver Reference of the MGlxSkinChangeObserver. + */ + void RemoveSkinChangeObserver( MGlxSkinChangeObserver& aObserver ); + + private: + + /** + * Observers that will be notified if skin is changed + * owned + */ + RPointerArray iSkinChangeObservers; + + }; + +#endif // C_GLXUIUTILITYCOECONTROL_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxtextentrypopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxtextentrypopup.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2008-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: text entry popup class +* +*/ + + + + +#ifndef __GLXTEXTENTRYPOPUP_H__ +#define __GLXTEXTENTRYPOPUP_H__ + +#include + +/** + * text entry popup class definition + * + * @lib glxuiutilities.lib + * + * @internal reviewed 06/06/2007 by Dave Schofield + */ +class CGlxTextEntryPopup : protected CAknTextQueryDialog + { +public: + + /** + * Creates a new CGlxTextEntryPopup. + * @param aTitle Dialog title. + * @param aText default dialog text + * on completion of ExecuteLD() contains text entered by user. + * @return a pointer to a new instance of CGlxTextEntryPopup. + */ + IMPORT_C static CGlxTextEntryPopup* NewL(const TDesC& aTitle, TDes& aText); + + /** + * calls the popup for text entry + * @return Zero, unless it is a waiting dialog. + * For a waiting dialog, the return value is the ID + * of the button that closed the dialog, or zero if + * it was the cancel button + */ + IMPORT_C TInt ExecuteLD(); + + /** + * Updates left softkey + */ + virtual void UpdateLeftSoftKeyL(); + + /** + * Sets left softkey based on conditions whether to make it visible or not + * @param aAllowEmptyString - bool to set the leftsoft key status + */ + IMPORT_C void SetLeftSoftKeyL(TBool aAllowEmptyString); + + +protected: + /** + * Constructor + * @param aText default dialog text + * on completion of ExecuteLD() contains text entered by user. + */ + CGlxTextEntryPopup(TDes& aText); + /** + * Second stage constructor + * @param aTitle Dialog title. + */ + void ConstructL(const TDesC& aTitle); + + /** + * Helper function to revert state in case anything leaves + * between state changes + */ + static void RollbackState( TAny* aParam ); +private: + //Bool which sets the leftsoftkey status + TBool iAllowEmptyString; + }; + +#endif // __GLXTEXTENTRYPOPUP_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxuiutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxuiutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,340 @@ +/* +* Copyright (c) 2008-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: ALF TK utilities +* +*/ + + + + +#ifndef C_GLXUIUTILITY_H +#define C_GLXUIUTILITY_H + +// external incudes +#include +#include + +#include //for action observers + +// Internal includes +#include // for inteface MGlxTvObserver + +// constants +const TUint KGlxDefaultVisibleItemsGranularity = 15; +const TUint KGlxQHDVisibleItemsGranularity = 20; +const TUint KGlxVGAVisibleItemsGranularity = 21; + +class MGlxSkinChangeObserver; +class CGlxSkinChangeMonitor; +class CCoeAppUi; +class CGlxSettingsModel; +class CGlxTextureManager; +class CAlfEnv; +class CAlfDisplay; +class CAlfTexture; +class CAlfControl; +class CGlxTv; +class CGlxResolutionManager; +class CGlxScreenFurniture; +//class CHgContextUtility; +/** + * Enumeration for different types of navigations that occur from one view to the next + */ +enum TGlxNavigationDirection + { + EGlxNavigationForwards, + EGlxNavigationBackwards, + EGlxNavigationNext, + EGlxNavigationPrevious + }; + +/** + * Enumeration for screen orientation of the application. + */ +enum TGlxOrientation + { + EGlxOrientationUninitialised, /**< For internal use only */ + EGlxOrientationDefault, /**< Default orientation for the device */ + EGlxOrientationTextEntry, /**< Text entry orientation for the device */ + EGlxOrientationLandscape /**< Landscape orientation */ + }; + +/** + * CGlxUiUtility + * + * Alf utils + * + * @lib glxalfutils.lib + * + * @internal reviewed 12/06/2007 by Dave Schofield + */ +class CGlxUiUtility : public CBase, + public MGlxTvObserver , // for TV Out + public MAlfActionObserver //FOR layout change notifications + { + +public: + /** + * Get the single instance of the utility and increment the reference count. + * The caller must call Close() when the utility is no longer needed. + * @return Pointer to the single instance of the UiUtility. + */ + IMPORT_C static CGlxUiUtility* UtilityL(); + + /** + * Decrement the reference count of the utility and delete it if the count + * becomes zero. + */ + IMPORT_C void Close(); + + /** + * Get a pointer to the Alf environment. + * @return The ALF environment owned by the AlfUtility. + */ + IMPORT_C CAlfEnv* Env() const; + + /** + * Get a pointer to the Alf display. + * @return The ALF display owned by ALF. + */ + IMPORT_C CAlfDisplay* Display() const; + + /** + * Shows the Alf display in full screen. + */ + IMPORT_C static void ShowAlfDisplayL(); + + /** + * Hides the Alf display so that Avkon screen can take over the whole screen + * and Avkon dialog can show the status pane. + */ + IMPORT_C static void HideAlfDisplayL(); + + /** + * Return the GlxTextureManager owned by the UiUtility. + * This pointer is only guaranteed to be valid until the UiUtility is Close()d. + * @return The GlxTextureManager owned by the UiUtility + */ + IMPORT_C CGlxTextureManager& GlxTextureManager(); + + /** + * @return The current direction of the switch between views + */ + IMPORT_C TGlxNavigationDirection ViewNavigationDirection(); + + /** + * Set the current direction of the switch between views + * @param aDirection The direction of the navigation + */ + IMPORT_C void SetViewNavigationDirection(TGlxNavigationDirection aDirection); + + + /** + * Helper function to return display size + * @return Display size + */ + IMPORT_C TSize DisplaySize() const; + + /** + * Get an id of a text style corresponding to the font and size + * @param aFontId The Avkon logical font Id + * @param aSizeInPixels The size of the text + * @return The Id of the Text style in the UiTextStyleManager + */ + IMPORT_C TInt TextStyleIdL(TInt aFontId, TInt aSizeInPixels); + + /** + * Set the screen orientation of the application. + * @param aOrientation The new orientation. + */ + IMPORT_C void SetAppOrientationL(TGlxOrientation aOrientation); + /** + * @return The current screen orientation of the application. + */ + IMPORT_C TGlxOrientation AppOrientation() const; + + /** + * ScreenFurniture + * @return pointer to CGlxScreenFurniture + */ + IMPORT_C CGlxScreenFurniture* ScreenFurniture(); + + /** + * CHgContextUtility + * @return pointer to CHgContextUtility + */ + //IMPORT_C CHgContextUtility* ContextUtility(); + + /** + * This method can be used to check whether pen support is enabled. + * @return ETrue if pen support is enabled, otherwise EFalse. + */ + IMPORT_C TBool IsPenSupported(); + //Nitz Review Added + /** + * This method can be used to set the image size required for Rotation. + * @param aRotatedImageSize the image size to be set. + */ + IMPORT_C void SetRotatedImageSize(TSize aRotatedImageSize); + //Nitz Review Added end + + /** + * This method can be used to Get the image size required for Rotation. + * @return the image size for the image to be rotated. + */ + IMPORT_C TSize GetRotatedImageSize(); + + /** + * This method can be used to get Icon Size for Grid Widget + * @return const TSize. + */ + IMPORT_C TSize GetGridIconSize(); + IMPORT_C TBool IsExitingState(); + + IMPORT_C void SetExitingState(TBool aIsExiting); + + /** + * Returns Visible items granularity based on feature + * layout (i.e., qHD, VGA) + * @return TInt visible items granularity / count + */ + IMPORT_C TInt VisibleItemsInPageGranularityL(); + +public: // from class MGlxTvObserver + + /** + * @ref MGlxTvObserver::HandleTvStatusChangedL + */ + IMPORT_C void HandleTvStatusChangedL( TTvChangeType aChangeType ); + + +public://from MAlfActionObserver + + /** + * @ref MAlfActionObserver::HandleActionL + */ + void HandleActionL (const TAlfActionCommand &aActionCommand); +public: + + /** + *Add MGlxSkinChangeObserver to skin change observers array. + *@param aObserver Reference of the MGlxSkinChangeObserver. + */ + IMPORT_C void AddSkinChangeObserverL(MGlxSkinChangeObserver& aObserver); + + + /** + *Remove MGlxSkinChangeObserver from skin change observers array. + *@param aObserver Reference of the MGlxSkinChangeObserver. + */ + IMPORT_C void RemoveSkinChangeObserver(MGlxSkinChangeObserver& aObserver); + + +private: + /** + * C++ default constructor. + */ + CGlxUiUtility(); + /** + * 2nd phase constructor. + */ + void ConstructL(); + /** + * Destructor. + */ + ~CGlxUiUtility(); + + /** 2-phase constructor */ + static CGlxUiUtility* NewL(); + +private: + /** + * Create the secondary TV Out Display + */ + void CreateTvOutDisplayL(); + + /** + * Destroy the secondary TV Out Display + */ + void DestroyTvOutDisplay(); + /** + * Calculate the Grid Icon Size for Grid Widget. It always calculate + * size for Landscape orientation. This is done to avoid saving two + * different thumbnail icons in Thumbnail database. + */ + void GridIconSizeL(); + // internal class to contain details of a style +private: + class TGlxTextStyle + { + public: + TGlxTextStyle( TInt aFontId, TInt aSizeInPixels, TInt aStyleId ) + : iFontId(aFontId), iSizeInPixels( aSizeInPixels ), iStyleId( aStyleId ) + {}; + public: + TInt iFontId; + TInt iSizeInPixels; + TInt iStyleId; + }; + +private: + /** Pointer to the appui (not owned) */ + CCoeAppUi* iAppUi; + + /** The Alf environment (owned) */ + CAlfEnv* iEnv; + + /** The Alf display used by the control (not owned) */ + CAlfDisplay* iAlfDisplay; + + /** The texture manager (owned) */ + CGlxTextureManager* iGlxTextureManager; + + /** Avkon control hosting the TV Alf display (owned) */ + CAlfDisplay* iTvDisplay; + + /** Pointer to TvOut monitoring object (owned) */ + CGlxTv* iGlxTvOut; + + /** Pointer to resolution manager object (owned) */ + CGlxResolutionManager* iGlxResolutionManager; + + /** Application settings model */ + CGlxSettingsModel* iSettingsModel; + + /// Current navigation direction between views + TGlxNavigationDirection iNavigationDirection; + + /** Array of details of created styles */ + RArray iTextStyles; + + /** Screen orientation of the application */ + TGlxOrientation iOrientation; + + /** Avkon control for monitoring skin changes*/ + CGlxSkinChangeMonitor* iGlxSkinChangeMonitor; + + TBool iShared; + TSize iGridIconSize; + + CGlxScreenFurniture* iScreenFurniture; + TBool iIsExiting; + //Added to give the Image size to the Coverflow Widget for Rotation + TSize iRotatedImageSize; + +// CHgContextUtility* iContextUtility; + }; + + +#endif // C_GLXALFUTILITY_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxuiutilitycoecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxuiutilitycoecontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2008-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: CoeControl utility +* +*/ + + + + +#ifndef C_GLXUIUTILITYCOECONTROL_H +#define C_GLXUIUTILITYCOECONTROL_H + +#include +#include +#include + +/** + * CGlxUiUtilityCoeControl + * + * Utility to handle display orientation changes. + * + * @lib glxhuiutils.lib + * + * @internal reviewed 12/06/2007 by Dave Schofield + */ +NONSHARABLE_CLASS( CGlxUiUtilityCoeControl ) : public CHuiDisplayCoeControl + { + public: // the API + + /** + * Static factory method for constructing a new instance of + * CGlxUiUtilityCoeControl. + * @param aEnv the HUI environment + * @param aArea the area for the control + * @ref AknLayoutUtils::TAknLayoutMetrics + * @param aFlags the screen creation flag + * @ref CHuiEnv::TNewDisplayFlags + */ + static CGlxUiUtilityCoeControl* NewL( + CHuiEnv& aEnv, + AknLayoutUtils::TAknLayoutMetrics aArea = AknLayoutUtils::EScreen, + TInt aFlags = CHuiEnv::ENewDisplayFullScreen ); + + /** + * Destructor + */ + ~CGlxUiUtilityCoeControl(); + + /** + * Set the area for the control. + * @param aArea the area for the control + * @ref AknLayoutUtils::TAknLayoutMetrics + * @return aRect the rect corresponding to the area + */ + TRect SetArea( AknLayoutUtils::TAknLayoutMetrics aArea ); + + private: // Implementation + + /** + * C++ constructor + * @param aEnv the Hui environment + */ + CGlxUiUtilityCoeControl( CHuiEnv& aEnv ); + + /** + * Second-phase constructor + * @param aArea the area for the control + * @ref AknLayoutUtils::TAknLayoutMetrics + * @param aFlags the screen creation flag + * @ref CHuiEnv::TNewDisplayFlags + */ + void ConstructL( AknLayoutUtils::TAknLayoutMetrics aArea, TInt aFlags ); + + /** + * Handles resource change. From CCoeControl + * + * @ref CCoeControl::HandleResourceChange + */ + void HandleResourceChange( TInt aType ); + + private: + + /// Own: the area for the display + AknLayoutUtils::TAknLayoutMetrics iArea; + + /** Pointer to the appui (not owned) */ + CCoeAppUi* iAppUi; + + }; + + +#endif // C_GLXUIUTILITYCOECONTROL_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxutilities.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxutilities.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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: Dialog Id +* +*/ + + + +#ifndef GLXUTILITIES_HRH +#define GLXUTILITIES_HRH + +enum TGlxTileDialogIds + { + EGlxDlgWaitNote = 0x00002000 + }; + +#endif // GLXUTILITIES_HRH + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/glxvisualutilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/glxvisualutilities.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2008-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: Alf visual utilities +* +*/ + + + + +#ifndef __GLXVISUALUTILITIES_H__ +#define __GLXVISUALUTILITIES_H__ + +// EXTERNAL HEADERS +#include + +// FORWARD DECLARES +class CHuiVisual; +class CHuiControl; + +/** + * Namespace to hold the CHuiVisual related algorithms. + * + * @author Kimmo Hoikka + * @lib glxhuiutils.lib + */ +namespace NGlxVisualUtilities + { + /** + * Method to transfer the ownership of CHuiVisuals to a new CHuiControl. + * In case of a Leave the ownership is held in the old owner so the ownership transfer + * succeeds either completely or not at all. + * @param aVisual reference to the topmost visual in the hierarchy + * @param aNewParent the new parent to be applied to all visuals in the hierarchy + */ + IMPORT_C void TransferVisualsL( CHuiVisual& aVisual, CHuiControl& aNewParent ); + } + +#endif // __GLXVISUALUTILITIES_H__ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxactivemedialistchangeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxactivemedialistchangeobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-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: Observer interface to be notified in change of media list +* +*/ + + + + +#ifndef __M_GLXACTIVEMEDIALISTCHANGEOBSERVER_H__ +#define __M_GLXACTIVEMEDIALISTCHANGEOBSERVER_H__ + +/** + * Observer interface to observe notifications if the currently + * active media list changes + */ +class MGlxActiveMediaListChangeObserver + { +public: + /** + * Called to notify that the currently active media list pointer + * has changed. + * Use MGlxActiveMediaListResolver to get the pointer of the + * newly active list. + */ + virtual void HandleActiveMediaListChanged() = 0; + }; + +#endif // __M_GLXACTIVEMEDIALISTCHANGEOBSERVER_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxactivemedialistresolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxactivemedialistresolver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-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: Class that resolves the active media list +* +*/ + + + + +#ifndef __M_GLXACTIVEMEDIALISTRESOLVER_H__ +#define __M_GLXACTIVEMEDIALISTRESOLVER_H__ + +#include + +class MGlxActiveMediaListChangeObserver; +class MGlxMediaList; + +/** + * Interface that allows client to resolve the currently active + * media list. + */ +class MGlxActiveMediaListResolver + { +public: + /** + * InstanceL + * Call Close to close the instance + * @param aObserver Observer to add or NULL + * @return an reference counter instance of the object + */ + IMPORT_C static MGlxActiveMediaListResolver* InstanceL( + MGlxActiveMediaListChangeObserver* aObserver); + + /** + * Close reference count and remove observer + * @param aObserver Observer to remove + */ + virtual void Close(MGlxActiveMediaListChangeObserver* aObserver) = 0; + + /** + * Returns the pointer to the currently active media list + * The active media list is the list in the currently open view that + * the user is navigating, or NULL if that media list is not known + * @return active media list, or NULL + */ + virtual MGlxMediaList* ActiveMediaList() const = 0; + }; + +#endif // __M_GLXACTIVEMEDIALISTRESOLVER_H__ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxanimation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxanimation.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2008-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: General animation interface +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Michael Yip + */ + +#ifndef M_GLXANIMATION_H +#define M_GLXANIMATION_H + + +class MGlxAnimationObserver; + +/// Constant to slow down all animations for testing purposes +const TInt KGlxAnimationSlowDownFactor = 1; + +/** + * General-purpose animation class + */ +class MGlxAnimation + { +public: + /** + * Start the animation + * @param aTimer Timer to use for the animation. Timed value ranges from + * 0 (animation start) to 1 (animation complete) + * @param aObserver Optional observer to get a callback when the animation + * completes + */ + virtual void AnimateL(TInt aTimer, + MGlxAnimationObserver* aObserver = NULL) = 0; + + /** + * Destructor + */ + virtual ~MGlxAnimation() {}; + }; + + +#endif // M_GLXANIMATION_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxanimationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxanimationobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008-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: Observer interface for animations +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Michael Yip + */ + +#ifndef M_GLXANIMATIONOBSERVER_H +#define M_GLXANIMATIONOBSERVER_H + +class MGlxAnimation; + +/** + * Animation observer interface + */ +class MGlxAnimationObserver + { +public: + /** + * Callback received when animation is complete + * @param aAnimation The completed animation - may be deleted within callback + */ + virtual void AnimationComplete(MGlxAnimation* aAnimation) = 0; + }; + +#endif // M_GLXANIMATIONOBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxenterkeyeventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxenterkeyeventobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-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: Enter Key observer interface +* +*/ + + + + +#ifndef M_GLXENTERKEYEVENTOBSERVER_H +#define M_GLXENTERKEYEVENTOBSERVER_H + +/** + * MGlxEnterKeyEventObserver + * + * List event notification interface + */ +class MGlxEnterKeyEventObserver + { +public: + /** + * Called when enter key is Pressed. + * @param aCommand Key event Id + */ + virtual void HandleEnterKeyEventL(TInt aCommand) = 0; + + }; + +#endif // M_GLXENTERKEYEVENTOBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxscrollbarobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxscrollbarobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2008-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: Observer interface for scrollbar +* +*/ + + + + +#ifndef M_GLXSCROLLBAROBSERVER_H +#define M_GLXSCROLLBAROBSERVER_H + +/** + * MGlxScrollbarObserver + * + * Scrollbar observer interface + * + * @lib glxuiutilities.lib + * + * @author Michael Yip + */ +class MGlxScrollbarObserver + { +public: + /** + * Callback received to indicate whether scrollbar is scrollable + */ + virtual void HandleScrollable(TBool aScrollable) = 0; + }; + +#endif // M_GLXSCROLLBAROBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxsimpleobservable.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxsimpleobservable.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2008-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: Provides a simple observable interface. +* +*/ + + + + +#ifndef M_GLXSIMPLEOBSERVABLE_H +#define M_GLXSIMPLEOBSERVABLE_H + +#include +#include "glxsimpleobserverevents.h" + +class MGlxSimpleObserver; + +/** + * MGlxSimpleObservable + * + * Provides a simple observable interface. + * + * @lib glxhuiutils.lib + */ +class MGlxSimpleObservable + { +public: + /** + * Registers an observer if not previously registered + * @param aObserver The observer concerned + */ + virtual void RegisterObserverL( MGlxSimpleObserver* aObserver ) = 0; + + /** + * Deregisters an observer if previously registered + * @param aObserver The observer concerned + */ + virtual void DeregisterObserver( MGlxSimpleObserver* aObserver ) = 0; + }; + +#endif // M_GLXSIMPLEOBSERVABLE_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/inc/mglxskinchangeobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/inc/mglxskinchangeobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2008-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: Skin change observer +* +*/ + + + + + +#ifndef M_GLXSKINCHANGEOBSERVER_H +#define M_GLXSKINCHANGEOBSERVER_H + +/** + * Class that observes the skin change + */ +class MGlxSkinChangeObserver + { +public: + /* + * Handle notification whenever skin changes + * @param The change type - resource change type + */ + virtual void HandleSkinChanged() = 0; + }; + +#endif // M_GLXSKINCHANGEOBSERVER_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxactivemedialistregistry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxactivemedialistregistry.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2008-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: Class that stores the active media list pointer +* +*/ + + + + +#include "glxactivemedialistregistry.h" + +#include +#include +#include +#include +#include "mglxactivemedialistchangeobserver.h" + +// ----------------------------------------------------------------------------- +// Return an instance +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxActiveMediaListRegistry* CGlxActiveMediaListRegistry::InstanceL( + MGlxActiveMediaListChangeObserver* aObserver) + { + GLX_LOG_INFO1("CGlxActiveMediaListRegistry::InstanceL: %x", aObserver); + + CGlxActiveMediaListRegistry* obj = CGlxSingletonStore::InstanceL(&NewL); + + // Add the observer if has not already been added + if (aObserver && KErrNotFound == obj->iObservers.Find(aObserver)) + { + TRAPD(err, obj->iObservers.AppendL(aObserver)); + // Close tls reference and leave if AppendL leaves. + // Otherwise there will be one reference that will be never closed + if (KErrNone != err) + { + CGlxSingletonStore::Close(obj); + User::Leave(err); + } + } + return obj; + } + +// ----------------------------------------------------------------------------- +// Return new object +// ----------------------------------------------------------------------------- +// +CGlxActiveMediaListRegistry* CGlxActiveMediaListRegistry::NewL() + { + CGlxActiveMediaListRegistry* obj = new (ELeave) CGlxActiveMediaListRegistry(); + // (No ConstructL necessary) + return obj; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxActiveMediaListRegistry::CGlxActiveMediaListRegistry() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxActiveMediaListRegistry::~CGlxActiveMediaListRegistry() + { + iObservers.Close(); + } + +// ----------------------------------------------------------------------------- +// Close a reference +// ----------------------------------------------------------------------------- +// +void CGlxActiveMediaListRegistry::Close(MGlxActiveMediaListChangeObserver* aObserver) + { + TRACER("CGlxActiveMediaListRegistry::Close"); + // Remove the observer if it has been added earlier + TInt index = iObservers.Find(aObserver); + if (KErrNotFound != index) + { + iObservers.Remove(index); + } + + // Decrease reference count, and delete if last one + // May delete this object + CGlxSingletonStore::Close(this); + // Member variable access not safe after CGlxTls::Close() + } + +// ----------------------------------------------------------------------------- +// Register an active media list +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxActiveMediaListRegistry::RegisterActiveMediaList(MGlxMediaList* aMediaList) + { + GLX_LOG_INFO1("CGlxActiveMediaListRegistry::RegisterActiveMediaList: %x", aMediaList); + // Add to registration count if the new list is the same as the existing one + if (aMediaList == iActiveMediaList) + { + __ASSERT_DEBUG(!iRegisteredTwice, Panic(EGlxPanicIllegalState)); // Cannot register three times + GLX_LOG_INFO("CGlxActiveMediaListRegistry::RegisterActiveMediaList: Media list registered twice"); + // The same media list has been registered twice + iRegisteredTwice = ETrue; + } + + // If active list has changed, pick up the new list and notify observers + if (iActiveMediaList != aMediaList) + { + GLX_LOG_INFO("CGlxActiveMediaListRegistry::RegisterActiveMediaList: Media list changed"); + // Pick up the new list + iActiveMediaList = aMediaList; + + // This is the first registration + iRegisteredTwice = EFalse; + + // Notify observers + NotifyObservers(); + } + } + +// ----------------------------------------------------------------------------- +// Deregister an active media list +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxActiveMediaListRegistry::DeregisterActiveMediaList(MGlxMediaList* aMediaList) + { + GLX_LOG_INFO1("CGlxActiveMediaListRegistry::DeregisterActiveMediaList: %x", aMediaList); + // Ignore deregistration if another list has already been registered + // (Another view was activated, and it registered a list) + if (aMediaList == iActiveMediaList) + { + // The list may be registered twice if the new and old view + // registered the same list. + if (iRegisteredTwice) + { + GLX_LOG_INFO("CGlxActiveMediaListRegistry::DeregisterActiveMediaList: Remove second registration"); + // Remove second registration + iRegisteredTwice = EFalse; + } + else + { + GLX_LOG_INFO("CGlxActiveMediaListRegistry::DeregisterActiveMediaList: Setting active list to NULL"); + // No new media list has been registered and current one is being + // deregistered, so set active list to NULL + iActiveMediaList = NULL; + + // Notify observers + NotifyObservers(); + } + } + } + +// ----------------------------------------------------------------------------- +// Notify observers +// ----------------------------------------------------------------------------- +// +void CGlxActiveMediaListRegistry::NotifyObservers() + { + // Notify observers + for (TInt i = iObservers.Count() - 1; i >= 0; i--) + { + iObservers[i]->HandleActiveMediaListChanged(); + } + } + +// ----------------------------------------------------------------------------- +// Return active media list +// ----------------------------------------------------------------------------- +// +MGlxMediaList* CGlxActiveMediaListRegistry::ActiveMediaList() const + { + GLX_LOG_INFO("CGlxActiveMediaListRegistry::ActiveMediaList()"); + return iActiveMediaList; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxanimationfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxanimationfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008-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: Factory for gallery animations +* +*/ + + + + +/** + * @internal reviewed 11/07/2007 by Michael Yip + */ + +#include "glxanimationfactory.h" + +#include "glxanimationview.h" +#include "glxanimationimageloading.h" + + +// ----------------------------------------------------------------------------- +// CreateViewAnimationL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxAnimation* GlxAnimationFactory::CreateViewAnimationL( + TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection, + CAlfControlGroup* aControlGroup) + { + CGlxAnimationView* anim = NULL; + + RPointerArray controlGroupArray; + controlGroupArray.Append(aControlGroup); + anim = CGlxAnimationView::NewL(aAnimType, aDirection, controlGroupArray); + controlGroupArray.Reset(); + + return anim; + } + +// ----------------------------------------------------------------------------- +// CreateViewAnimationL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxAnimation* GlxAnimationFactory::CreateViewAnimationL( + TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection, + RPointerArray& aControlGroups) + { + return CGlxAnimationView::NewL(aAnimType, aDirection, aControlGroups); + } + +// ----------------------------------------------------------------------------- +// CreateImageLoadingAnimationL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxAnimation* GlxAnimationFactory::CreateImageLoadingAnimationL( + CAlfVisual& aVisual, + CAlfTexture& aFlashTexture) + { + return CGlxAnimationImageLoading::NewL(aVisual, aFlashTexture); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxanimationimageloading.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxanimationimageloading.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2008-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: Image loading animation +* +*/ + + + + + +#include "glxanimationimageloading.h" + +#include +#include +#include +#include +#include + +#include "glxuiutility.h" + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxAnimationImageLoading* CGlxAnimationImageLoading::NewL( + CAlfVisual& aVisual, + CAlfTexture& aFlashTexture) + { + CGlxAnimationImageLoading* self = new (ELeave) CGlxAnimationImageLoading(aVisual, aFlashTexture); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxAnimationImageLoading::CGlxAnimationImageLoading(CAlfVisual& aVisual, + CAlfTexture& aFlashTexture) +: iVisual(aVisual), + iFlashTexture(aFlashTexture) + { + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxAnimationImageLoading::ConstructL() + { + + // Create brush + CGlxUiUtility* utility = CGlxUiUtility::UtilityL(); + CleanupClosePushL(*utility); + + // Rowland 30/10/07 Now need to get the environment + CAlfEnv* env = utility->Env(); + + TAlfImage img(iFlashTexture); + + iImageBrush = CAlfImageBrush::NewL(*env, img); + + CleanupStack::PopAndDestroy(utility); + + iImageBrush->SetLayer(EAlfBrushLayerForeground); + iImageBrush->SetBorders(1,1,1,1); + /// @todo check is this is correct? Rowland 30/10/07 SetClipToVisual is no longer defined + //iImageBrush->SetClipToVisual(ETrue); + iImageBrush->SetScaleMode(CAlfImageVisual::EScaleFit); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxAnimationImageLoading::~CGlxAnimationImageLoading() + { + } + +// ----------------------------------------------------------------------------- +// StartTimedAnimationL +// ----------------------------------------------------------------------------- +// +void CGlxAnimationImageLoading::StartTimedAnimationL( TInt aTime ) + { + iVisual.EnableBrushesL(); + iVisual.Brushes()->AppendL(iImageBrush, EAlfHasOwnership); + TAlfTimedValue opacity; + opacity.SetValueNow( 1.0 ); // immediate change + opacity.SetTarget(0.0, aTime ); // target + iImageBrush->SetOpacity(opacity); + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxanimationtimed.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxanimationtimed.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2008-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: Base class for timed animations +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Michael Yip + */ + +#include "glxanimationtimed.h" +#include "mglxanimationobserver.h" +#include "glxuiutility.h" + +#include +#include + +const TInt KGlxEventAnimationComplete = 0; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxAnimationTimed::CGlxAnimationTimed() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxAnimationTimed::~CGlxAnimationTimed() + { + if ( iUiUtility ) + { + iUiUtility->Env()->CancelCommands(this); + + iUiUtility->Close(); + iUiUtility = NULL; + } + } + +// ----------------------------------------------------------------------------- +// AnimateL +// ----------------------------------------------------------------------------- +// +void CGlxAnimationTimed::AnimateL( TInt aTime, MGlxAnimationObserver* aObserver ) + { + if ( aObserver ) + { + iObserver = aObserver; + + // if we dont yet have ui utility handle, get it now + if ( !iUiUtility ) + { + iUiUtility = CGlxUiUtility::UtilityL(); + } + + // send event once the animation should complete + iUiUtility->Env()->Send( + TAlfCustomEventCommand( KGlxEventAnimationComplete, this ), aTime ); + } + + // call the abstract method + StartTimedAnimationL( aTime ); + } + +// ----------------------------------------------------------------------------- +// OfferEventL +// ----------------------------------------------------------------------------- +// +TBool CGlxAnimationTimed::OfferEventL( const TAlfEvent &aEvent ) + { + TBool consumed = EFalse; + + if ( aEvent.IsCustomEvent() ) + { + // Rowland (30/10/2007) Changed iParam to CustomParameter() + if ( KGlxEventAnimationComplete == aEvent.CustomParameter() ) + { + // we consumed the event + consumed = ETrue; + + if ( iObserver ) + { + iObserver->AnimationComplete( this ); + } + // IMPORTANT! + // No code after this! Client may delete the animation! + } + } + + return consumed; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxanimationview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxanimationview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2008-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: View-transition animations +* +*/ + + + + +/** + * @internal reviewed 12/07/2007 by Michael Yip + */ + +#include "glxanimationview.h" + +#include +#include +#include + + +const TReal KGlxViewSwitchBackgroundScalingFactor = 0.2; +const TReal KGlxViewSwitchForegroundScalingFactor = 0.3; + + + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +CGlxAnimationView* CGlxAnimationView::NewL( + TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection, + const RPointerArray& aControlGroups) + { + CGlxAnimationView* self = new (ELeave) CGlxAnimationView(aAnimType, aDirection); + CleanupStack::PushL(self); + self->ConstructL(aControlGroups); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxAnimationView::CGlxAnimationView( + TGlxViewswitchAnimation aAnimType, + TGlxNavigationDirection aDirection) +: iAnimType(aAnimType), + iDirection(aDirection) + { + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxAnimationView::ConstructL(const RPointerArray& aControlGroups) + { + TInt count = aControlGroups.Count(); + + for (TInt index = 0; index < count; index++) + { + iControlGroups.AppendL(aControlGroups[index]); + } + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxAnimationView::~CGlxAnimationView() + { + iControlGroups.Close(); + } + +// ----------------------------------------------------------------------------- +// StartTimedAnimationL +// ----------------------------------------------------------------------------- +// +void CGlxAnimationView::StartTimedAnimationL( TInt aTime ) + { + // Set up timed values + TAlfTimedValue scale( 1.0 ); + TAlfTimedValue opacity( 1.0 ); + + // Set the scaling effect + if ( EGlxNavigationForwards == iDirection ) + { + if( EGlxViewAnimationEntry == iAnimType ) + { + scale.SetValueNow( 1 - KGlxViewSwitchBackgroundScalingFactor ); + scale.SetTarget( 1, aTime ); // and target + } + else if ( EGlxViewAnimationExit == iAnimType ) + { + scale.SetValueNow( 1 ); + scale.SetTarget( 1 + KGlxViewSwitchForegroundScalingFactor, aTime ); // and target + } + } + else if ( EGlxNavigationBackwards == iDirection ) + { + if( EGlxViewAnimationEntry == iAnimType ) + { + scale.SetValueNow( 1 + KGlxViewSwitchForegroundScalingFactor ); + scale.SetTarget( 1, aTime ); // and target + } + else if ( EGlxViewAnimationExit == iAnimType ) + { + scale.SetValueNow( 1 ); + scale.SetTarget( 1 - KGlxViewSwitchBackgroundScalingFactor, aTime ); // and target + } + } + + // Set the opacity effect + if( EGlxViewAnimationEntry == iAnimType ) + { + opacity.SetValueNow( 0 ); + opacity.SetTarget(1.0, aTime ); + } + else if ( EGlxViewAnimationExit == iAnimType ) + { + opacity.SetValueNow( 1.0 ); + opacity.SetTarget(0.0, aTime ); + } + opacity.SetStyle(EAlfTimedValueStyleLinear); + + // Find out the screen size + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *uiUtility ); + //TSize dispSize = uiUtility->ScreenFurniture().CentralScreenRect().Size();// tobe implemented by sf + CleanupStack::PopAndDestroy( uiUtility ); + + // Animate each of the control groups + TInt cgCount = iControlGroups.Count(); + for ( TInt cg = 0; cg < cgCount; cg++ ) + { + // If exiting, disable input events + if ( EGlxViewAnimationExit == iAnimType ) + { + iControlGroups[cg]->SetAcceptInput( EFalse ); + } + + // Set up control group transformations + iControlGroups[cg]->EnableTransformationL(); + CAlfTransformation& trans = iControlGroups[cg]->Transformation(); + + //trans.Translate(dispSize.iWidth/2, dispSize.iHeight/2);//tobe implemented by sf + trans.Scale( scale, scale ); + // trans.Translate(-dispSize.iWidth/2, -dispSize.iHeight/2);//tobe implemented by sf + + // Set opacity of all toplevel visuals in all controls in this group + TInt controlCount = iControlGroups[cg]->Count(); + for(TInt i = 0; i < controlCount; i++ ) + { + CAlfControl& control = iControlGroups[cg]->Control(i); + for(TInt j = 0; j < control.VisualCount(); j++) + { + if ( control.Visual(j).Layout() ) + { + control.Visual(j).SetOpacity( opacity ); + } + } + } + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxattributeretriever.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxattributeretriever.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,711 @@ +/* +* Copyright (c) 2008-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: Blocking attribute retriever +* +*/ + + + + +#include "glxattributeretriever.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + + +/** + * Observer that should be implemented by users of the + * CGlxAttributeRetriever class to inform them when attribute retrieval is complete + */ +class MGlxAttributeRetrieverObserver + { +public: + /** + * Called when attribute retrieval is complete + * @param aError symbian os error code. + */ + virtual void AttributeRetrievalCompleteL(TInt aError) = 0; + }; + +/** + * CGlxAttributeRetriever + * This class informs the MGlxAttributeRetrieverObserver when all + * requested metadata has been retrived. + * @ingroup mlm_media_list_manager_design + * @lib glxuiutlities.lib + */ +NONSHARABLE_CLASS( CGlxAttributeRetriever ) + : public CActive, public MGlxMediaListObserver + { +public: + /** + * Constructor + * @param aObserver observer to be informed when attribute retrieval is complete + */ + CGlxAttributeRetriever(MGlxAttributeRetrieverObserver& aObserver); + + /** + * Destructor + */ + ~CGlxAttributeRetriever(); + + /** + * Retrieve the attrubutes + * @param aContext the fetch context containing the attribute to be retrieved + * @param aList the medialist containing the item for which the attributes are retrieved + * @return Error code + */ + void RetrieveL(const MGlxFetchContext* aContext, MGlxMediaList* aList); + + void CancelRetrieve(); + +private: // from CActive + void RunL(); + void DoCancel(); + +public: // From MGlxMediaListObserver + void HandleAttributesAvailableL(TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList); + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + void HandlePopulatedL(MGlxMediaList* aList); + void HandleError(TInt aError); + +private: + /** + * Asynchronously notifies the observer is attribute retrieval is complete + */ + void NotifyObserverIfCompleteL(); + + /** + * Completes the active object causing a call from the + * active scheduler to RunL() + * @param aError error code passed to RunL() + * (test in RunL using iStatus.Int()) + */ + void CompleteSelf(TInt aError); + +private: + /// pointer to a Fetch Context associated with the desired attribute. Not owned + const MGlxFetchContext* iContext; + + /// pointer to the Media List. Not owned + MGlxMediaList* iList; + + /** + * observer + */ + MGlxAttributeRetrieverObserver& iObserver; + + /** + * Internal cache of objects still to retrieve + */ + TInt iRequestCount; + }; + +/** + * Abstract interface for a blocking attribute retriever + */ +class MGlxBlockingAttributeRetriever + { +public: + /** + * Retrieve the attrubutes (call blocks until attribute retrieval is complete) + * @param aContext the fetch context containing the attribute to be retrieved + * @param aList the medialist containing the item for which the attributes are retrieved + * @return Error code + */ + virtual TInt RetrieveL(const MGlxFetchContext* aContext, MGlxMediaList* aList) = 0; + virtual ~MGlxBlockingAttributeRetriever() {}; + }; + +/** + * This class displays a wait dialog and blocks until all requested metadata has been retrieved. + */ +class CGlxWaitDialogAttributeRetriever : public CBase, + public MProgressDialogCallback, + public MGlxBlockingAttributeRetriever, + public MGlxAttributeRetrieverObserver + { +public: + static CGlxWaitDialogAttributeRetriever* NewLC(); + +public: // from MGlxBlockingAttributeRetriever + /** + * See @ref MGlxBlockingAttributeRetriever::RetrieveL + */ + TInt RetrieveL(const MGlxFetchContext* aContext, MGlxMediaList* aList); + +private: // from MGlxAttributeRetrieverObserver + /** + * See @ref MGlxAttributeRetrieverObserver::AttributeRetrievalCompleteL + */ + void AttributeRetrievalCompleteL(TInt aError); + +public: // From MProgressDialogCallback + void DialogDismissedL(TInt aButtonId); + +private: + /** + * Constructor + */ + CGlxWaitDialogAttributeRetriever(); + + /** + * Destructor + */ + ~CGlxWaitDialogAttributeRetriever(); + + /** + * Second stage constructor + */ + void ConstructL(); + +private: + /** + * Loads the resource file for this dll + */ + void AddResourceFileL(); + + /** + * Unloads the resource file for this dll + */ + void RemoveResourceFile(); + +private: + /// App environment used for accessing resource file (not owned) + CCoeEnv* iCoeEnv; + + /// Wait dialog + CAknWaitDialog* iWaitDialog; + + /// Resource file offset + TInt iResourceOffset; + + /** + * Attribute retriever (owned) + */ + CGlxAttributeRetriever* iAttributeRetriever; + + /** + * Attribute retrieval error + */ + TInt iError; + }; + +/** + * This class blocks until all requested metadata has been retrieved + */ +class CGlxSynchronousAttributeRetriever : public CBase, + public MGlxBlockingAttributeRetriever, + public MGlxAttributeRetrieverObserver + { +public: + static CGlxSynchronousAttributeRetriever* NewLC(); + +public: // from MGlxBlockingAttributeRetriever + /** + * See @ref MGlxBlockingAttributeRetriever::RetrieveL + */ + TInt RetrieveL(const MGlxFetchContext* aContext, MGlxMediaList* aList); + +private: // from MGlxAttributeRetrieverObserver + /** + * See @ref MGlxAttributeRetrieverObserver::AttributeRetrievalCompleteL + */ + void AttributeRetrievalCompleteL(TInt aError); + +private: + /** + * StopScheduler + */ + void StopScheduler(); + +private: + /** + * Second stage constructor + */ + void ConstructL(); + + /** + * Destructor + */ + ~CGlxSynchronousAttributeRetriever(); + +private: + /// Active scheduler wait object. Owned + CActiveSchedulerWait* iSchedulerWait; + + /** + * Attribute retriever (owned) + */ + CGlxAttributeRetriever* iAttributeRetriever; + + /** + * Attribute retrieval error + */ + TInt iError; + }; + +// ----------------------------------------------------------------------------- +// RetrieveL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt GlxAttributeRetriever::RetrieveL(const MGlxFetchContext& aContext, + MGlxMediaList& aList, TBool aShowDialog) + { + MGlxBlockingAttributeRetriever* retriever = NULL; + if (aShowDialog) + { + retriever = CGlxWaitDialogAttributeRetriever::NewLC(); + } + else + { + retriever = CGlxSynchronousAttributeRetriever::NewLC(); + } + TInt err = retriever->RetrieveL(&aContext, &aList); + /** + * This will cause a code scanner warning, but it is not possible to do + * CleanupStack::PopAndDestroy(retriever) because the pointer pushed + * onto the cleanup stack was either of class CGlxWaitDialogAttributeRetriever + * or a CGlxSynchronousAttributeRetriever and the object 'retriever' is of + * class MGlxBlockingAttributeRetriever + */ + CleanupStack::PopAndDestroy(); + return err; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxAttributeRetriever::CGlxAttributeRetriever(MGlxAttributeRetrieverObserver& aObserver) + : CActive(EPriorityHigh), iObserver(aObserver) // We want out RunL to be serviced ASAP + { + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxAttributeRetriever::~CGlxAttributeRetriever() + { + Cancel(); + + if ( iList ) + { + iList->RemoveMediaListObserver( this ); + } + } + + +// ----------------------------------------------------------------------------- +// CGlxAttributeRetriever::RetrieveL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::RetrieveL(const MGlxFetchContext* aContext, MGlxMediaList* aList) + { + iContext = aContext; + iList = aList; + iList->AddMediaListObserverL(this); + + if(iList->IsPopulated()) + { + NotifyObserverIfCompleteL(); + } + } + +void CGlxAttributeRetriever::CancelRetrieve() + { + // Simply remove media list observer to prevent call backs from the media list + iList->RemoveMediaListObserver(this); + } + +// ----------------------------------------------------------------------------- +// CGlxAttributeRetriever::RunL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::RunL() + { + iObserver.AttributeRetrievalCompleteL(iStatus.Int()); + } + +// ----------------------------------------------------------------------------- +// CGlxAttributeRetriever::DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::DoCancel() + { + // No need to do anything + } + +// ----------------------------------------------------------------------------- +// CGlxAttributeRetriever::NotifyObserverIfCompleteL() +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::NotifyObserverIfCompleteL() + { + iRequestCount--; + + if( iRequestCount <= 0 ) + { + iRequestCount = iContext->RequestCountL(iList); + if(iRequestCount <= 0) + { + iList->RemoveMediaListObserver(this); // prevent any more callbacks from the media list + CompleteSelf(iRequestCount); // request count is an error + } + } + } + +// --------------------------------------------------------------------------- +// CGlxDataSource::CompleteSelf +// --------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::CompleteSelf(TInt aError) + { + TRequestStatus* status=&iStatus; + User::RequestComplete(status, aError); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleAttributesAvailableL(TInt /* aItemIndex */, + const RArray& /* aAttributes */, MGlxMediaList* /*aList*/) + { + NotifyObserverIfCompleteL(); + } + +// ----------------------------------------------------------------------------- +// HandleItemAddedL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleItemAddedL(TInt /* aStartIndex */, + TInt /* aEndIndex */, MGlxMediaList* /* aList */) + { + // No implementaion + } + +// ----------------------------------------------------------------------------- +// HandleItemRemovedL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleItemRemovedL(TInt /* aStartIndex */, + TInt /* aEndIndex */, MGlxMediaList* /* aList */) + { + // No implementaion + } + +// ----------------------------------------------------------------------------- +// HandleItemModifiedL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleItemModifiedL(const RArray& /* aItemIndexes */, + MGlxMediaList* /* aList */) + { + // No implementaion + } + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /* aType */, + TInt /* aNewIndex */, TInt /* aOldIndex */, MGlxMediaList* /* aList */) + { + // No implementaion + } + +// ----------------------------------------------------------------------------- +// HandleMediaL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleMediaL(TInt /* aListIndex */, + MGlxMediaList* /* aList */) + { + // No implementaion + } + +// ----------------------------------------------------------------------------- +// HandleItemSelectedL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleItemSelectedL(TInt /* aIndex */, + TBool /* aSelected */, MGlxMediaList* /* aList */) + { + // No implementaion + } + +// ----------------------------------------------------------------------------- +// HandleMessageL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleMessageL(const CMPXMessage& /* aMessage */, + MGlxMediaList* /* aList */) + { + // No implementaion + } + +// ----------------------------------------------------------------------------- +// HandleError +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandleError(TInt /* aError */) + { + // An error has been reported. But is it ours? + // If the request is not complete then the error is not ours + iRequestCount = 0; + TRAP_IGNORE(NotifyObserverIfCompleteL()); + + } + +// ----------------------------------------------------------------------------- +// HandlePopulatedL +// ----------------------------------------------------------------------------- +// +void CGlxAttributeRetriever::HandlePopulatedL(MGlxMediaList* /*aList*/) + { + // If the media list is empty we will never get the HandleAttributesAvailableL callback, + // therefore the call to NotifyObserversIfCompleteL below is necessary. + NotifyObserverIfCompleteL(); + } + +// ----------------------------------------------------------------------------- +// CGlxWaitDialogAttributeRetriever +// ----------------------------------------------------------------------------- +// + +// ----------------------------------------------------------------------------- +// CGlxWaitDialogAttributeRetriever::NewLC +// ----------------------------------------------------------------------------- +// +CGlxWaitDialogAttributeRetriever* CGlxWaitDialogAttributeRetriever::NewLC() + { + CGlxWaitDialogAttributeRetriever* self = new (ELeave) CGlxWaitDialogAttributeRetriever(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CGlxWaitDialogAttributeRetriever::RetrieveL +// ----------------------------------------------------------------------------- +// +TInt CGlxWaitDialogAttributeRetriever::RetrieveL(const MGlxFetchContext* aContext, MGlxMediaList* aList) + { + // Load the resource file for this dll containing the wait dialog + AddResourceFileL(); + + // prepare the wait dialog + iWaitDialog = new( ELeave ) CAknWaitDialog(reinterpret_cast(&iWaitDialog)); + iWaitDialog->PrepareLC(R_GLX_WAIT_NOTE_BLOCKING); // Pushes a point to a CEikDialog onto the CleanupStack. RunLD Pops it. + + iWaitDialog->SetCallback(this); + + // Load string for dialog + HBufC* title = StringLoader::LoadLC( R_GLX_PROGRESS_GENERAL ); + iWaitDialog->SetTextL(*title); + CleanupStack::PopAndDestroy(title); + + // The cancel key is specified in the resource + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + cba->AddCommandSetToStackL(R_AVKON_SOFTKEYS_CANCEL); + + iAttributeRetriever->RetrieveL(aContext, aList); + iWaitDialog->RunLD(); // starts another active scheduler and blocks + return iError; + } + +// ----------------------------------------------------------------------------- +// CGlxWaitDialogAttributeRetriever::AttributeRetrievalComplete +// ----------------------------------------------------------------------------- +// +void CGlxWaitDialogAttributeRetriever::AttributeRetrievalCompleteL(TInt aError) + { + iError = aError; + iWaitDialog->ProcessFinishedL(); + } + +// ----------------------------------------------------------------------------- +// CGlxWaitDialogAttributeRetriever::DialogDismissedL +// ----------------------------------------------------------------------------- +// +void CGlxWaitDialogAttributeRetriever::DialogDismissedL(TInt aButtonId) + { + if (aButtonId == EEikBidCancel) + { + iAttributeRetriever->CancelRetrieve(); + iError = KErrCancel; + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxWaitDialogAttributeRetriever::CGlxWaitDialogAttributeRetriever() + { + iCoeEnv = CCoeEnv::Static(); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxWaitDialogAttributeRetriever::~CGlxWaitDialogAttributeRetriever() + { + RemoveResourceFile(); + delete iAttributeRetriever; + } + +// ----------------------------------------------------------------------------- +// CGlxWaitDialogAttributeRetriever::ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxWaitDialogAttributeRetriever::ConstructL() + { + iAttributeRetriever = new (ELeave) CGlxAttributeRetriever(*this); + } + +// ----------------------------------------------------------------------------- +// AddResourceFileL +// ----------------------------------------------------------------------------- +// +void CGlxWaitDialogAttributeRetriever::AddResourceFileL() + { + if (!iResourceOffset) // Lazy construction - ensure that this is only run once + { + GLX_LOG_INFO("Adding attribute retriever resource file"); + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = iCoeEnv->AddResourceFileL(resourceFile); + } + } + +// ----------------------------------------------------------------------------- +// RemoveResourceFile +// ----------------------------------------------------------------------------- +// +void CGlxWaitDialogAttributeRetriever::RemoveResourceFile() + { + if (iResourceOffset) // Check that the resource has been loaded + { + GLX_LOG_INFO("Removing attribute retriever resource file"); + iCoeEnv->DeleteResourceFile( iResourceOffset ); + iResourceOffset = 0; + } + } + +// ----------------------------------------------------------------------------- +// CGlxSynchronousAttributeRetriever +// ----------------------------------------------------------------------------- +// + +// ----------------------------------------------------------------------------- +// CGlxSynchronousAttributeRetriever::NewLC +// ----------------------------------------------------------------------------- +// +CGlxSynchronousAttributeRetriever* CGlxSynchronousAttributeRetriever::NewLC() + { + CGlxSynchronousAttributeRetriever* self = new (ELeave) CGlxSynchronousAttributeRetriever(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + + +// ----------------------------------------------------------------------------- +// CGlxSynchronousAttributeRetriever::RetrieveL +// ----------------------------------------------------------------------------- +// +TInt CGlxSynchronousAttributeRetriever::RetrieveL(const MGlxFetchContext* aContext, MGlxMediaList* aList) + { + iAttributeRetriever->RetrieveL(aContext,aList); + iSchedulerWait->Start(); + return iError; + } + +// ----------------------------------------------------------------------------- +// CGlxSynchronousAttributeRetriever::AttributeRetrievalCompleteL +// ----------------------------------------------------------------------------- +// +void CGlxSynchronousAttributeRetriever::AttributeRetrievalCompleteL(TInt aError) + { + iError = aError; + StopScheduler(); + } + +// ----------------------------------------------------------------------------- +// StopScheduler +// ----------------------------------------------------------------------------- +// +void CGlxSynchronousAttributeRetriever::StopScheduler() + { + if (iSchedulerWait) + { + if (iSchedulerWait->IsStarted()) + { + iSchedulerWait->AsyncStop(); + } + } + } + +// ----------------------------------------------------------------------------- +// CGlxSynchronousAttributeRetriever::ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxSynchronousAttributeRetriever::ConstructL() + { + iSchedulerWait = new (ELeave) CActiveSchedulerWait(); + iAttributeRetriever = new (ELeave) CGlxAttributeRetriever(*this); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxSynchronousAttributeRetriever::~CGlxSynchronousAttributeRetriever() + { + delete iSchedulerWait; + delete iAttributeRetriever; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxgeneraluiutilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxgeneraluiutilities.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2008-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: general ui utilities +* +*/ + + + + +#include +#include +#include +#include "glxgeneraluiutilities.h" + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::ShowErrorNoteL +// ----------------------------------------------------------------------------- +// +EXPORT_C void GlxGeneralUiUtilities::ShowErrorNoteL(TInt aError) + { + // TextResolver instance for error resolving. + CTextResolver* textresolver = CTextResolver::NewLC(); + // Resolve the error text + const TDesC& text = + textresolver->ResolveErrorString( aError ); + ShowErrorNoteL(text, ETrue); + CleanupStack::PopAndDestroy( textresolver ); + } + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::ConfirmQueryL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool GlxGeneralUiUtilities::ConfirmQueryL( TInt aQueryResourceId, + const TDesC& aTitleText ) + { + CAknQueryDialog* query = CAknQueryDialog::NewL(); + TInt ret = query->ExecuteLD( aQueryResourceId, aTitleText ); + + if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) + { + return ETrue; + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::ConfirmQueryL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool GlxGeneralUiUtilities::ConfirmQueryL( const TDesC& aTitleText ) + { + return ConfirmQueryL(R_GLX_QUERY_OK_CANCEL, aTitleText); + } + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::ShowErrorNoteL +// ----------------------------------------------------------------------------- +// +EXPORT_C void GlxGeneralUiUtilities::ShowErrorNoteL( const TDesC& aInfoText, + TBool aWaitingDialog ) + { + CAknErrorNote* infoNote = + new( ELeave ) CAknErrorNote( aWaitingDialog ); + infoNote->ExecuteLD( aInfoText ); + } + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::ShowInfoNoteL +// ----------------------------------------------------------------------------- +// +EXPORT_C void GlxGeneralUiUtilities::ShowInfoNoteL( const TDesC& aInfoText, + TBool aWaitingDialog ) + { + CAknInformationNote* infoNote = + new( ELeave ) CAknInformationNote( aWaitingDialog ); + infoNote->ExecuteLD( aInfoText ); + } + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::ShowConfirmationNoteL +// ----------------------------------------------------------------------------- +// +EXPORT_C void GlxGeneralUiUtilities::ShowConfirmationNoteL( const TDesC& aInfoText, + TBool aWaitingDialog ) + { + CAknConfirmationNote* confNote = + new( ELeave ) CAknConfirmationNote( aWaitingDialog ); + confNote->ExecuteLD( aInfoText ); + } + + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::FormatString +// ----------------------------------------------------------------------------- +// +EXPORT_C void GlxGeneralUiUtilities::FormatString( TDes& aDestination, + const TDesC& aSource, + TInt aPosition, + TInt aNumber, + TBool aNumberConversion ) + { + StringLoader::Format( aDestination, aSource, aPosition, aNumber ); + + if( aNumberConversion ) + { + AknTextUtils::LanguageSpecificNumberConversion( aDestination ); + } + } + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::IsLandscape() +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool GlxGeneralUiUtilities::IsLandscape() + { + // This class does not have access to a CEikonEnv and hence + // pls ignore the code scanner warning - Using CEikonEnv::Static + CAknAppUiBase::TAppUiOrientation orientation = static_cast((CEikonEnv::Static()->EikAppUi()))->Orientation(); + + if (orientation == CAknAppUiBase::EAppUiOrientationLandscape) + { + return true; + } + + else if (orientation == CAknAppUiBase::EAppUiOrientationUnspecified ) + { + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + if ( (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) || + (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) ) + { + //landscape + return true; + } + else + { + // Portrait + return false; + } + } + + return false; + } + + +// ----------------------------------------------------------------------------- +// GlxGeneralUiUtilities::LayoutIsMirrored +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool GlxGeneralUiUtilities::LayoutIsMirrored() + { +// remove comment from next line to force arabic/hebrew layout for testing +//#define FORCE_ARABIC_HEBREW_LAYOUT +#ifdef FORCE_ARABIC_HEBREW_LAYOUT + return ETrue; +#else + return AknLayoutUtils::LayoutMirrored(); +#endif + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxscreenfurniture.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxscreenfurniture.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,321 @@ +/* +* Copyright (c) 2008 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: Screenfurniture interface. Used to show/hide UI or +* enable/disable induvidual screenfurniture items. +* +*/ + + + + +#include "glxscreenfurniture.h" + +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include + +_LIT(KGlxUiUtilitiesResource,"glxuiutilities.rsc"); + +// CONSTANTS AND FORWARD DECLARATIONS +const TInt KSfNoView = 0; +const TInt KGlxFloatingToolbarXPosOffset = 80; +const TInt KGlxFloatingToolbarYPosOffset = 120; + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxScreenFurniture* CGlxScreenFurniture::NewL( + CGlxUiUtility& aParentUtility) + { + TRACER("CGlxScreenFurniture::NewL()"); + + CGlxScreenFurniture* self = CGlxScreenFurniture::NewLC(aParentUtility); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxScreenFurniture* CGlxScreenFurniture::NewLC( + CGlxUiUtility& aParentUtility) + { + TRACER("CGlxScreenFurniture::NewLC()"); + + CGlxScreenFurniture* self = new(ELeave) CGlxScreenFurniture(aParentUtility); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxScreenFurniture::CGlxScreenFurniture(CGlxUiUtility& aParentUtility) : iParentUtility(aParentUtility) + { + TRACER("CGlxScreenFurniture::CGlxScreenFurniture()"); + + } + +//------------------------------------------------------------------------------ +// Destructor +//------------------------------------------------------------------------------ +// +CGlxScreenFurniture::~CGlxScreenFurniture() + { + TRACER("CGlxScreenFurniture::~CGlxScreenFurniture"); + + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + delete iToolbar; + + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxScreenFurniture::ConstructL() + { + TRACER("CGlxScreenFurniture::ConstructL()"); + + // No view is active at the time of ScreenFurniture object construction + iActiveView = KSfNoView; + + // Load resource + TParse parse; + parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + // Create the fullscreen floating toolbar (used only for non-touch) + iToolbar = CAknToolbar::NewL(R_GLX_FULLSCREEN_FLOATING_TOOLBAR); + iToolbar->SetOrientation(EAknOrientationVertical); + iToolbar->SetWithSliding(EFalse); + + // Set ScreenFurniture to observe the toolbar events + SetToolbarObserver(this); + } + +// ----------------------------------------------------------------------------- +// SetActiveView +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::SetActiveView( TInt aViewId) + { + TRACER("CGlxScreenFurniture::SetActiveView()"); + + iActiveView = aViewId; + + // Calculate toolbar position and display toolbar on the screen + // as soon as the calling view is activated. + SetToolbarPosition(); + SetToolbarVisibility(ETrue); + } + +// ----------------------------------------------------------------------------- +// ViewDeactivated +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::ViewDeactivated( TInt aViewId) + { + TRACER("CGlxScreenFurniture::ViewDeactivated()"); + + if ( aViewId == iActiveView ) + { + iActiveView = KSfNoView; + SetToolbarVisibility(EFalse); + } + } + +// ----------------------------------------------------------------------------- +// SetVisibility +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::SetToolbarVisibility( TBool aVisible ) + { + TRACER("CGlxScreenFurniture::SetToolbarVisibility()"); + + if( aVisible ) + { + // @TODO: Abhijit : Uncomment the following lines after the Avkon fix in week 02 MCL + // iToolbar->SetFocus( ETrue, EDrawNow ); + // iToolbar->SetToolbarVisibility( aVisible, ETrue ); + } + else + { + // iToolbar->SetToolbarVisibility( aVisible, EFalse ); + } + } + +// ----------------------------------------------------------------------------- +// SetVisibility +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::SetToolbarItemVisibility( TInt aCommand, + TBool aVisible ) + { + TRACER("CGlxScreenFurniture::SetToolbarItemVisibility()"); + + iToolbar->HideItem(aCommand,!aVisible,EFalse); + } + +// ----------------------------------------------------------------------------- +// SetItemDimmedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::SetToolbarItemDimmed( TInt aCommand, + TBool aDimmed ) + { + TRACER("CGlxScreenFurniture::SetToolbarItemDimmed()"); + + iToolbar->SetItemDimmed(aCommand,aDimmed,ETrue); + } + +// ----------------------------------------------------------------------------- +// SetFocusL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::SetFocusL( TInt aCommand ) + { + TRACER("CGlxScreenFurniture::SetFocusL()"); + + iToolbar->SetFocusedItemL( aCommand ); + } + +// ----------------------------------------------------------------------------- +// PLACEMENT OF FLOATING TOOLBAR ON THE SCREEN +// +// |<------xOffset---------->| +// +// -------------------------------- --- --- +// | | | | yOffset +// | ---.--- | | --- +// | | | dispHeight +// | | | +// | | | +// -------------------------------- --- +// +// |<-------- dispWidth --------->| +// +// +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// SetPosition +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::SetToolbarPosition() + { + TRACER("CGlxScreenFurniture::SetToolbarPosition()"); + + TSize displaySize(iParentUtility.DisplaySize()); + TInt dispWidth = displaySize.iWidth; + TInt dispHeight = displaySize.iHeight; + + // Please refer to the figure above for a detailed description + TInt xOffset = dispWidth - KGlxFloatingToolbarXPosOffset; + TInt yOffset = (dispHeight/2) - KGlxFloatingToolbarYPosOffset; + iToolbar->SetPosition(TPoint( xOffset, yOffset ) ); + + } + +// ----------------------------------------------------------------------------- +// SetTooltipL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::SetTooltipL( TInt aCommand, + CAknButton::TTooltipPosition aToolTipPos, const TDesC& aToolTipText ) + { + TRACER("CGlxScreenFurniture::SetTooltipL()"); + + // Get the button reference of the command specified + CAknButton* toolbarButton = static_cast + (iToolbar->ControlOrNull(aCommand)); + + if( toolbarButton ) + { + if( aToolTipText != KNullDesC ) + { + // Set tooltip text + toolbarButton->State()->SetHelpTextL(aToolTipText); + } + toolbarButton->SetTooltipPosition( aToolTipPos ); + } + } + +// ----------------------------------------------------------------------------- +// OfferToolbarEventL +// ----------------------------------------------------------------------------- +// +void CGlxScreenFurniture::OfferToolbarEventL( TInt aCommand ) + { + TRACER("CGlxScreenFurniture::OfferToolbarEventL()"); + + // This class does not have access to a CEikonEnv and hence + // pls ignore the code scanner warning - Using CEikonEnv::Static + MEikCommandObserver* commandObserver = CEikonEnv::Static()->EikAppUi(); + commandObserver->ProcessCommandL( aCommand ); + } + +// ----------------------------------------------------------------------------- +// SetToolbarObserver +// ----------------------------------------------------------------------------- +// +void CGlxScreenFurniture::SetToolbarObserver( MAknToolbarObserver* aObserver ) + { + TRACER("CGlxScreenFurniture::SetToolbarObserver()"); + + // Add ScreenFurniture to ToolbarObserver + iToolbar->SetToolbarObserver(aObserver); + } + +// ----------------------------------------------------------------------------- +// ChangeMskIdL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScreenFurniture::ModifySoftkeyIdL(CEikButtonGroupContainer::TCommandPosition aPosition, + TInt aCommandId, TInt aResourceId, const TDesC& aText) + { + TRACER("CGlxScreenFurniture::ChangeMskIdL(TInt aCommandId, TDesC& aText)"); + if (!AknLayoutUtils::PenEnabled()) + { + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + if (!aResourceId) + { + cba->SetCommandL(aPosition, aCommandId, aText ); + cba->DrawNow(); + } + else + { + HBufC* textbuf = StringLoader::LoadLC(aResourceId); + TPtr msktext = textbuf->Des(); + cba->SetCommandL(aPosition, aCommandId, msktext ); + cba->DrawNow(); + CleanupStack::PopAndDestroy(textbuf); + } + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxscrollbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxscrollbar.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,395 @@ +/* +* Copyright (c) 2008-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: Scrollbar +* +*/ + + + + +#include "glxscrollbar.h" + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "mglxscrollbarobserver.h" +#include "glxuiutility.h" + +// S60 standard size for scrollbar +const TInt KWidth = 8; + +const TInt KBackgroundLayoutIndex = 0; +const TInt KThumbLayoutIndex = 1; + +const TInt KTopVisualIndex = 0; +const TInt KMiddleVisualIndex = 1; +const TInt KBottomVisualIndex = 2; + +// ----------------------------------------------------------------------------- +// Two phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxScrollbar* CGlxScrollbar::NewLC(CAlfControl& aControl, CAlfLayout& aParentLayout) + { + GLX_LOG_INFO( "CGlxScrollbar::NewLC" ); + + CGlxScrollbar* self = new (ELeave) CGlxScrollbar(); + CleanupStack::PushL( self ); + self->ConstructL( aControl, aParentLayout ); + return self; + } + +// ----------------------------------------------------------------------------- +// Two phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxScrollbar* CGlxScrollbar::NewL(CAlfControl& aControl, CAlfLayout& aParentLayout) + { + GLX_LOG_INFO( "CGlxScrollbar::NewL" ); + + CGlxScrollbar* self = CGlxScrollbar::NewLC( aControl, aParentLayout ); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxScrollbar::CGlxScrollbar() + { + GLX_LOG_INFO( "CGlxScrollbar::CGlxScrollbar" ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxScrollbar::~CGlxScrollbar() + { + GLX_LOG_INFO( "CGlxScrollbar::~CGlxScrollbar" ); + + iObservers.Close(); + } + +// ----------------------------------------------------------------------------- +// Two phase constructor +// ----------------------------------------------------------------------------- +// +void CGlxScrollbar::ConstructL(CAlfControl& aControl, CAlfLayout& aParentLayout) + { + GLX_LOG_INFO( "CGlxScrollbar::ConstructL" ); + + iLayout = CAlfLayout::AddNewL( aControl, &aParentLayout ); + + // Create the background layout and child visuals + CAlfAnchorLayout* backgroundLayout = CAlfAnchorLayout::AddNewL( aControl, iLayout ); + + CAlfImageVisual::AddNewL( aControl, backgroundLayout ); + CAlfImageVisual::AddNewL( aControl, backgroundLayout ); + CAlfImageVisual::AddNewL( aControl, backgroundLayout ); + + // Create the thumb layout and child visuals + CAlfAnchorLayout* thumbLayout = CAlfAnchorLayout::AddNewL( aControl, iLayout ); + + CAlfImageVisual::AddNewL( aControl, thumbLayout ); + CAlfImageVisual::AddNewL( aControl, thumbLayout ); + CAlfImageVisual::AddNewL( aControl, thumbLayout ); + + // Create and set textures for the visuals + SetTexturesL(); + } + +// ----------------------------------------------------------------------------- +// Add an observer to observe scrollbar +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScrollbar::AddObserverL(MGlxScrollbarObserver* aObserver) + { + GLX_LOG_INFO( "CGlxScrollbar::AddObserverL" ); + + __ASSERT_DEBUG( iObservers.Find( aObserver ) == KErrNotFound, + Panic( EGlxPanicIllegalArgument ) ); + + iObservers.AppendL( aObserver ); + } + +// ----------------------------------------------------------------------------- +// Remove an observer +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScrollbar::RemoveObserver(MGlxScrollbarObserver* aObserver) + { + GLX_LOG_INFO( "CGlxScrollbar::RemoveObserver" ); + + TInt index = iObservers.Find( aObserver ); + + __ASSERT_DEBUG( index != KErrNotFound, Panic( EGlxPanicIllegalArgument ) ); + + if (index != KErrNotFound) + { + iObservers.Remove( index ); + } + } + +// ----------------------------------------------------------------------------- +// Sets the visible length of the scrollbar +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScrollbar::SetVisibleLength(TUint aVisibleLength) + { + GLX_LOG_INFO( "CGlxScrollbar::SetVisibleLength" ); + + __ASSERT_DEBUG( aVisibleLength > 0, Panic( EGlxPanicIllegalArgument ) ); + + iVisibleLength = aVisibleLength; + + NotifyObservers(); + + Update( 0 ); + } + +// ----------------------------------------------------------------------------- +// Sets the full length of the scrollbar +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScrollbar::SetFullLength(TUint aFullLength, TUint aTransitionTime) + { + GLX_LOG_INFO( "CGlxScrollbar::SetFullLength" ); + + __ASSERT_DEBUG( aFullLength > 0, Panic( EGlxPanicIllegalArgument ) ); + + iFullLength = aFullLength; + + NotifyObservers(); + + Update( aTransitionTime ); + } + +// ----------------------------------------------------------------------------- +// Sets the position of the first visible row in the full length +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxScrollbar::SetPosition(TUint aPosition, TUint aTransitionTime) + { + GLX_LOG_INFO( "CGlxScrollbar::SetPosition" ); + + __ASSERT_DEBUG( aPosition < iFullLength, Panic( EGlxPanicIllegalArgument ) ); + + iPosition = aPosition; + if ( iPosition > iFullLength - iVisibleLength ) + { + iPosition = iFullLength - iVisibleLength; + } + + Update( aTransitionTime ); + } + +// ----------------------------------------------------------------------------- +// Set the textures for the visuals +// ----------------------------------------------------------------------------- +// +void CGlxScrollbar::SetTexturesL() + { + GLX_LOG_INFO( "CGlxScrollbar::SetTexturesL" ); + + CGlxUiUtility* UiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *UiUtility ); + + CGlxTextureManager& textureManager = UiUtility->GlxTextureManager(); + + SetBackgroundTexturesL( textureManager ); + SetThumbTexturesL( textureManager ); + + CleanupStack::PopAndDestroy( UiUtility ); + } + +// ----------------------------------------------------------------------------- +// Set the textures for the visuals in the background layout +// ----------------------------------------------------------------------------- +// +void CGlxScrollbar::SetBackgroundTexturesL(CGlxTextureManager& aTextureManager) + { + GLX_LOG_INFO( "CGlxScrollbar::SetBackgroundTexturesL" ); + + CAlfAnchorLayout& backgroundLayout = + static_cast( iLayout->Visual( KBackgroundLayoutIndex ) ); + + CAlfTexture& bgTopTexture = + aTextureManager.CreateAvkonIconTextureL( KAknsIIDQsnCpScrollBgTop, + TSize( KWidth, KWidth ) ); + + CAlfImageVisual& bgTop = + static_cast( backgroundLayout.Visual( KTopVisualIndex ) ); + bgTop.SetImage( TAlfImage( bgTopTexture ) ); + + CAlfTexture& bgMiddleTexture = + aTextureManager.CreateAvkonIconTextureL( KAknsIIDQsnCpScrollBgMiddle, + TSize( KWidth, KWidth ) ); + + CAlfImageVisual& bgMiddle = + static_cast( backgroundLayout.Visual( KMiddleVisualIndex ) ); + bgMiddle.SetImage( TAlfImage( bgMiddleTexture ) ); + + CAlfTexture& bgBottomTexture = + aTextureManager.CreateAvkonIconTextureL( KAknsIIDQsnCpScrollBgBottom, + TSize( KWidth, KWidth ) ); + + CAlfImageVisual& bgBottom = + static_cast( backgroundLayout.Visual( KBottomVisualIndex ) ); + bgBottom.SetImage( TAlfImage( bgBottomTexture ) ); + } + +// ----------------------------------------------------------------------------- +// Set the textures for the visuals in the thumb layout +// ----------------------------------------------------------------------------- +// +void CGlxScrollbar::SetThumbTexturesL(CGlxTextureManager& aTextureManager) + { + GLX_LOG_INFO( "CGlxScrollbar::SetThumbTexturesL" ); + + CAlfAnchorLayout& thumbLayout = + static_cast( iLayout->Visual( KThumbLayoutIndex ) ); + + CAlfTexture& thumbTopTexture = + aTextureManager.CreateAvkonIconTextureL( KAknsIIDQsnCpScrollHandleTop, + TSize( KWidth, KWidth ) ); + + CAlfImageVisual& thumbTop = + static_cast( thumbLayout.Visual( KTopVisualIndex ) ); + thumbTop.SetImage( TAlfImage( thumbTopTexture ) ); + + CAlfTexture& thumbMiddleTexture = + aTextureManager.CreateAvkonIconTextureL( KAknsIIDQsnCpScrollHandleMiddle, + TSize( KWidth, KWidth ) ); + + CAlfImageVisual& thumbMiddle = + static_cast( thumbLayout.Visual( KMiddleVisualIndex ) ); + thumbMiddle.SetImage( TAlfImage( thumbMiddleTexture ) ); + + CAlfTexture& thumbBottomTexture = + aTextureManager.CreateAvkonIconTextureL( KAknsIIDQsnCpScrollHandleBottom, + TSize( KWidth, KWidth ) ); + + CAlfImageVisual& thumbBottom = + static_cast( thumbLayout.Visual( KBottomVisualIndex ) ); + thumbBottom.SetImage( TAlfImage( thumbBottomTexture ) ); + } + +// ----------------------------------------------------------------------------- +// Set the background or thumb layout anchors +// ----------------------------------------------------------------------------- +// +void CGlxScrollbar::SetAnchors(CAlfAnchorLayout& aLayout) + { + GLX_LOG_INFO( "CGlxScrollbar::SetAnchors" ); + + TInt width = aLayout.Size().Target().AsSize().iWidth; + + aLayout.SetAnchor(EAlfAnchorTopLeft, KTopVisualIndex, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint(0, 0)); + aLayout.SetAnchor(EAlfAnchorBottomRight, KTopVisualIndex, + EAlfAnchorOriginRight, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint(0, width)); + + aLayout.SetAnchor(EAlfAnchorTopLeft, KMiddleVisualIndex, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint(0, width)); + aLayout.SetAnchor(EAlfAnchorBottomRight, KMiddleVisualIndex, + EAlfAnchorOriginRight, EAlfAnchorOriginBottom, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint(0, -width)); + + aLayout.SetAnchor(EAlfAnchorTopLeft, KBottomVisualIndex, + EAlfAnchorOriginLeft, EAlfAnchorOriginBottom, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint(0, -width)); + aLayout.SetAnchor(EAlfAnchorBottomRight, KBottomVisualIndex, + EAlfAnchorOriginRight, EAlfAnchorOriginBottom, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint(0, 0)); + + aLayout.UpdateChildrenLayout(); + } + +// ----------------------------------------------------------------------------- +// Update the scrollbar +// ----------------------------------------------------------------------------- +// +void CGlxScrollbar::Update(TUint aTransitionTime) + { + GLX_LOG_INFO( "CGlxScrollbar::Update" ); + + TSize layoutSize = iLayout->Size().Target().AsSize(); + + TSize thumbSize(layoutSize); + TPoint thumbPos( 0, 0 ); + if ( iFullLength > iVisibleLength ) + { + thumbSize.iHeight = layoutSize.iHeight * iVisibleLength / iFullLength; + thumbPos.iY = layoutSize.iHeight * iPosition / iFullLength; + } + + CAlfAnchorLayout& backgroundLayout = + static_cast( iLayout->Visual( KBackgroundLayoutIndex ) ); + + backgroundLayout.SetPos( TPoint( 0, 0 ) ); + backgroundLayout.SetSize( layoutSize ); + SetAnchors( backgroundLayout ); + + CAlfAnchorLayout& thumbLayout = + static_cast( iLayout->Visual( KThumbLayoutIndex ) ); + + thumbLayout.SetPos( thumbPos, aTransitionTime ); + thumbLayout.SetSize( thumbSize, aTransitionTime ); + SetAnchors( thumbLayout ); + } + +// ----------------------------------------------------------------------------- +// Notify observers if the scrollbar is scrollable +// ----------------------------------------------------------------------------- +// +void CGlxScrollbar::NotifyObservers() + { + GLX_LOG_INFO( "CGlxScrollbar::NotifyObservers" ); + + TBool scrollable(EFalse); + if ( iFullLength > iVisibleLength ) + { + scrollable = ETrue; + } + + TInt count = iObservers.Count(); + for ( TInt i = 0; i < count; ++i ) + { + iObservers[i]->HandleScrollable(scrollable); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxsetappstate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxsetappstate.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2008-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: Update PCFW with current application state +* +*/ + + + + +/** + * @internal reviewed 03/07/2007 by David Holland + */ + +#include "glxsetappstate.h" + +#include + +///@todo use 'real' header when available in SDK +#include +#include + +// ----------------------------------------------------------------------------- +// SetState +// ----------------------------------------------------------------------------- +// +EXPORT_C void GlxSetAppState::SetState(TGlxAppState aAppState) + { + GLX_LOG_INFO1("GlxSetAppState::SetState state (%d)", aAppState); + + KPCFWAppStatePSGalleryState appState; + + TBool validAppState = ETrue; + + switch(aAppState) + { + case EGlxInCarouselView: + { + appState = GalleryInCarouselView; + } + break; + case EGlxInFullScreenView: + { + appState = GalleryInFullScreenView; + } + break; + case EGlxInZoomedView: + { + appState = GalleryInZoomedView; + } + break; + case EGlxInVideoPlaybackView: + { + appState = GalleryInVideoPlaybackView; + } + break; + case EGlxInSlideshowView: + { + appState = GalleryInSlideshowView; + } + break; + case EGlxInListView: + { + appState = GalleryInListView; + } + break; + case EGlxInTagBrowserView: + { + appState = GalleryInTagBrowserView; + } + break; + case EGlxInMapBrowserView: + { + appState = GalleryInMapBrowserView; + } + break; + case EGlxInTextEntry: + { + appState = GalleryInTextEntry; + } + break; + default: + { + validAppState = EFalse; + } + break; + } + + if(validAppState) + { + // ignore any error + RProperty::Set(KPCFWAppStatePSUid, KPCFWAppStatePSGallery, appState); + } + } + +// ----------------------------------------------------------------------------- +// AppState +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxAppState GlxSetAppState::AppState() + { + TGlxAppState appState = EGlxAppStateUndefined; + TInt pcfwState; + + TInt err = + RProperty::Get(KPCFWAppStatePSUid, KPCFWAppStatePSGallery, pcfwState); + + if(err == KErrNone) + { + switch(pcfwState) + { + case GalleryInCarouselView: + { + appState = EGlxInCarouselView; + } + break; + case GalleryInFullScreenView: + { + appState = EGlxInFullScreenView; + } + break; + case GalleryInZoomedView: + { + appState = EGlxInZoomedView; + } + break; + case GalleryInVideoPlaybackView: + { + appState = EGlxInVideoPlaybackView; + } + break; + case GalleryInSlideshowView: + { + appState = EGlxInSlideshowView; + } + break; + case GalleryInListView: + { + appState = EGlxInListView; + } + break; + case GalleryInTagBrowserView: + { + appState = EGlxInTagBrowserView; + } + break; + case GalleryInMapBrowserView: + { + appState = EGlxInMapBrowserView; + } + break; + case GalleryInTextEntry: + { + appState = EGlxInTextEntry; + } + break; + default: + + break; + } + } + GLX_LOG_INFO1("GlxSetAppState::AppState state is (%d)", appState); + return appState; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxskinchangemonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxskinchangemonitor.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the CGlxSkinChangeMonitor class +* +*/ + + + + + // Class definition + +#include "glxskinchangemonitor.h" + +//----------------------------------------------------------------------------- +// NewL +//----------------------------------------------------------------------------- +CGlxSkinChangeMonitor* CGlxSkinChangeMonitor::NewL() + { + CGlxSkinChangeMonitor* self = new (ELeave) CGlxSkinChangeMonitor( ); + CleanupStack::PushL( self ); + // 2nd phase + self->ConstructL( ); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +CGlxSkinChangeMonitor::~CGlxSkinChangeMonitor() + { + //ResetAndDestroy()??? + iSkinChangeObservers.Close(); + } + +//----------------------------------------------------------------------------- +// C++ Constructor +//----------------------------------------------------------------------------- +CGlxSkinChangeMonitor::CGlxSkinChangeMonitor( ) + { + } + +//----------------------------------------------------------------------------- +// Symbian 2 phase constructor +//----------------------------------------------------------------------------- +void CGlxSkinChangeMonitor::ConstructL() + { + CreateWindowL(); + } + + +//----------------------------------------------------------------------------- +// HandleResourceChange +//----------------------------------------------------------------------------- +void CGlxSkinChangeMonitor::HandleResourceChange( TInt aType ) + { + // Call base class method + CCoeControl::HandleResourceChange(aType); + + // is it skin change + if( KAknsMessageSkinChange == aType ) + { + TInt obsCount = iSkinChangeObservers.Count(); + for (TInt obsIdx = 0; obsIdx < obsCount; ++obsIdx) + { + iSkinChangeObservers[obsIdx]->HandleSkinChanged(); + } + } + } + +//----------------------------------------------------------------------------- +// AddSkinChangedObserverL +//----------------------------------------------------------------------------- +void CGlxSkinChangeMonitor::AddSkinChangeObserverL( MGlxSkinChangeObserver& aObserver ) + { + iSkinChangeObservers.AppendL( &aObserver ); + } + +//----------------------------------------------------------------------------- +// RemoveSkinChangedObserver +//----------------------------------------------------------------------------- +void CGlxSkinChangeMonitor::RemoveSkinChangeObserver( MGlxSkinChangeObserver& aObserver ) + { + TInt index = iSkinChangeObservers.Find( &aObserver ); + + if ( index != KErrNotFound ) + { + iSkinChangeObservers.Remove( index ); + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxtextentrypopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxtextentrypopup.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2008-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: Text entry popup class for entering textual input +* +*/ + + + + +/** + * @internal reviewed 06/06/2007 by Dave Schofield + */ + +#include "glxtextentrypopup.h" + +#include + +#include "glxuiutility.h" +#include +#include "glxsetappstate.h" +#include + +/** + * TGlxTextEntryPopupRestoreState + * Contains state information to be + * restored when CGlxTextEntryPopup is + * dismissed or if CAknTextQueryDialog::ExecuteLD + * leaves + */ +class TGlxTextEntryPopupRestoreState + { +public: + /** + * Default constructor + */ + TGlxTextEntryPopupRestoreState(); + +public: + /** Pointer to the HUI utility (not owned) */ + CGlxUiUtility* iUiUtility; + + /** Previous screen orientation */ + TGlxOrientation iPreviousOrientation; + + /** Previous application state */ + TGlxAppState iPreviousAppState; + }; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +TGlxTextEntryPopupRestoreState::TGlxTextEntryPopupRestoreState() + { + iUiUtility = NULL; + iPreviousOrientation = EGlxOrientationDefault; + iPreviousAppState = EGlxAppStateUndefined; + } + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxTextEntryPopup* CGlxTextEntryPopup::NewL(const TDesC& aTitle, TDes& aText) + { + CGlxTextEntryPopup* self = new (ELeave) CGlxTextEntryPopup(aText); + CleanupStack::PushL(self); + self->ConstructL(aTitle); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxTextEntryPopup::CGlxTextEntryPopup(TDes& aText) : CAknTextQueryDialog(aText) + { + } + +// ----------------------------------------------------------------------------- +// ExecuteLD +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxTextEntryPopup::ExecuteLD() + { + TRACER( "CGlxTextEntryPopup::ExecuteLD" ); + + TGlxTextEntryPopupRestoreState rollbackState; + // attempt to get current PCFW app state + rollbackState.iPreviousAppState = GlxSetAppState::AppState(); + // set app state to text entry + GlxSetAppState::SetState(EGlxInTextEntry); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *uiUtility ); + + // create cleanup stack item to revert previous state if dlg leaves + TCleanupItem cleanupItem( RollbackState, &rollbackState ); + CleanupStack::PushL( cleanupItem ); + + rollbackState.iUiUtility = uiUtility; + rollbackState.iPreviousOrientation = uiUtility->AppOrientation(); + + // If Device supports text-entry mode only in portrait, + // then the orientation has to be forced to EGlxOrientationTextEntry here. + if(uiUtility->IsPenSupported()) + { + uiUtility->SetAppOrientationL( EGlxOrientationDefault ); + } + else + { + uiUtility->SetAppOrientationL( EGlxOrientationTextEntry ); + } + + TInt retVal = CAknTextQueryDialog::ExecuteLD(R_GLX_TEXT_ENTRY_QUERY); + + CleanupStack::PopAndDestroy( &rollbackState ); // cleanupItem + CleanupStack::PopAndDestroy( uiUtility ); + + return retVal; + } + +// ----------------------------------------------------------------------------- +// UpdateLeftSoftKeyL +// ----------------------------------------------------------------------------- +// +void CGlxTextEntryPopup::UpdateLeftSoftKeyL() + { + //Check whether the entered text length is bigger than zero + if( !CheckIfEntryTextOk () && !iAllowEmptyString) + { + MakeLeftSoftkeyVisible(EFalse); + } + else + { + MakeLeftSoftkeyVisible(ETrue); + } + } + +// ----------------------------------------------------------------------------- +// SetLeftSoftKeyL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxTextEntryPopup::SetLeftSoftKeyL(TBool aAllowEmptyString) + { + iAllowEmptyString = aAllowEmptyString; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxTextEntryPopup::ConstructL(const TDesC& aTitle) + { + SetPromptL(aTitle); + } + +// ----------------------------------------------------------------------------- +// RollbackState +// ----------------------------------------------------------------------------- +// +void CGlxTextEntryPopup::RollbackState(TAny* aParam) + { + TRACER( "CGlxTextEntryPopup::RollbackState" ); + TGlxTextEntryPopupRestoreState* restoreState + = static_cast( aParam ); + + // Rollback app state to previous state + GlxSetAppState::SetState( restoreState->iPreviousAppState ); + + if ( restoreState->iUiUtility) + { + TRAP_IGNORE( restoreState->iUiUtility->SetAppOrientationL( + restoreState->iPreviousOrientation ) ); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxuiutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxuiutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,720 @@ +/* +* Copyright (c) 2008-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: ALFTK utilities +* +*/ + + + + + +// INCLUDE FILES +// Class header + +// USER INCLUDE FILES +#include "glxuiutility.h" +#include "glxscreenfurniture.h" +#include "glxskinchangemonitor.h" + +// SYSTEM INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For feature constants + +// Internal incudes +#include // for CGlxResolutionManager +#include +#include +#include // for GLX_ASSERT_DEBUG +#include // for ETvConnectionChanged +#include // for CGlxTv +#include +#include +#include +#include +#include +//Hg +//#include + +// TV size constants +using namespace glxTvOut; + + +// ----------------------------------------------------------------------------- +// UtilityL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxUiUtility* CGlxUiUtility::UtilityL() + { + TRACER("CGlxUiUtility::UtilityL()"); + return CGlxSingletonStore::InstanceL(&NewL); + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::Close() + { + TRACER("CGlxUiUtility::Close()"); + CGlxSingletonStore::Close(this); + } + +// ----------------------------------------------------------------------------- +// 2-phase constructor +// ----------------------------------------------------------------------------- +// +CGlxUiUtility* CGlxUiUtility::NewL() + { + TRACER("CGlxUiUtility::NewL()"); + CGlxUiUtility* obj = new (ELeave) CGlxUiUtility(); + CleanupStack::PushL(obj); + obj->ConstructL(); + CleanupStack::Pop(obj); + return obj; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxUiUtility::CGlxUiUtility() +: iNavigationDirection( EGlxNavigationForwards ), + iOrientation( EGlxOrientationUninitialised ) + { + TRACER("CGlxUiUtility::CGlxUiUtility()"); + iAppUi = CCoeEnv::Static()->AppUi(); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxUiUtility::ConstructL() + { + TRACER("CGlxUiUtility::ConstructL()"); + iSettingsModel = CGlxSettingsModel::InstanceL(); + + + // Always start in default orientation + //SetAppOrientationL(EGlxOrientationDefault); + + iOrientation = EGlxOrientationDefault; + // in emulator use bitgdi as open GL does not support changing orientation + + // Ferhan (28/06/07) : commenting out usage of opengl because causing drawing problems when using + // the preview list (gldrawelements method in opengl seems to hang) + // iEnv = CHuiEnv::Static(); + //@ Fix for error id EABI-7RJA8C + iEnv = CAlfEnv::Static(); + if (!iEnv) + { + iEnv = CAlfEnv::NewL(); + // change to this on hw that supports opengl + // iEnv = CHuiEnv::NewL( EHuiRendererGles10 ); + } + else + { + iShared = ETrue; + } + iGlxTextureManager = CGlxTextureManager::NewL(iEnv->TextureManager()); + + //Skin change observer + iGlxSkinChangeMonitor = CGlxSkinChangeMonitor::NewL(); + iAppUi->AddToStackL(iGlxSkinChangeMonitor); + + // Add TextureManager as a skin change event observer here itself because + // calling CGlxHuiUtility::Utility() in CGlxTextureManager creates a recursive call + // to CGlxTextureManager::NewL which again calls CGlxHuiUtility::Utility() and so on. + AddSkinChangeObserverL( *iGlxTextureManager ); + GridIconSizeL(); + TRect rect; + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect ); + iAlfDisplay = &iEnv->NewDisplayL(rect, + CAlfEnv::ENewDisplayAsCoeControl | CAlfEnv::ENewDisplayFullScreen ); + + iEnv->AddActionObserverL (this); + + // Use the Avkon skin background as the display background. + //iAlfDisplay->SetClearBackgroundL(CAlfDisplay::EClearWithSkinBackground); + + // create the resoltuion manager - needs to be informed when screen size + // changes + iGlxResolutionManager = CGlxResolutionManager::NewL(); + + iGlxTvOut = CGlxTv::NewL(*this); + + // Is the TV Out display on + // Note that this also sets the initial size for the resolution manager + HandleTvStatusChangedL( ETvConnectionChanged ); + + iScreenFurniture = CGlxScreenFurniture::NewL(*this); + +// iContextUtility = CHgContextUtility::NewL(); +// iContextUtility->RePublishWhenFgL( ETrue ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxUiUtility::~CGlxUiUtility() + { + TRACER("CGlxUiUtility::~CGlxUiUtility()"); + GLX_LOG_INFO("~CGlxUiUtility"); + delete iScreenFurniture; +/* if (iContextUtility) + { + delete iContextUtility; + iContextUtility = NULL; + } +*/ + // Destroy TV Out related objects + delete iGlxTvOut; + delete iGlxResolutionManager; + DestroyTvOutDisplay(); + + if( iGlxTextureManager ) + { + RemoveSkinChangeObserver( *iGlxTextureManager ); + delete iGlxTextureManager; + } + + if(iAlfDisplay) + { + delete iAlfDisplay; + } + + iEnv->RemoveActionObserver(this); + + if ( iGlxSkinChangeMonitor ) + { + iAppUi->RemoveFromStack(iGlxSkinChangeMonitor); + delete iGlxSkinChangeMonitor; + } + + if (!iShared) + { + delete iEnv; + } + + iTextStyles.Close(); + if ( iSettingsModel ) + { + iSettingsModel->Close(); + } + + } + +// ----------------------------------------------------------------------------- +// Env +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfEnv* CGlxUiUtility::Env() const + { + TRACER("CGlxUiUtility::Env()"); + return iEnv; + } + +// ----------------------------------------------------------------------------- +// Display +// ----------------------------------------------------------------------------- +// +EXPORT_C CAlfDisplay* CGlxUiUtility::Display() const + { + TRACER("CGlxUiUtility::Display()"); + return iAlfDisplay; + } + +// ----------------------------------------------------------------------------- +// ShowAlfDisplay +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxUiUtility::ShowAlfDisplayL() + { + TRACER("CGlxUiUtility::ShowAlfDisplayL()"); + // make it visible as well + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + + CCoeControl* contl = (CCoeControl*)uiUtility->Display()->ObjectProvider(); + contl->MakeVisible (ETrue); + + uiUtility->Close(); + // no need to do anything else, the coecontrol handles the visibility + } + +// ----------------------------------------------------------------------------- +// HideAlfDisplay +// ----------------------------------------------------------------------------- +EXPORT_C void CGlxUiUtility::HideAlfDisplayL() + { + TRACER("CGlxUiUtility::HideAlfDisplayL()"); + // make it invisible as well (this might be all that is needed) + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + + CCoeControl* contl = (CCoeControl*)uiUtility->Display()->ObjectProvider(); + contl->MakeVisible (EFalse); + + uiUtility->Close(); + // no need to do anything else, the coecontrol handles the visibility + } + +// ----------------------------------------------------------------------------- +// GlxTextureManager +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxTextureManager& CGlxUiUtility::GlxTextureManager() + { + TRACER("CGlxUiUtility::GlxTextureManager()"); + __ASSERT_ALWAYS(iGlxTextureManager, Panic(EGlxPanicLogicError)); + return *iGlxTextureManager; + } + +// ----------------------------------------------------------------------------- +// ViewNavigationDirection +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection() + { + TRACER("CGlxUiUtility::ViewNavigationDirection()"); + return iNavigationDirection; + } + + +// ----------------------------------------------------------------------------- +// SetViewNavigationDirection +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::SetViewNavigationDirection(TGlxNavigationDirection aDirection) + { + TRACER("CGlxUiUtility::SetViewNavigationDirection()"); + iNavigationDirection = aDirection; + } + +// ----------------------------------------------------------------------------- +// DisplaySize +// ----------------------------------------------------------------------------- +// +EXPORT_C TSize CGlxUiUtility::DisplaySize() const + { + TRACER("CGlxUiUtility::DisplaySize()"); + //return Env()->PrimaryDisplay().Size(); + const TRect& rect = Env()->PrimaryDisplay().VisibleArea(); + return rect.Size(); + } + +// ----------------------------------------------------------------------------- +// TextStyleIdL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxUiUtility::TextStyleIdL(TInt aFontId, TInt aSizeInPixels) + { + TRACER("CGlxUiUtility::TextStyleIdL()"); + TInt id = 0; + TBool found = EFalse; + TInt index = 0; + TInt count = iTextStyles.Count(); + // Look for existing style with this font and size + while(index < count && !found) + { + if(iTextStyles[index].iSizeInPixels == aSizeInPixels && + iTextStyles[index].iFontId == aFontId) + { + // found it. Prepare to return found id + id = iTextStyles[index].iStyleId; + found = ETrue; + } + else + { + // check next style + index++; + } + } + if(!found) + { + // Create a new style based on the required font + CAlfTextStyleManager& styleMan = iEnv->TextStyleManager(); + + // remember its id for return later + id = styleMan.CreatePlatformTextStyleL(aFontId); + + // Get style. It is not owned + CAlfTextStyle* style = styleMan.TextStyle(id); + + // Set this style to have required size and to be normal weight + style->SetTextSizeInPixels(aSizeInPixels); + + style->SetBold(EFalse); + + // Add this style to list + TGlxTextStyle textStyle(aFontId, aSizeInPixels, id); + iTextStyles.AppendL(textStyle); + } + return id; + } + +// --------------------------------------------------------------------------- +// SetAppOrientationL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::SetAppOrientationL(TGlxOrientation aOrientation) + { + TRACER("CGlxUiUtility::SetAppOrientationL()"); + GLX_LOG_INFO1( "CGlxUiUtility::SetAppOrientationL(%d)", aOrientation ); + + if ( iOrientation != aOrientation ) + { + CAknAppUiBase::TAppUiOrientation orientation( + CAknAppUiBase::EAppUiOrientationUnspecified); + + switch ( aOrientation ) + { + case EGlxOrientationTextEntry: + if ( iSettingsModel->IsTextEntryPortrait() ) + { + orientation = CAknAppUiBase::EAppUiOrientationPortrait; + break; + } + // else fall through to EGlxOrientationDefault + + case EGlxOrientationDefault: + { + if ( CGlxSettingsModel::ELandscape + == iSettingsModel->SupportedOrientations() ) + { + orientation = CAknAppUiBase::EAppUiOrientationLandscape; + } + else + { + orientation = CAknAppUiBase::EAppUiOrientationAutomatic; + } + } + break; + + case EGlxOrientationLandscape: + orientation = CAknAppUiBase::EAppUiOrientationLandscape; + break; + + default: + Panic(EGlxPanicIllegalArgument); + break; + } + + static_cast(iAppUi)->SetOrientationL(orientation); + iOrientation = aOrientation; + } + } + +// --------------------------------------------------------------------------- +// AppOrientation +// --------------------------------------------------------------------------- +// +EXPORT_C TGlxOrientation CGlxUiUtility::AppOrientation() const + { + TRACER("CGlxUiUtility::AppOrientation()"); + return iOrientation; + } +// ----------------------------------------------------------------------------- +// GetGridIconSize +// ----------------------------------------------------------------------------- +// +EXPORT_C TSize CGlxUiUtility::GetGridIconSize() + { + TRACER("CGlxUiUtility::GetGridIconSize()"); + return iGridIconSize; + } +// ----------------------------------------------------------------------------- +// HandleTvStatusChangedL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::HandleTvStatusChangedL( TTvChangeType aChangeType ) + { + TRACER("CGlxUiUtility::HandleTvStatusChangedL()"); + + if ( aChangeType == ETvDisplayNotVisible ) // Visibility event + { + iEnv->Release(); + return; // don't redraw the display + } + else if ( aChangeType == ETvDisplayIsVisible ) // Visibility event + { + iEnv->RestoreL(); + } + else // TV Connection event + { + GLX_ASSERT_DEBUG( (aChangeType == ETvConnectionChanged), + Panic( EGlxPanicLogicError ), + "Expected TV Connection Changed" ); + + if ( iGlxTvOut->IsConnected() ) + { + // Remove the TV Diplay - a ETvConnectionChanged may result from + // the user changing the central repository TV values. + DestroyTvOutDisplay(); + CreateTvOutDisplayL(); + } + else + { + DestroyTvOutDisplay(); + // Set the display size to that of the phone + iGlxResolutionManager->SetScreenSizeL( DisplaySize() ); + } + } + + if (iTvDisplay) + { + iTvDisplay->SetDirty(); // redraw + } + } + +// ----------------------------------------------------------------------------- +// SetRotatedImageSize +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::SetRotatedImageSize(TSize aRotatedImageSize) + { + iRotatedImageSize = aRotatedImageSize; + } + +// ----------------------------------------------------------------------------- +// SetRotatedImageSize +// ----------------------------------------------------------------------------- +// +EXPORT_C TSize CGlxUiUtility::GetRotatedImageSize() + { + return iRotatedImageSize; + } + +void CGlxUiUtility::HandleActionL (const TAlfActionCommand &aActionCommand) + { + TRACER("CGlxUiUtility::HandleActionL()"); + + if(aActionCommand.Id() == KAlfActionIdDeviceLayoutChanged ) + { + // check if tv-out is connected + if ( iGlxTvOut->IsConnected() ) + { + // The primary (phone) display has changed orientation + DestroyTvOutDisplay(); + CreateTvOutDisplayL(); //@ will generate false positive in codescanner + } + else + { + // reset the screen size in case the orientation changed for example + iGlxResolutionManager->SetScreenSizeL( DisplaySize() ); + } + } + } + +// ----------------------------------------------------------------------------- +// DestroyTvOutDisplay +// ----------------------------------------------------------------------------- +// +void CGlxUiUtility::DestroyTvOutDisplay() + { + TRACER("CGlxUiUtility::DestroyTvOutDisplay()"); + if (iTvDisplay) + { + delete iTvDisplay; + iTvDisplay = NULL; + // Remove Primary Window Refresh observer + //Display()->iRefreshObservers.Remove( *this ); + iEnv->PauseRefresh(); + // Disable Primary Window Visibility events + CCoeControl* contl = (CCoeControl*)iEnv->PrimaryDisplay().ObjectProvider(); + contl->DrawableWindow()->DisableVisibilityChangeEvents(); + } + } + + +// ----------------------------------------------------------------------------- +// CreateTvOutDisplayL +// ----------------------------------------------------------------------------- +// +void CGlxUiUtility::CreateTvOutDisplayL() + { + TRACER("CGlxUiUtility::CreateTvOutDisplayL()"); + + // Get the TV Out display size buffer in pixels + TSize tvOutDisplaySz = iGlxTvOut->ScreenSizeL(); + + // Calculate the TV Out buffer by using + // A) aspect ratio that matches the phone screen and + // B) size that fills the TV so that either width or height of TV is fully + // used (in practice height is always restricting dimension). + TSize phoneDisplaySz = DisplaySize(); + + // Scale the tv display size to match that of the phone display size + tvOutDisplaySz = TSize (tvOutDisplaySz.iHeight * phoneDisplaySz.iWidth + / phoneDisplaySz.iHeight, tvOutDisplaySz.iHeight ); + const TRect tvOutDisplayBuffer( tvOutDisplaySz ); + + // Commenting out Creation of second display as it goes into posting surface, + // Right now, only cloning is going to be the funcationality and posting would be done + // only for specific views (FS , Zoom and Slideshow) +// if (!iTvDisplay) +// { +// iTvDisplay = &iEnv->NewDisplayL( tvOutDisplayBuffer, +// CAlfEnv::ENewDisplayAsCoeControl, +// iGlxTvOut->IsWidescreen() ? CAlfDisplay::EDisplayTvOutWide : +// CAlfDisplay::EDisplayTvOut ); +// +// if (iTvDisplay) +// { +// // Use the Avkon skin background as the display background. +// iTvDisplay->SetClearBackgroundL( +// CAlfDisplay::EClearWithSkinBackground ); +// //Todo +// // Primary Window Refresh observer +// iEnv->SetRefreshMode(EAlfRefreshModeAutomatic); +// } +// } + + // Set the TV screen size + iGlxResolutionManager->SetScreenSizeL( tvOutDisplaySz ); + } + +// ----------------------------------------------------------------------------- +// AddSkinChangeObserverL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::AddSkinChangeObserverL(MGlxSkinChangeObserver& aObserver) + { + TRACER("CGlxUiUtility::AddSkinChangeObserverL()"); + iGlxSkinChangeMonitor->AddSkinChangeObserverL( aObserver ); + } + +// ----------------------------------------------------------------------------- +// RemoveSkinChangeObserver +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxUiUtility::RemoveSkinChangeObserver(MGlxSkinChangeObserver& aObserver) + { + TRACER("CGlxUiUtility::RemoveSkinChangeObserver()"); + iGlxSkinChangeMonitor->RemoveSkinChangeObserver( aObserver ); + } + +// ----------------------------------------------------------------------------- +// ScreenFurniture +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxScreenFurniture* CGlxUiUtility::ScreenFurniture() + { + return iScreenFurniture; + } + +// ----------------------------------------------------------------------------- +// Context Utility for Teleport +// ----------------------------------------------------------------------------- +// +/*EXPORT_C CHgContextUtility* CGlxUiUtility::ContextUtility() + { + return iContextUtility; + } +*/ +// ----------------------------------------------------------------------------- +// IsPenSupported +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxUiUtility::IsPenSupported() + { + TRACER("CGlxUiUtility::IsPenSupported"); + + return AknLayoutUtils::PenEnabled(); + } + +// ----------------------------------------------------------------------------- +// GridIconSize +// ----------------------------------------------------------------------------- +// +void CGlxUiUtility::GridIconSizeL() + { + TRACER("CGlxUiUtility::GridIconSize()"); + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + + if(FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch )) + { + iGridIconSize = TSize(111,83); + } + else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640)) + { + iGridIconSize = TSize(146,110); + } + else + { + iGridIconSize = TSize(146,110); + } + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + } + + + +EXPORT_C TBool CGlxUiUtility::IsExitingState() + { + TRACER("CGlxUiUtility::ExitingState"); + RDebug::Printf("iIsExiting = %d", iIsExiting); + return iIsExiting; + } + +EXPORT_C void CGlxUiUtility::SetExitingState(TBool aIsExiting) + { + TRACER("CGlxUiUtility::SetExitingState"); + iIsExiting = aIsExiting; + } + + +// ----------------------------------------------------------------------------- +// VisibleItemsInPageGranularityL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxUiUtility::VisibleItemsInPageGranularityL() + { + TRACER("CGlxUiUtility::VisibleItemsInPageGranularityL"); + + //TBD: In MCL 9.1/Corolla env currently the feature flags + //KFeatureIdLayout640_480 and KFeatureIdLayout480_640 are not defined. + //so making the default granularity as 21 instead of 15. + //Need to replace with KGlxDefaultVisibleItemsGranularity after + //getting the feature flag. + TInt ret = KGlxVGAVisibleItemsGranularity; + FeatureManager::InitializeLibL(); + + if (FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || + FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch )) + { + ret = KGlxQHDVisibleItemsGranularity; + } + else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || + FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || + FeatureManager::FeatureSupported(KFeatureIdLayout480_640)) + { + ret = KGlxVGAVisibleItemsGranularity; + } + FeatureManager::UnInitializeLib(); + return ret; + } + + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxuiutilityCoeControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxuiutilityCoeControl.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the CGlxUiUtilityCoeControl class +* +*/ + + + + +#include "glxuiutilitycoecontrol.h" // Class definition + +#include +#include +#include + +//----------------------------------------------------------------------------- +// NewL +//----------------------------------------------------------------------------- +CGlxUiUtilityCoeControl* CGlxUiUtilityCoeControl::NewL( + CHuiEnv& aEnv, AknLayoutUtils::TAknLayoutMetrics aArea, TInt aFlags ) + { + CGlxUiUtilityCoeControl* self = + new (ELeave) CGlxUiUtilityCoeControl( aEnv ); + CleanupStack::PushL( self ); + // 2nd phase + self->ConstructL( aArea, aFlags ); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +CGlxUiUtilityCoeControl::~CGlxUiUtilityCoeControl() + { + } + +//----------------------------------------------------------------------------- +// SetArea +//----------------------------------------------------------------------------- +TRect CGlxUiUtilityCoeControl::SetArea( + AknLayoutUtils::TAknLayoutMetrics aArea ) + { + TRect rect; + // remember the area name for the orientation changes + iArea = aArea; + // ask for the rect of the named area now + AknLayoutUtils::LayoutMetricsRect( iArea, rect ); + // set the new rect + SetRect( rect ); + // return the rect + return rect; + } + +//----------------------------------------------------------------------------- +// C++ Constructor +//----------------------------------------------------------------------------- +CGlxUiUtilityCoeControl::CGlxUiUtilityCoeControl( CHuiEnv& aEnv ) + : CHuiDisplayCoeControl( aEnv ) + { + } + +//----------------------------------------------------------------------------- +// ConstructL +//----------------------------------------------------------------------------- +void CGlxUiUtilityCoeControl::ConstructL( + AknLayoutUtils::TAknLayoutMetrics aArea, TInt aFlags ) + { + // set the area, as a side product we get the rect + TRect rect = SetArea( aArea ); + // and construct the display with rect and flags + CHuiDisplayCoeControl::ConstructL( rect, aFlags ); + iAppUi = CCoeEnv::Static()->AppUi(); + } + +//----------------------------------------------------------------------------- +// HandleResourceChange +//----------------------------------------------------------------------------- +void CGlxUiUtilityCoeControl::HandleResourceChange( TInt aType ) + { + // Call base class method + CCoeControl::HandleResourceChange(aType); + + // Was it orientation change + if( KEikDynamicLayoutVariantSwitch == aType ) + { + // re-set the area, it sets the rect + SetArea( iArea ); + // Notify skin to change size + TRAP_IGNORE( Env().Skin().NotifyDisplaySizeChangedL() ); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/glxvisualutilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/glxvisualutilities.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2008-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: ALF visual utilities +* +*/ + + + + +// CLASS HEADER +#include "glxvisualutilities.h" + +// EXTERNAL HEADERS +#include +#include + +namespace NGlxVisualUtilities + { + /** + * TGlxVisualTransferCleanup + * This class handles the awkward situation in visual ownership transfer + * that some of the visuals are transferred to new parent and a leave occurs. + * In leave case we need to undo the ownership transfer completely. + * This class also removes the ownership from the old control in case + * there was no leave. + * @usage: + * \code + * RArray allvisuals; + * TGlxVisualTransferCleanup cleanup( allvisuals ); + * // set the parent to remove from to be the new one + * cleanup.iParentToRemoveFrom = aNewParent; + * CleanupClosePushL( cleanup ); + * // start to append the visuals to the new parent + * // in case of leave they are removed from new parent + * RecurseAndTransferVisualsL( visualcleanup, aVisual, aNewParent ); + * // set the parent to remove to be the old one + * cleanup.iParentToRemoveFrom = oldParent; + * // remove the item from cleanupstack, + * // this removes the visuals from their old parent + * CleanupStack::PopAndDestroy( &cleanup ); + * \endcode + */ + NONSHARABLE_CLASS( TGlxVisualTransferCleanup ) + { + public: + + /** + * Constructor. + * @param aArray, the array of Visuals + * @param aOldParent, the old parent of visuals + * @param aNewParent, the new parent for visuals + */ + inline TGlxVisualTransferCleanup( + RArray& aArray ) + : iArray( aArray ) + { + } + + /** + * Close. Put this class to Cleanupstack with + * CleanupClosePushL so that this gets called in case of a leave + */ + inline void Close() + { + // need to remove all visuals from the given parent + // loop through all the CHuiVisuals + for( TInt i = 0; i < iArray.Count(); ++i ) + { + // remove from the given parent + iParentToRemoveFrom->Remove( iArray[ i ] ); + } + // reset the array + iArray.Reset(); + } + + /// Ref: the parent where to remove + MHuiVisualOwner* iParentToRemoveFrom; + + private: // Implementation + + /// Ref: the array containing all the visuals + RArray& iArray; + + }; + + /** + * Recursive helper method to transfer the ownership of visuals + * @param aVisualCleanup an array containing all visuals in the hierarchy + * @param aVisual the visual to move to new control + * @param aNewParent the new parent for the visual + */ + void RecurseAndTransferVisualsL( + RArray& aVisualCleanup, + CHuiVisual& aVisual, CHuiControl& aNewParent ) + { + // make room to the pointer so that we always succeed in appending + // Note that we need to make room for one new item, thus count + 1 + aVisualCleanup.ReserveL( aVisualCleanup.Count() + 1 ); + // append us to the new parent, Note that for a while we are + // owner by two controls but thats not a problem as the other parent + // is removed by either TGlxVisualTransferCleanup.Close() by CleanupStack + // or destructor of TGlxVisualTransferCleanup and there is no other way + // of getting out from this method (of course panic is ;) + aNewParent.AppendL( &aVisual ); + // add us in the cleanuparray so that we can be removed from the + // new parent in case some of the following AppendLs leave + // this does not fail as reserve was called so no AppendL needed + aVisualCleanup.Append( &aVisual ); + // check if the visual has childs + TInt childCount = aVisual.Count(); + // transfer all the childs + while( childCount-- > 0 ) + { + // get the child + CHuiVisual& childVisual = aVisual.Visual( childCount ); + // call transfer recursively on the child + RecurseAndTransferVisualsL( + aVisualCleanup, childVisual, aNewParent ); + } + } + + // ------------------------------------------------------------------------- + // TransferVisualsL + // ------------------------------------------------------------------------- + EXPORT_C void TransferVisualsL( + CHuiVisual& aVisual, CHuiControl& aNewParent ) + { + // check if parent is already correct + if( &( aVisual.Owner() ) == + static_cast< MHuiVisualOwner* >( &aNewParent ) ) + { + // nothing else to be done + return; + } + // create an array for visual pointers on the stack + RArray< CHuiVisual* > visualcleanup; + // create the cleanup item from stack as well + TGlxVisualTransferCleanup removeParent( visualcleanup ); + // set the parent to remove from to be the new one + removeParent.iParentToRemoveFrom = &aNewParent; + // need to remember the old parent + MHuiVisualOwner* oldParent = &( aVisual.Owner() ); + // put it to cleanupstack so that close gets called in case of leave + CleanupClosePushL( removeParent ); + // run the recursive loop, if it leaves the visuals are removed from + // new parent by the Close method of cleanParents + RecurseAndTransferVisualsL( visualcleanup, aVisual, aNewParent ); + // set the parent to remove to be the old one + removeParent.iParentToRemoveFrom = oldParent; + // remove the item from cleanupstack, + // this removes the visuals from the old parent + CleanupStack::PopAndDestroy( &removeParent ); + // close the array + visualcleanup.Close(); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/uiutilities/src/mglxactivemedialistresolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/uiutilities/src/mglxactivemedialistresolver.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2008-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: Class that resolves the active media list +* +*/ + + + + +#include "mglxactivemedialistresolver.h" + +#include "glxactivemedialistregistry.h" + +// ----------------------------------------------------------------------------- +// Return new object +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxActiveMediaListResolver* MGlxActiveMediaListResolver::InstanceL( + MGlxActiveMediaListChangeObserver* aObserver) + { + return CGlxActiveMediaListRegistry::InstanceL(aObserver); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/bwins/glxcloudviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/bwins/glxcloudviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,16 @@ +EXPORTS + ??0CGlxInfoBubble@@QAE@XZ @ 1 NONAME ; CGlxInfoBubble::CGlxInfoBubble(void) + ??1CGlxInfoBubble@@UAE@XZ @ 2 NONAME ; CGlxInfoBubble::~CGlxInfoBubble(void) + ?BaseConstructL@CGlxInfoBubble@@QAEXAAVCAlfControl@@AAVCAlfEnv@@@Z @ 3 NONAME ; void CGlxInfoBubble::BaseConstructL(class CAlfControl &, class CAlfEnv &) + ?CreateThumbnailTextureL@CGlxInfoBubble@@IAEAAVCAlfTexture@@ABVTGlxMedia@@ABV?$TGlxId@VTGlxIdSpaceIdBase@@@@ABVTSize@@@Z @ 4 NONAME ; class CAlfTexture & CGlxInfoBubble::CreateThumbnailTextureL(class TGlxMedia const &, class TGlxId const &, class TSize const &) + ?DisappearBubble@CGlxInfoBubble@@IAEXXZ @ 5 NONAME ; void CGlxInfoBubble::DisappearBubble(void) + ?DisplayBubbleL@CGlxInfoBubble@@IAEXVTPoint@@AAVCAlfTexture@@ABVTDesC16@@2@Z @ 6 NONAME ; void CGlxInfoBubble::DisplayBubbleL(class TPoint, class CAlfTexture &, class TDesC16 const &, class TDesC16 const &) + ?NewL@CGlxCloudView@@SAPAV1@PAVMGlxMediaListFactory@@ABVTDesC16@@HHHH@Z @ 7 NONAME ; class CGlxCloudView * CGlxCloudView::NewL(class MGlxMediaListFactory *, class TDesC16 const &, int, int, int, int) + ?NewL@CGlxCloudViewImp@Alf@@SAPAV12@PAVMGlxMediaListFactory@@ABVTDesC16@@HHHH@Z @ 8 NONAME ; class Alf::CGlxCloudViewImp * Alf::CGlxCloudViewImp::NewL(class MGlxMediaListFactory *, class TDesC16 const &, int, int, int, int) + ?NewL@CGlxContainerInfoBubble@@SAPAV1@PAVMGlxMediaList@@AAVCAlfEnv@@AAVCAlfControl@@@Z @ 9 NONAME ; class CGlxContainerInfoBubble * CGlxContainerInfoBubble::NewL(class MGlxMediaList *, class CAlfEnv &, class CAlfControl &) + ?NewLC@CGlxCloudView@@SAPAV1@PAVMGlxMediaListFactory@@ABVTDesC16@@HHHH@Z @ 10 NONAME ; class CGlxCloudView * CGlxCloudView::NewLC(class MGlxMediaListFactory *, class TDesC16 const &, int, int, int, int) + ?NewLC@CGlxCloudViewImp@Alf@@SAPAV12@PAVMGlxMediaListFactory@@ABVTDesC16@@HHHH@Z @ 11 NONAME ; class Alf::CGlxCloudViewImp * Alf::CGlxCloudViewImp::NewLC(class MGlxMediaListFactory *, class TDesC16 const &, int, int, int, int) + ?NewLC@CGlxContainerInfoBubble@@SAPAV1@PAVMGlxMediaList@@AAVCAlfEnv@@AAVCAlfControl@@@Z @ 12 NONAME ; class CGlxContainerInfoBubble * CGlxContainerInfoBubble::NewLC(class MGlxMediaList *, class CAlfEnv &, class CAlfControl &) + ?ResetImage@CGlxInfoBubble@@IAEXXZ @ 13 NONAME ; void CGlxInfoBubble::ResetImage(void) + ?UpdateTextureL@CGlxInfoBubble@@IAEXAAVCAlfTexture@@@Z @ 14 NONAME ; void CGlxInfoBubble::UpdateTextureL(class CAlfTexture &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/eabi/glxcloudviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/eabi/glxcloudviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,25 @@ +EXPORTS + _ZN13CGlxCloudView4NewLEP20MGlxMediaListFactoryRK7TDesC16iiii @ 1 NONAME + _ZN13CGlxCloudView5NewLCEP20MGlxMediaListFactoryRK7TDesC16iiii @ 2 NONAME + _ZN14CGlxInfoBubble10ResetImageEv @ 3 NONAME + _ZN14CGlxInfoBubble14BaseConstructLER11CAlfControlR7CAlfEnv @ 4 NONAME + _ZN14CGlxInfoBubble14DisplayBubbleLE6TPointR11CAlfTextureRK7TDesC16S5_ @ 5 NONAME + _ZN14CGlxInfoBubble14UpdateTextureLER11CAlfTexture @ 6 NONAME + _ZN14CGlxInfoBubble15DisappearBubbleEv @ 7 NONAME + _ZN14CGlxInfoBubble23CreateThumbnailTextureLERK9TGlxMediaRK6TGlxIdI17TGlxIdSpaceIdBaseERK5TSize @ 8 NONAME + _ZN14CGlxInfoBubbleC1Ev @ 9 NONAME + _ZN14CGlxInfoBubbleC2Ev @ 10 NONAME + _ZN14CGlxInfoBubbleD0Ev @ 11 NONAME + _ZN14CGlxInfoBubbleD1Ev @ 12 NONAME + _ZN14CGlxInfoBubbleD2Ev @ 13 NONAME + _ZN23CGlxContainerInfoBubble4NewLEP13MGlxMediaListR7CAlfEnvR11CAlfControl @ 14 NONAME + _ZN23CGlxContainerInfoBubble5NewLCEP13MGlxMediaListR7CAlfEnvR11CAlfControl @ 15 NONAME + _ZN3Alf16CGlxCloudViewImp4NewLEP20MGlxMediaListFactoryRK7TDesC16iiii @ 16 NONAME + _ZN3Alf16CGlxCloudViewImp5NewLCEP20MGlxMediaListFactoryRK7TDesC16iiii @ 17 NONAME + _ZTI14CGlxInfoBubble @ 18 NONAME ; ## + _ZTI20CGlxCloudViewControl @ 19 NONAME ; ## + _ZTI23CGlxContainerInfoBubble @ 20 NONAME ; ## + _ZTV14CGlxInfoBubble @ 21 NONAME ; ## + _ZTV20CGlxCloudViewControl @ 22 NONAME ; ## + _ZTV23CGlxContainerInfoBubble @ 23 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Project build file +* +*/ + + + + +#include + +PRJ_EXPORTS +../rom/glxcloudview.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxcloudview.iby) + +PRJ_MMPFILES +glxcloudview.mmp + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/group/glxcloudview.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/group/glxcloudview.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxcloudview.dll +TARGETTYPE dll +UID 0x1000008d 0x200071BA + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxcloudview.cpp +SOURCE glxcloudviewimp.cpp +SOURCE glxcontainerinfobubble.cpp +SOURCE glxcloudviewcontrol.cpp +SOURCE glxinfobubble.cpp +SOURCE glxbubbletimer.cpp + +APP_LAYER_SYSTEMINCLUDE + + +SYSTEMINCLUDE ../../../texturemanager/inc +SYSTEMINCLUDE ../../viewbase/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../commonui/inc + +USERINCLUDE ../inc + + +LIBRARY euser.lib +LIBRARY cone.lib // For CCoeEnv +LIBRARY eikcore.lib //For MEikMenuObserver +LIBRARY avkon.lib // For CAknView +LIBRARY eikcoctl.lib // For MAknToolbarObserver +LIBRARY aknskins.lib // For MAknsSkinInstance +LIBRARY touchfeedback.lib // for touch feedback +LIBRARY flogger.lib + +LIBRARY mpxcommon.lib // For MPX + +LIBRARY glxuiutilities.lib // For CGlxUiUtilities +LIBRARY glxtexturemanager.lib // For CGlxTextureManager + +LIBRARY alfclient.lib // For Alfred Hitchcock framework +LIBRARY alfwidgetmodel.lib // For AlfWidgetEnvExtension +LIBRARY glxmedialists.lib // For MGlxMediaList, +LIBRARY glxviewbase.lib // For CGlxViewBase +LIBRARY glxcommon.lib // for CResourceUtilities + +LIBRARY cdlengine.lib +LIBRARY aknlayout2scalable.lib + + +// End of File \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxbubbletimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxbubbletimer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2008-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: Cloud view implementation + * +*/ + + + + +#ifndef C_GLXBUBBLETIMER_H +#define C_GLXBUBBLETIMER_H + +// INCLUDES +#include + +/** + *MGlxTimerNotifier is a calss to get timer delay functionality + */ +class MGlxTimerNotifier + { +public: + /** + * @function TimerComplete + * @since S60 3.2 + * Function is used to get timer notification + */ + virtual void TimerComplete() = 0; + }; + +//Forward Declaration +class MGlxTimerNotifier; + +/** + * CGlxBubbleTimer is a clsss derived from CActive. + *It provides active objects functionality. + */ +NONSHARABLE_CLASS(CGlxBubbleTimer): public CActive + { +public: + + /** + * @function NewL + * @since S60 3.2 + * Perform the two phase construction + * @param aNotifier - MGlxTimerNotifier class pointer + * @return Pointer to newly created object + */ + static CGlxBubbleTimer *NewL(MGlxTimerNotifier *aNotifier); + + /** + * Destructor. + */ + ~CGlxBubbleTimer(); + + /** + * @function SetDelay + * @since S60 3.2 + * @param aDelay -Time period for timer + */ + void SetDelay(TTimeIntervalMicroSeconds32 aDelay); + +private: + + /** + * @Default c++ contructor + * @since S60 3.2 + * @aNotifier MGlxTimerNotifier class pointer + */ + CGlxBubbleTimer(MGlxTimerNotifier *aNotifier); + + /** + * @function ConstructL + * @since S60 3.2 + * Perform the two phase construction + */ + void ConstructL(); + + /** + * @function RunL + * @since S60 3.2 + * Executed when callback occurs + */ + void RunL(); + + /** + * @function DoCancel + * @since S60 3.2 + */ + void DoCancel(); + +private: + + RTimer iTimer; //Timer object + MGlxTimerNotifier *iNotifier; //Notifier variable + + }; + +#endif // C_GLXBUBBLETIMER_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxcloudinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxcloudinfo.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2008-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: Cloud view implementation + * +*/ + + + + +#ifndef GLXCLOUDINFO_H +#define GLXCLOUDINFO_H + +// CLASS DECLARATION + +/** + * Cloud info stores information about cloud view items + * @lib glxcloudview.lib + */ +class TGlxCloudInfo + { +public: + + TInt iRowNum; //Rownum keeps track of the Cloud View Row number //this can be removed + TInt iStartIndex; //StartIndex of row + TInt iEndIndex; //End Index of row //can be retrieved from a separate function + }; + +#endif // GLXCLOUDINFO_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxcloudview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxcloudview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008-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: Cloud view implementation + * +*/ + + + + +#ifndef C_GLXCLOUDVIEW_H +#define C_GLXCLOUDVIEW_H + +// INCLUDES +#include // For CGlxMediaListViewBase + +// CLASS DECLARATION + +/** + * Cloud view which displays weihted list of items associated with gallery items + * + * @lib glxcloudview.lib + */ +NONSHARABLE_CLASS(CGlxCloudView): public CGlxMediaListViewBase + { +public: + /** + * @function NewL + * @since S60 3.2 + * Perform the two phase construction + * @param aMediaListFactory - Handle to the medialist provider + * @param aViewResId - Resource id of the View + * @param aTitleResId - Resource id for the Title text + * @param aEmptyListResId - Resource id for the empty listbox text + * @param aSoftKeyResId - Resource id for the softkey text + * @paramaSoftkeyMskDisabledId - Resource id for msk disabled. + * @return Pointer to newly created object + */ + IMPORT_C static CGlxCloudView *NewL(MGlxMediaListFactory + *aMediaListFactory, const TDesC &aFileName, TInt aViewResId, + TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId); + + /** + * @function NewLC + * @since S60 3.2 + * Perform the two phase construction + * @param aMediaListFactory - Handle to the medialist provider + * @param aViewResId - Resource id of the View + * @param aTitleResId - Resource id for the Title text + * @param aEmptyListResId - Resource id for the empty listbox text + * @param aSoftKeyResId - Resource id for the softkey text + * @paramaSoftkeyMskDisabledId - Resource id for msk disabled. + * @return Pointer to newly created object + */ + IMPORT_C static CGlxCloudView *NewLC(MGlxMediaListFactory + *aMediaListFactory, const TDesC &aFileName, TInt aViewResId, + TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId); + + /** + * Destructor + */ + virtual ~CGlxCloudView(); + }; + +#endif // C_GLXCLOUDVIEW_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxcloudview.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxcloudview.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: enums used in cloudview +* +*/ + + + +#ifndef GLXCLOUDVIEW_HRH +#define GLXCLOUDVIEW_HRH + +enum TGlxCloudMenuCommands + { + EGlxCmdStartSlideshow = 0x0000FFFF + }; + +#endif // GLXCLOUDVIEW_HRH diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxcloudviewcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxcloudviewcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,575 @@ +/* +* Copyright (c) 2008-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: Carousel control class + * +*/ + + + + +#ifndef C_GLXCLOUDVIEWCONTROL_H +#define C_GLXCLOUDVIEWCONTROL_H + +// INCLUDES + +#include +#include +#include +#include + +//use includes +#include +#include "glxcontainerinfobubble.h" +#include "glxcloudinfo.h" +#include + +#include +using namespace Alf; + + +// FORWARD DECLARATION +class MMPXViewUtility; +class MGlxUiCommandHandler; +class CAlfAnchorLayout; +class CAlfViewportLayout; +class CAlfControl; +class MGlxMediaList; +class CGlxDefaultAttributeContext; +class MMPXCollectionUtility; +class CGlxContainerInfoBubble; +class MTouchFeedback; +class MGlxCloudViewMskObserver; +class MGlxEnterKeyEventObserver; +class MGlxCloudViewLayoutObserver; + +enum TTagEventType + { + ECustomEventFocusDragScroll + }; +/** + * CGlxCloudViewControl + * Alf-based Cloud control + * Creates a weighted list of items based on the associations. + * + */ + +class CGlxCloudViewControl : public CAlfControl,public IAlfWidgetEventHandler + ,public MGlxMediaListObserver + { +public: + + /** + * Perform the two phase construction + * @param aEnv - Env Variable of Alf + * @param aEmptyText - Specifies the text for the empty list + * @param aMediaList - medialist from which attributes will be fetched + * @return Pointer to newly created object + */ + static CGlxCloudViewControl *NewL(CAlfDisplay& aDisplay, CAlfEnv &aEnv, + MGlxMediaList& aMediaList, const TDesC& aEmptyText + ,MGlxCloudViewMskObserver& aObserver + ,MGlxEnterKeyEventObserver& aObserverEnterKeyEvent, + CAlfAnchorLayout *aAnchorLayout,MGlxCloudViewLayoutObserver& aLayoutObserver); + + /** + * Perform the two phase construction + * @param aEnv - Env Variable of Alf + * @param aEmptyText - Specifies the text for the empty list + * @param aMediaList - medialist from which attributes will be fetched + * @return Pointer to newly created object + */ + static CGlxCloudViewControl *NewLC(CAlfDisplay& aDisplay, CAlfEnv &aEnv, + MGlxMediaList& aMediaList, const TDesC& aEmptyText + ,MGlxCloudViewMskObserver& aObserver + ,MGlxEnterKeyEventObserver& aObserverEnterKeyEvent, + CAlfAnchorLayout *aAnchorLayout,MGlxCloudViewLayoutObserver& aLayoutObserver); + + /** + * Destroy the object and release all memory objects + */ + ~CGlxCloudViewControl(); + +public: + /** + * Used to identify event handlers that are capable of handling + * a specified key or custom event. Pointer event handlers cannot be + * identified directly, since they are dependent on the presentation. + * Therefore, pointer event handlers should be associated with + * a custom event ID that can be used to simulate the actual pointer event. + * + * @since S60 ?S60_version + * @param aEvent The event. + * @return ETrue if the event can be processed. Otherwise EFalse. + */ + bool accept ( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + /** + * @see IAlfWidgetEventHandler + */ + virtual AlfEventStatus offerEvent ( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + + + /** + * Sets AlfWidgetEventHandlerInitData to event handler. + * + * @param aData A data structure which contains for example id of the event + * handler. + */ + virtual void setEventHandlerData( const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + } + + /** + * Defines the widget states, where the event handler is active. + * By default, if this method is not called, the event handler is expected + * to be active in all states. + * + * @param aStates A bitmask defining the widget states, where the event + * handler is active. The low 16 bits are reserved for the states + * defined by the framework in . The high 16 bits are + * available for states defined by the client code. + */ + void setActiveStates ( unsigned int aStates ); + + IAlfInterfaceBase* makeInterface ( const IfId& aType ); + + /** + * Returns the type of EventHandler. + * @see IAlfWidgetEventHandler::AlfEventHandlerType + * + * @return The type of event handler. + */ + AlfEventHandlerType eventHandlerType(); + + /** + * Returns information about the phase in the event handling cycle in + * which the event hadler will be executed. + * @see IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase + * + * @return Event handler execution phase. + */ + AlfEventHandlerExecutionPhase eventExecutionPhase(); + + /** + * Returns AlfWidgetEventHandlerInitData. + * + * @return A pointer to AlfWidgetEventHandlerInitData structure which contains + * for example id of the event handler. + */ + virtual AlfWidgetEventHandlerInitData* eventHandlerData() + { + return NULL; + } + + /** + * initialises data for scrollbar model + * @param scrollbar widget + */ + void InitializeScrollBar(IAlfScrollBarWidget* aScrollBarWidget); + +private: + /** + * Perform the two phase construction + * @param aEvent - key Event to handle + * @return EKeyWasConsumed if key event is processed, + * otherwise EKeyWasNotConsumed + */ + TBool OfferEventL(const TAlfEvent &aEvent); + + /** + * @function HandleKeyUp + * + */ + void HandleKeyUpL(); + + + /** + * @since S60 3.2 + * + */ + void HandleLayoutFocusChange(); + + /** + * @since S60 3.2 + * + */ + void HandleKeyDownL(); + /** + /** + * @since S60 3.2 + * + */ + void UpdateLayout(); + + /** + * Displays the empty cloud view when there are no tags to diplay + */ + void DisplayEmptyCloudViewL(); + + + /** + * constructor + * @param aEnv - Env Variable of Alf + * @param aMediaList - medialist from which attributes will be fetched + * @param aMediaList - medialist from which attributes will be fetched + */ + CGlxCloudViewControl(CAlfEnv &aEnv, + MGlxMediaList& aMediaList,MGlxCloudViewMskObserver& aObserver,MGlxEnterKeyEventObserver& aObserverEnterKeyEvent + ,MGlxCloudViewLayoutObserver& aLayoutObserver); + + /** + * Perform the two phase construction + * @param aStartPoint - start point for draeing the row + * @param aRowHeight - height of the row + * @param aRowStartIndex - start index of row + * @param aRowEndIndex- Index upto which items will be drawn + * @return + */ + TInt LayoutVisibleRows(TPoint aStartPoint,TInt aRowStartIndex, TInt + aRowEndIndex); + + + + /** + * Perform the two phase construction + * @param aStartRowIndex - row index + * @return + */ + void LayoutVisibleArea(/*TInt aStartRowIndex*/); + + /** + * returns the rownumber for a particular index. + * @param aItemIndex - row index + * @return rownum + */ + TInt RowNumber(TInt aItemIndex) const; + + /** + * Updates the focus whenever there is a change in focus of the item. + */ + void FocusUpdate(); + + /** + * Perform the second phase of two phase construction + * @param aEmptyText - Specifies the text for the empty list + */ + void ConstructL(const TDesC& aEmptyText,CAlfDisplay& aDisplay,CAlfAnchorLayout *aAnchorLayout); + + /** + * Updates Row Structure + * + */ + void UpdateRowDataL(); + + + /** + * Returns maximum value of usage Count + * + */ + TInt MaxUsageCount(); + + + /** + * @param aIndex - Media List Index + * Returns usage count for a given index + * */ + TInt UsageCount(TInt aIndex); + + + + /** + * @function FetchAttributeFromCacheL + * + * */ + void FetchAttributeFromCacheL(); + + + /** + * Utility method to add a TGlxCloudInfo struct into iCloudInfo array + * @param aCloudInfo The next item to add into iCloudinfo + * @param aRowHeight value of aCloudInfo.iRowHeight + * @param aStartIndex value of aCloudInfo.iStartIndex + * @param aEndIndex value of aCloudInfo.iEndIndex + * */ + void AppendToCloudArrayL( TGlxCloudInfo& aCloudInfo, + const TInt& aStartIndex, const TInt& aEndIndex ); + +private: + + /** + * Sets focused item color + **/ + void SetFocusColor(); + + + /** + * Set the middle point of the infobuble + **/ + void SetBubleMidPoint(TPoint& aMidPoint); + + /** + * Create the infobublecontainer + **/ + void CreateBubleContainer(); + + /** + * Move the viewport up depending on the condition + * + **/ + void MoveUpIfRequired(); + + /** + * Move the viewport down depending on the condition + **/ + void MoveDownIfRequired(); + + /** + * calculate the mid point of the bubble + **/ + void CalculateBubleMidPoint(); + +public: + + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + /** + * Notification that media object is now available for an item + * @param Index of the item + * @param aList List that this callback relates to + */ + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + + /** + * Notification that media item was removed from the list + * @param aStartIndex First item that was removed + * @param aEndIndex Last item that was removed + * @param aList List that this callback relates to + */ + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + /** + * Notification that media item was changed + * @param aItemIndexes Indexes of items that were changed + * @param aList List that this callback relates to + */ + void HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* aList); + + /** + * Notification that an attribute is available + * @param aItemIndex Index of the for which the thumbnail is available + * @param aAttributes Array of attributes that have become available + * @param aList List that this callback relates to + */ + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /** + * Notification that focus has moved + * @param aType the direction of the focus change + * @param aNewIndex the new index after the focus change + * @param aOldIndex the old index before the focus change + * @param aList List that this callback relates to + */ + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList); + + /** + * Notification that an item has been selected/deselected + * @param aIndex Index of the item that has been selected/deselected + * @param aSelected Boolean to indicate selection/deselection + * @param aList List that the selection relates to + */ + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + /** + * Notification from the collection. E.g. Items added/modified/deleted and progress notifications + * @param aMessage Message notification from the collection + * @param aList List that the notification relates to + */ + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + + /** + * Notification from the collection that the medialist is populated + * @param aList List that the notification relates to + */ + void HandlePopulatedL(MGlxMediaList* /*aList*/); + + /** + * Notification from the collection. E.g. Items added/modified/deleted and progress notifications + * @param aIndex Index of the item for which property needs to be set + * @param aScale Scale parameter to decide the properties of item + */ + void SetPropertiesL(TInt aIndex, TInt aScale); + + /** + * Called whenever the resolution is changed + */ + void VisualLayoutUpdated(CAlfVisual & aVisual); + +private: + + /** + * Handle the pointer event + * @param aEvent event describing the gesture + */ + TBool HandlePointerEventL( const TAlfEvent &aEvent ); + + /** + * Handles the drag events + * @param pointer event generated because of drag + * @return returns whether the pointer event is consumed or not + */ + TBool HandleDragL(const TPointerEvent& aPointerEvent); + + /** + * checks the visual on which the drag event is generated + * @param position where the drag event has ocuured + * @return the index of the visual that needs to be focused + */ + TInt GetAbsoluteIndex(const TPoint& aPosition); + + /** + * Checks which visual lies below/above the focused item and sets the focus + * @param the row number that needs to be checked for getting the overlaping visual + */ + void SetRelativeFocusL(TInt aRowNumber); + + /** + * Updates layout when orientation is changed + */ + void UpdateLayoutL(); + +private: + /** + * Send the scroll custom event to scrollbar widget + */ + void Scroll(); + + /** + * decide the scrollbar new position + * @param number of steps which is used to determine the amout to be scrolled + */ + void UpdateScrollBar(TInt aNumberOfSteps, TBool aDiff = ETrue); + + /** + * Display the scrollbar only if there are items + * @param visibility + */ + void DisplayScrollBar(); + +private: + + // The Alf Environment + CAlfEnv& iEnv; + + //Parent layout for viewportayout + CAlfAnchorLayout* iViewPortParentLayout; + + //ViewPortLayout + CAlfViewportLayout* iViewPortLayout; + + //Anchor layout for tags + CAlfAnchorLayout *iLayout; + + //medialist not owned + MGlxMediaList& iMediaList; + + //Array of Cloud visuals. + RPointerArray iLabels; + + // Array for information of cloud visuals. + RArray iCloudInfo; + + //Ui Utility + CGlxUiUtility* iUiUtility; + + // Visual for empty string display + CAlfTextVisual *iEmptyString; + + // FocusIndex keeps track of the focussed item + TInt iScrollDirection; + + // FocusIndex keeps track of the focussed row + TInt iFocusRowIndex; + + // EndRowindex keeps track of the end row + TInt iEndRowIndex; + + //keeps track of the end row + TInt iLayoutIndex; + + // initiates bubble container + CGlxContainerInfoBubble *iBubbleContainer; + + + // Fetch context for list item attributes + CGlxDefaultAttributeContext* iAttributeContext; + + // for storing screen height + TInt iScreenHeight; + + // List event observer + MGlxCloudViewMskObserver& iObserver; + + // stores the text for empty view + HBufC* iEmptyText; + + //Viewport position + TAlfRealPoint iViewPortPosition; + + //observer to inform "open" command cloudviewimp class so that it opens the next view + MGlxEnterKeyEventObserver& iObserverEnterKeyEvent; + + //observer to inform command cloudviewimp class that layout is changed + MGlxCloudViewLayoutObserver& iLayoutObserver; + //Viewport size + TAlfRealSize iViewPortSize; + + //Viewport virtual size + TAlfRealSize iViewPortVirtualSize; + + //Width of the screen in which is available for tags to fit in + TInt iTagScreenWidth; + + //Height of the screen in which is available for tags to fit in + TInt iTagScreenHeight; + + //Touch feedback instance + MTouchFeedback* iTouchFeedback; + + //parent layout for all the layout's + CAlfLayout* iParentLayout; + + //data structure for scrollbar + ScrollModelChangedEventData iScrollEventData; + + //scrollbar element + IAlfWidgetEventHandler *iScrollbarElement; + + //scrollbar widget + IAlfScrollBarWidget *iScrollBarWidget; + + //direction of dragging + TInt iIsDragging; + + TAknWindowLineLayout iScrollPaneHandle; + + }; + +#endif // C_GLXCLOUDVIEWCONTROL_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxcloudviewimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxcloudviewimp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2008-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: Cloud view implementation + * +*/ + + + + +#ifndef C_GLXCLOUDVIEWIMP_H +#define C_GLXCLOUDVIEWIMP_H + +// INCLUDES +#include +#include + +#include "mglxcloudviewmskobserver.h" +#include "mglxenterkeyeventobserver.h" + +#include "glxcloudview.h" //base class +#include "mglxcloudviewlayoutobserver.h" + +// FORWARD DECLARATIONS +class CGlxCloudViewControl; + + +// CLASS DECLARATION + +/** + * CGlxCloudViewImp + * Implementation class for Cloud control + */ +namespace Alf +{ +class IAlfScrollBarWidget; +class IAlfScrollBarDefaultBaseElement; + + +NONSHARABLE_CLASS(CGlxCloudViewImp): public CGlxCloudView, + public MGlxCloudViewMskObserver, + public MGlxEnterKeyEventObserver, + public MGlxCloudViewLayoutObserver + { +public: + + /** + * @since S60 3.2 + * Perform the two phase construction + * @param aMediaListFactory - Handle to the medialist provider + * @param aViewResId - Resource id of the View + * @param aTitleResId - Resource id for the Title text + * @param aEmptyListResId - Resource id for the empty listbox text + * @param aSoftKeyResId - Resource id for the softkey texts + * @param aSoftkeyMskDisabledId -Respource id for Msk Disabled + * @return Pointer to newly created object + */ + IMPORT_C static CGlxCloudViewImp *NewL(MGlxMediaListFactory + *aMediaListFactory, const TDesC &aFileName, TInt aViewResId, + TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId); + + /** + * @since S60 3.2 + * Perform the two phase construction + * @param aMediaListFactory - Handle to the medialist provider + * @param aViewResId - Resource id of the View + * @param aTitleResId - Resource id for the Title text + * @param aEmptyListResId - Resource id for the empty listbox text + * @param aSoftKeyResId - Resource id for the softkey texts + * @param aSoftkeyMskDisabledId -Respource id for Msk Disabled + * @return Pointer to newly created object + */ + IMPORT_C static CGlxCloudViewImp *NewLC(MGlxMediaListFactory + *aMediaListFactory, const TDesC &aFileName, TInt aViewResId, + TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId); + + /** + * Destructor. + */ + virtual ~CGlxCloudViewImp(); + +public: // MGlxCloudViewMskObserver + + /** + * Called when msk status change is required + * @param aDirection The direction of the focus change + */ + void HandleMskChangedL(TBool aMskEnabled); +public: // MGlxEnterKeyEventObserver + /** + * Called when Key Event is handled. + */ + + void HandleEnterKeyEventL(TInt aCommand); + +public: + // MGlxCloudViewLayoutObserver + /** + * Called when layout is changed + */ + void HandleLayoutChanged(); + +protected: + // From CGlxViewBase + + /** + * @since S60 3.2 + * @param aCommand command to be handled + */ + virtual TBool HandleViewCommandL(TInt aCommand); + + +private: + + /** + * @function C++ default constructor + * @since S60 3.2 + */ + CGlxCloudViewImp(TInt aSoftKeyResId,TInt aSoftkeyMskDisabledId); + + /** + * @function ControlGroupId + * @since S60 3.2 + * @returns Control group id + */ + TInt ControlGroupId()const; + + /** + * @since S60 3.2 + * Perform the two phase construction + * @param aMediaListFactory - Handle to the medialist provider + * @param aViewResId - Resource id of the View + * @param aTitleResId - Resource id for the Title text + * @param aEmptyListResId - Resource id for the empty listbox text + * @param aSoftKeyResId - Resource id for the softkey texts + */ + void ConstructL(MGlxMediaListFactory *aMediaListFactory, const TDesC + &aFileName, TInt aViewResId, TInt aEmptyListResId, TInt aSoftKeyResId); + + // from base class CAknView + + /** + * @since S60 3.2 + * Returns the unique identifier of the view + * @return Unique identifier + */ + TUid Id()const; + + /** + * @since S60 3.2 + * This will be called when the view is activated + * @param aPrevViewId Specifies the view previously active. + * @param aCustomMessageId Specifies the message type. + * @param aCustomMessage The activation message. + */ + void DoMLViewActivateL(const TVwsViewId &aPrevViewId, TUid + aCustomMessageId, const TDesC8 &aCustomMessage); + + /** + * @since S60 3.2 + * This will be called when the view is deactivated + */ + void DoMLViewDeactivate(); + + /** + * Cleanup the visuals: called after deactivate animation is complete, + * and when the view is destroyed + */ + void CleanupVisuals(); + +private: + +//added for scrollbar widget implementation + void ConstructCloudControlL(); + + //set the rect for scrollbar + void SetScrollBarRect(); + + +private: + // Data + /**used for resource fetching */ + TInt iResourceOffset; + + /**For Cloud View Control */ + CGlxCloudViewControl *iCloudControl; + + /**variable for Alf display*/ + CAlfDisplay* iDisplay; + + /** Empty listbox text */ + HBufC* iEmptyListText; + + /** The animation being applied to the view */ + MGlxAnimation* iViewAnimation; + + /**Resource id for MSk */ + TInt iSoftKeyResId; + + /**Resource id for MSk Disabled */ + TInt iSoftkeyMskDisabledId; + + //view widget + IAlfViewWidget *iViewWidget; + + //scrollbar widget + IAlfScrollBarWidget* iScrollWidget; + + IAlfScrollBarDefaultBaseElement* iScrollbarDefaultBaseElement; + + //scrollpane layout + TAknWindowLineLayout iScrollPaneHandle; + + //anchor layout from the view widget + CAlfAnchorLayout* iAnchorlayout; + + // save title text + HBufC* iTitletext; + + }; +} +#endif // C_GLXTESTTILEVIEWIMP_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxcontainerinfobubble.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxcontainerinfobubble.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,268 @@ +/* +* Copyright (c) 2008-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: Cloud view implementation + * +*/ + + + + +#ifndef C_GLXCONTAINERINFOBUBBLE_H +#define C_GLXCONTAINERINFOBUBBLE_H + +// INCLUDES +#include //for base class +#include "glxbubbletimer.h" //for timer functionality +#include "glxinfobubble.h" //info bubble + + +//Forward Declaration +class CGlxDefaultThumbnailContext; +class CGlxDefaultAttributeContext; +class MGlxMediaList; + + +// CLASS DECLARATION + +/** + * CGlxContainerInfoBubble + * It Fetches attributes from medialist and launch Info bubble + * + */ +class CGlxContainerInfoBubble : public CGlxInfoBubble, public +MGlxTimerNotifier, public MGlxMediaListObserver + + { +public: + /** + * @function NewL + * @since S60 3.2 + * Perform the two phase construction + * @param aMediaList - medialist from which attributes will be fetched + * @param aEnv - Env Variable of Alf + * @param aOwnerControl - Owner control which will be the parent of Infobubble + * @return Pointer to newly created object + */ + + IMPORT_C static CGlxContainerInfoBubble *NewL(MGlxMediaList *aMediaList, + CAlfEnv &aEnv, CAlfControl &aOwnerControl); + + /** + * @function NewLC + * @since S60 3.2 + * Perform the two phase construction + * @param aMediaList - medialist from which attributes will be fetched + * @param aEnv - Env Variable of Alf + * @param aOwnerControl - Owner control which will be the parent of Infobubble + * @return Pointer to newly created object + */ + + IMPORT_C static CGlxContainerInfoBubble *NewLC(MGlxMediaList *aMediaList, + CAlfEnv &aEnv, CAlfControl &aOwnerControl); + + /** + * Virtual Function from MGlxTimernotifier + */ + void TimerComplete(); + + /** + * Destructor + */ + ~CGlxContainerInfoBubble(); + + /** + * @function SetFocus + * @since S60 3.2 + * @param aPos - Reference position for Info Bubble + * @return none + */ + void SetFocus(TPoint aPos); + + /** + * @function C++ default constructor + * @param aMediaList - medialist from which attributes will be fetched + * @param aEnv - Env Variable of Alf + * @since S60 3.2 + */ + CGlxContainerInfoBubble(MGlxMediaList *aMediaList); + + /** + * @function ConstructL + * @since S60 3.2 + * Perform the second phase of two phase construction + * @param aEnv - Env Variable of Alf + * @param aOwnerControl - Owner control which will be the parent of Infobubble + */ + void ConstructL(CAlfEnv &aEnv, CAlfControl &aOwnerControl); + +public: + //medialist observer + /** + * @function HandleItemAddedL + * Notification that media items were added to the list + * @param aStartIndex First item that was added (inserted) + * @param aEndIndex Last item that was added (inserted) + * @param aList List that this callback relates to + */ + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + /** + * @function HandleMediaL + * Notification that media object is now available for an item + * @param Index of the item + * @param aList List that this callback relates to + */ + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + /** + * @function HandleItemRemoved + * Notification that media item was removed from the list + * @param aStartIndex First item that was removed + * @param aEndIndex Last item that was removed + * @param aList List that this callback relates to + */ + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + /** + * @function HandleItemModifiedL + * Notification that media item was changed + * @param aItemIndexes Indexes of items that were changed + * @param aList List that this callback relates to + */ + void HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* aList); + + /** + * @function HandleAttributesAvailableL + * Notification that an attribute is available + * @param aItemIndex Index of the for which the thumbnail is available + * @param aAttributes Array of attributes that have become available + * @param aList List that this callback relates to + */ + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /** + * @function HandleFocusChangedL + * Notification that focus has moved + * @param aType the direction of the focus change + * @param aNewIndex the new index after the focus change + * @param aOldIndex the old index before the focus change + * @param aList List that this callback relates to + */ + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList); + + /** + * @function HandleItemSelected + * Notification that an item has been selected/deselected + * @param aIndex Index of the item that has been selected/deselected + * @param aSelected Boolean to indicate selection/deselection + * @param aList List that the selection relates to + */ + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + /** + * @function HandleMessageL + * Notification from the collection. E.g. Items added/modified/deleted and progress notifications + * @param aMessage Message notification from the collection + * @param aList List that the notification relates to + */ + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: + + /** + * @function ShowNow : Calls Info Bubble for the focussed item. + * @since S60 3.2 + * @return none + */ + void ShowNowL(); + + /** + * Sets the attributes + * @return none + */ + void SetAttributesL(); + + /** + * Sets the attributes + * @ param attributes array + * @ param attributes count + * @return none + */ + void SetAttributesL(const RArray& aAttributes, const TInt& aAttributescount); + + /** + * Get the MediaTitle + * @param media + * @return if the title changed + */ + TBool GetMediaTitleL(const TGlxMedia& aMedia); + + /** + * Sets the MediaSubTitle + * @param media + * @return if the subtitle changed + */ + TBool GetMediaSubTitleL(const TGlxMedia& aMedia); + + /** + * Sets the MediaThumbNail + * @param aMedia,media + * @param aIdSpaceId,Id-space identifier + * @param aSize,thumbnail size + * @param thumbnailattribute + * @return if new texture was created + */ + TBool GetMediaThumbNailL(const TGlxMedia& aMedia, TGlxIdSpaceId& aIdSpaceId, + TSize& aSize, TMPXAttribute& aAttrThumbnail); + +private: + /**medialist not owned */ + MGlxMediaList *iMediaList; + + /**flag for Timer completion */ + TBool iTimerComplete; + + /** iThumbnailContext for getting Thumbnail form medialist*/ + CGlxDefaultThumbnailContext *iThumbnailContext; + + /** for getting attribute form medialist*/ + CGlxDefaultAttributeContext *iAttributeContext; + + /**position used for Info Bubble */ + TPoint iPos; + + /**variable used for providing delay */ + CGlxBubbleTimer *iTimer; + + /**Stores the first line of text */ + HBufC* iMediaTitle; + + /**stores the second line of text */ + HBufC* iMediaSubTitle; + + /**Image variable for Thumbnail texture*/ + CAlfTexture* iTexture; + + /** The id of the thumbnail texture retrieved from the texture manager */ + TInt iThumbnailId; + }; + +#endif // C_GLXCONTAINERINFOBUBBLE_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/glxinfobubble.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/glxinfobubble.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,312 @@ +/* +* Copyright (c) 2008-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: Info Bubble Implementation + * +*/ + + + + +#ifndef C__GLXINFOBUBBLE_H__ +#define C__GLXINFOBUBBLE_H__ + +//Includes + +#include //base class for Alf control +#include //for TAlfImage +#include //for interface MGlxSkinChangeObserver +#include + +#include + +//Forward Declaration +class CGlxUiUtility; +class CAlfAnchorLayout; +class CAlfBorderBrush; +class CAlfDeckLayout; +class CAlfTexture; +class CAlfImageVisual; +class CAlfTextVisual; + +/** + * CGlxInfoBubble is a common calss based on Alf Control. + *It draws a bitmap and two lines on text. + *It has a position logic of its own. + */ +class CGlxInfoBubble : public CAlfControl,public MGlxSkinChangeObserver, + public MGlxTextureObserver + { +public: + + /* Constructors. */ + + /** + * @Default c++ contructor + * @since S60 3.2 + * Perform the two phase construction + * @param aEnv - Env Variable of Alf + */ + IMPORT_C CGlxInfoBubble(); + + /** + * @function ConstructL + * @since S60 3.2 + * Perform the two phase construction + * @param aOwnerControl - Owner control which will be the parent of Infobubble + * @param aEnv - Env Variable of Alf + */ + IMPORT_C void BaseConstructL(CAlfControl &aOwnerControl, CAlfEnv &aEnv); + + /** + * Destructor. + */ + IMPORT_C virtual ~CGlxInfoBubble(); + +protected: + + /** + * @function DisplayBubbleL + * @since S60 3.2 + * @param aPos - Position of Visual for which InfoBubble will be shown + * @param aTexture - Thumbnail texture associated with an item + * @param aTitle - title of a tag + * @param aSubTitle - subtitle of a tag + */ + IMPORT_C void DisplayBubbleL(TPoint aPos, CAlfTexture& aTexture, + const TDesC& aTitle, const TDesC& aSubTitle); + + /** + * @function UpdateTextureL + * @since S60 3.2 + * @param aTexture - AlfTexture associated with an item thumbnail + */ + IMPORT_C void UpdateTextureL(CAlfTexture& aTexture); + + + /** + * @function DisapperBubble + * Animates when bubble becomes out of context + * @since S60 3.2 + */ + IMPORT_C void DisappearBubble(); + + /** + * @function CreateThumbnailTextureL + * creates the thumbnailtexture + * @param aMedia,media + * @param aIdSpaceId,Id-space identifier + * @param aSize,thumbnail size + */ + IMPORT_C CAlfTexture& CreateThumbnailTextureL(const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId,const TSize& aSize); + + /** + * @function ResetImage() + * Resets the image + */ + IMPORT_C void ResetImage(); + +private: // From MGlxTextureObserver + void TextureContentChangedL( TBool aHasContent, CAlfTexture* aNewTexture ); + +private: + + /** + * @function DrawBubbleFirstQuad + * @since S60 3.2 + * @param aReferencepos - reference postion for tail + * @param aQuadrantId - determines the bubble type + */ + void DrawBubbleFirstQuadL(TPoint aReferencepos); + + + /** + * @function DrawBubbleSecondQuad + * @since S60 3.2 + * @param aReferencepos - reference postion for tail + * @param aQuadrantId - determines the bubble type + */ + void DrawBubbleSecondQuadL(TPoint aReferencepos); + + + /** + * @function DrawBubbleThirdQuad + * @since S60 3.2 + * @param aReferencepos - reference postion for tail + * @param aQuadrantId - determines the bubble type + */ + void DrawBubbleThirdQuadL(TPoint aReferencepos); + + + /** + * @function DrawBubbleFourthQuad + * @since S60 3.2 + * @param aReferencepos - reference postion for tail + * @param aQuadrantId - determines the bubble type + */ + void DrawBubbleFourthQuadL(TPoint aReferencepos); + + + /** + * @function DrawBubbleLeftComponent + * @since S60 3.2 + */ + void DrawBubbleLeftComponentL(); + + + /** + * @function DrawBubbleRightComponent + * @since S60 3.2 + */ + void DrawBubbleRightComponentL(); + + + /** + * @function DrawBubbleExtemsibleComponent + * @since S60 3.2 + * @param aQuadrantId - determines the bubble type + */ + void DrawBubbleExtensibleComponentL(TInt aSlots); + + + /** + * @function DrawBubbleTailComponent() + * @since S60 3.2 + */ + void DrawBubbleTailComponentL(); + + + /** + * @function ResetBubbleComponent() + * @since S60 3.2 + */ + void ResetBubbleComponent(); + + + /** + * @function LoadTailAssembly() + * @since S60 3.2 + */ + void LoadTailAssemblyL(TInt aTailEnumId, TInt aTailStripEnumId); + + void CreateItemContainerLayoutL(); + + void SetVariableVisualCountL(); + + //from MGlxSkinChangeObserver + void HandleSkinChanged(); + + /** + * @function SetThumbnailBorderColor() + * @since S60 3.2 + * Sets the color for thumbnail border + */ + void SetThumbnailBorderColor(); + +protected: + /**UI Utility */ + CGlxUiUtility* iUiUtility; + +private: + //Enum for deciding the location of bubble + enum TGlxBubbleQuadrantFlags + { + EQuadrantFirst = 0, + EQuadrantSecond , + EQuadrantThird, + EQuadrantFourth + }; + + /**Anchor layout for Bubble container */ + CAlfAnchorLayout *iInfoBubbleContainer; + + /**Anchor layout for Bubble */ + CAlfAnchorLayout *iInfoBubble; + + /**deck layout which is base layout for Bubble */ + CAlfDeckLayout *iInfoDeck; + + /**Visual for centre Image of Bubble */ + CAlfImageVisual *iDeckCentreimage; + + /**Visual for first line of text in Bubble */ + CAlfTextVisual *iBubbleTextTitle; + + /**Visual for second line of text in Bubble */ + CAlfTextVisual *iBubbleTextSubTitle; + + /**Image variable of bubble components */ + TAlfImage iImageThumb, iImageBubbleLeft, iImageBubbleRight; + TAlfImage iImageBubbleStrip, iImageBubbleExpand, iImageBubbleTail; + + /**Border brush */ + CAlfBorderBrush *iThumbnailBorderBrush; + + /**Visual array for expandable middle bubble component */ + RPointerArray iBubbleExpandStrip; // + + /**Visual for left arc of Bubble */ + CAlfImageVisual *iBubbleLeft; + + /**Visual for rightarc of Bubble */ + CAlfImageVisual *iBubbleRight; + + /**Visual for strip that connects to tail of Bubble */ + CAlfImageVisual *iBubbleTailStrip; + + /**Visual for tail of Bubble */ + CAlfImageVisual *iBubbleTail; + + /**number of times centre bubble image is needed */ + TReal iRoudedSlotValue; + + /**flag to decide iInfoBubbleContainer position */ + TInt iTailPositionUp; + + /**flag to indicate whether tail will be drawn on normal position or not */ + TInt iTailNormalPosition; + + /**point from which the drawing of bubble will start */ + TPoint iBubbleRectDrawPoint; + + /**Storing screen width */ + TInt iScreenWidth; + + /** storing screen height*/ + TInt iScreenHeight; + + /**offset for bubble drawing */ + TInt iPositionOffset; + + /** Stores Size of bubble*/ + TSize iBubbleSize; + + /**stores counter of bubble component drawn */ + TInt iBubbleComponentCount; + + /**Increment variable for X axis */ + TPoint iPos; + + TInt iBubbleXaxisInc; + + //mif file + TFileName iMifFile; + CAlfTexture *iTexture; + + /**temporary object to store Bubble Text*/ + CAlfTextVisual *iTempTitleText; + }; + +#endif // C__GLXINFOBUBBLE_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/mglxcloudviewlayoutobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/mglxcloudviewlayoutobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2008-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: Cloud View layout change observer interface +* +*/ + + + + +#ifndef M_GLXCLOUDVIEWLAYOUTOBSERVER_H +#define M_GLXCLOUDVIEWLAYOUTOBSERVER_H + +#include + +/** + * MGlxCloudViewLayoutObserver + * + * widget rect change notification interface + * + * @lib glxcloudview.lib + */ +class MGlxCloudViewLayoutObserver + { +public: + /** + * Called when there is layout change + */ + virtual void HandleLayoutChanged() = 0; + + }; + +#endif // M_GLXCLOUDVIEWLAYOUTOBSERVER_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/inc/mglxcloudviewmskobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/inc/mglxcloudviewmskobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-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: Cloud View Msk observer interface +* +*/ + + + + +#ifndef M_GLXCLOUDVIEWMSKOBSERVER_H +#define M_GLXCLOUDVIEWMSKOBSERVER_H + +#include + +/** + * MGlxCloudViewMskObserver + * + * List event notification interface + * + * @lib glxcloudview.lib + */ +class MGlxCloudViewMskObserver + { +public: + /** + * Called when item focus change has happened it the listbox + * @param aDirection The direction of the focus change + */ + virtual void HandleMskChangedL(TBool aMskEnabled) = 0; + + + }; + +#endif // M_GLXCLOUDVIEWMSKOBSERVER_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/rom/glxcloudview.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/rom/glxcloudview.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Cloud View iby file. +* +*/ + + + + +#ifndef __CLOUDVIEW_IBY__ +#define __CLOUDVIEW_IBY__ + +file=ABI_DIR\BUILD_DIR\glxcloudview.dll SHARED_LIB_DIR\glxcloudview.dll + +#endif // __CLOUDVIEW_IBY__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/src/glxbubbletimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/src/glxbubbletimer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Cloud view + * +*/ + + + + +// INCLUDE FILES +#include "glxbubbletimer.h" //class declaration + +#include // For Logs + + +// ======== MEMBER FUNCTIONS ======== +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// + +CGlxBubbleTimer::~CGlxBubbleTimer() + { + TRACER("GLX_CLOUD::CGlxBubbleTimer::~CGlxBubbleTimer"); + //if (iTimer) + // { + //iTimer.Cancel (); + iTimer.Close (); + //} + if ( iNotifier) + { + iNotifier =NULL; + } + } + +// ConstructL +// --------------------------------------------------------------------------- +// +void CGlxBubbleTimer::ConstructL() + { + TRACER("GLX_CLOUD::CGlxBubbleTimer::ConstructL()"); + User::LeaveIfError (iTimer.CreateLocal ()); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxBubbleTimer *CGlxBubbleTimer::NewL(MGlxTimerNotifier *aNotifier) + { + TRACER("GLX_CLOUD::CGlxBubbleTimer::NewL"); + CGlxBubbleTimer *self = new(ELeave)CGlxBubbleTimer(aNotifier); + CleanupStack::PushL (self); + self->ConstructL (); + CleanupStack::Pop (self); + return self; + } + +// --------------------------------------------------------------------------- +// Default C++ Constructor +// --------------------------------------------------------------------------- +// + +CGlxBubbleTimer::CGlxBubbleTimer(MGlxTimerNotifier *aNotifier) : + CActive(0), iNotifier(aNotifier) + { + TRACER("GLX_CLOUD::CGlxBubbleTimer::CGlxBubbleTimer"); + CActiveScheduler::Add (this); + + } + +// --------------------------------------------------------------------------- +// SetDelay() +// --------------------------------------------------------------------------- +// +void CGlxBubbleTimer::SetDelay(TTimeIntervalMicroSeconds32 aDelay) + { + TRACER("GLX_CLOUD::CGlxBubbleTimer::SetDelay"); + //iTimer.Cancel() ; + Cancel (); + + _LIT(KDelayedHelloPanic, "CGlxBubbleTimer"); + __ASSERT_ALWAYS(!IsActive(), User::Panic(KDelayedHelloPanic, 1)); + // iTimer.Close() ; + if( !IsActive() ) + { + iTimer.After (iStatus, aDelay); + SetActive (); + } + } + +// --------------------------------------------------------------------------- +// RunL() +// --------------------------------------------------------------------------- +// +void CGlxBubbleTimer::RunL() + { + TRACER("GLX_CLOUD::CGlxBubbleTimer::RunL"); + iNotifier->TimerComplete (); //notify that timer is over + } + +// --------------------------------------------------------------------------- +// DoCancel() +// --------------------------------------------------------------------------- +// + +void CGlxBubbleTimer::DoCancel() + { + TRACER("GLX_CLOUD::CGlxBubbleTimer::DoCancel"); + iTimer.Cancel (); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/src/glxcloudview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/src/glxcloudview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Cloud view + * +*/ + + + + +#include "glxcloudview.h" //class declaration + +// INCLUDE FILES +#include "glxcloudviewimp.h" // class header +#include // For Logs + + +// ======== MEMBER FUNCTIONS ======== +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxCloudView::~CGlxCloudView() + { + TRACER("GLX_CLOUD::CGlxCloudView::~CGlxCloudView"); + // No implementation + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCloudView *CGlxCloudView::NewL +(MGlxMediaListFactory*aMediaListFactory, const TDesC &aFileName, TInt + aViewResId, TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId) + { + TRACER("GLX_CLOUD::CGlxCloudView::NewL"); + return CGlxCloudViewImp::NewL(aMediaListFactory, aFileName, aViewResId, + aEmptyListResId, aSoftKeyResId, aSoftkeyMskDisabledId); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCloudView *CGlxCloudView::NewLC +(MGlxMediaListFactory*aMediaListFactory, const TDesC &aFileName, TInt + aViewResId, TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId) + { + TRACER("GLX_CLOUD::CGlxCloudView::NewLC"); + return CGlxCloudViewImp::NewLC(aMediaListFactory, aFileName, aViewResId, + aEmptyListResId, aSoftKeyResId, aSoftkeyMskDisabledId); + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/src/glxcloudviewcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/src/glxcloudviewcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1849 @@ +/* +* Copyright (c) 2008-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: Cloud View control class + * +*/ + + + + +// INCLUDE FILES +#include "glxcloudviewcontrol.h" //class header +//AlfT headers + +#include // For CAlfAnchorLayout +#include // For CAlfViewPortLayout +#include // For MTouchFeedback +#include // For CAlfTextStyle +#include // For CAlfTextVisual +#include +#include // For CAlfWidgetControl +#include // For CalfRoster +#include // For CAlfDisplay +#include // For alfScrollbar model +#include + +#include +#include +#include + +//AlfT +#include // For Logs +#include // For Logs +#include //attribute context +#include //for medialist + +#include "glxcontainerinfobubble.h" //intelligent class for data of infobubble +#include "glxcloudview.hrh" +#include "mglxcloudviewmskobserver.h" // For Msk Observer +#include "mglxenterkeyeventobserver.h" // For enterkey observer +#include "mglxcloudviewlayoutobserver.h" + +//Constants +const TInt KPrimaryFontSize = 21; +//Font sizes +const TInt KFontSmallest = 28; +const TInt KFontSmaller = 32; +const TInt KFontMedium = 36; +const TInt KFontLarger = 40; +const TInt KFontLargest = 44; +const TInt KRowHeight = 72; +const TInt KLeftMargin = 10; +const TInt KNumMinRowSpace = 2; +const TInt KColSpace = 20; +const TInt KRightmargin = 20; +const TInt KMinTagSize = 77; +const TInt KTagScreenHeight = 460; +const TInt KDragHoldTime = 500; + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxCloudViewControl *CGlxCloudViewControl::NewL(CAlfDisplay& aDisplay, + CAlfEnv &aEnv, MGlxMediaList& aMediaList, const TDesC& aEmptyText, + MGlxCloudViewMskObserver& aObserver,MGlxEnterKeyEventObserver& aObserverEnterKeyEvent + ,CAlfAnchorLayout *aAnchorLayout,MGlxCloudViewLayoutObserver& aLayoutObserver) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::NewL"); + CGlxCloudViewControl *self = CGlxCloudViewControl::NewLC (aDisplay, aEnv, + aMediaList, aEmptyText,aObserver,aObserverEnterKeyEvent,aAnchorLayout,aLayoutObserver); + CleanupStack::Pop (self); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxCloudViewControl *CGlxCloudViewControl::NewLC(CAlfDisplay& aDisplay, + CAlfEnv &aEnv, MGlxMediaList& aMediaList, const TDesC& aEmptyText, + MGlxCloudViewMskObserver& aObserver,MGlxEnterKeyEventObserver& aObserverEnterKeyEvent + ,CAlfAnchorLayout *aAnchorLayout,MGlxCloudViewLayoutObserver& aLayoutObserver) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::NewLC"); + CGlxCloudViewControl *self = new(ELeave)CGlxCloudViewControl(aEnv,aMediaList,aObserver + ,aObserverEnterKeyEvent,aLayoutObserver); + CleanupStack::PushL (self); + self->ConstructL (aEmptyText,aDisplay,aAnchorLayout); + return self; + } + +// --------------------------------------------------------------------------- +// Default C++ Constructor +// --------------------------------------------------------------------------- +// + +CGlxCloudViewControl::CGlxCloudViewControl(CAlfEnv &aEnv, MGlxMediaList& aMediaList, + MGlxCloudViewMskObserver& aObserver,MGlxEnterKeyEventObserver& aObserverEnterKeyEvent + ,MGlxCloudViewLayoutObserver& aLayoutObserver): + iEnv(aEnv), iMediaList(aMediaList), iObserver(aObserver) + ,iObserverEnterKeyEvent(aObserverEnterKeyEvent),iLayoutObserver(aLayoutObserver) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::CGlxCloudViewControl"); + //added for scrollbar widget implementation + iScrollEventData.mChangedMask = 0; + iScrollEventData.mViewStartPos = 0; + iScrollEventData.mSpan = 0; + iScrollEventData.mViewLength = 0; + } + +// --------------------------------------------------------------------------- +//ConstructL() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::ConstructL(const TDesC& aEmptyText,CAlfDisplay& aDisplay + ,CAlfAnchorLayout *aAnchorLayout) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL (); + CAlfControl::ConstructL(iEnv); + BindDisplay (aDisplay); + //Initializing data for cloud view display + iFocusRowIndex = 0; //initially focus row will be zero + + iEmptyText = aEmptyText.AllocL(); + + TRect rect; + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); + iScreenHeight = rect.Height (); + iParentLayout = CAlfLayout::AddNewL(*this, aAnchorLayout); + iTagScreenWidth = rect.Width() - iScrollPaneHandle.iW - KRightmargin; + + if (GlxGeneralUiUtilities::IsLandscape()) + { + iTagScreenHeight = rect.Height(); + } + else + { + + iTagScreenHeight = KTagScreenHeight; + } + + iViewPortLayout = CAlfViewportLayout::AddNewL(*this, iParentLayout); + iLayout=CAlfAnchorLayout::AddNewL (*this,iViewPortLayout); + iLayout->SetFlags ( EAlfVisualFlagLayoutUpdateNotification); //to get screen change notification + + iViewPortLayout->SetClipping(ETrue); + + // Set the attribute context + iAttributeContext = CGlxDefaultAttributeContext::NewL (); + iAttributeContext->AddAttributeL (KMPXMediaGeneralTitle); + iAttributeContext->AddAttributeL (KMPXMediaGeneralCount); + iAttributeContext->SetRangeOffsets( 0, KMaxTInt / 2 ); + iMediaList.AddContextL ( iAttributeContext, KGlxFetchContextPriorityCloudView ); //highest one to use 0 or 1 + iMediaList.AddMediaListObserverL ( this); //make this control as medialist observer + + TInt listCount = iMediaList.Count(); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::ConstructL MedialistCount %d ", + listCount); + + //Display Empty Cloud View if no tags exists and if the navigation is backwards + //Since in backward navigation the callback HandlePopulatedL() does not come + if ( listCount ==0 && (iUiUtility->ViewNavigationDirection ()== EGlxNavigationBackwards) ) + { + DisplayEmptyCloudViewL(); + } + else //Setting focus on the 1 st Media List item + { + //get the attributes from Cache + FetchAttributeFromCacheL(); + + if ( iLabels.Count ()==listCount && iAttributeContext->RequestCountL (&iMediaList)==0) + { + //if we navigate in forward direction, first item should be highlighted.if we are navigating in + // backwards direction, index is not necessarily zero, it will be restored. + if ( iUiUtility->ViewNavigationDirection ()== EGlxNavigationForwards && iMediaList.Count ()) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0); + } + UpdateRowDataL (); + } + } + //get touch feedback instance + iTouchFeedback = MTouchFeedback::Instance(); + } + + +// --------------------------------------------------------------------------- +//VisualLayoutUpdated() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::VisualLayoutUpdated(CAlfVisual &/* aVisual*/) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::VisualLayoutUpdated"); + TRect rect; + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); + if ( (rect.Width() != iTagScreenWidth) && ( rect.Height () != iScreenHeight)) + { + //set the new screen dimensions + UpdateLayoutL(); + } + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxCloudViewControl::~CGlxCloudViewControl() + + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::~CGlxCloudViewControl"); + iCloudInfo.Close (); + iLabels.Close(); + iMediaList.RemoveContext (iAttributeContext); + iMediaList.RemoveMediaListObserver (this); + delete iAttributeContext; + /*if ( iBubbleContainer ) + { + iBubbleContainer->SetHost (NULL); + delete iBubbleContainer; + }*/ + + if ( iUiUtility ) + { + iUiUtility->Close (); + } + delete iEmptyText; + } + +// --------------------------------------------------------------------------- +// LayoutVisibleRows() +// --------------------------------------------------------------------------- +// +TInt CGlxCloudViewControl::LayoutVisibleRows(TPoint aStartPoint,TInt aRowStartIndex + , TInt aRowEndIndex) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::DrawRow"); + TSize vsize; + TPoint tl, br; + tl = aStartPoint; + br.iY = tl.iY + KRowHeight; + //drawing in reverse for arabic hebrew support + if ( GlxGeneralUiUtilities::LayoutIsMirrored ()) + { + br.iX = aStartPoint.iX; + const TInt KMaxScreenWidth = iTagScreenWidth - iScrollPaneHandle.iW; + //Set the positions of tags in a row. + for (TInt j = aRowStartIndex; j <= aRowEndIndex; j++) + { + vsize = iLabels[j]->TextExtents (); + if ( vsize.iWidth < KMinTagSize ) + { + vsize.iWidth = KMinTagSize; + } + //If the size of the tag is more than the screen size then wrap it + if (vsize.iWidth > KMaxScreenWidth) + { + TAlfRealSize tagSize( KMaxScreenWidth, br.iY ); + iLabels[j]->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); + vsize = iLabels[j]->TextExtents (); + tl.iX -= aStartPoint.iX; + tl.iY = aStartPoint.iY; + br.iX = tagSize.iWidth; + } + else + { + tl.iX -= (vsize.iWidth + KColSpace); + } + //Set the anchor points for the tags + iLayout->SetAnchor (EAlfAnchorTopLeft, iLayoutIndex, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (tl.iX, tl.iY)); + iLayout->SetAnchor (EAlfAnchorBottomRight, iLayoutIndex, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (br.iX, br.iY)); + br.iX -= (vsize.iWidth + KColSpace); + iLayoutIndex += 1; + } + + } + else + { + const TInt KMaxScreenWidth = iTagScreenWidth - iScrollPaneHandle.iW; + for (TInt j = aRowStartIndex; j <= aRowEndIndex; j++) + { + vsize = iLabels[j]->TextExtents (); + if( vsize.iWidth < KMinTagSize ) + { + vsize.iWidth = KMinTagSize; + } + if (vsize.iWidth > KMaxScreenWidth) + { + TAlfRealSize tagSize( KMaxScreenWidth, br.iY ); + TAlfRealPoint startPos( aStartPoint.iX, 0 ); + iLabels[j]->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); + tl.iX = aStartPoint.iX; + tl.iY = aStartPoint.iY; + br.iX = tagSize.iWidth; + } + else + { + br.iX += vsize.iWidth + KColSpace; + } + iLayout->SetAnchor (EAlfAnchorTopLeft, iLayoutIndex, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (tl.iX, tl.iY)); + iLayout->SetAnchor (EAlfAnchorBottomRight, iLayoutIndex, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (br.iX, br.iY)); + tl.iX = br.iX; + iLayoutIndex += 1; + } + } + return 0; + } + + + + +// --------------------------------------------------------------------------- +// LayoutVisibleArea() +// +// --------------------------------------------------------------------------- +void CGlxCloudViewControl::LayoutVisibleArea() + { + //screen height for boundary check:how many rows fit in. + //find out how many rows can fit in. + //add upper and lower margin spacing 5 pixels + + //draw the row on screens + TPoint startpoint; + // arabic hebrew change + //If the layout is arabic hebrew then start positioning of tags from end + if ( GlxGeneralUiUtilities::LayoutIsMirrored ()) + { + startpoint.iX = iTagScreenWidth - KRightmargin; + } + + //else start from biginning + else + { + startpoint.iX = KLeftMargin; + } + startpoint.iY = KNumMinRowSpace; + //associate the active visuals with anchor layout + GLX_LOG_INFO("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea Layout reset"); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea layout Count after reset %d ", iLayout->Count ()); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea iCloudInfo[0].iStartIndex %d ", iCloudInfo[0].iStartIndex); + TInt endindex = iCloudInfo.Count()-1; + + for (TInt j = iCloudInfo[0].iStartIndex; j <=iCloudInfo[endindex].iEndIndex; j++) + { + GLX_LOG_INFO("GLX_CLOUD ::CGlxCloudViewControl::::FindEndRowIndex Entering layout append"); + + + TAlfTimedValue opacity; + opacity.SetValueNow(1.0); // immediate change + iLabels[j]->SetOpacity(opacity); + } + + GLX_LOG_INFO("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea Exiting layout append"); + iLayoutIndex = 0; + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea layout Count realloc %d ", iLayout->Count ()); + for (TInt j = 0; j <= iEndRowIndex; j++) + { + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::::LayoutVisibleArea Drawing row started %d ", j); + LayoutVisibleRows (startpoint,iCloudInfo[j].iStartIndex, + iCloudInfo[j].iEndIndex); + startpoint.iY += KRowHeight + KNumMinRowSpace; + } + TInt totalHeight = 0; + for (TInt j = 0; j <= iCloudInfo.Count()-1; j++) + { + totalHeight+=KRowHeight; + totalHeight+=KNumMinRowSpace; + } + + //Set the virtual size of viewport to the total size of anchor. + if( totalHeight > iTagScreenHeight ) + { + iViewPortLayout->SetVirtualSize(TAlfRealSize(iTagScreenWidth,totalHeight ),0); + iViewPortVirtualSize.iHeight = totalHeight; + } + else + { + iViewPortLayout->SetVirtualSize(TAlfRealSize(iTagScreenWidth,iTagScreenHeight ),0); + iViewPortVirtualSize.iHeight = iTagScreenHeight; + } + iViewPortVirtualSize.iWidth = iTagScreenWidth; + + iViewPortLayout->SetViewportSize(TAlfRealSize(iTagScreenWidth,iTagScreenHeight), 0); + iViewPortLayout->SetSize(TAlfRealSize(iTagScreenWidth,iTagScreenHeight), 0); + iViewPortSize.iWidth = iTagScreenWidth; + iViewPortSize.iHeight = iTagScreenHeight; + iViewPortLayout->SetViewportPos(TAlfRealPoint(0, 0),1000); + + iViewPortPosition.iX =0; + iViewPortPosition.iY =0; + + iScrollEventData.mSpan = iViewPortVirtualSize.iHeight ; + iScrollEventData.mViewLength = iViewPortSize.iHeight; + if(iScrollBarWidget) + { + ((IAlfScrollBarModel *)(iScrollBarWidget->model()))->changeData(iScrollEventData.mSpan, + iScrollEventData.mViewLength, + 0); + DisplayScrollBar(); + } + //constructing the bubblecontainer + CreateBubleContainer(); + + iLayout->UpdateChildrenLayout (); //update layout + + HandleLayoutFocusChange (); + + MoveDownIfRequired(); + } + + +// --------------------------------------------------------------------------- +// OfferEventL() +// --------------------------------------------------------------------------- +// +TBool CGlxCloudViewControl::OfferEventL(const TAlfEvent &aEvent) + { TRACER("GLX_CLOUD:: CGlxCloudViewControl::OfferEventL"); + + //check if key inputs needs handling + TBool consumed = EFalse; + if ( ( iLabels.Count () == 0 ) ) + { + GLX_LOG_INFO( "GLX_CLOUD ::CGlxCloudViewControl::offerkeyeventL no key press returning "); + return EFalse; //return as no futher processing is required + } + + if ( aEvent.IsKeyEvent ()&& aEvent.Code() == EEventKey ) + { + switch (aEvent.KeyEvent().iCode) + { + //@ EABI-7R7FRU Fute failure: Tag views enter key has no functionality. + case EKeyEnter : + case EKeyDevice3: + { + iObserverEnterKeyEvent.HandleEnterKeyEventL( (TInt)EAknCmdOpen ); + consumed= ETrue; + } + break; + case EKeyUpArrow: + { + if(iCloudInfo.Count() >1 ) + { + HandleKeyUpL (); + consumed = ETrue; + iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); + + MoveUpIfRequired(); + } + } + break; + + case EKeyDownArrow: + { + if(iCloudInfo.Count() >1 ) + { + HandleKeyDownL (); + consumed = ETrue; + iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); + + MoveDownIfRequired(); + } + } + break; + + case EKeyLeftArrow: + case EKeyPrevious: + { + // arabic hebrew change + if ( GlxGeneralUiUtilities::LayoutIsMirrored () ) + { + if ( iMediaList.FocusIndex() == iMediaList.Count() - 1 ) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0); + } + else + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iMediaList.FocusIndex ()+ 1); + } + iScrollDirection = 0; + } + else + { + if ( iMediaList.FocusIndex ()== 0 ) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iMediaList.Count() - 1 ); + } + else + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iMediaList.FocusIndex ()- 1); + } + iScrollDirection = 1; + } + consumed = ETrue; + TInt focusRowIndex = RowNumber (iMediaList.FocusIndex ()); + if(iFocusRowIndex != focusRowIndex) + { + iFocusRowIndex = focusRowIndex; + if( iScrollDirection == 0 ) + { + MoveDownIfRequired(); + } + else + { + MoveUpIfRequired(); + } + } + } + + break; + + case EKeyRightArrow: + case EKeyNext: + { + // arabic hebrew change + if ( GlxGeneralUiUtilities::LayoutIsMirrored () ) + { + if ( iMediaList.FocusIndex ()== 0 ) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iMediaList.Count() - 1 ); + } + else + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iMediaList.FocusIndex ()- 1); + } + iScrollDirection = 1; + } + else + { + if ( iMediaList.FocusIndex ()== iMediaList.Count() - 1 ) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0); + } + else + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iMediaList.FocusIndex ()+ 1); + } + iScrollDirection = 0; + } + TInt focusRowIndex = RowNumber (iMediaList.FocusIndex ()); + + if( iFocusRowIndex != focusRowIndex ) + { + iFocusRowIndex = focusRowIndex; + if( iScrollDirection == 1 ) + { + MoveUpIfRequired(); + } + else + { + MoveDownIfRequired(); + } + } + } + consumed = ETrue; + break; + + default: + break; + } + } + + if(aEvent.IsPointerEvent() ) + { + //if its a pointer event + consumed = HandlePointerEventL(aEvent); + } + else if( aEvent.IsCustomEvent() ) + { + if(aEvent.CustomParameter() == ECustomEventFocusDragScroll) + { + //dragging down + if( iIsDragging == 1 ) + { + if(iFocusRowIndex!=iCloudInfo.Count()-1) + { + SetRelativeFocusL(iFocusRowIndex+1); + iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); + // iScrollDirection = 0; + MoveDownIfRequired(); + } + } + //dragging up + else if(iIsDragging == 2) + { + if(iFocusRowIndex!=0) + { + SetRelativeFocusL(iFocusRowIndex-1); + iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); + // iScrollDirection = 0; + MoveUpIfRequired(); + } + } + } + consumed = EFalse; + } + return consumed; + } + +// --------------------------------------------------------------------------- +// HandleKeyUp() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleKeyUpL() + { + TRACER("GLX_CLOUD:: CGlxCloudViewControl::HandleKeyUpL"); + + //If the first item is focused and if we are navigating upwards,then set the focus to last element. + if( iFocusRowIndex == 0 ) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iMediaList.Count() - 1); + } + + //else set the focus to the item which is in the previous row,that overlaps with midpoint of the + //focused item. + else + { + TInt prevrownum = iFocusRowIndex - 1; + SetRelativeFocusL(prevrownum); + } + + iScrollDirection = 1; + } + + +// --------------------------------------------------------------------------- +// HandleKeyDown() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleKeyDownL() + { + TRACER("GLX_CLOUD:: CGlxCloudViewControl::HandleKeyDownL"); + + // If the last item is focused and if we are navigating downwards,then set the + // focus to first element. + if( iFocusRowIndex == iCloudInfo.Count()-1 ) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + 0); + } + + //else set the focus to the item which is in the next row,that overlaps with midpoint of the + //focused item. + else + { + TInt nextrownum = iFocusRowIndex + 1; + SetRelativeFocusL(nextrownum); + } + + iScrollDirection = 0; + } + +// --------------------------------------------------------------------------- +// HandleLayoutFocusChange() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleLayoutFocusChange() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleLayoutFocusChange"); + + if ( iLabels.Count()-1 >= iMediaList.FocusIndex()) + { + //to highlight focused element + SetFocusColor(); + //CalculateBubleMidPoint (); + } + } + + +// --------------------------------------------------------------------------- +// FocusUpdate() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::FocusUpdate() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::FocusUpdate"); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::FocusUpdate HighLighted RowNum %d ",iFocusRowIndex); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::FocusUpdate End RowNumn %d ",iCloudInfo.Count()-1); + iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); + iEndRowIndex = iCloudInfo.Count()-1; + LayoutVisibleArea(); + } + + +// --------------------------------------------------------------------------- +// ResetLayout() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::UpdateLayout() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::UpdateLayout()"); + iCloudInfo.Close (); //row information is reset + for(TInt i = 0;iRemoveAndDestroyAllD(); // removes from control + iLabels[i] = NULL; + } + iLabels.Reset(); + } + + +// --------------------------------------------------------------------------- +// GetRownum() +// --------------------------------------------------------------------------- +// +TInt CGlxCloudViewControl::RowNumber(TInt aItemIndex) const +{ + +TRACER("GLX_CLOUD::CGlxCloudViewControl::GetRownum"); +//Get the rownumber of the given item index. +TInt i; +for (i = 0; i < iCloudInfo.Count (); i++) + { + if ( (aItemIndex >= iCloudInfo[i].iStartIndex) && (aItemIndex <=iCloudInfo[i].iEndIndex)) + break; + } +return i; + +} + +// --------------------------------------------------------------------------- +// FetchAttributeFromCacheL() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::FetchAttributeFromCacheL() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::FetchAttributeFromCacheL"); + GLX_LOG_INFO("GLX_CLOUD ::CGlxCloudViewControl::FetchAttributeFromCache MediaList already filled" ); + //enable msk as the medialist is populated + //iObserver.HandleMskChangedL (ETrue); + iLayoutObserver.HandleLayoutChanged(); + if ( iLabels.Count ()==0) + { + for (TInt i=0; iSetOpacity(opacity); + } + } + + for (TInt i=0; iSetTextL( item.Title() ); + } + } + + +//medialist Observers + +// --------------------------------------------------------------------------- +// HandleItemAddedL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleItemAddedL"); + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::HandleItemAddedL start index %d ", aStartIndex); + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::HandleItemAddedL end index %d ", aEndIndex); + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::HandleItemAddedL media list count %d ", aList->Count()); + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::HandleItemAddedL attribute request count %d ", iAttributeContext->RequestCountL(aList)); + + if ( iEmptyString ) + { + // remove the empty string so it does not fool around in animations + iEmptyString->RemoveAndDestroyAllD(); // removes from control + iEmptyString = NULL; + } + //The new item has been added and it is required to cleanup the visuals and info bubble + //for the existing tags(if any). + //when a filter is applied attribute request count is zero but medialist count in non zero + if (iAttributeContext->RequestCountL(aList) == 0 ) + { + //reset the layout and get the items from cache + UpdateLayout(); //remove all the visuals from the layout.layout is empty now. + iCloudInfo.Close (); //row information is reset + //get the new array contents from cache.no need to reset the array as the number + //of items in array will remain same. + FetchAttributeFromCacheL(); + UpdateRowDataL (); //updates the row data and reassigns font sizes and draw the layout on screen. + } + + } + + +// --------------------------------------------------------------------------- +// HandleMediaL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleMediaL"); + } + +// --------------------------------------------------------------------------- +// HandleItemRemovedL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleItemRemovedL"); + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::HandleItemRemovedL Start RowNum %d ", aStartIndex); + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::HandleItemRemovedL iCloudCount %d ", aEndIndex); + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::HandleItemRemovedL media list count %d ", aList->Count()); + + //when a filter is applied attribute request count is zero but medialist count in non zero + if (iAttributeContext->RequestCountL(aList) == 0 ) + { + //reset the layout and get the items from cache + UpdateLayout(); //remove all the visuals from the layout.layout is empty now. + if( aList->Count() > 0 ) + { + //get the new array contents from cache.no need to reset the array as the number + //of items in array will remain same. + FetchAttributeFromCacheL(); + UpdateRowDataL (); //updates the row data and reassigns font sizes and draw the layout on screen. + } + else + { + DisplayEmptyCloudViewL(); + } + } + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleItemModifiedL"); + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleAttributesAvailableL"); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::HandleAttributesAvailableL iLabels.Count() %d ",iLabels.Count()); + TInt attCount = aAttributes.Count (); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::HandleAttributesAvailableL count: %d ",attCount); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::HandleAttributesAvailableL Item Index: %d ", aItemIndex); + + TBool relevantAttribute = EFalse; + for ( TInt i = 0 ; i < attCount ; i++ ) + { + if ( ( aAttributes[i] == KMPXMediaGeneralTitle ) + || ( aAttributes[i] == KMPXMediaGeneralCount ) ) + { + relevantAttribute = ETrue; + } + } + //if the title array has been loaded completely and request count for attribute context becomes + //zero update the row data and arrange layout + if ( ( iAttributeContext->RequestCountL(aList) ==0 ) + && ( aList->Count() != 0) && relevantAttribute ) + { + //get the new array contents from cache.no need to reset the array as the number + //of items in array will remain same. + UpdateLayout(); //remove all the visuals from the layout.layout is empty now. + FetchAttributeFromCacheL(); + //if we navigate in forward direction, first item should be highlighted.if we are navigating in + // backwards direction, index is not necessarily zero, it will be restored. + if ( iUiUtility->ViewNavigationDirection ()== EGlxNavigationForwards && iMediaList.Count ()) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, 0); + } + //generate row structures and draw rows on screen + UpdateRowDataL (); + } + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* /*aList*/) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleFocusChangedL"); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::HandleFocusChangedL aNewIndex %d ", aNewIndex); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::HandleFocusChangedL aOldIndex %d ",aOldIndex); + if ( (aOldIndex >= 0) && (iLabels.Count()-1 >= aOldIndex) ) + { + //Reset the focused color + iLabels[aOldIndex]->SetColor (KAknsIIDQsnTextColors, + EAknsCIQsnTextColorsCG6); + HandleLayoutFocusChange (); + } + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleItemSelectedL"); + } + +// --------------------------------------------------------------------------- +// HandleMessageL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleMessageL"); + } + +// --------------------------------------------------------------------------- +// HandlePopulatedL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::HandlePopulatedL(MGlxMediaList* /*aList*/) + { + //Display the Empty clould view only when we get this call back. + // At this stage the medialist will be populated. + if(iMediaList.Count()<=0) + { + DisplayEmptyCloudViewL(); + } + } + +// --------------------------------------------------------------------------- +//UpdateRowDataL() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::UpdateRowDataL() + + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::UpdateRowData()"); + + TInt rowStartingTagIndex = 0; + TInt lastRowStartTagIndex = 0; + TInt currentTagIndex = 0; + TSize currentTagSize(0, 0); + TGlxCloudInfo cloudInfo; + TInt rowHeight = 0; + TInt rowWidth = 0; + TInt itemUsageCount = 0; + const TInt KLabelsCount = iLabels.Count(); + iScrollPaneHandle = AknLayoutScalable_UiAccel::aa_scroll_pane(0).LayoutLine(); + const TInt KMaxScreenWidth = iTagScreenWidth - KRightmargin - iScrollPaneHandle.iW; + + iCloudInfo.Close (); //delete existing structures for orintation change + + + //Setting the Font Styles based on association counts + //Finding the maximum value of image association + //Determining the Font(Style) for each visual + TInt maxCount= MaxUsageCount (); //Maximum Association count + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData mediaCount %d ", maxCount); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData iLabels.Count() %d ",iLabels.Count()); + if ( 0 == maxCount ) + { + return; //do not proceed if max count is zero + } + + for (TInt i = 0; i < KLabelsCount; i++) + { + TInt percent( 0 ); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData Item Counter value %d ",i); + itemUsageCount = UsageCount(i); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData Usage Count %d ", itemUsageCount); + percent = ((itemUsageCount * 99)/ maxCount); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData iLabels.Count() %d ",iLabels.Count()); + + // percent is between 0 and 99 so divide it by 20 to make it 0, 1, 2, 3 or 4 + // as there is 5 different font sizes + SetPropertiesL( i, TInt( percent / 20 ) ); + } + + while ( currentTagIndex < KLabelsCount ) + { + //Determining text size of visual. + currentTagSize = iLabels[currentTagIndex]->TextExtents(); + if( currentTagSize .iWidth < KMinTagSize ) + { + currentTagSize.iWidth = KMinTagSize; + } + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData currentTagSize.iHeight %d ", currentTagSize.iHeight); + + // The current row's height will always be the largest height of all the tags in that row + if ( currentTagSize.iHeight > rowHeight ) + { + rowHeight = currentTagSize.iHeight; + } + + // Current row width will be progressively incremented to fit as many tags as possible + rowWidth += currentTagSize.iWidth + 10; + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData currentTagSize.iWidth %d ", currentTagSize.iWidth); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData rowWidth %d ", rowWidth); + + // If the tag size crosses the Screen Size, Then wrap it. + if ( currentTagSize.iWidth > KMaxScreenWidth ) + { + lastRowStartTagIndex = ((rowStartingTagIndex == currentTagIndex)?rowStartingTagIndex : currentTagIndex-1); + AppendToCloudArrayL( cloudInfo,/* rowHeight,*/ rowStartingTagIndex, lastRowStartTagIndex ); + // Reset row height and row width for the next line + rowHeight = 0; + rowWidth = 0; + if (lastRowStartTagIndex != currentTagIndex-1 ) + { + currentTagIndex++; + } + rowStartingTagIndex = currentTagIndex; + lastRowStartTagIndex++; + } + + // If the current row's width is overflowing the screen width + // then we must fit the current visual into the next row. + // Do that check now and adjust accordingly. + // Fix for EAHN-7BZD78 is to exclude the gap value between the row's tags from the logic + else if ( rowWidth - 10 > KMaxScreenWidth ) + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::UpdateRowData Row added"); + lastRowStartTagIndex = currentTagIndex - 1; + AppendToCloudArrayL( cloudInfo,rowStartingTagIndex, lastRowStartTagIndex ); + lastRowStartTagIndex++; + // Reset row height and row width for the next line + rowHeight = 0; + rowWidth = 0; + rowStartingTagIndex = currentTagIndex; + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData iCloudInfo.count %d ", iCloudInfo.Count()); + } + + // need to work with next tag only if current tag has been taken care of + if ( rowWidth ) + { + currentTagIndex++; + } + + } // while ( currentTagIndex < KLabelsCount ) + + if( lastRowStartTagIndex < KLabelsCount) + { + AppendToCloudArrayL( cloudInfo,lastRowStartTagIndex, KLabelsCount - 1 ); + } + + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::UpdateRowData iCloudInfo.count loop exit %d ", iCloudInfo.Count()); + FocusUpdate (); //Start screen drawing + + iEndRowIndex = iCloudInfo.Count()-1; + } + +// --------------------------------------------------------------------------- +// SetProperties +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::SetPropertiesL(TInt aIndex, TInt aScale) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::SetProperties()"); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::SetProperties layout Count after reset %d ", iLayout->Count()); + //Retrieving theme color + + TAlfTimedValue scale(0); + TRAP_IGNORE(iLabels[aIndex]->EnableTransformationL()); + TAlfTimedValue opacity; + opacity.SetStyle (EAlfTimedValueStyleLinear); + opacity.SetValueNow(0.0); + iLabels[aIndex]->SetOpacity(opacity); + iLabels[aIndex]->SetAlign (EAlfAlignHLocale, EAlfAlignVBottom); //setting allignment + iLabels[aIndex]->SetColor (KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6); + //custom style cod + TInt typefaceSecondaryStyleId = CGlxCloudViewControl::Env().TextStyleManager().CreatePlatformTextStyleL( + EAknLogicalFontSecondaryFont,EAlfTextStyleNormal); + TInt typefacePrimaryStyleId = CGlxCloudViewControl::Env().TextStyleManager().CreatePlatformTextStyleL( + EAknLogicalFontPrimaryFont,EAlfTextStyleNormal); + CAlfTextStyle* stylePrimary = CGlxCloudViewControl::Env().TextStyleManager().TextStyle( + typefacePrimaryStyleId); + CAlfTextStyle* styleSecondary = CGlxCloudViewControl::Env().TextStyleManager().TextStyle( + typefaceSecondaryStyleId); + switch (aScale) + { + case 0: + { + styleSecondary->SetTextSizeInPixels (KFontSmallest, 0); + iLabels[aIndex]->SetTextStyle (typefaceSecondaryStyleId); + TAlfTimedValue opacity; + opacity.SetValueNow(0.0); + iLabels[aIndex]->SetOpacity(opacity); + scale.SetTarget(1, 1000); + break; + } + case 1: + { + styleSecondary->SetTextSizeInPixels (KFontSmaller, 0); + iLabels[aIndex]->SetTextStyle (typefaceSecondaryStyleId); + scale.SetTarget(1, 1200); + TAlfTimedValue opacity; + opacity.SetValueNow(0.0); + iLabels[aIndex]->SetOpacity(opacity); + break; + } + case 2: + { + stylePrimary->SetTextSizeInPixels (KFontMedium, 0); + iLabels[aIndex]->SetTextStyle (typefacePrimaryStyleId); + scale.SetTarget(1, 1500); + TAlfTimedValue opacity; + opacity.SetValueNow(0.0); + iLabels[aIndex]->SetOpacity(opacity); + break; + } + case 3: + { + stylePrimary->SetTextSizeInPixels (KFontLarger, 0); + iLabels[aIndex]->SetTextStyle (typefacePrimaryStyleId); + scale.SetTarget(1, 1800); + TAlfTimedValue opacity; + opacity.SetValueNow(0.0); + iLabels[aIndex]->SetOpacity(opacity); + break; + } + case 4: + { + stylePrimary->SetTextSizeInPixels (KFontLargest, 0); + iLabels[aIndex]->SetTextStyle (typefacePrimaryStyleId); + scale.SetTarget(1, 2200); + TAlfTimedValue opacity; + opacity.SetValueNow(0.0); + iLabels[aIndex]->SetOpacity(opacity); + break; + } + } + + iLabels[aIndex]->Transformation().Scale (scale, scale); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::SetProperties layout Count after reset %d ", iLayout->Count()); + } + +// --------------------------------------------------------------------------- +// DisplayEmptyCloudView +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::DisplayEmptyCloudViewL() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::DisplayEmptyCloudView"); + if( !iEmptyString ) + { + iEmptyString = CAlfTextVisual::AddNewL ( *this, iViewPortLayout ); + iViewPortLayout->SetSize(TAlfRealSize(iTagScreenWidth,iTagScreenHeight), 0); + iLayout->UpdateChildrenLayout (); //update layout + } + //Setting text color to default theme text color. + iEmptyString->SetColor(KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); + iEmptyString->SetTextStyle(iUiUtility->TextStyleIdL(EAknLogicalFontPrimaryFont + ,KPrimaryFontSize)); + iEmptyString->SetWrapping( CAlfTextVisual::ELineWrapBreak ); + iEmptyString->SetTextL (iEmptyText->Des()); + // no shadow wanted for the text + iEmptyString->EnableShadow( EFalse ); + + //disable msk + iLayoutObserver.HandleLayoutChanged(); + //iObserver.HandleMskChangedL (EFalse); + iScrollEventData.mSpan = 0; + iScrollEventData.mViewLength = 0; + DisplayScrollBar(); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::DisplayEmptyCloudView layout Count after reset %d ", iLayout->Count()); + } + +// --------------------------------------------------------------------------- +// MaxUsageCount() +// --------------------------------------------------------------------------- +// +TInt CGlxCloudViewControl::MaxUsageCount() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::GetMaxusageCount"); + TInt maxValue=0; + const TInt mediaListSize = iMediaList.Count(); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::GetMaxusageCount MediaList Count %d ",iMediaList.Count()); + for (TInt k=0; k < mediaListSize; k++) + { + TInt count = UsageCount (k); + if ( count > maxValue) + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::GetMaxusageCount in the loop"); + maxValue=count; + } + } + return maxValue; + } + +// --------------------------------------------------------------------------- +// UsageCount() +// --------------------------------------------------------------------------- +// +TInt CGlxCloudViewControl::UsageCount(TInt aIndex) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::UsageCount"); + GLX_LOG_INFO1("GLX_CLOUD :: CGlxCloudViewControl::UsageCount Item index: %d ", aIndex); + TMPXAttribute attrCount(KMPXMediaGeneralCount); // get the attrCount + TInt usageCount =0; + const CGlxMedia* media = iMediaList.Item(aIndex).Properties (); + if ( media) + { + if ( media->IsSupported (attrCount)) + { + usageCount = media->ValueTObject (attrCount); + GLX_LOG_INFO1("GLX_CLOUD :: CGlxCloudViewControl::UsageCount Count: %d ", usageCount); + } + } + return usageCount; + } + +// --------------------------------------------------------------------------- +// SetFocusColor() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::AppendToCloudArrayL( + TGlxCloudInfo& aCloudInfo,const TInt& aStartIndex, const TInt& aEndIndex ) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::AppendToCloudArrayL"); + aCloudInfo.iStartIndex = aStartIndex; + aCloudInfo.iEndIndex = aEndIndex; + iCloudInfo.AppendL( aCloudInfo ); + } + +// --------------------------------------------------------------------------- +// SetFocusColor() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::SetFocusColor() + { + iLabels[iMediaList.FocusIndex()]->SetColor (KAknsIIDQsnHighlightColors ,EAknsCIQsnHighlightColorsCG3); + } + + +// --------------------------------------------------------------------------- +// SetBubleMidPoint() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::SetBubleMidPoint(TPoint& aMidPoint) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::SetBubleMidPoint"); + //Substract the viewport position so as to set the buble at the right position on the screen + aMidPoint.iX-=iViewPortPosition.iX; + aMidPoint.iY-=iViewPortPosition.iY; + } + +// --------------------------------------------------------------------------- +// CreateBubleContainer() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::CreateBubleContainer() + { + /* if ( !iBubbleContainer) + { + TRAPD(err1, + { + iBubbleContainer = CGlxContainerInfoBubble::NewL (&iMediaList, + CGlxCloudViewControl::Env (), *this); + }); + ; + if ( err1!= KErrNone) + { + GLX_LOG_INFO1("GLX_CLOUD::CGlxCloudViewControl::LayoutVisibleArea - Error (%d)", err1); + } + iBubbleContainer->SetHost (this); + }*/ + } + +// --------------------------------------------------------------------------- +// MoveUpIfRequired() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::MoveUpIfRequired() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::MoveUpIfRequired"); + //get the focused item's position + TPoint point; + iLayout->ChildPos(iMediaList.FocusIndex(),point); + TSize size; + iLayout->ChildSize(iMediaList.FocusIndex(),size); + TInt focus = iMediaList.FocusIndex(); + TInt rownumber = RowNumber(focus); + //if the focused item is not visible then move the viewport + if(point.iY < iViewPortPosition.iY) + { + //set the new position of viewport + TInt offeset = iViewPortPosition.iY - point.iY; + iViewPortPosition.iY-=offeset; + if( (iViewPortPosition.iY < 0) ) + { + iViewPortPosition.iY = 0; + } + } + //if its key event then it should be cyclic + else if( rownumber == (iCloudInfo.Count()-1)) + { + iViewPortPosition.iY = iViewPortVirtualSize.iHeight - iViewPortSize.iHeight; + } + iViewPortLayout->SetViewportPos (iViewPortPosition,1000); + iScrollEventData.mViewStartPos = iViewPortPosition.iY; + Scroll(); + //CalculateBubleMidPoint (); + } + + +// --------------------------------------------------------------------------- +// MoveDownIfRequired() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::MoveDownIfRequired() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::MoveDownIfRequired"); + //get the focused item's position + TPoint point; + iLayout->ChildPos(iMediaList.FocusIndex(),point); + TSize size; + iLayout->ChildSize(iMediaList.FocusIndex(),size); + //if the focused visual is not visible then move the viewport + if(point.iY+size.iHeight > iViewPortPosition.iY+iViewPortSize.iHeight ) + { + //set the new position of viewport + TInt offeset = (point.iY+size.iHeight) - (iViewPortPosition.iY+iViewPortSize.iHeight); + iViewPortPosition.iY+=offeset; + if( (iViewPortPosition.iY > iViewPortVirtualSize.iHeight) ) + { + iViewPortPosition.iY = iViewPortVirtualSize.iHeight - iViewPortSize.iHeight; + } + } + //if its key event then it should be cyclic + else if (iMediaList.FocusIndex() == 0) + { + iViewPortPosition.iY = 0; + } + iViewPortLayout->SetViewportPos (iViewPortPosition,1000); + iScrollEventData.mViewStartPos = iViewPortPosition.iY; + if(iScrollBarWidget) + { + Scroll(); + } + //CalculateBubleMidPoint(); + } + +// --------------------------------------------------------------------------- +// MoveDownIfRequired() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::CalculateBubleMidPoint() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::CalculateBubleMidPoint"); + TPoint midpoint; + TAlfRealRect focussedItemRect; + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, mainPaneRect); + + CAlfVisual& visual = iLayout->Visual( iMediaList.FocusIndex() ); + focussedItemRect = visual.DisplayRect(); + + if( GlxGeneralUiUtilities::LayoutIsMirrored () ) + { + midpoint.iX = focussedItemRect.iBr.iX + + ((focussedItemRect.iTl.iX - focussedItemRect.iBr.iX )/2); + } + + else + { + midpoint.iX=focussedItemRect.iTl.iX + + ((focussedItemRect.iBr.iX - focussedItemRect.iTl.iX )/2); + } + + midpoint.iY=focussedItemRect.iTl.iY+ + ((focussedItemRect.iBr.iY - focussedItemRect.iTl.iY )/2); + TPoint anchorRect; + + //Get the position of anchor layout + iViewPortLayout->ChildPos (0, anchorRect); + + //Add the differance to the midpoint + midpoint.iX+=anchorRect.iX; + midpoint.iY+=anchorRect.iY; + + //Substract from the viewport position the viewport position + SetBubleMidPoint(midpoint); + + //Set the buble focus + // iBubbleContainer->SetFocus (midpoint); + } + +// --------------------------------------------------------------------------- +// HandlePointerEventL() +// --------------------------------------------------------------------------- +// +TBool CGlxCloudViewControl::HandlePointerEventL( const TAlfEvent &aEvent ) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandlePointerEventL"); + CAlfVisual* tappedvisual = aEvent.Visual(); + TBool consumed = EFalse; + if(aEvent.PointerEvent().iType == TPointerEvent::EButton1Down) + { + if(tappedvisual) + { + for(TInt index=0;indexCount();index++) + { + CAlfVisual* layoutvisual = &(iLayout->Visual(index)); + //if the tapped visual is same as the visual in the layout then focus that visual + if(layoutvisual == tappedvisual) + { + TInt focus = iMediaList.FocusIndex(); + //if the visual is already focused then for next tap open the next view + if( focus == index ) + { + iTouchFeedback->InstantFeedback( ETouchFeedbackBasic ); + iObserverEnterKeyEvent.HandleEnterKeyEventL( (TInt)EAknCmdOpen ); + consumed = ETrue; + } + else if( index!= focus ) + { + iTouchFeedback->InstantFeedback( ETouchFeedbackBasic ); + TInt focusrowindex = iFocusRowIndex; + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + index); + SetFocusColor(); + iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); + if( iFocusRowIndex > focusrowindex) + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandleDragL,b4 movedown"); + iScrollDirection = 0; + MoveDownIfRequired(); + } + else if( iFocusRowIndex < focusrowindex ) + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandleDragL,b4 moveup"); + iScrollDirection = 1; + MoveUpIfRequired(); + } + } + consumed = ETrue; + Display()->Roster().SetPointerEventObservers( EAlfPointerEventReportDrag + + EAlfPointerEventReportLongTap + + EAlfPointerEventReportUnhandled, *this ); + Display()->Roster().DisableLongTapEventsWhenDragging(*this); + break; + } + } + } + } + + else if (aEvent.PointerEvent().iType == TPointerEvent::EDrag) + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandlePointerEventL(EDrag) event"); + iTouchFeedback->InstantFeedback( ETouchFeedbackBasic ); + consumed = HandleDragL(aEvent.PointerEvent()); + } + else if (aEvent.PointerUp()) + { + + Env().CancelCustomCommands(this,ECustomEventFocusDragScroll); + Display()->Roster().SetPointerEventObservers(0, *this); + consumed = ETrue; + } + return consumed; + } + +// --------------------------------------------------------------------------- +// HandleDragL() +// --------------------------------------------------------------------------- +// +TBool CGlxCloudViewControl::HandleDragL(const TPointerEvent& aPointerEvent) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::HandleDragL"); + TBool consumed = EFalse; + TInt itemindex = GetAbsoluteIndex(aPointerEvent.iPosition); + TInt focus = iMediaList.FocusIndex(); + TInt focusrowindex = iFocusRowIndex; + + //if index is not NULL then focus the tag and move the viewport down if necessary + if ( itemindex != KErrNotFound ) + { + if (focus != itemindex ) + { + iTouchFeedback->InstantFeedback( ETouchFeedbackSensitive ); + iMediaList.SetFocusL (NGlxListDefs::EAbsolute,itemindex); + iFocusRowIndex = RowNumber (iMediaList.FocusIndex ()); + GLX_LOG_INFO1("GLX_CLOUD :: CGlxCloudViewControl::HandleDragL,focusrowindex = %d",iFocusRowIndex); + if( iFocusRowIndex > focusrowindex) + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandleDragL,b4 movedown"); + iScrollDirection = 0; + MoveDownIfRequired(); + } + else if( iFocusRowIndex < focusrowindex ) + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandleDragL,b4 moveup"); + iScrollDirection = 1; + MoveUpIfRequired(); + } + } + consumed = ETrue; + } + + TRect screenstartrect; + //the starting rect of the visible screen + screenstartrect.SetRect(0,0,iTagScreenWidth,2*KRowHeight); + + TRect screenendrect; + //the end rect of the visible screen + screenendrect.SetRect(0,(iTagScreenHeight-(2*KRowHeight)),iTagScreenWidth,iTagScreenHeight); + + //dragging down + if(screenendrect.Contains(aPointerEvent.iPosition)) + { + iIsDragging = 1; + Env().Send(TAlfCustomEventCommand(ECustomEventFocusDragScroll, + this),KDragHoldTime); + } + //dragging up + else if (screenstartrect.Contains(aPointerEvent.iPosition)) + { + iIsDragging = 2; + Env().Send(TAlfCustomEventCommand(ECustomEventFocusDragScroll, + this),KDragHoldTime); + } + + return consumed; + } + +// --------------------------------------------------------------------------- +// GetAbsoluteIndex() +// --------------------------------------------------------------------------- +// +TInt CGlxCloudViewControl::GetAbsoluteIndex(const TPoint& aPosition) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::GetAbsoluteIndex"); + //find out the visual on which the drag event has occured + for(TInt j = 0; j < iLayout->Count(); j++) + { + CAlfVisual* visual = &(iLayout->Visual(j)); + TRect visualrect = visual->DisplayRect(); + TInt focusindex = iMediaList.FocusIndex(); + if(visualrect.Contains(aPosition) && (focusindex != j)) + { + return j; + } + } + return KErrNotFound; + } + +// --------------------------------------------------------------------------- +// SetRelativeFocusL() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::SetRelativeFocusL(TInt aRowNumber) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::SetRelativeFocusL"); + TInt focus = iMediaList.FocusIndex (); + //get the co-ordinates of the focused tag + TInt x = iLayout->Visual(focus).DisplayRect().Center().iX; + TInt y = iLayout->Visual(focus).DisplayRect().Center().iY; + TPoint midpoint(x, y); + + //find the tag below\above that overlaps with the focused tag + for(TInt index = iCloudInfo[aRowNumber].iStartIndex; + index <= iCloudInfo[aRowNumber].iEndIndex; index++) + { + CAlfVisual* visual = &(iLayout->Visual(index)); + TRect visualrect = visual->DisplayRect(); + if ( (visualrect.iTl.iX <= midpoint.iX) && (midpoint.iX <= visualrect.iBr.iX)) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute,index); + break; + } + } + + // if no element is found that overlaps with midpoint of the + //focused item,then focus the last element of the next row. + if(focus == iMediaList.FocusIndex ()) + { + iMediaList.SetFocusL (NGlxListDefs::EAbsolute, + iCloudInfo[aRowNumber].iEndIndex); + } + } + +// --------------------------------------------------------------------------- +// setActiveStates() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::setActiveStates( unsigned int /*aStates*/ ) + { + } + +// --------------------------------------------------------------------------- +// makeInterface() +// --------------------------------------------------------------------------- +// +IAlfInterfaceBase* CGlxCloudViewControl::makeInterface ( const IfId& /*aType*/ ) + { + return NULL; + } + +// --------------------------------------------------------------------------- +// eventHandlerType() +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType CGlxCloudViewControl::eventHandlerType() + { + return IAlfWidgetEventHandler::ELogicalEventHandler; + } + +// --------------------------------------------------------------------------- +// eventExecutionPhase() +// --------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase CGlxCloudViewControl::eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } + +// --------------------------------------------------------------------------- +// offerEvent() +// --------------------------------------------------------------------------- +// +AlfEventStatus CGlxCloudViewControl::offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::offerEvent"); + AlfEventStatus status = EEventNotHandled; + if(aEvent.IsCustomEvent() && accept(aControl, aEvent)) + { + if ((iScrollBarWidget!=NULL)) + { + if (aEvent.IsCustomEvent()) + { + switch(aEvent.CustomParameter()) + { + case KAlfActionIdDeviceLayoutChanged: + { + // iObserver.HandleMskChangedL(ETrue); + iLayoutObserver.HandleLayoutChanged(); + TRAP_IGNORE(UpdateLayoutL()); + } + return EEventNotHandled; + + case EEventDragVertical: + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::offerEvent(EEventScrollDown) event"); + TInt steps = TInt(aEvent.CustomEventData()); + UpdateScrollBar(steps,EFalse); + Scroll(); + status = EEventHandled; + } + break; + case EEventScrollPageUp: + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::offerEvent(EEventScrollPageUp) event"); + UpdateScrollBar(-iScrollEventData.mViewLength); + Scroll(); + status = EEventHandled; + } + break; + case EEventScrollPageDown: + { + GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::offerEvent(EEventScrollPageDown) event"); + UpdateScrollBar(iScrollEventData.mViewLength); + Scroll(); + status = EEventHandled; + } + break; + }//end switch + } + } + } + return status; + } + +// --------------------------------------------------------------------------- +// accept() +// --------------------------------------------------------------------------- +// +bool CGlxCloudViewControl::accept ( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ) const + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::accept"); + if( aEvent.CustomParameter() == EEventScrollPageUp || + aEvent.CustomParameter() == EEventScrollPageDown || + aEvent.CustomParameter() == EEventDragVertical || + aEvent.CustomParameter() == KAlfActionIdDeviceLayoutChanged ) + { + return true; + } + return false; + } + +// --------------------------------------------------------------------------- +// attachScrollBar() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::InitializeScrollBar(IAlfScrollBarWidget* aScrollBarWidget) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::InitializeScrollBar"); + iScrollBarWidget=aScrollBarWidget; + ((IAlfScrollBarModel *)(iScrollBarWidget->model()))->initializeData(iScrollEventData.mSpan, + iScrollEventData.mViewLength,0); + DisplayScrollBar(); + } + +// --------------------------------------------------------------------------- +// Scroll() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::Scroll() + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::Scroll()"); + TAlfEvent customevent(EEventScrollBarModelChanged,(TInt)&iScrollEventData); + IAlfElement* baseelement = iScrollBarWidget->control()->findElement ("BaseElement"); + iScrollbarElement=static_cast ( + baseelement->makeInterface (IAlfWidgetEventHandler::type())); + //pass the custom event to scrollbar element so as to scroll to the required position + iScrollbarElement->offerEvent(*(iScrollBarWidget->control()),customevent); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxCloudViewControl::Scroll(),position %d ",iScrollEventData.mViewStartPos); + iViewPortPosition.iY = iScrollEventData.mViewStartPos; + iViewPortLayout->SetViewportPos (iViewPortPosition,1000); + } + +// --------------------------------------------------------------------------- +// UpdateScrollBar() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::UpdateScrollBar(TInt aNumberOfSteps, TBool aDiff) + { + TRACER("GLX_CLOUD::CGlxCloudViewControl::UpdateScrollBar()"); + TInt viewLength = ((IAlfScrollBarModel *)(iScrollBarWidget->model()))->getViewLength(); + TInt viewStartPos=((IAlfScrollBarModel *)(iScrollBarWidget->model()))->getViewStartPosition(); + TInt totalLength=((IAlfScrollBarModel *)(iScrollBarWidget->model()))->getTotalLength(); + + TInt newViewStartPos=viewStartPos; + if(aDiff) + { + aNumberOfSteps+=viewStartPos; + } + if( (aNumberOfSteps <= (totalLength-viewLength))&&(aNumberOfSteps>=0) ) + { + newViewStartPos=aNumberOfSteps; + } + else if( aNumberOfSteps > (totalLength-viewLength) ) + { + newViewStartPos=totalLength-viewLength; + } + else if ( aNumberOfSteps < 0 ) + { + newViewStartPos=0; + } + iScrollEventData.mViewStartPos = newViewStartPos; + } + +// --------------------------------------------------------------------------- +// DisplayScrollBar() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::DisplayScrollBar() + { + if( iScrollBarWidget ) + { + IAlfElement* vertBaseElement =(iScrollBarWidget->control()->findElement ("BaseElement")); + IAlfScrollBarDefaultBaseElement* scrollbarbaselement=static_cast ( + vertBaseElement->makeInterface (IAlfScrollBarDefaultBaseElement::type() ) ); + + if( iScrollEventData.mSpan ) + { + scrollbarbaselement->setThumbOpacity(1.0); + } + else + { + scrollbarbaselement->setThumbOpacity(0.0); + } + } + } + +// --------------------------------------------------------------------------- +// UpdateLayoutL() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewControl::UpdateLayoutL() + { + TRect rect; + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); + if ( (rect.Width() != iTagScreenWidth) && ( rect.Height () != iScreenHeight)) + { + //set the new screen dimensions + iScreenHeight=rect.Height(); + iTagScreenWidth = rect.Width()- iScrollPaneHandle.iW - KRightmargin; + if (GlxGeneralUiUtilities::IsLandscape()) + { + iTagScreenHeight = rect.Height(); + } + else + { + iTagScreenHeight = KTagScreenHeight; + } + + iViewPortLayout->SetSize(TAlfRealSize(iTagScreenWidth,iTagScreenHeight), 0); + //delete all layout associations + if ( iCloudInfo.Count ()!= 0)//check for the empty cloud view + { + UpdateLayout(); + FetchAttributeFromCacheL(); + //generate row structures and draw rows on screen + UpdateRowDataL (); + } + } + } + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/src/glxcloudviewimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/src/glxcloudviewimp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,423 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Cloud view + * +*/ + + + + +// INCLUDE FILES +#include "glxcloudviewimp.h" //header file + +//ALF headers +#include //for Alfcontrolgroup +#include //for alfwidget controls +#include // For CAlfGridLayout +#include // For CAlfLAyoutManager +#include // For CAlfScrollBarModel +#include // For CAlfScrollBarDefaultBaseelement +#include +#include +#include // for CGlxResourceUtilities + +#include +#include +#include +#include // For Logs +#include // For view state +#include //medialist +#include // For directory paths + +#include + +#include "glxcloudviewcontrol.h"//cloud view control + +const TInt KViewId = 0x200071B7; + +using namespace Alf; +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCloudViewImp *CGlxCloudViewImp::NewL(MGlxMediaListFactory + *aMediaListFactory, const TDesC &aFileName, TInt aViewResId, + TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId) + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::NewL"); + CGlxCloudViewImp *self = CGlxCloudViewImp::NewLC(aMediaListFactory, + aFileName, aViewResId, aEmptyListResId, aSoftKeyResId + , aSoftkeyMskDisabledId); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCloudViewImp *CGlxCloudViewImp::NewLC(MGlxMediaListFactory + *aMediaListFactory, const TDesC &aFileName, TInt aViewResId, + TInt aEmptyListResId, TInt aSoftKeyResId, TInt aSoftkeyMskDisabledId) + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::NewLC"); + CGlxCloudViewImp *self = new(ELeave)CGlxCloudViewImp(aSoftKeyResId,aSoftkeyMskDisabledId); + CleanupStack::PushL(self); + self->ConstructL(aMediaListFactory, aFileName, aViewResId, aEmptyListResId, aSoftKeyResId); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCloudViewImp::CGlxCloudViewImp(TInt aSoftKeyResId, + TInt aSoftkeyMskDisabledId) : + iSoftKeyResId(aSoftKeyResId), iSoftkeyMskDisabledId(aSoftkeyMskDisabledId) + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::CGlxCloudViewImp"); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::ConstructL(MGlxMediaListFactory *aMediaListFactory, + const TDesC &aFileName, TInt aViewResId, TInt aEmptyListResId, + TInt /*aSoftKeyResId*/) + + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::ConstructL"); + TFileName resourceFile(KDC_APP_RESOURCE_DIR); + resourceFile.Append (aFileName); + CGlxResourceUtilities::GetResourceFilenameL (resourceFile); + iResourceOffset = iCoeEnv->AddResourceFileL (resourceFile); + BaseConstructL (aViewResId); + ViewBaseConstructL (); + MLViewBaseConstructL (aMediaListFactory); + + //Register the view to recieve toolbar events. ViewBase handles the events + SetToolbarObserver(this); + ShowToolbarOnViewActivation(ETrue); + + iEmptyListText = iEikonEnv->AllocReadResourceL(aEmptyListResId); + iDisplay = iUiUtility->Display (); + CAknToolbar* toolbar = Toolbar(); + if(toolbar) + { + toolbar->DisableToolbarL(ETrue); + } +// SetSoftkeysFromResourceIdL (iSoftkeyMskDisabledId); //initially load empty msk + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxCloudViewImp::~CGlxCloudViewImp() + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::~CGlxCloudViewImp"); + CleanupVisuals (); + delete iEmptyListText; + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile (iResourceOffset); + } + delete iTitletext; + } + +// --------------------------------------------------------------------------- +// From CAknView +// Returns views id. +// --------------------------------------------------------------------------- +// +TUid CGlxCloudViewImp::Id()const + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::Id()"); + return TUid::Uid (KViewId); + } + +// --------------------------------------------------------------------------- +// HandleViewCommandL +// --------------------------------------------------------------------------- +// +TBool CGlxCloudViewImp::HandleViewCommandL(TInt aCommand) + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::HandleViewCommandL"); + TBool consumed = EFalse; + + switch (aCommand) + { + case EAknCmdOpen: + case EKeyEnter: + { + // Processing of this Command depends on Medialist Count ( > 0 tags Available) + if(iMediaList->Count()) + { + // There can be no selection in cloud view, so assume that path contains focused item + iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); + CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); + iCollectionUtility->Collection().OpenL (*path); + CleanupStack::PopAndDestroy (path); + consumed= ETrue; + } + break; + } + } + + return consumed; + } + + +// --------------------------------------------------------------------------- +// From CAknView +// Handles a view activation. +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::DoMLViewActivateL(const TVwsViewId & /* aPrevViewId */, + TUid /* aCustomMessageId */, const TDesC8 & /* aCustomMessage */) + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::DoMLViewActivateL"); + if(StatusPane()) + { + StatusPane()->MakeVisible(ETrue); + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + if( iTitletext ) + { + // Set the required Title + titlePane->SetTextL( *iTitletext ); + } + } + ConstructCloudControlL(); + GLX_LOG_INFO("CGlxCloudViewImp::DoMLViewActivateL Cloud View Control Created" ); + // set app state to tag-browser view + GlxSetAppState::SetState (EGlxInTagBrowserView); + } + +// --------------------------------------------------------------------------- +// From CAknView +// View deactivation function. +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::DoMLViewDeactivate() + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::DoMLViewDeactivate"); + if(StatusPane()) + { + if(iTitletext) + { + delete iTitletext; + iTitletext = NULL; + } + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + TRAP_IGNORE(CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + iTitletext = titlePane->Text()->AllocL()); + } + //Hide softkeys and toolbar upon view de-activation. + iViewWidget->enableControlPane(EFalse); + if ( EGlxNavigationForwards == iUiUtility->ViewNavigationDirection() ) + { + iViewWidget->enableStatusPane(EFalse); + } + CleanupVisuals (); + } + +// --------------------------------------------------------------------------- +// HandleMskChangedL(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::HandleMskChangedL(TBool aMskEnabled) + { + TRACER("GLX_CLOUD ::CGlxCloudViewImp::HandleMskChangedL"); + GLX_LOG_INFO1("GLX_CLOUD ::GLX_CLOUD ::CGlxCloudViewImp::HandleMskChangedL MSk State %d ", + aMskEnabled); + //iViewWidget->setRect( ClientRect() ); + } + +// --------------------------------------------------------------------------- +// HandleLayoutChanged(). +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::HandleLayoutChanged() + { + iViewWidget->setRect( ClientRect() ); + SetScrollBarRect(); + } + +// --------------------------------------------------------------------------- +//ControlGroupId() +// --------------------------------------------------------------------------- +// +TInt CGlxCloudViewImp::ControlGroupId()const + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::ControlGroupId"); + return reinterpret_cast < TInt > (this); + } + +// --------------------------------------------------------------------------- +// CleanupVisuals +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::CleanupVisuals() + { + TRACER("GLX_CLOUD::CGlxCloudViewImp::CleanupVisuals()"); + if( iViewWidget ) + { + iViewWidget->show(false); + } + + if(iScrollWidget) + { + iScrollWidget->control()->removeEventHandler(*iCloudControl); + iScrollWidget = NULL; + } + if( iUiUtility ) + { + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*(iUiUtility->Env ())); + widgetFactory.destroyWidget(iViewWidget); + + } + iViewWidget = NULL; + // delete iCloudControl; + // iCloudControl = NULL; + iScrollbarDefaultBaseElement = NULL; + } + +// --------------------------------------------------------------------------- +// HandleEnterKeyEventL +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::HandleEnterKeyEventL(TInt aCommand) + { + HandleViewCommandL(aCommand); + } + +// --------------------------------------------------------------------------- +// HandleEnterKeyEventL +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::ConstructCloudControlL() + { + const char* KScrollBarWidget("scrollbarwidget"); + const char* KVerScrollbarWidgetName("alfscrollbarwidget_ver"); + const char* KScrollBarModel(/*"mulmodel"*/"scrollbarmodel"); + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*(iUiUtility->Env ())); + + iViewWidget = widgetFactory.createViewWidget("viewwidget", 0,0,iDisplay); + + iViewWidget->setRect( ClientRect() ); + iViewWidget->show(true); + + IAlfLayoutManager* layoutmanager = IAlfInterfaceBase::makeInterface(iViewWidget->control()); + iViewWidget->setRect(ClientRect()); + + // parent layout handle for scrollbar + iScrollPaneHandle = AknLayoutScalable_UiAccel::aa_scroll_pane(0).LayoutLine(); + + iAnchorlayout = &((CAlfAnchorLayout&)layoutmanager->getLayout()); + + iAnchorlayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + iAnchorlayout->SetFlag(EAlfVisualFlagAutomaticLocaleMirroringEnabled); + + iCloudControl = CGlxCloudViewControl::NewL (*iDisplay, *iUiUtility->Env (), *iMediaList, + *iEmptyListText, *this,*this,iAnchorlayout,*this); + + CAlfControlGroup * ctrlGroup = iUiUtility->Env ()->FindControlGroup(0); + if(ctrlGroup) + { + ctrlGroup->AppendL(iCloudControl); + } + iScrollWidget = widgetFactory.createWidget + ( KScrollBarWidget, KVerScrollbarWidgetName, *iViewWidget, 0 ); + + IAlfScrollBarModel* verScrollModel = widgetFactory.createModel (KScrollBarModel); + + iScrollWidget->setModel( verScrollModel ); + + IAlfElement* vertBaseElement =(iScrollWidget->control()->findElement ("BaseElement")); + + iScrollbarDefaultBaseElement=static_cast ( + vertBaseElement->makeInterface (IAlfScrollBarDefaultBaseElement::type() ) ); + + if(iScrollWidget) + { + if(iScrollbarDefaultBaseElement) + { + iCloudControl->InitializeScrollBar(iScrollWidget); + } + (iScrollWidget->control())->addEventHandler (iCloudControl); + } + + SetScrollBarRect(); + + //acquire the focus so as to get events to your control instead of widgets + iCloudControl->AcquireFocus(); + } +// --------------------------------------------------------------------------- +// SetScrollBarRect() +// --------------------------------------------------------------------------- +// +void CGlxCloudViewImp::SetScrollBarRect() + { + TRect rct = ClientRect(); + rct.iBr.iX = rct.iBr.iX - iScrollPaneHandle.iW; + // anchor points for cloud control + iAnchorlayout->SetAnchor( + EAlfAnchorTopLeft, + 0, + EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, + TAlfTimedPoint(0,0)); + + iAnchorlayout->SetAnchor( + EAlfAnchorBottomRight, + 0, + EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, + TAlfTimedPoint(ClientRect().iBr.iX - iScrollPaneHandle.iW,(ClientRect().iBr.iY - ClientRect().iTl.iY))); + + // anchor points for scrollbar widget + iAnchorlayout->SetAnchor( + EAlfAnchorTopLeft, + 1, + EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, + TAlfTimedPoint(ClientRect().iBr.iX - iScrollPaneHandle.iW,0)); + + iAnchorlayout->SetAnchor( + EAlfAnchorBottomRight, + 1, + EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, + TAlfTimedPoint(ClientRect().iBr.iX ,(ClientRect().iBr.iY - ClientRect().iTl.iY))); + + iAnchorlayout->UpdateChildrenLayout(0); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/src/glxcontainerinfobubble.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/src/glxcontainerinfobubble.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,483 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Cloud view + * +*/ + + + +#include "glxcontainerinfobubble.h" // class header + + +#include // For CGlxTextureManager +#include // For CGlxUiUtility +#include +#include // For Logs +#include // For Attribute constants +#include //for KGlxMediaCollectionPluginSpecificSubTitle +#include // for 'KGlxMediaIdThumbnail' +#include //for thumbnail context +#include //for attribute context +#include +#include +#include //for medialist +#include + +// INCLUDE FILES +#include "glxerrormanager.h" + +const TInt KThumbnailWidth = 50; +const TInt KThumbnailHeight = 50; + +// ======== MEMBER FUNCTIONS ======== +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxContainerInfoBubble::~CGlxContainerInfoBubble() + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::~CGlxContainerInfoBubble"); + + if ( iTexture ) + { + if( iUiUtility ) + { + iUiUtility->GlxTextureManager().RemoveTexture( *iTexture ); + } + } + + if ( iTimer) + { + iTimer->Cancel ();//cancels any outstanding requests + delete iTimer; + } + if ( iMediaTitle) + { + delete iMediaTitle; + } + if ( iMediaSubTitle) + { + delete iMediaSubTitle; + } + if ( iMediaList) + { + iMediaList->RemoveContext (iAttributeContext); + iMediaList->RemoveContext (iThumbnailContext); + iMediaList->RemoveMediaListObserver (this); + } + if ( iAttributeContext) + { + delete iAttributeContext; + } + if ( iThumbnailContext) + { + delete iThumbnailContext; + } + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxContainerInfoBubble *CGlxContainerInfoBubble::NewL(MGlxMediaList + *aMediaList, CAlfEnv &aEnv, CAlfControl &aOwnerControl) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::NewL"); + CGlxContainerInfoBubble *self = CGlxContainerInfoBubble::NewLC(aMediaList,aEnv, aOwnerControl); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxContainerInfoBubble *CGlxContainerInfoBubble::NewLC(MGlxMediaList + *aMediaList, CAlfEnv &aEnv, CAlfControl &aOwnerControl) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::NewLC"); + CGlxContainerInfoBubble *self = new(ELeave)CGlxContainerInfoBubble(aMediaList); + CleanupStack::PushL(self); + self->ConstructL(aEnv, aOwnerControl); + return self; + } + +// --------------------------------------------------------------------------- +// ShowNow() +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::ShowNowL() + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::ShowNow"); + // if we got texture, titles and timer is complete, show the bubble + if ( iTexture && iMediaTitle && iMediaSubTitle && iTimerComplete ) + { + //last three items will come from medialist + DisplayBubbleL (iPos,*iTexture, *iMediaTitle, *iMediaSubTitle); //last three items will come from medialist + } + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::ConstructL(CAlfEnv &aEnv, CAlfControl +&aOwnerControl) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::ConstructL"); + CGlxInfoBubble::BaseConstructL (aOwnerControl, aEnv); + iTimer = CGlxBubbleTimer::NewL (this); + //medialist code + iAttributeContext = CGlxDefaultAttributeContext::NewL (); + iAttributeContext->AddAttributeL (KMPXMediaGeneralTitle); + iAttributeContext->AddAttributeL (KGlxMediaCollectionPluginSpecificSubTitle); + + iThumbnailContext = CGlxDefaultThumbnailContext::NewL (); + iThumbnailContext->SetDefaultSpec (50, 50); + iThumbnailContext->SetRangeOffsets (5, 5); + iAttributeContext->SetRangeOffsets (10, 10); + + iMediaList->AddContextL (iAttributeContext, + KGlxFetchContextPriorityCloudViewInfoBubble ); + + iMediaList->AddMediaListObserverL ( this); + iMediaList->AddContextL (iThumbnailContext, + KGlxFetchContextPriorityCloudViewInfoBubble ); + + TInt listCount = iMediaList->Count (); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxContainerInfoBubble::ConstructL iMediaList->FocusIndex %d ", iMediaList->FocusIndex ()); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxContainerInfoBubble::ConstructL MedialistCount %d ",listCount); + + if ( listCount) + { + SetAttributesL (); + } + } + +// --------------------------------------------------------------------------- +// SetAttributes() +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::SetAttributesL() + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::SetAttributes()"); + + // Set the attribute context here for fetching the list data + TSize size(KThumbnailWidth, KThumbnailHeight); + + TMPXAttribute attrThumbnail(KGlxMediaIdThumbnail + ,GlxFullThumbnailAttributeId (ETrue, size.iWidth, size.iHeight)); + + TGlxMedia media = iMediaList->Item (iMediaList->FocusIndex()); + + TGlxIdSpaceId IdSpaceId = iMediaList->IdSpaceId(iMediaList->FocusIndex()); + + // Get the Title, ignore return value + GetMediaTitleL( media); + + // Get the subtitle, ignore return value + GetMediaSubTitleL( media); + + //Get the thumbnail, ignore return value + GetMediaThumbNailL( media, IdSpaceId, size, attrThumbnail ); + + ShowNowL(); + } +// --------------------------------------------------------------------------- +// SetAttributes() +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::SetAttributesL( + const RArray& aAttributes, + const TInt& aAttributescount ) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::SetAttributesL"); + // Set the attribute context here for fetching the list data + TSize size(KThumbnailWidth, KThumbnailHeight); + TMPXAttribute attrThumbnail(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId (ETrue, size.iWidth, size.iHeight)); + + const TGlxMedia media = iMediaList->Item (iMediaList->FocusIndex()); + + TGlxIdSpaceId IdSpaceId = iMediaList->IdSpaceId(iMediaList->FocusIndex()); + + TBool updateBubble = EFalse; + // Loop untill it checks for all the avialable attributes + for (TInt i = aAttributescount - 1; i >= 0 ; i--) + { + //Get the Title if the fetched attribute is MediaTitle + if ( aAttributes[i] == KMPXMediaGeneralTitle ) + { + // update bubble if we changed the title + updateBubble = GetMediaTitleL(media); + } + + //Get the SubTitle if the fetched attribute is MediaSubTitle + else if ( aAttributes[i] == KGlxMediaCollectionPluginSpecificSubTitle) + { + // update bubble if we changed the subtitle + updateBubble = GetMediaSubTitleL(media); + } + //Get the ThumbNail if the fetched attribute is MediaThumbNail + else if ( (attrThumbnail.ContentId() == aAttributes[i].ContentId()) + && (attrThumbnail.AttributeId() == aAttributes[i].AttributeId() ) ) + { + // update bubble if thumbnail changed + updateBubble = + GetMediaThumbNailL( media, IdSpaceId, size, attrThumbnail ); + } + } + if ( updateBubble ) + { + ShowNowL(); + } + } + + +// --------------------------------------------------------------------------- +// GetMediaTitle() +// --------------------------------------------------------------------------- +TBool CGlxContainerInfoBubble::GetMediaTitleL(const TGlxMedia& aMedia) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::GetMediaTitleL"); + // get current title + const TDesC& title = aMedia.Title(); + // if we dont have a title + if( !iMediaTitle ) + { + // we dont have a title so get the title + iMediaTitle = title.AllocL(); + return ETrue; + } + // if we have a title, but its different than new one (tag renamed) + else if( iMediaTitle->Compare( title ) ) + { + // allocate the new title + HBufC* tempTitle = title.AllocL(); + // got new title so release old + delete iMediaTitle; + // assign new in place of old + iMediaTitle = tempTitle; + // did change title + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// GetMediaSubTitle() +// --------------------------------------------------------------------------- +TBool CGlxContainerInfoBubble::GetMediaSubTitleL(const TGlxMedia& aMedia) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::GetMediaSubTitleL"); + // get current subtitle + const TDesC& title = aMedia.SubTitle(); + // if we dont have a subtitle + if( !iMediaSubTitle ) + { + // we dont have a subtitle so get the title + iMediaSubTitle = title.AllocL(); + return ETrue; + } + // if we have a subtitle, but its different than new one (count changed) + else if( iMediaSubTitle->Compare( title ) ) + { + // allocate the new subtitle + HBufC* tempTitle = title.AllocL(); + // got new so release old + delete iMediaSubTitle; + // assign new in place of old + iMediaSubTitle = tempTitle; + // did change subtitle + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// GetMediaThumbNailL() +// --------------------------------------------------------------------------- +// +TBool CGlxContainerInfoBubble::GetMediaThumbNailL(const TGlxMedia& aMedia, + TGlxIdSpaceId& aIdSpaceId,TSize& aSize, + TMPXAttribute& aAttrThumbnail) + { + TRACER("GLX_CLOUD ::CGlxContainerInfoBubble::SetAttributesL Thumbnail available"); + + //Get the thumbnail + if ( aMedia.ThumbnailAttribute( aAttrThumbnail ) ) + { + // take the address of the created texture + iTexture = &( CreateThumbnailTextureL( aMedia, aIdSpaceId, aSize ) ); + return ETrue; + } + //If there is an error in thumbnail attribute i.e the thumbnail is broken then create broken thumbnail + else if (GlxErrorManager::HasAttributeErrorL(aMedia.Properties(), KGlxMediaIdThumbnail) != KErrNone ) + { + // create 'default' icon + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + + TSize iconSize( KThumbnailWidth, KThumbnailHeight ); + + //Create the texture for broken thumbnail + iTexture = &(iUiUtility->GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_corrupted, resFile, iconSize ) ); + return ETrue; + } + return EFalse; + } + + +// --------------------------------------------------------------------------- +// TimerComplete() +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::TimerComplete() + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::TimerComplete"); + iTimerComplete =ETrue; + TRAP_IGNORE (ShowNowL ()); + } + +// --------------------------------------------------------------------------- +// SetFocus() +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::SetFocus(TPoint aPos) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::SetFocus"); + //iFocusindex = iMediaList->FocusIndex (); //get the medialist focus index + DisappearBubble (); + + if ( iTexture ) + { + iUiUtility->GlxTextureManager().RemoveTexture( *iTexture ); + ResetImage(); + iTexture = NULL; + } + iPos = aPos; + //fetch the attributes from medialsit + iTimerComplete =EFalse; + iTimer->Cancel ();//cancels any outstanding requests + if ( iMediaTitle) + { + delete iMediaTitle; + iMediaTitle =NULL; + } + if ( iMediaSubTitle) + { + delete iMediaSubTitle; + iMediaSubTitle =NULL; + } + TRAP_IGNORE(SetAttributesL()); + iTimer->SetDelay (1500000);//1.5 seconds delay + } + +// --------------------------------------------------------------------------- +// Default C++ Constructor +// --------------------------------------------------------------------------- +// +CGlxContainerInfoBubble::CGlxContainerInfoBubble(MGlxMediaList *aMediaList) : + CGlxInfoBubble(), iMediaList(aMediaList) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::CGlxContainerInfoBubble"); + } + +//medialist Observers + +// --------------------------------------------------------------------------- +// HandleItemAddedL(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleItemAddedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleMediaL(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleMediaL( + TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + } + +// --------------------------------------------------------------------------- +// HandleItemRemoved(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList*/* aList*/) + { + TRACER("GLX_CLOUD::CGlxContainerInfoBubble::HandleAttributesAvailableL"); + + TInt attCount = aAttributes.Count (); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxContainerInfoBubble::HandleAttributesAvailableL count: %d ",attCount); + GLX_LOG_INFO1("GLX_CLOUD ::CGlxContainerInfoBubble::HandleAttributesAvailableL Item Index: %d ", aItemIndex); + + if ( ( attCount ) && (iMediaList->FocusIndex() == aItemIndex ) ) + { + SetAttributesL( aAttributes, attCount ); + } + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, + TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleItemSelected(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + } + +// --------------------------------------------------------------------------- +// HandleMessageL(). +// --------------------------------------------------------------------------- +// +void CGlxContainerInfoBubble::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/cloudview/src/glxinfobubble.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/cloudview/src/glxinfobubble.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,876 @@ +/* +* Copyright (c) 2008-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: Info Bubble source file + * +*/ + + + +//Includes +#include "glxinfobubble.h" //header file + +//AlfT classes +#include // For CAlfTextStyleManager +#include // For CAlfTextStyle +#include // For CAlfAnchorLayout +#include // For CAlfDeckLayout +#include // For CAlfImageVisual +#include // For CAlfTextVisual +#include // For CAlfBorderBrush +#include // For CAlfBrushArray + + +#include //main pane rect +#include //gallery icons file +#include +#include // For Logs +#include +#include //math functions +#include +#include // For CGlxUiUtilities +#include // For CGlxTextureManager + + +const TInt KGlxBubbleMinimumWidth(22); +const TInt KGlxBubbleWidthOffset(65); +const TInt KGlxBubbleThumbnailOffset(55); +const TInt KGlxBubblePosOffset(17); +const TInt KGlxBubbleHeight(75); +const TInt KGlxBubblePosPreOffset( 5 ); +const TInt KGlxBubbleTextHeightPos(25); +const TInt KGlxBubbleMaxExcluder( 78 ); // Max Space to be excluded to form the biggest bubble. +const TInt KGlxBubbleRightStrip(5); + + +_LIT(KCloudViewMifFile, "glxicons.mif"); + + + +// --------------------------------------------------------------------------- +// Default C++ Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxInfoBubble::CGlxInfoBubble(): +CAlfControl() + { + TRACER("GLX_CLOUD::CGlxInfoBubble::CGlxInfoBubble"); + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxInfoBubble::BaseConstructL(CAlfControl &aOwnerControl, CAlfEnv &aEnv) + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::BaseConstructL"); + CAlfControl::ConstructL(aEnv); + iUiUtility = CGlxUiUtility::UtilityL(); + iUiUtility->AddSkinChangeObserverL(*this); + iInfoDeck = CAlfDeckLayout::AddNewL (aOwnerControl); //deck layout is the root layout + //adding deck layout to anchor layout + iInfoDeck->SetFlags (EAlfVisualFlagManualSize); + iInfoDeck->SetFlags (EAlfVisualFlagManualPosition); + iInfoBubbleContainer = CAlfAnchorLayout::AddNewL (*this, iInfoDeck); //item container anchor layout + iInfoBubble = CAlfAnchorLayout::AddNewL (*this, iInfoDeck); //anchor layout for bubble + + //InfoBubbleContainer associated items + iDeckCentreimage = CAlfImageVisual::AddNewL (*this, iInfoBubbleContainer); + iBubbleTextTitle = CAlfTextVisual::AddNewL (*this, iInfoBubbleContainer); + iBubbleTextTitle->SetFlag( EAlfVisualFlagManualSize ); + iBubbleTextTitle->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); + iBubbleTextSubTitle = CAlfTextVisual::AddNewL (*this, iInfoBubbleContainer); + + //InfoBubble components + iBubbleLeft= CAlfImageVisual::AddNewL (*this); //Visual for left arc of Bubble + iBubbleRight= CAlfImageVisual::AddNewL (*this); //Visual for rightarc of Bubble + iBubbleTailStrip= CAlfImageVisual::AddNewL (*this); //Visual for strip that connects to tail of Bubble + iBubbleTail= CAlfImageVisual::AddNewL (*this); //Visual for tail of Bubble + iTempTitleText = CAlfTextVisual::AddNewL (*this);//temporary visual for storing tilte + + //load common components for bubble + iMifFile=KDC_APP_BITMAP_DIR; + iMifFile.Append(KCloudViewMifFile); + iImageBubbleLeft = iUiUtility->GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_graf_mediatag_bubble_side_l, iMifFile); + iImageBubbleRight = iUiUtility->GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_graf_mediatag_side_r, iMifFile); + iImageBubbleExpand = iUiUtility->GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_graf_mediatag_bubble_center, iMifFile); + + iThumbnailBorderBrush = CAlfBorderBrush::NewL(aEnv,2, 2, 0, 0); + + //set the text properties + //fetching the s60 font styles + TInt iTypefaceSecondaryStyleId = CGlxInfoBubble::Env().TextStyleManager().CreatePlatformTextStyleL + (EAknLogicalFontSecondaryFont, EAlfTextStyleNormal); + TInt iTypefacePrimaryStyleId = CGlxInfoBubble::Env().TextStyleManager().CreatePlatformTextStyleL + (EAknLogicalFontPrimaryFont, EAlfTextStyleNormal); + CAlfTextStyle* stylePrimary = CGlxInfoBubble::Env().TextStyleManager().TextStyle + (iTypefacePrimaryStyleId); + CAlfTextStyle* styleSecondary = CGlxInfoBubble::Env().TextStyleManager().TextStyle + (iTypefaceSecondaryStyleId); + styleSecondary->SetTextSizeInPixels (14, 0); + stylePrimary->SetTextSizeInPixels (21, 0); + + iBubbleTextTitle->SetTextStyle (iTypefacePrimaryStyleId); + + TAlfTimedValue opacity; + opacity.SetTarget(1, 500); + iBubbleTextTitle->SetOpacity(opacity); + +// iBubbleTextTitle->iOpacity.Set (1); + iBubbleTextTitle->SetColor (KRgbBlack); + + iBubbleTextSubTitle->SetTextStyle (iTypefaceSecondaryStyleId); + + opacity.SetTarget(1, 500); + iBubbleTextSubTitle->SetOpacity(opacity); + +// iBubbleTextSubTitle->iOpacity.Set (1); + iBubbleTextSubTitle->SetColor (KRgbBlack); + + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxInfoBubble::~CGlxInfoBubble() + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::~CGlxInfoBubble"); + if ( iThumbnailBorderBrush) + { + delete iThumbnailBorderBrush; + } + ResetBubbleComponent(); + iBubbleExpandStrip.ResetAndDestroy (); + iBubbleExpandStrip.Close (); + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::ResetBubbleComponent -iBubbleExpandStrip.Count()(%d)", iBubbleExpandStrip.Count()); + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::ResetBubbleComponent -iInfoBubble->Count()(%d)", iInfoBubble->Count()); + iUiUtility->RemoveSkinChangeObserver(*this); + if ( iUiUtility) + { + iUiUtility->Close (); + } + } + +// --------------------------------------------------------------------------- +// DisappearBubble() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxInfoBubble::DisappearBubble() + { + TRACER("GLX_CLOUD::CGlxInfoBubble::DisappearBubble"); + TAlfTimedValue opacity; + opacity.SetTarget(0, 500); + iInfoDeck->SetOpacity(opacity); + } + +// --------------------------------------------------------------------------- +// CreateThumbnailTextureL() +// --------------------------------------------------------------------------- +// +EXPORT_C CAlfTexture& CGlxInfoBubble::CreateThumbnailTextureL(const TGlxMedia& aMedia, + const TGlxIdSpaceId& aIdSpaceId,const TSize& aSize ) + { + TRACER("GLX_CLOUD::CGlxInfoBubble::CreateThumbnailTextureL"); + return iUiUtility->GlxTextureManager().CreateThumbnailTextureL(aMedia, + aIdSpaceId, aSize, this ); + } + +void CGlxInfoBubble::ResetBubbleComponent() + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::ResetBubbleComponent"); + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::ResetBubbleComponent -iBubbleExpandStrip.Count()(%d)", iBubbleExpandStrip.Count()); + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::ResetBubbleComponent -iInfoBubble->Count()(%d)", iInfoBubble->Count()); + iBubbleExpandStrip.ResetAndDestroy (); + if ( iInfoBubble->Count ()!=0) + { + iInfoBubble->Remove (iBubbleLeft); + iInfoBubble->Remove (iBubbleTailStrip); + iInfoBubble->Remove (iBubbleRight); + iInfoBubble->Remove (iBubbleTail); + + iInfoBubble->UpdateChildrenLayout (); //update layout + } + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::ResetBubbleComponent -iBubbleExpandStrip.Count()(%d)", iBubbleExpandStrip.Count()); + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::ResetBubbleComponent -iInfoBubble->Count()(%d)", iInfoBubble->Count()); + + } + +void CGlxInfoBubble::LoadTailAssemblyL(TInt aTailEnumId, TInt aTailStripEnumId) + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::LoadTailAssemblyL"); + iImageBubbleTail = iUiUtility->GlxTextureManager().CreateIconTextureL (aTailEnumId, iMifFile); + iImageBubbleStrip =iUiUtility->GlxTextureManager().CreateIconTextureL (aTailStripEnumId, iMifFile); + iBubbleTailStrip->SetImage (iImageBubbleStrip); + iBubbleTail->SetImage (iImageBubbleTail); + + } + +void CGlxInfoBubble::CreateItemContainerLayoutL() + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::CreateItemContainerLayoutL"); + + iDeckCentreimage->EnableBrushesL (); + //Ownership of the brush is not transferred to the visual. + iDeckCentreimage->Brushes()->AppendL (iThumbnailBorderBrush, EAlfDoesNotHaveOwnership); + + TAlfTimedValue opacity; + opacity.SetValueNow(1); // immediate change + iDeckCentreimage->SetOpacity(opacity); + + SetThumbnailBorderColor(); + iThumbnailBorderBrush->SetLayer (EAlfBrushLayerForeground); + if( GlxGeneralUiUtilities::LayoutIsMirrored () ) + { + TInt bublepos = iBubbleSize.iWidth-60; + + iInfoBubbleContainer->SetAnchor (EAlfAnchorTopLeft, 0, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + bublepos, iPositionOffset+ 5)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorBottomRight, 0, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + bublepos+50, iPositionOffset + 55)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorTopLeft, 1, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 5, iPositionOffset + 5)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorBottomRight, 1, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 5+ iBubbleTextTitle->TextExtents().iWidth, + iPositionOffset+iBubbleTextTitle->TextExtents().iHeight+5)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorTopLeft, 2, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 5, iPositionOffset+iBubbleTextTitle->TextExtents().iHeight +10)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorBottomRight, 2, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 5+ iBubbleTextSubTitle->TextExtents().iWidth, + iPositionOffset+iBubbleTextTitle->TextExtents().iHeight +10+ + iBubbleTextSubTitle->TextExtents().iHeight)); + } + + else + { + //setting anchors + iInfoBubbleContainer->SetAnchor (EAlfAnchorTopLeft, 0, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 5, iPositionOffset+ 5)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorBottomRight, 0, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 55, iPositionOffset + 55)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorTopLeft, 1, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 60, iPositionOffset + 5)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorBottomRight, 1, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 60+ iBubbleTextTitle->TextExtents().iWidth, + iPositionOffset+iBubbleTextTitle->TextExtents().iHeight+5)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorTopLeft, 2, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 65, iPositionOffset+iBubbleTextTitle->TextExtents().iHeight +10)); + + iInfoBubbleContainer->SetAnchor (EAlfAnchorBottomRight, 2, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + 65+ iBubbleTextSubTitle->TextExtents().iWidth, + iPositionOffset+iBubbleTextTitle->TextExtents().iHeight +10+ + iBubbleTextSubTitle->TextExtents().iHeight)); + + } + } + +void CGlxInfoBubble::SetVariableVisualCountL() + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::SetVariableVisualCountL"); + TInt stripCount( 0 ); + TInt tempTitleLength = iTempTitleText->TextExtents().iWidth; + TInt tempPos = (iPos.iX>KGlxBubbleWidthOffset?KGlxBubbleThumbnailOffset:iPos.iX-25); + if ( tempTitleLength > (iBubbleTextSubTitle->TextExtents().iWidth)) + { + stripCount = tempTitleLength; + } + else + { + stripCount = iBubbleTextSubTitle->TextExtents().iWidth; + } + + if ( stripCount>iScreenWidth/2 - 15 ) + { + stripCount = ( ( iScreenWidth - iPos.iX > stripCount+KGlxBubbleThumbnailOffset ) ? stripCount : + stripCount-iPos.iX +tempPos ); + + } + // Bubbles stripCount should be a maximum of Screenwidth - KGlxBubbleMaxExcluder + stripCount = Min( stripCount, iScreenWidth - KGlxBubbleMaxExcluder ); + + //set the tag size + TAlfRealSize tagSize( stripCount, KGlxBubbleTextHeightPos ); + iBubbleTextTitle->SetSize( tagSize, 0 ); + + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::DrawBubbleExtemsibleComponent stripCount %d ",stripCount); + //set the deck layout size + iBubbleSize.iHeight = KGlxBubbleHeight; //height is constant + iBubbleSize.iWidth = KGlxBubbleWidthOffset + stripCount + KGlxBubbleRightStrip; //KGlxBubbleRightStrip (5) is for right strip + iInfoDeck->SetSize (iBubbleSize); + TReal variableWidth = (KGlxBubbleWidthOffset + stripCount) - KGlxBubbleMinimumWidth; + TReal slotsToFill =variableWidth/12.0; + Math::Round (iRoudedSlotValue, slotsToFill, 0); + } +// --------------------------------------------------------------------------- +// UpdateTextureL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxInfoBubble::UpdateTextureL(CAlfTexture& aTexture) + { + iDeckCentreimage->SetImage(TAlfImage(aTexture)); + // Fix for BUG EDKZ-77UKMZ( The Image is cropped to fit in the info bubble thumbnail space ) + iDeckCentreimage->SetScaleMode( CAlfImageVisual::EScaleCover ); + iDeckCentreimage->SetFlag( EAlfVisualFlagClipping ); + return; + } +// --------------------------------------------------------------------------- +// ResetImage() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxInfoBubble::ResetImage() + { + TAlfImage image; + iDeckCentreimage->SetImage(image); + } + +// --------------------------------------------------------------------------- +// DisplayBubble() +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxInfoBubble::DisplayBubbleL(TPoint aPos, CAlfTexture& aTexture, const TDesC + &aTitle, const TDesC &aSubTitle) + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::DisplayBubble"); + iPos = aPos; //bubble draw point + ResetBubbleComponent(); + + //assign the params + //setting the texts value and image brush boundary + iBubbleTextTitle->SetTextL(aTitle); + //to-check + //iBubbleTextTitle->SetChanged(); + iBubbleTextSubTitle->SetTextL(aSubTitle); + _LIT(KNullDesc,""); + iTempTitleText->SetTextL(KNullDesc()); + iTempTitleText->SetTextL(aTitle); + + //loading the texture for thumbanil image + UpdateTextureL(aTexture); + //to-check + //iInfoDeck->Changed(); + TRect rect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); + iScreenWidth = rect.Width(); + iScreenHeight = rect.Height(); + + //determing the info bubble posotion + TInt dx (iPos.iY); + TInt dy (iPos.iX); + TInt rx = iScreenHeight - dx; //remaining distance form x axis + TInt ry = iScreenWidth - dy;//remaining distance form y axis + + //sets the variable Visual count + SetVariableVisualCountL(); + + //Deciding bubble positions + if ((ry >= dy) && (rx >= dx)) + //down- towards right + { + iPositionOffset=15; + LoadTailAssemblyL(EMbmGlxiconsQgn_graf_mediatag_bubble_corner_tl,EMbmGlxiconsQgn_graf_mediatag_bubble_side_b); + DrawBubbleFirstQuadL(aPos); + + } + if ((ry < dy) && (rx > dx)) + //down- towards left + { + iPositionOffset=15; + LoadTailAssemblyL(EMbmGlxiconsQgn_graf_mediatag_bubble_corner_tr,EMbmGlxiconsQgn_graf_mediatag_bubble_side_b); + DrawBubbleSecondQuadL(aPos); + } + if ((ry >= dy) && (rx <= dx)) + //up- towards right + { + iPositionOffset=0; + LoadTailAssemblyL(EMbmGlxiconsQgn_graf_mediatag_bubble_corner_bl,EMbmGlxiconsQgn_graf_mediatag_bubble_side_t); + DrawBubbleThirdQuadL(aPos); + } + if ((ry < dy) && (rx < dx)) + //up- towards left + { + iPositionOffset=0; + LoadTailAssemblyL(EMbmGlxiconsQgn_graf_mediatag_bubble_corner_br,EMbmGlxiconsQgn_graf_mediatag_bubble_side_t); + DrawBubbleFourthQuadL(aPos); + } +//to-check +// iInfoBubble->SetChanged(); + + //all texture loaded + //now find the width of bubblle and create layout based on these visuals. + //optimize logic for tail allignment towards centre of the focussed item + TInt bubblewidth = iInfoDeck->Size().iX.Target(); + + // make sure that bubble does not get outside the screen + // first check the left hand side + if( GlxGeneralUiUtilities::LayoutIsMirrored () ) + { + if( iBubbleRectDrawPoint.iX < 0 ) + { + // set bubble to be as left as possible + iBubbleRectDrawPoint.iX = 13; + } + + // then check the right hand side + if( ( iBubbleRectDrawPoint.iX + bubblewidth ) > iScreenWidth ) + { + // set bubble to be as left as possible + iBubbleRectDrawPoint.iX = iScreenWidth - bubblewidth+5; + } + } + else + { + if( iBubbleRectDrawPoint.iX < 0 ) + { + // set bubble to be as left as possible + iBubbleRectDrawPoint.iX = 0; + } + // then check the right hand side + if( ( iBubbleRectDrawPoint.iX + bubblewidth ) > iScreenWidth ) + { + // set bubble to be as left as possible + iBubbleRectDrawPoint.iX = iScreenWidth - bubblewidth; + } + } + + TAlfTimedValue opacity; + opacity.SetTarget(0.9, 500); + iInfoBubble->SetOpacity(opacity); + + //iInfoBubble->iOpacity.Set(0.9, 1000); + iInfoDeck->SetPos(iBubbleRectDrawPoint); + CreateItemContainerLayoutL(); + + //Setting properies for Layouts + iInfoDeck->MoveToFront(); + +// TAlfTimedValue opacity; + opacity.SetTarget(0, 500); + iInfoDeck->SetOpacity(opacity); + +// iInfoDeck->iOpacity.Set(0); + + opacity.SetTarget(1.0, 800); + iInfoDeck->SetOpacity(opacity); + //iInfoDeck->iOpacity.Set(1.0,800); + + opacity.SetTarget(1.0, 500); + iInfoBubble->SetOpacity(opacity); + //iInfoBubble->iOpacity.Set(1.0); + + iInfoBubbleContainer->MoveToFront(); + //to-check + // iInfoDeck->SetChanged(); + + /// @todo would need to reposition the tail as well somehow!!! + + } + +void CGlxInfoBubble::DrawBubbleFirstQuadL(TPoint aReferencepos) + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::DrawBubble"); + + //determining the position of tail and setting postion for bubble rect + if ( (aReferencepos.iX - KGlxBubblePosOffset) >= 5) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX - KGlxBubblePosOffset; + iTailNormalPosition=1; + } + else + if ( (aReferencepos.iX - KGlxBubblePosPreOffset) >= 5) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX - KGlxBubblePosPreOffset; + iTailNormalPosition=0; + } + iBubbleRectDrawPoint.iY = aReferencepos.iY; + + //drawing bubble + iBubbleComponentCount=0; + iBubbleXaxisInc=0; + + DrawBubbleLeftComponentL (); + if ( iTailNormalPosition ==1) + { + //draw tail: + iInfoBubble->Append (iBubbleTail); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (17, 1)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (29, 16)); + iBubbleComponentCount+=1; + //tail end + DrawBubbleExtensibleComponentL (1); + DrawBubbleTailComponentL (); + DrawBubbleExtensibleComponentL (iRoudedSlotValue -1); + } + else + { + DrawBubbleTailComponentL (); + DrawBubbleExtensibleComponentL (iRoudedSlotValue); + //draw tail: + iInfoBubble->Append (iBubbleTail); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (5, 1)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (17, 16)); + iBubbleComponentCount+=1; + //tail end + } + DrawBubbleRightComponentL (); + + } + +void CGlxInfoBubble::DrawBubbleSecondQuadL(TPoint aReferencepos) + { + + //determining the position of tail and setting postion for bubble rect + if ( (aReferencepos.iX + KGlxBubblePosOffset) <= iScreenWidth) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX -(iBubbleSize.iWidth - KGlxBubblePosOffset); + iTailNormalPosition=1; + } + else + if ( (aReferencepos.iX + KGlxBubblePosPreOffset) <= iScreenWidth) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX - (iBubbleSize.iWidth -KGlxBubblePosPreOffset); + iTailNormalPosition=0; + } + iBubbleRectDrawPoint.iY = aReferencepos.iY; + + //drawing bubble + iBubbleComponentCount=0; + iBubbleXaxisInc=0; + DrawBubbleLeftComponentL (); + TInt xCord=KGlxBubbleMinimumWidth + (iRoudedSlotValue*12); + xCord -=29; + if ( iTailNormalPosition ==1) + { + //draw tail: + iInfoBubble->Append (iBubbleTail); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (xCord, 1)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (xCord+12, 16)); + iBubbleComponentCount+=1; + //tail end + DrawBubbleExtensibleComponentL (iRoudedSlotValue-1); + DrawBubbleTailComponentL (); + DrawBubbleExtensibleComponentL (1); + } + else + { + DrawBubbleExtensibleComponentL (iRoudedSlotValue); + DrawBubbleTailComponentL (); + //draw tail: + iInfoBubble->Append (iBubbleTail); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (xCord+12, 1)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (xCord+24, 16)); + iBubbleComponentCount+=1; + //tail end + } + DrawBubbleRightComponentL (); + + } + +void CGlxInfoBubble::DrawBubbleThirdQuadL(TPoint aReferencepos) + { + + //determining the position of tail and setting postion for bubble rect + if ( (aReferencepos.iX - KGlxBubblePosOffset) >= 5) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX - KGlxBubblePosOffset; + iTailNormalPosition=1; + } + else + if ( (aReferencepos.iX - KGlxBubblePosPreOffset) >= 5) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX - KGlxBubblePosPreOffset; + iTailNormalPosition=0; + } + iBubbleRectDrawPoint.iY = aReferencepos.iY -KGlxBubbleHeight; + //drawing bubble + iBubbleComponentCount=0; + iBubbleXaxisInc=0; + DrawBubbleLeftComponentL (); + if ( iTailNormalPosition ==1) + { + //draw tail: + iInfoBubble->Append (iBubbleTail); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (17, 60)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (29, 75)); + iBubbleComponentCount+=1; + //tail end + DrawBubbleExtensibleComponentL (1); + DrawBubbleTailComponentL (); + DrawBubbleExtensibleComponentL (iRoudedSlotValue -1); + + } + else + { + DrawBubbleTailComponentL (); + DrawBubbleExtensibleComponentL (iRoudedSlotValue); + //draw tail: + iInfoBubble->Append (iBubbleTail); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (5, 60)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (17, 75)); + iBubbleComponentCount+=1; + //tail end + } + DrawBubbleRightComponentL (); + } + +void CGlxInfoBubble::DrawBubbleFourthQuadL(TPoint aReferencepos) + { + //determining the position of tail and setting postion for bubble rect + + if ( (aReferencepos.iX + KGlxBubblePosOffset) <= iScreenWidth) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX -(iBubbleSize.iWidth - KGlxBubblePosOffset); + iTailNormalPosition=1; + } + else + if ( (aReferencepos.iX + KGlxBubblePosPreOffset) <= iScreenWidth) + { + iBubbleRectDrawPoint.iX= aReferencepos.iX - (iBubbleSize.iWidth -KGlxBubblePosPreOffset); + iTailNormalPosition=0; + } + iBubbleRectDrawPoint.iY = aReferencepos.iY -KGlxBubbleHeight; + + //drawing bubble + iBubbleComponentCount=0; + iBubbleXaxisInc=0; + DrawBubbleLeftComponentL (); + TInt xCord=KGlxBubbleMinimumWidth + (iRoudedSlotValue*12); + xCord -=29; + if ( iTailNormalPosition ==1) + { + //draw tail: + iInfoBubble->Append (iBubbleTail); + + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + xCord, 60)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + xCord+12, 75)); + iBubbleComponentCount+=1; + //tail end + DrawBubbleExtensibleComponentL (iRoudedSlotValue-1); + DrawBubbleTailComponentL (); + DrawBubbleExtensibleComponentL (1); + } + else + { + DrawBubbleExtensibleComponentL (iRoudedSlotValue); + DrawBubbleTailComponentL (); + //draw tail: + iInfoBubble->Append (iBubbleTail); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (xCord+12, 60)); + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (xCord+24, 75) ); + iBubbleComponentCount+=1; + //tail end + } + DrawBubbleRightComponentL (); + + } + +void CGlxInfoBubble::DrawBubbleLeftComponentL() + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::DrawBubbleLeftComponent"); + iInfoBubble->Append (iBubbleLeft); + iBubbleLeft->SetImage (iImageBubbleLeft); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + iBubbleXaxisInc, iPositionOffset)); + iBubbleXaxisInc += 5; + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + iBubbleXaxisInc, iPositionOffset+60)); + iBubbleComponentCount+=1; + + } +void CGlxInfoBubble::DrawBubbleRightComponentL() + { + TRACER("GLX_CLOUD::CGlxInfoBubble::DrawBubbleRightComponent"); + + iInfoBubble->Append (iBubbleRight); + iBubbleRight->SetImage (iImageBubbleRight); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + iBubbleXaxisInc, iPositionOffset)); + iBubbleXaxisInc+=5; + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + iBubbleXaxisInc, iPositionOffset+60)); + iBubbleComponentCount+=1; + + } +void CGlxInfoBubble::DrawBubbleExtensibleComponentL(TInt aSlots) + { + + TRACER("GLX_CLOUD::CGlxInfoBubble::DrawBubbleExtemsibleComponent"); + GLX_LOG_INFO1("GLX_CLOUD::CGlxInfoBubble::DrawBubbleExtemsibleComponent slots %d ", + aSlots); + for (TInt j=0; jRemove (tempimagevisual); + tempimagevisual->SetImage (iImageBubbleExpand); //image visual that will be used multiple times + iInfoBubble->Append (tempimagevisual); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (iBubbleXaxisInc, iPositionOffset)); + iBubbleXaxisInc+=12; + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, + TAlfTimedPoint (iBubbleXaxisInc, iPositionOffset+60)); + iBubbleComponentCount+=1; + } + } + +void CGlxInfoBubble::DrawBubbleTailComponentL() + { + TRACER("GLX_CLOUD::CGlxInfoBubble::DrawBubbleTailComponent"); + + iInfoBubble->Append (iBubbleTailStrip); + iInfoBubble->SetAnchor (EAlfAnchorTopLeft, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + iBubbleXaxisInc, iPositionOffset)); + iBubbleXaxisInc+=12; + iInfoBubble->SetAnchor (EAlfAnchorBottomRight, iBubbleComponentCount, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, TAlfTimedPoint ( + iBubbleXaxisInc, iPositionOffset+60)); + iBubbleComponentCount+=1; + + } + +// --------------------------------------------------------------------------- +// SetThumbnailBorderColor() +// --------------------------------------------------------------------------- +// +void CGlxInfoBubble::SetThumbnailBorderColor() + { + TRgb brushColor; + //Get the cached color + AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), brushColor, KAknsIIDQsnHighlightColors,EAknsCIQsnHighlightColorsCG3); + iThumbnailBorderBrush->SetColor (brushColor); + } + +// --------------------------------------------------------------------------- +// HandleSkinChanged() +// --------------------------------------------------------------------------- +// +void CGlxInfoBubble::HandleSkinChanged() + { + SetThumbnailBorderColor(); + } + +// --------------------------------------------------------------------------- +// TextureContentChangedL +// --------------------------------------------------------------------------- +// +void CGlxInfoBubble::TextureContentChangedL( TBool /*aHasContent*/ , CAlfTexture* /*aNewTexture*/) + { + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/bwins/glxfullscreenviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/bwins/glxfullscreenviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,20 @@ +EXPORTS + ??1TGlxMulFSMPTagsBindingSetFactory@@UAE@XZ @ 1 NONAME ; TGlxMulFSMPTagsBindingSetFactory::~TGlxMulFSMPTagsBindingSetFactory(void) + ??0TGlxMulFSMPDateBindingSetFactory@@QAE@XZ @ 2 NONAME ; TGlxMulFSMPDateBindingSetFactory::TGlxMulFSMPDateBindingSetFactory(void) + ??1TGlxMulFSMPLocationBindingSetFactory@@UAE@XZ @ 3 NONAME ; TGlxMulFSMPLocationBindingSetFactory::~TGlxMulFSMPLocationBindingSetFactory(void) + ??1TGlxMulFSMPDateBindingSetFactory@@UAE@XZ @ 4 NONAME ; TGlxMulFSMPDateBindingSetFactory::~TGlxMulFSMPDateBindingSetFactory(void) + ??0TGlxMulFullScreenBindingSetFactory@@QAE@XZ @ 5 NONAME ; TGlxMulFullScreenBindingSetFactory::TGlxMulFullScreenBindingSetFactory(void) + ??0TGlxMulFSMPMemoryBindingSetFactory@@QAE@XZ @ 6 NONAME ; TGlxMulFSMPMemoryBindingSetFactory::TGlxMulFSMPMemoryBindingSetFactory(void) + ??0TGlxMulFSMPAlbumBindingSetFactory@@QAE@XZ @ 7 NONAME ; TGlxMulFSMPAlbumBindingSetFactory::TGlxMulFSMPAlbumBindingSetFactory(void) + ??1TGlxMulFullScreenBindingSetFactory@@UAE@XZ @ 8 NONAME ; TGlxMulFullScreenBindingSetFactory::~TGlxMulFullScreenBindingSetFactory(void) + ??1TGlxMulFSMPAlbumBindingSetFactory@@UAE@XZ @ 9 NONAME ; TGlxMulFSMPAlbumBindingSetFactory::~TGlxMulFSMPAlbumBindingSetFactory(void) + ??0TGlxMulFSMPTimeBindingSetFactory@@QAE@XZ @ 10 NONAME ; TGlxMulFSMPTimeBindingSetFactory::TGlxMulFSMPTimeBindingSetFactory(void) + ??1TGlxMulFSMPTimeBindingSetFactory@@UAE@XZ @ 11 NONAME ; TGlxMulFSMPTimeBindingSetFactory::~TGlxMulFSMPTimeBindingSetFactory(void) + ??1TGlxMulFSMPMemoryBindingSetFactory@@UAE@XZ @ 12 NONAME ; TGlxMulFSMPMemoryBindingSetFactory::~TGlxMulFSMPMemoryBindingSetFactory(void) + ?NewL@CGlxFullScreenView@@SAPAV1@PAVMGlxMediaListFactory@@ABVTFullScreenViewResourceIds@@HABVTDesC16@@@Z @ 13 NONAME ; class CGlxFullScreenView * CGlxFullScreenView::NewL(class MGlxMediaListFactory *, class TFullScreenViewResourceIds const &, int, class TDesC16 const &) + ??0TGlxMulFSMPTitleBindingSetFactory@@QAE@XZ @ 14 NONAME ; TGlxMulFSMPTitleBindingSetFactory::TGlxMulFSMPTitleBindingSetFactory(void) + ??0TGlxMulFSMPLocationBindingSetFactory@@QAE@XZ @ 15 NONAME ; TGlxMulFSMPLocationBindingSetFactory::TGlxMulFSMPLocationBindingSetFactory(void) + ?NewLC@CGlxFullScreenView@@SAPAV1@PAVMGlxMediaListFactory@@ABVTFullScreenViewResourceIds@@HABVTDesC16@@@Z @ 16 NONAME ; class CGlxFullScreenView * CGlxFullScreenView::NewLC(class MGlxMediaListFactory *, class TFullScreenViewResourceIds const &, int, class TDesC16 const &) + ??1TGlxMulFSMPTitleBindingSetFactory@@UAE@XZ @ 17 NONAME ; TGlxMulFSMPTitleBindingSetFactory::~TGlxMulFSMPTitleBindingSetFactory(void) + ??0TGlxMulFSMPTagsBindingSetFactory@@QAE@XZ @ 18 NONAME ; TGlxMulFSMPTagsBindingSetFactory::TGlxMulFSMPTagsBindingSetFactory(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/eabi/glxfullscreenviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/eabi/glxfullscreenviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,44 @@ +EXPORTS + _ZN18CGlxFullScreenView4NewLEP20MGlxMediaListFactoryRK26TFullScreenViewResourceIdsiRK7TDesC16 @ 1 NONAME + _ZN18CGlxFullScreenView5NewLCEP20MGlxMediaListFactoryRK26TFullScreenViewResourceIdsiRK7TDesC16 @ 2 NONAME + _ZN32TGlxMulFSMPDateBindingSetFactoryC1Ev @ 3 NONAME + _ZN32TGlxMulFSMPDateBindingSetFactoryC2Ev @ 4 NONAME + _ZN32TGlxMulFSMPDateBindingSetFactoryD0Ev @ 5 NONAME + _ZN32TGlxMulFSMPDateBindingSetFactoryD1Ev @ 6 NONAME + _ZN32TGlxMulFSMPDateBindingSetFactoryD2Ev @ 7 NONAME + _ZN32TGlxMulFSMPTagsBindingSetFactoryC1Ev @ 8 NONAME + _ZN32TGlxMulFSMPTagsBindingSetFactoryC2Ev @ 9 NONAME + _ZN32TGlxMulFSMPTagsBindingSetFactoryD0Ev @ 10 NONAME + _ZN32TGlxMulFSMPTagsBindingSetFactoryD1Ev @ 11 NONAME + _ZN32TGlxMulFSMPTagsBindingSetFactoryD2Ev @ 12 NONAME + _ZN32TGlxMulFSMPTimeBindingSetFactoryC1Ev @ 13 NONAME + _ZN32TGlxMulFSMPTimeBindingSetFactoryC2Ev @ 14 NONAME + _ZN32TGlxMulFSMPTimeBindingSetFactoryD0Ev @ 15 NONAME + _ZN32TGlxMulFSMPTimeBindingSetFactoryD1Ev @ 16 NONAME + _ZN32TGlxMulFSMPTimeBindingSetFactoryD2Ev @ 17 NONAME + _ZN33TGlxMulFSMPAlbumBindingSetFactoryC1Ev @ 18 NONAME + _ZN33TGlxMulFSMPAlbumBindingSetFactoryC2Ev @ 19 NONAME + _ZN33TGlxMulFSMPAlbumBindingSetFactoryD0Ev @ 20 NONAME + _ZN33TGlxMulFSMPAlbumBindingSetFactoryD1Ev @ 21 NONAME + _ZN33TGlxMulFSMPAlbumBindingSetFactoryD2Ev @ 22 NONAME + _ZN33TGlxMulFSMPTitleBindingSetFactoryC1Ev @ 23 NONAME + _ZN33TGlxMulFSMPTitleBindingSetFactoryC2Ev @ 24 NONAME + _ZN33TGlxMulFSMPTitleBindingSetFactoryD0Ev @ 25 NONAME + _ZN33TGlxMulFSMPTitleBindingSetFactoryD1Ev @ 26 NONAME + _ZN33TGlxMulFSMPTitleBindingSetFactoryD2Ev @ 27 NONAME + _ZN34TGlxMulFSMPMemoryBindingSetFactoryC1Ev @ 28 NONAME + _ZN34TGlxMulFSMPMemoryBindingSetFactoryC2Ev @ 29 NONAME + _ZN34TGlxMulFSMPMemoryBindingSetFactoryD0Ev @ 30 NONAME + _ZN34TGlxMulFSMPMemoryBindingSetFactoryD1Ev @ 31 NONAME + _ZN34TGlxMulFSMPMemoryBindingSetFactoryD2Ev @ 32 NONAME + _ZN34TGlxMulFullScreenBindingSetFactoryC1Ev @ 33 NONAME + _ZN34TGlxMulFullScreenBindingSetFactoryC2Ev @ 34 NONAME + _ZN34TGlxMulFullScreenBindingSetFactoryD0Ev @ 35 NONAME + _ZN34TGlxMulFullScreenBindingSetFactoryD1Ev @ 36 NONAME + _ZN34TGlxMulFullScreenBindingSetFactoryD2Ev @ 37 NONAME + _ZN36TGlxMulFSMPLocationBindingSetFactoryC1Ev @ 38 NONAME + _ZN36TGlxMulFSMPLocationBindingSetFactoryC2Ev @ 39 NONAME + _ZN36TGlxMulFSMPLocationBindingSetFactoryD0Ev @ 40 NONAME + _ZN36TGlxMulFSMPLocationBindingSetFactoryD1Ev @ 41 NONAME + _ZN36TGlxMulFSMPLocationBindingSetFactoryD2Ev @ 42 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/group/glxfullscreenview.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/group/glxfullscreenview.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxfullscreenview.dll +TARGETTYPE dll +UID 0x1000008d 0x20000A07 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src + +SOURCE glxfullscreenview.cpp +SOURCE glxfullscreenviewimp.cpp +SOURCE glxfullscreenbindingsetfactory.cpp +//SOURCE glxsinglelinemetapanecontrol.cpp +//SOURCE glxslmpfavmlobserver.cpp + + +USERINCLUDE ../inc +// System includes from the source tree + +SYSTEMINCLUDE ../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerdrm/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../drmutility/inc +SYSTEMINCLUDE ../../../layouts/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../texturemanager/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../viewbase/inc +SYSTEMINCLUDE ../../../dataprovider/inc +SYSTEMINCLUDE ../../zoomview/inc +SYSTEMINCLUDE ../../../tvout/inc + +APP_LAYER_SYSTEMINCLUDE + + + +LIBRARY avkon.lib // CAknView +LIBRARY cone.lib // MCoeView +LIBRARY eikcoctl.lib // CEikMenuBar +LIBRARY eikcore.lib // CEikMenuBar +LIBRARY euser.lib // RAllocator +LIBRARY alfclient.lib // ALF UI framework +LIBRARY glxmedialists.lib // CGlxMediaList +LIBRARY glxuiutilities.lib // CGlxUiUtility +LIBRARY glxviewbase.lib // CGlxViewBase +LIBRARY glxdataprovider.lib // MulModelProvider +LIBRARY glxzoomview.lib // CGlxZoomControl +LIBRARY alfwidgetmodel.lib // AlfWidgetModel +LIBRARY mulmodelutility.lib // For Usting converter +LIBRARY mpxcommon.lib // For MPX Attributes +LIBRARY osncore.lib // CAlfString +LIBRARY flogger.lib // For Logging Tracer +LIBRARY glxcommoncommandhandlers.lib //For CGlxCommandHandlerAddToContainer +LIBRARY glxcommandhandlerbase.lib // Base command handlers +LIBRARY lbs.lib +LIBRARY eikcdlg.lib +LIBRARY eikctl.lib +LIBRARY commonengine.lib +LIBRARY glxtexturemanager.lib // for texturemanager +LIBRARY platformenv.lib // Path Info for SLMP +LIBRARY efsrv.lib // RFs for SLMP +LIBRARY glxdrmutility.lib // for DRM utility +LIBRARY gesturehelper.lib +LIBRARY glxcommon.lib // for filter facotory +LIBRARY glxcommonui.lib +LIBRARY glxtvout.lib + +// EOF + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenbindingsetfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenbindingsetfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of fULL-SCREEN view +* +*/ + + + + +#ifndef _GLXFULLSCREENBINDINGSETFACTORY_H_ +#define _GLXFULLSCREENBINDINGSETFACTORY_H_ + +#include +#include +#include "glxmulbindingsetfactory.h" + +NONSHARABLE_CLASS( TGlxMulFullScreenBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFullScreenBindingSetFactory::TGlxMulFullScreenBindingSetFactory(); + IMPORT_C TGlxMulFullScreenBindingSetFactory::~TGlxMulFullScreenBindingSetFactory(); +private: + void AddBindingsL() const; + }; + + NONSHARABLE_CLASS( TGlxMulFSMPTitleBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFSMPTitleBindingSetFactory(); + IMPORT_C ~TGlxMulFSMPTitleBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulFSMPDateBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFSMPDateBindingSetFactory(); + IMPORT_C ~TGlxMulFSMPDateBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulFSMPTimeBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFSMPTimeBindingSetFactory(); + IMPORT_C ~TGlxMulFSMPTimeBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; +NONSHARABLE_CLASS( TGlxMulFSMPMemoryBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFSMPMemoryBindingSetFactory(); + IMPORT_C ~TGlxMulFSMPMemoryBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + + +NONSHARABLE_CLASS( TGlxMulFSMPAlbumBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFSMPAlbumBindingSetFactory(); + IMPORT_C ~TGlxMulFSMPAlbumBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulFSMPLocationBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFSMPLocationBindingSetFactory(); + IMPORT_C ~TGlxMulFSMPLocationBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulFSMPTagsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFSMPTagsBindingSetFactory(); + IMPORT_C ~TGlxMulFSMPTagsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +#endif // _GLXFULLSCREENBINDINGSETFACTORY_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2008-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: Tile view implementation +* +*/ + + + + + +#ifndef C_GLXFULLSCREENVIEW_H +#define C_GLXFULLSCREENVIEW_H + + +// INCLUDES +#include + + + class TFullScreenViewResourceIds + { + public: + TInt iViewId; // a AVKON_VIEW + TInt iMenuId; // a MENU_PANE + TInt iCbaId; // a CBA + }; + +// CLASS DECLARATION + +/** + * Tile view + * + * @lib glxtileview.lib + */ +NONSHARABLE_CLASS(CGlxFullScreenView) : public CGlxMediaListViewBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + IMPORT_C static CGlxFullScreenView* NewL(MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle = KNullDesC()); + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + IMPORT_C static CGlxFullScreenView* NewLC(MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle = KNullDesC()); + + /** + * Destructor. + */ + virtual ~CGlxFullScreenView(); + }; +#endif // C_GLXFULLSCREENVIEW_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenview.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenview.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008-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: Definition of CGlxZoomControl + * +*/ + +#ifndef GLXFULLSCREENVIEW_HRH_ +#define GLXFULLSCREENVIEW_HRH_ + +enum TZoomStartMode + { + EZoomStartKey =3, + EZoomStartPinch =4, + EZoomStartSlider =5, + EZoomStartDoubleTap =6 + }; + +#endif /* GLXFULLSCREENVIEW_HRH_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenviewimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/inc/glxfullscreenviewimp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,316 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Fullscreen view +* +*/ + +#ifndef C_CGLXFULLSCREENIMP_C +#define C_CGLXFULLSCREENIMP_C + +#include +#include +#include +#include + +#include "glxfullscreenview.h" +#include "glxfullscreenbindingsetfactory.h" +#include "glxfullscreenview.hrh" + +//Gesture Helper namespace +namespace GestureHelper + { + class CGestureHelper; + } + +// FORWARD DECLARATIONS +class CAlfEnv; +class CGlxMediaListMulModelProvider; +class TGlxMulFullScreenBindingSetFactory; +class CEikButtonGroupContainer; +class CGlxActiveMediaListRegistry; +class CGlxZoomControl; +class CGlxSinleLineMetaPane; +class CGlxCommandHandlerAiwShowMapHardKey; +class CGlxDRMUtility; +class CGlxHdmiController; +class CGestureHelper; +//class CHgContextUtility; + +namespace Alf + { + class IMulCoverFlowWidget; + class IMulModel; + class IMulSliderWidget; + class IMulSliderModel; + } +/* + Defines the state of the Ui in fullscreen + */ +namespace NGlxNFullScreenUIState + { + enum TUiState + { + EUiOn,EUiOff + }; + } +/* + Defines the swipe direction + */ +enum TSwipe + { + EForward,EBackward + }; + +NONSHARABLE_CLASS (CGlxFullScreenViewImp): public CGlxFullScreenView, + public IAlfWidgetEventHandler, + public MGlxUiCommandHandler + { +public: + /** + * Two-phased constructor.` + * + * @return Pointer to newly created object. + */ + static CGlxFullScreenViewImp* NewL(MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle); + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + static CGlxFullScreenViewImp* NewLC(MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds,TInt aViewUID, const TDesC& aTitle); + + /** + * Destructor. + */ + virtual ~CGlxFullScreenViewImp(); + +public:// CGlxViewBase + virtual TBool HandleViewCommandL(TInt aCommand); + + void HandleCommandL(TInt aCommandId, CAlfControl* aControl) ; + + void HandleResourceChangeL (TInt aType); + +public:// CAknView + void HandleForegroundEventL(TBool aForeground); + + TUid Id() const; + + void DoMLViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage); + void DoMLViewDeactivate(); + + //Shows the exipry note/dialog for expired DRM files + void ShowDrmExpiaryNoteL(); + + // Callback for periodic timer, static, + static TInt PeriodicCallback( TAny* aPtr ); + //nonstatic func called from periodic timer + void CallPeriodicCallback(); +public: + //From IAlfWidgetEventHandler + bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + + void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ); + + AlfWidgetEventHandlerInitData* eventHandlerData(); + + void setActiveStates( unsigned int aStates ); + + IAlfInterfaceBase* makeInterface( const IfId& aType ); + + AlfEventHandlerType eventHandlerType() ; + + AlfEventHandlerExecutionPhase eventExecutionPhase() ; + +private: + /* + * Constructor + */ + CGlxFullScreenViewImp(const TFullScreenViewResourceIds& aResourceIds,TInt aViewUID); + + /* + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(MGlxMediaListFactory* aMediaListFactory,const TDesC& aTitle ); + + /* + * Creates a coverflow widget + */ + void CreateCoverflowWidgetL(); + + /* + * Destroys Widgets, Coverflow and also calls DestroySliderWidget() + */ + void DestroyWidgets(); + + /* + * Destroys Slider widget + */ + void DestroySliderWidget(); + + /* + * Activate zoomcontrol + * @param:aTap: specifies whether zoom control is launched by tapping or by pressing volume keys + */ + void ActivateZoomControlL(TZoomStartMode aStartMode, TPoint* aZoomFocus = NULL); + + /* + * DeActivate zoomcontrol + */ + void DeactivateZoomControlL(); + + /* + * DeactivateFullScreen + */ + void DeactivateFullScreen(); + + /* + * ActivateFullScreen + */ + void ActivateFullScreenL(); + + /* + * Trun the UI on + * @param aStartTimer:Incase of starting the zoom :we shouldn't be starting the timer. + * else we need to start the Ui timer to hide the screen furniture + * so for the rest of the cases we need to have aStartTimer = ETrue + */ + void ShowUiL(TBool aStartTimer); + + /* + * Hide the UI off + * @param asliderstatus:When we start zooming using the slider widget,for continous zooming from the + * fullscreen view to zoom control, we need to have the slider visible so in this case we shouldnt + * be hiding the slider so pass EFalse,else case asliderstatus = ETrue + */ + void HideUi(TBool aSliderStatus); + + /* + * Sets the UI state + */ + void SetUiSate (NGlxNFullScreenUIState::TUiState aState); + + /* + * returns the Ui state + */ + NGlxNFullScreenUIState::TUiState GetUiSate(); + + /* + * returns the Ui state + */ + void CreateScreenFurnitureL(); + + /* + * Call back function for the CPeriodic + */ + static TInt TimeOut(TAny* aSelf); + + /* + * Calculates and returns the Initial Zoom factor + */ + TInt GetIntialZoomLevel(); + + /* + * Calls GetIntialZoomLevel() to get the Zoom Level and Sets the Value to the + * Slider Level + */ + void SetSliderLevel(); + + /* + * Creates and Initializes the slider model/widget + */ + void CreateSliderWidgetL(); + + /** + * This function doesnt add any value, added to remove codescanner warnings + */ + AlfEventStatus OfferEventL(const TAlfEvent& aEvent); + /** + * returns the swipe direction of coverflow + */ + TSwipe GetSwipeDirection(); + /** + * returns the index of item for which texture can be removed for cleanup + * The index will be out the iterator offsets w.r.t focssed index. + */ + TInt GetIndexToBeRemoved(); + /** + * Remove the fullscreen texture. + */ + void RemoveTexture(); + +private: + /** Softkey resource id's */ + TFullScreenViewResourceIds iResourceIds; + // /** Avkon unique ViewId */ + TInt iViewUid; + + /** Alf environment (not owned) */ + CAlfEnv* iEnv; + + /// Active media list registry stores the pointer to the active media list + /// Allows UPnP to know when list has changed + CGlxActiveMediaListRegistry* iActiveMediaListRegistry; + + /** Data Provider */ + CGlxMediaListMulModelProvider* iMediaListMulModelProvider; + TGlxMulFullScreenBindingSetFactory iFullScreenBindingSet; + + //creating instance of viewWidget + IAlfViewWidget* iViewWidget; + + /** The 2D Coverflow Widget ( owned )*/ + IMulCoverFlowWidget* iCoverFlowWidget; + IMulSliderWidget* iSliderWidget; + IMulSliderModel* iSliderModel; + + //creating zoomcontrol + CGlxZoomControl* iZoomControl; + + // Holds the state of the Ui in Fullscreen + NGlxNFullScreenUIState::TUiState iUiState; + + // used to turn the Ui off,if the screen is inactive for 10 sec + CPeriodic* iTimer; + CEikButtonGroupContainer* iZoomButtonGroup; + CGlxCommandHandlerAiwShowMapHardKey* iShowOnMapHardKeyhandler; + + CGlxScreenFurniture* iScreenFurniture; + //CGlxSinleLineMetaPane* iSingleLineMetaPane; +// CHgContextUtility* iContextUtility; + CGlxHdmiController* iHdmiController; + + CGlxDRMUtility* iDrmUtility; + CPeriodic* iPeriodic; + + GestureHelper::CGestureHelper* iGestureHelper; + TBool iMultiTouchGestureOngoing ; + + // stores the initial zoom percentage + TInt iInitialZoomRatio ; + //Previous focused index + TInt iOldFocusIndex; + + }; + +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/inc/glxmediakeyutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/inc/glxmediakeyutility.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: Command object factory +* +*/ + + + + +#ifndef T_GLXMEDIAKEYUTILITY_H +#define T_GLXMEDIAKEYUTILITY_H + +#include // MViaPlayerMediaKeyListener + + +/** + * TGlxMediaKeyUtility + * + * This is a utility class that simplifies the use of RemCon + * A problem results when an application instantiates more than one + * Instance of RemCon. + * + * This class enables other components to use the same instance on RemCon that the + * It inherits from MRemConCoreApiTargetObserver and links with the RemConCoreApi.lib + * It inherits from MViaPlayerMediaKeyListener and links with the ViaPlayerUtilities.lib + * It interperets the keys from RemCon via the MediaKeyEventL method and translates them + * to standard key which get added to the application event queue for normal processing + * (Via OfferKeyEventL). + * + * Note that TranslateKeyEvent and DispatchKeyEvent methods are virtual. + * So if different behaviour is required just create a Sub class and overide + * those metheds are needed. + * + */ + +class CGlxMediaKeyUtility : public CBase, public MViaPlayerMediaKeyListener + { +public: + /** + * Standard NewLC class used for Instantiation + + * @return Instance of Itself, also on the cleanup stack + */ + static CGlxMediaKeyUtility* NewLC(); + + /** + * Standard NewL class used for Instantiation + + * @return Instance of Itself + */ + static CGlxMediaKeyUtility* NewL(); + + /** + * Destructor + */ + virtual ~CGlxMediaKeyUtility(); + +protected: + /** + * Creates KeyEvent and places it on the application event queue. + * + * @param aKeyCode this is the action (up, down or click). + * @param aScanCode this is the TStdScanCode for the Key Event. + */ + void DoSimulateKeyEvent( TRawEvent::TType aKeyCode, TStdScanCode aScanCode ); + + /** + * Converts RemCon key types to standard key types + * + * @param aOperationId the RemCon key type + * + * @return the standard key type + */ + virtual TStdScanCode TranslateKeyEvent(TRemConCoreApiOperationId aOperationId); + + /** + * Places the Key Event in the applications quere acording to aButtonAct (up, down, click) + * + * @param aButtonAct (up, down or click) + * @param aScanCode the standard scan code for a key + */ + virtual void DispatchKeyEvent( TRemConCoreApiButtonAction aButtonAct, TStdScanCode aScanCode); + +private: + CGlxMediaKeyUtility(); + void ConstructL(); + +private: // from MViaPlayerMediaKeyListener + void MediaKeyEventL(TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + }; + +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/inc/glxsinglelinemetapanecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/inc/glxsinglelinemetapanecontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2008-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: Header for class to implement Single line metapane +* +*/ + +#ifndef GLXMETADATACONTROL_H_ +#define GLXMETADATACONTROL_H_ + +#include +#include + +#include "glxfullscreenviewimp.h" + +enum TGlxControlGroupId + { + //List View + EMetaOrinentaionPortrait = 10, + EMetaOrinentaionLandscape = 20 + }; + +// Forward decleartion +class CAlfEnv; +class CAlfAnchorLayout; +class CAlfGridLayout; +class CAlfDeckLayout; +class CAlfImageVisual; +class CAlfTextVisual; +class CAlfImageBrush; +class CAlfBorderBrush; +class MGlxMediaList; +class CGlxDefaultAttributeContext; +class CGlxUiUtility; +class TGlxMedia; +class CGlxTextureManager; +class CGlxSLMPFavMLObserver; + +/* + * This is an observer class to observe the favourites attribute change and pass it back to the metapane + * for updating its favourite icon + */ +class MGlxSLMPObserver + { +public: + virtual void HandleUpdateIconL(TBool aModify) = 0; + + }; + + +/* + * For craeting and maintaining the Single Line metapane + */ +class CGlxSinleLineMetaPane: public CAlfControl, + public MGlxMediaListObserver, + public MGlxSLMPObserver + { +public: + /* + * NewL() + */ + static CGlxSinleLineMetaPane* NewL( CGlxFullScreenViewImp& aFullscreenView, + MGlxMediaList& aMediaList, CGlxUiUtility& aUiUtility); + + /* + * destructor + */ + ~CGlxSinleLineMetaPane(); + + /* + * Show/Hide the Metapane + */ + void ShowMetaPane(TBool aShow); + +public://frm CAlControl + TBool OfferEventL(const TAlfEvent &aEvent); + + void VisualLayoutUpdated(CAlfVisual& aVisual); + +public: // from MGlxMediaListObserver + void HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/ ); + void HandleItemRemovedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& /*aAttributes*/, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/ ); + void HandleMessageL( const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/ ); + void HandleError( TInt /*aError*/ ); + void HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, TInt /*aError*/, + MGlxMediaList* /*aList*/ ); + void HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ); + void HandleItemModifiedL( const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/ ); + +public:// MGlxSLMPObserver + virtual void HandleUpdateIconL(TBool aModify); + +private: + /* + * Constructor + */ + CGlxSinleLineMetaPane(CGlxFullScreenViewImp& aFullscreenView, + MGlxMediaList& aMediaList,CGlxUiUtility& aUiUtility); + + /* + * ConstructL() + */ + void ConstructL(); + + /* + * Creating the grid + */ + void CreateGridL(); + + /* + * Update position + */ + void UpdatePosition(); + + /* + * Determines the orientation of the view + */ + TInt DetermineOrientation(TRect aRect); + + /* + * This is called from handleattributes available, it updtates the + * metapane values for each item + */ + void UpdateAttributesInMetaPane(TMPXAttribute aAtrribute, + TInt aFocusIndex, const TGlxMedia& item); + + /* + * This is called from handleattributes available and focus changed, it updtates the + * metapane values for focus item + */ + void UpdateMetaPaneL(TInt aFocusIndex, MGlxMediaList* aList, + TBool aUpdateFavIcon = EFalse); + + /* + * This creates the icons for Favourites and Location Icon and then + * updates the respective image visuals + */ + void CreateIconTextureAndUpdateVisualsL(); + + TRect GetScreenSize(); + +private: + CGlxFullScreenViewImp& iFullscreenView; // Fullscreenview + MGlxMediaList& iMediaList; // MGlxMedialist passed from FS view + CGlxUiUtility& iUiUtility; // CGlxUiUtility passed from FS view + CGlxDefaultAttributeContext* iAttribContext; // CGlxDefaultAttributeContext + + CAlfEnv* iEnv; // Alf Env + CAlfDisplay* iDisplay; // Alf Display + CAlfAnchorLayout* iMainVisual; // Anchor Layout + CAlfGridLayout* iGridVisual; // Grid layout + CAlfGridLayout* iLocationGridVisual; // Grid layout + + CGlxSLMPFavMLObserver* iSLMPFavMLObserver; // Single line metapane medialist observer + + CAlfImageVisual* iBackgroundBorderImageVisual; // Background Image Visual + + CAlfTextVisual* iDateTextVisual; // Date Text + CAlfImageVisual* iFavIconImageVisual; // Location Icon + CAlfImageVisual* iLocIconImageVisual; // Size Text + CAlfTextVisual* iLocationTextVisual; // Location Text + + CAlfTexture* iFavAddedIconTexture; // Fav Added Icon Texture ( Yellow Icon ) + CAlfTexture* iFavNotAddedIconTexture; // Fav Not Added Icon Texture ( Black Icon ) + CAlfBorderBrush* iBorderBrush; // Border brush for background image visual + + TRect iScreenSize; // To store the screen size + TBool iFavIconStatus; // ETrue when the item is in favourites else EFalse + }; + + +#endif /* GLXMETADATACONTROL_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/inc/glxslmpfavmlobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/inc/glxslmpfavmlobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2008-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: Header for class to implement Single line metapane +* +*/ + +#ifndef GLXSLMPFAVMLOBSERVER_H_ +#define GLXSLMPFAVMLOBSERVER_H_ + +#include +#include + +class MGlxMediaList; +class CGlxDefaultAttributeContext; + +class CGlxSLMPFavMLObserver : public CBase, + public MGlxMediaListObserver + { +public: + /* + * Newl() + */ + static CGlxSLMPFavMLObserver* NewL( CGlxSinleLineMetaPane& aSingleLineMetaPane, + TInt aFocusIndex,MGlxMediaList* aList); + + /* + * Destructor + */ + ~CGlxSLMPFavMLObserver(); + +public: // from MGlxMediaListObserver + void HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/ ); + void HandleItemRemovedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList */); + void HandleAttributesAvailableL( TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList */); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ); + void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/ ); + void HandleMessageL( const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/ ); + void HandleError( TInt /*aError*/ ); + void HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, TInt /*aError*/, + MGlxMediaList* /*aList*/ ); + void HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ); + void HandleItemModifiedL( const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/ ); + +private: + /* + * Constructor + */ + CGlxSLMPFavMLObserver(CGlxSinleLineMetaPane& aSingleLineMetaPane); + + /* + * 2nd Phase Ctor + * Create the medialist for the favourites icon here with + * fav collection path + */ + void ConstructL(TInt aFocusIndex, MGlxMediaList* aList); + +private: + CGlxSinleLineMetaPane& iSingleLineMetaPane; // SingleLineMetapane Reference + MGlxMediaList* iFavMediaList; // Favourite Medialist + CGlxDefaultAttributeContext* iFavAttribContext; // Attribute context for favourites + }; + + +#endif /* GLXSLMPFAVMLOBSERVER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/src/glxfullscreenbindingsetfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/src/glxfullscreenbindingsetfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,266 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of fULL-SCREEN view +* +*/ + + + + + +#include "glxfullscreenbindingsetfactory.h" +#include "glxmuliconprovider.h" +#include "glxuiutility.h" +#include +#include +#include +#include +#include +// const that holds default icon size +const TSize KDefaultIconSize = TSize(50, 50); + +//----------------------------------------------------------------------------- +// TGlxMulFullScreenBindingSetFactory +//----------------------------------------------------------------------------- + +/** + * Constructor + */ +EXPORT_C TGlxMulFullScreenBindingSetFactory::TGlxMulFullScreenBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFullScreenBindingSetFactory::~TGlxMulFullScreenBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFullScreenBindingSetFactory::AddBindingsL() const + { + AddFullScreenThumbnailBindingL( Alf::mulvisualitem::KMulIcon1 ); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *uiUtility ); + TSize videoIconSize = uiUtility->GetGridIconSize(); + CleanupStack::PopAndDestroy( uiUtility ); + AddIconBindingL( Alf::mulvisualitem::KMulIndicator2, + CGlxMulVideoIconProvider::NewL(ETrue), videoIconSize); + } + +//----------------------------------------------------------------------------- +// TGlxMulFSMPTitleBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulFSMPTitleBindingSetFactory::TGlxMulFSMPTitleBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFSMPTitleBindingSetFactory::~TGlxMulFSMPTitleBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFSMPTitleBindingSetFactory::AddBindingsL() const + { + //AddIconBindingL( Alf::mulvisualitem::KMulIcon1 /*CGlxMulStaticIconProvider::NewL(resource ID)*/ );//@todo the resource file from which this to be read + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulTitle1 , KMPXMediaGeneralTitle ); + //AddIconBindingL( Alf::mulvisualitem::KMulIcon1, CGlxMulStaticIconProvider::NewL(EMbmGlxiconsQgn_lgal_icon_tag_list)); + AddTemplateBindingL(Alf::mulwidget::KTemplate5); + } + +//----------------------------------------------------------------------------- +// TGlxMulFSMPDateBindingSetFactory +//----------------------------------------------------------------------------- +/** + * Constructor + */ +EXPORT_C TGlxMulFSMPDateBindingSetFactory::TGlxMulFSMPDateBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFSMPDateBindingSetFactory::~TGlxMulFSMPDateBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFSMPDateBindingSetFactory::AddBindingsL() const + { + //AddThumbnailBindingL( Alf::mulvisualitem::KMulIcon1 ); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralDate, + R_QTN_DATE_USUAL_WITH_ZERO ); + AddTemplateBindingL(Alf::mulwidget::KTemplate3); + } + + +//----------------------------------------------------------------------------- +// TGlxMulFSMPTimeBindingSetFactory +//----------------------------------------------------------------------------- +/** + * Constructor + */ +EXPORT_C TGlxMulFSMPTimeBindingSetFactory::TGlxMulFSMPTimeBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFSMPTimeBindingSetFactory::~TGlxMulFSMPTimeBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFSMPTimeBindingSetFactory::AddBindingsL() const + { + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralDate, + R_QTN_TIME_USUAL_WITH_ZERO ); + AddTemplateBindingL(Alf::mulwidget::KTemplate3); + } + +//----------------------------------------------------------------------------- +// TGlxMulFSMPMemoryBindingSetFactory +//----------------------------------------------------------------------------- +/** + * Constructor + */ +EXPORT_C TGlxMulFSMPMemoryBindingSetFactory::TGlxMulFSMPMemoryBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFSMPMemoryBindingSetFactory::~TGlxMulFSMPMemoryBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFSMPMemoryBindingSetFactory::AddBindingsL() const + { + AddIconBindingL( Alf::mulvisualitem::KMulIcon1, + CGlxMulDriveIconProvider::NewL(), KDefaultIconSize ); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralSize ); + AddTemplateBindingL(Alf::mulwidget::KTemplate4); + } + +//----------------------------------------------------------------------------- +// TGlxMulFSMPAlbumBindingSetFactory +//----------------------------------------------------------------------------- + +/** + * Constructor + */ +EXPORT_C TGlxMulFSMPAlbumBindingSetFactory::TGlxMulFSMPAlbumBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFSMPAlbumBindingSetFactory::~TGlxMulFSMPAlbumBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFSMPAlbumBindingSetFactory::AddBindingsL() const + { +// AddIconBindingL( Alf::mulvisualitem::KMulIcon1 /*CGlxMulStaticIconProvider::NewL(resource ID)//qgn_lgal_fullscr_meta_album + //AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralTitle ); + AddTemplateBindingL(Alf::mulwidget::KTemplate4); + } + +//----------------------------------------------------------------------------- +// TGlxMulFSMPLocationBindingSetFactory +//----------------------------------------------------------------------------- + +/** + * Constructor + */ +EXPORT_C TGlxMulFSMPLocationBindingSetFactory::TGlxMulFSMPLocationBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFSMPLocationBindingSetFactory::~TGlxMulFSMPLocationBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFSMPLocationBindingSetFactory::AddBindingsL() const + { +// AddIconBindingL( Alf::mulvisualitem::KMulIcon1, KGlxMediaGeneralLocation );//qgn_lgal_metapane_location + AddIconBindingL( Alf::mulvisualitem::KMulIcon1, + CGlxMulLocationIconProvider::NewL(), KDefaultIconSize ); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KGlxMediaGeneralLocation );//@todo + AddIconBindingL( Alf::mulvisualitem::KMulIcon2, + CGlxMulLocationIconProvider::NewL(), KDefaultIconSize ); + AddTemplateBindingL(Alf::mulwidget::KTemplate6); + } + +//----------------------------------------------------------------------------- +// TGlxMulFSMPTagsBindingSetFactory +//----------------------------------------------------------------------------- + +/** + * Constructor + */ +EXPORT_C TGlxMulFSMPTagsBindingSetFactory::TGlxMulFSMPTagsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFSMPTagsBindingSetFactory::~TGlxMulFSMPTagsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFSMPTagsBindingSetFactory::AddBindingsL() const + { +// AddIconBindingL( Alf::mulvisualitem::KMulIcon1 /*CGlxMulStaticIconProvider::NewL(resource ID)//QTN_LGAL_FULLSCR_METAPANE_TAGS //@todo + //AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralTitle );//@todo + AddTemplateBindingL(Alf::mulwidget::KTemplate4); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/src/glxfullscreenview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/src/glxfullscreenview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of fULL-SCREEN view +* +*/ + + + + + +// INCLUDE FILES +#include "glxfullscreenview.h" +#include "glxfullscreenviewimp.h" +#include +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxFullScreenView* CGlxFullScreenView::NewL(MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle) + { + TRACER("CGlxFullScreenView::NewL()"); + return CGlxFullScreenViewImp::NewL(aMediaListFactory, + aResourceIds, + aViewUID, + aTitle); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxFullScreenView* CGlxFullScreenView::NewLC(MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle) + { + GLX_LOG_INFO("CGlxFullScreenView::NewLC()"); + return CGlxFullScreenViewImp::NewLC(aMediaListFactory, + aResourceIds, + aViewUID, + aTitle); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxFullScreenView::~CGlxFullScreenView() + { + GLX_LOG_INFO("CGlxFullScreenView::~CGlxFullScreenView()"); + // Do nothing + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1312 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of fULL-SCREEN view +* +*/ + + + + +// Avkon and System Headers +#include // CEikButtonGroupContainer +#include +#include // for KDC_APP_RESOURCE_DIR +#include +#include // String Loader + +// Alf Headers +#include // widget factory +#include // To get CAlfControl from CAlfWidgetControl +#include // View Widget +#include // Widget Env Extensions to create view widget +#include // AlfUtil + +// Antariksh Headers +#include +#include // Coverflow widget +#include // For Slider Widget +#include + +#include + +using namespace GestureHelper; + +//Hg +//#include +#include + +// Photos Headers +#include // CGlxLogger +#include // For Log +#include // For MulModelProvider +#include // For EGlxCmdFullScreenBack +#include // FS View Resource +#include // KGlxMediaIdThumbnail +//#include "glxmediakeyutility.h" +#include // For medialist registry +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include "glxfullscreenviewimp.h" +#include + +using namespace Alf; + +//To disable AppUi status pane +#define GetAppViewUi() (dynamic_cast(CEikonEnv::Static()->EikAppUi())) +const TInt KGlxScreenTimeout =10000000; +const TInt KCoverflowDataWindowSize = 1; +const TInt KGlxRotationDelay = 800; // Milliseconds +const TInt KGlxMaxSmallImageZoomLevel =150; +const TInt KGlxMaxBigImageZoomLevel =100; +const TInt KGlxMinSmallImageZoomLevel =100; +const TInt KGlxNeutralPinchPosition =100; +const TInt KGlxSliderTickValue =5; +_LIT(KGlxIconsFilename, "glxicons.mif"); +/** + * Start Delay for the periodic timer, in microseconds + */ +const TInt KPeriodicStartDelay = 250000; +//This constant is used to calculate the index of the item for which texture has to removed. +//6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index); +const TInt KFullScreenIterator = 3; +//Constant which says maximum number of fullscreen textures that we have have at a time. +//11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards)) +const TInt KFullScreenTextureOffset = 5; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxFullScreenViewImp::CGlxFullScreenViewImp( + const TFullScreenViewResourceIds& aResourceIds, TInt aViewUID) : + iResourceIds(aResourceIds), iViewUid(aViewUID) + { + TRACER("CGlxFullScreenViewImp::CGlxFullScreenViewImp"); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxFullScreenViewImp* CGlxFullScreenViewImp::NewL( + MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle) + { + TRACER("CGlxFullScreenViewImp::NewL"); + CGlxFullScreenViewImp* self = CGlxFullScreenViewImp::NewLC ( + aMediaListFactory, aResourceIds, aViewUID, aTitle); + CleanupStack::Pop (self); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxFullScreenViewImp* CGlxFullScreenViewImp::NewLC( + MGlxMediaListFactory* aMediaListFactory, + const TFullScreenViewResourceIds& aResourceIds, TInt aViewUID, + const TDesC& aTitle) + { + TRACER("CGlxFullScreenViewImp::NewLC"); + CGlxFullScreenViewImp* self =new (ELeave) CGlxFullScreenViewImp(aResourceIds, aViewUID); + CleanupStack::PushL (self); + self->ConstructL (aMediaListFactory, aTitle); + return self; + } + +// --------------------------------------------------------------------------- +// ConstructL. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::ConstructL( + MGlxMediaListFactory* aMediaListFactory, const TDesC& aTitle) + { + TRACER("CGlxFullScreenViewImp::ConstructL"); + BaseConstructL (iResourceIds.iViewId); + ViewBaseConstructL(); + MLViewBaseConstructL (aMediaListFactory, aTitle , EFalse); + + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + //Register the view to recieve toolbar events. ViewBase handles the events + SetToolbarObserver(this); + + // Presently image viewer dont have toolbar + // So need to remove if image viewer using full screen + CGlxNavigationalState* navigationalState = CGlxNavigationalState::InstanceL(); + CleanupClosePushL( *navigationalState ); + CMPXCollectionPath* naviState = navigationalState->StateLC(); + if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + { + CAknToolbar* toolbar = Toolbar(); + if(toolbar) + { + toolbar->DisableToolbarL(ETrue); + } + ShowToolbarOnViewActivation(EFalse); + } + else + { + ShowToolbarOnViewActivation(ETrue); + } + CleanupStack::PopAndDestroy(naviState); + CleanupStack::PopAndDestroy(navigationalState); + + + //Get the ScreenFurniture instance + iScreenFurniture = iUiUtility->ScreenFurniture(); + + //Get the env from the uiutilities + iEnv = iUiUtility->Env (); + iZoomButtonGroup = CEikButtonGroupContainer::NewL( + CEikButtonGroupContainer::ECba, // type + CEikButtonGroupContainer::EHorizontal, // orientation + this, // command observer + R_GLX_FULLSCREEN_SOFTKEYS_ZOOM ); + iZoomButtonGroup->MakeVisible( EFalse ); + + //create the drmutility instance + iDrmUtility = CGlxDRMUtility::InstanceL(); + // Get object that stores the active media list registry + iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL(); + if(!iPeriodic) + { + iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard); + } + } + +// --------------------------------------------------------------------------- +// ~CGlxFullScreenViewImp() +// --------------------------------------------------------------------------- +// +CGlxFullScreenViewImp::~CGlxFullScreenViewImp() + { + TRACER("CGlxFullScreenViewImp::~CGlxFullScreenViewImp"); + delete iMediaListMulModelProvider; + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } + delete iTimer; + if(iZoomButtonGroup) + { + AppUi()->RemoveFromStack( iZoomButtonGroup ); + delete iZoomButtonGroup; + } + if(iActiveMediaListRegistry) + { + iActiveMediaListRegistry->Close(); + } + if( iDrmUtility ) + { + iDrmUtility->Close(); + } + if (iPeriodic) + { + iPeriodic->Cancel(); + delete iPeriodic; + } + } + // --------------------------------------------------------------------------- +// From CGlxViewBase +// --------------------------------------------------------------------------- +// +TUid CGlxFullScreenViewImp::Id() const + { + TRACER("CGlxFullScreenViewImp::Id"); + return TUid::Uid(iViewUid); + } + + +// --------------------------------------------------------------------------- +// Destroys a coverflow widget +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::DestroyWidgets() + { + TRACER("CGlxFullScreenViewImp::DestroyCoverflowWidget"); + if (iCoverFlowWidget) + { + iCoverFlowWidget->RemoveEventHandler(*this); + } + // Destror Slider widget + DestroySliderWidget(); + + delete iMediaListMulModelProvider; + iMediaListMulModelProvider = NULL; + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); + // Destroying this widget calls destructor of single line meta pane + widgetFactory.destroyWidget(iViewWidget); + + iCoverFlowWidget = NULL; + iViewWidget = NULL; + } + +// --------------------------------------------------------------------------- +// Destroys a Slider widget +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::DestroySliderWidget() + { + TRACER("CGlxFullScreenViewImp::DestroySliderWidget"); + if(iSliderWidget) + { + iSliderWidget->RemoveEventHandler(*this); + } + iSliderWidget = NULL; + iSliderModel = NULL; + } +// --------------------------------------------------------------------------- +// From CAknView +// Handles a view activation. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::DoMLViewActivateL( + const TVwsViewId & /* aPrevViewId */, TUid /* aCustomMessageId */, + const TDesC8 & /* aCustomMessage */) + { + TRACER("CGlxFullScreenViewImp::DoMLViewActivateL"); + //Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash + if(!iMediaList->Count()) + { + CGlxNavigationalState* navigationalState = CGlxNavigationalState::InstanceL(); + CleanupClosePushL( *navigationalState ); + navigationalState->ActivatePreviousViewL(); + CleanupStack::PopAndDestroy( navigationalState ); + } + //need to create the instance first,other wise panics while + // zooming from imgvwr. + iHdmiController = CGlxHdmiController::NewL(); + if(iMediaList->Count()) + { + iOldFocusIndex = iMediaList->FocusIndex(); + TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() ); + GLX_LOG_INFO("CGlxHdmi - CGlxFullScreenViewImp Create HdmiController"); + if (item.Category() != EMPXVideo) + { + TInt frameCount(0); + TSize orignalSize; + TBool aFramesPresent = item.GetFrameCount(frameCount); + TBool adimension = item.GetDimensions(orignalSize); + iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount); + } + } + iScreenFurniture->SetActiveView(iViewUid); + + //set the ui state to off,when the Fullscreen launches + SetUiSate(NGlxNFullScreenUIState::EUiOff); + + GlxSetAppState::SetState(EGlxInFullScreenView); + + // create the coverflow + CreateCoverflowWidgetL(); + + // create the screen furniture for touch devices + CreateScreenFurnitureL(); + + CreateSliderWidgetL(); + +// iMediaKeyUtility = CGlxMediaKeyUtility::NewL(); + + // create a zoom control + iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList, + *iZoomButtonGroup, *iSliderWidget, iGestureHelper); + + // Create the Metapane + //iSingleLineMetaPane = CGlxSinleLineMetaPane::NewL(*this,*iMediaList,*iUiUtility); + + // hide the screen furniture + HideUi(ETrue); + // Set active media list pointer, so that UPnP renderer knows about this list + iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList); + + //Get the HgContextUtility instance +// iContextUtility = iUiUtility->ContextUtility(); + + // if the Medialist has any item, set the First index context to Hg Context Utility +// TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() ); +// iContextUtility->PublishPhotoContextL(item.Uri()); + if ( !iPeriodic->IsActive() ) + { + iPeriodic->Start( KPeriodicStartDelay, KMaxTInt, TCallBack( + &PeriodicCallback, static_cast( this ) ) ); + } + } + + +// --------------------------------------------------------------------------- +// Creates a coverflow widget +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::CreateCoverflowWidgetL() + { + TRACER("CGlxFullScreenViewImp::CreateCoverflowWidgetL"); + + const char* KWidgetName("mulcoverflowwidget"); + const char* KCoverflowViewWidget("CoverflowViewWidget"); + const char* KCoverflowWidget("CoverflowWidget"); + try + { + // Get widget factory from CAlfEnv + // Factory is then used to create the individual widgets & data model + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); + + // create a view widget + iViewWidget = widgetFactory.createViewWidget ( + KCoverflowViewWidget, 0x113); + // hide control and status pane + iViewWidget->enableControlPane(EFalse); + iViewWidget->enableStatusPane(EFalse); + iViewWidget->setRect(TRect(TPoint(0,0),AlfUtil::ScreenSize())); + iViewWidget->show(true); + // create coverflow widget + iCoverFlowWidget = widgetFactory.createWidget ( + KWidgetName, KCoverflowWidget, *iViewWidget, NULL); + iCoverFlowWidget->SetFlags(IMulMultiItemWidget::EMulWidgetDoubleTap); + + // Widget takes the ownership + iCoverFlowWidget->AddEventHandler (*this); + + // hide appui's status pane + GetAppViewUi()->StatusPane()->MakeVisible(EFalse); + + // hide appui's softkeys + GetAppViewUi()->Cba()->MakeVisible(EFalse); + iCoverFlowWidget->ShowWidget(ETrue); + iCoverFlowWidget->control()->AcquireFocus(); + + iMediaListMulModelProvider = CGlxMediaListMulModelProvider::NewL (*iEnv, + *iCoverFlowWidget, *iMediaList, iFullScreenBindingSet, + mulwidget::KTemplate4, KCoverflowDataWindowSize ); + + iGestureHelper = (GestureHelper::CGestureHelper*)iCoverFlowWidget->Gesturehelper(); + } + + catch(...) + { + User::Leave(KErrGeneral); + } + + } + +//---------------------------------------------------------------------------- +//Initialise the slider widget and the slider model +//---------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::CreateSliderWidgetL() + { + const char* KSliderWidgetName("mulsliderwidget"); + const char* KZoomSliderWidget("ZoomSliderWidget"); + + try + { + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); + + iSliderWidget = widgetFactory.createWidget( KSliderWidgetName, + KZoomSliderWidget, *iViewWidget, NULL); + + iSliderWidget->AddEventHandler(*this); + iSliderWidget->SetHandleKeyEvent(EFalse); + iSliderModel = widgetFactory.createModel ("mulslidermodel"); + iSliderModel->SetTemplate(ESliderTemplate3); + iSliderWidget->setModel(iSliderModel); + + //adding the range and slider tick value + if(iSliderModel) + { + iSliderModel->SetTick(KGlxSliderTickValue); + } + + //SetSliderLevel(); + + } + catch(...) + { + User::Leave(KErrGeneral); + } + } + +// --------------------------------------------------------------------------- +// ShowUiL +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::ShowUiL(TBool aStartTimer) + { + TRACER("CGlxFullScreenViewImp::ShowUiL"); + + TInt index = iMediaList->FocusIndex(); + const TGlxMedia& item = iMediaList->Item(index); + TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail); + // Display slider only for non corrupted images + if (error == KErrNone && item.Category() == EMPXImage) + { + //To set the Slider values. + SetSliderLevel(); + //show the slider + iSliderWidget->ShowWidget(ETrue); + } + + if (iCoverFlowWidget) + { + // This is done to set the item counter + iCoverFlowWidget->SetUIMode(ETrue); + } + + //show the toolbar + CAknToolbar* toolbar = Toolbar(); + if(toolbar) + { + toolbar->SetToolbarVisibility(ETrue); + } + + // For floating toolbar in non-touch devices + iScreenFurniture->SetToolbarVisibility(ETrue); + //show the softkeys + Cba()->MakeVisible( ETrue ); + Cba()->DrawNow(); + + // Show the Metapane + //iSingleLineMetaPane->ShowMetaPane(ETrue); + + //set the ui state to On + SetUiSate(NGlxNFullScreenUIState::EUiOn); + + //start the timer,for the screen timeout + iTimer->Cancel(); + if(aStartTimer) + { + iTimer->Start(KGlxScreenTimeout,KGlxScreenTimeout,TCallBack( TimeOut,this )); + } + } + +// --------------------------------------------------------------------------- +// HideUi +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::HideUi(TBool aSliderStatus) + { + TRACER("CGlxFullScreenViewImp::HideUi"); + //cancel the timer + iTimer->Cancel(); + + // For floating toolbar in non-touch devices + iScreenFurniture->SetToolbarVisibility(EFalse); + // hide the slider + if(aSliderStatus && iSliderWidget) + { + iSliderWidget->ShowWidget(EFalse); + } + + if (iCoverFlowWidget) + { + iCoverFlowWidget->SetUIMode(EFalse); + } + // hide the toolbar + CAknToolbar* toolbar = Toolbar(); + if(toolbar) + { + toolbar->SetToolbarVisibility(EFalse); + } + + // hide the softkeys + Cba()->MakeVisible( EFalse ); + Cba()->DrawNow(); + // Hide the metapane + //iSingleLineMetaPane->ShowMetaPane(EFalse); + + // set the ui state to On + SetUiSate(NGlxNFullScreenUIState::EUiOff); + } + +// --------------------------------------------------------------------------- +// CreateScreenFurnitureL +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::CreateScreenFurnitureL() + { + TRACER("CGlxFullScreenViewImp::CreateScreenFurnitureL"); + // create the softkeys + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + CleanupStack::PushL( cba ); + cba->SetCommandSetL(R_GLX_FULLSCREEN_SOFTKEYS); + CleanupStack::Pop(cba); + } + +// --------------------------------------------------------------------------- +// SetUiSate +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::SetUiSate (NGlxNFullScreenUIState::TUiState aState) + { + TRACER("CGlxFullScreenViewImp::SetUiSate"); + iUiState = aState; + } + +// --------------------------------------------------------------------------- +// GetUiSate +// --------------------------------------------------------------------------- +// +NGlxNFullScreenUIState::TUiState CGlxFullScreenViewImp::GetUiSate() + { + TRACER("CGlxFullScreenViewImp::GetUiSate"); + return iUiState; + } + +// --------------------------------------------------------------------------- +// TimeOut +// --------------------------------------------------------------------------- +// +TInt CGlxFullScreenViewImp::TimeOut(TAny* aSelf) + { + TRACER("CGlxFullScreenViewImp::TimeOut"); + if(aSelf) + { + CGlxFullScreenViewImp* self = static_cast (aSelf); + if (self) + { + if ( NGlxNFullScreenUIState::EUiOn == self->GetUiSate()) + { + // After time out, hide UI only when menu is not being displayed. + if( self->MenuBar() && !(self->MenuBar()->IsDisplayed()) ) + { + self->HideUi(ETrue); + } + } + } + } + return KErrNone; + } + +// --------------------------------------------------------------------------- +//DeactivateFullScreen function. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::DeactivateFullScreen() + { + TRACER("CGlxFullScreenViewImp::DeactivateFullScreen"); + if (iCoverFlowWidget) + { + iCoverFlowWidget->RemoveEventHandler(*this); + iCoverFlowWidget->ShowWidget(EFalse); + } + if(iSliderWidget) + { + iSliderWidget->RemoveEventHandler(*this); + } + //Dont Hide the slider,when activating the Zoom control,so pass EFalse + HideUi(EFalse); + iViewWidget->show(ETrue); + } + +// --------------------------------------------------------------------------- +//ActivateFullScreen function. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::ActivateFullScreenL() + { + TRACER("CGlxFullScreenViewImp::ActivateFullScreenL"); + + if (iCoverFlowWidget) + { + iCoverFlowWidget->AddEventHandler(*this); + iCoverFlowWidget->ShowWidget(ETrue); + } + if(iSliderWidget) + { + iSliderWidget->ShowWidget( EFalse ); + iSliderWidget->AddEventHandler(*this); + } + iViewWidget->show(ETrue); + iViewWidget->setRect(TRect(TPoint(0,0),AlfUtil::ScreenSize())); + GlxSetAppState::SetState(EGlxInFullScreenView); + } + +// --------------------------------------------------------------------------- +//ActivateZoomControl function. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::ActivateZoomControlL(TZoomStartMode aStartMode, TPoint* apZoomFocus) + { + TRACER("CGlxFullScreenViewImp::ActivateZoomControlL"); + TInt focus = iMediaList->FocusIndex(); + TGlxMedia item = iMediaList->Item( focus ); + TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties() , KGlxMediaIdThumbnail); + + if(KErrNone == error) + { + if(EMPXImage == item.Category()) + { + if(iZoomControl && !iZoomControl->Activated()) + { + iHdmiController->ActivateZoom(); + iZoomControl->ActivateL(GetIntialZoomLevel(),aStartMode, focus, item, apZoomFocus); + + //==Removing all textures other than the focussed one=============== + TInt count = iMediaList->Count(); + + while (count > 0) + { + TGlxMedia mediaItem = iMediaList->Item(count-1); + if (mediaItem.Id() != item.Id() ) + { + iUiUtility->GlxTextureManager().RemoveTexture(mediaItem.Id(),EFalse); + } + count--; + } + //==\Removing all textures============== + } + else + { + return; + } + DeactivateFullScreen(); + GlxSetAppState::SetState(EGlxInZoomedView); + } + } + } + +// --------------------------------------------------------------------------- +//DeactivateZoomControl function. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::DeactivateZoomControlL() + { + TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL"); + ActivateFullScreenL(); + if(iZoomControl->Activated()) + { + iHdmiController->DeactivateZoom(); + iZoomControl->Deactivate(); + } + //Once into fullscreen view,show the screen furniture + HideUi(ETrue); + } + +// --------------------------------------------------------------------------- +// From CAknView +// View deactivation function. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::DoMLViewDeactivate() + { + TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate"); + iScreenFurniture->ViewDeactivated(iViewUid); + if (iHdmiController) + { + delete iHdmiController; + iHdmiController = NULL; + } + + if(iZoomControl) + { + if(iZoomControl->Activated()) + { + iZoomControl->Deactivate(); + } + delete iZoomControl; + iZoomControl = NULL; + } + DestroyWidgets(); + iTimer->Cancel(); + // Deregister active media list pointer + iActiveMediaListRegistry->DeregisterActiveMediaList(iMediaList); + + /* + * safe code-- if user press back very quickly + * cancelling the timer while going back to prev view + */ + if (iPeriodic->IsActive()) + { + iPeriodic->Cancel(); + } + + } +// --------------------------------------------------------------------------- +// Foreground event handling function. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::HandleForegroundEventL(TBool aForeground) + { + TRACER("CGlxFullScreenViewImp::HandleForegroundEventL"); + CAknView::HandleForegroundEventL(aForeground); + + if(!aForeground) + { + if(iZoomControl && iZoomControl->Activated()) + { + iZoomControl->HandleZoomForegroundEvent(aForeground); + } + } + } + + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler.. +// --------------------------------------------------------------------------- +// +bool CGlxFullScreenViewImp::accept( CAlfWidgetControl& /*aControl*/, + const TAlfEvent& /*aEvent*/) const + { + TRACER("CGlxFullScreenViewImp::accept()"); + return ETrue; + } + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler.. +// --------------------------------------------------------------------------- +// +AlfEventStatus CGlxFullScreenViewImp::offerEvent( + CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent) + { + TRACER("CGlxFullScreenViewImp::offerEvent"); + // The below function call will not add any values except + // to reduce the codescanner warnings to one + return OfferEventL(aEvent); + } + +// --------------------------------------------------------------------------- +// OfferEventL() +// --------------------------------------------------------------------------- +// +AlfEventStatus CGlxFullScreenViewImp::OfferEventL(const TAlfEvent& aEvent) + { + TRACER("CGlxFullScreenViewImp::offerEventL"); + if ( aEvent.IsKeyEvent()) + { + switch ( aEvent.KeyEvent().iScanCode ) + { + case EStdKeyNkpAsterisk : + if(iUiUtility->IsPenSupported()) + { + return EEventNotHandled; + } + case EStdKeyIncVolume : + //Listen EStdKeyApplicationD as EKeyZoomIn key is mapped to TKeyCode:: + //EKeyApplicationC for which TStdScancode is EStdKeyApplicatoinC + case EStdKeyApplicationC: + { + if(EEventKeyDown == aEvent.Code()) + { + //Dont start the timer while activating the zoom control, + //when the timer activates while launching the zoom + //it causes the crash. + ShowUiL(EFalse); + SetSliderLevel(); + TRAP_IGNORE( ActivateZoomControlL(EZoomStartKey)); + return EEventConsumed; + } + } + case EStdKeyUpArrow: + case EStdKeyDownArrow: + case EStdKeyDevice0: + case EStdKeyDevice1: + //Listen EStdKeyApplicationC as EKeyZoomOut key is mapped to TKeyCode:: + //EKeyApplicationD for which TStdScancode is EStdKeyApplicatoinD + case EStdKeyApplicationD: + { + if ( NGlxNFullScreenUIState::EUiOff == GetUiSate()&& ( + aEvent.Code() == EEventKey ) ) + { + //the Ui timer sjould be started once the UI screen furniture is shown + ShowUiL(ETrue); + } + return EEventHandled; + } + case EStdKeyLeftArrow: + case EStdKeyRightArrow: + { + if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) + { + HideUi(ETrue); + } + return EEventHandled; + } + case EStdKeyApplication1C: + { + if(iUiUtility->IsPenSupported()) + { + return EEventNotHandled; + } + else + { + ProcessCommandL(KGlxCmdMnShowMap); + return EEventHandled; + } + } + default: + return EEventNotHandled; + } + } + if(!aEvent.IsCustomEvent()) + { + GLX_LOG_INFO("Event Not Handled"); + return EEventNotHandled; + } + + if(aEvent.IsCustomEvent()) + { + TInt eventId = aEvent.CustomParameter(); + + switch(eventId) + { + case KAlfActionIdDeviceLayoutChanged: + { + iViewWidget->setRect(TRect(TPoint(0,0),AlfUtil::ScreenSize())); + + iScreenFurniture->SetToolbarPosition(); + + return EEventNotHandled; + } + case ETypeSelect: + { + TBool pensupport = iUiUtility->IsPenSupported(); + if ( pensupport ) + { + if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) + { + //Hide the slider + HideUi(ETrue); + } + else + { + //the Ui timer should be started once the UI screen furniture is shown + ShowUiL(ETrue); + } + } + else + { + if ( NGlxNFullScreenUIState::EUiOff == GetUiSate() ) + { + //the Ui timer should be started once the UI screen furniture is shown + ShowUiL(ETrue); + } + } + } + break; + + case ETypeRemove: + { + // Handle the "C" key or the BackSpace key to Delete an item. + ProcessCommandL(EGlxCmdDelete); + return EEventConsumed; + } + + case ETypeDoubleTap: + { + GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap"); + + MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); + TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint; + SetSliderLevel(); + TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint) ); + return EEventConsumed; + } + case ETypeHighlight: + { + iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); + if (AknLayoutUtils::PenEnabled()) + { + iMediaList->SetVisibleWindowIndexL(aEvent.CustomEventData()); + } + if(iMediaList->Count()> KFullScreenTextureOffset) + { + RemoveTexture(); + } + TGlxMedia item1 = iMediaList->Item( iMediaList->FocusIndex() ); + TInt frameCount(0); + TSize orignalSize; + TBool aFramesPresent = item1.GetFrameCount(frameCount); + TBool adimension = item1.GetDimensions(orignalSize); + if (item1.Category() != EMPXVideo) + { + GLX_LOG_INFO("CGlxHdmi - FullscreenView - SetImageL"); + iHdmiController->SetImageL(item1.Uri(), orignalSize, frameCount); + } + else + { + iHdmiController->IsVideo(); + } + iOldFocusIndex = iMediaList->FocusIndex(); + if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) + { + HideUi(ETrue); + } + TRAP_IGNORE(ShowDrmExpiaryNoteL()); + return EEventConsumed; + } + case EVideoIconSelect: + { + TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() ); + if(item.Category() == EMPXVideo) + { + ProcessCommandL(EGlxCmdPlay); + } + else + { + if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) + { + HideUi(ETrue); + } + else + { + //the Ui timer should be started once the UI screen furniture is shown + ShowUiL(ETrue); + } + } + } + break; + //Zoom Start via pinch + case ETypePinch: + // Handle only a pinch out. not a pinch in. + if (KGlxNeutralPinchPosition < aEvent.CustomEventData()) + { + SetSliderLevel(); + TRAP_IGNORE( ActivateZoomControlL(EZoomStartPinch)); + } + return EEventConsumed; // will be consumed even if we are pinching IN (trying to zoom OUT). + //slider event handling + case ETypePrimaryValueChange: + { + // Zoomview is only launched if the currentslider value is above the level + // of fullscreenlevel. + iTimer->Cancel(); + iSliderWidget->ShowWidget( ETrue, 0 ); + SetSliderLevel(); + TRAP_IGNORE( ActivateZoomControlL(EZoomStartSlider)); + } + return EEventConsumed; + default: + return EEventNotHandled; + } + } + return EEventNotHandled; + } +// --------------------------------------------------------------------------- +// From HandleViewCommandL.. +// --------------------------------------------------------------------------- +// +TBool CGlxFullScreenViewImp::HandleViewCommandL(TInt aCommand) + { + TRACER("GCGlxFullScreenViewImp::HandleViewCommandL"); + //size calculated for rotation + TSize size = iUiUtility->GetRotatedImageSize(); // ViewBase iUiUtility is use + TBool consumed = EFalse; + switch (aCommand) + { + case EGlxCmdResetView: + { + HideUi(ETrue); + consumed = ETrue; + break; + } + case EGlxCmdFullScreenBack: + SetSliderLevel(); + DeactivateZoomControlL(); + consumed = ETrue; + break; +// case EGlxCmdRotateLeft: +// iCoverFlowWidget->RotateImage(IMulWidget::ERotateLeft,size,KGlxRotationDelay); +// consumed = ETrue; +// break; +// case EGlxCmdRotateRight: +// iCoverFlowWidget->RotateImage(IMulWidget::ERotateRight,size,KGlxRotationDelay); +// consumed = ETrue; +// break; + } + return consumed; + } + +// --------------------------------------------------------------------------- +// From HandleCommandL.. +// --------------------------------------------------------------------------- +// + void CGlxFullScreenViewImp::HandleCommandL(TInt aCommandId, CAlfControl* aControl) + { + TRACER("CGlxFullScreenViewImp::HandleCommandLCAlfControl"); + //Gets a callback from zoomview if zoomlevel goes beyound the launch zoomlevel + // and activates the fullscreenview + if((aControl == iZoomControl)&& (aCommandId == KGlxZoomOutCommand)) + { + SetSliderLevel(); + DeactivateZoomControlL(); + } + /*else if(aControl == iSingleLineMetaPane) + { + ProcessCommandL(aCommandId); + }*/ + } + +// --------------------------------------------------------------------------- +// From HandleResourceChangeL.. +// --------------------------------------------------------------------------- +// + void CGlxFullScreenViewImp::HandleResourceChangeL (TInt aType) + { + TRACER("CGlxFullScreenViewImp::HandleResourceChangeL"); + HandleResourceChangeL ( aType); + switch (aType) + { + case KEikDynamicLayoutVariantSwitch: + { + //if resolution changed +// iSliderWidget->control()->Display()->SetVisibleArea( ClientRect() ); + break; + } + } + } + +//---------------------------------------------------------------------------------- +// IntialZoomLevel:Calculate the initial Zoom Level for the Image +//---------------------------------------------------------------------------------- +// +TInt CGlxFullScreenViewImp::GetIntialZoomLevel() + { + TRACER("CGlxFullScreenViewImp::IntialZoomLevel"); + TInt focus = iMediaList->FocusIndex(); + TGlxMedia item = iMediaList->Item( focus ); + TSize size; + TUint8 initialZoomLevel; + item.GetDimensions( size ); + TRect rect = AlfUtil::ScreenSize(); + + if( rect.Width()>= size.iWidth && rect.Height() >= size.iHeight) + { + //if Both the Width and Height are lesser than the screen size,the initial Zoom Level will be 100 + initialZoomLevel = KGlxMinSmallImageZoomLevel; + } + else + { + //Calculate (Display Area Width) /Image Width * 100 + //Calculate (Display Area Height) /Image Height * 100 + //Choose the Minimum Of the above. + TReal32 imageWidthRatio = ((TReal32) rect.Width() / size.iWidth )*100.0F; + TReal32 imageHeightRatio = ((TReal32)rect.Height()/ size.iHeight )*100.0F; + initialZoomLevel = Min(imageWidthRatio,imageHeightRatio); + } + return initialZoomLevel; + } + +//---------------------------------------------------------------------------------- +// SetSliderLevel() Set the Initial Zoom Level for the Image +//---------------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::SetSliderLevel() + { + TRACER("CGlxFullScreenViewImp::SetSliderLevel"); + + TInt value = GetIntialZoomLevel(); + if(iSliderModel) + { + iSliderModel->SetMinRange(value); + (value==KGlxMaxBigImageZoomLevel)?(iSliderModel->SetMaxRange(KGlxMaxSmallImageZoomLevel)) + :(iSliderModel->SetMaxRange(KGlxMaxBigImageZoomLevel)); + iSliderModel->SetPrimaryValue(value); + } + } + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler.. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::setEventHandlerData( + const AlfWidgetEventHandlerInitData& /*aData*/) + { + TRACER("CGlxFullScreenViewImp::setEventHandlerData"); + } + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler.. +// --------------------------------------------------------------------------- +// +AlfWidgetEventHandlerInitData* CGlxFullScreenViewImp::eventHandlerData() + { + TRACER("CGlxFullScreenViewImp::eventHandlerData"); + return NULL; + } + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::setActiveStates( unsigned int /*aStates*/ ) + { + TRACER("CGlxFullScreenViewImp::setActiveStates"); + } + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// + +IAlfInterfaceBase* CGlxFullScreenViewImp::makeInterface( const IfId& /*aType*/ ) + { + TRACER("CGlxFullScreenViewImp::makeInterface"); + return NULL; + } + +//---------------------------------------------------------------------------------- +// eventHandlerType +//---------------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType CGlxFullScreenViewImp::eventHandlerType() + { + TRACER("CGlxFullScreenViewImp::eventHandlerType"); + return IAlfWidgetEventHandler::ELogicalEventHandler; + } + +//---------------------------------------------------------------------------------- +// eventExecutionPhase +//---------------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase CGlxFullScreenViewImp::eventExecutionPhase() + { + TRACER("CGlxFullScreenViewImp::eventHandlerType"); + return EBubblingPhaseEventHandler; + } + +// ----------------------------------------------------------------------------- +// Callback from periodic timer +// ----------------------------------------------------------------------------- +// +TInt CGlxFullScreenViewImp::PeriodicCallback(TAny* aPtr ) + { + TRACER("CGlxFullScreenViewImp::PeriodicCallback"); + static_cast< CGlxFullScreenViewImp* >( aPtr )->CallPeriodicCallback(); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// Callback from periodic timer-- non static +// ----------------------------------------------------------------------------- +// +inline void CGlxFullScreenViewImp::CallPeriodicCallback() + { + TRACER("CGlxFullScreenViewImp::CallPeriodicCallback"); + if(iPeriodic->IsActive()) + { + iPeriodic->Cancel(); + } + /* + * function can leave + */ + TRAP_IGNORE(ShowDrmExpiaryNoteL()); + } + +// --------------------------------------------------------------------------- +// +// Shows expiry note/dialog for expired DRM files, can leave +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::ShowDrmExpiaryNoteL() + { + TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL"); + if(iMediaList->Count()>0) + { + const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex()); + if (media.IsDrmProtected()) + { + const TDesC& uri = media.Uri(); + if ( !iDrmUtility->CheckOpenRightsL(uri , (media.Category() == EMPXImage)) && ( uri.Length()>0 )) + { + iDrmUtility->ShowRightsInfoL(uri); + } + } + } + } +// --------------------------------------------------------------------------- +// +// Gets the Swipe direction +// --------------------------------------------------------------------------- +// +TSwipe CGlxFullScreenViewImp::GetSwipeDirection() + { + TRACER("CGlxFullScreenViewImp::GetSwipeDirection"); + + TInt count = iMediaList->Count(); + TInt focusindex = iMediaList->FocusIndex(); + TSwipe swipedirection; + + if(focusindex == 0) + { + swipedirection = (iOldFocusIndex == 1 ? EBackward : EForward); + } + else if(focusindex == count-1) + { + swipedirection = (iOldFocusIndex == 0 ? EBackward : EForward); + } + else + { + swipedirection = (focusindex-iOldFocusIndex < 0 ? EBackward : EForward) ; + } + return swipedirection; + } +// --------------------------------------------------------------------------- +// +// Gets the index of the item for which the texture has to be removed +// --------------------------------------------------------------------------- +// +TInt CGlxFullScreenViewImp::GetIndexToBeRemoved() + { + TRACER("CGlxFullScreenViewImp::GetIndexToBeRemoved"); + + TSwipe swipedirection = GetSwipeDirection(); + TInt indextoberemoved; + TInt count = iMediaList->Count(); + TInt focusindex = iMediaList->FocusIndex(); + if(swipedirection == EForward) + { + indextoberemoved = focusindex-KFullScreenIterator; + if(indextoberemoved < 0) + { + indextoberemoved = count+indextoberemoved; + } + } + else + { + indextoberemoved = focusindex+KFullScreenIterator; + if(indextoberemoved > count-1) + { + indextoberemoved = indextoberemoved-count; + } + } + GLX_LOG_INFO1("CGlxFullScreenViewImp::GetIndexToBeRemoved index tobe removed %d",indextoberemoved ); + return indextoberemoved; + } +// --------------------------------------------------------------------------- +// +// Remove the texture on every swipe while HDMI is connected. +// --------------------------------------------------------------------------- +// +void CGlxFullScreenViewImp::RemoveTexture() + { + TRACER("CGlxFullScreenViewImp::RemoveTexture"); + + const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved()); + iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/src/glxmediakeyutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/src/glxmediakeyutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2008-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: Command object factory +* +*/ + + + + +#include +#include +#include // CViaPlayerMediaKeyObserver +#include +#include + +#include "glxmediakeyutility.h" + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxMediaKeyUtility::CGlxMediaKeyUtility() + { + TRACER("CGlxMediaKeyUtility::CGlxMediaKeyUtility()"); + } + +// --------------------------------------------------------------------------- +// Destructor. Remove itself as a listner from the MediaKeyObserver +// --------------------------------------------------------------------------- +// +CGlxMediaKeyUtility::~CGlxMediaKeyUtility() + { + TRACER("CGlxMediaKeyUtility::~CGlxMediaKeyUtility()"); + TRAP_IGNORE( CViaPlayerMediaKeyObserver::StaticL().RemoveListener( this ); ); + } + +// --------------------------------------------------------------------------- +// NewLC - Standard two phase constructor placing itself on the cleanup stack +// --------------------------------------------------------------------------- +// +CGlxMediaKeyUtility* CGlxMediaKeyUtility::NewLC() + { + TRACER("CGlxMediaKeyUtility::NewLC()"); + CGlxMediaKeyUtility* self = new (ELeave) CGlxMediaKeyUtility(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// NewL - Standard two phase constructor +// --------------------------------------------------------------------------- +// +CGlxMediaKeyUtility* CGlxMediaKeyUtility::NewL() + { + TRACER("CGlxMediaKeyUtility::NewL()"); + CGlxMediaKeyUtility* self = CGlxMediaKeyUtility::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// ConstructL - Adds itsself as a media key listener +// --------------------------------------------------------------------------- +// +void CGlxMediaKeyUtility::ConstructL() + { + TRACER("CGlxMediaKeyUtility::ConstructL()"); + CViaPlayerMediaKeyObserver::StaticL().AddListenerL( this ); + } + +// --------------------------------------------------------------------------- +// MediaKeyEventL - The ViaPlayerMediaKeyObserver sends all RemCon key events +// here, where they get translated and dispatched +// --------------------------------------------------------------------------- +// +void CGlxMediaKeyUtility::MediaKeyEventL(TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) + { + TRACER("CGlxMediaKeyUtility::MediaKeyEventL()"); + TStdScanCode scanCode = TranslateKeyEvent(aOperationId); + DispatchKeyEvent(aButtonAct, scanCode); + } + + +// --------------------------------------------------------------------------- +// DoSimulateKeyEvent - Add key event to application queue +// --------------------------------------------------------------------------- +// +void CGlxMediaKeyUtility::DoSimulateKeyEvent(TRawEvent::TType aKeyCode, TStdScanCode aScanCode ) + { + TRACER("CGlxMediaKeyUtility::DoSimulateKeyEvent()"); + TRawEvent rawEvent; + rawEvent.Set(aKeyCode, aScanCode); + UserSvr::AddEvent(rawEvent); + } + +// --------------------------------------------------------------------------- +// TranslateKeyEvent - Translates RemCon keys into standard scan codes +// --------------------------------------------------------------------------- +// +TStdScanCode CGlxMediaKeyUtility::TranslateKeyEvent(TRemConCoreApiOperationId aOperationId) + { + TRACER("CGlxMediaKeyUtility::TranslateKeyEvent()"); + + TStdScanCode scanCode = EStdKeyNull; + + switch (aOperationId) + { + case ERemConCoreApiVolumeUp: + scanCode = EStdKeyIncVolume; + break; + + case ERemConCoreApiVolumeDown: + scanCode = EStdKeyDecVolume; + + break; + + default: + break; + } + + return scanCode; + } + +// --------------------------------------------------------------------------- +// DispatchKeyEvent - Interperets the button action and acts accordingly +// --------------------------------------------------------------------------- +// +void CGlxMediaKeyUtility::DispatchKeyEvent(TRemConCoreApiButtonAction aButtonAct, TStdScanCode aScanCode) + { + TRACER("CGlxMediaKeyUtility::DispatchKeyEvent()"); + + if (EStdKeyNull == aScanCode) + { + return; + } + + switch (aButtonAct) + { + case ERemConCoreApiButtonPress: + DoSimulateKeyEvent(TRawEvent::EKeyDown, aScanCode); + break; + + case ERemConCoreApiButtonRelease: + DoSimulateKeyEvent(TRawEvent::EKeyUp, aScanCode); + break; + + case ERemConCoreApiButtonClick: + DoSimulateKeyEvent(TRawEvent::EKeyDown, aScanCode); + DoSimulateKeyEvent(TRawEvent::EKeyUp, aScanCode); + break; + } + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/src/glxsinglelinemetapanecontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/src/glxsinglelinemetapanecontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,647 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Single Line metapane for Fulscreen view +* +*/ + + +// Avkon Headers +#include // String loader +#include // KDC_APP_RESOURCE_DIR +#include // For Path info +#include // Added for DriveInfo class +#include // Added for R_QTN_DATE_USUAL_WITH_ZERO +#include + +// Alf Headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Photos Headers +#include // Tracer logs +#include // Glx logs +#include // CGlxMedialist +#include // Converts the symbian types to UString type +#include // Attribute context +#include // Attribute fetch priority +#include // UiUtility Singleton +#include // FS resource +#include // icons +#include // Texturemanager +#include // Commandhandlers +#include // General utilties class definition +#include + +// User Includes +#include // User include + +// Contants and Literals +const TInt KGlxFullScreenControlGrpId =0x113; // This is the same control grp id used in FS view +const TInt KGridColoumns = 4; +const TInt KGridRows = 1; +const TReal KOpacityOpaque = 1.0; +const TReal KOpacityTransparent = 0.0; + +_LIT(KEmptyText, ""); +_LIT(KFormat, " "); +_LIT8(KTagLoc, "Loc"); +_LIT8(KTagFav, "Fav"); + +#define GetAppUi() (dynamic_cast(CEikonEnv::Static()->EikAppUi())) + + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CGlxSinleLineMetaPane* CGlxSinleLineMetaPane::NewL(CGlxFullScreenViewImp& aFullscreenView, + MGlxMediaList& aMediaList, CGlxUiUtility& aUiUtility) + { + TRACER("CGlxSinleLineMetaPane* CGlxSinleLineMetaPane::NewL()"); + CGlxSinleLineMetaPane* self = new (ELeave) CGlxSinleLineMetaPane(aFullscreenView, + aMediaList, aUiUtility); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// CGlxSinleLineMetaPane() constructor +// --------------------------------------------------------------------------- +// +CGlxSinleLineMetaPane::CGlxSinleLineMetaPane(CGlxFullScreenViewImp& aFullscreenView, + MGlxMediaList& aMediaList, CGlxUiUtility& aUiUtility) :iFullscreenView(aFullscreenView), + iMediaList(aMediaList), iUiUtility(aUiUtility) + { + TRACER("CGlxSinleLineMetaPane* CGlxSinleLineMetaPane::NewL()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::ConstructL() + { + TRACER("CGlxSinleLineMetaPane::ConstructL()"); + // Construct the base class. + // Get the icon file + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + + iEnv = iUiUtility.Env(); + CAlfControl::ConstructL(*iEnv); + + CAlfTexture& backgroundTexture = iUiUtility.GlxTextureManager().CreateIconTextureL( + EMbmGlxiconsQgn_lgal_bg, resFile ) ; + //----------------------- LAYOUT HIERARCHY ------------------------------- + // + // ->iDateTextVisual + // | + // | + // |->iFavIconImageVisual + // | + // iMainVisual-->iGridVisual-> + // |->iMapIconImageVisual + // | + // | + // ->iLocationTextVisual + //------------------------------------------------------------------------- + + iMainVisual = CAlfAnchorLayout::AddNewL(*this); + + // BackGround Border Image Visual + iBackgroundBorderImageVisual = CAlfImageVisual::AddNewL(*this,iMainVisual); + iBackgroundBorderImageVisual->EnableBrushesL(); + iBackgroundBorderImageVisual->SetImage(TAlfImage(backgroundTexture)); + + iBackgroundBorderImageVisual->SetOpacity( 0.6 ); + + iGridVisual = CAlfGridLayout::AddNewL(*this, KGridColoumns, KGridRows, iMainVisual); + CAlfControlGroup* group =&iEnv->ControlGroup(KGlxFullScreenControlGrpId); + group->AppendL(this); + + // Create a 1 pixel Border brush and append it to the background visual + CAlfBorderBrush* borderBrush= CAlfBorderBrush::NewLC(*iEnv, 1, 1, 0, 0); + borderBrush->SetColor(KRgbWhite); + iBackgroundBorderImageVisual->Brushes()->AppendL(borderBrush, EAlfHasOwnership); + CleanupStack::Pop(borderBrush); + + iMediaList.AddMediaListObserverL( this ); + // Set up and add the context + iAttribContext = CGlxDefaultAttributeContext::NewL(); + // add all the attributes needed in handleattributes available + // this is because even + iAttribContext->AddAttributeL( KMPXMediaGeneralDate ); + iAttribContext->AddAttributeL( KGlxMediaGeneralLocation ); + + // Using priority as same as UMP view's album pane + iMediaList.AddContextL( iAttribContext, KGlxFetchContextPriorityLow ); + + // Hide the Metapane at the initial start up, to avoid flicker + ShowMetaPane(EFalse); + + CreateGridL(); + + iMainVisual->SetFlag(EAlfVisualFlagManualLayout); + + // Update the pos and size of the visual + UpdatePosition(); + + // Create the Metapane + iSLMPFavMLObserver = CGlxSLMPFavMLObserver::NewL(*this, iMediaList.FocusIndex(), &iMediaList); + + // Update the Grid Visuals with initial Data + UpdateMetaPaneL(iMediaList.FocusIndex(), &iMediaList, ETrue); + // Setting the Flag to get layout change notifications + iMainVisual->SetFlag ( EAlfVisualFlagLayoutUpdateNotification); + + // Store the Current Screensize + iScreenSize = GetScreenSize(); + } + +// --------------------------------------------------------------------------- +// ~CGlxSinleLineMetaPane Destructor +// --------------------------------------------------------------------------- +// +CGlxSinleLineMetaPane::~CGlxSinleLineMetaPane() + { + TRACER("CGlxSinleLineMetaPane::~CGlxSinleLineMetaPane()"); + iMediaList.RemoveMediaListObserver(this); + if( iAttribContext ) + { + iMediaList.RemoveContext( iAttribContext ); + delete iAttribContext; + } + if (iMainVisual) + { + iMainVisual->RemoveAndDestroyAllD(); + iMainVisual = NULL; + } + if (iSLMPFavMLObserver) + { + delete iSLMPFavMLObserver; + iSLMPFavMLObserver= NULL; + } + } + +// --------------------------------------------------------------------------- +// CreateIconTextureAndUpdateVisualsL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::CreateIconTextureAndUpdateVisualsL() + { + TRACER("CGlxSinleLineMetaPane::CreateIconTextureAndUpdateVisualsL()"); + // Get the icon file + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + CGlxTextureManager& tm = (iUiUtility.GlxTextureManager()); + //Create the texture for broken thumbnail + iFavNotAddedIconTexture = &(tm.CreateIconTextureL( + EMbmGlxiconsQgn_lgal_fav2, resFile ) ) ; + iFavAddedIconTexture = &(tm.CreateIconTextureL( + EMbmGlxiconsQgn_lgal_fav1, resFile ) ); + CAlfTexture& locIconTexture = tm.CreateIconTextureL( + EMbmGlxiconsQgn_menu_maps, resFile ) ; + iLocIconImageVisual->SetImage(TAlfImage(locIconTexture)); + } + +// --------------------------------------------------------------------------- +// CreateGridL +// @bug :tapadar :major :This function is using magic numbers, would be corrected with updated LAF docs +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::CreateGridL() + { + TRACER("CGlxSinleLineMetaPane::CreateGridL()"); + + iGridVisual->SetPadding(TPoint(1,1)); + iGridVisual->SetInnerPadding( TPoint(1,1) ); + RArray weights; + CleanupClosePushL(weights); + + User::LeaveIfError(weights.Append(2)); + User::LeaveIfError(weights.Append(1)); + User::LeaveIfError(weights.Append(1)); + User::LeaveIfError(weights.Append(5)); + + iGridVisual->SetColumnsL(weights); + CleanupStack::PopAndDestroy(&weights); + + iDateTextVisual = CAlfTextVisual::AddNewL(*this,iGridVisual); + iDateTextVisual->SetStyle( EAlfTextStyleSmall, EAlfBackgroundTypeDark ); + iDateTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); + iDateTextVisual->SetTextL( KEmptyText ); + iDateTextVisual->SetAlign(EAlfAlignHLocale, EAlfAlignVCenter); + + iFavIconImageVisual= CAlfImageVisual::AddNewL(*this,iGridVisual); + iFavIconImageVisual->SetScaleMode(CAlfImageVisual::EScaleFitInside); + iFavIconImageVisual->SetTagL(KTagFav); + CAlfBorderBrush* borderBrush= CAlfBorderBrush::NewLC(*iEnv, 1, 1, 0, 0); + borderBrush->SetColor(KRgbWhite); + borderBrush->SetOpacity(0.35f); + iFavIconImageVisual->EnableBrushesL(); + iFavIconImageVisual->Brushes()->AppendL(borderBrush, EAlfHasOwnership); + CleanupStack::Pop(borderBrush); + + iLocIconImageVisual = CAlfImageVisual::AddNewL(*this,iGridVisual); + iLocIconImageVisual->SetScaleMode(CAlfImageVisual::EScaleFitInside); + + // Creates the Icon Textures and Updates the Favourite and Loc Icon Visuals + CreateIconTextureAndUpdateVisualsL(); + + iLocationTextVisual = CAlfTextVisual::AddNewL(*this,iGridVisual); + iLocationTextVisual->SetStyle( EAlfTextStyleSmall, EAlfBackgroundTypeDark ); + iLocationTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); + HBufC* noLocationInfo = + StringLoader::LoadLC(R_FULLSCREEN_NO_LOCATION_INFO); + iLocationTextVisual->SetTextL(*noLocationInfo); + CleanupStack::PopAndDestroy(noLocationInfo ); + iLocationTextVisual->SetTagL(KTagLoc); + iLocationTextVisual->SetAlign(EAlfAlignHLocale, EAlfAlignVCenter); + } + +// --------------------------------------------------------------------------- +// ShowMetaPane +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::ShowMetaPane(TBool aShow) + { + TRACER("CGlxSinleLineMetaPane::ShowMetaPane()"); + GLX_LOG_INFO1("CGlxSinleLineMetaPane::ShowMetaPane() value %d",aShow); + if(aShow) + { + iMainVisual->SetOpacity(KOpacityOpaque); + } + else + { + iMainVisual->SetOpacity(KOpacityTransparent); + } + } + +// --------------------------------------------------------------------------- +// OfferEventL +// --------------------------------------------------------------------------- +// +TBool CGlxSinleLineMetaPane::OfferEventL(const TAlfEvent &aEvent) + { + TRACER("CGlxSinleLineMetaPane::OfferEventL()"); + TBool consumed = EFalse; + + if (aEvent.IsKeyEvent()) + { + GLX_LOG_INFO( "CGlxSinleLineMetaPane::OfferEventL::KeyEvent"); + } + + // Dont handle if not visible. [HACK ALERT]: This might probably be a hack. + // Further investigation needed. + if (KOpacityTransparent == iMainVisual->Opacity().ValueNow()) + { + return consumed; + } + + if(aEvent.IsPointerEvent() && aEvent.PointerDown() ) + { + GLX_LOG_INFO( "CGlxSinleLineMetaPane::OfferEventL::PointerEvent"); + CAlfVisual* onVisual = NULL; + onVisual = aEvent.Visual(); + if(AlfUtil::TagMatches(onVisual->Tag(), KTagFav)) + { + GLX_LOG_INFO( "CGlxSinleLineMetaPane::OfferEventL::PointerEvent - KTagFav"); + if (iFavIconStatus) + { + GLX_LOG_INFO( "CGlxSinleLineMetaPane::OfferEventL::PointerEvent - Already Fav"); + iFullscreenView.HandleCommandL(EGlxCmdRemoveFromFavourites,this); + } + else + { + GLX_LOG_INFO( "CGlxSinleLineMetaPane::OfferEventL::PointerEvent - Add to Fav"); + iFullscreenView.HandleCommandL(EGlxCmdAddToFavourites,this); + } + consumed = ETrue; + } + else if (AlfUtil::TagMatches(onVisual->Tag(), KTagLoc)) + { + GLX_LOG_INFO( "CGlxSinleLineMetaPane::OfferEventL::PointerEvent - KTagLoc , Location info present"); + iFullscreenView.HandleCommandL(KGlxCmdMnShowMap,this); + consumed = ETrue; + } + } + return consumed; + } + +// --------------------------------------------------------------------------- +// VisualLayoutUpdated +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::VisualLayoutUpdated(CAlfVisual&/* aVisual*/) + { + TRACER("CGlxSinleLineMetaPane::VisualLayoutUpdated()"); + // Update the Screen positions only if the layout has changed. + // For performace improvement + TRect presentScreenSize = GetScreenSize(); + if (iScreenSize.Width() != presentScreenSize.Width()) + { + UpdatePosition(); + iScreenSize = presentScreenSize; + } + } + +// --------------------------------------------------------------------------- +// DetermineOrientation +// --------------------------------------------------------------------------- +// +TInt CGlxSinleLineMetaPane::DetermineOrientation(TRect aRect) + { + TRACER("CGlxSinleLineMetaPane::DetermineOrientation()"); + TInt orientationValue = (aRect.Width()>aRect.Height()?EMetaOrinentaionLandscape: + EMetaOrinentaionPortrait); + return orientationValue; + } + +// --------------------------------------------------------------------------- +// GetScreenSize +// --------------------------------------------------------------------------- +// +TRect CGlxSinleLineMetaPane::GetScreenSize() + { + TRACER("CGlxSinleLineMetaPane::GetScreenSize()"); + return AlfUtil::ScreenSize(); + } +// --------------------------------------------------------------------------- +// UpdatePosition +// @bug :tapadar :major :This function is using magic numbers, would be corrected with updated LAF docs +// @bug :tapadar :major :This function needs to be worked upon across corrolla and ivalo once LAF present +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::UpdatePosition() + { + TRACER("CGlxSinleLineMetaPane::UpdatePosition()"); + TRect rect = GetScreenSize(); + TInt screenWidth = rect.Width(); + TInt screenHeight = rect.Height(); + TInt orientation = DetermineOrientation(rect); + // Switch off the Flag for layout update notification, else a change in size/pos + // will call VisualLayoutUpdated multiple times. + iMainVisual->ClearFlag( EAlfVisualFlagLayoutUpdateNotification); + if (EMetaOrinentaionPortrait == orientation) + { + GLX_LOG_INFO("CGlxSinleLineMetaPane::UpdatePosition - EMetaOrinentaionPortrait Orientation"); + CAknToolbar* toolbar = GetAppUi()->CurrentFixedToolbar(); + + if (toolbar->IsToolbarDisabled()) + { + //set the control size + iMainVisual->SetSize(TSize(screenWidth-6,45)); + iMainVisual->SetPos(TAlfRealPoint(3,screenHeight-100)); + } + else + { + //set the control size + iMainVisual->SetSize(TSize(screenWidth-6,45)); + iMainVisual->SetPos(TAlfRealPoint(3,screenHeight-160)); + } + } + else if(EMetaOrinentaionLandscape == orientation) + { + GLX_LOG_INFO("CGlxSinleLineMetaPane::UpdatePosition - EMetaOrinentaionLandscape Orientation"); + //set the control size + iMainVisual->SetSize(TSize(screenWidth-100,45)); + iMainVisual->SetPos(TAlfRealPoint(3,screenHeight-45)); + } + else + { + GLX_LOG_INFO("CGlxSinleLineMetaPane::UpdatePosition - Wrong Orientation"); + } + iMainVisual->SetFlag ( EAlfVisualFlagLayoutUpdateNotification); + } + +// --------------------------------------------------------------------------- +// UpdateMetaPaneL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::UpdateMetaPaneL(TInt aFocusIndex, MGlxMediaList* aList, + TBool aUpdateFavIcon) + { + TRACER("CGlxSinleLineMetaPane::UpdateMetaPaneL()"); + + const TGlxMedia& item = aList->Item(aFocusIndex); + const CGlxMedia* media = item.Properties(); + CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); + CleanupStack::PushL(stringConverter ); + HBufC* dataString = NULL; + + if (media->IsSupported(KMPXMediaGeneralDate)) + { + // R_QTN_DATE_USUAL is for the Date of format 08/02/1982 type + stringConverter->AsStringL( item, KMPXMediaGeneralDate,R_QTN_DATE_USUAL, + dataString ); + if (dataString) + { + iDateTextVisual->SetTextL(*dataString); + } + } + if (media->IsSupported(KGlxMediaGeneralLocation)) + { + stringConverter->AsStringL( item, KGlxMediaGeneralLocation,0, dataString ); + if (dataString->Compare(KFormat) != 0) + { + iLocationTextVisual->SetTextL(*dataString); + } + } + else + { + HBufC* noLocationInfo = + StringLoader::LoadLC(R_FULLSCREEN_NO_LOCATION_INFO); + iLocationTextVisual->SetTextL(*noLocationInfo); + CleanupStack::PopAndDestroy(noLocationInfo ); + } + delete dataString; + dataString = NULL; + CleanupStack::PopAndDestroy(stringConverter ); + + // Setting the not created icon to the FavIcon initially, would update it once available + // through HandleObjectChangeL + if (aUpdateFavIcon) + { + iFavIconStatus = EFalse; + iFavIconImageVisual->SetImage(TAlfImage(*iFavNotAddedIconTexture)); + } + } + +// --------------------------------------------------------------------------- +// HandleUpdateIconL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleUpdateIconL(TBool aModify) + { + TRACER("CGlxSinleLineMetaPane::HandleUpdateIconL()"); + // Check if the item is added to favourites already + if (aModify) + { + iFavIconStatus = ETrue; + iFavIconImageVisual->SetImage(TAlfImage(*iFavAddedIconTexture)); + } + else + { + iFavIconStatus = EFalse; + iFavIconImageVisual->SetImage(TAlfImage(*iFavNotAddedIconTexture)); + } + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSinleLineMetaPane::HandleItemAddedL()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// HandleItemRemovedL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleItemRemovedL( TInt/* aStartIndex*/, + TInt/* aEndIndex*/, MGlxMediaList*/* aList */) + { + TRACER("CGlxSinleLineMetaPane::HandleItemRemovedL()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleAttributesAvailableL( TInt aItemIndex, + const RArray& /*aAttributes*/, MGlxMediaList* aList ) + { + TRACER("CGlxSinleLineMetaPane::HandleAttributesAvailableL()"); + + TInt focusIndex = iMediaList.FocusIndex(); + GLX_LOG_INFO2("CGlxSinleLineMetaPane::HandleAttributesAvailableL FocusIndex is : %d and ItemIdex is : %d", + focusIndex, aItemIndex); + + // Update the metapane only for the focus Index, do not make unnecessary calls. + // for focus change, we would get calls to HandleFocusChange and thus would update + // metapane from there. + if (aItemIndex == focusIndex) + { + UpdateMetaPaneL(focusIndex, aList); + } + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, +TInt aNewIndex, TInt /*aOldIndex*/, MGlxMediaList* aList ) + { + TRACER("CGlxSinleLineMetaPane::HandleFocusChangedL()"); + // Check the count here to ensure the medialist is present + // this case may be occurred when the last item of the Fs view is deleted and it + // wants to go back to the grid view + if (aList->Count()) + { + if (iSLMPFavMLObserver) + { + delete iSLMPFavMLObserver; + iSLMPFavMLObserver= NULL; + iSLMPFavMLObserver = CGlxSLMPFavMLObserver::NewL(*this, aList->FocusIndex(), aList); + } + // Update the Metapane on Focus change + UpdateMetaPaneL(aNewIndex, aList, ETrue); + } + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleItemSelectedL(TInt/* aIndex*/, TBool/* aSelected*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSinleLineMetaPane::HandleItemSelectedL()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// HandleMessageL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList*/* aList */) + { + TRACER("CGlxSinleLineMetaPane::HandleMessageL()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// HandleError +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleError( TInt /*aError*/ ) + { + TRACER("CGlxSinleLineMetaPane::HandleError()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// HandleCommandCompleteL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList*/* aList */) + { + TRACER("CGlxSinleLineMetaPane::HandleCommandCompleteL()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// HandleMediaL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList*/* aList */) + { + TRACER("CGlxSinleLineMetaPane::HandleMediaL()"); + // No Implementation + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL +// --------------------------------------------------------------------------- +// +void CGlxSinleLineMetaPane::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList*/* aList */) + { + TRACER("CGlxSinleLineMetaPane::HandleItemModifiedL()"); + // No Implementation + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/fullscreenview/src/glxslmpfavmlobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/fullscreenview/src/glxslmpfavmlobserver.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Single line meta pane favourites observer +* +*/ + +#include // Albums collection plugin implementation id +#include // FilterFactory +#include // CGlxMedialist +#include // Attribute context +#include // Attribute fetch priority +#include +#include +#include + +// --------------------------------------------------------------------------- +// NewL() +// --------------------------------------------------------------------------- +// +CGlxSLMPFavMLObserver* CGlxSLMPFavMLObserver::NewL( CGlxSinleLineMetaPane& aSingleLineMetapane, + TInt aFocusIndex, MGlxMediaList* aList) + { + TRACER("CGlxSLMPFavMLObserver::NewL()"); + CGlxSLMPFavMLObserver* self = new(ELeave) CGlxSLMPFavMLObserver(aSingleLineMetapane); + CleanupStack::PushL(self); + self->ConstructL(aFocusIndex, aList); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// CGlxSLMPFavMLObserver() +// --------------------------------------------------------------------------- +// +CGlxSLMPFavMLObserver::CGlxSLMPFavMLObserver(CGlxSinleLineMetaPane& aSingleLineMetaPane) + : iSingleLineMetaPane( aSingleLineMetaPane) + { + TRACER("CGlxSLMPFavMLObserver::CGlxSLMPFavMLObserver()"); + // Nothing done here + } + +// --------------------------------------------------------------------------- +// ~CGlxSLMPFavMLObserver() +// --------------------------------------------------------------------------- +// +CGlxSLMPFavMLObserver::~CGlxSLMPFavMLObserver() + { + TRACER("CGlxSLMPFavMLObserver::~CGlxSLMPFavMLObserver()"); + if (iFavMediaList) + { + iFavMediaList->RemoveMediaListObserver(this); + iFavMediaList->RemoveContext( iFavAttribContext ); + delete iFavAttribContext; + iFavMediaList->Close(); + } + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::ConstructL(TInt aFocusIndex, MGlxMediaList* aList) + { + TRACER("CGlxSLMPFavMLObserver::ConstructL()"); + CMPXCollectionPath* favCollection = CMPXCollectionPath::NewL(); + CleanupStack::PushL(favCollection); + // The target collection has to be appeneded with the albums plugin id + favCollection->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + // The target collection has also to be appeneded with the the relation id. + // appending another level into the albums to get favourites and 1 is the relation id of albums + favCollection->AppendL( TMPXItemId(1) ); + favCollection->Set( 0 ); + const TGlxMedia& item = aList->Item(aFocusIndex); + const TDesC& uri = item.Uri(); + CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(item.Uri()); + CleanupStack::PushL(filter); + + // Create the media list + iFavMediaList = MGlxMediaList::InstanceL( *favCollection, + TGlxHierarchyId(KGlxCollectionPluginAlbumsDllUid), filter ); + CleanupStack::PopAndDestroy( filter ); + CleanupStack::PopAndDestroy( favCollection ); + iFavMediaList->AddMediaListObserverL(this); + iFavAttribContext = CGlxDefaultAttributeContext::NewL(); + // add all the attributes needed in handleattributes available + // this is because even + iFavAttribContext->AddAttributeL( KMPXMediaGeneralCount ); + // Using priority as same as UMP view's album pane + iFavMediaList->AddContextL( iFavAttribContext, KGlxFetchContextPriorityLow ); + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleAttributesAvailableL(TInt/* aItemIndex*/, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxSLMPFavMLObserver::HandleAttributesAvailableL()"); + // No Implementation Required + } + +// --------------------------------------------------------------------------- +// HandleItemAddedL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* aList ) + { + TRACER("CGlxSLMPFavMLObserver::HandleItemAddedL()"); + GLX_LOG_INFO1("CGlxSLMPFavMLObserver::HandleItemAddedL() medialist count = %d", aList->Count()); + // Passing ETrue as mediacount denotes item present in medialist + iSingleLineMetaPane.HandleUpdateIconL(ETrue); + } + +// --------------------------------------------------------------------------- +// HandleItemRemovedL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleItemRemovedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList */) + { + TRACER("CGlxSLMPFavMLObserver::HandleItemRemovedL()"); + // Passing EFalse as mediacount 0 denotes item not present in medialist + iSingleLineMetaPane.HandleUpdateIconL(EFalse); + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSLMPFavMLObserver::HandleFocusChangedL()"); + // No Implementation Required + } + +// --------------------------------------------------------------------------- +// HandleItemSelectedL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSLMPFavMLObserver::HandleItemSelectedL()"); + // No Implementation Required + } + +// --------------------------------------------------------------------------- +// HandleMessageL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSLMPFavMLObserver::HandleMessageL()"); + // No Implementation Required + } + +// --------------------------------------------------------------------------- +// HandleError() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleError( TInt /*aError*/ ) + { + TRACER("CGlxSLMPFavMLObserver::HandleError()"); + // No Implementation Required + } + +// --------------------------------------------------------------------------- +// HandleCommandCompleteL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSLMPFavMLObserver::HandleCommandCompleteL()"); + // No Implementation Required + } + +// --------------------------------------------------------------------------- +// HandleMediaL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSLMPFavMLObserver::HandleMediaL()"); + // No Implementation Required + } + +// --------------------------------------------------------------------------- +// HandleItemModifiedL() +// --------------------------------------------------------------------------- +// +void CGlxSLMPFavMLObserver::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxSLMPFavMLObserver::HandleItemModifiedL()"); + // No Implementation Required + } + + +//EOF diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/bwins/glxgridviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/bwins/glxgridviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ?NewL@CGlxGridView@@SAPAV1@PAVMGlxMediaListFactory@@ABVTGridViewResourceIds@@HABVTDesC16@@@Z @ 1 NONAME ; class CGlxGridView * CGlxGridView::NewL(class MGlxMediaListFactory *, class TGridViewResourceIds const &, int, class TDesC16 const &) + ?NewL@CGlxGridViewMLObserver@@SAPAV1@AAVMGlxMediaList@@PAVCHgGrid@@@Z @ 2 NONAME ; class CGlxGridViewMLObserver * CGlxGridViewMLObserver::NewL(class MGlxMediaList &, class CHgGrid *) + ?NewLC@CGlxGridView@@SAPAV1@PAVMGlxMediaListFactory@@ABVTGridViewResourceIds@@HABVTDesC16@@@Z @ 3 NONAME ; class CGlxGridView * CGlxGridView::NewLC(class MGlxMediaListFactory *, class TGridViewResourceIds const &, int, class TDesC16 const &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/eabi/glxgridviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/eabi/glxgridviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _ZN12CGlxGridView4NewLEP20MGlxMediaListFactoryRK20TGridViewResourceIdsiRK7TDesC16 @ 1 NONAME + _ZN12CGlxGridView5NewLCEP20MGlxMediaListFactoryRK20TGridViewResourceIdsiRK7TDesC16 @ 2 NONAME + _ZN22CGlxGridViewMLObserver4NewLER13MGlxMediaListP7CHgGrid @ 3 NONAME + _ZTI21CGlxGridViewContainer @ 4 NONAME ; ## + _ZTI22CGlxGridViewMLObserver @ 5 NONAME ; ## + _ZTV21CGlxGridViewContainer @ 6 NONAME ; ## + _ZTV22CGlxGridViewMLObserver @ 7 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/group/glxgridview.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/group/glxgridview.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxgridview.dll +TARGETTYPE dll +UID 0x1000008d 0x200009EF + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxgridviewimp.cpp +SOURCE glxgridview.cpp +SOURCE glxgridviewmlobserver.cpp +SOURCE glxgridviewcontainer.cpp + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../../viewbase/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../drmutility/inc +SYSTEMINCLUDE ../../../visuallistmanager/inc +SYSTEMINCLUDE ../../../dataprovider/inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY avkon.lib // CAknView +LIBRARY cone.lib // MCoeView +LIBRARY commonengine.lib // StringLoader +LIBRARY eikcoctl.lib // CEikMenuBar +LIBRARY eikcore.lib // CEikMenuBar +LIBRARY euser.lib // RAllocator +LIBRARY glxmedialists.lib // CGlxMedialist +LIBRARY glxuiutilities.lib // UiUtilities +LIBRARY glxviewbase.lib // MedilaistViewBsse +LIBRARY glxcommonui.lib // for NGlxZoomStatePublisher::PublishStateL +LIBRARY mpxcommon.lib // Mpx Attributes +LIBRARY flogger.lib // For Logging Tracer +LIBRARY glxdrmutility.lib // For Drm Utility +LIBRARY ganes.lib +LIBRARY fbscli.lib +LIBRARY aknicon.lib +LIBRARY egul.lib alfclient.lib +LIBRARY aknskins.lib +LIBRARY featmgr.lib // FeatureManager + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/inc/glxgridview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/inc/glxgridview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2008-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: Tile view implementation +* +*/ + + + + + +#ifndef C_GLXGRIDVIEW_H +#define C_GLXGRIDVIEW_H + + +// INCLUDES +#include + +class MGlxMediaListFactory; + + class TGridViewResourceIds + { + public: + TInt iViewId; // a AVKON_VIEW + TInt iMenuId; // a MENU_PANE + TInt iCbaId; // a CBA + TInt iEmptyViewTextId; // a TBUF + TInt iOkOptionsMenuId; + }; + +// CLASS DECLARATION + +/** + * Tile view + * + * @lib glxtileview.lib + */ +NONSHARABLE_CLASS(CGlxGridView) : public CGlxMediaListViewBase//, public MGlxLayoutOwner + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + IMPORT_C static CGlxGridView* NewL(MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle = KNullDesC()); + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + IMPORT_C static CGlxGridView* NewLC(MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle = KNullDesC()); + + /** + * Destructor. + */ + virtual ~CGlxGridView(); + }; + +#endif // C_GLXTILEVIEW_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/inc/glxgridviewcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/inc/glxgridviewcontainer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2008-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: Grid view control class + * + */ + + + + +#ifndef CGLXGRIDVIEWCONTROL_H +#define CGLXGRIDVIEWCONTROL_H + +#include +// Ganes observerers +#include +#include +#include + +// Photos Headers +#include +#include // Interface for going through items in +#include // MGlxMediaListFactory + +#include +#include +#include "glxgridvieweventobserver.h" + +class CHgGrid; +class CGlxUiUtility; +class CGlxGridViewMLObserver; +class CGlxActiveMediaListRegistry; +class CGlxThumbnailContext; +class CGlxDRMUtility; +class CAknsBasicBackgroundControlContext; +class CGlxNavigationalState; + +//class declaration + +class CGlxGridViewContainer : public CCoeControl, + public MHgScrollBufferObserver, + public MHgSelectionObserver, + public MHgMarkingObserver + { +public: + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxGridViewContainer *NewL(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility,MGlxGridEventObserver& aObserver ); + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxGridViewContainer *NewLC(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility,MGlxGridEventObserver& aObserver); + + //destructor + ~CGlxGridViewContainer(); + + + TBool HandleViewCommandL(TInt aCommand); +protected: // from MHgScrollBufferObserver + void Request(TInt aRequestStart, TInt aRequestEnd, THgScrollDirection aDirection); + void Release(TInt aReleaseStart, TInt aReleaseEnd); + +protected: // from MHgSelectionObserver + void HandleSelectL( TInt aIndex ); + void HandleOpenL( TInt aIndex ); + +protected: // from MHgMarkingObserver + + void HandleMarkingL( TInt aIndex, TBool aMarked ); + +public: // From CCoeControl + + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); + + //handle orientaion realted changes + void HandleResourceChange(TInt aType); +private: + /** + * C++ default constructor. + */ + CGlxGridViewContainer(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility,MGlxGridEventObserver& aObserver); + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + void RequestL(TInt aRequestStart, TInt aRequestEnd); + + //create grid + void CreateGridL(); + + /** + * Set grid thumbnail context with BlokyIterator to fetch + * grid thumbnails + */ + void SetGridThumbnailContextL(); + + // Create HG Grid widget + void CreateHgGridWidgetL(); + + // Create an observer and pass MediaList and HGGrid objects + void CreateGridMediaListObserverL(); + + // Create Grid once again after returning from FS as No calls for handleItem added. + void CreateGridAfterFSDeactivatedL(); + /** + * Set FS thumbnail context with FromFocusOutwardIterator + * for FS thumbnails + */ + void FetchFSThumbnailL(); + /** + * Set the Time stamp for Scrollbar Time Strip + */ + void SetDownloadLinksTimeL(); + /** + * Removes the thumbnail contexts for FS + */ + void RemoveFSThumbnailContext(); + /** + * Handle Multiple marking + */ + void HandleMultipleMarkingL(TInt aIndex , TBool aMarked ); + /** + * Set the Icons + */ + void SetIconsL(TInt index); + + //handle enterkey realted events + void HandleEnterKeyEventL(TInt aCommand); + + /** + * Checks the availability of relevant thumbnail(Quality or Speed) attribute + * @param aIndex Media index to check the thumbnail attribute + * @return ETrue if relevant thumbnail available + * EFalse if relevant thumbnail not available + */ + TBool HasRelevantThumbnail(TInt aIndex); + +private: + //medialist + MGlxMediaList* iMediaList; // MGlxMedialist , to Create MediaList + + //Drmutility + CGlxUiUtility* iUiUtility; + + //No of visible items in a page/view + TInt iItemsPerPage; + + // HG Grid instance + CHgGrid* iHgGrid; + + // Medialist observer for Grid view + CGlxGridViewMLObserver* iGlxGridMLObserver; + + /// Active media list registry stores the pointer to the active media list + /// Allows UPnP to know when list has changed + CGlxActiveMediaListRegistry* iActiveMediaListRegistry; + + // Thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + // FS thumbnail context + CGlxThumbnailContext* iFsThumbnailContext; + + // Iterators for Grid and FS + TGlxFromManualIndexBlockyIterator iBlockyIterator; + TGlxFromFocusOutwardIterator iFsFromFocusOutwardIterator; + + // Grid Icon size from FS view + TSize iGridIconSize; + + // Flag to indicate the downloads plugin + TBool iDownloadsPlugin; + + // Bool to check backward navigation + TBool iBackwardActivation; + + // Provides DRM related functionality + CGlxDRMUtility* iDRMUtility; + + // Background context for the themes to be used in MopSupplyObject + CAknsBasicBackgroundControlContext* iBgContext; //Own + + //Grid Thumbnail Attribs + TMPXAttribute iQualityTnAttrib; + TMPXAttribute iSpeedTnAttrib; + + // Making the default FSActivation as false + TBool iFullscreenViewActivated; + + // Navigational state need to be changed while launching fullscreen + CGlxNavigationalState* iNavigationalstate; + + // making the default mode of marking as false + TBool iMultipleMarkingActive ; + + //flag to prevent call to HandleOpen( ) on multiple tap for video + TBool iIsFSVideoViewActivating; + + //observer + MGlxGridEventObserver& iGlxGridViewObserver; + }; + +#endif // CGLXGRIDVIEWCONTROL_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/inc/glxgridvieweventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/inc/glxgridvieweventobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008-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 : Grid view events Observers +* +*/ + + +#ifndef GLXGRIDVIEWEVENTOBSERVER_H_ +#define GLXGRIDVIEWEVENTOBSERVER_H_ + + +class MGlxGridEventObserver + { +public : + virtual void HandleGridEventsL(TInt aCmd) = 0; + virtual void HandleLatchToolbar() = 0; + }; + +#endif //GLXGRIDVIEWEVENTOBSERVER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/inc/glxgridviewimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/inc/glxgridviewimp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2008-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: Grid view implementation +* +*/ + +#ifndef C_GLXGRIDLVIEWIMP_H +#define C_GLXGRIDLVIEWIMP_H + +// INCLUDES +#include +#include + +#include +#include // for NGlxListDefs::TFocusChangeType + +// INCLUDES +#include "glxgridview.h" +#include "glxgridviewcontainer.h" + +// FORWARD DECLARATIONS +class CGlxActiveMediaListRegistry; +class MGlxMediaListFactory; +class CGlxDefaultAttributeContext; + +// CLASS DECLARATION +/** + * MPX collection view. + * + * @lib glxgridview.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS(CGlxGridViewImp) : public CGlxGridView + ,public MGlxGridEventObserver + { +public: + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxGridViewImp* NewL(MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle); + + /** + * Two-phased constructor. + * + * @since 3.0 + * @return Pointer to newly created object. + */ + static CGlxGridViewImp* NewLC(MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle); + + /** + * Destructor. + */ + virtual ~CGlxGridViewImp(); + +public: // From CGlxViewBase + TBool HandleViewCommandL(TInt aCommand); + +public: // From CGlxMediaListViewBase + void DoMLViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + void DoMLViewDeactivate(); + +public: // from MGlxGridEventObserver + void HandleGridEventsL(TInt aCmd); + void HandleLatchToolbar(); + +private:// from base class CAknView + TUid Id() const; + + void HandleForegroundEventL(TBool aForeground); + +private: + /** + * C++ default constructor. + */ + CGlxGridViewImp(const TGridViewResourceIds& aResourceIds, TInt aViewUID); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(MGlxMediaListFactory* aMediaListFactory, + const TDesC& aTitle); + + void DestroyGridWidget(); + +private:// Data + + TGridViewResourceIds iResourceIds; + /// UID of the plugin creating the Grid view + TInt iViewUID; + + /// Active media list registry stores the pointer to the active media list + /// Allows UPnP to know when list has changed + CGlxActiveMediaListRegistry* iActiveMediaListRegistry; + + /// Previous navigation + NGlxListDefs::TFocusChangeType iPreviousFocusChangeType; + + // save title text + HBufC* iTitletext; + + //Create control + CGlxGridViewContainer* iGlxGridViewContainer; + }; + +#endif // C_GLXGRIDLVIEWIMP_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/inc/glxgridviewmlobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/inc/glxgridviewmlobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2008-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 : Grid view Observers +* +*/ + + +#ifndef GLXGRIDVIEWMLOBSERVER_H_ +#define GLXGRIDVIEWMLOBSERVER_H_ + +// Photos Headers +#include + +// FORWARD DECLARATIONS +class CGlxMediaList; +class CHgGrid; +class CGlxDRMUtility; +//class CHgContextUtility; + +// CLASS DECLARATION +class CGlxGridViewMLObserver: public CBase, + public MGlxMediaListObserver + + { +public: + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + IMPORT_C static CGlxGridViewMLObserver* NewL(MGlxMediaList& aMediaList, + CHgGrid* aHgGrid); + + /** + * Destructor. + */ + virtual ~CGlxGridViewMLObserver(); + +public: // from MGlxMediaListObserver + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + void HandleError( TInt aError ); + void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, + MGlxMediaList* aList ); + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + void HandlePopulatedL( MGlxMediaList* aList ); + +private: + + /** + * C++ default constructor. + */ + CGlxGridViewMLObserver(MGlxMediaList& aMediaList,CHgGrid* aHgGrid); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * HandleErrorL is added to make the compiler happy by reducing codescanner warnings + * No extra purpose + */ + void HandleErrorL(); + + /** + * Checks the availability of relevant thumbnail(Quality or Speed) attribute + * @param aIndex Media index to check the thumbnail attribute + * @return ETrue if relevant thumbnail available + * EFalse if relevant thumbnail not available + */ + TBool HasRelevantThumbnail(TInt aIndex); + + /** + * RefreshScreen - Refreshes the Hg Grid based on the attributes available index + * + */ + void RefreshScreen(TInt aItemIndex,const RArray& aAttributes); + + /** + * UpdateItemsL - Update the items with the DRM/video icon and date/time + * + */ + void UpdateItemsL (TInt aItemIndex,const RArray& aAttributes); + +private: + + MGlxMediaList& iMediaList; + + // Instance of HG Grid + CHgGrid* iHgGrid; + + // Provides DRM related functionality + CGlxDRMUtility* iDRMUtility; + + TSize iGridIconSize; + + //No of visible items in a page/view + TInt iItemsPerPage; + + // Flag to indicate the downloads plugin + TBool iDownloadsPlugin; + + // Modified Indexes array to refresh the screen + RArray iModifiedIndexes; + +// CHgContextUtility* iContextUtility; + + //Grid Thumbnail Attribs + TMPXAttribute iQualityTnAttrib; + TMPXAttribute iSpeedTnAttrib; + }; +#endif //GLXGRIDVIEWMLOBSERVER_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/src/glxgridview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/src/glxgridview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Grid view +* +*/ + + + + + +// INCLUDE FILES +#include "glxgridview.h" +#include "glxgridviewimp.h" +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxGridView* CGlxGridView::NewL(MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle) + { + GLX_LOG_INFO("CGlxGridView::NewL()"); + return CGlxGridViewImp::NewL(aMediaListFactory, + aResourceIds, + aViewUID, + aTitle); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxGridView* CGlxGridView::NewLC(MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle) + { + GLX_LOG_INFO("CGlxGridView::NewLC()"); + return CGlxGridViewImp::NewLC(aMediaListFactory, + aResourceIds, + aViewUID, + aTitle); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxGridView::~CGlxGridView() + { + GLX_LOG_INFO("CGlxGridView::~CGlxGridView()"); + // Do nothing + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/src/glxgridviewcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/src/glxgridviewcontainer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1006 @@ +/* + * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation of Grid view control + * + */ +#include // For AknLayoutUtils to calculate rect +#include +#include +#include +#include +#include // Feature Manager + +// Ganes Headers +#include // Gul Icons +#include // HG Items +#include // Hg Grid Widget + +// Framework +#include +#include +#include // For EGlxCmdFullScreenBack +#include // All item collection plugin id + + +#include // For Navigational State +#include // MGlxMediaList, CMPXCollectionPath +#include // For UiUtility instance +#include // DRM utility class to provide DRM-related functionality +#include // For CGlxErrormanager +#include // KGlxMediaIdThumbnail +#include // Gridview resource +#include // For Corrupted and not created icons + +#include "glxgridviewcontainer.h" +#include "glxgridviewimp.h" +#include "glxgridviewmlobserver.h" // medialist observer for Hg Grid + +const TInt KNoOfPages(3); +const TInt KBufferTresholdSize(3); // in rows +const TInt KMaxNoOfSeamlessLinks(2); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxGridViewContainer* CGlxGridViewContainer::NewL(MGlxMediaList *aMediaList, + CGlxUiUtility* aUiUtility, + MGlxGridEventObserver& aObserver) + { + TRACER("CGlxGridViewContainer::NewL"); + CGlxGridViewContainer* self = CGlxGridViewContainer::NewLC(aMediaList,aUiUtility,aObserver) ; + CleanupStack::Pop(self) ; + return self ; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxGridViewContainer* CGlxGridViewContainer::NewLC(MGlxMediaList *aMediaList, + CGlxUiUtility* aUiUtility, + MGlxGridEventObserver& aObserver) + { + TRACER("CGlxGridViewContainer::NewLC"); + CGlxGridViewContainer* self = new(ELeave) CGlxGridViewContainer(aMediaList,aUiUtility,aObserver); + CleanupStack::PushL(self ) ; + self->ConstructL() ; + return self ; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxGridViewContainer::~CGlxGridViewContainer() + { + TRACER("CGlxGridViewContainer::~CGlxGridViewContainer"); + if(iBgContext) + { + delete iBgContext; + } + if(iDRMUtility) + { + iDRMUtility->Close(); + } + if (iGlxGridMLObserver) + { + delete iGlxGridMLObserver; + iGlxGridMLObserver = NULL; + } + if (iMediaList) + { + iMediaList->RemoveContext(iThumbnailContext); + delete iThumbnailContext; + } + if(iUiUtility->IsPenSupported()) + { + RemoveFSThumbnailContext(); + } + if(iNavigationalstate) + { + iNavigationalstate->Close(); + } + if (iHgGrid) + { + delete iHgGrid; + iHgGrid = NULL; + } + //reset the flag + iBackwardActivation = EFalse; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxGridViewContainer::CGlxGridViewContainer(MGlxMediaList *aMediaList,CGlxUiUtility* aUiUtility, + MGlxGridEventObserver& aObserver) + : iMediaList(aMediaList),iUiUtility(aUiUtility),iGlxGridViewObserver(aObserver) + { + TRACER("CGlxGridViewContainer::CGlxGridViewContainer"); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::ConstructL() + { + TRACER("CGlxGridViewContainer::ConstructL()"); + + //create the container window. + CreateWindowL(); + + // Making the default FSActivation as false + iFullscreenViewActivated = EFalse; + + iNavigationalstate = CGlxNavigationalState::InstanceL(); + + //check the navigational direction + if (iUiUtility->ViewNavigationDirection ()== EGlxNavigationBackwards) + { + iBackwardActivation = ETrue; + } + + // making the default mode of marking as false + iMultipleMarkingActive = EFalse; + + iGridIconSize = iUiUtility->GetGridIconSize(); + + iItemsPerPage = iUiUtility->VisibleItemsInPageGranularityL(); + + // For DRM Utility + iDRMUtility = CGlxDRMUtility::InstanceL(); + + // background Skin Context for the skin support + TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); + iBgContext = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgScreen,apRect,ETrue); + + iQualityTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + + iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + CreateGridL(); + } + +// --------------------------------------------------------------------------- +// From OfferKeyEventL +// Default implementation, +// --------------------------------------------------------------------------- +// +TKeyResponse CGlxGridViewContainer::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType) + { + TRACER("CGlxGridViewContainer::OfferKeyEventL()"); + TKeyResponse response = EKeyWasNotConsumed; + CCoeControl::OfferKeyEventL(aKeyEvent,aType); + if(aType == EEventKey) + { + switch(aKeyEvent.iCode) + { + case EKeyBackspace: + { + iGlxGridViewObserver.HandleGridEventsL(EGlxCmdDelete); + response = EKeyWasConsumed; + break; + } + default: + response = EKeyWasNotConsumed; + break; + } + } + + //send the unconsumed events from grid container to hg-grid to handle related key events + if(response == EKeyWasNotConsumed) + { + response = iHgGrid->OfferKeyEventL(aKeyEvent,aType); + } + return response ; + } + +// --------------------------------------------------------------------------- +// Release +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::Release(TInt /*aBufferStart*/, TInt/* aBufferEnd*/) + { + TRACER("CGlxGridViewContainer::Release()"); + // This has to do nothing on default + } + +// --------------------------------------------------------------------------- +// Request +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::Request(TInt aRequestStart, TInt aRequestEnd, + THgScrollDirection /*aDirection*/) + { + TRACER("CGlxGridViewContainer::Request()"); + RequestL(aRequestStart, aRequestEnd); + } + +// --------------------------------------------------------------------------- +// RequestL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::RequestL(TInt aRequestStart, TInt aRequestEnd) + { + TRACER("CGlxGridViewContainer::RequestL()"); + TInt visIndex = 0; + TInt mediaCount = iMediaList->Count(); + aRequestStart = (aRequestStart<0 ? 0 : aRequestStart) ; + aRequestEnd = (aRequestEnd>=mediaCount? (mediaCount-1) : aRequestEnd); + + GLX_LOG_INFO3("CGlxGridViewContainer::RequestL - aRequestStart(%d), " + "aRequestEnd(%d), FirstIndexOnScreen(%d)", aRequestStart, + aRequestEnd, iHgGrid->FirstIndexOnScreen()); + GLX_LOG_INFO1("CGlxGridViewContainer::Request - mediaCount(%d)",mediaCount); + + visIndex = iHgGrid->FirstIndexOnScreen(); + + if(visIndex >= mediaCount ) + { + visIndex = mediaCount-1; + } + if(visIndex<0 || mediaCount<=0) + { + visIndex = 0; + } + GLX_LOG_INFO1("CGlxGridViewContainer::Request - SetVisibleWindowIndex" + " visIndex(%d)", visIndex); + iMediaList->SetVisibleWindowIndexL(visIndex); + + if(mediaCount>0) + { + //Set the icons and refresh the screen only when the items are present + for (TInt i=aRequestStart; i<= aRequestEnd; i++) + { + SetIconsL(i); + TInt firstIndex = iHgGrid->FirstIndexOnScreen(); + firstIndex = (firstIndex<0 ? 0 : firstIndex); + TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; + lastOnScreen = (lastOnScreen >mediaCount-1? mediaCount-1:lastOnScreen); + if (i == lastOnScreen || (i == aRequestEnd && i < lastOnScreen)) + { + if (HasRelevantThumbnail(i)) + { + GLX_LOG_INFO1("CGlxGridViewContainer::Request - RefreshScreen" + " lastOnScreen / aRequestEnd i(%d)", i); + iHgGrid->RefreshScreen(i); + } + } + } + } + + if (iDownloadsPlugin && aRequestStart == KMaxNoOfSeamlessLinks) + { + SetDownloadLinksTimeL(); + } + } + +// ---------------------------------------------------------------------------- +// HasRelevantThumbnail +// ---------------------------------------------------------------------------- +// +TBool CGlxGridViewContainer::HasRelevantThumbnail(TInt aIndex) + { + TRACER("CGlxGridViewContainer::HasRelevantThumbnail()"); + const TGlxMedia& item = iMediaList->Item( aIndex ); + const CGlxThumbnailAttribute* qualityTn = item.ThumbnailAttribute( + iQualityTnAttrib ); + const CGlxThumbnailAttribute* speedTn = item.ThumbnailAttribute( + iSpeedTnAttrib ); + if ( qualityTn || speedTn ) + { + GLX_LOG_INFO("CGlxGridViewContainer::HasRelevantThumbnail() - TN avail"); + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// HandleSelectL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::HandleSelectL( TInt aIndex ) + { + TRACER("CGlxGridViewContainer::HandleSelectL()"); + // Map the index of HG Grid and Medialist + // Make sure that the Selection Index is inside medialist count + if (aIndex Count() && aIndex >=0) + { + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); + } + } + +// --------------------------------------------------------------------------- +// HandleOpenL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::HandleOpenL( TInt aIndex ) + { + TRACER("CGlxGridViewContainer::HandleOpenL()"); + + // Make sure that the Selection Index is inside medialist count + if (aIndex Count() && aIndex >=0) + { + if (!(iHgGrid->Flags() && CHgScroller::EHgScrollerSelectionMode)) + { + // If not in marking mode, then open FS view + iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); + //Navigate to the next view + //Item is selected, go to next view + HandleEnterKeyEventL((TInt)EAknCmdOpen); + } + } + } + +// ----------------------------------------------------------------------------- +// HandleEnterKeyEventL +// ----------------------------------------------------------------------------- +// +void CGlxGridViewContainer::HandleEnterKeyEventL(TInt aCommand) + { + TRACER("CGlxGridViewContainer::HandleEnterKeyEventL()"); + HandleViewCommandL(aCommand); + } + +// --------------------------------------------------------------------------- +// HandleMarkingL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::HandleMarkingL( TInt aIndex, TBool aMarked ) + { + TRACER("CGlxGridViewContainer::HandleMarkingL()"); + HandleMultipleMarkingL(aIndex,aMarked); + } + +// --------------------------------------------------------------------------- +// CreateHgGridWidgetL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::CreateHgGridWidgetL() + { + TRACER("CGlxGridViewContainer::CreateHgGridWidgetL()"); + + TInt mediaCount = iMediaList->Count(); + if (!iHgGrid) + { + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_notcreated); + AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); + TRect rect = iEikonEnv->EikAppUi()->ClientRect(); + // Create Hg grid object + iHgGrid = CHgGrid::NewL (rect,mediaCount,CGulIcon::NewL(bitmap)); + } + if (mediaCount) + { + // Mediacount would give the no of static items present and + // coz medialist doesnt have all the item at + // this stage, it will focus index for only download icons. + // For other grid views, we have to set focus elsewhere + for (TInt i=0; iItem(i); + TIconInfo icon; + if (item.GetIconInfo(icon) ) + { + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(icon.bmpfile, icon.bitmapId); + AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); + iHgGrid->ItemL(i).SetIcon(CGulIcon::NewL(bitmap)); + } + } + // Setting the initial focus + iHgGrid->SetSelectedIndex(iMediaList->FocusIndex()); + } + // Setting to MopParent to update background skin + iHgGrid->SetMopParent(this); + // Setting Selction observer for getting callback on key event change + iHgGrid->SetSelectionObserver(*this); + + // This Displays the scrollbar at the opening of the Grid view + iHgGrid->SetScrollBarTypeL(CHgScroller::EHgScrollerTimeStrip ); + + // Enable Buffer support + iHgGrid->EnableScrollBufferL(*this, (KNoOfPages * iItemsPerPage), + KBufferTresholdSize); + + // Enable Marking support + iHgGrid->SetMarkingObserver(*this); + iHgGrid->SetFocus(ETrue); + /* + * note: don't push hggrid to the control stack + */ + } + +// --------------------------------------------------------------------------- +// CreateGridL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::CreateGridL() + { + TRACER("CGlxGridViewContainer::CreateGridL()"); + // Set the Grid thumbnail context and iterator + SetGridThumbnailContextL(); + // Create HG Grid widget + CreateHgGridWidgetL(); + // Create an observer and pass MediaList and HGGrid objects + CreateGridMediaListObserverL(); + // Create Grid once again after returning from FS as No calls for handleItem added. + CreateGridAfterFSDeactivatedL(); + if (iUiUtility->IsPenSupported()) + { + // Fetch fullscreen thumbnails of the focused item with low priority + FetchFSThumbnailL(); + } + } + +// --------------------------------------------------------------------------- +// SetGridThumbnailContextL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::SetGridThumbnailContextL() + { + TRACER("CGlxGridViewContainer::SetGridThumbnailContextL()"); + // show static items again + iMediaList->SetStaticItemsEnabled(ETrue); + + iThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context + iThumbnailContext->SetDefaultSpec( iGridIconSize.iWidth,iGridIconSize.iHeight ); + iMediaList->AddContextL(iThumbnailContext, KGlxFetchContextPriorityNormal ); + + iDownloadsPlugin = EFalse; + CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent ); + if (path->Id() == KGlxCollectionPluginDownloadsImplementationUid) + { + iDownloadsPlugin = ETrue; + } + CleanupStack::PopAndDestroy(path); + } + +// --------------------------------------------------------------------------- +// CreateGridMediaListObserverL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::CreateGridMediaListObserverL() + { + TRACER("CGlxGridViewContainer::CreateGridMediaListObserverL()"); + // Creating the Medialist observer for HG Grid + iGlxGridMLObserver = CGlxGridViewMLObserver::NewL(*iMediaList, iHgGrid); + } + +// --------------------------------------------------------------------------- +// CreateGridAfterFSDeactivatedL +// On Returning from the FS View, There is no calls to the handle attribut available, +// So repeating the code to view Grid on FS return +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::CreateGridAfterFSDeactivatedL() + { + TRACER("CGlxGridViewContainer::CreateGridAfterFSDeactivatedL()"); + if (iBackwardActivation) + { + TInt mlCount = iMediaList->Count(); + GLX_LOG_INFO1("CreateGridAfterFSDeactivatedL() mlCount=%d", mlCount); + + // Setting the Empty Text + HBufC* emptyText = + StringLoader::LoadLC(R_GRID_EMPTY_VIEW_TEXT); + iHgGrid->SetEmptyTextL(*emptyText); + CleanupStack::PopAndDestroy(emptyText); + + if (mlCount <= 0) + { + GLX_LOG_INFO("CreateGridAfterFSDeactivatedL() - SetEmptyTextL()"); + iHgGrid->DrawNow(); + } + + TInt focusIndex = iMediaList->FocusIndex(); + TSize setSize = CHgGrid::PreferredImageSize(); + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + + for (TInt index=0; indexSetSelectedIndex(focusIndex); + iHgGrid->RefreshScreen(focusIndex); + } + iBackwardActivation = EFalse; + } + +// --------------------------------------------------------------------------- +// SetIconsL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::SetIconsL(TInt index) + { + TRACER("CGlxGridViewContainer::SetIconsL()"); + const TGlxMedia& item = iMediaList->Item(index); + TSize setSize = CHgGrid::PreferredImageSize(); + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + TIconInfo icon; + TInt tnError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + + const CGlxThumbnailAttribute* qualityTn = item.ThumbnailAttribute( iQualityTnAttrib ); + const CGlxThumbnailAttribute* speedTn = item.ThumbnailAttribute( iSpeedTnAttrib ); + + if (qualityTn) + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + bitmap->Duplicate( qualityTn->iBitmap->Handle()); + iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL qualityTn-Index is %d",index); + } + else if (speedTn) + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + bitmap->Duplicate( speedTn->iBitmap->Handle()); + iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL speedTn-Index is %d",index); + } + else if (item.GetIconInfo(icon)) + { + GLX_LOG_INFO1("CGlxGridViewContainer::SetIconsL - icon(%d)", index); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(icon.bmpfile, icon.bitmapId); + AknIconUtils::SetSize(bitmap, setSize); + iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewContainer::SetIconsL GetIconInfo-Index is %d",index); + } + else if ( KErrNone != tnError && KErrNotSupported != tnError && KErrCANoRights !=tnError) + { + GLX_LOG_INFO2("CGlxGridViewContainer::SetIconsL - image_corrupted tnError(%d), i(%d)", + tnError, index); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_corrupted); + AknIconUtils::SetSize(bitmap, setSize); + iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); + } + else if (KErrCANoRights ==tnError) + { + /*fix for EABI-7RKHDG + * this is a safe code added to show default + * TNM returns -17452 in case SD DRM files + * this code is added as coming from other view to + * gridview,it draws broken TN then the callback goes to + * glxgridviewobserver and redraws a not-created TN. + * with this part of code that TN swich will not be visible + */ + GLX_LOG_INFO2("CGlxGridViewContainer::SetIconsL - image_defaultthumbnail tnError(%d), i(%d)", + tnError, index); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_notcreated); + AknIconUtils::SetSize(bitmap, setSize); + iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); + } + else if(KErrNotSupported == tnError) + { + GLX_LOG_INFO2("CGlxGridViewContainer::SetIconsL - image_defaultthumbnail tnError(%d), i(%d)", + tnError, index); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_corrupted); + AknIconUtils::SetSize(bitmap, setSize); + iHgGrid->ItemL(index).SetIcon(CGulIcon::NewL(bitmap)); + } + + if (item.IsDrmProtected()) + { + const TDesC& uri = item.Uri(); + if( uri.Length() > 0) + { + if(iDRMUtility->IsForwardLockedL(uri)) + { + /* + * fix for EABI-7RKHDG + * to show the invalid DRM icon + */ + TMPXGeneralCategory cat = item.Category(); + TBool checkViewRights = (cat==EMPXImage); + + if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights)) + { + iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsValid); + } + else + { + iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsExpired); + } + } + else + { + TMPXGeneralCategory cat = item.Category(); + TBool checkViewRights = (cat==EMPXImage); + + if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights)) + { + iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsValid); + } + else + { + iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsDrmRightsExpired); + } + } + } + } + TTime time(0); + if (item.GetDate(time)) + { + iHgGrid->ItemL(index).SetTime(time); + } + + if (item.Category() == EMPXVideo) + { + iHgGrid->ItemL(index).SetFlags(CHgItem::EHgItemFlagsVideo); + } + } + +// --------------------------------------------------------------------------- +// FetchFSThumbnailL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::FetchFSThumbnailL() + { + TRACER("CGlxGridViewContainer::FetchFSThumbnailL()"); + TSize dispSize = iUiUtility->DisplaySize(); + iFsFromFocusOutwardIterator.SetRangeOffsets(0,0); + + iFsThumbnailContext = CGlxThumbnailContext::NewL(&iFsFromFocusOutwardIterator); + + if (dispSize.iHeight > dispSize.iWidth) + { + iFsThumbnailContext->SetDefaultSpec(dispSize.iHeight, dispSize.iWidth); + } + else + { + iFsThumbnailContext->SetDefaultSpec(dispSize.iWidth, dispSize.iHeight); + } + iMediaList->AddContextL(iFsThumbnailContext, KGlxFetchContextPriorityLow); + } + +// --------------------------------------------------------------------------- +// SetDownloadLinksTimeL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::SetDownloadLinksTimeL() + { + TRACER("CGlxGridViewContainer::SetDownloadLinksTimeL()"); + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + TInt mediaCount = iMediaList->Count(); + if (FeatureManager::FeatureSupported(KFeatureIdSeamlessLinks)) + { + if (iDownloadsPlugin && mediaCount > iHgGrid->ItemsOnScreen() ) + { + TTime time(0); + if (iMediaList->Item(KMaxNoOfSeamlessLinks).GetDate(time)) + { + if (iMediaList->Item(0).IsStatic()) + { + iHgGrid->ItemL(0).SetTime(time); // Image Downloads link Icon + } + if (iMediaList->Item(1).IsStatic()) + { + iHgGrid->ItemL(1).SetTime(time); // Video Downloads link Icon + } + } + } + } + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + } + +// --------------------------------------------------------------------------- +// RemoveFSThumbnailContext +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::RemoveFSThumbnailContext() + { + TRACER("CGlxGridViewContainer::RemoveFSThumbnailContext()"); + if (iMediaList) + { + iMediaList->RemoveContext(iFsThumbnailContext); + delete iFsThumbnailContext; + iFsThumbnailContext = NULL; + } + } + +// ----------------------------------------------------------------------------- +// MopSupplyObject +// To handle Skin support +// ----------------------------------------------------------------------------- +// +TTypeUid::Ptr CGlxGridViewContainer::MopSupplyObject(TTypeUid aId) + { + TRACER("CGlxGridViewContainer::MopSupplyObject()"); + if (iBgContext) + { + return MAknsControlContext::SupplyMopObject(aId, iBgContext ); + } + return CCoeControl::MopSupplyObject( aId ); + } + +// --------------------------------------------------------------------------- +// HandleMultipleMarkingL +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::HandleMultipleMarkingL(TInt aIndex , TBool aMarked ) + { + TRACER("CGlxGridViewContainer::HandleMultipleMarkingL()"); + //@ fix for EIZU-7RE43S + if(!iMediaList->Item(aIndex).IsStatic() && iHgGrid) + { + if(aMarked) + { + iGlxGridViewObserver.HandleGridEventsL(EAknCmdMark) ; + + } + else + { + iGlxGridViewObserver.HandleGridEventsL(EAknCmdUnmark) ; + + } + } + + // This check is only implicated when multiple marking mode and we mark static items + // As Hg Grid marks the items on the screen, we have to unmark the same. + if (iMediaList->Item(aIndex).IsStatic()) + { + iHgGrid->UnMark(aIndex); + } + } + +// --------------------------------------------------------------------------- +// HandleViewCommandL +// Command handling function. +// --------------------------------------------------------------------------- +TBool CGlxGridViewContainer::HandleViewCommandL(TInt aCommand) + { + TRACER("CGlxGridViewContainer::HandleViewCommandL()"); + GLX_LOG_INFO1( "CGlxGridViewContainer::HandleViewCommandL(%x) entering", aCommand ); + + TBool retVal = EFalse; + TInt focusIndex = iMediaList->FocusIndex(); + switch (aCommand) + { + case EAknCmdOpen: + { + GLX_LOG_INFO( "EAknCmdOpen" ); + // Activate Fullscreen + GLX_LOG_INFO("CGlxGridViewContainer::HandleViewCommandL - EAKnCmdOpen received"); + if ( !iFullscreenViewActivated && !iMultipleMarkingActive && + focusIndex != KErrNotFound) + { + const TGlxMedia& item = iMediaList->Item(focusIndex); + const TDesC& uri = item.Uri(); + + if ( item.IsStatic() ) + { + TInt cmd = 0; + if( item.GetStaticItemCommand(cmd) ) + { + iGlxGridViewObserver.HandleGridEventsL(cmd) ; + } + } + else if(item.Category() == EMPXVideo) + { + //Fix for ESLM-7U58CG - here since we get + //multiple HandleOpen( ) event on multiple tap + //we need to guard the event by a flag. + if(!iIsFSVideoViewActivating) + { + iIsFSVideoViewActivating = ETrue; + iFullscreenViewActivated = ETrue; + iIsFSVideoViewActivating = EFalse; + iGlxGridViewObserver.HandleGridEventsL(EGlxCmdPlay) ; + } + } + else + { + iFullscreenViewActivated = ETrue; + iNavigationalstate->SetToViewMode(); + } + } + + //@ fix for EIZU-7RE43S + if(iMultipleMarkingActive) + { + //If in marking mode Mark/Unmark the item + //appropriately. + if(iMediaList->IsSelected(focusIndex)) + { + iGlxGridViewObserver.HandleGridEventsL(EAknCmdUnmark) ; + } + else + { + iGlxGridViewObserver.HandleGridEventsL(EAknCmdMark) ; + } + } + retVal = ETrue; + break; + } + + case EAknCmdMark: + { + iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode ); + //Start Marking mode on grid. + iMultipleMarkingActive = ETrue; + //@ fix for EIZU-7RE43S + iHgGrid->Mark(focusIndex); + iHgGrid->RefreshScreen(focusIndex); + retVal = ETrue; + break; + } + + case EAknCmdUnmark: + { + //@ fix for EIZU-7RE43S + iHgGrid->UnMark(focusIndex); + iHgGrid->RefreshScreen(focusIndex); + retVal = ETrue; + break; + } + + case EAknMarkAll: + { + //Start Marking mode on grid. + iMultipleMarkingActive = ETrue; + iHgGrid->SetFlags( CHgScroller::EHgScrollerSelectionMode ); + iHgGrid->MarkAll(); + + // If the 0th item is static, then it must be downloads, + // so unmark 0th and 1st item + // corresponding to image and vieo icons + const TGlxMedia& item = iMediaList->Item(0); + if (item.IsStatic()) + { + // Assuming that the first two items are static + iHgGrid->UnMark(0); + iHgGrid->UnMark(1); + } + // When mark all after some item is marked using toolbar + // it directly goes to commandhandler, so it returns not + // consumed after marking medialist + // and view marks on the display + // The Check prevents looping from view to mark and vice versa + // @ fix for ESLM-7TQGMP + if (iMediaList->SelectionCount() < 1) + { + iGlxGridViewObserver.HandleGridEventsL(aCommand) ; + } + retVal = ETrue; + break; + } + + case EAknUnmarkAll: + { + if(iHgGrid) + { + iHgGrid->UnMarkAll(); + iHgGrid->RefreshScreen(iMediaList->Count()-1); + if (!iMultipleMarkingActive) + { + iHgGrid->ClearFlags( CHgScroller::EHgScrollerSelectionMode ); + } + } + break; + } + + case EGlxCmdEndMultipleMarking: + { + iMultipleMarkingActive = EFalse; + iHgGrid->ClearFlags( CHgScroller::EHgScrollerSelectionMode ); + // Turn off the marking mode only if the event is from toolbar marking button. + //Unlatch the mark toolbar button upon exiting the marking mode + if(iEikonEnv->AppUiFactory()->ToolBar()) + { + // This will unmark the items after adding an album/tag + // Have to find a better solution and unmark only the items + // marked and not all, might be a perf hit + if(iHgGrid) + { + iHgGrid->UnMarkAll(); + } + iGlxGridViewObserver.HandleLatchToolbar(); + } + retVal = ETrue; + break; + } + + case EGlxCmdStartMultipleMarking: + { + if( iHgGrid->Flags() & CHgScroller::EHgScrollerSelectionMode ) + { + iHgGrid->ClearFlags( CHgScroller::EHgScrollerSelectionMode ); + // Refreshing the items selected after unmark + for (TInt i= 0;iSelectionCount();i++) + { + TInt selectedItemIndex = iMediaList->SelectedItemIndex(i); + iHgGrid->UnMark(selectedItemIndex); + iHgGrid->RefreshScreen(selectedItemIndex); + } + iGlxGridViewObserver.HandleGridEventsL(EGlxCmdEndMultipleMarking) ; + } + else + { + //Start Marking mode on grid. + iMultipleMarkingActive = ETrue; + iHgGrid->SetFlags(CHgScroller::EHgScrollerSelectionMode); + } + retVal = ETrue; + break; + } + + case EAknSoftkeyCancel: + { + //@ fix for EIZU-7RE43S + if( iHgGrid->Flags() & CHgScroller::EHgScrollerSelectionMode ) + { + iGlxGridViewObserver.HandleGridEventsL(EGlxCmdEndMultipleMarking) ; + } + retVal = ETrue; + break; + + } + case EGlxCmdResetView: + { + //@ fix for ESLM-7VRGKH + if(iHgGrid) + { + iHgGrid->InitScreenL(iEikonEnv->EikAppUi()->ClientRect()); + } + retVal = ETrue; + break; + } + default: + break; + } + GLX_LOG_INFO("CGlxGridViewContainer::HandleViewCommandL() exiting"); + return retVal; + } + +// --------------------------------------------------------------------------- +// HandleResourceChange +// Handle BG screen context && Hg grid orientaion +// --------------------------------------------------------------------------- +// +void CGlxGridViewContainer::HandleResourceChange(TInt aId) + { + TRACER("CGlxGridViewContainer::HandleResourceChange()"); + CCoeControl::HandleResourceChange(aId); + if ( iBgContext ) + { + TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); + iBgContext->SetRect( apRect ); + } + if(iHgGrid) + { + TRAP_IGNORE (iHgGrid->InitScreenL(iEikonEnv->EikAppUi()->ClientRect()); ) + } + } +//end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/src/glxgridviewimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/src/glxgridviewimp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Grid view +* +*/ + + + + + +// INCLUDE FILES +#include +#include +#include + +//Gallery Headers +#include // For medialist registry +#include // For EGlxCmdFullScreenBack +#include // Gridview resource + +#include // CGlxMedialist +#include +#include // For Tracer + + +// User Includes +#include "glxgridviewimp.h" +#include "glxgridviewmlobserver.h" // medialist observer for Hg Grid +#include "glxgridviewcontainer.h" + +const TInt KGlxToolbarButtonUnLatched = 0; // Toolbar mark button's unlatched state defined in the rss file + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxGridViewImp* CGlxGridViewImp::NewL( + MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle) + { + TRACER("CGlxGridViewImp::NewL"); + CGlxGridViewImp* self = CGlxGridViewImp::NewLC(aMediaListFactory, + aResourceIds, + aViewUID, + aTitle); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxGridViewImp* CGlxGridViewImp::NewLC( + MGlxMediaListFactory* aMediaListFactory, + const TGridViewResourceIds& aResourceIds, + TInt aViewUID, + const TDesC& aTitle) + { + TRACER("CGlxGridViewImp::NewLC()"); + CGlxGridViewImp* self = + new (ELeave) CGlxGridViewImp(aResourceIds, aViewUID); + CleanupStack::PushL(self); + self->ConstructL(aMediaListFactory, aTitle); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxGridViewImp::CGlxGridViewImp(const TGridViewResourceIds& aResourceIds, + TInt aViewUID) : + iResourceIds(aResourceIds), + iViewUID(aViewUID), + iPreviousFocusChangeType(NGlxListDefs::EUnknown) + { + TRACER("CGlxGridViewImp::CGlxGridViewImp()"); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxGridViewImp::ConstructL(MGlxMediaListFactory* aMediaListFactory, + const TDesC& aTitle) + { + TRACER("CGlxGridViewImp::ConstructL()"); + BaseConstructL(iResourceIds.iViewId); + ViewBaseConstructL(); + MLViewBaseConstructL(aMediaListFactory, aTitle); + + //Register the view to recieve toolbar events. ViewBase handles the events + SetToolbarObserver(this); + ShowToolbarOnViewActivation(ETrue); + + // Get object that stores the active media list registry + iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL(); + } + +// --------------------------------------------------------------------------- +// From CAknView +// Handles a view activation. +// --------------------------------------------------------------------------- +// +void CGlxGridViewImp::DoMLViewActivateL( + const TVwsViewId& /* aPrevViewId */, + TUid /* aCustomMessageId */, + const TDesC8& /*aCustomMessage*/) + { + TRACER("CGlxGridViewImp::DoMLViewActivateL()"); + + if(StatusPane()) + { + StatusPane()->MakeVisible(ETrue); + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + const TDesC* titleText = titlePane->Text(); + HBufC* tempTitle = titleText->AllocLC(); + TPtr titleptr = tempTitle->Des(); + titleptr.Trim(); + if(!tempTitle->Length()) + { + if( iTitletext ) + { + // Set the required Title + titlePane->SetTextL( *iTitletext ); + } + } + CleanupStack::PopAndDestroy(tempTitle); + } + + GlxSetAppState::SetState(EGlxInCarouselView); + // Setting the Context sensitive menu id + MenuBar()->SetContextMenuTitleResourceId( iResourceIds.iOkOptionsMenuId ); + iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList); + + //Create HG Grid, medialist observer, FS thumbnailcontext + iGlxGridViewContainer = CGlxGridViewContainer::NewL(iMediaList,iUiUtility,*this); + iEikonEnv->AppUi()->AddToStackL(*this,iGlxGridViewContainer); + } + +// --------------------------------------------------------------------------- +// From CAknView +// View deactivation function. +// --------------------------------------------------------------------------- +// +void CGlxGridViewImp::DoMLViewDeactivate() + { + TRACER("CGlxGridViewImp::DoMLViewDeactivate"); + if(StatusPane()) + { + if(iTitletext) + { + delete iTitletext; + iTitletext = NULL; + } + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + TRAP_IGNORE(CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + iTitletext = titlePane->Text()->AllocL()); + } + // Deregister active media list pointer + iActiveMediaListRegistry->DeregisterActiveMediaList(iMediaList); + + // Destroy Grid widget before going to next view + DestroyGridWidget(); + } + +// --------------------------------------------------------------------------- +// DestroyGridWidget +// --------------------------------------------------------------------------- +// +void CGlxGridViewImp::DestroyGridWidget() + { + TRACER("CGlxGridViewImp::DestroyGridWidget()"); + //while view deactivating need to remove from the control stack. + iEikonEnv->AppUi()->RemoveFromViewStack(*this,iGlxGridViewContainer); + delete iGlxGridViewContainer; + iGlxGridViewContainer = NULL; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxGridViewImp::~CGlxGridViewImp() + { + TRACER("CGlxGridViewImp::~CGlxGridViewImp"); + delete iTitletext; + + if (iActiveMediaListRegistry) + { + iActiveMediaListRegistry->Close(); + } + } + +// --------------------------------------------------------------------------- +// From CAknView +// Returns views id. +// --------------------------------------------------------------------------- +TUid CGlxGridViewImp::Id() const +{ +TRACER("CGlxGridViewImp::Id()"); +return TUid::Uid(iViewUID); +} + +// --------------------------------------------------------------------------- +// From CAknView +// Command handling function. +// --------------------------------------------------------------------------- +TBool CGlxGridViewImp::HandleViewCommandL(TInt aCommand) + { + TRACER("CGlxGridViewImp::HandleViewCommandL()"); + GLX_LOG_INFO1( "CGlxGridViewImp::HandleViewCommandL(%x) entering", aCommand ); + return iGlxGridViewContainer->HandleViewCommandL(aCommand); + } + +// --------------------------------------------------------------------------- +// From CAknView +// HandleForegroundEventL +// Foreground event handling function. +// --------------------------------------------------------------------------- +// +void CGlxGridViewImp::HandleForegroundEventL(TBool aForeground) + { + TRACER("CGlxGridViewImp::HandleForegroundEventL()"); + CAknView::HandleForegroundEventL(aForeground); + } + +// --------------------------------------------------------------------------- +// From MGlxHandleGridEvents +// HandleGridEventsL() +// handles processcommandL related commands +// ----------------------------------------------------------------------------- +// +void CGlxGridViewImp::HandleGridEventsL(TInt aCmd) + { + TRACER("CGlxGridViewImp::HandleGridEventsL()"); + //do processcmd related event handling + ProcessCommandL(aCmd); + } + +// --------------------------------------------------------------------------- +// From MGlxHandleButtonMark +// HandleLatchToolbar() +// sets toolbar mark unmark status +// ----------------------------------------------------------------------------- +// +void CGlxGridViewImp::HandleLatchToolbar() + { + TRACER("CGlxGridViewImp::HandleLatchToolbarL()"); + CAknButton* markButton = static_cast + (Toolbar()->ControlOrNull( EGlxCmdStartMultipleMarking )); + + if(markButton) + { + markButton->SetCurrentState( KGlxToolbarButtonUnLatched, ETrue ); + } + } +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/gridview/src/glxgridviewmlobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/gridview/src/glxgridviewmlobserver.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,618 @@ +/* +* Copyright (c) 2008-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 : Grid view Observers +* +*/ + + +// INCLUDE FILES + +// Ganes Headers +#include +#include //Hg Grid Widget +//#include +#include + +//Gallery Headers +#include // For Tracer +#include // For Glx Logging +#include // For UiUtility instance +#include // For Corrupted and not created icons +#include // For CGlxErrormanager +#include +#include // CGlxMedialist +#include // KGlxMediaIdThumbnail +#include // DRM utility class to provide DRM-related functionality +#include // KMPXMediaDrmProtected +#include +#include // Gridview resource + +// Framework +#include +#include + +#include // For feature constants +#include // Feature Manager +#include +#include + +#include "glxgridviewmlobserver.h" + +const TInt KRecreateGridSize(100); //minimum no of items added to trigger recreate grid +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxGridViewMLObserver* CGlxGridViewMLObserver::NewL( + MGlxMediaList& aMediaList, CHgGrid* aHgGrid) + { + TRACER("CGlxGridViewMLObserver::NewLC()"); + CGlxGridViewMLObserver* self = + new (ELeave) CGlxGridViewMLObserver(aMediaList, aHgGrid); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxGridViewMLObserver::CGlxGridViewMLObserver(MGlxMediaList& aMediaList, + CHgGrid* aHgGrid ) : iMediaList(aMediaList), iHgGrid(aHgGrid) + { + TRACER("CGlxGridViewMLObserver::CGlxGridViewMLObserver"); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::ConstructL() + { + TRACER("CGlxGridViewMLObserver::ConstructL"); + iMediaList.AddMediaListObserverL(this); + // For DRm Utility + iDRMUtility = CGlxDRMUtility::InstanceL(); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + iGridIconSize = uiUtility->GetGridIconSize(); + //Get the HgContextUtility instance +// iContextUtility = uiUtility->ContextUtility(); + iItemsPerPage = uiUtility->VisibleItemsInPageGranularityL(); + uiUtility->Close() ; + + iDownloadsPlugin = EFalse; + + CMPXCollectionPath* path = iMediaList.PathLC( NGlxListDefs::EPathParent ); + if (path->Id() == KGlxCollectionPluginDownloadsImplementationUid) + { + iDownloadsPlugin = ETrue; + } + CleanupStack::PopAndDestroy(path); + + iQualityTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + + iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxGridViewMLObserver::~CGlxGridViewMLObserver() + { + TRACER("CGlxGridViewMLObserver::~CGlxGridViewMLObserver"); + iMediaList.RemoveMediaListObserver( this ); + if (iDRMUtility) + { + iDRMUtility->Close(); + } + iModifiedIndexes.Reset(); + } + +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList ) + { + TRACER("CGlxGridViewMLObserver::HandleItemAddedL()"); + GLX_DEBUG3("CGlxGridViewMLObserver::HandleItemAddedL() aStartIndex(%d)," + " aEndIndex(%d)", aStartIndex, aEndIndex); + + if (iHgGrid) + { + if ((aEndIndex - aStartIndex) >= KRecreateGridSize) + { + iHgGrid->ResizeL(aList->Count()); + } + else + { + for (TInt i = aStartIndex; i<= aEndIndex; i++) + { + iHgGrid->InsertItem(CHgItem::NewL(), i); + } + } + } + // Setting the initial focus for all grid views except downloads, + // for downloads it is already set. + TInt focusIndex = aList->FocusIndex(); + iHgGrid->SetSelectedIndex(focusIndex); + + // if the Medialist has any item, set the First index context to Hg Context Utility +// TGlxMedia item = aList->Item( focusIndex ); +// iContextUtility->PublishPhotoContextL(item.Uri()); + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleItemRemovedL( TInt aStartIndex, + TInt aEndIndex, MGlxMediaList* aList ) + { + TRACER("CGlxGridViewMLObserver::HandleItemRemovedL()"); + if (iHgGrid) + { + TInt mediaCount = aList->Count(); + + for (TInt i = aEndIndex; i>= aStartIndex; i--) + { + iHgGrid->RemoveItem(i); + } + + // If the last item is also deleted, this refreshes the view + if (mediaCount <=0) + { + if(iMediaList.VisibleWindowIndex() > iMediaList.Count()) + { + iMediaList.SetVisibleWindowIndexL(0); + } + //This is done since the Hg doesnot refresh the screen + //when we remove all the items from the grid + iHgGrid->DrawDeferred(); + iHgGrid->Reset(); + return; + } + else if (iMediaList.VisibleWindowIndex() > iMediaList.Count()) + { + iMediaList.SetVisibleWindowIndexL(iMediaList.Count()-1); + } + iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); + } + } + +// ---------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxGridViewMLObserver::HandleAttributesAvailableL()"); + GLX_LOG_INFO1("CGlxGridViewMLObserver::HandleAttributesAvailableL " + "aItemIndex(%d)", aItemIndex); + if (!iHgGrid) + { + return; + } + + TInt mediaCount = iMediaList.Count(); + const TGlxMedia& item = iMediaList.Item( aItemIndex ); + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + if (KErrNotFound != aAttributes.Find( iQualityTnAttrib, match ) || + KErrNotFound != aAttributes.Find( iSpeedTnAttrib, match )) + { + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + TSize setSize = CHgGrid::PreferredImageSize(); + TIconInfo icon; + + const CGlxThumbnailAttribute* qualityTn = item.ThumbnailAttribute( + iQualityTnAttrib ); + + const CGlxThumbnailAttribute* speedTn = item.ThumbnailAttribute( + iSpeedTnAttrib ); + + TInt tnError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + + if (qualityTn) + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + bitmap->Duplicate( qualityTn->iBitmap->Handle()); + AknIconUtils::SetSize(bitmap, setSize); + iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewMLObserver::HandleAttributesAvailableL" + " qualityTn-Index is %d",aItemIndex); + } + else if (speedTn) + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + bitmap->Duplicate( speedTn->iBitmap->Handle()); + AknIconUtils::SetSize(bitmap, setSize); + iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewMLObserver::HandleAttributesAvailableL" + " speedTn-Index is %d",aItemIndex); + } + else if (item.GetIconInfo(icon)) + { + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(icon.bmpfile, icon.bitmapId); + AknIconUtils::SetSize(bitmap, setSize ); + iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap)); + GLX_LOG_INFO1("### CGlxGridViewMLObserver::HandleAttributesAvailableL " + "GetIconInfo-Index is %d",aItemIndex); + } + else if ( KErrNone != tnError && KErrNotSupported != tnError && + KErrArgument != tnError ) + { + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_corrupted); + AknIconUtils::SetSize(bitmap, setSize); + iHgGrid->ItemL(aItemIndex).SetIcon(CGulIcon::NewL(bitmap)); + } + } + + //Now Update the items with the DRM/video icon and date/time + UpdateItemsL(aItemIndex,aAttributes); + + //Now refresh the screen based on the attributes available index + RefreshScreen(aItemIndex,aAttributes); + } + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleFocusChangedL( NGlxListDefs:: + TFocusChangeType /*aType*/, TInt aNewIndex, TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxGridViewMLObserver::HandleFocusChangedL()"); + iHgGrid->SetSelectedIndex(aNewIndex); + iHgGrid->RefreshScreen(aNewIndex); +/* if (aList->Count()) + { + // This us to set the context to HG Teleport + TGlxMedia item = iMediaList.Item( aNewIndex ); + iContextUtility->PublishPhotoContextL(item.Uri()); + }*/ + } + +// ---------------------------------------------------------------------------- +// HandleItemSelected +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxGridViewMLObserver::HandleItemSelectedL"); + } + +// ---------------------------------------------------------------------------- +// HandleMessageL +// ---------------------------------------------------------------------------- +// + void CGlxGridViewMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxGridViewMLObserver::HandleMessageL()"); + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleError( TInt /*aError*/ ) + { + TRACER("CGlxGridViewMLObserver::HandleError()"); + TRAP_IGNORE(HandleErrorL()); + } + +// ---------------------------------------------------------------------------- +// HandleErrorL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleErrorL() + { + TRACER("CGlxGridViewMLObserver::HandleErrorL()"); + for ( TInt i = 0; i < iMediaList.Count(); i++ ) + { + const TGlxMedia& item = iMediaList.Item( i ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + + if( thumbnailError== KErrCANoRights) + { + /*fix for EABI-7RKHDG + * this is a safe code added to show default + * TNM returns -17452 in case SD DRM files + */ + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_notcreated); + AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); + iHgGrid->ItemL(i).SetIcon(CGulIcon::NewL(bitmap), + CHgItem::EHgItemFlagsDrmRightsExpired); + } + else if (thumbnailError) + { + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_corrupted); + + //@ Fix for EABI-7RJA8C, Changes for HG grid for corrupted icon. + AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize() ); + + iHgGrid->ItemL(i).SetIcon(CGulIcon::NewL(bitmap), + CHgItem::EHgItemFlagsNone); + } + } + iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); + } +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxGridViewMLObserver::HandleCommandCompleteL()"); + } + +// ---------------------------------------------------------------------------- +// HandleMediaL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxGridViewMLObserver::HandleMediaL()"); + } + +// ---------------------------------------------------------------------------- +// HandlePopulatedL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandlePopulatedL( MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxGridViewMLObserver::HandlePopulatedL()"); + if (iHgGrid) + { + // Setting the Empty Text + HBufC* emptyText = + StringLoader::LoadLC(R_GRID_EMPTY_VIEW_TEXT); + iHgGrid->SetEmptyTextL(*emptyText); + CleanupStack::PopAndDestroy(emptyText); + GLX_DEBUG2("GridMLObserver::HandlePopulatedL() iMediaList.Count()=%d", + iMediaList.Count()); + + + if (iMediaList.Count() <= 0) + { + GLX_DEBUG1("GridMLObserver::HandlePopulatedL() - SetEmptyTextL()"); + iHgGrid->DrawNow(); + } + } + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::HandleItemModifiedL(const RArray& aItemIndexes, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxGridViewMLObserver::HandleItemModifiedL()"); + for(TInt index = 0;index& aAttributes) + { + TInt mediaCount = iMediaList.Count(); + TInt firstIndex = iHgGrid->FirstIndexOnScreen(); + firstIndex = (firstIndex<0 ? 0 : firstIndex); + TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; + lastOnScreen = (lastOnScreen >mediaCount-1? mediaCount-1:lastOnScreen); + if (mediaCount < iItemsPerPage || aItemIndex == firstIndex) + { + if (aItemIndex == firstIndex && HasRelevantThumbnail(firstIndex)) + { + GLX_DEBUG2("## GridMLObserver::HandleAttributesAvailableL()" + " RefreshScreen - firstIndex(%d)", firstIndex); + iHgGrid->RefreshScreen(firstIndex); + } + } + else if (aItemIndex > firstIndex && aItemIndex <= lastOnScreen) + { + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + if (KErrNotFound != aAttributes.Find(iQualityTnAttrib, match) || + KErrNotFound != aAttributes.Find(iSpeedTnAttrib, match) ) + { + if ( HasRelevantThumbnail(firstIndex) ) + { + if ( HasRelevantThumbnail(lastOnScreen) ) + { + GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" + " RefreshScreen - aItemIndex(%d)", aItemIndex); + iHgGrid->RefreshScreen(aItemIndex); + } + else if (aItemIndex == lastOnScreen) + { + GLX_DEBUG2("GridMLObserver::HandleAttributesAvailableL()" + " RefreshScreen - lastOnScreen(%d)", lastOnScreen); + iHgGrid->RefreshScreen(lastOnScreen); + } + } + } + } + if (iModifiedIndexes.Count() > 0) + { + for(TInt index = 0;indexRefreshScreen(aItemIndex); + iModifiedIndexes.Remove(index); + iModifiedIndexes.Compress(); + } + } + } + } + + +// ---------------------------------------------------------------------------- +// UpdateItemsL +// ---------------------------------------------------------------------------- +// +void CGlxGridViewMLObserver::UpdateItemsL (TInt aItemIndex, + const RArray& aAttributes) + { + TInt mediaCount = iMediaList.Count(); + const TGlxMedia& item = iMediaList.Item( aItemIndex ); + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound) + { + if (item.IsDrmProtected()) + { + const TDesC& uri = item.Uri(); + if( uri.Length() > 0) + { + if(iDRMUtility->IsForwardLockedL(uri)) + { + /* + * fix for EABI-7RKHDG + * to show the invalid DRM icon + */ + TMPXGeneralCategory cat = item.Category(); + TBool checkViewRights = (cat==EMPXImage); + + if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights)) + { + iHgGrid->ItemL(aItemIndex).SetFlags( + CHgItem::EHgItemFlagsDrmRightsValid); + } + else + { + iHgGrid->ItemL(aItemIndex).SetFlags( + CHgItem::EHgItemFlagsDrmRightsExpired); + } + } + else + { + TMPXGeneralCategory cat = item.Category(); + TBool checkViewRights = (cat==EMPXImage); + + if(iDRMUtility->CheckOpenRightsL(uri, checkViewRights)) + { + iHgGrid->ItemL(aItemIndex).SetFlags( + CHgItem::EHgItemFlagsDrmRightsValid); + } + else + { + iHgGrid->ItemL(aItemIndex).SetFlags( + CHgItem::EHgItemFlagsDrmRightsExpired); + } + } + } + } + } + + if (aAttributes.Find(KMPXMediaGeneralDate, match) != KErrNotFound) + { + TTime time(0); + if (item.GetDate(time)) + { + iHgGrid->ItemL(aItemIndex).SetTime(time); + } + + // Sets up TLS, must be done before FeatureManager is used. + FeatureManager::InitializeLibL(); + + if (FeatureManager::FeatureSupported(KFeatureIdSeamlessLinks)) + { + if (iDownloadsPlugin && mediaCount > iHgGrid->ItemsOnScreen() + && aItemIndex == 2) + { + if (iMediaList.Item(0).IsStatic()) + { + iHgGrid->ItemL(0).SetTime(time); // Image Downloads link Icon + } + if (iMediaList.Item(1).IsStatic()) + { + iHgGrid->ItemL(1).SetTime(time); // Video Downloads link Icon + } + } + } + + // Frees the TLS. Must be done after FeatureManager is used. + FeatureManager::UnInitializeLib(); + } + + if (aAttributes.Find(KMPXMediaGeneralCategory, match) != KErrNotFound) + { + if (item.Category() == EMPXVideo) + { + iHgGrid->ItemL(aItemIndex).SetFlags(CHgItem::EHgItemFlagsVideo); + } + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2008-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: Build information file for views. +* +*/ + + + + +PRJ_MMPFILES +../viewbase/group/glxviewbase.mmp +../zoomview/group/glxzoomview.mmp +../fullscreenview/group/glxfullscreenview.mmp +../listview/group/glxlistview.mmp +../gridview/group/glxgridview.mmp + +PRJ_TESTMMPFILES +//../listview/tsrc/group/ut_cglxlistcontrol.mmp +//../listview/tsrc/group/ut_cglxlistviewimp.mmp + +// Views +#include "../metadatadialog/group/bld.inf" +#include "../cloudview/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/bwins/glxlistviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/bwins/glxlistviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + ?NewL@CGlxListView@@SAPAV1@PAVMGlxMediaListFactory@@HAAUTListViewResourceIds@@ABVTDesC16@@@Z @ 1 NONAME ; class CGlxListView * CGlxListView::NewL(class MGlxMediaListFactory *, int, struct TListViewResourceIds &, class TDesC16 const &) + ?NewLC@CGlxListView@@SAPAV1@PAVMGlxMediaListFactory@@HAAUTListViewResourceIds@@ABVTDesC16@@@Z @ 2 NONAME ; class CGlxListView * CGlxListView::NewLC(class MGlxMediaListFactory *, int, struct TListViewResourceIds &, class TDesC16 const &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/eabi/glxlistviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/eabi/glxlistviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + _ZN12CGlxListView4NewLEP20MGlxMediaListFactoryiR20TListViewResourceIdsRK7TDesC16 @ 1 NONAME + _ZN12CGlxListView5NewLCEP20MGlxMediaListFactoryiR20TListViewResourceIdsRK7TDesC16 @ 2 NONAME + _ZTI12CGlxListView @ 3 NONAME ; ## + _ZTV12CGlxListView @ 4 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2008-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: Build information file for views. +* +*/ + + + + +PRJ_MMPFILES +glxlistview.mmp + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/group/create-ut_cglxlistcontrol-sis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/group/create-ut_cglxlistcontrol-sis.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: SIS file for listcontrol +rem + +@echo off +echo. +echo ==================================== +echo. +echo Digia EUnit - Test +echo. +echo This BAT copies Test DLL +echo to local folder and makes SIS file +echo. +echo ==================================== +echo. + +:CHECK_EPOCROOT +echo. +echo - verify epoc root +set EPOCROOT +if errorlevel == 1 goto END_ERROR + +:COPY_DLL +echo. +echo - copy test dll to current directory +copy %EPOCROOT%epoc32\release\thumb\urel\ut_cglxlistcontrol.dll . +if errorlevel == 1 goto END_ERROR + +:CREATE_DIR +echo. +echo - create Sis folder (created only if needed) +mkdir ..\Sis + +:MAKESIS +echo. +echo - makesis ut_cglxlistcontrol.pkg ..\sis\ut_cglxlistcontrol.sis +call makesis ut_cglxlistcontrol.pkg ..\sis\ut_cglxlistcontrol.sis +if errorlevel == 1 goto END_ERROR + +:DELETE_DLL +echo. +echo - remove the copied dll from current folder +del ut_cglxlistcontrol.dll +goto END + +:END_ERROR +echo. +echo Sis creation failed. +goto FINAL_END + +:END +echo. +echo Sis file created succesfully +echo ============================ + +:FINAL_END +echo. + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/group/create-ut_cglxlistviewimp-sis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/group/create-ut_cglxlistviewimp-sis.bat Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,70 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: SIS file for listview +rem + +@echo off +echo. +echo ==================================== +echo. +echo Digia EUnit - Test +echo. +echo This BAT copies Test DLL +echo to local folder and makes SIS file +echo. +echo ==================================== +echo. + +:CHECK_EPOCROOT +echo. +echo - verify epoc root +set EPOCROOT +if errorlevel == 1 goto END_ERROR + +:COPY_DLL +echo. +echo - copy test dll to current directory +copy %EPOCROOT%epoc32\release\thumb\urel\ut_cglxlistviewimp.dll . +if errorlevel == 1 goto END_ERROR + +:CREATE_DIR +echo. +echo - create Sis folder (created only if needed) +mkdir ..\Sis + +:MAKESIS +echo. +echo - makesis ut_cglxlistviewimp.pkg ..\sis\ut_cglxlistviewimp.sis +call makesis ut_cglxlistviewimp.pkg ..\sis\ut_cglxlistviewimp.sis +if errorlevel == 1 goto END_ERROR + +:DELETE_DLL +echo. +echo - remove the copied dll from current folder +del ut_cglxlistviewimp.dll +goto END + +:END_ERROR +echo. +echo Sis creation failed. +goto FINAL_END + +:END +echo. +echo Sis file created succesfully +echo ============================ + +:FINAL_END +echo. + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/group/glxlistview.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/group/glxlistview.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + + +TARGET glxlistview.dll +TARGETTYPE dll +UID 0x1000008d 0x20000A0D + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxlistview.cpp +SOURCE glxlistviewimp.cpp +SOURCE glxpreviewthumbnailbinding.cpp + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../commonui/inc +SYSTEMINCLUDE ../../../../common/inc +SYSTEMINCLUDE ../../../plugins/listviewplugin/inc +SYSTEMINCLUDE ../../../views/viewbase/inc +SYSTEMINCLUDE ../../../uiutilities/inc //glxanimationfactory +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../dataprovider/inc +SYSTEMINCLUDE ../../../medialists/inc //glxmedialistiterator + +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY commonengine.lib //String Loader +LIBRARY alfclient.lib //TAlfEvent +LIBRARY mpxcommon.lib //TMPXAttribute +LIBRARY mpxviewutility.lib +LIBRARY eikcoctl.lib + +LIBRARY glxviewbase.lib +LIBRARY glxuiutilities.lib //CGlxUiUtility +LIBRARY glxmedialists.lib +LIBRARY glxcommonui.lib +LIBRARY glxcommon.lib + +LIBRARY flogger.lib // For Logging Tracer +LIBRARY ganes.lib +LIBRARY fbscli.lib +LIBRARY aknicon.lib +LIBRARY egul.lib +LIBRARY aknskins.lib diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/group/ut_cglxlistcontrol.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/group/ut_cglxlistcontrol.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2004 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:Package information for listcontrol +; + +; Supported languages +&en + +; Package header (one name for each supported language) +#{"ut_cglxlistcontrol"},(0x01700000),0,10,0 + +; Package signature + + +; Options line not supported currently + +; Conditions blocks not supported currently + +; Language independent files that are always installed +"ut_cglxlistcontrol.dll"-"!:\DigiaEUnit\Tests\ut_cglxlistcontrol.dll" + +; Language dependent files + + +; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) +(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/group/ut_cglxlistviewimp.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/group/ut_cglxlistviewimp.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2004 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: Package information for listview +; + +; Supported languages +&en + +; Package header (one name for each supported language) +#{"ut_cglxlistviewimp"},(0x01700000),0,10,0 + +; Package signature + + +; Options line not supported currently + +; Conditions blocks not supported currently + +; Language independent files that are always installed +"ut_cglxlistviewimp.dll"-"!:\DigiaEUnit\Tests\ut_cglxlistviewimp.dll" + +; Language dependent files + + +; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) +(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/inc/glxlistview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/inc/glxlistview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2008-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: List view implementation +* +*/ + + + + +#ifndef C_GLXLISTVIEW_H +#define C_GLXLISTVIEW_H + +// INCLUDES + +#include + +// CLASS DECLARATION + +/** + * Struct to hold resource ids + * + * @ingroup glx_view_list_view + */ +struct TListViewResourceIds + { + /// Avkon view resource ID. + TInt iViewId; + /// menu bar resource ID + TInt iMenuId; + /// Softkey resource ID + TInt iCbaId; + /// String resource ID for text to display when the list is empty + TInt iEmptyTextId; + }; + + +/** + * View which displays a vertically scrolling list control. + * + */ +class CGlxListView : public CGlxMediaListViewBase + { +public: + /** + * Two-phased constructor. + * + * @param aMediaListFactory object providing a media list + * @param aViewUid plugin implementation uid + * @param aResourceIds containing view specific resource ids + * @param aTitle title of the view + * + * @return pointer to created view + */ + IMPORT_C static CGlxListView* NewL(MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + TListViewResourceIds& aResourceIds, + const TDesC& aTitle = KNullDesC()); + + + /** + * Two-phased constructor. + * + * @param aMediaListFactory object providing a media list + * @param aViewUid plugin implementation uid + * @param aResourceIds containing view specific resource ids + * @param aTitle title of the view + * + * @return pointer to created view + */ + IMPORT_C static CGlxListView* NewLC(MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + TListViewResourceIds& aResourceIds, + const TDesC& aTitle = KNullDesC()); + + + /** + * Destructor. + */ + virtual ~CGlxListView(); + }; + +#endif // C_GLXLISTVIEW_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/inc/glxlistview.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/inc/glxlistview.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008-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: List View UID definition +* +*/ + + + + +#ifndef GLXLISTVIEW_HRH +#define GLXLISTVIEW_HRH + +#define KGlxListViewDllUid 0x20000A0D + +#endif // GLXLISTVIEW_HRH diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/inc/glxlistviewimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/inc/glxlistviewimp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2008-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: List view implementation +* +*/ + + + + + +#ifndef C_GLXLISTVIEWIMP_H +#define C_GLXLISTVIEWIMP_H + + +// INCLUDES +#include "glxlistview.h" +#include "glxpreviewthumbnailbinding.h" + +#include // Fetch context to retrieve thumbnails +#include // Interface for going through items in + +#include +#include + +// FORWARD DECLARATIONS +class MMPXCollectionUtility; +class CGlxPreviewThumbnailBinding; + +class CHgList; +class CAknsBasicBackgroundControlContext; + +// CLASS DECLARATION + +/** + * Implementation of preview list view. The view shows a vertically scrolling + * listbox with a highlight on the selected item. The selected item may also + * show additional information such as extra text and preview thumbnails. + * + * The view uses the mullistwidget + * + * When the list is empty, a static text string is displayed in the centre of + * the view, and the middle softkey is disabled. + * + */ + +NONSHARABLE_CLASS( CGlxListViewImp ) : public CGlxListView, + public MGlxMediaListObserver, + public MHgScrollBufferObserver, + public MHgSelectionObserver, + public MPreviewTNObserver + { +public: + /** + * Two-phased constructor. + * + * @param aMediaListFactory object providing a media list + * @param aViewUid ID of the view to create. + * @param aResourceIds containing view specific resource ids + * @param aTitle title of the view + * + * @return Pointer to newly created object. + */ + static CGlxListViewImp* NewL(MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + const TListViewResourceIds& aResourceIds, + const TDesC& aTitle); + + + /** + * Two-phased constructor. + * + * @param aMediaListFactory object providing a media list + * @param aViewUid ID of the view to create. + * @param aResourceIds containing view specific resource ids + * @param aTitle title of the view + * + * @return Pointer to newly created object. + */ + static CGlxListViewImp* NewLC(MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + const TListViewResourceIds& aResourceIds, + const TDesC& aTitle); + + /** + * Destructor. + */ + virtual ~CGlxListViewImp(); + + +private: + /** + * C++ default constructor. + * + * @param aViewUid ID of the view to create. + * @param aResourceIds containing view specific resource ids + */ + CGlxListViewImp(TInt aViewUid, const TListViewResourceIds& aResourceIds); + + /** + * By default Symbian 2nd phase constructor is private. + * + * @param aMediaListFactory object providing a media list + * @param aTitle title of the view + */ + void ConstructL(MGlxMediaListFactory* aMediaListFactory, const TDesC& aTitle); + + /** + * @return ID for the control group containing the list control. + */ + TInt ControlGroupId() const; + + // from base class CAknView + TUid Id() const; + + void DoMLViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + void DoMLViewDeactivate(); + + TBool HandleViewCommandL(TInt aCommand); + + /** + * HandleStatusPaneSizeChange. + * Called by the framework when the application status pane + * size is changed. + */ + void HandleStatusPaneSizeChange ( ); + + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + + /** + * Destroys the View Widget and Model for List Widget + */ + void DestroyListViewWidget(); + +protected: + void PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIndex); + +protected: + void Request(TInt aRequestStart, TInt aRequestEnd, THgScrollDirection aDirection); + void Release(TInt aReleaseStart, TInt aReleaseEnd); + +protected: + void HandleSelectL( TInt aIndex ); + void HandleOpenL( TInt aIndex ); + +private: + void CreateListL(); + +public: // from MGlxMediaListObserver + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + void HandleError( TInt aError ); + void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, + MGlxMediaList* aList ); + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + void HandlePopulatedL( MGlxMediaList* aList ); + +private: // Data + + CAknsBasicBackgroundControlContext* iBgContext; //Own + + CHgList* iList; //Own + + MGlxMediaList* iFocusedChildList; + + CGlxPreviewThumbnailBinding* iPreviewTNBinding; //Own + + // Fetch context for retrieving title attribute + CGlxDefaultAttributeContext* iTitleAttributeContext; + + // Fetch context for retrieving subtitle + CGlxDefaultAttributeContext* iSubtitleAttributeContext; + + // Thumbnail context + CGlxThumbnailContext* iThumbnailContext; //Own + + // for thumbnail context + TGlxSequentialIterator iThumbnailIterator; + + /** Unique ID of this Avkon view */ + TInt iViewUid; + + /** View specific resource ids */ + TListViewResourceIds iResourceIds; + + /// The animation being applied to the view + MGlxAnimation* iViewAnimation; + + TBool iPopulateListTNs; + + TInt iStartIndex; + + TInt iLastFocusedIndex; + + TBool iNextViewActivationEnabled; + // save title text + HBufC* iTitletext; + + }; + +#endif // C_GLXLISTVIEWIMP_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/inc/glxpreviewthumbnailbinding.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/inc/glxpreviewthumbnailbinding.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2008-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 : Class header for preview thumbnail in list view +* +*/ + + +#ifndef _GLXPREVIEWTHUMBNAILBINDING_H_ +#define _GLXPREVIEWTHUMBNAILBINDING_H_ + + +#include "glxbinding.h" // The binding is created by the binding set factory. +#include "glxmedialistiterator.h" // Interface for going through items in the list in a non-sequential order +#include "mglxmedialistobserver.h" // Observes for changes in media list +#include + + +class GlxThumbnailVariantType; +class CGlxThumbnailContext; // Fetch context to retrieve thumbnails + +/** + * Observer interface + */ +class MPreviewTNObserver + { +public: + virtual void PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIndex) = 0; + }; + +// CLASS DECLARATION +/** + * Implementation of preview thumbnail binding for the + * list view. + * + */ + + NONSHARABLE_CLASS(CGlxPreviewThumbnailBinding) : public CBase, + public MGlxMediaListObserver + { + public: + + /** + * Two phase construction + * @param aMulTag Mul field that the binding corresponds to + */ + static CGlxPreviewThumbnailBinding* NewL (MPreviewTNObserver& aObserver); + + /** + * Two phase construction + */ + static CGlxPreviewThumbnailBinding* NewLC(MPreviewTNObserver& aObserver ); // takes ownership + + + /** + * Destructor + */ + ~CGlxPreviewThumbnailBinding(); + + /** + * HasFirstThumbnail + */ + TBool HasFirstThumbnail( const RArray< TMPXAttribute >& aAttributes ); + +private: + + /** + * Constructor + */ + CGlxPreviewThumbnailBinding(MPreviewTNObserver& aObserver); + + /** + * Two phase construction + */ + void ConstructL(); + +public: + void HandleItemChangedL(const CMPXCollectionPath& aPath, TBool aPopulateListTNs); + void StartTimer(TBool aPopulateListTNs); + + // From MGlxMediaListObserver + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + void HandleError( TInt aError ); + void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, + MGlxMediaList* aList ); + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + +private: + /** + * IsTimeL + */ + static TInt IsTimeL( TAny* aSelf ); + + /** + * TimerTickedL + */ + void TimerTickedL(); + +private: + MPreviewTNObserver& iObserver; + + // Timer that checks for the time expiration + CPeriodic* iTimer; + + //Medialist that holds the thumbnail information + MGlxMediaList* iMediaList; + + // Thumbnail context + CGlxThumbnailContext* iThumbnailContext; + + // for thumbnail context + TGlxSequentialIterator iThumbnailIterator; + + // Preview thumbnail index + TInt iProgressIndex; + + // flag that says whether timer has expired + TBool iTimerTicked; + + //flag will be true, when initially the first thumbnails for all the + //items in the list are populated. + TBool iPopulateListTNs; + + //it holds the initial number of thumbnail to be displayed + RArray iPreviewItemCount; + + TSize iGridIconSize; + + // Holds the numbers of trials count,after which PreviewTNReady callback + // has to be called + TInt iTrialCount; + + TInt iTrial; +}; + + +#endif //_GLXPREVIEWTHUMBNAILBINDING_H_ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/src/glxlistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/src/glxlistview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of list view +* +*/ + + + + +// INCLUDE FILES +#include "glxlistview.h" +#include "glxlistviewimp.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxListView* CGlxListView::NewL( + MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + TListViewResourceIds& aResourceIds, + const TDesC& aTitle) + { + return CGlxListViewImp::NewL(aMediaListFactory, aViewUid, aResourceIds, aTitle); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxListView* CGlxListView::NewLC( + MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + TListViewResourceIds& aResourceIds, + const TDesC& aTitle) + { + return CGlxListViewImp::NewLC(aMediaListFactory, aViewUid, + aResourceIds, aTitle); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxListView::~CGlxListView() + { + // Do nothing + } +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/src/glxlistviewimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/src/glxlistviewimp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,714 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of list view +* +*/ + + + + +// INCLUDE FILES + +#include "glxlistviewimp.h" +#include "glxpreviewthumbnailbinding.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //MGlxMediaList +#include +#include //Glx Logs +#include +#include //CGlxMediaListMulModelProvider +#include +#include //StringLoader +#include + +const TInt KListDataWindowSize(10); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code that might leave. +// --------------------------------------------------------------------------- +// +CGlxListViewImp::CGlxListViewImp(TInt aViewUid, const TListViewResourceIds& aResourceIds): + iViewUid(aViewUid), + iResourceIds(aResourceIds) + { + } + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxListViewImp* CGlxListViewImp::NewL(MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + const TListViewResourceIds& aResourceIds, + const TDesC& aTitle) + { + TRACER("CGlxListViewImp::NewL"); + + CGlxListViewImp* self = CGlxListViewImp::NewLC(aMediaListFactory, aViewUid, + aResourceIds, aTitle); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxListViewImp* CGlxListViewImp::NewLC(MGlxMediaListFactory* aMediaListFactory, + TInt aViewUid, + const TListViewResourceIds& aResourceIds, + const TDesC& aTitle) + { + TRACER("CGlxListViewImp::NewLC"); + + CGlxListViewImp* self = new (ELeave) CGlxListViewImp(aViewUid, aResourceIds); + CleanupStack::PushL(self); + self->ConstructL(aMediaListFactory, aTitle); + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxListViewImp::ConstructL(MGlxMediaListFactory* aMediaListFactory, + const TDesC& aTitle) + { + TRACER("CGlxListViewImp::ConsrtuctL"); + + BaseConstructL(iResourceIds.iViewId); + ViewBaseConstructL(); + MLViewBaseConstructL(aMediaListFactory, aTitle); + CAknToolbar* toolbar = Toolbar(); + if(toolbar) + { + toolbar->DisableToolbarL(ETrue); + } + + //Register the view to recieve toolbar events. ViewBase handles the events + SetToolbarObserver(this); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxListViewImp::~CGlxListViewImp() + { + TRACER("CGlxListViewImp::~CGlxListViewImp"); + delete iTitletext; + } + +// --------------------------------------------------------------------------- +// ControlGroupId +// --------------------------------------------------------------------------- +// +TInt CGlxListViewImp::ControlGroupId() const + { + TRACER("CGlxListViewImp::ControlGroupId()"); + return reinterpret_cast(this); + } + +// --------------------------------------------------------------------------- +// From CAknView +// Returns views id. +// --------------------------------------------------------------------------- +// +TUid CGlxListViewImp::Id() const + { + TRACER("CGlxListViewImp::Id()"); + return TUid::Uid(iViewUid); + } + +// --------------------------------------------------------------------------- +// From CAknView +// Handles a view activation. +// --------------------------------------------------------------------------- +// +void CGlxListViewImp::DoMLViewActivateL(const TVwsViewId& /* aPrevViewId */, + TUid /* aCustomMessageId */, const TDesC8& /* aCustomMessage */) + { + TRACER("CGlxListViewImp::DoMLViewActivateL"); + iNextViewActivationEnabled = ETrue; + if(StatusPane()) + { + StatusPane()->MakeVisible(ETrue); + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + const TDesC* titletext = titlePane->Text(); + HBufC* temptitle = titletext->AllocLC(); + TPtr titleptr = temptitle->Des(); + titleptr.Trim(); + if(!temptitle->Length()) + { + if( iTitletext ) + { + // Set the required Title + titlePane->SetTextL( *iTitletext ); + } + } + CleanupStack::PopAndDestroy(temptitle); + } + + GlxSetAppState::SetState(EGlxInListView); + + // Separate contexts so that some attributes are loaded before others + iTitleAttributeContext = CGlxDefaultAttributeContext::NewL(); + iTitleAttributeContext->SetRangeOffsets( KListDataWindowSize, + KListDataWindowSize ); + iTitleAttributeContext->AddAttributeL( KMPXMediaGeneralTitle ); + + iSubtitleAttributeContext = CGlxDefaultAttributeContext::NewL(); + iSubtitleAttributeContext->SetRangeOffsets( KListDataWindowSize, + KListDataWindowSize ); + iSubtitleAttributeContext->AddAttributeL( + KGlxMediaCollectionPluginSpecificSubTitle ); + + iMediaList->AddContextL( iTitleAttributeContext, KMaxTInt ); + iMediaList->AddContextL( iSubtitleAttributeContext, KMaxTInt ); + + iMediaList->AddMediaListObserverL(this); + TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); + iBgContext = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgScreen,apRect,ETrue); + + iPreviewTNBinding = CGlxPreviewThumbnailBinding::NewL(*this); + CreateListL(); + if (iPreviewTNBinding) + { + iPopulateListTNs = ETrue; + CMPXCollectionPath* path = iMediaList->PathLC( + NGlxListDefs::EPathFocusOrSelection ); + iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs); + CleanupStack::PopAndDestroy( path ); + } + + } + +// --------------------------------------------------------------------------- +// From CAknView +// View deactivation function. +// --------------------------------------------------------------------------- +// +void CGlxListViewImp::DoMLViewDeactivate() + { + TRACER("CGlxListViewImp::DoMLViewDeactivate"); + if(StatusPane()) + { + if(iTitletext) + { + delete iTitletext; + iTitletext = NULL; + } + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + TRAP_IGNORE(CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + iTitletext = titlePane->Text()->AllocL()); + } + + iMediaList->RemoveContext( iTitleAttributeContext ); + delete iTitleAttributeContext; + iTitleAttributeContext = NULL; + + iMediaList->RemoveContext( iSubtitleAttributeContext ); + delete iSubtitleAttributeContext; + iSubtitleAttributeContext = NULL; + + iMediaList->RemoveMediaListObserver( this ); + delete iPreviewTNBinding; + iPreviewTNBinding = NULL; + DestroyListViewWidget(); + } + +// --------------------------------------------------------------------------- +// Destroys the Widget +// --------------------------------------------------------------------------- +// +void CGlxListViewImp::DestroyListViewWidget() + { + TRACER("CGlxListViewImp::DestroyListViewWidget"); + + if (iList) + { + AppUi()->RemoveFromStack(iList); + delete iList; + iList = NULL; + } + delete iBgContext; + iBgContext = NULL; + if(iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards ) + { + iLastFocusedIndex = 0; + } + } + +// --------------------------------------------------------------------------- +// From CGlxViewBase +// Command handling function. +// --------------------------------------------------------------------------- +// +TBool CGlxListViewImp::HandleViewCommandL(TInt aCommand) + { + TRACER("CGlxListViewImp::HandleViewCommandL"); + + if (aCommand == EAknCmdOpen) + { + //Navigational State to be used + if( iNextViewActivationEnabled ) + { + iNextViewActivationEnabled = EFalse; + iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); + //Navigate to the next view + CMPXCollectionPath* path = + iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); + iCollectionUtility->Collection().OpenL(*path); + CleanupStack::PopAndDestroy(path); + } + return ETrue; + } + else + { + return EFalse; + } + } + +// ----------------------------------------------------------------------------- +// Called by the framework when the application status pane +// size is changed. Passes the new client rectangle to the +// AppView +// ----------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleStatusPaneSizeChange ( ) + { + if ( iBgContext ) + { + TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); + iBgContext->SetRect( apRect ); + } + + if(iList) + { + TRAP_IGNORE (iList->InitScreenL(ClientRect()); ) + } + } + +TTypeUid::Ptr CGlxListViewImp::MopSupplyObject(TTypeUid aId) + { + if (iBgContext) + { + return MAknsControlContext::SupplyMopObject(aId, iBgContext ); + } + + return CAknView::MopSupplyObject(aId); + } + +void CGlxListViewImp::Request(TInt /*aRequestStart*/, TInt /*aRequestEnd*/, + THgScrollDirection /*aDirection*/) + { + TRACER("CGlxListViewImp::Request"); + } + +void CGlxListViewImp::Release(TInt /*aBufferStart*/, TInt /*aBufferEnd*/) + { + TRACER("CGlxListViewImp::Release"); + } + +void CGlxListViewImp::HandleSelectL( TInt aIndex ) + { + TRACER("CGlxListViewImp::HandleSelectL"); + if(0 <= aIndex && aIndex < iMediaList->Count()) + { + iPopulateListTNs = EFalse; + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, aIndex); + } + } + +void CGlxListViewImp::HandleOpenL( TInt aIndex ) + { + TRACER("CGlxListViewImp::HandleOpenL"); + if( iNextViewActivationEnabled && ( aIndex >= 0 && aIndex < + iMediaList->Count())) + { + iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aIndex); + iLastFocusedIndex = iMediaList->FocusIndex(); + iNextViewActivationEnabled = EFalse; + iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); + //Navigate to the next view + CMPXCollectionPath* path = + iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); + iCollectionUtility->Collection().OpenL(*path); + CleanupStack::PopAndDestroy(path); + } + } + +void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* + /*aMask*/, TInt /*aIndex*/) + { + TRACER("CGlxListViewImp::PreviewTNReadyL"); + + TInt focusIndex = iMediaList->FocusIndex(); + TInt mediaCount = iMediaList->Count(); + + if (aBitmap) + { + iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(aBitmap)); + } + else + { + //Displays default thumbnail if aBitmap is NULL + + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + CFbsBitmap* defaultBitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_notcreated); + AknIconUtils::SetSize(defaultBitmap, + CHgDoubleGraphicList::PreferredImageSize()); + + iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(defaultBitmap)); + } + + TInt firstIndex = iList->FirstIndexOnScreen(); + TInt itemsOnScreen = iList->ItemsOnScreen(); + TInt lastOnScreen = firstIndex + itemsOnScreen - 1; + if (lastOnScreen > (mediaCount - 1)) + { + lastOnScreen = mediaCount; + } + + if (!iPopulateListTNs || focusIndex == lastOnScreen) + { + GLX_DEBUG2("CGlxListViewImp::PreviewTNReadyL()" + " RefreshScreen - focusIndex(%d)", focusIndex); + iList->RefreshScreen(focusIndex); + } + + if (iPopulateListTNs) + { + if(iStartIndex == KErrNotFound) + { + iStartIndex = focusIndex; + } + + TInt count = iMediaList->Count(); + if(count) + { + TInt focus = (focusIndex+1)%count; + if (focus != iStartIndex) + { + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, focus); + } + else + { + iPopulateListTNs = EFalse; + + // iStartIndex holds the focus index of the item. + // If the focus is not on 0th index and if USB is Connected/Disconnected + // or some files are deleted from file manager, + // Once the updation of all items is done, the focus should be set to + // previous focus index(not to 0th index). + + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, + iStartIndex); + iList->SetSelectedIndex(iStartIndex); + iList->RefreshScreen(iStartIndex); + + iStartIndex = KErrNotFound; + + /* The medialist doesn't give the callback for focuschanged if the count is one. + * So we have to explicitly start the timer of 2 seconds after populating the list + * TN's ie., after gettting the first thumbnail. + * The callback is not given because the setfocus index is same as the focused index + * in medialist. + */ + if(count==1) + { + iPreviewTNBinding->StartTimer( iPopulateListTNs ); + } + } + } + } + } + +// ---------------------------------------------------------------------------- +// CreateListL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::CreateListL() + { + TRACER("CGlxListViewImp::CreateListL"); + + iPopulateListTNs = ETrue; + iStartIndex = KErrNotFound; + TInt mediaCount = iMediaList->Count(); + GLX_DEBUG2("CGlxListViewImp::CreateListL() mediaCount=%d", mediaCount); + + if (!iList) + { + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, + EMbmGlxiconsQgn_prop_image_notcreated); + AknIconUtils::SetSize(bitmap, + CHgDoubleGraphicList::PreferredImageSize()); + + iList = CHgDoubleGraphicList::NewL( + ClientRect(), + mediaCount, + CGulIcon::NewL(bitmap) ); + + iList->SetMopParent(this); + + iList->SetSelectionObserver(*this); + + if (iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards) + { + GLX_DEBUG1("CGlxListViewImp::CreateListL() - SetEmptyTextL()"); + //set the text to be shown if the list is empty. + HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); + iList->SetEmptyTextL(*emptyText); + CleanupStack::PopAndDestroy(emptyText); + iLastFocusedIndex = iMediaList->FocusIndex(); + } + + //Fix for ESLM-7SAHPT::Clear Flag to Disable QWERTY search input in list view + iList->ClearFlags(CHgScroller::EHgScrollerSearchWithQWERTY ); + + AppUi()->AddToStackL(iList); + } + + if (mediaCount) + { + for (TInt i=0; iItem(i); + iList->ItemL(i).SetTitleL(item.Title()); + iList->ItemL(i).SetTextL(item.SubTitle()); + } + + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); + iList->SetSelectedIndex(iLastFocusedIndex); + iList->RefreshScreen(iLastFocusedIndex); + } + } + +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxListViewImp::HandleItemAddedL"); + + if (iList) + { + for (TInt i = aStartIndex; i<= aEndIndex; i++) + { + const TGlxMedia& item = iMediaList->Item(i); + iList->InsertItem(CHgItem::NewL(CHgItem::EHgItemFlagsNone, + NULL, item.Title(), item.SubTitle()), i); + } + + if(aStartIndex == aEndIndex ) + { + iLastFocusedIndex = aStartIndex; + iPopulateListTNs = EFalse; + iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); + } + + iList->SetSelectedIndex(iLastFocusedIndex); + iList->RefreshScreen(iLastFocusedIndex); + } + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList ) + { + TRACER("CGlxListViewImp::HandleItemRemovedL"); + + if(iMediaList == aList) + { + for(TInt i = aStartIndex;i <= aEndIndex; i++ ) + { + iList->RemoveItem(i); + } + + if(aEndIndex >= iList->ItemCount()) + { + iList->SetSelectedIndex(iList->ItemCount()-1); + } + iList->RefreshScreen(iList->FirstIndexOnScreen()); + } + } + +// ---------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxListViewImp::HandleAttributesAvailableL"); + + TMPXAttribute titleAttrib(KMPXMediaGeneralTitle); + TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle); + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + const TGlxMedia& item = iMediaList->Item(aItemIndex); + + if (KErrNotFound != aAttributes.Find(titleAttrib, match)) + { + iList->ItemL(aItemIndex).SetTitleL(item.Title()); + iList->RefreshScreen(aItemIndex); + } + + if (KErrNotFound != aAttributes.Find(subTitleAttrib, match)) + { + iList->ItemL(aItemIndex).SetTextL(item.SubTitle()); + iList->RefreshScreen(aItemIndex); + + // Set iPopulateListTNs to ETrue and refresh all the items in + // list view if subtitle is updated + if (iPreviewTNBinding && !iPopulateListTNs) + { + iPopulateListTNs = ETrue; + iStartIndex = KErrNotFound; + CMPXCollectionPath* path = iMediaList->PathLC( + NGlxListDefs::EPathFocusOrSelection ); + iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs); + CleanupStack::PopAndDestroy( path ); + } + } + } + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleFocusChangedL( NGlxListDefs:: + TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER( "CGlxListViewImp::HandleFocusChangedL"); + + if (iPreviewTNBinding) + { + CMPXCollectionPath* path = iMediaList->PathLC( + NGlxListDefs::EPathFocusOrSelection ); + iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs); + CleanupStack::PopAndDestroy( path ); + } + } + +// ---------------------------------------------------------------------------- +// HandleItemSelected +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + } + +// ---------------------------------------------------------------------------- +// HandleMessageL +// ---------------------------------------------------------------------------- +// + void CGlxListViewImp::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleError( TInt /*aError*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleMediaL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandlePopulatedL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandlePopulatedL( MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxListViewImp::HandlePopulatedL()"); + if (iList) + { + //set the text to be shown if the list is empty. + HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); + iList->SetEmptyTextL(*emptyText); + CleanupStack::PopAndDestroy(emptyText); + + GLX_DEBUG2("CGlxListViewImp::HandlePopulatedL() MediaList Count()=%d", + iMediaList->Count()); + if (iMediaList->Count() <= 0) + { + GLX_DEBUG1("CGlxListViewImp::HandlePopulatedL() - SetEmptyTextL()"); + iList->DrawNow(); + } + } + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxListViewImp::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/listview/src/glxpreviewthumbnailbinding.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/listview/src/glxpreviewthumbnailbinding.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,430 @@ +/* +* Copyright (c) 2008-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 : Class defination for preview thumbnail in list view +* +*/ + + +#include +#include +#include // For TGlxFilterFactory +#include +#include "glxpreviewthumbnailbinding.h" +#include "glxgeneraluiutilities.h" +#include // For UiUtility instance + +#include +#include + +#include // Fetch context priority def'ns + +const TInt KInitialThumbnailsTimeDelay(100000); +const TInt KWaitCount(5); +const TInt KThumbnailStartTimeDelay(2000000); +const TInt KThumbnailIntervalTimeDelay(2000000); +const TInt KPreviewThumbnailFetchCount(18); + +// ---------------------------------------------------------------------------- +// NewL +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding* CGlxPreviewThumbnailBinding::NewL( + MPreviewTNObserver& aObserver) + { + TRACER("CGlxPreviewThumbnailBinding::NewL"); + CGlxPreviewThumbnailBinding* self = CGlxPreviewThumbnailBinding::NewLC(aObserver); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// NewLC +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding* CGlxPreviewThumbnailBinding::NewLC( + MPreviewTNObserver& aObserver) + { + TRACER("CGlxPreviewThumbnailBinding::NewLC"); + CGlxPreviewThumbnailBinding* self = new(ELeave)CGlxPreviewThumbnailBinding(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding::CGlxPreviewThumbnailBinding( + MPreviewTNObserver& aObserver) +: iObserver(aObserver) + { + } + +// ---------------------------------------------------------------------------- +// ConstructL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::ConstructL() + { + TRACER("CGlxPreviewThumbnailBinding::ConstructL"); + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + iGridIconSize = uiUtility->GetGridIconSize(); + uiUtility->Close() ; + } + + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CGlxPreviewThumbnailBinding::~CGlxPreviewThumbnailBinding() + { + TRACER("CGlxPreviewThumbnailBinding::~CGlxPreviewThumbnailBinding"); + // close any medialist that exist + if( iMediaList ) + { + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + delete iThumbnailContext; + iMediaList->Close(); + iMediaList = NULL; + } + + // cancel any outstanding request of the timer + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } + delete iTimer; + iTimer = NULL; + iPreviewItemCount.Close(); + } + +// ---------------------------------------------------------------------------- +// TimerTickedL: we need to update only when required i.e, when the thumbnail count +// has not reached till the max limit to be shown +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::TimerTickedL() + { + TRACER("CGlxPreviewThumbnailBinding::TimerTickedL"); + + if(iMediaList && iMediaList->Count() && iPreviewItemCount.Count() ) + { + TInt thumbnailIndex = iPreviewItemCount[iProgressIndex]; + if(thumbnailIndex < iMediaList->Count()) + { + const TGlxMedia& item = iMediaList->Item(thumbnailIndex); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( + thumbnailAttribute ); + if (value) + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + bitmap->Duplicate( value->iBitmap->Handle()); + iObserver.PreviewTNReadyL(bitmap, NULL,iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iPreviewItemCount.Count() || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + } + } + } + else if (iPopulateListTNs && iMediaList && iMediaList->Count() == 0) + { + if (iTrial == KWaitCount) + { + iObserver.PreviewTNReadyL(NULL, NULL, KErrNotFound); + iTrial=0; + return; + } + iTrial++; + } + else if(iMediaList && iMediaList->Count() ) + { + if(iProgressIndex > iMediaList->Count()-1 ) + { + iProgressIndex = 0; + } + const TGlxMedia& item = iMediaList->Item(iProgressIndex); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( + thumbnailAttribute ); + if (value) + { + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + bitmap->Duplicate( value->iBitmap->Handle()); + iObserver.PreviewTNReadyL(bitmap, NULL,iProgressIndex); + iProgressIndex++; + if (iProgressIndex >= KPreviewThumbnailFetchCount || + iProgressIndex >= iMediaList->Count()) + { + iProgressIndex = 0; + } + } + else + { + if (iTrialCount == KWaitCount) + { + iObserver.PreviewTNReadyL(NULL, NULL, KErrNotFound); + iTrialCount=0; + return; + } + iTrialCount++; + } + } + } +// ---------------------------------------------------------------------------- +// IsTimeL callback function invoked when timer expires +// ---------------------------------------------------------------------------- +// +TInt CGlxPreviewThumbnailBinding::IsTimeL( TAny* aSelf ) + { + TRACER("CGlxPreviewThumbnailBinding::IsTimeL"); + if (aSelf) + { + TRACER("CGlxPreviewThumbnailBinding::IsTimeL"); + CGlxPreviewThumbnailBinding* self = static_cast(aSelf); + if(self) + { + self->TimerTickedL(); + } + } + return KErrNone; + } + + +// ---------------------------------------------------------------------------- +// HandleItemChangedL +// This function basically closes the old medialist if any for ex. Tags, +// Captured.. and then opens a new medialist with teh required filter. +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemChangedL(const CMPXCollectionPath& aPath, + TBool aPopulateListTNs ) + { + TRACER("CGlxPreviewThumbnailBinding::HandleItemChangedL"); + iTimerTicked = EFalse; + iPopulateListTNs = aPopulateListTNs; + iProgressIndex = KErrNone; + + // remove and close old medialist + if( iMediaList ) + { + // Reset the trial and the trialCount to 0 while deleting the medialist + iTrial = 0; + iTrialCount = 0; + iMediaList->RemoveMediaListObserver( this ); + iMediaList->RemoveContext(iThumbnailContext); + delete iThumbnailContext; + iThumbnailContext = NULL; + iMediaList->Close(); + iMediaList = NULL; + } + + // Filter that filters out any GIF, corrupted images + CMPXFilter* filter = NULL; + filter = TGlxFilterFactory::CreatePreviewFilterL(); + CleanupStack::PushL( filter ); + // create new medialist with the required filter which filters out all DRM, GIFS and corrupt + // thumbnial + iMediaList = MGlxMediaList::InstanceL( aPath ,KGlxIdNone, filter); + iThumbnailContext = CGlxThumbnailContext::NewL( &iThumbnailIterator ); // set the thumbnail context + iThumbnailIterator.SetRange( KPreviewThumbnailFetchCount ); // request for fifiteen thumbnails + iThumbnailContext->SetDefaultSpec( iGridIconSize.iWidth,iGridIconSize.iHeight ); + iMediaList->AddContextL(iThumbnailContext ,KGlxFetchContextPriorityNormal ); + // adding the medialist to observ any changes or updates done + iMediaList->AddMediaListObserverL(this); + CleanupStack::PopAndDestroy( filter ); + + //Start the timer + StartTimer(iPopulateListTNs); + } + +// ---------------------------------------------------------------------------- +// StartTimer - Starts the timer based on the flag populateListTN's +// where the flag will be true, when initially the first thumbnails in the list +// are populated. +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::StartTimer(TBool aPopulateListTNs) + { + TRACER("CGlxPreviewThumbnailBinding::StartTimer"); + + iPopulateListTNs = aPopulateListTNs; + + if (iTimer) + { + iTimer->Cancel(); + } + + if (iPopulateListTNs) + { + iTimer->Start(KInitialThumbnailsTimeDelay, KInitialThumbnailsTimeDelay, + TCallBack(IsTimeL,this)); + } + else + { + iTimer->Start(KThumbnailStartTimeDelay, KThumbnailIntervalTimeDelay, + TCallBack(IsTimeL,this)); + } + } + +// ---------------------------------------------------------------------------- +// HasFirstThumbnail +// ---------------------------------------------------------------------------- +// + TBool CGlxPreviewThumbnailBinding::HasFirstThumbnail( const RArray< TMPXAttribute >& aAttributes ) + { + TRACER("CGlxPreviewThumbnailBinding::HasFirstThumbnail"); + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, + iGridIconSize.iWidth, + iGridIconSize.iHeight) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + return ( KErrNotFound != aAttributes.Find( thumbnailAttribute, match ) ); + } +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemAddedL( TInt /*aStartIndex*/, TInt + /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemRemovedL( TInt /*aStartIndex*/, TInt + /*aEndIndex*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleAttributesAvailableL +// Inside this function we are going to append the index for which we have valid +// thumbnails and when the number of available thumbnails become equal to the +// number of slots where thumbnail to be shown we go for updating them to visual +// item. +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxPreviewThumbnailBinding::HandleAttributesAvailableL"); + + TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, + GlxFullThumbnailAttributeId( ETrue, iGridIconSize.iWidth, + iGridIconSize.iHeight ) ); + + TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); + + if (KErrNotFound != aAttributes.Find( thumbnailAttribute, match )) + { + const TGlxMedia& item = iMediaList->Item( aItemIndex ); + const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( + thumbnailAttribute ); + if (value) + { + iPreviewItemCount.AppendL( aItemIndex ); + } + } + } + +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleFocusChangedL( NGlxListDefs:: + TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// ---------- ------------------------------------------------------------------ +// HandleItemSelected +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleMessageL +// ---------------------------------------------------------------------------- +// + void CGlxPreviewThumbnailBinding::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleError( TInt /*aError*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleCommandCompleteL( CMPXCommand* + /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleMediaL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleMediaL( TInt /*aListIndex*/, + MGlxMediaList* /*aList*/ ) + { + + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxPreviewThumbnailBinding::HandleItemModifiedL( const RArray& + /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/bwins/glxmetadatadialogu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/bwins/glxmetadatadialogu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + ?NewL@CGlxMetadataDialog@@SAPAV1@ABVTDesC16@@@Z @ 1 NONAME ; class CGlxMetadataDialog * CGlxMetadataDialog::NewL(class TDesC16 const &) + ?ActivateViewL@GlxMetadataViewUtility@@SAXABVTDesC16@@@Z @ 2 NONAME ; void GlxMetadataViewUtility::ActivateViewL(class TDesC16 const &) + ?ExecuteLD@CGlxMetadataDialog@@QAEHXZ @ 3 NONAME ; int CGlxMetadataDialog::ExecuteLD(void) + ?ExecuteLD@CGlxImgVwrMetadataDialog@@QAEHXZ @ 4 NONAME ; int CGlxImgVwrMetadataDialog::ExecuteLD(void) + ?GetResourceFilenameL@CGlxResourceUtilities@@SAXAAV?$TBuf@$0BAA@@@AAVRFs@@@Z @ 5 NONAME ; void CGlxResourceUtilities::GetResourceFilenameL(class TBuf<256> &, class RFs &) + ?GetResourceFilenameL@CGlxResourceUtilities@@SAXAAV?$TBuf@$0BAA@@@@Z @ 6 NONAME ; void CGlxResourceUtilities::GetResourceFilenameL(class TBuf<256> &) + ?NewL@CGlxImgVwrMetadataDialog@@SAPAV1@ABVTDesC16@@@Z @ 7 NONAME ; class CGlxImgVwrMetadataDialog * CGlxImgVwrMetadataDialog::NewL(class TDesC16 const &) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/data/glxmetadatadialog.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/data/glxmetadatadialog.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,486 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Metadata Dialog +* +*/ + + + + +//RESOURCE IDENTIFIER + + NAME MGMV + +//INCLUDES + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include "glxcommandhandlers.hrh" + +//RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="MGMV"; } + +// ----------------------------------------------------------------------------- +// +// Define default menu and CBA key. +// +// ----------------------------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + menubar = r_metadata_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; + } + +// ----------------------------------------------------------------------------- +// Metadata Dialog +// ----------------------------------------------------------------------------- +RESOURCE DIALOG r_metadata_dialog + { + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + flags = EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagCbaButtons | EEikDialogFlagWait;// |EEikDialogFlagNoBackgroundFade |EEikDialogFlagNoBorder; + items = + { + DLG_LINE + { + type = EMetaDataDialogListBox; + id = EMetaControlIdSettingList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = AVKON_SETTING_ITEM_LIST + { + items = + { + AVKON_SETTING_ITEM + { + identifier = ENameItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_title; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EDescriptionItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_description; + empty_item_text = " "; + }, + + AVKON_SETTING_ITEM + { + identifier = EAlbumsItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_albums; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = ETagsItem; + setting_page_resource = r_tags_name_setting_page; + name = qtn_lgal_details_tags; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EDateAndTimeItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_date_time; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = ELocationItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_location; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = ESizeItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_file_size; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EResolutionItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_resolution_title; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EDurationItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_duration; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = ElicenseItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_detail_drm; + empty_item_text = " "; + } + + }; + }; + } + }; + } + +RESOURCE AVKON_SETTING_PAGE r_metadata_name_settings_page + { + label = qtn_lgal_details_title; + type = EEikCtEdwin; + editor_resource_id = r_glx_edwin; + } + +RESOURCE POPUP_SETTING_LIST r_settingslist_details_setting_list + { + } + +RESOURCE AVKON_POPUP_SETTING_TEXTS r_meta_popuptext + { + setting_texts_resource = r_meta_sample_text; + } + +RESOURCE ARRAY r_meta_sample_text + { + items = + { + AVKON_ENUMERATED_TEXT + { + value = 1; + text = " "; + }, + AVKON_ENUMERATED_TEXT + { + value = 0; + text = " "; + } + }; + } +// ----------------------------------------------------------------------------- +// Slideshow settings music filename setting page +// ----------------------------------------------------------------------------- +RESOURCE AVKON_SETTING_PAGE r_tags_name_setting_page + { + label = qtn_lgal_details_tags; + type = EEikCtEdwin; + } +RESOURCE LBUF r_empty + { txt = "NOTEXT"; } + + +// ----------------------------------------------------------------------------- +// reource for menubar +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_metadata_menubar + { + titles= + { + MENU_TITLE { menu_pane = r_metadata_menu; txt = qtn_lgal_title_details; } + }; + } + +// ----------------------------------------------------------------------------- +// reource for menupane +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_metadata_menu + { + items= + { + //MENU_ITEM { command = KGlxEditBoundMenuCommandId; txt = qtn_lgal_options_edit; }, + MENU_ITEM { command = KGlxViewBoundMenuCommandId; txt = qtn_lgal_options_view; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; txt = qtn_lgal_option_show_on_map;}, + MENU_ITEM { command = KGlxDeleteBoundMenuCommandId; txt = qtn_lgal_options_delete;flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; } + }; + } + +// ----------------------------------------------------------------------------- +// +// metadata view custom resource +// +// ----------------------------------------------------------------------------- +// + +// ----------------------------------------------------------------------------- +// reource for CEikEdwin control +// ----------------------------------------------------------------------------- +// +RESOURCE EDWIN r_glx_edwin + { + flags = EAknEditorFlagDefault + | EEikEdwinNoAutoSelection + | EEikEdwinAvkonDisableCursor ; + width = 10; + lines= 1; + maxlength = 512; // Max number of characters + allowed_input_modes = EAknEditorTextInputMode; + default_input_mode = EAknEditorTextInputMode; + } + +// ----------------------------------------------------------------------------- +// reource for view title +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_title + { + buf = qtn_lgal_title_details; + } +// ----------------------------------------------------------------------------- +// reource for options edit +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_options_edit + { + buf = qtn_lgal_options_edit; + } + +// ----------------------------------------------------------------------------- +// reource for options delete +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_options_delete + { + buf = qtn_lgal_options_delete; + } + +// ----------------------------------------------------------------------------- +// reource for options view +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_options_view + { + buf = qtn_lgal_options_view; + } + +// ----------------------------------------------------------------------------- +// reource for options show on map +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_show_on_map_options_view + { + buf = qtn_lgal_option_show_on_map; + } + +// ----------------------------------------------------------------------------- +// reource for view title +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_title_details + { + buf = qtn_lgal_title_details; + } + +// ----------------------------------------------------------------------------- +// reource for metadata view title pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_title_nseries + { + buf = qtn_lgal_details_title; + } + +// ----------------------------------------------------------------------------- +// reource for metadata view description pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_description_nseries + { + buf = qtn_lgal_details_description; + } + +// ----------------------------------------------------------------------------- +// reource for metadata view tags pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_tags_nseries + { + buf = qtn_lgal_details_tags; + } +// ----------------------------------------------------------------------------- +// reource for metadata view albums pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_albums_nseries + { + buf = qtn_lgal_details_albums; + } +// ----------------------------------------------------------------------------- +// reource for metadata view location pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_location_nseries + { + buf = qtn_lgal_details_location; + } +// ----------------------------------------------------------------------------- +// reource for metadata view resolution pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_resolution_nseries + { + buf = qtn_lgal_details_resolution_title; + } +// ----------------------------------------------------------------------------- +// reource for metadata view duration pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_duration_nseries + { + buf = qtn_lgal_details_duration; + } +// ----------------------------------------------------------------------------- +// reource for metadata view drm pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_drm_nseries + { + buf = qtn_lgal_detail_drm; + } +// ----------------------------------------------------------------------------- +// reource for metadata view date and time pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_date_time_nseries + { + buf = qtn_lgal_details_date_time; + } +// ----------------------------------------------------------------------------- +// reource for metadata view file size pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_file_size_nseries + { + buf = qtn_lgal_details_file_size; + } +// ----------------------------------------------------------------------------- +// reource for metadata view file size pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_resolution_detail_nseries + { + buf = qtn_lgal_details_resolution_detail; + } + +// ----------------------------------------------------------------------------- +// reource for delete location confirmation note +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_note_delete_location + { + buf = qtn_lgal_note_delete_location; + } + +// ----------------------------------------------------------------------------- +// reource for no location info note +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_note_info_no_location + { + buf = qtn_lgal_note_no_location; + } + +//==============================================================================// +//===========================start of Imageviewer details Dialog================// +//==============================================================================// + +// ----------------------------------------------------------------------------- +// Metadata Dialog +// ----------------------------------------------------------------------------- +RESOURCE DIALOG r_img_viewer_metadata_dialog + { + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + flags = EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagCbaButtons | EEikDialogFlagWait;// |EEikDialogFlagNoBackgroundFade |EEikDialogFlagNoBorder; + items = + { + DLG_LINE + { + type = EMetaDataDialogListBox; + id = EMetaControlIdSettingList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = AVKON_SETTING_ITEM_LIST + { + items = + { + AVKON_SETTING_ITEM + { + identifier = EImgVwrNameItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_title; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EImgVwrDescriptionItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_description; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EImgVwrDateAndTimeItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_date_time; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EImgVwrSizeItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_file_size; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EImgVwrResolutionItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_details_resolution_title; + empty_item_text = " "; + }, + AVKON_SETTING_ITEM + { + identifier = EImgVwrlicenseItem; + setting_page_resource = r_metadata_name_settings_page; + name = qtn_lgal_detail_drm; + empty_item_text = " "; + } + + }; + }; + } + }; + } + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/eabi/glxmetadatadialogu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/eabi/glxmetadatadialogu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,17 @@ +EXPORTS + _ZN18CGlxMetadataDialog4NewLERK7TDesC16 @ 1 NONAME + _ZN18CGlxMetadataDialog9ExecuteLDEv @ 2 NONAME + _ZN21CGlxResourceUtilities20GetResourceFilenameLER4TBufILi256EE @ 3 NONAME + _ZN21CGlxResourceUtilities20GetResourceFilenameLER4TBufILi256EER3RFs @ 4 NONAME + _ZN22GlxMetadataViewUtility13ActivateViewLERK7TDesC16 @ 5 NONAME + _ZN24CGlxImgVwrMetadataDialog4NewLERK7TDesC16 @ 6 NONAME + _ZN24CGlxImgVwrMetadataDialog9ExecuteLDEv @ 7 NONAME + _ZTI18CGlxMetadataDialog @ 8 NONAME + _ZTI23CGlxMetadataAsyncUpdate @ 9 NONAME + _ZTI24CGlxImgVwrMetadataDialog @ 10 NONAME + _ZTI26CGlxMetadataCommandHandler @ 11 NONAME + _ZTV18CGlxMetadataDialog @ 12 NONAME + _ZTV23CGlxMetadataAsyncUpdate @ 13 NONAME + _ZTV24CGlxImgVwrMetadataDialog @ 14 NONAME + _ZTV26CGlxMetadataCommandHandler @ 15 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-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: Project build file +* +*/ + + + + +PRJ_EXPORTS + + + +PRJ_MMPFILES + +glxmetadatadialog.mmp + + +//End of files + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/group/glxmetadatadialog.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/group/glxmetadatadialog.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxmetadatadialog.dll +TARGETTYPE dll +UID 0x1000008D 0x20007193 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxmetadatadialog.cpp +SOURCE glxmetadatacontainer.cpp +SOURCE glxmetadataviewutility.cpp +SOURCE glxresourceutilities.cpp +SOURCE glxmetadatacommandhandler.cpp +SOURCE glximgvwrmetadatadialog.cpp +SOURCE glximgvwrmetadatacontainer.cpp + +SOURCEPATH ../data + +START RESOURCE ../data/glxmetadatadialog.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../inc +SYSTEMINCLUDE ../../viewbase/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../texturemanager/inc +SYSTEMINCLUDE ../../../dataprovider/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc //for attribute retrival +SYSTEMINCLUDE ../../../drmutility/inc //for drm utility +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../../collectionframework/plugins/glxcollectionplugincamera/inc +SYSTEMINCLUDE ../../../../collectionframework/plugins/tagcollectionplugin/inc +SYSTEMINCLUDE ../../../../collectionframework/plugins/glxcollectionpluginall/inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../commonui/inc + +LIBRARY euser.lib +LIBRARY avkon.lib //for Avkon conrols +LIBRARY eikcoctl.lib //for eik controls +LIBRARY eikcore.lib //for eik controls +LIBRARY eikctl.lib //for eik controls + +LIBRARY cone.lib //for CCoeEnv +LIBRARY commonengine.lib //for String loader +LIBRARY efsrv.lib //for TParse +LIBRARY glxmedialists.lib //for CGlxMedia +LIBRARY mpxcommon.lib //for TMPXAttribute +LIBRARY glxcommon.lib //for filter factory, CResourceUtilities +LIBRARY glxuiutilities.lib //for ui utility +LIBRARY glxcommoncommandhandlers.lib //For CGlxCommandHandlerAddToContainer +LIBRARY glxcommandhandlerbase.lib // Base command handlers +LIBRARY bafl.lib //for BaflUtils +LIBRARY hlplch.lib // for HlpLauncher +LIBRARY glxdrmutility.lib +// Uiaccelerator related libraries +LIBRARY osncore.lib // CAlfString +LIBRARY alfclient.lib // MAlfWidgetFactory +LIBRARY alfwidgetmodel.lib + +// MUL related libraries +LIBRARY libstdcpp.lib //for STL code +LIBRARY glxdataprovider.lib //data provider + +LIBRARY eikcdlg.lib +LIBRARY eikdlg.lib //for eik dialog +LIBRARY lbs.lib +LIBRARY exiflib.lib //For CExifModify +LIBRARY caf.lib //For ContentAccess +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/inc/glximgvwrmetadatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/inc/glximgvwrmetadatacontainer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,156 @@ +/* +* 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: +* +*/ +/* + * glximgvwrmetadatacontainer.h + * + * Created on: Oct 22, 2009 + * Author: sourbasu + */ + +#ifndef GLXIMGVWRMETADATACONTAINER_H_ +#define GLXIMGVWRMETADATACONTAINER_H_ + + +#include //media list +#include +#include // for CAknSettingItem +#include "mglxmedialistobserver.h" +#include + + +//FORWARD DECLARATION +class MGlxMediaList; +class CGlxDetailsMulModelProvider; +class CGlxCommandHandlerAddToContainer; + +#include "glxmedia.h" + +// CLASS DECLARATION +/** + * CGlxImgVwrMetadataContainer + * + * Metadata Container implementation + */ +NONSHARABLE_CLASS( CGlxImgVwrMetadataContainer ) : public CAknSettingItemList, +public MGlxMediaListObserver + + { +public: // Constructors and destructor + void ViewDynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane); + /** + * Symbian standard tow phase construction.Construct object of CGlxImgVwrMetadataContainer object. + * + * @param aRect rect for control + * @param aMediaList media list + * @return Metadata container object + */ + static CGlxImgVwrMetadataContainer* NewL( const TRect& aRect,const TDesC& aUri); + + /** + * Symbian standard tow phase construction.Construct object of CGlxImgVwrMetadataContainer object. + * + * @param aRect rect for control + * @param aMediaList media list + * @return Metadata container object + */ + static CGlxImgVwrMetadataContainer* NewLC( const TRect& aRect,const TDesC& aUri); + + /** + * Destructor + */ + ~CGlxImgVwrMetadataContainer(); + +public: + + // @ref CAknSettingItemList::CreateSettingItemL + CAknSettingItem* CreateSettingItemL(TInt aIdentifier); + + // @ref CAknSettingItemList::HandleListBoxEventL + void HandleListBoxEventL(CEikListBox* aListBox, + TListBoxEvent aEventType); + void HandleListboxChangesL(); + + //Enable disble the options based on the current selected item + TBool IsItemModifiable(); + //Change MSK + void ChangeMskL(); + //Enable marquee support + void EnableMarqueingL(); + + + + +public: + //MedialistObserver APIS + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + void HandleError( TInt aError ); + void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, + MGlxMediaList* aList ); + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + void HandleErrorL(); + MGlxMediaList& MediaList(); + void HandleCommandCompleteL(TAny* aSessionId, + CMPXCommand* /*aCommandResult*/, TInt aError, MGlxMediaList* aList); + +private: + + /** + * C++ constructor. + * + * @param aMediaList media list + */ + CGlxImgVwrMetadataContainer(const TDesC& aUri); + + /** + * Symbian 2nd phase constructor + * @param aRect rect for this control + */ + void ConstructL( const TRect& aRect); + void CreateMediaListForSelectedItemL(); + void SetAttributesL(TMPXAttribute attribute); + void EditItemL(TInt aIndex, TBool aCalledFromMenu); + void SetNameDescriptionL(TInt aItem); + void SetDurationLIicenseItemVisibilityL(); + TBool IsLicenseItem(); + +private: //data + + //Flag to check if the item is a video. + TBool iVideo; + //To check if marquee is enabled. + TBool iMarquee; + //to set visible license items based on the Item. + TBool iSetVisible; + RBuf iTextSetter; + const TDesC& iUri ; + MGlxMediaList* iItemMediaList; + CGlxAttributeContext* iMainListAttributecontext; + TGlxSelectionIterator iSelectionIterator; + + }; + + + +#endif /* GLXIMGVWRMETADATACONTAINER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/inc/glximgvwrmetadatadialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/inc/glximgvwrmetadatadialog.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2008-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: glximgvwrmetadatadialog.h +* +*/ + + + +#ifndef GLXIMGVWRMETADATADIALOG_H_ +#define GLXIMGVWRMETADATADIALOG_H_ + + + +// SYSTEM INCLUDES +#include + +#include +#include +// FORWARD DECLARATIONS +class CGlxMetadataCommandHandler; +class CGlxCommandHandlerAddToContainer; +class CGlxUiUtility; + +// CLASS DECLARATION +/** + * CGlxImgVwrMetadataDialog + * + * Metadata dialog implementation + */ +class CGlxImgVwrMetadataDialog : public CAknDialog + + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aURI uri or file name of item + */ + IMPORT_C static CGlxImgVwrMetadataDialog* NewL( const TDesC& aUri ); + + /** + * Destructor. + */ + virtual ~CGlxImgVwrMetadataDialog(); + +private : + CGlxImgVwrMetadataDialog(const TDesC& aUri); + + +public: // Functions from base classes + + /** + * Initializes the dialog and calls CAknDialog's + * ExecuteLD() + * This method need to be called to execute the dialog. + * After exiting the dialog gets automatically destroyed + * + * @return TInt ID value of the button that closed the dialog. + */ + IMPORT_C TInt ExecuteLD(); + + +protected: // Functions from base classes + + /** + * From MEikCommandObserver Prosesses menucommands + * + * @param aCommandId Commant value defined in resources. + */ + void ProcessCommandL( TInt aCommandId ); + + /** + * From MEikMenuObserver Initializes items on the menu + * + * @param aMenuId Current menu's resource Id + * @param aMenuPane Pointer to menupane + */ + void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane); + //hanldes orientation changes. + void HandleResourceChange( TInt aType ); + void SizeChanged(); + +private: + /** + * Initializes the dialog's controls before the dialog is sized and + * layed out. Empty by default. + */ + void PreLayoutDynInitL(); + + /** + * Initializes the dialog's controls after the dialog has been sized + * but before it has been activated. + */ + void PostLayoutDynInitL(); + /** + * Symbian 2nd phase constructor. + * + * @param aURI + */ + void ConstructL(); + + /** + * Constructs the Alf Environment and display + */ + void ConstructAlfEnvL(); + + /** + * Initalise the resource + * + */ + void InitResourceL(); + + /** + * To deal with any specific commands + * + * @param aCommand The command to respond to + * @return ETrue if the command has been handled. + * + */ + TBool HandleViewCommandL(TInt aCommand); + + + +private: + + void Draw( const TRect& /*aRect*/ ) const; + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + /** + * SetTitleL + * Sets title for view + * @param aTitleText title of view to be set + */ + void SetTitleL(const TDesC& aTitleText); + /** + * SetPreviousTitleL + * Sets title of previous view + */ + void SetPreviousTitleL(); + + void SetDetailsDlgToolbarVisibility(TBool aVisible); + +public: // from MEikDialogPageObserver + /** + * @ref MEikDialogPageObserver::CreateCustomControlL + */ + SEikControlInfo CreateCustomControlL(TInt aControlType); + +public: + /* + * + */ + void HandleToolbarResetting(TBool aVisible); + +private: //data + + TInt iResourceOffset; + TBool iStatusPaneAvailable; + CGlxUiUtility* iUiUtility; + HBufC* iPreviousTitle; + const TDesC& iUri; + CGlxImgVwrMetadataContainer* iContainer; + }; + + +#endif /* GLXIMGVWRMETADATADIALOG_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacommandhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacommandhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2008-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: Metadata dialog implementation +* +*/ + + +#ifndef GLXMETADATACOMMANDHANDLER_H_ +#define GLXMETADATACOMMANDHANDLER_H_ + + +#include +#include + +//Forward Decleration +class CGlxCommandHandlerAiwShowMap; +class CGlxMediaListCommandHandler; +/** +* CGlxMetadataCommandHandler +* +*/ +class CGlxMetadataCommandHandler :public CGlxMediaListCommandHandler + { +public: + /** + * Two-phase constructor NewL + * + * @param aEnv , Hui Environment + */ + static CGlxMetadataCommandHandler* NewL(MGlxMediaListProvider *aMediaListProvider ); + + /** Destructor + * + */ + ~CGlxMetadataCommandHandler(); + + /** OfferKeyEventL + * + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + +public: // From CGlxMediaListCommandHandler + /// See @ref CGlxMediaListCommandHandler::ExecuteL */ + TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); + + void PreDynInitMenuPaneL( TInt aResourceId ); + + void DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ); + +private: + /** + * 2nd phase Constructor + */ + void ConstructL(); + + /** + * Constructor + */ + CGlxMetadataCommandHandler(MGlxMediaListProvider* aMediaListProvider); + +private: + CGlxCommandHandlerAiwShowMap * iShowOnMapCmdHandler; + MGlxMediaListProvider* iMediaListProvider; + + }; + +#endif /*GLXMETADATACOMMANDHANDLER_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacontainer.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2008-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: Metadata dialog implementation +* +*/ + + +#ifndef C_GLXMETADATACONTAINER_H__ +#define C_GLXMETADATACONTAINER_H__ + +// INCLUDES + +#include //media list +#include +#include // for CAknSettingItem +#include "mglxmedialistobserver.h" +#include + +/* + * whenever some operation in details view happens,we need to refresh the toolbar area. + * Through this observer, we shall notify the main class to refresh the toolbar area. + */ +class MToolbarResetObserver + { +public: + virtual void HandleToolbarResetting(TBool aVisible)= 0; + }; + +//FORWARD DECLARATION +class MGlxMediaList; +class CGlxDetailsMulModelProvider; +class MGlxMetadataDialogObserver; +class CGlxCommandHandlerAddToContainer; +class CGlxMetadataAsyncUpdate; + +#include "glxmedia.h" + +// CLASS DECLARATION +/** + * CGlxMetadataContainer + * + * Metadata Container implementation + */ +NONSHARABLE_CLASS( CGlxMetadataContainer ) : public CAknSettingItemList, +public MGlxMediaListObserver + + { +public: // Constructors and destructor + void ViewDynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane); + /** + * Symbian standard tow phase construction.Construct object of CGlxMetadataContainer object. + * + * @param aRect rect for control + * @param aMediaList media list + * @return Metadata container object + */ + static CGlxMetadataContainer* NewL( const TRect& aRect, + MGlxMetadataDialogObserver& aDialogObserver, + const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs ); + + /** + * Symbian standard tow phase construction.Construct object of CGlxMetadataContainer object. + * + * @param aRect rect for control + * @param aMediaList media list + * @return Metadata container object + */ + static CGlxMetadataContainer* NewLC( const TRect& aRect, + MGlxMetadataDialogObserver& aDialogObserver, + const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs); + + /** + * Destructor + */ + ~CGlxMetadataContainer(); + +public: + + // @ref CAknSettingItemList::CreateSettingItemL + CAknSettingItem* CreateSettingItemL(TInt aIdentifier); + + // @ref CAknSettingItemList::HandleListBoxEventL + void HandleListBoxEventL(CEikListBox* aListBox, + TListBoxEvent aEventType); + void HandleListboxChangesL(); + + //Enable disble the options based on the current selected item + TBool IsItemModifiable(); + TBool IsLicenseItem(); + TBool IsLocationItem(); + + //Delete the location information + void RemoveLocationL(); + //Change MSK + void ChangeMskL(); + //Enable marquee support + void EnableMarqueingL(); +private: + + /** + * C++ constructor. + * + * @param aMediaList media list + */ + CGlxMetadataContainer(MGlxMetadataDialogObserver& aDialogObserver,const TDesC& aUri + ,MToolbarResetObserver& aResetToolbarObs); + + /** + * Symbian 2nd phase constructor + * @param aRect rect for this control + */ + void ConstructL( const TRect& aRect); + + /** + * Create media list with URI filter + * This function creates the collection path filter and finally the MediaList + * + * @param aIsRename If ETrue,then MediaList is created with iModifiedUri + * ,if EFalse,then created with iUri + */ + void CreateMediaListForSelectedItemL(TBool aIsRename = EFalse); + /** + * Create media list to get the tags list for the particular Item. + * This function creates the collection path filter and finally the MediaList + * + */ + void CreateTagsMediaListL(); + /** + * Create media list to get the Albums list for the particular Item. + * This function creates the collection path filter and finally the MediaList + * + * @param aItemURI uri or file name of item + */ + void CreateAlbumsMediaListL(); + //Set attributes to the settings list once fetched from medialist. + void SetAttributesL(TMPXAttribute attribute); + //Set the modifed name or description to the list and MDS + void SetNameDescriptionL(TInt aItem); + //Sets the duration and license items based on the selected item + void SetDurationLIicenseItemVisibilityL(); + //updates the tags item on callback. + void UpdateTagsL(); + //updates the Albums item on callback. + void UpdateAlbumsL(); + //Update the details field. + void EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/); + /** + * Parse the drive, path & extension from the old uri, + * And return the modified uri by appending the new title + * + * @param aTitleText new title entered by user. + * @return TFileName as modified uri + */ + TFileName ParseFileName(const TDesC& aTitleText); +public: + //MedialistObserver APIS + void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ); + void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */); + void HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ); + void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ); + void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ); + void HandleError( TInt aError ); + void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, + MGlxMediaList* aList ); + void HandleMediaL( TInt aListIndex, MGlxMediaList* aList ); + void HandleItemModifiedL( const RArray& aItemIndexes, MGlxMediaList* aList ); + void HandleErrorL(); + MGlxMediaList& MediaList(); + void HandleCommandCompleteL(TAny* aSessionId, + CMPXCommand* /*aCommandResult*/, TInt aError, MGlxMediaList* aList); + /** + * Create new mediaList with modified filename. + */ + void RefreshMediaListL(); + +private: //data + + MGlxMetadataDialogObserver& iDialogObesrver; + //Flag to check if the item is a video. + TBool iVideo; + //To check if marquee is enabled. + TBool iMarquee; + //to set visible duration and license items based on the Item. + TBool iSetVisible; + TBool iLocationinfo; + RBuf iTextSetter; + RBuf iTagSetter; + RBuf iAlbumSetter; + const TDesC& iUri ; + MGlxMediaList* iItemMediaList; + MGlxMediaList* iTagMediaList; + MGlxMediaList* iAlbumMediaList; + CGlxDefaultAttributeContext* iAlbumContext; + CGlxDefaultAttributeContext* iTagContext; + TGlxSelectionIterator iSelectionIterator; + CGlxAttributeContext* iMainListAttributecontext; + MToolbarResetObserver& iResetToolbarObs; // observer + //New variable introduce to hold the modified uri name + //since iUri is const type. + HBufC* iModifiedUri; + CGlxMetadataAsyncUpdate* iAsyncRequest; + }; + +/** + * CGlxMetadataAsyncUpdate + * + * Metadata asynchronous update implementation + * Asynchronously refreshing the MediaList because it can't be done in any MediaList callback. + */ +class CGlxMetadataAsyncUpdate: public CActive + { + + public: + /** + * Symbian standard two phase construction.Construct object of CGlxMetadataAsyncUpdate class. + * + * @param aObserver CGlxMetadataContainer + * @return MetadataAsynchronous object + */ + static CGlxMetadataAsyncUpdate* NewL(CGlxMetadataContainer& aObserver); + /** + * Symbian standard two phase construction.Construct object of CGlxMetadataAsyncUpdate class. + * + * @param aObserver CGlxMetadataContainer + * @return MetadataAsynchronous object + */ + static CGlxMetadataAsyncUpdate* NewLC(CGlxMetadataContainer& aObserver); + /** + * Destructor + */ + ~CGlxMetadataAsyncUpdate(); + /** + * Completes the active object causing a call from the + * active scheduler to RunL() + * (test in RunL using iStatus.Int()) + */ + void CompleteSelf(); + private: + /** + * C++ constructor. + * + * @param aObserver CGlxMetadataContainer + */ + CGlxMetadataAsyncUpdate(CGlxMetadataContainer& aObserver); + // from CActive + void RunL(); + void DoCancel(); + + private: + CGlxMetadataContainer& iObserver; + }; +#endif //C_GLXMETADATACONTAINER_H__ + +//End of file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/inc/glxmetadatadialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/inc/glxmetadatadialog.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2008-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: Metadata dialog implementation +* +*/ + + +#ifndef GLXMETADATADIALOG_H +#define GLXMETADATADIALOG_H + +// SYSTEM INCLUDES +#include + +#include + +#include "glxmetadatacontainer.h" +#include "mglxmedialistprovider.h" +#include "mglxmedialistobserver.h" +#include +#include "glxmedia.h" + + +// FORWARD DECLARATIONS +class CGlxMetadataCommandHandler;class CGlxCommandHandlerAddToContainer; +class CGlxUiUtility; + +// CLASS DECLARATION +/** + * CGlxMetadataDialog + * + * Metadata dialog implementation + */ +class CGlxMetadataDialog : public CAknDialog, + public MGlxMediaListProvider, + public MGlxMetadataDialogObserver, + public MToolbarResetObserver + + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @param aURI uri or file name of item + */ + IMPORT_C static CGlxMetadataDialog* NewL( const TDesC& aUri ); + + /** + * Destructor. + */ + virtual ~CGlxMetadataDialog(); + +private : + CGlxMetadataDialog(const TDesC& aUri); + + +public: // Functions from base classes + + /** + * Initializes the dialog and calls CAknDialog's + * ExecuteLD() + * This method need to be called to execute the dialog. + * After exiting the dialog gets automatically destroyed + * + * @return TInt ID value of the button that closed the dialog. + */ + IMPORT_C TInt ExecuteLD(); + + /** + * From CEikDialog. Handles button events and checks if the dialog + * can be closed + * + * @param aKeycode Id of the 'pressed' button + * + * @return EFalse if Options menu was pressed + * ETrue otherwise + */ + TBool OkToExitL( TInt aKeycode ); + /* + * From MToolbarResetObserver + */ + void HandleToolbarResetting(TBool aVisible); + +protected: // Functions from base classes + + /** + * From MEikCommandObserver Prosesses menucommands + * + * @param aCommandId Commant value defined in resources. + */ + void ProcessCommandL( TInt aCommandId ); + + /** + * From CCoeControl Handles key events + * + * @param aKeyEvent TKeyEvent + * @param aType TEventCode + * + * @return TKeyResponse depending on was is consumed or not. + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * From MEikMenuObserver Initializes items on the menu + * + * @param aMenuId Current menu's resource Id + * @param aMenuPane Pointer to menupane + */ + void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane); + //hanldes orientation changes. + void HandleResourceChange( TInt aType ); + void SizeChanged(); + +private: + /** + * Initializes the dialog's controls before the dialog is sized and + * layed out. Empty by default. + */ + void PreLayoutDynInitL(); + + /** + * Initializes the dialog's controls after the dialog has been sized + * but before it has been activated. + */ + void PostLayoutDynInitL(); + /** + * Symbian 2nd phase constructor. + * + * @param aURI + */ + void ConstructL(); + + /** + * Constructs the Alf Environment and display + */ + void ConstructAlfEnvL(); + + /** + * Initalise the resource + * + */ + void InitResourceL(); + + /** + * To deal with any specific commands + * + * @param aCommand The command to respond to + * @return ETrue if the command has been handled. + * + */ + TBool HandleViewCommandL(TInt aCommand); + + /** + * Returns reference to the current media list + * + */ + MGlxMediaList& MediaList(); + +private: + + void Draw( const TRect& /*aRect*/ ) const; + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + /** + * SetTitleL + * Sets title for view + * @param aTitleText title of view to be set + */ + void SetTitleL(const TDesC& aTitleText); + /** + * SetPreviousTitleL + * Sets title of previous view + */ + void SetPreviousTitleL(); + /** + * Find out the items nature to set the corresponding options + */ + void OnLocationEditL(); + void AddTagL(); + void AddAlbumL(); + void SetDetailsDlgToolbarVisibility(TBool aVisible); + +public: // from MEikDialogPageObserver + /** + * @ref MEikDialogPageObserver::CreateCustomControlL + */ + SEikControlInfo CreateCustomControlL(TInt aControlType); + +private: //data + + TInt iResourceOffset; + TBool iStatusPaneAvailable; + CGlxMetadataContainer* iContainer; + CGlxMetadataCommandHandler* iMetadataCmdHandler;//own + CGlxUiUtility* iUiUtility; + HBufC* iPreviousTitle; + const TDesC& iUri; + CGlxCommandHandlerAddToContainer* iAddToTag; + CGlxCommandHandlerAddToContainer* iAddToAlbum; + }; + +#endif // GLXMETADATADIALOG_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/inc/glxresourceutilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/inc/glxresourceutilities.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2008-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: Metadata dialog implementation +* +*/ + + + + + +#ifndef __C_GLXRESOURCELOADER_H__ +#define __C_GLXRESOURCELOADER_H__ + +#include +#include // for TFileName +#include +#include // Rfs + +/** + * Class with a single static method which + * finds the resource file on either the c or z drive + * class CGlxResourceUtil + * @author Loughlin Spollen + */ +NONSHARABLE_CLASS( CGlxResourceUtilities ) : CBase + { +public: + + /** + * Retrieve the full resource file name and path for a give resource + * file name. + * Note! this version connects a RFs session + * @param The resource filename to search + */ + IMPORT_C static void GetResourceFilenameL( TFileName& aResFile ); + + /** + * Retrieve the full resource file name and path for a give resource + * file name. + * @param The resource filename to search + * @param The file server session, must be connected before the call + */ + IMPORT_C static void GetResourceFilenameL( TFileName& aResFile, RFs& aFs ); + }; + + +#endif // __C_GLXRESOURCELOADER_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/inc/mglxmetadatadialogobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/inc/mglxmetadatadialogobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2008-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: Metadata dialog implementation +* +*/ + + + + +#ifndef MGLXMETADATADIALOGOBSERVER_H_ +#define MGLXMETADATADIALOGOBSERVER_H_ + +/** + * MGlxMetadataDialogObserver + * List event notification interface + */ +class MGlxMetadataDialogObserver + { + public: + /* OnLocationEditL + * On Lacation Pane select for launching optons + **/ + virtual void OnLocationEditL() = 0; + virtual void AddTagL() = 0; + virtual void AddAlbumL() = 0; + }; + +#endif /*MGLXMETADATADIALOGOBSERVER_H_*/ + +//EOF \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatacontainer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,749 @@ +/* +* 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: +* +*/ +/* + * glximgvwrmetadatacontainer.cpp + * + * Created on: Oct 22, 2009 + * Author: sourbasu + */ + + +#include "glximgvwrmetadatacontainer.h" +#include "glxustringconverter.h" // converts the symbian types to UString type +#include +#include +#include +#include +#include +#include +#include +#include //Details data provider +#include +#include // For CGlxCommandHandlerAddToContainer +#include // for command handler id +#include //for command factory +#include // Content ID identifying general category of content provided + +#include +#include +#include +#include // tag collection plugin uid +#include // KGlxMediaIdThumbnail +#include // CGlxAttributeReteiver +#include +#include //For launching DRM details pane +#include // General utilties class definition +#include +#include //For CExifModify +#include +#include +#include + +//marquee + +#include +#include +const TInt KMaxMediaPopupTitleLength = 0x100; +const TInt KMediaListId = 0x2000D248; +const TInt KMarqueeLoopCount = 3; +const TInt KMarqueeScrollAmount = 20; +const TInt KMarqueeScrollDelay = 1000000; +const TInt KMarqueeScrollInterval = 200000; +_LIT( KGlxTextSetter, ""); + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewL( const TRect& aRect,const TDesC& item) + { + TRACER("CGlxImgVwrMetadataContainer::NewL"); + CGlxImgVwrMetadataContainer* self = CGlxImgVwrMetadataContainer::NewLC( aRect,item); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// NewLC +// --------------------------------------------------------- +// +CGlxImgVwrMetadataContainer* CGlxImgVwrMetadataContainer::NewLC( const TRect& aRect,const TDesC& aUri) + { + TRACER("CGlxImgVwrMetadataContainer::NewLC"); + CGlxImgVwrMetadataContainer* self = new(ELeave) CGlxImgVwrMetadataContainer(aUri); + CleanupStack::PushL(self); + self->ConstructL( aRect); + return self; + } + +// --------------------------------------------------------- +// CGlxImgVwrMetadataContainer +// --------------------------------------------------------- +// +CGlxImgVwrMetadataContainer::CGlxImgVwrMetadataContainer(const TDesC& aUri) +:iUri(aUri) + { + // No implementation + } + +// --------------------------------------------------------- +// CGlxImgVwrMetadataContainer::ConstructL +// --------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::ConstructL( const TRect& /*aRect*/ ) + { + //Creating the RBuf texts for all the items except tags & albums + //which would be updated as whne the item is edited + iTextSetter.CreateL(KMaxFileName); + CreateMediaListForSelectedItemL(); + } + +// --------------------------------------------------------- +// ~CGlxImgVwrMetadataContainer +// --------------------------------------------------------- +// +CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer() + { + TRACER("CGlxImgVwrMetadataContainer::~CGlxImgVwrMetadataContainer"); + if( iItemMediaList ) + { + iItemMediaList->RemoveContext(iMainListAttributecontext); + iItemMediaList->RemoveMediaListObserver(this); + iItemMediaList->Close(); + iItemMediaList = NULL; + } + if( iMainListAttributecontext ) + { + delete iMainListAttributecontext; + iMainListAttributecontext = NULL; + } + if( IsVisible() ) + { + MakeVisible(EFalse); + } + iTextSetter.Close(); + } + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::MediaList +//----------------------------------------------------------------------------- +MGlxMediaList& CGlxImgVwrMetadataContainer::MediaList() + { + //returns the active medialist. + return *iItemMediaList; + } + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::CreateSettingItemL +//----------------------------------------------------------------------------- +CAknSettingItem* CGlxImgVwrMetadataContainer::CreateSettingItemL(TInt aResourceId) + { + TRACER("CGlxImgVwrMetadataContainer::CreateSettingItemL"); + CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack + iTextSetter.Copy(KGlxTextSetter); + + //Creating a empty Settings list box which will be populated with metadata in handleattributeavailable + + switch(aResourceId) + { + case EImgVwrNameItem: + case EImgVwrDateAndTimeItem: + case EImgVwrDescriptionItem: + { + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iTextSetter ); + + break; + } + case EImgVwrSizeItem: + case EImgVwrResolutionItem: + { + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iTextSetter ); + + break; + } + + case EImgVwrlicenseItem: + { + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iTextSetter ); + //Hide the item until we get the attributes + //where in we check for the usage rights. + settingItem->SetHidden(ETrue); + //Required to refresh the listbox when any items visiblity is changed + this->HandleChangeInItemArrayOrVisibilityL(); + } + break; + + default: + { + break; + } + } + return settingItem; + } +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::IsItemModifiable +//----------------------------------------------------------------------------- +TBool CGlxImgVwrMetadataContainer::IsItemModifiable() + { + //Only items like name , description, tag and albums are modifiable + //The check is for the items from ENameItem(0) tille ETagsItem(4) + if(ListBox()->CurrentItemIndex()<=ETagsItem) + { + return EFalse; + } + //return ETrue to dim the item + return ETrue; + + } + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::HandleListBoxEventL +//----------------------------------------------------------------------------- +void CGlxImgVwrMetadataContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, + TListBoxEvent aEventType) + { + GLX_LOG_INFO("CGlxImgVwrMetadataContainer::HandleListBoxEventL"); + if ((aEventType == EEventEnterKeyPressed) || + (aEventType == EEventEditingStarted) || + (aEventType == EEventItemDoubleClicked)) + { + //handle edit functionality if items when useer selects via touch + HandleListboxChangesL(); + } + } +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::HandleListboxChangesL +//----------------------------------------------------------------------------- +void CGlxImgVwrMetadataContainer::HandleListboxChangesL() + { + + TInt index = ListBox()->CurrentItemIndex(); + + switch(index) + { + case EImgVwrNameItem: + case EImgVwrDescriptionItem: + { + SetNameDescriptionL(index); + break; + } + + case EImgVwrlicenseItem: + { + + //Create DRM utility + CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); + CleanupClosePushL(*drmUtility); + drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri()/*iUri*/); + CleanupStack::PopAndDestroy(drmUtility); + } + break; + default: + { + break; + } + } + + } + + +// ---------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane) + { + if( aMenuId == R_METADATA_MENU ) + { + //Set dim the options based on the utem selected + //Viewdetails option will be availble only for the license item + aMenuPane->SetItemDimmed(KGlxViewBoundMenuCommandId,IsLicenseItem()); + } + } + +//Medialist callbacks. +// ---------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::HandleAttributesAvailableL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleAttributesAvailableL( TInt /*aItemIndex*/, + const RArray& aAttributes, MGlxMediaList* aList ) + { + + TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()"); + //generic medialist for the item for all the attributes required other than tags and albums. + TInt x = aAttributes.Count(); + if(aList == iItemMediaList) + { + // Loop untill it checks for all the avialable attributes + for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--) + { + //set attributes to the items in the container + SetAttributesL(aAttributes[i]); + } + } + + } + +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* aList ) + { + if(!iMarquee) + { + EnableMarqueingL(); + } + SetDurationLIicenseItemVisibilityL(); + if(aList == iItemMediaList) + { + if(iItemMediaList->Count()) + { + TGlxMedia item = iItemMediaList->Item(0); + CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); + CleanupStack::PushL(stringConverter ); + for(TInt index = 0; index <= 4; index++) + { + HBufC* string = NULL; + + if(index == EImgVwrSizeItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralSize,0, string ); + } + else if(index == EImgVwrNameItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralTitle,0, string ); + } + else if(index == EImgVwrDateAndTimeItem) + { + stringConverter->AsStringL( item, + KMPXMediaGeneralDate, + R_QTN_DATE_USUAL_WITH_ZERO,string ); + } + else if(index == EImgVwrDescriptionItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralComment,0, string ); + } + else if(index == EImgVwrResolutionItem) + { + stringConverter->AsStringL(item, + KGlxMediaGeneralDimensions,0, string ); + } + else + { + //no implementation + } + if(string) + { + iTextSetter.Copy(KGlxTextSetter); + iTextSetter.Append(*string); + } + EditItemL(index,EFalse); + delete string; + string = NULL; + } + CleanupStack::PopAndDestroy(stringConverter ); + } + } + + + } +// ---------------------------------------------------------------------------- +// EnableMarqueingL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::EnableMarqueingL() + { + TRACER("CGlxImgVwrMetadataContainer::EnableMarqueingL()"); + iMarquee = ETrue; + ListBox()->UseLogicalToVisualConversion(ETrue); + ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount, + KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval); + ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + } +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleCommandCompleteL(TAny* aSessionId, + CMPXCommand* /*aCommandResult*/, TInt aError, MGlxMediaList* aList) + { + TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()"); + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleItemRemovedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleItemRemovedL()"); + } +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleFocusChangedL( NGlxListDefs:: + TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleFocusChangedL()"); + } +// ---------------------------------------------------------------------------- +// HandleItemSelected +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleItemSelectedL"); + } +// ---------------------------------------------------------------------------- +// HandleMessageL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleMessageL()"); + } +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleError( TInt /*aError*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleError()"); + TRAP_IGNORE(HandleErrorL()); + } + +// ---------------------------------------------------------------------------- +// HandleErrorL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleErrorL() + { + TRACER("CGlxImgVwrMetadataContainer::HandleErrorL()"); + } +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleCommandCompleteL()"); + } + +// ---------------------------------------------------------------------------- +// HandleMediaL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleMediaL()"); + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxImgVwrMetadataContainer::HandleItemModifiedL()"); + } +// ---------------------------------------------------------------------------- +// ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::ChangeMskL() + { + TRACER("CGlxImgVwrMetadataContainer::ChangeMsk()"); + TInt index = ListBox()->CurrentItemIndex(); + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + switch(index) + { + case EImgVwrNameItem: + case EImgVwrDescriptionItem: + + { + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT); + } + break; + case EImgVwrDateAndTimeItem: + case EImgVwrSizeItem: + case EImgVwrResolutionItem: + case EImgVwrlicenseItem: + { + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEdit,R_GLX_METADATA_MSK_BLANK); + } + break; + default: + { + break; + } + } + + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL +//----------------------------------------------------------------------------- +void CGlxImgVwrMetadataContainer::CreateMediaListForSelectedItemL() + { + TRACER("CGlxMetadataContainer::CreateMediaListL"); + + //create the collection path for the medialist to be created + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI + path->AppendL(/*KGlxCollectionPluginAllImplementationUid*/KGlxCollectionPluginImageViewerImplementationUid); + //create the filter with the URI + CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(iUri); + CleanupStack::PushL( filter ); + //create the medialist + iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter); + + //Add the attributes which are required to be displayed. + iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator); + iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize); + iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDate); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment); + + //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes. + iItemMediaList->AddContextL( iMainListAttributecontext, + KGlxFetchContextPriorityBlocking ); + + //add to observer for callbacks. + iItemMediaList->AddMediaListObserverL(this); + + CleanupStack::PopAndDestroy( filter ); + CleanupStack::PopAndDestroy( path ); + } +// ---------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::SetAttributes +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::SetAttributesL(TMPXAttribute attribute) + { + TRACER("CGlxImgVwrMetadataContainer::SetAttributesL"); + + if(!iSetVisible) + { + iSetVisible = ETrue; + SetDurationLIicenseItemVisibilityL(); + } + TGlxMedia item = iItemMediaList->Item(0); + //Create the string convertor instance + //String convertor class with provide the specific format for date,location and duration and size. + CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); + CleanupStack::PushL(stringConverter ); + HBufC* string = NULL; + + //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null + if(attribute == KMPXMediaGeneralDate) + { + stringConverter->AsStringL(item, + attribute, + R_QTN_DATE_USUAL_WITH_ZERO, string ); + } + else + { + stringConverter->AsStringL(item, + attribute,0, string ); + } + //get the settings item based on the attribute and set the text. + if ( string ) + { + iTextSetter.Copy(KGlxTextSetter); + iTextSetter.Append(*string); + if(attribute == KMPXMediaGeneralSize) + { + EditItemL(EImgVwrSizeItem,EFalse); + } + else if(attribute == KMPXMediaGeneralTitle) + { + EditItemL(EImgVwrNameItem,EFalse); + } + else if(attribute == KMPXMediaGeneralDate) + { + EditItemL(EImgVwrDateAndTimeItem,EFalse); + } + else if(attribute == KMPXMediaGeneralComment) + { + EditItemL(EImgVwrDescriptionItem,EFalse); + } + else if(attribute == KGlxMediaGeneralDimensions) + { + EditItemL(EImgVwrResolutionItem,EFalse); + }/* + else if(attribute == KMPXMediaDrmProtected) + { + EditItemL(EImgVwrlicenseItem,EFalse); + }*/ + else + { + + } + delete string; + string = NULL; + } + CleanupStack::PopAndDestroy(stringConverter ); + } + +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::EditItemL +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/) + { + TRACER("CGlxImgVwrMetadataContainer::EditItemL"); + CAknSettingItem* settingsitem = NULL; + settingsitem = (*SettingItemArray())[aIndex]; + settingsitem->LoadL(); + settingsitem->UpdateListBoxTextL(); + settingsitem->StoreL(); + ListBox()->DrawNow(); + } + + + +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::SetAttributes +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::SetNameDescriptionL(TInt aItem) + { + TRACER("CGlxImgVwrMetadataContainer::SetNameDescriptionL"); + //This function is commn for updatng both name and description once modified + //get the item handle to be modified + CAknSettingItem* settingsitem = (*SettingItemArray())[aItem]; + HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength ); + (textBuf->Des()).Copy((settingsitem->SettingTextL())); + TPtr textPtr = textBuf->Des(); + TBuf titleText(*textBuf); + HBufC *buf = NULL; + if(aItem == ENameItem) + { + buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES); + } + else + { + buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES); + } + + //Launch the text entry editor. + CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr ); + CleanupStack::PopAndDestroy(buf); + + //action upon selecting ok from the editor + if ( popup->ExecuteLD() == EEikBidOk ) + { + if(0 != (titleText.Compare(*textBuf))) + { + //Modify the MDS and setting list only if the entry is different from previous Item value + iTextSetter.Copy(*textBuf); + EditItemL(aItem,EFalse); + if( iItemMediaList->Count() > 0 ) + { + iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item + CMPXCollectionPath* path = iItemMediaList->PathLC(); + CMPXCommand* command = NULL; + //Create the glx command based on the item + if(aItem == ENameItem) + { + command = TGlxCommandFactory::RenameCommandLC(settingsitem->SettingTextL(), + *path); + } + else + { + command = TGlxCommandFactory::SetDescriptionCommandLC(settingsitem->SettingTextL(), + *path); + } + command->SetTObjectValueL(KMPXCommandGeneralSessionId, static_cast(this)); + //issue command to the medialist which further calls data source to update MDS + iItemMediaList->CommandL(*command); + CleanupStack::PopAndDestroy(command); + CleanupStack::PopAndDestroy(path); + } + } + } + CleanupStack::PopAndDestroy( textBuf ); + + } +// ---------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL() +// ---------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataContainer::SetDurationLIicenseItemVisibilityL() + { + //get the media item. + const TGlxMedia& item = iItemMediaList->Item(0); + const CGlxMedia* media = item.Properties(); + + //in order to check for video category and drm rights + + CAknSettingItem* hiddenItem = NULL; + + if( media && media->IsSupported(KMPXMediaDrmProtected)) + { + if(item.IsDrmProtected()) + { + hiddenItem = (*SettingItemArray())[EImgVwrlicenseItem]; + //Set the License item visible + hiddenItem->SetHidden(EFalse); + //Required to refresh the listbox when any items visiblity is changed + this->HandleChangeInItemArrayOrVisibilityL(); + } + } + } +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataContainer::IsLicenseItem +//----------------------------------------------------------------------------- +TBool CGlxImgVwrMetadataContainer::IsLicenseItem() + { + //Checks the item for DRMProtection. + if((ListBox()->CurrentItemIndex()== EImgVwrlicenseItem)) + { + return EFalse; + } + return ETrue; + } + + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatadialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/src/glximgvwrmetadatadialog.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2008-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: glximgvwrmetadatadialog.cpp +* +*/ + + +#include "glximgvwrmetadatadialog.h" + +//system includes +#include //for AknUtils +#include +#include +#include +#include // KDC_APP_RESOURCE_DIR +#include // for CEikMenuBar +#include +#include +#include // For CGlxCommandHandlerAddToContainer + +//User includes +#include +#include +#include +#include +#include +#include // for TGlxFilterFactory +#include +#include +#include // for HlpLauncher +#include +#include +#include +#include +#include +#include // For Panics +#include "glxmetadatacommandhandler.h" + +#define GetAppUi() (dynamic_cast(iEikonEnv->EikAppUi())) + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxImgVwrMetadataDialog* CGlxImgVwrMetadataDialog::NewL( const TDesC& aUri ) + { + TRACER("CGlxImgVwrMetadataDialog::NewL"); + + CGlxImgVwrMetadataDialog* self = new(ELeave) CGlxImgVwrMetadataDialog(aUri ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +CGlxImgVwrMetadataDialog::CGlxImgVwrMetadataDialog(const TDesC& aUri):iUri(aUri) + { + + } +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::ConstructL() + { + TRACER("CGlxImgVwrMetadataDialog::ConstructL"); + + // Load dialog's resource file + InitResourceL(); + + // make the toolbar disabled + SetDetailsDlgToolbarVisibility(EFalse); + + iStatusPaneAvailable = EFalse; + // set the title to the dialog, Note that avkon dialogs do not support + // setting the title in the status pane so we need to do it the hard way + // get status pane + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + + if(statusPane && statusPane->IsVisible()) + { + iStatusPaneAvailable = ETrue; + } + + // make the toolbar disabled + SetDetailsDlgToolbarVisibility(EFalse); + + // do we have status pane + if( statusPane ) + { + GLX_LOG_INFO1("GLX_UMP::CGlxImgVwrMetadataDialog::ConstructL::STATUS PANE = %d",statusPane->IsVisible()); + // load the title text + HBufC* text = StringLoader::LoadL(R_GLX_METADATA_VIEW_TITLE_DETAILS, iEikonEnv ); + SetTitleL( *text ); + if( text) + { + delete text; + } + GetAppUi()->StatusPane()->MakeVisible(ETrue); + } + + iUiUtility = CGlxUiUtility::UtilityL(); + + // Call the base class' two-phased constructor + CAknDialog::ConstructL( R_METADATA_MENUBAR ); + + } + +// ----------------------------------------------------------------------------- +// ~CGlxImgVwrMetadataDialog +// ----------------------------------------------------------------------------- +// +CGlxImgVwrMetadataDialog::~CGlxImgVwrMetadataDialog() + { + + TRACER("CGlxImgVwrMetadataDialog::~CGlxImgVwrMetadataDialog"); + + + //To Disable the status pane if the dialog is launched from fullscreenview + if(!iStatusPaneAvailable) + { + GetAppUi()->StatusPane()->MakeVisible(EFalse); + } + + TRAP_IGNORE(SetPreviousTitleL()); + + delete iPreviousTitle; + + // Restore the Toolbar as it was in the Calling application + SetDetailsDlgToolbarVisibility(ETrue); + + // If details launched from FullScreen View, while moving back, + // all the UI components should be hidden. Hence processing this command here. + TRAP_IGNORE(GetAppUi()->ProcessCommandL(EGlxCmdResetView)); + + if( iUiUtility ) + { + iUiUtility->Close(); + } + + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + } + +// --------------------------------------------------------------------------- +// SetDetailsDlgToolbarVisibility() +// --------------------------------------------------------------------------- +void CGlxImgVwrMetadataDialog::SetDetailsDlgToolbarVisibility(TBool aVisible) + { + TRACER("CGlxImgVwrMetadataDialog::SetDetailsDlgToolbarVisibility"); + CAknAppUi* appUi = GetAppUi(); + __ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer)); + + HandleToolbarResetting(aVisible); + CAknToolbar* currentPopupToolbar = appUi->CurrentPopupToolbar(); + if(currentPopupToolbar) + { + currentPopupToolbar->SetToolbarVisibility(aVisible); + currentPopupToolbar->MakeVisible( aVisible ); + } + } + +// ----------------------------------------------------------------------------- +// ExecuteLD +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxImgVwrMetadataDialog::ExecuteLD() + { + TRACER("CGlxImgVwrMetadataDialog::ExecuteLD"); + return CAknDialog::ExecuteLD( R_IMG_VIEWER_METADATA_DIALOG ); + } +// ----------------------------------------------------------------------------- +// ProcessCommandL +// ----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::ProcessCommandL( TInt aCommandId ) + {} +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::CreateCustomControlL +//----------------------------------------------------------------------------- +SEikControlInfo CGlxImgVwrMetadataDialog::CreateCustomControlL(TInt + aControlType) + { + GLX_LOG_INFO("CShwSlideshowSettingsDialog::CreateCustomControlL"); + + // create control info, no flags or trailer text set + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + if (aControlType == EMetaDataDialogListBox) + { + iContainer = CGlxImgVwrMetadataContainer::NewL(GetAppUi()->ClientRect(),iUri); + controlInfo.iControl = iContainer; // giving ownership + } + return controlInfo; // returns ownership of ItemList + } + +// ----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::DynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ) + { + //no implementation + } + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::SizeChanged +//----------------------------------------------------------------------------- +void CGlxImgVwrMetadataDialog::SizeChanged() + { + TRACER("CGlxImgVwrMetadataDialog::SizeChanged"); + CAknDialog::SizeChanged(); + } +// ----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::InitResourceL +// ----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::InitResourceL() + { + TRACER("CGlxImgVwrMetadataDialog::InitResourceL"); + + _LIT(KGlxMetadataDialogResource,"glxmetadatadialog.rsc"); + //add resource file + TParse parse; + parse.Set(KGlxMetadataDialogResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + } + + +// ----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::HandleViewCommandL +// ----------------------------------------------------------------------------- +// +TBool CGlxImgVwrMetadataDialog::HandleViewCommandL( TInt /*aCommand*/ ) + { + TRACER("CGlxImgVwrMetadataDialog::HandleViewCommandL"); + return EFalse; + } +// --------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::PreLayoutDynInitL +// --------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::PreLayoutDynInitL() + { + // No Implementation + } + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::PostLayoutDynInitL +//----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::PostLayoutDynInitL() + {} + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::Draw +//----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::Draw( const TRect& /*aRect*/ ) const +{ +TRACER("CGlxImgVwrMetadataDialog::Draw"); +TRect rect; +AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); + +// Get the standard graphics context +CWindowGc& gc = SystemGc(); +gc.SetBrushColor(KRgbWhite); +gc.DrawRect(rect); +} + +//----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::HandlePointerEventL +//----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::HandlePointerEventL( + const TPointerEvent& aPointerEvent) + { + TRACER("CGlxImgVwrMetadataDialog::HandlePointerEventL"); + CCoeControl::HandlePointerEventL( aPointerEvent ); + } + +// --------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::SetTitleL() +// --------------------------------------------------------------------------- +void CGlxImgVwrMetadataDialog::SetTitleL(const TDesC& aTitleText) + { + TRACER("CGlxFetcherContainer::SetTitleL"); + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CleanupStack::PushL(statusPane); + // get pointer to the default title pane control + CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + CleanupStack::PushL(titlePane); + // set the title if we got the title pane control + if( titlePane ) + { + GLX_LOG_INFO("GLX_UMP::CGlxImgVwrMetadataDialog::ConstructL::INSIDE titlePane"); + iPreviousTitle = titlePane->Text()->AllocL(); + // Set the required Title + titlePane->SetTextL( aTitleText ); + } + CleanupStack::Pop(titlePane); + CleanupStack::Pop(statusPane); + } + +// --------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::SetPreviousTitleL +// --------------------------------------------------------------------------- +void CGlxImgVwrMetadataDialog::SetPreviousTitleL() + { + TRACER("CGlxFetcherContainer::SetPreviousTitleL"); + CEikStatusPane* prevStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CleanupStack::PushL(prevStatusPane); + CAknTitlePane* prevTitlePane = ( CAknTitlePane* )prevStatusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + CleanupStack::PushL(prevTitlePane); + if( prevTitlePane ) + { + // Restore the Title back of the Calling Application + prevTitlePane->SetTextL( *iPreviousTitle ); + } + CleanupStack::Pop(prevTitlePane); + CleanupStack::Pop(prevStatusPane); + } +// ----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::HandleResourceChange +// ----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::HandleResourceChange( TInt aType ) + { + TRACER("CGlxImgVwrMetadataDialog::HandleResourceChange"); + //Handle global resource changes, such as scalable UI or skin events and orientation change (override) + CAknDialog::HandleResourceChange( aType ); + } +// ----------------------------------------------------------------------------- +// CGlxImgVwrMetadataDialog::HandleToolbarResetting +// ----------------------------------------------------------------------------- +// +void CGlxImgVwrMetadataDialog::HandleToolbarResetting(TBool aVisible) + { + TRACER("CGlxImgVwrMetadataDialog::HandleToolbarResetting"); + CAknAppUi* appUi = GetAppUi(); + __ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer)); + + CAknToolbar* popupToolbar = appUi->PopupToolbar(); + if(popupToolbar) + { + popupToolbar->SetToolbarVisibility( !aVisible ); + popupToolbar->MakeVisible( !aVisible ); + if(!aVisible) + { + popupToolbar->DrawNow(); + } + } + CAknToolbar* toolbar = appUi->CurrentFixedToolbar(); + if(toolbar) + { + toolbar->HideItemsAndDrawOnlyBackground(!aVisible); + toolbar->SetToolbarVisibility(aVisible); + toolbar->MakeVisible( aVisible ); + } + } + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/src/glxmetadatacommandhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/src/glxmetadatacommandhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata dialog +* +*/ + + + + +#include "glxmetadatacommandhandler.h" + +#include +#include +#include +#include +#include + + +//----------------------------------------------------------------------------- +// C++ default constructor. +//----------------------------------------------------------------------------- +CGlxMetadataCommandHandler::CGlxMetadataCommandHandler( + MGlxMediaListProvider* aMediaListProvider): + CGlxMediaListCommandHandler( aMediaListProvider ) + { + TRACER("CGlxMetadataCommandHandler::CGlxMetadataCommandHandler"); + + iMediaListProvider = aMediaListProvider; + } + +//----------------------------------------------------------------------------- +// Two-phased constructor. +//----------------------------------------------------------------------------- +CGlxMetadataCommandHandler* CGlxMetadataCommandHandler::NewL( + MGlxMediaListProvider* aMediaListProvider) + { + TRACER("CGlxMetadataCommandHandler::NewL"); + + CGlxMetadataCommandHandler* self = new( ELeave ) + CGlxMetadataCommandHandler(aMediaListProvider); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// ConstructL() +// --------------------------------------------------------------------------- +void CGlxMetadataCommandHandler::ConstructL() + { + TRACER("CGlxMetadataCommandHandler::ConstructL"); + + iShowOnMapCmdHandler = CGlxCommandHandlerAiwShowMap::NewL(iMediaListProvider, R_METADATA_MENU); + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +CGlxMetadataCommandHandler::~CGlxMetadataCommandHandler() + { + TRACER("CGlxMetadataCommandHandler::~CGlxMetadataCommandHandler"); + + delete iShowOnMapCmdHandler; + } + +//----------------------------------------------------------------------------- +// DoExecuteL +//----------------------------------------------------------------------------- +TBool CGlxMetadataCommandHandler::DoExecuteL(TInt aCommandId, MGlxMediaList&/* aList*/) + { + TRACER("CGlxMetadataCommandHandler::DoExecuteL"); + + TBool ret = iShowOnMapCmdHandler->ExecuteL( aCommandId ); + return ret; + } + +//----------------------------------------------------------------------------- +// OfferKeyEventL +//----------------------------------------------------------------------------- +TKeyResponse CGlxMetadataCommandHandler::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, + TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// ----------------------------------------------------------------------------- +// DynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxMetadataCommandHandler::PreDynInitMenuPaneL( TInt aResourceId ) + { + TRACER("CGlxMetadataCommandHandler::PreDynInitMenuPaneL"); + iShowOnMapCmdHandler->PreDynInitMenuPaneL(aResourceId); + } + +// ----------------------------------------------------------------------------- +// DynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxMetadataCommandHandler::DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ) + { + TRACER("CGlxMetadataCommandHandler::DynInitMenuPaneL"); + + iShowOnMapCmdHandler->DynInitMenuPaneL(aMenuId,aMenuPane); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/src/glxmetadatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/src/glxmetadatacontainer.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1366 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata dialog +* +*/ + +#include "glxmetadatacontainer.h" +#include "glxustringconverter.h" // converts the symbian types to UString type +#include +#include +#include +#include +#include +#include +#include +#include //Details data provider +#include +#include // For CGlxCommandHandlerAddToContainer +#include // for command handler id +#include //for command factory +#include // Content ID identifying general category of content provided +#include "mglxmetadatadialogobserver.h" +#include +#include +#include +#include // tag collection plugin uid +#include // KGlxMediaIdThumbnail +#include // CGlxAttributeReteiver +#include +#include //For launching DRM details pane +#include // General utilties class definition +#include +#include //For CExifModify +#include +#include +#include //For Filesystem + +//marquee + +#include +#include +const TInt KMaxMediaPopupTitleLength = 0x100; +const TInt KMediaListId = 0x2000D248; +const TInt KOffsets = 50; +const TInt KMarqueeLoopCount = 3; +const TInt KMarqueeScrollAmount = 20; +const TInt KMarqueeScrollDelay = 1000000; +const TInt KMarqueeScrollInterval = 200000; +_LIT( KGlxTextSetter, ""); +_LIT( KGlxComma, ","); + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CGlxMetadataContainer* CGlxMetadataContainer::NewL( const TRect& aRect, + MGlxMetadataDialogObserver& aDialogObserver, + const TDesC& item,MToolbarResetObserver& aResetToolbarObs) + { + TRACER("CGlxMetadataContainer::NewL"); + CGlxMetadataContainer* self = CGlxMetadataContainer::NewLC( aRect, + aDialogObserver,item,aResetToolbarObs); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// NewLC +// --------------------------------------------------------- +// +CGlxMetadataContainer* CGlxMetadataContainer::NewLC( const TRect& aRect, + MGlxMetadataDialogObserver& aDialogObserver, + const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs) + { + TRACER("CGlxMetadataContainer::NewLC"); + CGlxMetadataContainer* self = new(ELeave) CGlxMetadataContainer(aDialogObserver,aUri,aResetToolbarObs); + CleanupStack::PushL(self); + self->ConstructL( aRect); + return self; + } + +// --------------------------------------------------------- +// CGlxMetadataContainer +// --------------------------------------------------------- +// +CGlxMetadataContainer::CGlxMetadataContainer(MGlxMetadataDialogObserver& aDialogObserver, + const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs) + :iDialogObesrver ( aDialogObserver ),iUri(aUri),iResetToolbarObs(aResetToolbarObs) + { + // No implementation + } + +// --------------------------------------------------------- +// CGlxMetadataContainer::ConstructL +// --------------------------------------------------------- +// +void CGlxMetadataContainer::ConstructL( const TRect& /*aRect*/ ) + { + //Creating the RBuf texts for all the items except tags & albums + //which would be updated as whne the item is edited + iTextSetter.CreateL(KMaxFileName); + + //RBuf text which would be updated as when a tag is edited for the item. + iTagSetter.CreateL(KMaxFileName); + + //RBuf text which would be updated as when a album is edited for the item. + iAlbumSetter.CreateL(KMaxFileName); + + //Create medialist filtered by uri - iUri + CreateMediaListForSelectedItemL(); + + //Setting the iVideo flag to EFalse initially + iVideo = EFalse; + + //Setting the iMarquee flag to EFalse initially + iMarquee = EFalse; + + //check when Remove location information is selected. + iLocationinfo = EFalse; + + //Creating a CGlxMetadataAsyncUpdate object + iAsyncRequest = CGlxMetadataAsyncUpdate::NewL(*this); + + //Initializing to NULL + iModifiedUri = NULL; + } + +// --------------------------------------------------------- +// ~CGlxMetadataContainer +// --------------------------------------------------------- +// +CGlxMetadataContainer::~CGlxMetadataContainer() + { + TRACER("CGlxMetadataContainer::~CGlxMetadataContainer"); + if( iItemMediaList ) + { + iItemMediaList->RemoveContext(iMainListAttributecontext); + iItemMediaList->RemoveMediaListObserver(this); + iItemMediaList->Close(); + iItemMediaList = NULL; + } + if ( iTagMediaList ) + { + iTagMediaList->RemoveContext(iTagContext); + iTagMediaList->RemoveMediaListObserver(this); + iTagMediaList->Close(); + iTagMediaList = NULL; + } + if ( iAlbumMediaList ) + { + iAlbumMediaList->RemoveContext(iAlbumContext); + iAlbumMediaList->RemoveMediaListObserver(this); + iAlbumMediaList->Close(); + iAlbumMediaList = NULL; + } + if( iTagContext ) + { + delete iTagContext; + iTagContext = NULL; + } + if( iAlbumContext ) + { + delete iAlbumContext; + iAlbumContext = NULL; + } + if( iMainListAttributecontext ) + { + delete iMainListAttributecontext; + iMainListAttributecontext = NULL; + } + if( IsVisible() ) + { + MakeVisible(EFalse); + } + iTextSetter.Close(); + iTagSetter.Close(); + iAlbumSetter.Close(); + if(iAsyncRequest) + { + delete iAsyncRequest; + } + if(iModifiedUri) + { + delete iModifiedUri; + } + } + +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::MediaList +//----------------------------------------------------------------------------- +MGlxMediaList& CGlxMetadataContainer::MediaList() + { + //returns the active medialist. + return *iItemMediaList; + } + +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::CreateSettingItemL +//----------------------------------------------------------------------------- +CAknSettingItem* CGlxMetadataContainer::CreateSettingItemL(TInt aResourceId) + { + TRACER("CGlxMetadataContainer::CreateSettingItemL"); + CAknSettingItem* settingItem = NULL; // No need to push onto cleanup stack + iTextSetter.Copy(KGlxTextSetter); + + //Creating a empty Settings list box which will be populated with metadata in handleattributeavailable + + switch(aResourceId) + { + case ENameItem: + case EDateAndTimeItem: + case EDescriptionItem: + { + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iTextSetter ); + + break; + } + case ETagsItem: + { + iTagSetter.Copy(KGlxTextSetter); + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iTagSetter ); + break; + } + case EAlbumsItem: + { + iAlbumSetter.Copy(KGlxTextSetter); + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iAlbumSetter ); + break; + } + case ELocationItem: + case ESizeItem: + case EResolutionItem: + { + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iTextSetter ); + + break; + } + case EDurationItem: + case ElicenseItem: + { + settingItem = new (ELeave) CAknTextSettingItem( + aResourceId, iTextSetter ); + //Hide the item until we get the attributes + //where in we check for the usage rights. + settingItem->SetHidden(ETrue); + //Required to refresh the listbox when any items visiblity is changed + this->HandleChangeInItemArrayOrVisibilityL(); + } + break; + + default: + { + break; + } + } + return settingItem; + } +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::IsItemModifiable +//----------------------------------------------------------------------------- +TBool CGlxMetadataContainer::IsItemModifiable() + { + //Only items like name , description, tag and albums are modifiable + //The check is for the items from ENameItem(0) tille ETagsItem(4) + if(ListBox()->CurrentItemIndex()<=ETagsItem) + { + return EFalse; + } + //return ETrue to dim the item + return ETrue; + + } +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::IsLicenseItem +//----------------------------------------------------------------------------- +TBool CGlxMetadataContainer::IsLicenseItem() + { + //Checks the item for DRMProtection. + //if item is a video item index should be ELicense else check for EDuration Item. + //because License Item index would become EDuration as the duration item is hidden in case of inage file. + if((!iVideo && ListBox()->CurrentItemIndex()== EDurationItem) + || (ListBox()->CurrentItemIndex()== ElicenseItem)) + { + return EFalse; + } + return ETrue; + } + +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::IsLocationItem +//----------------------------------------------------------------------------- +TBool CGlxMetadataContainer::IsLocationItem() + { + //if its location item - enable the delete option + if(ListBox()->CurrentItemIndex()== ELocationItem) + { + const TGlxMedia& item = iItemMediaList->Item(0); + TCoordinate coordinate; + if(item.GetCoordinate(coordinate)) + { + return EFalse; + } + return ETrue; + } + //return ETrue to dim the item + return ETrue; + } + +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::HandleListBoxEventL +//----------------------------------------------------------------------------- +void CGlxMetadataContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, + TListBoxEvent aEventType) + { + GLX_LOG_INFO("CGlxMetadataContainer::HandleListBoxEventL"); + if ((aEventType == EEventEnterKeyPressed) || + (aEventType == EEventEditingStarted) || + (aEventType == EEventItemSingleClicked)) + { + //handle edit functionality if items when useer selects via touch + HandleListboxChangesL(); + } + } +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::HandleListboxChangesL +//----------------------------------------------------------------------------- +void CGlxMetadataContainer::HandleListboxChangesL() + { + if(iItemMediaList->Count() == 0) + { + return; + } + + TInt index = ListBox()->CurrentItemIndex(); + + switch(index) + { + case ENameItem: + case EDescriptionItem: + { + SetNameDescriptionL(index); + break; + } + case ETagsItem: + { + //Set the focus of the item + iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); + //Launch add to container commandhandler via dialog observer. + iDialogObesrver.AddTagL(); + break; + } + case EAlbumsItem: + { + //Set the focus of the item + iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); + //Launch add to container commandhandler via dialog observer. + iDialogObesrver.AddAlbumL(); + break; + } + case EDurationItem: + { + //This is conditionis useful when the license item is selected for a image file + if(iVideo) + { + break; + } + } + case ElicenseItem: + { + //Create DRM utility + CGlxDRMUtility* drmUtility = CGlxDRMUtility::InstanceL(); + CleanupClosePushL(*drmUtility); + drmUtility->ShowDRMDetailsPaneL(iItemMediaList->Item(0).Uri()); + CleanupStack::PopAndDestroy(drmUtility); + } + break; + default: + { + break; + } + } + } +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::CreateMediaListForSelectedItemL +//----------------------------------------------------------------------------- +void CGlxMetadataContainer::CreateMediaListForSelectedItemL(TBool aIsRename) + { + TRACER("CGlxMetadataContainer::CreateMediaListForSelectedItemL"); + + //create the collection path for the medialist to be created + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + //set the all collection path as the details dialog can be launched from any of the grid views and filter with URI + path->AppendL(KGlxCollectionPluginAllImplementationUid); + //create the filter with the URI + CMPXFilter* filter = NULL; + if(aIsRename) + { + //create the filter with the modified URI after Rename happens + filter = TGlxFilterFactory::CreateURIFilterL(iModifiedUri->Des()); + } + else + { + filter = TGlxFilterFactory::CreateURIFilterL(iUri); + } + CleanupStack::PushL( filter ); + //create the medialist + iItemMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter); + + //Add the attributes which are required to be displayed. + iMainListAttributecontext = new (ELeave) CGlxAttributeContext(&iSelectionIterator); + iMainListAttributecontext->AddAttributeL(KMPXMediaDrmProtected); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralCategory); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralSize); + iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralDimensions); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralTitle); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDate); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralComment); + iMainListAttributecontext->AddAttributeL(KGlxMediaGeneralLocation); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralDuration); + iMainListAttributecontext->AddAttributeL(KMPXMediaGeneralUri); + + //Add Context so that we get the handleattributes call once the medialist is populated with above mentioned attributes. + iItemMediaList->AddContextL( iMainListAttributecontext, + KGlxFetchContextPriorityBlocking ); + + //add to observer for callbacks. + iItemMediaList->AddMediaListObserverL(this); + + CleanupStack::PopAndDestroy( filter ); + CleanupStack::PopAndDestroy( path ); + } + +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::CreateTagsMediaList +//----------------------------------------------------------------------------- +void CGlxMetadataContainer::CreateTagsMediaListL() + { + TRACER("CGlxMetadataContainer::CreateTagsMediaListL"); + //create the collection path for the medialist to be created + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + //Set the Tags collection for the particular item + path->AppendL(KGlxTagCollectionPluginImplementationUid); + //get the media item for which we require the tags collection + TGlxMedia item = iItemMediaList->Item(0); + //create the medialist filter with media ID + CMPXFilter* filter1 = + TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(item.Id()); + CleanupStack::PushL(filter1); + //set the array order as required, here its alphabetical + TGlxFilterProperties filterProperty; + filterProperty.iSortOrder = EGlxFilterSortOrderAlphabetical; + filterProperty.iSortDirection = EGlxFilterSortDirectionAscending; + //combine the filter with filterProperty + CMPXFilter* filter = TGlxFilterFactory::CreateCombinedFilterL( filterProperty, + filter1, + EFalse); + CleanupStack::PushL(filter); + + //create the medialist to get the tags array. + iTagMediaList = MGlxMediaList::InstanceL(*path,TGlxHierarchyId(KMediaListId),filter); + + //add the attribute KMPXMediaGeneralTitle to the context to get the tag name + iTagContext = CGlxDefaultAttributeContext::NewL(); + iTagContext->AddAttributeL(KMPXMediaGeneralTitle); + iTagContext->SetRangeOffsets(KOffsets,KOffsets); + + //Add Context so that we get the handleattributes call once the medialist is populated with tags. + iTagMediaList->AddContextL( iTagContext, + KGlxFetchContextPriorityUMPViewTagPane ); + + //add to observer for callbacks. + iTagMediaList->AddMediaListObserverL(this); + + CleanupStack::PopAndDestroy(filter); + CleanupStack::PopAndDestroy(filter1); + CleanupStack::PopAndDestroy(path); + + } +//----------------------------------------------------------------------------- +// CGlxMetadataContainer::CreateAlbumsMediaListL +//----------------------------------------------------------------------------- +void CGlxMetadataContainer::CreateAlbumsMediaListL() + { + TRACER("CGlxMetadataContainer::CreateAlbumsMediaListL"); + //create the collection path for the medialist to be created + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + //Set the albums collection for the particular item + path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); + //get the media item for which we require the tags collection + TGlxMedia item = iItemMediaList->Item(0); + //create the medialist filter with media ID + CMPXFilter* filter = + TGlxFilterFactory::CreateExcludeContainersWithoutItemFilterL(item.Id()); + CleanupStack::PushL(filter); + //create the albums medialist. + iAlbumMediaList = MGlxMediaList::InstanceL(*path, + TGlxHierarchyId(KMediaListId), + filter); + + //add the attribute KMPXMediaGeneralTitle to the context to get the album name + iAlbumContext = CGlxDefaultAttributeContext::NewL(); + iAlbumContext->AddAttributeL(KMPXMediaGeneralTitle); + iAlbumContext->SetRangeOffsets(KOffsets,KOffsets); + //Add Context to the medialist so that we get the handleattributes call once the medialist is populated with albums. + iAlbumMediaList->AddContextL( iAlbumContext, + KGlxFetchContextPriorityUMPViewAlbumPane ); + + //add to observer for callbacks. + iAlbumMediaList->AddMediaListObserverL(this); + + CleanupStack::PopAndDestroy(filter); + CleanupStack::PopAndDestroy(path); + + } + + +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::ViewDynInitMenuPaneL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::ViewDynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane) + { + if( aMenuId == R_METADATA_MENU ) + { + //Set dim the options based on the utem selected + //Edit option will be available only for ENameItem,EDescriptionItem,ETagsItem,EAlbumItem + //Viewdetails option will be availble only for the license item + //Delete option will be available only for the location item + //aMenuPane->SetItemDimmed(KGlxEditBoundMenuCommandId,IsItemModifiable()); + aMenuPane->SetItemDimmed(KGlxViewBoundMenuCommandId,IsLicenseItem()); + aMenuPane->SetItemDimmed(KGlxDeleteBoundMenuCommandId,IsLocationItem()); + aMenuPane->SetItemDimmed(EGlxCmdAiwShowMap,IsLocationItem()); + } + + + } +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::RemoveLocationL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::RemoveLocationL() + { + TRACER("CGlxMetadataContainer::RemoveLocationL"); + + iLocationinfo = ETrue; + // get the media item + const TGlxMedia& media = iItemMediaList->Item(0); + // Test to see if the coordinate is present + TCoordinate coordinate; + TBool isSupported = media.GetCoordinate(coordinate); + if( !isSupported ) + { + HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_INFO_NO_LOCATION); + GlxGeneralUiUtilities::ShowInfoNoteL(*buf,ETrue); + CleanupStack::PopAndDestroy(buf); + } + else + { + HBufC *buf = StringLoader::LoadLC(R_GLX_METADATA_NOTE_DELETE_LOCATION); + TBool response = GlxGeneralUiUtilities::ConfirmQueryL(R_GLX_QUERY_YES_NO,*buf); + CleanupStack::PopAndDestroy(buf); + + if( response ) + { + //user selected yes, so delete location + //send command for delete location after successfull removal of command remove this pane + if( iItemMediaList->Count() > 0 ) + { + //set focus to first item + iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); + + // Deleting location information from image file + RFs rFs; + User::LeaveIfError( rFs.Connect() ); + CleanupClosePushL( rFs ); + RFile rFile; + User::LeaveIfError( rFile.Open(rFs, + iItemMediaList->Item(0).Uri() + ,EFileWrite )); + CleanupClosePushL( rFile ); + + TInt imageFileSize = 0; // Image File Size + User::LeaveIfError( rFile.Size( imageFileSize ) ); + HBufC8* imageData = HBufC8::NewL( imageFileSize ); //Actual Image Data + CleanupStack::PushL( imageData ); + + TPtr8 myImagePtr = imageData->Des(); + TInt readError = rFile.Read( myImagePtr ); + if ( readError != KErrNone ) + { + User::Leave( KErrGeneral ); + } + + //CExifModify Interface class for modifying existing Exif v2.2 (or prior) + //file format or creating Exif v2.2 file format using valid Jpeg image + CExifModify* exifWriter = NULL; + TRAPD(err,exifWriter = CExifModify::NewL( imageData->Des())); + CleanupStack::PushL( exifWriter ); + if(err == KErrNone) + { + //Removes the specified IFD structure and all its tags from the Exif data + exifWriter->DeleteIfd ( EIfdGps ); + + HBufC8* modifiedExif = exifWriter->WriteDataL( imageData->Des() ); //Modified Image Data + CleanupStack::PushL( modifiedExif ); + + const TUint32 fileSize = modifiedExif->Des().Length(); //Size of Modified File + TInt oldSize; + rFile.Size( oldSize ); + // set position to begin of file & write the Modified data (Without Location Information) + TInt pos = 0; + User::LeaveIfError( rFile.Seek( ESeekStart, pos ) ); + User::LeaveIfError( rFile.Write( modifiedExif->Des(), fileSize ) ); + + TTime lastModified; + lastModified.UniversalTime(); + User::LeaveIfError( rFile.SetModified( lastModified ) ); //Change the Modified Time + + CleanupStack::PopAndDestroy( modifiedExif); + } + CleanupStack::PopAndDestroy( exifWriter); + CleanupStack::PopAndDestroy( imageData ); + CleanupStack::PopAndDestroy( &rFile ); + CleanupStack::PopAndDestroy( &rFs ); + + //Deleting location information from MDS database + CMPXCollectionPath* path = iItemMediaList->PathLC(); + CMPXCommand* command = TGlxCommandFactory::DeleteLocationCommandLC(*path); + + command->SetTObjectValueL(KMPXCommandGeneralSessionId, + static_cast(this)); + + iItemMediaList->CommandL(*command); + CleanupStack::PopAndDestroy(command); + CleanupStack::PopAndDestroy(path); + } + } + } + } +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::EditItemL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/) + { + TRACER("CGlxMetadataContainer::EditItemL"); + CAknSettingItem* settingsitem = NULL; + settingsitem = (*SettingItemArray())[aIndex]; + settingsitem->LoadL(); + settingsitem->UpdateListBoxTextL(); + settingsitem->StoreL(); + ListBox()->DrawNow(); + } +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::SetAttributes +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::SetAttributesL(TMPXAttribute attribute) +{ + TRACER("CGlxMetadataContainer::SetAttributesL"); + + //create the tags and albums medialist once the item medialist is populated + //Tags and albums medialist can be created only with media ID. + if(!iTagMediaList) + { + CreateTagsMediaListL(); + } + if(!iAlbumMediaList) + { + CreateAlbumsMediaListL(); + } + if(!iSetVisible) + { + iSetVisible = ETrue; + SetDurationLIicenseItemVisibilityL(); + } + TGlxMedia item = iItemMediaList->Item(0); + //Create the string convertor instance + //String convertor class with provide the specific format for date,location and duration and size. + CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); + CleanupStack::PushL(stringConverter ); + HBufC* string = NULL; + + //if attribute is date and time we need to pass the format it as R_QTN_DATE_USUAL_WITH_ZERO else null + if(attribute == KMPXMediaGeneralDate) + { + stringConverter->AsStringL(item, + attribute, + R_QTN_DATE_USUAL_WITH_ZERO, string ); + } + else + { + stringConverter->AsStringL(item, + attribute,0, string ); + } + //get the settings item based on the attribute and set the text. + if ( string ) + { + iTextSetter.Copy(KGlxTextSetter); + iTextSetter.Append(*string); + if(attribute == KMPXMediaGeneralSize) + { + EditItemL(ESizeItem,EFalse); + } + else if(attribute == KMPXMediaGeneralDuration) + { + EditItemL(EDurationItem,EFalse); + } + else if(attribute == KMPXMediaGeneralTitle) + { + EditItemL(ENameItem,EFalse); + } + else if(attribute == KMPXMediaGeneralDate) + { + EditItemL(EDateAndTimeItem,EFalse); + } + else if(attribute == KMPXMediaGeneralComment) + { + EditItemL(EDescriptionItem,EFalse); + } + else if(attribute == KGlxMediaGeneralLocation) + { + EditItemL(ELocationItem,EFalse); + } + else if(attribute == KGlxMediaGeneralDimensions) + { + EditItemL(EResolutionItem,EFalse); + } + else + { + + } + delete string; + string = NULL; + } + CleanupStack::PopAndDestroy(stringConverter ); +} + +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::SetNameDescriptionL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::SetNameDescriptionL(TInt aItem) + { + TRACER("CGlxMetadataContainer::SetNameDescriptionL"); + //This functions i commn for updatng both name and description once modified + //get the item handcle to be modified + CAknSettingItem* settingsitem = (*SettingItemArray())[aItem]; + HBufC* textBuf = HBufC::NewLC( KMaxMediaPopupTitleLength ); + (textBuf->Des()).Copy((settingsitem->SettingTextL())); + TPtr textPtr = textBuf->Des(); + TBuf titleText(*textBuf); + HBufC *buf = NULL; + if(aItem == ENameItem) + { + buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_TITLE_NSERIES); + } + else + { + buf = StringLoader::LoadLC(R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES); + } + + //Launch the text entry editor. + CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *buf, textPtr ); + CleanupStack::PopAndDestroy(buf); + + //action upon selecting ok from the editor + if ( popup->ExecuteLD() == EEikBidOk ) + { + if(0 != (titleText.Compare(*textBuf))) + { + if ((aItem == ENameItem) && + (BaflUtils::FileExists(ControlEnv()->FsSession(), ParseFileName(*textBuf)))) + { + //if changed title is same as existing one then showing the already use popup to user + HBufC* info = StringLoader::LoadLC(R_GLX_NAME_ALREADY_USED, *textBuf); + GlxGeneralUiUtilities::ShowInfoNoteL(*info, ETrue); + CleanupStack::PopAndDestroy(info); + } + else + { + //Modify the MDS and setting list only if the entry is different from previous Item value + iTextSetter.Copy(*textBuf); + EditItemL(aItem,EFalse); + iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0);//set focus to first item + CMPXCollectionPath* path = iItemMediaList->PathLC(); + CMPXCommand* command = NULL; + //Create the glx command based on the item + if(aItem == ENameItem) + { + command = TGlxCommandFactory::RenameCommandLC(settingsitem->SettingTextL(), + *path); + } + else + { + command = TGlxCommandFactory::SetDescriptionCommandLC(settingsitem->SettingTextL(), + *path); + } + command->SetTObjectValueL(KMPXCommandGeneralSessionId, static_cast(this)); + //issue command to the medialist which further calls data source to update MDS + iItemMediaList->CommandL(*command); + CleanupStack::PopAndDestroy(command); + CleanupStack::PopAndDestroy(path); + } + } + } + CleanupStack::PopAndDestroy( textBuf ); + + //notify observer that some operation has happened. So refresh the toolbar area.. + iResetToolbarObs.HandleToolbarResetting(EFalse); + } +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::UpdateTagsL() +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::UpdateTagsL() + { + //Get the tag setting item handle to set the text + CAknSettingItem* settingsitem = + (*SettingItemArray())[ETagsItem]; + //Set the tag setter to empty string before filling in the data. + iTagSetter.Copy(KGlxTextSetter); + //Loop to appened all the tags to the iTagSetter. + for( TInt index = 0 ; index < iTagMediaList->Count() ; index++ ) + { + if(iTagSetter.Length()) + { + iTagSetter.Append(KGlxComma); + } + const TGlxMedia& item = iTagMediaList->Item( index ); + const TDesC& title = item.Title(); + iTagSetter.Append(title); + } + EditItemL(ETagsItem,EFalse); + } +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::UpdateAlbumsL() +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::UpdateAlbumsL() + { + //Get the tag setting item handle to set the text + CAknSettingItem* settingsitem = + (*SettingItemArray())[EAlbumsItem]; + //Set the tag setter to empty string before filling in the data. + iAlbumSetter.Copy(KGlxTextSetter); + //Loop to appened all the tags to the iAlbumSetter. + for( TInt index = 0 ; index < iAlbumMediaList->Count() ; index++ ) + { + if(iAlbumSetter.Length()) + { + iAlbumSetter.Append(KGlxComma); + } + const TGlxMedia& item = iAlbumMediaList->Item( index ); + const TDesC& title = item.Title(); + iAlbumSetter.Append(title); + } + EditItemL(EAlbumsItem,EFalse); + } +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL() +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::SetDurationLIicenseItemVisibilityL() + { + //get the media item. + const TGlxMedia& item = iItemMediaList->Item(0); + const CGlxMedia* media = item.Properties(); + + //in order to check for video category and drm rights + + CAknSettingItem* hiddenItem = NULL; + if( item.Category() == EMPXVideo) + { + if(!item.IsDrmProtected()) + { + hiddenItem = (*SettingItemArray())[EDurationItem]; + //Set the duration item visible + hiddenItem->SetHidden(EFalse); + } + //set the video flag which would be used to enable/disable the view details option. + this->HandleChangeInItemArrayOrVisibilityL(); + iVideo = ETrue; + } + if( media && media->IsSupported(KMPXMediaDrmProtected)) + { + if(item.IsDrmProtected()) + { + hiddenItem = (*SettingItemArray())[ElicenseItem]; + //Set the License item visible + hiddenItem->SetHidden(EFalse); + //Required to refresh the listbox when any items visiblity is changed + this->HandleChangeInItemArrayOrVisibilityL(); + } + } + } +//Medialist callbacks. +// ---------------------------------------------------------------------------- +// CGlxMetadataContainer::HandleAttributesAvailableL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleAttributesAvailableL( TInt /*aItemIndex*/, + const RArray& aAttributes, MGlxMediaList* aList ) + { + TRACER("CGlxMetadataContainer::HandleAttributesAvailableL()"); + //generic medialist for the item for all the attributes required other than tags and albums. + if(aList == iItemMediaList) + { + // Loop untill it checks for all the avialable attributes + for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--) + { + //set attributes to the items in the container + SetAttributesL(aAttributes[i]); + } + } + //updation of tags and albums list based on the medialist callback. + if(aList == iTagMediaList || aList == iAlbumMediaList) + { + for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--) + { + TMPXAttribute titleAtrribute (KMPXMediaGeneralTitle); + for (TInt i = aAttributes.Count() - 1; i >= 0 ; i--) + { + if( titleAtrribute == aAttributes[i] ) + { + if(aList == iTagMediaList) + { + UpdateTagsL(); + } + else if(aList == iAlbumMediaList) + { + UpdateAlbumsL(); + } + } + } + + } + } + + } + +// ---------------------------------------------------------------------------- +// HandleItemAddedL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* aList ) + { + TRACER("CGlxMetadataContainer::HandleItemAddedL()"); + + if(!iTagMediaList) + { + CreateTagsMediaListL(); + } + if(!iAlbumMediaList) + { + CreateAlbumsMediaListL(); + } + if(!iMarquee) + { + EnableMarqueingL(); + } + SetDurationLIicenseItemVisibilityL(); + if(aList == iTagMediaList) + { + UpdateTagsL(); + } + else if(aList == iAlbumMediaList) + { + UpdateAlbumsL(); + } + if(aList == iItemMediaList) + { + if(iItemMediaList->Count()) + { + TGlxMedia item = iItemMediaList->Item(0); + CGlxUStringConverter* stringConverter = CGlxUStringConverter::NewL(); + CleanupStack::PushL(stringConverter ); + for(TInt index = 0; index <= 9; index++) + { + HBufC* string = NULL; + + if(index == ESizeItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralSize,0, string ); + } + else if(index == EDurationItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralDuration,0, string ); + } + else if(index == ENameItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralTitle,0, string ); + } + else if(index == EDateAndTimeItem) + { + stringConverter->AsStringL( item, + KMPXMediaGeneralDate, + R_QTN_DATE_USUAL_WITH_ZERO,string ); + } + else if(index == EDescriptionItem) + { + stringConverter->AsStringL(item, + KMPXMediaGeneralComment,0, string ); + } + else if(index == ELocationItem) + { + stringConverter->AsStringL(item, + KGlxMediaGeneralLocation,0, string ); + } + else if(index == EResolutionItem) + { + stringConverter->AsStringL(item, + KGlxMediaGeneralDimensions,0, string ); + } + else + { + //no implementation + } + if(string) + { + iTextSetter.Copy(KGlxTextSetter); + iTextSetter.Append(*string); + } + EditItemL(index,EFalse); + delete string; + string = NULL; + } + CleanupStack::PopAndDestroy(stringConverter ); + } + } + } +// ---------------------------------------------------------------------------- +// EnableMarqueingL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::EnableMarqueingL() + { + TRACER("CGlxMetadataContainer::EnableMarqueingL()"); + iMarquee = ETrue; + ListBox()->UseLogicalToVisualConversion(ETrue); + ListBox()->ItemDrawer()->ColumnData()->SetMarqueeParams (KMarqueeLoopCount, + KMarqueeScrollAmount, KMarqueeScrollDelay, KMarqueeScrollInterval); + ListBox()->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + } +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleCommandCompleteL(TAny* aSessionId, + CMPXCommand* /*aCommandResult*/, TInt aError, MGlxMediaList* aList) + { + TRACER("CGlxMetadataContainer::HandleCommandCompleteL()"); + //To rename the uri in File System + if(aError == KErrNone) + { + TInt index = ListBox()->CurrentItemIndex(); + if(aList == iItemMediaList && index == ENameItem) + { + iItemMediaList->SetFocusL(NGlxListDefs::EAbsolute,0); + const TGlxMedia& media = iItemMediaList->Item(0); + ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); + CleanupStack::PushL(manager); + TFileName fileName = ParseFileName(iTextSetter); + if(iModifiedUri) + { + delete iModifiedUri; + iModifiedUri = NULL; + } + iModifiedUri = fileName.AllocL(); + iTextSetter.Copy(KGlxTextSetter); + TInt error = manager->RenameFile(media.Uri(), iModifiedUri->Des()); + if(error == KErrNone) + { + iAsyncRequest->CompleteSelf(); + } + else + { + User::LeaveIfError(error); + } + CleanupStack::PopAndDestroy(manager); + } + } + //To update the location information once the delete operation is successful. + if(aList == iItemMediaList && iLocationinfo + && static_cast( this ) == aSessionId) + { + TGlxMedia media = iItemMediaList->Item(0) ; + media.DeleteLocationAttribute(); + iLocationinfo = EFalse; + if ( aError == KErrNone ) + { + iTextSetter.Copy(KGlxTextSetter); + EditItemL(ELocationItem,EFalse); + } + } + } + +// ---------------------------------------------------------------------------- +// HandleItemRemoved +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleItemRemovedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMetadataContainer::HandleItemRemovedL()"); + } +// ---------------------------------------------------------------------------- +// HandleFocusChangedL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleFocusChangedL( NGlxListDefs:: + TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMetadataContainer::HandleFocusChangedL()"); + } +// ---------------------------------------------------------------------------- +// HandleItemSelected +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleItemSelectedL(TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMetadataContainer::HandleItemSelectedL"); + } +// ---------------------------------------------------------------------------- +// HandleMessageL +// ---------------------------------------------------------------------------- +// + void CGlxMetadataContainer::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMetadataContainer::HandleMessageL()"); + } +// ---------------------------------------------------------------------------- +// HandleError +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleError( TInt /*aError*/ ) + { + TRACER("CGlxMetadataContainer::HandleError()"); + TRAP_IGNORE(HandleErrorL()); + } + +// ---------------------------------------------------------------------------- +// HandleErrorL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleErrorL() + { + TRACER("CGlxMetadataContainer::HandleErrorL()"); + } +// ---------------------------------------------------------------------------- +// HandleCommandCompleteL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, + TInt /*aError*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMetadataContainer::HandleCommandCompleteL()"); + } + +// ---------------------------------------------------------------------------- +// HandleMediaL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMetadataContainer::HandleMediaL()"); + } + +// ---------------------------------------------------------------------------- +// HandleItemModifiedL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::HandleItemModifiedL( const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/ ) + { + TRACER("CGlxMetadataContainer::HandleItemModifiedL()"); + } +// ---------------------------------------------------------------------------- +// ChangeMskL +// ---------------------------------------------------------------------------- +// +void CGlxMetadataContainer::ChangeMskL() + { + TRACER("CGlxMetadataContainer::ChangeMsk()"); + TInt index = ListBox()->CurrentItemIndex(); + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + switch(index) + { + case ENameItem: + case EDescriptionItem: + case ETagsItem: + case EAlbumsItem: + { + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT); + } + break; + case EDateAndTimeItem: + case ELocationItem: + case ESizeItem: + case EDurationItem: + case ElicenseItem: + case EResolutionItem: + { + uiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEdit,R_GLX_METADATA_MSK_BLANK); + } + break; + default: + { + break; + } + } + + if ( uiUtility ) + { + uiUtility->Close(); + } + } + +// --------------------------------------------------------------------------- +// Parse the drive, path & extension from the old uri, +// And return the modified uri by appending the new title +// --------------------------------------------------------------------------- +TFileName CGlxMetadataContainer::ParseFileName(const TDesC& aTitleText) + { + TRACER("CGlxMetadataContainer::ParseFileName()"); + const TGlxMedia& media = iItemMediaList->Item(0); + TParsePtrC parsePtr(media.Uri()); + + TFileName destinationFileName; + destinationFileName.Append(parsePtr.DriveAndPath()); + destinationFileName.Append(aTitleText); + destinationFileName.Append(parsePtr.Ext()); + + return destinationFileName; + } + +// --------------------------------------------------------------------------- +// Create new MediaList with modified FileName. +// --------------------------------------------------------------------------- +void CGlxMetadataContainer::RefreshMediaListL() + { + TRACER("CGlxMetadataContainer::RefreshMediaList()"); + if(iItemMediaList) + { + iItemMediaList->RemoveContext(iMainListAttributecontext); + iItemMediaList->RemoveMediaListObserver(this); + iItemMediaList->Close(); + iItemMediaList = NULL; + if( iMainListAttributecontext ) + { + delete iMainListAttributecontext; + iMainListAttributecontext = NULL; + } + CreateMediaListForSelectedItemL(ETrue); + } + } + +// --------------------------------------------------------------------------- +// Completes the active object causing a call from the active scheduler to RunL() +// --------------------------------------------------------------------------- +// +void CGlxMetadataAsyncUpdate::CompleteSelf() + { + TRACER("CGlxMetadataAsyncUpdate::CompleteSelf"); + TRequestStatus* status=&iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// RunL +// ----------------------------------------------------------------------------- +// +void CGlxMetadataAsyncUpdate::RunL() + { + TRACER("CGlxMetadataAsyncUpdate::RunL"); + if(iStatus.Int() == KErrNone) + { + iObserver.RefreshMediaListL(); + } + } + +// ----------------------------------------------------------------------------- +// DoCancel +// ----------------------------------------------------------------------------- +// +void CGlxMetadataAsyncUpdate::DoCancel() + { + TRACER("CGlxMetadataAsyncUpdate::DoCancel"); + // No need to do anything + } + +// --------------------------------------------------------- +// NewL +// --------------------------------------------------------- +// +CGlxMetadataAsyncUpdate* CGlxMetadataAsyncUpdate::NewL(CGlxMetadataContainer& aObserver) + { + TRACER("CGlxMetadataAsyncUpdate::NewL"); + CGlxMetadataAsyncUpdate* self = CGlxMetadataAsyncUpdate::NewLC(aObserver); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// NewLC +// --------------------------------------------------------- +// +CGlxMetadataAsyncUpdate* CGlxMetadataAsyncUpdate::NewLC(CGlxMetadataContainer& aObserver) + { + TRACER("CGlxMetadataAsyncUpdate::NewLC"); + CGlxMetadataAsyncUpdate* self = new(ELeave) CGlxMetadataAsyncUpdate(aObserver); + CleanupStack::PushL(self); + return self; + } + +// --------------------------------------------------------- +// Constructor +// --------------------------------------------------------- +// +CGlxMetadataAsyncUpdate::CGlxMetadataAsyncUpdate(CGlxMetadataContainer& aObserver): + CActive(EPriorityStandard),iObserver(aObserver) + { + TRACER("CGlxMetadataAsyncUpdate::CGlxMetadataAsyncUpdate()"); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CGlxMetadataAsyncUpdate::~CGlxMetadataAsyncUpdate() + { + TRACER("CGlxMetadataAsyncUpdate::~CGlxMetadataAsyncUpdate"); + Cancel(); + } +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/src/glxmetadatadialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/src/glxmetadatadialog.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,589 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata dialog +* +*/ + +#include "glxmetadatadialog.h" + +//system includes +#include //for AknUtils +#include +#include +#include +#include // KDC_APP_RESOURCE_DIR +#include // for CEikMenuBar +#include +#include +#include // For CGlxCommandHandlerAddToContainer + +//User includes +#include +#include +#include +#include +#include +#include // for TGlxFilterFactory +#include +#include +#include // for HlpLauncher +#include +#include +#include +#include +#include +#include // For Panics +#include "glxmetadatacommandhandler.h" + +#define GetAppUi() (dynamic_cast(iEikonEnv->EikAppUi())) + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMetadataDialog* CGlxMetadataDialog::NewL( const TDesC& aUri ) + { + TRACER("CGlxMetadataDialog::NewL"); + + CGlxMetadataDialog* self = new(ELeave) CGlxMetadataDialog(aUri ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +CGlxMetadataDialog::CGlxMetadataDialog(const TDesC& aUri):iUri(aUri) +{ + +} +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::ConstructL() + { + TRACER("CGlxMetadataDialog::ConstructL"); + + // Load dialog's resource file + InitResourceL(); + + + iStatusPaneAvailable = EFalse; + // set the title to the dialog, Note that avkon dialogs do not support + // setting the title in the status pane so we need to do it the hard way + // get status pane + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + + if(statusPane && statusPane->IsVisible()) + { + iStatusPaneAvailable = ETrue; + } + + // make the toolbar disabled + SetDetailsDlgToolbarVisibility(EFalse); + + // do we have status pane + if( statusPane ) + { + GLX_LOG_INFO1("GLX_UMP::CGlxMetadataDialog::ConstructL::STATUS PANE = %d",statusPane->IsVisible()); + // load the title text + HBufC* text = StringLoader::LoadL(R_GLX_METADATA_VIEW_TITLE_DETAILS, iEikonEnv ); + SetTitleL( *text ); + if( text) + { + delete text; + } + GetAppUi()->StatusPane()->MakeVisible(ETrue); + } + + iUiUtility = CGlxUiUtility::UtilityL(); + iAddToTag = CGlxCommandHandlerAddToContainer::NewL(this, EGlxCmdAddTag, EFalse); + iAddToAlbum = CGlxCommandHandlerAddToContainer::NewL(this, EGlxCmdAddToAlbum, EFalse); + + // Call the base class' two-phased constructor + CAknDialog::ConstructL( R_METADATA_MENUBAR ); + + // Instantiate the command handler + iMetadataCmdHandler = CGlxMetadataCommandHandler::NewL(this); + + } + +// ----------------------------------------------------------------------------- +// ~CGlxMetadataDialog +// ----------------------------------------------------------------------------- +// +CGlxMetadataDialog::~CGlxMetadataDialog() + { + + TRACER("CGlxMetadataDialog::~CGlxMetadataDialog"); + + //To Disable the status pane if the dialog is launched from fullscreenview + if(!iStatusPaneAvailable) + { + GetAppUi()->StatusPane()->MakeVisible(EFalse); + } + + TRAP_IGNORE(SetPreviousTitleL()); + + delete iPreviousTitle; + delete iMetadataCmdHandler; + + // Restore the Toolbar as it was in the Calling application + SetDetailsDlgToolbarVisibility(ETrue); + + // If details launched from FullScreen View, while moving back, + // all the UI components should be hidden. Hence processing this command here. + TRAP_IGNORE(GetAppUi()->ProcessCommandL(EGlxCmdResetView)); + + if(iAddToTag) + { + delete iAddToTag; + } + + if(iAddToAlbum) + { + delete iAddToAlbum; + } + + if( iUiUtility ) + { + iUiUtility->Close(); + } + + if (iResourceOffset) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + } + +// --------------------------------------------------------------------------- +// SetDetailsDlgToolbarVisibility() +// --------------------------------------------------------------------------- +void CGlxMetadataDialog::SetDetailsDlgToolbarVisibility(TBool aVisible) + { + TRACER("CGlxMetadataDialog::SetDetailsDlgToolbarVisibility"); + CAknAppUi* appUi = GetAppUi(); + __ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer)); + + + HandleToolbarResetting(aVisible); + CAknToolbar* currentPopupToolbar = appUi->CurrentPopupToolbar(); + if(currentPopupToolbar) + { + currentPopupToolbar->SetToolbarVisibility(aVisible); + currentPopupToolbar->MakeVisible( aVisible ); + } + } + +// ----------------------------------------------------------------------------- +// ExecuteLD +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxMetadataDialog::ExecuteLD() + { + TRACER("CGlxMetadataDialog::ExecuteLD"); + return CAknDialog::ExecuteLD( R_METADATA_DIALOG ); + } +// --------------------------------------------------------------------------- +// MediaList. +// --------------------------------------------------------------------------- +// + MGlxMediaList& CGlxMetadataDialog::MediaList() + { + TRACER("CGlxMetadataDialog::MediaList"); + // return the refernce of media list + return iContainer->MediaList(); + } +// ----------------------------------------------------------------------------- +// ProcessCommandL +// ----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::ProcessCommandL( TInt aCommandId ) + { + TRACER("CGlxMetadataDialog::ProcessCommandL"); + + // hide menu bar + iMenuBar->StopDisplayingMenuBar(); + + switch( aCommandId ) + { + case EAknSoftkeyEdit: + case EAknSoftkeyCancel: + case EAknSoftkeySelect: + case EAknSoftkeyOk: + { + TryExitL( aCommandId ); + break; + } + + case EAknCmdHelp: + { + TCoeHelpContext helpContext; + helpContext.iMajor = TUid::Uid( KGlxGalleryApplicationUid ); + helpContext.iContext.Copy( LGAL_HLP_DETAILS_VIEW ); + const TInt KListSz = 1; + CArrayFix* contextList = + new (ELeave) CArrayFixFlat( KListSz ); + CleanupStack::PushL(contextList); + contextList->AppendL(helpContext); + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), contextList ); + CleanupStack::Pop( contextList ); + break; + } + case KGlxDeleteBoundMenuCommandId: + { + //Event passed on to container to handle + //Delete the location information of the data. + iContainer->RemoveLocationL(); + break; + } + case KGlxEditBoundMenuCommandId: + case KGlxViewBoundMenuCommandId: + { + //To edit the details - forward the event to container to edit + //Both edit and view details command are handled in the same function based on the item. + iContainer->HandleListboxChangesL(); + break; + } + case EGlxCmdAiwBase: + { + // pass aCommandId to command handler + iMetadataCmdHandler->DoExecuteL( aCommandId, MediaList() ); + } + default: + break; + } + } +//----------------------------------------------------------------------------- +// CGlxMetadataDialog::CreateCustomControlL +//----------------------------------------------------------------------------- +SEikControlInfo CGlxMetadataDialog::CreateCustomControlL(TInt + aControlType) + { + GLX_LOG_INFO("CShwSlideshowSettingsDialog::CreateCustomControlL"); + + // create control info, no flags or trailer text set + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + if (aControlType == EMetaDataDialogListBox) + { + iContainer = CGlxMetadataContainer::NewL(GetAppUi()->ClientRect(), + *this, iUri, *this); + controlInfo.iControl = iContainer; // giving ownership + } + return controlInfo; // returns ownership of ItemList + } + + +// ----------------------------------------------------------------------------- +// CGlxMetadataDialog::OfferKeyEventL +// ----------------------------------------------------------------------------- +// +TKeyResponse CGlxMetadataDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + TRACER("CGlxMetadataDialog::OfferKeyEventL"); + TKeyResponse response = EKeyWasNotConsumed; + switch(aKeyEvent.iCode) + { + case EKeyUpArrow: + case EKeyDownArrow: + { + if(!iUiUtility->IsPenSupported()) + { + iContainer->ChangeMskL(); + } + iContainer->EnableMarqueingL(); + break; + } + default: + break; + } + if ( response == EKeyWasNotConsumed ) + { + // container didn't consume the key so try the base class + // this is crucial as platform uses a key event to dismiss dialog + // when a view changes to another. the base class also consumes all + // the keys we dont want to handle automatically as this is a + // blocking dialog + response = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); + } + return response; + } + +// ----------------------------------------------------------------------------- +// CGlxMetadataDialog::DynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ) + { + TRACER("CGlxMetadataDialog::DynInitMenuPaneL"); + iMetadataCmdHandler->PreDynInitMenuPaneL(aMenuId); + iMetadataCmdHandler->DynInitMenuPaneL(aMenuId,aMenuPane); + //To enable/diable the options based on the item selected. + iContainer->ViewDynInitMenuPaneL(aMenuId, aMenuPane); + } + +// ----------------------------------------------------------------------------- +// OkToExitL +// ----------------------------------------------------------------------------- +// +TBool CGlxMetadataDialog::OkToExitL( TInt aKeycode ) + { + TRACER("CGlxMetadataDialog::OkToExitL"); + + TBool retVal = EFalse; + + switch (aKeycode) + { + case EAknSoftkeySelect: + case EAknSoftkeyOk: + { + break; + } + case EAknSoftkeyOptions: + { + // display menu only + // show the option menu that can have mutiselect options + iMenuBar->SetMenuType( CEikMenuBar::EMenuOptions ); + retVal = CAknDialog::OkToExitL( aKeycode ); + break; + } + case EAknSoftkeyBack: + case EAknSoftkeyCancel: + { + retVal = ETrue; + break; + } + + case EAknSoftkeyEdit: + { + if(!iUiUtility->IsPenSupported()) + { + iContainer->HandleListboxChangesL(); + } + else + { + HandleViewCommandL(aKeycode); + } + break; + } + default : + break; + } + return retVal; + } + +//----------------------------------------------------------------------------- +// CGlxMetadataDialog::SizeChanged +//----------------------------------------------------------------------------- +void CGlxMetadataDialog::SizeChanged() + { + TRACER("CGlxMetadataDialog::SizeChanged"); + CAknDialog::SizeChanged(); + } +// ----------------------------------------------------------------------------- +// CGlxMetadataDialog::InitResourceL +// ----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::InitResourceL() + { + TRACER("CGlxMetadataDialog::InitResourceL"); + + _LIT(KGlxMetadataDialogResource,"glxmetadatadialog.rsc"); + //add resource file + TParse parse; + parse.Set(KGlxMetadataDialogResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + } + + +// ----------------------------------------------------------------------------- +// CGlxMetadataDialog::HandleViewCommandL +// ----------------------------------------------------------------------------- +// +TBool CGlxMetadataDialog::HandleViewCommandL( TInt /*aCommand*/ ) + { + TRACER("CGlxMetadataDialog::HandleViewCommandL"); + return EFalse; + } +// --------------------------------------------------------------------------- +// CGlxMetadataDialog::PreLayoutDynInitL +// --------------------------------------------------------------------------- +// +void CGlxMetadataDialog::PreLayoutDynInitL() + { + // No Implementation + } + +//----------------------------------------------------------------------------- +// CGlxMetadataDialog::PostLayoutDynInitL +//----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::PostLayoutDynInitL() + { + TRACER("CGlxMetadataDialog::PostLayoutDynInitL"); + if(!iUiUtility->IsPenSupported()) + { + iUiUtility->ScreenFurniture()->ModifySoftkeyIdL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknSoftkeyEdit,R_GLX_METADATA_MSK_EDIT); + } + } + +//----------------------------------------------------------------------------- +// CGlxMetadataDialog::Draw +//----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::Draw( const TRect& /*aRect*/ ) const + { + TRACER("CGlxMetadataDialog::Draw"); + TRect rect; + AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); + + // Get the standard graphics context + CWindowGc& gc = SystemGc(); + gc.SetBrushColor(KRgbWhite); + gc.DrawRect(rect); + } + +//----------------------------------------------------------------------------- +// CGlxMetadataDialog::HandlePointerEventL +//----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::HandlePointerEventL( + const TPointerEvent& aPointerEvent) + { + TRACER("CGlxMetadataDialog::HandlePointerEventL"); + CCoeControl::HandlePointerEventL( aPointerEvent ); + } + +// --------------------------------------------------------------------------- +// CGlxMetadataDialog::OnLocationEditL +// --------------------------------------------------------------------------- +// +void CGlxMetadataDialog::OnLocationEditL() + { + TRACER("CGlxMetadataDialog::OnLocationEditL"); + OkToExitL( EAknSoftkeyOptions ); + } + +// --------------------------------------------------------------------------- +// CGlxMetadataDialog::AddTag +// --------------------------------------------------------------------------- +// +void CGlxMetadataDialog::AddTagL() +{ + iAddToTag->ExecuteL(EGlxCmdAddTag); +} +// --------------------------------------------------------------------------- +// CGlxMetadataDialog::AddAlbum +// --------------------------------------------------------------------------- +// +void CGlxMetadataDialog::AddAlbumL() +{ + iAddToAlbum->ExecuteL(EGlxCmdAddToAlbum); +} + +// --------------------------------------------------------------------------- +// CGlxMetadataDialog::SetTitleL() +// --------------------------------------------------------------------------- +void CGlxMetadataDialog::SetTitleL(const TDesC& aTitleText) + { + TRACER("CGlxFetcherContainer::SetTitleL"); + CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CleanupStack::PushL(statusPane); + // get pointer to the default title pane control + CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + CleanupStack::PushL(titlePane); + // set the title if we got the title pane control + if( titlePane ) + { + GLX_LOG_INFO("GLX_UMP::CGlxMetadataDialog::ConstructL::INSIDE titlePane"); + iPreviousTitle = titlePane->Text()->AllocL(); + // Set the required Title + titlePane->SetTextL( aTitleText ); + } + CleanupStack::Pop(titlePane); + CleanupStack::Pop(statusPane); + } + +// --------------------------------------------------------------------------- +// CGlxMetadataDialog::SetPreviousTitleL +// --------------------------------------------------------------------------- +void CGlxMetadataDialog::SetPreviousTitleL() + { + TRACER("CGlxFetcherContainer::SetPreviousTitleL"); + CEikStatusPane* prevStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); + CleanupStack::PushL(prevStatusPane); + CAknTitlePane* prevTitlePane = ( CAknTitlePane* )prevStatusPane->ControlL( + TUid::Uid( EEikStatusPaneUidTitle )); + CleanupStack::PushL(prevTitlePane); + if( prevTitlePane ) + { + // Restore the Title back of the Calling Application + prevTitlePane->SetTextL( *iPreviousTitle ); + } + CleanupStack::Pop(prevTitlePane); + CleanupStack::Pop(prevStatusPane); + } +// ----------------------------------------------------------------------------- +// CGlxMetadataDialog::HandleResourceChange +// ----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::HandleResourceChange( TInt aType ) + { + TRACER("CGlxMetadataDialog::HandleResourceChange"); + //Handle global resource changes, such as scalable UI or skin events and orientation change (override) + CAknDialog::HandleResourceChange( aType ); + } + +// ----------------------------------------------------------------------------- +// CGlxMetadataDialog::HandleToolbarResetting +// ----------------------------------------------------------------------------- +// +void CGlxMetadataDialog::HandleToolbarResetting(TBool aVisible) + { + TRACER("CGlxMetadataDialog::HandleToolbarResetting"); + CAknAppUi* appUi = GetAppUi(); + __ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer)); + + CAknToolbar* popupToolbar = appUi->PopupToolbar(); + if(popupToolbar) + { + popupToolbar->SetToolbarVisibility( !aVisible ); + popupToolbar->MakeVisible( !aVisible ); + if(!aVisible) + { + popupToolbar->DrawNow(); + } + } + CAknToolbar* toolbar = appUi->CurrentFixedToolbar(); + if(toolbar) + { + toolbar->HideItemsAndDrawOnlyBackground(!aVisible); + toolbar->SetToolbarVisibility(aVisible); + toolbar->MakeVisible( aVisible ); + } + } +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/src/glxmetadataviewutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/src/glxmetadataviewutility.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata dialog +* +*/ + +#include "glxmetadataviewutility.h" + +#include +#include +#include +#include "glxmetadatadialog.h" +#include + + +// ======================= MEMBER FUNCTIONS ================================== + +// --------------------------------------------------------------------------- +// ActivateViewL +// --------------------------------------------------------------------------- +// +EXPORT_C void GlxMetadataViewUtility::ActivateViewL( const TDesC& aURI ) + { + TRACER("GlxMetadataViewUtility::ActivateViewL"); + CGlxMetadataDialog* dialog = CGlxMetadataDialog::NewL( aURI ); + dialog->ExecuteLD(); + } + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadatadialog/src/glxresourceutilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadatadialog/src/glxresourceutilities.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata dialog +* +*/ + + + + +// CLASS HEADER +#include "glxresourceutilities.h" + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES +#include + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile ) + { + TRACER("CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile)"); + + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + CGlxResourceUtilities::GetResourceFilenameL( aResFile, fs ); + CleanupStack::PopAndDestroy( &fs ); + } + +// --------------------------------------------------------------------------- +// GetResourceFilenameL +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile, RFs& aFs ) + { + TRACER("CGlxResourceUtilities::GetResourceFilenameL( TFileName& aResFile, RFs& aFs )"); + + // don't use AknUtils CompleteWithAppPath + aResFile.Insert( 0, TDriveUnit( EDriveC).Name() ); + // try to locate the localised resource + BaflUtils::NearestLanguageFile( aFs, aResFile ); + // if the localised resource is found, the file name is changed to + // the localised name (z:\apps\resources\xxx.r001) + if( !BaflUtils::FileExists( aFs, aResFile ) ) + { + // not found on c drive, try z + aResFile.Replace( 0, KMaxDriveName, TDriveUnit( EDriveZ ).Name() ); + // try to locate the localised resource again + BaflUtils::NearestLanguageFile( aFs, aResFile ); + // if file was not found this time, there is no localised + // resource with the name + if (!BaflUtils::FileExists( aFs, aResFile ) ) + { + User::Leave( KErrNotFound ); + } + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/bwins/glxunifiedmetadataviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/bwins/glxunifiedmetadataviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,24 @@ +EXPORTS + ??0TGlxMulAlbumsDetailsBindingSetFactory@@QAE@XZ @ 1 NONAME ; TGlxMulAlbumsDetailsBindingSetFactory::TGlxMulAlbumsDetailsBindingSetFactory(void) + ??0TGlxMulDateAndTimeDetailsBindingSetFactory@@QAE@XZ @ 2 NONAME ; TGlxMulDateAndTimeDetailsBindingSetFactory::TGlxMulDateAndTimeDetailsBindingSetFactory(void) + ??0TGlxMulDescriptionDetailsBindingSetFactory@@QAE@XZ @ 3 NONAME ; TGlxMulDescriptionDetailsBindingSetFactory::TGlxMulDescriptionDetailsBindingSetFactory(void) + ??0TGlxMulDurationDetailsBindingSetFactory@@QAE@XZ @ 4 NONAME ; TGlxMulDurationDetailsBindingSetFactory::TGlxMulDurationDetailsBindingSetFactory(void) + ??0TGlxMulFileSizeDetailsBindingSetFactory@@QAE@XZ @ 5 NONAME ; TGlxMulFileSizeDetailsBindingSetFactory::TGlxMulFileSizeDetailsBindingSetFactory(void) + ??0TGlxMulLocationDetailsBindingSetFactory@@QAE@XZ @ 6 NONAME ; TGlxMulLocationDetailsBindingSetFactory::TGlxMulLocationDetailsBindingSetFactory(void) + ??0TGlxMulResolutionDetailsBindingSetFactory@@QAE@XZ @ 7 NONAME ; TGlxMulResolutionDetailsBindingSetFactory::TGlxMulResolutionDetailsBindingSetFactory(void) + ??0TGlxMulTagsDetailsBindingSetFactory@@QAE@XZ @ 8 NONAME ; TGlxMulTagsDetailsBindingSetFactory::TGlxMulTagsDetailsBindingSetFactory(void) + ??0TGlxMulTitleDetailsBindingSetFactory@@QAE@XZ @ 9 NONAME ; TGlxMulTitleDetailsBindingSetFactory::TGlxMulTitleDetailsBindingSetFactory(void) + ??0TGlxMulUsageRightsDetailsBindingSetFactory@@QAE@XZ @ 10 NONAME ; TGlxMulUsageRightsDetailsBindingSetFactory::TGlxMulUsageRightsDetailsBindingSetFactory(void) + ??1TGlxMulAlbumsDetailsBindingSetFactory@@UAE@XZ @ 11 NONAME ; TGlxMulAlbumsDetailsBindingSetFactory::~TGlxMulAlbumsDetailsBindingSetFactory(void) + ??1TGlxMulDateAndTimeDetailsBindingSetFactory@@UAE@XZ @ 12 NONAME ; TGlxMulDateAndTimeDetailsBindingSetFactory::~TGlxMulDateAndTimeDetailsBindingSetFactory(void) + ??1TGlxMulDescriptionDetailsBindingSetFactory@@UAE@XZ @ 13 NONAME ; TGlxMulDescriptionDetailsBindingSetFactory::~TGlxMulDescriptionDetailsBindingSetFactory(void) + ??1TGlxMulDurationDetailsBindingSetFactory@@UAE@XZ @ 14 NONAME ; TGlxMulDurationDetailsBindingSetFactory::~TGlxMulDurationDetailsBindingSetFactory(void) + ??1TGlxMulFileSizeDetailsBindingSetFactory@@UAE@XZ @ 15 NONAME ; TGlxMulFileSizeDetailsBindingSetFactory::~TGlxMulFileSizeDetailsBindingSetFactory(void) + ??1TGlxMulLocationDetailsBindingSetFactory@@UAE@XZ @ 16 NONAME ; TGlxMulLocationDetailsBindingSetFactory::~TGlxMulLocationDetailsBindingSetFactory(void) + ??1TGlxMulResolutionDetailsBindingSetFactory@@UAE@XZ @ 17 NONAME ; TGlxMulResolutionDetailsBindingSetFactory::~TGlxMulResolutionDetailsBindingSetFactory(void) + ??1TGlxMulTagsDetailsBindingSetFactory@@UAE@XZ @ 18 NONAME ; TGlxMulTagsDetailsBindingSetFactory::~TGlxMulTagsDetailsBindingSetFactory(void) + ??1TGlxMulTitleDetailsBindingSetFactory@@UAE@XZ @ 19 NONAME ; TGlxMulTitleDetailsBindingSetFactory::~TGlxMulTitleDetailsBindingSetFactory(void) + ??1TGlxMulUsageRightsDetailsBindingSetFactory@@UAE@XZ @ 20 NONAME ; TGlxMulUsageRightsDetailsBindingSetFactory::~TGlxMulUsageRightsDetailsBindingSetFactory(void) + ?NewL@CGlxMetadataView@@SAPAV1@PAVMGlxMediaListFactory@@@Z @ 21 NONAME ; class CGlxMetadataView * CGlxMetadataView::NewL(class MGlxMediaListFactory *) + ?NewLC@CGlxMetadataView@@SAPAV1@PAVMGlxMediaListFactory@@@Z @ 22 NONAME ; class CGlxMetadataView * CGlxMetadataView::NewLC(class MGlxMediaListFactory *) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/data/glxmetadataview.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/data/glxmetadataview.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,298 @@ +/* +* Copyright (c) 2008-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: Resource definitions for Metadata View +* +*/ + + +//RESOURCE IDENTIFIER + +NAME MGMV + +//INCLUDES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//RESOURCE DEFINITIONS + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="MGMV"; } + +// ----------------------------------------------------------------------------- +// reource for view +// ----------------------------------------------------------------------------- +// +RESOURCE AVKON_VIEW r_glx_metadata_view + { + menubar = r_metadata_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; + } + +// ----------------------------------------------------------------------------- +// reource for menubar +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_BAR r_metadata_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_metadata_menu; txt = qtn_lgal_title_details; } + }; + } + +// ----------------------------------------------------------------------------- +// reource for menupane +// ----------------------------------------------------------------------------- +// +RESOURCE MENU_PANE r_metadata_menu + { + items= + { + MENU_ITEM { command = KGlxEditBoundMenuCommandId; txt = qtn_lgal_options_edit; }, + MENU_ITEM { command = KGlxViewBoundMenuCommandId; txt = qtn_lgal_options_view; }, + MENU_ITEM { command = EGlxCmdAiwShowMap; txt = qtn_lgal_option_show_on_map;}, + MENU_ITEM { command = KGlxDeleteBoundMenuCommandId; txt = qtn_lgal_options_delete;flags = EEikMenuItemSpecific; }, + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; } + }; + } + + +// ----------------------------------------------------------------------------- +// +// metadata view custom resource +// +// ----------------------------------------------------------------------------- +// + +// ----------------------------------------------------------------------------- +// reource for CEikEdwin control +// ----------------------------------------------------------------------------- +// +RESOURCE EDWIN r_glx_edwin + { + flags = EAknEditorFlagDefault + | EEikEdwinNoAutoSelection + | EEikEdwinAvkonDisableCursor ; + width = 10; + lines= 1; + maxlength = 512; // Max number of characters + allowed_input_modes = EAknEditorTextInputMode; + default_input_mode = EAknEditorTextInputMode; + } + +// ----------------------------------------------------------------------------- +// reource for CAknQueryControl control +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_glx_data_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = " "; // prompt text + control = EDWIN + { + width = 5; + lines = 1; + maxlength = 50; + }; + }; + } + }; + } + +// ----------------------------------------------------------------------------- +// reource for view title +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_title + { + buf = qtn_lgal_title_details; // CHANGED FROM qtn_lgal_view_title_properties; + } + +// ----------------------------------------------------------------------------- +// reource for options edit +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_options_edit + { + buf = qtn_lgal_options_edit; + } + +// ----------------------------------------------------------------------------- +// reource for options delete +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_options_delete + { + buf = qtn_lgal_options_delete; + } + +// ----------------------------------------------------------------------------- +// reource for options view +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_options_view + { + buf = qtn_lgal_options_view; + } + +// ----------------------------------------------------------------------------- +// reource for options show on map +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_show_on_map_options_view + { + buf = qtn_lgal_option_show_on_map; + } + +// ----------------------------------------------------------------------------- +// reource for view title +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_title_details + { + buf = qtn_lgal_title_details; + } + +// ----------------------------------------------------------------------------- +// reource for metadata view title pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_title_nseries + { + buf = qtn_lgal_details_title; + } + +// ----------------------------------------------------------------------------- +// reource for metadata view description pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_description_nseries + { + buf = qtn_lgal_details_description; + } + +// ----------------------------------------------------------------------------- +// reource for metadata view tags pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_tags_nseries + { + buf = qtn_lgal_details_tags; + } +// ----------------------------------------------------------------------------- +// reource for metadata view albums pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_albums_nseries + { + buf = qtn_lgal_details_albums; + } +// ----------------------------------------------------------------------------- +// reource for metadata view location pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_location_nseries + { + buf = qtn_lgal_details_location; + } +// ----------------------------------------------------------------------------- +// reource for metadata view resolution pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_resolution_nseries + { + buf = qtn_lgal_details_resolution_title; + } +// ----------------------------------------------------------------------------- +// reource for metadata view duration pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_duration_nseries + { + buf = qtn_lgal_details_duration; + } +// ----------------------------------------------------------------------------- +// reource for metadata view drm pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_drm_nseries + { + buf = qtn_lgal_detail_drm; + } +// ----------------------------------------------------------------------------- +// reource for metadata view date and time pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_date_time_nseries + { + buf = qtn_lgal_details_date_time; + } +// ----------------------------------------------------------------------------- +// reource for metadata view file size pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_file_size_nseries + { + buf = qtn_lgal_details_file_size; + } +// ----------------------------------------------------------------------------- +// reource for metadata view file size pane +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_view_resolution_detail_nseries + { + buf = qtn_lgal_details_resolution_detail; + } + +// ----------------------------------------------------------------------------- +// reource for delete location confirmation note +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_note_delete_location + { + buf = qtn_lgal_note_delete_location; + } + +// ----------------------------------------------------------------------------- +// reource for no location info note +// ----------------------------------------------------------------------------- +// +RESOURCE TBUF r_glx_metadata_note_info_no_location + { + buf = qtn_lgal_note_no_location; + } + +//End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/eabi/glxunifiedmetadataviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/eabi/glxunifiedmetadataviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,54 @@ +EXPORTS + _ZN16CGlxMetadataView4NewLEP20MGlxMediaListFactory @ 1 NONAME + _ZN16CGlxMetadataView5NewLCEP20MGlxMediaListFactory @ 2 NONAME + _ZN35TGlxMulTagsDetailsBindingSetFactoryC1Ev @ 3 NONAME + _ZN35TGlxMulTagsDetailsBindingSetFactoryC2Ev @ 4 NONAME + _ZN35TGlxMulTagsDetailsBindingSetFactoryD0Ev @ 5 NONAME + _ZN35TGlxMulTagsDetailsBindingSetFactoryD1Ev @ 6 NONAME + _ZN35TGlxMulTagsDetailsBindingSetFactoryD2Ev @ 7 NONAME + _ZN36TGlxMulTitleDetailsBindingSetFactoryC1Ev @ 8 NONAME + _ZN36TGlxMulTitleDetailsBindingSetFactoryC2Ev @ 9 NONAME + _ZN36TGlxMulTitleDetailsBindingSetFactoryD0Ev @ 10 NONAME + _ZN36TGlxMulTitleDetailsBindingSetFactoryD1Ev @ 11 NONAME + _ZN36TGlxMulTitleDetailsBindingSetFactoryD2Ev @ 12 NONAME + _ZN37TGlxMulAlbumsDetailsBindingSetFactoryC1Ev @ 13 NONAME + _ZN37TGlxMulAlbumsDetailsBindingSetFactoryC2Ev @ 14 NONAME + _ZN37TGlxMulAlbumsDetailsBindingSetFactoryD0Ev @ 15 NONAME + _ZN37TGlxMulAlbumsDetailsBindingSetFactoryD1Ev @ 16 NONAME + _ZN37TGlxMulAlbumsDetailsBindingSetFactoryD2Ev @ 17 NONAME + _ZN39TGlxMulDurationDetailsBindingSetFactoryC1Ev @ 18 NONAME + _ZN39TGlxMulDurationDetailsBindingSetFactoryC2Ev @ 19 NONAME + _ZN39TGlxMulDurationDetailsBindingSetFactoryD0Ev @ 20 NONAME + _ZN39TGlxMulDurationDetailsBindingSetFactoryD1Ev @ 21 NONAME + _ZN39TGlxMulDurationDetailsBindingSetFactoryD2Ev @ 22 NONAME + _ZN39TGlxMulFileSizeDetailsBindingSetFactoryC1Ev @ 23 NONAME + _ZN39TGlxMulFileSizeDetailsBindingSetFactoryC2Ev @ 24 NONAME + _ZN39TGlxMulFileSizeDetailsBindingSetFactoryD0Ev @ 25 NONAME + _ZN39TGlxMulFileSizeDetailsBindingSetFactoryD1Ev @ 26 NONAME + _ZN39TGlxMulFileSizeDetailsBindingSetFactoryD2Ev @ 27 NONAME + _ZN39TGlxMulLocationDetailsBindingSetFactoryC1Ev @ 28 NONAME + _ZN39TGlxMulLocationDetailsBindingSetFactoryC2Ev @ 29 NONAME + _ZN39TGlxMulLocationDetailsBindingSetFactoryD0Ev @ 30 NONAME + _ZN39TGlxMulLocationDetailsBindingSetFactoryD1Ev @ 31 NONAME + _ZN39TGlxMulLocationDetailsBindingSetFactoryD2Ev @ 32 NONAME + _ZN41TGlxMulResolutionDetailsBindingSetFactoryC1Ev @ 33 NONAME + _ZN41TGlxMulResolutionDetailsBindingSetFactoryC2Ev @ 34 NONAME + _ZN41TGlxMulResolutionDetailsBindingSetFactoryD0Ev @ 35 NONAME + _ZN41TGlxMulResolutionDetailsBindingSetFactoryD1Ev @ 36 NONAME + _ZN41TGlxMulResolutionDetailsBindingSetFactoryD2Ev @ 37 NONAME + _ZN42TGlxMulDateAndTimeDetailsBindingSetFactoryC1Ev @ 38 NONAME + _ZN42TGlxMulDateAndTimeDetailsBindingSetFactoryC2Ev @ 39 NONAME + _ZN42TGlxMulDateAndTimeDetailsBindingSetFactoryD0Ev @ 40 NONAME + _ZN42TGlxMulDateAndTimeDetailsBindingSetFactoryD1Ev @ 41 NONAME + _ZN42TGlxMulDateAndTimeDetailsBindingSetFactoryD2Ev @ 42 NONAME + _ZN42TGlxMulDescriptionDetailsBindingSetFactoryC1Ev @ 43 NONAME + _ZN42TGlxMulDescriptionDetailsBindingSetFactoryC2Ev @ 44 NONAME + _ZN42TGlxMulDescriptionDetailsBindingSetFactoryD0Ev @ 45 NONAME + _ZN42TGlxMulDescriptionDetailsBindingSetFactoryD1Ev @ 46 NONAME + _ZN42TGlxMulDescriptionDetailsBindingSetFactoryD2Ev @ 47 NONAME + _ZN42TGlxMulUsageRightsDetailsBindingSetFactoryC1Ev @ 48 NONAME + _ZN42TGlxMulUsageRightsDetailsBindingSetFactoryC2Ev @ 49 NONAME + _ZN42TGlxMulUsageRightsDetailsBindingSetFactoryD0Ev @ 50 NONAME + _ZN42TGlxMulUsageRightsDetailsBindingSetFactoryD1Ev @ 51 NONAME + _ZN42TGlxMulUsageRightsDetailsBindingSetFactoryD2Ev @ 52 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008-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: Project build file +* +*/ + + + +PRJ_EXPORTS + +//../rom/glxmetadataview.iby CORE_APP_LAYER_IBY_EXPORT_PATH(glxmetadataview.iby) + +PRJ_MMPFILES + +//glxmetadataview.mmp + +//End of files + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/group/glxmetadataview.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/group/glxmetadataview.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + +#include + +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + +TARGET glxunifiedmetadataview.dll +TARGETTYPE dll +UID 0x1000008D 0x200104E2 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxmetadataviewimp.cpp +SOURCE glxmetadataview.cpp +SOURCE glxmetadatabindingsetfactory.cpp + +START RESOURCE ../data/glxmetadataview.rss +HEADER +TARGETPATH resource/apps +LANGUAGE_IDS +END + +SYSTEMINCLUDE ../inc +SYSTEMINCLUDE ../../viewbase/inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../dataprovider/inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc //for attribute retrival +SYSTEMINCLUDE ../../../drmutility/inc //for drm utility +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../commandhandlers/commoncommandhandlers/inc + +// System includes from epoc32/include +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY avkon.lib //for Avkon conrols +LIBRARY eikcoctl.lib //for eik controls +LIBRARY eikcore.lib //for eik controls +LIBRARY cone.lib //for CCoeEnv +LIBRARY efsrv.lib //for TParse +LIBRARY glxmedialists.lib //for CGlxMedia +LIBRARY glxviewbase.lib //for CGlxViewBase +LIBRARY mpxcommon.lib //for TMPXAttribute +LIBRARY glxcommon.lib //for filter factory, CResourceUtilities +LIBRARY glxuiutilities.lib //for ui utility +LIBRARY glxcommoncommandhandlers.lib //for show on map +LIBRARY flogger.lib + +// Uiaccelerator related libraries +LIBRARY osncore.lib // CAlfString +LIBRARY alfclient.lib // MAlfWidgetFactory +LIBRARY alfwidgetmodel.lib + +// MUL related libraries +LIBRARY libstdcpp.lib //for STL code +LIBRARY glxdataprovider.lib //data provider + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/inc/glxmetadatabindingsetfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/inc/glxmetadatabindingsetfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata view +* +*/ + + + +#ifndef _GLXMETADATABINDINGSETFACTORY_H_ +#define _GLXMETADATABINDINGSETFACTORY_H_ + + +#include +#include +#include "glxmulbindingsetfactory.h" + +NONSHARABLE_CLASS( TGlxMulTitleDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulTitleDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulTitleDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulDateAndTimeDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulDateAndTimeDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulDateAndTimeDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulDescriptionDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulDescriptionDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulDescriptionDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulTagsDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulTagsDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulTagsDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulAlbumsDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulAlbumsDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulAlbumsDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulLocationDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulLocationDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulLocationDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulFileSizeDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulFileSizeDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulFileSizeDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + + +NONSHARABLE_CLASS( TGlxMulResolutionDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulResolutionDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulResolutionDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulDurationDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulDurationDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulDurationDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +NONSHARABLE_CLASS( TGlxMulUsageRightsDetailsBindingSetFactory ) : public TGlxMulBindingSetFactory + { +public: + IMPORT_C TGlxMulUsageRightsDetailsBindingSetFactory(); + IMPORT_C ~TGlxMulUsageRightsDetailsBindingSetFactory(); +private: + /** + * Add different types of binding to the Binding set + * @param aCommand command associated with option menu item/items + */ + void AddBindingsL() const; + }; + +#endif // _GLXMETADATABINDINGSETFACTORY_H_ \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/inc/glxmetadataview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/inc/glxmetadataview.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2008-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: Metadata view implementation +* +*/ + + +#ifndef C_GLXMETADATAVIEW_H +#define C_GLXMETADATAVIEW_H + + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * Metadata view + * + */ +NONSHARABLE_CLASS(CGlxMetadataView) :public CGlxMediaListViewBase + { +public: + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + IMPORT_C static CGlxMetadataView* NewL( MGlxMediaListFactory* aMediaListFactory ); + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + IMPORT_C static CGlxMetadataView* NewLC( MGlxMediaListFactory* aMediaListFactory ); + + /** + * Destructor. + */ + virtual ~CGlxMetadataView(); + + }; + +#endif // C_GLXMETADATAVIEW_H + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/inc/glxmetadataviewimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/inc/glxmetadataviewimp.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2008-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: Metadata view implementation + * +*/ + + +#ifndef C_GLXMETADATAVIEWIMP_H__ +#define C_GLXMETADATAVIEWIMP_H__ + +// INCLUDES +#include + +#include "glxmetadataview.h" + +// FORWARD DECLARATIONS +class MGlxMediaList; +class CGlxDetailsMulModelProvider; + +// CLASS DECLARATION +/** + * CGlxMetadataViewImp + * + * Metadata view implementation. + */ +NONSHARABLE_CLASS( CGlxMetadataViewImp ) : public CGlxMetadataView, public IAlfWidgetEventHandler + { +public: + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + static CGlxMetadataViewImp* NewL( MGlxMediaListFactory* aMediaListFactory ); + + /** + * Two-phased constructor. + * + * @return Pointer to newly created object. + */ + static CGlxMetadataViewImp* NewLC( MGlxMediaListFactory* aMediaListFactory ); + + /** + * Destructor. + */ + virtual ~CGlxMetadataViewImp(); + +private: + + /** + * C++ default constructor. + */ + CGlxMetadataViewImp(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( MGlxMediaListFactory* aMediaListFactory ); + + // From MEikMenuObserver + void ViewDynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane *aMenuPane ); + +public: // From CGlxMediaListViewBase + + virtual TBool HandleViewCommandL( TInt aCommand ); + + virtual TInt MenuResourceId(); + + MGlxMediaList& MediaList(); + +private: // from base class CGlxMediaListViewBase + + TUid Id() const; + + void DoMLViewActivateL( const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& aCustomMessage ); + + void DoMLViewDeactivate(); + + +public: // ialfwidgeteventhandler + + bool accept( CAlfWidgetControl& /*aControl*/, const TAlfEvent& /*aEvent*/ ) const; + + void setActiveStates( unsigned int /*aStates*/ ); + + AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ); + + IAlfInterfaceBase* makeInterface( const IfId& /*aType*/ ); + + void setEventHandlerData( const AlfWidgetEventHandlerInitData& /*aData*/ ); + + AlfWidgetEventHandlerInitData* eventHandlerData(); + + AlfEventHandlerType eventHandlerType() ; + + AlfEventHandlerExecutionPhase eventExecutionPhase() ; + +private : //new method + + /** + * Create media list with URI filter + * + * @param aURI uri or file name of item + */ + void CreateMediaListL( const TDesC8& aURI ); + + /** + * Sets the default text for the List View when empty + */ + void CreateEmptyText(); + + /** + * Constructs the Alf Environment and display + */ + void ConstructAlfEnvL(); + + /** + * Constructs the list widget + */ + void ConstructInitialViewL(); + + /** + * Destroys the view Widget + */ + void DestroyListViewWidget(); + + /** + * Send factory instance for the items to be shown in the list + */ + void AddListEntryL(); + +private: // Data + + MGlxMediaList* iItemMediaList;//own + TInt iResourceOffset; + HBufC* iItemURI; + + //Alf environment (not owned) + CAlfEnv* iEnv; + + //Alf display (not owned) + CAlfDisplay* iDisp; + + // Owns the list widget (not owned) + IMulListWidget* iListWidget; + IAlfViewWidget* iViewWidget; + + //Owns DetailsMulModelProvider + CGlxDetailsMulModelProvider* iDetailsMulModelProvider; + + + //Control gorup id + TInt iControlGroupId; + + TBool iIsVideo; + + TBool iIsDrm; + + }; + +#endif // C_GLXMETADATAVIEWIMP_H__ + +// End of File + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/rom/glxmetadataview.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/rom/glxmetadataview.iby Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Metadataview iby file. +* +*/ + + + +#ifndef __GLXMETADATAVIEW_IBY__ +#define __GLXMETADATAVIEW_IBY__ + +file=ABI_DIR\BUILD_DIR\glxunifiedmetadataview.dll SHARED_LIB_DIR\glxunifiedmetadataview.dll +data=DATAZ_\app_resource_dir\glxmetadataview.rsc RESOURCE_FILES_DIR\glxmetadataview.rsc + +#endif // __GLXMETADATAVIEW_IBY__ + +// End of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/src/glxmetadatabindingsetfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/src/glxmetadatabindingsetfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata view +* +*/ + + +#include "glxmetadatabindingsetfactory.h" +#include "glxmuliconprovider.h" +#include "glxdetailsboundcommand.h" +#include "glxuiutility.h" +#include +#include +#include +#include +#include +#include // tag collection plugin uid +#include // album collection plugin uid +#include + +//----------------------------------------------------------------------------- +// TGlxMulTitleDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulTitleDetailsBindingSetFactory::TGlxMulTitleDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulTitleDetailsBindingSetFactory::~TGlxMulTitleDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulTitleDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulTitleDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate6, Alf::mulwidget::KTemplate6); + AddStringBindingL( Alf::mulvisualitem::KMulTitle, R_GLX_METADATA_VIEW_TITLE_NSERIES ); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralTitle ); + + CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *uiUtility ); + AddThumbnailBindingL( Alf::mulvisualitem::KMulIcon1, uiUtility->GetGridIconSize() ); + CleanupStack::PopAndDestroy( uiUtility ); + +// AddThumbnailBindingL( Alf::mulvisualitem::KMulIndicator1 );//qgn_lgal_details_editable_item + AddCommandBindingL(CGlxTitleBoundCommand::NewL()); + } + +//----------------------------------------------------------------------------- +// TGlxMulDateAndTimeDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulDateAndTimeDetailsBindingSetFactory::TGlxMulDateAndTimeDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulDateAndTimeDetailsBindingSetFactory::~TGlxMulDateAndTimeDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulDateAndTimeDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulDateAndTimeDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle,R_GLX_METADATA_VIEW_DATE_TIME_NSERIES ); + AddCommandBindingL(CGlxDateAndTimeBoundCommand::NewL()); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , + KMPXMediaGeneralDate, R_QTN_DATE_USUAL_WITH_ZERO ); + } + +//----------------------------------------------------------------------------- +// TGlxMulDescriptionDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulDescriptionDetailsBindingSetFactory::TGlxMulDescriptionDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulDescriptionDetailsBindingSetFactory::~TGlxMulDescriptionDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulDescriptionDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulDescriptionDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle,R_GLX_METADATA_VIEW_DESCRIPTION_NSERIES ); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralComment ); +// AddThumbnailBindingL( Alf::mulvisualitem::KMulIndicator1 );//qgn_lgal_details_editable_item + AddCommandBindingL(CGlxDescriptionBoundCommand::NewL()); + } + +//----------------------------------------------------------------------------- +// TGlxMulTagsDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulTagsDetailsBindingSetFactory::TGlxMulTagsDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulTagsDetailsBindingSetFactory::~TGlxMulTagsDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulTagsDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulTagsDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle, R_GLX_METADATA_VIEW_TAGS_NSERIES ); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( KGlxTagCollectionPluginImplementationUid ); + AddContainerListBindingL( Alf::mulvisualitem::KMulDetail, *path ); + CleanupStack::PopAndDestroy( path ); + +// AddThumbnailBindingL( Alf::mulvisualitem::KMulIndicator1 );//qgn_lgal_details_editable_item + AddCommandBindingL(CGlxTagsBoundCommand::NewL()); + } + +//----------------------------------------------------------------------------- +// TGlxMulAlbumsDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulAlbumsDetailsBindingSetFactory::TGlxMulAlbumsDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulAlbumsDetailsBindingSetFactory::~TGlxMulAlbumsDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulAlbumsDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulAlbumsDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle, R_GLX_METADATA_VIEW_ALBUMS_NSERIES ); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( KGlxCollectionPluginAlbumsImplementationUid ); + AddContainerListBindingL( Alf::mulvisualitem::KMulDetail, *path ); + CleanupStack::PopAndDestroy( path ); + + //AddThumbnailBindingL( Alf::mulvisualitem::KMulIndicator1 );//qgn_lgal_details_editable_item + AddCommandBindingL(CGlxAlbumsBoundCommand::NewL()); + + } + +//----------------------------------------------------------------------------- +// TGlxMulLocationDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulLocationDetailsBindingSetFactory::TGlxMulLocationDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulLocationDetailsBindingSetFactory::~TGlxMulLocationDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulLocationDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulLocationDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle, R_GLX_METADATA_VIEW_LOCATION_NSERIES ); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KGlxMediaGeneralLocation ) ;//@todo +// AddThumbnailBindingL( Alf::mulvisualitem::KMulIndicator1 );//qgn_lgal_details_editable_item + AddCommandBindingL(CGlxLocationBoundCommand::NewL()); + } + +//----------------------------------------------------------------------------- +// TGlxMulFileSizeDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulFileSizeDetailsBindingSetFactory::TGlxMulFileSizeDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulFileSizeDetailsBindingSetFactory::~TGlxMulFileSizeDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulFileSizeDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulFileSizeDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle,R_GLX_METADATA_VIEW_FILE_SIZE_NSERIES ); + AddCommandBindingL(CGlxFileSizeBoundCommand::NewL()); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralSize ); + } + +//----------------------------------------------------------------------------- +// TGlxMulResolutionDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulResolutionDetailsBindingSetFactory::TGlxMulResolutionDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulResolutionDetailsBindingSetFactory::~TGlxMulResolutionDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulResolutionDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulResolutionDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle, R_GLX_METADATA_VIEW_RESOLUTION_NSERIES ); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KGlxMediaGeneralDimensions ); + AddCommandBindingL(CGlxResolutionBoundCommand::NewL()); + } + +//----------------------------------------------------------------------------- +// TGlxMulDurationDetailsBindingSetFactory +//----------------------------------------------------------------------------- + + /** + * Constructor + */ +EXPORT_C TGlxMulDurationDetailsBindingSetFactory::TGlxMulDurationDetailsBindingSetFactory() + { + } + +/** + * Destructor + */ +EXPORT_C TGlxMulDurationDetailsBindingSetFactory::~TGlxMulDurationDetailsBindingSetFactory() + { + } + + /** + * AddBindingsL + */ +void TGlxMulDurationDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulDurationDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle, R_GLX_METADATA_VIEW_DURATION_NSERIES); + AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaGeneralDuration ); + AddCommandBindingL(CGlxDurationBoundCommand::NewL()); + } + + +//----------------------------------------------------------------------------- +// TGlxMulUsageRightsDetailsBindingSetFactory +//----------------------------------------------------------------------------- + +/** +* Constructor +*/ +EXPORT_C TGlxMulUsageRightsDetailsBindingSetFactory::TGlxMulUsageRightsDetailsBindingSetFactory() + { + } + +/** +* Destructor +*/ +EXPORT_C TGlxMulUsageRightsDetailsBindingSetFactory::~TGlxMulUsageRightsDetailsBindingSetFactory() + { + } + +/** +* AddBindingsL +*/ +void TGlxMulUsageRightsDetailsBindingSetFactory::AddBindingsL() const + { + TRACER("TGlxMulUsageRightsDetailsBindingSetFactory::AddBindingsL"); + + AddTemplateBindingL(Alf::mulwidget::KTemplate5, Alf::mulwidget::KTemplate5); + AddStringBindingL( Alf::mulvisualitem::KMulTitle, R_GLX_METADATA_VIEW_DRM_NSERIES ); + //AddMpxAttributeBindingL( Alf::mulvisualitem::KMulDetail , KMPXMediaNullAttribute );//@todo + AddCommandBindingL(CGlxUsageRightsBoundCommand::NewL()); + } + + + + + + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/src/glxmetadataview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/src/glxmetadataview.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadata view +* +*/ + + +// INCLUDE FILES +#include "glxmetadataview.h" +#include "glxmetadataviewimp.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxMetadataView* CGlxMetadataView::NewL( MGlxMediaListFactory* aMediaListFactory ) + { + return CGlxMetadataViewImp::NewL( aMediaListFactory ); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxMetadataView* CGlxMetadataView::NewLC( MGlxMediaListFactory* aMediaListFactory ) + { + return CGlxMetadataViewImp::NewLC( aMediaListFactory ); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMetadataView::~CGlxMetadataView() + { + // Do nothing + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/metadataview/src/glxmetadataviewimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/metadataview/src/glxmetadataviewimp.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,537 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Metadataview +* +*/ + + +// INCLUDE FILES + +#include "glxmetadataviewimp.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include // for CGlxResourceUtilities +#include // set app state in PCFW key + +#include // for TGlxFilterFactory +#include //Details data provider +#include "glxmetadatabindingsetfactory.h" //for Binding list entries +#include + +#include "glxmetadataview.h" +#include + +#include + +#include + +//CONSTANTS +const TInt KViewId = 0x200071B0; +const TInt KMainMediaListId = 0x2000D248; +const TInt KDetialsDataWindowSize = 5; +_LIT( KGlxStrETrue, "\x0001"); + +// ============================== MEMBER FUNCTIONS =========================== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxMetadataViewImp* CGlxMetadataViewImp::NewL + ( MGlxMediaListFactory* aMediaListFactory ) + { + TRACER("CGlxMetadataViewImp::NewL"); + + CGlxMetadataViewImp* self = CGlxMetadataViewImp::NewLC( aMediaListFactory ); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxMetadataViewImp* CGlxMetadataViewImp::NewLC + ( MGlxMediaListFactory* aMediaListFactory ) + { + TRACER("CGlxMetadataViewImp::NewLC"); + + CGlxMetadataViewImp* self = new (ELeave) CGlxMetadataViewImp(); + CleanupStack::PushL(self); + self->ConstructL( aMediaListFactory ); + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxMetadataViewImp::CGlxMetadataViewImp() + { + //No implementation + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxMetadataViewImp::~CGlxMetadataViewImp() + { + TRACER("CGlxMetadataViewImp::~CGlxMetadataViewImp"); + + + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); + } + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::ConstructL( MGlxMediaListFactory* /*aMediaListFactory*/ ) + { + TRACER("CGlxMetadataViewImp::ConstructL"); + + _LIT(KGlxMetadataViewResource,"glxmetadataview.rsc"); + + //add resource file + TParse parse; + parse.Set(KGlxMetadataViewResource, &KDC_APP_RESOURCE_DIR, NULL); + TFileName resourceFile; + resourceFile.Append(parse.FullName()); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); + + //call base class's consructor + BaseConstructL(R_GLX_METADATA_VIEW); + ViewBaseConstructL(); + + HBufC* title = iEikonEnv->AllocReadResourceLC(R_GLX_METADATA_VIEW_TITLE_DETAILS); + MLViewBaseConstructL(NULL,*title); + CleanupStack::PopAndDestroy(title); + + // ShowMap commandhandler + GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShowMap"); + this->AddCommandHandlerL(CGlxCommandHandlerAiwShowMap:: + NewL(this, R_METADATA_MENU)); + + // Creating the Alf Environment + ConstructAlfEnvL(); + } + +// --------------------------------------------------------------------------- +// DynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::ViewDynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane *aMenuPane) + { + TRACER("CGlxMetadataViewImp::DynInitMenuPaneL"); + + iDetailsMulModelProvider->InitMenuL(*aMenuPane); + } + +// --------------------------------------------------------------------------- +// HandleViewCommandL +// --------------------------------------------------------------------------- +// +TBool CGlxMetadataViewImp::HandleViewCommandL(TInt aCommand) + { + TRACER("CGlxMetadataViewImp::HandleViewCommandL"); + + if( aCommand ) + { + return iDetailsMulModelProvider->OfferCommandL( aCommand ); + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// From CGlxViewBase +// return menuresource id +// --------------------------------------------------------------------------- +// +TInt CGlxMetadataViewImp::MenuResourceId() + { + return R_METADATA_MENU; + } + +// --------------------------------------------------------------------------- +// From CAknView +// Returns views id. +// --------------------------------------------------------------------------- +// +TUid CGlxMetadataViewImp::Id() const + { + return TUid::Uid(KViewId); + } + +// --------------------------------------------------------------------------- +// From CAknView +// Handles a view activation. +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::DoMLViewActivateL( const TVwsViewId& /* aPrevViewId */, + TUid /* aCustomMessageId */, const TDesC8& aCustomMessage ) + { + TRACER("CGlxMetadataViewImp::DoMLViewActivateL"); + CreateMediaListL( aCustomMessage ); + + StatusPane()->MakeVisible(ETrue); + + // Construct the application's default view i.e., listview widget + ConstructInitialViewL(); + GlxSetAppState::SetState( EGlxInListView ); + } + +// --------------------------------------------------------------------------- +// From CAknView +// View deactivation function. +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::DoMLViewDeactivate() + { + TRACER("CGlxMetadataViewImp::DoMLViewDeactivate"); + + + + DestroyListViewWidget(); + if( iItemMediaList ) + { + iItemMediaList->Close(); + iItemMediaList = NULL; + } + if( iItemURI ) + { + delete iItemURI; + iItemURI = NULL; + } + } + +// --------------------------------------------------------------------------- +// ConstructAlfEnvL +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::ConstructAlfEnvL() + { + TRACER("CGlxMetadataViewImp::ConstructAlfEnvL"); + + + // Creating the Alf Environment + // Should be the first thing to be done before widgets can be created + iEnv = iUiUtility->Env(); + + // Creating the Alf display + // display is need to show anything related to Alf + // Avkon perceives the Alf display as one CoeControl, + // it can't see widgets inside the display + iDisp = iUiUtility->Display(); + + // Use the Avkon skin background as the display background. + iDisp->SetClearBackgroundL (CAlfDisplay::EClearWithSkinBackground); + } + +// --------------------------------------------------------------------------- +// ConstructInitialViewL +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::ConstructInitialViewL() + { + TRACER("CGlxMetadataViewImp::ConstructInitialViewL"); + + const char* KLoadName("mullistwidget"); + const char* KWidgetLoadName("ListWidget"); + + iControlGroupId = reinterpret_cast < TInt > (this); + + try + { + // Get widget factory from CAlfEnv + // Factory is then used to create the individual widgets & data model + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); + + + iViewWidget = widgetFactory.createViewWidget("detaillistviewwidget", iControlGroupId); + + //Enable status pane + iViewWidget->enableStatusPane(true); + iViewWidget->setRect( ClientRect() ); + iViewWidget->show(true); + + // Create List widget. CAlfEnv owns widget + iListWidget = widgetFactory.createWidget( KLoadName, + KWidgetLoadName, *iViewWidget, NULL); + + // Disable marking for list, need to remove this flag when widget + // construction has no marking flag set by default + iListWidget->ClearFlags( IMulMultiItemWidget::EMulWidgetMarkingMode ); + + //Sets the default text for the List View when empty + CreateEmptyText(); + + if ( iListWidget ) + { + // Widget takes the ownership + iListWidget->AddEventHandler (*this); + iListWidget->ShowWidget(true); + iListWidget->control()->AcquireFocus(); + } + + AddListEntryL(); + + } + catch(...) + { + User::Leave(KErrGeneral); + } + } + +// --------------------------------------------------------------------------- +// Destroys the Widget +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::DestroyListViewWidget() + { + if( iDetailsMulModelProvider ) + { + delete iDetailsMulModelProvider; + iDetailsMulModelProvider = NULL; + } + if( iListWidget ) + { + iListWidget->RemoveEventHandler (*this); + iListWidget->ShowWidget(false); + iViewWidget->show(false); + } + + IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); + widgetFactory.destroyWidget(iViewWidget); + + iListWidget = NULL; + iViewWidget = NULL; + } + +// --------------------------------------------------------------------------- +// From AddListEntryL +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::AddListEntryL() + { + TRACER("CGlxMetadataViewImp::AddListEntryL"); + + iDetailsMulModelProvider = CGlxDetailsMulModelProvider::NewL( *iEnv, + *iListWidget, + *iItemMediaList, + mulwidget::KTemplate5, KDetialsDataWindowSize ); + + iDetailsMulModelProvider->AddEntryL(TGlxMulTitleDetailsBindingSetFactory() ); + iDetailsMulModelProvider->AddEntryL(TGlxMulDateAndTimeDetailsBindingSetFactory() ); + iDetailsMulModelProvider->AddEntryL(TGlxMulDescriptionDetailsBindingSetFactory() ); + iDetailsMulModelProvider->AddEntryL(TGlxMulTagsDetailsBindingSetFactory() ); + iDetailsMulModelProvider->AddEntryL(TGlxMulAlbumsDetailsBindingSetFactory() ); + iDetailsMulModelProvider->AddEntryL(TGlxMulLocationDetailsBindingSetFactory() ); + iDetailsMulModelProvider->AddEntryL(TGlxMulFileSizeDetailsBindingSetFactory() ); + iDetailsMulModelProvider->AddEntryL(TGlxMulResolutionDetailsBindingSetFactory() ); + if( iIsVideo) + { + iDetailsMulModelProvider->AddEntryL(TGlxMulDurationDetailsBindingSetFactory() ); + } + if( iIsDrm ) + { + iDetailsMulModelProvider->AddEntryL(TGlxMulUsageRightsDetailsBindingSetFactory() ); + } + } + +// --------------------------------------------------------- +// CreateEmptyText +// --------------------------------------------------------- +// +void CGlxMetadataViewImp::CreateEmptyText() + { + TRACER("CGlxMetadataViewImp::CreateEmptyText"); + + // The listwidget can set an empty text on the display + // If there are no data items in the associated data model, + // then the empty text is shown on the widget + // If the empty text is not set, then widget won't shown any text by default + UString* defaultText = new UString("No Items Present"); + iListWidget->SetEmptyText (*defaultText); // Widget takes the ownership + delete defaultText; + } + +// --------------------------------------------------------------------------- +// CreateMediaListL +// --------------------------------------------------------------------------- +// +void CGlxMetadataViewImp::CreateMediaListL( const TDesC8& aURI ) + { + TRACER("CGlxMetadataViewImp::CreateMediaListL"); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + + path->AppendL(KGlxCollectionPluginAllImplementationUid); + + //convert uri from 8 bit to unicode + iItemURI = HBufC::NewL( aURI.Length() ); + iItemURI->Des().Copy( aURI ); + + //Get last two characters for checking drm or video and reset the length for uri + TPtr uriPtr (iItemURI->Des()); + + TPtr isVideo = uriPtr.MidTPtr(uriPtr.Length()-1,1); + if( !isVideo.Compare(KGlxStrETrue )) + { + iIsVideo = ETrue; + } + + TPtr isDrm = uriPtr.MidTPtr(uriPtr.Length()-2,1); + if( !isDrm.Compare(KGlxStrETrue)) + { + iIsDrm = ETrue; + } + + uriPtr.SetLength(uriPtr.Length()-2); + + CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL( *iItemURI ); + CleanupStack::PushL( filter ); + + //@TODO remove magic no - allocate uid from uid list + iItemMediaList = MGlxMediaList::InstanceL(*path, TGlxHierarchyId(KMainMediaListId), filter); + + CleanupStack::PopAndDestroy( filter ); + CleanupStack::PopAndDestroy( path ); + } + +// --------------------------------------------------------------------------- +// MediaList. +// --------------------------------------------------------------------------- +// +MGlxMediaList& CGlxMetadataViewImp::MediaList() + { + return *iItemMediaList; + } + +// --------------------------------------------------------- +// offerEvent +// --------------------------------------------------------- +// +AlfEventStatus CGlxMetadataViewImp::offerEvent( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ) + { + + //Check if its a Custom Event else return + if(!aEvent.IsCustomEvent()) + { + GLX_LOG_INFO("Event Not Handled"); + return EEventNotHandled; + } + TInt eventId = aEvent.CustomParameter(); + switch(eventId) + { + case KAlfActionIdDeviceLayoutChanged: + { + iViewWidget->setRect( ClientRect() ); + return EEventNotHandled; + } + case ETypeSelect: + { + TRAP_IGNORE(HandleViewCommandL((TInt)KGlxEditBoundMenuCommandId)); + } + } + + return EEventConsumed; + } + +//---------------------------------------------------------------------------------- +// eventHandlerType +//---------------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType CGlxMetadataViewImp::eventHandlerType() + { + return IAlfWidgetEventHandler::EPresentationEventHandler; + } + +//---------------------------------------------------------------------------------- +// eventExecutionPhase +//---------------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase CGlxMetadataViewImp::eventExecutionPhase() + { + return EBubblingPhaseEventHandler; + } +// --------------------------------------------------------- +// accept +// --------------------------------------------------------- +// + +bool CGlxMetadataViewImp::accept( CAlfWidgetControl& /*aControl*/, const TAlfEvent& /*aEvent*/ ) const + { + return ETrue; + } + +// --------------------------------------------------------- +// setActiveStates +// --------------------------------------------------------- +// + + void CGlxMetadataViewImp::setActiveStates( unsigned int /*aStates*/ ) + { + + } + +// --------------------------------------------------------- +// makeInterface +// --------------------------------------------------------- +// + +IAlfInterfaceBase* CGlxMetadataViewImp::makeInterface( const IfId& /*aType*/ ) + { + return NULL; + } + +// --------------------------------------------------------- +// setEventHandlerData +// --------------------------------------------------------- +// + +void CGlxMetadataViewImp::setEventHandlerData(const AlfWidgetEventHandlerInitData& /*aData*/ ) + { + + } + +// --------------------------------------------------------- +// eventHandlerData +// --------------------------------------------------------- +// + +AlfWidgetEventHandlerInitData* CGlxMetadataViewImp::eventHandlerData() + { + return NULL; + } + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/bwins/glxviewbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/bwins/glxviewbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +EXPORTS + ?DoActivateL@CGlxViewBase@@EAEXABVTVwsViewId@@VTUid@@ABVTDesC8@@@Z @ 1 NONAME ; void CGlxViewBase::DoActivateL(class TVwsViewId const &, class TUid, class TDesC8 const &) + ?HandleViewCommandL@CGlxViewBase@@MAEHH@Z @ 2 NONAME ; int CGlxViewBase::HandleViewCommandL(int) + ?CurrentListL@MGlxMediaListFactory@@IBEAAVMGlxMediaList@@AAVMMPXCollectionUtility@@@Z @ 3 NONAME ; class MGlxMediaList & MGlxMediaListFactory::CurrentListL(class MMPXCollectionUtility &) const + ??1CGlxMediaListViewBase@@UAE@XZ @ 4 NONAME ; CGlxMediaListViewBase::~CGlxMediaListViewBase(void) + ?AnimationComplete@CGlxViewBase@@MAEXPAVMGlxAnimation@@@Z @ 5 NONAME ; void CGlxViewBase::AnimationComplete(class MGlxAnimation *) + ?CreateMediaListL@MGlxMediaListFactory@@UBEAAVMGlxMediaList@@AAVMMPXCollectionUtility@@@Z @ 6 NONAME ; class MGlxMediaList & MGlxMediaListFactory::CreateMediaListL(class MMPXCollectionUtility &) const + ?MediaList@CGlxMediaListViewBase@@UAEAAVMGlxMediaList@@XZ @ 7 NONAME ; class MGlxMediaList & CGlxMediaListViewBase::MediaList(void) + ??0CGlxViewBase@@QAE@H@Z @ 8 NONAME ; CGlxViewBase::CGlxViewBase(int) + ?DoHandleCommandL@CGlxMediaListViewBase@@MAEHH@Z @ 9 NONAME ; int CGlxMediaListViewBase::DoHandleCommandL(int) + ?HandleTitleAvailableL@CGlxMediaListViewBase@@UAEXABVTDesC16@@@Z @ 10 NONAME ; void CGlxMediaListViewBase::HandleTitleAvailableL(class TDesC16 const &) + ?DynInitMenuPaneL@CGlxViewBase@@EAEXHPAVCEikMenuPane@@@Z @ 11 NONAME ; void CGlxViewBase::DynInitMenuPaneL(int, class CEikMenuPane *) + ?MLViewBaseConstructL@CGlxMediaListViewBase@@IAEXPAVMGlxMediaListFactory@@ABVTDesC16@@H@Z @ 12 NONAME ; void CGlxMediaListViewBase::MLViewBaseConstructL(class MGlxMediaListFactory *, class TDesC16 const &, int) + ?DoViewActivateL@CGlxMediaListViewBase@@EAEXABVTVwsViewId@@VTUid@@ABVTDesC8@@@Z @ 13 NONAME ; void CGlxMediaListViewBase::DoViewActivateL(class TVwsViewId const &, class TUid, class TDesC8 const &) + ?SetToolbarObserver@CGlxViewBase@@IAEXPAVMAknToolbarObserver@@@Z @ 14 NONAME ; void CGlxViewBase::SetToolbarObserver(class MAknToolbarObserver *) + ?ViewDynInitMenuPaneL@CGlxViewBase@@MAEXHPAVCEikMenuPane@@@Z @ 15 NONAME ; void CGlxViewBase::ViewDynInitMenuPaneL(int, class CEikMenuPane *) + ?FetchAttributesL@CGlxMediaListViewBase@@EAEXXZ @ 16 NONAME ; void CGlxMediaListViewBase::FetchAttributesL(void) + ?ViewActivatedL@CGlxViewBase@@MAEXABVTVwsViewId@@VTUid@@ABVTDesC8@@@Z @ 17 NONAME ; void CGlxViewBase::ViewActivatedL(class TVwsViewId const &, class TUid, class TDesC8 const &) + ?DoViewDeactivate@CGlxMediaListViewBase@@EAEXXZ @ 18 NONAME ; void CGlxMediaListViewBase::DoViewDeactivate(void) + ?AddCommandHandlerL@CGlxViewBase@@QAEXPAVCGlxCommandHandler@@@Z @ 19 NONAME ; void CGlxViewBase::AddCommandHandlerL(class CGlxCommandHandler *) + ?DoDeactivate@CGlxViewBase@@EAEXXZ @ 20 NONAME ; void CGlxViewBase::DoDeactivate(void) + ?SetToolbarStateL@CGlxMediaListViewBase@@EAEXXZ @ 21 NONAME ; void CGlxMediaListViewBase::SetToolbarStateL(void) + ?ViewBaseConstructL@CGlxViewBase@@IAEXXZ @ 22 NONAME ; void CGlxViewBase::ViewBaseConstructL(void) + ?DoHandleCommandL@CGlxViewBase@@UAEHH@Z @ 23 NONAME ; int CGlxViewBase::DoHandleCommandL(int) + ?HandleViewCommandL@CGlxMediaListViewBase@@MAEHH@Z @ 24 NONAME ; int CGlxMediaListViewBase::HandleViewCommandL(int) + ?ViewAnimationSupported@CGlxViewBase@@MAEHW4TGlxViewswitchAnimation@@@Z @ 25 NONAME ; int CGlxViewBase::ViewAnimationSupported(enum TGlxViewswitchAnimation) + ?DoViewAnimationL@CGlxViewBase@@MAEXW4TGlxViewswitchAnimation@@W4TGlxNavigationDirection@@@Z @ 26 NONAME ; void CGlxViewBase::DoViewAnimationL(enum TGlxViewswitchAnimation, enum TGlxNavigationDirection) + ??1CGlxViewBase@@UAE@XZ @ 27 NONAME ; CGlxViewBase::~CGlxViewBase(void) + ?SetTitleL@CGlxViewBase@@QAEXABVTDesC16@@@Z @ 28 NONAME ; void CGlxViewBase::SetTitleL(class TDesC16 const &) + ??0CGlxMediaListViewBase@@QAE@XZ @ 29 NONAME ; CGlxMediaListViewBase::CGlxMediaListViewBase(void) + ?DisableTitle@CGlxViewBase@@QAEXXZ @ 30 NONAME ; void CGlxViewBase::DisableTitle(void) + ?HandleCommandL@CGlxViewBase@@EAEXH@Z @ 31 NONAME ; void CGlxViewBase::HandleCommandL(int) + ?FetchAttributesForCommandL@CGlxViewBase@@MAEXH@Z @ 32 NONAME ; void CGlxViewBase::FetchAttributesForCommandL(int) + ??1CGlxTitleFetcher@@UAE@XZ @ 33 NONAME ; CGlxTitleFetcher::~CGlxTitleFetcher(void) + ?OfferToolbarEventL@CGlxViewBase@@MAEXH@Z @ 34 NONAME ; void CGlxViewBase::OfferToolbarEventL(int) + ?ViewDeactivated@CGlxViewBase@@MAEXXZ @ 35 NONAME ; void CGlxViewBase::ViewDeactivated(void) + ?FetchAttributesL@CGlxViewBase@@MAEXXZ @ 36 NONAME ; void CGlxViewBase::FetchAttributesL(void) + ?DoPrepareCommandHandlerL@CGlxMediaListViewBase@@MAEXPAVCGlxCommandHandler@@@Z @ 37 NONAME ; void CGlxMediaListViewBase::DoPrepareCommandHandlerL(class CGlxCommandHandler *) + ?FetchAttributesForCommandL@CGlxMediaListViewBase@@EAEXH@Z @ 38 NONAME ; void CGlxMediaListViewBase::FetchAttributesForCommandL(int) + ?SetToolbarStateL@CGlxViewBase@@MAEXXZ @ 39 NONAME ; void CGlxViewBase::SetToolbarStateL(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/data/glxviewbase.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/data/glxviewbase.rss Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2008-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: Resource definitions +* +*/ + + + + +#include +#include +#include +#include +#include + +#include + +#include +#include + +NAME GLVB // 4 letter ID + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="GLVB"; } + +// ----------------------------------------------------------------------------- +// +// r_glx_query_viewbase_ok_cancel +// Confirmation query. +// +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_glx_query_viewbase_ok_cancel + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EAknCtQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + + +RESOURCE DIALOG r_glx_viewbase_progress_dialog + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EAknCtNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + }; + } + }; + } + + +// +// Days for details pane +// + + + +RESOURCE TBUF r_qtn_lgal_metapane_weekday_monday + { + buf = qtn_lgal_metapane_weekday_monday; + } + +RESOURCE TBUF r_qtn_lgal_metapane_weekday_tuesday + { + buf = qtn_lgal_metapane_weekday_tuesday; + } + +RESOURCE TBUF r_qtn_lgal_metapane_weekday_wednesday + { + buf = qtn_lgal_metapane_weekday_wednesday; + } + +RESOURCE TBUF r_qtn_lgal_metapane_weekday_thursday + { + buf = qtn_lgal_metapane_weekday_thursday; + } + +RESOURCE TBUF r_qtn_lgal_metapane_weekday_friday + { + buf = qtn_lgal_metapane_weekday_friday; + } + +RESOURCE TBUF r_qtn_lgal_metapane_weekday_saturday + { + buf = qtn_lgal_metapane_weekday_saturday; + } + +RESOURCE TBUF r_qtn_lgal_metapane_weekday_sunday + { + buf = qtn_lgal_metapane_weekday_sunday; + } + +// +// Months for details pane +// +RESOURCE TBUF r_qtn_lgal_metapane_month_january + { + buf = qtn_month_three_chars_jan; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_february + { + buf = qtn_month_three_chars_feb; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_march + { + buf = qtn_month_three_chars_mar; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_april + { + buf = qtn_month_three_chars_apr; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_may + { + buf = qtn_month_three_chars_may; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_june + { + buf = qtn_month_three_chars_jun; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_july + { + buf = qtn_month_three_chars_jul; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_august + { + buf = qtn_month_three_chars_aug; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_september + { + buf = qtn_month_three_chars_sep; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_october + { + buf = qtn_month_three_chars_oct; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_november + { + buf = qtn_month_three_chars_nov; + } + +RESOURCE TBUF r_qtn_lgal_metapane_month_december + { + buf = qtn_month_three_chars_dec; + } + +RESOURCE TBUF r_glx_msk_open + { + buf = qtn_msk_open; + } + +RESOURCE TBUF r_glx_msk_edit + { + buf = qtn_msk_edit; + } + +RESOURCE TBUF r_glx_msk_play + { + buf = qtn_msk_play; + } + +RESOURCE TBUF r_glx_msk_add + { + buf = qtn_msk_add; + } + +RESOURCE TBUF r_glx_msk_blank + { + buf = " "; + } + +#ifdef GLX_TILE_VIEW_SHOW_DURATION_AND_WEEK_DAY +RESOURCE TBUF r_qtn_lgal_metapane_length_min + { + buf = qtn_lgal_metapane_length_min; + } + +RESOURCE TBUF r_qtn_lgal_metapane_length_hrs + { + buf = qtn_lgal_metapane_length_hrs; + } +#endif + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/eabi/glxviewbaseu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/eabi/glxviewbaseu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,59 @@ +EXPORTS + _ZN12CGlxViewBase11DoActivateLERK10TVwsViewId4TUidRK6TDesC8 @ 1 NONAME + _ZN12CGlxViewBase12DisableTitleEv @ 2 NONAME + _ZN12CGlxViewBase12DoDeactivateEv @ 3 NONAME + _ZN12CGlxViewBase14HandleCommandLEi @ 4 NONAME + _ZN12CGlxViewBase14ViewActivatedLERK10TVwsViewId4TUidRK6TDesC8 @ 5 NONAME + _ZN12CGlxViewBase15ViewDeactivatedEv @ 6 NONAME + _ZN12CGlxViewBase16DoHandleCommandLEi @ 7 NONAME + _ZN12CGlxViewBase16DoViewAnimationLE23TGlxViewswitchAnimation23TGlxNavigationDirection @ 8 NONAME + _ZN12CGlxViewBase16DynInitMenuPaneLEiP12CEikMenuPane @ 9 NONAME + _ZN12CGlxViewBase16FetchAttributesLEv @ 10 NONAME + _ZN12CGlxViewBase16SetToolbarStateLEv @ 11 NONAME + _ZN12CGlxViewBase17AnimationCompleteEP13MGlxAnimation @ 12 NONAME + _ZN12CGlxViewBase18AddCommandHandlerLEP18CGlxCommandHandler @ 13 NONAME + _ZN12CGlxViewBase18HandleViewCommandLEi @ 14 NONAME + _ZN12CGlxViewBase18OfferToolbarEventLEi @ 15 NONAME + _ZN12CGlxViewBase18SetToolbarObserverEP19MAknToolbarObserver @ 16 NONAME + _ZN12CGlxViewBase18ViewBaseConstructLEv @ 17 NONAME + _ZN12CGlxViewBase20ViewDynInitMenuPaneLEiP12CEikMenuPane @ 18 NONAME + _ZN12CGlxViewBase22ViewAnimationSupportedE23TGlxViewswitchAnimation @ 19 NONAME + _ZN12CGlxViewBase26FetchAttributesForCommandLEi @ 20 NONAME + _ZN12CGlxViewBase9SetTitleLERK7TDesC16 @ 21 NONAME + _ZN12CGlxViewBaseC2Ei @ 22 NONAME + _ZN12CGlxViewBaseD0Ev @ 23 NONAME + _ZN12CGlxViewBaseD1Ev @ 24 NONAME + _ZN12CGlxViewBaseD2Ev @ 25 NONAME + _ZN21CGlxMediaListViewBase15DoViewActivateLERK10TVwsViewId4TUidRK6TDesC8 @ 26 NONAME + _ZN21CGlxMediaListViewBase16DoHandleCommandLEi @ 27 NONAME + _ZN21CGlxMediaListViewBase16DoViewDeactivateEv @ 28 NONAME + _ZN21CGlxMediaListViewBase16FetchAttributesLEv @ 29 NONAME + _ZN21CGlxMediaListViewBase16SetToolbarStateLEv @ 30 NONAME + _ZN21CGlxMediaListViewBase18HandleViewCommandLEi @ 31 NONAME + _ZN21CGlxMediaListViewBase20MLViewBaseConstructLEP20MGlxMediaListFactoryRK7TDesC16i @ 32 NONAME + _ZN21CGlxMediaListViewBase21HandleTitleAvailableLERK7TDesC16 @ 33 NONAME + _ZN21CGlxMediaListViewBase24DoPrepareCommandHandlerLEP18CGlxCommandHandler @ 34 NONAME + _ZN21CGlxMediaListViewBase26FetchAttributesForCommandLEi @ 35 NONAME + _ZN21CGlxMediaListViewBase9MediaListEv @ 36 NONAME + _ZN21CGlxMediaListViewBaseC2Ev @ 37 NONAME + _ZN21CGlxMediaListViewBaseD0Ev @ 38 NONAME + _ZN21CGlxMediaListViewBaseD1Ev @ 39 NONAME + _ZN21CGlxMediaListViewBaseD2Ev @ 40 NONAME + _ZNK20MGlxMediaListFactory12CurrentListLER21MMPXCollectionUtility @ 41 NONAME + _ZNK20MGlxMediaListFactory16CreateMediaListLER21MMPXCollectionUtility @ 42 NONAME + _ZTI12CGlxViewBase @ 43 NONAME ; ## + _ZTI16CGlxTitleFetcher @ 44 NONAME ; ## + _ZTI20MGlxMediaListFactory @ 45 NONAME ; ## + _ZTI21CGlxMediaListViewBase @ 46 NONAME ; ## + _ZTV12CGlxViewBase @ 47 NONAME ; ## + _ZTV16CGlxTitleFetcher @ 48 NONAME ; ## + _ZTV20MGlxMediaListFactory @ 49 NONAME ; ## + _ZTV21CGlxMediaListViewBase @ 50 NONAME ; ## + _ZThn12_N12CGlxViewBase16DynInitMenuPaneLEiP12CEikMenuPane @ 51 NONAME ; ## + _ZThn164_N21CGlxMediaListViewBase9MediaListEv @ 52 NONAME ; ## + _ZThn168_N21CGlxMediaListViewBase21HandleTitleAvailableLERK7TDesC16 @ 53 NONAME ; ## + _ZThn4_N12CGlxViewBase14ViewActivatedLERK10TVwsViewId4TUidRK6TDesC8 @ 54 NONAME ; ## + _ZThn4_N12CGlxViewBase15ViewDeactivatedEv @ 55 NONAME ; ## + _ZThn80_N12CGlxViewBase17AnimationCompleteEP13MGlxAnimation @ 56 NONAME ; ## + _ZThn84_N12CGlxViewBase18OfferToolbarEventLEi @ 57 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008-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: Build information file for project glxviewbase.dll + * +*/ + + + + +PRJ_EXPORTS + +PRJ_MMPFILES + +glxviewbase.mmp + +PRJ_TESTMMPFILES + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/group/glxviewbase.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/group/glxviewbase.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + + +TARGET glxviewbase.dll +TARGETTYPE dll +UID 0x1000008d 0x2000719B + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + + +SOURCEPATH ../src +//SOURCE glxkeymonitor.cpp +SOURCE glxmedialistfactory.cpp +SOURCE glxmedialistviewbase.cpp +SOURCE glxviewbase.cpp +SOURCE glxtitlefetcher.cpp +SOURCE glxtoolbarcontroller.cpp +SOURCE glxmskcontroller.cpp + +SOURCEPATH ../data + +START RESOURCE glxviewbase.rss +HEADER +TARGETPATH /resource/apps +LANGUAGE_IDS + +END // RESOURCE + +APP_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SYSTEMINCLUDE ../../../../gallery/loc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../../commandhandlers/inc +SYSTEMINCLUDE ../../../commandhandlers/commandhandlerbase/inc +SYSTEMINCLUDE ../../../../common/inc // for CGlxResourceUtilities +SYSTEMINCLUDE ../../../../commonui/inc //added as per single clk chngs + +LIBRARY aknicon.lib +LIBRARY aknlayout2.lib +LIBRARY aknlayout2scalable.lib +LIBRARY aknskins.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY cdlengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY estor.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxvisuallistmanager.lib +LIBRARY hlplch.lib +LIBRARY glxcommon.lib // for CResourceUtilities +LIBRARY flogger.lib +LIBRARY alfclient.lib // Alf framework + +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxviewutility.lib +LIBRARY ws32.lib +LIBRARY commonengine.lib + +// Uiaccelerator related libraries +LIBRARY osncore.lib +LIBRARY alfwidgetmodel.lib +// MUL related libraries +LIBRARY mulmodelutility.lib //For Visual Item and Filter action item +//for handling the Ustring memory leak +LIBRARY libc.lib +LIBRARY libglib.lib +LIBRARY glxcommandhandlerbase.lib +LIBRARY glxcommonui.lib //added as per single clk chngs +// End of File + +SOURCEPATH ../src \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/group/ut_cglxmedialistcommandhandler.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/group/ut_cglxmedialistcommandhandler.pkg Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2004 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: package file for medialist commandhandler test +; + +; Supported languages +&en + +; Package header (one name for each supported language) +#{"ut_cglxmedialistcommandhandler"},(0x01700000),0,10,0 + +; Package signature + + +; Options line not supported currently + +; Conditions blocks not supported currently + +; Language independent files that are always installed +"ut_cglxmedialistcommandhandler.dll"-"!:\DigiaEUnit\Tests\ut_cglxmedialistcommandhandler.dll" + +; Language dependent files + + +; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) +(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/glxkeyeventreceiver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/glxkeyeventreceiver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008-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: Key event receiver interface +* +*/ + + + + +#ifndef M_GLXKEYEVENTRECEIVER_H +#define M_GLXKEYEVENTRECEIVER_H + +/** + * MGlxKeyEventReceiver + * + * Key event receiver. + * + * @lib glxviewbase.lib + */ +class MGlxKeyEventReceiver + { +public: + /** + * Interface to recieve keypress information from an associated CGlxKeyMonitor. + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown + * @return Indicates whether or not the key event was used by this control. EKeyWasNotConsumed or EKeyWasConsumed + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType) = 0; + }; + +#endif // M_GLXKEYEVENTRECEIVER_H \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/glxmedialistfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/glxmedialistfactory.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008-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: Media List provider interface +* +*/ + + + + +#ifndef M_GLXSMediaListFactory_H +#define M_GLXSMediaListFactory_H + +class MGlxMediaList; +class MMPXCollectionUtility; + +/** + * Provider of a media list + */ +class MGlxMediaListFactory + { +public: + /** + * Creates and returns a Media List. Ownership of Media List is transfered. + * @param aCollectionUtility The collection utility to use when creating the media list + * @return The Media List (ownership transfered to caller) + */ + IMPORT_C virtual MGlxMediaList& CreateMediaListL(MMPXCollectionUtility& aCollectionUtility) const; + +protected: + /** + * Creates media list based on collection path + * @param aCollectionUtility The collection utility to use when creating the media list + * @return The Media List (ownership transfered to caller) + */ + IMPORT_C MGlxMediaList& CurrentListL(MMPXCollectionUtility& aCollectionUtility) const; + }; + + + +#endif // M_GLXSMediaListFactory_H + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/glxmedialistviewbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/glxmedialistviewbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2008-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: Media List View Base +* +*/ + + + + +#ifndef C_GLXMEDIALISTVIEW_H +#define C_GLXMEDIALISTVIEW_H + +#include "glxtoolbarcontroller.h" +#include "glxmskcontroller.h" +#include "glxviewbase.h" +#include "mglxmedialistprovider.h" +#include "mglxtitlefetcherobserver.h" +#include + +class MGlxMediaListFactory; +class MMPXCollectionUtility; +class CGlxTitleFetcher; +class CGlxAttributeContext; + +/** + * Struct to hold resource ids + * + */ +struct TViewWidgetIds + { + //Instance Id for the View Widget + const char* iViewWidgetId; + //Instance Id for the Widget + const char* iWidgetId; + // Control Group Id for View Widget + TInt iControlGroup; + }; + +/** + * Media Liost View Base + */ +class CGlxMediaListViewBase : public CGlxViewBase, + public MGlxMediaListProvider, + public MGlxTitleFetcherObserver + + { +public: + /** + * Constructor + */ + IMPORT_C CGlxMediaListViewBase(); + + /** + * Destructor + */ + IMPORT_C virtual ~CGlxMediaListViewBase(); + +public: // From MGlxMediaListProvider + IMPORT_C virtual MGlxMediaList& MediaList(); + + + // From MGlxTitleFetcherObserver + IMPORT_C void HandleTitleAvailableL(const TDesC& aTitle); + + + +protected: + /** + * This will be called on derived classes when the view is activated + * @param aPrevViewId Specifies the view previously active. + * @param aCustomMessageId Specifies the message type. + * @param aCustomMessage The activation message. + */ + virtual void DoMLViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) = 0; + + /** + * This will be called on derived classes when the view is deactivated + */ + virtual void DoMLViewDeactivate() = 0; + + /** + * Derived classes should use this to deal with any view-specific commands + * @param aCommand The command to respond to + * @return ETrue iff the command has been handled. + */ + IMPORT_C virtual TBool HandleViewCommandL(TInt aCommand); + + /** + * Handles commands + * @param aCommand The command to respond to + * @return ETrue iff the command has been handled. + */ + + IMPORT_C virtual TInt DoHandleCommandL(TInt aCommand); + +protected: + /** + * Media List View Base Constructor + * @param aMediaListFactory A media list provider. + * @param aTitle If specified, title to be displayed instead of that from media list + * @param aCustomMessage The activation message. + * @param aEnableMiddleSoftkey MSK Enabler + */ + IMPORT_C void MLViewBaseConstructL( + MGlxMediaListFactory* aMediaListFactory, + const TDesC& aTitle = KNullDesC(),TBool aEnableMiddleSoftkey = ETrue ); + +private: // From CGlxViewBase + IMPORT_C virtual void DoViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); + IMPORT_C virtual void DoViewDeactivate(); + + /** + * See @ref CGlxViewBase::FetchAttributesL() + */ + IMPORT_C virtual void FetchAttributesL(); + + /** + * See @ref CGlxViewBase::FetchAttributesForCommandL() + */ + IMPORT_C virtual void FetchAttributesForCommandL(TInt aCommand); + + /** + * See @ref CGlxViewBase::SetToolbarStateL() + */ + IMPORT_C void SetToolbarStateL(); + +protected: // from CGlxViewBase + /** + * See @ref CGlxViewBase::DoPrepareCommandHandlerL + */ + IMPORT_C void DoPrepareCommandHandlerL(CGlxCommandHandler* aCommandHandler); + + +private: + /** + * Removes the attribute context (iPreloadContextForCommandHandlers) + * from the media list and closes the media list. + */ + void CloseMediaList(); + + /** + * Helper method to add attributes to an attribute context. + * @param aAttributeContext context to add attributes to. + * @param aCommandHandler command handler to request attributes from. + * @param aFilterUsingSelection If ETrue, only attributes relevant + * to the current selection will be appended. + * @param aFilterUsingCommandId If ETrue, only attributes relevant + * to the command id specified by aCommandId will be appended + * @param aCommandId if aFilterUsingCommandId is ETrue, only + * attributes relevant to aCommandId will be appened. + */ + void AddAttributesToContextL(CGlxAttributeContext& aAttributeContext, + CGlxCommandHandler* aCommandHandler, + TBool aFilterUsingSelection, + TBool aFilterUsingCommandId, + TInt aCommandId = 0); + + /** + * Helper method to fetch attributes + * @param aFilterUsingCommandId If ETrue, only attributes relevant + * to the command id specified by aCommandId will be appended + * @param aCommandId if aFilterUsingCommandId is ETrue, only + * attributes relevant to aCommandId will be appened. + */ + void FetchAttributesL(TBool aFilterUsingCommandId, TInt aCommandId = 0); + +protected: + MGlxMediaList* iMediaList; + MMPXCollectionUtility* iCollectionUtility; + HBufC* iFixedTitle; + +private: + MGlxMediaListFactory* iMediaListFactory; + CGlxTitleFetcher* iTitleFetcher; + + /** + * Controlls the ui states of toolbar for all the views + * (Owned) + */ + CGlxToolbarController* iToolbarControl; + + /** + * Controlls the Msk for all the views + * (Owned) + */ + CGlxMSKController* iCbaControl; + + /** + * Attribute context used to preload attributes + * required by command handlers. + * (Owned) + */ + CGlxAttributeContext* iPreloadContextForCommandHandlers; + + /** + * Selection iterator used by iPreloadContextForCommandHandlers above. + */ + TGlxSelectionIterator iSelectionIterator; + + /** + * MSK Enabler used by FullScreen to disable the MSK + */ + TBool iEnableMidddleSoftkey; + }; + + +#endif // C_GLXMEDIALISTVIEW_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/glxmskcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/glxmskcontroller.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2008-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: Media item list observer interface + * +*/ + + + +#ifndef GLXMSKCONTROLLER_H_ +#define GLXMSKCONTROLLER_H_ + + +#include +#include +#include "glxviewbase.h" + +class CGlxUiUtility; + +NONSHARABLE_CLASS( CGlxMSKController ): public CBase, public MGlxMediaListObserver + { +public: + /* + * function NewL + */ + static CGlxMSKController* NewL (); + + /* + * Adds object of CGlxMSKController to observe medialist + * @param aList Reference of MGlxMediaList + */ + void AddToObserverL(MGlxMediaList& aList, CEikButtonGroupContainer* aCba); + + /* + * Removes object of CGlxMSKController from medialist observer + * @param aList Reference of MGlxMediaList + */ + void RemoveFromObserver (MGlxMediaList& aList); + + /** + * Sets MSK status.This is called after adding CGlxMSKController + * to medialist observer, if there is no HandleAttributeAvailable callback. + * @param aList Pointer to MGlxMediaList + */ + void SetStatusOnViewActivationL( MGlxMediaList* aList ); + + /* + * Sets the MSK status for the Main List view. + */ + void SetMainStatusL(); + + /* + * Destructor + */ + ~CGlxMSKController(); + +public: //From MGlxMediaListObserver + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + void HandleAttributesAvailableL(TInt aItemIndex, const RArray& aAttributes, + MGlxMediaList* aList); + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: + /* + * Default Constructor + */ + CGlxMSKController(); + + /* + * Sets the MSK status on every attribute available callback. + * If attributes not available, but there are items, then this call is forced + * by SetStatusOnViewActivationL from MediaListViewBase + * @param aList Pointer og MGlxMediaList + */ + void SetStatusL( MGlxMediaList* aList ); + +private: + CEikButtonGroupContainer* iCba; + TBool iAttributeAvailable; + CGlxUiUtility* iUiUtility; + }; + + +#endif /*GLXMSKCONTROLLER_H_*/ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/glxtitlefetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/glxtitlefetcher.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2008-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: Title fetcher +* +*/ + + + + +#ifndef GLXTITLEFETCHER_H +#define GLXTITLEFETCHER_H + +#include +#include +#include +#include +#include "mglxtitlefetcherobserver.h" + + +class CMPXCollectionPath; +class MGlxMediaList; +class CGlxDefaultAttributeContext; + + +class CGlxTitleFetcher : public CBase, public MGlxMediaListObserver + { +public: + /** + * Constructs an instance of CGlxTitleFetcher and initiates obtaining + * a title + * + * @param aObserver Observer of this list + * @param aPath The current path by which to obtain the title + */ + static CGlxTitleFetcher* NewL(MGlxTitleFetcherObserver& aObserver, + CMPXCollectionPath* aPath); + + IMPORT_C virtual ~CGlxTitleFetcher(); + + // From MGlxMediaListObserver + virtual void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList); + + /** + * Notification that media object is now available for an item + * + * @param Index of the item + */ + virtual void HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) {}; + + /** + * Notification that media item was removed from the list + * + * @param aStartIndex First item that was removed + * @param aEndIndex Last item that was removed + */ + virtual void HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) {}; + + /** + * Notification that media item was changed + * + * @param aItemIndexes Indexes of items that were changed + */ + virtual void HandleItemModifiedL(const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) {}; + + + /** + * Notification that an attribute is available + * + * @param aItemIndex Index of the for which the thumbnail is available + * @param aAttributes Array of attributes that have become available + * @param aList List that this callback relates to + */ + virtual void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /** + * Notification that focus has moved + * + * @param aType the direction of the focus change + * @param aNewIndex the new index after the focus change + * @param aOldIndex the old index before the focus change + * @param aList List that this callback relates to + */ + virtual void HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, + TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) {}; + + /** + * Notification that an item has been selected/deselected + * + * @param aIndex Index of the item that has been selected/deselected + * @param aSelected Boolean to indicate selection/deselection + * @param aList List that the selection relates to + */ + virtual void HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, + MGlxMediaList* /*aList*/) {}; + + /** + * Notification from the collection. E.g. Items added/modified/deleted and progress notifications + * + * @param aMessage Message notification from the collection + * @param aList List that the notification relates to + */ + virtual void HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) {}; + +private: + + CGlxTitleFetcher(MGlxTitleFetcherObserver& aObserver, + CMPXCollectionPath* aPath); + + void ConstructL(); + +private: + + MGlxTitleFetcherObserver& iObserver; + CMPXCollectionPath* iPath; + TMPXItemId iPathId; + MGlxMediaList* iBackMediaList; + CGlxDefaultAttributeContext* iContext; + }; + + +#endif // GLXTITLEFETCHER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/glxtoolbarcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/glxtoolbarcontroller.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2008-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: Media item list observer interface +* +*/ + + + + +#ifndef GLXTOOLBARCONTROLLER_H +#define GLXTOOLBARCONTROLLER_H + +#include +#include // For Toolbar + + +NONSHARABLE_CLASS( CGlxToolbarController ): public CBase, public MGlxMediaListObserver + { +public: + /* + * function NewL + */ + static CGlxToolbarController* NewL (); + + /* + * Adds object of CGlxToolbar to observe medialist + * @param aList Reference of MGlxMediaList + */ + void AddToObserverL(MGlxMediaList& aList, CAknToolbar* aToolbar); + + /* + * Removes object of CGlxToolbar from medialist observer + * @param aList Reference of MGlxMediaList + */ + void RemoveFromObserver (MGlxMediaList& aList); + + /** + * Sets toolbar status.This is called after adding CGlxToolbarController + * to medialist observer, if there is no HandleAttributeAvailable callback. + * (This is done to activate toolbar when attributes are already available in cache) + * @param aList Pointer to MGlxMediaList + */ + void SetStatusOnViewActivationL( MGlxMediaList* aList ); + + /* + * Sets the toolbar status on every attribute available callback. + * If attributes not available, but there are items, then this call is forced + * by SetStatusOnViewActivationL from MediaListViewBase + * @param aList Pointer og MGlxMediaList + */ + void SetStatusL( MGlxMediaList* aList ); + + /* + * Destructor + */ + ~CGlxToolbarController(); + +public: //From MGlxMediaListObserver + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + void HandleAttributesAvailableL(TInt aItemIndex, const RArray& aAttributes, + MGlxMediaList* aList); + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, + TInt aOldIndex, MGlxMediaList* aList); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: + /* + * Default Constructor + */ + CGlxToolbarController(); + + /* Enables or disables latching on the toolbar button. + * Used in Marking mode. + * @param aCommandId The Command on toolbar that needs to be latched/unlatched. + * aLatched ETrue if the command button needs to be latched. + */ + void EnableLatch( TInt aCommandId, TInt aLatched ); + + /* + * check the current view + */ + TBool IsFullScreenView(); +private: + CAknToolbar* iToolbar; + TBool iAttributeAvailable; + }; + +#endif /*GLXTOOLBARCONTROLLER_H*/ + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/glxviewbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/glxviewbase.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,276 @@ +/* +* Copyright (c) 2008-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: View Base +* +*/ + + + + +#ifndef C_GLXVIEWBASE_H +#define C_GLXVIEWBASE_H + +// INCLUDES + + +#include +#include +#include +#include +#include +#include "glxkeyeventreceiver.h" +#include +#include +#include +#include +#include "mglxsoftkeyhandler.h" +#include +#include +class CGlxCommandHandler; +class CGlxUiUtility; +class CAlfControlGroup; +class CGlxKeyMonitor; + +// CLASS DECLARATION + +/** + * View base + * + * @lib glxviewbase.lib + */ +class CGlxViewBase : public CAknView, + public MGlxAnimationObserver, + public MAknToolbarObserver + { +public: + /** + * Constructor + */ + IMPORT_C CGlxViewBase(TBool aSyncActivation = EFalse); + + /** + * Destructor. + */ + IMPORT_C virtual ~CGlxViewBase(); + + /** + * Add a command handler to the view (ownership transferred and the + * command handler is deleted in the event of a leave). + * @param aCommandHandler The command handler to add. + */ + IMPORT_C void AddCommandHandlerL(CGlxCommandHandler* aCommandHandler); + + /** + * Enable and set a Title in screen furniture + * @param aTitleText The text to be displayed + * @param aAnimate Indicates if the change is to be animated + */ + IMPORT_C void SetTitleL(const TDesC& aTitleText); + + /** + * Disable a Title in screen furniture + * @param aAnimate Indicates if the change is to be animated + */ + IMPORT_C void DisableTitle(); + + /** + * Handles commands + * @param aCommand The command to respond to + * @return ETrue iff the command has been handled. + */ + IMPORT_C virtual TInt DoHandleCommandL(TInt aCommand); + + +protected: // From MCoeView. + + /** + * See @ref MCoeView. + */ + IMPORT_C void ViewActivatedL(const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage); + + /** + * See @ref MCoeView + */ + IMPORT_C void ViewDeactivated(); + + +protected: // From MGlxAnimationObserver + IMPORT_C virtual void AnimationComplete(MGlxAnimation* aAnimation); + +protected: + //From MAknToolbarObserver + IMPORT_C void OfferToolbarEventL( TInt aCommand ); + + IMPORT_C void SetToolbarObserver(MAknToolbarObserver* aObserver); + +protected: + /** + * IMPORTANT: Call this from the ConstructL of any derived class + */ + IMPORT_C void ViewBaseConstructL(); + + /** + * Derived classes should use this to deal with any view-specific commands + * @param aCommand The command to respond to + * @return ETrue iff the command has been handled. + */ + IMPORT_C virtual TBool HandleViewCommandL(TInt aCommand); + + /** + * Derived classes should use this to initialize the menus if required + * @param aResourceId The menu resource + * @param aMenuPane The menu pane to edit + */ + IMPORT_C virtual void ViewDynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + /** + * This will be called on derived classes when the view is activated + * @param aPrevViewId Specifies the view previously active. + * @param aCustomMessageId Specifies the message type. + * @param aCustomMessage The activation message. + */ + virtual void DoViewActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) = 0; + + /** + * This will be called on derived classes when the view is deactivated + */ + virtual void DoViewDeactivate() = 0; + + /** + * This is called on derived classes before the options menu + * is opened. The derived classes should use it to ensure that + * all required attributes have been retrieved in order to determine + * if the command should be displayed on the options menu and. + */ + IMPORT_C virtual void FetchAttributesL(); + + /** + * This is called on derived classes before commands are executed. + * The derived classes should use it to ensure that all the required + * attributes have been tetrieved in order to execute the command. + */ + IMPORT_C virtual void FetchAttributesForCommandL(TInt aCommand); + + /** + * Report whether the given type of animation is supported by the class + * @return ETrue iff the animaiton is implemented + */ + IMPORT_C virtual TBool ViewAnimationSupported(TGlxViewswitchAnimation aType); + + /** + * Start the given type of view-switch animation + * @param aType The type of animation (e.g. Entry / Exit) + * @param aDirection The direction of the animation (e.g. Forwards / Backwards) + */ + IMPORT_C virtual void DoViewAnimationL(TGlxViewswitchAnimation aType, TGlxNavigationDirection aDirection); + + /** + * Sets the toolbar state after command execution. + * @ return ETrue If item is a system item. Else EFalse + */ + IMPORT_C virtual void SetToolbarStateL(); + + +private: + // From MEikMenuObserver + IMPORT_C virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + // From MGlxUiCommandHandler + IMPORT_C void HandleCommandL(TInt aCommand); + + // From CAknView + IMPORT_C void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); + IMPORT_C void DoDeactivate(); + +private: + + /** + * Initialize a viewswitch animation + * @param aType The type of animation to start + */ + void InitAnimationL(TGlxViewswitchAnimation aType); + + /** + * Cancel the current viewswitch animation, if any + */ + void CancelViewAnimation(); + + /** + * Called when the view-switch animation is complete or interrupted + * @param aType The type of animation (e.g. Entry / Exit) + */ + void ViewAnimationComplete(TGlxViewswitchAnimation aType); + + /** + * Gets the title pane instance. + */ + CAknTitlePane* GetTitlePaneL(); + +protected: + /** + * Optionally implemented by sub-classes to prepare command handlers. + * Called once for every command handler added to the view. + * @param aCommandHandler command handler added to the view. + */ + virtual void DoPrepareCommandHandlerL(CGlxCommandHandler* /*aCommandHandler*/) {}; + +protected: + /// The list of command handlers owned by the view + RPointerArray iCommandHandlerList; + +protected: + CGlxUiUtility* iUiUtility; ///< The UiUtility in use + + /// The view animation time + TInt iViewAnimationTime; +private: + /** + * Functions to handle view activate asynchronously + */ + static TBool ViewActivateCallbackL(TAny* aPtr); + inline void ViewActivateL(); + +private: + /// Resource file offset + TInt iViewBaseResourceOffset; + + /// Ui Utility resource file offset + TInt iUiUtilitiesResourceOffset; + /// The type of viewswitch animation in progress, if any + TGlxViewswitchAnimation iViewAnimationInProgress; + + /// Flag to determine if this view is activated synchronously + const TBool iSyncActivation; + + //This is a Kind of Hack to prevent Photos to act on any command's till + //Corresponding view is activated + //This Should be fixed with Proper Way + TBool iViewActivated; + + /// View activate attributes for callback + TVwsViewId iPrevViewId; + TUid iCustomMessageId; + HBufC8* iCustomMessage; + + /// Callback for view activate + CAsyncCallBack* iViewActivateCallback; + + /// Status pane for title + CAknTitlePane* iTitlePane; + }; + + +#endif // C_GLXVIEWBASE_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/mglxsoftkeyhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/mglxsoftkeyhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2008-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: Interface for softkey handling +* +*/ + + + + +#ifndef M_GLXSOFTKEYHANDLER_H +#define M_GLXSOFTKEYHANDLER_H + +/** + * Available softkeys + */ +enum TGlxSoftkey + { + EGlxLeftSoftkey, + EGlxMiddleSoftkey, + EGlxRightSoftkey + }; + +/** + * Allow components other than views to update softkeys if necessary + */ +class MGlxSoftkeyHandler + { +public: + /** + * Store copy of current softkeys to allow original config + * to be restored + */ + virtual void StoreCurrentSoftKeysL() = 0; + + /** + * Set specified softkey with command and text + * @param aSoftkey softkey to set (EGlxLeftSoftkey/EGlxRighttSoftkey) + * @param aCommand id of command to associate with softkey + * @param aSoftkeyText text for softkey (softkey takes ownership) + */ + virtual void ChangeSoftkeyL(TGlxSoftkey aSoftkey, TInt aCommand, + const TDesC& aSoftkeyText) = 0; + /** + * Restore original softkeys and title + */ + virtual void RestoreSoftKeysAndTitleL() = 0; + + /** + * Enables / disables a softkey + * @param aEnable Whether to enable or disable the softkey + * @param aSoftkey The affected softkey + */ + virtual void EnableSoftkey( TBool aEnable, TGlxSoftkey aSoftkey ) = 0; + }; + +#endif // M_GLXSOFTKEYHANDLER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/inc/mglxtitlefetcherobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/inc/mglxtitlefetcherobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2008-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: Title fetcher observer +* +*/ + + + + +#ifndef MGLXTITLEFETCHEROBSERVER_H +#define MGLXTITLEFETCHEROBSERVER_H + +#include +//#include +//#include + +/** + * MGlxTitleFetcherObserver + * + * Title fetcher interface + */ +class MGlxTitleFetcherObserver + { +public: + /** + * Handle the title + * @param aTitle The title + */ + virtual void HandleTitleAvailableL(const TDesC& aTitle) = 0; + + }; + + + + +#endif // MGLXTITLEFETCHEROBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/src/glxkeymonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/src/glxkeymonitor.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2008-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: Key monitoring control +* +*/ + + + + + +#include "glxkeymonitor.h" +#include +#include "glxviewbase.h" +#include "glxkeyeventreceiver.h" + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxKeyMonitor::CGlxKeyMonitor() + : CAlfControl() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxKeyMonitor::~CGlxKeyMonitor() + { + } + +// ----------------------------------------------------------------------------- +// OfferEventL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxKeyMonitor::OfferEventL(const TAlfEvent &aEvent) + { + TBool consumed = EFalse; + + if ( aEvent.IsKeyEvent() && iEventReceiver ) + { + TKeyResponse resp = iEventReceiver->OfferKeyEventL(aEvent.KeyEvent(), aEvent.Code()); + consumed = (resp == EKeyWasConsumed); + } + + return consumed; + } + +// ----------------------------------------------------------------------------- +// SetView +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxKeyMonitor::SetReceiver(MGlxKeyEventReceiver* aEventReceiver) + { + iEventReceiver = aEventReceiver; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/src/glxmedialistfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/src/glxmedialistfactory.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-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: Media List provider default implementation +* +*/ + + + + +#include +#include "glxmedialistfactory.h" + +#include +#include +#include "mglxmedialist.h" + + +// ----------------------------------------------------------------------------- +// MediaList +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxMediaList& MGlxMediaListFactory::CreateMediaListL(MMPXCollectionUtility& aCollectionUtility) const + { + return CurrentListL(aCollectionUtility); + } + +// ----------------------------------------------------------------------------- +// CurrentList +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxMediaList& MGlxMediaListFactory::CurrentListL(MMPXCollectionUtility& aCollectionUtility) const + { + MGlxMediaList* mediaList = NULL; + + // Create media list + CMPXCollectionPath* path = aCollectionUtility.Collection().PathL(); + CleanupStack::PushL(path); + path->Back(); + mediaList = MGlxMediaList::InstanceL(*path); + CleanupStack::PopAndDestroy(path); + + return *mediaList; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/src/glxmedialistviewbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,400 @@ +/* +* Copyright (c) 2008-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: Media List View Base +* +*/ + + + + +#include "glxmedialistviewbase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For Logs +#include +#include "glxtitlefetcher.h" +#include "glxmedialistfactory.h" +#include "mglxmedialist.h" + + _LIT(KBlankTitle," "); + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListViewBase::CGlxMediaListViewBase() + { + } + +// ----------------------------------------------------------------------------- +// MLViewBaseConstructL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::MLViewBaseConstructL( + MGlxMediaListFactory* aMediaListFactory, + const TDesC& aTitle,TBool aEnableMiddleSoftkey) + { + iMediaListFactory = aMediaListFactory; + iCollectionUtility = MMPXCollectionUtility::NewL(NULL, KMcModeDefault); + iEnableMidddleSoftkey = aEnableMiddleSoftkey; + + iSelectionIterator.SetRange(KMaxTInt); + iPreloadContextForCommandHandlers = new (ELeave) CGlxAttributeContext(&iSelectionIterator); + + if(aTitle.Length() > 0) + { + iFixedTitle = aTitle.AllocL(); + } + + + if(iUiUtility->IsPenSupported()) + { + // Responsible for controlling the ui states of toolbar + // Create ToolbarController only for touch supported devices. + iToolbarControl = CGlxToolbarController::NewL(); + } + else + { + // Responsible for controlling the middle softkey if enabled. + // Create Middle Softkey Controller only for non-touch devices + iCbaControl = CGlxMSKController::NewL(); + } + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxMediaListViewBase::~CGlxMediaListViewBase() + { + CloseMediaList(); + + if ( iCollectionUtility ) + { + iCollectionUtility->Close(); + } + + delete iFixedTitle; + delete iTitleFetcher; + delete iPreloadContextForCommandHandlers; + + if( iCbaControl ) + { + delete iCbaControl; + } + + if( iToolbarControl ) + { + delete iToolbarControl; + } + } + +// ----------------------------------------------------------------------------- +// MediaList +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxMediaList& CGlxMediaListViewBase::MediaList() + { + GLX_ASSERT_ALWAYS( iMediaList, Panic( EGlxPanicNullMediaList ), + "Media list has been closed" ); + return *iMediaList; + } + +// ----------------------------------------------------------------------------- +// DoViewActivateL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::DoViewActivateL( + const TVwsViewId& aPrevViewId, TUid aCustomMessageId, + const TDesC8& aCustomMessage) + { + TRACER ("CGlxMediaListViewBase::DoViewActivateL()"); + iUiUtility->SetAppOrientationL( EGlxOrientationDefault ); + if ( iMediaList ) + { + // may need to refresh the media list if it has got out of sync + // with the current navigational state, e.g. when jumping back two views + // instead of just one, the intermediate view's media list will not have + // been closed so if that view is subsequently re-opened its media list + // could contain out of date items + CMPXCollectionPath* path = iMediaList->PathLC(); + // current navigational state + CMPXCollectionPath* navigationalState = + iCollectionUtility->Collection().PathL(); + CleanupStack::PushL( navigationalState ); + // current node id in UI Hierarchy + TMPXItemId navStateNodeId = + navigationalState->Id( navigationalState->Levels() - 2 ); + // current media list's node id in UI hierarchy + TMPXItemId mediaListNodeId = path->Id( path->Levels() - 2 ); + + if ( mediaListNodeId != navStateNodeId ) + { + // the node ids are out of synch so close the media list + // for it to be recreated later on + CloseMediaList(); + } + CleanupStack::PopAndDestroy( navigationalState ); + CleanupStack::PopAndDestroy( path ); + } + + if (!iMediaList && iMediaListFactory) + { + iMediaList = &iMediaListFactory->CreateMediaListL(*iCollectionUtility); + iMediaList->AddContextL(iPreloadContextForCommandHandlers, 0); + } + + if(iFixedTitle) + { + // If there is a fixed title, set it + SetTitleL(*iFixedTitle); + } + else + { + // else obtain a title from the media list + // First set a blank title to claim the title space + SetTitleL(KBlankTitle); + + CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent ); + iTitleFetcher = CGlxTitleFetcher::NewL(*this, path); + CleanupStack::PopAndDestroy(path); + } + + //Allow the MskController to observe medialist everytime a view with a valid + //medialist becomes active + if( iCbaControl && iMediaList && Cba()&& iEnableMidddleSoftkey ) + { + CMPXCollectionPath* navigationalState = iCollectionUtility->Collection().PathL(); + CleanupStack::PushL(navigationalState); + iCbaControl->AddToObserverL(*iMediaList,Cba()); + if(!(1 == navigationalState->Levels())) // Checking for the main list view + { + iCbaControl->SetStatusOnViewActivationL(iMediaList); + } + else + { + iCbaControl->SetMainStatusL(); + } + CleanupStack::PopAndDestroy(navigationalState); + } + + //Allow the toolbarController to observe medialist everytime a view with a valid + //medialist becomes active + if( Toolbar() && iToolbarControl ) + { + iToolbarControl->AddToObserverL(*iMediaList, Toolbar()); + iToolbarControl->SetStatusOnViewActivationL(iMediaList); + } + + DoMLViewActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); + } + +// ----------------------------------------------------------------------------- +// DoViewDeactivate +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::DoViewDeactivate() + { + DoMLViewDeactivate(); + if( iCbaControl && iMediaList && Cba() ) + { + //Remove Mskcontroller from medialist observer + iCbaControl->RemoveFromObserver(*iMediaList); + } + if( Toolbar() && iToolbarControl ) + { + //Remove Toolbarcontroller from medialist observer + iToolbarControl->RemoveFromObserver(*iMediaList); + } + + // Only close the medialist if navigating backwards + if ( iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards ) + { + CloseMediaList(); + } + + delete iTitleFetcher; + iTitleFetcher = NULL; + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListViewBase::FetchAttributesL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::FetchAttributesL() + { + FetchAttributesL(EFalse); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListViewBase::FetchAttributesForCommandL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::FetchAttributesForCommandL(TInt aCommand) + { + FetchAttributesL(ETrue, aCommand); + } + +// ----------------------------------------------------------------------------- +// SetToolbarStateL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::SetToolbarStateL() + { + TRACER("CGlxMediaListViewBase::SetToolbarStateL"); + + if( iToolbarControl && iMediaList ) + { + iToolbarControl->SetStatusL(iMediaList); + } + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListViewBase::FetchAttributesL +// ----------------------------------------------------------------------------- +// +void CGlxMediaListViewBase::FetchAttributesL(TBool aFilterUsingCommandId, + TInt aCommandId) + { + TRACER("CGlxMediaListViewBase::FetchAttributesL"); + + TGlxSelectionIterator iterator; + CGlxAttributeContext* attributeContext = new(ELeave) CGlxAttributeContext(&iterator); + CleanupStack::PushL(attributeContext); + + TInt commandHandlerCount = iCommandHandlerList.Count(); + for (TInt i = 0; i < commandHandlerCount; i++) + { + AddAttributesToContextL(*attributeContext, iCommandHandlerList[i], ETrue, aFilterUsingCommandId, aCommandId); + } + + if (attributeContext->AttributeCount()) + { + // Check if media attributes are already fetched. + // If media item is NULL, Cancel the previous pending request + MediaList().CancelPreviousRequests(); + + MediaList().AddContextL(attributeContext, KGlxFetchContextPriorityCommandHandlerOpening ); + + // TGlxContextRemover will remove the context when it goes out of scope + // Used here to avoid a trap and still have safe cleanup + TGlxFetchContextRemover contextRemover(attributeContext, MediaList()); + // put to cleanupstack as cleanupstack is emptied before stack objects + // are deleted + CleanupClosePushL( contextRemover ); + // retrieve attributes, ignore return value + (void)GlxAttributeRetriever::RetrieveL(*attributeContext, MediaList(), ETrue); + // context off the list + CleanupStack::PopAndDestroy( &contextRemover ); + } + + CleanupStack::PopAndDestroy(attributeContext); + } + +// ----------------------------------------------------------------------------- +// HandleTitleAvailableL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::HandleTitleAvailableL( + const TDesC& aTitle) + { + // Convertion of unsigned short to unsigned int + TUint16* tileConv = const_cast(aTitle.Ptr()); + TInt titleLen = aTitle.Length(); + TPtr titlePtr(tileConv,titleLen,titleLen); + + //to convert between arabic-indic digits and european digits. + //based on existing language setting. + AknTextUtils::LanguageSpecificNumberConversion(titlePtr); + + // Set a title after it has been obtained by the title fetcher + SetTitleL(aTitle); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListViewBase::DoPrepareCommandHandlerL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxMediaListViewBase::DoPrepareCommandHandlerL( + CGlxCommandHandler* aCommandHandler) + { + AddAttributesToContextL(*iPreloadContextForCommandHandlers, + aCommandHandler, EFalse, EFalse); + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListViewBase::CloseMediaList +// ----------------------------------------------------------------------------- +// +void CGlxMediaListViewBase::CloseMediaList() + { + if (iMediaList) + { + iMediaList->RemoveContext(iPreloadContextForCommandHandlers); + iMediaList->Close(); + iMediaList = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CGlxMediaListViewBase::AddAttributesToContextL +// ----------------------------------------------------------------------------- +// +void CGlxMediaListViewBase::AddAttributesToContextL( + CGlxAttributeContext& aAttributeContext, + CGlxCommandHandler* aCommandHandler, + TBool aFilterUsingSelection, + TBool aFilterUsingCommandId, + TInt aCommandId) + { + RArray requiredAttributes; + CleanupClosePushL(requiredAttributes); + aCommandHandler-> + GetRequiredAttributesL(requiredAttributes, aFilterUsingSelection, aFilterUsingCommandId, aCommandId); + + TInt attributeCount = requiredAttributes.Count(); + for (TInt i = 0; i < attributeCount; i++) + { + aAttributeContext.AddAttributeL(requiredAttributes[i]); + } + CleanupStack::PopAndDestroy(&requiredAttributes); + } + +// ----------------------------------------------------------------------------- +// HandleViewCommandL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxMediaListViewBase::HandleViewCommandL(TInt /*aCommand*/) + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// DoHandleCommandL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxMediaListViewBase::DoHandleCommandL(TInt aCommand) + { + // Pass the command to the deriving class + return HandleViewCommandL( aCommand ); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/src/glxmskcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/src/glxmskcontroller.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,343 @@ +/* +* Copyright (c) 2008-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: Media item list observer interface +* +*/ + + + + +#include "glxmskcontroller.h" +#include // For Logs +#include +#include +#include "glxcommandhandlers.hrh" +#include +#include +#include + + +//---------------------------------------------------------------------------------- +// NewL +//---------------------------------------------------------------------------------- +// +CGlxMSKController* CGlxMSKController::NewL() + { + TRACER("CGlxToolbarController::NewL"); + + CGlxMSKController *self = new( ELeave ) CGlxMSKController (); + return self; + } + +//---------------------------------------------------------------------------------- +// Default Constructor +//---------------------------------------------------------------------------------- +// +CGlxMSKController::CGlxMSKController() + + { + TRACER("CGlxMSKController::CGlxMSKController"); + iUiUtility = CGlxUiUtility::UtilityL(); + } + +//---------------------------------------------------------------------------------- +// AddToObserver +//---------------------------------------------------------------------------------- +// +void CGlxMSKController::AddToObserverL (MGlxMediaList& aList, CEikButtonGroupContainer* aCba) + { + TRACER("CGlxMSKController::AddToObserverL"); + + iCba = aCba; + iAttributeAvailable = EFalse; + aList.AddMediaListObserverL ( this ); + } + +//---------------------------------------------------------------------------------- +// RemoveFromObserver +//---------------------------------------------------------------------------------- +// +void CGlxMSKController::RemoveFromObserver (MGlxMediaList& aList) + { + TRACER("CGlxMSKController::RemoveFromObserver"); + + aList.RemoveMediaListObserver ( this ); + } + +//---------------------------------------------------------------------------- +// HandleItemAddedL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxMSKController::HandleItemAddedL"); + // no implementation + } + +//---------------------------------------------------------------------------- +// HandleMediaL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxMSKController::HandleMediaL"); + // no implementation + } + +//---------------------------------------------------------------------------- +// HandleItemRemovedL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* aList) + { + TRACER("CGlxMSKController::HandleItemRemovedL"); + + if( aList->Count() <= 0 ) + { + iCba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK); + iCba->DrawNow(); + } + } + +//---------------------------------------------------------------------------- +// HandleItemModifiedL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleItemModifiedL(const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxMSKController::HandleItemModifiedL"); + // no implementation + } + +//---------------------------------------------------------------------------- +// HandleAttributesAvailableL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& /*aAttributes*/, + MGlxMediaList* aList) + { + TRACER("CGlxMSKController::HandleAttributesAvailableL"); + + if( aItemIndex == aList->FocusIndex() ) + { + iAttributeAvailable = ETrue; + SetStatusL(aList); + } + const TGlxMedia& mediaItem = aList->Item(aList->FocusIndex()); + + if( mediaItem.IsStatic() && aList->SelectionCount() <= 0 ) + { + HBufC* openbuf = StringLoader::LoadLC(R_GLX_MSK_OPEN); + TPtr textopenptr = openbuf->Des(); + + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopenptr ); + iCba->DrawNow(); + CleanupStack::PopAndDestroy(openbuf); + } + } + +//---------------------------------------------------------------------------- +// HandleFocusChangedL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, + TInt aNewIndex, TInt /*aOldIndex*/, + MGlxMediaList* aList) + { + TRACER("CGlxMSKController::HandleFocusChangedL"); + + // If new index is not equal to -1 (i.e., if there are items present), + // then check the media item + + if( (KErrNotFound != aNewIndex) && (aNewIndex == aList->FocusIndex()) ) + { + SetStatusL(aList); + } + } + +//---------------------------------------------------------------------------- +// HandleItemSelectedL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleItemSelectedL(TInt /*aIndex*/, TBool aSelected, + MGlxMediaList* aList) + { + TRACER("CGlxMSKController::HandleItemSelectedL"); + + if( !aSelected ) + { + SetStatusL(aList); + } + } + +//---------------------------------------------------------------------------- +// HandleMessageL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxMSKController::HandleMessageL"); + // no implementation + } + +//---------------------------------------------------------------------------- +// Destructor +//---------------------------------------------------------------------------- +// +CGlxMSKController::~CGlxMSKController() + { + TRACER("CGlxMSKController::~CGlxMSKController"); + if ( iUiUtility ) + { + iUiUtility->Close(); + iUiUtility = NULL; + } + } + +//---------------------------------------------------------------------------- +// SetStatusOnViewActivationL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::SetStatusOnViewActivationL( MGlxMediaList* aList ) + { + TRACER("CGlxMSKController::SetStatusOnViewActivationL"); + + // When going back from fullscreen to grid, when the attributes are already + // available in the cache, there is no HandleAttributeAvailable callback. Hence, + // checking for medialist count. + if( !iAttributeAvailable && (aList->Count(NGlxListDefs::ECountNonStatic) > 0)) + { + SetStatusL(aList); + } + if( aList->Count() == 0 ) + { + iCba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK); + iCba->DrawNow(); + } + } + +//---------------------------------------------------------------------------- +//SetStatusL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::SetStatusL(MGlxMediaList* aList) + { + TRACER("CGlxMSKController::SetStatusL"); + + if( !aList->SelectionCount() > 0 ) + { + //Get the current media item from medialist + const TGlxMedia& mediaItem = aList->Item(aList->FocusIndex()); + TBool isSystemItem = EFalse; + mediaItem.GetSystemItem(isSystemItem); + + HBufC* openbuf = StringLoader::LoadLC(R_GLX_MSK_OPEN); + TPtr textopen = openbuf->Des(); + + HBufC* playbuf = StringLoader::LoadLC(R_GLX_MSK_PLAY); + TPtr textplay = playbuf->Des(); + + // Check whether media item is a system item, for example Favourites album + // or a static item + if( isSystemItem || mediaItem.IsStatic() ) + { + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopen ); + iCba->DrawNow(); + } + + else + { + switch (mediaItem.Category()) + { + case EMPXImage: + { + if (!iUiUtility->IsExitingState()) + { + // When Marking is done and Exit key is pressed, we do not need to set + // MSK, as the application is exiting. + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopen ); + iCba->DrawNow(); + } + break; + } + case EMPXVideo: + { + // When Marking is done and Exit key is pressed, we do not need to set + // MSK, as the application is exiting. + if (!iUiUtility->IsExitingState()) + { + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textplay ); + iCba->DrawNow(); + } + break; + } + case EMPXMonth: + { + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopen ); + iCba->DrawNow(); + break; + } + case EMPXAlbum: + { + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopen ); + iCba->DrawNow(); + break; + } + case EMPXTag: + { + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopen ); + iCba->DrawNow(); + break; + } + default: + { + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopen ); + iCba->DrawNow(); + break; + } + } + } + CleanupStack::PopAndDestroy(playbuf); + CleanupStack::PopAndDestroy(openbuf); + } + } + +//---------------------------------------------------------------------------- +//SetMainStatusL +//---------------------------------------------------------------------------- +// +void CGlxMSKController::SetMainStatusL() + { + HBufC* openbuf = StringLoader::LoadLC(R_GLX_MSK_OPEN); + TPtr textopen = openbuf->Des(); + + iCba->SetCommandL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, + EAknCmdOpen, textopen ); + iCba->DrawNow(); + CleanupStack::PopAndDestroy(openbuf); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/src/glxtitlefetcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/src/glxtitlefetcher.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2008-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: Title fetcher +* +*/ + + + + + +// INCLUDE FILES +#include "glxtitlefetcher.h" + +#include +#include +#include +#include +#include +#include "glxlog.h" +#include "glxtracer.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxTitleFetcher::CGlxTitleFetcher(MGlxTitleFetcherObserver& aObserver, + CMPXCollectionPath* aPath) : + iObserver(aObserver), iPath(aPath) + { + TRACER("CGlxTitleFetcher::CGlxTitleFetcher"); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// + +void CGlxTitleFetcher::ConstructL() + { + TRACER("CGlxTitleFetcher::ConstructL"); + // Go back one level to obtain the ID + iPathId = iPath->Id(); + // Go back another level from which to create a media list containing + // this path + iPath->Back(); + + iBackMediaList = MGlxMediaList::InstanceL(*iPath); + + /// @todo: This idSpaceId must be calculated properly + TGlxIdSpaceId idSpaceId = iBackMediaList->IdSpaceId(0); + + TGlxMediaId id(iPathId); + TBool requestAttributes = ETrue; + TInt index = iBackMediaList->Index(idSpaceId, id); + + if ( index != KErrNotFound ) + { + const TGlxMedia& item = iBackMediaList->Item(index); + const CGlxMedia* media = item.Properties(); + + // get the Title from the attribute if it is already present + if (media && media->IsSupported(KMPXMediaGeneralTitle) + && index != KErrNotFound) + { + const TDesC& title = media->ValueText(KMPXMediaGeneralTitle); + // notify the observer + iObserver.HandleTitleAvailableL(title); + requestAttributes = EFalse; + } + } + + if ( requestAttributes ) + { + // Otherwise add a context setting range to cover all items + iContext = CGlxDefaultAttributeContext::NewL(); + iContext->SetRangeOffsets(10000,10000); + iContext->AddAttributeL(KMPXMediaGeneralTitle); + // Add the context at a high priority + iBackMediaList->AddContextL( iContext, + KGlxFetchContextPriorityTitleFetcher ); + // Set self as observer + iBackMediaList->AddMediaListObserverL(this); + } + } + + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CGlxTitleFetcher* CGlxTitleFetcher::NewL(MGlxTitleFetcherObserver& aObserver, + CMPXCollectionPath* aPath) + { + CGlxTitleFetcher* self = new (ELeave) CGlxTitleFetcher(aObserver, aPath); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxTitleFetcher::~CGlxTitleFetcher() + { + TRACER("CGlxTitleFetcher::~CGlxTitleFetcher ()"); + + if(iBackMediaList) + { + if(iContext) + { + iBackMediaList->RemoveContext(iContext); + delete iContext; + } + iBackMediaList->RemoveMediaListObserver(this); + iBackMediaList->Close(); + } + + } +// --------------------------------------------------------------------------- +// CGlxTitleFetcher::HandleItemAddedL +// --------------------------------------------------------------------------- +// +void CGlxTitleFetcher::HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* aList) + { + TRACER("CGlxTitleFetcher::HandleItemAddedL ()"); + if(aList == iBackMediaList) + { + for(TInt index = aStartIndex;index <= aEndIndex;index++) + // Is it the item (path) that we want + { + if(aList->Item(index).Id().Value() == (TUint32)iPathId) + { + const TGlxMedia& item = aList->Item(index); + const CGlxMedia* media = item.Properties(); + // get the Title from the attribute + if (media && media->IsSupported(KMPXMediaGeneralTitle)) + { + const TDesC& title = media->ValueText(KMPXMediaGeneralTitle); + // notify the observer + iObserver.HandleTitleAvailableL(title); + iBackMediaList->RemoveContext(iContext); + delete iContext; + iContext = NULL; + } + } + } + } + } +// --------------------------------------------------------------------------- +// CGlxTitleFetcher::HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxTitleFetcher::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& /*aAttributes*/, MGlxMediaList* aList) + { + TRACER("CGlxTitleFetcher::HandleAttributesAvailableL ()"); + // Is it the list that we want + if(aList == iBackMediaList) + { + // Is it the item (path) that we want + if(aList->Item(aItemIndex).Id().Value() == (TUint32)iPathId) + { + const TGlxMedia& item = aList->Item(aItemIndex); + const CGlxMedia* media = item.Properties(); + // get the Title from the attribute + if (media && media->IsSupported(KMPXMediaGeneralTitle)) + { + const TDesC& title = media->ValueText(KMPXMediaGeneralTitle); + // notify the observer + iObserver.HandleTitleAvailableL(title); + iBackMediaList->RemoveContext(iContext); + delete iContext; + iContext = NULL; + + } + } + } + } + + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/src/glxtoolbarcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/src/glxtoolbarcontroller.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,367 @@ +/* +* Copyright (c) 2008-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: Media item list observer interface +* +*/ + + + + +#include "glxtoolbarcontroller.h" +#include +#include // For Toolbar +#include // For Command ids +#include // For Logs +#include + +#include +#include +#include +const TInt KGlxToolbarButtonUnLatched = 0; // As per the states in resource file +const TInt KGlxToolbarButtonLatched = 1 ; + +//---------------------------------------------------------------------------------- +// NewL +//---------------------------------------------------------------------------------- +// +CGlxToolbarController* CGlxToolbarController::NewL() + { + TRACER("CGlxToolbarController::NewL"); + + CGlxToolbarController *self = new( ELeave ) CGlxToolbarController (); + return self; + } + +//---------------------------------------------------------------------------------- +// Default Constructor +//---------------------------------------------------------------------------------- +// +CGlxToolbarController::CGlxToolbarController( ) + { + TRACER("CGlxToolbarController::Default constructor"); + + } + +//---------------------------------------------------------------------------------- +// AddToObserver +//---------------------------------------------------------------------------------- +// +void CGlxToolbarController::AddToObserverL (MGlxMediaList& aList, CAknToolbar* aToolbar) + { + TRACER("CGlxToolbarController::AddToObserverL"); + + iToolbar = aToolbar; + iAttributeAvailable = EFalse; + iToolbar->SetDimmed(ETrue); + iToolbar->DrawNow(); + aList.AddMediaListObserverL ( this ); + } + +//---------------------------------------------------------------------------------- +// RemoveFromObserver +//---------------------------------------------------------------------------------- +// +void CGlxToolbarController::RemoveFromObserver (MGlxMediaList& aList) + { + TRACER("CGlxToolbarController::RemoveFromObserver"); + + if( aList.SelectionCount()<= 0 ) + { + EnableLatch( EGlxCmdStartMultipleMarking, EFalse ); + } + + aList.RemoveMediaListObserver ( this ); + } + +//---------------------------------------------------------------------------- +// HandleItemAddedL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxToolbarController::HandleItemAddedL"); + + } + +//---------------------------------------------------------------------------- +// HandleMediaL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) + { + TRACER("CGlxToolbarController::HandleMediaL"); + + } + +//---------------------------------------------------------------------------- +// HandleItemRemovedL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleItemRemovedL(TInt /*aStartIndex*/, + TInt /*aEndIndex*/, MGlxMediaList* aList) + { + TRACER("CGlxToolbarController::HandleItemRemovedL"); + + if( aList->Count() <= 0 ) + { + iToolbar->SetDimmed(ETrue); + iToolbar->DrawNow(); + } + } + +//---------------------------------------------------------------------------- +// HandleItemModifiedL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleItemModifiedL(const RArray& /*aItemIndexes*/, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxToolbarController::HandleItemModifiedL"); + + } + +//---------------------------------------------------------------------------- +// HandleAttributesAvailableL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& /*aAttributes*/, + MGlxMediaList* aList) + { + TRACER("CGlxToolbarController::HandleAttributesAvailableL"); + + if( aItemIndex == aList->FocusIndex() ) + { + iAttributeAvailable = ETrue; + SetStatusL(aList); + } + } + +//---------------------------------------------------------------------------- +// HandleFocusChangedL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, + TInt aNewIndex, TInt /*aOldIndex*/, + MGlxMediaList* aList) + { + TRACER("CGlxToolbarController::HandleFocusChangedL"); + + // If new index is not equal to -1 (i.e., if there are some items present), + // then check the media item + if( (aNewIndex == aList->FocusIndex()) && (KErrNotFound != aNewIndex) ) + { + //Get the current media item from medialist + const TGlxMedia& mediaItem = aList->Item(aList->FocusIndex()); + //Check whether media item is a system item, for example Favourites album + TBool isSystemItem = EFalse; + mediaItem.GetSystemItem(isSystemItem); + if( mediaItem.IsStatic() ) + { + iToolbar->SetDimmed(ETrue); + } + else if( iToolbar->IsDimmed() ) + { + iToolbar->SetDimmed(EFalse); + } + if( isSystemItem ) + { + iToolbar->SetItemDimmed( EGlxCmdRename, ETrue, ETrue ); + } + else + { + iToolbar->SetItemDimmed( EGlxCmdRename, EFalse, ETrue ); + } + } + //DrawNow must be called since SetDimmed does not redraw the toolbar + iToolbar->DrawNow(); + } + +//---------------------------------------------------------------------------- +// HandleItemSelectedL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, + MGlxMediaList* aList) + { + TRACER("CGlxToolbarController::HandleItemSelectedL"); + + // If atleast 1 item is marked, or if Mark All is called, then Latch the mark button. + if((aList->SelectionCount() == 1 ) || (aList->SelectionCount() == aList->Count())) + { + EnableLatch( EGlxCmdStartMultipleMarking, ETrue ); + } + /* single clk chngs + * check the current view status. + * need to disable upload button in toolbar for grid by default + */ + if(!IsFullScreenView()) + { + if(aList->SelectionCount() >= 1 ) + { + iToolbar->SetItemDimmed(EGlxCmdUpload,EFalse , ETrue); + } + else + { + iToolbar->SetItemDimmed(EGlxCmdUpload,ETrue , ETrue); + } + } + + //DrawNow must be called since SetDimmed does not redraw the toolbar + iToolbar->DrawNow(); + } + +//---------------------------------------------------------------------------- +// HandleMessageL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::HandleMessageL(const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxToolbarController::HandleMessageL"); + + } + +//---------------------------------------------------------------------------- +// Destructor +//---------------------------------------------------------------------------- +// +CGlxToolbarController::~CGlxToolbarController() + { + TRACER("CGlxToolbarController Destructor"); + + } + +//---------------------------------------------------------------------------- +// SetStatusOnViewActivationL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::SetStatusOnViewActivationL( MGlxMediaList* aList ) + { + TRACER("CGlxToolbarController::SetStatusOnViewActivationL"); + + // When going back from fullscreen to grid, when the attributes are already + // available in the cache, there is no HandleAttributeAvailable callback. Hence, + // checking for medialist count. + if( !iAttributeAvailable && (aList->Count(NGlxListDefs::ECountNonStatic) > 0)) + { + SetStatusL(aList); + } + } + +//---------------------------------------------------------------------------- +//SetStatusL +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::SetStatusL(MGlxMediaList* aList) + { + TRACER("CGlxToolbarController::SetStatusL"); + if(KErrNotFound != aList->FocusIndex()) + { + //Get the current media item from medialist + const TGlxMedia& mediaItem = aList->Item(aList->FocusIndex()); + + //Check whether media item is a system item, for example Favourites album + TBool isSystemItem = EFalse; + mediaItem.GetSystemItem(isSystemItem); + + if(!mediaItem.IsStatic() && iToolbar->IsDimmed()) + { + //Activate (Undim) the toolbar if item in focus is not static + iToolbar->SetDimmed(EFalse); + } + + + if( isSystemItem ) + { + iToolbar->SetItemDimmed( EGlxCmdRename, ETrue, ETrue ); + } + else + { + iToolbar->SetItemDimmed( EGlxCmdRename, EFalse, ETrue ); + } + } + /* single clk chngs + * enable/disable upload button as per selection count, only in grid view + */ + if(aList->SelectionCount()== 0 && !IsFullScreenView()) + { + iToolbar->SetItemDimmed(EGlxCmdUpload,ETrue , ETrue); + } + + //DrawNow must be called since SetDimmed does not redraw the toolbar + iToolbar->DrawNow(); + } + +//---------------------------------------------------------------------------- +// EnableLatch +//---------------------------------------------------------------------------- +// +void CGlxToolbarController::EnableLatch( TInt aCommandId, TInt aLatched ) + { + CAknButton* toolbarButton = static_cast + (iToolbar->ControlOrNull( aCommandId )); + + if( toolbarButton ) + { + if(aLatched) + { + toolbarButton->SetCurrentState( KGlxToolbarButtonLatched, ETrue ); + } + else + { + toolbarButton->SetCurrentState( KGlxToolbarButtonUnLatched, ETrue ); + } + } + } +//---------------------------------------------------------------------------- +// Check for current view mode .Grid/fullscreen/imgviewer +//---------------------------------------------------------------------------- +// +TBool CGlxToolbarController::IsFullScreenView() + { + TBool fullscreenViewingMode = EFalse; + + CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); + CMPXCollectionPath* naviState = aNavigationalState->StateLC(); + + if ( naviState->Levels() >= 1) + { + if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) + { + // For image viewer collection, goto view mode + if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + { + // current view mode is img vwr + fullscreenViewingMode = ETrue; + } + else + { + //current view mode is Grid + fullscreenViewingMode = EFalse; + } + } + else + { + //current view mode is Fullscreen + fullscreenViewingMode = ETrue; + } + } + CleanupStack::PopAndDestroy( naviState ); + aNavigationalState->Close(); + return fullscreenViewingMode; + } +//end os file + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/viewbase/src/glxviewbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/viewbase/src/glxviewbase.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,637 @@ +/* +* Copyright (c) 2008-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: View Base implementation +* +*/ + + + + +#include "glxviewbase.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CGlxResourceUtilities +#include +#include +#include +#include "glxcommandhandler.h" + +_LIT(KGlxViewBaseResource, "glxviewbase.rsc"); + +/// Length of time a view-switch animation should take +const TInt KGlxViewSwitchAnimationDuration = 1000 * KGlxAnimationSlowDownFactor; + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxViewBase::CGlxViewBase(TBool aSyncActivation) : + iViewAnimationTime(KGlxViewSwitchAnimationDuration), + iViewAnimationInProgress(EGlxViewAnimationNone), + iSyncActivation(aSyncActivation) + { + TRACER( "CGlxViewBase::CGlxViewBase()" ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxViewBase::~CGlxViewBase() + { + TRACER( "CGlxViewBase::~CGlxViewBase" ); + iCommandHandlerList.ResetAndDestroy(); + + if ( iUiUtility ) + { + iUiUtility->Close(); + iUiUtility = NULL; + } + + if ( iViewBaseResourceOffset ) + { + iCoeEnv->DeleteResourceFile( iViewBaseResourceOffset ); + } + + if ( iUiUtilitiesResourceOffset ) + { + iCoeEnv->DeleteResourceFile( iUiUtilitiesResourceOffset ); + } + + if ( iViewActivateCallback ) + { + iViewActivateCallback->Cancel(); + delete iViewActivateCallback; + } + + delete iCustomMessage; + } + +// ----------------------------------------------------------------------------- +// ViewBaseConstructL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::ViewBaseConstructL() + { + TRACER( "CGlxViewBase::ViewBaseConstructL" ); + // Load resources + TFileName resourceFile(KDC_APP_RESOURCE_DIR); + resourceFile.Append(KGlxViewBaseResource); + CGlxResourceUtilities::GetResourceFilenameL(resourceFile, + iCoeEnv->FsSession()); + iViewBaseResourceOffset = iCoeEnv->AddResourceFileL(resourceFile); + + // Load UiUtilities resources, for wait dialog + TFileName uiUtilsResourceFile( KDC_APP_RESOURCE_DIR ); + uiUtilsResourceFile.Append( KGlxUiUtilitiesResource ); + CGlxResourceUtilities::GetResourceFilenameL(uiUtilsResourceFile, + iCoeEnv->FsSession()); + iUiUtilitiesResourceOffset = iCoeEnv->AddResourceFileL(uiUtilsResourceFile); + + iUiUtility = CGlxUiUtility::UtilityL(); + + iViewActivateCallback = new (ELeave) CAsyncCallBack ( TCallBack ( ViewActivateCallbackL, this ), + CActive::EPriorityStandard); + iCustomMessage = HBufC8::NewL(0); + } + +// ----------------------------------------------------------------------------- +// AddCommandHandlerL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::AddCommandHandlerL(CGlxCommandHandler* aCommandHandler) + { + TRACER( "CGlxViewBase::AddCommandHandlerL" ); + if ( aCommandHandler ) + { + CleanupDeletePushL( aCommandHandler ); + if ( KErrNotFound == iCommandHandlerList.Find( aCommandHandler )) + { + iCommandHandlerList.AppendL(aCommandHandler); + DoPrepareCommandHandlerL(aCommandHandler); + } + CleanupStack::Pop( aCommandHandler ); + } + else + { + User::Leave(KErrArgument); + } + } + +// ----------------------------------------------------------------------------- +// HandleCommandL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::HandleCommandL(TInt aCommand) + { + TRACER( "CGlxViewBase::HandleCommandL" ); + if(iViewActivated) // Act on this Command if view is Activated or Pass to AppUi + { + if ( EAknSoftkeyBack == aCommand ) + { + iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards); + } + else if ( EAknCmdOpen == aCommand ) + { + iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); + } + + if ( EGlxCmdOptions == aCommand ) + { + FetchAttributesL(); + // Open the options menu properly + ProcessCommandL(EAknSoftkeyOptions); + } + else + { + // Fetch the attributes required to execute the command provided it is not one of + // the state changing commands (EGlxCmdStateView and EGlxCmdStateBrowse) + if (aCommand != EGlxCmdStateView && aCommand != EGlxCmdStateBrowse) + { + FetchAttributesForCommandL(aCommand); + } + + TBool handled = EFalse; + + // Pass the command to the command handlers + TInt count = iCommandHandlerList.Count(); + TInt i = count - 1; + + // Iterating backwards to give last-added handlers chance to override + while ( i >= 0 && !handled ) + { + handled = iCommandHandlerList[i]->ExecuteL( aCommand ); + i--; + } + + if ( !handled ) + { + // Give the implemented view chance at handling the command + handled = DoHandleCommandL(aCommand); + } + + if ( !handled ) + { + // None of the command handlers have handled it, pass it on to the AppUi + AppUi()->HandleCommandL(aCommand); + } + } + } + else + { + // Command Not Handled + AppUi()->HandleCommandL(aCommand); + } + } + +// ----------------------------------------------------------------------------- +// DynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + TRACER( "CGlxViewBase::DynInitMenuPaneL" ); + TInt count = iCommandHandlerList.Count(); + + // NB Member variable used for loop counter, so if the user interrupts (e.g. Cancels the wait + // dialog), we know which command handler we need to stop (see DialogDismissedL) + for (TInt i = 0; i < count; i++ ) + { + iCommandHandlerList[i]->PreDynInitMenuPaneL( aResourceId ); + } + + // Allow implementing view to filter menu first + ViewDynInitMenuPaneL(aResourceId, aMenuPane); + + for (TInt i = 0; i < count; i++ ) + { + iCommandHandlerList[i]->DynInitMenuPaneL( aResourceId, aMenuPane ); + } + } + + +// ----------------------------------------------------------------------------- +// SetTitleL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::SetTitleL(const TDesC& aTitleText) + { + TRACER( "CGlxViewBase::SetTitleL" ); + iTitlePane = GetTitlePaneL(); + if(iTitlePane) + { + iTitlePane->SetTextL(aTitleText); + } + //StatusPane()->MakeVisible(ETrue); + } + +// ----------------------------------------------------------------------------- +// DisableTitleL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::DisableTitle() + { + TRACER( "CGlxViewBase::DisableTitle" ); + //StatusPane()->MakeVisible(EFalse); + } + +// DoActivateL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) + { + TRACER( "CGlxViewBase::DoActivateL" ); + // Store view activate values + iPrevViewId = aPrevViewId; + iCustomMessageId = aCustomMessageId; + + delete iCustomMessage; + iCustomMessage = NULL; + iCustomMessage = HBufC8::NewL( aCustomMessage.Length() ); + + TPtr8 customMessagePtr = iCustomMessage->Des(); + customMessagePtr.Copy( aCustomMessage ); + + // show the view specific toolbar + CAknToolbar* toolbar = Toolbar(); + + // Get the pointer to the application toolbar + // (when there isn't a view specific toolbar) to set it visible + if ( !toolbar ) + { + toolbar = AppUi()->PopupToolbar(); + } + else + { + // Deactivate the toolbar untill the view gets activated properly. + toolbar->SetDimmed(ETrue); + toolbar->DrawNow(); + } + toolbar->SetToolbarVisibility(ETrue); + + // View should be activated asynchronously, since there can be a lot of processing + // that may result in the view being in an indeterminate state if it leaves + + // HOWEVER, making the view asynchronous breaks the assumptions of the slideshow design + // and results in slideshow not functioning correctly + // Therefore, we have used the following nasty workaround to make this work, + // otherwise, either view activation or slideshow would require considerable refactoring + // TODO: This should be refactored whenever the opportunity arises + // + // The workaround is to have a flag to determine if the view should be activated + // synchronously or asynchronously. + if ( iSyncActivation ) + { + ViewActivateL(); + } + else + { + if ( !iViewActivateCallback->IsActive() ) + { + iViewActivateCallback->CallBack(); + } + } + } + +// ----------------------------------------------------------------------------- +// DoDeactivate +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::DoDeactivate() + { + TRACER( "CGlxViewBase::DoDeactivate" ); + // hide the view specific toolbar + CAknToolbar* toolbar = Toolbar(); + + // Get the pointer to the application toolbar + // (when there isn't a view specific toolbar) to hide it properly + if ( !toolbar ) + { + toolbar = AppUi()->PopupToolbar(); + } + toolbar->SetToolbarVisibility(EFalse); + // Clear the toolbar background as well + toolbar->MakeVisible(EFalse); + + if ( iViewActivateCallback->IsActive() ) + { + iViewActivateCallback->Cancel(); + } + + CancelViewAnimation(); + + // Deactivate command handlers + TInt count = iCommandHandlerList.Count(); + TInt i = 0; + + while ( i < count ) + { + iCommandHandlerList[i]->Deactivate(); + i++; + } + + TRAP_IGNORE(InitAnimationL(EGlxViewAnimationExit)); + } + + +// ----------------------------------------------------------------------------- +// CGlxViewBase::FetchAttributesL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::FetchAttributesL() + { + TRACER( "CGlxViewBase::FetchAttributesL" ); + // No implementation required + } + +// ----------------------------------------------------------------------------- +// CGlxViewBase::FetchAttributesForCommandL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::FetchAttributesForCommandL(TInt /*aCommand*/) + { + TRACER( "CGlxViewBase::FetchAttributesForCommandL" ); + // No implementation required + } + +// ----------------------------------------------------------------------------- +// Handles a view activation event from viewserv. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::ViewActivatedL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ) + { + TRACER("CGlxViewBase::ViewActivatedL()"); + if ( dynamic_cast( iEikonEnv->EikAppUi() ) ) + { + CAknView::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage); + } + else + { + GLX_LOG_INFO("Not in CAknViewAppUi -> CAknView::AknViewActivatedL()"); + AknViewActivatedL( aPrevViewId, aCustomMessageId, aCustomMessage ); + } + } + +// ----------------------------------------------------------------------------- +// Handles a view deactivation event from viewserv. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::ViewDeactivated() + { + TRACER("CGlxViewBase::ViewDeactivated()"); + if ( dynamic_cast( iEikonEnv->EikAppUi() ) ) + { + CAknView::ViewDeactivated(); + } + else + { + GLX_LOG_INFO("Not in CAknViewAppUi -> DoDeactivate()"); + DoDeactivate(); + } + } + + +// ----------------------------------------------------------------------------- +// HandleViewCommandL +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxViewBase::HandleViewCommandL(TInt /*aCommand*/) + { + TRACER( "CGlxViewBase::HandleViewCommandL" ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// ViewDynInitMenuPaneL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::ViewDynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/) + { + TRACER( "CGlxViewBase::ViewDynInitMenuPaneL" ); + // No implementation - derived classes may override this + } + +// ----------------------------------------------------------------------------- +// ViewAnimationSupported +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxViewBase::ViewAnimationSupported(TGlxViewswitchAnimation /*aType*/) + { + TRACER( "CGlxViewBase::ViewAnimationSupported" ); + // Default implementation - may be overridden + return EFalse; + } + +// ----------------------------------------------------------------------------- +// DoViewAnimationL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::DoViewAnimationL(TGlxViewswitchAnimation /*aType*/, TGlxNavigationDirection /*aDirection*/) + { + TRACER( "CGlxViewBase::DoViewAnimationL" ); + // Do nothing by default + } + +// ----------------------------------------------------------------------------- +// SetToolbarStateL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::SetToolbarStateL() + { + TRACER( "CGlxViewBase::SetToolbarStateL" ); + // Derived MediaListViewBase has the implementation. + } + +// ----------------------------------------------------------------------------- +// InitAnimationL +// ----------------------------------------------------------------------------- +// +void CGlxViewBase::InitAnimationL(TGlxViewswitchAnimation aType) + { + TRACER( "CGlxViewBase::InitAnimationL" ); + if ( ViewAnimationSupported(aType) ) + { + /*@@ + /// @todo : Remove hack when TAlfTimedValue fixed + iViewAnimationTimedValue.Now(); // Hack to force reevaluation of internal "interpolating" flag: otherwise + // call to RemainingTime() returns a hugely wrong number + + TInt remainingTime = iViewAnimationTimedValue.RemainingTime(); + + iViewAnimationTimedValue.Set(1 - iViewAnimationTimedValue.Now()); // In case previous animation is incomplete + // Assumes opposite animations happen in sequence: entry - exit - entry etc + iViewAnimationTimedValue.Set(1, KGlxViewSwitchAnimationDuration - remainingTime); */ + + DoViewAnimationL(aType, iUiUtility->ViewNavigationDirection()); + iViewAnimationInProgress = aType; + } + else + { + // Immediately complete animation + ViewAnimationComplete(aType); + } + } + +// ----------------------------------------------------------------------------- +// AnimationComplete +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::AnimationComplete(MGlxAnimation* /*aAnimation*/) // From MGlxAnimationObserver + { + TRACER( "CGlxViewBase::AnimationComplete" ); + CancelViewAnimation(); + } + +// ----------------------------------------------------------------------------- +// OfferToolbarEventL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::OfferToolbarEventL( TInt aCommand ) + { + TRACER( "CGlxViewBase::OfferToolbarEventL" ); + CAknToolbar* toolbar = Toolbar(); + if(toolbar) + { + // Deactivate the toolbar. Don't accept the toolbar input when the command + // execution is already in progress. + toolbar->SetDimmed(ETrue); + toolbar->DrawNow(); + + // Execute the command recieved. + ProcessCommandL(aCommand); + + // Activate back the toolbar and set it's state properly + // after command execution. + SetToolbarStateL(); + } + } + +// ----------------------------------------------------------------------------- +// SetToolbarObserver +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxViewBase::SetToolbarObserver(MAknToolbarObserver* aObserver) + { + TRACER( "CGlxViewBase::SetToolbarObserver" ); + //Register the view to recieve toolbar events. ViewBase handles the events + if ( Toolbar() ) + { + Toolbar()->SetToolbarObserver( aObserver ); + } + } + +// ----------------------------------------------------------------------------- +// CancelViewAnimation +// ----------------------------------------------------------------------------- +// +void CGlxViewBase::CancelViewAnimation() + { + TRACER( "CGlxViewBase::CancelViewAnimation" ); + if ( iViewAnimationInProgress != EGlxViewAnimationNone ) + { + ViewAnimationComplete(iViewAnimationInProgress); + iViewAnimationInProgress = EGlxViewAnimationNone; + } + } + +// ----------------------------------------------------------------------------- +// ViewAnimationComplete +// ----------------------------------------------------------------------------- +// +void CGlxViewBase::ViewAnimationComplete(TGlxViewswitchAnimation aType) + { + TRACER( "CGlxViewBase::ViewAnimationComplete" ); + if ( aType == EGlxViewAnimationExit ) + { + // Deactivate view + DoViewDeactivate(); + iViewActivated = EFalse; // View is DeActivated + } + } + +//------------------------------------------------------------------------------ +// GetTitlePaneControlL +//------------------------------------------------------------------------------ +// +CAknTitlePane* CGlxViewBase::GetTitlePaneL() + { + TRACER( "CGlxViewBase::GetTitlePaneL" ); + + return (( CAknTitlePane* )StatusPane()->ControlL + (TUid::Uid( EEikStatusPaneUidTitle ))); + } + +// ----------------------------------------------------------------------------- +// DoHandleCommandL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxViewBase::DoHandleCommandL(TInt /*aCommand*/) + { + TRACER( "CGlxViewBase::DoHandleCommandL" ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Callback for view activate +// ----------------------------------------------------------------------------- +// +TBool CGlxViewBase::ViewActivateCallbackL(TAny* aPtr) + { + TRACER( "CGlxViewBase::ViewActivateCallbackL()" ); + __ASSERT_DEBUG( aPtr, Panic( EGlxPanicNullPointer ) ); + static_cast( aPtr )->ViewActivateL(); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// Perform view activate +// ----------------------------------------------------------------------------- +// +void CGlxViewBase::ViewActivateL() + { + TRACER("CGlxViewBase::ViewActivateL()"); + CancelViewAnimation(); + + // View is Activated + iViewActivated = ETrue; + DoViewActivateL( iPrevViewId, iCustomMessageId, *iCustomMessage ); + + TInt count = iCommandHandlerList.Count(); + TInt i = 0; + + while ( i < count ) + { + iCommandHandlerList[i]->ActivateL(Id().iUid); + i++; + } + + InitAnimationL(EGlxViewAnimationEntry); + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/bwins/glxzoomviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/bwins/glxzoomviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ?ActivateL@CGlxZoomControl@@QAEXHW4TZoomStartMode@@HAAVTGlxMedia@@PAVTPoint@@@Z @ 1 NONAME ; void CGlxZoomControl::ActivateL(int, enum TZoomStartMode, int, class TGlxMedia &, class TPoint *) + ?HandleZoomForegroundEvent@CGlxZoomControl@@QAEXH@Z @ 2 NONAME ; void CGlxZoomControl::HandleZoomForegroundEvent(int) + ?Activated@CGlxZoomControl@@QAEHXZ @ 3 NONAME ; int CGlxZoomControl::Activated(void) + ?NewL@CGlxZoomControl@@SAPAV1@AAVMGlxUiCommandHandler@@AAVMGlxMediaList@@AAVCEikButtonGroupContainer@@AAVIMulSliderWidget@Alf@@PAVCGestureHelper@GestureHelper@@@Z @ 4 NONAME ; class CGlxZoomControl * CGlxZoomControl::NewL(class MGlxUiCommandHandler &, class MGlxMediaList &, class CEikButtonGroupContainer &, class Alf::IMulSliderWidget &, class GestureHelper::CGestureHelper *) + ?Deactivate@CGlxZoomControl@@QAEXXZ @ 5 NONAME ; void CGlxZoomControl::Deactivate(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/eabi/glxzoomviewu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/eabi/glxzoomviewu.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,11 @@ +EXPORTS + _ZN15CGlxZoomControl10DeactivateEv @ 1 NONAME + _ZN15CGlxZoomControl25HandleZoomForegroundEventEi @ 2 NONAME + _ZN15CGlxZoomControl4NewLER20MGlxUiCommandHandlerR13MGlxMediaListR24CEikButtonGroupContainerRN3Alf16IMulSliderWidgetEPN13GestureHelper14CGestureHelperE @ 3 NONAME + _ZN15CGlxZoomControl9ActivateLEi14TZoomStartModeiR9TGlxMediaP6TPoint @ 4 NONAME + _ZN15CGlxZoomControl9ActivatedEv @ 5 NONAME + _ZTI15CGlxZoomControl @ 6 NONAME + _ZTI23CGlxZoomPanEventHandler @ 7 NONAME + _ZTV15CGlxZoomControl @ 8 NONAME + _ZTV23CGlxZoomPanEventHandler @ 9 NONAME + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/group/glxzoomview.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/group/glxzoomview.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + +#include +#include "../../../../group/glxbuildcommon.mmh" +#include "../../../../inc/glxalfhelper.mmh" + + +#include + +TARGET glxzoomview.dll +TARGETTYPE dll +UID 0x1000008d 0x200071CB + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxzoomcontrol.cpp +SOURCE glxzoomeventhandler.cpp +SOURCE glxzoommathsengine.cpp + +USERINCLUDE ../inc + +// System includes from the source tree +SYSTEMINCLUDE ../inc +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../../../inc +SYSTEMINCLUDE ../../../medialists/inc +SYSTEMINCLUDE ../../../uiutilities/inc +SYSTEMINCLUDE ../../fullscreenview/inc +SYSTEMINCLUDE ../../../texturemanager/inc +SYSTEMINCLUDE ../../../tvout/inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY avkon.lib +LIBRARY euser.lib +LIBRARY eikcoctl.lib // CEikButtonGroupContainer +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxtexturemanager.lib +LIBRARY mpxcommon.lib +LIBRARY commonengine.lib // stringloader +LIBRARY alfclient.lib // ALF framework +LIBRARY alfwidgetmodel.lib // AlfWidgetModel +LIBRARY flogger.lib +LIBRARY centralrepository.lib +LIBRARY exiflib.lib +LIBRARY efsrv.lib +LIBRARY gesturehelper.lib +LIBRARY cone.lib +LIBRARY glxtvout.lib +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/inc/glxzoomcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/inc/glxzoomcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2008-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: Definition of CGlxZoomControl + * +*/ + + +#ifndef C_GLXZOOMCONTROL_H +#define C_GLXZOOMCONTROL_H + +// INCLUDES + +#include // For TEventCode + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include // for inteface MGlxTvObserver +//Gesture Helper namespace +namespace GestureHelper + { + class CGestureHelper; + } + + +namespace Alf + { + class IAlfViewWidget; + class IMulSliderWidget; + class IMulSliderModel; + class IAlfWidgetEventHandler; + } +// FORWARD DECLARATIONS +class CGlxDefaultAttributeContext; +class CGlxUiUtility; +class MGlxUiCommandHandler; +class CAlfImageVisual; +class CAlfViewportLayout; +class TAlfImage; +class CEikButtonGroupContainer; +class CGlxTextureManager; +class CGestureHelper; +class MGestureObserver; + +class CGlxTv; +using namespace Alf; + +// Commands sent to the view in response to zoom keys +const TInt KGlxZoomInCommand = 1 ; +const TInt KGlxZoomOutCommand = 2 ; +const TInt KGlxVerticalImageOrientationThreshold = 4 ; + +/** + * Control for zooming in the FullScreen view. + * @ingroup glx_view_zoomed_view + */ +class CGlxZoomControl : public CAlfControl, + public IAlfWidgetEventHandler, + public MGlxTextureObserver, + public MGlxZoomEventHandlers, + public GestureHelper::MGestureObserver, + public MGlxTvObserver + { +public: + // Constructors and destructor + /** + * Two-phased constructor. + * @param aCommandHandler: Handler for commands. + * @param aMediaList : Reference to media list. + * @param aZoomKeys : Reference to Back Key. + * @param aSliderWidget : Reference to slider widget created in fullscreen view. + */ + IMPORT_C static CGlxZoomControl* NewL( + MGlxUiCommandHandler& aCommandHandler, + MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomKeys, + IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper); + + /** + * Destructor. + */ + ~CGlxZoomControl(); + + /** + * Show the control and begin zooming in. + * @param aIntialZoomLevel:The Initial Zoom Level shown when zoom is active from full screen view. + * @param aTap :if the zoom was launched by tapping or by pressing volume key. + */ + IMPORT_C void ActivateL(TInt aIntialZoomRatio,TZoomStartMode aStartMode,TInt aFocusIndex, + TGlxMedia& aItem, TPoint* aZoomFocus = NULL); + + /** + * Hide the control and disable zooming. + */ + IMPORT_C void Deactivate(); + + /** + * to check if the zoom control is activated? + */ + IMPORT_C TBool Activated(); + + /** + * Zoom Foreground event handling function + * @param aForeground: value signify if it is in foreground or not. + */ + IMPORT_C void HandleZoomForegroundEvent(TBool aForeground); + + void UpdateViewPort( + TPoint& aViewPortTopLeft , + TInt aTransitionTime , + TSize *apViewPortDimension = NULL, + TInt aPrimarySliderLevel = -1); +private:// From MGlxTvObserver + virtual void HandleTvStatusChangedL ( TTvChangeType aChangeType ); + +private: // From CAlfControl + TBool OfferEventL(const TAlfEvent &aEvent); + + void VisualLayoutUpdated(CAlfVisual &aVisual); + +private: //From IAlfWidgetEventHandler + AlfEventStatus offerEvent( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ); + + bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const; + + void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData ); + + AlfWidgetEventHandlerInitData* eventHandlerData(); + + void setActiveStates( unsigned int aStates ); + + IAlfInterfaceBase* makeInterface( const IfId& aType ); + + AlfEventHandlerType eventHandlerType() ; + + AlfEventHandlerExecutionPhase eventExecutionPhase() ; + +private: // From MGlxTextureObserver + void TextureContentChangedL( TBool aHasContent , CAlfTexture* aNewTexture); + +private: // From MGlxZoomEventHandlers + void HandleViewPortParametersChanged(TPoint& aViewPortTopLeft , + TInt aTransitionTime , + TSize *apViewPortDimension = NULL, + TInt aPrimarySliderLevel = -1); + + void HandleShowUi(TBool aShow= EFalse) ; + + void HandleZoomOutL(TInt aCommandId); +private: + /* + * Call back function for the CPeriodic + */ + static TInt TimeOut(TAny* aSelf); + void ActivateFullscreen(); + void StartZoomAnimation(); + +private: + /** + * C++ default constructor. + */ + CGlxZoomControl(MGlxUiCommandHandler& aCommandHandler, + MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomKeys, + IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper); + /** + * Does the necessary Initialization of iUiUtility,control group and the Media list. + */ + void ConstructL(); + /** + * Creation of zoomvisual:creates the zoom visual and sets the Black Background behind the image + * and also sets the ViewPort Layout. + */ + void CreateZoomVisualL(); + /** + * Turn the UI/Screen Furniture[Back Key/Slider] on + */ + void ShowUi(TBool aShow); + + /** + * Cleanup function resets all the memeber variable on deactivating the ZoomControl + */ + void CleanUpVisual(); + + /* + * Get Orientation of the file , + * This code is DUPLICATE and second copy implemented in bitmapdecoder, + * Got to plan for removing this duplicacy + */ + TUint16 GetOrientationL(const TDesC& aFileName) ; + + /* + * This Function Shows/Hides the zoom + * by setting the level of Opacity + */ + void ShowZoom(TBool aShow); + + /* + * Retrieves the Screensize with the help of Alf utility + */ + TSize ScreenSize(); + + void HandleGestureL( const GestureHelper::MGestureEvent& aEvent ); + + TBool HandlePointerEventsL(const TAlfEvent &aEvent); + + TInt GetIntialZoomLevel(TSize& aSize ); + +private: // Data + CAlfEnv* iEnv; // AlfEnv + MGlxMediaList& iMediaList; // Medialist (not owned) + GestureHelper::CGestureHelper* iGestureHelper; // Attribute context for image dimensions + IMulSliderModel* iZoomSliderModel; // Zoom slider model + IMulSliderWidget& iZoomSliderWidget; // Zoom slider Widget + CEikButtonGroupContainer* iZoomBackKey; // Back zoom soft key(not owned) + CGlxDefaultAttributeContext* iAttributeContext; // Attribute context for image dimensions + + CAlfDisplay* iDisplay; // Alf Display + CGlxUiUtility* iUiUtility; // UI utility + CGlxTextureManager* iTextureMgr; // TextureManager + CAlfControlGroup* iControlGroup; // Control group for the Zoom control + + CAlfViewportLayout* iViewPort; // Parent Layout for Zooming/Panning + CAlfImageVisual* iImageVisual; // Child visual for normal image items (not owned) + CAlfTexture* iImageTexture; // Texture to be zoomed + + TBool iIsdrag; // To determine if drag occured to evaluate the single tap + TBool iZoomActive; // This variable is updated when Zoom is activated. + TSize iOriginalDimensions; + + MGlxUiCommandHandler& iCommandHandler; // For Handling ZoomOut commands + CGlxZoomPanEventHandler* iEventHandler; // The event handler for the Zoom Pan Engine + + TSize iScreenSize; + TBool iMultiTouchGestureOngoing; + CGlxTv* iGlxTvOut; + CPeriodic* iTimer; + TBool iZoomIn; + }; + +#endif // C_GLXZOOMCONTROL_H + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/inc/glxzoomeventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/inc/glxzoomeventhandler.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,305 @@ +/* +* Copyright (c) 2008-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: Zoom Event Handler +* +*/ + +#ifndef GLXZOOMEVENTHANDLER_H_ +#define GLXZOOMEVENTHANDLER_H_ + +#include "glxzoomview.hrh" +#include "glxfullscreenview.hrh" +#include "glxzoommathsengine.h" + +//Alf Headers +#include // For Key Events +#include // for TAlfRealPoint +#include + +#include +#include +#include + +// FORWARD DECLARATIONS +class CGlxZoomControl; +class TGlxZoomAndPanMathsEngine; +class MGlxZoomEventHandlers; + +class CGlxZoomPanEventHandler : public CBase + { +public: + /** + * Two-phased constructor. + * @param aZoomEventHandler: Handler for ZoomControl commands. + */ + static CGlxZoomPanEventHandler* NewL(MGlxZoomEventHandlers& aZoomEventHandler ); + + /** + * Destructor. + */ + ~CGlxZoomPanEventHandler(); + + /** + * Two stop shop to handle all alf events. [PRASH] Make this a one stop shop + */ + TBool HandleEventL(const TAlfEvent &aEvent ); + + TBool HandleEvent( const TAlfEvent& aEvent ); + + /** + * Cancel the timer for continous zooming + */ + void CancelZoomPanTimer(); + + /* + * ActivateZoom from the Zoom control + */ + void ActivateZoom(TInt initialZoomRatio, + TSize imageSize, + TZoomStartMode aStartMode, + TInt aMinSliderRange, + TInt aMaxSliderRange, + TSize& aOriginalDimensions, + TPoint* aZoomFocus); + + /* + * DeactivateZoom from the Zoom control + */ + void DeactivateZoom(); + + /* + * OrientationChanged + */ + void OrientationChanged(const TRect& aNewScreenRect) ; + + /* + * ZoomIsActivated + * This is called when the zoom is activated/deactivated from Zoom control + */ + void SetZoomActivated(TBool aIsActivated = EFalse); + + /* + * ZoomUiState + * This is called when the zoom state in Zoom control is changed + */ + void SetZoomUiState(TUiState aZoomUiState); + + /* + * ZoomUiState + * This is called when the zoom state in Zoom control is changed + */ + TUiState ZoomUiState(); + + /** + * Handle the drag events for panning + */ + void HandleDragEvent(const GestureHelper::MGestureEvent& aEvent ); + + void HandlePinchEventL(const GestureHelper::MGestureEvent& aEvent); + + void HandleDoubleTap(const GestureHelper::MGestureEvent& aEvent ); + + void HandleSingleTap(const GestureHelper::MGestureEvent& aEvent ); + + void HandleGestureReleased(const GestureHelper::MGestureEvent& aEvent ); + + void SetPreviousEventCode(const GestureHelper::TGestureCode code ); + + void HandleMultiTouchReleased(); + +private: + /* + * Constructor + */ + CGlxZoomPanEventHandler(MGlxZoomEventHandlers& aZoomEventHandler); + + /* + * ConstructL + */ + void ConstructL(); + + /** + * This Function handles all the KeyEvents + */ + TBool HandlekeyEvents(const TAlfEvent &aEvent); + + /** + * Callback function for zoom + */ + static TInt ZoomIntervalExpired(TAny* aPtr); + + /** + * Callback function for pan + */ + static TInt PanIntervalExpired(TAny* aPtr); + + /** + * Start zoom in/out continously + */ + void DoZoom(); + + // Zoom by the next zoom increment. + // aZoomMode is ignored if aExpectedZoomLevel has a positive value + void Zoom(TInt aExpectedZoomLevel, TInt aRelativeZoomFactor, TZoomMode aZoomMode = EZoomIn, TPoint* aZoomFocus = NULL); + /** + * Start Panning continously + */ + void DoPan(); + + /** + * Starts the timer for continous zooming + */ + void StartZoomTimer(); + + /** + * Starts the timer for continous Panning + */ + void StartPanTimer(); + + /** + * Stops the timer for showing the UI. + */ + void CancelUITimer(); + + /** + * Starts the timer for showing the UI. + */ + void StartUITimer(TTimeIntervalMicroSeconds32 aDelay, + TTimeIntervalMicroSeconds32 anInterval, + TCallBack aCallBack) ; + + /** + *Call back function to Turn off UI/Screen Furniture[Back Key/Slider]. + */ + static TInt UiTimeOut(TAny* aSelf); + + /* + * Timer callback for zoomout + */ + static TInt ZoomOutTimerL(TAny* aSelf); + + /** + * Handle zoom key pressed or released. + * @param aZoomIn :ETrue for Zoom In key, EFalse for Zoom Out key + * @param aEventCode :Type of key event. + */ + void HandleZoomKey(TZoomMode aZoomMode, const TEventCode aEventCode); + + /** + * Handle the key events for panning + * @param aPanDirection: Specifies the pan direction + * @param aEvent : Specifies the event values. + */ + TBool HandlePanKey(const TAlfEvent &aEvent); + + /** + * Handle zoom stripe key pressed. + * @param aZoomIn :ETrue for Zoom In key, EFalse for Zoom Out key + * @param aEventCode :Type of key event. + */ + void HandleZoomStripeAction(TZoomMode aZoomMode ,TEventCode aEventCode); + + /** + * Handle the drag events for panning + */ + void HandleDragEvent(const TPoint &aTapPoint); + + /* + * ShowSliderTillTimeout + */ + void ShowSliderTillTimeout() ; + + /* + * ShowScreenFurniture + * aTimeout == 0 means no timeout. + */ + void ShowScreenFurniture(TTimeIntervalMicroSeconds32 aTimeout); + + /* + * HideScreenFurniture + */ + void HideScreenFurniture(); + + /* + * SetupPanOperation + */ + void SetupPanOperation(TPoint& aPanDirection); + + void CallZoomOutL(); + + void SetupAnimatedZoom(TZoomMode aZoomMode, TPoint * aZoomFocus = NULL); + + static TInt ActivationIntervalElapsed(TAny* aPtr) ; + + void NextStepAnimatedZoom(); + + void SetupAnimatedPan() ; + + static TInt PanInertiaFrameElapsed(TAny* aPtr); + + void NextStepInerticPan(); + + void CancelAnimationTimer(); + + + +private: + MGlxZoomEventHandlers& iZoomEventHandler; + + TTime iPanTime; // The Purpose of this Variable is to determine the Time,for how long the key was held + TZoomMode iZoomMode; // Says whether we are zooming in or out. + TPoint iPanDirection; // This gives the direction of the panning that has to be done + TInt iMinZoomRatio; // The minimum value that the Zoom Slider will have + TInt iMaxZoomRatio; // The maximum value that the Zoom Slider will have + + CPeriodic* iUiTimer; // The Timer used to Hide the UI/Screen Furniture[Back Key/Slider] after 2 seconds + CPeriodic* iZoomPanTimer; // The Timer used for Zooming/Panning the Image Exponentially + TPoint iStartDisplayPoint; // The variable holds the starting pointer posistion to determine the Drag Distance + TTime iDoubleTap; // This Variable is used to determine the double tap,by using the difference of the time + // between subsequent single Tap. + // [todo] do we need this variable to be global + TInt iZoomRatio; + TRect iDoubleTapRect; // This varaible holds the rect for the Double Tap + TBool iDragOngoing; // Is a drag event ongoing + TBool iZoomActivated; // To Denote if zoom is activated + TUiState iZoomUiState; // To Denote if the Ui is On in zoom + + TPoint iPreviousPointerPosition; + TPoint iPreviousDragStartPosition; + + // for the animated zoom to 50 % allowed. + TBool iIsZoomingInAnimatedState; + TAnimationMode iAnimatedZoomMode; + CPeriodic* iZoomAnimationTimer; + TInt iZoomPerInterval; + TInt iTargetAnimatedZoomRatio; + // for the animated zoom to 50 % allowed. END + + // For considering Zoom Focus. + TPoint iZoomFocus; // Not used right now. WIll soon carry the coordinates of the zoom focus. + // For considering Zoom Focus. END + + // For Pan Inertia. + GestureHelper::TGestureCode iPreviousGestureCode ; + // For Pan Inertia. END + + + + TGlxZoomAndPanMathsEngine iMathsEngine; // The new Maths engine at the core of the Zoom Component + + + }; + + +#endif /* GLXZOOMEVENTHANDLER_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/inc/glxzoommathsengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/inc/glxzoommathsengine.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2008-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: Declaration of Maths Engine +* +*/ + +#ifndef GLXZOOMMATHSENGINE_H_ +#define GLXZOOMMATHSENGINE_H_ + + +// INCLUDE FILES +#include + +#include + +NONSHARABLE_CLASS( TGlxZoomAndPanMathsEngine ) + { +public: + + /** + * Starts panning with keys + *@ param aOffset:Specifies the offset value with which image has to be shifted/panned + */ + void Pan(TPoint aOffset, + TPoint& aViewPortTopLeft, + TGlxPanIncrementType aPanIncrement, + TBool* aThresholdReached = NULL); + + /** + * Starts zooming In/out with slider/Keys + * @ param aMfactor:The Zooming factor with which image has to be zoomed + */ + TInt Zoom( TZoomMode aZoomMode, // Ignored when aExpectedZoomRatio has a value + TInt aExpectedZoomRatio, // only for slider based zoom. = 0 for key based zoom. + TPoint& aViewPortTopLeft, + TSize& aViewPortDimension, + TBool* apThresholdReached = NULL, + TPoint* apZoomFocus = NULL, + TInt aRelativeZoomFactor = 0); + + // Initialize + void Initialize(TPoint& aCenter, + TSize& aScreenSize, + TSize& aImageSize, + TSize& aOriginalZoomedDimensions, + TUint8 aInitialZoomRatio); + + void UpdatePanFactor(TTime& aPanTime); + + // this can have a more generic name. but now it informs only abt screen orientation changes. and hence the name + void OrientationChanged(const TRect& aNewScreenRect); + + TSize ImageVirtualSize(); + + TSize ScreenSize(); + + TInt NewCenterCoordinate(TInt Center, + TInt Offset, + TUint16 HalfScreenDimension, + TInt MinimumCoordinate, + TInt MaximumCoordinate, + TBool *aLimitReached = NULL) ; + + void SetupPanOperation(); + + TPoint LastPanOffset(); + +private: + + /** + * Get the next Zoomlevel on the basis of Zoom In/Out + * @ param aZoomMode:Specifies the zoomode,whether it is Zoom In/Out + * + * We ignore aZoommode and aRelativeZoomFactor if we have a aExpectedZoomRatio. + * We ignore aZoommode if we have a aRelativeZoomFactor. + * + */ + TInt NewZoomRatio( + TInt aExpectedZoomRatio, + TInt aRelativeZoomFactor, + TZoomMode aZoomMode, + TBool *aThresholdReached = NULL) ; + + TPoint iCenter ; + TSize iScreenSize ; + TSize iImageVirtualSize ; + TSize iActualImageSize ; + + // The Purpose of this Variable is to set the No:of pixels, by which it should Pan, + // when the Key is held for long time. + TUint8 iPanFactor ; + // No of continuous pan operations that have happened. This is used in calculating the pan factor + TInt iContinuousPanOperations; + + // These are the thresholds + TUint8 iMaxZoomRatio; + TUint8 iMinZoomRatio ; + TSize iInitialImageSize ; + + // This is what our current zoom ratio is in percentage + TReal iZoomRatio; + + TPoint iPanSpeed; // Pixels Panned per pan operation in vector form. + TPoint iLastPanOffset; // Pixels Panned during the last pan operation. + + // [TODO]:Tsize might not be an exact match for this. using this only since it has exactly all the parameters that are required. + TSize iBorderWidth; + + }; + + + +#endif //GLXZOOMMATHSENGINE diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/inc/glxzoomview.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/inc/glxzoomview.hrh Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2008-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: Enums for Zoom COntrol +* +*/ + +#ifndef GLXZOOMVIEW_HRH_ +#define GLXZOOMVIEW_HRH_ + +enum TZoomMode + { + EZoomOut, + EZoomIn + }; + +enum TAnimationMode + { + EAnimationModeZoomOut, + EAnimationModeZoomIn, + EAnimationModePan + }; + +enum TGlxPanIncrementType + { + EGlxPanIncrementUniform, + EGlxPanIncrementExponential, + EGlxPanIncrementInertic + }; + +enum TUiState + { + EUiOn, + EUiOff + }; + +#endif /* GLXZOOMVIEW_HRH_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/inc/mglxzoomeventhandlers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/inc/mglxzoomeventhandlers.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2008-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: Zoom Event Handler +* +*/ + + +#ifndef MGLXZOOMEVENTHANDLERS_H_ +#define MGLXZOOMEVENTHANDLERS_H_ + +#include // for TAlfRealPoint +#include +class MGlxZoomEventHandlers + { +public: + /** + * Handles the set view port + */ + virtual void HandleViewPortParametersChanged(TPoint& aViewPortTopLeft , + TInt aTransitionTime , + TSize *apViewPortDimension = NULL, + TInt aPrimarySliderLevel = -1) = 0; + + virtual void HandleShowUi(TBool aShow= EFalse) = 0; + + virtual void HandleZoomOutL(TInt aCommandId) = 0; + + virtual TBool HandlePointerEventsL(const TAlfEvent &aEvent)= 0; + }; +#endif /* MGLXZOOMEVENTHANDLERS_H_ */ diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/src/glxzoomcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/src/glxzoomcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,861 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of CGlxZoomControl +* +*/ + + +// INCLUDE FILES + +#include "glxzoomcontrol.h" + +// INCLUDES +#include +#include //For CEikButtonGroupContainer +#include + +//Alf Headers +#include // For CAlfViewPortLayout +#include // For CAlfImageVisual +#include // For CAlfControlGroup +#include // For CAlfDisplay +#include // For CAlfRoster +#include // For AlfUtil +// Antariksh +#include // For Slider Widget +#include // For Slider events + +#include +#include + +using namespace GestureHelper; + +//Gallery Headers +#include +#include +#include // For Tracer +#include // For Log +#include // For Creating Texture +#include // For Fetch Context Priority +#include // For MGlxMediaList +#include // For MGlxUiCommandHandler + +#include "glxtv.h" // for CGlxTv +// LOCAL CONSTANTS AND MACROS +const TReal KGlxOpacityOpaque = 1.0; +const TInt KGlxMaxExifSize = 0x10000; +const TReal KGlxOpacityTransparent = 0.0; +//zoom delay for animation while hdmi cable, +//is connected and zoom is initiated +const TInt KZoomDelay = 150000; +//Zoom level for the animation , assuming the innitial level is 1. +const TReal KGlxZoomLevel = 1.5; +const TInt KGlxMinSmallImageZoomLevel =100; + +const TInt KGlxDecodingThreshold = 3000000; // pixels + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CGlxZoomControl::CGlxZoomControl +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CGlxZoomControl::CGlxZoomControl(MGlxUiCommandHandler& aCommandHandler, + MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomBackKeys, + IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper) : + iMediaList(aMediaList), iGestureHelper(aGestureHelper), + iZoomSliderWidget(aSliderWidget), iZoomBackKey(&aZoomBackKeys), + iCommandHandler(aCommandHandler) + { + TRACER("CGlxZoomControl::CGlxZoomControl"); + } + +// ----------------------------------------------------------------------------- +// CGlxZoomControl::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::ConstructL() + { + TRACER("CGlxZoomControl::ConstructL()"); + iAttributeContext = CGlxDefaultAttributeContext::NewL(); + iAttributeContext->AddAttributeL(KGlxMediaGeneralDimensions); + iMediaList.AddContextL( iAttributeContext, KGlxFetchContextPriorityLow ); + iUiUtility = CGlxUiUtility::UtilityL(); + iEnv = iUiUtility->Env(); + iDisplay = iUiUtility->Display(); + iTextureMgr = &iUiUtility->GlxTextureManager(); + iScreenSize = ScreenSize(); + + iDisplay->SetVisibleArea(TRect(TPoint(0,0),iScreenSize)); + CAlfControl::ConstructL(*iEnv); + + //Func creating black background and visual that has to zoomed + CreateZoomVisualL(); + + iControlGroup = &iEnv->NewControlGroupL(0x119); + iControlGroup->AppendL(this); + + iDisplay->Roster().ShowL( *iControlGroup); + + // Hide the Zoom at the construction + ShowZoom(EFalse); + iZoomActive = EFalse; + //To know if HDMi cable is connected. + iGlxTvOut = CGlxTv::NewL(*this); + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + } + +// ----------------------------------------------------------------------------- +// ScreenSize : gets the screensize, Note that , this is not stored in member variable as +// Screen rect can change based on orientation +// ----------------------------------------------------------------------------- +// +TSize CGlxZoomControl::ScreenSize() + { + TRACER("CGlxZoomControl::ScreenSize()"); + return AlfUtil::ScreenSize(); + } + +// ----------------------------------------------------------------------------- +// ShowZoom +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::ShowZoom(TBool aShow) + { + TRACER("CGlxZoomControl::ShowZoom()"); + if (aShow) + { + iViewPort->SetOpacity(KGlxOpacityOpaque); + iGestureHelper->AddObserver(this); + } + else + { + iViewPort->SetOpacity(KGlxOpacityTransparent); + } + } + +// ----------------------------------------------------------------------------- +// CreateZoomVisual +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::CreateZoomVisualL() + { + TRACER("CGlxZoomControl::CreateZoomVisualL()"); + + CAlfTexture *blackoutTexture = &(iTextureMgr->CreateFlatColourTextureL(KRgbBlack)); + CleanupStack::PushL(blackoutTexture); + + iViewPort = CAlfViewportLayout::AddNewL(*this); + //Create the Image visual ,which holds the texture,which is complete black in color + CAlfImageVisual *blackoutImageVisual = CAlfImageVisual::AddNewL(*this,iViewPort); + CleanupStack::PushL(blackoutImageVisual); + + // Visual is larger than the screen to deal with control transformations that + // may show areas usually outside the normal screen coordinates + TInt16 blackImageSize =(iScreenSize.iWidth > iScreenSize.iHeight) ?iScreenSize.iWidth:iScreenSize.iHeight; + blackoutImageVisual->SetImage(TAlfImage(*blackoutTexture)); + blackoutImageVisual->SetFlag(EAlfVisualFlagManualLayout); + blackoutImageVisual->SetSize(TAlfRealSize(blackImageSize, blackImageSize)); + blackoutImageVisual->SetPos(TAlfRealPoint(0, 0)); + CleanupStack::Pop(blackoutImageVisual); + CleanupStack::Pop(blackoutTexture); + + // VisualLayoutUpdated + // Enable scrolling of the Viewport. + // The content area of a layout can be thought to be larger than the real visible size. + // Scrolling changes which portion of the layout’s content is actually visible at the moment. + iViewPort->SetFlag(EAlfVisualFlagLayoutUpdateNotification); + iViewPort->SetVirtualSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); + iViewPort->SetViewportSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); + iViewPort->SetViewportPos(TAlfRealPoint(0,0), 0); + iViewPort->SetClipping(EFalse); + iViewPort->SetOrigin( EAlfVisualHOriginLeft, EAlfVisualVOriginTop ); + + //Enable scrolling of the Viewport. + //The content area of a layout can be thought to be larger than the real visible size. + //Scrolling changes which portion of the layout’s content is actually visible at the moment. + iViewPort->EnableScrollingL(); + iViewPort->EnableTransformationL(); + + iImageVisual = CAlfImageVisual::AddNewL(*this,iViewPort); + iImageVisual->SetScaleMode(CAlfImageVisual::EScaleFitInside); + + iEventHandler = CGlxZoomPanEventHandler::NewL(*this); + + } + +// ----------------------------------------------------------------------------- +// CGlxZoomControl::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxZoomControl* CGlxZoomControl::NewL( + MGlxUiCommandHandler& aCommandHandler, + MGlxMediaList& aMediaList,CEikButtonGroupContainer& aZoomKeys, + IMulSliderWidget& aSliderWidget, GestureHelper::CGestureHelper* aGestureHelper) + { + TRACER("CGlxZoomControl::NewL"); + CGlxZoomControl* self = new (ELeave) CGlxZoomControl(aCommandHandler, + aMediaList,aZoomKeys,aSliderWidget,aGestureHelper); + + CleanupStack::PushL(self); + self->ConstructL(); + + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxZoomControl::~CGlxZoomControl() + { + TRACER("CGlxZoomControl::~CGlxZoomControl()"); + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } + delete iTimer; + if(iEventHandler) + { + delete iEventHandler; + iEventHandler = NULL ; + } + + if(iViewPort) + { + iViewPort->RemoveAndDestroyAllD(); + iViewPort = NULL; + } + iMediaList.RemoveContext(iAttributeContext); + delete iAttributeContext; + if(iImageTexture) + { + delete iImageTexture; + iImageTexture=NULL; + } + iDisplay->Roster().Hide(*iControlGroup); + if ( iControlGroup ) + { + iControlGroup->Remove(this); + iEnv->DeleteControlGroup(0x119); + iControlGroup = NULL; + } + if ( iUiUtility ) + { + iUiUtility->Close(); + } + } + +// ----------------------------------------------------------------------------- +// ActivateL:Activates the Zoom Control,set the image visual ,do the initial setup +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxZoomControl::ActivateL(TInt aInitialZoomRatio, TZoomStartMode aStartMode, + TInt aFocusIndex, TGlxMedia& aItem, TPoint* aZoomFocus) + { + TRACER("CGlxZoomControl::ActivateL()"); + if ( !iZoomActive ) + { + //This Varaiable updates that we are in zoom state now. + iZoomActive = ETrue; + //To Retrive the image details + TMPXAttribute thumbNailAttribute(0,0); + TGlxIdSpaceId idspace = iMediaList.IdSpaceId( aFocusIndex ); + //Get the texture Created in fullscreen View. + iImageTexture = &(iTextureMgr->CreateNewTextureForMediaL( + ScreenSize(),aItem, idspace, this )); + iImageVisual->SetImage(*iImageTexture); + + if(iGlxTvOut->IsConnected()) + { + StartZoomAnimation(); + } + else + { + ShowZoom(ETrue); + iZoomSliderWidget.AddEventHandler(*this); + iZoomSliderWidget.SetHandleKeyEvent(EFalse); + iZoomSliderModel = (IMulSliderModel*) iZoomSliderWidget.model(); + // Get size, return value tells us if it was available + //We need this Value to calculate the size of the visual/Layout corresponding to the Zoom factor + TSize imageSize; + aItem.GetDimensions( imageSize ); + TSize maxVirtualImageSize = imageSize; + + if (KGlxDecodingThreshold < (imageSize.iWidth * imageSize.iHeight)) + { + TReal areaRatio = TReal(imageSize.iWidth*imageSize.iHeight)/KGlxDecodingThreshold ; + + TReal sideRatio; + Math::Sqrt(sideRatio, areaRatio); + + + maxVirtualImageSize.iHeight = imageSize.iHeight / sideRatio ; + maxVirtualImageSize.iWidth = imageSize.iWidth / sideRatio ; + + } + + TInt initialZoomRatio = GetIntialZoomLevel(maxVirtualImageSize); + iZoomSliderModel->SetMinRange(initialZoomRatio); + + iEventHandler->SetZoomActivated(ETrue); + iEventHandler->ActivateZoom(initialZoomRatio, + maxVirtualImageSize, + aStartMode, + iZoomSliderModel->MinRange(), + iZoomSliderModel->MaxRange(), + maxVirtualImageSize, + aZoomFocus); + + TRAP_IGNORE(iImageTexture = + &(iTextureMgr->CreateZoomedTextureL(aItem,thumbNailAttribute,idspace,this))); + + //This is for handling the alaram interrupt events,that causes the phone to freeze. + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + if (NULL != cba) + { + if (cba->IsVisible()) + { + cba->ActivateL(); + } + } + } + } +} +// --------------------------------------------------------------------------- +// StartZoomAnimation +// --------------------------------------------------------------------------- +// +void CGlxZoomControl::StartZoomAnimation() + { + TRACER("CGlxZoomControl::StartZoomAnimation()"); + iZoomIn = ETrue; + //Set zoom visible but not enable the gesturehelper events + iViewPort->SetOpacity(KGlxOpacityOpaque); + TAlfTimedValue timedvalue; + //using KGlxOpacityOpaque for the value 1 , assuming the initial zoom level as 1. + timedvalue.SetValueNow(KGlxOpacityOpaque); + timedvalue.SetTarget(KGlxZoomLevel,KZoomDelay/1000); + iImageVisual->SetScale(timedvalue); + iTimer->Cancel(); + iTimer->Start(KZoomDelay,KZoomDelay,TCallBack( TimeOut,this )); + } +// --------------------------------------------------------------------------- +// TimeOut +// --------------------------------------------------------------------------- +// +TInt CGlxZoomControl::TimeOut(TAny* aSelf) + { + TRACER("CGlxZoomControl::TimeOut"); + if(aSelf) + { + CGlxZoomControl* self = static_cast (aSelf); + self->ActivateFullscreen(); + } + return KErrNone; + } +// --------------------------------------------------------------------------- +// ActivateZoomAnimation +// --------------------------------------------------------------------------- +// +void CGlxZoomControl::ActivateFullscreen() + { + TRACER("CGlxZoomControl::ActivateFullscreen"); + if(iZoomIn) + { + iZoomIn = EFalse; + TAlfTimedValue timedvalue; + timedvalue.SetValueNow(KGlxZoomLevel); + timedvalue.SetTarget(KGlxOpacityOpaque,KZoomDelay/1000); + iImageVisual->SetScale(timedvalue); + } + else + { + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } + //once the animation is done come back to fullscreen. + HandleZoomOutL(KGlxZoomOutCommand); + } + } + +// ----------------------------------------------------------------------------------- +// Deactivate:Remove the screen furniture ,cancel the timers if any +// ---------------------------------------------------------------------------------- +// +EXPORT_C void CGlxZoomControl::Deactivate() + { + TRACER("CGlxZoomControl::Deactivate()"); + + if ( iZoomActive ) + { + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } + iZoomSliderWidget.ShowWidget( EFalse, 0 ); + iZoomSliderWidget.RemoveEventHandler(*this); + iZoomBackKey->MakeVisible( EFalse ); + iTextureMgr->RemoveZoomList(); + + iImageVisual->SetImage(*iImageTexture); + iEventHandler->DeactivateZoom(); + CleanUpVisual(); + + iZoomActive = EFalse; + iEventHandler->SetZoomActivated(EFalse); + } + // Hide the Zoom View + ShowZoom(EFalse); + } + +// ----------------------------------------------------------------------------------- +// HandleZoomForegroundEventL:Zoom Foreground event handling function +// ---------------------------------------------------------------------------------- +// +EXPORT_C void CGlxZoomControl::HandleZoomForegroundEvent(TBool aForeground) + { + TRACER("CGlxZoomControl::HandleZoomForegroundEventL()"); + if (!aForeground) + { + iEventHandler->CancelZoomPanTimer(); + } + } + +// ----------------------------------------------------------------------------- +// CleanUpVisual:reset the values of the variables. +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::CleanUpVisual() + { + TRACER("CGlxZoomControl::CleanUpVisual() "); + } +// ----------------------------------------------------------------------------- +// Activated +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGlxZoomControl::Activated() + { + TRACER("CGlxZoomControl::Activated"); + return iZoomActive; + } + +// ----------------------------------------------------------------------------- +// OfferEventL +// ----------------------------------------------------------------------------- +// +TBool CGlxZoomControl::OfferEventL(const TAlfEvent &aEvent) + { + TRACER("CGlxZoomControl::OfferEventL()"); + + GLX_LOG_INFO1("OfferEventL 2: iZoomEnabled = %d ", iZoomActive ); + // All the events related to the keys and pointers will be coming to this offerevent + return iEventHandler->HandleEventL(aEvent) ; + } + + +// ----------------------------------------------------------------------------- +// offerEvent +// ----------------------------------------------------------------------------- +// +AlfEventStatus CGlxZoomControl::offerEvent( CAlfWidgetControl& /*aControl*/, + const TAlfEvent& aEvent) + { + TRACER("CGlxZoomControl::OfferEvent( CAlfWidgetControl& /*aControl*/)"); + // All the events which are related to slider widget will be coming + // to this offerevent. + AlfEventStatus eventStatus = EEventNotHandled; + + TBool consumed = iEventHandler->HandleEvent(aEvent); + if ( consumed ) + { + eventStatus = EEventConsumed; + } + + return eventStatus; + } + + +// ----------------------------------------------------------------------------- +// TextureContentChangedL +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::TextureContentChangedL( TBool /*aHasContent*/ , CAlfTexture* aNewTexture) + { + TRACER("CGlxZoomControl::TextureContentChangedL "); + //if both the textures are null that means we do not have memory to + //decode and show anything. So try and check if the fullscreen texture + //is created by now if not then go to fullscreen view. + + if(aNewTexture == NULL) + { + if(iImageTexture == NULL) + { + TSize TextureSize = ScreenSize(); + TInt focus = iMediaList.FocusIndex(); + TGlxMedia item = iMediaList.Item( focus ); + TGlxIdSpaceId idspace = iMediaList.IdSpaceId( focus ); + + CAlfTexture* newTexture = NULL; + //Get the texture Created in fullscreen View. + TRAPD(errtexture, newTexture = &(iTextureMgr->CreateNewTextureForMediaL( + TextureSize,item, idspace, this ))); + + if(errtexture != KErrNone) + { + GLX_LOG_INFO( "CGlxTextureManagerImpl::HandleBitmapDecodedL::CreateNewTextureForMediaL Failed"); + //Exit zoom and goto fullscreen + HandleZoomOutL(KGlxZoomOutCommand); + } + else + { + //show the fullscreen texture. + iImageTexture = newTexture; + iImageVisual->SetImage( *iImageTexture ); + } + } + else + { + //show the existing first level decoded image texture in case second level + //decoding fails + iImageVisual->SetImage( *iImageTexture ); + } + } + else + { + iImageTexture = aNewTexture; + iImageVisual->SetImage( *iImageTexture ); + } + } + +// ----------------------------------------------------------------------------- +// VisualLayoutUpdated:updates the co-ordinates when phone is tilted +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::VisualLayoutUpdated(CAlfVisual& aVisual) + { + TRACER("CGlxZoomControl::VisualLayoutUpdated "); + // Callback comes to this function when there is a resolution change + TRect rect; + rect = AlfUtil::ScreenSize(); + if ( (rect.Width() != iScreenSize.iWidth) && ( rect.Height() != iScreenSize.iHeight) && (Activated()) ) + { + //notify slider about Orientation Change + iZoomSliderWidget.ContainerLayout().Owner().VisualLayoutUpdated(aVisual); + //when the Phone is tilted,Height becomes the width and vice versa. So update with the new dimensions + iScreenSize.iWidth = rect.Width(); + iScreenSize.iHeight = rect.Height(); + iDisplay->SetVisibleArea(TRect(TPoint(0,0),iScreenSize)); + + //[TODO]: Use the Maths engine ro arrive at this figure (virtual and viewport sizes). else there might be problems in fringe conditions + iViewPort->SetVirtualSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); + iViewPort->SetViewportSize(TAlfRealSize(iScreenSize.iWidth,iScreenSize.iHeight), 0); + + iEventHandler->OrientationChanged(rect); + } + } + +// --------------------------------------------------------------------------- +// ShowUi +// --------------------------------------------------------------------------- +// +void CGlxZoomControl::ShowUi(TBool aShow) + { + TRACER("CGlxZoomControl::ShowUi "); + + if (aShow) + { + iEventHandler->SetZoomUiState(EUiOn); + } + else + { + iEventHandler->SetZoomUiState(EUiOff); + } + + iZoomBackKey->MakeVisible( aShow ); + iZoomSliderWidget.ShowWidget( aShow, 0 ); + } + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler.. +// --------------------------------------------------------------------------- +// +bool CGlxZoomControl::accept( CAlfWidgetControl& /*aControl*/, + const TAlfEvent& /*aEvent*/) const + { + TRACER("CGlxZoomControl::accept "); + return ETrue; + } + +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler.. +// --------------------------------------------------------------------------- +// +void CGlxZoomControl::setEventHandlerData( + const AlfWidgetEventHandlerInitData& /*aData*/) + { + TRACER("CGlxZoomControl::setEventHandlerData "); + } +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler.. +// --------------------------------------------------------------------------- +// + +AlfWidgetEventHandlerInitData* CGlxZoomControl::eventHandlerData() + { + TRACER("CGlxZoomControl::eventHandlerData "); + return NULL; + } +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// + +void CGlxZoomControl::setActiveStates( unsigned int /*aStates*/ ) + { + TRACER("CGlxZoomControl::setActiveStates "); + } +// --------------------------------------------------------------------------- +// From IAlfWidgetEventHandler. +// --------------------------------------------------------------------------- +// + +IAlfInterfaceBase* CGlxZoomControl::makeInterface( const IfId& /*aType*/ ) + { + TRACER("CGlxZoomControl::makeInterface Enter/Exit"); + return NULL; + } +//---------------------------------------------------------------------------------- +// eventHandlerType +//---------------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerType CGlxZoomControl::eventHandlerType() + { + TRACER("CGlxZoomControl::eventHandlerType Enter/Exit"); + return IAlfWidgetEventHandler::ELogicalEventHandler; + } + +//---------------------------------------------------------------------------------- +// eventExecutionPhase +//---------------------------------------------------------------------------------- +// +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase CGlxZoomControl::eventExecutionPhase() + { + TRACER("CGlxZoomControl::eventExecutionPhase Enter/Exit"); + return EBubblingPhaseEventHandler; + } + +//---------------------------------------------------------------------------------- +// GetOrientationL: to retreive orientation from the exif tags in the file +//---------------------------------------------------------------------------------- +// +TUint16 CGlxZoomControl::GetOrientationL(const TDesC& aFileName) + { + TRACER("CGlxZoomControl::GetOrientationL()"); + //Get Exif Metadata and the orientation tag from the file first + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + User::LeaveIfError(file.Open(fs, + aFileName, EFileRead)); + + TInt size; + User::LeaveIfError(file.Size(size)); + if ( KGlxMaxExifSize < size ) + { + size = KGlxMaxExifSize; + } + TUint16 orientation = 0; + HBufC8* exifData = HBufC8::NewLC(size); + TPtr8 ptr(exifData->Des()); + User::LeaveIfError(file.Read(ptr)); + CExifRead* exifReader = NULL; + TRAPD(exifErr,exifReader = CExifRead::NewL(*exifData, CExifRead::ENoJpeg)); + if(exifErr == KErrNone) + { + CleanupStack::PushL(exifReader); + + TInt readErr = exifReader->GetOrientation(orientation); + if(readErr != KErrNone) + { + orientation = 0; + } + CleanupStack::PopAndDestroy(exifReader); + } + CleanupStack::PopAndDestroy(exifData); + //Close and pop file Session + CleanupStack::PopAndDestroy(&file); + CleanupStack::PopAndDestroy(&fs); + return orientation; + + } + +// ----------------------------------------------------------------------------- +// UpdateViewPort +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::UpdateViewPort(TPoint& aViewPortTopLeft, + TInt aTransitionTime, + TSize *apViewPortDimension, + TInt aPrimarySliderRatio) + { + TRACER("void CGlxZoomControl::UpdateViewPort"); + + iViewPort->SetViewportPos(aViewPortTopLeft,aTransitionTime); + + if (apViewPortDimension) + { + iViewPort->SetVirtualSize(*apViewPortDimension,0); + } + + if(aPrimarySliderRatio >= 0) + { + iZoomSliderModel->SetPrimaryValue(aPrimarySliderRatio); + } + } + +// ----------------------------------------------------------------------------- +// HandleShowUi +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::HandleShowUi( TBool aShow) + { + TRACER("void CGlxZoomControl::HandleShowUi"); + ShowUi(aShow); + } + + + +// ----------------------------------------------------------------------------- +// HandleSetViewPort +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::HandleViewPortParametersChanged(TPoint& aViewPortTopLeft , + TInt aTransitionTime , + TSize *apViewPortDimension , + TInt aPrimarySliderLevel ) + { + TRACER("void CGlxZoomControl::HandleSetViewPort"); + UpdateViewPort(aViewPortTopLeft, aTransitionTime, apViewPortDimension, + aPrimarySliderLevel); + } + +// ----------------------------------------------------------------------------- +// HandleZoomOut +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::HandleZoomOutL(TInt aCommandId) + { + TRACER("void CGlxZoomControl::HandleZoomOut"); + iCommandHandler.HandleCommandL(aCommandId, this); + } + + +// ----------------------------------------------------------------------------- +// HandlePointerEventsL +// ----------------------------------------------------------------------------- +// +TBool CGlxZoomControl::HandlePointerEventsL(const TAlfEvent &aEvent) + { + TRACER("void CGlxZoomControl::HandlePointerEventsL"); + + return iGestureHelper->OfferEventL(aEvent); + + } + +// ----------------------------------------------------------------------------- +// HandleGestureL +// ----------------------------------------------------------------------------- +// +void CGlxZoomControl::HandleGestureL( const GestureHelper::MGestureEvent& aEvent ) + { + TRACER("void CGlxZoomControl::HandleGestureL"); + + TGestureCode code = aEvent.Code(MGestureEvent::EAxisBoth); + GLX_LOG_INFO1("_PHOTOS_LOG_: void CGlxZoomControl::HandleGestureL Code : %d", code); + + // Todo: This switch should go into the event handler. + switch (code) + { + case EGestureDrag: + iEventHandler->HandleDragEvent(aEvent); + break; + case EGestureTap: + iEventHandler->HandleSingleTap(aEvent); + break; + case EGesturePinch: + iEventHandler->HandlePinchEventL(aEvent); + break; + case EGestureDoubleTap: + iEventHandler->HandleDoubleTap(aEvent); + break; + case EGestureReleased: + iEventHandler->HandleGestureReleased(aEvent); + break; + default : + break; + } + iEventHandler->SetPreviousEventCode(code); + } + +TInt CGlxZoomControl::GetIntialZoomLevel(TSize& aSize ) + { + TRACER("CGlxZoomControl::IntialZoomLevel"); + + TRect rect = AlfUtil::ScreenSize(); + TUint8 initialZoomLevel; + + if( rect.Width()>= aSize.iWidth && rect.Height() >= aSize.iHeight) + { + //if Both the Width and Height are lesser than the screen size,the initial Zoom Level will be 100 + initialZoomLevel = KGlxMinSmallImageZoomLevel; + } + else + { + //Calculate (Display Area Width) /Image Width * 100 + //Calculate (Display Area Height) /Image Height * 100 + //Choose the Minimum Of the above. + TReal32 imageWidthRatio = ((TReal32) rect.Width()/ aSize.iWidth )*100.0F; + TReal32 imageHeightRatio = ((TReal32)rect.Height()/ aSize.iHeight )*100.0F; + initialZoomLevel = Min(imageWidthRatio,imageHeightRatio); + } + return initialZoomLevel; + } +// ----------------------------------------------------------------------------- +// HandleTvStatusChangedL +// ----------------------------------------------------------------------------- +void CGlxZoomControl::HandleTvStatusChangedL( TTvChangeType aChangeType ) + { + TRACER("CGlxZoomControl::HandleTvStatusChangedL()"); + if ( aChangeType == ETvConnectionChanged ) + { + if ( iGlxTvOut->IsConnected() ) + { + //go to fullscreen. + HandleZoomOutL(KGlxZoomOutCommand); + } + } + } + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/src/glxzoomeventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/src/glxzoomeventhandler.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1227 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Zoom Event Handler +* +*/ + + +// Avkon +#include + +// Antariksh +#include // AlfUtil +#include // For Slider events + +//Photos Headers +#include // For Tracer +#include // For Log + +#include // For MGlxUiCommandHandler +#include +#include +#include +#include + + +// LOCAL CONSTANTS AND MACROS +const TInt KTimerLengthInMicroseconds = 100000 ; +const TInt KGlxScreenTimeout = 2000000 ; // 2 seconds timer for UI On/Off + +const TInt KGlxAnimationTimeDrag = 30 ; +const TInt KGlxAnimationTimekeyPan = 50 ; + +const TInt KGlxZoomPanInc = 5 ; // Min number of pixels panned in one keypress. This value is incremented exponentially by multiples of iPanFactor + +// Anime Speed changes in inverse proportion to KGlxAnimeFrameInmS. +// Steps increase with KGlxAnimeFrameCount. +// Total time taken = (KGlxAnimeFrameInmS * KGlxAnimeFrameCount)microseconds. +const TInt KGlxAnimeFrameInmS = 10000 ; +const TInt KGlxAnimeFrameCount = 10 ; + +const TInt KGlxPanInertiaFrameInmS = 20000 ; + +using namespace GestureHelper; + +// ============================ CGlxZoomPanEventHandler=============================== +// ============================ MEMBER FUNCTIONS =============================== + +//---------------------------------------------------------------------------------- +// NewL +//---------------------------------------------------------------------------------- +// +CGlxZoomPanEventHandler* CGlxZoomPanEventHandler::NewL(MGlxZoomEventHandlers& aZoomEventHandler) + { + TRACER("CGlxZoomPanEventHandler::NewL"); + CGlxZoomPanEventHandler* self = new (ELeave) CGlxZoomPanEventHandler(aZoomEventHandler); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +//---------------------------------------------------------------------------------- +// CGlxZoomPanEventHandler constructor +//---------------------------------------------------------------------------------- +// +CGlxZoomPanEventHandler::CGlxZoomPanEventHandler(MGlxZoomEventHandlers& aZoomEventHandler): + iZoomEventHandler(aZoomEventHandler) + { + TRACER("CGlxZoomPanEventHandler::CGlxZoomPanEventHandler()"); + // No Implementation + } + +//---------------------------------------------------------------------------------- +// CGlxZoomPanEventHandlerDestructor +//---------------------------------------------------------------------------------- +// +CGlxZoomPanEventHandler::~CGlxZoomPanEventHandler() + { + TRACER("CGlxZoomPanEventHandler::~CGlxZoomPanEventHandler()"); + if(iZoomPanTimer) + { + CancelZoomPanTimer(); + delete iZoomPanTimer; + iZoomPanTimer = NULL; + } + if (iUiTimer) + { + CancelUITimer(); + delete iUiTimer; + iUiTimer = NULL; + } + if(iZoomAnimationTimer) + { + CancelAnimationTimer(); + delete iZoomAnimationTimer; + iZoomAnimationTimer = NULL; + } + + } + +//---------------------------------------------------------------------------------- +// CGlxZoomPanEventHandler Constructl +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::ConstructL() + { + TRACER("CGlxZoomPanEventHandler::ConstructL()"); + if(!iUiTimer) + { + iUiTimer = CPeriodic::NewL(EPriorityNormal); + } + if(!iZoomPanTimer) + { + iZoomPanTimer = CPeriodic::NewL(EPriorityNormal); + } + if(!iZoomAnimationTimer) + { + iZoomAnimationTimer = CPeriodic::NewL(EPriorityNormal); + } + } + +//---------------------------------------------------------------------------------- +// CGlxZoomPanEventHandler SetupAnimatedZoom +//---------------------------------------------------------------------------------- +// +// Todo: Combine logics of setting up animated zoom and pan. +void CGlxZoomPanEventHandler::SetupAnimatedZoom(TZoomMode aZoomMode, TPoint* aZoomFocus) + { + TRACER("CGlxZoomPanEventHandler::SetupAnimatedZoom"); + + iTargetAnimatedZoomRatio = (iMaxZoomRatio + iMinZoomRatio)/2 ; + + CancelAnimationTimer(); + + //ToDo: Verify this with images slightly smaller or slightly larger than fullscreen size. + if (EZoomIn == aZoomMode) + { + // the '1+' is to take care of the situation when there the rest of the equation returns something betn 0 and 1 + iZoomPerInterval = 1 + (iTargetAnimatedZoomRatio - iZoomRatio)/KGlxAnimeFrameCount ; + } + else + { + iZoomPerInterval = 1 + (iZoomRatio - iMinZoomRatio)/KGlxAnimeFrameCount; + } + + + if (1 < iZoomPerInterval) + { + iIsZoomingInAnimatedState = ETrue; + + switch(aZoomMode) + { + case EZoomIn: + iAnimatedZoomMode = EAnimationModeZoomIn; + break; + case EZoomOut: + iAnimatedZoomMode = EAnimationModeZoomOut; + break; + } + + iZoomAnimationTimer->Start( 0, + KGlxAnimeFrameInmS, + TCallBack( ActivationIntervalElapsed,(TAny*)this) ); + } + else + // Cant zoom in/out at less than 1 percent. so directly jump to the target zoom ratio. + // This happens in cases where there is not much difference between the source and target zoom levels + { + TInt targetZoomRatio = 0; + if (EZoomIn == aZoomMode) + { + targetZoomRatio = iTargetAnimatedZoomRatio ; + } + else + { + targetZoomRatio = iMinZoomRatio ; + } + Zoom(targetZoomRatio, 0) ; + } + } + +//---------------------------------------------------------------------------------- +// CGlxZoomPanEventHandler ActivationIntervalElapsed +//---------------------------------------------------------------------------------- +// +TInt CGlxZoomPanEventHandler::ActivationIntervalElapsed(TAny* aPtr) + { + TRACER("CGlxZoomPanEventHandler::ActivationIntervalElapsed"); + + CGlxZoomPanEventHandler* self = static_cast(aPtr); + + self->NextStepAnimatedZoom(); + return 0; + } + +//---------------------------------------------------------------------------------- +// CGlxZoomPanEventHandler NextStepAmimatedZoom +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::NextStepAnimatedZoom() + { + TRACER("CGlxZoomPanEventHandler::NextStepAmimatedZoom"); + + TInt targetZoomLevel = 0 ; + + if (EAnimationModeZoomIn == iAnimatedZoomMode) + { + targetZoomLevel = iZoomRatio + iZoomPerInterval; + } + else + { + targetZoomLevel = iZoomRatio - iZoomPerInterval; + } + + Zoom(targetZoomLevel, 0, EZoomIn, &iZoomFocus ); + + // The boundary conditions. + if ( (( targetZoomLevel >= iTargetAnimatedZoomRatio ) && (EAnimationModeZoomIn == iAnimatedZoomMode ) ) + || ((targetZoomLevel <= iMinZoomRatio) && (EAnimationModeZoomOut == iAnimatedZoomMode))) + { + iIsZoomingInAnimatedState = EFalse; + CancelAnimationTimer(); + TSize screensize = iMathsEngine.ScreenSize(); + iZoomFocus = TPoint(screensize.iWidth>>1,screensize.iHeight>>1) ; + } + } + + +//---------------------------------------------------------------------------------- +// StartZoomTimer:Starts the Zoom timer for continous zoom +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::StartZoomTimer() + { + TRACER("CGlxZoomPanEventHandler::StartZoomTimer"); + + if (iZoomPanTimer->IsActive()) + { + iZoomPanTimer->Cancel(); + } + iZoomPanTimer->Start( KTimerLengthInMicroseconds, + KTimerLengthInMicroseconds, + TCallBack( ZoomIntervalExpired,(TAny*)this) ); + } + +//---------------------------------------------------------------------------------- +// StartPanTimer:Starts the Pan timer for continous Panning +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::StartPanTimer() + { + TRACER("CGlxZoomPanEventHandler::StartPanTimer "); + + //After Panning in one direction for a long time by holding the key and + //then if panning is started in another direction,the panning will be done in more pixels. + iPanTime.HomeTime(); + + GLX_LOG_INFO("CGlxZoomPanEventHandler::StartPanTimer: Cancelling timers "); + + if (iZoomPanTimer->IsActive()) + { + iZoomPanTimer->Cancel(); + } + iZoomPanTimer->Start( 0, + KTimerLengthInMicroseconds, + TCallBack( PanIntervalExpired,(TAny*)this) ); + + } + +//---------------------------------------------------------------------------------- +// CancelZoomPanTimer: Cancels the Zoom timer for continous zoom +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::CancelZoomPanTimer() + { + TRACER("CGlxZoomPanEventHandler::CancelZoomPanTimer "); + + if (iZoomPanTimer->IsActive()) + { + iZoomPanTimer->Cancel(); + } + } + +//---------------------------------------------------------------------------------- +// CancelUITimer +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::CancelUITimer() + { + TRACER("CGlxZoomPanEventHandler::CancelUITimer "); + + if (iUiTimer->IsActive()) + { + iUiTimer->Cancel(); + } + } + +//---------------------------------------------------------------------------------- +// CancelUITimer +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::CancelAnimationTimer() + { + TRACER("CGlxZoomPanEventHandler::CancelAnimationTimer "); + + // This will set the timer to false if it is being used for zoom. For Pan + // this flag is immaterial + iIsZoomingInAnimatedState = EFalse; + if (iZoomAnimationTimer->IsActive()) + { + iZoomAnimationTimer->Cancel(); + } + } + +//---------------------------------------------------------------------------------- +// StartUITimer +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::StartUITimer(TTimeIntervalMicroSeconds32 aDelay, + TTimeIntervalMicroSeconds32 anInterval, + TCallBack aCallBack) + { + TRACER("CGlxZoomPanEventHandler::StartUITimer "); + + if (iUiTimer->IsActive()) + { + iUiTimer->Cancel(); + } + iUiTimer->Start(aDelay,anInterval,aCallBack); + } + +// ----------------------------------------------------------------------------- +// HandlekeyEvents:This function handles the key Events. +// ----------------------------------------------------------------------------- +// +TBool CGlxZoomPanEventHandler::HandlekeyEvents(const TAlfEvent &aEvent) + { + TRACER("CGlxZoomControl::HandlekeyEvents()"); + GLX_LOG_INFO1("CGlxZoomPanEventHandler::HandlekeyEvents. Scancode = %d ", aEvent.KeyEvent().iScanCode); + + TBool consumed = EFalse; + + if (!iIsZoomingInAnimatedState) + { + switch (aEvent.KeyEvent().iScanCode) + { + case EStdKeyDevice10: //Listen to EStdKeyDevice10 as EKeyLeftUpArrow key is mapped to TKeyCode::EKeyDevice10 for which TStdScancode is EStdKeyDevice10 + case EKeyLeftUpArrow : + case EStdKeyDevice13: //Listen to EStdKeyDevice13 as EKeyLeftDownArrow key is mapped to TKeyCode::EKeyDevice13 for which TStdScancode is EStdKeyDevice13 + case EKeyLeftDownArrow : + case EStdKeyDevice11://Listen to EStdKeyDevice11 as EKeyRightUpArrow key is mapped to TKeyCode::EKeyDevice11 for which TStdScancode is EStdKeyDevice11 + case EKeyRightUpArrow : + case EStdKeyDevice12: //Listen to EStdKeyDevice12 as EKeyRightDownArrow key is mapped to TKeyCode::EKeyDevice12 for which TStdScancode is EStdKeyDevice12 + case EKeyRightDownArrow : + case EStdKeyLeftArrow : + case EStdKeyRightArrow : + case EStdKeyUpArrow : + case EStdKeyDownArrow : + { + HandlePanKey(aEvent); + consumed = ETrue; + } + break; + case EStdKeyDevice0: + case EStdKeyDevice1: + case EStdKeyDevice3: + { + //Center button/MSK changes the UI State + if (aEvent.Code() == EEventKeyDown) + { + if (EUiOff == iZoomUiState ) + { + ShowScreenFurniture(KGlxScreenTimeout); + } + else + { + HideScreenFurniture(); + } + } + consumed = ETrue; + } + break; + + //Listen EStdKeyApplicationC as EKeyZoomIn key is mapped to TKeyCode:: EKeyApplicationC for which TStdScancode is EStdKeyApplicatoinC + case EStdKeyApplicationC : + { + HandleZoomStripeAction(EZoomIn ,aEvent.Code()) ; + consumed = ETrue; + break ; + } + //Listen EStdKeyApplicationD as EKeyZoomOut key is mapped to TKeyCode:: EKeyApplicationD for which TStdScancode is EStdKeyApplicatoinD + case EStdKeyApplicationD : + { + HandleZoomStripeAction(EZoomOut,aEvent.Code()); + consumed = ETrue; + break ; + } + case EStdKeyIncVolume : + case EKeyZoomIn : + case EStdKeyNkpAsterisk : + { + GLX_LOG_INFO1("CGlxZoomControl::HandlekeyEvents VLUP=%d", aEvent.KeyEvent().iScanCode ); + if (iZoomActivated) + { + HandleZoomKey(EZoomIn, aEvent.Code()); + } + consumed = ETrue; + break; + } + case EStdKeyDecVolume : + case EKeyZoomOut : + case EStdKeyHash : + { + GLX_LOG_INFO1("CGlxZoomControl::HandlekeyEvents VLUP_D=%d", aEvent.KeyEvent().iScanCode ); + HandleZoomKey(EZoomOut, aEvent.Code()); + consumed = ETrue; + break; + } + default: + break; + } + } + + return consumed; + } + +// ----------------------------------------------------------------------------- +// HandleZoomKey:Starts the Timer for contionous zoom +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandleZoomKey(TZoomMode aZoomMode ,const TEventCode aEventCode ) + { + TRACER("CGlxZoomControl::HandleZoomKey "); + + if ( EEventKeyDown == aEventCode ) + { + CancelUITimer(); + iZoomEventHandler.HandleShowUi(ETrue); + iZoomMode = aZoomMode ; + StartZoomTimer(); + } + else if ( EEventKeyUp == aEventCode ) + { + CancelZoomPanTimer(); + StartUITimer(KGlxScreenTimeout,KGlxScreenTimeout,TCallBack( + UiTimeOut,this )) ; + } + } + +// ----------------------------------------------------------------------------- +// HandleZoomStripeAction:Zooms the image on zoom stripe action. +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandleZoomStripeAction(TZoomMode aZoomMode , + TEventCode aEventCode) + { + TRACER("CGlxZoomControl::HandleZoomStripeAction "); + if ( iZoomActivated ) + { + switch(aEventCode) + { + case EEventKey : + { + iZoomMode = aZoomMode ; + Zoom(0, 0, aZoomMode) ; + + ShowScreenFurniture(KGlxScreenTimeout); + break ; + } + default : + break ; + } + } + } + + +// ----------------------------------------------------------------------------- +// SetupPanOperation: start the pan operation for Key based pan. +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::SetupPanOperation(TPoint& aPanDirection) + { + TRACER("CGlxZoomPanEventHandler::SetupPanOperation "); + + iPanDirection = TPoint(aPanDirection); + if(EUiOn == iZoomUiState ) + { + HideScreenFurniture(); + } + + StartPanTimer(); + + iMathsEngine.SetupPanOperation(); + } + +// ----------------------------------------------------------------------------- +// HandlePanKey :handles the keys related to pan and starts the pan Timer +// ----------------------------------------------------------------------------- +// +TBool CGlxZoomPanEventHandler::HandlePanKey( const TAlfEvent &aEvent ) + { + TRACER("CGlxZoomPanEventHandler::HandlePanKey "); + + TSize imageVirtualSize = iMathsEngine.ImageVirtualSize(); + TSize screenSize = iMathsEngine.ScreenSize(); + TBool safeToPan = EFalse ; + TPoint panDirection(0,0); + TBool handled = EFalse; + + if ( aEvent.Code() == EEventKeyDown ) + { + //if height and/or width of the zoomed image is greater than the screen height and screen width , + //then this paning should be posssible + switch(aEvent.KeyEvent().iScanCode ) + { + case EStdKeyDevice10: + case EKeyLeftUpArrow: + { + if ((imageVirtualSize.iHeight>screenSize.iHeight) + &&(imageVirtualSize.iWidth > screenSize.iWidth)) + { + safeToPan = ETrue; + panDirection = TPoint(-KGlxZoomPanInc, -KGlxZoomPanInc); + } + } + break; + case EStdKeyDevice11: + case EKeyRightUpArrow: + { + if ((imageVirtualSize.iHeight>screenSize.iHeight) + &&(imageVirtualSize.iWidth > screenSize.iWidth)) + { + safeToPan = ETrue; + panDirection = TPoint(KGlxZoomPanInc, -KGlxZoomPanInc); + } + } + break; + case EStdKeyDevice12: + case EKeyLeftDownArrow: + { + if ((imageVirtualSize.iHeight>screenSize.iHeight) + &&(imageVirtualSize.iWidth > screenSize.iWidth)) + { + safeToPan = ETrue; + panDirection = TPoint(-KGlxZoomPanInc, KGlxZoomPanInc); + } + } + break; + case EStdKeyDevice13: + case EKeyRightDownArrow: + { + if ((imageVirtualSize.iHeight>screenSize.iHeight) + &&(imageVirtualSize.iWidth > screenSize.iWidth)) + { + safeToPan = ETrue; + panDirection = TPoint(KGlxZoomPanInc, KGlxZoomPanInc); + } + } + break; + case EStdKeyUpArrow: + { + if( (imageVirtualSize.iHeight ) > screenSize.iHeight ) + { + safeToPan = ETrue; + panDirection = TPoint(0, -KGlxZoomPanInc); + } + } + break; + case EStdKeyDownArrow: + { + if( (imageVirtualSize.iHeight ) > screenSize.iHeight ) + { + safeToPan = ETrue; + panDirection = TPoint(0, KGlxZoomPanInc); + } + } + break; + case EStdKeyLeftArrow: + { + if( (imageVirtualSize.iWidth ) > screenSize.iWidth ) + { + safeToPan = ETrue; + panDirection = TPoint(-KGlxZoomPanInc, 0); + } + } + break; + case EStdKeyRightArrow: + { + if ((imageVirtualSize.iWidth ) > screenSize.iWidth ) + { + safeToPan = ETrue; + panDirection = TPoint(KGlxZoomPanInc, 0); + } + } + break; + default: + break; + } + if (safeToPan) + { + SetupPanOperation(panDirection); + handled = ETrue; + } + } + else if ( aEvent.Code() == EEventKeyUp) + { + // destroy the Pan infrastructure + // Reset the PanDirection and cancel the pan timers. + CancelZoomPanTimer(); + iPanDirection = TPoint(0, 0); + handled = ETrue; + } + return handled; + } + + +// ----------------------------------------------------------------------------- +// HandleDragEvent +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandleDragEvent(const GestureHelper::MGestureEvent& aEvent ) + { + TRACER("CGlxZoomControl::HandleDragEvent (GestureHelper::MGestureEvent&)"); + + + // Ignore events when we are animating in Zoom + if (iIsZoomingInAnimatedState) + { + return; + } + + TPoint startPos = aEvent.StartPos(); + TPoint currPos = aEvent.CurrentPos(); + + + // This means a new gesture has just started. + if (startPos != iPreviousDragStartPosition) + { + iPreviousPointerPosition = startPos; + } + + TPoint offset((iPreviousPointerPosition.iX - currPos.iX) , (iPreviousPointerPosition.iY - currPos.iY)); + + HideScreenFurniture(); + + TPoint topLeftCorner(0,0); + iMathsEngine.Pan(offset, topLeftCorner, EGlxPanIncrementUniform); + + + iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner, KGlxAnimationTimeDrag); + + iPreviousPointerPosition = currPos ; + iPreviousDragStartPosition = startPos; + } + +// ----------------------------------------------------------------------------- +// HandleGestureReleased +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandleGestureReleased(const GestureHelper::MGestureEvent& aEvent ) + { + TRACER("CGlxZoomPanEventHandler::HandleGestureReleasedEvent(const GestureHelper::MGestureEvent& )"); + + if ( /*(EGestureUnknown == iPreviousGestureCode) + ||*/(EGestureSwipeLeft == iPreviousGestureCode) + ||(EGestureSwipeRight == iPreviousGestureCode) + ||(EGestureSwipeUp == iPreviousGestureCode) + ||(EGestureSwipeDown == iPreviousGestureCode)) + { + SetupAnimatedPan(); + } + } + +void CGlxZoomPanEventHandler::SetupAnimatedPan() + { + TRACER("CGlxZoomPanEventHandler::SetupAnimatedPan"); + + CancelAnimationTimer(); + + iZoomAnimationTimer->Start( KGlxPanInertiaFrameInmS, + KGlxPanInertiaFrameInmS, + TCallBack( PanInertiaFrameElapsed,(TAny*)this) ); + + } + + +TInt CGlxZoomPanEventHandler::PanInertiaFrameElapsed(TAny* aPtr) + { + TRACER("CGlxZoomPanEventHandler::PanInertiaFrameElapsed"); + + CGlxZoomPanEventHandler* self = static_cast(aPtr); + + self->NextStepInerticPan(); + return 0; + + } + + +void CGlxZoomPanEventHandler::NextStepInerticPan() + { + TRACER("CGlxZoomPanEventHandler::NextStepInerticPan"); + + TPoint inertiaOffset = iMathsEngine.LastPanOffset(); + + if ( (10 >= Abs(inertiaOffset.iX )) && (10 >= Abs(inertiaOffset.iY) )) + { + CancelAnimationTimer(); + } + else + { + TPoint topLeftCorner(0,0); + TBool thresholdReached = EFalse; + iMathsEngine.Pan(inertiaOffset, topLeftCorner, EGlxPanIncrementInertic, &thresholdReached); + + iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner, KGlxAnimationTimeDrag); + + // we dont want to continue animated PAN if we have reached one end of the image. + if (thresholdReached) + { + CancelAnimationTimer(); + } + } + } + +void CGlxZoomPanEventHandler::SetPreviousEventCode(const TGestureCode aCode ) + { + TRACER("CGlxZoomPanEventHandler::SetPreviousEventCode(const TGestureCode aCode )"); + + iPreviousGestureCode = aCode; + } + +// ----------------------------------------------------------------------------- +// HandlePinchEvent +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandlePinchEventL(const GestureHelper::MGestureEvent& aEvent ) + { + TRACER("CGlxZoomControl::HandlePinchEvent(GestureHelper::MGestureEvent&)"); + + // Ignore events when we are animating in Zoom + if (iIsZoomingInAnimatedState) + { + return; + } + + TPoint pinchFocus = aEvent.PinchCentrePoint(); + TInt pinchPercentage = aEvent.PinchPercent(); // Wrong convention in variable nomenclature but better than ratioInPercentOfChangeInPinchDistance which is incidentally correct + + // pinchPercentage == 100 => No change in finger distance => No Zoom. + // A negative Pinch percentage signifies an error in calculations. So NOT handling these + if ( (pinchPercentage != 100) + && (pinchPercentage > 0) ) + { + Zoom(0, pinchPercentage, EZoomIn, &pinchFocus); + } + + HideScreenFurniture(); + } + +// ----------------------------------------------------------------------------- +// HandleDoubleTap +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandleDoubleTap(const GestureHelper::MGestureEvent& aEvent ) + { + TRACER("CGlxZoomControl::HandleDoubleTap(GestureHelper::MGestureEvent&)"); + + // Ignore events when we are animating in Zoom + if (iIsZoomingInAnimatedState) + { + return; + } + + SetupAnimatedZoom(EZoomOut); + } + +// ----------------------------------------------------------------------------- +// HandleSingleTap +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandleSingleTap(const GestureHelper::MGestureEvent& aEvent ) + { + TRACER("CGlxZoomControl::HandleSingleTap(GestureHelper::MGestureEvent&)"); + + // Ignore events when we are animating in Zoom + if (iIsZoomingInAnimatedState) + { + return; + } + + ShowScreenFurniture(KGlxScreenTimeout); + } + +// --------------------------------------------------------------------------- +// UiTimeOut: Hides the screen furniture once the Timeout happens +// --------------------------------------------------------------------------- +// +TInt CGlxZoomPanEventHandler::UiTimeOut(TAny* aSelf) + { + TRACER("CGlxZoomControl::UiTimeOut"); + if(aSelf) + { + CGlxZoomPanEventHandler* self = static_cast (aSelf); + //retreive the UI state. + if(EUiOn == self->iZoomUiState) + { + self->HideScreenFurniture(); + } + } + return KErrNone; + } + +// --------------------------------------------------------------------------- +// ZoomOutTimerL +// --------------------------------------------------------------------------- +// +TInt CGlxZoomPanEventHandler::ZoomOutTimerL(TAny* aSelf) + { + TRACER("CGlxZoomControl::ZoomOutTimerL"); + if(aSelf) + { + CGlxZoomPanEventHandler* self = static_cast (aSelf); + self->CallZoomOutL(); + } + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CallZoomOutL +// --------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::CallZoomOutL() + { + TRACER("CGlxZoomPanEventHandler::CallZoomOutL()"); + iZoomEventHandler.HandleZoomOutL(KGlxZoomOutCommand); + } + +//---------------------------------------------------------------------------------- +// ZoomTimerCallback:Callback function for the Zoom timer +//---------------------------------------------------------------------------------- +// +TInt CGlxZoomPanEventHandler::ZoomIntervalExpired(TAny* aPtr) + { + TRACER("CGlxZoomControl::ZoomIntervalExpired "); + CGlxZoomPanEventHandler* self = static_cast(aPtr); + self->DoZoom(); + return 0; // Timer has finished + } + +//---------------------------------------------------------------------------------- +// PanIntervalExpired:Callback function for the pan timer +//---------------------------------------------------------------------------------- +// +TInt CGlxZoomPanEventHandler::PanIntervalExpired(TAny* aPtr) + { + TRACER("CGlxZoomPanEventHandler::PanIntervalExpired "); + GLX_LOG_INFO("PanIntervalExpired "); + CGlxZoomPanEventHandler* self = static_cast(aPtr); + self->DoPan(); + return 0; // Timer has finished + } + +//---------------------------------------------------------------------------------- +// DoZoom:calls zooming function and updates the slider value +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::DoZoom() + { + TRACER("CGlxZoomPanEventHandler::DoZoom "); + Zoom(0, 0, iZoomMode); + } + + +//---------------------------------------------------------------------------------- +// DoPan:calls Panning function. +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::DoPan() + { + TRACER("CGlxZoomPanEventHandler::DoPan "); + + TBool atPanThreshold = EFalse; + TPoint topLeftCorner; + iMathsEngine.Pan(iPanDirection, topLeftCorner, EGlxPanIncrementExponential, &atPanThreshold); + + iZoomEventHandler.HandleViewPortParametersChanged(topLeftCorner, KGlxAnimationTimekeyPan); + + if ( atPanThreshold ) + { + CancelZoomPanTimer(); + } + + iMathsEngine.UpdatePanFactor(iPanTime); + } + + +//---------------------------------------------------------------------------------- +// OrientationChanged +//---------------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::OrientationChanged(const TRect& aNewScreenRect) + { + TRACER("CGlxZoomPanEventHandler::OrientationChanged "); + + Zoom(0, 0, iZoomMode) ; + + iMathsEngine.OrientationChanged(aNewScreenRect); + } + +// ----------------------------------------------------------------------------- +// ShowSlider +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::ShowScreenFurniture(TTimeIntervalMicroSeconds32 aTimeout) + { + TRACER("CGlxZoomPanEventHandler::ShowScreenFurniture()"); + + iZoomEventHandler.HandleShowUi(ETrue); + + if (aTimeout.Int()) + { + StartUITimer(aTimeout,aTimeout,TCallBack( UiTimeOut,this )); + } + } + + +// ----------------------------------------------------------------------------- +// HideScreenFurniture +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HideScreenFurniture() + { + TRACER("CGlxZoomPanEventHandler::HideScreenFurniture()"); + + iZoomEventHandler.HandleShowUi(EFalse); + CancelUITimer(); + } + + +// ----------------------------------------------------------------------------- +// ActivateZoom +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::ActivateZoom(TInt /*aInitialZoomRatio*/, + TSize aImageSize, + TZoomStartMode aStartMode, + TInt aMinSliderRange, + TInt aMaxSliderRange, + TSize& aOriginalDimensions, + TPoint* aZoomFocus) + { + TRACER("CGlxZoomPanEventHandler::ActivateZoom"); + + TPoint center(aImageSize.iWidth/2 ,aImageSize.iHeight/2 ); + TSize imageSize(aImageSize.iWidth, aImageSize.iHeight); + + TSize screenSize = TSize(AlfUtil::ScreenSize()); + + GLX_LOG_INFO2("ActivateZoom : Center = [%d,%d], ", + TInt(center.iX), + TInt(center.iY) + ); + + // A zoom ratio is calculated by multiplying the the new virtual size with 100 and dividing it with the original size. + // this division using integers might cause truncation. The +1 is added to make sure that every such truncation + // is pegged to the next higher integer than the next lower, thus ensuring that the zoom ratio in the zoom mode will always + // be greater than that in the full screen mode. + // + // The only other solution is to introduce a real number for this calculation. But do we really need such a deep level of accuracy? + iMinZoomRatio = iZoomRatio = aMinSliderRange + 1; + iMaxZoomRatio = aMaxSliderRange ; + + iMathsEngine.Initialize(center, + screenSize, + imageSize, + aOriginalDimensions, + iZoomRatio + ); + + //initially show the slider,so set the state to slider visible + TPoint viewPortTopLeft(0,0); + TSize viewPortDimension(0,0); + iZoomMode = EZoomIn; + + switch(aStartMode) + { + case EZoomStartKey : + { + StartZoomTimer(); + } + break; + case EZoomStartDoubleTap : + { + if (!iIsZoomingInAnimatedState) + { + if (aZoomFocus) + { + iZoomFocus.iX = aZoomFocus->iX ; + iZoomFocus.iY = aZoomFocus->iY ; + } + SetupAnimatedZoom(EZoomIn, &iZoomFocus); + } + } + break; + case EZoomStartPinch: + { + iZoomRatio = iMathsEngine.Zoom(EZoomIn, aMinSliderRange, + viewPortTopLeft, viewPortDimension); + + iZoomEventHandler.HandleViewPortParametersChanged(viewPortTopLeft , 0, + &viewPortDimension, iZoomRatio); + iZoomEventHandler.HandleShowUi(EFalse); + } + break; + case EZoomStartSlider : + break; + default: + break; + } + + } + +// ----------------------------------------------------------------------------- +// DeactivateZoom +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::DeactivateZoom() + { + TRACER("CGlxZoomPanEventHandler::DeactivateZoom()"); + + iZoomMode = EZoomOut; + iIsZoomingInAnimatedState = EFalse ; + CancelZoomPanTimer(); + CancelUITimer(); + CancelAnimationTimer(); + } + +// ----------------------------------------------------------------------------- +// HandleEvent +// ----------------------------------------------------------------------------- +// +// Todo: Combine both these HandleEvents +TBool CGlxZoomPanEventHandler::HandleEvent( const TAlfEvent& aEvent ) + { + TRACER("CGlxZoomControl::HandleEvent()"); + + TBool eventHandledState = EFalse; + + if (iZoomActivated) + { + if(!aEvent.IsCustomEvent()) + { + eventHandledState = EFalse; + } + else + { + GLX_LOG_INFO("CGlxZoomPanEventHandler::HandleEvent: Custom Event."); + TInt EventID = aEvent.CustomParameter(); + + switch(EventID) + { + case ETypePrimaryValueChange: + { + GLX_LOG_INFO(" CGlxZoomPanEventHandler::HandleEvent: ETypePrimaryValueChange." ); + + MulSliderPos* dataPtr = (MulSliderPos*)(aEvent.CustomEventData()); + TInt currentSliderValue = dataPtr->mCurrentValue; + + // is current value within accetable ranges. + if ( currentSliderValue > iMinZoomRatio + && currentSliderValue <= iMaxZoomRatio ) + { + Zoom(currentSliderValue, 0, EZoomIn); + } + else if (currentSliderValue <= iMinZoomRatio) + { + CallZoomOutL(); + } + eventHandledState = ETrue; + } + break; + + case ECustomEventIconClick : + { + //The Slider is held by user,so cancel the UI Timer + //When the slider is held ,the screen furniture shouldn't disappear + GLX_LOG_INFO( " CGlxZoomControl::offerEvent,ECustomEventIconClick"); + CancelUITimer(); + eventHandledState = ETrue; + } + break; + + case ECustomEventIconRelease: + { + //The slider is not held, by the user,start the ui timer to hide the screen furniture + GLX_LOG_INFO( " CGlxZoomControl::offerEvent,ECustomEventIconRelease"); + StartUITimer(KGlxScreenTimeout, KGlxScreenTimeout, TCallBack( UiTimeOut,this ) ); + eventHandledState = ETrue; + } + break; + + default: + { + GLX_LOG_INFO(" CGlxZoomPanEventHandler::HandleEvent default"); + eventHandledState = EFalse; + break; + } + } + } + } + return eventHandledState ; + } + +// ----------------------------------------------------------------------------- +// HandleEvent +// ----------------------------------------------------------------------------- +// +TBool CGlxZoomPanEventHandler::HandleEventL(const TAlfEvent &aEvent) + { + TRACER("CGlxZoomControl::HandleEventL()"); + + TBool consumed = EFalse; + + if (iZoomActivated) + { + if (aEvent.IsKeyEvent() ) + { + GLX_LOG_INFO(" CGlxZoomPanEventHandler::HandleEvent KeyEvent"); + consumed = HandlekeyEvents(aEvent); + } + else if(aEvent.IsPointerEvent() ) + { + GLX_LOG_INFO(" CGlxZoomPanEventHandler::HandleEvent PointerEvent "); + consumed = iZoomEventHandler.HandlePointerEventsL(aEvent); + } + } + return consumed; + } + + +// ----------------------------------------------------------------------------- +// Zoom +// ----------------------------------------------------------------------------- +// + + +void CGlxZoomPanEventHandler::Zoom(TInt aExpectedZoomLevel, TInt aRelativeZoomFactor, TZoomMode aZoomMode, TPoint* aZoomFocus) + { + TRACER("CGlxZoomControl::ZoomL( )"); + + TPoint viewPortTopLeft(0,0); + TSize viewPortDimension(0,0); + TBool atZoomThreshold = EFalse; + + iZoomRatio = iMathsEngine.Zoom(aZoomMode, + aExpectedZoomLevel, + viewPortTopLeft, + viewPortDimension, + &atZoomThreshold, + aZoomFocus, + aRelativeZoomFactor); + + iZoomEventHandler.HandleViewPortParametersChanged(viewPortTopLeft, 0, + &viewPortDimension, iZoomRatio); + + if( atZoomThreshold ) + { + CancelZoomPanTimer(); + if (iZoomRatio <= iMinZoomRatio) + { + CallZoomOutL(); + } + } + } + +// ----------------------------------------------------------------------------- +// ZoomIsActivated +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::SetZoomActivated(TBool aIsActivated) + { + TRACER("CGlxZoomPanEventHandler::ZoomIsActivated"); + iZoomActivated = aIsActivated; + } + +// ----------------------------------------------------------------------------- +// SetZoomUiState +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::SetZoomUiState(TUiState aZoomUiState) + { + TRACER("CGlxZoomPanEventHandler::ZoomIsActivated"); + iZoomUiState = aZoomUiState; + GLX_LOG_INFO1("CGlxZoomPanEventHandler::SetZoomUiState :=%d",iZoomUiState); + } + +// ----------------------------------------------------------------------------- +// ZoomUiState +// ----------------------------------------------------------------------------- +// +TUiState CGlxZoomPanEventHandler::ZoomUiState() + { + TRACER("CGlxZoomPanEventHandler::ZoomUiState"); + return iZoomUiState ; + } + +// ----------------------------------------------------------------------------- +// HandleMultiTouchReleased +// ----------------------------------------------------------------------------- +// +void CGlxZoomPanEventHandler::HandleMultiTouchReleased() + { + TRACER("CGlxZoomPanEventHandler::HandleMultiTouchReleased"); + +// ShowScreenFurniture(KGlxScreenTimeout); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/views/zoomview/src/glxzoommathsengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/views/zoomview/src/glxzoommathsengine.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,532 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of Zoom Maths engine +* +*/ + + +//includes +#include "glxzoomeventhandler.h" +#include "glxzoommathsengine.h" +#include "glxzoomcontrol.h" + +// Includes for Logs +#include // For Tracer +#include // For Log + +#define BORDER_HEIGHT (iBorderWidth.iHeight*(100-((newZoomRatio-iMinZoomRatio)*100/(iMaxZoomRatio-iMinZoomRatio))))/100 +#define BORDER_WIDTH (iBorderWidth.iWidth*(100-((newZoomRatio-iMinZoomRatio)*100/(iMaxZoomRatio-iMinZoomRatio))))/100 +// LOCAL CONSTANTS AND MACROS +const TInt KGlxLargeImageMaximumZoomRatio = 100 ; +const TInt KGlxSmallImageMaximumZoomRatio = 150 ; + +const TInt KGlxMinPanFactor = 1 ; // The min multiple of pixles to pan +const TInt KGlxPanInertiaFactor = 10 ; +const TInt KGlxPanFactorUpdateMultiple = 5 ; // The number of pan operations after which panning speed is increased by an order of magnitude +const TInt KGlxMaxPanUpdateMultiple = 6 ; +const TInt KGlxOrigin = 0 ; + +const TInt KGlxMinRelativeZoomPercent = 85 ; +const TInt KGlxMaxRelativeZoomPercent = 115 ; + +const TInt KGlxZoomPanInc = 10 ; // Min number of pixels panned in one keypress. This value is incremented exponentially by multiples of iPanFactor + +// ============================ MEMBER FUNCTIONS =============================== + +void TGlxZoomAndPanMathsEngine::Initialize(TPoint& aCenter, + TSize& aScreenSize, + TSize& aImageSize, + TSize& aOriginalZoomedDimensions, + TUint8 aInitialZoomRatio) + { + TRACER("void TGlxZoomAndPanMathsEngine::Initialize()"); + + iCenter = aCenter; + iScreenSize = aScreenSize; + + // This will only be set at initialization/constructiron. Never afterwards. + // [TODO] Is there a way to make this constant. + iActualImageSize = aImageSize; + + iMinZoomRatio = aInitialZoomRatio; + iZoomRatio = aInitialZoomRatio; + iMaxZoomRatio = ((aInitialZoomRatio == KGlxLargeImageMaximumZoomRatio) ? + KGlxSmallImageMaximumZoomRatio:KGlxLargeImageMaximumZoomRatio); + + iPanFactor = KGlxMinPanFactor; + + iImageVirtualSize.iHeight = aImageSize.iHeight * aInitialZoomRatio /100; + iImageVirtualSize.iWidth = aImageSize.iWidth * aInitialZoomRatio /100; + + iCenter.iX = iImageVirtualSize.iWidth/2 ; + iCenter.iY = iImageVirtualSize.iHeight/2; + + iBorderWidth.iWidth = (iScreenSize.iWidth - iImageVirtualSize.iWidth )/2 ; + iBorderWidth.iHeight = (iScreenSize.iHeight - iImageVirtualSize.iHeight)/2 ; + + } + +TInt TGlxZoomAndPanMathsEngine::NewCenterCoordinate(TInt aCenter, + TInt aOffset, + TUint16 aHalfScreenDimension, + TInt aMinimumCoordinate, + TInt aMaximumCoordinate, + TBool *aThresholdReached) + { + TRACER("TGlxZoomAndPanMathsEngine::NewCenterCoordinate"); + if(aOffset) + { + //Add the No:of Pixels that has to be panned,the No:of pixels added will be more + //if the pan key is held for long time,the PanFactor determines that + aCenter = aCenter + (aOffset*iPanFactor); + + // For Checking the boundary condition + if( (aCenter - aHalfScreenDimension) < aMinimumCoordinate ) + { + //This shows the black background on boundaries of the image and reset to the start of the image + aCenter = aHalfScreenDimension; + // Set the variable as true, if the there EXISTS a Variable at that address + if (NULL != aThresholdReached) + { + *aThresholdReached = ETrue; + } + } + if(aCenter + aHalfScreenDimension > aMaximumCoordinate ) + { + //This shows the black background on boundaries of the image and reset to the end of the image + aCenter = aMaximumCoordinate - aHalfScreenDimension; + if (NULL != aThresholdReached) + { + *aThresholdReached = ETrue; + } + } + } + return aCenter; + } + + +void TGlxZoomAndPanMathsEngine::Pan(TPoint aOffset, + TPoint& aViewPortTopLeft, + TGlxPanIncrementType aPanIncrement, + TBool * aThresholdReached) + { + TRACER("TGlxZoomAndPanMathsEngine::Pan"); + + GLX_LOG_INFO2("Pan: Center before PAN= [%d,%d] ", iCenter.iX, iCenter.iY ); + GLX_LOG_INFO2("Pan: Pan Offset = [%d,%d] ", TInt(aOffset.iX), TInt(aOffset.iY)); + + TPoint panOffset = aOffset; + TUint16 halfScreenWidth = iScreenSize.iWidth>>1; + TUint16 halfScreenHeight = iScreenSize.iHeight>>1; + + // if we are dragging or something like that the caller might want a uniform increase in panning factor. + if (EGlxPanIncrementUniform == aPanIncrement) + { + iPanFactor = KGlxMinPanFactor ; + } + else if ( EGlxPanIncrementInertic == aPanIncrement) + { + if (panOffset.iX > 0 ) + { + panOffset.iX = panOffset.iX - KGlxPanInertiaFactor ; + } + else + { + panOffset.iX = panOffset.iX + KGlxPanInertiaFactor ; + } + + if (panOffset.iY > 0 ) + { + panOffset.iY = panOffset.iY - KGlxPanInertiaFactor ; + } + else + { + panOffset.iY = panOffset.iY + KGlxPanInertiaFactor ; + } + } + + GLX_LOG_INFO1("Pan: Pan Factor = %d ", iPanFactor ); + + // dont pan on a dimension if image is smaller on that dimension than the screen. + if (iImageVirtualSize.iWidth > iScreenSize.iWidth) + { + iCenter.iX = NewCenterCoordinate( iCenter.iX, panOffset.iX, halfScreenWidth,KGlxOrigin, + iImageVirtualSize.iWidth, aThresholdReached) ; + } + + if (iImageVirtualSize.iHeight > iScreenSize.iHeight) + { + TBool thresholdReached = EFalse; + iCenter.iY = NewCenterCoordinate( iCenter.iY, panOffset.iY, halfScreenHeight,KGlxOrigin, + iImageVirtualSize.iHeight, &thresholdReached) ; + + if (NULL != aThresholdReached) + { + *aThresholdReached = *aThresholdReached || thresholdReached ; // if we reach the threshold along either axis this means we have reached the threshold + } + } + + aViewPortTopLeft.iX = iCenter.iX - halfScreenWidth; + aViewPortTopLeft.iY = iCenter.iY - halfScreenHeight; + + iLastPanOffset = panOffset; + + GLX_LOG_INFO2("Pan: Center after PAN= [%d,%d] ", + TInt(iCenter.iX), TInt(iCenter.iY) ); + GLX_LOG_INFO2("Pan: aViewPortTopLeft after PAN= [%d,%d] ", + TInt(aViewPortTopLeft.iX), TInt(aViewPortTopLeft.iY) ); + } + + +TInt TGlxZoomAndPanMathsEngine::Zoom(TZoomMode aZoomMode, + TInt aExpectedZoomRatio, // only for slider based zoom. = 0 for key based zoom + TPoint& aViewPortTopLeft, + TSize& aViewPortDimension, + TBool* aThresholdReached, + TPoint* apZoomFocus, + TInt aRelativeZoomFactor) + { + TRACER("TGlxZoomAndPanMathsEngine::Zoom "); + + //[TODO] Unlike the above method this method is a very very very very very small method. + //[TODO] Consider making this larger. [:|] + TUint16 halfScreenWidth = iScreenSize.iWidth>>1; + TUint16 halfScreenHeight = iScreenSize.iHeight>>1; + TPoint centerTranslationfactor(0,0); + + //[TODO] try to make sure that this variable does not get used in calculations. it always should be the center and + //existing and new screen and virtual image dimensions should be calculated using this one. + TPoint viewPortTopLeft(TPoint(iCenter).iX - halfScreenWidth, + TPoint(iCenter).iY - halfScreenHeight) ; + GLX_LOG_INFO2(" Zoom(): Center before Zoom= [%d,%d] ", iCenter.iX, iCenter.iY ); + GLX_LOG_INFO2(" Zoom(): viewPortTopLeft Before Zoom = [%d,%d] ", TInt(viewPortTopLeft.iX), + TInt(viewPortTopLeft.iY) ); + + TInt oldZoomRatio = iZoomRatio ; + TInt newZoomRatio = NewZoomRatio(aExpectedZoomRatio, aRelativeZoomFactor, aZoomMode, aThresholdReached); + + // we have an offcenter focus for our zoom in certain cases ( e.g pinch operation) or a double tap at an offcenter point. + // In such a case the zoom happens around that point. So we need to translate (move) the + // center in such a way that the relative position of the zoom facus does not change. + // centerTranslationfactor is the vector representation of that amount. + if (NULL != apZoomFocus) + { + // Offcenter Zooming will be enabled later on. + centerTranslationfactor.iX = (((apZoomFocus->iX - halfScreenWidth) * newZoomRatio)/oldZoomRatio) + (halfScreenWidth - apZoomFocus->iX); + centerTranslationfactor.iY = (((apZoomFocus->iY - halfScreenHeight) * newZoomRatio)/oldZoomRatio) + (halfScreenHeight - apZoomFocus->iY); + } + + GLX_LOG_INFO1(" Zoom: newZoomRatio = %d. ", newZoomRatio ); + + TSize imageDimension = TSize(iActualImageSize); + imageDimension.iWidth = (imageDimension.iWidth * newZoomRatio)/100; + imageDimension.iHeight = (imageDimension.iHeight * newZoomRatio)/100; + + // Is image size bigger than screen size AND image is panned to such an extent that + // the an edge of the image comes within the screen rectange? If so go ahead, + // for everything else there is mastercard. I mean the else condition below. + // [TODO] The master card however needs more simplification. + if( + ((iImageVirtualSize.iHeight > iScreenSize.iHeight) + && (iImageVirtualSize.iWidth > iScreenSize.iWidth)) + && ((iCenter.iX != iImageVirtualSize.iWidth/2) + || (iCenter.iY != iImageVirtualSize.iHeight/2)) + ) + { + //Calculate the new Center posistion accordingly to the new zoom factor + // [TODO] Suggest the use of overloaded operators so that points can be operated upon by vectors. + // specifically in this case to enable a point to be multiplied by a dimension resulting from the ratio of two dimension + iCenter.iX = (iCenter.iX * imageDimension.iWidth )/iImageVirtualSize.iWidth ; + iCenter.iY = (iCenter.iY * imageDimension.iHeight)/iImageVirtualSize.iHeight ; + + + //HEIGHT Calculation + // TODO: Hive center corrections into an different function. + // If the image might have become smaller than the screen DUE to or AFTER the above calculations + if((imageDimension.iHeight < iScreenSize.iHeight - BORDER_HEIGHT)) + { + iCenter.iY=(imageDimension.iHeight/2); + } + else + { + TInt weightedBorderHeight = (iBorderWidth.iHeight*(100-((newZoomRatio-iMinZoomRatio)*100/(iMaxZoomRatio-iMinZoomRatio))))/100 ; + // Is Center positioned such that the top end of the image is inside the + // screen. + if( iCenter.iY < (halfScreenHeight - weightedBorderHeight )) + { + iCenter.iY = halfScreenHeight - weightedBorderHeight ; + } + // Is Center positioned such that the Bottom end of the image is inside the + // screen. + else if((iCenter.iY + (halfScreenHeight - weightedBorderHeight ))> imageDimension.iHeight) + { + // if so pan the image so that the edge of the image and screen coincide. + iCenter.iY = imageDimension.iHeight - (halfScreenHeight - weightedBorderHeight) ; + } + } + + //WIDTH Calculation + if((imageDimension.iWidth < iScreenSize.iWidth - BORDER_WIDTH)) + { + iCenter.iX=(imageDimension.iWidth/2); + } + else + { + TInt weightedBorderWidth = (iBorderWidth.iWidth*(100-((newZoomRatio-iMinZoomRatio)*100/(iMaxZoomRatio-iMinZoomRatio))))/100 ; + if( iCenter.iX < (halfScreenWidth - weightedBorderWidth )) + { + iCenter.iX = (halfScreenWidth - weightedBorderWidth ); + } + else if((iCenter.iX + (halfScreenWidth - weightedBorderWidth ))> imageDimension.iWidth) + { + iCenter.iX = imageDimension.iWidth - (halfScreenWidth - weightedBorderWidth ) ; + } + } + //Update the TopLeft corner and then re align to the center in the below code + viewPortTopLeft.iY = iCenter.iY - halfScreenHeight ; + viewPortTopLeft.iX = iCenter.iX - halfScreenWidth ; + + iImageVirtualSize = imageDimension; + } + else + { + //Conditions to Check. + //1.Image Height is Smaller than screen Size and Width is Bigger than screen Size. + //2.Image Height is Bigger than screen Size and Width is Smaller than screen Size. + //3.Both Image Height and Width is Smaller than screen Size + //4.Image Height is Bigger than screen Size and it is panned. + //4.Image Height is Bigger than screen Size and it is not panned at all. + //5.Image Width is Bigger than screen Size and it is panned. + //6.Image Width is Bigger than screen Size and it is not panned at all. + //7. First Time Zoom operation is performed. + + if( (imageDimension.iHeight <= iScreenSize.iHeight) || + ( (imageDimension.iHeight > iScreenSize.iHeight) && + (iCenter.iY == (iImageVirtualSize.iHeight/2)) ) || + ( ((iCenter.iY + halfScreenHeight) > imageDimension.iHeight)&& + ((iCenter.iY - halfScreenHeight) < KGlxOrigin) )) + { + //The Image is not panned along Y axis, so the center of the image is the center co-ordinate on this axis. + iCenter.iY=(imageDimension.iHeight/2); + } + else + { + //The image is panned and shift the center posistion + //Calculate the new Center posistion accordingly to the new zoom factor + iCenter.iY = (iCenter.iY * imageDimension.iHeight)/iImageVirtualSize.iHeight; + if( (iCenter.iY + halfScreenHeight) > imageDimension.iHeight) + { + //Stick the Image to bottom side and then re-posistion the center + iCenter.iY = imageDimension.iHeight - halfScreenHeight; + } + // New DIM is less than Old one. and all above conditions fail. + // This means that new DIM is smaller than VP DIM. So keep center 'centered'. + // DIM = dimension + else if(iImageVirtualSize.iHeight > imageDimension.iHeight) + { + //This is executed in the Zoom Out Case,In ZoomIn Case the Image is widened. + iCenter.iY=(imageDimension.iHeight/2); + } + } + + if((imageDimension.iWidth <= iScreenSize.iWidth) || + ( (imageDimension.iWidth > iScreenSize.iWidth) && (iCenter.iX == + (iImageVirtualSize.iWidth/2)) ) || ( (iCenter.iX + halfScreenWidth) > + imageDimension.iWidth )&&((iCenter.iX - halfScreenWidth) < KGlxOrigin) ) + { + //The Image is not panned along X axis, ,so the center of the image is the center co-ordinate. + iCenter.iX=(imageDimension.iWidth/2); + } + else + { + //The image is panned and shift the center posistion + //Calculate the new Center posistion accordingly to the new zoom factor + iCenter.iX = (iCenter.iX * imageDimension.iWidth )/iImageVirtualSize.iWidth ; + if( (iCenter.iX + halfScreenWidth) > imageDimension.iWidth ) + { + //Stick the Image to right side and then re-posistion the center + iCenter.iX = imageDimension.iWidth - halfScreenWidth ; + } + else if(iImageVirtualSize.iWidth >imageDimension.iWidth ) + { + //The Image is panned and while zooming out ,the center has to be possistioned to center of the screen. + iCenter.iX =(imageDimension.iWidth/2); + } + } + + viewPortTopLeft.iX = iCenter.iX - halfScreenWidth; + viewPortTopLeft.iY = iCenter.iY - halfScreenHeight; + iImageVirtualSize = imageDimension; + + } + + // if centerTranslationfactor exists that means we have an off center zoom, then + // pan that way to get the new center. + Pan(centerTranslationfactor, viewPortTopLeft, EGlxPanIncrementUniform) ; + + aViewPortDimension = imageDimension ; + aViewPortTopLeft = viewPortTopLeft ; + + GLX_LOG_INFO2("Zoom(): Center After Zoom = [%d,%d] ", TInt(iCenter.iX), + TInt(iCenter.iY) ); + GLX_LOG_INFO2("Zoom(): aViewPortDimension After Zoom = [%d,%d] ", + TInt(aViewPortDimension.iWidth), TInt(aViewPortDimension.iHeight) ); + GLX_LOG_INFO2("Zoom(): viewPortTopLeft After Zoom = [%d,%d] ", + TInt(viewPortTopLeft.iX), TInt(viewPortTopLeft.iY) ); + + return newZoomRatio; + } + +//------------------------------------------------------------------------------------- +// UpdatePanFactor: Calculates the Pan Factor based on time the key was pressed +//------------------------------------------------------------------------------------- +// +void TGlxZoomAndPanMathsEngine::UpdatePanFactor(TTime& aPanTime) + { + TRACER("void TGlxZoomAndPanMathsEngine::UpdatePanFactor()"); + + iContinuousPanOperations++; + + TInt elapsedPanOperationSetCount = iContinuousPanOperations/KGlxPanFactorUpdateMultiple; + + // Double the pan factor for every multiple of KGlxPanFactorUpdateMultiple that the key was pressed till + // we have crossed 'KGlxMaxTimeMultiple' orders of magnitude + if (KGlxMaxPanUpdateMultiple > elapsedPanOperationSetCount ) + { + iPanFactor = KGlxMinPanFactor << elapsedPanOperationSetCount ; + } + GLX_LOG_INFO1("iPanFactor %d", iPanFactor); + } + + +//------------------------------------------------------------------------------------- +// NewZoomRatio: Calculates the Zoom Ratio +//------------------------------------------------------------------------------------- +// +TInt TGlxZoomAndPanMathsEngine::NewZoomRatio( + TInt aExpectedZoomRatio, + TInt aRelativeZoomFactor, + TZoomMode aZoomMode, + TBool *aThresholdReached) + { + TRACER("TGlxZoomAndPanMathsEngine::NewZoomRatio "); + GLX_LOG_INFO1("NewZoomRatio: Old Zoom Ratio = %d . ",TInt(iZoomRatio) ); + GLX_LOG_INFO1("NewZoomRatio: Expected Zoom Ratio = %d . ",aExpectedZoomRatio ); + GLX_LOG_INFO1("NewZoomRatio: Relative Zoom Factor = %d . ",aRelativeZoomFactor ); + + // We ignore zoommode and aRelativeZoomFactor if we have a aExpectedZoomRatio. + // We ignore zoommode if we have a aRelativeZoomFactor. + if (aExpectedZoomRatio > 0) + { + iZoomRatio = aExpectedZoomRatio ; + } + else if (aRelativeZoomFactor > 0) + { + //Pruning extreme values. Not allowing more than 15% change in zoom ratio. + TInt normalizedRelativeZoomFactor = aRelativeZoomFactor ; + if (normalizedRelativeZoomFactor < KGlxMinRelativeZoomPercent) + { + normalizedRelativeZoomFactor = KGlxMinRelativeZoomPercent; + } + else if (normalizedRelativeZoomFactor > KGlxMaxRelativeZoomPercent) + { + normalizedRelativeZoomFactor = KGlxMaxRelativeZoomPercent; + } + + iZoomRatio = (iZoomRatio * normalizedRelativeZoomFactor)/100 ; + } + else + { + if(EZoomIn == aZoomMode) + { + iZoomRatio += KGlxZoomPanInc; + } + else + { + iZoomRatio -= KGlxZoomPanInc; + } + } + + // if iZoomRatio crosses max or minimum limits, then peg them to those limits. + if (iZoomRatio >= iMaxZoomRatio) + { + iZoomRatio = iMaxZoomRatio; + if (NULL != aThresholdReached) + { + GLX_LOG_INFO1("NewZoomRatio: Max Threshold Reached iMaxZoomRatio = %d .",iMaxZoomRatio); + *aThresholdReached = ETrue; + } + } + else if( iZoomRatio <= iMinZoomRatio ) + { + iZoomRatio = iMinZoomRatio; + if (NULL != aThresholdReached) + { + GLX_LOG_INFO1("NewZoomRatio: Min Threshold Reached iInitialZoomRatio = %d .", iMinZoomRatio ); + *aThresholdReached = ETrue; + } + } + + GLX_LOG_INFO1("NewZoomRatio: New Zoom Ratio = %d. ",TInt(iZoomRatio) ); + return iZoomRatio; + } + + +//------------------------------------------------------------------------------------- +// OrientationChanged: +//------------------------------------------------------------------------------------- +// +void TGlxZoomAndPanMathsEngine::OrientationChanged(const TRect& aNewScreenRect) + { + TRACER("void TGlxZoomAndPanMathsEngine::OrientationChanged()"); + iScreenSize.iWidth = aNewScreenRect.Width(); + iScreenSize.iHeight = aNewScreenRect.Height(); + } + +//------------------------------------------------------------------------------------- +// ImageVirtualSize: retieves the virtual size of the image. +//------------------------------------------------------------------------------------- +// +TSize TGlxZoomAndPanMathsEngine::ImageVirtualSize() + { + TRACER("TGlxZoomAndPanMathsEngine::ImageVirtualSize()"); + return iImageVirtualSize; + } + + +//------------------------------------------------------------------------------------- +// ScreenSize: retrieves the screen size . +//------------------------------------------------------------------------------------- +// +TSize TGlxZoomAndPanMathsEngine::ScreenSize() + { + TRACER("TGlxZoomAndPanMathsEngine::ScreenSize()"); + return iScreenSize; + } + +//------------------------------------------------------------------------------------- +// ImageVirtualSize: retrieves the screen size . +//------------------------------------------------------------------------------------- +// +void TGlxZoomAndPanMathsEngine::SetupPanOperation() + { + TRACER("TGlxZoomAndPanMathsEngine::SetupPanOperation()"); + iContinuousPanOperations = 0 ; + } + +TPoint TGlxZoomAndPanMathsEngine::LastPanOffset() + { + TRACER("TGlxZoomAndPanMathsEngine::LastPanOffset()"); + return iLastPanOffset; + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/bwins/glxvisuallistmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/bwins/glxvisuallistmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,27 @@ +EXPORTS + ??0CGlxIconManager@@IAE@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 1 NONAME ; CGlxIconManager::CGlxIconManager(class MGlxMediaList &, class MGlxVisualList &) + ??0TGlxIconManagerParams@@QAE@MMMMM@Z @ 2 NONAME ; TGlxIconManagerParams::TGlxIconManagerParams(float, float, float, float, float) + ??1CGlxIconManager@@UAE@XZ @ 3 NONAME ; CGlxIconManager::~CGlxIconManager(void) + ??1CGlxVisualIconManager@@UAE@XZ @ 4 NONAME ; CGlxVisualIconManager::~CGlxVisualIconManager(void) + ?AddIconToItemL@CGlxIconManager@@UAEXHH@Z @ 5 NONAME ; void CGlxIconManager::AddIconToItemL(int, int) + ?AddIconToItemL@CGlxIconManager@@UAEXPAVCAlfVisual@@H@Z @ 6 NONAME ; void CGlxIconManager::AddIconToItemL(class CAlfVisual *, int) + ?AllocListL@CGlxVisualListManager@@QAEPAVMGlxVisualList@@AAVMGlxMediaList@@AAVCAlfEnv@@AAVCAlfDisplay@@W4TScaleMode@CAlfImageVisual@@@Z @ 7 NONAME ; class MGlxVisualList * CGlxVisualListManager::AllocListL(class MGlxMediaList &, class CAlfEnv &, class CAlfDisplay &, enum CAlfImageVisual::TScaleMode) + ?BaseConstructL@CGlxIconManager@@QAEXXZ @ 8 NONAME ; void CGlxIconManager::BaseConstructL(void) + ?BrushPositionInVisual@CGlxIconManager@@UAEHHH@Z @ 9 NONAME ; int CGlxIconManager::BrushPositionInVisual(int, int) + ?BrushPositionInVisual@CGlxIconManager@@UAEHPAVCAlfVisual@@H@Z @ 10 NONAME ; int CGlxIconManager::BrushPositionInVisual(class CAlfVisual *, int) + ?Close@CGlxVisualListManager@@QAEXXZ @ 11 NONAME ; void CGlxVisualListManager::Close(void) + ?CreateVisualFromIconL@CGlxIconManager@@UAEXHAAVTDesC16@@@Z @ 12 NONAME ; void CGlxIconManager::CreateVisualFromIconL(int, class TDesC16 &) + ?CreateVisualFromIconL@CGlxIconManager@@UAEXHAAVTDesC16@@AAVTGlxIconManagerParams@@@Z @ 13 NONAME ; void CGlxIconManager::CreateVisualFromIconL(int, class TDesC16 &, class TGlxIconManagerParams &) + ?CreateVisualFromTextureL@CGlxIconManager@@UAEXAAVCAlfTexture@@@Z @ 14 NONAME ; void CGlxIconManager::CreateVisualFromTextureL(class CAlfTexture &) + ?CreateVisualFromTextureL@CGlxIconManager@@UAEXAAVCAlfTexture@@AAVTGlxIconManagerParams@@@Z @ 15 NONAME ; void CGlxIconManager::CreateVisualFromTextureL(class CAlfTexture &, class TGlxIconManagerParams &) + ?ListL@CGlxVisualListManager@@QAEPAVMGlxVisualList@@AAVMGlxMediaList@@AAVCAlfEnv@@AAVCAlfDisplay@@W4TScaleMode@CAlfImageVisual@@@Z @ 16 NONAME ; class MGlxVisualList * CGlxVisualListManager::ListL(class MGlxMediaList &, class CAlfEnv &, class CAlfDisplay &, enum CAlfImageVisual::TScaleMode) + ?ManagerL@CGlxVisualListManager@@SAPAV1@XZ @ 17 NONAME ; class CGlxVisualListManager * CGlxVisualListManager::ManagerL(void) + ?NewL@CGlxBorderIconManager@@SAPAV1@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 18 NONAME ; class CGlxBorderIconManager * CGlxBorderIconManager::NewL(class MGlxMediaList &, class MGlxVisualList &) + ?NewL@CGlxVideoIconManager@@SAPAV1@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 19 NONAME ; class CGlxVideoIconManager * CGlxVideoIconManager::NewL(class MGlxMediaList &, class MGlxVisualList &) + ?NewL@CGlxVisualIconManager@@SAPAV1@AAVMGlxMediaList@@AAVMGlxVisualList@@@Z @ 20 NONAME ; class CGlxVisualIconManager * CGlxVisualIconManager::NewL(class MGlxMediaList &, class MGlxVisualList &) + ?ReleaseList@CGlxVisualListManager@@QAEXPAVMGlxVisualList@@@Z @ 21 NONAME ; void CGlxVisualListManager::ReleaseList(class MGlxVisualList *) + ?RemoveFromItem@CGlxIconManager@@UAEXHH@Z @ 22 NONAME ; void CGlxIconManager::RemoveFromItem(int, int) + ?RemoveFromItem@CGlxIconManager@@UAEXPAVCAlfVisual@@H@Z @ 23 NONAME ; void CGlxIconManager::RemoveFromItem(class CAlfVisual *, int) + ?SetScaleMode@CGlxVisualObject@@QAEXW4TScaleMode@CAlfImageVisual@@@Z @ 24 NONAME ; void CGlxVisualObject::SetScaleMode(enum CAlfImageVisual::TScaleMode) + ?SetThumbnailBorderColor@CGlxBorderIconManager@@QAEXXZ @ 25 NONAME ; void CGlxBorderIconManager::SetThumbnailBorderColor(void) + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/eabi/glxvisuallistmanageru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/eabi/glxvisuallistmanageru.def Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +EXPORTS + _ZN15CGlxIconManager14AddIconToItemLEP10CAlfVisuali @ 1 NONAME + _ZN15CGlxIconManager14AddIconToItemLEii @ 2 NONAME + _ZN15CGlxIconManager14BaseConstructLEv @ 3 NONAME + _ZN15CGlxIconManager14RemoveFromItemEP10CAlfVisuali @ 4 NONAME + _ZN15CGlxIconManager14RemoveFromItemEii @ 5 NONAME + _ZN15CGlxIconManager21BrushPositionInVisualEP10CAlfVisuali @ 6 NONAME + _ZN15CGlxIconManager21BrushPositionInVisualEii @ 7 NONAME + _ZN15CGlxIconManager21CreateVisualFromIconLEiR7TDesC16 @ 8 NONAME + _ZN15CGlxIconManager21CreateVisualFromIconLEiR7TDesC16R21TGlxIconManagerParams @ 9 NONAME + _ZN15CGlxIconManager24CreateVisualFromTextureLER11CAlfTexture @ 10 NONAME + _ZN15CGlxIconManager24CreateVisualFromTextureLER11CAlfTextureR21TGlxIconManagerParams @ 11 NONAME + _ZN15CGlxIconManagerC1ER13MGlxMediaListR14MGlxVisualList @ 12 NONAME + _ZN15CGlxIconManagerC2ER13MGlxMediaListR14MGlxVisualList @ 13 NONAME + _ZN15CGlxIconManagerD0Ev @ 14 NONAME + _ZN15CGlxIconManagerD1Ev @ 15 NONAME + _ZN15CGlxIconManagerD2Ev @ 16 NONAME + _ZN16CGlxVisualObject12SetScaleModeEN15CAlfImageVisual10TScaleModeE @ 17 NONAME + _ZN20CGlxVideoIconManager4NewLER13MGlxMediaListR14MGlxVisualList @ 18 NONAME + _ZN21CGlxBorderIconManager23SetThumbnailBorderColorEv @ 19 NONAME + _ZN21CGlxBorderIconManager4NewLER13MGlxMediaListR14MGlxVisualList @ 20 NONAME + _ZN21CGlxVisualIconManager4NewLER13MGlxMediaListR14MGlxVisualList @ 21 NONAME + _ZN21CGlxVisualIconManagerD0Ev @ 22 NONAME + _ZN21CGlxVisualIconManagerD1Ev @ 23 NONAME + _ZN21CGlxVisualIconManagerD2Ev @ 24 NONAME + _ZN21CGlxVisualListManager10AllocListLER13MGlxMediaListR7CAlfEnvR11CAlfDisplayN15CAlfImageVisual10TScaleModeE @ 25 NONAME + _ZN21CGlxVisualListManager11ReleaseListEP14MGlxVisualList @ 26 NONAME + _ZN21CGlxVisualListManager5CloseEv @ 27 NONAME + _ZN21CGlxVisualListManager5ListLER13MGlxMediaListR7CAlfEnvR11CAlfDisplayN15CAlfImageVisual10TScaleModeE @ 28 NONAME + _ZN21CGlxVisualListManager8ManagerLEv @ 29 NONAME + _ZN21TGlxIconManagerParamsC1Efffff @ 30 NONAME + _ZN21TGlxIconManagerParamsC2Efffff @ 31 NONAME + _ZTI15CGlxIconManager @ 32 NONAME ; ## + _ZTI16CGlxVisualObject @ 33 NONAME ; ## + _ZTI21CGlxVisualListControl @ 34 NONAME ; ## + _ZTI21CGlxVisualListManager @ 35 NONAME ; ## + _ZTI21TGlxDefaultIdProviderI6TGlxIdI21TGlxIdViewContextBaseEE @ 36 NONAME ; ## + _ZTV15CGlxIconManager @ 37 NONAME ; ## + _ZTV16CGlxVisualObject @ 38 NONAME ; ## + _ZTV21CGlxVisualListControl @ 39 NONAME ; ## + _ZTV21CGlxVisualListManager @ 40 NONAME ; ## + _ZTV21TGlxDefaultIdProviderI6TGlxIdI21TGlxIdViewContextBaseEE @ 41 NONAME ; ## + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/group/bld.inf Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2008-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: Build information for subsystem Visual List Manager. +* +*/ + + + + +PRJ_MMPFILES +glxvisuallistmanager.mmp diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/group/glxvisuallistmanager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/group/glxvisuallistmanager.mmp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2008-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: Project definition file +* +*/ + + + + + +#include +#include + +#include "../../../group/glxbuildcommon.mmh" + +TARGET glxvisuallistmanager.dll +TARGETTYPE dll +UID 0x1000008d 0x20000A02 + +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif +CAPABILITY ALL -Tcb // CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE glxbordericonmanager.cpp +SOURCE glxiconmanager.cpp +SOURCE glxitemvisual.cpp +SOURCE glxvisuallistcontrol.cpp +SOURCE glxvisuallistmanager.cpp +SOURCE glxvisuallistwindow.cpp +SOURCE glxvideoiconmanager.cpp +SOURCE glxvisualiconmanager.cpp + +USERINCLUDE ../inc +// System includes from the source tree +SYSTEMINCLUDE ../../../inc +SYSTEMINCLUDE ../../inc +SYSTEMINCLUDE ../../layouts/inc +SYSTEMINCLUDE ../../medialists/inc +SYSTEMINCLUDE ../../texturemanager/inc +SYSTEMINCLUDE ../../uiutilities/inc + +APP_LAYER_SYSTEMINCLUDE + + +LIBRARY aknlayout2scalable.lib +LIBRARY aknskins.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY cdlengine.lib +LIBRARY commonengine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY egul.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY featmgr.lib +//LIBRARY glxlayouts.lib +LIBRARY glxmedialists.lib +LIBRARY glxuiutilities.lib +LIBRARY glxtexturemanager.lib +LIBRARY hitchcock.lib +LIBRARY hlplch.lib +LIBRARY mpxcommon.lib +LIBRARY alfclient.lib + + +// End of File diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxbordericonmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxbordericonmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2008-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: Adds a border to icons in visual lists +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ + + +#ifndef C_GLXBORDERICONMANAGER_H +#define C_GLXBORDERICONMANAGER_H + +#include + +#include "glxiconmanager.h" + +/** + * CGlxBorderIconManager + * + * Icon manager for visuals + * Handles adding video icon if required. + * If thumbnail not present look for icon attribute + * @author D Schofield + * @lib glxvisuallistmanager + */ +struct TIconInfo; +class CAlfVisual; +class TGlxMediaId; +class CGlxMedia; +class CAlfBorderBrush; + +NONSHARABLE_CLASS( CGlxBorderIconManager ) : public CGlxIconManager + { +public: + /** + * Static constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + * @return pointer to CGlxVideoIconManager instance + */ + IMPORT_C static CGlxBorderIconManager* NewL(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + /** + * Destructor + */ + ~CGlxBorderIconManager(); + + /** + *Get the cached color and set it as the thumbnail border color. + */ + IMPORT_C void SetThumbnailBorderColor(); +private: // from MGlxVisualListObserver + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + +private: + /** + * Constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + */ + CGlxBorderIconManager(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Add a border brush to the visual] + * @param aVisual Visual to add the border to + */ + void AddBorderBrushL(CAlfVisual* aVisual); + +private: + /// Owned: the border brush + CAlfBorderBrush* iBorderBrush; + }; + +#endif // C_GLXBORDERICONMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxiconmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxiconmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2008-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: Icon manager base class +* +*/ + + + + +#ifndef C_GLXICONMANAGER_H +#define C_GLXICONMANAGER_H + +#include + +#include +#include "mglxvisuallistobserver.h" + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ + +/** + * @internal re-reviewed 09/08/2007 by Rowland Cook + */ + +/** + * TGlxIconManagerParams + * + * Container class for icon/brush parameters passed to + * icon manager. (Currently only holds co-ordinates for + * brush object relative to its parent visual.) + * + * @author M Byrne + * @lib glxvisuallistmanager + */ +NONSHARABLE_CLASS( TGlxIconManagerParams ) + { +public: + /** + * TGlxIconManagerParams constructor + * @param aTlX top left x pos. for icon (relative to parent visual) + * @param aTlY top left y pos. for icon (relative to parent visual) + * @param aBrX lower right x pos. for icon (relative to parent visual) + * @param aBrY lower right y pos. for icon (relative to parent visual) + * @param aOpacity opacity + */ + IMPORT_C TGlxIconManagerParams(TReal32 aTlX, TReal32 aTlY, + TReal32 aBrX, TReal32 aBrY, + TReal32 aOpacity = 1.0); +public: + TReal32 iTlX; + TReal32 iTlY; + TReal32 iBrX; + TReal32 iBrY; + TReal32 iOpacity; + }; + + +/** + * CGlxIconManager + * + * Icon manager base class + * + * @author M Byrne + * @lib glxvisuallistmanager + */ +class CGlxUiUtility; +class CAlfBrush; +class CAlfImageBrush; +class CGlxVisualListManager; +class CAlfTexture; + +class CGlxIconManager : public CBase, public MGlxMediaListObserver, + public MGlxVisualListObserver + { +public: + + /** + * Destructor + */ + IMPORT_C virtual ~CGlxIconManager(); + + /** + * Base construction + */ + IMPORT_C void BaseConstructL(); + + /** + * Create image brush from supplied bitmap + * @param aIconResourceId id for resource (from .mbg) + * @param aFilename full filename for .mbm + */ + IMPORT_C virtual void CreateVisualFromIconL(TInt aIconResourceId, + TDesC& aFilename); + + /** + * Create image brush from supplied bitmap + * @param aIconResourceId id for resource (from .mbg) + * @param aFilename full filename for .mbm + * @param aParams position and opacity params for icon + */ + IMPORT_C virtual void CreateVisualFromIconL(TInt aIconResourceId, + TDesC& aFilename, TGlxIconManagerParams& aParams); + + /** + * Create image brush from supplied texture + * @param aTexture Texture to apply to the new image brush + */ + IMPORT_C virtual void CreateVisualFromTextureL( CAlfTexture& aTexture ); + + /** + * Create image brush from supplied texture + * @param aTexture Texture to apply to the new image brush + * @param aParams position and opacity params for icon + */ + IMPORT_C virtual void CreateVisualFromTextureL( + CAlfTexture& aTexture, TGlxIconManagerParams& aParams ); + + /* + * Add icon to visual at specified position + * @param aListIndex index in visual list + * @param aBrushIndex index of item to add + */ + IMPORT_C virtual void AddIconToItemL(TInt aListIndex, TInt aBrushIndex); + + /* + * Add icon to visual at specified position + * @param aVisual pointer to visual + * @param aBrushIndex index of item to add + */ + IMPORT_C virtual void AddIconToItemL(CAlfVisual* aVisual, TInt aBrushIndex); + + /* + * Remove icon from visual at specified position + * @param aListIndex index in visual list + * @param aBrushIndex index of item to remove + */ + IMPORT_C virtual void RemoveFromItem(TInt aListIndex, TInt aBrushIndex); + + /* + * Remove icon from visual at specified position + * @param aVisual pointer to visual + * @param aBrushIndex index of item to remove + */ + IMPORT_C virtual void RemoveFromItem(CAlfVisual* aVisual, + TInt aBrushIndex); + + /** + * Check for position of specifed brush in visual's brush array + * @param aListIndex position of visual in visual list + * @param aBrushIndex index of brush in icon mgr's array of brushes + * @return position of brush in visual's brush array or KErrNotFound + * if brush not present in visual + */ + IMPORT_C virtual TInt BrushPositionInVisual(TInt aListIndex, + TInt aBrushIndex); + + /** + * Check for position of specifed brush in visual's brush array + * @param aListIndex position of visual in visual list + * @param aBrushIndex index of brush in icon mgr's array of brushes + * @return position of brush in visual's brush array or KErrNotFound + * if brush not present in visual + */ + IMPORT_C virtual TInt BrushPositionInVisual(CAlfVisual* aVisual, + TInt aBrushIndex); + +private: // From MGlxMediaListObserver + /// See @ref MGlxMediaListObserver::HandleItemAddedL + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMediaL + void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemRemovedL + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemModifiedL + void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleFocusChangedL + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleItemSelectedL + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + + /// See @ref MGlxMediaListObserver::HandleMessageL + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +private: // from MGlxVisualListObserver + /** @see MGlxVisualListObserver::HandleFocusChangedL */ + void HandleFocusChangedL( TInt aFocusIndex, TReal32 aItemsPerSecond, MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType ); + /** @see MGlxVisualListObserver::HandleSizeChanged */ + void HandleSizeChanged( const TSize& aSize, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualRemoved */ + void HandleVisualRemoved( const CAlfVisual* aVisual, MGlxVisualList* aList ); + /** @see MGlxVisualListObserver::HandleVisualAddedL */ + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + +protected: + /** + * Constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + * @return pointer to CGlxIconManager + */ + IMPORT_C CGlxIconManager( MGlxMediaList& aMediaList, MGlxVisualList& aVisualList ); + + +protected: + /** Reference to media list */ + MGlxMediaList& iMediaList; + + /** Reference to visual list */ + MGlxVisualList& iVisualList; + + /** UI utility, reference */ + CGlxUiUtility* iUiUtility; + /** Array of image brushes created by this icon mgr */ + RPointerArray< CAlfBrush > iImageBrushArray; + }; + +#endif // C_GLXICONMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxiconmgrdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxiconmgrdefs.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2008-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: Overlay icon definitions +* +*/ + + + + +#ifndef __GLXICONMGRDEFS_H__ +#define __GLXICONMGRDEFS_H__ + +#include + +/** + * Namespace for icon manager related definitions + */ +namespace NGlxIconMgrDefs + { + /// + enum TGlxIconPosition + { + EGlxIconTopLeft, + EGlxIconTopRight, + EGlxIconBottomLeft, + EGlxIconBottomRight, + EGlxIconCentred + }; + } + +#endif // __GLXICONMGRDEFS_H__ + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxitemvisual.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxitemvisual.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,485 @@ +/* +* Copyright (c) 2008-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: A visual representing an image/video/etc thumbnail +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#ifndef C_GLXITEMVISUAL_H +#define C_GLXITEMVISUAL_H + +#include +#include // for CAlfImageVisual::TScaleMode +#include // for anchor types +#include // TAlfImage +// FORWARD DECLARATIONS +class CAlfAnchorLayout; +class CAlfDeckLayout; +class CAlfLayout; +class CAlfControl; +class CAlfBrush; + +class TMPXAttribute; + + +class CAlfDisplay; +class CAlfTexture; +class CAlfImageBrush; +class CGlxUiUtility; +class TGlxMedia; +class TGlxAnchors; +// INCLUDES +#include +#include +#include // TAlfImage +#include +#include +#include +#include +class MGlxMediaList; +#include "glxiconmgrdefs.h" + +class MGlxVisualObjectStatusObserver; +class MGlxVisualObjectLayoutRefreshObserver; +/** + * MGlxVisualObjectParameterFactory + * Interface for the CGlxVisualObject + * to retrieve parameters for visual creation + * + * @author Kimmo Hoikka + */ +class MGlxVisualObjectParameterFactory + { + protected: + + /** + * Destructor, dont allow deletion through this interface + */ + virtual ~MGlxVisualObjectParameterFactory() { }; + + public: + + /** + * @return the HUI layout for the visual object + */ + virtual CAlfLayout* Layout() = 0; + + /** + * @return the HUI control that owns the HUI object + */ + virtual CAlfControl& VisualOwner() = 0; + + /** + * Ownership of the brush stays in the factory + * + * @return the Border brush for the Visual. + */ + virtual CAlfBrush* BorderBrush() = 0; + + /** + * @return the scale mode to use for the thumbnails + */ + virtual CAlfImageVisual::TScaleMode ThumbnailScaleMode() = 0; + }; + +/** + * CGlxVisualObject + * + * A visual representing an image/video/etc thumbnail + * + * @author Kimmo Hoikka + */ +class CGlxVisualObject : public CBase, public MGlxTextureObserver + { + public: + /** + * Thumbnail/icon status of a visual. + */ + enum TVisualStatus + { + EHasDefaultIcon, EHasErrorIcon, EHasOtherIcon, EHasThumbnail + }; + + public: + /** + * Constructor. + * @param aParent the parent HUI control + * @param aLayout the layout chain for the visual + */ + static CGlxVisualObject* NewLC( + MGlxVisualObjectParameterFactory& aFactory, + MGlxMediaList& aMediaList ); + + /** + * Destructor + */ + ~CGlxVisualObject(); + + + /** + * Set the scale mode for the visual. + * @param aMode The scale mode to be used. + */ + IMPORT_C void SetScaleMode(CAlfImageVisual::TScaleMode aMode); + + /** + * @return the visual of this object + */ + CAlfVisual* Visual(); + + /** + * Set the visual either visible or invisible + * @param aVisible If true, set visible, otherwise invisible + */ + void SetVisible( TBool aVisible ); + + /** + * Sets the index + * @param aIndex, the index of this visual + */ + void SetIndex( TInt aIndex ); + + /** + * Specifies the image for the visual + * @param aImage the image + * @param aImageId the image id + */ + void SetImage( TAlfImage aImage ); + + /** + * @return the THuiImage that corresponds to the image + */ + TAlfImage Image(); + + /** + * Notify that the display refresh has just started + * @param aDisplay the HUI display + */ + void RefreshLayout( TSize aScreenSize ); + + /** + * Handle new attributes recieved for the item + * @param aIdSpaceId ID space ID of the media item + * @param aItem Media item to check attributes + * @param aAttributes Array of new attributes + */ + void HandleAttributesAvailableL( const TGlxIdSpaceId& aIdSpaceId, + const TGlxMedia& aItem, + const RArray& aAttributes); + + /** + * Start an animation + * @param aAnimatedTexture The animated texture to use + */ + void StartAnimation( CAlfTexture& aAnimatedTexture ); + + /** + * Stop current animation + */ + void StopAnimation(); + + /** + * Set a flag indicating whether an item should be animated + * when all necessary attributes have been fetched + * @param aFlag Value of the flag + */ + void SetAnimateWhenAttributesAvailable(TBool aFlag); + + /** + * Try to start an item animation, if available + * @param aItem Media item to animate + */ + void TryAnimateL(const TGlxMedia& aItem); + + /** + * Add icon to visual + * @param aTexture texture of icon to apply + * @param aIconPos position of icon (centred or relative to a specific corner) + * @param aForeground foreground or background icon + * @param aStretch ETrue if texture scales to visual + * @param aBorderMargin margin from specified corner + * @param aWidth width as proportion of visual width + * @param aHeight height as proportion of height width + */ + void AddIconL( const CAlfTexture& aTexture, NGlxIconMgrDefs::TGlxIconPosition aIconPos, + TBool aForeground, TBool aStretch, TInt aBorderMargin, + TReal32 aWidth, TReal32 aHeight ); + + /** + * Remove icon from visual + * @param aTexture texture of icon to remove + */ + TBool RemoveIcon( const CAlfTexture& aTexture ); + + /** + * Hide or show icon if required + * @param aTexture texture of icon + * @param aVisible Set hidden or show + */ + void SetIconVisibility( const CAlfTexture& aTexture, TBool aVisible ); + + /** + * Get thumbnail/icon status. + * @return Current status. + */ + TVisualStatus Status() const; + /** + * Set thumbnail/icon status. + * @param aStatus New status. + */ + void SetStatus( TVisualStatus aStatus ); + + /** + * Set observer to be notified when the thumbnail texture gains or + * loses content. + * @param aObserver Observer for the thumbnail status. + * @return Whether the thumbnail texture currently has content. + */ + TBool SetObserver( MGlxVisualObjectStatusObserver& aObserver ); + + + /** + * Set observer to be notified when the thumbnail texture gains or + * loses content. + * @param aObserver Observer for the thumbnail status. + * @return Whether the thumbnail texture currently has content. + */ + void AddObserver( MGlxVisualObjectLayoutRefreshObserver* aObserver ); + + void RemoveObserver( MGlxVisualObjectLayoutRefreshObserver* aObserver ); + + void Reset(); + void ResetLayout( CAlfVisual& aVisual ); + + private: // From MGlxTextureObserver + void TextureContentChangedL( TBool aHasContent, CAlfTexture* aNewTexture ); + + private: + // default constructor + CGlxVisualObject( MGlxMediaList& aMediaList); + + // 2nd phase constructor + void ConstructL( MGlxVisualObjectParameterFactory& aFactory); + + /** + * Remove zoom tiles for attributes no longer available + * @param aItem Media item to check attributes + */ + void RemoveOldZoomTiles(const TGlxMedia& aItem); + /** + * Add zoom tiles for new cropped thumbnail attributes + * @param aIdSpaceId ID space ID of the media item + * @param aItem Media item to check attributes + * @param aAttributes Array of new attributes + */ + void AddNewZoomTilesL(TGlxIdSpaceId aIdSpaceId, const TGlxMedia& aItem, + const RArray& aAttributes); + + /** + * Remove a zoom tile visual from the array and delete it. + * @param aIndex Which tile to remove. + */ + void RemoveZoomTile(TInt aIndex); + + /** + * Create a zoom tile visual as a child of the anchor layout. + * @param aItem Media item to check attributes + * @param aAttribute Cropped thumbnail attribute + * @param aIdSpaceId ID space ID of the media item + * @param aCroppingRect Cropping rect for the tile. + */ + TInt AddZoomTileL( + const TGlxMedia& aItem, const TMPXAttribute& aAttribute, + TGlxIdSpaceId aIdSpaceId, const TRect& aCroppingRect ); + + /** + * Reapply the anchors to tiles which have changed position (anchor + * layout doesn't reorder the anchors when the child order changes). + * @param aFirstPosition Index of first tile which has changed. + */ + void ReanchorZoomTiles( TInt aFirstPosition ); + + /** + * Structure to hold icon anchor details + */ + class TGlxAnchorDetails + { + public: + TAlfAnchorOrigin iAnchorHorizOrigin; + TAlfAnchorOrigin iAnchorVertiOrigin; + TAlfAnchorMetric iAnchorMetric; + TAlfTimedPoint iPosition; + }; + + /** + * Structure to store both anchors for an icon + */ + class TGlxIconAnchors + { + public: + /** + * Helper method to compare two icons + */ + static TBool Match( const TGlxIconAnchors& aIcon1, + const TGlxIconAnchors& aIcon2 ); + + /// The texture for this icon (not owned) + const CAlfTexture* iTexture; + TGlxAnchorDetails iTopLeftAnchor; + TGlxAnchorDetails iBotRightAnchor; + }; + + + /** + * Calculate anchors based on icon position and scaling + * @param aAnchors Structure to hold anchor information + * @param aTexture Texture used to create icon (need texture size) + * @param aIconPos position of icon (relative to specified corner + * or central) + * @param aBorderMargin distance from corner of icon + * @param aStretch is texture icon to scaled with layout or fixed size + */ + void GenerateAnchors( TGlxIconAnchors& aAnchors, + const CAlfTexture& aTexture, + NGlxIconMgrDefs::TGlxIconPosition aIconPos, + TInt aBorderMargin, TBool aStretch, + TReal32 aWidth, TReal32 aHeight ); + + /** + * Set the anchors + * @param aAnchors Structure to hold anchor information + * @param aLayout Layout (foreground or background) + * @param aPos position of icon in layout + * @param aUseOffsets whether to apply horizontal and vertical offsets + * to anchors + */ + void SetAnchors( TGlxIconAnchors& aAnchors, CAlfAnchorLayout& aLayout, + TInt aPos, TBool aUseOffsets = EFalse ); + + + /** + * Find position in layout of icon with specified texture + * @param aTexture Texture to search for + * @param aForeground ETrue if icon is in foreground, EFalse if background + * @return positon of icon in layout, KErrNotFound if icon not present + */ + TInt FindExistingTexture( const CAlfTexture& aTexture, TBool aForeground ); + + /** + * Remove icon and reset anchors for following icons. + * @param aLayout Layout (foreground or background) + * @param aAnchorsArray Stored anchors for specified layout + * @param aPos position in layout of icon that was removed + */ + void DoRemoveIcon( CAlfAnchorLayout& aLayout, + RArray& aAnchorsArray, + TInt aPos ); + + /** + * If visual has resized calcuate offsets for overlay icons (so we can + * ensure icons are positioned over thumbnail if thumbnail dos not fill visual) + * @param aTexture texture for image + * @param aVisSize size of visual + */ + void UpdateIconAnchors( const CAlfTexture& aTexture, TSize aVisSize ); + + + + private: // Data + /** + * Structure to hold information about a zoom tile visual. + */ + class TZoomTile + { + public: + /** Visual to display the tile (not owned) */ + CAlfImageVisual* iVisual; + /** Attribute ID of the cropped thumbnail */ + TUint iAttributeId; + /** Zoom level of the cropped thumbnail */ + TInt iZoomLevel; + /** Anchor point for top left of tile */ + TAlfRealPoint iTopLeft; + /** Anchor point for bottom right of tile */ + TAlfRealPoint iBottomRight; + }; + + /// Own: the index + TInt iIndex; + MGlxMediaList& iMediaList; + + /// Top-level visual + CAlfAnchorLayout* iVisual; + + /// The visual that handles the drawing of image(not owned) + CAlfAnchorLayout* iMainVisual; + + /// The visual that handles the drawing of background underlay icons + /// (not owned) + CAlfImageVisual* iBackgroundOverlayVisual; + + /// Child visual for normal image items (not owned) + CAlfImageVisual* iImageVisual; + + /// Own: the HUI image + TAlfImage iImage; + TBool iImageValid; + /// Own: the HUI animated texture + CAlfTexture* iAnimatedTexture; + /// Whether this item should be animated when the correct attributes + /// are available + TBool iAnimateWhenAttributesAvailable; + /// Own: The HUI utility + CGlxUiUtility* iUiUtility; + /// Own: Array of tiles for zoomed image + RArray iZoomTiles; + /// Original image dimensions + TSize iDimensions; + + /// Anchor details for foreground overlay icons + RArray iForegroundIconAnchors; + + // Anchor details for background 'underlay' icons + RArray iBackgroundIconAnchors; + + // vertical offset for overlay icons + TReal32 iVertIconOffset; + + // horizontal offset for overlay icons + TReal32 iHoriIconOffset; + + // Store size of visual + TSize iVisSize; + + /// Current thumbnail/icon status + TVisualStatus iStatus; + + /// Observer of this visual object. + MGlxVisualObjectStatusObserver* iObserver; + + // The id of the zoom texture from the texture manager + TInt iZoomTextureId; + + /** Array of observers (owned) */ + RPointerArray iObservers; + + }; + +#endif // C_GLXITEMVISUAL_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxvideoiconmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxvideoiconmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2008-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: Icon manager for visuals +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#ifndef C_GLXVIDEOICONMANAGER_H +#define C_GLXVIDEOICONMANAGER_H + +#include + +#include "glxiconmanager.h" + +class CAlfVisual; +class CAlfTexture; + +/** + * CGlxVideoIconManager + * + * Icon manager for visuals + * Handles adding video overlay if required. + * + * @author Dave Holland + */ +NONSHARABLE_CLASS ( CGlxVideoIconManager ) : public CGlxIconManager + { +public: + /** + * Static constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + * @return pointer to CGlxVideoIconManager instance + */ + IMPORT_C static CGlxVideoIconManager* NewL(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + + /** + * Destructor + */ + ~CGlxVideoIconManager(); + +private: // From MGlxMediaListObserver + /// See @ref MGlxMediaListObserver::HandleAttributesAvailableL + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + +private: // from MGlxVisualListObserver + void HandleFocusChangedL( TInt aFocusIndex, TReal32 aItemsPerSecond, + MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType ); + + /** @see MGlxVisualListObserver::HandleVisualAddedL */ + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + + +private: + /** + * Constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + */ + CGlxVideoIconManager(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Check if thumbnail attribute is present for specifed vis. + * If not add icon if present or add default icon + * @param aIndex index of item in media list + */ + void AddIconIfVideoL( TInt aIndex ); + + +private: + // Texture for large video overlay not owned + CAlfTexture* iLargeVideoIcon; + + // Texture for small video overlay not owned + CAlfTexture* iSmallVideoIcon; + + // focus index + TInt iFocusIndex; + }; + +#endif // C_GLXVIDEOICONMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxvisualiconmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxvisualiconmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2008-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: Icon manager for visuals +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ + + +#ifndef C_GLXVISUALICONMANAGER_H +#define C_GLXVISUALICONMANAGER_H + +#include + +#include "glxiconmanager.h" +#include +#include "mglxvisualobjectstatusobserver.h" +#include +#include + +// FORWARD DECLARES +struct TIconInfo; +class CAlfVisual; +class TGlxMediaId; +class CAlfTexture; +class CGlxTextureManager; + +/** + * CGlxVisualIconManager + * + * Icon manager for visuals + * Handles adding default or broken icon if required. + * If thumbnail not present look for icon attribute + * @author M Byrne + * @lib glxvisuallistmanager + */ +NONSHARABLE_CLASS( CGlxVisualIconManager ) : public CGlxIconManager, + public MGlxAnimationObserver, public MGlxVisualObjectStatusObserver + { + public: + /** + * Static constructor + * @param aMediaList reference to media list + * @param aVisualList reference to associated visual list + * @return pointer to CGlxVisualIconManager instance + */ + IMPORT_C static CGlxVisualIconManager* NewL(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList); + + /** + * Destructor + */ + IMPORT_C ~CGlxVisualIconManager(); + + /** + * Trigger the image-loading animation + * @param aItemIndex Index of item to animate + */ + IMPORT_C void AnimateImageLoadedL(TInt aItemIndex); + + public: // from MGlxAnimationObserver + virtual void AnimationComplete(MGlxAnimation* aAnimation); + + private: // From MGlxVisualObjectStatusObserver + void VisualStatusChangedL( CGlxVisualObject& aObject, + TInt aListIndex, TBool aHasThumbnail ); + void ThumbnailLoadedL( CGlxVisualObject& aObject ); + + private: + /** + * Identifiers for default and broken icons + */ + enum TGlxVisualIcon + { + EDefaultIcon, + EBrokenIcon, + EEmptyIcon, + EBlackBrush + }; + + private: + /** + * Constructor + * @param aMediaList refernce to media list + * @param aVisualList reference to associated visual list + */ + CGlxVisualIconManager( + CGlxTextureManager& aTextureManager, + MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList ); + void ConstructL(); + + /** + * Check if thumbnail attribute is present for specifed vis. + * If not add icon if present or add default icon + * @param aIndex index of item in media list + */ + void CheckThumbnailAttributesL( TInt aIndex ); + + /** + * Trigger the image-loading animation + * @param aItemVisual Visual of item to animate + */ + void AnimateImageLoadedL(CAlfVisual* aItemVisual); + /** + * Helper function used be HandleError + * @param aError the error code to handle. + */ + void DoHandleErrorL( TInt aError ); + + /** + * Select the icon to be used for a visual. + * @param aIndex Index of item in media list + * @return Pointer to an icon texture. + */ + const CAlfTexture* SelectIconTextureL( TInt aIndex ); + + /** + * Helper method to compare two icons + */ + static TBool MatchIcon( const TIconInfo& aIcon1, + const TIconInfo& aIcon2 ); + + /** + * Helper function to determine if an item is a DRM protected video. + * @param aItem, the item to test + * @return ETrue if the item is a DRM protected video, EFalse otherwise + */ + TBool IsDrmVideoItem( const TGlxMedia& aItem ); + + private: + /** @see MGlxVisualListObserver::HandleVisualAddedL */ + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, MGlxVisualList* aList ); + + /** @see MGlxMediaListObserver::HandleError */ + void HandleError( TInt aError ); + + private: + /// @ref texture manager + CGlxTextureManager& iTextureManager; + + // array of thumbnail icons added via icon attribute + RArray iThumbnailIcons; + + /// White texture for image-loading "flash" effect + CAlfTexture* iWhiteTexture; + + /// List of current animations, maintained in address order + RPointerArray iAnimations; + + // texture for default icon overlay not owned + CAlfTexture* iDefaultIconTexture; + + // texture for broken icon overlay not owned + CAlfTexture* iBrokenIconTexture; + + // texture for empty icon overlay not owned + CAlfTexture* iEmptyIconTexture; + + // array of icon textures (textures not owned) + RPointerArray< CAlfTexture > iIconTextureArray; + }; + +#endif // C_GLXVISUALICONMANAGER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxvisuallistcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxvisuallistcontrol.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2008-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: Visual list control +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#ifndef C_GLXVISUALLISTCONTROL_H +#define C_GLXVISUALLISTCONTROL_H + +#include +#include +#include +#include +#include +#include +#include +#include "mglxmedialistobserver.h" +#include "mglxmedialist.h" +#include "glxlistwindow.h" +#include "glxblendlayout.h" +#include "mglxvisualobjectlayoutrefreshobserver.h" +#include "mglxvisuallist.h" + +class CGlxVisualListWindow; +//class MGlxLayout; +class MGlxVisualListObserver; +class CAlfBorderBrush; +class CGlxUiUtility; +class CGlxDefaultAttributeContext; +class CGlxVisualIconManager; +class MGlxLayoutObserver; +class CAlfAnchorLayout; +/** + * CGlxVisualListControl + * + * Item visual owner control + * + * @author Aki Vanhatalo + */ +class CGlxVisualListControl : public CAlfControl, public MGlxVisualList, + public MGlxMediaListObserver//, public MGlxVisualObjectLayoutRefreshObserver + { + friend class CGlxVisualListWindow; +public: + /** + * Two-phased constructor. + * @param aMediaList Media list of items the visuals represent + * @param aEnv Alf environment for the control + * @param aDisplay Alf display on which the control should be shown + * @param aThumbnailScaleMode Scale mode to use for the visuals + */ + static CGlxVisualListControl* NewLC( MGlxMediaList& aMediaList, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, + CAlfImageVisual::TScaleMode aThumbnailScaleMode ); + + /** + * Destructor + */ + ~CGlxVisualListControl(); + + /** + * Add reference + * @return new new reference count + */ + TInt AddReference(); + + /** + * Remove reference + * @return new new reference count + */ + TInt RemoveReference(); + + /** + * @return Media list of items the visuals represent + */ + const MGlxMediaList& MediaList() const; + +// From MGlxVisualList + TGlxVisualListId Id() const; + CAlfVisual* Visual(TInt aIndex); + CGlxVisualObject* Item(TInt aListIndex); + virtual TInt ItemCount(NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll) const; + TInt FocusIndex() const; + CAlfControlGroup* ControlGroup() const; + void AddObserverL(MGlxVisualListObserver* aObserver); + void RemoveObserver(MGlxVisualListObserver* aObserver); + TGlxViewContextId AddContextL(TInt aFrontVisibleRangeOffset, + TInt aRearVisibleRangeOffset); + void RemoveContext(const TGlxViewContextId& aContextId); + void AddLayoutL(MGlxLayout* aLayout); + void RemoveLayout(const MGlxLayout* aLayout); + void NavigateL(TInt aIndexCount); + TSize Size() const; + void BringVisualsToFront(); + void EnableAnimationL(TBool aAnimate, TInt aIndex); + /// @ref MGlxVisualList::SetDefaultIconBehaviourL + void SetDefaultIconBehaviourL( TBool aEnable ); + + void AddIconL( TInt aListIndex, const CAlfTexture& aTexture, + NGlxIconMgrDefs::TGlxIconPosition aIconPos, + TBool aForeground, TBool aStretch, TInt aBorderMargin, + TReal32 aWidth = 1.0, TReal32 aHeight = 1.0 ); + + TBool RemoveIcon( TInt aListIndex, const CAlfTexture& aTexture ); + void SetIconVisibility( TInt aListIndex, const CAlfTexture& aTexture, TBool aVisible ); + + + + +// From MGlxMediaListObserver + void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleMediaL(TInt aIndex, MGlxMediaList* aList); + void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList); + void HandleItemModifiedL(const RArray& aItemIndexes, MGlxMediaList* aList); + void HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList); + void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList); + void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); + void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); + +// From MHuiDisplayRefreshObserver +// void NotifyDisplayRefreshStarted( CHuiDisplay &aDisplay ); + + //From + + void VisualObjectLayoutRefreshed(TInt aListIndex ,TSize aScreenSize ); + /** + * @return The thumbnail scale mode of list + */ + CAlfImageVisual::TScaleMode ThumbnailScaleMode(); + +private: + /** + * Constructor + * @param aMediaList Media list of items the visuals represent + * @param aEnv HUI environment for the control + * @param aDisplay HUI display on which the control should be shown + * @param aThumbnailScaleMode Scale mode to use for the visuals + */ + CGlxVisualListControl( MGlxMediaList& aMediaList, + CAlfEnv& aEnv, + CAlfImageVisual::TScaleMode aThumbnailScaleMode ); + + /** + * Second-phase constructor + */ + void ConstructL( CAlfEnv& aEnv, CAlfDisplay& aDisplay ); + + /** + * Find the range offsets for the window by combining all contexts. + * @param aFrontOffset Variable to store the front offset. + * @param aRearOffset Variable to store the rear offset. + */ + void RangeOffsets(TInt& aFrontOffset, TInt& aRearOffsets); + /** + * Inform observers of a visual being removed. + * @param aVisual The visual that is being removed. + */ + void HandleVisualRemoved( const CAlfVisual* aVisual ); + /** + * Inform observers of a visual being added. + * @param aVisual The visual that is being added. + * @param aIndex The list index of the new visual. + */ + void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex ); + + private: // From CAlfControl + /** + * Notifies the control that one of the visuals it ows has been laid out. + * Updates observers with new size. Public in base class, but not intended + * to be used by clients. + */ + void VisualLayoutUpdated( CAlfVisual& aVisual ); + +private: + /** The media list (not owned) */ + MGlxMediaList& iMediaList; + /** The alf env (not owned) */ + CAlfEnv& iEnv; + /** + * Structure to hold information about a view context. + */ + struct TContext + { + TGlxViewContextId iId; + TInt iFrontVisibleRangeOffset; + TInt aRearVisibleRangeOffset; + }; + +private: + /** Number of users of this object */ + TInt iReferenceCount; + + /** Window of visuals in the visible part of the media list (owned) */ + CGlxVisualListWindow* iVisualWindow; + + /** Border brush for visuals (owned) */ + CAlfBorderBrush* iBorderBrush; + + /** Control group for the control (owned) */ + CAlfControlGroup* iControlGroup; + + /** ID of the control group */ + TInt iControlGroupId; + + /** Parent layout for the visuals (owned by HUI) */ + CAlfAnchorLayout* iParentLayout; + + /** Current Size of the Parent Layout */ + TSize iCurrentLayoutSize; + // TGlxBlendLayout iLayoutBlender; + /** Ref: UI utility */ + CGlxUiUtility* iUiUtility; + + /** Blender of multiple MGlxLayouts */ + //MGlxLayout* iLayout; + + /** Array of view contexts (owned) */ + RArray iContexts; + + /** ID provider for new view contexts */ + TGlxDefaultIdProvider iContextIdProvider; + + /** Time of last movement */ + TTime iLastTime; + + /** Array of observers (owned) */ + RPointerArray iObservers; + + /// Default scale mode of image visual + CAlfImageVisual::TScaleMode iScaleMode; + + /** Fetch context for attributes needed for animated GIFs (owned) */ + CGlxDefaultAttributeContext* iAttributeContext; + + /// Own: the visual icon manager in case default icons are wanted + CGlxVisualIconManager* iVisualIconManager; + + MGlxLayoutObserver* iLayoutObserver; + }; + +#endif // C_GLXVISUALLISTCONTROL_H + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxvisuallistmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxvisuallistmanager.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: Manager of visual lists +* +*/ + + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#ifndef C_GLXVISUALLISTMANAGER_H +#define C_GLXVISUALLISTMANAGER_H + +#include + +class MGlxVisualList; +class CGlxVisualListControl; +class MGlxMediaList; +class CAlfEnv; +class CAlfDisplay; + +/** + * MGlxVisualListManager + * + * Manager of lists of visuals + * + * @author Aki Vanhatalo + */ +class CGlxVisualListManager : public CBase + { +public: + /* + * @return pointer to instance of visual list manager + */ + IMPORT_C static CGlxVisualListManager* ManagerL(); + + /** + * Close visual list manager + */ + IMPORT_C void Close(); + + /** + * Destructor + */ + ~CGlxVisualListManager(); + + /** + * Allocate new visual list + * @param aItemList ponter to media list + * @param aEnv HuiEnv + * @param aDisplay HUI display + * @return pointer to visual list + */ + IMPORT_C MGlxVisualList* AllocListL( + MGlxMediaList& aItemList, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, + CAlfImageVisual::TScaleMode aThumbnailScaleMode = CAlfImageVisual::EScaleFitInside ); + + /** + * Return visual list associated with specified Media List + * Allocate new list if one does not already exist + * @param aItemList ponter to media list + * @param aEnv HuiEnv + * @param aDisplay HUI display + * @return pointer to visual list + */ + IMPORT_C MGlxVisualList* ListL( + MGlxMediaList& aItemList, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, + CAlfImageVisual::TScaleMode aThumbnailScaleMode = CAlfImageVisual::EScaleFitInside ); + + /** + * Release a reference to a visual list + * @param aList list to be released or NULL. + * If NULL, does nothing. + */ + IMPORT_C void ReleaseList(MGlxVisualList* aList); + +private: + /** + * Constructor + */ + CGlxVisualListManager(); + +private: + /** Array of visual lists (owned) */ + RPointerArray iVisualLists; + }; + +#endif // C_GLXVISUALLISTMANAGER_H + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/glxvisuallistwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/glxvisuallistwindow.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-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: Visual list window +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#ifndef C_GLXVISUALLISTWINDOW_H +#define C_GLXVISUALLISTWINDOW_H + +#include + +#include "glxlistwindow.h" +#include "glxitemvisual.h" +#include "mglxmedialist.h" + +class CGlxVisualListControl; +class CGlxVisualObject; +//class TGlxBlendLayout; +class MGlxMediaList; +class CGlxUiUtility; + +/** + * CGlxVisualListWindow + * + * Item visual list window + * + * @author Aki Vanhatalo + */ +NONSHARABLE_CLASS( CGlxVisualListWindow ) : public CGlxListWindow, + public MGlxWindowObjectFactory, + public MGlxVisualObjectParameterFactory + { + public: + /** + * Constructor. + * @param aControl Owner control for visuals + * @param aLayout Parent layout for visuals + * @param aMediaList Media list of items the visuals represent + * @param aHuiUtility HUI utility + * @param aThumbnailScaleMode Scale mode to use for the visuals + */ + static CGlxVisualListWindow* NewL( + CGlxVisualListControl* aControl, + MGlxMediaList* aMediaList, + CGlxUiUtility* aUiUtility, + CAlfImageVisual::TScaleMode aThumbnailScaleMode ); + + + public: + + CGlxVisualObject* GetObjectL( TInt aListIndex ); + void CleanupObject( TInt aWindowIndex ); + void PostObjectsAdded( RArray& aAddedAtListIndexes ); + void SetFocusIndexL( TInt aIndex ); + void UpdatePositions(); + CBase* CreateObjectL() const; + void SetupObject(TInt aListIndex, CBase& aObject ); + void CleanupObject(TInt /*aListIndex*/, CBase& /*aObject*/ ); + void SetupObjectL( TInt aIndex, CBase& aObject ); + + public: // from MGlxVisualObjectParameterFactory + + CAlfLayout* Layout(); + CAlfControl& VisualOwner(); + CAlfBrush* BorderBrush(); + CAlfImageVisual::TScaleMode ThumbnailScaleMode(); + CGlxVisualObject* ObjectByIndex( TInt aIndex ); + + private: + + CGlxVisualListWindow(); + /** Owner control for visuals (not owned) */ + CGlxVisualListControl* iControl; + /** Media list of items the visuals represent (not owned) */ + MGlxMediaList* iMediaList; + /** UI utility (not owned) */ + CGlxUiUtility* iUiUtility; + /** Scale mode to use for the visuals */ + CAlfImageVisual::TScaleMode iScaleMode; + + }; + + +#endif // C_GLXVISUALLISTWINDOW_H + + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/mglxlayoutobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/mglxlayoutobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2008-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: Visualist Observer +* +*/ + + + + +class MGlxLayoutObserver + { + public: + + virtual void UpdateLayout( CAlfVisual& aVisual ); + }; \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/mglxvisuallist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/mglxvisuallist.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2008-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: Interface to visual list +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#ifndef M_GLXVISUALLIST_H +#define M_GLXVISUALLIST_H + +#include +#include +#include "glxiconmgrdefs.h" + +class CGlxVisualObject; +class MGlxLayout; +class MGlxVisualListObserver; +class CAlfControlGroup; +class CAlfTexture; +class CAlfVisual; + +class TGlxVisualListIdBase {}; +typedef TGlxId TGlxVisualListId; + +/** + * View Context id + */ +class TGlxIdViewContextBase {}; // Don't use this. This is just to make TGlxId concrete +typedef TGlxId TGlxViewContextId; // Use this + + + +/** + * MGlxVisualList + * + * Interface to a visual list. + * Used to separate the data model from layout and key handling controls. + * + * @author Aki Vanhatalo + */ +class MGlxVisualList + { +public: + /** + * @returns the id of the list + */ + virtual TGlxVisualListId Id() const = 0; + + /** + * @returns a visual by list index + */ + virtual CAlfVisual* Visual(TInt aListIndex) = 0; + + /** + * @returns a visual item by list index + */ + virtual CGlxVisualObject* Item(TInt aListIndex) = 0; + + /** + * @returns the count of visuals in window + */ + virtual TInt ItemCount(NGlxListDefs::TCountType aType = NGlxListDefs::ECountAll) const = 0; + + /** + * @returns the focus index + */ + virtual TInt FocusIndex() const = 0; + + /** + * @returns the control group for the visual list + * The layout/eventhandler controls should add themselved + * to this same group. View should show this group when + * it is activated and hide it when it is deactivated. + */ + virtual CAlfControlGroup* ControlGroup() const = 0; + + /** + * Add/remove an observer + */ + virtual void AddObserverL(MGlxVisualListObserver* aObserver) = 0; + virtual void RemoveObserver(MGlxVisualListObserver* aObserver) = 0; + + /** + * Add a layout + * The layout is used when layout out the visuals owned by the + * MViuVisualOwner-derived class (or its helper) + */ + virtual void AddLayoutL(MGlxLayout* aLayout) = 0; + + /** + * Remove an existing layout + */ + virtual void RemoveLayout(const MGlxLayout* aLayout) = 0; + + /** + * Defines a context in terms of range offsets + * + * @param aFrontVisibleRangeOffset The front offset to focus for items that are + * visible in the UI. Must be less or equal to 0. + * @param aRearVisibleRangeOffset The front offset to focus for items that are + * visible in the UI. Must be greater or equal to 0. + * @returns Unique id of the context + */ + virtual TGlxViewContextId AddContextL(TInt aFrontVisibleRangeOffset, + TInt aRearVisibleRangeOffset) = 0; + + /** + * Removes an existing view context. Forwards the request to List Reader. + * If you are relying on the visual owner control, use this function to + * remove a context instead of calling the list reader directly. + * + * @param aContextId Id of the context to be removed + */ + virtual void RemoveContext(const TGlxViewContextId& aContextId) = 0; + + /** + * Navigate either forward or backward + * @param aIndexCount amount of indexes to navigate + * if positive, navigates forward + * if negative, navigates backward + */ + virtual void NavigateL(TInt aIndexCount) = 0; + + /** + * @returns size of the control area + */ + virtual TSize Size() const = 0; + + /** + * Brings the visuals to the front of the display + */ + virtual void BringVisualsToFront() = 0; + + /** + * Start or stop animation of given item, if animation available + * @param aAnimate If true, starts the animation if availble; if false, stops it + * @param aIndex Index of the item to animate + */ + virtual void EnableAnimationL(TBool aAnimate, TInt aIndex) = 0; + + /** + * Specifies whether the visual list shows default icons or not + * @param aEnable true to show the default icons, false to not show + */ + virtual void SetDefaultIconBehaviourL( TBool aEnable ) = 0; + + /** + * Add icon to specified visual + * @param aListIndex position in list + * @param aTexture texture of icon to apply + * @param aIconPos position of icon (centred or relative to a specific corner) + * @param aForeground foreground or background icon + * @param aStretch ETrue if icon is scaled to visual, EFalse if texture is fixed size + * @param aBorderMargin margin from specified corner + * @param aWidth width for anchor when icon is stretched + * @param aHeight height for anchor when icon is stretched + */ + virtual void AddIconL( TInt aListIndex, const CAlfTexture& aTexture, + NGlxIconMgrDefs::TGlxIconPosition aIconPos, + TBool aForeground, TBool aStretch, TInt aBorderMargin, + TReal32 aWidth = 1.0, TReal32 aHeight = 1.0 ) = 0; + + /** + * Remove icon from specified visual + * @param aListIndex position in list + * @param aTexture texture of icon to remove + * @return ETrue if texture was present + */ + virtual TBool RemoveIcon( TInt aListIndex, const CAlfTexture& aTexture ) = 0; + + /** + * Hide or show icon if required + * @param aListIndex position in list + * @param aTexture texture of icon + * @param aVisible Set hidden or show + */ + virtual void SetIconVisibility( TInt aListIndex, const CAlfTexture& aTexture, + TBool aVisible ) = 0; + }; + + +#endif // M_GLXVISUALLIST_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/mglxvisuallistobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/mglxvisuallistobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2008-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: Visual list observer interface +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#ifndef M_GLXVISUALLISTOBSERVER_H +#define M_GLXVISUALLISTOBSERVER_H + +#include +#include + +class MGlxVisualList; +class CAlfVisual; + +/** + * MGlxVisualListObserver + * + * Observer to a list of visuals + * + * @author Aki Vanhatalo + */ +class MGlxVisualListObserver + { +public: + + /** + * Focus has changed. + * @param aFocusIndex new focus index + * @param aItemsPerSecond speed of focus change + * @param aList The visual list to which this notification relates + * @param aType Type/direction of focus change + */ + virtual void HandleFocusChangedL(TInt aFocusIndex, TReal32 aItemsPerSecond, + MGlxVisualList* aList, NGlxListDefs::TFocusChangeType aType) = 0; + + /** + * Size of the rendering area has changed + * @param aSize new size of the area + * @param aList The visual list to which this notification relates + */ + virtual void HandleSizeChanged(const TSize& aSize, + MGlxVisualList* aList) = 0; + + /** + * Visual is being removed. The visual instance will be + * destroyed after this call returns. + * @param aVisual The visual which is being removed + * @param aList The visual list to which this notification relates + */ + virtual void HandleVisualRemoved(const CAlfVisual* aVisual, + MGlxVisualList* aList) = 0; + + /** + * Visual has been added + * @param aVisual The new visual + * @param aIndex The list index of the new visual + * @param aList The visual list to which this notification relates + */ + virtual void HandleVisualAddedL( CAlfVisual* aVisual, TInt aIndex, + MGlxVisualList* aList) = 0; + }; + +#endif // M_GLXVISUALLISTOBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/mglxvisualobjectlayoutrefreshobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/mglxvisualobjectlayoutrefreshobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2008-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: Item visual container +* +*/ + + + + + + +//NONSHARABLE_CLASS ( MGlxVisualObjectLayoutRefreshObserver ) +// { +// public: +// virtual void VisualObjectLayoutRefreshed(TInt aListIndex ,TSize aScreenSize )=0; +// }; \ No newline at end of file diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/inc/mglxvisualobjectstatusobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/inc/mglxvisualobjectstatusobserver.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2008-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: Visual object status observer +* +*/ + + + + +#ifndef M_GLXVISUALOBJECTSTATUSOBSERVER_H +#define M_GLXVISUALOBJECTSTATUSOBSERVER_H + +#include + +class CGlxVisualObject; + +/** + * Observer interface for notification when visual thumbnail status changes. + * + * @author Dan Rhodes + */ +NONSHARABLE_CLASS( MGlxVisualObjectStatusObserver ) + { +public: + /** + * Called when the visual thumbnail status changes. + * @param aObject The visual whose status has changed. + * @param aListIndex Media list index. + * @param aHasThumbnail Whether the thumbnail texture has content. + */ + virtual void VisualStatusChangedL( CGlxVisualObject& aObject, + TInt aListIndex, TBool aHasThumbnail ) = 0; + /** + * Called when a thumbnail has been loaded for an item which previously + * didn't have one. + * @param aObject The visual whose status has changed. + */ + virtual void ThumbnailLoadedL( CGlxVisualObject& aObject ) = 0; + }; + +#endif // M_GLXVISUALOBJECTSTATUSOBSERVER_H diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxbordericonmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxbordericonmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2008-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: Adds a border to icons in visual lists +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ + +#include "glxbordericonmanager.h" +//#include "mglxmedialistobserver.h" +#include "mglxvisuallist.h" + +#include +#include +#include +#include +#include +#include + +const TInt KGlxBorderIconWidth = 1; +const TInt KGlxBorderIconOffset = 1; + +// --------------------------------------------------------------------------- +// 1st phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxBorderIconManager* CGlxBorderIconManager::NewL( + MGlxMediaList& aMediaList, MGlxVisualList& aVisualList) + { + CGlxBorderIconManager* self = + new(ELeave)CGlxBorderIconManager(aMediaList, aVisualList); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxBorderIconManager::~CGlxBorderIconManager() + { + iVisualList.RemoveObserver(this); + delete iBorderBrush; + } + +// --------------------------------------------------------------------------- +// HandleVisualAddedL +// --------------------------------------------------------------------------- +// +void CGlxBorderIconManager::HandleVisualAddedL( CAlfVisual* aVisual, + TInt /*aIndex*/, MGlxVisualList* /*aList*/ ) + { + AddBorderBrushL(aVisual); + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxBorderIconManager::CGlxBorderIconManager(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList) + : CGlxIconManager(aMediaList, aVisualList) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// 2nd phase construction +// --------------------------------------------------------------------------- +// +void CGlxBorderIconManager::ConstructL() + { + BaseConstructL(); + + // add as observer + iVisualList.AddObserverL(this); + + TRgb brushColor; + AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), brushColor, + KAknsIIDQsnOtherColors, EAknsCIQsnOtherColorsCG12); + + iBorderBrush = + CAlfBorderBrush::NewL( + *( iUiUtility->Env() ), + KGlxBorderIconWidth, KGlxBorderIconWidth, + KGlxBorderIconOffset, KGlxBorderIconOffset ); + + iBorderBrush->SetLayer(EAlfBrushLayerForeground); + iBorderBrush->SetColor(brushColor); + + // check for any visual already present in list + TInt itemCount = iVisualList.ItemCount(); + for(TInt i = 0; i < itemCount; i++) + { + AddBorderBrushL(iVisualList.Visual(i)); + } + } + + +// --------------------------------------------------------------------------- +// AddBorderBrushL +// --------------------------------------------------------------------------- +// +void CGlxBorderIconManager::AddBorderBrushL(CAlfVisual* aVisual) + { + if ( aVisual ) + { + aVisual->EnableBrushesL(); + + aVisual->Brushes()->AppendL( iBorderBrush, EAlfDoesNotHaveOwnership ); + } + } + +// --------------------------------------------------------------------------- +// SetThumbnailBorderColor +// --------------------------------------------------------------------------- +// +EXPORT_C void CGlxBorderIconManager::SetThumbnailBorderColor() + { + TRgb brushColor; + TInt errCode = AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), brushColor, + KAknsIIDQsnOtherColors, EAknsCIQsnOtherColorsCG12); + + if( KErrNone == errCode ) + { + iBorderBrush->SetColor( brushColor ); + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxiconmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxiconmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,421 @@ +/* +* Copyright (c) 2008-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: Icon manager base class +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ + +#include "glxiconmanager.h" + +#include "mglxmedialistobserver.h" +#include "mglxvisuallistobserver.h" +#include "mglxvisuallist.h" + +#include +#include +#include +#include + +#include +#include "glxtexturemanager.h" +#include + +#include +#include +#include +#include +#include + +// ----------------------------------------------------------------------------- +// Parameters for icon/brush creation +// ----------------------------------------------------------------------------- +// +EXPORT_C TGlxIconManagerParams::TGlxIconManagerParams(TReal32 aTlX, + TReal32 aTlY, TReal32 aBrX, TReal32 aBrY, + TReal32 aOpacity) + :iTlX(aTlX), iTlY(aTlY), iBrX(aBrX), iBrY(aBrY), iOpacity(aOpacity) + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxIconManager::~CGlxIconManager() + { + TRACER("CGlxIconManager::~CGlxIconManager"); + GLX_LOG_INFO("CGlxIconManager::~CGlxIconManager"); + if(iUiUtility) + { + iUiUtility->Close(); + } + + + // remove brushes we've added to visuals in visual list + TInt mcount = iMediaList.Count(); + TInt brushCount = iImageBrushArray.Count(); + + for(TInt visIdx =0; visIdxGlxTextureManager(). + CreateIconTextureL(aIconResourceId, aFilename); + + CreateVisualFromTextureL( iconTexture ); + } + +// ----------------------------------------------------------------------------- +// CreateVisualFromIconL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxIconManager::CreateVisualFromIconL(TInt aIconResourceId, + TDesC& aFilename, TGlxIconManagerParams& aParams) + { + TRACER("CGlxIconManager::CreateVisualFromIconL"); + GLX_LOG_INFO("CGlxIconManager::CreateVisualFromIconL"); + // create image brush for our icon + CAlfTexture& iconTexture = iUiUtility->GlxTextureManager(). + CreateIconTextureL(aIconResourceId, aFilename); + + CreateVisualFromTextureL( iconTexture, aParams ); + } + +// ----------------------------------------------------------------------------- +// CreateVisualFromTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxIconManager::CreateVisualFromTextureL( CAlfTexture& aTexture ) + { + TRACER("CGlxIconManager::CreateVisualFromTextureL( CAlfTexture& aTexture )"); + GLX_LOG_INFO("CGlxIconManager::CreateVisualFromTextureL"); + TAlfImage img( aTexture ); + + CAlfImageBrush* imageBrush = + CAlfImageBrush::NewL( *( iUiUtility->Env() ), img ); + CleanupStack::PushL(imageBrush); + + imageBrush->SetLayer(EAlfBrushLayerForeground); + + /// @todo Remove these 2 lines when Hui fixes the image brush rendering bug + imageBrush->SetBorders(-1,-1,-1,-1); + // imageBrush->SetClipToVisual(ETrue); + + iImageBrushArray.AppendL(imageBrush); + CleanupStack::Pop(imageBrush); + } + +// ----------------------------------------------------------------------------- +// CreateVisualFromTextureL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxIconManager::CreateVisualFromTextureL( + CAlfTexture& aTexture, TGlxIconManagerParams& aParams ) + { + TRACER("CGlxIconManager::CreateVisualFromTextureL 2"); + GLX_LOG_INFO("CGlxIconManager::CreateVisualFromTextureL 2"); + TAlfImage img( aTexture ); + img.SetTexCoords(aParams.iTlX, aParams.iTlY, aParams.iBrX, aParams.iBrY ); + + CAlfImageBrush* imageBrush = + CAlfImageBrush::NewL( *iUiUtility->Env(), img ); + CleanupStack::PushL(imageBrush); + + imageBrush->SetLayer( EAlfBrushLayerForeground ); + + /// @todo Remove these 2 lines when Hui fixes the image brush rendering bug + imageBrush->SetBorders(-1,-1,-1,-1); + // imageBrush->SetClipToVisual(ETrue); + + TAlfTimedValue opacity( aParams.iOpacity, 0 ); + imageBrush->SetOpacity( opacity ); + + iImageBrushArray.AppendL(imageBrush); + CleanupStack::Pop(imageBrush); + } + +// ----------------------------------------------------------------------------- +// AddIconToItemL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxIconManager::AddIconToItemL(TInt aIndex, TInt aBrushIndex) + { + TRACER("CGlxIconManager::AddIconToItemL"); + GLX_LOG_INFO("CGlxIconManager::AddIconToItemL"); + CAlfVisual* vis = iVisualList.Visual(aIndex); + AddIconToItemL(vis, aBrushIndex); + } + +// ----------------------------------------------------------------------------- +// AddIconToItemL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxIconManager::AddIconToItemL(CAlfVisual* aVisual, TInt aBrushIndex) + { + TRACER("CGlxIconManager::AddIconToItemL 2"); + GLX_LOG_INFO("CGlxIconManager::AddIconToItemL 2"); + if(aVisual) + { + // only add if not already present + if(BrushPositionInVisual(aVisual, aBrushIndex) == KErrNotFound) + { + aVisual->EnableBrushesL(); + aVisual->Brushes()->AppendL(iImageBrushArray[aBrushIndex], + EAlfDoesNotHaveOwnership ); + // aVisual->SetChanged(); + } + } + } + +// ----------------------------------------------------------------------------- +// RemoveFromItemL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxIconManager::RemoveFromItem(TInt aIndex, TInt aIconIndex) + { + TRACER("CGlxIconManager::RemoveFromItem"); + GLX_LOG_INFO("CGlxIconManager::RemoveFromItem"); + CAlfVisual* vis = iVisualList.Visual(aIndex); + RemoveFromItem(vis, aIconIndex); + } + +// ----------------------------------------------------------------------------- +// RemoveFromItemL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxIconManager::RemoveFromItem(CAlfVisual* aVisual, + TInt aIconIndex) + { + TRACER("CGlxIconManager::RemoveFromItem 2"); + GLX_LOG_INFO("CGlxIconManager::RemoveFromItem 2"); + if(aVisual && aIconIndex < iImageBrushArray.Count()) + { + CAlfBrushArray* brushArray = aVisual->Brushes(); + if ( brushArray ) + { + TInt brushCount = brushArray->Count(); + for(TInt i = 0; iAt(i)); + if(brush==iImageBrushArray[aIconIndex]) + { + brushArray->Remove(i); + // aVisual->SetChanged(); + break; + } + } + } + } + } + +// ----------------------------------------------------------------------------- +// BrushPositionInVisual +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxIconManager::BrushPositionInVisual(TInt aListIndex, + TInt aBrushIndex) + { + TRACER("CGlxIconManager::BrushPositionInVisual"); + GLX_LOG_INFO("CGlxIconManager::BrushPositionInVisual"); + CAlfVisual* vis = iVisualList.Visual( aListIndex ); + return BrushPositionInVisual(vis, aBrushIndex ); + } + +// ----------------------------------------------------------------------------- +// BrushPositionInVisual +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGlxIconManager::BrushPositionInVisual( CAlfVisual* aVisual, + TInt aBrushIndex) + { + TRACER("CGlxIconManager::BrushPositionInVisual 2"); + GLX_LOG_INFO("CGlxIconManager::BrushPositionInVisual 2"); + TInt pos = KErrNotFound; + + if(aVisual && aBrushIndex < iImageBrushArray.Count()) + { + CAlfBrushArray* brushArray = aVisual->Brushes(); + if ( brushArray ) + { + TInt brushCount = brushArray->Count(); + for(TInt i = 0; iAt(i)); + if(brush==iImageBrushArray[aBrushIndex]) + { + pos = i; + break; + } + } + } + } + return pos; + } + +// ----------------------------------------------------------------------------- +// HandleItemAddedL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleItemAddedL(TInt /*StartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleMediaL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleMediaL(TInt /*aListIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleItemRemovedL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleItemRemovedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleItemModifiedL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleItemModifiedL(const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleAttributesAvailableL(TInt /*aItemIndex*/, + const RArray& /*aAttributes*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleFocusChangedL(NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleItemSelectedL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleMessageL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleMessageL(const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/) + { + // No implementation + } + + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleFocusChangedL(TInt /*aFocusIndex*/, TReal32 /*aItemsPerSecond*/, MGlxVisualList* /*aList*/, NGlxListDefs::TFocusChangeType /*aType*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleSizeChanged +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleSizeChanged( const TSize& /*aSize*/, MGlxVisualList* /*aList*/) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleVisualRemoved +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleVisualRemoved( const CAlfVisual* /*aVisual*/, MGlxVisualList* /*aList*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleVisualAddedL +// ----------------------------------------------------------------------------- +// +void CGlxIconManager::HandleVisualAddedL(CAlfVisual* /*aVisual*/, TInt /*aIndex*/,MGlxVisualList* /*aList*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxIconManager::CGlxIconManager(MGlxMediaList& aMediaList, MGlxVisualList& aVisList) + : iMediaList(aMediaList), iVisualList(aVisList) + { + // No implementation + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxitemvisual.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxitemvisual.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,1063 @@ +/* +* Copyright (c) 2008-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: Item visual container +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#include "glxitemvisual.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mglxvisualobjectstatusobserver.h" +#include "mglxvisualobjectlayoutrefreshobserver.h" + +const TInt KGlxOpacityFadeDuration = 400; + +const TInt KGlxForegroundAnchorOrdinal = 2; + +// ----------------------------------------------------------------------------- +// Constructor. Inlined to save a few bits of rom +// ----------------------------------------------------------------------------- +inline CGlxVisualObject::CGlxVisualObject( MGlxMediaList& aMediaList) + : iMediaList( aMediaList ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// NewLC +// ----------------------------------------------------------------------------- +CGlxVisualObject* CGlxVisualObject::NewLC( + MGlxVisualObjectParameterFactory& aFactory,MGlxMediaList& aMediaList) + { + TRACER("CGlxVisualObject::NewLC"); + CGlxVisualObject* self = new ( ELeave ) CGlxVisualObject( aMediaList); + CleanupStack::PushL( self ); + self->ConstructL( aFactory ); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CGlxVisualObject::~CGlxVisualObject() + { + TRACER("CGlxVisualObject::~CGlxVisualObject"); + iForegroundIconAnchors.Close(); + iBackgroundIconAnchors.Close(); + + while ( iZoomTiles.Count() ) + { + RemoveZoomTile(0); + } + iZoomTiles.Close(); + + if ( iUiUtility && iImageValid ) + { + // Clean up the texture from the texture manager + iUiUtility->GlxTextureManager().RemoveTexture( iImage.Texture() ); + } + + if ( iVisual ) + { + iVisual->RemoveAndDestroyAllD(); + } + delete iAnimatedTexture; + if ( iUiUtility ) + { + iUiUtility->Close(); + } + iObservers.Close(); + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +void CGlxVisualObject::ConstructL( MGlxVisualObjectParameterFactory& aFactory) + { + TRACER("CGlxVisualObject::ConstructL"); + iUiUtility = CGlxUiUtility::UtilityL(); + // create the visual with parents layout + iVisual = CAlfAnchorLayout::AddNewL(aFactory.VisualOwner(), + aFactory.Layout()); + iVisual->EnableTransformationL(); + + // create background underlay anchor layout + //to act as a black screen and avoid overlapping images + iBackgroundOverlayVisual = + CAlfImageVisual::AddNewL( aFactory.VisualOwner(), iVisual); + CAlfTexture& backgroundTexture = + iUiUtility->GlxTextureManager().CreateFlatColourTextureL(KRgbBlack); + iBackgroundOverlayVisual->SetClipping(ETrue); + iBackgroundOverlayVisual->SetImage(TAlfImage(backgroundTexture)); + // create main visual + iMainVisual = + CAlfAnchorLayout::AddNewL( aFactory.VisualOwner(), iVisual ); + + // create the child image visual + iImageVisual = + CAlfImageVisual::AddNewL( aFactory.VisualOwner(), iMainVisual ); + //iImageVisual->SetScaleMode( aFactory.ThumbnailScaleMode() ); + iImageVisual->SetScaleMode(CAlfImageVisual::EScaleNormal); + // Turn on clipping only if cover-mode has been chosen + iImageVisual->SetClipping(ETrue); + + User::LeaveIfError( iMainVisual->SetRelativeAnchorRect( + 0, EAlfAnchorOriginLeft, EAlfAnchorOriginTop, TAlfRealPoint(), + EAlfAnchorOriginRight, EAlfAnchorOriginBottom, TAlfRealPoint() ) ); + + // get screen size + SetVisible(EFalse); + TSize screenSize = iUiUtility->DisplaySize(); + RefreshLayout( screenSize ); + } + +// ----------------------------------------------------------------------------- +// SetScaleMode +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxVisualObject::SetScaleMode(CAlfImageVisual::TScaleMode aMode) + { + TRACER("CGlxVisualObject::SetScaleMode"); + iImageVisual->SetScaleMode(aMode); + } + +// ----------------------------------------------------------------------------- +// Reset state of the object as if it had just been constructed +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::Reset() + { + TRACER("CGlxVisualObject::Reset"); + SetVisible(EFalse); + StopAnimation(); + iAnimateWhenAttributesAvailable = EFalse; + iUiUtility->GlxTextureManager().RemoveTexture(iImage.Texture()); + } + +// ----------------------------------------------------------------------------- +// Remove and delete all child visuals of the layout +// @param aLayout layout to reset +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::ResetLayout( CAlfVisual& /*aVisual*/ ) + { + //to be used when layouts are back + // until no visuals left + } + +// ----------------------------------------------------------------------------- +// Visual +// ----------------------------------------------------------------------------- +CAlfVisual* CGlxVisualObject::Visual() + { + TRACER("CGlxVisualObject::Visual"); + return iVisual; + } + +// ----------------------------------------------------------------------------- +// SetVisible +// ----------------------------------------------------------------------------- +void CGlxVisualObject::SetVisible( TBool aVisible ) + { + TRACER("CGlxVisualObject::SetVisible"); + if(aVisible) + { + iVisual->SetOpacity( TAlfTimedValue(1.0 , 0 )); + } + else + { + iVisual->SetOpacity( TAlfTimedValue(0.0, 0 )); + } + + } + +// ----------------------------------------------------------------------------- +// SetIndex +// ----------------------------------------------------------------------------- +void CGlxVisualObject::SetIndex( TInt aIndex ) + { + TRACER("CGlxVisualObject::SetIndex"); + GLX_LOG_INFO1("CGlxVisualObject::SetIndex %d",aIndex); + iIndex = aIndex; + } + +// ----------------------------------------------------------------------------- +// SetImage +// ----------------------------------------------------------------------------- +void CGlxVisualObject::SetImage( TAlfImage aImage ) + { + TRACER("CGlxVisualObject::SetImage"); + iImageVisual->SetImage( aImage ); + iImage = aImage; + iImageValid = ETrue; + } + +// ----------------------------------------------------------------------------- +// Image +// ----------------------------------------------------------------------------- +TAlfImage CGlxVisualObject::Image() + { + TRACER("CGlxVisualObject::Image"); + return iImage; + } + +// ----------------------------------------------------------------------------- +// RefreshLayout +// the visual list has requested us to refresh the layout +// ----------------------------------------------------------------------------- +void CGlxVisualObject::RefreshLayout( TSize /*aScreenSize*/ ) + { + TRACER("CGlxVisualObject::RefreshLayout"); + // get texture manager + CGlxTextureManager& textureMgr = iUiUtility->GlxTextureManager(); + // get new size, note that this is synchronous c/s call + TSize visSize = Visual()->Size().ValueNow().AsSize(); + + // check if visual size has changed since last time + if( visSize != iVisSize ) + { + // store size + iVisSize = visSize; + + // get the media id and id space id for this index + TGlxMedia item = iMediaList.Item( iIndex ); + TGlxIdSpaceId idspace = iMediaList.IdSpaceId( iIndex ); + + // check if there was a better thumbnail available + if( textureMgr.TextureNeedsUpdating( item, idspace, visSize ) ) + { + // need to update the texture + TRAP_IGNORE(CAlfTexture& texture = + textureMgr.CreateThumbnailTextureL( + item, idspace, visSize, this ); + // set the new texture in place + SetImage( TAlfImage( texture ) )); + } + + // update positions of overlay icons + UpdateIconAnchors( Image().Texture(), visSize ); + } + } + +// ----------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::HandleAttributesAvailableL( + const TGlxIdSpaceId& aIdSpaceId, const TGlxMedia& aItem, + const RArray& aAttributes) + { + TRACER("CGlxVisualObject::HandleAttributesAvailableL"); + TBool animate = ( EHasDefaultIcon == Status() ); + + // get texture manager + CGlxTextureManager& textureMgr = iUiUtility->GlxTextureManager(); + // get new size, note that this is synchronous c/s call + TSize visSize = iUiUtility->DisplaySize(); + + // check if there was a better thumbnail available + if( textureMgr.TextureNeedsUpdating( aItem, aIdSpaceId, visSize ) ) + { + // need to update the texture + CAlfTexture& texture = + textureMgr.CreateThumbnailTextureL( + aItem, aIdSpaceId, visSize, this ); + // set the new texture in place + SetImage( TAlfImage( texture ) ); + + // update positions of overlay icons + UpdateIconAnchors( Image().Texture(), visSize ); + + if ( animate && iObserver ) + { + iObserver->ThumbnailLoadedL( *this ); + } + } + + if ( iAnimateWhenAttributesAvailable ) + { + TryAnimateL(aItem); + } + + } + +// ----------------------------------------------------------------------------- +// StartAnimation +// ----------------------------------------------------------------------------- +void CGlxVisualObject::StartAnimation( CAlfTexture& aAnimatedTexture ) + { + TRACER("CGlxVisualObject::StartAnimation"); + // if we have an old texture + if ( iAnimatedTexture ) + { + // release the old texture + iUiUtility->GlxTextureManager().RemoveTexture( *iAnimatedTexture ); + iAnimatedTexture = NULL; + } + // store the texture pointer so that we can stop it without a + // reference to the texture + iAnimatedTexture = &aAnimatedTexture; + + // start the animation + aAnimatedTexture.StartAnimation(); + // set the image to the visual + iImageVisual->SetImage( TAlfImage( aAnimatedTexture ) ); + } + +// ----------------------------------------------------------------------------- +// StopAnimation +// ----------------------------------------------------------------------------- +void CGlxVisualObject::StopAnimation() + { + TRACER("CGlxVisualObject::StopAnimation"); + if ( iAnimatedTexture ) + { + iImageVisual->SetImage( iImage ); + + // stop the animation + iAnimatedTexture->StopAnimation(); + + // release the texture + iUiUtility->GlxTextureManager().RemoveTexture( *iAnimatedTexture ); + iAnimatedTexture = NULL; + } + } + +// ----------------------------------------------------------------------------- +// SetAnimateWhenAttributesAvailable +// ----------------------------------------------------------------------------- +void CGlxVisualObject::SetAnimateWhenAttributesAvailable(TBool aFlag) + { + TRACER("CGlxVisualObject::SetAnimateWhenAttributesAvailable"); + iAnimateWhenAttributesAvailable = aFlag; + } + +// ----------------------------------------------------------------------------- +// TryAnimateL +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::TryAnimateL(const TGlxMedia& aItem) + { + TRACER("CGlxVisualObject::TryAnimateL"); + TInt frameCount = 0; + TSize mediaItemSize( KErrNotFound, KErrNotFound ); + aItem.GetDimensions( mediaItemSize ); + if ( aItem.GetFrameCount( frameCount ) ) + { + const TDesC& uri = aItem.Uri(); + if (frameCount > 1 && uri.Length() > 0) + { + // create the animated texture from the URI + CAlfTexture& animTexture = + iUiUtility->GlxTextureManager().CreateAnimatedGifTextureL( uri, mediaItemSize ); + StartAnimation( animTexture ); + } + SetAnimateWhenAttributesAvailable(EFalse); + } + else + { + SetAnimateWhenAttributesAvailable(ETrue); + } + } + +// ----------------------------------------------------------------------------- +// RemoveOldZoomTiles +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::RemoveOldZoomTiles(const TGlxMedia& aItem) + { + TRACER("CGlxVisualObject::RemoveOldZoomTiles"); + const CGlxMedia* properties = aItem.Properties(); + TInt firstPosition = iZoomTiles.Count(); + + for ( TInt i = iZoomTiles.Count() - 1; i >= 0; i-- ) + { + if ( !(properties && properties->IsSupported(TMPXAttribute( + KGlxMediaIdThumbnail, iZoomTiles[i].iAttributeId))) ) + { + RemoveZoomTile(i); + firstPosition = i; + } + } + + ReanchorZoomTiles( firstPosition ); + } + +// ----------------------------------------------------------------------------- +// AddNewZoomTilesL +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::AddNewZoomTilesL(TGlxIdSpaceId aIdSpaceId, + const TGlxMedia& aItem, const RArray& aAttributes) + { + TRACER("CGlxVisualObject::AddNewZoomTilesL"); + // Get dimension if we don't already have it + if ( (iDimensions.iWidth == 0 || iDimensions.iHeight == 0) ) + { + // Ignore success/failure return, test dimension instead + aItem.GetDimensions(iDimensions); + } + + if ( iDimensions.iWidth == 0 || iDimensions.iHeight == 0 ) + { + return; + } + + TInt firstPosition = iZoomTiles.Count(); + + // Check new attributes for cropped thumbnails + TInt count = aAttributes.Count(); + for ( TInt i = 0; i < count; i++ ) + { + TMPXAttribute attr(aAttributes[i]); + + if ( KGlxMediaIdThumbnail == attr.ContentId() + && !GlxIsFullThumbnailAttribute( attr.AttributeId() ) ) + { + const CGlxThumbnailAttribute* thumbnail = + aItem.ThumbnailAttribute( attr ); + if ( thumbnail ) + { + TInt position = AddZoomTileL( aItem, attr, aIdSpaceId, + thumbnail->iCroppingRect ); + + if ( position < firstPosition ) + { + firstPosition = position; + } + } + } + } + + ReanchorZoomTiles( firstPosition ); + } + +// ----------------------------------------------------------------------------- +// RemoveZoomTile +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::RemoveZoomTile(TInt aIndex) + { + TRACER("CGlxVisualObject::RemoveZoomTile"); + __ASSERT_ALWAYS(0 <= aIndex && aIndex < iZoomTiles.Count(), + Panic(EGlxPanicIllegalArgument)); + + CAlfImageVisual* visual = iZoomTiles[aIndex].iVisual; + const TAlfImage& image = visual->Image(); + if( image.HasTexture() ) + { + iUiUtility->GlxTextureManager().RemoveTexture( image.Texture() ); + } + iVisual->Owner().Remove(visual); // Caller gets ownership of the visual + delete visual; + iZoomTiles.Remove(aIndex); + } + +// --------------------------------------------------------------------------- +// AddZoomTileL +// --------------------------------------------------------------------------- +// +TInt CGlxVisualObject::AddZoomTileL( + const TGlxMedia& aItem, const TMPXAttribute& aAttribute, + TGlxIdSpaceId aIdSpaceId, const TRect& aCroppingRect ) + { + TRACER("CGlxVisualObject::AddZoomTileL"); + // Reserve space for new tile + iZoomTiles.ReserveL( iZoomTiles.Count() + 1 ); + + // Extract zoom level field from attribute ID + TInt zoomLevel = GlxZoomedThumbnailZoomLevel( aAttribute.AttributeId() ); + TInt position = 0; + // Lowest zoom level goes to highest position (front) + while ( position < iZoomTiles.Count() + && zoomLevel < iZoomTiles[position].iZoomLevel ) + { + position++; + } + + CAlfImageVisual* visual = CAlfImageVisual::AddNewL( + static_cast( iMainVisual->Owner() ), + iMainVisual ); + CleanupStack::PushL(visual); + + // Set temporary anchor to reserve space in anchors array + TInt ordinal = iMainVisual->ChildOrdinal( iMainVisual->Count() - 1 ); + User::LeaveIfError( iMainVisual->SetRelativeAnchorRect( ordinal, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, TAlfRealPoint(), + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, TAlfRealPoint() ) ); + + // Move new visual to correct position + iMainVisual->Reorder(*visual, position + 1); // Full image thumbnail is position 0 + + TReal32 imageWidth = iDimensions.iWidth; + TReal32 imageHeight = iDimensions.iHeight; + + TZoomTile tile; + tile.iVisual = visual; + tile.iAttributeId = aAttribute.AttributeId(); + tile.iZoomLevel = zoomLevel; + tile.iTopLeft.iX = aCroppingRect.iTl.iX / imageWidth; + tile.iTopLeft.iY = aCroppingRect.iTl.iY / imageHeight; + tile.iBottomRight.iX = aCroppingRect.iBr.iX / imageWidth; + tile.iBottomRight.iY = aCroppingRect.iBr.iY / imageHeight; + // Shouldn't leave due to reservation above + iZoomTiles.InsertL(tile, position); + CleanupStack::Pop(visual); + + return position; + } + +// --------------------------------------------------------------------------- +// ReanchorZoomTiles +// --------------------------------------------------------------------------- +// +void CGlxVisualObject::ReanchorZoomTiles( TInt aFirstPosition ) + { + TRACER("CGlxVisualObject::ReanchorZoomTiles"); + TInt count = iZoomTiles.Count(); + for ( TInt i = aFirstPosition; i < count; i++ ) + { + TZoomTile& tile( iZoomTiles[i] ); + TInt ordinal = iMainVisual->ChildOrdinal( i + 1 ); + + TInt error = iMainVisual->SetRelativeAnchorRect( ordinal, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, tile.iTopLeft, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, tile.iBottomRight ); + if ( KErrNone != error ) + { + // Should never fail since space was reserved in the anchor array + GLX_LOG_WARNING1( "Failed to update anchor, error %d", error ); + __ASSERT_DEBUG( EFalse, Panic( EGlxPanicUnhandledError ) ); + } + } + } + +// ----------------------------------------------------------------------------- +// AddIconL +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::AddIconL( const CAlfTexture& aTexture, + NGlxIconMgrDefs::TGlxIconPosition /*aIconPos*/, + TBool /*aForeground*/, TBool /*aStretch*/, TInt /*aBorderMargin*/, + TReal32 /*aWidth*/, TReal32 /*aHeight*/ ) + { + TRACER("CGlxVisualObject::AddIconL"); + //currently foreground and background visuals are not being used + //the implications needs to be studied + //background visual is used mainly to provide a background for small visual objects + //foreground visual is used to supply specialised icons for clips + + + // Set image for corrupted thumbnail + SetImage(TAlfImage( aTexture )); + + } + +// ----------------------------------------------------------------------------- +// RemoveIcon +// ----------------------------------------------------------------------------- +// +TBool CGlxVisualObject::RemoveIcon( const CAlfTexture& aTexture ) + { + TRACER("CGlxVisualObject::RemoveIcon"); + + TInt visPos = FindExistingTexture( aTexture, ETrue ); + if( visPos != KErrNotFound ) + { + DoRemoveIcon( *iMainVisual, + iForegroundIconAnchors, visPos ); + } + else + { + visPos = FindExistingTexture( aTexture, EFalse ); + } + + return ( visPos != KErrNotFound ); + + } + +// ----------------------------------------------------------------------------- +// SetIconVisibility +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::SetIconVisibility( const CAlfTexture& aTexture, TBool aVisible ) + { + TRACER("CGlxVisualObject::SetIconVisibility"); + // find texture (assume it's a foreground visual) + TInt pos = FindExistingTexture( aTexture, ETrue ); + if( pos != KErrNotFound ) + { + CAlfVisual& vis = iMainVisual->Visual( pos ); + + if( aVisible ) + { + vis.SetOpacity( TAlfTimedValue( 1.0, KGlxOpacityFadeDuration ) ); + } + else + { + vis.SetOpacity( TAlfTimedValue( 0.0, KGlxOpacityFadeDuration ) ); + } + } + } + +// ----------------------------------------------------------------------------- +// Status +// ----------------------------------------------------------------------------- +// +CGlxVisualObject::TVisualStatus CGlxVisualObject::Status() const + { + TRACER("CGlxVisualObject::Status()"); + return iStatus; + } + +// ----------------------------------------------------------------------------- +// SetStatus +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::SetStatus( TVisualStatus aStatus ) + { + TRACER("CGlxVisualObject::SetStatus"); + iStatus = aStatus; + } + +// ----------------------------------------------------------------------------- +// SetObserver +// ----------------------------------------------------------------------------- +// +TBool CGlxVisualObject::SetObserver( MGlxVisualObjectStatusObserver& aObserver ) + { + TRACER("CGlxVisualObject::SetObserver"); + iObserver = &aObserver; + return iImage.HasTexture(); + } + +// ----------------------------------------------------------------------------- +// TextureContentChangedL +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::TextureContentChangedL( TBool aHasContent, CAlfTexture* /*aNewTexture */) + { + TRACER("CGlxVisualObject::TextureContentChangedL"); + if ( iObserver ) + { + iObserver->VisualStatusChangedL( *this, iIndex, aHasContent ); + } + } + +// ----------------------------------------------------------------------------- +// SetAnchors +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::SetAnchors( TGlxIconAnchors& aAnchors, + CAlfAnchorLayout& aLayout, TInt aPos, TBool aUseOffsets ) + { + TRACER("CGlxVisualObject::SetAnchors"); + TAlfTimedPoint leftPoint = aAnchors.iTopLeftAnchor.iPosition; + TAlfTimedPoint rightPoint = aAnchors.iBotRightAnchor.iPosition; + + if( aUseOffsets && + aAnchors.iTopLeftAnchor.iAnchorMetric == EAlfAnchorMetricRelativeToSize ) + { + // update horizontal positions if there is a horizontal offset + if( aAnchors.iTopLeftAnchor.iAnchorHorizOrigin == EAlfAnchorOriginLeft ) + { + leftPoint.iX.SetValueNow( leftPoint.iX.Target() + iHoriIconOffset ); + + if( rightPoint.iX.Target() == 1.0) + { + rightPoint.iX.SetValueNow( rightPoint.iX.Target() - iHoriIconOffset ); + } + + } + else if ( aAnchors.iTopLeftAnchor.iAnchorHorizOrigin == EAlfAnchorOriginRight ) + { + if( leftPoint.iX.Target() == -1.0) + { + leftPoint.iX.SetValueNow( leftPoint.iX.Target() + iHoriIconOffset ); + } + + rightPoint.iX.SetValueNow( rightPoint.iX.Target() - iHoriIconOffset ); + } + else + { + + } + + // update vertical positions if there is a vertical offset + if( aAnchors.iTopLeftAnchor.iAnchorVertiOrigin == EAlfAnchorOriginTop ) + { + leftPoint.iY.SetValueNow( leftPoint.iY.Target() + iVertIconOffset ); + if( rightPoint.iY.Target() == 1.0) + { + rightPoint.iY.SetValueNow( rightPoint.iY.Target() - iVertIconOffset ); + } + } + else if ( aAnchors.iTopLeftAnchor.iAnchorHorizOrigin == EAlfAnchorOriginBottom ) + { + if( leftPoint.iY.Target() == -1.0) + { + leftPoint.iY.SetValueNow( leftPoint.iY.Target() + iVertIconOffset ); + } + rightPoint.iY.SetValueNow( rightPoint.iY.Target() - iVertIconOffset ); + } + else + { + + } + } + + + aLayout.SetAnchor( EAlfAnchorTopLeft, aPos, + aAnchors.iTopLeftAnchor.iAnchorHorizOrigin, + aAnchors.iTopLeftAnchor.iAnchorVertiOrigin, + aAnchors.iTopLeftAnchor.iAnchorMetric, + aAnchors.iTopLeftAnchor.iAnchorMetric, + leftPoint ); + + aLayout.SetAnchor( EAlfAnchorBottomRight, aPos, + aAnchors.iBotRightAnchor.iAnchorHorizOrigin, + aAnchors.iBotRightAnchor.iAnchorVertiOrigin, + aAnchors.iBotRightAnchor.iAnchorMetric, + aAnchors.iBotRightAnchor.iAnchorMetric, + rightPoint ); + + aLayout.UpdateChildrenLayout(); + } + +// ----------------------------------------------------------------------------- +// GenerateAnchors +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::GenerateAnchors( TGlxIconAnchors& aAnchors, + const CAlfTexture& aTexture, + NGlxIconMgrDefs::TGlxIconPosition aIconPos, + TInt aBorderMargin, TBool aStretch, + TReal32 aWidth, TReal32 aHeight ) + { + TRACER("CGlxVisualObject::GenerateAnchors"); + // top-left anchor + TGlxAnchorDetails topLeftAnchor; + TGlxAnchorDetails bottomRightAnchor; + + if( aStretch) + { + topLeftAnchor.iAnchorMetric = EAlfAnchorMetricRelativeToSize; + bottomRightAnchor.iAnchorMetric = EAlfAnchorMetricRelativeToSize; + } + else + { + topLeftAnchor.iAnchorMetric = EAlfAnchorMetricAbsolute; + bottomRightAnchor.iAnchorMetric = EAlfAnchorMetricAbsolute; + } + + TInt textureWidth = aTexture.Size().iWidth + aBorderMargin; + TInt textureHeight = aTexture.Size().iHeight + aBorderMargin; + + // + switch( aIconPos ) + { + case NGlxIconMgrDefs::EGlxIconTopLeft: + { + topLeftAnchor.iAnchorHorizOrigin = EAlfAnchorOriginLeft; + topLeftAnchor.iAnchorVertiOrigin = EAlfAnchorOriginTop; + + bottomRightAnchor.iAnchorHorizOrigin = EAlfAnchorOriginLeft; + bottomRightAnchor.iAnchorVertiOrigin = EAlfAnchorOriginTop; + + if( aStretch ) + { + topLeftAnchor.iPosition = TAlfTimedPoint( 0, 0 ); + bottomRightAnchor.iPosition = TAlfTimedPoint( aWidth, aHeight ); + } + else + { + topLeftAnchor.iPosition = + TAlfTimedPoint( aBorderMargin, aBorderMargin ); + bottomRightAnchor.iPosition = + TAlfTimedPoint( textureWidth,textureHeight); + } + + break; + } + case NGlxIconMgrDefs::EGlxIconTopRight: + { + topLeftAnchor.iAnchorHorizOrigin = EAlfAnchorOriginRight; + topLeftAnchor.iAnchorVertiOrigin = EAlfAnchorOriginTop; + + bottomRightAnchor.iAnchorHorizOrigin = EAlfAnchorOriginRight; + bottomRightAnchor.iAnchorVertiOrigin = EAlfAnchorOriginTop; + + if( aStretch ) + { + topLeftAnchor.iPosition = TAlfTimedPoint( -aWidth, 0.0 ); + bottomRightAnchor.iPosition = TAlfTimedPoint( 0.0, aHeight ); + } + else + { + topLeftAnchor.iPosition = + TAlfTimedPoint( -textureWidth, aBorderMargin ); + bottomRightAnchor.iPosition = + TAlfTimedPoint( -aBorderMargin, textureHeight); + } + break; + } + case NGlxIconMgrDefs::EGlxIconBottomLeft: + { + topLeftAnchor.iAnchorHorizOrigin = EAlfAnchorOriginLeft; + topLeftAnchor.iAnchorVertiOrigin = EAlfAnchorOriginBottom; + + bottomRightAnchor.iAnchorHorizOrigin = EAlfAnchorOriginLeft; + bottomRightAnchor.iAnchorVertiOrigin = EAlfAnchorOriginBottom; + + if( aStretch) + { + topLeftAnchor.iPosition = TAlfTimedPoint( aWidth, -aHeight ); + bottomRightAnchor.iPosition = TAlfTimedPoint( 0.0, 1.0 ); + } + else + { + topLeftAnchor.iPosition = + TAlfTimedPoint( aBorderMargin, -textureHeight ); + bottomRightAnchor.iPosition = + TAlfTimedPoint( textureWidth, aBorderMargin ); + } + + break; + } + case NGlxIconMgrDefs::EGlxIconBottomRight: + { + topLeftAnchor.iAnchorHorizOrigin = EAlfAnchorOriginRight; + topLeftAnchor.iAnchorVertiOrigin = EAlfAnchorOriginBottom; + + bottomRightAnchor.iAnchorHorizOrigin = EAlfAnchorOriginRight; + bottomRightAnchor.iAnchorVertiOrigin = EAlfAnchorOriginBottom; + + if( aStretch) + { + topLeftAnchor.iPosition = TAlfTimedPoint( -aWidth, -aHeight ); + bottomRightAnchor.iPosition = TAlfTimedPoint( 0.0, 0.0 ); + } + else + { + topLeftAnchor.iPosition = + TAlfTimedPoint( -textureWidth, -textureHeight ); + bottomRightAnchor.iPosition = + TAlfTimedPoint( -aBorderMargin, -aBorderMargin ); + } + + break; + } + case NGlxIconMgrDefs::EGlxIconCentred: + { + topLeftAnchor.iAnchorHorizOrigin = EAlfAnchorOriginHCenter; + topLeftAnchor.iAnchorVertiOrigin = EAlfAnchorOriginVCenter; + + bottomRightAnchor.iAnchorHorizOrigin = EAlfAnchorOriginHCenter; + bottomRightAnchor.iAnchorVertiOrigin = EAlfAnchorOriginVCenter; + + if( aStretch) + { + topLeftAnchor.iPosition = TAlfTimedPoint( -aWidth/2, -aHeight/2 ); + bottomRightAnchor.iPosition = TAlfTimedPoint( aWidth/2, aHeight/2 ); + } + else + { + topLeftAnchor.iPosition = + TAlfTimedPoint( -textureWidth/2, -textureHeight/2 ); + bottomRightAnchor.iPosition = + TAlfTimedPoint( textureWidth/2, textureHeight/2 ); + } + + break; + } + default: + { + + } + }; + + aAnchors.iTexture = &aTexture; + aAnchors.iTopLeftAnchor = topLeftAnchor; + aAnchors.iBotRightAnchor = bottomRightAnchor; + } + +// ----------------------------------------------------------------------------- +// FindExistingTexture +// ----------------------------------------------------------------------------- +// +TInt CGlxVisualObject::FindExistingTexture( const CAlfTexture& aTexture, + TBool aForeground ) + { + TRACER("CGlxVisualObject::FindExistingTexture"); + TGlxIconAnchors icon; + icon.iTexture = &aTexture; + + return ( aForeground ) + ? iForegroundIconAnchors.Find( icon, TGlxIconAnchors::Match ) + : iBackgroundIconAnchors.Find( icon, TGlxIconAnchors::Match ); + } + +// ----------------------------------------------------------------------------- +// DoRemoveIcon +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::DoRemoveIcon( CAlfAnchorLayout& aLayout, + RArray& aAnchorsArray, TInt aPos ) + { + TRACER("CGlxVisualObject::DoRemoveIcon"); + // First remove the icon visual + if ( aPos < aLayout.Count() ) + { + CAlfVisual* visual = &aLayout.Visual( aPos ); + visual->Owner().Remove( visual ); + delete visual; + } + + // after an icon has been removed from layout the anchor for all icons with + // positions in layout after that of removed icon will need to be updated + // due to HUI issue. + TInt count = aAnchorsArray.Count(); + + if ( aPos < count ) + { + // removed anchor information for icon that has been removed + aAnchorsArray.Remove( aPos ); + + count--; + + // reset anchors for remaining icons + // only for icons with positions that were after + // removed icon + for ( TInt i = aPos; i < count; i++ ) + { + SetAnchors( aAnchorsArray[i], aLayout, i ); + } + } + } + +// ----------------------------------------------------------------------------- +// UpdateIconAnchors +// ----------------------------------------------------------------------------- +// +void CGlxVisualObject::UpdateIconAnchors( const CAlfTexture& aTexture, TSize aVisSize ) + { + TRACER("CGlxVisualObject::UpdateIconAnchors"); + TInt iconCount = iForegroundIconAnchors.Count(); + + // only proceed if there are foreground icons + if( iconCount ) + { + TSize textureSize = aTexture.Size(); + + iVertIconOffset = 0.0; + iHoriIconOffset = 0.0; + + TReal32 visWidth = ( TReal32 )aVisSize.iWidth; + TReal32 visHeight = ( TReal32 )aVisSize.iHeight; + + TReal32 textWidth = ( TReal32 )textureSize.iWidth; + TReal32 textHeight = ( TReal32 )textureSize.iHeight; + + if( textWidth == 0 || textHeight == 0 ) + { + return; + } + + // compare aspect ratios between visual and texture + // and calculate either horizontal or vertical offset + if( (visWidth * textHeight ) < ( textWidth * visHeight ) ) + { + TInt dispHeight = textHeight * visWidth/textWidth; + + iVertIconOffset = ( visHeight - dispHeight ) / visHeight; + iVertIconOffset /= 2; + } + else + { + TInt dispWidth = textWidth * visHeight/textHeight; + + iHoriIconOffset = ( visWidth - dispWidth ) / visWidth; + iHoriIconOffset /= 2; + } + } + + // move anchor positon of foreground anchor layout + iVisual->SetRelativeAnchorRect( KGlxForegroundAnchorOrdinal, + EAlfAnchorOriginLeft, EAlfAnchorOriginTop, + TAlfRealPoint( iHoriIconOffset, iVertIconOffset), + EAlfAnchorOriginRight, EAlfAnchorOriginBottom, + TAlfRealPoint( -iHoriIconOffset, - iVertIconOffset)); + } + +// --------------------------------------------------------------------------- +// TGlxIconAnchors::Match +// --------------------------------------------------------------------------- +// +TBool CGlxVisualObject::TGlxIconAnchors::Match( + const TGlxIconAnchors& aIcon1, const TGlxIconAnchors& aIcon2 ) + { + TRACER("CGlxVisualObject::Match"); + return ( aIcon1.iTexture == aIcon2.iTexture ); + } + +void CGlxVisualObject::AddObserver( MGlxVisualObjectLayoutRefreshObserver* aObserver ) + { + TRACER("CGlxVisualObject::AddObserver"); + __ASSERT_DEBUG(iObservers.Find(aObserver) == KErrNotFound, + Panic(EGlxPanicIllegalArgument)); // Already exists + iObservers.Append(aObserver); + } + +void CGlxVisualObject::RemoveObserver( MGlxVisualObjectLayoutRefreshObserver* aObserver ) + { + TRACER("CGlxVisualObject::RemoveObserver"); + TInt i = iObservers.Find(aObserver); + if (i != KErrNotFound) + { + iObservers.Remove(i); + } + } + + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxvideoiconmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxvideoiconmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2008-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: Manager of visual lists +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + + +#include "glxvideoiconmanager.h" + +#include +//#include +#include +#include + +#include +#include + +#include // icons +#include +#include +#include +#include +#include +#include "mglxvisuallist.h" + +const TInt KGlxLargeVideoIconWidth = 30; +const TInt KGlxLargeVideoIconHeight = 169; + +const TInt KGlxSmallVideoIconWidth = 10; +const TInt KGlxSmallVideoIconHeight = 56; + +const TReal32 KGlxVideoIconWidth = 0.18; +const TReal32 KGlxVideoIconHeight = 1.0; + +// --------------------------------------------------------------------------- +// 1st phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxVideoIconManager* CGlxVideoIconManager::NewL( + MGlxMediaList& aMediaList, MGlxVisualList& aVisualList) + { + TRACER("CGlxVideoIconManager::NewL"); + GLX_LOG_INFO("CGlxVideoIconManager::NewL "); + CGlxVideoIconManager* self = + new(ELeave)CGlxVideoIconManager(aMediaList, aVisualList); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CGlxVideoIconManager::~CGlxVideoIconManager() + { + TRACER("CGlxVideoIconManager::~CGlxVideoIconManager"); + GLX_LOG_INFO("CGlxVideoIconManager::~CGlxVideoIconManager"); + iMediaList.RemoveMediaListObserver(this); + iVisualList.RemoveObserver(this); + } + +// --------------------------------------------------------------------------- +// HandleAttributesAvailableL +// --------------------------------------------------------------------------- +// +void CGlxVideoIconManager::HandleAttributesAvailableL(TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* /*aList*/) + { + TRACER("CGlxVideoIconManager::HandleAttributesAvailableL"); + GLX_LOG_INFO("CGlxVideoIconManager::HandleAttributesAvailableL "); + if ( KErrNotFound != aAttributes.Find(KMPXMediaGeneralCategory, + TMPXAttribute::Match) ) + { + AddIconIfVideoL( aItemIndex ); + } + } + +// --------------------------------------------------------------------------- +// HandleFocusChangedL +// --------------------------------------------------------------------------- +// +void CGlxVideoIconManager::HandleFocusChangedL( TInt aFocusIndex, TReal32 /*aItemsPerSecond*/, + MGlxVisualList* /*aList*/, NGlxListDefs::TFocusChangeType /*aType*/ ) + { + TRACER("CGlxVideoIconManager::HandleFocusChangedL"); + GLX_LOG_INFO("CGlxVideoIconManager::HandleFocusChangedL "); + if( aFocusIndex >= 0 && aFocusIndex < iMediaList.Count() ) + { + // replace video icon if necessary + if( iFocusIndex != KErrNotFound && iFocusIndex < iMediaList.Count() ) + { + AddIconIfVideoL( iFocusIndex ); + } + + iFocusIndex = aFocusIndex; + + AddIconIfVideoL( aFocusIndex ); + } + } + +// --------------------------------------------------------------------------- +// HandleVisualAddedL +// --------------------------------------------------------------------------- +// +void CGlxVideoIconManager::HandleVisualAddedL( CAlfVisual* /*aVisual*/, + TInt aIndex, MGlxVisualList* /*aList*/ ) + { + TRACER("CGlxVideoIconManager::HandleVisualAddedL"); + GLX_LOG_INFO("CGlxVideoIconManager::HandleVisualAddedL "); + if(aIndex >= 0 && aIndex < iMediaList.Count() ) + { + AddIconIfVideoL( aIndex ); + } + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxVideoIconManager::CGlxVideoIconManager(MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList) + : CGlxIconManager(aMediaList, aVisualList) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// 2nd phase construction +// --------------------------------------------------------------------------- +// +void CGlxVideoIconManager::ConstructL() + { + TRACER("CGlxVideoIconManager::ConstructL"); + GLX_LOG_INFO("CGlxVideoIconManager::ConstructL "); + BaseConstructL(); + + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + iLargeVideoIcon = &(iUiUtility->GlxTextureManager(). + CreateIconTextureL( EMbmGlxiconsQgn_indi_media_fullscreen_play, + resFile, TSize( KGlxLargeVideoIconWidth, + KGlxLargeVideoIconHeight ) ) ); + + iSmallVideoIcon = &(iUiUtility->GlxTextureManager(). + CreateIconTextureL( EMbmGlxiconsQgn_indi_media_fullscreen_play, + resFile, TSize( KGlxSmallVideoIconWidth, + KGlxSmallVideoIconHeight ) ) ); + + // add as observers + iMediaList.AddMediaListObserverL(this); + iVisualList.AddObserverL(this); + + + // check for any visual already present in list + TInt itemCount = iMediaList.Count(); + + iFocusIndex = iMediaList.FocusIndex(); + + for(TInt i = 0; i < itemCount; i++) + { + AddIconIfVideoL(i); + } + } + + +// --------------------------------------------------------------------------- +// AddIconIfVideoL +// --------------------------------------------------------------------------- +// +void CGlxVideoIconManager::AddIconIfVideoL( TInt aIndex ) + { + TRACER("CGlxVideoIconManager::AddIconIfVideoL"); + GLX_LOG_INFO("CGlxVideoIconManager::AddIconIfVideoL "); + TGlxMedia item = iMediaList.Item( aIndex ); + if( EMPXVideo == item.Category() ) + { + if( aIndex == iMediaList.FocusIndex() ) + { + iVisualList.RemoveIcon( aIndex, *iSmallVideoIcon ); + iVisualList.AddIconL( aIndex, *iLargeVideoIcon, + NGlxIconMgrDefs::EGlxIconTopLeft, ETrue, ETrue, 0, + KGlxVideoIconWidth, KGlxVideoIconHeight ); + } + else + { + iVisualList.RemoveIcon( aIndex, *iLargeVideoIcon ); + iVisualList.AddIconL( aIndex, *iSmallVideoIcon, + NGlxIconMgrDefs::EGlxIconTopLeft, ETrue, ETrue, 0, + KGlxVideoIconWidth, KGlxVideoIconHeight ); + } + } + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxvisualiconmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxvisualiconmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,467 @@ +/* +* Copyright (c) 2008-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: Manager of visual lists +* +*/ + + + + +/** + * @internal reviewed 31/07/2007 by Rowland Cook + */ + +#include "glxvisualiconmanager.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include // icons +#include +#include +#include +#include +#include +#include "mglxvisuallist.h" + +#include "glxitemvisual.h" + + +/// How long the image-loading animation should last for (in milliseconds) +const TInt KGlxImageLoadingAnimationDuration = 400 * KGlxAnimationSlowDownFactor; + + +// --------------------------------------------------------------------------- +// 1st phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxVisualIconManager* CGlxVisualIconManager::NewL( + MGlxMediaList& aMediaList, MGlxVisualList& aVisualList) + { + TRACER("CGlxVisualIconManager::NewL"); + GLX_LOG_INFO("CGlxVisualIconManager::NewL "); + // get the ui utility + CGlxUiUtility* utility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *utility ); + CGlxVisualIconManager* self = + new ( ELeave ) CGlxVisualIconManager( + utility->GlxTextureManager(), aMediaList, aVisualList); + CleanupStack::PopAndDestroy( utility ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxVisualIconManager::~CGlxVisualIconManager() + { + TRACER("CGlxVisualIconManager::~CGlxVisualIconManager"); + GLX_LOG_INFO("CGlxVisualIconManager::~CGlxVisualIconManager"); + // remove us from the medialist and visual list observer + iMediaList.RemoveMediaListObserver(this); + iVisualList.RemoveObserver( this ); + + TInt animCount = iAnimations.Count(); + + for ( TInt animIndex = 0; animIndex < animCount; animIndex++ ) + { + delete iAnimations[animIndex]; + } + iAnimations.Reset(); + + iIconTextureArray.Reset(); + + if( iWhiteTexture ) + { + iTextureManager.RemoveTexture( *iWhiteTexture ); + } + + iThumbnailIcons.Close(); + } + +// --------------------------------------------------------------------------- +// HandleVisualAddedL +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::HandleVisualAddedL( CAlfVisual* aVisual, + TInt aIndex, MGlxVisualList* aList ) + { + TRACER("CGlxVisualIconManager::HandleVisualAddedL"); + GLX_LOG_INFO("CGlxVisualIconManager::HandleVisualAddedL"); + if ( aIndex >= 0 && aIndex < iMediaList.Count() ) + { + CheckThumbnailAttributesL( aIndex ); + } + } + +// --------------------------------------------------------------------------- +// HandleError +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::HandleError( TInt aError ) + { + TRACER("CGlxVisualIconManager::HandleError"); + GLX_LOG_INFO1("CGlxVisualIconManager::HandleError: %d",aError); + TRAP_IGNORE( DoHandleErrorL( aError ) ); + } + +// --------------------------------------------------------------------------- +// DoHandleErrorL +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::DoHandleErrorL( TInt /*aError*/ ) + { + TRACER("CGlxVisualIconManager::DoHandleErrorL"); + GLX_LOG_INFO("CGlxVisualIconManager::DoHandleErrorL"); + // Check for items for which fetching a thumbnail has failed, and replace + // the default icon with broken icon + TInt count = iMediaList.Count(); + for ( TInt i = 0; i < count; i++ ) + { + CGlxVisualObject* visItem = iVisualList.Item( i ); + + // Only need to check that visual item exitst or not + if ( visItem ) + { + const CAlfTexture* iconTexture = SelectIconTextureL( i ); + + if ( iDefaultIconTexture != iconTexture ) + { + visItem->RemoveIcon( *iDefaultIconTexture ); + + visItem->SetStatus( CGlxVisualObject::EHasErrorIcon ); + visItem->AddIconL( *iconTexture, + NGlxIconMgrDefs::EGlxIconCentred, + ETrue, EFalse, 0, 1.0, 1.0 ); + visItem->SetScaleMode(CAlfImageVisual::EScaleNormal); + } + } + } + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CGlxVisualIconManager::CGlxVisualIconManager( + CGlxTextureManager& aTextureManager, + MGlxMediaList& aMediaList, + MGlxVisualList& aVisualList ) + : CGlxIconManager( aMediaList, aVisualList ), + iTextureManager( aTextureManager ) + { + TRACER("CGlxVisualIconManager::CGlxVisualIconManager"); + GLX_LOG_INFO("CGlxVisualIconManager::CGlxVisualIconManager"); + // No implementation + } + +// --------------------------------------------------------------------------- +// 2nd phase construction +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::ConstructL() + { + TRACER("CGlxVisualIconManager::ConstructL"); + GLX_LOG_INFO("CGlxVisualIconManager::ConstructL"); + BaseConstructL(); + + //iWhiteTexture = + // &( iTextureManager.CreateFlatColourTextureL( KRgbWhite ) ); + + // create 'default' icon + TFileName resFile(KDC_APP_BITMAP_DIR); + resFile.Append(KGlxIconsFilename); + // get the ui utility + CGlxUiUtility* utility = CGlxUiUtility::UtilityL(); + CleanupClosePushL( *utility ); + TSize iconSize = utility->GetGridIconSize(); + CleanupStack::PopAndDestroy( utility ); + iDefaultIconTexture = + &(iTextureManager.CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_notcreated, resFile, iconSize ) ); + + iBrokenIconTexture = + &(iTextureManager.CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_corrupted, resFile, iconSize ) ); + + iEmptyIconTexture = + &(iTextureManager.CreateIconTextureL( + EMbmGlxiconsQgn_prop_image_notcreated, resFile, iconSize ) ); + + // add as observers + iMediaList.AddMediaListObserverL(this); + iVisualList.AddObserverL(this); + + + // check for any visual already present in list + TInt itemCount = iMediaList.Count(); + for ( TInt i = 0; i < itemCount; i++ ) + { + CheckThumbnailAttributesL( i ); + } + } + +// --------------------------------------------------------------------------- +// CheckThumbnailAttributesL +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::CheckThumbnailAttributesL( TInt aIndex ) + { + TRACER("CGlxVisualIconManager::CheckThumbnailAttributesL"); + GLX_LOG_INFO1("CGlxVisualIconManager::CheckThumbnailAttributesL: %d",aIndex); + CGlxVisualObject* visItem = iVisualList.Item( aIndex ); + + if ( visItem ) + { + TBool thumbnail = visItem->SetObserver( *this ); + const TGlxMedia& item = iMediaList.Item( aIndex ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + + if ( thumbnail && thumbnailError == KErrNone ) + { + visItem->SetStatus( CGlxVisualObject::EHasThumbnail ); + } + else + { + const CAlfTexture* iconTexture = iDefaultIconTexture; + visItem->SetScaleMode(CAlfImageVisual::EScaleNormal); + TIconInfo icon; + if ( item.GetIconInfo( icon ) ) + { + // The item has its own icon + // In this case we treat the icon as a thumbnail + // i.e. we want it to scale appropriate to its + // position in the view + visItem->SetStatus( CGlxVisualObject::EHasOtherIcon ); + + GLX_ASSERT_DEBUG( iThumbnailIcons.Count() == iIconTextureArray.Count(), + Panic( EGlxPanicIllegalState ), "Icon array mismatch" ); + + // Check if icon texture already generated + TInt pos = iThumbnailIcons.Find( icon, MatchIcon ); + + if ( pos == KErrNotFound ) + { + // Ask texture manager to generate icon + /// @todo Should specify a size here + iconTexture = + &iUiUtility->GlxTextureManager().CreateIconTextureL( + icon.bitmapId, icon.bmpfile ); + + iThumbnailIcons.ReserveL( iThumbnailIcons.Count() + 1 ); + iIconTextureArray.AppendL( iconTexture ); + // Can't fail because of reservation + iThumbnailIcons.AppendL( icon ); + } + else + { + iconTexture = iIconTextureArray[pos]; + } + // add to visual + //@Migration info: Required? + //visItem->SetImage( THuiImage( *iconTexture ) ); + } + else + { + iconTexture = SelectIconTextureL( aIndex ); + if ( iDefaultIconTexture == iconTexture ) + { + visItem->SetStatus( CGlxVisualObject::EHasDefaultIcon ); + } + else + { + visItem->SetStatus( CGlxVisualObject::EHasErrorIcon ); + } + // add to visual + visItem->AddIconL( *iconTexture, NGlxIconMgrDefs::EGlxIconCentred, + ETrue, EFalse, 0, 1.0, 1.0 ); + // } + } + } + } + } + + +// --------------------------------------------------------------------------- +// AnimateImageLoaded +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::AnimateImageLoadedL( CAlfVisual* aItemVisual) + { + TRACER("CGlxVisualIconManager::AnimateImageLoadedL"); + GLX_LOG_INFO("CGlxVisualIconManager::AnimateImageLoadedL"); + MGlxAnimation* anim = + GlxAnimationFactory::CreateImageLoadingAnimationL( *aItemVisual, *iWhiteTexture ); + + CleanupStack::PushL(anim); + iAnimations.InsertInAddressOrderL(anim); + CleanupStack::Pop(anim); + + anim->AnimateL( KGlxImageLoadingAnimationDuration, this ); + } + +// --------------------------------------------------------------------------- +// AnimationComplete +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::AnimationComplete(MGlxAnimation* aAnimation) + { + TRACER("CGlxVisualIconManager::AnimationComplete"); + GLX_LOG_INFO("CGlxVisualIconManager::AnimationComplete"); + TInt animIndex = iAnimations.FindInAddressOrder(aAnimation); + + if ( animIndex != KErrNotFound ) + { + iAnimations.Remove(animIndex); + } + + delete aAnimation; + } + +// --------------------------------------------------------------------------- +// IsDrmVideoItem to be done +// --------------------------------------------------------------------------- +// +TBool CGlxVisualIconManager::IsDrmVideoItem( const TGlxMedia& aItem ) + { + TRACER("CGlxVisualIconManager::IsDrmVideoItem"); + GLX_LOG_INFO("CGlxVisualIconManager::IsDrmVideoItem"); + if ( aItem.IsDrmProtected() && aItem.Category() == EMPXVideo ) + { + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// VisualStatusChangedL +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::VisualStatusChangedL( CGlxVisualObject& aObject, + TInt aListIndex, TBool aHasThumbnail ) + { + TRACER("CGlxVisualIconManager::VisualStatusChangedL"); + GLX_LOG_INFO("CGlxVisualIconManager::VisualStatusChangedL"); + // Note: The visual may not yet be in the visual list + + if ( aHasThumbnail ) + { + // Remove icons + if ( CGlxVisualObject::EHasDefaultIcon == aObject.Status() ) + { + aObject.RemoveIcon( *iDefaultIconTexture ); + } + else if ( CGlxVisualObject::EHasErrorIcon == aObject.Status() ) + { + aObject.RemoveIcon( *iBrokenIconTexture ); + aObject.RemoveIcon( *iEmptyIconTexture ); + } + + aObject.SetStatus( CGlxVisualObject::EHasThumbnail ); + } + else + { + if ( CGlxVisualObject::EHasThumbnail == aObject.Status() ) + { + const CAlfTexture* iconTexture = SelectIconTextureL( aListIndex ); + if ( iDefaultIconTexture == iconTexture ) + { + aObject.SetStatus( CGlxVisualObject::EHasDefaultIcon ); + } + else + { + aObject.SetStatus( CGlxVisualObject::EHasErrorIcon ); + } + + aObject.AddIconL( *iconTexture, NGlxIconMgrDefs::EGlxIconCentred, + ETrue, EFalse, 0, 1.0, 1.0 ); + aObject.SetScaleMode(CAlfImageVisual::EScaleNormal); + } + } + } + +// --------------------------------------------------------------------------- +// ThumbnailLoadedL +// --------------------------------------------------------------------------- +// +void CGlxVisualIconManager::ThumbnailLoadedL( CGlxVisualObject& aObject ) + { + TRACER("CGlxVisualIconManager::ThumbnailLoadedL"); + GLX_LOG_INFO("CGlxVisualIconManager::ThumbnailLoadedL"); + AnimateImageLoadedL( aObject.Visual() ); + } + +// --------------------------------------------------------------------------- +// SelectIconTextureL +// --------------------------------------------------------------------------- +// +const CAlfTexture* CGlxVisualIconManager::SelectIconTextureL( TInt aIndex ) + { + TRACER(" CGlxVisualIconManager::SelectIconTextureL"); + GLX_LOG_INFO(" CGlxVisualIconManager::SelectIconTextureL"); + const CAlfTexture* iconTexture = iDefaultIconTexture; + + const TGlxMedia& item = iMediaList.Item( aIndex ); + TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( + item.Properties(), KGlxMediaIdThumbnail ); + + if ( KErrGlxEmptyContainer == thumbnailError ) + { + iconTexture = iEmptyIconTexture; + } + else if ( KErrNone == thumbnailError || + // If the error is not supported display the default icon, not the corrupted icon. e.g. real media + thumbnailError == KErrNotSupported || + + IsDrmVideoItem( item ) ) + { + // Use default icon + // Test whether the item is a DRM'd video to fix error EDKZ-77UJZA + // as DRM'd videos should show the default icon not the broken icon + } + else + { + iconTexture = iBrokenIconTexture; + } + + return iconTexture; + } + +// --------------------------------------------------------------------------- +// MatchIcon +// --------------------------------------------------------------------------- +// +TBool CGlxVisualIconManager::MatchIcon( const TIconInfo& aIcon1, + const TIconInfo& aIcon2 ) + { + TRACER("CGlxVisualIconManager::MatchIcon"); + GLX_LOG_INFO("CGlxVisualIconManager::MatchIcon "); + return ( aIcon1.bmpfile == aIcon2.bmpfile && + aIcon1.bitmapId == aIcon2.bitmapId ); + } diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxvisuallistcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxvisuallistcontrol.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,802 @@ +/* +* Copyright (c) 2008-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: Visual list manager +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "glxvisuallistcontrol.h" +#include "mglxvisuallistobserver.h" +#include "glxvisuallistwindow.h" +#include "glxitemvisual.h" +#include "glxvisualiconmanager.h" // for iVisualIconManager +#include "mglxlayoutobserver.h" + +const TInt KMaxTimeBetweenNavigationsForSpeedConsideration = 2000; +const TInt KGlxVisualFetchOffset = 2; + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CGlxVisualListControl* CGlxVisualListControl::NewLC( + MGlxMediaList& aMediaList, + CAlfEnv& aEnv, + CAlfDisplay& aDisplay, + CAlfImageVisual::TScaleMode aThumbnailScaleMode ) + { + TRACER("CGlxVisualListControl::NewLC"); + GLX_LOG_INFO("CGlxVisualListControl::NewLC"); + CGlxVisualListControl* self = + new (ELeave) CGlxVisualListControl( + aMediaList, aEnv, aThumbnailScaleMode ); + CleanupStack::PushL(self); + self->ConstructL( aEnv, aDisplay ); + return self; + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxVisualListControl::CGlxVisualListControl( + MGlxMediaList& aMediaList, + CAlfEnv& aEnv, + CAlfImageVisual::TScaleMode aThumbnailScaleMode ) + : iMediaList(aMediaList ), + iEnv( aEnv ), + iScaleMode( aThumbnailScaleMode ) + { + TRACER("CGlxVisualListControl::CGlxVisualListControl"); + GLX_LOG_INFO("CGlxVisualListControl::CGlxVisualListControl"); + // set current time + TTime time; + time.HomeTime(); + iLastTime = time; + } + +// ----------------------------------------------------------------------------- +// ConstructL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::ConstructL( CAlfEnv& aEnv, + CAlfDisplay& aDisplay ) + { + TRACER("CGlxVisualListControl::ConstructL"); + GLX_LOG_INFO("CGlxVisualListControl::ConstructL"); + // call base class ConstructL + CAlfControl::ConstructL( aEnv ); + BindDisplay( aDisplay ); + iParentLayout = CAlfAnchorLayout::AddNewL(*this); + iParentLayout->SetFlags(EAlfVisualFlagLayoutUpdateNotification); + iParentLayout->EnableTransformationL(); + + iBorderBrush = CAlfBorderBrush::NewL( iEnv, 1, 1, 0, 0 ); + iBorderBrush->SetColor(KRgbBlack); + + iMediaList.AddMediaListObserverL( this ); + + iUiUtility = CGlxUiUtility::UtilityL(); + // create the visual list window + iVisualWindow = CGlxVisualListWindow::NewL(this,&iMediaList, iUiUtility, iScaleMode); + + //@todo below method not found + //iVisualWindow->SetOwnsObjects( ETrue ); + iControlGroupId = reinterpret_cast((void*)this); // @todo: Temp, have better logic for control group ids + iControlGroup = &Env().NewControlGroupL(iControlGroupId); + iControlGroup->AppendL(this); + + // The media list might not be empty, so add items if there are any + TInt count = iMediaList.Count(); + if (count > 0) + { + // add the items to the visual list first + HandleItemAddedL( 0, count - 1, &iMediaList ); + // then set the focus as media list may have been navigated before + iVisualWindow->SetFocusIndexL( iMediaList.FocusIndex() ); + } + iAttributeContext = CGlxDefaultAttributeContext::NewL(); + iAttributeContext->AddAttributeL(KMPXMediaGeneralUri); + iAttributeContext->AddAttributeL(KGlxMediaGeneralFramecount); + iAttributeContext->SetRangeOffsets(KGlxVisualFetchOffset, + KGlxVisualFetchOffset); + iMediaList.AddContextL( iAttributeContext, KGlxFetchContextPriorityLow ); + + + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxVisualListControl::~CGlxVisualListControl() + { + TRACER("CGlxVisualListControl::~CGlxVisualListControl"); + GLX_LOG_INFO("CGlxVisualListControl::~CGlxVisualListControl"); + // delete visual icon manager just in case + delete iVisualIconManager; + iVisualIconManager = NULL; + + // This control has to be removed from the control group, since deleting + // the control group also deletes the control (this object), and would + // delete the control twice. + if ( iControlGroup ) + { + iControlGroup->Remove(this); // Gives ownership to caller, but I'm being deleted anyway + Env().DeleteControlGroup(iControlGroupId); + iControlGroup = NULL; + } + + if ( iAttributeContext ) + { + iMediaList.RemoveContext( iAttributeContext ); + } + delete iAttributeContext; + iAttributeContext = NULL; + + // and media list observer + iMediaList.RemoveMediaListObserver( this ); + delete iVisualWindow; + iVisualWindow = NULL; + iContexts.Close(); + iObservers.Close(); + delete iBorderBrush; + iBorderBrush = NULL; + if ( iUiUtility ) + { + iUiUtility->Close(); + iUiUtility = NULL; + } + } + +// ----------------------------------------------------------------------------- +// AddReference +// ----------------------------------------------------------------------------- +// +TInt CGlxVisualListControl::AddReference() + { + TRACER("CGlxVisualListControl::AddReference"); + GLX_LOG_INFO("CGlxVisualListControl::AddReference"); + iReferenceCount++; + return iReferenceCount; + } + +// ----------------------------------------------------------------------------- +// RemoveReference +// ----------------------------------------------------------------------------- +// +TInt CGlxVisualListControl::RemoveReference() + { + TRACER("CGlxVisualListControl::RemoveReference"); + GLX_LOG_INFO("CGlxVisualListControl::RemoveReference"); + __ASSERT_ALWAYS(iReferenceCount > 0, Panic(EGlxPanicLogicError)); + iReferenceCount--; + return iReferenceCount; + } + +// ----------------------------------------------------------------------------- +// MediaList +// ----------------------------------------------------------------------------- +// +const MGlxMediaList& CGlxVisualListControl::MediaList() const + { + TRACER("CGlxVisualListControl::MediaList"); + GLX_LOG_INFO("CGlxVisualListControl::MediaList"); + return iMediaList; + } + +// ----------------------------------------------------------------------------- +// Id +// ----------------------------------------------------------------------------- +// +TGlxVisualListId CGlxVisualListControl::Id() const + { + TRACER("CGlxVisualListControl::Id"); + GLX_LOG_INFO("CGlxVisualListControl::Id"); + return TGlxVisualListId(reinterpret_cast((void*)this)); + } + +// ----------------------------------------------------------------------------- +// Returns visual by index +// ----------------------------------------------------------------------------- +// +CAlfVisual* CGlxVisualListControl::Visual( TInt aListIndex ) + { + TRACER("CGlxVisualListControl::Visual"); + GLX_LOG_INFO("CGlxVisualListControl::Visual"); + CGlxVisualObject* visualObject = Item( aListIndex ); + if ( visualObject ) + { + return visualObject->Visual(); + } + return NULL; + } + +// ----------------------------------------------------------------------------- +// Returns visual by index +// ----------------------------------------------------------------------------- +// +CGlxVisualObject* CGlxVisualListControl::Item( TInt aListIndex ) + { + TRACER("CGlxVisualListControl::Item"); + GLX_LOG_INFO("CGlxVisualListControl::Item"); + return iVisualWindow->ObjectByIndex( aListIndex ); + } + +// ----------------------------------------------------------------------------- +// Returns item count +// ----------------------------------------------------------------------------- +// +TInt CGlxVisualListControl::ItemCount(NGlxListDefs::TCountType aType) const + { + TRACER("CGlxVisualListControl::ItemCount"); + GLX_LOG_INFO("CGlxVisualListControl::ItemCount"); + return iMediaList.Count(aType); + } + +// ----------------------------------------------------------------------------- +// Returns focus index +// ----------------------------------------------------------------------------- +// +TInt CGlxVisualListControl::FocusIndex() const + { + TRACER("CGlxVisualListControl::FocusIndex"); + GLX_LOG_INFO("CGlxVisualListControl::FocusIndex"); + return iMediaList.FocusIndex(); + } + +// ----------------------------------------------------------------------------- +// ControlGroup +// ----------------------------------------------------------------------------- +// +CAlfControlGroup* CGlxVisualListControl::ControlGroup() const + { + TRACER("CGlxVisualListControl::ControlGroup"); + GLX_LOG_INFO("CGlxVisualListControl::ControlGroup"); + return iControlGroup; + } + +// ----------------------------------------------------------------------------- +// AddContextL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::AddObserverL(MGlxVisualListObserver* aObserver) + { + TRACER("CGlxVisualListControl::AddObserverL"); + GLX_LOG_INFO("CGlxVisualListControl::AddObserverL"); + __ASSERT_DEBUG(iObservers.Find(aObserver) == KErrNotFound, + Panic(EGlxPanicIllegalArgument)); // Already exists + iObservers.Append(aObserver); + } + +// ----------------------------------------------------------------------------- +// AddContextL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::RemoveObserver(MGlxVisualListObserver* aObserver) + { + TRACER("CGlxVisualListControl::RemoveObserver"); + GLX_LOG_INFO("CGlxVisualListControl::RemoveObserver"); + TInt i = iObservers.Find(aObserver); + if (i != KErrNotFound) + { + iObservers.Remove(i); + } + } + +// ----------------------------------------------------------------------------- +// AddContextL +// ----------------------------------------------------------------------------- +// +TGlxViewContextId CGlxVisualListControl::AddContextL( + TInt aFrontVisibleRangeOffset, TInt aRearVisibleRangeOffset ) + { + TRACER("CGlxVisualListControl::AddContextL"); + GLX_LOG_INFO("CGlxVisualListControl::AddContextL"); + iContexts.ReserveL( iContexts.Count() + 1 ); + TGlxViewContextId nextId; + iContextIdProvider.NextId(nextId); + + // Add the context to define which visuals should be created + TContext context; + context.iId = nextId; + context.iFrontVisibleRangeOffset = aFrontVisibleRangeOffset; + context.aRearVisibleRangeOffset = aRearVisibleRangeOffset; + iContexts.Append(context); // Cannot fail thanks to reservation + + // Combine the contexts, and update the window + TInt frontOffset = 0; + TInt rearOffset = 0; + RangeOffsets(frontOffset, rearOffset); + iVisualWindow->SetRangeOffsetsL(frontOffset, rearOffset); + + iVisualWindow->UpdatePositions(); + + return nextId; + } + +// ----------------------------------------------------------------------------- +// RemoveContext +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::RemoveContext(const TGlxViewContextId& aContextId) + { + TRACER("CGlxVisualListControl::RemoveContext"); + GLX_LOG_INFO("CGlxVisualListControl::RemoveContext"); + // Remove context + TInt count = iContexts.Count(); + TInt i; + for (i = 0; i < count; i++) + { + if (iContexts[i].iId == aContextId) + { + iContexts.Remove(i); + break; + } + } + __ASSERT_DEBUG(i != count, Panic(EGlxPanicIllegalArgument)); // No such context + + // Combine the contexts, and update the window + TInt frontOffset = 0; + TInt rearOffset = 0; + RangeOffsets(frontOffset, rearOffset); + // This can actually never fail (read CVieListWindow header). Trapped in case maintenance + // changes change the behavior of window base class + TRAP_IGNORE(iVisualWindow->SetRangeOffsetsL(frontOffset, rearOffset)); + } + +// ----------------------------------------------------------------------------- +// RangeOffsets +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::RangeOffsets(TInt& aFrontOffset, TInt& aRearOffsets) + { + TRACER("CGlxVisualListControl::RangeOffsets"); + GLX_LOG_INFO("CGlxVisualListControl::RangeOffsets"); + // Combine the contexts, and update the window + aFrontOffset = 0; + aRearOffsets = 0; + + TInt count = iContexts.Count(); + for (TInt i = 0; i < count; i++) + { + TContext& context = iContexts[i]; + // Pick smallest start offset + aFrontOffset = Min(aFrontOffset, context.iFrontVisibleRangeOffset); + // Pick largest end offset + aRearOffsets = Max(aRearOffsets, context.aRearVisibleRangeOffset); + } + } + +// ----------------------------------------------------------------------------- +// AddLayoutL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::AddLayoutL(MGlxLayout* /*aLayout*/) + { + // add the layout to the blender + //iLayoutBlender.AddLayoutL( aLayout ); + } + +// ----------------------------------------------------------------------------- +// RemoveLayout +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::RemoveLayout(const MGlxLayout* /*aLayout*/) + { + // remove layout + //iLayoutBlender.RemoveLayout( aLayout ); + } + +// BringVisualsToFront +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::BringVisualsToFront() + { + TRACER("CGlxVisualListControl::BringVisualsToFront"); + GLX_LOG_INFO("CGlxVisualListControl::BringVisualsToFront"); + iUiUtility->Display()->Roster().MoveVisualToFront( *iParentLayout ); + } + +// ----------------------------------------------------------------------------- +// HandleItemAddedL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxVisualListControl::HandleItemAddedL"); + GLX_LOG_INFO("CGlxVisualListControl::HandleItemAddedL"); + iVisualWindow->AddObjects( aStartIndex, aEndIndex ); + iVisualWindow->UpdatePositions(); + } + +// ----------------------------------------------------------------------------- +// HandleMediaL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleMediaL(TInt /*aIndex*/, MGlxMediaList* aList) + { + TRACER("CGlxVisualListControl::HandleMediaL"); + GLX_LOG_INFO("CGlxVisualListControl::HandleMediaL"); + __ASSERT_DEBUG(aList == &iMediaList, Panic(EGlxPanicIllegalArgument)); + } + +// ----------------------------------------------------------------------------- +// HandleItemRemovedL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, + MGlxMediaList* /*aList*/) + { + TRACER("CGlxVisualListControl::HandleItemRemovedL"); + GLX_LOG_INFO("CGlxVisualListControl::HandleItemRemovedL"); + iVisualWindow->RemoveObjects( aStartIndex, aEndIndex ); + iVisualWindow->UpdatePositions(); + } + +// ----------------------------------------------------------------------------- +// HandleItemModifiedL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleItemModifiedL( + const RArray& /*aItemIndexes*/, MGlxMediaList* /*aList*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// HandleAttributesAvailableL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleAttributesAvailableL( TInt aItemIndex, + const RArray& aAttributes, MGlxMediaList* aList ) + { + TRACER("CGlxVisualListControl::HandleAttributesAvailableL"); + GLX_LOG_INFO("CGlxVisualListControl::HandleAttributesAvailableL"); + __ASSERT_DEBUG( aList == &iMediaList, Panic( EGlxPanicIllegalArgument ) ); + + // forward the attribute availability info to the matching visual object, + // if it exists in the window + CGlxVisualObject* visualObject = iVisualWindow->ObjectByIndex( aItemIndex ); + if( visualObject ) + { + visualObject->HandleAttributesAvailableL( aList->IdSpaceId( aItemIndex ), + aList->Item( aItemIndex ), aAttributes ); + } + } + +// ----------------------------------------------------------------------------- +// HandleFocusChangedL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleFocusChangedL( + NGlxListDefs::TFocusChangeType aType, + TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ) + { + TRACER("CGlxVisualListControl::HandleFocusChangedL"); + GLX_LOG_INFO("CGlxVisualListControl::HandleFocusChangedL"); + __ASSERT_DEBUG( aList == &iMediaList, Panic( EGlxPanicIllegalArgument ) ); + + iVisualWindow->SetFocusIndexL( aNewIndex ); + + // Move the focused visual to front to make sure focused visual is above + // other visuals + if ( aNewIndex >= 0 ) + { + iVisualWindow->ObjectByIndex( aNewIndex )->Visual()->MoveToFront(); + } + + // get the current time + TTime time_now; + time_now.HomeTime(); + // get the delta + TTimeIntervalMicroSeconds elapsed = time_now.MicroSecondsFrom( iLastTime ); + // set last time to be time now + iLastTime = time_now; + + TReal32 speed = 0; + // Only consider the focus change if there was a focus before + if ( aOldIndex != KErrNotFound + && elapsed < KMaxTimeBetweenNavigationsForSpeedConsideration ) + { + TInt indexesMoved = 0; + + if ( aType == NGlxListDefs::EForward ) + { + indexesMoved = aNewIndex - aOldIndex; + } + else if ( aType == NGlxListDefs::EBackward ) + { + indexesMoved = aOldIndex - aNewIndex; + } + else + { + // Client did not use NavigateL for setting the focus index => + // don't guess, instead provide no speed. + } + + if ( indexesMoved < 0 ) + { + indexesMoved += ItemCount(); + } + //speed = indexesMoved / elapsed; + } + + TInt count = iObservers.Count(); + for (TInt i = 0; i < count; i++) + { + iObservers[i]->HandleFocusChangedL( aNewIndex, speed, this, aType ); + } + } + +// ----------------------------------------------------------------------------- +// Handles item selection/deselection +// ----------------------------------------------------------------------------- +void CGlxVisualListControl::HandleItemSelectedL( TInt /*aIndex*/, + TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// Handles collection notification +// ----------------------------------------------------------------------------- +void CGlxVisualListControl::HandleMessageL( const CMPXMessage& /*aMessage*/, + MGlxMediaList* /*aList*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// NavigateL +// From MViuVisualOwner +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::NavigateL(TInt aIndexCount) + { + TRACER("CGlxVisualListControl::NavigateL"); + GLX_LOG_INFO("CGlxVisualListControl::NavigateL"); + if (aIndexCount == 0) + { + __ASSERT_DEBUG(EFalse, Panic(EGlxPanicIllegalArgument)); // no navigation to either direction + return; + } + iMediaList.SetFocusL(NGlxListDefs::ERelative, aIndexCount); + } + +// ----------------------------------------------------------------------------- +// NavigateL +// From MViuVisualOwner +// ----------------------------------------------------------------------------- +// + TSize CGlxVisualListControl::Size() const + { + TRACER("CGlxVisualListControl::Size"); + GLX_LOG_INFO("CGlxVisualListControl::Size"); + return iParentLayout->Size().Target().AsSize(); + } + +// ----------------------------------------------------------------------------- +// NavigateL +// From CHuiControl +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::VisualLayoutUpdated( CAlfVisual& aVisual ) + { + TRACER("CGlxVisualListControl::VisualLayoutUpdated"); + GLX_LOG_INFO("CGlxVisualListControl::VisualLayoutUpdated"); + if (&aVisual == iParentLayout) + { + TSize size = iParentLayout->Size().Target().AsSize(); + if(size != iCurrentLayoutSize) + { + iCurrentLayoutSize = size; + TInt count = iObservers.Count(); + for (TInt i = 0; i < count; i++) + { + iObservers[i]->HandleSizeChanged(size, this); + } + } + } + } + +// ----------------------------------------------------------------------------- +// HandleVisualRemoved +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleVisualRemoved(const CAlfVisual* aVisual) + { + TRACER("CGlxVisualListControl::HandleVisualRemoved"); + GLX_LOG_INFO("CGlxVisualListControl::HandleVisualRemoved"); + TInt count = iObservers.Count(); + for (TInt i = 0; i < count; i++) + { + iObservers[i]->HandleVisualRemoved(aVisual, this); + } + } + +// ----------------------------------------------------------------------------- +// HandleVisualRemoved +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::HandleVisualAddedL(CAlfVisual* aVisual, TInt aIndex) + { + TRACER("CGlxVisualListControl::HandleVisualAddedL"); + GLX_LOG_INFO("CGlxVisualListControl::HandleVisualAddedL"); + //iVisualWindow->ObjectByIndex(aIndex)->AddObserver(this); + TInt count = iObservers.Count(); + for (TInt i = 0; i < count; i++) + { + iObservers[i]->HandleVisualAddedL(aVisual, aIndex, this); + } + } + +// ----------------------------------------------------------------------------- +// EnableAnimationL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::EnableAnimationL(TBool aAnimate, TInt aIndex) + { + TRACER("CGlxVisualListControl::EnableAnimationL"); + GLX_LOG_INFO("CGlxVisualListControl::EnableAnimationL"); + CGlxVisualObject* visualObject = iVisualWindow->ObjectByIndex( aIndex ); + if ( visualObject ) + { + //iVisualWindow->ObjectByIndex(aIndex)->RemoveObserver(this); + if( aAnimate ) + { + visualObject->TryAnimateL( iMediaList.Item( aIndex ) ); + } + else + { + // Stop animation + visualObject->StopAnimation(); + visualObject->SetAnimateWhenAttributesAvailable( EFalse ); + } + } + } + +// ----------------------------------------------------------------------------- +// SetDefaultIconBehaviourL +// ----------------------------------------------------------------------------- +void CGlxVisualListControl::SetDefaultIconBehaviourL( TBool aEnable ) + { + TRACER("CGlxVisualListControl::SetDefaultIconBehaviourL"); + GLX_LOG_INFO("CGlxVisualListControl::SetDefaultIconBehaviourL"); + // do we want to disable + if( !aEnable ) + { + // disable by deleting it + delete iVisualIconManager; + // prevent double delete + iVisualIconManager = NULL; + } + // do we want to enable and we dont yet have icon manager + else if( !iVisualIconManager ) + { + iVisualIconManager = CGlxVisualIconManager::NewL( iMediaList, *this ); + } + else + { + } + } + +// ----------------------------------------------------------------------------- +// ThumbnailScaleMode +// ----------------------------------------------------------------------------- +// +CAlfImageVisual::TScaleMode CGlxVisualListControl::ThumbnailScaleMode() + { + TRACER("CGlxVisualListControl::ThumbnailScaleMode"); + GLX_LOG_INFO("CGlxVisualListControl::ThumbnailScaleMode"); + return iScaleMode; + } + +// ----------------------------------------------------------------------------- +// AddIconL +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::AddIconL( TInt aListIndex, const CAlfTexture& aTexture, + NGlxIconMgrDefs::TGlxIconPosition aIconPos, + TBool aForeground, TBool aStretch, TInt aBorderMargin, + TReal32 aWidth, TReal32 aHeight ) + { + TRACER("CGlxVisualListControl::AddIconL"); + GLX_LOG_INFO("CGlxVisualListControl::AddIconL"); + CGlxVisualObject* visItem = Item( aListIndex ); + if( visItem ) + { + visItem->AddIconL( aTexture, aIconPos, + aForeground, aStretch, aBorderMargin, aWidth, aHeight ); + } + } + +// ----------------------------------------------------------------------------- +// RemoveIconL +// ----------------------------------------------------------------------------- +// +TBool CGlxVisualListControl::RemoveIcon( TInt aListIndex, const CAlfTexture& aTexture ) + { + TRACER("CGlxVisualListControl::RemoveIcon"); + GLX_LOG_INFO("CGlxVisualListControl::RemoveIcon"); + TBool iconRemoved = EFalse; + + CGlxVisualObject* visItem = Item( aListIndex ); + if( visItem ) + { + iconRemoved = visItem->RemoveIcon( aTexture ); + } + + return iconRemoved; + } + +// ----------------------------------------------------------------------------- +// SetIconVisibility +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::SetIconVisibility( TInt aListIndex, + const CAlfTexture& aTexture, TBool aVisible ) + { + TRACER("CGlxVisualListControl::SetIconVisibility"); + GLX_LOG_INFO("CGlxVisualListControl::SetIconVisibility"); + CGlxVisualObject* visItem = Item( aListIndex ); + if( visItem ) + { + visItem->SetIconVisibility( aTexture, aVisible ); + } + } + +// ----------------------------------------------------------------------------- +// VisualObjectLayoutRefreshed +// ----------------------------------------------------------------------------- +// +void CGlxVisualListControl::VisualObjectLayoutRefreshed(TInt aListIndex ,TSize /*aScreensize*/) + { + TRACER("CGlxVisualListControl::VisualObjectLayoutRefreshed"); + GLX_LOG_INFO("CGlxVisualListControl::VisualObjectLayoutRefreshed"); + iLayoutObserver->UpdateLayout( * ( Visual ( aListIndex ) ) ); + } + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxvisuallistmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxvisuallistmanager.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2008-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: Visual list manager +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "mglxmedialist.h" + +#include "mglxvisuallistobserver.h" +#include "glxitemvisual.h" +#include "glxvisuallistcontrol.h" +#include "glxvisuallistmanager.h" + +/** + * CGlxVlmTls + * + * Global object stored in TLS. + * Owns the only instance of a Visual List Manager. + */ +struct CGlxVlmTls + { + CGlxVlmTls(CGlxVisualListManager* aListManager) + { + iListManager = aListManager; + iReferenceCount = 0; + } + + CGlxVisualListManager* iListManager; + TInt iReferenceCount; + }; + +// ----------------------------------------------------------------------------- +// ManagerL +// ----------------------------------------------------------------------------- +// +EXPORT_C CGlxVisualListManager* CGlxVisualListManager::ManagerL() + { + TRACER("CGlxVisualListManager::ManagerL"); + GLX_LOG_INFO("CGlxVisualListManager::ManagerL"); + CGlxVlmTls* tls = reinterpret_cast(Dll::Tls()); + + // Create tls struct if does not exist + if (tls == NULL) + { + // Create list manager instance + CGlxVisualListManager* lm = new (ELeave) CGlxVisualListManager(); + CleanupStack::PushL(lm); + tls = new (ELeave) CGlxVlmTls(lm); + + // MUST NOT LEAVE AFTER THIS POINT + CleanupStack::Pop(lm); + + Dll::SetTls( reinterpret_cast(tls)); + } + + // Add user + tls->iReferenceCount++; + + return tls->iListManager; + } + +// ----------------------------------------------------------------------------- +// Close +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxVisualListManager::Close() + { + + TRACER("CGlxVisualListManager::Close"); + GLX_LOG_INFO("CGlxVisualListManager::Close"); + CGlxVlmTls* tls = reinterpret_cast(Dll::Tls()); + __ASSERT_DEBUG(tls != NULL, Panic(EGlxPanicLogicError)); + __ASSERT_DEBUG(tls->iReferenceCount > 0, Panic(EGlxPanicLogicError)); // There's nothign to close + + if (tls != NULL) + { + tls->iReferenceCount--; + + // Delete the tls pointer and list manager instance if this was the + // last reference + if (tls->iReferenceCount == 0) + { + delete tls->iListManager; + delete tls; + Dll::SetTls(NULL); + } + } + } + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +CGlxVisualListManager::CGlxVisualListManager() + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CGlxVisualListManager::~CGlxVisualListManager() + { + iVisualLists.Close(); + } + +// ----------------------------------------------------------------------------- +// AllocListL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxVisualList* CGlxVisualListManager::AllocListL( + MGlxMediaList& aMediaList, CAlfEnv& aEnv, CAlfDisplay& aDisplay, + CAlfImageVisual::TScaleMode aThumbnailScaleMode ) + { + TRACER("CGlxVisualListManager::AllocListL"); + GLX_LOG_INFO("CGlxVisualListManager::AllocListL"); + __ASSERT_DEBUG( &aMediaList, Panic(EGlxPanicNullPointer)); + + CGlxVisualListControl* lc = CGlxVisualListControl::NewLC(aMediaList, + aEnv, aDisplay, aThumbnailScaleMode); + iVisualLists.AppendL(lc); + lc->AddReference(); // Add first user + CleanupStack::Pop(lc); + return lc; + } + +// ----------------------------------------------------------------------------- +// ListL +// ----------------------------------------------------------------------------- +// +EXPORT_C MGlxVisualList* CGlxVisualListManager::ListL( + MGlxMediaList& aItemList, + CAlfEnv& aEnv, CAlfDisplay& aDisplay, + CAlfImageVisual::TScaleMode aThumbnailScaleMode) + { + TRACER("CGlxVisualListManager::ListL"); + GLX_LOG_INFO("CGlxVisualListManager::ListL"); + __ASSERT_DEBUG( &aItemList, Panic(EGlxPanicNullPointer) ); + + // Try to find an existing visual list with the same media list + MGlxVisualList* visList = NULL; + + // search in existing list + TInt listCount = iVisualLists.Count(); + for ( TInt i = 0; i < listCount; i++ ) + { + if ( &iVisualLists[i]->MediaList() == &aItemList + && iVisualLists[i]->ThumbnailScaleMode() == aThumbnailScaleMode) + { + visList = iVisualLists[i]; + iVisualLists[i]->AddReference(); + break; + } + } + + // if not found allocate a new one + if ( !visList ) + { + visList = AllocListL(aItemList, aEnv, aDisplay, aThumbnailScaleMode); + } + + return visList; + } + +// ----------------------------------------------------------------------------- +// Removes a reference to the list, an deletes it if no more references remain +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGlxVisualListManager::ReleaseList(MGlxVisualList* aList) + { + TRACER("CGlxVisualListManager::ReleaseList"); + GLX_LOG_INFO("CGlxVisualListManager::ReleaseList"); + if (aList == NULL) + { + return; + } + + TGlxVisualListId id = aList->Id(); + TInt count = iVisualLists.Count(); + for (TInt i = 0; i < count; i++) + { + CGlxVisualListControl* list = iVisualLists[i]; + if (list->Id() == id) + { + TInt refsLeft = list->RemoveReference(); + if (refsLeft == 0) + { + // No users left, delete + delete list; + iVisualLists.Remove(i); + } + break; + } + } + } + + diff -r 000000000000 -r 4e91876724a2 photosgallery/viewframework/visuallistmanager/src/glxvisuallistwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/visuallistmanager/src/glxvisuallistwindow.cpp Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,299 @@ +/* +* Copyright (c) 2008-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: Visual list manager +* +*/ + + + + +/** + * @internal reviewed 04/07/2007 by M Byrne + */ + +#include "glxvisuallistwindow.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mglxmedialistobserver.h" +#include "glxuiutility.h" +#include "glxitemvisual.h" +#include +#include "glxvisuallistcontrol.h" +#include +#include +#include +#include +#include "glxlistwindow.h" +#include "glxitemvisual.h" +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +CGlxVisualListWindow* CGlxVisualListWindow::NewL( CGlxVisualListControl* aControl, + MGlxMediaList* aMediaList, CGlxUiUtility* aUiUtility, + CAlfImageVisual::TScaleMode aThumbnailScaleMode ) + { + TRACER("CGlxVisualListWindow::NewL"); + GLX_LOG_INFO("CGlxVisualListWindow::NewL"); + CGlxVisualListWindow* self = new (ELeave) CGlxVisualListWindow(); + CleanupStack::PushL( self ); + + self->iControl = aControl; + self->iMediaList = aMediaList; + self->iUiUtility = aUiUtility; + self->iScaleMode = aThumbnailScaleMode; + self->ConstructL(); // Construct base class + + CleanupStack::Pop( self ); + return self; + + } + + + CGlxVisualListWindow::CGlxVisualListWindow(): + CGlxListWindow( static_cast< MGlxWindowObjectFactory& > ( *this ) ) + { + + } + +CBase* CGlxVisualListWindow::CreateObjectL() const + { + TRACER("CGlxVisualListWindow::CreateObjectL"); + GLX_LOG_INFO("CGlxVisualListWindow::CreateObjectL"); + + CGlxVisualObject* object = CGlxVisualObject::NewLC( *(const_cast(this)) ,*iMediaList ); + CleanupStack::Pop( object ); + return object; + + } + + + void CGlxVisualListWindow::SetupObject(TInt aIndex, CBase& aObject ) + { + TRACER("CGlxVisualListWindow::SetupObject"); + GLX_LOG_INFO("CGlxVisualListWindow::SetupObject"); + TRAP_IGNORE(SetupObjectL( aIndex, aObject )); + } +// ----------------------------------------------------------------------------- +// SetupObjectL +// ----------------------------------------------------------------------------- +void CGlxVisualListWindow::SetupObjectL( TInt aIndex, CBase& aObject ) + { + TRACER("CGlxVisualListWindow::SetupObjectL 2"); + GLX_LOG_INFO("CGlxVisualListWindow::SetupObjectL 2"); + CGlxVisualObject& object = static_cast< CGlxVisualObject& >( aObject ); + // set the index + object.SetIndex( aIndex ); + + // No easy way to get rid of this trap. Would be possible to do + // multiple objects within the same trap by modifying the CGlxListWindowBase + // but would be surprising if this TRAP is a actually a performance problem + + // create texture from thumbnail + //TSize visSize = object.Visual()->Size().ValueNow().AsSize(); + TSize visSize =iUiUtility->DisplaySize(); + + CAlfTexture* texture = NULL; + + // media will be null if aMedia's Properties are not available + // so furtur operation need to be cancle + if ( iMediaList->Item( aIndex ).Properties() == NULL) + { + texture = &iUiUtility->Env()->TextureManager().BlankTexture(); + } + else + { + TRAPD(err, texture = &iUiUtility->GlxTextureManager().CreateThumbnailTextureL( + iMediaList->Item( aIndex ),iMediaList->IdSpaceId( aIndex ), visSize, &object )); + if(err != KErrNone) + { + texture = &iUiUtility->Env()->TextureManager().BlankTexture(); + } + } + // add the texture and its id for the visual object + object.SetImage(TAlfImage( *texture )); + + TSize imageSize ; + iMediaList->Item( aIndex ).GetDimensions(imageSize); + // Set scale mode to EScaleFitInside if the Image is bigger then screen + // or to scale the grid size thumbnails if full thumbnail is not available while fast swipe + if ( imageSize.iWidth >= visSize.iWidth || imageSize.iHeight >= visSize.iHeight + ||(texture->Size().iHeight < imageSize.iHeight && texture->Size().iWidth < imageSize.iWidth )) + { + object.SetScaleMode(CAlfImageVisual::EScaleFitInside); + } + + // show the object. do this before notifying control, to show + // at the image if control leaves + object.SetVisible( ETrue ); + + // notify observer + iControl->HandleVisualAddedL( object.Visual(), aIndex ); + } + + void CGlxVisualListWindow::CleanupObject(TInt aListIndex, CBase& aObject) + { + TRACER("CGlxVisualListWindow::CleanupObject"); + GLX_LOG_INFO("CGlxVisualListWindow::CleanupObject"); + CGlxVisualObject& object = static_cast< CGlxVisualObject& >( aObject ); + + object.Reset(); + + iControl->HandleVisualRemoved( object.Visual() ); + } + +// ----------------------------------------------------------------------------- +// GetObjectL +// ----------------------------------------------------------------------------- +CGlxVisualObject* CGlxVisualListWindow::GetObjectL( TInt aListIndex ) + { + TRACER("CGlxVisualListWindow::GetObjectL"); + GLX_LOG_INFO1("CGlxVisualListWindow::GetObjectL %d", aListIndex); + // create the object + CGlxVisualObject* listObj = + CGlxVisualObject::NewLC( *this, *iMediaList ); + CleanupStack::Pop( listObj ); + return listObj; + } + +// ----------------------------------------------------------------------------- +// CleanupObject +// ----------------------------------------------------------------------------- +void CGlxVisualListWindow::CleanupObject( TInt aWindowIndex ) + { + TRACER("CGlxVisualListWindow::CleanupObject 2"); + GLX_LOG_INFO1("CGlxVisualListWindow::CleanupObject 2 %d",aWindowIndex); + CGlxVisualObject* item = ObjectByIndex( aWindowIndex); + CAlfVisual* visual = item->Visual(); + + iControl->HandleVisualRemoved( visual ); + } + +// ----------------------------------------------------------------------------- +// PostObjectsAdded +// ----------------------------------------------------------------------------- +void CGlxVisualListWindow::PostObjectsAdded( RArray& aAddedAtListIndexes ) + { + /* + TInt count = aAddedAtListIndexes.Count(); + // step through array and notify our observers + // cant leave so need to just ignore the error + TRAP_IGNORE( + { + for(TInt i = 0; i < count; i++ ) + { + TInt listIdx = aAddedAtListIndexes[i]; + //TInt idx = ListIndexToWindowIndex( listIdx ); + //CGlxVisualObject* item = ObjectByIndex( idx); + //iControl->HandleVisualAddedL( item->Visual(), listIdx ); + } + }); + */ + } + +// ----------------------------------------------------------------------------- +// SetFocusIndexL +// ----------------------------------------------------------------------------- +void CGlxVisualListWindow::SetFocusIndexL( TInt aFocusIndex ) + { + TRACER("CGlxVisualListWindow::SetFocusIndexL"); + GLX_LOG_INFO1("CGlxVisualListWindow::SetFocusIndexL %d",aFocusIndex); + CGlxListWindow::SetFocusIndex( aFocusIndex ); + + UpdatePositions(); + + } + +// ----------------------------------------------------------------------------- +// UpdatePositions +// ----------------------------------------------------------------------------- +void CGlxVisualListWindow::UpdatePositions() + { + TRACER("CGlxVisualListWindow::UpdatePositions"); + GLX_LOG_INFO("CGlxVisualListWindow::UpdatePositions"); + // Set positions of items in the window to current list index. + TGlxWindowIterator iterator = Iterator(); + TInt index = 0; + while ( KErrNotFound != ( index = iterator++ ) ) + { + CGlxVisualObject* visualObj = ObjectByIndex( index ); + // set index for the visual + visualObj->SetIndex( index ); + // get screen size + TSize screenSize = iUiUtility->DisplaySize(); + // update the layout data + visualObj->RefreshLayout(screenSize); + } + } + +// ----------------------------------------------------------------------------- +// Layout +// ----------------------------------------------------------------------------- +CAlfLayout* CGlxVisualListWindow::Layout() + { + TRACER("CGlxVisualListWindow::Layout"); + GLX_LOG_INFO("CGlxVisualListWindow::Layout"); + return static_cast(iControl->iParentLayout); + } + +// ----------------------------------------------------------------------------- +// VisualOwner +// ----------------------------------------------------------------------------- +CAlfControl& CGlxVisualListWindow::VisualOwner() + { + TRACER("CGlxVisualListWindow::VisualOwner"); + GLX_LOG_INFO("CGlxVisualListWindow::VisualOwner"); + return *iControl; + } + +// ----------------------------------------------------------------------------- +// BorderBrush +// ----------------------------------------------------------------------------- +CAlfBrush* CGlxVisualListWindow::BorderBrush() + { + TRACER("CGlxVisualListWindow::BorderBrush"); + GLX_LOG_INFO("CGlxVisualListWindow::BorderBrush"); + return iControl->iBorderBrush; + } + +// ----------------------------------------------------------------------------- +// ThumbnailScaleMode +// ----------------------------------------------------------------------------- +CAlfImageVisual::TScaleMode CGlxVisualListWindow::ThumbnailScaleMode() + { + TRACER("CGlxVisualListWindow::ThumbnailScaleMode"); + GLX_LOG_INFO("CGlxVisualListWindow::ThumbnailScaleMode"); + return iScaleMode; + } + +// ----------------------------------------------------------------------------- +// Return visual object by index +// ----------------------------------------------------------------------------- +CGlxVisualObject* CGlxVisualListWindow::ObjectByIndex( TInt aIndex ) + { + TRACER("CGlxVisualListWindow::ObjectByIndex"); + GLX_LOG_INFO("CGlxVisualListWindow::ObjectByIndex"); + return static_cast< CGlxVisualObject* >( At( aIndex ) ); + } + diff -r 000000000000 -r 4e91876724a2 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +